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.
In the country there are n cities and m bidirectional roads between them. Each city has an army. Army of the i-th city consists of ai soldiers. Now soldiers roam. After roaming each soldier has ... | instruction | 0 | 26,023 | 1 | 52,046 |
No | output | 1 | 26,023 | 1 | 52,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In the country there are n cities and m bidirectional roads between them. Each city has an army. Army of the i-th city consists of ai soldiers. Now soldiers roam. After roaming each soldier has ... | instruction | 0 | 26,024 | 1 | 52,048 |
No | output | 1 | 26,024 | 1 | 52,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In the country there are n cities and m bidirectional roads between them. Each city has an army. Army of the i-th city consists of ai soldiers. Now soldiers roam. After roaming each soldier has ... | instruction | 0 | 26,025 | 1 | 52,050 |
No | output | 1 | 26,025 | 1 | 52,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In the country there are n cities and m bidirectional roads between them. Each city has an army. Army of the i-th city consists of ai soldiers. Now soldiers roam. After roaming each soldier has ... | instruction | 0 | 26,026 | 1 | 52,052 |
No | output | 1 | 26,026 | 1 | 52,053 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line; the segment contains exactly n + 1 bus stops. ... | instruction | 0 | 26,554 | 1 | 53,108 |
Tags: binary search, data structures, dp
Correct Solution:
```
a,b=map(int,input().split())
z=[]
g=10**9+7
def f():
return map(int,input().split())
if b==0:
print (0)
else:
s=set()
for i in range(b):
x,y=f()
z.append((x,y))
s.add(x)
s.add(y)
s.add (0)
... | output | 1 | 26,554 | 1 | 53,109 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line; the segment contains exactly n + 1 bus stops. ... | instruction | 0 | 26,555 | 1 | 53,110 |
Tags: binary search, data structures, dp
Correct Solution:
```
a,b=map(int,input().split())
z=[]
g=10**9+7
def f():
return map(int,input().split())
if b==0:
print (0)
else:
s=set()
for i in range(b):
x,y=f()
z.append((x,y))
s.add(x)
s.add(y)
s.add (0)
s.add (a)
... | output | 1 | 26,555 | 1 | 53,111 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line; the segment contains exactly n + 1 bus stops. ... | instruction | 0 | 26,556 | 1 | 53,112 |
Tags: binary search, data structures, dp
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from bisect import bisect_left as bt
def main():
mod = 10**9+7
n,m = map(int,input().split())
jump,x = [],[]
for i in range(m):
... | output | 1 | 26,556 | 1 | 53,113 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line;... | instruction | 0 | 26,557 | 1 | 53,114 |
No | output | 1 | 26,557 | 1 | 53,115 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line;... | instruction | 0 | 26,558 | 1 | 53,116 |
No | output | 1 | 26,558 | 1 | 53,117 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line;... | instruction | 0 | 26,559 | 1 | 53,118 |
No | output | 1 | 26,559 | 1 | 53,119 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line;... | instruction | 0 | 26,560 | 1 | 53,120 |
No | output | 1 | 26,560 | 1 | 53,121 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the (Ox) axis.
On this street, there are n antennas, numbered from 1 to n. The i-th antenna lies on the position x_i and has an initial scope of... | instruction | 0 | 26,657 | 1 | 53,314 |
Tags: data structures, dp, greedy, sortings
Correct Solution:
```
import sys
from operator import itemgetter
readline = sys.stdin.readline
N, M = map(int, readline().split())
inf = 10**9+7
XS = [(0, 0)] + [tuple(map(int, readline().split())) for _ in range(N)]
XS.sort(key = lambda x: x[0]-x[1])
x, s = XS[0]
dp1 =... | output | 1 | 26,657 | 1 | 53,315 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the (Ox) axis.
On this street, there are n antennas, numbered from 1 to n. The i-th antenna lies on the position x_i and has an initial scope of... | instruction | 0 | 26,658 | 1 | 53,316 |
Tags: data structures, dp, greedy, sortings
Correct Solution:
```
n, m = [int(x.strip()) for x in input().split()]
u = [[int(x.strip()) for x in input().split()] for _ in range(n)]
u = [(max(x[0] - x[1], 1), min(x[0] + x[1], m)) for x in u]
u = sorted(u)
d = [2 ** 60] * (m+11)
d[0] = 0
for s, e in u:
next_d = [2... | output | 1 | 26,658 | 1 | 53,317 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the (Ox) axis.
On this street, there are n antennas, numbered from 1 to n. The i-th antenna lies on the position x_i and has an initial scope of... | instruction | 0 | 26,659 | 1 | 53,318 |
Tags: data structures, dp, greedy, sortings
Correct Solution:
```
import sys
from array import array # noqa: F401
from typing import List, Tuple, TypeVar, Generic, Sequence, Union # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
def main():
n, m = map(int, input().split())
... | output | 1 | 26,659 | 1 | 53,319 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the (Ox) axis.
On this street, there are n antennas, numbered from 1 to n. The i-th antenna lies on the position x_i and has an initial scope of... | instruction | 0 | 26,660 | 1 | 53,320 |
Tags: data structures, dp, greedy, sortings
Correct Solution:
```
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
A=[]
COVERED=[0]*(m+1)
for i in range(n):
x,y=map(int,input().split())
A.append((x-y,x+y))
for j in range(max(0,x-y),min(m+1,x+y+1)):
COVERED[j]=1
if min(COVERED[... | output | 1 | 26,660 | 1 | 53,321 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the (Ox) axis.
On this street, there are n antennas, numbered from 1 to n. The i-th antenna lies on the position x_i and has an initial scope of... | instruction | 0 | 26,661 | 1 | 53,322 |
Tags: data structures, dp, greedy, sortings
Correct Solution:
```
n , m = map(int,input().split())
a=[]
for i in range(n):
b , c = map(int,input().split())
a.append((max(0,b-c),min(b+c,m)))
dp=[0]*(m+1)
for i in range(1,m+1):
dp[i]=i
for j in range(n):
c,d=a[j]
if c<=i and i<=d:
... | output | 1 | 26,661 | 1 | 53,323 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the (Ox) axis.
On this street, there are n antennas, numbered from 1 to n. The i-th antenna lies on the position x_i and has an initial scope of... | instruction | 0 | 26,662 | 1 | 53,324 |
Tags: data structures, dp, greedy, sortings
Correct Solution:
```
#watu
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
St = [list(map(int, input().split())) for _ in range(N)]
dp = [M-i for i in range(M+1)]
for m in reversed(range(M)):
covered = False
for x, s in St:
if x-s <... | output | 1 | 26,662 | 1 | 53,325 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the (Ox) axis.
On this street, there are n antennas, numbered from 1 to n. The i-th antenna lies on the position x_i and has an initial scope of... | instruction | 0 | 26,663 | 1 | 53,326 |
Tags: data structures, dp, greedy, sortings
Correct Solution:
```
import sys
from operator import itemgetter
input = sys.stdin.readline
n, m = map(int, input().split())
info = [list(map(int, input().split())) for i in range(n)]
INF = 10**9
new_info = []
for pos, width in info:
tmp = [max(pos-width-1, 0), min(po... | output | 1 | 26,663 | 1 | 53,327 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the (Ox) axis.
On this street, there are n antennas, numbered from 1 to n. The i-th antenna lies on the position x_i and has an initial scope of... | instruction | 0 | 26,664 | 1 | 53,328 |
Tags: data structures, dp, greedy, sortings
Correct Solution:
```
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
St = [list(map(int, input().split())) for _ in range(N)]
dp = [M-i for i in range(M+1)]
for m in reversed(range(M)):
covered = False
for x, s in St:
if x-s <= m+1 ... | output | 1 | 26,664 | 1 | 53,329 |
Provide tags and a correct Python 2 solution for this coding contest problem.
Students of Winter Informatics School are going to live in a set of houses connected by underground passages. Teachers are also going to live in some of these houses, but they can not be accommodated randomly. For safety reasons, the followi... | instruction | 0 | 26,740 | 1 | 53,480 |
Tags: constructive algorithms, dfs and similar, graph matchings, graphs, greedy
Correct Solution:
```
""" Python 3 compatibility tools. """
from __future__ import division, print_function
import itertools
import sys
import os
from io import BytesIO
from atexit import register
if sys.version_info[0] < 3:
input = ra... | output | 1 | 26,740 | 1 | 53,481 |
Provide tags and a correct Python 2 solution for this coding contest problem.
Students of Winter Informatics School are going to live in a set of houses connected by underground passages. Teachers are also going to live in some of these houses, but they can not be accommodated randomly. For safety reasons, the followi... | instruction | 0 | 26,741 | 1 | 53,482 |
Tags: constructive algorithms, dfs and similar, graph matchings, graphs, greedy
Correct Solution:
```
""" Python 3 compatibility tools. """
from __future__ import division, print_function
import itertools
import sys
import os
from io import BytesIO
from atexit import register
if sys.version_info[0] < 3:
input = ra... | output | 1 | 26,741 | 1 | 53,483 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Students of Winter Informatics School are going to live in a set of houses connected by underground passages. Teachers are also going to live in some of these houses, but they can not be accommodated randomly. For safety reasons, the followi... | instruction | 0 | 26,744 | 1 | 53,488 |
Tags: constructive algorithms, dfs and similar, graph matchings, graphs, greedy
Correct Solution:
```
"""
#If FastIO not needed, use this and don't forget to strip
#import sys, math
#input = sys.stdin.readline
"""
import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bi... | output | 1 | 26,744 | 1 | 53,489 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Students of Winter Informatics School are going to live in a set of houses connected by underground passages. Teachers are also going to live in some of these houses, but they can not be accommodated randomly. For safety reasons, the followi... | instruction | 0 | 26,749 | 1 | 53,498 |
Tags: constructive algorithms, dfs and similar, graph matchings, graphs, greedy
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
def __init__(self, file):
self.newlines = 0
self._fd = file.fileno()
self.buffer = By... | output | 1 | 26,749 | 1 | 53,499 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without vi... | instruction | 0 | 26,953 | 1 | 53,906 |
Tags: graphs, shortest paths
Correct Solution:
```
from collections import defaultdict, deque
n, m, k = map(int, input().split())
graph = defaultdict(list)
for i in range(m):
x, y = map(int, input().split())
graph[x].append(y)
graph[y].append(x)
mp = {}
for i in range(k):
a, b, c = map(int, input().spl... | output | 1 | 26,953 | 1 | 53,907 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without vi... | instruction | 0 | 26,954 | 1 | 53,908 |
Tags: graphs, shortest paths
Correct Solution:
```
from collections import defaultdict,deque
n,m,k = map(int,input().split())
graph = defaultdict(list)
# a = list(map(int,input().split()))
for i in range(m):
x,y = map(int,input().split())
graph[x].append(y)
graph[y].append(x)
mp = {}
for i in range(k):
... | output | 1 | 26,954 | 1 | 53,909 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without vi... | instruction | 0 | 26,955 | 1 | 53,910 |
Tags: graphs, shortest paths
Correct Solution:
```
n, m, k = map(int, input().split())
graph = [[] for i in range(n + 2)]
for _ in range(m):
x, y = map(int, input().split())
graph[x].append(y)
graph[y].append(x)
graph[n].append(n + 1)
triples = set(a + (b + c * n) * n for a, b, c in ( map(int, input(... | output | 1 | 26,955 | 1 | 53,911 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without vi... | instruction | 0 | 26,956 | 1 | 53,912 |
Tags: graphs, shortest paths
Correct Solution:
```
def read(): return map(int, input().split())
n, m, k = read()
g = [[] for i in range(n + 2)]
for _ in range(m):
u, v = read()
g[u].append(v)
g[v].append(u)
g[n].append(n + 1)
triples = set(a + (b + c * n) * n for a, b, c in (read() for i in range(k)))
p ... | output | 1 | 26,956 | 1 | 53,913 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without vi... | instruction | 0 | 26,957 | 1 | 53,914 |
Tags: graphs, shortest paths
Correct Solution:
```
#https://codeforces.com/contest/59/problem/E
class Pathclass:
def __init__(self,node_number,nextnode):
self.number = node_number
self.next = nextnode
import collections
lis = input().split()
n,m,k = int(lis[0]),int(lis[1]),int(lis[2])
adjlis = [collections.deque(... | output | 1 | 26,957 | 1 | 53,915 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without vi... | instruction | 0 | 26,958 | 1 | 53,916 |
Tags: graphs, shortest paths
Correct Solution:
```
import sys
from array import array # noqa: F401
from collections import deque
def input():
return sys.stdin.buffer.readline().decode('utf-8')
n, m, k = map(int, input().split())
adj = [[] for _ in range(n)]
for u, v in (map(int, input().split()) for _ in rang... | output | 1 | 26,958 | 1 | 53,917 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without vi... | instruction | 0 | 26,959 | 1 | 53,918 |
Tags: graphs, shortest paths
Correct Solution:
```
import sys
I = lambda: int(input())
RL = readline = lambda: sys.stdin.readline().strip('\n')
RM = readmap = lambda x = int: map(x,readline().split(' '))
def rec(u,v):
'''to recursivley visit the edge previous to this edge'''
if v: rec(pre[u][v],u);print(v,e... | output | 1 | 26,959 | 1 | 53,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without vi... | instruction | 0 | 26,960 | 1 | 53,920 |
Tags: graphs, shortest paths
Correct Solution:
```
from queue import PriorityQueue
n, m, k = map(int, input().split())
road = [[0] * (n + 1) for i in range(n + 1)]
for i in range(m):
x, y = map(int, input().split())
road[x][y] = 1
road[y][x] = 1
halfSps = {}
sps = {}
for i in range(k):
a, b, c = map(in... | output | 1 | 26,960 | 1 | 53,921 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller vi... | instruction | 0 | 26,961 | 1 | 53,922 |
Yes | output | 1 | 26,961 | 1 | 53,923 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller vi... | instruction | 0 | 26,962 | 1 | 53,924 |
Yes | output | 1 | 26,962 | 1 | 53,925 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller vi... | instruction | 0 | 26,963 | 1 | 53,926 |
Yes | output | 1 | 26,963 | 1 | 53,927 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller vi... | instruction | 0 | 26,964 | 1 | 53,928 |
Yes | output | 1 | 26,964 | 1 | 53,929 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller vi... | instruction | 0 | 26,965 | 1 | 53,930 |
No | output | 1 | 26,965 | 1 | 53,931 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller vi... | instruction | 0 | 26,966 | 1 | 53,932 |
No | output | 1 | 26,966 | 1 | 53,933 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller vi... | instruction | 0 | 26,967 | 1 | 53,934 |
No | output | 1 | 26,967 | 1 | 53,935 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller vi... | instruction | 0 | 26,968 | 1 | 53,936 |
No | output | 1 | 26,968 | 1 | 53,937 |
Provide a correct Python 3 solution for this coding contest problem.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route ... | instruction | 0 | 27,326 | 1 | 54,652 |
"Correct Solution:
```
INF = 10 ** 20
def search(rest, now, goal, dp, edges):
if now == goal:
return 0
if rest == ():
if now == goal:
return 0
else:
return INF
if (rest, now) in dp:
return dp[(rest, now)]
ret = INF
for i, t in enumerate(rest):
for dist, to in edges[now]:
... | output | 1 | 27,326 | 1 | 54,653 |
Provide a correct Python 3 solution for this coding contest problem.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route ... | instruction | 0 | 27,327 | 1 | 54,654 |
"Correct Solution:
```
while True:
N, M, P, A, B = map(int, input().split())
if not (N | M | P | A | B):
break
A, B = A - 1, B - 1
T = [int(x) for x in input().split()]
dp = [[float("inf")] * M for _ in range(1 << N)]
dp[0][A] = 0
edges = []
for _ in range(P):
s, t, c = m... | output | 1 | 27,327 | 1 | 54,655 |
Provide a correct Python 3 solution for this coding contest problem.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route ... | instruction | 0 | 27,328 | 1 | 54,656 |
"Correct Solution:
```
while True:
N, M, P, A, B = map(int, input().split())
if not (N | M | P | A | B):
break
A, B = A - 1, B - 1
T = [int(x) for x in input().split()]
dp = [[float("inf")] * M for _ in range(1 << N)]
dp[0][A] = 0
edges = []
for _ in range(P):
s, t, c = m... | output | 1 | 27,328 | 1 | 54,657 |
Provide a correct Python 3 solution for this coding contest problem.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route ... | instruction | 0 | 27,329 | 1 | 54,658 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
from heapq import heappop, heappush
def inpl(): return list(map(int, input().split()))
N, M, P, A, B = inpl()
INF = 10**6
while N:
T = inpl()
G = [[] for _ in range(M+1)]
D = [2**i for i in range(N)]
for _ in range(P):
x, y, z = inpl()
G[x... | output | 1 | 27,329 | 1 | 54,659 |
Provide a correct Python 3 solution for this coding contest problem.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route ... | instruction | 0 | 27,330 | 1 | 54,660 |
"Correct Solution:
```
while True:
N, M, P, A, B = map(int, input().split())
if not (N | M | P | A | B):
break
A, B = A - 1, B - 1
T = [int(x) for x in input().split()]
dp = [[float("inf")] * M for _ in range(1 << N)]
dp[0][A] = 0
edges = []
for _ in range(P):
s, t, c = m... | output | 1 | 27,330 | 1 | 54,661 |
Provide a correct Python 3 solution for this coding contest problem.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route ... | instruction | 0 | 27,331 | 1 | 54,662 |
"Correct Solution:
```
while True:
N, M, P, A, B = map(int, input().split())
if not (N | M | P | A | B):
break
A, B = A - 1, B - 1
T = [int(x) for x in input().split()]
dp = [[float("inf")] * M for _ in range(1 << N)]
dp[0][A] = 0
edges = []
for _ in range(P):
s, t, c = m... | output | 1 | 27,331 | 1 | 54,663 |
Provide a correct Python 3 solution for this coding contest problem.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route ... | instruction | 0 | 27,332 | 1 | 54,664 |
"Correct Solution:
```
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().... | output | 1 | 27,332 | 1 | 54,665 |
Provide a correct Python 3 solution for this coding contest problem.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route ... | instruction | 0 | 27,333 | 1 | 54,666 |
"Correct Solution:
```
INF = 10 ** 20
def search(rest, now, goal, dp, edges):
if now == goal:
return 0
if rest == ():
if now == goal:
return 0
else:
return INF
if (rest, now) in dp:
return dp[(rest, now)]
ret = INF
for i, t in enumerate(rest):
for dist, to in edges[now]:
... | output | 1 | 27,333 | 1 | 54,667 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this p... | instruction | 0 | 27,334 | 1 | 54,668 |
Yes | output | 1 | 27,334 | 1 | 54,669 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this p... | instruction | 0 | 27,335 | 1 | 54,670 |
Yes | output | 1 | 27,335 | 1 | 54,671 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this p... | instruction | 0 | 27,336 | 1 | 54,672 |
Yes | output | 1 | 27,336 | 1 | 54,673 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.