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
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either...
instruction
0
92,041
15
184,082
Yes
output
1
92,041
15
184,083
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either...
instruction
0
92,042
15
184,084
Yes
output
1
92,042
15
184,085
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either...
instruction
0
92,043
15
184,086
Yes
output
1
92,043
15
184,087
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either...
instruction
0
92,044
15
184,088
No
output
1
92,044
15
184,089
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either...
instruction
0
92,045
15
184,090
No
output
1
92,045
15
184,091
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either...
instruction
0
92,046
15
184,092
No
output
1
92,046
15
184,093
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either...
instruction
0
92,047
15
184,094
No
output
1
92,047
15
184,095
Provide tags and a correct Python 3 solution for this coding contest problem. There is a square matrix n Γ— n, consisting of non-negative integer numbers. You should find such a way on it that * starts in the upper left cell of the matrix; * each following cell is to the right or down from the current cell; *...
instruction
0
92,056
15
184,112
Tags: dp, math Correct Solution: ``` n = int(input()) m = [] for i in range(n): m.append(list(map(int, input().split()))) # n x n matrices with zeroes div2 = [[0 for i in range(n)] for ii in range(n)] div5 = [[0 for i in range(n)] for ii in range(n)] # check for zero input ans = 0 for i in range(n): for ii ...
output
1
92,056
15
184,113
Provide tags and a correct Python 3 solution for this coding contest problem. There is a square matrix n Γ— n, consisting of non-negative integer numbers. You should find such a way on it that * starts in the upper left cell of the matrix; * each following cell is to the right or down from the current cell; *...
instruction
0
92,057
15
184,114
Tags: dp, math Correct Solution: ``` def trail_find(i, val, m): global zero_trail if val == 0: zero_trail = i return 20000 r = 0 while val % m == 0: r += 1 val //= m return r def find_path(): for i in range(1, n): list_mod_2[i][0] += list_mod_2[i - 1][0]...
output
1
92,057
15
184,115
Provide a correct Python 3 solution for this coding contest problem. Problem statement I have a grid of $ H $ rows and $ W $ columns. Hereafter, the cells in the $ i $ row and $ j $ column on the grid are written as $ (i, j) $ cells. Each cell in the grid has a number between $ 1 $ and $ 6 $, or the letter `#` in $ ...
instruction
0
92,589
15
185,178
"Correct Solution: ``` def main(): H, W = map( int, input().split()) S = [ list( input()) for _ in range(H)] T = [[6,3,1,4], [2,0,2,0],[1,3,6,4],[5,0,5,0]] C = [[0]*W for _ in range(H)] for i in range(H): for j in range(W): if S[i][j] == '#': continue ...
output
1
92,589
15
185,179
Provide a correct Python 3 solution for this coding contest problem. Problem statement I have a grid of $ H $ rows and $ W $ columns. Hereafter, the cells in the $ i $ row and $ j $ column on the grid are written as $ (i, j) $ cells. Each cell in the grid has a number between $ 1 $ and $ 6 $, or the letter `#` in $ ...
instruction
0
92,590
15
185,180
"Correct Solution: ``` import sys sys.setrecursionlimit(10**7) dice = [[6,3,1,4], [2,0,2,0], [1,3,6,4], [5,0,5,0]] H,W = map(int,input().split()) s = list(input() for _ in range(H)) board = [[0]*W for _ in range(H)] def dfs(x,y): board[x][y] = 1 for dx,dy in [[0,-1],[0,1],[1,0],[-1,0]]...
output
1
92,590
15
185,181
Provide a correct Python 3 solution for this coding contest problem. Problem statement I have a grid of $ H $ rows and $ W $ columns. Hereafter, the cells in the $ i $ row and $ j $ column on the grid are written as $ (i, j) $ cells. Each cell in the grid has a number between $ 1 $ and $ 6 $, or the letter `#` in $ ...
instruction
0
92,591
15
185,182
"Correct Solution: ``` #!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS...
output
1
92,591
15
185,183
Provide a correct Python 3 solution for this coding contest problem. Problem statement I have a grid of $ H $ rows and $ W $ columns. Hereafter, the cells in the $ i $ row and $ j $ column on the grid are written as $ (i, j) $ cells. Each cell in the grid has a number between $ 1 $ and $ 6 $, or the letter `#` in $ ...
instruction
0
92,592
15
185,184
"Correct Solution: ``` H,W = map(int,input().split()) S = [list(input()) for i in range(H)] A = [[False]*W for i in range(H)] Q = [(0,0,(5,4,1,3,6,2))] while Q: q = Q.pop() h,w,s = q[0],q[1],q[2] if min(h,w)<0 or h>=H or w>=W:continue if S[h][w]=="#":continue if A[h][w]:continue if int(S[h][w...
output
1
92,592
15
185,185
Provide a correct Python 3 solution for this coding contest problem. Problem statement I have a grid of $ H $ rows and $ W $ columns. Hereafter, the cells in the $ i $ row and $ j $ column on the grid are written as $ (i, j) $ cells. Each cell in the grid has a number between $ 1 $ and $ 6 $, or the letter `#` in $ ...
instruction
0
92,593
15
185,186
"Correct Solution: ``` #!/usr/bin/env python3 import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) from collections import deque h, w = map(int, input().split()) edge = [[] for _ in range(8 * w * h)] field = [] for _ in range(h): line = input().rstrip() field.append(line) if field[h-1][w-1] == "#...
output
1
92,593
15
185,187
Provide a correct Python 3 solution for this coding contest problem. Problem statement I have a grid of $ H $ rows and $ W $ columns. Hereafter, the cells in the $ i $ row and $ j $ column on the grid are written as $ (i, j) $ cells. Each cell in the grid has a number between $ 1 $ and $ 6 $, or the letter `#` in $ ...
instruction
0
92,594
15
185,188
"Correct Solution: ``` h, w = map(int, input().split()) p = list(range(h*w)) def find(x): global p if p[x] == x:return x p[x] = find(p[x]) return p[x] def unite(x, y): global p x = find(x) y = find(y) if x != y:p[x] =y def real_number(i, j): i += 1 j += 1 i %= 4 j %= ...
output
1
92,594
15
185,189
Provide a correct Python 3 solution for this coding contest problem. Problem statement I have a grid of $ H $ rows and $ W $ columns. Hereafter, the cells in the $ i $ row and $ j $ column on the grid are written as $ (i, j) $ cells. Each cell in the grid has a number between $ 1 $ and $ 6 $, or the letter `#` in $ ...
instruction
0
92,595
15
185,190
"Correct Solution: ``` from collections import deque h,w = map(int,input().split()) g = [list(map(int, list(input().replace('#', '0')))) for _ in range(h)] f = [[False]*w for _ in range(h)] q = deque() d = ((0,1), (1,0), (-1,0), (0,-1)) def chst(c,st,i): if i == 1: nc = st[1] nst = (st[0], 7-c) if i == 0:...
output
1
92,595
15
185,191
Provide a correct Python 3 solution for this coding contest problem. Problem statement I have a grid of $ H $ rows and $ W $ columns. Hereafter, the cells in the $ i $ row and $ j $ column on the grid are written as $ (i, j) $ cells. Each cell in the grid has a number between $ 1 $ and $ 6 $, or the letter `#` in $ ...
instruction
0
92,596
15
185,192
"Correct Solution: ``` H,W = map(int,input().split()) S = [input() for i in range(H)] def tor(x,y): to = {'6':'3','3':'1','1':'4','4':'6'} if y%4==0 else {'6':'4','4':'1','1':'3','3':'6'} return to[S[y][x]] def tol(x,y): to = {'6':'3','3':'1','1':'4','4':'6'} if y%4==2 else {'6':'4','4':'1','1':'3','3':'6'...
output
1
92,596
15
185,193
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing n cells, with each cell either being al...
instruction
0
92,881
15
185,762
Tags: implementation Correct Solution: ``` from sys import stdin,stdout from heapq import heapify,heappush,heappop,heappushpop from collections import defaultdict as dd, deque as dq,Counter as C from bisect import bisect_left as bl ,bisect_right as br from itertools import combinations as cmb,permutations as pmb from m...
output
1
92,881
15
185,763
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing n cells, with each cell either being al...
instruction
0
92,882
15
185,764
Tags: implementation Correct Solution: ``` import os import sys from io import BytesIO, IOBase from collections import Counter import math as mt BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "...
output
1
92,882
15
185,765
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing n cells, with each cell either being al...
instruction
0
92,883
15
185,766
Tags: implementation Correct Solution: ``` import sys from os import path if(path.exists('input.txt')): sys.stdin = open('input.txt', 'r') sys.stdout = open('output.txt', 'w') # sys.stdin.readline().rstrip() #n, m = map(int, input().split()) t = int(input()) for _ in range(t): n, m = map(int, input()....
output
1
92,883
15
185,767
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing n cells, with each cell either being al...
instruction
0
92,884
15
185,768
Tags: implementation Correct Solution: ``` for _ in range(int(input())): n, m = map(int, input().split()) s = input() s = '0' + s l = [-1e10] * (n+2) r = [1e10] * (n+2) for i in range(1, n+1): l[i] = l[i-1] if s[i] == '1': l[i] = i for i in range(n, 0, -1): ...
output
1
92,884
15
185,769
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing n cells, with each cell either being al...
instruction
0
92,885
15
185,770
Tags: implementation Correct Solution: ``` t = int(input()) for _ in range(t): n,m = [int(d) for d in input().split()] s = list(input()) idx = [] for i in range(len(s)): if (s[i] == '1'): idx.append(i) if (idx != []): if (idx[0] > 0): l = idx[0] c = 0 while (c < min(l,m)): s[l-c-1] = '1' ...
output
1
92,885
15
185,771
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing n cells, with each cell either being al...
instruction
0
92,886
15
185,772
Tags: implementation Correct Solution: ``` import io import os from bisect import bisect_left, bisect_right from collections import Counter, defaultdict, deque from heapq import heappush, heappop, heapify from math import gcd, inf def solve(N, M, A): for _ in range(M): B = [0] * N for i in range(...
output
1
92,886
15
185,773
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing n cells, with each cell either being al...
instruction
0
92,887
15
185,774
Tags: implementation Correct Solution: ``` for __ in range(int(input())): n, m = map(int, input().split()) s = list(input()) zeros = s.count('0') ones = n - zeros j = 0 while j < m and (zeros != n or ones != n): indices = [] flag = True for i in range(n): if s...
output
1
92,887
15
185,775
Provide tags and a correct Python 3 solution for this coding contest problem. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing n cells, with each cell either being al...
instruction
0
92,888
15
185,776
Tags: implementation Correct Solution: ``` for _ in range(int(input())): s = [int(i)for i in input().split()][1] x = input() a = -1 ans = [] ans_str = '' try: if '1' in x: for i in range(len(x)): if x[i] == '0' and a == -1: a = i ...
output
1
92,888
15
185,777
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array con...
instruction
0
92,889
15
185,778
Yes
output
1
92,889
15
185,779
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array con...
instruction
0
92,890
15
185,780
Yes
output
1
92,890
15
185,781
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array con...
instruction
0
92,891
15
185,782
Yes
output
1
92,891
15
185,783
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array con...
instruction
0
92,892
15
185,784
Yes
output
1
92,892
15
185,785
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array con...
instruction
0
92,893
15
185,786
No
output
1
92,893
15
185,787
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array con...
instruction
0
92,894
15
185,788
No
output
1
92,894
15
185,789
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array con...
instruction
0
92,895
15
185,790
No
output
1
92,895
15
185,791
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array con...
instruction
0
92,896
15
185,792
No
output
1
92,896
15
185,793
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
94,412
15
188,824
Tags: graphs, shortest paths Correct Solution: ``` from collections import deque n, m = map(int, input().split()) sx, sy = map(int, input().split()) tl, tr = map(int, input().split()) g = [input() for i in range(n)] sx -= 1 sy -= 1 dis = [[-1 for j in range(m)] for i in range(n)] q = deque() def go(x, y, s, left=False...
output
1
94,412
15
188,825
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
94,413
15
188,826
Tags: graphs, shortest paths Correct Solution: ``` from collections import deque n,m = map(int, input().split()) r,c = map(int, input().split()) x,y = map(int, input().split()) gr = [] vd = [[0]*m for i in range(n)] r -= 1 c -= 1 ans = 0 for i in range(n): gr.append(input()) to_visit = deque() to_visit.append((r,...
output
1
94,413
15
188,827
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
94,414
15
188,828
Tags: graphs, shortest paths Correct Solution: ``` '''input 4 5 3 2 1 2 ..... .***. ...** *.... 3 5 3 2 1 2 ..... .***. ...** 4 4 2 2 0 1 .... ..*. .... .... ''' from collections import deque n, m = map(int, input().split()) sx, sy = map(int, input().split()) tl, tr = map(int, input().split()) g = [input() for i in r...
output
1
94,414
15
188,829
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
94,415
15
188,830
Tags: graphs, shortest paths Correct Solution: ``` n, m = map(int, input().split()) r, c = map(int, input().split()) r, c = r-1, c-1 X, Y = map(int, input().split()) S = [input() for i in range(n)] L = [[-1]*m for i in range(n)] R = [[-1]*m for i in range(n)] from collections import deque q = deque([]) q.append((r, c)...
output
1
94,415
15
188,831
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
94,416
15
188,832
Tags: graphs, shortest paths Correct Solution: ``` from collections import deque def move(tx, ty, s, left=False): if 0 <= tx < n and 0 <= ty < m: if smap[tx][ty] == '.' and mp[tx][ty] == -1: mp[tx][ty] = s if left: q.appendleft((tx, ty)) else: ...
output
1
94,416
15
188,833
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
94,417
15
188,834
Tags: graphs, shortest paths Correct Solution: ``` from collections import deque n,m = map(int, input().split()) r,c = map(int, input().split()) x,y = map(int, input().split()) gr = [] vd = [[0]*m for i in range(n)] r -= 1 c -= 1 ans = 0 for i in range(n): gr.append(list(input())) to_visit = deque() to_visit.appe...
output
1
94,417
15
188,835
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
94,418
15
188,836
Tags: graphs, shortest paths Correct Solution: ``` import collections n,m = map(int,input().split()) r,c = map(int,input().split()) x,y = map(int,input().split()) arr = [] for i in range(n): arr.append(input()) que = collections.deque([(r-1,c-1)]) dist = [[float("inf")]*m for i in range(n)] dist[r-1][c-1] = 0 ...
output
1
94,418
15
188,837
Provide tags and a correct Python 3 solution for this coding contest problem. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one st...
instruction
0
94,419
15
188,838
Tags: graphs, shortest paths Correct Solution: ``` import queue import collections n, m = list(map(int, input().split())) x, y = list(map(int, input().split())) l, r = list(map(int, input().split())) maze = [] for _ in range(n): maze.append(list(input())) cost = [[float("inf")]*m for _ in range(n)] def bfs(start...
output
1
94,419
15
188,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starti...
instruction
0
94,420
15
188,840
Yes
output
1
94,420
15
188,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starti...
instruction
0
94,421
15
188,842
Yes
output
1
94,421
15
188,843
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starti...
instruction
0
94,422
15
188,844
No
output
1
94,422
15
188,845
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starti...
instruction
0
94,423
15
188,846
No
output
1
94,423
15
188,847
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starti...
instruction
0
94,424
15
188,848
No
output
1
94,424
15
188,849
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starti...
instruction
0
94,425
15
188,850
No
output
1
94,425
15
188,851
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
94,838
15
189,676
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
94,838
15
189,677
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
94,839
15
189,678
Tags: implementation Correct Solution: ``` n=int(input()) s = input() d = list(map(int, input().split())) i = 0 for _ in range(n+1): if i < 0 or i >= n: print("FINITE") exit() if s[i] == '>': i += d[i] elif s[i] == '<': i -= d[i] print("INFINITE") ```
output
1
94,839
15
189,679
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
94,840
15
189,680
Tags: implementation Correct Solution: ``` n = int(input()) s = input() d = list(map(int, input().split())) k = [False]*n i = 0 inf = False while not inf and i >= 0 and i < n: if not k[i]: k[i] = True else: inf = True if s[i] == '<': i -= d[i] else: i += d[i] if inf: print("INFINITE") else: print("FIN...
output
1
94,840
15
189,681