message stringlengths 2 19.9k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 322 108k | cluster float64 15 15 | __index_level_0__ int64 644 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with integers from 1 to 10... | instruction | 0 | 57,384 | 15 | 114,768 |
Tags: dfs and similar, graphs, hashing, shortest paths
Correct Solution:
```
def main():
import sys
from collections import deque
x0,y0,x1,y1 = map(int,input().strip().split())
n = int(input())
S = list(map(int,sys.stdin.read().strip().split()))
h = set()
d = {}
def getchild(a):
... | output | 1 | 57,384 | 15 | 114,769 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with integers from 1 to 10... | instruction | 0 | 57,385 | 15 | 114,770 |
Tags: dfs and similar, graphs, hashing, shortest paths
Correct Solution:
```
from collections import deque, defaultdict
class Solution:
def solve(self):
kpos = input().split()
kpos = [int(x) for x in kpos]
startK = [kpos[0], kpos[1]]
endK = [kpos[2], kpos[3]]
N = int(input... | output | 1 | 57,385 | 15 | 114,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with integers from 1 to 10... | instruction | 0 | 57,386 | 15 | 114,772 |
Tags: dfs and similar, graphs, hashing, shortest paths
Correct Solution:
```
from collections import *
import bisect
import heapq
import sys
from math import inf
def ri():
return int(input())
def rl():
return list(map(int, input().split()))
def isPossiblePlace(x, y):
for my_list in allowed[x]:
a, b = my... | output | 1 | 57,386 | 15 | 114,773 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with integers from 1 to 10... | instruction | 0 | 57,387 | 15 | 114,774 |
Tags: dfs and similar, graphs, hashing, shortest paths
Correct Solution:
```
from collections import deque
x,y,x2,y2=map(int,input().split())
n=int(input())
kletki={}
for i in range(n):
r,a,b=map(int,input().split())
for j in range(a, b+1):
kletki[(r,j)]=-1
kletki[(x,y)]=0
deq = deque()
deq.append... | output | 1 | 57,387 | 15 | 114,775 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns ar... | instruction | 0 | 57,388 | 15 | 114,776 |
Yes | output | 1 | 57,388 | 15 | 114,777 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns ar... | instruction | 0 | 57,389 | 15 | 114,778 |
Yes | output | 1 | 57,389 | 15 | 114,779 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns ar... | instruction | 0 | 57,390 | 15 | 114,780 |
Yes | output | 1 | 57,390 | 15 | 114,781 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns ar... | instruction | 0 | 57,391 | 15 | 114,782 |
Yes | output | 1 | 57,391 | 15 | 114,783 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns ar... | instruction | 0 | 57,392 | 15 | 114,784 |
No | output | 1 | 57,392 | 15 | 114,785 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns ar... | instruction | 0 | 57,393 | 15 | 114,786 |
No | output | 1 | 57,393 | 15 | 114,787 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns ar... | instruction | 0 | 57,394 | 15 | 114,788 |
No | output | 1 | 57,394 | 15 | 114,789 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns ar... | instruction | 0 | 57,395 | 15 | 114,790 |
No | output | 1 | 57,395 | 15 | 114,791 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
<im... | instruction | 0 | 57,524 | 15 | 115,048 |
Tags: brute force, implementation
Correct Solution:
```
import itertools
def king():
n= int(input())
s= input()
a= []
for i in range(len(s)):
if s[i]== "*":
a.append(i+1)
#print(a)
if len(a)< 5:
print("no")
return
for arr in itertools.combinat... | output | 1 | 57,524 | 15 | 115,049 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
<im... | instruction | 0 | 57,525 | 15 | 115,050 |
Tags: brute force, implementation
Correct Solution:
```
n = int(input())
s = input().strip()
print('yes' if '*****' in ('.'.join(s[i::j] for i in range(n) for j in range(1, n))) else 'no')
# Made By Mostafa_Khaled
``` | output | 1 | 57,525 | 15 | 115,051 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
<im... | instruction | 0 | 57,526 | 15 | 115,052 |
Tags: brute force, implementation
Correct Solution:
```
n,s = int(input()),input()
for i in range(1,len(s)):
for j in range(len(s)):
if s[j] == '.':
continue
L = s[j::i]
mx = 0; c = 1
for k in range(1,len(L)):
if L[k] == L[k - 1] and L[k] == '*':
... | output | 1 | 57,526 | 15 | 115,053 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
<im... | instruction | 0 | 57,527 | 15 | 115,054 |
Tags: brute force, implementation
Correct Solution:
```
n,s = int(input()),input()
for i in range(1,len(s)):
for j in range(len(s)):
if s[j] == '.':
continue
L = s[j::i]
mx = 0; c = 1
for k in range(1,len(L)):
if L[k] == L[k - 1] and L[k] == '*':
... | output | 1 | 57,527 | 15 | 115,055 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
<im... | instruction | 0 | 57,528 | 15 | 115,056 |
Tags: brute force, implementation
Correct Solution:
```
import sys
n = int(input())
S = input()
for l in range(n):
if S[l] == "*":
d = 1
while l + 4 * d < n:
if S[l + d] == S[l + 2 * d] == S[l + 3 * d] == S[l + 4 * d] == "*":
print("yes")
sys.exit(0)
... | output | 1 | 57,528 | 15 | 115,057 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
<im... | instruction | 0 | 57,529 | 15 | 115,058 |
Tags: brute force, implementation
Correct Solution:
```
n = int(input())
level = input()
yes = False
for i in range(n):
for j in range(n):
count = 0
f = 5
a = []
for k in range(i, n, j + 1):
if f > 0:
if level[k] == '*':
count += 1
... | output | 1 | 57,529 | 15 | 115,059 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
<im... | instruction | 0 | 57,530 | 15 | 115,060 |
Tags: brute force, implementation
Correct Solution:
```
import sys, os
import fileinput
n = int(input())
s = input().strip()
for i in range(1, n + 1):
for j in range(1, n + 1):
if j - 1 >= n or j - 1 + i >= n or j - 1 + 2*i >= n or j - 1 + 3*i >= n or j - 1 + 4*i >= n: break
t = "%s%s%s%s%s" % (s[j - 1], s[j - 1 ... | output | 1 | 57,530 | 15 | 115,061 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
<im... | instruction | 0 | 57,531 | 15 | 115,062 |
Tags: brute force, implementation
Correct Solution:
```
n=int(input())
s=input()
print('yes' if any(any(all(s[i+k*j]=='*' for k in range(5)) for j in range(1, (n-i+3)//4)) for i in range(n-4)) else 'no')
``` | output | 1 | 57,531 | 15 | 115,063 |
Provide a correct Python 3 solution for this coding contest problem.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and bet... | instruction | 0 | 57,935 | 15 | 115,870 |
"Correct Solution:
```
from math import factorial
def comb (x,y):
return factorial(x)//factorial(x-y)//factorial(y)
w,h,ax,ay,bx,by=map(int,input().split())
dx=abs(ax-bx)
dx=min(dx,w-dx)
dy=abs(ay-by)
dy=min(dy,h-dy)
an=1
if dx*2==w:an*=2
if dy*2==h:an*=2
an*=comb(dx+dy,dx)
print(an%int(1E8+7))
``` | output | 1 | 57,935 | 15 | 115,871 |
Provide a correct Python 3 solution for this coding contest problem.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and bet... | instruction | 0 | 57,936 | 15 | 115,872 |
"Correct Solution:
```
# Edit: 2014/09/09
# Lang: Python3
# Time: .00s
from math import factorial
if __name__ == "__main__":
# a, b, c, d, e, f = map(int, input().strip("\n").split(" "))
r, c, ar, ac, br, bc = map(int, input().strip("\n").split(" "))
maxans = 100000007 # 100,000,007
# maxn = 100000... | output | 1 | 57,936 | 15 | 115,873 |
Provide a correct Python 3 solution for this coding contest problem.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and bet... | instruction | 0 | 57,937 | 15 | 115,874 |
"Correct Solution:
```
mod = 10**8+7
n = 1001
def comb(x, y):
if 2*y > x: return comb(x, x-y)
return fac[x] * inv[y]* inv[x-y] % mod
fac = [1]*(n+1)
inv = [1]*(n+1)
for i in range(2, n+1):
fac[i] = fac[i-1] * i % mod
inv[n] = pow(fac[n], mod-2, mod)
for i in range(n-1, 1, -1):
inv[i] = inv[i+1] * (i+1... | output | 1 | 57,937 | 15 | 115,875 |
Provide a correct Python 3 solution for this coding contest problem.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and bet... | instruction | 0 | 57,938 | 15 | 115,876 |
"Correct Solution:
```
# AOJ 1501: Grid
# Python3 2018.7.13 bal4u
MOD = 100000007
def dp(n, k):
if tbl[n][k]: return tbl[n][k]
if (k << 1) > n: k = n-k
if k == 0: ans = 1
elif k == 1: ans = n
else: ans = dp(n-1, k) + dp(n-1, k-1)
tbl[n][k] = ans % MOD
return tbl[n][k]
tbl = [[0 for j in range(1001)] for i in r... | output | 1 | 57,938 | 15 | 115,877 |
Provide a correct Python 3 solution for this coding contest problem.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and bet... | instruction | 0 | 57,939 | 15 | 115,878 |
"Correct Solution:
```
# Edit: 2014/09/09
# Lang: Python3
# Time: .00s
from math import factorial
if __name__ == "__main__":
r, c, ar, ac, br, bc = map(int, input().strip("\n").split(" "))
maxans = 100000007 # 100,000,007
# tate Row
dr = min(abs(br - ar), r - abs(br - ar))
if 2 * dr == r:
... | output | 1 | 57,939 | 15 | 115,879 |
Provide a correct Python 3 solution for this coding contest problem.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and bet... | instruction | 0 | 57,940 | 15 | 115,880 |
"Correct Solution:
```
MOD = 100000007
r, c, a1, a2, b1, b2 = map(int, input().split())
dx = abs(a1 - b1)
dy = abs(a2 - b2)
cnt = 1
if dx * 2 == r:cnt *= 2
if dy * 2 == c:cnt *= 2
dx = min(dx, r - dx)
dy = min(dy, c - dy)
dp = [[0] * (dx + 2) for _ in range(dy + 2)]
dp[0][1] = 1
for y in range(1, dy + 2):
for x in... | output | 1 | 57,940 | 15 | 115,881 |
Provide a correct Python 3 solution for this coding contest problem.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and bet... | instruction | 0 | 57,941 | 15 | 115,882 |
"Correct Solution:
```
# AOJ 1501: Grid
# Python3 2018.7.13 bal4u
from math import factorial
def comb (n, k):
return factorial(n)//factorial(n-k)//factorial(k)
k = 0
r, c, a1, a2, b1, b2 = map(int, input().split())
dr = abs(a1-b1)
if dr > r-dr: dr = r-dr
if (dr << 1) == r: k += 1
dc = abs(a2-b2)
if dc > c-dc: dc ... | output | 1 | 57,941 | 15 | 115,883 |
Provide a correct Python 3 solution for this coding contest problem.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and bet... | instruction | 0 | 57,942 | 15 | 115,884 |
"Correct Solution:
```
def func (x):
if x:
return int(x)*func(x-1)
else:
return (1)
def comb (x,y):
return func(x)//func(x-y)//func(y)
import sys
sys.setrecursionlimit(10000)
w,h,ax,ay,bx,by=map(int,input().split())
dx=min(w-abs(ax-bx),abs(ax-bx))
dy=min(h-abs(ay-by),abs(ay-by))
ans=1
if dx*2==w:ans*=2
if dy*2=... | output | 1 | 57,942 | 15 | 115,885 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And... | instruction | 0 | 57,943 | 15 | 115,886 |
Yes | output | 1 | 57,943 | 15 | 115,887 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And... | instruction | 0 | 57,944 | 15 | 115,888 |
Yes | output | 1 | 57,944 | 15 | 115,889 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And... | instruction | 0 | 57,945 | 15 | 115,890 |
Yes | output | 1 | 57,945 | 15 | 115,891 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And... | instruction | 0 | 57,946 | 15 | 115,892 |
Yes | output | 1 | 57,946 | 15 | 115,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And... | instruction | 0 | 57,947 | 15 | 115,894 |
No | output | 1 | 57,947 | 15 | 115,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And... | instruction | 0 | 57,948 | 15 | 115,896 |
No | output | 1 | 57,948 | 15 | 115,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And... | instruction | 0 | 57,949 | 15 | 115,898 |
No | output | 1 | 57,949 | 15 | 115,899 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And... | instruction | 0 | 57,950 | 15 | 115,900 |
No | output | 1 | 57,950 | 15 | 115,901 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the... | instruction | 0 | 58,525 | 15 | 117,050 |
Yes | output | 1 | 58,525 | 15 | 117,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the... | instruction | 0 | 58,526 | 15 | 117,052 |
Yes | output | 1 | 58,526 | 15 | 117,053 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the... | instruction | 0 | 58,527 | 15 | 117,054 |
Yes | output | 1 | 58,527 | 15 | 117,055 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the... | instruction | 0 | 58,528 | 15 | 117,056 |
Yes | output | 1 | 58,528 | 15 | 117,057 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the... | instruction | 0 | 58,529 | 15 | 117,058 |
No | output | 1 | 58,529 | 15 | 117,059 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the... | instruction | 0 | 58,530 | 15 | 117,060 |
No | output | 1 | 58,530 | 15 | 117,061 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the... | instruction | 0 | 58,531 | 15 | 117,062 |
No | output | 1 | 58,531 | 15 | 117,063 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the... | instruction | 0 | 58,532 | 15 | 117,064 |
No | output | 1 | 58,532 | 15 | 117,065 |
Provide a correct Python 3 solution for this coding contest problem.
Problem Statement
There is a maze which can be described as a W \times H grid. The upper-left cell is denoted as (1, 1), and the lower-right cell is (W, H). You are now at the cell (1, 1) and have to go to the cell (W, H). However, you can only move... | instruction | 0 | 58,802 | 15 | 117,604 |
"Correct Solution:
```
import sys
readline = sys.stdin.readline
write = sys.stdout.write
from string import ascii_lowercase, ascii_uppercase
from collections import deque
dd = ((1, 0), (0, 1))
def solve():
H, W = map(int, readline().split())
if H == W == 0:
return False
C = [readline().strip() for... | output | 1 | 58,802 | 15 | 117,605 |
Provide a correct Python 3 solution for this coding contest problem.
We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,... | instruction | 0 | 59,465 | 15 | 118,930 |
"Correct Solution:
```
h, w, n = map(int, input().split())
sr, sc = map(int, input().split())
S = input()
T = input()
win = 0
SR = sr
SC = sc
sr = SR
sc = SC
for i in range(n):
if S[i] == "L":
sc -= 1
if sc <= 0:
break
if T[i] == "R" and sc < w:
sc += 1
if sc <= 0:
win = 1
sr ... | output | 1 | 59,465 | 15 | 118,931 |
Provide a correct Python 3 solution for this coding contest problem.
We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,... | instruction | 0 | 59,466 | 15 | 118,932 |
"Correct Solution:
```
h,w,n = map(int,input().split())
y,x = map(int,input().split())
s = input()[::-1]
t = input()[::-1]
r = w
l = 1
d = h
u = 1
for i in range(n):
if t[i] == "R":
l = max(1,l-1)
elif t[i] == "L":
r = min(w,r+1)
elif t[i] == "D":
u = max(1,u-1)
else:
... | output | 1 | 59,466 | 15 | 118,933 |
Provide a correct Python 3 solution for this coding contest problem.
We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,... | instruction | 0 | 59,467 | 15 | 118,934 |
"Correct Solution:
```
h,w,n=[int(j) for j in input().split()]
R,C=[int(j) for j in input().split()]
s=input()
t=input()
#LR
x=C
l,r=1,w
for i in range(n)[::-1]:
if t[i]=="R":
l-=1
elif t[i]=="L":
r+=1
if l==0:
l=1
if r>w:
r=w
if s[i]=="R":
r-=1
elif s[i]... | output | 1 | 59,467 | 15 | 118,935 |
Provide a correct Python 3 solution for this coding contest problem.
We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,... | instruction | 0 | 59,468 | 15 | 118,936 |
"Correct Solution:
```
H, W , N = (int(i) for i in input().split())
sr, sc = (int(i) for i in input().split())
S = input()
T = input()
# 高橋はUR、青木はDL重視
su = sr
sd = sr
sle = sc
sri = sc
flag = False
for ss, tt in zip(S, T):
if ss == "U":
su -= 1
if ss == "D":
sd += 1
if ss == "R":
... | output | 1 | 59,468 | 15 | 118,937 |
Provide a correct Python 3 solution for this coding contest problem.
We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,... | instruction | 0 | 59,469 | 15 | 118,938 |
"Correct Solution:
```
H, W, N = map(int, input().split())
h, w = map(int, input().split())
S = input()
T = input()
h -= 1
w -= 1
for i in range(N):
if S[i] == "L":
if w-1 < W-w-1:
w -= 1
elif S[i] == "R":
if w > W-w-2:
w += 1
elif S[i] == "U":
if h-1 < H-h-1... | output | 1 | 59,469 | 15 | 118,939 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.