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.
The height of the student was measured at the medical examination. Create a program that takes height data as input, creates a frequency distribution, and outputs it. The frequency distribution ... | instruction | 0 | 12,416 | 17 | 24,832 |
Yes | output | 1 | 12,416 | 17 | 24,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The height of the student was measured at the medical examination. Create a program that takes height data as input, creates a frequency distribution, and outputs it. The frequency distribution ... | instruction | 0 | 12,417 | 17 | 24,834 |
Yes | output | 1 | 12,417 | 17 | 24,835 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Imur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged them all in a circle and held a draw to break ... | instruction | 0 | 12,467 | 17 | 24,934 |
Tags: binary search, interactive
Correct Solution:
```
USE_STDIO = True
import sys
if not USE_STDIO:
try: import mypc
except: pass
def get_two(x, n):
print('?', x)
sys.stdout.flush()
a = int(input())
x += n // 2
if x > n:
x -= n
print('?', x)
sys.stdout.flush()
b = int... | output | 1 | 12,467 | 17 | 24,935 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem.
Imur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged them all in a circle and held a draw to break ... | instruction | 0 | 12,468 | 17 | 24,936 |
Tags: binary search, interactive
Correct Solution:
```
from sys import stdout
n = int(input())
if n % 4 == 2:
print("! -1")
exit(0)
print("?", 1)
stdout.flush()
a = int(input())
print("?", 1 + n // 2)
stdout.flush()
b = int(input())
if a == b:
print("!", 1)
exit(0)
l = 1
r = 1 + n // 2
while(l != r):
... | output | 1 | 12,468 | 17 | 24,937 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Imur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged... | instruction | 0 | 12,469 | 17 | 24,938 |
No | output | 1 | 12,469 | 17 | 24,939 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Imur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged... | instruction | 0 | 12,470 | 17 | 24,940 |
No | output | 1 | 12,470 | 17 | 24,941 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Imur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged... | instruction | 0 | 12,471 | 17 | 24,942 |
No | output | 1 | 12,471 | 17 | 24,943 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem.
Imur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged... | instruction | 0 | 12,472 | 17 | 24,944 |
No | output | 1 | 12,472 | 17 | 24,945 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are numbered from 1 to n from left to right.
Since... | instruction | 0 | 14,249 | 17 | 28,498 |
Tags: greedy, math
Correct Solution:
```
t=int(input())
while(t):
n,x,a,b=map(int,input().split())
d=abs(a-b)
p=d+x
if p<n:
print(p)
else:
print(n-1)
t-=1
``` | output | 1 | 14,249 | 17 | 28,499 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are numbered from 1 to n from left to right.
Since... | instruction | 0 | 14,250 | 17 | 28,500 |
Tags: greedy, math
Correct Solution:
```
t=int(input())
for i in range(t):
n,x,a,b=input().split()
n,x,a,b=int(n),int(x),int(a),int(b)
if n>x+abs(a-b):
print(x+abs(a-b))
else:
print(n-1)
``` | output | 1 | 14,250 | 17 | 28,501 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are numbered from 1 to n from left to right.
Since... | instruction | 0 | 14,251 | 17 | 28,502 |
Tags: greedy, math
Correct Solution:
```
t = int(input())
for i in range(t):
n, x, a, b = map(int, input().split())
l = abs(a - b)
mx_l = n - 1
if mx_l - l - x <= 0:
print(mx_l)
else:
print(l+x)
``` | output | 1 | 14,251 | 17 | 28,503 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are numbered from 1 to n from left to right.
Since... | instruction | 0 | 14,252 | 17 | 28,504 |
Tags: greedy, math
Correct Solution:
```
t=int(input())
for i in range(t):
n,x,a,b=list(map(int,input().split()))
c=max(a,b)
a=min(a,b)
b=c
while b<n and x!=0:
b+=1
x-=1
#print(b)
#print(b)
while a>1 and x!=0:
a-=1
x-=1
#print(a)
#... | output | 1 | 14,252 | 17 | 28,505 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are numbered from 1 to n from left to right.
Since... | instruction | 0 | 14,253 | 17 | 28,506 |
Tags: greedy, math
Correct Solution:
```
for _ in range(int(input())):
n,x,a,b=map(int,input().split())
d=abs(a-b)
if(d==n-1):
print(d)
else:
print(min(n-1,d+x))
``` | output | 1 | 14,253 | 17 | 28,507 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are numbered from 1 to n from left to right.
Since... | instruction | 0 | 14,254 | 17 | 28,508 |
Tags: greedy, math
Correct Solution:
```
t = int(input())
result = str()
for i in range(t):
n, x, a, b = list(map(int, input().split()))
distance = abs(a - b) + x
if distance >= n:
distance = n - 1
result += f'\n{distance}'
print(result.strip())
``` | output | 1 | 14,254 | 17 | 28,509 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are numbered from 1 to n from left to right.
Since... | instruction | 0 | 14,255 | 17 | 28,510 |
Tags: greedy, math
Correct Solution:
```
for _ in range(int(input())):
n, x, a, b = map(int, input().split())
if a > b:
a, b = b, a
print(min(n - b + a - 1 + b - a, x + b - a))
``` | output | 1 | 14,255 | 17 | 28,511 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are numbered from 1 to n from left to right.
Since... | instruction | 0 | 14,256 | 17 | 28,512 |
Tags: greedy, math
Correct Solution:
```
t=int(input())
for x in range(t):
n,x,a,b=map(int,input().split())
a,b=min(a,b),max(a,b)
for x in range(x):
if a==1:
if b!=n:
b+=1
else:
a-=1
print(abs(a-b))
``` | output | 1 | 14,256 | 17 | 28,513 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are ... | instruction | 0 | 14,257 | 17 | 28,514 |
Yes | output | 1 | 14,257 | 17 | 28,515 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are ... | instruction | 0 | 14,258 | 17 | 28,516 |
Yes | output | 1 | 14,258 | 17 | 28,517 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are ... | instruction | 0 | 14,259 | 17 | 28,518 |
Yes | output | 1 | 14,259 | 17 | 28,519 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are ... | instruction | 0 | 14,260 | 17 | 28,520 |
Yes | output | 1 | 14,260 | 17 | 28,521 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are ... | instruction | 0 | 14,261 | 17 | 28,522 |
No | output | 1 | 14,261 | 17 | 28,523 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are ... | instruction | 0 | 14,262 | 17 | 28,524 |
No | output | 1 | 14,262 | 17 | 28,525 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are ... | instruction | 0 | 14,263 | 17 | 28,526 |
No | output | 1 | 14,263 | 17 | 28,527 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are the gym teacher in the school.
There are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are ... | instruction | 0 | 14,264 | 17 | 28,528 |
No | output | 1 | 14,264 | 17 | 28,529 |
Provide a correct Python 3 solution for this coding contest problem.
To write a research paper, you should definitely follow the structured format. This format, in many cases, is strictly defined, and students who try to write their papers have a hard time with it.
One of such formats is related to citations. If you ... | instruction | 0 | 16,760 | 17 | 33,520 |
"Correct Solution:
```
# AOJ 1051: Citation Format
# Python3 2018.7.7 bal4u
while True:
n = int(input())
if n == 0: break
p = list(map(int, input().split())) + [-1]
ans, s = [], p[0]
for i in range(1, n+1):
if p[i] != p[i-1]+1:
if s == p[i-1]: ans.append(str(s))
else: ans.append(str(s)+'-'+str(p[i-1]))
... | output | 1 | 16,760 | 17 | 33,521 |
Provide a correct Python 3 solution for this coding contest problem.
To write a research paper, you should definitely follow the structured format. This format, in many cases, is strictly defined, and students who try to write their papers have a hard time with it.
One of such formats is related to citations. If you ... | instruction | 0 | 16,761 | 17 | 33,522 |
"Correct Solution:
```
while True:
n = int(input())
if n == 0:
break
line = list(map(int, input().split()))
i = 0
while i < n:
j = i
while j+1 < n and line[j+1]-line[j] == 1:
j += 1
s = "\n" if n-1 == j else " "
if i == j:
print("%d%s" ... | output | 1 | 16,761 | 17 | 33,523 |
Provide a correct Python 3 solution for this coding contest problem.
To write a research paper, you should definitely follow the structured format. This format, in many cases, is strictly defined, and students who try to write their papers have a hard time with it.
One of such formats is related to citations. If you ... | instruction | 0 | 16,762 | 17 | 33,524 |
"Correct Solution:
```
while True:
n = int(input())
if n == 0:
break
pages = list(map(int, input().split()))
ans = ""
while pages:
for i in range(len(pages) - 1):
if pages[i + 1] - pages[i] != 1:
s = pages[:i+1]
if i == 0:
ans += " " + str(s[0])
else:
... | output | 1 | 16,762 | 17 | 33,525 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating their skills in watering. It is extremely expens... | instruction | 0 | 16,912 | 17 | 33,824 |
Tags: binary search, data structures, implementation, sortings, trees, two pointers
Correct Solution:
```
#!/usr/bin/env python
import operator as op
import os
import sys
from bisect import bisect_left, bisect_right, insort
from functools import reduce
from io import BytesIO, IOBase
from itertools import chain, repeat,... | output | 1 | 16,912 | 17 | 33,825 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating their skills in watering. It is extremely expens... | instruction | 0 | 16,913 | 17 | 33,826 |
Tags: binary search, data structures, implementation, sortings, trees, two pointers
Correct Solution:
```
from bisect import bisect_left
from sys import stdin, stdout
n, m, q = map(int, stdin.readline().split())
count = [0] * (m + 1)
a = []
for el in stdin.readline().split():
el = int(el)
a.append(count[el] * ... | output | 1 | 16,913 | 17 | 33,827 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating their skills in watering. It is extremely expens... | instruction | 0 | 16,914 | 17 | 33,828 |
Tags: binary search, data structures, implementation, sortings, trees, two pointers
Correct Solution:
```
from bisect import bisect_left as bl
import sys
N, M, Q = map(int, sys.stdin.readline().split())
count = [0] * (M + 1)
T = tuple(map(int, sys.stdin.readline().split()))
A = []
for t in T:
A.append(count[t] * M... | output | 1 | 16,914 | 17 | 33,829 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating their skills in watering. It is extremely expens... | instruction | 0 | 16,915 | 17 | 33,830 |
Tags: binary search, data structures, implementation, sortings, trees, two pointers
Correct Solution:
```
from bisect import bisect_left as bl
import sys
N, M, Q = map(int, sys.stdin.readline().split())
count = [0] * (M + 1)
A = []
for a in sys.stdin.readline().split():
a = int(a)
A.append(count[a] * M + a)
... | output | 1 | 16,915 | 17 | 33,831 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating their skills in watering. It is extremely expens... | instruction | 0 | 16,916 | 17 | 33,832 |
Tags: binary search, data structures, implementation, sortings, trees, two pointers
Correct Solution:
```
from bisect import bisect_left as bl
import sys
N, M, Q = map(int, sys.stdin.readline().split())
count = [0] * (M + 1)
T = tuple(map(int, sys.stdin.readline().split()))
A = []
for t in T:
A.append(count[t] * M... | output | 1 | 16,916 | 17 | 33,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating t... | instruction | 0 | 16,917 | 17 | 33,834 |
No | output | 1 | 16,917 | 17 | 33,835 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating t... | instruction | 0 | 16,918 | 17 | 33,836 |
No | output | 1 | 16,918 | 17 | 33,837 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating t... | instruction | 0 | 16,919 | 17 | 33,838 |
No | output | 1 | 16,919 | 17 | 33,839 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating t... | instruction | 0 | 16,920 | 17 | 33,840 |
No | output | 1 | 16,920 | 17 | 33,841 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!
Let students be numbered from 1 to n. Laptop of the i-th... | instruction | 0 | 17,755 | 17 | 35,510 |
Tags: binary search, greedy
Correct Solution:
```
import sys
import os
from math import trunc
s = os.read(0,os.fstat(0).st_size)
inp = []
sign = 1.0
numb = 0.0
for i in range(len(s)):
if s[i]>=48:
numb = 10.0*numb + s[i]-48.0
else:
if s[i]==45:
sign = -1.0
elif s[i]!=13:
... | output | 1 | 17,755 | 17 | 35,511 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!
Let students be numbered from 1 to n. Laptop of the i-th... | instruction | 0 | 17,756 | 17 | 35,512 |
Tags: binary search, greedy
Correct Solution:
```
import sys
import os
from math import trunc
s = os.read(0,os.fstat(0).st_size)
inp = []
sign = 1.0
numb = 0.0
for i in range(len(s)):
if s[i]>=48:
numb = 10.0*numb + s[i]-48.0
else:
if s[i]==45:
sign = -1.0
elif s[i]!=13:
... | output | 1 | 17,756 | 17 | 35,513 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!
Let students be numbered from 1 to n. Laptop of the i-th... | instruction | 0 | 17,757 | 17 | 35,514 |
Tags: binary search, greedy
Correct Solution:
```
import sys
import os
from math import trunc
s = os.read(0,os.fstat(0).st_size)
inp = []
sign = 1
numb = 0
for i in range(len(s)):
if s[i]>=48:
numb = 10*numb + s[i]-48
else:
if s[i]==45:
sign = -1
elif s[i]!=13:
... | output | 1 | 17,757 | 17 | 35,515 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!
Let students be numbered from 1 to n. Laptop of the i-th... | instruction | 0 | 17,758 | 17 | 35,516 |
Tags: binary search, greedy
Correct Solution:
```
import sys
import os
from math import trunc
s = os.read(0,os.fstat(0).st_size)
inp = []
sign = 1.0
numb = 0.0
for i in range(len(s)):
if s[i]>=48:
numb = 10.0*numb + s[i]-48.0
else:
if s[i]==45:
sign = -1.0
elif s[i]!=13:
... | output | 1 | 17,758 | 17 | 35,517 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!
Let stude... | instruction | 0 | 17,759 | 17 | 35,518 |
No | output | 1 | 17,759 | 17 | 35,519 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!
Let stude... | instruction | 0 | 17,760 | 17 | 35,520 |
No | output | 1 | 17,760 | 17 | 35,521 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!
Let stude... | instruction | 0 | 17,761 | 17 | 35,522 |
No | output | 1 | 17,761 | 17 | 35,523 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!
Let stude... | instruction | 0 | 17,762 | 17 | 35,524 |
No | output | 1 | 17,762 | 17 | 35,525 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.
We know that this group of people has archenemies. Each student has at most two a... | instruction | 0 | 17,963 | 17 | 35,926 |
Tags: dfs and similar, implementation
Correct Solution:
```
n, m = list(map(int, input().split()))
arch = [-1 for i in range(n+1)]
conjs = []
edges = []
for i in range(m):
a, b = list(map(int, input().split()))
if arch[a]==-1 and arch[b]==-1:
conjs.append(set([a, b]))
arch[a] = len(conjs) -1
... | output | 1 | 17,963 | 17 | 35,927 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.
We know that this group of people has archenemies. Each student has at most two a... | instruction | 0 | 17,964 | 17 | 35,928 |
Tags: dfs and similar, implementation
Correct Solution:
```
def main():
n, m = map(int, input().split())
graph = Graph(n)
for _ in range(m):
v, w = map(int, input().split())
graph.addEdge(v - 1, w - 1)
marked = [False for _ in range(n)]
toRemove = 0
for i in range(n):
if... | output | 1 | 17,964 | 17 | 35,929 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.
We know that this group of people has archenemies. Each student has at most two a... | instruction | 0 | 17,965 | 17 | 35,930 |
Tags: dfs and similar, implementation
Correct Solution:
```
def arr_inp():
return [int(x) for x in stdin.readline().split()]
def solution1():
# graph solution
student = graph()
for i in range(m):
a, b = arr_inp()
student.add_edge(a, b)
ans = student.dfs()
return ans
def solut... | output | 1 | 17,965 | 17 | 35,931 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.
We know that this group of people has archenemies. Each student has at most two a... | instruction | 0 | 17,966 | 17 | 35,932 |
Tags: dfs and similar, implementation
Correct Solution:
```
def dfs(u, last, depth):
global al, used, cnt
used[u] = 1
for v in al[u]:
if v != last:
if used[v] == 1:
if depth % 2 == 1:
cnt += 1
elif used[v] == 0:
dfs(v, u, de... | output | 1 | 17,966 | 17 | 35,933 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.
We know that this group of people has archenemies. Each student has at most two a... | instruction | 0 | 17,967 | 17 | 35,934 |
Tags: dfs and similar, implementation
Correct Solution:
```
def arr_inp():
return [int(x) for x in stdin.readline().split()]
def solution1():
# graph solution
student = graph()
for i in range(m):
a, b = arr_inp()
student.add_edge(a, b)
ans = student.dfs()
return ans
def solut... | output | 1 | 17,967 | 17 | 35,935 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.
We know that this group of people has archenemies. Each student has at most two a... | instruction | 0 | 17,968 | 17 | 35,936 |
Tags: dfs and similar, implementation
Correct Solution:
```
import sys
##############################################
class Graph:
def __init__(self,pairs,n):
self.g = []
self.sizes = []
for _ in range(n+1):
self.g.append([0,0])
self.sizes.append(0)
self.n=... | output | 1 | 17,968 | 17 | 35,937 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.