Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
⌀
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
8 values
p02684
if __name__=="__main__": N, K = map(int, input().split(' ')) _town_list = input().split(' ') town_list = [int(n) for n in _town_list] next_town = town_list[0] visited_town = set() visited_town.add(1) visited_town.add(next_town) lst_visited_town = [1] lst_visited_town.append(next_tow...
if __name__=="__main__": N, K = map(int, input().split(' ')) _town_list = input().split(' ') town_list = [int(n) for n in _town_list] next_town = town_list[0] visited_town = set() visited_town.add(1) visited_town.add(next_town) lst_visited_town = [1] lst_visited_town.append(next_tow...
[ "identifier.change", "call.arguments.change", "io.output.change" ]
415,100
415,101
u701893485
python
p02684
if __name__=="__main__": N, K = map(int, input().split(' ')) _town_list = input().split(' ') town_list = [int(n) for n in _town_list] next_town = town_list[0] visited_town = set() visited_town.add(1) visited_town.add(next_town) lst_visited_town = [1] lst_visited_town.append(next_tow...
if __name__=="__main__": N, K = map(int, input().split(' ')) _town_list = input().split(' ') town_list = [int(n) for n in _town_list] next_town = town_list[0] visited_town = set() visited_town.add(1) visited_town.add(next_town) lst_visited_town = [1] lst_visited_town.append(next_tow...
[ "identifier.change", "call.arguments.change", "io.output.change" ]
415,102
415,101
u701893485
python
p02684
from sys import stdin, setrecursionlimit setrecursionlimit(10 ** 9) INF = 1 << 60 def input(): return stdin.readline().strip() def main(): N, K = map(int, input().split()) A = [int(s) for s in input().split()] pos = 1 order = [-1] * (N+1) order[1] = 0 s = [1] for i in range(1, N + ...
from sys import stdin, setrecursionlimit setrecursionlimit(10 ** 9) INF = 1 << 60 def input(): return stdin.readline().strip() def main(): N, K = map(int, input().split()) A = [int(s) for s in input().split()] pos = 1 order = [-1] * (N+1) order[1] = 0 s = [1] for i in range(1, N + ...
[ "control_flow.return.add" ]
415,105
415,106
u968166680
python
p02684
[N,K] = list(map(int,input().split())) A = list(map(int,input().split())) #ループする場合 flag=[0]*N patt=[] aaaa=0 i=0 while True: patt.append(i) if flag[i]==1: #del patt[-1] break flag[i]=1 i=A[i]-1 srt = patt.index(patt[-1]) #print('srt',srt) end = len(patt)-2 ptrn = patt[srt:end+1] ...
[N,K] = list(map(int,input().split())) A = list(map(int,input().split())) #ループする場合 flag=[0]*N patt=[] aaaa=0 i=0 while True: patt.append(i) if flag[i]==1: #del patt[-1] break flag[i]=1 i=A[i]-1 srt = patt.index(patt[-1]) #print('srt',srt) end = len(patt)-2 ptrn = patt[srt:end+1] ...
[ "control_flow.branch.if.condition.change", "call.arguments.change" ]
415,107
415,108
u017603316
python
p02684
[N,K] = list(map(int,input().split())) A = list(map(int,input().split())) #ループする場合 flag=[0]*N patt=[] aaaa=0 i=0 while True: patt.append(i) if flag[i]==1: #del patt[-1] break flag[i]=1 i=A[i]-1 srt = patt.index(patt[-1]) #print('srt',srt) end = len(patt)-2 ptrn = patt[srt:end+1] if ...
[N,K] = list(map(int,input().split())) A = list(map(int,input().split())) #ループする場合 flag=[0]*N patt=[] aaaa=0 i=0 while True: patt.append(i) if flag[i]==1: #del patt[-1] break flag[i]=1 i=A[i]-1 srt = patt.index(patt[-1]) #print('srt',srt) end = len(patt)-2 ptrn = patt[srt:end+1] ...
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
415,109
415,108
u017603316
python
p02684
[N,K] = list(map(int,input().split())) A = list(map(int,input().split())) #ループする場合 flag=[0]*N patt=[] aaaa=0 i=0 while True: patt.append(i) if flag[i]==1: #del patt[-1] break flag[i]=1 i=A[i]-1 srt = patt.index(patt[-1]) #print('srt',srt) end = len(patt)-2 ptrn = patt[srt:end+1] if K...
[N,K] = list(map(int,input().split())) A = list(map(int,input().split())) #ループする場合 flag=[0]*N patt=[] aaaa=0 i=0 while True: patt.append(i) if flag[i]==1: #del patt[-1] break flag[i]=1 i=A[i]-1 srt = patt.index(patt[-1]) #print('srt',srt) end = len(patt)-2 ptrn = patt[srt:end+1] ...
[ "control_flow.branch.if.condition.change", "call.arguments.change", "expression.operation.binary.remove" ]
415,110
415,108
u017603316
python
p02684
N, M = map(int, input().split()) P = [i -1 for i in map(int,input().split())] ss = set([]) point = 0 for i in range(N): if point in ss: break ss.add(point) point = P[point] S = [0] points = 0 for i in range(len(ss)-1): points = P[points] S.append(points) loop = S[S.index(points):] ll = len(S...
N, M = map(int, input().split()) P = [i -1 for i in map(int,input().split())] ss = set([]) point = 0 for i in range(N): if point in ss: break ss.add(point) point = P[point] S = [0] points = 0 for i in range(len(ss)-1): points = P[points] S.append(points) loop = S[S.index(point):] ll = len(S)...
[ "assignment.value.change", "identifier.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
415,120
415,121
u756195685
python
p02684
N, M = map(int, input().split()) P = [i -1 for i in map(int,input().split())] ss = set([]) point = 0 for i in range(N): if point in ss: break ss.add(point) point = P[point] S = [0] points = 0 for i in range(len(ss)-1): points = P[points] S.append(points) loop = S[S.index(points):] ll = len(S...
N, M = map(int, input().split()) P = [i -1 for i in map(int,input().split())] ss = set([]) point = 0 for i in range(N): if point in ss: break ss.add(point) point = P[point] S = [0] points = 0 for i in range(len(ss)-1): points = P[points] S.append(points) loop = S[S.index(point):] ll = len(S)...
[ "assignment.value.change", "identifier.change", "variable_access.subscript.index.change", "call.arguments.change", "io.output.change" ]
415,122
415,121
u756195685
python
p02684
n,k = map(int,input().split()) a = [0]+list(map(int,input().split())) def bin(arr,val): left,right = 0,len(arr)-1 while left<=right: mid = (left+right)//2 if arr[mid]==val: return 1 elif arr[mid]<val: left = mid + 1 else: right = mid - 1 return 0 know = [] now = 1 while not...
n,k = map(int,input().split()) a = [0]+list(map(int,input().split())) def bin(arr,val): left,right = 0,len(arr)-1 while left<=right: mid = (left+right)//2 if arr[mid]==val: return 1 elif arr[mid]<val: left = mid + 1 else: right = mid - 1 return 0 know = [] now = 1 while not...
[ "assignment.value.change", "identifier.change" ]
415,127
415,128
u054556734
python
p02684
# = int(input()) N, K = map(int, input().split()) A = list(map(int, input().split())) # = [int(input()) for i in range(N)] # = [list(map(int, input().split())) for i in range(N)] next = 1 List = [-1]*N for i in range(K): if List[next-1] == -1: List[next-1] = i next = A[next-1] else: lo...
# = int(input()) N, K = map(int, input().split()) A = list(map(int, input().split())) # = [int(input()) for i in range(N)] # = [list(map(int, input().split())) for i in range(N)] next = 1 List = [-1]*N for i in range(K): if List[next-1] == -1: List[next-1] = i next = A[next-1] else: lo...
[ "expression.operation.binary.remove", "call.arguments.change" ]
415,134
415,135
u511457539
python
p02684
# = int(input()) N, K = map(int, input().split()) A = list(map(int, input().split())) # = [int(input()) for i in range(N)] # = [list(map(int, input().split())) for i in range(N)] next = 1 List = [-1]*N for i in range(K): if List[next-1] == -1: List[next-1] = i next = A[next-1] else: lo...
# = int(input()) N, K = map(int, input().split()) A = list(map(int, input().split())) # = [int(input()) for i in range(N)] # = [list(map(int, input().split())) for i in range(N)] next = 1 List = [-1]*N for i in range(K): if List[next-1] == -1: List[next-1] = i next = A[next-1] else: lo...
[ "expression.operation.binary.remove", "call.arguments.change" ]
415,136
415,135
u511457539
python
p02684
N,K = map(int, input().split()) A =[0] B=list(map(int, input().split())) for m in range(N): A.append(B[m]) place=set([]) p=[] i=1 count=0 while i not in place: place.add(i) p.append(i) i=A[i] count+=1 if count>=K: print(p[K]) else: loop=[i] start=i j=A[i] count+=1 while j!=st...
N,K = map(int, input().split()) A =[0] B=list(map(int, input().split())) for m in range(N): A.append(B[m]) place=set([]) p=[] i=1 count=0 while i not in place: place.add(i) p.append(i) i=A[i] count+=1 if count>K: print(p[K]) else: loop=[i] start=i j=A[i] count+=1 while j!=sta...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "identifier.replace.add", "literal.replace.remove", "variable_access.subscript.index.change", "call.arguments.change", "io.output.change" ]
415,139
415,140
u527454768
python
p02684
N,K = map(int, input().split()) A =[0] B=list(map(int, input().split())) for m in range(N): A.append(B[m]) place=set([]) p=[] i=1 count=0 while i not in place: place.add(i) p.append(i) i=A[i] count+=1 if count>=K: print(p[K]) else: loop=[i] start=i j=A[i] count+=1 while j!=st...
N,K = map(int, input().split()) A =[0] B=list(map(int, input().split())) for m in range(N): A.append(B[m]) place=set([]) p=[] i=1 count=0 while i not in place: place.add(i) p.append(i) i=A[i] count+=1 if count>K: print(p[K]) else: loop=[i] start=i j=A[i] count+=1 while j!=sta...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
415,141
415,140
u527454768
python
p02684
N,K = map(int, input().split()) A =[0] B=list(map(int, input().split())) for m in range(N): A.append(B[m]) place=set([]) p=[] i=1 count=0 while i not in place: place.add(i) p.append(i) i=A[i] count+=1 if count>=K: print(p[K]) else: loop=[i] start=i j=A[i] count+=1 while j!=st...
N,K = map(int, input().split()) A =[0] B=list(map(int, input().split())) for m in range(N): A.append(B[m]) place=set([]) p=[] i=1 count=0 while i not in place: place.add(i) p.append(i) i=A[i] count+=1 if count>K: print(p[K]) else: loop=[i] start=i j=A[i] count+=1 while j!=sta...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
415,143
415,140
u527454768
python
p02684
N,K = map(int, input().split()) A =[0] B=list(map(int, input().split())) for m in range(N): A.append(B[m]) place=set([]) p=[] i=1 count=0 while i not in place: place.add(i) p.append(i) i=A[i] count+=1 if count>=K: print(place[K+1]) else: loop=[i] start=i j=A[i] count+=1 while...
N,K = map(int, input().split()) A =[0] B=list(map(int, input().split())) for m in range(N): A.append(B[m]) place=set([]) p=[] i=1 count=0 while i not in place: place.add(i) p.append(i) i=A[i] count+=1 if count>K: print(p[K]) else: loop=[i] start=i j=A[i] count+=1 while j!=sta...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "identifier.change", "call.arguments.change", "io.output.change", "expression.operation.binary.remove" ]
415,144
415,140
u527454768
python
p02684
N,K = map(int,input().split()) As = list(map(int,input().split())) towns = [0]*N route = [0] pre = 0 i = 0 towns[0] = 1 for _ in range(N): i = As[i]-1 if towns[i]>0: pre = route.index(i) route = route[pre:] break route.append(i) towns[i] = 1 mod = len(route) print(route[(K-pre)%m...
N,K = map(int,input().split()) As = list(map(int,input().split())) towns = [0]*N route = [0] pre = 0 i = 0 towns[0] = 1 for _ in range(K): i = As[i]-1 if towns[i]>0: pre = route.index(i) route = route[pre:] break route.append(i) towns[i] = 1 mod = len(route) print(route[(K-pre)%m...
[ "identifier.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
415,145
415,146
u996665352
python
p02684
N,K = map(int,input().split()) A = list(map(int,input().split())) A_dict = {i:a for i,a in enumerate(A,1)} History = [1] History_set = {1} now = 1 for _ in range(N): now = A_dict[now] if now not in History_set: History.append(now) History_set.add(now) else: break #print(History,now)...
N,K = map(int,input().split()) A = list(map(int,input().split())) A_dict = {i:a for i,a in enumerate(A,1)} History = [1] History_set = {1} now = 1 for i in range(N): now = A_dict[now] if now not in History_set: History.append(now) History_set.add(now) else: break #print(History,now)...
[ "identifier.change", "control_flow.branch.if.condition.change" ]
415,155
415,156
u813953440
python
p02684
N,K = map(int,input().split()) A = list(map(int,input().split())) A_dict = {i:a for i,a in enumerate(A,1)} History = [1] History_set = {1} now = 1 for _ in range(N): now = A_dict[now] if now not in History_set: History.append(now) History_set.add(now) else: break #print(History,now)...
N,K = map(int,input().split()) A = list(map(int,input().split())) A_dict = {i:a for i,a in enumerate(A,1)} History = [1] History_set = {1} now = 1 for i in range(N): now = A_dict[now] if now not in History_set: History.append(now) History_set.add(now) else: break #print(History,now)...
[ "identifier.change" ]
415,157
415,156
u813953440
python
p02684
n,k = map(int, input().split()) a = list(map(int, input().strip().split())) for i in range(len(a)): a[i] -= 1 visited = [-1] * n now = 0 visited[0] = 0 pre_roop = 0 pos = 0 i = 1 r = 1 while i <= k: next = a[now] #print('roop:',i,now+1,next+1) if visited[next] >= 0: r = i-visited[next] ...
n,k = map(int, input().split()) a = list(map(int, input().strip().split())) for i in range(len(a)): a[i] -= 1 visited = [-1] * n now = 0 visited[0] = 0 pre_roop = 0 pos = 0 i = 1 r = 1 while i <= k: next = a[now] #print('roop:',i,now+1,next+1) if visited[next] >= 0: r = i-visited[next] ...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
415,168
415,169
u934099192
python
p02684
n,k = map(int, input().split()) a = list(map(int, input().strip().split())) for i in range(len(a)): a[i] -= 1 visited = [-1] * n now = 0 visited[0] = 0 pre_roop = 0 pos = 0 i = 1 r = 1 while i < k: next = a[now] #print('roop:',i,now+1,next+1) if visited[next] >= 0: r = i-visited[next] ...
n,k = map(int, input().split()) a = list(map(int, input().strip().split())) for i in range(len(a)): a[i] -= 1 visited = [-1] * n now = 0 visited[0] = 0 pre_roop = 0 pos = 0 i = 1 r = 1 while i <= k: next = a[now] #print('roop:',i,now+1,next+1) if visited[next] >= 0: r = i-visited[next] ...
[ "expression.operator.compare.change", "control_flow.loop.condition.change", "control_flow.branch.if.condition.change" ]
415,170
415,169
u934099192
python
p02684
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K <= key - 1: print(lst_memo[K - 1] + 1) else: roop = lst_memo[key:]...
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K < key: print(lst_memo[K] + 1) else: roop = lst_memo[key:] ...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
415,175
415,176
u894521144
python
p02684
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K < key: print(lst_memo[K - 1] + 1) else: roop = lst_memo[key:] ...
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K < key: print(lst_memo[K] + 1) else: roop = lst_memo[key:] ...
[ "expression.operation.binary.remove" ]
415,177
415,176
u894521144
python
p02684
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K <= key: print(lst_memo[K - 1] + 1) else: roop = lst_memo[key:] ...
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K < key: print(lst_memo[K] + 1) else: roop = lst_memo[key:] ...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
415,178
415,176
u894521144
python
p02684
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K <= key: print(lst_memo[K - 1] + 1) else: roop = lst_memo[key:] ...
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K < key: print(lst_memo[K] + 1) else: roop = lst_memo[key:] ...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
415,179
415,176
u894521144
python
p02684
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K <= N: print(lst_memo[K - 1] + 1) else: roop = lst_memo[key:] ...
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K < key: print(lst_memo[K] + 1) else: roop = lst_memo[key:] ...
[ "expression.operation.binary.remove" ]
415,180
415,176
u894521144
python
p02684
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K < key: print(lst_memo[K - 1] + 1) else: roop = lst_memo[key:] ...
def main(N, K, A): i = 0 # 現在地 lst_memo = [] set_memo = set([]) while i not in set_memo: lst_memo.append(i) set_memo.add(i) i = A[i] - 1 # pythonは一つずれる key = lst_memo.index(i) if K < key: print(lst_memo[K] + 1) else: roop = lst_memo[key:] ...
[ "expression.operation.binary.remove" ]
415,181
415,176
u894521144
python
p02684
from collections import deque import numpy as np n, k = map(int, input().split()) An = list(map(int, input().split())) root = deque([1]) check = np.zeros(n, np.int) check[0] = 1 i = 0 dup = 1 cnt = 1 for _ in range(n): temp = An[i] if check[temp-1] == 1: dup = temp break root.append(temp) ...
from collections import deque import numpy as np n, k = map(int, input().split()) An = list(map(int, input().split())) root = deque([1]) check = np.zeros(n, np.int) check[0] = 1 i = 0 dup = 1 cnt = 1 for _ in range(n): temp = An[i] if check[temp-1] == 1: dup = temp break root.append(temp) ...
[ "expression.operation.binary.remove" ]
415,187
415,188
u459150945
python
p02684
from collections import deque import numpy as np n, k = map(int, input().split()) An = list(map(int, input().split())) root = deque([1]) check = np.zeros(n, np.int) check[0] = 1 i = 0 dup = 1 cnt = 1 for _ in range(n): temp = An[i] if check[temp-1] == 1: dup = temp break root.append(temp) ...
from collections import deque import numpy as np n, k = map(int, input().split()) An = list(map(int, input().split())) root = deque([1]) check = np.zeros(n, np.int) check[0] = 1 i = 0 dup = 1 cnt = 1 for _ in range(n): temp = An[i] if check[temp-1] == 1: dup = temp break root.append(temp) ...
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
415,189
415,188
u459150945
python
p02684
n,k = map(int, input().split()) a = list(map(int, input().split())) import numpy as np link = set() next = a[0] link.add(1) while next not in link: link.add(next) next = a[next-1] # print(next) link2 = set() next2 = a[0] link2.add(1) while next not in link2: link2.add(next2) next2 = a[next2-1] link2.r...
n,k = map(int, input().split()) a = list(map(int, input().split())) import numpy as np link = set() next = a[0] link.add(1) while next not in link: link.add(next) next = a[next-1] # print(next) link2 = set() next2 = a[0] link2.add(1) while next not in link2: link2.add(next2) next2 = a[next2-1] link2.r...
[]
415,190
415,191
u023185908
python
p02684
N,K = list(map(int, input().split())) A = list(map(int, input().split())) r = 0 if K <= N: current = 0 for i in range(K): current = A[current-1] print(current) else: isReturn = [0 for i in range(N)] step = 1 current = 1 isReturn[current-1] = step for i in range(N): curren...
N,K = list(map(int, input().split())) A = list(map(int, input().split())) r = 0 if K <= N: current = 1 for i in range(K): current = A[current-1] print(current) else: isReturn = [0 for i in range(N)] step = 1 current = 1 isReturn[current-1] = step for i in range(N): curren...
[ "literal.number.integer.change", "assignment.value.change" ]
415,192
415,193
u994147425
python
p02684
n, k = map(int, input().split()) a = list(map(int, input().split())) visited = [1] is_visited = [0] * n now = 1 step = 0 for i in range(k): now = a[now-1] step += 1 if is_visited[now-1] == 0: is_visited[now-1] = 1 else: ind = visited.index(now) loop = visited[ind:] tmp ...
n, k = map(int, input().split()) a = list(map(int, input().split())) visited = [1] is_visited = [0] * n now = 1 step = 0 for i in range(k): now = a[now-1] step += 1 if is_visited[now-1] == 0: is_visited[now-1] = 1 visited.append(now) else: ind = visited.index(now) loop ...
[ "call.add" ]
415,194
415,195
u822662438
python
p02684
n, k = map(int, input().split()) a = list(map(int, input().split())) visited = [1] is_visited = [0] * n now = 1 step = 0 for i in range(k): now = a[now-1] step += 1 if is_visited[now-1] == 0: is_visited[now-1] = 1 else: ind = visited.index(now) loop = visited[ind:] tmp ...
n, k = map(int, input().split()) a = list(map(int, input().split())) visited = [1] is_visited = [0] * n now = 1 step = 0 for i in range(k): now = a[now-1] step += 1 if is_visited[now-1] == 0: is_visited[now-1] = 1 visited.append(now) else: ind = visited.index(now) loop ...
[ "call.add" ]
415,196
415,195
u822662438
python
p02684
n,k=map(int,input().split()) a=list(map(int,input().split())) l=[1] di={} di[1]=1 for i in a: b=a[l[-1]-1] if b in di: x=b break l.append(b) di[b]=1 t1=0 for j in l: if j==x: break else: aa+=1 t2=len(l)-t1 if k<=t1: print(l[k]) else: aa=(k-t1)%t2 ...
n,k=map(int,input().split()) a=list(map(int,input().split())) l=[1] di={} di[1]=1 for i in a: b=a[l[-1]-1] if b in di: x=b break l.append(b) di[b]=1 t1=0 for j in l: if j==x: break else: t1+=1 t2=len(l)-t1 if k<=t1: print(l[k]) else: aa=(k-t1)%t2 ...
[ "identifier.change" ]
415,197
415,198
u449473917
python
p02684
n,k = list(map(int,input().split())) A = list(map(int,input().split())) tour=[0] visited=[0]*n visited[0]=1 next_town = 0 flag=False for i in range(n): next_town=A[next_town]-1 if i+1==k: flag = True ans = next_town break if next_town==0: first_roop_idx = 0 break ...
n,k = list(map(int,input().split())) A = list(map(int,input().split())) tour=[0] visited=[0]*n visited[0]=1 next_town = 0 flag=False for i in range(n): next_town=A[next_town]-1 if i+1==k: flag = True ans = next_town break if next_town==0: first_roop_idx = 0 break ...
[ "call.remove" ]
415,201
415,202
u657786757
python
p02684
n,k = list(map(int,input().split())) A = list(map(int,input().split())) tour=[0] visited=[0]*n visited[0]=1 next_town = 0 flag=False for i in range(n): next_town=A[next_town]-1 if i==k: flag = True ans = next_town if next_town==0: first_roop_idx = 0 break if visited[next_...
n,k = list(map(int,input().split())) A = list(map(int,input().split())) tour=[0] visited=[0]*n visited[0]=1 next_town = 0 flag=False for i in range(n): next_town=A[next_town]-1 if i+1==k: flag = True ans = next_town break if next_town==0: first_roop_idx = 0 break ...
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one", "control_flow.break.add" ]
415,203
415,202
u657786757
python
p02684
n,k = map(int, input().split()) a = list(map(lambda x : int(x) -1, map(int, input().split()))) s = {0} loop = [0] while a[loop[-1]] not in s: loop.append(a[loop[-1]]) s.add(loop[-1]) idx = loop.index(a[loop[-1]]) if k <= len(loop): print(loop[k]+1) else: print(loop[(k - idx)% (len(loop) - idx)...
n,k = map(int, input().split()) a = list(map(lambda x : int(x) -1, map(int, input().split()))) s = {0} loop = [0] while a[loop[-1]] not in s: loop.append(a[loop[-1]]) s.add(loop[-1]) idx = loop.index(a[loop[-1]]) if k < len(loop): print(loop[k]+1) else: print(loop[(k - idx)% (len(loop) - idx) ...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
415,215
415,216
u851319680
python
p02684
n,k = map(int, input().split()) a = list(map(lambda x : int(x) -1, map(int, input().split()))) s = {0} loop = [0] while a[loop[-1]] not in s: loop.append(a[loop[-1]]) s.add(loop[-1]) idx = loop.index(a[loop[-1]]) if k <= len(loop): print(loop[k-1]+1) else: print(loop[(k - idx)% (len(loop) - id...
n,k = map(int, input().split()) a = list(map(lambda x : int(x) -1, map(int, input().split()))) s = {0} loop = [0] while a[loop[-1]] not in s: loop.append(a[loop[-1]]) s.add(loop[-1]) idx = loop.index(a[loop[-1]]) if k < len(loop): print(loop[k]+1) else: print(loop[(k - idx)% (len(loop) - idx) ...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
415,217
415,216
u851319680
python
p02684
n, k = map(int, input().split()) a = [int(i) - 1 for i in input().split()] visit = {0} tmp = 0 a_list = [0] ans = True for i in range(k): tmp = a[tmp] if tmp in visit: left = a_list.index(tmp) ans = False print(a[left + (k - left) % (i + 1 - left)] + 1) break else: vi...
n, k = map(int, input().split()) a = [int(i) - 1 for i in input().split()] visit = {0} tmp = 0 a_list = [0] ans = True for i in range(k): tmp = a[tmp] if tmp in visit: left = a_list.index(tmp) ans = False print(a_list[left + (k - left) % (i + 1 - left)] + 1) break else: ...
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
415,221
415,222
u091051505
python
p02684
from collections import defaultdict n,k = map(int, input().split()) a = list(map(int, input().split())) s = 1 w = [1] y = defaultdict(lambda: 0) y[1] = 1 flag = 0 zen = 0 for i in range(k): # print(s,a[s-1]) if(y[a[s-1]] == 1): # print("w",w,a[s-1]) flag = 1 if(a[s-1] == 1): break else: for j in range(...
from collections import defaultdict n,k = map(int, input().split()) a = list(map(int, input().split())) s = 1 w = [1] y = defaultdict(lambda: 0) y[1] = 1 flag = 0 zen = 0 for i in range(k): # print(s,a[s-1]) if(y[a[s-1]] == 1): # print("w",w,a[s-1]) flag = 1 if(a[s-1] == 1): break else: for j in range(...
[]
415,250
415,251
u969808621
python
p02684
n,k = map(int,input().split()) A = [int(i) for i in input().split()] Visit = [False for i in range(n+1)] loop_st,loop_end,loop_len = 0,0,0 st = 1 releki = [] loop_list = [] for i in range(10000000000000): if Visit[st] == True: loop_key = st loop_st = releki.index(loop_key) loop_end = len(r...
n,k = map(int,input().split()) A = [int(i) for i in input().split()] Visit = [False for i in range(n+1)] loop_st,loop_end,loop_len = 0,0,0 st = 1 releki = [] loop_list = [] for i in range(10000000000000): if Visit[st] == True: loop_key = st loop_st = releki.index(loop_key) loop_end = len(r...
[ "identifier.change", "variable_access.subscript.index.change", "call.arguments.change", "io.output.change" ]
415,257
415,258
u494058663
python
p02684
b0=input().split() towns=int(b0[0]) k=int(b0[1]) al=[int(i)-1 for i in input().split()] rt=[-1 for x in range(towns)] rt[0]=0 now=0 for x in range(1,300000): now=al[now] if rt[now]!=-1: stp=x break else: rt[now]=x ll=stp-rt[now] k2=k-rt[now] if k<ll: print(rt.index(k)+1) else: print(rt.ind...
b0=input().split() towns=int(b0[0]) k=int(b0[1]) al=[int(i)-1 for i in input().split()] rt=[-1 for x in range(towns)] rt[0]=0 now=0 for x in range(1,300000000): now=al[now] if rt[now]!=-1: stp=x break else: rt[now]=x ll=stp-rt[now] k2=k-rt[now] if k<rt[now]: print(rt.index(k)+1) else: print...
[ "literal.number.integer.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change", "control_flow.branch.if.condition.change" ]
415,261
415,262
u276691127
python
p02684
N,K=(int(x) for x in input().split()) A=list(map(int, input().split())) if K<=N: s=1 for i in range(K): s=A[s-1] print(s) else: s=1 S={1} iloop=1 while A[s-1] not in S: S.add(A[s-1]) s=A[s-1] iloop=iloop+1 p=s loop=1 while A[s-1] != p: loop...
N,K=(int(x) for x in input().split()) A=list(map(int, input().split())) if K<=N: s=1 for i in range(K): s=A[s-1] print(s) else: s=1 S={1} iloop=1 while A[s-1] not in S: S.add(A[s-1]) s=A[s-1] iloop=iloop+1 p=s loop=1 while A[s-1] != p: loop...
[ "call.remove" ]
415,265
415,266
u475402977
python
p02684
N,K=(int(x) for x in input().split()) A=list(map(int, input().split())) if K<=N: s=1 for i in range(K): s=A[s-1] print(s) else: s=1 S={1} iloop=1 while A[s-1] not in S: S.add(A[s-1]) s=A[s-1] iloop=iloop+1 p=s loop=0 while A[s-1] != p: loop...
N,K=(int(x) for x in input().split()) A=list(map(int, input().split())) if K<=N: s=1 for i in range(K): s=A[s-1] print(s) else: s=1 S={1} iloop=1 while A[s-1] not in S: S.add(A[s-1]) s=A[s-1] iloop=iloop+1 p=s loop=1 while A[s-1] != p: loop...
[ "literal.number.integer.change", "assignment.value.change" ]
415,267
415,266
u475402977
python
p02684
N,K=(int(x) for x in input().split()) A=list(map(int, input().split())) if K<=2*N: s=1 for i in range(K): s=A[s-1] print(s) else: s=1 S={1} iloop=1 while A[s-1] not in S: S.add(A[s-1]) s=A[s-1] iloop=iloop+1 p=s loop=0 while A[s-1] != p: lo...
N,K=(int(x) for x in input().split()) A=list(map(int, input().split())) if K<=N: s=1 for i in range(K): s=A[s-1] print(s) else: s=1 S={1} iloop=1 while A[s-1] not in S: S.add(A[s-1]) s=A[s-1] iloop=iloop+1 p=s loop=1 while A[s-1] != p: loop...
[ "expression.operation.binary.remove", "literal.number.integer.change", "assignment.value.change" ]
415,268
415,266
u475402977
python
p02684
N,K=(int(x) for x in input().split()) A=list(map(int, input().split())) if K<=2*N: s=1 for i in range(K): s=A[s-1] print(s) else: s=1 S={1} iloop=1 while A[s-1] not in S: S.add(A[s-1]) s=A[s-1] iloop=iloop+1 p=s loop=1 while A[s-1] != p: lo...
N,K=(int(x) for x in input().split()) A=list(map(int, input().split())) if K<=N: s=1 for i in range(K): s=A[s-1] print(s) else: s=1 S={1} iloop=1 while A[s-1] not in S: S.add(A[s-1]) s=A[s-1] iloop=iloop+1 p=s loop=1 while A[s-1] != p: loop...
[ "expression.operation.binary.remove" ]
415,269
415,266
u475402977
python
p02684
#!/usr/bin/env python3 # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools def main(n, k, a): ck=[-1]*n tak=0 c=0 ck[0]=c for i in range(n): c+=1 tak=a[tak]-1 if ck[tak]!=-1: loop=c-ck[tak] lps=ck[tak] break ck[tak...
#!/usr/bin/env python3 # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools def main(n, k, a): ck=[-1]*n tak=0 c=0 ck[0]=c for i in range(n): c+=1 tak=a[tak]-1 if ck[tak]!=-1: loop=c-ck[tak] lps=ck[tak] break ck[tak...
[ "call.add", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
415,272
415,273
u090649502
python
p02684
N, K = map(int,input().split()) A = list(map(int,input().split())) count = 0 i = 1 position = 1 position_list = [1] position_history = [0] * N start_loop = 0 def last(): k = (K - start_loop) % (count - start_loop) print(position_list[start_loop+k]) while i > 0: position = A[position-1] position_history[positi...
N, K = map(int,input().split()) A = list(map(int,input().split())) count = 0 i = 1 position = 1 position_list = [1] position_history = [0] * N start_loop = 0 def last(): k = (K - start_loop) % (count - start_loop) print(position_list[start_loop+k]) while i > 0: position = A[position-1] position_history[positi...
[ "control_flow.break.add" ]
415,283
415,284
u874333466
python
p02684
import math from collections import defaultdict def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) visited = [-1 for _ in range(N)] visited[0] = 0 current = 0 th = -1 per_loop = -1 for i in range(1, N+1): current = A[current] - 1 if visi...
import math from collections import defaultdict def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) visited = [-1 for _ in range(N)] visited[0] = 0 current = 0 th = -1 per_loop = -1 for i in range(1, N+1): current = A[current] - 1 if visi...
[ "identifier.change", "control_flow.branch.if.condition.change", "identifier.replace.add", "literal.replace.remove" ]
415,285
415,286
u866949333
python
p02684
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,sqrt,factorial,hypot,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter,default...
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,sqrt,factorial,hypot,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter,default...
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
415,312
415,313
u788137651
python
p02684
N,K = map(int,input().split()) A = list(map(int,input().split())) pos = 0 visit = [0] * N move = [] roop = [] while visit[pos]!=2: if visit[pos]==0: move.append(pos) else: roop.append(pos) visit[pos] += 1 pos = a[pos] - 1 if len(move)>K: print(move[K]+1) else: print(roop[(K-(len(...
N,K = map(int,input().split()) A = list(map(int,input().split())) pos = 0 visit = [0] * N move = [] roop = [] while visit[pos]!=2: if visit[pos]==0: move.append(pos) else: roop.append(pos) visit[pos] += 1 pos = A[pos] - 1 if len(move)>K: print(move[K]+1) else: print(roop[(K-(len(...
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
415,316
415,317
u807028974
python
p02684
# import sys # import math #sqrt,gcd,pi # import decimal # import queue # queue # import bisect # import heapq # priolity-queue # import time # from itertools import product,permutations,\ # combinations,combinations_with_replacement # 重複あり順列、順列、組み合わせ、重複あり組み合わせ # import collections # deque # from operator import it...
# import sys # import math #sqrt,gcd,pi # import decimal # import queue # queue # import bisect # import heapq # priolity-queue # import time # from itertools import product,permutations,\ # combinations,combinations_with_replacement # 重複あり順列、順列、組み合わせ、重複あり組み合わせ # import collections # deque # from operator import it...
[ "call.remove", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
415,318
415,319
u807028974
python
p02684
import sys n, k = map(int, input().split()) A = list(map(int, input().split())) route = [1] appearance = set() index = 1 cnt = 0 flg = False for _ in range(n): if index in appearance: flg = True break appearance.add(index) cnt += 1 next_city = A[index - 1] route.append(next_city) ...
import sys n, k = map(int, input().split()) A = list(map(int, input().split())) route = [1] appearance = set() index = 1 cnt = 0 flg = False for _ in range(k): if index in appearance: flg = True break appearance.add(index) cnt += 1 next_city = A[index - 1] route.append(next_city) ...
[ "identifier.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
415,326
415,327
u285022453
python
p02684
N, K = map(int, input().split()) A_list = [int(a) for a in input().split()] # print(N, K) # print(A_list) keiro = [1] visit_town = [0]*N town = 1 c = 1 while True: visit_town[town - 1] = c c += 1 town = A_list[town - 1] # print('town', town) if len(keiro) > 1 and visit_town[town-1] != 0: ...
N, K = map(int, input().split()) A_list = [int(a) for a in input().split()] # print(N, K) # print(A_list) keiro = [1] visit_town = [0]*N town = 1 c = 1 while True: visit_town[town - 1] = c c += 1 town = A_list[town - 1] # print('town', town) if len(keiro) > 1 and visit_town[town-1] != 0: ...
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
415,330
415,331
u596681540
python
p02684
N, K = map(int, input().split()) A_list = [int(a) for a in input().split()] # print(N, K) # print(A_list) keiro = [1] visit_town = [0]*N town = 1 c = 1 while True: visit_town[town - 1] = c c += 1 town = A_list[town - 1] # print('town', town) if len(keiro) > 1 and visit_town[town-1] != 0: ...
N, K = map(int, input().split()) A_list = [int(a) for a in input().split()] # print(N, K) # print(A_list) keiro = [1] visit_town = [0]*N town = 1 c = 1 while True: visit_town[town - 1] = c c += 1 town = A_list[town - 1] # print('town', town) if len(keiro) > 1 and visit_town[town-1] != 0: ...
[ "control_flow.branch.if.condition.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change", "expression.operation.binary.remove" ]
415,332
415,331
u596681540
python
p02684
def main(): N,K=map(int,input().split()) A=list(map(int,input().split())) pos=set() pos.add(0) i=0 traversal=[0] start=0 nodes=[1] while(start<K): position=A[i]-1 if position in pos: break traversal.append(position) pos.add(position) ...
def main(): N,K=map(int,input().split()) A=list(map(int,input().split())) pos=set() pos.add(0) i=0 traversal=[0] start=0 nodes=[1] while(start<K): position=A[i]-1 if position in pos: break traversal.append(position) pos.add(position) ...
[ "identifier.change", "call.arguments.change", "io.output.change" ]
415,336
415,337
u882832697
python
p02684
def main(): import sys input = sys.stdin.readline N, K = map(int, input().split()) A = list(map(int, input().split())) # N = 2*(10**4) # K = 10**18 # A = [i+2 for i in range(N)] # A[-1] = 1 # print(A) visited = [0] visited_set = set([0]) now = 0 ind = 0 my_appe...
def main(): import sys input = sys.stdin.readline N, K = map(int, input().split()) A = list(map(int, input().split())) # N = 2*(10**4) # K = 10**18 # A = [i+2 for i in range(N)] # A[-1] = 1 # print(A) visited = [0] visited_set = set([0]) now = 0 ind = 0 my_appe...
[ "assignment.value.change", "call.add" ]
415,338
415,339
u239917977
python
p02684
N ,K = map(int, input().split()) A = list(map(int, input().split())) B = [0] C = {} C[0] = 0 cnt = 0 jdg = 0 q = 0 while jdg == 0: i = A[q]-1 q = i if q in C: l = C[q] #print(q,l) break cnt += 1 B.append(i) C[i] = cnt r = cnt+1 #print(q) #print(B) #print(C) #print(l) #pr...
N ,K = map(int, input().split()) A = list(map(int, input().split())) B = [0] C = {} C[0] = 0 cnt = 0 jdg = 0 q = 0 while jdg == 0: i = A[q]-1 q = i if q in C: l = C[q] #print(q,l) break cnt += 1 B.append(i) C[i] = cnt r = cnt+1 #print(q) #print(B) #print(C) #print(l) #pr...
[ "call.remove" ]
415,340
415,341
u489124637
python
p02684
import sys n,k=map(int,input().split()) alist=list(map(int,input().split())) vislist=[1] visset={1} loopflag=True endflag=False donek=0 ima=1 while loopflag: ima=alist[ima-1] if ima in visset: loopflag=False if ima == alist[ima-1]: endflag=True else: vislist.append(ima)...
import sys n,k=map(int,input().split()) alist=list(map(int,input().split())) vislist=[1] visset={1} loopflag=True endflag=False donek=0 ima=1 while loopflag: ima=alist[ima-1] if ima in visset: loopflag=False if ima == alist[ima-1]: endflag=True else: vislist.append(ima)...
[ "variable_access.subscript.index.change", "call.arguments.change", "io.output.change", "expression.operation.unary.add" ]
415,350
415,351
u485979475
python
p02684
n, k = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] -= 1 v = 0 li = [v] set_ = {v} while True: nxt_v = a[v] if nxt_v not in set_: li.append(nxt_v) set_.add(nxt_v) v = nxt_v else: start = nxt_v break for i in range(len(li...
n, k = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] -= 1 v = 0 li = [v] set_ = {v} while True: nxt_v = a[v] if nxt_v not in set_: li.append(nxt_v) set_.add(nxt_v) v = nxt_v else: start = nxt_v break for i in range(len(li)...
[ "expression.operation.binary.add" ]
415,356
415,357
u794173881
python
p02684
def main(): n,k=map(int,input().split()) a=list(map(int,input().split())) b=1 seen=[-1]*n c=0 while seen[b-1]==-1: seen[b-1]=c b=a[b-1] c+=1 start=seen[b-1] end=c k=start+(k-start)%(end-start) b=1 for _ in range(k): b=a[b-1] print(b) if __name__=='__main__': main()
def main(): n,k=map(int,input().split()) a=list(map(int,input().split())) b=1 seen=[-1]*n c=0 while seen[b-1]==-1: seen[b-1]=c b=a[b-1] c+=1 start=seen[b-1] end=c k=min(k,start+(k-start)%(end-start)) b=1 for _ in range(k): b=a[b-1] print(b) if __name__=='__main__': main()
[ "call.add", "call.arguments.change" ]
415,376
415,377
u707124227
python
p02684
N, K = map(int, input().split()) A_s = list(map(int, input().split())) # それぞれの街に訪れた時のカウント cache = [0]*N # cacheの逆引き辞書 MAP = {} # 町カーソル i=0 # テレポーターのカウント cnt=1 # 閉路のサイズ rplng = 0 nolp = False while(True): if(cache[i]!=0): rplng = cnt - cache[i] break if(cnt > K): nolp = True break...
N, K = map(int, input().split()) A_s = list(map(int, input().split())) # それぞれの街に訪れた時のカウント cache = [0]*N # cacheの逆引き辞書 MAP = {} # 町カーソル i=0 # テレポーターのカウント cnt=1 # 閉路のサイズ rplng = 0 nolp = False while(True): if(cache[i]!=0): rplng = cnt - cache[i] break if(cnt > K): nolp = True break...
[ "expression.operation.binary.remove", "call.arguments.change" ]
415,378
415,379
u309039873
python
p02684
# -*- coding: utf-8 -*- N, K = map(int, input().split()) A_list = list(map(int, input().split())) ans_list = [1] history_list = [0 for _ in range(N)] before_town = 1 loop_start_town = 10 ** 10 for i in range(N): now_town = A_list[before_town - 1] if history_list[now_town - 1] == 1: break ans_list.a...
# -*- coding: utf-8 -*- N, K = map(int, input().split()) A_list = list(map(int, input().split())) ans_list = [1] history_list = [0 for _ in range(N)] before_town = 1 loop_start_town = 10 ** 10 for i in range(N): now_town = A_list[before_town - 1] if history_list[now_town - 1] == 1: break ans_list.a...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
415,380
415,381
u811817592
python
p02684
import sys import numpy as np N, K = map(int, input().split()) A = np.array(list(map(int, input().split()))) A = np.insert(A, 0, 0) flg = [False for _ in range(N + 1)] town = [] i = 1 cnt = 0 for i in range(N): town.append(i) flg[i] = True i = A[i] if len(town) >= K: print(town[K]) else: s = i ...
import sys import numpy as np N, K = map(int, input().split()) A = np.array(list(map(int, input().split()))) A = np.insert(A, 0, 0) flg = [False for _ in range(N + 1)] town = [] i = 1 cnt = 0 for _ in range(N): town.append(i) flg[i] = True i = A[i] if len(town) >= K: print(town[K]) else: s = i ...
[ "identifier.change" ]
415,408
415,409
u728566015
python
p02684
N, K = list(map(int, input().split(" "))) A = list(map(int, input().split(" "))) import numpy as np Nstock = np.zeros(N) cpos = 1 Nstock[cpos - 1] = 1 stock = [cpos] loop = [] idx = 0 for i in range(K): cpos = A[cpos-1] if Nstock[cpos - 1] == 1: idx = stock.index(cpos) loop = stock[...
N, K = list(map(int, input().split(" "))) A = list(map(int, input().split(" "))) import numpy as np Nstock = np.zeros(N) cpos = 1 Nstock[cpos - 1] = 1 stock = [cpos] loop = [] idx = 0 for i in range(K): cpos = A[cpos-1] if Nstock[cpos - 1] == 1: idx = stock.index(cpos) loop = stock[...
[ "expression.operation.binary.remove" ]
415,412
415,413
u881195671
python
p02684
N, K = map(int, input().split()) A = list(map(lambda x: x-1, map(int, input().split()))) T = [False]*N initcount = 0 count = 0 cur = 0 for _ in range(N): count += 1 T[cur] = True cur = A[cur] if T[cur]: break initcur = 0 for _ in range(count+1): initcount += 1 initcur = A[initcur] i...
N, K = map(int, input().split()) A = list(map(lambda x: x-1, map(int, input().split()))) T = [False]*N initcount = 0 count = 0 cur = 0 for _ in range(N): count += 1 T[cur] = True cur = A[cur] if T[cur]: break initcur = 0 for _ in range(count+1): initcount += 1 initcur = A[initcur] i...
[ "call.remove" ]
415,423
415,424
u785213188
python
p02684
N,K = map(int,input().split()) A = list(map(int,input().split())) city = [-1 for i in range(0,N,1)]#0~N-1 count = 0 nex_city = 0 city[0]=0 while True: city[nex_city] = count nex_city = A[nex_city]-1 count+=1 if city[nex_city] >= 0: break X = nex_city Y = count - city[nex_city] nex_city = 0 if...
N,K = map(int,input().split()) A = list(map(int,input().split())) city = [-1 for i in range(0,N,1)]#0~N-1 count = 0 nex_city = 0 city[0]=0 while True: city[nex_city] = count nex_city = A[nex_city]-1 count+=1 if city[nex_city] >= 0: break X = city[nex_city] Y = count - city[nex_city] nex_city ...
[]
415,431
415,432
u364862909
python
p02684
N,K = map(int,input().split()) A = list(map(int,input().split())) city = [-1 for i in range(0,N,1)]#0~N-1 count = 0 nex_city = 0 city[0]=0 while True: city[nex_city] = count nex_city = A[nex_city]-1 count+=1 if city[nex_city] >= 0: break X = nex_city Y = count - city[nex_city] nex_city = 0 if...
N,K = map(int,input().split()) A = list(map(int,input().split())) city = [-1 for i in range(0,N,1)]#0~N-1 count = 0 nex_city = 0 city[0]=0 while True: city[nex_city] = count nex_city = A[nex_city]-1 count+=1 if city[nex_city] >= 0: break X = city[nex_city] Y = count - city[nex_city] nex_city ...
[]
415,433
415,432
u364862909
python
p02684
n,k=map(int,input().split()) p=list(map(int,input().split())) a=[0]+p flag=0 bef=1 town=[1] town_set=set(town) cnt=0 while flag==0 and cnt<k: if not a[bef] in town_set: town.append(a[bef]) town_set.add(a[bef]) bef=a[bef] else: flag=1 memo=a[bef] cnt+=1 if cnt==k: ...
n,k=map(int,input().split()) p=list(map(int,input().split())) a=[0]+p flag=0 bef=1 town=[1] town_set=set(town) cnt=0 while flag==0 and cnt<k: if not a[bef] in town_set: town.append(a[bef]) town_set.add(a[bef]) bef=a[bef] else: flag=1 memo=a[bef] break cnt+=1 i...
[ "control_flow.break.add" ]
415,434
415,435
u518064858
python
p02684
n,k=map(int,input().split()) p=list(map(int,input().split())) a=[0]+p flag=0 bef=1 town=[1] town_set=set(town) cnt=0 while flag==0 and cnt<k: if not a[bef] in town_set: town.append(a[bef]) town_set.add(a[bef]) bef=a[bef] else: flag=1 memo=a[bef] cnt+=1 if cnt==k: ...
n,k=map(int,input().split()) p=list(map(int,input().split())) a=[0]+p flag=0 bef=1 town=[1] town_set=set(town) cnt=0 while flag==0 and cnt<k: if not a[bef] in town_set: town.append(a[bef]) town_set.add(a[bef]) bef=a[bef] else: flag=1 memo=a[bef] break cnt+=1 i...
[ "control_flow.break.add" ]
415,436
415,435
u518064858
python
p02684
inpl = lambda: list(map(int,input().split())) N, K = inpl() A = inpl() for i in range(N): A[i] -= 1 P = dict() k = 0 former = True i = 0 while i < K: if k in P.keys() and former: loop = i - P[k] K = i + (K-i) % loop former = False else: P[k] = i k = A[k] i += 1 el...
inpl = lambda: list(map(int,input().split())) N, K = inpl() A = inpl() for i in range(N): A[i] -= 1 P = dict() k = 0 former = True i = 1 while i <= K: if k in P.keys() and former: loop = i - P[k] K = i + (K-i) % loop former = False else: P[k] = i k = A[k] i += 1 else:...
[ "literal.number.integer.change", "assignment.value.change", "expression.operator.compare.change", "control_flow.loop.condition.change" ]
415,439
415,440
u894258749
python
p02684
inpl = lambda: list(map(int,input().split())) N, K = inpl() A = inpl() for i in range(N): A[i] -= 1 P = dict() k = 0 former = True while i < K: if k in P.keys() and former: loop = i - P[k] K = i + (K-i) % loop former = False else: P[k] = i k = A[k] i += 1 else: ...
inpl = lambda: list(map(int,input().split())) N, K = inpl() A = inpl() for i in range(N): A[i] -= 1 P = dict() k = 0 former = True i = 1 while i <= K: if k in P.keys() and former: loop = i - P[k] K = i + (K-i) % loop former = False else: P[k] = i k = A[k] i += 1 else:...
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
415,441
415,440
u894258749
python
p02684
N, K = map(int, input().split()) A = tuple(map(int, input().split())) if K <= 200000: i = 1 for _ in range(K): i = A[i-1] print(i) exit() visited = {1} order = [] i = 1 for count in range(1, 200001): i = A[i-1] if i in visited: break else: visited.add(i) order.append(i) idx = order.index...
N, K = map(int, input().split()) A = tuple(map(int, input().split())) if K <= 200000: i = 1 for _ in range(K): i = A[i-1] print(i) exit() visited = {1} order = [1] i = 1 for count in range(1, 200001): i = A[i-1] if i in visited: break else: visited.add(i) order.append(i) idx = order.inde...
[ "assignment.change" ]
415,446
415,447
u483331319
python
p02684
n,k = map(int,input().split()) l1 = list(map(int,input().split())) l = list(i-1 for i in l1) bit = list(0 for i in range(n)) bit[0] =1 mi = [0] m = l[0] er = 0 while er ==0: if bit[m]==1: a = mi.index(m) r = mi[a:] er =1 else: bit[m] = 1 mi.append(m) m = l[m] # print(bit) be = mi[:a]+r pri...
n,k = map(int,input().split()) l1 = list(map(int,input().split())) l = list(i-1 for i in l1) bit = list(0 for i in range(n)) bit[0] =1 mi = [0] m = l[0] er = 0 while er ==0: if bit[m]==1: a = mi.index(m) r = mi[a:] er =1 else: bit[m] = 1 mi.append(m) m = l[m] # print(bit) be = mi[:a]+r #pr...
[ "call.remove" ]
415,448
415,449
u288430479
python
p02684
n,k = map(int,input().split()) l1 = list(map(int,input().split())) l = list(i-1 for i in l1) bit = list(0 for i in range(n)) bit[0] =1 mi = [0] m = l[0] er = 0 while er ==0: if bit[m]==1: a = mi.index(m) r = mi[a:] er =1 else: bit[m] = 1 mi.append(m) m = l[m] # print(bit) be = mi[:a]+r #pr...
n,k = map(int,input().split()) l1 = list(map(int,input().split())) l = list(i-1 for i in l1) bit = list(0 for i in range(n)) bit[0] =1 mi = [0] m = l[0] er = 0 while er ==0: if bit[m]==1: a = mi.index(m) r = mi[a:] er =1 else: bit[m] = 1 mi.append(m) m = l[m] # print(bit) be = mi[:a]+r #pr...
[ "expression.operation.binary.add" ]
415,450
415,449
u288430479
python
p02684
from collections import deque N, K = map(int, input().split()) A = list(map(int, input().split())) stack = deque([]) passed = set() town = 0 while town not in passed: passed.add(town) stack.append(town) town = A[town] - 1 if len(stack) > K: print(stack[K]) import sys sys.exit() tail = 0 while...
from collections import deque N, K = map(int, input().split()) A = list(map(int, input().split())) stack = deque([]) passed = set() town = 0 while town not in passed: passed.add(town) stack.append(town) town = A[town] - 1 if len(stack) > K: print(stack[K] + 1) import sys sys.exit() tail = 0 w...
[ "expression.operation.binary.add" ]
415,454
415,455
u534296203
python
p02684
N,K=map(int,input().split()) A=list(map(int,input().split())) visited=[0]*N#訪問フラグ ima_pos=0#現在地 mirai_pos=0#移動先 count_first=0#一巡目のループ first_DP=[] while(visited[ima_pos]==0): visited[ima_pos]=1#訪れたら更新 mirai_pos=A[ima_pos]-1 ima_pos=mirai_pos first_DP.append(ima_pos)#何番目のインデックスに移動するか count_first+=1#何回移動したか s...
N,K=map(int,input().split()) A=list(map(int,input().split())) visited=[0]*N#訪問フラグ ima_pos=0#現在地 mirai_pos=0#移動先 count_first=0#一巡目のループ first_DP=[] while(visited[ima_pos]==0): visited[ima_pos]=1#訪れたら更新 mirai_pos=A[ima_pos]-1 ima_pos=mirai_pos first_DP.append(ima_pos)#何番目のインデックスに移動するか count_first+=1#何回移動したか s...
[ "expression.operation.binary.add" ]
415,460
415,461
u753386263
python
p02684
import sys a,b=map(int,input().split()) b=b+1 l=[0]*(a) List=list(map(int,input().split())) i=0 j=1 while l[i]==0 and j<b: l[i]+=j j+=1 i=List[i]-1 if j==b: print(List[i]) sys.exit() roop=j-l[i] c=(b-j)%roop for y in range(len(l)): if l[y] ==c+l[i]: print(y+1) sys.exit()
import sys a,b=map(int,input().split()) b=b+1 l=[0]*(a) List=list(map(int,input().split())) i=0 j=1 while l[i]==0 and j<b: l[i]+=j j+=1 i=List[i]-1 if j==b: print(i+1) sys.exit() roop=j-l[i] c=(b-j)%roop for y in range(len(l)): if l[y]==c+l[i]: print(y+1) sys.exit()
[ "call.arguments.change", "io.output.change" ]
415,462
415,463
u453815934
python
p02684
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline def main(): N, K = map(int, readline().split()) A = list(map(int, readline().split())) lenA = len(A) tmp = [] path = [] setpath = set([]) cnt = 0 i = 1 for _ in range(1, N+10): setpath.add(i) pat...
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline def main(): N, K = map(int, readline().split()) A = list(map(int, readline().split())) lenA = len(A) tmp = [] path = [] setpath = set([]) cnt = 0 i = 1 for _ in range(1, N+10): setpath.add(i) pat...
[ "expression.operation.binary.remove" ]
415,505
415,506
u125545880
python
p02684
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline def main(): N, K = map(int, readline().split()) A = list(map(int, readline().split())) lenA = len(A) tmp = [] path = [] setpath = set([]) cnt = 0 i = 1 for _ in range(1, lenA + 1): setpath.add(i) ...
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline def main(): N, K = map(int, readline().split()) A = list(map(int, readline().split())) lenA = len(A) tmp = [] path = [] setpath = set([]) cnt = 0 i = 1 for _ in range(1, N+10): setpath.add(i) pat...
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change", "literal.number.integer.change", "expression.operation.binary.remove" ]
415,507
415,506
u125545880
python
p02684
import sys import itertools import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = map(int, readline().split()) A = list(map(lambda x: x - 1, map(int, readline().split()))) visited = [False for i in range(N)] cur = 0 cycle = [] start = 0 wh...
import sys import itertools import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = map(int, readline().split()) A = list(map(lambda x: x - 1, map(int, readline().split()))) visited = [False for i in range(N)] cur = 0 cycle = [] start = 0 wh...
[ "call.remove" ]
415,516
415,517
u036104576
python
p02684
import sys import itertools import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = map(int, readline().split()) A = list(map(lambda x: x - 1, map(int, readline().split()))) visited = [False for i in range(N)] cur = 0 cycle = [] start = 0 wh...
import sys import itertools import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = map(int, readline().split()) A = list(map(lambda x: x - 1, map(int, readline().split()))) visited = [False for i in range(N)] cur = 0 cycle = [] start = 0 wh...
[ "identifier.change", "variable_access.subscript.index.change", "call.arguments.change", "io.output.change" ]
415,518
415,517
u036104576
python
p02684
import sys import itertools import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = map(int, readline().split()) A = list(map(lambda x: x - 1, map(int, readline().split()))) visited = [False for i in range(N)] cur = 0 cycle = [] start = 0 wh...
import sys import itertools import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = map(int, readline().split()) A = list(map(lambda x: x - 1, map(int, readline().split()))) visited = [False for i in range(N)] cur = 0 cycle = [] start = 0 wh...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "identifier.change", "variable_access.subscript.index.change", "call.arguments.change", "io.output.change" ]
415,519
415,517
u036104576
python
p02684
from collections import deque n, k = list(map(int, input().split())) a = [0, ] + list(map(int, input().split())) stack = deque([1, ]) visited = [0] * (n + 1) hist = [] open = [] loop = [] while stack: now = stack.popleft() if visited[now] == 1: b = hist.index(now) open = hist[:b] loop = ...
from collections import deque n, k = list(map(int, input().split())) a = [0, ] + list(map(int, input().split())) stack = deque([1, ]) visited = [0] * (n + 1) hist = [] open = [] loop = [] while stack: now = stack.popleft() if visited[now] == 1: b = hist.index(now) open = hist[:b] loop = ...
[ "call.remove" ]
415,522
415,523
u941047297
python
p02684
from collections import defaultdict def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) town = defaultdict(int) cn = defaultdict(int) visited = set() visited.add(0) cnt = 0 tmp = A[0]-1 town[cnt] = 0 ii = 0 while True: if(tmp n...
from collections import defaultdict def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) town = defaultdict(int) cn = defaultdict(int) visited = set() visited.add(0) cnt = 0 tmp = A[0]-1 town[cnt] = 0 ii = 0 while True: if(tmp n...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
415,524
415,525
u995062424
python
p02684
n, k = map(int, input().split()) a = list(map(int, input().split())) a = [i - 1 for i in a] g = [-1] * n i = 0 j = 0 while g[j] == -1: if i == k: print(a[j]) exit() g[j] = i i += 1 j = a[j] for i in range((k - g[j]) % (i - g[j])): j = a[j] print(j + 1)
n, k = map(int, input().split()) a = list(map(int, input().split())) a = [i - 1 for i in a] g = [-1] * n i = 0 j = 0 while g[j] == -1: if i == k: print(j + 1) exit() g[j] = i i += 1 j = a[j] for i in range((k - g[j]) % (i - g[j])): j = a[j] print(j + 1)
[ "call.arguments.change", "io.output.change" ]
415,526
415,527
u377989038
python
p02684
N , K = map(int,input().split()) B = {} C = {} D = {0} A = list(map(int,input().split())) place = 0 num = 0 C[0] = 0 while True: place = int(A[place]) - 1 num += 1 if place in D: Y = int(num) - int(C[place]) break elif num == K: break else: B[num] = place C...
N , K = map(int,input().split()) B = {} C = {} D = {0} A = list(map(int,input().split())) place = 0 num = 0 C[0] = 0 while True: place = int(A[place]) - 1 num += 1 if place in D: Y = int(num) - int(C[place]) break elif num == K: break else: B[num] = place C...
[ "call.arguments.change" ]
415,542
415,543
u648192617
python
p02684
N , K = map(int,input().split()) B = {} C = {} D = {0} A = list(map(int,input().split())) place = 0 num = 0 C[0] = 0 while True: place = int(A[place]) - 1 num += 1 if place in D: Y = int(num) - int(C[place]) break elif num == K: break else: B[num] = place C...
N , K = map(int,input().split()) B = {} C = {} D = {0} A = list(map(int,input().split())) place = 0 num = 0 C[0] = 0 while True: place = int(A[place]) - 1 num += 1 if place in D: Y = int(num) - int(C[place]) break elif num == K: break else: B[num] = place C...
[ "call.arguments.change", "io.output.change" ]
415,544
415,543
u648192617
python
p02684
n , k = map(int,input().split()) S = list(map(int,input().split())) l = [1] for i in range(2*n): l.append(S[l[i]-1]) L = len(l) def f(s, e): a = s b = s while True: a += 2 b += 1 if a >= e: return None if l[a] == l[b]: break a = 0 while ...
n , k = map(int,input().split()) S = list(map(int,input().split())) l = [1] for i in range(2*n): l.append(S[l[i]-1]) L = len(l) def f(s, e): a = s b = s while True: a += 2 b += 1 if a >= e: return None if l[a] == l[b]: break a = 0 while ...
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
415,551
415,552
u007263493
python
p02684
N, K = map(int, input().split()) A = list(map(int, input().split())) visited = [0] * N order = [] cur = 1 cnt = 0 while True: if visited[cur-1] == 0: visited[cur-1] += 1 if cnt == K: print(cur) elif visited[cur-1] == 1: # cur == 2 order_from_cur = order[order.i...
N, K = map(int, input().split()) A = list(map(int, input().split())) visited = [0] * N order = [] cur = 1 cnt = 0 while True: if visited[cur-1] == 0: visited[cur-1] += 1 if cnt == K: print(cur) break elif visited[cur-1] == 1: # cur == 2 order_from_c...
[ "control_flow.break.add" ]
415,555
415,556
u548545174
python
p02684
from copy import copy, deepcopy from collections import Counter from math import sqrt, floor, factorial from itertools import permutations, combinations, combinations_with_replacement from operator import mul from functools import reduce import bisect MOD = 10**9 + 7 INF = float('inf') N, K = list(map(int, input().sp...
from copy import copy, deepcopy from collections import Counter from math import sqrt, floor, factorial from itertools import permutations, combinations, combinations_with_replacement from operator import mul from functools import reduce import bisect MOD = 10**9 + 7 INF = float('inf') N, K = list(map(int, input().sp...
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "variable_access.subscript.index.change" ]
415,562
415,563
u935016954
python
p02684
# coding:utf-8 import sys import math import time #import numpy as np import collections from collections import deque from collections import Counter import queue import copy import bisect import heapq import itertools sys.setrecursionlimit(10**7) #N, Q = map(int, input().split()) #G = [list(input()) for i in rang...
# coding:utf-8 import sys import math import time #import numpy as np import collections from collections import deque from collections import Counter import queue import copy import bisect import heapq import itertools sys.setrecursionlimit(10**7) #N, Q = map(int, input().split()) #G = [list(input()) for i in rang...
[ "identifier.change", "call.arguments.change" ]
415,569
415,570
u395117343
python
p02684
N,K = map(int,input().split()) A = list(map(int,input().split())) towns = [0] * N town = 1 i = 0 while True: if towns[town-1] < 2: if towns[town-1] == 0: i += 1 towns[town-1] += 1 town = A[town-1] else: s = town break loop = towns....
N,K = map(int,input().split()) A = list(map(int,input().split())) towns = [0] * N town = 1 i = 0 while True: if towns[town-1] < 2: if towns[town-1] == 0: i += 1 towns[town-1] += 1 town = A[town-1] else: s = town break loop = towns....
[ "identifier.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change", "call.add" ]
415,615
415,616
u273496671
python
p02684
n, k = map(int, input().split()) list_A = list(map(int, input().split())) list_MAP = [] set_MAP = set() x = 1 while True: list_MAP.append(x) set_MAP.add(x) x = list_A[x-1] if x in set_MAP: break q = len(list_MAP) - list_MAP.index(x) p = k - list_MAP.index(x) if p < 0: print(list_MAP[k-1])...
n, k = map(int, input().split()) list_A = list(map(int, input().split())) list_MAP = [] set_MAP = set() x = 1 while True: list_MAP.append(x) set_MAP.add(x) x = list_A[x-1] if x in set_MAP: break q = len(list_MAP) - list_MAP.index(x) p = k - list_MAP.index(x) if p < 0: print(list_MAP[k]) e...
[ "expression.operation.binary.remove" ]
415,625
415,626
u011062360
python
p02684
n, k = map(int, input().split()) list_A = list(map(int, input().split())) list_MAP = [] set_MAP = set() x = 1 while True: list_MAP.append(x) set_MAP.add(x) x = list_A[x-1] if x in list_MAP: break q = len(list_MAP) - list_MAP.index(x) p = k - list_MAP.index(x) if p < 0: print(list_MAP[k-1]...
n, k = map(int, input().split()) list_A = list(map(int, input().split())) list_MAP = [] set_MAP = set() x = 1 while True: list_MAP.append(x) set_MAP.add(x) x = list_A[x-1] if x in set_MAP: break q = len(list_MAP) - list_MAP.index(x) p = k - list_MAP.index(x) if p < 0: print(list_MAP[k]) e...
[ "identifier.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
415,627
415,626
u011062360
python
p02684
import sys n,k=map(int,input().split()) a=list(map(int,input().split())) visited=[0]*n town=0 Town=0 visited[0]=0 lst=[] if a[0]==1: print(1) sys.exit() for i in range(n): town=a[town]-1 if visited[town]!=0 or town==0: lst.append([town,visited[town],i+1]) break else: visited[town]=i+1 Lst=[] print...
import sys n,k=map(int,input().split()) a=list(map(int,input().split())) visited=[0]*n town=0 Town=0 visited[0]=0 lst=[] if a[0]==1: print(1) sys.exit() for i in range(n): town=a[town]-1 if visited[town]!=0 or town==0: lst.append([town,visited[town],i+1]) break else: visited[town]=i+1 Lst=[] town=...
[ "call.remove" ]
415,628
415,629
u527261492
python
p02684
import sys n,k=map(int,input().split()) a=list(map(int,input().split())) visited=[0]*n town=0 Town=0 visited[0]=0 lst=[] if a[0]==1: print(1) sys.exit() for i in range(n): town=a[town]-1 if visited[town]!=0 or town==0: lst.append([town,visited[town],i+1]) break else: visited[town]=i+1 Lst=[] town=...
import sys n,k=map(int,input().split()) a=list(map(int,input().split())) visited=[0]*n town=0 Town=0 visited[0]=0 lst=[] if a[0]==1: print(1) sys.exit() for i in range(n): town=a[town]-1 if visited[town]!=0 or town==0: lst.append([town,visited[town],i+1]) break else: visited[town]=i+1 Lst=[] town=...
[ "expression.operation.binary.add" ]
415,630
415,629
u527261492
python
p02684
n,k = list(map(int, input().split())) a = list(map(int, input().split())) a.insert(0,0) start = 1 now = start c = 0 flag = [-1]*(n+1) while c <= k and flag[now] == -1: #print(now) flag[now] = c c+= 1 now = a[now] #print(c, now) if c == k: print(now) else: k-=c cc = c-flag[now] nokori = k...
n,k = list(map(int, input().split())) a = list(map(int, input().split())) a.insert(0,0) start = 1 now = start c = 0 flag = [-1]*(n+1) while c < k and flag[now] == -1: #print(now) flag[now] = c c+= 1 now = a[now] #print(c, now) if c == k: print(now) else: k-=c cc = c-flag[now] nokori = k ...
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
415,640
415,641
u813450934
python
p02684
n, k = [int(i) for i in input().split()] a = [int(i) for i in input().split()] def find_min_cycle(a): memo = {1: 0} idx = 0 cnt = 1 while a[idx] not in memo: memo[a[idx]] = cnt cnt += 1 idx = a[idx]-1 return memo[a[idx]], cnt-memo[a[idx]], memo offset, cycle_len, memo = f...
n, k = [int(i) for i in input().split()] a = [int(i) for i in input().split()] def find_min_cycle(a): memo = {1: 0} idx = 0 cnt = 1 while a[idx] not in memo: memo[a[idx]] = cnt cnt += 1 idx = a[idx]-1 return memo[a[idx]], cnt-memo[a[idx]], memo offset, cycle_len, memo = f...
[ "identifier.change", "call.arguments.change", "io.output.change" ]
415,647
415,648
u229848759
python
p02684
n,k= map(int,input().split()) A = [0] A += list(map(int,input().split())) B = [-1 for _ in range(n+1)] B[1] = 0 now =1 cnt = 0 cic = 0 for i in range(1,n+1): now = A[now] cnt +=1 if B[now] ==-1: B[now] = cnt else: cic = cnt - B[now] road = B[now] break if k <= road: ...
n,k= map(int,input().split()) A = [0] A += list(map(int,input().split())) B = [-1 for _ in range(n+1)] B[1] = 0 now =1 cnt = 0 cic = 0 for i in range(1,n+1): now = A[now] cnt +=1 if B[now] ==-1: B[now] = cnt else: cic = cnt - B[now] road = B[now] break if k <= road: ...
[ "expression.operation.binary.remove" ]
415,649
415,650
u487594898
python
p02684
n,k= map(int,input().split()) A = [0] A += list(map(int,input().split())) B = [-1 for _ in range(n+1)] B[1] = 0 now =1 cnt = 0 cic = 0 for i in range(1,n+1): now = A[now] cnt +=1 if B[now] ==-1: B[now] = cnt else: cic = cnt - B[now] road = B[now] break if k < road: ...
n,k= map(int,input().split()) A = [0] A += list(map(int,input().split())) B = [-1 for _ in range(n+1)] B[1] = 0 now =1 cnt = 0 cic = 0 for i in range(1,n+1): now = A[now] cnt +=1 if B[now] ==-1: B[now] = cnt else: cic = cnt - B[now] road = B[now] break if k <= road: ...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
415,651
415,650
u487594898
python