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.
Your company was appointed to lay new asphalt on the highway of length n. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or ... | instruction | 0 | 69,982 | 1 | 139,964 |
Yes | output | 1 | 69,982 | 1 | 139,965 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your company was appointed to lay new asphalt on the highway of length n. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or ... | instruction | 0 | 69,983 | 1 | 139,966 |
Yes | output | 1 | 69,983 | 1 | 139,967 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your company was appointed to lay new asphalt on the highway of length n. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or ... | instruction | 0 | 69,984 | 1 | 139,968 |
Yes | output | 1 | 69,984 | 1 | 139,969 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your company was appointed to lay new asphalt on the highway of length n. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or ... | instruction | 0 | 69,985 | 1 | 139,970 |
No | output | 1 | 69,985 | 1 | 139,971 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your company was appointed to lay new asphalt on the highway of length n. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or ... | instruction | 0 | 69,986 | 1 | 139,972 |
No | output | 1 | 69,986 | 1 | 139,973 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your company was appointed to lay new asphalt on the highway of length n. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or ... | instruction | 0 | 69,987 | 1 | 139,974 |
No | output | 1 | 69,987 | 1 | 139,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your company was appointed to lay new asphalt on the highway of length n. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or ... | instruction | 0 | 69,988 | 1 | 139,976 |
No | output | 1 | 69,988 | 1 | 139,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undirected roads, and for any two cities there always exists a path between them.
F... | instruction | 0 | 70,149 | 1 | 140,298 |
No | output | 1 | 70,149 | 1 | 140,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undirected roads, and for any two cities there always exists a path between them.
F... | instruction | 0 | 70,150 | 1 | 140,300 |
No | output | 1 | 70,150 | 1 | 140,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undirected roads, and for any two cities there always exists a path between them.
F... | instruction | 0 | 70,151 | 1 | 140,302 |
No | output | 1 | 70,151 | 1 | 140,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undirected roads, and for any two cities there always exists a path between them.
F... | instruction | 0 | 70,152 | 1 | 140,304 |
No | output | 1 | 70,152 | 1 | 140,305 |
Provide a correct Python 3 solution for this coding contest problem.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed to complete the sturdy and large building. There is no ... | instruction | 0 | 70,652 | 1 | 141,304 |
"Correct Solution:
```
from heapq import heappop, heappush
def solve(graph,start,goal,numnodes):
que = []
heappush(que,(0,start-1))
mindists = [float("inf")]*numnodes
while que:
ccost,cnode = heappop(que)
if mindists[cnode] < ccost: continue
for nnode,mcost in graph[cnode]:
... | output | 1 | 70,652 | 1 | 141,305 |
Provide a correct Python 3 solution for this coding contest problem.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed to complete the sturdy and large building. There is no ... | instruction | 0 | 70,653 | 1 | 141,306 |
"Correct Solution:
```
n=int(input())
m=int(input())
l=[]
for i in range(m):
l1=list(map(int,input().split(",")))
l.append(l1)
s,g,v,p=map(int,input().split(","))
listl=[[100000 for i in range(n+1)] for i in range(n+1)]
for i in l:
listl[i[0]][i[1]]=i[2]
listl[i[1]][i[0]]=i[3]
for i in range(1,n+1):
for j in ... | output | 1 | 70,653 | 1 | 141,307 |
Provide a correct Python 3 solution for this coding contest problem.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed to complete the sturdy and large building. There is no ... | instruction | 0 | 70,654 | 1 | 141,308 |
"Correct Solution:
```
N = int(input().strip())
M = int(input().strip())
Inf = 1001001001
K = [[Inf for j in range(N)] for i in range(N)]
for _ in range(M):
a,b,c,d = map(int,input().strip().split(","))
K[a-1][b-1] = c
K[b-1][a-1] = d
S,G,V,P = map(int,input().strip().split(","))
for k in range(N):
for ... | output | 1 | 70,654 | 1 | 141,309 |
Provide a correct Python 3 solution for this coding contest problem.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed to complete the sturdy and large building. There is no ... | instruction | 0 | 70,655 | 1 | 141,310 |
"Correct Solution:
```
class Graph():
from collections import namedtuple
__Pair = namedtuple("Pair", "cost point")
def __init__(self, townCount):
self.__townCount = townCount
self.__adjacencyList = [[] for _ in range(townCount)]
def GetPath(self, beginPoint, endPoint, cost):
i... | output | 1 | 70,655 | 1 | 141,311 |
Provide a correct Python 3 solution for this coding contest problem.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed to complete the sturdy and large building. There is no ... | instruction | 0 | 70,656 | 1 | 141,312 |
"Correct Solution:
```
n = int(input())
m = int(input())
K = [[float('inf') for i in range(n)] for j in range(n)]
#print(K)
for i in range(m):
a,b,c,d = map(int,input().split(','))
#print(a,b,c,d)
K[a-1][b-1] = c
K[b-1][a-1] = d
for k in range(n):
for i in range(n):
for j in range(n):
... | output | 1 | 70,656 | 1 | 141,313 |
Provide a correct Python 3 solution for this coding contest problem.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed to complete the sturdy and large building. There is no ... | instruction | 0 | 70,657 | 1 | 141,314 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0117
AC
"""
import sys
from sys import stdin
input = stdin.readline
def warshallFloyd(V, dp):
for k in range(V):
for i in range(V):
for j in range(V):
if dp[i][k] + dp[k]... | output | 1 | 70,657 | 1 | 141,315 |
Provide a correct Python 3 solution for this coding contest problem.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed to complete the sturdy and large building. There is no ... | instruction | 0 | 70,658 | 1 | 141,316 |
"Correct Solution:
```
import sys
n = int(input())
m = int(input())
cost = [[float("inf")] * n for _ in range(n)]
for _ in range(m):
a, b, c, d = map(int, sys.stdin.readline().split(","))
cost[a - 1][b - 1] = c
cost[b - 1][a - 1] = d
s, g, V, P = map(int, sys.stdin.readline().split(","))
for k in range(n):... | output | 1 | 70,658 | 1 | 141,317 |
Provide a correct Python 3 solution for this coding contest problem.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed to complete the sturdy and large building. There is no ... | instruction | 0 | 70,659 | 1 | 141,318 |
"Correct Solution:
```
n = int(input())
m = int(input())
K = [[10**9 for one in range(32)] for two in range(32)]
for three in range(m):
a,b,c,d = map(int,input().split(","))
K[a][b] = c
K[b][a] = d
for k in range(1,n+1):
for j in range(1,n+1):
for i in range(1,n+1):
if K[i][j] > K[i... | output | 1 | 70,659 | 1 | 141,319 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed... | instruction | 0 | 70,660 | 1 | 141,320 |
Yes | output | 1 | 70,660 | 1 | 141,321 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed... | instruction | 0 | 70,661 | 1 | 141,322 |
Yes | output | 1 | 70,661 | 1 | 141,323 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed... | instruction | 0 | 70,662 | 1 | 141,324 |
Yes | output | 1 | 70,662 | 1 | 141,325 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed... | instruction | 0 | 70,663 | 1 | 141,326 |
Yes | output | 1 | 70,663 | 1 | 141,327 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed... | instruction | 0 | 70,664 | 1 | 141,328 |
No | output | 1 | 70,664 | 1 | 141,329 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed... | instruction | 0 | 70,665 | 1 | 141,330 |
No | output | 1 | 70,665 | 1 | 141,331 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed... | instruction | 0 | 70,666 | 1 | 141,332 |
No | output | 1 | 70,666 | 1 | 141,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed... | instruction | 0 | 70,667 | 1 | 141,334 |
No | output | 1 | 70,667 | 1 | 141,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The whole delivery market of Berland is controlled by two rival companies: BerEx and BerPS. They both provide fast and reliable delivery services across all the cities of Berland.
The map of Be... | instruction | 0 | 70,797 | 1 | 141,594 |
No | output | 1 | 70,797 | 1 | 141,595 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The whole delivery market of Berland is controlled by two rival companies: BerEx and BerPS. They both provide fast and reliable delivery services across all the cities of Berland.
The map of Be... | instruction | 0 | 70,798 | 1 | 141,596 |
No | output | 1 | 70,798 | 1 | 141,597 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The whole delivery market of Berland is controlled by two rival companies: BerEx and BerPS. They both provide fast and reliable delivery services across all the cities of Berland.
The map of Be... | instruction | 0 | 70,799 | 1 | 141,598 |
No | output | 1 | 70,799 | 1 | 141,599 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The whole delivery market of Berland is controlled by two rival companies: BerEx and BerPS. They both provide fast and reliable delivery services across all the cities of Berland.
The map of Be... | instruction | 0 | 70,800 | 1 | 141,600 |
No | output | 1 | 70,800 | 1 | 141,601 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Denis came to Nastya and discovered that she was not happy to see him... There is only one chance that she can become happy. Denis wants to buy all things that Nastya likes so she will certainly... | instruction | 0 | 70,881 | 1 | 141,762 |
No | output | 1 | 70,881 | 1 | 141,763 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Due to the recent popularity of the Deep learning new countries are starting to look like Neural Networks. That is, the countries are being built deep with many layers, each layer possibly having many cities. They also have one entry, and on... | instruction | 0 | 71,309 | 1 | 142,618 |
Tags: dp, matrices
Correct Solution:
```
from sys import stdin
input = stdin.readline
def main():
mod = 10**9 + 7
n,l,m = map(int,input().split())
ar = [0 for i in range(m)]
ar3 = [0 for i in range(m)]
def f(num):
return int(num) % m
def f2(num):
return num % 1000000007
... | output | 1 | 71,309 | 1 | 142,619 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the recent popularity of the Deep learning new countries are starting to look like Neural Networks. That is, the countries are being built deep with many layers, each layer possibly havin... | instruction | 0 | 71,310 | 1 | 142,620 |
No | output | 1 | 71,310 | 1 | 142,621 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the recent popularity of the Deep learning new countries are starting to look like Neural Networks. That is, the countries are being built deep with many layers, each layer possibly havin... | instruction | 0 | 71,311 | 1 | 142,622 |
No | output | 1 | 71,311 | 1 | 142,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the recent popularity of the Deep learning new countries are starting to look like Neural Networks. That is, the countries are being built deep with many layers, each layer possibly havin... | instruction | 0 | 71,312 | 1 | 142,624 |
No | output | 1 | 71,312 | 1 | 142,625 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the recent popularity of the Deep learning new countries are starting to look like Neural Networks. That is, the countries are being built deep with many layers, each layer possibly havin... | instruction | 0 | 71,313 | 1 | 142,626 |
No | output | 1 | 71,313 | 1 | 142,627 |
Provide a correct Python 3 solution for this coding contest problem.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a competitive relationship with each other.
In this metropolita... | instruction | 0 | 71,548 | 1 | 143,096 |
"Correct Solution:
```
from sys import stdin
def solve():
file_input = stdin
data_sets_num = int(file_input.readline())
for i in range(data_sets_num):
xa, ya, xb, yb = map(int, file_input.readline().split())
x_ab = xb - xa
y_ab = yb - ya
n = int(file_input.readline())
... | output | 1 | 71,548 | 1 | 143,097 |
Provide a correct Python 3 solution for this coding contest problem.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a competitive relationship with each other.
In this metropolita... | instruction | 0 | 71,549 | 1 | 143,098 |
"Correct Solution:
```
m = int(input())
while m:
m -= 1
ax, ay, bx, by = map(int, input().split())
n = int(input())
dx, dy = bx - ax, by - ay
intersections = set()
while n:
n -= 1
sx, sy, tx, ty, o, l = map(int, input().split())
tdx, tdy = tx - sx, ty - sy
asx, as... | output | 1 | 71,549 | 1 | 143,099 |
Provide a correct Python 3 solution for this coding contest problem.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a competitive relationship with each other.
In this metropolita... | instruction | 0 | 71,550 | 1 | 143,100 |
"Correct Solution:
```
for i in range(int(input())):
xa, ya, xb, yb = map(int, input().split())
n = int(input())
ip = []
for j in range(n):
xs, ys, xt, yt, o, l = map(int, input().split())
d = (xb - xa) * (yt - ys) - (yb - ya) * (xt - xs)
if d == 0:
continue
t... | output | 1 | 71,550 | 1 | 143,101 |
Provide a correct Python 3 solution for this coding contest problem.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a competitive relationship with each other.
In this metropolita... | instruction | 0 | 71,551 | 1 | 143,102 |
"Correct Solution:
```
m = int(input())
while m:
m -= 1
ax, ay, bx, by = map(int, input().split())
n = int(input())
dx, dy = bx - ax, by - ay
intersections = set()
while n:
n -= 1
sx, sy, tx, ty, o, l = map(int, input().split())
tdx, tdy = tx - sx, ty - sy
asx, as... | output | 1 | 71,551 | 1 | 143,103 |
Provide a correct Python 3 solution for this coding contest problem.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a competitive relationship with each other.
In this metropolita... | instruction | 0 | 71,552 | 1 | 143,104 |
"Correct Solution:
```
m = int(input())
while m:
m -= 1
ax, ay, bx, by = map(int, input().split())
n = int(input())
dx, dy = bx - ax, by - ay
intersections = set()
while n:
n -= 1
sx, sy, tx, ty, o, l = map(int, input().split())
tdx, tdy = tx - sx, ty - sy
asx, as... | output | 1 | 71,552 | 1 | 143,105 |
Provide a correct Python 3 solution for this coding contest problem.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a competitive relationship with each other.
In this metropolita... | instruction | 0 | 71,553 | 1 | 143,106 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int... | output | 1 | 71,553 | 1 | 143,107 |
Provide a correct Python 3 solution for this coding contest problem.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a competitive relationship with each other.
In this metropolita... | instruction | 0 | 71,554 | 1 | 143,108 |
"Correct Solution:
```
m = int(input())
while m:
m -= 1
ax, ay, bx, by = map(int, input().split())
n = int(input())
dx, dy = bx - ax, by - ay
intersections = set()
while n:
n -= 1
sx, sy, tx, ty, o, l = map(int, input().split())
tdx, tdy = tx - sx, ty - sy
asx, as... | output | 1 | 71,554 | 1 | 143,109 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a compet... | instruction | 0 | 71,555 | 1 | 143,110 |
No | output | 1 | 71,555 | 1 | 143,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a compet... | instruction | 0 | 71,556 | 1 | 143,112 |
No | output | 1 | 71,556 | 1 | 143,113 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a compet... | instruction | 0 | 71,557 | 1 | 143,114 |
No | output | 1 | 71,557 | 1 | 143,115 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a compet... | instruction | 0 | 71,558 | 1 | 143,116 |
No | output | 1 | 71,558 | 1 | 143,117 |
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 | 71,696 | 1 | 143,392 |
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 | 71,696 | 1 | 143,393 |
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 | 71,697 | 1 | 143,394 |
Tags: brute force, math
Correct Solution:
```
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
a,b=map(int,input().split())
a=a%k
MIN=10**12
MAX=0
def gcd(a, b):
while b:
a, b = b, a % b
return a
for i in range(n):
ne=i*k-b
dist=abs(a-ne)
#print(ne,dist)
if dist==... | output | 1 | 71,697 | 1 | 143,395 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.