Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02675 (python)

Fixed submission:
N = int(input()[-1])

if N in [2,4,5,7,9]:
  print("hon")
elif N in [0,1,6,8]:
  print("pon")
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
N = int(input()[:-1])

if N in [2,4,5,7,9]:
  print("hon")
elif N in [0,1,6,8]:
  print("pon")
else:
  print("bon")
Problem p02713 (python)

Fixed submission:
N = int(input())

import itertools
h = itertools.combinations_with_replacement(list(range(1,N+1)), 3)

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans = 0
for n1, n2, n3 in h:
  #print("{} {} {}".format(n1,n2,n3))
  if n1 == n2 == n3:
    ans += gcd(n1,n2,n3)
  elif n1 == n2 or n1 == n3 or n2 == n3:
    ans += gcd(n1,n2,n3)*3
  else:
    ans += gcd(n1,n2,n3)*6
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())

h = itertools.combinations_with_replacement(list(range(1,N+1)), 3)

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans = 0
for n1, n2, n3 in h:
  if n1 == n2 == n3:
    ans += gcd(n1,n2,n3)
  else:
    ans += gcd(n1,n2,n3)*3
print(ans)
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
 
cor = 0
penalty = 0
dic_penalty = {}
dic = {}
for i in range(M):
  p, S = input().split()
  p = int(p)
  if p not in dic:
    dic[p] = "_"
    dic_penalty[p] = 0
  if (S == "AC") & (dic[p] != "AC"):
    dic[p] = "AC"
    cor = cor+1
    penalty = penalty + dic_penalty[p]
    continue
  elif (S == "WA") & (dic[p] != "AC"):
    dic_penalty[p] = dic_penalty[p] + 1
    
print("{} {}".format(cor, penalty))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

cor = 0
penalty = 0
dic = {}
for i in range(M):
  p, S = input().split()
  p = int(p)
  if p not in dic:
    dic[p] = "_"
  if (S == "AC") & (dic[p] != "AC"):
    dic[p] = "AC"
    cor = cor+1
    continue
  elif (S == "WA") & (dic[p] != "AC"):
    penalty = penalty + 1
    
print("{} {}"penalty)
Problem p02865 (python)

Fixed submission:
n = int(input())

print((n - (n+1)%2)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())

print(n - (n+1)%2)//2
Problem p02885 (python)

Fixed submission:
x,y = map(int, input().split())
a = x - y*2
if a > 0:
  print(a)
else:
  print("0")

Buggy submission (verdict: Runtime Error):
a = int(input()) - int(input())*2
if a > 0:
  print(a)
else:
  print("0")

Buggy submission (verdict: Runtime Error):
a = int(input())
if int(input()) - int(input())*2 > 0:
  print(int(input()) - int(input())*2)
else:
  print("0")
Problem p03067 (python)

Fixed submission:
A, B, C = map(int, input().split())

if A < C < B:
  print("Yes")
elif B < C < A:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
ss = sorted(s)
ssr = sorted(s, reverse=True)

if s=ss or s==ssr:
  print("No")
else:
  print("Yes")
Problem p03086 (python)

Fixed submission:
S = input()
n = len(S)

flag = 0
for i in reversed(range(0,n+1)):
  for j in range(0,n-i+1):
    s = S[j:j+i].replace("A", "").replace("C", "").replace("G","").replace("T","")
    #print("+", s, "+", len(s))
    if len(s) == 0:
      flag=1
      break
  if flag==1:
    break

print(i)

Buggy submission (verdict: Runtime Error):
S = list(input())
n = len(S)

for i in reversed(range(0,n)):
  for j in range(0,n-i+1):
    s = S[j:j+i].strip("A").strip("C").strip("G").strip("T")
    if s == "":
      break

print(i)
Problem p03110 (python)

Fixed submission:
N = int(input())

ans = 0
for n in range(N):
  x, t = input().split()
  if t == "BTC":
    ans += float(x)*380000.0
  else:
    ans += float(x)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())

ans = 0
for n in range(N):
  x, t = input().split()
  if t == "BTC":
    ans += x*380000.0
  else:
    ans += x
print(ans)
Problem p03145 (python)

Fixed submission:
A, B, C = map(int, input().split())
print(A*B//2)

Buggy submission (verdict: Runtime Error):
print(int(input())*int(input())//2)
Problem p03155 (python)

Fixed submission:
N = int(input())
H = int(input())
W = int(input())
 
print((N-H+1)*(N-W+1))

Buggy submission (verdict: Runtime Error):
N, H, W = map(int, input().split())

print((N-H+1)*(N-W+1))
Problem p03238 (python)

Fixed submission:
if input()=="1":
  print("Hello World")
else:
  print(int(input()) + int(input()))

Buggy submission (verdict: Runtime Error):
if input()==1:
  print("Hello World")
else:
  print(int(input()) + int(input()))
Problem p03285 (python)

Fixed submission:
X = int(input())

A_ = X//4+1
B_ = X//7+1

ans = 0
for a in range(A_):
  for b in range(B_):
    c = 4*a + 7*b
    if c > X:
      break
    if c == X:
      ans = 1
      break
if ans == 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
X = int(input())

A_ = X//4+1
B_ = X//7+1

ans - 0
for a in range(A_):
  for b in range(B_):
    c = 4*a + 7*b
    if c > X:
      break
    if c == X:
      ans = 1
      break
if ans == 1:
  print("Yes")
else:
  print("No")
Problem p03288 (python)

Fixed submission:
x = int(input())

if x < 1200:
  print("ABC")
elif x < 2800:
  print("ARC")
else:
  print("AGC")

Buggy submission (verdict: Runtime Error):
Vx = int(input())

if x < 1200:
  print("ABC")
elif x < 2800:
  print("ARC")
else:
  print("AGC")
Problem p03308 (python)

Fixed submission:
N = int(input())
S = list(map(int, input().split()))

print(max(S) - min(S))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = map(int, input().split())

print(max(S) - min(S))
Problem p03328 (python)

Fixed submission:
A, B = map(int, input().split())

A_x = (B-A)-1

print(sum(list(range(A_x+1)))-A)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input())

A_x = (B-A)-1

print(sum(list(range(A_x+1)))-A)
Problem p03359 (python)

Fixed submission:
month, day = map(int, input().split())

ans = month-1 if month > day else month

print(ans)

Buggy submission (verdict: Runtime Error):
month, day = map(int, input().split())

ans = month-1 if month > day else month

if month < day:
  

print(ans)
Problem p03369 (python)

Fixed submission:
print(700 + input().count("o")*100)

Buggy submission (verdict: Runtime Error):
print(700 + input().count()*100)
Problem p03437 (python)

Fixed submission:
X , Y = map(int, input().split())

if X%Y == 0:
  print(-1)
else:
  i = 2
  while True:
    if X*i > 10**18:
      print(-1)
      break
    if X*i%Y != 0:
      print(X*i)
      break
    i += 1

Buggy submission (verdict: Runtime Error):
X , Y = map(int, input()split())

if X%Y == 0:
  print(-1)
else:
  i = 1
  while True:
    if X*i%Y != 0:
      print(X*i)
      break
Problem p03456 (python)

Fixed submission:
import math
x = int("".join(input().split()))

if int(math.sqrt(x))**2 == x:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import math
x = int("".join([input(), input()]))

if int(math.sqrt(x))**2 == x:
  print("Yes")
else:
  print("No")
Problem p03469 (python)

Fixed submission:
s = input()
s = s.replace("2017","2018")
 
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
s[0:3] = "2018"

print(s)
Problem p03502 (python)

Fixed submission:
x = input()

xi = int(x)
xs = sum([ int(xx) for xx in x])

if xi%xs==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = input()

xi = int(x)
xs = sum(list(x))

if xi%xs==0:
  print("Yes")
else:
  print("No")
Problem p03543 (python)

Fixed submission:
s = input()

if s[0] == s[1] == s[2]:
  print("Yes")
elif s[3] == s[1] == s[2]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import collections

s = input()

c = collections.Counter(s)

if len(c) == 1:
  print("Yes")
elif len(c) == 2:
  if (c.values()[0] == 1) | (c.values()[0] == 3):
    print("Yes")
  else:
    print("No")
else:
  print("No")
Problem p03598 (python)

Fixed submission:
N = int(input())
K = int(input())
l = list(map(int, input().split()))

ans = 0
for i in l:
  ans += min([K-i, i])*2
  
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
l = list(map(int, input().split()))

ans = 0
for i in l:
  ans += min([K-l, l])*2
  
print(ans)
Problem p03624 (python)

Fixed submission:
s = set(list(input()))
b = set(list("abcdefghijklmnopqrstuvwxyz"))

l = sorted(list(b-s))

if l == []:
  print("None")
else:
  print(sorted(list(b-s))[0])

Buggy submission (verdict: Runtime Error):
s = set(list(input()))
b = set(list("abcdefghijklmnopqrstuvwxyz"))

print(sorted(list(b-s))[0])
Problem p03632 (python)

Fixed submission:
A, B, C, D = map(int, input().split())

if A<C:
  if B-C < 0:
    print(0)
  else:
    if D-B < 0:
      x = B-D
    else:
      x = 0
    print(B-C-x)
else:
  if D-A < 0:
    print(0)
  else:
    if B-D < 0:
      x = D-B
    else:
      x = 0
    print(D-A-x)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

if A<C:
  if B-C < 0:
    print(0)
  else:
    if D-B < 0:
      x = B-D
    else:
      x = 0
    print(B-C-x)
else:
  if D-A < 0:
    print(0)
  else:
    if B-D < 0:
      x = D-B
    print(D-A-x)
Problem p03720 (python)

Fixed submission:
N, M = map(int, input().split())

dic = { n:0for n in range(N)}
for m in range(M):
  a,b = map(int,input().split())
  dic[a-1] += 1
  dic[b-1] += 1

for n in range(N):
  print(dic[n])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

dic = { m:0for m in range(M)}
for n in range(N):
  a,b = map(int,input().split())
  dic[a-1] += 1
  dic[b-1] += 1

for m in range(M):
  print(dic[m])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

dic = { m:0for m in range(M)}
for n in range(N):
  a,b = map(int,input().split())
  dic[a-1] += 1
  dic[b-1] += 1

for m in range(M):
  print(dic[m])
Problem p03722 (python)

Fixed submission:
import sys

INF = float('inf')

def Bellmanford(n, edges, r): #r: 始点
    d = [INF] * n
    d[r] = 0
    
    for i in range(n):
        for (u, v, c) in edges:
            if d[u] != INF and d[u] + c < d[v]:
                d[v] = d[u] + c
                if i == n-1 and v == n-1:
                    return 'inf'
    
    return -d[n-1]
    

N, M = map(int, sys.stdin.readline().split())
Edges = [None] * M

for i in range(M):
    ai, bi, ci = map(int, sys.stdin.readline().split())
    Edges[i] = (ai-1, bi-1, -ci)
    
ans = Bellmanford(N, Edges, 0)

print(ans)

Buggy submission (verdict: Runtime Error):
def BellmanFord(sv, ev, cv, num_v, source):
  #グラフの初期化
  inf=float("inf")
  dist=[inf for i in range(num_v)]
  dist[source-1]=0
  
  #辺の緩和
  for i in range(num_v):
    for s,e,c in zip(sv, ev, cv):
      if dist[0] != inf and dist[e-1] > dist[s-1] + c:
        dist[e-1] = dist[s-1] + c
        if i == n-1 and e == n-1:
          return "inf"
  
  return dist[-1]*-1

N, M = map(int, input().split())
a, b, c = [], [], []
for i in range(M):
  aa, bb, cc = map(int, input().split())
  a.append(aa)
  b.append(bb)
  c.append(cc*-1)

print(BellmanFord(a, b, c, N, 1))

Buggy submission (verdict: Runtime Error):
def BellmanFord(sv, ev, cv, num_v, source):
  #グラフの初期化
  inf=float("inf")
  dist=[inf for i in range(num_v)]
  dist[source-1]=0
  
  #辺の緩和
  for i in range(num_v):
    for s,e,c in zip(sv, ev, cv):
      if dist[0] != inf and dist[e-1] > dist[s-1] + c:
        dist[e-1] = dist[s-1] + c
        if i==num_v-1: return "inf"
  
  return dist[num_v-1]*-1

N, M = map(int, input().split())
a, b, c = [], [], []
for i in range(M):
  aa, bb, cc = map(int, input().split())
  a.append(aa)
  b.append(bb)
  c.append(cc*-1)

print(BellmanFord(a, b, c, N, 1)[N-1]*-1)

Buggy submission (verdict: Runtime Error):
def BellmanFord(sv, ev, cv, num_v, source):
  #グラフの初期化
  inf=float("inf")
  dist=[inf for i in range(num_v)]
  dist[source-1]=0
  
  #辺の緩和
  for i in range(num_v):
    for s,e,c in zip(sv, ev, cv):
      if dist[0] != inf and dist[e-1] > dist[s-1] + c:
        dist[e-1] = dist[s-1] + c
        if i==num_v-1: return 1
  
  return dist

N, M = map(int, input().split())
a, b, c = [], [], []
for i in range(M):
  aa, bb, cc = map(int, input().split())
  a.append(aa)
  b.append(bb)
  c.append(cc*-1)

print(BellmanFord(a, b, c, N, 1)[N-1]*-1)

Buggy submission (verdict: Runtime Error):
def BellmanFord(sv, ev, cv, num_v, source):
  #グラフの初期化
  inf=float("inf")
  dist=[inf for i in range(num_v)]
  dist[source-1]=0
  
  #辺の緩和
  for i in range(num_v):
    for s,e,c in zip(sv, ev, cv):
      if dist[0] != inf and dist[e-1] > dist[s-1] + c:
        dist[e-1] = dist[s-1] + c
        if i==num_v-1: return -1
  
  return dist

N, M = map(int, input().split())
a, b, c = [], [], []
for i in range(M):
  aa, bb, cc = map(int, input().split())
  a.append(aa)
  b.append(bb)
  c.append(cc*-1)

print(BellmanFord(a, b, c, N, 1)[N-1]*-1)
Problem p03844 (python)

Fixed submission:
x1, op, x2 = input().split()
 
if op == "+":
  print(int(x1)+int(x2))
else:
  print(int(x1)-int(x2))

Buggy submission (verdict: Runtime Error):
x1, op, x2 = input().split()

if op == "+":
  print(x1+x2)
else:
  print(x1-x2)
Problem p03845 (python)

Fixed submission:
N = int(input())
Ts = list(map(int, input().split()))
M = int(input())
base_ = sum(Ts)

for m in range(M):
  p, t = map(int, input().split())
  #print(Ts[p-1])
  #print(t)
  #print((Ts[p-1]-t))
  print(base_ - (Ts[p-1]-t))

Buggy submission (verdict: Runtime Error):
N = int(input())
Ts = list(map(int, input().split()))
M = int(input())
base_ = sum(Ts)

for m in range(1,M+1):
  p, t = map(int, input().split())
  print(base_ - (Ts[p]-t))
Problem p03919 (python)

Fixed submission:
H, W = map(int, input().split())

for i in range(H):
  s = input().split()
  if "snuke" in s:
    row = i+1
    col = 65+s.index('snuke')
    break
print("{}{}".format(chr(col), row))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())

for i in range(H):
  s = input().split()
  if W != 1:
    if len(set(s)) == 2:
      row = i+1
      col = 65+s.index('snuke')
      break
  else:
    if s == ["snuke"]:
      row = i+1
      col = 65
print("{}{}".format(chr(col), row))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())

for i in range(H):
  s = input().split()
  if len(set(s)) == 2:
    row = i+1
    col = 65+s.index('snuke')
    break
print("{}{}".format(chr(col), row))
Problem p03944 (python)

Fixed submission:
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))

Buggy submission (verdict: Runtime Error):
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))

Buggy submission (verdict: Runtime Error):
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))

Buggy submission (verdict: Runtime Error):
import numpy as np

W, H, N = map(int, input().split())
l = np.zeros((H,W))

for i in range(N):
  x, y, a = map(int, input().split())
  if a==1:
    l[:,:x] = 1
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
    
print(H*W-int(l.sum().sum()))
Problem p03992 (python)

Fixed submission:
s = list(input())
print("".join((s[:4] + [" "] + s[4:])))

Buggy submission (verdict: Runtime Error):
s = list(input())
print("".join(s[:4] + [" "] + s[4:])
Problem p02724 (python)

Fixed submission:
X = int(input())
 
cnt = X//500
new_X = X - cnt * 500
ncnt = new_X // 5
print(cnt*1000 + ncnt*5)

Buggy submission (verdict: Runtime Error):
X = int(input())

500_cnt = X//500
new_X = X - 500_cnt * 500
5_cnt = new_X // 5
print(500_cnt*1000 + 5_cnt*5)
Problem p02760 (python)

Fixed submission:
import sys
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
N = int(input())
b_list=[]
for i in range(N):
  b_list.append(int(input()))
 
for i in b_list:
  A1 = [x if x != i else -1 for x in A1]
  A2 = [y if y != i else -1 for y in A2]
  A3 = [z if z != i else -1 for z in A3]
 
if sum(A1)==-3 or sum(A2)==-3 or sum(A3)==-3:
  print('Yes')
  sys.exit()
for t in range(3):
  if A1[t]+A2[t]+A3[t] == -3:
    print('Yes')
    sys.exit()
if A1[0]+A2[1]+A3[2] == -3 or A1[2]+A2[1]+A3[0] == -3:
  print('Yes')
  sys.exit()
print('No')

Buggy submission (verdict: Runtime Error):
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
N = int(input())
b_list=[]
for i in range(N):
  b_list.append(int(input))

for i in b_list:
  A1 = [x in A1 if x != i else -1]
  A2 = [y in A2 if y != i else -1]
  A3 = [z in A3 if z != i else -1]

if sum(A1)==-3 or sum(A2)==-3 or sum(A3)==-3:
  print('Yes')
  exit()
for t in range(3)
  if A1[t]+A2[t]+A3[t] == -3:
    print('Yes')
    exit()
if A1[0]+A2[1]+A3[2] == -3 or A1[2]+A2[1]+A3[0] == -3:
  print('Yes')
  exit()
print('No')
Problem p02772 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

for i in A:
  if i%2 == 0 and i%3 != 0 and i%5 != 0:
    print('DENIED')
    exit()
print('APPROVED')

Buggy submission (verdict: Runtime Error):
N = int(input())
num_list = list(map(int, input().split()))
 
a=0
for i in num_list:
  if i%2==0 and (i%3!=0 and i%5!=0):
  	print('DENIED')
    exit()

print('APPROVED')
Problem p02789 (python)

Fixed submission:
N,M = input().split()
if N == M:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int(),input().split())
print('Yes' if N==M else 'No')

Buggy submission (verdict: Runtime Error):
N,M = map(int(),input().split())
 
if N == M:
  print('Yes')
  
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int(),input().split( ))

if N == M:
  print('Yes')
  
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
if N == M:
  print("Yes")
  
 else:
  print("No")
Problem p02791 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))  

min = 0
cnt = 0
for i in range(N):
  if i == 0:
    cnt += 1
    min = A[i]
    continue
  if A[i] <= min:
    cnt += 1
    min = A[i]

print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))  

cnt = 0
for i in N:
  if all([A[v] >= A[i] for v in i]): 
    cnt = cnt +1

print(cnt)
Problem p03547 (python)

Fixed submission:
X,Y =input().split()
if X>Y:
  print(">")
elif X<Y:
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
X,Y = map(int, input().split())
if X>Y:
  print(">")
elif X<Y:
  print("<")
else:
  print("=")
Problem p02684 (python)

Fixed submission:
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

N, K = LI()
A = LI()

tel = [-1] * N
flag = True
i = 0
time = 1
while True:
    # print(i, end=" ")
    if time == K:
        print(A[i])
        flag = False
        break
    
    if tel[i] == -1:
        tel[i] = [time, A[i]-1]
        i = A[i]-1
    else:
        # i = A[i]-1
        break
        # pass
    
    time += 1
    # print(time, tel)
# print()
# print(time-1)
# print(time - tel[i][0])
# print((K - (time-1)) % (time - tel[i][0]))

if flag:
    for _ in range((K - (time-1)) % (time - tel[i][0])):
        i = A[i]-1

    print(i+1)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

N, K = LI()
A = LI()

tel = [-1] * N

i = 0
time = 1
while True:
    # print(i, end=" ")
    if time == K:
        print(A[i])
        break
    
    if tel[i] == -1:
        tel[i] = [time, A[i]-1]
        i = A[i]-1
    else:
        # i = A[i]-1
        break
    
    time += 1
    # print(time, tel)
# print()
# print(time-1)
# print(time - tel[i][0])
# print((K - (time-1)) % (time - tel[i][0]))

for _ in range((K - (time-1)) % (time - tel[i][0])):
    i = A[i]-1

print(i+1)
Problem p02705 (python)

Fixed submission:
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

R = I()
print(R*2*math.pi)

Buggy submission (verdict: Runtime Error):
aa
Problem p02741 (python)

Fixed submission:
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = I()
print(A[K - 1])

Buggy submission (verdict: Runtime Error):
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = I()
print(A[K - 1])
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = I()
print(A[K - 1])