message stringlengths 2 20.1k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 1.95k 109k | cluster float64 17 17 | __index_level_0__ int64 3.91k 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tourname... | instruction | 0 | 81,627 | 17 | 163,254 |
Yes | output | 1 | 81,627 | 17 | 163,255 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tourname... | instruction | 0 | 81,628 | 17 | 163,256 |
Yes | output | 1 | 81,628 | 17 | 163,257 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tourname... | instruction | 0 | 81,629 | 17 | 163,258 |
Yes | output | 1 | 81,629 | 17 | 163,259 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tourname... | instruction | 0 | 81,630 | 17 | 163,260 |
No | output | 1 | 81,630 | 17 | 163,261 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tourname... | instruction | 0 | 81,631 | 17 | 163,262 |
No | output | 1 | 81,631 | 17 | 163,263 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tourname... | instruction | 0 | 81,632 | 17 | 163,264 |
No | output | 1 | 81,632 | 17 | 163,265 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tourname... | instruction | 0 | 81,633 | 17 | 163,266 |
No | output | 1 | 81,633 | 17 | 163,267 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
A team is to be formed of n players, all of whi... | instruction | 0 | 81,737 | 17 | 163,474 |
Tags: combinatorics, dp, math, probabilities
Correct Solution:
```
n, m, h = map(int, input().split())
s = list(map(int, input().split()))
ans = 1
for i in range(sum(s) - 1, sum(s) - s[h - 1], -1):
ans *= (i - n + 1) / i
print (1 - ans if sum(s) >= n else -1)
``` | output | 1 | 81,737 | 17 | 163,475 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
A team is to be formed of n players, all of whi... | instruction | 0 | 81,738 | 17 | 163,476 |
Tags: combinatorics, dp, math, probabilities
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi, ceil, log, inf
from itertools import p... | output | 1 | 81,738 | 17 | 163,477 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
A team is to be formed of n players, all of whi... | instruction | 0 | 81,739 | 17 | 163,478 |
Tags: combinatorics, dp, math, probabilities
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
def main():
n,m,h = map(int,input().split())
s = list(map(int,input().split()))
x = sum(s)
if x < n:
print(-1)
else:
... | output | 1 | 81,739 | 17 | 163,479 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
A team is to be formed of n players, all of whi... | instruction | 0 | 81,740 | 17 | 163,480 |
Tags: combinatorics, dp, math, probabilities
Correct Solution:
```
def fact(x):
ans = 1
for i in range(1, x + 1):
ans *= i
return ans
def C(x, y):
return fact(x) // fact(y) // fact(x - y)
m, n, h = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
h -= 1
if(s < m):
print(-1)
elif(s ==... | output | 1 | 81,740 | 17 | 163,481 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
A team is to be formed of n players, all of whi... | instruction | 0 | 81,741 | 17 | 163,482 |
Tags: combinatorics, dp, math, probabilities
Correct Solution:
```
def nck(n,k):
if(n<k):
return 0
num=1
den=1
if(k>n-k):
return nck(n,n-k)
for i in range(k):
num=num*(n-i)
den=den*(i+1)
return num//den
l=input().split()
n=int(l[0])
m=int(l[1])
h=int(l[2])
l=input... | output | 1 | 81,741 | 17 | 163,483 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
A team is to be formed of n players, all of whi... | instruction | 0 | 81,742 | 17 | 163,484 |
Tags: combinatorics, dp, math, probabilities
Correct Solution:
```
#!/usr/bin/env python3
from functools import reduce
from operator import mul
from fractions import Fraction
def nCk(n,k):
return int( reduce(mul, (Fraction(n-i, i+1) for i in range(k)), 1) )
def divide(a, b):
return float(Fraction(a, b))
def ... | output | 1 | 81,742 | 17 | 163,485 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
A team is to be formed of n players, all of whi... | instruction | 0 | 81,743 | 17 | 163,486 |
Tags: combinatorics, dp, math, probabilities
Correct Solution:
```
n, _, h = [int(x) for x in input().split()]
s = [int(x) for x in input().split()]
h -= 1
n -= 1
s[h] -= 1
st = sum(s) - s[h]
if st + s[h] < n:
print(-1)
elif n == 0:
print(0)
elif st < n:
print(1)
elif st == 0:
print(0 if s[h] == 0 el... | output | 1 | 81,743 | 17 | 163,487 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
A team is to be formed of n players, all of whi... | instruction | 0 | 81,744 | 17 | 163,488 |
Tags: combinatorics, dp, math, probabilities
Correct Solution:
```
import math
def binom(k, n):
ret = 1
for i in range(0, k):
ret = ret * (n-i) // (i+1)
return ret
[n, m, h] = map(int, input().split())
l = list(map(int, input().split()))
t = sum(l) - 1
n = n - 1
l[h-1] = l[h-1] - 1
p = t - l[h-1]
if n > t:... | output | 1 | 81,744 | 17 | 163,489 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
... | instruction | 0 | 81,745 | 17 | 163,490 |
Yes | output | 1 | 81,745 | 17 | 163,491 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
... | instruction | 0 | 81,746 | 17 | 163,492 |
Yes | output | 1 | 81,746 | 17 | 163,493 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
... | instruction | 0 | 81,747 | 17 | 163,494 |
Yes | output | 1 | 81,747 | 17 | 163,495 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
... | instruction | 0 | 81,748 | 17 | 163,496 |
Yes | output | 1 | 81,748 | 17 | 163,497 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
... | instruction | 0 | 81,749 | 17 | 163,498 |
No | output | 1 | 81,749 | 17 | 163,499 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
... | instruction | 0 | 81,750 | 17 | 163,500 |
No | output | 1 | 81,750 | 17 | 163,501 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
... | instruction | 0 | 81,751 | 17 | 163,502 |
No | output | 1 | 81,751 | 17 | 163,503 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
... | instruction | 0 | 81,752 | 17 | 163,504 |
No | output | 1 | 81,752 | 17 | 163,505 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* the game may result in a tie, then both teams get... | instruction | 0 | 81,950 | 17 | 163,900 |
Tags: brute force, constructive algorithms, dfs and similar, graphs, greedy, implementation, math
Correct Solution:
```
from sys import stdin, gettrace
if gettrace():
def inputi():
return input()
else:
def input():
return next(stdin)[:-1]
def inputi():
return stdin.buffer.readline... | output | 1 | 81,950 | 17 | 163,901 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* the game may result in a tie, then both teams get... | instruction | 0 | 81,951 | 17 | 163,902 |
Tags: brute force, constructive algorithms, dfs and similar, graphs, greedy, implementation, math
Correct Solution:
```
####################################################
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
... | output | 1 | 81,951 | 17 | 163,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* the game may result in a tie, then both teams get... | instruction | 0 | 81,952 | 17 | 163,904 |
Tags: brute force, constructive algorithms, dfs and similar, graphs, greedy, implementation, math
Correct Solution:
```
# ANKIT BEHIND
import math
t=int(input())
for i in range(0,t):
n=int(input())
ans=[]
if(n%2!=0):
for i in range(0,(n*(n-1)//2)):
if(i%2==0):
ans.appen... | output | 1 | 81,952 | 17 | 163,905 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* the game may result in a tie, then both teams get... | instruction | 0 | 81,953 | 17 | 163,906 |
Tags: brute force, constructive algorithms, dfs and similar, graphs, greedy, implementation, math
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO,IOBase
def some_random_function():
"""due to the fast IO template, my code gets caught in
... | output | 1 | 81,953 | 17 | 163,907 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* the game may result in a tie, then both teams get... | instruction | 0 | 81,954 | 17 | 163,908 |
Tags: brute force, constructive algorithms, dfs and similar, graphs, greedy, implementation, math
Correct Solution:
```
from math import ceil,floor,log
import sys
from heapq import heappush,heappop
from collections import Counter,defaultdict,deque
input=lambda : sys.stdin.readline().strip()
c=lambda x: 10**9 if(x=="?")... | output | 1 | 81,954 | 17 | 163,909 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* the game may result in a tie, then both teams get... | instruction | 0 | 81,955 | 17 | 163,910 |
Tags: brute force, constructive algorithms, dfs and similar, graphs, greedy, implementation, math
Correct Solution:
```
for _ in range(int(input())):
n=int(input())
x=(n*(n-1))//2
z=[0]*n
k=x//n
y=[]
for i in range(n):
for j in range(i+1,n):
if z[i]<k:
z[i]+=1... | output | 1 | 81,955 | 17 | 163,911 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* the game may result in a tie, then both teams get... | instruction | 0 | 81,956 | 17 | 163,912 |
Tags: brute force, constructive algorithms, dfs and similar, graphs, greedy, implementation, math
Correct Solution:
```
from sys import stdin, setrecursionlimit, stdout
#setrecursionlimit(100000) #use "python" instead of "pypy" to avoid MLE
from collections import deque
from math import sqrt, floor, ceil, log, log2, lo... | output | 1 | 81,956 | 17 | 163,913 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* the game may result in a tie, then both teams get... | instruction | 0 | 81,957 | 17 | 163,914 |
Tags: brute force, constructive algorithms, dfs and similar, graphs, greedy, implementation, math
Correct Solution:
```
def solve(n):
t = [[None for i in range(n)] for j in range(n)]
for i in range(n):
for j in range(i+1,n):
if(j==i+1 and n&1==0 and i&1==0):
t[i][j] = 0
t[j][i] = 0
elif(i&1==0):... | output | 1 | 81,957 | 17 | 163,915 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* th... | instruction | 0 | 81,958 | 17 | 163,916 |
Yes | output | 1 | 81,958 | 17 | 163,917 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* th... | instruction | 0 | 81,959 | 17 | 163,918 |
Yes | output | 1 | 81,959 | 17 | 163,919 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* th... | instruction | 0 | 81,960 | 17 | 163,920 |
Yes | output | 1 | 81,960 | 17 | 163,921 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* th... | instruction | 0 | 81,961 | 17 | 163,922 |
Yes | output | 1 | 81,961 | 17 | 163,923 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* th... | instruction | 0 | 81,962 | 17 | 163,924 |
No | output | 1 | 81,962 | 17 | 163,925 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* th... | instruction | 0 | 81,963 | 17 | 163,926 |
No | output | 1 | 81,963 | 17 | 163,927 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* th... | instruction | 0 | 81,964 | 17 | 163,928 |
No | output | 1 | 81,964 | 17 | 163,929 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.
There are two possible outcomes of a game:
* th... | instruction | 0 | 81,965 | 17 | 163,930 |
No | output | 1 | 81,965 | 17 | 163,931 |
Provide a correct Python 3 solution for this coding contest problem.
In 21XX, an annual programming contest, Japan Algorithmist GrandPrix (JAG) has become one of the most popular mind sports events.
JAG is conducted as a knockout tournament. This year, $N$ contestants will compete in JAG. A tournament chart is repres... | instruction | 0 | 82,526 | 17 | 165,052 |
"Correct Solution:
```
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return li... | output | 1 | 82,526 | 17 | 165,053 |
Provide a correct Python 3 solution for this coding contest problem.
In 21XX, an annual programming contest, Japan Algorithmist GrandPrix (JAG) has become one of the most popular mind sports events.
JAG is conducted as a knockout tournament. This year, $N$ contestants will compete in JAG. A tournament chart is repres... | instruction | 0 | 82,527 | 17 | 165,054 |
"Correct Solution:
```
import re
def main():
s = input()
d = {}
n = len(re.findall(r'\w', s))
for i in range(n):
a, v = input().split()
v = int(v)
d[a] = v
prog = re.compile(r'\[(\w)-(\w)\]')
m = prog.search(s)
while m is not None:
c1, c2 = m.group(1, 2)
... | output | 1 | 82,527 | 17 | 165,055 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A football league has recently begun in Beautiful land. There are n teams participating in the league. Let's enumerate them with integers from 1 to n.
There will be played exactly (n(n-1))/(2) ... | instruction | 0 | 82,708 | 17 | 165,416 |
No | output | 1 | 82,708 | 17 | 165,417 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive.
Before the university programming championship the coach wants to split all students into gro... | instruction | 0 | 82,874 | 17 | 165,748 |
Tags: brute force, dfs and similar, graphs
Correct Solution:
```
import sys
nm = list(map(int, input().split()))
done = []
visited = []
for i in range(nm[1]):
pair = input().split()
if pair[0] not in visited and pair[1] not in visited:
done.append([pair[0],pair[1]])
visited.append(pair[0])
... | output | 1 | 82,874 | 17 | 165,749 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive.
Before the university programming championship the coach wants to split all students into gro... | instruction | 0 | 82,875 | 17 | 165,750 |
Tags: brute force, dfs and similar, graphs
Correct Solution:
```
#http://codeforces.com/problemset/problem/300/B
from collections import defaultdict
from itertools import islice
def finding_connected_component(graph, current_student):
stack = [current_student]
result = []
while stack:
student = st... | output | 1 | 82,875 | 17 | 165,751 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive.
Before the university programming championship the coach wants to split all students into gro... | instruction | 0 | 82,876 | 17 | 165,752 |
Tags: brute force, dfs and similar, graphs
Correct Solution:
```
import sys
from collections import defaultdict
def make_graph():
return defaultdict(make_graph)
def return_pair_sets(person, graph, used):
if person in used:
return []
used[person] = True
if person not in graph:
re... | output | 1 | 82,876 | 17 | 165,753 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive.
Before the university programming championship the coach wants to split all students into gro... | instruction | 0 | 82,877 | 17 | 165,754 |
Tags: brute force, dfs and similar, graphs
Correct Solution:
```
n,m=map(int,input().split())
from collections import defaultdict
e=defaultdict(list)
f,v=[False]*(n+1),[]
def dfs(i,s):
s.add(i)
f[i]=True
for k in e[i]:
if not f[k]:
dfs(k,s)
for j in range(m):
a,b=map(int,input().s... | output | 1 | 82,877 | 17 | 165,755 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive.
Before the university programming championship the coach wants to split all students into gro... | instruction | 0 | 82,878 | 17 | 165,756 |
Tags: brute force, dfs and similar, graphs
Correct Solution:
```
n, m = map(int, input().split())
visited = [False for i in range(n)]
g = [[] for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
g[a-1].append(b-1)
g[b-1].append(a-1)
def dfs(x, s):
s.add(x)
visited[x] = True
... | output | 1 | 82,878 | 17 | 165,757 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive.
Before the university programming championship the coach wants to split all students into gro... | instruction | 0 | 82,879 | 17 | 165,758 |
Tags: brute force, dfs and similar, graphs
Correct Solution:
```
n, m = map(int, input().split())
edges = [[*map(int, input().split())] for _ in range(m)]
parent = [*range(n)]
for i, j in edges:
if parent[i - 1] != parent[j - 1]:
old, new = parent[i - 1], parent[j - 1]
for j in range(n):
... | output | 1 | 82,879 | 17 | 165,759 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive.
Before the university programming championship the coach wants to split all students into gro... | instruction | 0 | 82,880 | 17 | 165,760 |
Tags: brute force, dfs and similar, graphs
Correct Solution:
```
n,m = map(int, input().split())
arr = [i for i in range(n+1)]
mem = {}
for i in range(m):
a,b = map(int, input().split())
if arr[a] in mem:
mem[arr[a]].append(arr[b])
arr[b] = arr[a]
elif arr[b] in mem:
mem[arr[b]].appe... | output | 1 | 82,880 | 17 | 165,761 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive.
Before the university programming championship the coach wants to split all students into gro... | instruction | 0 | 82,881 | 17 | 165,762 |
Tags: brute force, dfs and similar, graphs
Correct Solution:
```
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
from itertools import permutations
import heapq
#sys.setrecursionlimit(10**7)
# OneDrive\Documents\codeforces
I=sys.stdin.readline
alpha="abcd... | output | 1 | 82,881 | 17 | 165,763 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.