message stringlengths 2 22.8k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 16 109k | cluster float64 1 1 | __index_level_0__ int64 32 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetl... | instruction | 0 | 68,177 | 1 | 136,354 |
Tags: brute force, math
Correct Solution:
```
import sys
import math
from collections import defaultdict as dd
mod=1000000007
def lcm(x,y):
return (x*y)//(math.gcd(x,y))
T=1
#T=int(sys.stdin.readline())
for _ in range(T):
n,k=map(int,input().split())
a,b=map(int,input().split())
p=[]
q=n*k
... | output | 1 | 68,177 | 1 | 136,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetl... | instruction | 0 | 68,178 | 1 | 136,356 |
Tags: brute force, math
Correct Solution:
```
import math
n, k = map(int, input().split())
a, b = map(int, input().split())
s = [1 if l == 0 else n * k // math.gcd(n * k, l) for i in range(n) for l in (abs(k * i - b - a), abs(k * i + b - a))]
print(min(s), max(s))
``` | output | 1 | 68,178 | 1 | 136,357 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetl... | instruction | 0 | 68,179 | 1 | 136,358 |
Tags: brute force, math
Correct Solution:
```
#!/usr/bin/env python3
import os
import sys
from functools import reduce
from io import BytesIO, IOBase
sys.stdout, stream = IOBase(), BytesIO()
sys.stdout.flush = lambda: os.write(1, stream.getvalue()) and not stream.truncate(0) and stream.seek(0)
sys.stdout.write = lambd... | output | 1 | 68,179 | 1 | 136,359 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetl... | instruction | 0 | 68,180 | 1 | 136,360 |
Tags: brute force, math
Correct Solution:
```
from math import gcd
n, k = (int(x) for x in input().split())
nk = n*k
a, b = (int(x) for x in input().split())
flag1 = [1, 1, -1, -1]
flag2 = [1, -1, 1, -1]
min_ans, max_ans = float('inf'), -1
for s in range(1, k+1):
for dir in range(4):
if (s + flag1[dir]*a +... | output | 1 | 68,180 | 1 | 136,361 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetl... | instruction | 0 | 68,181 | 1 | 136,362 |
Tags: brute force, math
Correct Solution:
```
n, k = list(map(int, input().split()))
a,b = list(map(int, input().split()))
def gcd(x, y):
while(y):
x, y = y, x % y
return x
mi = n*k
ma = 0
s1 = 1 + a
start = k + 1 - b
for i in range(start, n*k + 1, k):
l1 = i - s1
if l1 < 0:
break
... | output | 1 | 68,181 | 1 | 136,363 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetl... | instruction | 0 | 68,182 | 1 | 136,364 |
Tags: brute force, math
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
sys.stdout, stream = IOBase(), BytesIO()
sys.stdout.flush = lambda: os.write(1, stream.getvalue()) and not stream.truncate(0) and stream.seek(0)
sys.stdout.write = lambda s: stream.write(s.encode())
input = BytesIO(os.re... | output | 1 | 68,182 | 1 | 136,365 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetl... | instruction | 0 | 68,183 | 1 | 136,366 |
Tags: brute force, math
Correct Solution:
```
import math
n, k = map(int, input().split())
a, b = map(int, input().split())
nk = n * k
mi = 1e12
ma = 0
def solve(st):
global mi, ma
for i in range(n):
en = i * k + 1 + b
if en < st:
en += nk
res = nk // math.gcd(en - st, nk)
mi = min(mi, res)
ma = max(ma... | output | 1 | 68,183 | 1 | 136,367 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetl... | instruction | 0 | 68,184 | 1 | 136,368 |
Tags: brute force, math
Correct Solution:
```
from math import gcd
n, k = map(int, input().split())
a, b = map(int, input().split())
l = n * k
x, y = 10 ** 18, -1
for i in range(n):
end = i * k + b + 1
start = a + 1
ll = (end - start)
if ll < 0:
ll += l
gg = l // gcd(ll, l)
x = min(x, ... | output | 1 | 68,184 | 1 | 136,369 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring citi... | instruction | 0 | 68,185 | 1 | 136,370 |
Yes | output | 1 | 68,185 | 1 | 136,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring citi... | instruction | 0 | 68,186 | 1 | 136,372 |
Yes | output | 1 | 68,186 | 1 | 136,373 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring citi... | instruction | 0 | 68,187 | 1 | 136,374 |
Yes | output | 1 | 68,187 | 1 | 136,375 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring citi... | instruction | 0 | 68,188 | 1 | 136,376 |
Yes | output | 1 | 68,188 | 1 | 136,377 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring citi... | instruction | 0 | 68,189 | 1 | 136,378 |
No | output | 1 | 68,189 | 1 | 136,379 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring citi... | instruction | 0 | 68,190 | 1 | 136,380 |
No | output | 1 | 68,190 | 1 | 136,381 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring citi... | instruction | 0 | 68,191 | 1 | 136,382 |
No | output | 1 | 68,191 | 1 | 136,383 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerated from 1 to n ⋅ k, the distance between the neighboring citi... | instruction | 0 | 68,192 | 1 | 136,384 |
No | output | 1 | 68,192 | 1 | 136,385 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any other district. Let's enumerate all di... | instruction | 0 | 68,461 | 1 | 136,922 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
import sys
from collections import defaultdict
from collections import deque
from types import GeneratorType
input = sys.stdin.readline
def bootstrap(f, stack=[]):
def wrappedfunc(*args, **kwargs):
if stack:
return f(*args, **kwar... | output | 1 | 68,461 | 1 | 136,923 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any other district. Let's enumerate all di... | instruction | 0 | 68,462 | 1 | 136,924 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
def dfs(grafos,quebrados):
l1,l2 = [1],[0] * (n+1) # lista para verificar as subtrees com estradas que devem ser consertadas.
while len(l1)!=0:
popado = l1.pop()
for adj in grafos[popado]:
l2[adj] = popado
if len(... | output | 1 | 68,462 | 1 | 136,925 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any other district. Let's enumerate all di... | instruction | 0 | 68,463 | 1 | 136,926 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
# http://codeforces.com/contest/369/problem/C
import sys
NOT_SEEN, SEEN, COMPLETE = 1, 2, 3
N = int(sys.stdin.readline())
edge = [ [] for i in range(N + 1)]
status = [ NOT_SEEN for i in range(N + 1)]
parent = [0 for i in range(N + 1)]
result = [0 for i in range... | output | 1 | 68,463 | 1 | 136,927 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any other district. Let's enumerate all di... | instruction | 0 | 68,464 | 1 | 136,928 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
n = int(input())
white = []
g = [[] for _ in range(n)]
d = [0] * n
for i in range(n - 1):
x, y, t = list(map(int, input().strip().split()))
x -= 1;
y -= 1;
# print(x,y)
if x >= 0 and y >= 0 and x < n and y < n:
g[x].append(y)
... | output | 1 | 68,464 | 1 | 136,929 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any other district. Let's enumerate all di... | instruction | 0 | 68,465 | 1 | 136,930 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from col... | output | 1 | 68,465 | 1 | 136,931 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any other district. Let's enumerate all di... | instruction | 0 | 68,466 | 1 | 136,932 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
n = int(input())
q = []
p = [[] for i in range(n + 1)]
for i in range(n - 1):
a, b, t = [int(i) for i in input().split()]
p[a].append(b)
p[b].append(a)
if t == 2: q.append((a, b))
if len(q) == 0:
print(0)
else:
r = [1]
t = [0] * (n... | output | 1 | 68,466 | 1 | 136,933 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any other district. Let's enumerate all di... | instruction | 0 | 68,467 | 1 | 136,934 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
def find_problem(edges, node, par, problems):
flag = False
for ch, problem in edges.get(node, []):
if ch!=par:
child_problem = find_problem(edges, ch, node, problems)
if not child_problem and problem:
prob... | output | 1 | 68,467 | 1 | 136,935 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any other district. Let's enumerate all di... | instruction | 0 | 68,468 | 1 | 136,936 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
n = int(input())
q, p = [], [[] for i in range(n + 1)]
for i in range(n - 1):
a, b, t = map(int, input().split())
p[a].append(b)
p[b].append(a)
if t == 2: q.append((a, b))
if q:
r, t = [1], [0] * (n + 1)
while r:
a = r.pop()
... | output | 1 | 68,468 | 1 | 136,937 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the road... | instruction | 0 | 68,469 | 1 | 136,938 |
Yes | output | 1 | 68,469 | 1 | 136,939 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the road... | instruction | 0 | 68,470 | 1 | 136,940 |
Yes | output | 1 | 68,470 | 1 | 136,941 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the road... | instruction | 0 | 68,471 | 1 | 136,942 |
Yes | output | 1 | 68,471 | 1 | 136,943 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the road... | instruction | 0 | 68,472 | 1 | 136,944 |
Yes | output | 1 | 68,472 | 1 | 136,945 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the road... | instruction | 0 | 68,473 | 1 | 136,946 |
No | output | 1 | 68,473 | 1 | 136,947 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the road... | instruction | 0 | 68,474 | 1 | 136,948 |
No | output | 1 | 68,474 | 1 | 136,949 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the road... | instruction | 0 | 68,475 | 1 | 136,950 |
No | output | 1 | 68,475 | 1 | 136,951 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The city Valera lives in is going to hold elections to the city Parliament.
The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the road... | instruction | 0 | 68,476 | 1 | 136,952 |
No | output | 1 | 68,476 | 1 | 136,953 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today s kilometer long auto race takes place in Berland. The track is represented by a straight line as long as s kilometers. There are n cars taking part in the race, all of them start simultaneously at the very beginning of the track. For ... | instruction | 0 | 68,494 | 1 | 136,988 |
Tags: brute force, implementation, two pointers
Correct Solution:
```
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
n, s = map(int, input().split())
data = [dict() for _ in range(n)]
for i in range(n):
k, *a = map(int, input().split())
... | output | 1 | 68,494 | 1 | 136,989 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably widened on account of lawn nobody needs anyway.... | instruction | 0 | 68,638 | 1 | 137,276 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
ss = [0] * (n + 1)
gg = [0] * (n + 1)
#mins = [0] * n
maxs = [0] * n
curMin = -10 ** 10
curMax = -curMin
for i in range(n):
s, g = map(int, input().split(' '))
ss[i] = s
gg[i] = g
curMin = max(curMin - 1, s)
... | output | 1 | 68,638 | 1 | 137,277 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably widened on account of lawn nobody needs anyway.... | instruction | 0 | 68,639 | 1 | 137,278 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n = int(input())
s = []
g = []
forwardBound = []
backwardBound = []
for _ in range(n):
sCur,gCur = map(int,input().split())
s.append(sCur)
g.append(gCur)
forw... | output | 1 | 68,639 | 1 | 137,279 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably widened on account of lawn nobody needs anyway.... | instruction | 0 | 68,640 | 1 | 137,280 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
s = [0]*n
g = [0]*n
for i in range(n):
a,b = map(int,input().split())
s[i] = a
g[i] = a+b
for i in range(1,n):
g[i] = min(g[i],g[i-1]+1)
for i in range(n-2,-1,-1):
g[i] = min(g[i],g[i+1]+1)
ans = 0
for i i... | output | 1 | 68,640 | 1 | 137,281 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably widened on account of lawn nobody needs anyway.... | instruction | 0 | 68,641 | 1 | 137,282 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
t = []
l = []
r = []
for _ in range(int(input())):
s, g = map(int, input().split())
t.append(s)
l.append(s)
r.append(g + s)
for i in range(1, len(l)):
if l[i] < l[i - 1]:
l[i] = l[i - 1] - 1
if r[i] > r[i - 1]:
r[i] = r[i - 1] + 1
... | output | 1 | 68,641 | 1 | 137,283 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably widened on account of lawn nobody needs anyway.... | instruction | 0 | 68,642 | 1 | 137,284 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
from random import choice, randint
from string import ascii_uppercase, ascii_letters, digits, ascii_lowercase
from sys import stdin, stdout
from random import choice
from functools import reduce
import time
from math import *
from itertools imp... | output | 1 | 68,642 | 1 | 137,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably widened on account of lawn nobody needs anyway.... | instruction | 0 | 68,643 | 1 | 137,286 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
n=int(input())
a=[]
for i in range(n):
a.append(list(map(int,input().split())))
a[i][1]+=a[i][0]
for i in range(1,n):
if a[i][1]>a[i-1][1]+1:
a[i][1]=a[i-1][1]+1
if a[i][1]<a[i][0]:exit(print(-1))
s=a[-1][1]-a[-1][0]... | output | 1 | 68,643 | 1 | 137,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably widened on account of lawn nobody needs anyway.... | instruction | 0 | 68,644 | 1 | 137,288 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
# https://codeforces.com/contest/883/problem/K
# WA
import heapq
from heapq import heappush as push_
from heapq import heappop as pop_
n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
Q = []
d = [s+g for s, g ... | output | 1 | 68,644 | 1 | 137,289 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably ... | instruction | 0 | 68,645 | 1 | 137,290 |
No | output | 1 | 68,645 | 1 | 137,291 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably ... | instruction | 0 | 68,646 | 1 | 137,292 |
No | output | 1 | 68,646 | 1 | 137,293 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably ... | instruction | 0 | 68,647 | 1 | 137,294 |
No | output | 1 | 68,647 | 1 | 137,295 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably ... | instruction | 0 | 68,648 | 1 | 137,296 |
No | output | 1 | 68,648 | 1 | 137,297 |
Provide a correct Python 3 solution for this coding contest problem.
D: Country In Distortion-
story
Alice was completely bored. This is because the White Rabbit, who is always playing with him, is out to Trump Castle. (Ah, I wish I had gone out with him in this case.) Alice thought. However, this is a country of di... | instruction | 0 | 68,890 | 1 | 137,780 |
"Correct Solution:
```
from heapq import heappush, heappop
def main():
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
x, y, t = map(int, input().split())
x -= 1
y -= 1
edges[x].append((y, t))
edges[y].append((x, t))
v0 = int(input())
a, b, c = map(in... | output | 1 | 68,890 | 1 | 137,781 |
Provide a correct Python 3 solution for this coding contest problem.
D: Country In Distortion-
story
Alice was completely bored. This is because the White Rabbit, who is always playing with him, is out to Trump Castle. (Ah, I wish I had gone out with him in this case.) Alice thought. However, this is a country of di... | instruction | 0 | 68,891 | 1 | 137,782 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
inf = float('inf')
n,m = map(int,input().split())
pathT = [{} for _ in range(n)]
for i in range(m):
x,y,t = map(int,input().split())
x -= 1
y -= 1
pathT[x][y] = t
pathT[y][x] = t
import heapq
def Dijkstra(ed... | output | 1 | 68,891 | 1 | 137,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome! Everything is fine.
You have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.
You have a list of k pairs of... | instruction | 0 | 69,039 | 1 | 138,078 |
Tags: dfs and similar, graphs, greedy, trees
Correct Solution:
```
from types import GeneratorType
def bootstrap(f, stack=[]):
def wrappedfunc(*args, **kwargs):
if stack:
return f(*args, **kwargs)
else:
to = f(*args, **kwargs)
while True:
if type(t... | output | 1 | 69,039 | 1 | 138,079 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome! Everything is fine.
You have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.
You have a list of k pairs of... | instruction | 0 | 69,040 | 1 | 138,080 |
Tags: dfs and similar, graphs, greedy, trees
Correct Solution:
```
import sys
# inf = open('input.txt', 'r')
# reader = (map(int, line.split()) for line in inf)
reader = (map(int, line.split()) for line in sys.stdin)
def minmaxPairs(g, costDict, n):
G = B = 0
s = 1
stack = [s]
traversal = []
visi... | output | 1 | 69,040 | 1 | 138,081 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome! Everything is fine.
You have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.
You have a list of k pairs of... | instruction | 0 | 69,041 | 1 | 138,082 |
Tags: dfs and similar, graphs, greedy, trees
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO,IOBase
def main():
for _ in range(int(input())):
n = 2*int(input())
path = [[] for _ in range(n)]
cost = [[] for _ in range(n... | output | 1 | 69,041 | 1 | 138,083 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome! Everything is fine.
You have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.
You have a list of k pairs of... | instruction | 0 | 69,042 | 1 | 138,084 |
Tags: dfs and similar, graphs, greedy, trees
Correct Solution:
```
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for T in range(int(input())):
k = int(input())
counts = [0] * (2 * k + 1)
adjacencies = [list() for i in range(2 * k + 1)]
for _ in range(2 * k - 1):
a, ... | output | 1 | 69,042 | 1 | 138,085 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.