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 a correct Python 3 solution for this coding contest problem.
A: A-Z-
problem
There is a circular board of 26 squares, each square with one capital letter of the alphabet written clockwise in alphabetical order. That is, the clockwise side of the'A'square is the'B' square, the next side of the'B'square is the... | instruction | 0 | 79,899 | 15 | 159,798 |
"Correct Solution:
```
S = input()
cur = 'A'
ans = 0
for i in range(len(S)):
if(S[i] == cur):
ans += 1
else:
if(cur > S[i]):
ans += 1
cur = S[i]
print(ans)
``` | output | 1 | 79,899 | 15 | 159,799 |
Provide a correct Python 3 solution for this coding contest problem.
A: A-Z-
problem
There is a circular board of 26 squares, each square with one capital letter of the alphabet written clockwise in alphabetical order. That is, the clockwise side of the'A'square is the'B' square, the next side of the'B'square is the... | instruction | 0 | 79,900 | 15 | 159,800 |
"Correct Solution:
```
# AOJ 2838: A-Z-
# Python3 2018.7.12 bal4u
S = input()
ans = p = 0
for s in S:
k = ord(s)-ord('A')
if k <= p: ans += 1
p = k
print(ans)
``` | output | 1 | 79,900 | 15 | 159,801 |
Provide a correct Python 3 solution for this coding contest problem.
A: A-Z-
problem
There is a circular board of 26 squares, each square with one capital letter of the alphabet written clockwise in alphabetical order. That is, the clockwise side of the'A'square is the'B' square, the next side of the'B'square is the... | instruction | 0 | 79,901 | 15 | 159,802 |
"Correct Solution:
```
S = input()
cnt, x = 0, 65
for c in S:
cnt = cnt + (x >= ord(c))
x = ord(c)
print(cnt)
``` | output | 1 | 79,901 | 15 | 159,803 |
Provide a correct Python 3 solution for this coding contest problem.
A: A-Z-
problem
There is a circular board of 26 squares, each square with one capital letter of the alphabet written clockwise in alphabetical order. That is, the clockwise side of the'A'square is the'B' square, the next side of the'B'square is the... | instruction | 0 | 79,902 | 15 | 159,804 |
"Correct Solution:
```
now=0
ans=0
for i in input():
j=ord(i)-ord("A")
if now>=j:ans+=1
now=j
print(ans)
``` | output | 1 | 79,902 | 15 | 159,805 |
Provide a correct Python 3 solution for this coding contest problem.
A: A-Z-
problem
There is a circular board of 26 squares, each square with one capital letter of the alphabet written clockwise in alphabetical order. That is, the clockwise side of the'A'square is the'B' square, the next side of the'B'square is the... | instruction | 0 | 79,903 | 15 | 159,806 |
"Correct Solution:
```
s = input()
print((s[0]=='A')+sum(s[i] >= s[i+1] for i in range(len(s)-1)))
``` | output | 1 | 79,903 | 15 | 159,807 |
Provide a correct Python 3 solution for this coding contest problem.
A: A-Z-
problem
There is a circular board of 26 squares, each square with one capital letter of the alphabet written clockwise in alphabetical order. That is, the clockwise side of the'A'square is the'B' square, the next side of the'B'square is the... | instruction | 0 | 79,904 | 15 | 159,808 |
"Correct Solution:
```
S = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Now = 0
ans = 0
for s in S:
Next = alpha.find(s)
# print(s, Now, Next)
if(Now < Next):
pass
else:
ans += 1
Now = Next
print(ans)
``` | output | 1 | 79,904 | 15 | 159,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start its journey. On each ... | instruction | 0 | 80,336 | 15 | 160,672 |
Tags: dp
Correct Solution:
```
from sys import stdin, stdout
mvalue = 1000
n, m, fold = map(int, stdin.readline().split())
fold += 1
dp = [[[False for k in range(mvalue)] for j in range(m + 1)] for i in range(n + 1)]
values = []
for i in range(n):
values.append(list(map(int, list(stdin.readline().strip()))))
for... | output | 1 | 80,336 | 15 | 160,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start its journey. On each ... | instruction | 0 | 80,337 | 15 | 160,674 |
Tags: dp
Correct Solution:
```
n, m, k = map(int, input().split())
board = [[0] * m for i in range(n)]
for i in range(n):
s = input().rstrip()
for j in range(m):
board[i][j] = int(s[j])
board.reverse()
dp = [[[-10 ** 9] * (k + 1) for i in range(m)] for j in range(n)]
prev = [[[(0, 0)] * (k + 1) for i i... | output | 1 | 80,337 | 15 | 160,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start its journey. On each ... | instruction | 0 | 80,338 | 15 | 160,676 |
Tags: dp
Correct Solution:
```
n, m, k = map(int, input().split())
board = [[0] * m for i in range(n)]
for i in range(n):
s = input().rstrip()
for j in range(m):
board[i][j] = int(s[j])
board.reverse()
dp = [[[-10 ** 9] * (k + 1) for i in range(m)] for j in range(n)]
prev = [[[(0, 0)] * (k + 1... | output | 1 | 80,338 | 15 | 160,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start its journey. On each ... | instruction | 0 | 80,339 | 15 | 160,678 |
Tags: dp
Correct Solution:
```
a,b,k = map(int, input().split())
k += 1
m = [[ord(c)-48 for c in input()] for i in range(a)][-1::-1]
dp = [[[-1 for t in range(k)] for j in range(b)] for i in range(a)]
pr = [[[0 for t in range(k)] for j in range(b)] for i in range(a)]
for i in range(a):
for j in range(b):
if... | output | 1 | 80,339 | 15 | 160,679 |
Provide tags and a correct Python 3 solution for this coding contest problem.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start its journey. On each ... | instruction | 0 | 80,340 | 15 | 160,680 |
Tags: dp
Correct Solution:
```
def restore_path(i, j):
vi, vj, vmod = i, j, 0
ans = []
while prev[vi][vj][vmod] is not None:
if prev[vi][vj][vmod][1] == vj - 1:
ans.append('L')
else:
ans.append('R')
vi, vj, vmod = prev[vi][vj][vmod]
return ''.join(ans)
n... | output | 1 | 80,340 | 15 | 160,681 |
Provide tags and a correct Python 3 solution for this coding contest problem.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start its journey. On each ... | instruction | 0 | 80,341 | 15 | 160,682 |
Tags: dp
Correct Solution:
```
if __name__ == '__main__':
n, m, k = map(int, input().split())
chessboard = tuple(tuple(map(int, input())) for _ in range(n))
costs = [m * [0] for _ in range(n)]
for i in range(m):
costs[0][i] = {i: (-1, "") for i in range(k + 1)}
costs[0][i][chessboard[0... | output | 1 | 80,341 | 15 | 160,683 |
Provide tags and a correct Python 3 solution for this coding contest problem.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start its journey. On each ... | instruction | 0 | 80,342 | 15 | 160,684 |
Tags: dp
Correct Solution:
```
#Récupération des données
n_m_k = input();
n, m, k = [int(s) for s in n_m_k.split()];
k+=1;
##if n<=1 or m<=1 or k <1:
## print(-1)
## exit()
plateau = [[0]*m for _ in range(n)];
for i in range(n):
new_line = input();
plateau[i] = [int(new_line[j]) for j in range(m)];
... | output | 1 | 80,342 | 15 | 160,685 |
Provide tags and a correct Python 3 solution for this coding contest problem.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start its journey. On each ... | instruction | 0 | 80,343 | 15 | 160,686 |
Tags: dp
Correct Solution:
```
from sys import stdin, stdout
mvalue = 1000
n, m, fold = map(int, stdin.readline().split())
fold += 1
dp = [[[False for k in range(mvalue)] for j in range(m + 1)] for i in range(n + 1)]
values = []
for i in range(n):
values.append(list(map(int, list(stdin.readline().strip()))))
... | output | 1 | 80,343 | 15 | 160,687 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of th... | instruction | 0 | 80,344 | 15 | 160,688 |
Yes | output | 1 | 80,344 | 15 | 160,689 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of th... | instruction | 0 | 80,345 | 15 | 160,690 |
No | output | 1 | 80,345 | 15 | 160,691 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of th... | instruction | 0 | 80,346 | 15 | 160,692 |
No | output | 1 | 80,346 | 15 | 160,693 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of th... | instruction | 0 | 80,347 | 15 | 160,694 |
No | output | 1 | 80,347 | 15 | 160,695 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
On some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of th... | instruction | 0 | 80,348 | 15 | 160,696 |
No | output | 1 | 80,348 | 15 | 160,697 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positions (X_i, Y_i) of N enemy rooks on an infinite chessboard. No two rooks attack each other (at most one rook per row or column).
You're going to replace one rook with a king ... | instruction | 0 | 80,602 | 15 | 161,204 |
No | output | 1 | 80,602 | 15 | 161,205 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positions (X_i, Y_i) of N enemy rooks on an infinite chessboard. No two rooks attack each other (at most one rook per row or column).
You're going to replace one rook with a king ... | instruction | 0 | 80,603 | 15 | 161,206 |
No | output | 1 | 80,603 | 15 | 161,207 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positions (X_i, Y_i) of N enemy rooks on an infinite chessboard. No two rooks attack each other (at most one rook per row or column).
You're going to replace one rook with a king ... | instruction | 0 | 80,604 | 15 | 161,208 |
No | output | 1 | 80,604 | 15 | 161,209 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positions (X_i, Y_i) of N enemy rooks on an infinite chessboard. No two rooks attack each other (at most one rook per row or column).
You're going to replace one rook with a king ... | instruction | 0 | 80,605 | 15 | 161,210 |
No | output | 1 | 80,605 | 15 | 161,211 |
Provide a correct Python 3 solution for this coding contest problem.
Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to... | instruction | 0 | 80,638 | 15 | 161,276 |
"Correct Solution:
```
from collections import deque
n,m=map(int,input().split())
edge = [[] for i in range(n+1)]
#edge[i] : iから出る道の[行先]の配列
for _ in range(m):
u, v = map(int, input().split())
edge[u].append(v)
s,t = map(int, input().split())
queue = deque()
queue.append((s, 0))
visited = [[False] * 3 for _ in r... | output | 1 | 80,638 | 15 | 161,277 |
Provide a correct Python 3 solution for this coding contest problem.
Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to... | instruction | 0 | 80,639 | 15 | 161,278 |
"Correct Solution:
```
import heapq
N,M=map(int,input().split())
G=[set() for i in range(N)]
for i in range(M):
u,v=map(int,input().split())
G[u-1].add(v-1)
#print(G)
S,T=map(int,input().split())
S-=1;T-=1
#dp[i][j]:i番目の頂点をmod 3=jで行けるかどうか
dist=[[10**10 for i in range(3)] for i in range(N)]
dist[S][0]=0
q=[]
hea... | output | 1 | 80,639 | 15 | 161,279 |
Provide a correct Python 3 solution for this coding contest problem.
Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to... | instruction | 0 | 80,640 | 15 | 161,280 |
"Correct Solution:
```
from collections import deque
N,M = map(int,input().split())
adj = [ [] for _ in range(N) ]
for _ in range(M):
a,b = map(int,input().split())
a -= 1
b -= 1
adj[a].append(b)
S,T = map(int,input().split())
S -= 1
T -= 1
INF = float('inf')
dist = [ [INF]*3 for _ in range(N) ]
q = deque([(S... | output | 1 | 80,640 | 15 | 161,281 |
Provide a correct Python 3 solution for this coding contest problem.
Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to... | instruction | 0 | 80,641 | 15 | 161,282 |
"Correct Solution:
```
N, M = map(int, input().split())
E = [[] for _ in range(N+1)]
for _ in range(M):
u, v = map(int, input().split())
E[u].append(v)
Closed = [[False]*(N+1) for _ in range(3)]
S, T = map(int, input().split())
st = [(S, 0)]
Closed[0][S] = True
ans = 0
while len(st):
st_new = []
for v, ... | output | 1 | 80,641 | 15 | 161,283 |
Provide a correct Python 3 solution for this coding contest problem.
Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to... | instruction | 0 | 80,642 | 15 | 161,284 |
"Correct Solution:
```
import copy
n, m = map(int,input().split())
edge = []
graph = [[] for i in range(n+1)]
for i in range(m):
edge.append(list(map(int,input().split())))
graph[edge[-1][0]].append(edge[-1][1])
s, g = map(int,input().split())
INF = 10**11
ans = [[INF, INF, INF] for i in range(n+1)]
q = [s]
d... | output | 1 | 80,642 | 15 | 161,285 |
Provide a correct Python 3 solution for this coding contest problem.
Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to... | instruction | 0 | 80,643 | 15 | 161,286 |
"Correct Solution:
```
# ABC132 E
from collections import deque
f=lambda:map(int,input().split())
N,M=f()
G=[[] for _ in [0]*(N+1)]
for _ in [0]*M:
a,b=f()
G[a].append(b)
S,T=f()
S=(S,0)
T=(T,0)
q=deque()
q.append(S)
F=set()
res=-1
while q:
node,r=q.popleft()
if (node,r%3) in F:
continue
... | output | 1 | 80,643 | 15 | 161,287 |
Provide a correct Python 3 solution for this coding contest problem.
Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to... | instruction | 0 | 80,644 | 15 | 161,288 |
"Correct Solution:
```
import queue
N, M = list(map(int, input().split()))
uv = [list(map(int, input().split())) for _ in range(M)]
S, T = list(map(int, input().split()))
V = [[0, 0, 0] for _ in range(N + 1)]
R = {}
for u, v in uv:
if u not in R:
R[u] = [v]
else:
R[u].append(v)
q = queue.Queue()
put = q.... | output | 1 | 80,644 | 15 | 161,289 |
Provide a correct Python 3 solution for this coding contest problem.
Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to... | instruction | 0 | 80,645 | 15 | 161,290 |
"Correct Solution:
```
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
graph[a-1].append(b-1)
#graph[b-1].append(a-1)
S, T = map(int, input().split())
S -= 1; T -= 1
D = [[-1]*3 for _ in range(N)]
D[S... | output | 1 | 80,645 | 15 | 161,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's... | instruction | 0 | 81,065 | 15 | 162,130 |
Tags: brute force, dfs and similar, dsu, graphs
Correct Solution:
```
MAX_N = 105
root = [0 for _ in range(MAX_N)]
n = int(input().strip())
x = []
y = []
def findRoot(u):
if u == root[u]:
return u
else:
root[u] = findRoot(root[u])
return root[u]
for i in range(n):
valx, valy = map(int, input().strip(... | output | 1 | 81,065 | 15 | 162,131 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's... | instruction | 0 | 81,067 | 15 | 162,134 |
Tags: brute force, dfs and similar, dsu, graphs
Correct Solution:
```
# WeirdBugsButOkay
n = int(input())
p = []
def dfs(i) :
p[i][2] = z
for j in range (0, n) :
if p[j][2] == -1 and (p[j][0] == p[i][0] or p[j][1] == p[i][1]) :
dfs(j)
for i in range (0, n) :
x1, y1 = list(map(int, inp... | output | 1 | 81,067 | 15 | 162,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's... | instruction | 0 | 81,068 | 15 | 162,136 |
Tags: brute force, dfs and similar, dsu, graphs
Correct Solution:
```
def neighbour(v):
global vs, used
ns = []
for i in range(len(vs)):
if v[2] != i and (vs[i][0] == v[0] or vs[i][1] == v[1]) and used[vs[i][2]] == False:
ns.append(vs[i])
return ns
def dfs(v):
global vs, used
... | output | 1 | 81,068 | 15 | 162,137 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's... | instruction | 0 | 81,069 | 15 | 162,138 |
Tags: brute force, dfs and similar, dsu, graphs
Correct Solution:
```
n = int(input())
p = []
def dfs(i):
p[i][-1] = res
for j in range(n):
if p[j][-1] == -1 and (p[i][0] == p[j][0] or p[i][1] == p[j][1]):
dfs(j)
res = -1
for i in range(n):
x, y = map(int, input().split())
p.append... | output | 1 | 81,069 | 15 | 162,139 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's... | instruction | 0 | 81,071 | 15 | 162,142 |
Tags: brute force, dfs and similar, dsu, graphs
Correct Solution:
```
n = int(input())
G = [[0,0] for _ in range(n)]
f = list(range(n+1))
def fd(a):
if f[a]!=a:f[a] = fd(f[a])
return f[a]
def un(a,b):
ra,rb = fd(a),fd(b)
if ra==rb:return
f[ra] = rb
for i in range(n):
x,y = map(int,input().spl... | output | 1 | 81,071 | 15 | 162,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's... | instruction | 0 | 81,072 | 15 | 162,144 |
Tags: brute force, dfs and similar, dsu, graphs
Correct Solution:
```
def dfs(start):
prev[start] = True
for i in mas[start]:
if not prev[i]:
dfs(i)
n = int(input())
mas = []
for i in range(2000):
mas.append([])
prev = [True] * 2000
for i in range(n):
x, y = map(int, input().split(... | output | 1 | 81,072 | 15 | 162,145 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s... | instruction | 0 | 81,073 | 15 | 162,146 |
Yes | output | 1 | 81,073 | 15 | 162,147 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s... | instruction | 0 | 81,075 | 15 | 162,150 |
Yes | output | 1 | 81,075 | 15 | 162,151 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s... | instruction | 0 | 81,079 | 15 | 162,158 |
No | output | 1 | 81,079 | 15 | 162,159 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s... | instruction | 0 | 81,080 | 15 | 162,160 |
No | output | 1 | 81,080 | 15 | 162,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper sta... | instruction | 0 | 81,276 | 15 | 162,552 |
Tags: implementation
Correct Solution:
```
n = int(input())
s = input()
v = [int(i) for i in input().split(' ')]
used = set()
curr = 0
while True:
if curr in used:
print('INFINITE')
break
used.add(curr)
curr += (v[curr])*(1 if s[curr]=='>' else -1)
if curr<0 or curr>=n:
print('FINITE')
break
`... | output | 1 | 81,276 | 15 | 162,553 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper sta... | instruction | 0 | 81,277 | 15 | 162,554 |
Tags: implementation
Correct Solution:
```
##import math
class codeforces:
## def presents(self,a):
## if a==1 or a==2:
## ans=1
## else:
## ans=(math.floor(a/3))*2
## if a%3!=0:
## ans+=1
## print(int(ans))
## return int(ans)
... | output | 1 | 81,277 | 15 | 162,555 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper sta... | instruction | 0 | 81,278 | 15 | 162,556 |
Tags: implementation
Correct Solution:
```
n = int(input())
s = input()
A = list(map(int, input().split()))
k = 1
B = [True for i in range(n)]
while True:
napr = s[k - 1]
if B[k - 1] == False:
print('INFINITE')
break
elif napr == '>' and B[k - 1] == True:
B[k - 1] = False
k +... | output | 1 | 81,278 | 15 | 162,557 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper sta... | instruction | 0 | 81,279 | 15 | 162,558 |
Tags: implementation
Correct Solution:
```
n=int(input())
a=input()
b=[int(i) for i in input().split()]
i=0
temp=0
while True:
if i < 0 or i >= n:
print("FINITE")
break
if b[i]==0:
print("INFINITE")
break
temp=b[i]
if a[i]=='<':
temp=-1*temp
b[i]=0
i+=temp... | output | 1 | 81,279 | 15 | 162,559 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper sta... | instruction | 0 | 81,280 | 15 | 162,560 |
Tags: implementation
Correct Solution:
```
def main():
n = int(input())
l = [j - i if c == "<" else j + i for c, i, j in zip(input(), map(int, input().split()), range(n))]
v, i = [True] * n, 0
while 0 <= i < n:
if v[i]:
v[i] = False
else:
print("INFINITE")
... | output | 1 | 81,280 | 15 | 162,561 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper sta... | instruction | 0 | 81,281 | 15 | 162,562 |
Tags: implementation
Correct Solution:
```
n = int(input())
s = list(1 if x == '>' else -1 for x in input())
l = list(map(int, input().split()))
summ = 1
cur = 0
next = 0
for i in range(n):
if cur < 0 or cur > n - 1:
print('FINITE')
exit()
if l[cur] == 0:
print('INFINITE')
exit()... | output | 1 | 81,281 | 15 | 162,563 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper sta... | instruction | 0 | 81,282 | 15 | 162,564 |
Tags: implementation
Correct Solution:
```
class CodeforcesTask641ASolution:
def __init__(self):
self.result = ''
self.n = 0
self.directions = []
self.jump_lengths = []
def read_input(self):
self.n = int(input())
self.directions = input()
self.jump_length... | output | 1 | 81,282 | 15 | 162,565 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper sta... | instruction | 0 | 81,283 | 15 | 162,566 |
Tags: implementation
Correct Solution:
```
n = int(input())
l = [1 if x == ">" else -1 for x in input()]
c = list(map(int, input().split()))
for i in range(len(c)):
l[i] *= c[i]
ret = True
i = 0
vis = {i}
while True:
if i < 0 or i >= n:
ret = False
break
i += l[i]
if i in vis:
re... | output | 1 | 81,283 | 15 | 162,567 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1 × n. Each cell contains the direction for the next ju... | instruction | 0 | 81,284 | 15 | 162,568 |
Yes | output | 1 | 81,284 | 15 | 162,569 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.