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.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.
When Vasya has some free tim... | instruction | 0 | 88,924 | 1 | 177,848 |
Tags: implementation, math
Correct Solution:
```
from math import gcd
def lcm(a, b):
return (a * b) // gcd(a, b)
i = 0
a, b = map(int, input().split())
first = False
second = False
masha = 0
dasha = 0
while i < lcm(a, b):
if first:
masha += b - (i % b)
i += b - (i % b)
elif s... | output | 1 | 88,924 | 1 | 177,849 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.
When Vasya has some free tim... | instruction | 0 | 88,925 | 1 | 177,850 |
Tags: implementation, math
Correct Solution:
```
d, m = map(int, input().split())
g, l = max(d, m), min(d, m)
while True:
if not(g % l): break
g, l = l, g%l
lcm = (d * m) // l
dcnt = (lcm // d) - 1
mcnt = (lcm // m) - 1
if d > m: dcnt += 1
else: mcnt += 1
if (dcnt == mcnt): print("Equal")
elif (dcnt > mcnt): pr... | output | 1 | 88,925 | 1 | 177,851 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.
When Vasya has some free tim... | instruction | 0 | 88,926 | 1 | 177,852 |
Tags: implementation, math
Correct Solution:
```
import math
import sys
input=sys.stdin.readline
a,b=list(map(int,input().split()))
x=math.gcd(a,b)
a,b=a//x,b//x
if abs(a-b)==1:
print('Equal')
elif a<b:
print('Dasha')
else:
print('Masha')
``` | output | 1 | 88,926 | 1 | 177,853 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.
When Vasya has some free tim... | instruction | 0 | 88,927 | 1 | 177,854 |
Tags: implementation, math
Correct Solution:
```
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
#from bisect import bisect_left as bl #c++ lowerbound bl(array,element)
#from bisect import bisect_right as br #c++ upperbound br(array,element)
import math
def main(... | output | 1 | 88,927 | 1 | 177,855 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.
When Vasya has some free tim... | instruction | 0 | 88,928 | 1 | 177,856 |
Tags: implementation, math
Correct Solution:
```
a, b = input().split()
a = int(a); b = int(b)
def gcd(a, b):
if a < b:
return gcd(b, a)
elif not a%b:
return b
return gcd(b, a%b)
lcm = a*b//gcd(a, b)
if a > b:
d_count = lcm//a
m_count = lcm//b - 1
if m_count > d_count:
print("Masha")
elif m_count == d_... | output | 1 | 88,928 | 1 | 177,857 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other... | instruction | 0 | 88,929 | 1 | 177,858 |
Yes | output | 1 | 88,929 | 1 | 177,859 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other... | instruction | 0 | 88,930 | 1 | 177,860 |
Yes | output | 1 | 88,930 | 1 | 177,861 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other... | instruction | 0 | 88,931 | 1 | 177,862 |
Yes | output | 1 | 88,931 | 1 | 177,863 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other... | instruction | 0 | 88,932 | 1 | 177,864 |
Yes | output | 1 | 88,932 | 1 | 177,865 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other... | instruction | 0 | 88,933 | 1 | 177,866 |
No | output | 1 | 88,933 | 1 | 177,867 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other... | instruction | 0 | 88,934 | 1 | 177,868 |
No | output | 1 | 88,934 | 1 | 177,869 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other... | instruction | 0 | 88,935 | 1 | 177,870 |
No | output | 1 | 88,935 | 1 | 177,871 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other... | instruction | 0 | 88,936 | 1 | 177,872 |
No | output | 1 | 88,936 | 1 | 177,873 |
Provide a correct Python 3 solution for this coding contest problem.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by, the bridge is so old that it is almost broken.
<image>... | instruction | 0 | 89,158 | 1 | 178,316 |
"Correct Solution:
```
from operator import itemgetter
while 1:
n = int(input())
if n == 0:
break
t_w = []
for _ in range(n):
m, a, b = map(int, input().split())
t_w.append((a, m, 5))
t_w.append((b, -m, 3))
t_w.sort(key=itemgetter(0, 2))
ans, cur = 'OK', 0
fo... | output | 1 | 89,158 | 1 | 178,317 |
Provide a correct Python 3 solution for this coding contest problem.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by, the bridge is so old that it is almost broken.
<image>... | instruction | 0 | 89,159 | 1 | 178,318 |
"Correct Solution:
```
import operator
while 1:
n = int(input())
if n == 0:break
s = [list(map(int,input().split())) for i in range(n)]
e = s[:]
s.sort(key = operator.itemgetter(1))
e.sort(key = operator.itemgetter(2))
s_i = e_i = 0
w = 0
for i in range(n*2):
if e_i < len(e)... | output | 1 | 89,159 | 1 | 178,319 |
Provide a correct Python 3 solution for this coding contest problem.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by, the bridge is so old that it is almost broken.
<image>... | instruction | 0 | 89,160 | 1 | 178,320 |
"Correct Solution:
```
while 1:
N = int(input())
if N == 0:
break
q = []
M = {}
for i in range(N):
m, a, b = map(int, input().split())
M[a] = M.get(a, 0) + m
M[b] = M.get(b, 0) - m
*q, = M.items()
q.sort()
ok = 1
cur = 0
for t, v in q:
cur ... | output | 1 | 89,160 | 1 | 178,321 |
Provide a correct Python 3 solution for this coding contest problem.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by, the bridge is so old that it is almost broken.
<image>... | instruction | 0 | 89,161 | 1 | 178,322 |
"Correct Solution:
```
while True:
N = int(input())
if not N:
break
e = []
for i in range(N):
m, a, b = map(int, input().split())
e.append((a, m))
e.append((b, -m))
M = 0
ot = 0
for t, m in sorted(e):
if M > 150 and ot != t:
print('NG')
... | output | 1 | 89,161 | 1 | 178,323 |
Provide a correct Python 3 solution for this coding contest problem.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by, the bridge is so old that it is almost broken.
<image>... | instruction | 0 | 89,162 | 1 | 178,324 |
"Correct Solution:
```
while True:
n = int(input())
if n == 0:
break
tlst = []
qlst = []
for _ in range(n):
m, a, b = map(int, input().split())
qlst.append((m, a, b))
tlst.append(a)
tlst.append(b)
tlst.append(b - 1)
tlst = sorted(list(set(tlst)))
tlst.sort()
tdic = {}
for i, t ... | output | 1 | 89,162 | 1 | 178,325 |
Provide a correct Python 3 solution for this coding contest problem.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by, the bridge is so old that it is almost broken.
<image>... | instruction | 0 | 89,163 | 1 | 178,326 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
Dangerous Bridge
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0231
"""
import sys
def solve(n):
events = []
for _ in range(n):
m, a, b = map(int, input().split())
events.append([a, m])
events.append([b, -m])
weight = ... | output | 1 | 89,163 | 1 | 178,327 |
Provide a correct Python 3 solution for this coding contest problem.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by, the bridge is so old that it is almost broken.
<image>... | instruction | 0 | 89,164 | 1 | 178,328 |
"Correct Solution:
```
# coding: utf-8
# Your code here!
class Sch:
def __init__(self, m, t):
self.m = m
self.t = t
def __lt__(self,other):
if self.t == other.t:
return self.m < other.m
else:
return self.t < other.t
while True:
N = ... | output | 1 | 89,164 | 1 | 178,329 |
Provide a correct Python 3 solution for this coding contest problem.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by, the bridge is so old that it is almost broken.
<image>... | instruction | 0 | 89,165 | 1 | 178,330 |
"Correct Solution:
```
while True:
n = int(input())
if n == 0:
break
tlst = []
qlst = []
for _ in range(n):
m, a, b = map(int, input().split())
qlst.append((m, a, b))
tlst.append(a)
tlst.append(b)
tlst = sorted(list(set(tlst)))
tlst.sort()
tdic = {}
for i, t in enumerate(tlst):
... | output | 1 | 89,165 | 1 | 178,331 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by,... | instruction | 0 | 89,166 | 1 | 178,332 |
Yes | output | 1 | 89,166 | 1 | 178,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by,... | instruction | 0 | 89,167 | 1 | 178,334 |
Yes | output | 1 | 89,167 | 1 | 178,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by,... | instruction | 0 | 89,168 | 1 | 178,336 |
Yes | output | 1 | 89,168 | 1 | 178,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by,... | instruction | 0 | 89,169 | 1 | 178,338 |
Yes | output | 1 | 89,169 | 1 | 178,339 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by,... | instruction | 0 | 89,170 | 1 | 178,340 |
No | output | 1 | 89,170 | 1 | 178,341 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by,... | instruction | 0 | 89,171 | 1 | 178,342 |
No | output | 1 | 89,171 | 1 | 178,343 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by,... | instruction | 0 | 89,172 | 1 | 178,344 |
No | output | 1 | 89,172 | 1 | 178,345 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to the surrounding villages. Despite the large number of passers-by,... | instruction | 0 | 89,173 | 1 | 178,346 |
No | output | 1 | 89,173 | 1 | 178,347 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway networ... | instruction | 0 | 89,316 | 1 | 178,632 |
Tags: brute force, greedy
Correct Solution:
```
from collections import defaultdict
def dist(a, b, n):
if b >= a:
return b - a
else:
return n - a + b
n, m = (int(x) for x in input().split())
stations = defaultdict(list)
for _ in range(m):
a, b = (int(x) for x in input().split())
statio... | output | 1 | 89,316 | 1 | 178,633 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway networ... | instruction | 0 | 89,317 | 1 | 178,634 |
Tags: brute force, greedy
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
BUFSIZE = 8192
class Fast... | output | 1 | 89,317 | 1 | 178,635 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway networ... | instruction | 0 | 89,318 | 1 | 178,636 |
Tags: brute force, greedy
Correct Solution:
```
def dist(a,b):
return (b-a)%n
n, m = map(int, input().split())
cnd = [0 for x in range(n+1)]
mn = [5000 for x in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
# print(a,b,dist(a,b))
cnd[a] += 1
mn[a] = min(mn[a], dist(a,b))
# print(... | output | 1 | 89,318 | 1 | 178,637 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway networ... | instruction | 0 | 89,319 | 1 | 178,638 |
Tags: brute force, greedy
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
BUFSIZE = 8192
class FastIO(IOBase):
ne... | output | 1 | 89,319 | 1 | 178,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway networ... | instruction | 0 | 89,320 | 1 | 178,640 |
Tags: brute force, greedy
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
import threading
from copy import deepcopy
def main():
n,m = map(int,input().split())
station = [[] for _ in range(n+1)]
time = [0]*(n+1)
... | output | 1 | 89,320 | 1 | 178,641 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway networ... | instruction | 0 | 89,321 | 1 | 178,642 |
Tags: brute force, greedy
Correct Solution:
```
if __name__ == "__main__":
from sys import stdin
n, m = list(map(int, stdin.readline().split()))
c = {}
for _ in range(m):
a, b = list(map(int, stdin.readline().split()))
if (a-1) not in c.keys():
c[a-1] = []
x = b-a + (n if b<a else 0)
c[a-1].append(x)
... | output | 1 | 89,321 | 1 | 178,643 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway networ... | instruction | 0 | 89,322 | 1 | 178,644 |
Tags: brute force, greedy
Correct Solution:
```
import sys
n, m = (int(t) for t in input().split(' '))
candies_total = [0 for _ in range(n)]
closest_distance = [n for _ in range(n)]
candies = sys.stdin.readlines()
for i in range(m):
from_, to = (int(t) - 1 for t in candies[i].split(' '))
candies_total[from_... | output | 1 | 89,322 | 1 | 178,645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway networ... | instruction | 0 | 89,323 | 1 | 178,646 |
Tags: brute force, greedy
Correct Solution:
```
def dist(a, b):
return (b - a) % n
n, m = list(map(int, input().split(" ")))
sweets = {i: [] for i in range(n)}
for i in range(m):
s, t = list(map(int, input().split(" ")))
sweets[s - 1].append(t - 1)
t = {i: 0 for i in range(n)}
for i in range(n):
swe... | output | 1 | 89,323 | 1 | 178,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consi... | instruction | 0 | 89,324 | 1 | 178,648 |
Yes | output | 1 | 89,324 | 1 | 178,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consi... | instruction | 0 | 89,325 | 1 | 178,650 |
Yes | output | 1 | 89,325 | 1 | 178,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consi... | instruction | 0 | 89,326 | 1 | 178,652 |
Yes | output | 1 | 89,326 | 1 | 178,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consi... | instruction | 0 | 89,327 | 1 | 178,654 |
Yes | output | 1 | 89,327 | 1 | 178,655 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consi... | instruction | 0 | 89,328 | 1 | 178,656 |
Yes | output | 1 | 89,328 | 1 | 178,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consi... | instruction | 0 | 89,329 | 1 | 178,658 |
No | output | 1 | 89,329 | 1 | 178,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consi... | instruction | 0 | 89,330 | 1 | 178,660 |
No | output | 1 | 89,330 | 1 | 178,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consi... | instruction | 0 | 89,331 | 1 | 178,662 |
No | output | 1 | 89,331 | 1 | 178,663 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consi... | instruction | 0 | 89,332 | 1 | 178,664 |
No | output | 1 | 89,332 | 1 | 178,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by exis... | instruction | 0 | 89,585 | 1 | 179,170 |
Tags: graphs, shortest paths
Correct Solution:
```
from sys import stdin
input = stdin.readline
n = int(input())
m = []
for ni in range(n): m.append([int(x) for x in input().strip().split()])
q = int(input())
ans = []
for qi in range(q):
s, e, v = [int(x) for x in input().strip().split()]
s-=1
e-=1
for ... | output | 1 | 89,585 | 1 | 179,171 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by exis... | instruction | 0 | 89,586 | 1 | 179,172 |
Tags: graphs, shortest paths
Correct Solution:
```
n = int(input())
a = []
for i in range(n):
a.append(list(map(int,input().split())))
k = int(input())
for y in range(k):
u,v,d = map(int,input().split())
u = u-1
v = v-1
a[u][v] = min(a[u][v],d)
for i in range(n):
for j in range(n):
... | output | 1 | 89,586 | 1 | 179,173 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by exis... | instruction | 0 | 89,587 | 1 | 179,174 |
Tags: graphs, shortest paths
Correct Solution:
```
n = int(input())
mt = [[] for _i in range(n)]
for i in range(n):
mt[i] = list(map(int,input().split()))
# print(mt)
kk = int(input())
for i in range(kk):
a,b,c = map(int,input().split())
a-=1
b-=1
if mt[a][b]>c:
mt[a][b] = c
mt[b]... | output | 1 | 89,587 | 1 | 179,175 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by exis... | instruction | 0 | 89,588 | 1 | 179,176 |
Tags: graphs, shortest paths
Correct Solution:
```
from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bi... | output | 1 | 89,588 | 1 | 179,177 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.