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
p02683
import itertools as t n,m,z=map(int,input().split()) l=[] answer=set([]) for i in range(n): l.append(list(map(int, input().split()))) for k in range(n): a=list(t.combinations(range(n),k)) for x in a: w=0 A=[0 for _ in range(m)] s=0 for y in x: w+=l[y][0] ...
import itertools as t n,m,z=map(int,input().split()) l=[] answer=set([]) for i in range(n): l.append(list(map(int, input().split()))) for k in range(n+1): a=list(t.combinations(range(n),k)) for x in a: w=0 A=[0 for _ in range(m)] s=0 for y in x: w+=l[y][0] ...
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
412,509
412,508
u562662744
python
p02683
import sys N,M,X=map(int,input().split()) L=[list(map(int,input().split())) for i in range(N)] #print(L) price=[] list_X=[X for i in range(M)] print(list_X) for i in range(2**N): A=[0 for i in range(M+1)] for j in range(N): if (i>>j) & 1: A = [x+y for (x,y) in zip(A,L[j])] #print(A) large = 0 for i...
import sys N,M,X=map(int,input().split()) L=[list(map(int,input().split())) for i in range(N)] #print(L) price=[] list_X=[X for i in range(M)] #print(list_X) for i in range(2**N): A=[0 for i in range(M+1)] for j in range(N): if (i>>j) & 1: A = [x+y for (x,y) in zip(A,L[j])] #print(A) large = 0 for ...
[ "call.remove" ]
412,527
412,528
u311113280
python
p02683
import itertools N,M,X=map(int, input().split()) data=[] ans=999999999 b=[] b_pairs=[] for i in range(N): b.append(i) for i in range(N): data.append(list(map(int, input().split()))) for i in range(2,N+1): b_pairs+=itertools.combinations(b,i) for i in range(N): flag=1 skill=[0]*M for j in rang...
import itertools N,M,X=map(int, input().split()) data=[] ans=999999999 b=[] b_pairs=[] for i in range(N): b.append(i) for i in range(N): data.append(list(map(int, input().split()))) for i in range(2,N+1): b_pairs+=itertools.combinations(b,i) for i in range(N): flag=1 skill=[0]*M for j in rang...
[ "call.remove" ]
412,531
412,532
u636665812
python
p02683
import itertools n, m, x = map(int, input().split()) caaa = [list(map(int, input().split())) for _ in range(n)] ans = 10 ** 7 for i in range(1, n + 1): for caa in list(itertools.combinations(caaa, i)): c = 0 aa = [0] * m for j in range(0, i): c += caa[j][0] for k in r...
import itertools n, m, x = map(int, input().split()) caaa = [list(map(int, input().split())) for _ in range(n)] ans = 10 ** 7 for i in range(1, n + 1): for caa in list(itertools.combinations(caaa, i)): c = 0 aa = [0] * m for j in range(i): c += caa[j][0] for k in rang...
[ "call.arguments.change" ]
412,535
412,536
u131264627
python
p02683
n,m,x=map(int,input().split()) a=[] for i in range(0,n): aa=input().split() for j in range(0,m+1): aa[j]=int(aa[j]) a.append(aa) smin=1000000*n d=1000000*n for i in range(0,2**n): mo=0 x2=[1 for i2 in range(0,m)] for j in range(0,n): if ((i>>j)&1)==1: mo+=a[...
n,m,x=map(int,input().split()) a=[] for i in range(0,n): aa=input().split() for j in range(0,m+1): aa[j]=int(aa[j]) a.append(aa) smin=1000000*n d=1000000*n for i in range(0,2**n): mo=0 x2=[0 for i2 in range(0,m)] for j in range(0,n): if ((i>>j)&1)==1: mo+=a[...
[ "literal.number.integer.change", "assignment.value.change" ]
412,553
412,554
u992471673
python
p02683
n,m,x=map(int,input().split()) a=[] for i in range(0,n): aa=input().split() for j in range(0,m+1): aa[j]=int(aa[j]) a.append(aa) smin=100000*n d=100000*n for i in range(0,2**n): mo=0 x2=[1 for i2 in range(0,m)] for j in range(0,n): if ((i>>j)&1)==1: mo+=a[j]...
n,m,x=map(int,input().split()) a=[] for i in range(0,n): aa=input().split() for j in range(0,m+1): aa[j]=int(aa[j]) a.append(aa) smin=1000000*n d=1000000*n for i in range(0,2**n): mo=0 x2=[0 for i2 in range(0,m)] for j in range(0,n): if ((i>>j)&1)==1: mo+=a[...
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
412,555
412,554
u992471673
python
p02683
from sys import stdin from itertools import combinations N,M,X = [int(x) for x in stdin.readline().rstrip().split()] data = [] for i in range(N): tmp = [int(x) for x in stdin.readline().rstrip().split()] data.append(tmp) ans = 10**18 for i in range(1,N): for j in combinations(data,i): C = 0 ...
from sys import stdin from itertools import combinations N, M, X = [int(x) for x in stdin.readline().rstrip().split()] data = [] for i in range(N): tmp = [int(x) for x in stdin.readline().rstrip().split()] data.append(tmp) ans = 10**18 for i in range(1, N+1): for j in combinations(data, i): C = 0 ...
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
412,594
412,595
u405256066
python
p02683
import sys from math import sqrt from collections import Counter, defaultdict, deque input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(MI()) def LIN(n: int): return [I() for _ in range(n)] in...
import sys from math import sqrt from collections import Counter, defaultdict, deque input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(MI()) def LIN(n: int): return [I() for _ in range(n)] in...
[ "call.remove" ]
412,602
412,603
u876438858
python
p02683
import sys from math import sqrt from collections import Counter, defaultdict, deque input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(MI()) def LIN(n: int): return [I() for _ in range(n)] in...
import sys from math import sqrt from collections import Counter, defaultdict, deque input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(MI()) def LIN(n: int): return [I() for _ in range(n)] in...
[ "assignment.value.change", "expression.operation.binary.change" ]
412,604
412,603
u876438858
python
p02683
def resolve(): N, M, X = map(int, input().split()) L = []*M ans = 10000000000 for i in range(N): L.append(tuple(map(int, input().split()))) for i in range(2 ** N): s = 0 C = [0]*M for j in range(N): if (i >> j) & 1: C = [a+b for (a, b) in ...
def resolve(): N, M, X = map(int, input().split()) L = []*M ans = 10000000000 for i in range(N): L.append(tuple(map(int, input().split()))) for i in range(2 ** N): s = 0 C = [0]*M for j in range(N): if (i >> j) & 1: C = [a+b for (a, b) in ...
[]
412,605
412,606
u822961851
python
p02683
import copy N, M, X = map(int, input().split()) C =[] A = {} for i in range(N): ipt = list(map(int, input().split())) C.append(ipt[0]) A[i] = ipt[1:] bestscore = 99999999999 def rec(n, score, money): global bestscore if n==N: return s = copy.deepcopy(score) rec(n+1, s, money) money ...
import copy N, M, X = map(int, input().split()) C =[] A = {} for i in range(N): ipt = list(map(int, input().split())) C.append(ipt[0]) A[i] = ipt[1:] bestscore = 99999999999 def rec(n, score, money): global bestscore if n==N: return s = copy.deepcopy(score) rec(n+1, s, money) money ...
[ "assignment.value.change", "identifier.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
412,607
412,608
u235783479
python
p02683
n,m,x=list(map(int, input().split())) ca=[] for i in range (n): ca.append(list(map(int, input().split()))) u=[0]*m for j in range (m): for i in range (n): u[j]+=ca[i][j+1] det=1 for y in range (m): if u[y]<x: det=0 if det==0: print(-1) else: cost=1300000 for z in range(2**n-1): ...
n,m,x=list(map(int, input().split())) ca=[] for i in range (n): ca.append(list(map(int, input().split()))) u=[0]*m for j in range (m): for i in range (n): u[j]+=ca[i][j+1] det=1 for y in range (m): if u[y]<x: det=0 if det==0: print(-1) else: cost=1300000 for z in range(2**n): ...
[ "expression.operation.binary.remove" ]
412,611
412,612
u190735555
python
p02683
n , m , x = map(int,input().split()) c = [] a = [] for i in range(n): l = list(map(int,input().split())) c. append(l[0]) a.append(l[1:m+1]) S = sum(c) ans = S +1 for i in range(2**n): cost = 0 sum = [0,0,0] for j in range(n): if ((i>>j)&1): cost += c[j] sum = [x +...
n , m , x = map(int,input().split()) c = [] a = [] for i in range(n): l = list(map(int,input().split())) c. append(l[0]) a.append(l[1:m+1]) S = sum(c) ans = S +1 for i in range(2**n): cost = 0 sum = [0]*m for j in range(n): if ((i>>j)&1): cost += c[j] sum = [x + y...
[ "assignment.change" ]
412,626
412,627
u007263493
python
p02683
import itertools N, M, X = map(int, input().split()) ca = [] for _ in range(N): ca.append(list(map(int, input().split()))) ns = [i for i in range(N)] price = 1000000000000 for r in range(1,N+1): for v in itertools.combinations(ns, r): flag = True for j in range(M): s = sum([ca[i][j+1] for i in v])...
import itertools N, M, X = map(int, input().split()) ca = [] for _ in range(N): ca.append(list(map(int, input().split()))) ns = [i for i in range(N)] price = 1000000000000 for r in range(1,N+1): for v in itertools.combinations(ns, r): flag = True for j in range(M): s = sum([ca[i][j+1] for i in v])...
[ "call.remove" ]
412,630
412,631
u379716238
python
p02683
import itertools N, M, X = map(int, input().split()) ca = [] for _ in range(N): ca.append(list(map(int, input().split()))) ns = [i for i in range(N)] price = 1000000000000 for r in range(1,N+1): for v in itertools.combinations(ns, r): aa = [] flag = True for j in range(M): s = sum([ca[i][j] fo...
import itertools N, M, X = map(int, input().split()) ca = [] for _ in range(N): ca.append(list(map(int, input().split()))) ns = [i for i in range(N)] price = 1000000000000 for r in range(1,N+1): for v in itertools.combinations(ns, r): flag = True for j in range(M): s = sum([ca[i][j+1] for i in v])...
[ "assignment.remove", "assignment.change" ]
412,632
412,631
u379716238
python
p02683
n, m, x = [int(i) for i in input().split()] arr = [] for _ in range(n): arr.append([int(i) for i in input().split()]) min_amount = float('+inf') has_sol = False def dfs(idx, amt, skills): global arr global min_amount global x global has_sol if idx == len(arr): ok = all(j >= x for j i...
n, m, x = [int(i) for i in input().split()] arr = [] for _ in range(n): arr.append([int(i) for i in input().split()]) min_amount = float('+inf') has_sol = False def dfs(idx, amt, skills): global arr global min_amount global x global has_sol if idx == len(arr): ok = all(j >= x for j i...
[ "expression.operation.binary.add" ]
412,636
412,637
u229848759
python
p02683
n, m, x = map(int, input().split()) sL = [0]*m bL = [] for i in range(n): book = list(map(int, input().split())) bL.append(book) def fullS(currentL, index, allP): if index > len(currentL): if min(currentL) >= x: return allP else: return -1 else: if min(c...
n, m, x = map(int, input().split()) sL = [0]*m bL = [] for i in range(n): book = list(map(int, input().split())) bL.append(book) def fullS(currentL, index, allP): if index >= len(bL): if min(currentL) >= x: return allP else: return -1 else: if min(curren...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "identifier.change" ]
412,638
412,639
u711295009
python
p02683
import itertools N, M, X = map(int, input().split()) C = [] A = [] for i in range(N): tmp = list(map(int, input().split())) C.append(tmp[0]) A.append(tmp[1:]) C_total_min = -1 for ci in range(N): # 組み合わせの数 for seq in itertools.combinations(range(N), ci): # 組み合わせのリスト C_total = 0 A_tot...
import itertools N, M, X = map(int, input().split()) C = [] A = [] for i in range(N): tmp = list(map(int, input().split())) C.append(tmp[0]) A.append(tmp[1:]) C_total_min = -1 for ci in range(1, N+1): # 組み合わせの数 for seq in itertools.combinations(range(N), ci): # 組み合わせのリスト C_total = 0 ...
[ "call.arguments.add" ]
412,642
412,643
u461592867
python
p02683
def sumList(index,array): if index ==n: sumArray.append(array) else: sumList(index+1,array) nextArray =[0]*(m+1) for i in range(m+1): nextArray[i] +=array[i]+ list[index][i] sumList(index+1,nextArray) if __name__ == '__main__': n,m,x = map(int, input()...
def sumList(index,array): if index ==n: sumArray.append(array) else: sumList(index+1,array) nextArray =[0]*(m+1) for i in range(m+1): nextArray[i] +=array[i]+ list[index][i] sumList(index+1,nextArray) if __name__ == '__main__': n,m,x = map(int, input()....
[ "call.remove" ]
412,644
412,645
u290187182
python
p02683
N,M,X = map(int,input().split()) books = [] for _ in range(N): line = list(map(int,input().split())) books.append(line) values = [] for i in range(2**N): bags = [] for j in range(N): if ((i >> j) & 1): bags.append(j) value = 0 algs = [0] * M for k in bags: v...
N,M,X = map(int,input().split()) books = [] for _ in range(N): line = list(map(int,input().split())) books.append(line) values = [] for i in range(2**N): bags = [] for j in range(N): if ((i >> j) & 1): bags.append(j) value = 0 algs = [0] * M for k in bags: v...
[ "expression.operation.binary.add" ]
412,655
412,656
u273496671
python
p02683
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**9) # 1 ✕ N N, M, X = list(map(int, input().rstrip().split())) # # N ✕ M (2D array) A = list(input().rstrip().split() for _ in range(N)) ans = 1e9 for bit in range(2 ** N): total = 0 array = [0 for _ in range(0, M)] for i in range(N): if...
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**9) # 1 ✕ N N, M, X = list(map(int, input().rstrip().split())) # N ✕ M (2D array) A = list(input().rstrip().split() for _ in range(N)) ans = 1e9 for bit in range(2 ** N): total = 0 array = [0 for _ in range(M)] for i in range(N): if bit ...
[ "call.arguments.change" ]
412,667
412,668
u017723605
python
p02683
import itertools def main(): N,M,X = list(map(int, input().split(' '))) inputs = [] for _ in range(N): inputs.append(list(map(int, input().split(' ')))) Ci = [s[0] for s in inputs] Aij = [s[1:] for s in inputs] # print(Ci, Aij) indexs = [i for i in range(N)] ...
import itertools def main(): N,M,X = list(map(int, input().split(' '))) inputs = [] for _ in range(N): inputs.append(list(map(int, input().split(' ')))) Ci = [s[0] for s in inputs] Aij = [s[1:] for s in inputs] # print(Ci, Aij) indexs = [i for i in range(N)] ...
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add" ]
412,677
412,678
u485716382
python
p02683
import itertools N,M,X = map(int, input().split()) C = [] for c in range(N): C.append(list(map(int, input().split()))) ans = float('inf') L = list(range(N)) for i in range(1, N+1): for comb in itertools.combinations(L, i): kingaku = 0 TM = [0]*M for c in comb: kingaku += C...
import itertools N,M,X = map(int, input().split()) C = [] for c in range(N): C.append(list(map(int, input().split()))) ans = float('inf') L = list(range(N)) for i in range(1, N+1): for comb in itertools.combinations(L, i): kingaku = 0 TM = [0]*M for c in comb: kingaku += C...
[ "call.arguments.add" ]
412,679
412,680
u847758719
python
p02683
import numpy as np from itertools import combinations n, m, x = map(int, input().split()) lis = [list(map(int, input().split())) for _ in range(n)] # print(n, m, x, lis) ans = 10 ** 9 for i in range(1, n+1): combination = combinations(range(n), i) for comb in combination: init = np.zeros(m+1) ...
import numpy as np from itertools import combinations n, m, x = map(int, input().split()) lis = [list(map(int, input().split())) for _ in range(n)] # print(n, m, x, lis) ans = 10 ** 9 for i in range(1, n+1): combination = combinations(range(n), i) for comb in combination: init = np.zeros(m+1) ...
[ "call.arguments.change" ]
412,683
412,684
u135847648
python
p02683
import itertools N, M, X = [int(i) for i in input().split()] CA = [] # (C, A) A = [] for i in range(N): c, *a = [int(i) for i in input().split()] CA.append((c, a)) min_c = 12 * 10**5 + 1 for x in range(1, N+1): for ca in itertools.combinations(CA, x): tmp_a = [0 for _ in range(M)] tmp_c = ...
import itertools N, M, X = [int(i) for i in input().split()] CA = [] # (C, A) A = [] for i in range(N): c, *a = [int(i) for i in input().split()] CA.append((c, a)) min_c = 12 * 10**5 + 1 for x in range(1, N+1): for ca in itertools.combinations(CA, x): tmp_a = [0 for _ in range(M)] tmp_c = ...
[ "call.remove" ]
412,691
412,692
u363825867
python
p02683
import numpy as np n,m,x=map(int,input().split()) MAX=9999999999 c=[] a=[] for i in range(n): ca=list(map(int,input().split())) c.append(ca[0]) a.append(ca[1:]) c=np.array(c) a=np.array(a) pat=2**n ans=MAX for i in range(pat): pat_i=bin(i)[2:].zfill(3) ai=np.array([0 for _ in range(m)]) ansi=...
import numpy as np n,m,x=map(int,input().split()) MAX=9999999999 c=[] a=[] for i in range(n): ca=list(map(int,input().split())) c.append(ca[0]) a.append(ca[1:]) c=np.array(c) a=np.array(a) pat=2**n ans=MAX for i in range(pat): pat_i=bin(i)[2:].zfill(n) ai=np.array([0 for _ in range(m)]) ansi=...
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
412,711
412,712
u010090035
python
p02683
INF = 10**18 n, m, x = map(int, input().split()) costs = [] a = [] for i in range(n): cost, *tmp = map(int, input().split()) costs.append(cost) a.append(tmp) ans = INF for i in range(1 << n): cost = 0 ms = [0] * m for j in range(n): if (i >> j) & 1 == 1: cost += costs[j] ...
INF = 10**18 n, m, x = map(int, input().split()) costs = [] a = [] for i in range(n): cost, *tmp = map(int, input().split()) costs.append(cost) a.append(tmp) ans = INF for i in range(1 << n): cost = 0 ms = [0] * m for j in range(n): if (i >> j) & 1 == 1: cost += costs[j] ...
[ "call.remove" ]
412,717
412,718
u111473084
python
p02683
n,m,co=map(int,input().split()) l=[] for i in range(n): l.append(list(map(int,input().split()))) c=2**n ans=10**10 for i in range(c): li=[] a=0 for j in range(n): if ((i >> j) & 1): li.append(l[j]) a+=l[j][0] z=[0]*m for k in range(len(li)): for kk in range(m): z[kk]+=li[...
n,m,co=map(int,input().split()) l=[] for i in range(n): l.append(list(map(int,input().split()))) c=2**n ans=10**10 for i in range(c): li=[] a=0 for j in range(n): if ((i >> j) & 1): li.append(l[j]) a+=l[j][0] z=[0]*m for k in range(len(li)): for kk in range(m): z[kk]+=li[...
[ "expression.operation.binary.add" ]
412,719
412,720
u769870836
python
p02683
n,m,co=map(int,input().split()) l=[] for i in range(n): l.append(list(map(int,input().split()))) c=2**n ans=10**10 for i in range(c): li=[] a=0 for j in range(n): if ((i >> j) & 1): li.append(l[j]) a+=l[j][0] z=[0]*m for k in range(len(li)): for kk in range(m): z[kk]+=li[...
n,m,co=map(int,input().split()) l=[] for i in range(n): l.append(list(map(int,input().split()))) c=2**n ans=10**10 for i in range(c): li=[] a=0 for j in range(n): if ((i >> j) & 1): li.append(l[j]) a+=l[j][0] z=[0]*m for k in range(len(li)): for kk in range(m): z[kk]+=li[...
[ "call.arguments.change" ]
412,721
412,720
u769870836
python
p02683
n,m,x=map(int,input().split()) from itertools import product li=[] ans=10**9 for i in range(n): a=list(map(int,input().split())) li.append(a) for p in product([0, 1], repeat = n): cnt = [0 for _ in range(m)] price=0 for i in range(n): if p[i]==1: price+=li[i][0] for j...
n,m,x=map(int,input().split()) from itertools import product li=[] ans=10**9 for i in range(n): a=list(map(int,input().split())) li.append(a) for p in product([0, 1], repeat = n): cnt = [0 for _ in range(m)] price=0 for i in range(n): if p[i]==1: price+=li[i][0] for j...
[ "expression.operation.binary.add" ]
412,724
412,725
u116233709
python
p02683
N, M, X = map(int, input().split()) C, A = [], [] ans = 100000 exist = False for n in range(N): li = list(map(int, input().split())) C.append(li[0]) A.append(li[1:]) for b in range(1 << N): amount = 0 understand = [0] * M for n in range(N): if (b >> n) & 1 == 1: amount += C[n...
N, M, X = map(int, input().split()) C, A = [], [] ans = 1200000 exist = False for n in range(N): li = list(map(int, input().split())) C.append(li[0]) A.append(li[1:]) for b in range(1 << N): amount = 0 understand = [0] * M for n in range(N): if (b >> n) & 1 == 1: amount += C[...
[ "literal.number.integer.change", "assignment.value.change" ]
412,726
412,727
u197078193
python
p02683
#!/usr/bin/env python3 import sys def main(): N, M, X = map(int, input().split()) C = [None] * N A = [None for _ in range(N)] for i in range(N): C[i], *A[i] = map(int, input().split()) # print(C,A) ans = 10**12 for i in range(2**N): tmp = [0] * N tmpC = 0 ...
#!/usr/bin/env python3 import sys def main(): N, M, X = map(int, input().split()) C = [None] * N A = [None for _ in range(N)] for i in range(N): C[i], *A[i] = map(int, input().split()) # print(C,A) ans = 10**12 for i in range(2**N): tmp = [0] * M tmpC = 0 ...
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
412,732
412,733
u086503932
python
p02683
import sys from collections import defaultdict, Counter, deque from itertools import accumulate, permutations, combinations from operator import itemgetter from bisect import bisect_left, bisect_right, bisect from heapq import heappop, heappush from math import gcd from math import ceil, floor, sqrt, cos, sin, pi from ...
import sys from collections import defaultdict, Counter, deque from itertools import accumulate, permutations, combinations from operator import itemgetter from bisect import bisect_left, bisect_right, bisect from heapq import heappop, heappush from math import gcd from math import ceil, floor, sqrt, cos, sin, pi from ...
[ "assignment.value.change", "identifier.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
412,734
412,735
u978494963
python
p02683
import sys from itertools import product sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n, m, x = map(int, input().split()) C = [list(map(int, input().split())) for _ in range(n)] res = f_inf for pattern in product([0, 1], repeat=n): A = [0 for _ in rang...
import sys from itertools import product sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n, m, x = map(int, input().split()) C = [list(map(int, input().split())) for _ in range(n)] res = f_inf for pattern in product([0, 1], repeat=n): A = [0 for _ in rang...
[ "expression.operation.binary.add" ]
412,748
412,749
u489959379
python
p02683
n,m,x = map(int,input().split()) ca = [list(map(int,input().split())) for _ in range(n)] true_buy = float("inf") for i in range(2**n): buy = [] buy_sum = 0 for j in range(n): if (i>>j) & 1: buy.append(ca[j]) buy_sum += ca[j][0] for k in range(m): gain = 0 for l in range(len(buy)): ...
n,m,x = map(int,input().split()) ca = [list(map(int,input().split())) for _ in range(n)] true_buy = float("inf") for i in range(2**n): buy = [] buy_sum = 0 for j in range(n): if (i>>j) & 1: buy.append(ca[j]) buy_sum += ca[j][0] for k in range(m): gain = 0 for l in range(len(buy)): ...
[ "expression.operation.binary.add" ]
412,774
412,775
u097317219
python
p02683
n, m, x = map(int, input().split()) data = [list(map(int, input().split())) for _ in range(n)] ans = -1 def calc_score(data, score): for i in range(m): score[i] += data[i] def judge_score(score): for i in range(m): if score[i] < x: return False return True for i in range...
n, m, x = map(int, input().split()) data = [list(map(int, input().split())) for _ in range(n)] ans = -1 def calc_score(data, score): for i in range(m): score[i] += data[i + 1] def judge_score(score): for i in range(m): if score[i] < x: return False return True for i in r...
[ "expression.operation.binary.add" ]
412,782
412,783
u502731482
python
p02683
N, M, X = map(int, input().split()) hon = [] for _ in range(N): hon.append(list(map(int, input().split()))) minyen = float("inf") for i in range(2**N): flag = False hoji = [] rikai = [0]*M #print("pattern{}: ".format(i), end="") for j in range(M+1): if((i>>j)&1): hoji.appen...
N, M, X = map(int, input().split()) hon = [] for _ in range(N): hon.append(list(map(int, input().split()))) minyen = float("inf") for i in range(2**N): flag = False hoji = [] rikai = [0]*M #print("pattern{}: ".format(i), end="") for j in range(N): if((i>>j)&1): hoji.append(...
[ "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.remove" ]
412,804
412,805
u697559326
python
p02683
import itertools import numpy as np N,M,X=map(int,input().split()) CA=[] for i in range(N): CA.append(list(map(int,input().split()))) money=100000000000 count=1 for i in range(1,N): test=itertools.combinations(CA,i) for j in test:#組み合わせごとに計算 pre_ans=np.sum(j, axis=0) if pre_ans[0]<money and np.all(pre_ans...
import itertools import numpy as np N,M,X=map(int,input().split()) CA=[] for i in range(N): CA.append(list(map(int,input().split()))) money=9000000000 count=1 for i in range(1,N+1): test=itertools.combinations(CA,i) for j in test:#組み合わせごとに計算 pre_ans=np.sum(j, axis=0) if pre_ans[0]<money and np.all(pre_ans...
[ "literal.number.integer.change", "assignment.value.change" ]
412,808
412,809
u753386263
python
p02683
import itertools import numpy as np N,M,X=map(int,input().split()) CA=[] for i in range(N): CA.append(list(map(int,input().split()))) #CA=sorted(CA, key=lambda x:sum(x[1:])) money=100000000000000000000000000000 count=1 for i in range(1,N): test=itertools.combinations(CA,i) for j in test:#組み合わせごとに計算 pre_ans=np...
import itertools import numpy as np N,M,X=map(int,input().split()) CA=[] for i in range(N): CA.append(list(map(int,input().split()))) money=9000000000 count=1 for i in range(1,N+1): test=itertools.combinations(CA,i) for j in test:#組み合わせごとに計算 pre_ans=np.sum(j, axis=0) if pre_ans[0]<money and np.all(pre_ans...
[ "literal.number.integer.change", "assignment.value.change" ]
412,810
412,809
u753386263
python
p02683
# -*- coding: utf-8 -*- """ Created on Sun May 10 21:06:30 2020 @author: shinba """ n,m,x = map(int,input().split()) ca = [] for i in range(n): ca.append(list(map(int,input().split()))) ans = float("inf") for i in range(1,2**n-1): s = [0]*(m+1) for j in range(n): if (i>>j) & 1: s...
# -*- coding: utf-8 -*- """ Created on Sun May 10 21:06:30 2020 @author: shinba """ n,m,x = map(int,input().split()) ca = [] for i in range(n): ca.append(list(map(int,input().split()))) ans = float("inf") for i in range(1,2**n): s = [0]*(m+1) for j in range(n): if (i>>j) & 1: s[0...
[ "expression.operation.binary.remove" ]
412,813
412,814
u496821919
python
p02683
import numpy as np n,m,x=map(int,input().split()) ans=10**5 f=1 s=[list(map(int,input().split())) for _ in range(n)] for i in range(2**n): t=np.zeros(m+1) for j in range(n): if (i>>j)&1: t=t+np.array(s[j]) if all(t[1:]>=x): ans=min(t[0],ans) f=0 if f: print(-1) else: print(int(ans))
import numpy as np n,m,x=map(int,input().split()) ans=10**10 f=1 s=[list(map(int,input().split())) for _ in range(n)] for i in range(1<<n): t=np.zeros(m+1) for j in range(n): if (i>>j)&1: t=t+np.array(s[j]) if all(t[1:]>=x): ans=min(t[0],ans) f=0 if f: print(-1) else: print(int(ans))
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
412,821
412,822
u568576853
python
p02683
# C - Skill Up import itertools import numpy as np N, M, X = map(int, input().split()) CA = np.zeros((N, M+1), dtype=np.int64) for i in range(N): CA[i] = list(int(x) for x in input().split()) ans = 10**18 for lst in itertools.product((0,1), repeat=N): tmp = 0 pnt = np.zeros(M, dtype=np.int8) for i in ...
# C - Skill Up import itertools import numpy as np N, M, X = map(int, input().split()) CA = np.zeros((N, M+1), dtype=np.int64) for i in range(N): CA[i] = list(int(x) for x in input().split()) ans = 10**18 for lst in itertools.product((0,1), repeat=N): tmp = 0 pnt = np.zeros(M, dtype=np.int64) for i in...
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
412,830
412,831
u141786930
python
p02683
N,M,X = map(int,input().split()) C = [0]*N A = [[0] for _ in range(N)] for i in range(N): tmp = list(map(int,input().split())) C[i] = tmp[0] A[i] = tmp[1:M+1] f = False money_min = 100000000000 for i in range(1,2**N): use = format(i,"0{}b".format(N)) print(use) money = 0 understand = [0]*M ...
N,M,X = map(int,input().split()) C = [0]*N A = [[0] for _ in range(N)] for i in range(N): tmp = list(map(int,input().split())) C[i] = tmp[0] A[i] = tmp[1:M+1] f = False money_min = 100000000000 for i in range(1,2**N): use = format(i,"0{}b".format(N)) money = 0 understand = [0]*M for j in ran...
[ "call.remove" ]
412,849
412,850
u224353074
python
p02683
N,M,X = map(int,input().split()) C = [0]*N A = [[0] for _ in range(N)] for i in range(N): tmp = list(map(int,input().split())) C[i] = tmp[0] A[i] = tmp[1:M+1] f = False money_min = 100000000000 for i in range(1,2**N-1): use = format(i,"0{}b".format(N)) money = 0 understand = [0]*M for j in r...
N,M,X = map(int,input().split()) C = [0]*N A = [[0] for _ in range(N)] for i in range(N): tmp = list(map(int,input().split())) C[i] = tmp[0] A[i] = tmp[1:M+1] f = False money_min = 100000000000 for i in range(1,2**N): use = format(i,"0{}b".format(N)) money = 0 understand = [0]*M for j in ran...
[ "expression.operation.binary.remove" ]
412,851
412,850
u224353074
python
p02683
from itertools import product N, M, X = [int(x) for x in input().strip().split(" ")] C = [] A = [] for _ in range(N): v = [int(x) for x in input().strip().split(" ")] c = v.pop(0) C.append(c) A.append(v) sums = [] patterns = product(*[(0, 1) for _ in range(N)]) for pattern in patterns: price = 0 ...
from itertools import product N, M, X = [int(x) for x in input().strip().split(" ")] C = [] A = [] for _ in range(N): v = [int(x) for x in input().strip().split(" ")] c = v.pop(0) C.append(c) A.append(v) sums = [] patterns = product(*[(0, 1) for _ in range(N)]) for pattern in patterns: price = 0 ...
[ "call.remove" ]
412,856
412,857
u553600587
python
p02683
n, m, x = map(int, input().split()) c = [] a = [] for i in range(n): row = list(map(int, input().split())) c.append(row[0]) a.append(row[1:]) import itertools ans = float('inf') for r in range(n): for idxs in itertools.combinations(range(n), r=r): price = [0]*m for idx in idxs: ...
n, m, x = map(int, input().split()) c = [] a = [] for i in range(n): row = list(map(int, input().split())) c.append(row[0]) a.append(row[1:]) import itertools ans = float('inf') for r in range(n+1): for idxs in itertools.combinations(range(n), r=r): price = [0]*m for idx in idxs: ...
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
412,866
412,867
u794250528
python
p02684
n,k = map(int,input().split()) A = [0] A.extend(list(map(int,input().split()))) town = 1 once = [0]*(n+1) for i in range(n): if once[town]==0: once[town] = 1 else: break town = A[town] rt = A[town] roop = 1 while rt != town: rt = A[rt] roop += 1 rt = 1 bf = 0 while rt != town: rt = A[rt] bf +=...
n,k = map(int,input().split()) A = [0] A.extend(list(map(int,input().split()))) town = 1 once = [0]*(n+1) for i in range(n): if once[town]==0: once[town] = 1 else: break town = A[town] rt = A[town] roop = 1 while rt != town: rt = A[rt] roop += 1 rt = 1 bf = 0 while rt != town: rt = A[rt] bf +=...
[]
412,884
412,885
u935642171
python
p02684
import sys def main(): n, k = map(int, sys.stdin.buffer.readline().split()) a = [0] + list(map(int, sys.stdin.buffer.readline().split())) visited = [0]*(n+1) town = 1 for i in range(1, k+1): town = a[town] if visited[town] == 0: visited[town] = i else: ...
import sys def main(): n, k = map(int, sys.stdin.buffer.readline().split()) a = [0] + list(map(int, sys.stdin.buffer.readline().split())) visited = [0]*(n+1) town = 1 for i in range(1, k+1): town = a[town] if visited[town] == 0: visited[town] = i else: ...
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
412,901
412,902
u597455618
python
p02684
n, k = map(int, input().split()) field = [(i, j) for i, j in zip(range(n), list(map(int, input().split())))] #%% town = 0 # 町は1始まりだが、indexの都合上-1する order = 0 # 訪問順序 visited = {town: order} # 訪問済みの街を格納 while True: trans = field[town][1] - 1 # 現在のtownにあるテレポーターの移動先 n_town = field[trans][0] # 遷移先の町. これはリストのindexに...
n, k = map(int, input().split()) field = [(i, j) for i, j in zip(range(n), list(map(int, input().split())))] #%% town = 0 # 町は1始まりだが、indexの都合上-1する order = 0 # 訪問順序 visited = {town: order} # 訪問済みの街を格納 while True: trans = field[town][1] - 1 # 現在のtownにあるテレポーターの移動先 n_town = field[trans][0] # 遷移先の町. これはリストのindexに...
[ "expression.operation.binary.remove" ]
412,921
412,922
u252729807
python
p02684
import sys sys.setrecursionlimit(10 ** 6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(input()) def MI(): return map(int, input().split()) def MI1(): return map(int1, input().split()) def LI(): return list(map(int, input().split())) def LI1(): return list(map(int1, in...
import sys sys.setrecursionlimit(10 ** 6) # input = sys.stdin.readline #### int1 = lambda x: int(x) - 1 def II(): return int(input()) def MI(): return map(int, input().split()) def MI1(): return map(int1, input().split()) def LI(): return list(map(int, input().split())) def LI1(): return list(map(int1, in...
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
412,923
412,924
u564589929
python
p02684
import sys import time N, K = map(int, input().split()) town_list = list(map(int, input().split())) queue = {} start = -1 count = 1 now_town = 1 for i in range(K): if town_list[now_town - 1] in queue: start = town_list[now_town - 1] break queue[town_list[now_town - 1]] = count now_town ...
import sys import time N, K = map(int, input().split()) town_list = list(map(int, input().split())) queue = {} start = -1 count = 1 now_town = 1 for i in range(K): if town_list[now_town - 1] in queue: start = town_list[now_town - 1] break queue[town_list[now_town - 1]] = count now_town ...
[ "call.remove" ]
412,933
412,934
u891516200
python
p02684
n,k=map(int,input().split()) pl=list(map(int,input().split())) cl=[0]*2*n order=[] next=0 for i in range(k): if cl[next]==0: cl[next]=1 next=pl[next]-1 elif cl[next]==1: cl[next]=2 order.append(next+1) next=pl[next]-1 else: kk=len(order) hasuu=cl.count(1) newk=k-hasuu ans=newk%...
n,k=map(int,input().split()) pl=list(map(int,input().split())) cl=[0]*2*n order=[] next=0 for i in range(k): if cl[next]==0: cl[next]=1 next=pl[next]-1 elif cl[next]==1: cl[next]=2 order.append(next+1) next=pl[next]-1 else: kk=len(order) hasuu=cl.count(1) newk=k-hasuu ans=newk%...
[ "call.arguments.change", "io.output.change" ]
412,941
412,942
u694380052
python
p02684
# A_1からスタートして、同じA_iに戻ってくるまでの[移動回数][到着場所]をリスト化 import sys readline = sys.stdin.readline N,K = map(int,readline().split()) A = list(map(int,readline().split())) route = [0] visited = {0} while True: nex = A[route[-1]] - 1 # print(route[-1]," -> ",nex) if nex in visited: # print(nex,"is already visited") lo...
# A_1からスタートして、同じA_iに戻ってくるまでの[移動回数][到着場所]をリスト化 import sys readline = sys.stdin.readline N,K = map(int,readline().split()) A = list(map(int,readline().split())) route = [0] visited = {0} while True: nex = A[route[-1]] - 1 # print(route[-1]," -> ",nex) if nex in visited: # print(nex,"is already visited") lo...
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
412,976
412,977
u936985471
python
p02684
n, k = map(int, input().split()) A = list(map(lambda x: x-1, map(int, input().split()))) isVisit = [False]*n visits = [] visit = 0 for i in range(n): if isVisit[visit]: break else: isVisit[visit] = True visits.append(visit) visit = A[visit] if len(visits)>=k: print(visits[k]...
n, k = map(int, input().split()) A = list(map(lambda x: x-1, map(int, input().split()))) isVisit = [False]*n visits = [] visit = 0 for i in range(n): if isVisit[visit]: break else: isVisit[visit] = True visits.append(visit) visit = A[visit] if len(visits)>k: print(visits[k]+...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
412,981
412,982
u747703115
python
p02684
# -*- coding: utf-8 -*- """ Created on Sat Jun 20 10:11:22 2020 @author: NEC-PCuser """ N, K = map(int, input().split()) A = list(map(int, input().split())) tele_set = set() tele_set.add(1) junkai_town = -1 junkai_first = -1 town = 1 for i in range(N): if A[town - 1] not in tele_set: tele_set.add(A[tow...
# -*- coding: utf-8 -*- """ Created on Sat Jun 20 10:11:22 2020 @author: NEC-PCuser """ N, K = map(int, input().split()) A = list(map(int, input().split())) tele_set = set() tele_set.add(1) junkai_town = -1 junkai_first = -1 town = 1 for i in range(N): if A[town - 1] not in tele_set: tele_set.add(A[tow...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
412,987
412,988
u153094838
python
p02684
N,K=map(int,input().split()) alist=[0]+list(map(int,input().split())) #print(alist) tlist=[] pos=1 pos_set=set() while True: tlist.append(pos) if pos in pos_set: break pos_set.add(pos) pos=alist[pos] dup_pos2=len(tlist)-1 dup_pos1=-1 for i in range(len(tlist)): if tlist[i]==tlist[-1]: dup_pos1=i ...
N,K=map(int,input().split()) alist=[0]+list(map(int,input().split())) #print(alist) tlist=[] pos=1 pos_set=set() while True: tlist.append(pos) if pos in pos_set: break pos_set.add(pos) pos=alist[pos] dup_pos2=len(tlist)-1 dup_pos1=-1 for i in range(len(tlist)): if tlist[i]==tlist[-1]: dup_pos1=i ...
[ "call.remove" ]
412,989
412,990
u203843959
python
p02684
N, K = map(int, input().split()) A = [i-1 for i in map(int, input().split())] used = [False] * N loop = [0] # startは0→町1 now = 0 # now+1が町 while not used[A[now]]: used[A[now]] = True loop.append(A[now]) now = A[now] ind = loop.index(A[now]) # new_loop = loop[(befo):] if K < ind: print(loop[K]+1) el...
N, K = map(int, input().split()) A = [i-1 for i in map(int, input().split())] used = [False] * N loop = [0] # startは0→町1 now = 0 # now+1が町 while not used[A[now]]: used[A[now]] = True loop.append(A[now]) now = A[now] ind = loop.index(A[now]) # new_loop = loop[(befo):] if K < ind: print(loop[K]+1) el...
[ "expression.operation.binary.change", "identifier.change", "variable_access.subscript.index.change", "call.arguments.change", "io.output.change" ]
412,991
412,992
u291543340
python
p02684
N, K = map(int, input().split()) A = list(map(int, input().split())) l = [0 for _ in range(N)] now = 0 l[now] = 1 count = 0 loop = [0] while count < K: count += 1 now = A[now]-1 loop.append(now) if l[now] == 1: loop = loop[loop.index(now):-1] break else: l[now] = 1 if coun...
N, K = map(int, input().split()) A = list(map(int, input().split())) l = [0 for _ in range(N)] now = 0 l[now] = 1 count = 0 loop = [0] while count < K: count += 1 now = A[now]-1 loop.append(now) if l[now] == 1: loop = loop[loop.index(now):-1] break else: l[now] = 1 if coun...
[]
412,996
412,997
u767664985
python
p02684
# D N,K = map(int,input().split()) A = list(map(int,input().split())) cnt = 0 temp = [] d = [0]*(2*(10**5) + 1) now = 1 while True: d[now] += 1 if d[now] > 1: break temp.append(now) now = A[now-1] for t in temp[::-1]: cnt += 1 if t == now: break temp2 = temp[-cnt::] if len(temp) <= K: kk ...
# D N,K = map(int,input().split()) A = list(map(int,input().split())) cnt = 0 temp = [] d = [0]*(2*(10**5) + 1) now = 1 while True: d[now] += 1 if d[now] > 1: break temp.append(now) now = A[now-1] for t in temp[::-1]: cnt += 1 if t == now: break temp2 = temp[-cnt::] if len(temp) <= K: kk ...
[ "call.add", "call.arguments.change" ]
412,999
413,000
u441254033
python
p02684
def main(): n, k = map(int, input().split()) a = list(map(int, input().split())) num = 1 l = [] s = [1]*n while s[num-1]: l.append(num) s[num-1] = 0 num = a[num-1] if l.index(num) <= k: l2 = l[l.index(num):] kk = (k-len(set(l)-set(l2)))%len(l2) ...
def main(): n, k = map(int, input().split()) a = list(map(int, input().split())) num = 1 l = [] s = [1]*n while s[num-1]: l.append(num) s[num-1] = 0 num = a[num-1] if l.index(num) <= k: l2 = l[l.index(num):] kk = (k-len(set(l)-set(l2)))%len(l2) ...
[ "identifier.change", "call.arguments.change", "io.output.change" ]
413,001
413,002
u316733945
python
p02684
n,k=map(int,input().split()) a=list(map(int,input().split())) visit=[0]*n visit[0]=1 now=0 c=0 for i in range(k): now_=now now=a[now]-1 if visit[now]==0: visit[now]=visit[now_]+1 else: c=1 break if c==1: t=(k+2-visit[now])%(visit[now_]-visit[now]+1) if t==0: print(now_+1) else: i=now ...
n,k=map(int,input().split()) a=list(map(int,input().split())) visit=[0]*n visit[0]=1 now=0 c=0 for i in range(k): now_=now now=a[now]-1 if visit[now]==0: visit[now]=visit[now_]+1 else: c=1 break if c==1: t=(k+2-visit[now])%(visit[now_]-visit[now]+1) if t==0: print(now_+1) else: i=now ...
[ "assignment.change" ]
413,003
413,004
u428199834
python
p02684
n,k=map(int,input().split()) a=list(map(int,input().split())) visit=[0]*n visit[0]=1 now=0 c=0 for i in range(n): now_=now now=a[now]-1 if visit[now]==0: visit[now]=visit[now_]+1 else: c=1 break if c==1: t=(k+2-visit[now])%(visit[now_]-visit[now]+1) if t==0: print(now_+1) else: i=now ...
n,k=map(int,input().split()) a=list(map(int,input().split())) visit=[0]*n visit[0]=1 now=0 c=0 for i in range(k): now_=now now=a[now]-1 if visit[now]==0: visit[now]=visit[now_]+1 else: c=1 break if c==1: t=(k+2-visit[now])%(visit[now_]-visit[now]+1) if t==0: print(now_+1) else: i=now ...
[ "identifier.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
413,005
413,004
u428199834
python
p02684
N,K=map(int,input().split()) A=list(map(int,input().split())) cycle=[] for i in range(0,N): cycle.append(-1) A[i]-=1 count=0 cycle[0]=count town=0 mod=0 while True: count+=1 K-=1 town=A[town] if K==0: break if cycle[town]==-1: cycle[town]=count else: mod=count-c...
N,K=map(int,input().split()) A=list(map(int,input().split())) cycle=[] for i in range(0,N): cycle.append(-1) A[i]-=1 count=0 cycle[0]=count town=0 mod=0 while True: count+=1 K-=1 town=A[town] if K==0: mod=1 break if cycle[town]==-1: cycle[town]=count else: ...
[ "assignment.add" ]
413,016
413,017
u630211216
python
p02684
n, k = map(int, input().split()) a = list(map(int, input().split())) d = {} for i in range(1, n + 1): d[i] = a[i - 1] did = set(1) route = [1] now = 1 for i in range(k): now = d[now] route.append(now) if now in did: break did.add(now) if k < 10 ** 6:#計算量的に間に合うので愚直に now = 1 for i ...
n, k = map(int, input().split()) a = list(map(int, input().split())) d = {} for i in range(1, n + 1): d[i] = a[i - 1] did = set([1]) route = [1] now = 1 for i in range(k): now = d[now] route.append(now) if now in did: break did.add(now) if k < 10 ** 6:#計算量的に間に合うので愚直に now = 1 for ...
[ "call.arguments.change" ]
413,026
413,027
u294385082
python
p02684
from collections import deque N,K=map(int,input().split()) A=list(map(int,input().split())) if A[0]==1: print(1) exit() if K==1: print(A[0]) exit() for i in range(N): A[i]-=1 #S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合 S = [0]*N L = deque() S[0]=1 L.append(1) count=1 pos=A[0] for i in...
from collections import deque N,K=map(int,input().split()) A=list(map(int,input().split())) if A[0]==1: print(1) exit() if K==1: print(A[0]) exit() for i in range(N): A[i]-=1 #S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合 S = [0]*N L = deque() S[0]=1 L.append(1) count=1 pos=A[0] for i in...
[ "call.arguments.change" ]
413,035
413,036
u013513417
python
p02684
from collections import deque N,K=map(int,input().split()) A=list(map(int,input().split())) if A[0]==1: print(1) exit() if K==1: print(A[0]) exit() for i in range(N): A[i]-=1 #S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合 S = [0]*N L = deque() S[0]=1 L.append(1) count=1 pos=A[0] for i in...
from collections import deque N,K=map(int,input().split()) A=list(map(int,input().split())) if A[0]==1: print(1) exit() if K==1: print(A[0]) exit() for i in range(N): A[i]-=1 #S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合 S = [0]*N L = deque() S[0]=1 L.append(1) count=1 pos=A[0] for i in...
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
413,037
413,036
u013513417
python
p02684
[n, k], [*a] = [[*map(int, t.split())] for t in open(0)] count = 0 visited = dict() tmp = 1 while count <= k: visited[tmp] = count count += 1 tmp = a[tmp - 1] if tmp in visited: break if count < k: k = (k - count) % (count - visited[tmp]) for _ in range(k): tmp = a[tmp - 1] print...
[n, k], [*a] = [[*map(int, t.split())] for t in open(0)] count = 0 visited = dict() tmp = 1 while count < k: visited[tmp] = count count += 1 tmp = a[tmp - 1] if tmp in visited: break if count < k: k = (k - count) % (count - visited[tmp]) for _ in range(k): tmp = a[tmp - 1] print(...
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
413,054
413,055
u434846982
python
p02684
[n, k], [*a] = [[*map(int, t.split())] for t in open(0)] count = 0 visited = dict() tmp = 1 while count <= k: visited[tmp] = count count += 1 tmp = a[tmp - 1] if tmp in visited: break if count <= k: k = (k - count) % (count - visited[tmp]) for _ in range(k): tmp = a[tmp - 1] prin...
[n, k], [*a] = [[*map(int, t.split())] for t in open(0)] count = 0 visited = dict() tmp = 1 while count < k: visited[tmp] = count count += 1 tmp = a[tmp - 1] if tmp in visited: break if count < k: k = (k - count) % (count - visited[tmp]) for _ in range(k): tmp = a[tmp - 1] print(...
[ "expression.operator.compare.change", "control_flow.loop.condition.change", "control_flow.branch.if.condition.change" ]
413,056
413,055
u434846982
python
p02684
# 初期入力 from collections import Counter from copy import deepcopy import sys input = sys.stdin.readline N,K = (int(x) for x in input().split()) A = list(map(int, input().split())) connection ={} for i,v in enumerate(A): connection[i+1] =v #巡回してるか passed=[1] nex =connection[1] lap =[] lap_num =0 pass_set =set() for...
# 初期入力 from collections import Counter from copy import deepcopy import sys input = sys.stdin.readline N,K = (int(x) for x in input().split()) A = list(map(int, input().split())) connection ={} for i,v in enumerate(A): connection[i+1] =v #巡回してるか passed=[1] nex =connection[1] lap =[] lap_num =0 pass_set =set(passe...
[ "call.arguments.change" ]
413,057
413,058
u116038906
python
p02684
# 初期入力 from collections import Counter from copy import deepcopy import sys input = sys.stdin.readline N,K = (int(x) for x in input().split()) A = list(map(int, input().split())) connection ={} for i,v in enumerate(A): connection[i+1] =v #巡回してるか passed=[1] nex =connection[1] lap =[] lap_num =0 pass_set =set() for...
# 初期入力 from collections import Counter from copy import deepcopy import sys input = sys.stdin.readline N,K = (int(x) for x in input().split()) A = list(map(int, input().split())) connection ={} for i,v in enumerate(A): connection[i+1] =v #巡回してるか passed=[1] nex =connection[1] lap =[] lap_num =0 pass_set =set(passe...
[ "call.arguments.change", "identifier.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
413,059
413,058
u116038906
python
p02684
# 初期入力 from collections import Counter from copy import deepcopy import sys input = sys.stdin.readline N,K = (int(x) for x in input().split()) A = list(map(int, input().split())) connection ={} for i,v in enumerate(A): connection[i+1] =v #巡回してるか passed=[1] nex =connection[1] lap =[] lap_num =0 pass_set =set() for...
# 初期入力 from collections import Counter from copy import deepcopy import sys input = sys.stdin.readline N,K = (int(x) for x in input().split()) A = list(map(int, input().split())) connection ={} for i,v in enumerate(A): connection[i+1] =v #巡回してるか passed=[1] nex =connection[1] lap =[] lap_num =0 pass_set =set(passe...
[ "call.arguments.change", "identifier.change", "control_flow.branch.if.condition.change" ]
413,060
413,058
u116038906
python
p02684
import bisect,collections,copy,heapq,itertools,math,string from collections import defaultdict as D from functools import reduce import numpy as np import sys import os from operator import mul sys.setrecursionlimit(10**7) def _S(): return sys.stdin.readline().rstrip() def I(): return int(_S()) def LS(): return list(...
import bisect,collections,copy,heapq,itertools,math,string from collections import defaultdict as D from functools import reduce import numpy as np import sys import os from operator import mul sys.setrecursionlimit(10**7) def _S(): return sys.stdin.readline().rstrip() def I(): return int(_S()) def LS(): return list(...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
413,065
413,066
u602500004
python
p02684
N, K = map(int, input().split()) A = [0] + list(map(int, input().split())) cnt = {} for i in range(1, N+1): cnt[i] = 0 root = [0] loop = [] now = 1 tmp = 0 amari = 0 while cnt[now] != 2: cnt[now] += 1 root.append(now) if cnt[now] == 2: tmp = now break amari += 1 now = A[now] w...
N, K = map(int, input().split()) A = [0] + list(map(int, input().split())) cnt = {} for i in range(1, N+1): cnt[i] = 0 root = [0] loop = [] now = 1 tmp = 0 amari = 0 while cnt[now] != 2: cnt[now] += 1 root.append(now) if cnt[now] == 2: tmp = now break amari += 1 now = A[now] w...
[ "assignment.change" ]
413,085
413,086
u397020326
python
p02684
n,k=map(int,input().split()) A=[0]+list(map(int,input().split())) color=["white" for _ in range(n+1)] DP,index=[],1 while 1: if color[index]=="white":color[index]="gray" elif color[index]=="gray":color[index]="black" DP.append(A[index]) index=A[index] if color[index]=="black":break repeat=[] for ...
n,k=map(int,input().split()) A=[0]+list(map(int,input().split())) color=["white" for _ in range(n+1)] DP,index=[],1 while 1: if color[index]=="white":color[index]="gray" elif color[index]=="gray":color[index]="black" DP.append(A[index]) index=A[index] if color[index]=="black":break repeat=[] for ...
[ "expression.operation.binary.add" ]
413,089
413,090
u905203728
python
p02684
n,k=map(int,input().split()) A=list(map(int,input().split())) time=0 color=["white" for _ in range(n+1)] D=[-1 for _ in range(n+1)] C,s=[],A[0] point=0 while 1: if color[s]=="white": color[s]="gray" C.append(s) D[s]=time time +=1 s=A[s-1] else: point=D[s] ...
n,k=map(int,input().split()) A=list(map(int,input().split())) time=0 color=["white" for _ in range(n+1)] D=[-1 for _ in range(n+1)] C,s=[],A[0] point=0 while 1: if color[s]=="white": color[s]="gray" C.append(s) D[s]=time time +=1 s=A[s-1] else: point=D[s] ...
[ "expression.operation.binary.remove", "identifier.change", "call.arguments.change", "io.output.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
413,091
413,092
u905203728
python
p02684
n,k=map(int,input().split()) A=list(map(int,input().split())) time=0 color=["white" for _ in range(n+1)] D=[-1 for _ in range(n+1)] C,s=[],A[0] point=0 while 1: if color[s]=="white": color[s]="gray" C.append(s) D[s]=time time +=1 s=A[s-1] else: point=D[s] ...
n,k=map(int,input().split()) A=list(map(int,input().split())) time=0 color=["white" for _ in range(n+1)] D=[-1 for _ in range(n+1)] C,s=[],A[0] point=0 while 1: if color[s]=="white": color[s]="gray" C.append(s) D[s]=time time +=1 s=A[s-1] else: point=D[s] ...
[ "identifier.change", "call.arguments.change", "io.output.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
413,091
413,093
u905203728
python
p02684
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
[ "expression.operation.binary.add" ]
413,094
413,095
u598296382
python
p02684
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
[ "control_flow.branch.if.condition.change" ]
413,096
413,095
u598296382
python
p02684
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
[ "control_flow.branch.if.condition.change", "call.arguments.add" ]
413,097
413,095
u598296382
python
p02684
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
[ "identifier.change", "control_flow.branch.if.condition.change" ]
413,094
413,098
u598296382
python
p02684
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
import heapq def binary_search(data, value): left = 0 # 探索する範囲の左端を設定 right = len(data) - 1 # 探索する範囲の右端を設定 while left <= right: mid = (left + right) // 2 # 探索する範囲の中央を計算 if data[mid] == value: # 中央の値と一致した場合は位置を返す return mid elif...
[ "identifier.change", "control_flow.branch.if.condition.change" ]
413,096
413,098
u598296382
python
p02684
import math from math import gcd INF = float("inf") import sys input=sys.stdin.readline sys.setrecursionlimit(500*500) import itertools from collections import Counter,deque def main(): n,k = map(int, input().split()) a = list(map(int, input().split())) c = [] mark = [-1]*n pos,l = 0,0 while ...
import math from math import gcd INF = float("inf") import sys input=sys.stdin.readline sys.setrecursionlimit(500*500) import itertools from collections import Counter,deque def main(): n,k = map(int, input().split()) a = list(map(int, input().split())) c = [] mark = [-1]*n pos,l = 0,0 while ...
[ "identifier.replace.add", "literal.replace.remove", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
413,102
413,103
u648315264
python
p02684
import math from math import gcd INF = float("inf") import sys input=sys.stdin.readline sys.setrecursionlimit(500*500) import itertools from collections import Counter,deque def main(): n,k = map(int, input().split()) a = list(map(int, input().split())) c = [] mark = [-1]*n pos,l = 0,0 while ...
import math from math import gcd INF = float("inf") import sys input=sys.stdin.readline sys.setrecursionlimit(500*500) import itertools from collections import Counter,deque def main(): n,k = map(int, input().split()) a = list(map(int, input().split())) c = [] mark = [-1]*n pos,l = 0,0 while ...
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
413,104
413,103
u648315264
python
p02684
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
#!/usr/bin/env python3 import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(2147483647) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collection...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
413,105
413,106
u191874006
python
p02684
from collections import Counter n, k = map(int, input().split()) A = list(map(int, input().split())) C = Counter([]) X, Y = [], [] m = 0 for _ in range(n): a = A[m]-1 C[m] += 1 X.append(m) if C[a] != 0: Y = X[X.index(a):] X = X[:X.index(a)] break m = a # print(X,Y) x = len(X)...
from collections import Counter n, k = map(int, input().split()) A = list(map(int, input().split())) C = Counter([]) X, Y = [], [] m = 0 for _ in range(n): a = A[m]-1 C[m] += 1 X.append(m) if C[a] != 0: Y = X[X.index(a):] X = X[:X.index(a)] break m = a # print(X,Y) x = len(X)...
[ "expression.operation.binary.remove", "control_flow.branch.if.condition.change" ]
413,115
413,116
u748311048
python
p02684
from collections import Counter n, k = map(int, input().split()) A = list(map(int, input().split())) C = Counter([]) X, Y = [], [] m = 0 for _ in range(n): a = A[m]-1 C[m] += 1 X.append(m) if C[a] != 0: Y = X[X.index(a):] X = X[:X.index(a)] break m = a # print(X,Y) x=len(X) y...
from collections import Counter n, k = map(int, input().split()) A = list(map(int, input().split())) C = Counter([]) X, Y = [], [] m = 0 for _ in range(n): a = A[m]-1 C[m] += 1 X.append(m) if C[a] != 0: Y = X[X.index(a):] X = X[:X.index(a)] break m = a # print(X,Y) x = len(X)...
[ "control_flow.branch.if.condition.change" ]
413,117
413,116
u748311048
python
p02684
def main(): N, K = (int(i) for i in input().split()) A = [int(i) for i in input().split()] d = [] d_set = set() s = 1 for _ in range(N): if s in d_set: if K < len(d): print(d[K]) idx = d.index(s) K -= idx d = d[idx:] ...
def main(): N, K = (int(i) for i in input().split()) A = [int(i) for i in input().split()] d = [] d_set = set() s = 1 for _ in range(N): if s in d_set: if K < len(d): return print(d[K]) idx = d.index(s) K -= idx d = d[idx:] ...
[ "control_flow.return.add" ]
413,118
413,119
u312025627
python
p02684
N, K = map(int, input().split()) A = [0] + list(map(int, input().split())) visited = [0] * (N + 1) route = [0] * (N + 1) next_ = 1 count = 0 for i in range(N + 1): if visited[next_] != 0: x = visited[next_] count = (K - (x - 1)) % (i + 1 - x) + x print(route[count]) exit() visi...
N, K = map(int, input().split()) A = [0] + list(map(int, input().split())) visited = [0] * (N + 1) route = [0] * (N + 1) next_ = 1 count = 0 for i in range(K + 1): if visited[next_] != 0: x = visited[next_] count = (K - (x - 1)) % (i + 1 - x) + x print(route[count]) exit() visi...
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
413,123
413,124
u628335443
python
p02684
import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate def read_ints(): return list(map(int, read().split())) def read_a_int(): return int(read()) def read_tuple(H): ''' H is number of rows ''' ret = [] for _ in range(H): ret.append(tuple...
import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate def read_ints(): return list(map(int, read().split())) def read_a_int(): return int(read()) def read_tuple(H): ''' H is number of rows ''' ret = [] for _ in range(H): ret.append(tuple...
[ "expression.operation.binary.add" ]
413,125
413,126
u179169725
python
p02684
from collections import Counter N, K = map(int,input().split()) A = list(map(int,input().split())) i = k = 0 B = [1] while k <= 10 ** 6: i = A[i] - 1 B.append(i + 1) k += 1 S = Counter(B) idx = S.most_common(1)[0][0] i = k = cnt = 0 k_s = None while k < 10 ** 6: if B[k] == idx and cnt == 1: k_s ...
from collections import Counter N, K = map(int,input().split()) A = list(map(int,input().split())) i = k = 0 B = [1] while k <= 10 ** 6: i = A[i] - 1 B.append(i + 1) k += 1 S = Counter(B) idx = S.most_common(1)[0][0] i = k = cnt = 0 k_s = None while k < 10 ** 6: if B[k] == idx and cnt == 1: k_s ...
[ "control_flow.branch.if.condition.change" ]
413,133
413,134
u882323840
python
p02684
n,k = map(int,input().split()) a = list(map(int,input().split())) for i in range(n): a[i] -= 1 visited = [-1] * n now = 0 for i in range(k+1): if visited[now] != -1: #訪れたことがあるか loop = i - visited[now] #ループの大きさ k = (k-(i-loop)) % loop for _ in range(k): now...
n,k = map(int,input().split()) a = list(map(int,input().split())) for i in range(n): a[i] -= 1 visited = [-1] * n now = 0 for i in range(k): if visited[now] != -1:#訪れたことがあるか loop = i - visited[now] #ループの大きさ k = (k-(i-loop)) % loop for _ in range(k): now = a[...
[ "expression.operation.binary.remove" ]
413,171
413,172
u883040023
python
p02684
import sys input = sys.stdin.readline def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) B = [1] a = 1 check = [0] * len(A) while True: a = A[a - 1] if check[a - 1] == 1: x = B.index(a) roop = B[x:] print(roop[(K ...
import sys input = sys.stdin.readline def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) B = [1] a = 1 check = [0] * len(A) while True: a = A[a - 1] if check[a - 1] == 1: x = B.index(a) roop = B[x:] print(roop[(K ...
[ "call.add" ]
413,173
413,174
u364693468
python
p02684
import sys input = sys.stdin.readline def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) B = [1] a = 1 check = [0] * len(A) while True: a = A[a - 1] if check[a - 1] == 1: x = B.index(a) roop = B[x:] print(roop[(K ...
import sys input = sys.stdin.readline def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) B = [1] a = 1 check = [0] * len(A) while True: a = A[a - 1] if check[a - 1] == 1: x = B.index(a) roop = B[x:] print(roop[(K ...
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "call.add" ]
413,175
413,174
u364693468
python
p02684
n, k = map(int, input().split()) lst = [int(i) for i in input().split()] tele_lst = [] town_set = set() town = 1 while True: if town not in town_set: tele_lst.append(town) town_set.add(town) else: break town = lst[town - 1] ind = tele_lst.index(town) length = len(town_set) circle = length - ind #prin...
n, k = map(int, input().split()) lst = [int(i) for i in input().split()] tele_lst = [] town_set = set() town = 1 while True: if town not in town_set: tele_lst.append(town) town_set.add(town) else: break town = lst[town - 1] ind = tele_lst.index(town) length = len(town_set) circle = length - ind #prin...
[ "assignment.value.change", "identifier.change" ]
413,178
413,179
u179376941
python
p02684
# カウントと踏破フラグをもっておくと二度目の踏破でループの長さが分かりそう n, k = map(int, input().split()) a = list(map(lambda x: int(x) - 1, input().split())) count_arr = [0] * n count = 0 now = 0 loop_length = -1 while True: if count == k: print(a[now] + 1) exit() if count_arr[now] != 0: loop_length = count - count_arr...
# カウントと踏破フラグをもっておくと二度目の踏破でループの長さが分かりそう n, k = map(int, input().split()) a = list(map(lambda x: int(x) - 1, input().split())) count_arr = [0] * n count = 0 now = 0 loop_length = -1 while True: if count == k: print(now + 1) exit() if count_arr[now] != 0: loop_length = count - count_arr[n...
[ "call.arguments.change" ]
413,180
413,181
u445624660
python
p02684
f=lambda:map(int,input().split()) n,k=f() a=list(f()) lv=[-1]*n lv[0]=0 p=0 for i in range(n): t=a[p]-1 if lv[t]>=0: l,r=lv[t],i+1 break lv[t]=i+1 p=t print(lv.index(l+(k-l)%(r-l))+1)
f=lambda:map(int,input().split()) n,k=f() a=list(f()) lv=[-1]*n lv[0]=0 p=0 for i in range(n): t=a[p]-1 if lv[t]>=0: l,r=lv[t],i+1 break lv[t]=i+1 p=t print(lv.index(l+(k-l)%(r-l) if k>l else k)+1)
[]
413,186
413,187
u133936772
python
p02684
n, k = map(int,input().split()) f = [int(x)-1 for x in input().split()] def tortoise_and_hare(s,f): tortoise = f[s] hare = f[f[s]] while tortoise != hare: tortoise = f[tortoise] hare = f[f[hare]] rho = 0 tortoise = s while tortoise != hare: tortoise = f[tortoise] ...
n, k = map(int,input().split()) f = [int(x)-1 for x in input().split()] def tortoise_and_hare(s,f): tortoise = f[s] hare = f[f[s]] while tortoise != hare: tortoise = f[tortoise] hare = f[f[hare]] rho = 0 tortoise = s while tortoise != hare: tortoise = f[tortoise] ...
[ "call.remove" ]
413,191
413,192
u100858029
python
p02684
N, K = map(int, input().split()) A = list(map(lambda x: x - 1, map(int, input().split()))) print(A) current = 0 memo = { 0: 0 } for i in range(1, K + 1): current = A[current] if current in memo: # loop length length = i - memo[current] tmp = (K - memo[current]) % length # pri...
N, K = map(int, input().split()) A = list(map(lambda x: x - 1, map(int, input().split()))) current = 0 memo = { 0: 0 } for i in range(1, K + 1): current = A[current] if current in memo: # loop length length = i - memo[current] tmp = (K - memo[current]) % length for j in range...
[ "call.remove" ]
413,212
413,213
u850390157
python
p02684
N,K = map(int,input().split()) cc = list(map(int,input().split())) memo = [] aa = ['.']*N a = 1 while aa[a-1] == '.': memo.append(a) aa[a-1] = 'v' a = cc[a-1] if len(memo)>K: print(aa[K]) else: b = memo.index(a) m = len(memo)-b mm = (K-b) % m del memo[:b] print(memo[mm])
N,K = map(int,input().split()) cc = list(map(int,input().split())) memo = [] aa = ['.']*N a = 1 while aa[a-1] == '.': memo.append(a) aa[a-1] = 'v' a = cc[a-1] if len(memo)>K: print(memo[K]) else: b = memo.index(a) m = len(memo)-b mm = (K-b) % m del memo[:b] print(memo[mm])
[ "identifier.change", "call.arguments.change", "io.output.change" ]
413,219
413,220
u089925107
python
p02684
n, k = map(int, input().split()) a = list(map(lambda x: int(x) - 1, input().split())) ls = [-1] * n now = 0 cnt = 0 path = [] while 1: if ls[now] != -1: b = ls[now] break ls[now] = cnt path.append(now) now = a[now] cnt += 1 loop = path[b:] if k <= b: print(path[k]) else: pri...
n, k = map(int, input().split()) a = list(map(lambda x: int(x) - 1, input().split())) ls = [-1] * n now = 0 cnt = 0 path = [] while 1: if ls[now] != -1: b = ls[now] break ls[now] = cnt path.append(now) now = a[now] cnt += 1 loop = path[b:] if k <= b: print(path[k] + 1) else: ...
[ "expression.operation.binary.add" ]
413,222
413,223
u823391732
python