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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really difficult even for experienced gamers.
Walter William, the main charact... | instruction | 0 | 104,037 | 1 | 208,074 |
No | output | 1 | 104,037 | 1 | 208,075 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really difficult even for experienced gamers.
Walter William, the main charact... | instruction | 0 | 104,038 | 1 | 208,076 |
No | output | 1 | 104,038 | 1 | 208,077 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really difficult even for experienced gamers.
Walter William, the main charact... | instruction | 0 | 104,039 | 1 | 208,078 |
No | output | 1 | 104,039 | 1 | 208,079 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really difficult even for experienced gamers.
Walter William, the main charact... | instruction | 0 | 104,040 | 1 | 208,080 |
No | output | 1 | 104,040 | 1 | 208,081 |
Provide a correct Python 3 solution for this coding contest problem.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic nam... | instruction | 0 | 104,369 | 1 | 208,738 |
"Correct Solution:
```
from itertools import cycle
f=lambda a,b:[chr(i) for i in range(a,b)]
c=(f(97,123)+f(65,91))[::-1]
c*=2
while int(input()):
l=cycle(map(int,input().split()))
s=input()
print("".join([c[c.index(i)+j] for (i,j) in zip(s,l)]))
``` | output | 1 | 104,369 | 1 | 208,739 |
Provide a correct Python 3 solution for this coding contest problem.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic nam... | instruction | 0 | 104,370 | 1 | 208,740 |
"Correct Solution:
```
# from sys import exit
alp = ['a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z']
alp += [a.upper() for a in alp]
id = [i for i in range(0, 52)]
alp2num = dict(zip(alp, id))
num2alp = dict(en... | output | 1 | 104,370 | 1 | 208,741 |
Provide a correct Python 3 solution for this coding contest problem.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic nam... | instruction | 0 | 104,371 | 1 | 208,742 |
"Correct Solution:
```
d = ''
for i in range(26):
d += chr(ord('a') + i)
for i in range(26):
d += chr(ord('A') + i)
def decode(c,key):
i = d.find(c)
return d[(i-key) % 52]
while True:
N = int(input())
if N == 0: break
ks = list(map(int,input().split()))
S = input()
ans = ''
for... | output | 1 | 104,371 | 1 | 208,743 |
Provide a correct Python 3 solution for this coding contest problem.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic nam... | instruction | 0 | 104,372 | 1 | 208,744 |
"Correct Solution:
```
abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
while True:
n = int(input())
if n == 0:
break
k = list(map(int, input().split()))
s = str(input())
for itr, c in enumerate(s):
idx = abc[(abc.find(c) - k[itr % n] + 52) % 52]
print(idx, end ... | output | 1 | 104,372 | 1 | 208,745 |
Provide a correct Python 3 solution for this coding contest problem.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic nam... | instruction | 0 | 104,373 | 1 | 208,746 |
"Correct Solution:
```
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
while True:
n = int(input())
if n == 0:
break
else:
... | output | 1 | 104,373 | 1 | 208,747 |
Provide a correct Python 3 solution for this coding contest problem.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic nam... | instruction | 0 | 104,374 | 1 | 208,748 |
"Correct Solution:
```
a = ord("a")
A = ord("A")
dic1 = {}
dic2 = {}
for i in range(26):
dic1[i] = chr(a + i)
dic2[chr(a + i)] = i
dic1[i + 26] = chr(A + i)
dic2[chr(A + i)] = i + 26
while True:
n = int(input())
if n == 0:break
klst = list(map(int, input().split())) * 100
s = input()
ans = ""
for c,... | output | 1 | 104,374 | 1 | 208,749 |
Provide a correct Python 3 solution for this coding contest problem.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic nam... | instruction | 0 | 104,375 | 1 | 208,750 |
"Correct Solution:
```
while 1:
n=int(input())
if n==0:break
a=list(map(int,input().split()))
s=list(input())
for i in range(len(s)):
for j in range(a[i%n]):
if s[i]=='A':s[i]='z'
elif s[i]=='a':s[i]='Z'
else:s[i]=s[i]=chr(ord(s[i])-1)
print(*s,sep='')... | output | 1 | 104,375 | 1 | 208,751 |
Provide a correct Python 3 solution for this coding contest problem.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, each with a single uppercase or lowercase alphabetic nam... | instruction | 0 | 104,376 | 1 | 208,752 |
"Correct Solution:
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
char_list = list(map(chr,range(ord('a'),ord('z')+1)))
char_list += list(map(chr,range(ord('A'),ord('Z')+1)))
while True:
n = int(input())
if n == 0:
break
keys = list(map(int,input().split(" ")))
sentence = input()
for i i... | output | 1 | 104,376 | 1 | 208,753 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, ... | instruction | 0 | 104,377 | 1 | 208,754 |
Yes | output | 1 | 104,377 | 1 | 208,755 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, ... | instruction | 0 | 104,378 | 1 | 208,756 |
Yes | output | 1 | 104,378 | 1 | 208,757 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, ... | instruction | 0 | 104,379 | 1 | 208,758 |
Yes | output | 1 | 104,379 | 1 | 208,759 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, ... | instruction | 0 | 104,380 | 1 | 208,760 |
Yes | output | 1 | 104,380 | 1 | 208,761 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, ... | instruction | 0 | 104,381 | 1 | 208,762 |
No | output | 1 | 104,381 | 1 | 208,763 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, ... | instruction | 0 | 104,382 | 1 | 208,764 |
No | output | 1 | 104,382 | 1 | 208,765 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, ... | instruction | 0 | 104,383 | 1 | 208,766 |
No | output | 1 | 104,383 | 1 | 208,767 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.
There are 52 train stations, ... | instruction | 0 | 104,384 | 1 | 208,768 |
No | output | 1 | 104,384 | 1 | 208,769 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Of course our child likes walking in a zoo. The zoo has n areas, that are numbered from 1 to n. The i-th area contains ai animals in it. Also there are m roads in the zoo, and each road connects two distinct areas. Naturally the zoo is conne... | instruction | 0 | 104,807 | 1 | 209,614 |
Tags: dsu, sortings
Correct Solution:
```
R = lambda:map(int, input().split())
n, m = R()
a = list(R())
p, f, sz =[], [], []
e = [[] for i in range(n)]
vis = [0] * n
ans = 0
def find(u):
if f[u] != u:
f[u] = find(f[u])
return f[u]
for i in range(n):
p.append([a[i], i])
f.append(i)
sz.append... | output | 1 | 104,807 | 1 | 209,615 |
Provide a correct Python 3 solution for this coding contest problem.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of more than L in a single day.
* He never sleeps in the o... | instruction | 0 | 105,159 | 1 | 210,318 |
"Correct Solution:
```
import bisect
N = int(input())
x = list(map(int, input().split()))
L = int(input())
dest = []
dest_1 = [0] * N
for i in range(N):
dest_1[i] = bisect.bisect_left(x, x[i] + L + 0.5) - 1
dest.append(dest_1)
for i in range(1, len(bin(N - 1)) - 1):
dest_prev = dest[i - 1]
dest_i = [0] * ... | output | 1 | 105,159 | 1 | 210,319 |
Provide a correct Python 3 solution for this coding contest problem.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of more than L in a single day.
* He never sleeps in the o... | instruction | 0 | 105,160 | 1 | 210,320 |
"Correct Solution:
```
from bisect import bisect_right
import sys
input = sys.stdin.readline
N = int(input())
x = list(map(int, input().split()))
L = int(input())
log = 1
while 1 << log < N:
log += 1
doubling = [[0] * (log + 1) for _ in range(N)]
for i in range(N):
j = bisect_right(x, x[i] + L) - 1
doublin... | output | 1 | 105,160 | 1 | 210,321 |
Provide a correct Python 3 solution for this coding contest problem.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of more than L in a single day.
* He never sleeps in the o... | instruction | 0 | 105,161 | 1 | 210,322 |
"Correct Solution:
```
import sys,bisect
input=sys.stdin.readline
N=int(input())
x=list(map(int,input().split()))
L=int(input())
doubling=[[-1 for i in range(N)] for j in range(20)]
for i in range(N):
npos=x[i]+L
index=bisect.bisect_right(x,npos)
doubling[0][i]=index-1
for i in range(1,20):
for j i... | output | 1 | 105,161 | 1 | 210,323 |
Provide a correct Python 3 solution for this coding contest problem.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of more than L in a single day.
* He never sleeps in the o... | instruction | 0 | 105,162 | 1 | 210,324 |
"Correct Solution:
```
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS... | output | 1 | 105,162 | 1 | 210,325 |
Provide a correct Python 3 solution for this coding contest problem.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of more than L in a single day.
* He never sleeps in the o... | instruction | 0 | 105,163 | 1 | 210,326 |
"Correct Solution:
```
import bisect
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
d = int(input())
graph = [[0 for i in range(n+1)] for j in range(18)]
for i in range(n):
x = bisect.bisect_right(a,a[i]+d)
graph[0][i+1] = x
for j in range(1,18):
for i in range(n):
t... | output | 1 | 105,163 | 1 | 210,327 |
Provide a correct Python 3 solution for this coding contest problem.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of more than L in a single day.
* He never sleeps in the o... | instruction | 0 | 105,164 | 1 | 210,328 |
"Correct Solution:
```
import bisect
n = int(input())
x = list(map(int, input().split()))
l = int(input())
q = int(input())
query = [list(map(int, input().split())) for i in range(q)]
log_size = n.bit_length() + 1
double = [[0] * n for i in range(log_size)]
for i in range(n):
double[0][i] = bisect.bisect_right(... | output | 1 | 105,164 | 1 | 210,329 |
Provide a correct Python 3 solution for this coding contest problem.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of more than L in a single day.
* He never sleeps in the o... | instruction | 0 | 105,165 | 1 | 210,330 |
"Correct Solution:
```
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.st... | output | 1 | 105,165 | 1 | 210,331 |
Provide a correct Python 3 solution for this coding contest problem.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of more than L in a single day.
* He never sleeps in the o... | instruction | 0 | 105,166 | 1 | 210,332 |
"Correct Solution:
```
n = int(input())
hot = list(map(int,input().split()))
n_ = n.bit_length()
db = [[n-1]*(n)]
L = int(input())
r = 1
for i in range(n-1):
while r < n-1 and hot[r+1]-hot[i] <= L:
r += 1
db[0][i] = r
for j in range(1,n_+1):
new = [db[-1][db[-1][i]] for i in range(n)]
db.append(new)
if n... | output | 1 | 105,166 | 1 | 210,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of... | instruction | 0 | 105,167 | 1 | 210,334 |
Yes | output | 1 | 105,167 | 1 | 210,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of... | instruction | 0 | 105,168 | 1 | 210,336 |
Yes | output | 1 | 105,168 | 1 | 210,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of... | instruction | 0 | 105,169 | 1 | 210,338 |
Yes | output | 1 | 105,169 | 1 | 210,339 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of... | instruction | 0 | 105,170 | 1 | 210,340 |
Yes | output | 1 | 105,170 | 1 | 210,341 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of... | instruction | 0 | 105,171 | 1 | 210,342 |
No | output | 1 | 105,171 | 1 | 210,343 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of... | instruction | 0 | 105,172 | 1 | 210,344 |
No | output | 1 | 105,172 | 1 | 210,345 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of... | instruction | 0 | 105,173 | 1 | 210,346 |
No | output | 1 | 105,173 | 1 | 210,347 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of... | instruction | 0 | 105,174 | 1 | 210,348 |
No | output | 1 | 105,174 | 1 | 210,349 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Aizu Magic School is a school where people who can use magic gather. Haruka, one of the students of that school, can use the magic of warp on the magic team.
From her house to the school, there is a straight road of length L. There are also... | instruction | 0 | 105,203 | 1 | 210,406 |
"Correct Solution:
```
INF = 10 ** 20
l, n = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(n)] + [[l, 0, INF]]
lst.sort()
score = {}
for p, _, _ in lst:
score[p] = p
for i in range(n + 1):
p, d, t = lst[i]
for j in range(i + 1, n + 1):
to_p, _, _ = lst[j]
if to_p >= p + d... | output | 1 | 105,203 | 1 | 210,407 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a map of that network, so for each railway section ... | instruction | 0 | 105,371 | 1 | 210,742 |
Tags: constructive algorithms, dfs and similar, greedy, sortings, trees
Correct Solution:
```
from itertools import chain
class RangeMinQuery:
# O(nlog(n)) construction/space, O(1) range minimum query
def __init__(self, data):
self._data = [list(data)]
n = len(self._data[0])
# self._d... | output | 1 | 105,371 | 1 | 210,743 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a map of that network, so for each railway section ... | instruction | 0 | 105,372 | 1 | 210,744 |
Tags: constructive algorithms, dfs and similar, greedy, sortings, trees
Correct Solution:
```
import copy
n = int(input())
g = [[] for i in range(n)]
depth = [0 for i in range(n)]
parent = [-2 for i in range(n)]
parent[0] = -1
beauty = [1 for i in range(n)]
Edges = []
def chk(f,t):
_min = 1145141919810
whil... | output | 1 | 105,372 | 1 | 210,745 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a map of that network, so for each railway section ... | instruction | 0 | 105,373 | 1 | 210,746 |
Tags: constructive algorithms, dfs and similar, greedy, sortings, trees
Correct Solution:
```
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
# Ref https://github.com/cheran-senthil/PyRival/tree/master/pyrival
# sys.modules["hashlib"] = sys.sha512 = sys
# import random
def dfsPre(par,graph,ti... | output | 1 | 105,373 | 1 | 210,747 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a map of that network, so for each railway section ... | instruction | 0 | 105,374 | 1 | 210,748 |
Tags: constructive algorithms, dfs and similar, greedy, sortings, trees
Correct Solution:
```
import sys
class RangeMinQuery:
# O(nlog(n)) construction/space, O(1) range minimum query
def __init__(self, data):
self._data = [list(data)]
n = len(self._data[0])
# self._data[i][j] stores t... | output | 1 | 105,374 | 1 | 210,749 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a map of that network, so for each railway section ... | instruction | 0 | 105,375 | 1 | 210,750 |
Tags: constructive algorithms, dfs and similar, greedy, sortings, trees
Correct Solution:
```
#!/usr/bin/python3
# @Author : indiewar
import sys
sys.setrecursionlimit(5233)
n = int(input())
G = [[] for i in range(n+1)]
dep = [0 for i in range(n+1)]
par = [-1 for i in range(n+1)]
x = [0 for i in range(n+1)]
y = [0 for ... | output | 1 | 105,375 | 1 | 210,751 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a map of that network, so for each railway section ... | instruction | 0 | 105,376 | 1 | 210,752 |
Tags: constructive algorithms, dfs and similar, greedy, sortings, trees
Correct Solution:
```
from collections import deque
from operator import itemgetter
import sys
input = sys.stdin.readline
def dfs(tree, root):
par = {root: -1}
st1 = deque([root])
while st1:
v = st1.pop()
for nxt_v in ... | output | 1 | 105,376 | 1 | 210,753 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a map of that network, so for each railway section ... | instruction | 0 | 105,377 | 1 | 210,754 |
Tags: constructive algorithms, dfs and similar, greedy, sortings, trees
Correct Solution:
```
import sys
from operator import itemgetter
readline = sys.stdin.readline
def parorder(Edge, p):
N = len(Edge)
par = [0]*N
par[p] = -1
stack = [p]
order = []
visited = set([p])
ast = stack.append
... | output | 1 | 105,377 | 1 | 210,755 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a map of that network, so for each railway section ... | instruction | 0 | 105,378 | 1 | 210,756 |
Tags: constructive algorithms, dfs and similar, greedy, sortings, trees
Correct Solution:
```
#AUTHOR- titia
import sys
input = sys.stdin.readline
from operator import itemgetter
n=int(input())
EDGE=[sorted(map(int,input().split())) for i in range(n-1)]
E=[[] for i in range(n+1)]
D=dict()
for i in range(n-1):
... | output | 1 | 105,378 | 1 | 210,757 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a ma... | instruction | 0 | 105,379 | 1 | 210,758 |
Yes | output | 1 | 105,379 | 1 | 210,759 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a ma... | instruction | 0 | 105,380 | 1 | 210,760 |
Yes | output | 1 | 105,380 | 1 | 210,761 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a ma... | instruction | 0 | 105,381 | 1 | 210,762 |
Yes | output | 1 | 105,381 | 1 | 210,763 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.
You have a ma... | instruction | 0 | 105,382 | 1 | 210,764 |
Yes | output | 1 | 105,382 | 1 | 210,765 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.