message stringlengths 2 22.8k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 16 109k | cluster float64 1 1 | __index_level_0__ int64 32 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β
k cities. The cities are numerated from 1 to n β
k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetl... | instruction | 0 | 71,698 | 1 | 143,396 |
Tags: brute force, math
Correct Solution:
```
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
"""
549 D
"""
from math import gcd
n, k = map(int, input().split())
a, b = map(int, input().split())
nk = n*k
cand1 = (gcd(nk, abs(i*k+b-a)) for i in range(n))
cand2 = (gcd(nk, abs(i*k-b-a)) for i in ran... | output | 1 | 71,698 | 1 | 143,397 |
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,699 | 1 | 143,398 |
Tags: brute force, math
Correct Solution:
```
from math import gcd
n,k=map(int,input().split())
a,b=map(int,input().split())
r=[]
i=1
p=n*k
while i<=n*k:
r.append(i)
i+=k
s=1+a
c=[]
for i in r:
c.append((i-b)%p)
c.append((i+b)%p)
mx=0
mn=1111111111111111111111111
for i in c:
dp=i-s
dp%=p
if ... | output | 1 | 71,699 | 1 | 143,399 |
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,700 | 1 | 143,400 |
Tags: brute force, math
Correct Solution:
```
from math import *
N, K = map(int, input().split())
A, B = map(int, input().split())
S = [A, K - A]
E = []
for i in range(N):
if i * K + B >= 0:
E += [i * K + B]
if i * K - B >= 0:
E += [i * K - B]
l = set()
for e in E:
l.add(abs(e - S[0]))
... | output | 1 | 71,700 | 1 | 143,401 |
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,701 | 1 | 143,402 |
Tags: brute force, math
Correct Solution:
```
from math import gcd
n, k = map(int, input().split())
a, b = map(int, input().split())
x, y = int(1e15), -1
for i in range(1, n + 1):
for v in a - b, a + b, b - a, - a - b:
l = k * i + v % k
g = gcd(n * k, l)
x = min(x, n * k // g)
y = ma... | output | 1 | 71,701 | 1 | 143,403 |
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,702 | 1 | 143,404 |
Tags: brute force, math
Correct Solution:
```
from math import gcd
n, k = map(int, input().split())
a, b = map(int, input().split())
mn = float("inf")
mx = 0
def process(x):
global mn, mx
x %= n*k
pa = a
pb = (n*k-a) % (n*k)
da = (x+n*k - pa) % (n*k)
db = (x+n*k - pb) % (n*k)
if da == 0:
... | output | 1 | 71,702 | 1 | 143,405 |
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,703 | 1 | 143,406 |
Tags: brute force, math
Correct Solution:
```
def gcd(a,b):
if(b == 0):
return a
else:
return gcd(b,a%b)
n,k = map(int,input().split())
a,b = map(int,input().split())
l = [b-a,-a-b]
g = []
for i in range(n):
for j in range(2):
u = k*i + l[j]
m1 = gcd(u,n*k)
g.append(... | output | 1 | 71,703 | 1 | 143,407 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β
k cities. The cities are numerated from 1 to n β
k, the distance between the neighboring citi... | instruction | 0 | 71,704 | 1 | 143,408 |
Yes | output | 1 | 71,704 | 1 | 143,409 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β
k cities. The cities are numerated from 1 to n β
k, the distance between the neighboring citi... | instruction | 0 | 71,705 | 1 | 143,410 |
Yes | output | 1 | 71,705 | 1 | 143,411 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β
k cities. The cities are numerated from 1 to n β
k, the distance between the neighboring citi... | instruction | 0 | 71,706 | 1 | 143,412 |
Yes | output | 1 | 71,706 | 1 | 143,413 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β
k cities. The cities are numerated from 1 to n β
k, the distance between the neighboring citi... | instruction | 0 | 71,707 | 1 | 143,414 |
Yes | output | 1 | 71,707 | 1 | 143,415 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β
k cities. The cities are numerated from 1 to n β
k, the distance between the neighboring citi... | instruction | 0 | 71,708 | 1 | 143,416 |
No | output | 1 | 71,708 | 1 | 143,417 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β
k cities. The cities are numerated from 1 to n β
k, the distance between the neighboring citi... | instruction | 0 | 71,709 | 1 | 143,418 |
No | output | 1 | 71,709 | 1 | 143,419 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β
k cities. The cities are numerated from 1 to n β
k, the distance between the neighboring citi... | instruction | 0 | 71,710 | 1 | 143,420 |
No | output | 1 | 71,710 | 1 | 143,421 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β
k cities. The cities are numerated from 1 to n β
k, the distance between the neighboring citi... | instruction | 0 | 71,711 | 1 | 143,422 |
No | output | 1 | 71,711 | 1 | 143,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with the smaller index to the block with the larger... | instruction | 0 | 71,870 | 1 | 143,740 |
Tags: bitmasks, constructive algorithms
Correct Solution:
```
import sys
input = sys.stdin.readline
N=32
E=[]
for i in range(31,11,-1):
for j in range(i+1,33):
E.append((i,j,2**(31-i)))
L,R=map(int,input().split())
LX=L
for i in range(22):
if L+(1<<i)-1<=R:
E.append((1,32-i,L))
#p... | output | 1 | 71,870 | 1 | 143,741 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with the smaller index to the block with the larger... | instruction | 0 | 71,871 | 1 | 143,742 |
Tags: bitmasks, constructive algorithms
Correct Solution:
```
readints = lambda: map(int, input().split(' '))
n = 32
e = []
l, r = readints()
print('YES')
if l == r:
print(2, 1)
print(1, 2, l)
exit(0)
if l == 1:
e.append([1, n, 1])
l += 1
r = r - l + 1
k = 0
while r >> k >> 1:
k += 1
for i in range(k + 1):
... | output | 1 | 71,871 | 1 | 143,743 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with the smaller index to the block with the larger... | instruction | 0 | 71,872 | 1 | 143,744 |
Tags: bitmasks, constructive algorithms
Correct Solution:
```
import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def MI(): return map(int, sys.stdin.buffer.readline().split())
def LI(): return list(map(int, sys.stdin.b... | output | 1 | 71,872 | 1 | 143,745 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with the smaller index to the block with the larger... | instruction | 0 | 71,873 | 1 | 143,746 |
Tags: bitmasks, constructive algorithms
Correct Solution:
```
import sys
l, r = map(int,input().split())
print("YES")
d = r-l+1
d -= 1
if d == 0:
print("2 1")
print("1 2 " + str(l))
sys.exit()
db = format(d, "b")
# print(db)
n = 1 + len(db) + 1
A = []
mu = 1
mm = 1
for i in range(len(db)-1,-1,-1):
#... | output | 1 | 71,873 | 1 | 143,747 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with the smaller index to the block with the larger... | instruction | 0 | 71,874 | 1 | 143,748 |
Tags: bitmasks, constructive algorithms
Correct Solution:
```
import sys
from collections import Counter
readline = sys.stdin.readline
limit = 22
L, R = map(int, readline().split())
D = R-L
if not D:
print('YES')
print(2, 1)
print(1, 2, L)
else:
K = D.bit_length()
Edge = [[] for _ in range(limit+1... | output | 1 | 71,874 | 1 | 143,749 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with the smaller index to the block with the larger... | instruction | 0 | 71,875 | 1 | 143,750 |
Tags: bitmasks, constructive algorithms
Correct Solution:
```
from sys import stdin, stdout
from collections import defaultdict
import math
def main():
L, R = list(map(int, stdin.readline().split()))
stdout.write("YES\n")
X = R - L + 1
pw = 1
node_cnt = 1
ans = []
while pw * 2 <= X:
... | output | 1 | 71,875 | 1 | 143,751 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with the smaller index to the block with the larger... | instruction | 0 | 71,876 | 1 | 143,752 |
Tags: bitmasks, constructive algorithms
Correct Solution:
```
from collections import defaultdict
from itertools import accumulate
import sys
input = sys.stdin.readline
'''
for CASES in range(int(input())):
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
sys.std... | output | 1 | 71,876 | 1 | 143,753 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with the smaller index to the block with the larger... | instruction | 0 | 71,877 | 1 | 143,754 |
Tags: bitmasks, constructive algorithms
Correct Solution:
```
import sys, io, os
if os.environ['USERNAME']=='kissz':
inp=open('in2.txt','r').readline
def debug(*args):
print(*args,file=sys.stderr)
else:
inp=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def debug(*args):
pass
# SC... | output | 1 | 71,877 | 1 | 143,755 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with... | instruction | 0 | 71,878 | 1 | 143,756 |
Yes | output | 1 | 71,878 | 1 | 143,757 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with... | instruction | 0 | 71,879 | 1 | 143,758 |
No | output | 1 | 71,879 | 1 | 143,759 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with... | instruction | 0 | 71,880 | 1 | 143,760 |
No | output | 1 | 71,880 | 1 | 143,761 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with... | instruction | 0 | 71,881 | 1 | 143,762 |
No | output | 1 | 71,881 | 1 | 143,763 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some time ago Homer lived in a beautiful city. There were n blocks numbered from 1 to n and m directed roads between them. Each road had a positive length, and each road went from the block with... | instruction | 0 | 71,882 | 1 | 143,764 |
No | output | 1 | 71,882 | 1 | 143,765 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty live... | instruction | 0 | 72,067 | 1 | 144,134 |
Tags: implementation
Correct Solution:
```
n = int(input())
H1 = list(map(int, input().split()))
H2 = list(map(int, input().split()))
av = list(map(int, input().split()))
ans = []
for i in range(n - 1):
ans.append(sum(H1[:i]) + av[i] + sum(H2[i:]))
ans.append(sum(H1) + av[-1])
ans.sort()
print(ans[0] + ans[1])
``` | output | 1 | 72,067 | 1 | 144,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty live... | instruction | 0 | 72,068 | 1 | 144,136 |
Tags: implementation
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
f=sum(l1)+l2[0]
e=[f]
for i in range(n-1) :
f+=-l2[i]-l1[i]+l2[i+1]+l[i]
e.append(f)
e=sorted(e)
print(e[0]+e[1])
``` | output | 1 | 72,068 | 1 | 144,137 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty live... | instruction | 0 | 72,069 | 1 | 144,138 |
Tags: implementation
Correct Solution:
```
n=int(input())
f=[0]+list(map(int,input().split()))
s=list(map(int,input().split()))+[0]
a=list(map(int,input().split()))
l=sorted([sum(f[:i+1])+a[i]+sum(s[i:]) for i in range(n)])
print(l[0]+l[1])
``` | output | 1 | 72,069 | 1 | 144,139 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty live... | instruction | 0 | 72,070 | 1 | 144,140 |
Tags: implementation
Correct Solution:
```
def f(i):
return sum(a1[0 : i]) + sum(a2[i : ]) + b[i]
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
b = list(map(int, input().split()))
m1 = 0
m2 = 1
if f(m1) > f(m2):
(m1, m2) = (m2, m1)
for i in range(2, n):
if f(i) ... | output | 1 | 72,070 | 1 | 144,141 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty live... | instruction | 0 | 72,071 | 1 | 144,142 |
Tags: implementation
Correct Solution:
```
# brute force seems viable here
def traverse(street):
a = sum(street[0])
b = sum(street[1])
paths,d,e = [a+street[2][-1],b+street[2][0]],0,0
for s in range(length-2,0,-1):
d += street[0][s]
e += street[1][s]
p = a - d + e + street[2][s]
... | output | 1 | 72,071 | 1 | 144,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty live... | instruction | 0 | 72,072 | 1 | 144,144 |
Tags: implementation
Correct Solution:
```
n = int(input())
shop_row = [0] + list(map(int, input().split()))
house_row = list(map(int, input().split())) + [0]
perek = list(map(int, input().split()))
for i in range(len(house_row) - 2, -1, -1):
house_row[i] += house_row[i + 1]
for i in range(1, len(shop_row)):
... | output | 1 | 72,072 | 1 | 144,145 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty live... | instruction | 0 | 72,073 | 1 | 144,146 |
Tags: implementation
Correct Solution:
```
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright Β© 2016 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.
"""
"""
n = int(input())
b = []
b.append([int(i) for i in input().split()])
b.append([int(i) for i in... | output | 1 | 72,073 | 1 | 144,147 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty live... | instruction | 0 | 72,074 | 1 | 144,148 |
Tags: implementation
Correct Solution:
```
n = int(input())
a = [None, None]
a[0] = list(map(int, input().split()))
a[1] = list(map(int, input().split()))
b = list(map(int, input().split()))
d = []
for p in range(n):
d.append(sum(a[0][:p]) + b[p] + sum(a[1][p:]))
print(sum(sorted(d)[:2]))
``` | output | 1 | 72,074 | 1 | 144,149 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage... | instruction | 0 | 72,075 | 1 | 144,150 |
Yes | output | 1 | 72,075 | 1 | 144,151 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage... | instruction | 0 | 72,076 | 1 | 144,152 |
Yes | output | 1 | 72,076 | 1 | 144,153 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage... | instruction | 0 | 72,077 | 1 | 144,154 |
Yes | output | 1 | 72,077 | 1 | 144,155 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage... | instruction | 0 | 72,078 | 1 | 144,156 |
Yes | output | 1 | 72,078 | 1 | 144,157 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage... | instruction | 0 | 72,079 | 1 | 144,158 |
No | output | 1 | 72,079 | 1 | 144,159 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage... | instruction | 0 | 72,080 | 1 | 144,160 |
No | output | 1 | 72,080 | 1 | 144,161 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage... | instruction | 0 | 72,081 | 1 | 144,162 |
No | output | 1 | 72,081 | 1 | 144,163 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage... | instruction | 0 | 72,082 | 1 | 144,164 |
No | output | 1 | 72,082 | 1 | 144,165 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are clos... | instruction | 0 | 72,201 | 1 | 144,402 |
Tags: dfs and similar, graphs, implementation, shortest paths
Correct Solution:
```
# changed
def answer(grid):
def find(type):
for i, row in enumerate(grid):
for j, c in enumerate(row):
if c == type:
return (i, j)
return (-1, -1)
home = find("S")... | output | 1 | 72,201 | 1 | 144,403 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are clos... | instruction | 0 | 72,202 | 1 | 144,404 |
Tags: dfs and similar, graphs, implementation, shortest paths
Correct Solution:
```
n, m = map(int, input().split())
mat = []
ans = -1
for i in range(n):
mat.append(input())
s, d = -1, -1
for i in range(n):
for j in range(m):
if mat[i][j]=='S':
s = (i,j)
if mat[i][j]=='T':
... | output | 1 | 72,202 | 1 | 144,405 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are clos... | instruction | 0 | 72,203 | 1 | 144,406 |
Tags: dfs and similar, graphs, implementation, shortest paths
Correct Solution:
```
n, m = map(int, input().split())
data = [list(input().strip()) for i in range(n)]
for i, v in enumerate(data):
if "S" in v:
si = i
sk = v.index("S")
break
for i, v in enumerate(data):
if "T" in v:
ti = i
... | output | 1 | 72,203 | 1 | 144,407 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are clos... | instruction | 0 | 72,204 | 1 | 144,408 |
Tags: dfs and similar, graphs, implementation, shortest paths
Correct Solution:
```
import sys
input = sys.stdin.readline
def q(sx, sy, gx, gy):
for i in range(sx, gx+1):
for j in range(sy, gy+1):
if S[i][j]=='*':
return False
return True
n, m = map(int, input().split(... | output | 1 | 72,204 | 1 | 144,409 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are clos... | instruction | 0 | 72,205 | 1 | 144,410 |
Tags: dfs and similar, graphs, implementation, shortest paths
Correct Solution:
```
from collections import deque as dq
st=0
class Graph:
def __init__(self,n=0,m=0):
self.g=[None for i in range(n)]
self.vis=[[False for j in range(m)] for i in range(n)]
self.dx=(1,0,-1,0)
self.dy=(0... | output | 1 | 72,205 | 1 | 144,411 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are clos... | instruction | 0 | 72,206 | 1 | 144,412 |
Tags: dfs and similar, graphs, implementation, shortest paths
Correct Solution:
```
n, m = map(int, input().split())
cells = [list(input()) for _ in range(n)]
ans = 'NO'
for r in range(n):
for c in range(m):
if cells[r][c] == "S":
sr, sc = r, c
elif cells[r][c] == "T":
tr, tc... | output | 1 | 72,206 | 1 | 144,413 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are clos... | instruction | 0 | 72,207 | 1 | 144,414 |
Tags: dfs and similar, graphs, implementation, shortest paths
Correct Solution:
```
import sys
sys.setrecursionlimit(20000)
lines = sys.stdin.read().split('\n')[:-1]
n, m = map(int, lines[0].split(' '))
lines = lines[1:]
road = []
start = ()
finish = ()
i = 0
j = 0
for line in lines:
for j in range(m):
if... | output | 1 | 72,207 | 1 | 144,415 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.