Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
list=filter(lambda x:x%2==1,range(1,n+1))
print(len(list))


Fixed submission:
n=int(input())
if n<10:
  print(n)
elif n<100:
  print(9)
elif n<1000:
  print(n-90)
elif n<10000:
  print(909)
elif n<100000:
  print(n-9999+909)
else:
  print(90909)

Buggy python submission (verdict: Runtime Error):
n=int(input())
list=filter(lambda x:x%2==1,range(1,n+1))
print(list.count())

Fixed submission:
n=int(input())
if n<10:
  print(n)
elif n<100:
  print(9)
elif n<1000:
  print(n-90)
elif n<10000:
  print(909)
elif n<100000:
  print(n-9999+909)
else:
  print(90909)
Buggy python submission (verdict: Runtime Error):
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
c=0
for i in range(N-1):
    for j in range(i+1,N):
        c += (sum((a-b)**2) for a,b in zip(X[i],X[j]))**0.5.is_integer()
print(c)

Fixed submission:
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
c=0
for i in range(N-1):
    for j in range(i+1,N):
        c += (sum((a-b)**2 for a,b in zip(X[i],X[j]))**0.5).is_integer()
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d=map(int,input().split())
ans = 0
for i in range(a,b+1):
  if i%c!=0 and i%d!=0:
    ans += 1
print(ans)

Fixed submission:
a,b,c,d=map(int,input().split())
C=b//c
D=b//d
import fractions
CD=b//(c*d//(fractions.gcd(c,d)))
B=b-C-D+CD
C_=(a-1)//c
D_=(a-1)//d
C_D_=(a-1)//(c*d//(fractions.gcd(c,d)))
A=a-1-C_-D_+C_D_
print(B-A)
Buggy python submission (verdict: Runtime Error):
n=input()
a=[input().split() + [i+1] for i in range(n)]
for i in range(n):
  a[i][1]= -int(a[i][1])
a.sort()
for i in range(n):
  print(a[i][2])

Fixed submission:
n=int(input())
a=[input().split() + [i+1] for i in range(n)]
for i in range(n):
  a[i][1]= -int(a[i][1])
a.sort()
for i in range(n):
  print(a[i][2])
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
print('Yay!' if (e-a)<=k else ':(')


Fixed submission:
a=int(input())
b=input()
c=input()
d=input()
e=int(input())
k=int(input())
print('Yay!' if (e-a)<=k else ':(')

Buggy python submission (verdict: Runtime Error):
a=input()
input()
input()
input()
e=input()
k=input()
print('Yay!' if (e-a)<=k else ':(')

Fixed submission:
a=int(input())
b=input()
c=input()
d=input()
e=int(input())
k=int(input())
print('Yay!' if (e-a)<=k else ':(')
Buggy python submission (verdict: Runtime Error):
b=input()
if b='A':
  print('T')
elif b='T':
  print('A')
elif b='G':
  print('C')
else:
  print('G')

Fixed submission:
b=input()
if b=='A':
  print('T')
elif b=='T':
  print('A')
elif b=='G':
  print('C')
else:
  print('G')
Buggy python submission (verdict: Runtime Error):
s=input()
L=['A','T','G','C']
ans=0
M=0
for i in range(s):
  if s[i] in L:
    ans += 1
  else:
    if ans > M:
      M = ans
    ans = 0
print(M)

Fixed submission:
s=input()
L=['A','T','G','C']
ans=0
M=0
for i in range(len(s)):
  if s[i] in L:
    ans += 1
  else:
      if ans > M:
          M = ans
          ans = 0
if ans > M:
    M = ans
    ans = 0
print(M)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
ans = 0
for i in range(q):
  l,r = map(int,input().split())
  m = s[l-1:r]
  for j in range(r-l):
      if m[j]=='A' and m[j+1]=='C':
          ans += 1
  print(ans)
  ans = 0


Fixed submission:
from itertools import accumulate


N,Q = list(map(int,input().split()))
S = input()
A = [list(map(int,input().split())) for i in range(Q)]

flg = []
for i in range(N-1):
    tmp_s = S[i:i+2]
    if tmp_s == 'AC':
        flg.append(1)
    else:
        flg.append(0)

flg2 = [0] + flg
flg2 = list(accumulate(flg2))

for a in A:
    print(flg2[a[1]-1] - flg2[a[0]-1])
Buggy python submission (verdict: Runtime Error):
input()
x=sum(input())
y=max(input())
print(x-y//2)

Fixed submission:
n=int(input())
p=[int(input()) for i in range(n)]
print(sum(p)-max(p)//2)
Buggy python submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=map(int,input().split())
x=100000
ans=0
for i in h:
  if abs(t-i*0.006-a)<x:
    ans=index(i)
print(ans)


Fixed submission:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
min = 1000
for i in range(n):
  T = t - h[i] * 0.006
  if abs(T-a) < min:
    min = abs(T-a)
    ans = i + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=input()
if n==1:
  print('Hello World')
else:
  a=input()
  b=input()
  print(a+b)

Fixed submission:
n=int(input())
if n==1:
  print('Hello World')
else:
  a=int(input())
  b=int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split())
ans=0
while i in a:
  while s in a:
    x=abs(s-i)
    if x>ans:
      ans=x
print(ans)

Fixed submission:
n=int(input())
a=sorted(map(int,input().split()))
print(a[-1]-a[0])
Buggy python submission (verdict: Runtime Error):
x = int(input())
c = 1
for b in range(2,x):
  for p in range(2,x):
    if b**p <= x:
      c = max(c,b**P)
    else:
      break
print(c)

Fixed submission:
x = int(input())
c = 1
for b in range(2,x):
  for p in range(2,x):
    if b**p <= x:
      c = max(c,b**p)
    else:
      break
print(c)
Buggy python submission (verdict: Runtime Error):
s=input()
print(700+100*s.count(o))

Fixed submission:
s=input()
print(700+100*s.count('o'))
Buggy python submission (verdict: Runtime Error):
for i in range(4):
  a,b,c,d=map(int,input().split())
print(min(a,b)+min(c,d))

Fixed submission:
a,b,c,d=[int(input()) for i in range(4)]
print(min(a,b)+min(c,d))
Buggy python submission (verdict: Runtime Error):
n=int(input())
li=map(int,input().split())
li=sorted(li)
A=0
B=0
for k in range(n//2):
  A += li[2*k]
  B += li[2*k+1]
if n % 2 ==1:
  A += li[n-1]
print(B-A)


Fixed submission:
n=int(input())
a=int(input())
print('Yes' if n%500<=a else 'No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split()))[::-1]
print(sum(a[::2])-sum(a[1::2]))

Fixed submission:
n=int(input())
li=map(int,input().split())
li=sorted(li)[::-1]
A=0
B=0
for k in range(n//2):
  A += li[2*k]
  B += li[2*k+1]
if n % 2 ==1:
  A += li[n-1]
print(A-B)

Buggy python submission (verdict: Runtime Error):
n=int(input())
li=sorted[int(input()) for i in range(n)]
A=0
B=0
for k in range(n//2):
  A += li[2*k]
  B += li[2*k+1]
if n % 2 ==1:
  A += li[n-1]
print(B-A)

Fixed submission:
n=int(input())
li=map(int,input().split())
li=sorted(li)[::-1]
A=0
B=0
for k in range(n//2):
  A += li[2*k]
  B += li[2*k+1]
if n % 2 ==1:
  A += li[n-1]
print(A-B)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if (a+b)>(c+d):
  print('Left')
elif (a+b)==(c+d):
  print('Balanced')
else:
  pritn('Right')

Fixed submission:
a,b,c,d=map(int,input().split())
if (a+b)>(c+d):
  print('Left')
elif (a+b)==(c+d):
  print('Balanced')
else:
  print('Right')
Buggy python submission (verdict: Runtime Error):
n=input()
print(n.count('1')

Fixed submission:
n=input()
print(n.count('1'))
Buggy python submission (verdict: Runtime Error):
def how_many_times(n):
  ans=0
  while n%2==0:
    n=n/2
    ans=ans+1
    return ans

n=int(input())
a=map(int,input().split())
print(min(map(how_many_times,a)))


Fixed submission:
def how_many_times(n):
  ans=0
  while n%2==0:
    n=n/2
    ans=ans+1
  return ans

n=int(input())
a=map(int,input().split())
print(min(map(how_many_times,a)))

Buggy python submission (verdict: Runtime Error):
def how_many_times(n):
  ans=0
  while n%2==0:
    n=n/2
    ans=ans+1
    return ans

n=int(input())
a=map(int,input().split())
print(min(map(how_many_times(n),a)))

Fixed submission:
def how_many_times(n):
  ans=0
  while n%2==0:
    n=n/2
    ans=ans+1
  return ans

n=int(input())
a=map(int,input().split())
print(min(map(how_many_times,a)))
Buggy python submission (verdict: Runtime Error):
n=map(int,input())
print('Yes' if sum(n)%n==0 else 'No')

Fixed submission:
n=input()
N=sum(list(map(int,n)))
print('Yes') if int(n)%N==0 else print('No')
Buggy python submission (verdict: Runtime Error):
x,y=input().split()
print('<' if x<y '=' if x==y else '>')

Fixed submission:
x,y=input().split()
print('<' if x<y else '=' if x==y else '>')
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(c if a==b else b if a==c else a if b==c)

Fixed submission:
a,b,c=map(int,input().split())
print(c if a==b else b if a==c else a)
Buggy python submission (verdict: Runtime Error):
a=int(input())
if 9 in a:
  print('Yes')
else:
  print('No')

Fixed submission:
a=input()
if '9' in a:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
print('A' if min(abs(a-x),abs(b-x)))==abs(a-x) else 'B')


Fixed submission:
x,a,b=map(int,input().split())
print('A' if min(abs(a-x),abs(b-x))==abs(a-x) else 'B')
Buggy python submission (verdict: Runtime Error):
N=input()
print("Yes" if N[0]=N[2] else "No")

Fixed submission:
N=input()
print("Yes" if N[0]==N[2] else "No")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=a-1
d=b-1
print(c*d)

Fixed submission:
a,b=map(int,input().split())
print((a-1)*(b-1))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=(a-1)
d=(b-1)
print(c*d)

Fixed submission:
a,b=map(int,input().split())
print((a-1)*(b-1))
Buggy python submission (verdict: Runtime Error):
s=input()
print(s[0]+len(s)+s[-1])

Fixed submission:
s=input()
print(s[0]+str(len(s)-2)+s[-1])
Buggy python submission (verdict: Runtime Error):
input()
x=map(int,input().split())
print(x[-1]-x[0])


Fixed submission:
input()
x=sorted(map(int,input().split()))
print(x[-1]-x[0])

Buggy python submission (verdict: Runtime Error):

x=map(int,input().split())
print(x[-1]-x[0])


Fixed submission:
input()
x=sorted(map(int,input().split()))
print(x[-1]-x[0])

Buggy python submission (verdict: Runtime Error):
n=input()
x=input().split()
print(x[-1]-x[0])


Fixed submission:
input()
x=sorted(map(int,input().split()))
print(x[-1]-x[0])

Buggy python submission (verdict: Runtime Error):
n=input()
x=input().split()
print(x.[-1]-x.[0])

Fixed submission:
input()
x=sorted(map(int,input().split()))
print(x[-1]-x[0])
Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
print('YES' if a[-1]=b[0] and b[-1]=c[0] else "NO")


Fixed submission:
a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else "NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(input())
print('YES' if a[-1]=b[0] and b[-1]=c[0] else "NO")

Fixed submission:
a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else "NO")
Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
print((a[0],b[0],c[0],sep='').upper())


Fixed submission:
a,b,c=input().split()
print((a[0]+b[0]+c[0]).upper())

Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
print((a[0],b[0],c[0],sep='').upper)

Fixed submission:
a,b,c=input().split()
print((a[0]+b[0]+c[0]).upper())
Buggy python submission (verdict: Runtime Error):
a=int(input())
import math
print(math.fractional(a))

Fixed submission:
a=int(input())
import math
print(math.factorial(a)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
x=input()
print('ABC' if x<1200 else 'ARC')

Fixed submission:
x=int(input())
print('ABC' if x<1200 else 'ARC')
Buggy python submission (verdict: Runtime Error):
a,b,c=input().split(,)
print(a,b,c)

Fixed submission:
a,b,c=input().split(',')
print(a,b,c)

Buggy python submission (verdict: Runtime Error):
a,b,c=input().split(,)
print(a,b,c)

Fixed submission:
a,b,c=input().split(',')
print(a,b,c)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0
for x in range(k+1):
  for y in range(k+1):
    if x+y+z<=s:
      ans+=1
print(ans)


Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range(k+1):
  for y in range(k+1):
    if s-k<=x+y<=s:
      ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0
for x in range(k+1):
  for y in range(k+1):
    if x+y+z<=s:
      ans+=1
print(ans)


Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range(k+1):
  for y in range(k+1):
    if s-k<=x+y<=s:
      ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z==s:
        ans+=1
print(ans)


Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range(k+1):
  for y in range(k+1):
    if s-k<=x+y<=s:
      ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,op,b=input().split()
if op = '+':
  print(int(a)+int(b))
else:
  print(int(a)-int(b))

Fixed submission:
a,op,b=input().split()
if op == '+':
  print(int(a)+int(b))
else:
  print(int(a)-int(b))
Buggy python submission (verdict: Time Limit Exceeded):
n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for i in range(n-1):
    while a[i] + a[i+1] > x:
        a[i+1] += -1
        ans += 1
print(ans)


Fixed submission:
n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
    if a[i] >= x:
        ans += a[i]-x
        a[i] = x
for j in range(n-1):
    if a[j] + a[j+1] >= x:
        d = a[j]+ a[j+1] - x
        ans += d
        a[j+1] -= d
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=sorted(map(int,input().split()))
print('Yes' if x+y==z else 'No')


Fixed submission:
a,b,c=sorted(map(int,input().split()))
print('Yes' if a+b==c else 'No')

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
x,y,z=sorted(a,b,c)
print('Yes' if x+y==z else 'No')


Fixed submission:
a,b,c=sorted(map(int,input().split()))
print('Yes' if a+b==c else 'No')

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
x,y,z=sorted(a,b,c)
print('Yes' if x+y=z else 'No')

Fixed submission:
a,b,c=sorted(map(int,input().split()))
print('Yes' if a+b==c else 'No')
Buggy python submission (verdict: Runtime Error):
S = {c:list(input()) for c in 'ABC'}
s = A
while S[s]:
  s=S[s].pop(0)
print(s)

Fixed submission:
S = {c:list(input()) for c in 'abc'}
s = 'a'
while S[s]:
  s=S[s].pop(0)
print(s.upper())
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)

b=[a[0],a[1]]
ans=a[0]
for i in range(2,n):
    cnt=0
    d=1
    for l in range(len(b)-1):
        if min(b[l],b[l+1])>cnt:
            d=l+1
            cnt=min(b[l],b[l+1])
    if min(b[0],b[-1])>cnt:
        b.append(a[i])    
        ans+=min(b[0],b[-1])
    else:
        b.insert(d,a[i])
        ans+=cnt
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
if n==2:
    exit(print(max(a)))
b=[a[0],a[1]]
ans=a[0]
a=a[1:]
from math import floor
for i in range(n-2):
    num=floor(i/2)
    ans+=a[num]
print(ans)
Buggy python submission (verdict: Runtime Error):
d=int(input())
for i in range(d):
   print(26%i+1)

Fixed submission:
d=int(input())
c=list(map(int,input().split()))
c_days=[0]*26

fir_ans=0
for i in range(d):
    s=list(map(int,input().split()))
    ss=sorted(s, reverse=False)
    for k in range(26):
        num=ss[k]
        n=s.index(num)
        if c_days[n]==0:

            fir_ans+=num
            continue 
    c_days[n]=i+1
    print(n+1)
    '''
    for l in range(26):
        los=c[l]*(i+1-c_days[l])
        fir_ans-=los
    print(fir_ans)
    '''
Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A,B=[0],[0]
for i in range(n):
    A.append(A[i]+a[i])
for i in range(m):
    B.append(B[i]+b[i])
ans,j=0,m
for i in range(n+1):
    if a[i]>k:
        break
    while b[j]>k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)        


Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A,B=[0],[0]
for i in range(n):
    A.append(A[i]+a[i])
for i in range(m):
    B.append(B[i]+b[i])
ans,j=0,m
for i in range(n+1):
    if A[i]>k:
        break
    while B[j]>k-A[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
for i in range(q):
    b,c=map(int,input().split())
    for l in range(n):
        if a[l]==b:
            a[l]=c
    print(sum(a))
            

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
ans=sum(a)
L=[0]*(10**5+1)
for i in range(n):
    L[a[i]]+=1
for i in range(q):
    b,c=map(int,input().split())
    num=L[b]
    L[b]=0
    L[c]+=num
    ans-=num*b
    ans+=num*c
    print(ans)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().solit())
if 2*x<=y and y%2==0 and 4*x>=y:
    print('Yes')
else:
    print('No')


Fixed submission:
x,y=map(int,input().split())
if 2*x<=y and y%2==0 and 4*x>=y:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
import sys
import numpy as np
a,b,h,m=map(int,input().split())
h=h*30+m*0.5
m=m*6
ma=max(h,m)
mi=min(h,m)
kakudo=abs(ma-mi)
if kakudo>180:
    kakudo=360-kakudo
elif kakudo == 0:
    print(abs(a-b))
    exit()
elif kakudo==180:
    print(a+b)
    exit()
c=math.cos(math.radians(kakudo))
#print(c)
ans=math.pow(a,2)+math.pow(b,2)-2*a*b*c
ans=math.sqrt(ans)
print(ans)

Fixed submission:
n=input()
if n[-1]=='3':
    print('bon')
elif n[-1]=='0' or n[-1]=='1' or n[-1]=='6' or n[-1]=='8':
    print('pon')
else:
    print('hon')

Buggy python submission (verdict: Runtime Error):
import math
a,b,h,m=map(int,input().split())
h=h*30+m*0.5
m=m*6
ma=max(h,m)
mi=min(h,m)
kakudo=abs(ma-mi)
if kakudo>180:
    kakudo-=180
elif kakudo ==0:
    print(abs(a-b))
    exit()
elif kakudo==180:
    print(a+b)
    exit()
#print(kakudo)
c=math.cos(math.radians(kakudo))
ans=a**2+b**2-2*a*b*c
ans=ans**0.5
print(ans)

Fixed submission:
n=input()
if n[-1]=='3':
    print('bon')
elif n[-1]=='0' or n[-1]=='1' or n[-1]=='6' or n[-1]=='8':
    print('pon')
else:
    print('hon')
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k=map(int,input().split())
ans=0
for i in range(k):
        if a>0:
                ans+=1
                a-=1
        elif b>0:
                b-=1
        elif c>0:
                ans-=1
                c-=1
print(ans)

Fixed submission:
a,b,c,k=map(int,input().split())
ans=0
if a-k>=0:
        print(k)
else:
        num=k-a
        if b-num>=0:
                print(a)
        else:
                num-=b
                print(a-num)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
now=0
l=[1]
ll=[]
for i in range(n*2):
    now=a[now]
    if now not in l:
        l.append(now)
    elif now in l and now not in ll:
        ll.append(now)
    else:
        break
    now-=1

b=len(l)
c=len(ll)
num=b-c
if k>num:
    k=(k-num)%c
    print(ll[k])
else:
    k=k%b
    print(l[k])


Fixed submission:
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:
    num=(k-t1)%t2
    print(l[t1+num])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
now=0
l=[1]
ll=[]
for i in range(n*2):
    now=a[now]
    if now not in l:
        l.append(now)
    elif now in l and now not in ll:
        ll.append(now)
    else:
        break
    now-=1

b=len(l)
c=len(ll)
num=b-c
if k>num:
    k=(k-num)%c
    print(ll[k])
else:
    k=k%b
    print(l[k])

Fixed submission:
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:
    num=(k-t1)%t2
    print(l[t1+num])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
now=0
l=[1]
ll=[]
for i in range(n*2):
    now=a[now]
    if now not in l:
        l.append(now)
    elif now in l and now not in ll:
        ll.append(now)
    else:
        break
    now-=1
num=len(l)-len(ll)
if k>num:
    k-=num
    k=k%len(ll)
    print(ll[k])
else:
    k=k%len(l)
    print(l[k])

Fixed submission:
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:
    num=(k-t1)%t2
    print(l[t1+num])
Buggy python submission (verdict: Runtime Error):
s=input()
if s=-'ARC':
    print('ABC')
else:
    print('ARC')

Fixed submission:
s=input()
if s=='ARC':
    print('ABC')
else:
    print('ARC')
Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
for i in range(-x,x):
    for l in range(-x,x):
        g=i**5
        g-=l**5
        if g==x:
            print('{} {}'.format(i,l))
            exit() 

Fixed submission:
x=int(input())
for i in range(-120,120):
    for l in range(-120,120):
        g=i**5
        g-=l**5
        if g==x:
            print('{} {}'.format(i,l))
            exit()
Buggy python submission (verdict: Time Limit Exceeded):

a,b,n=map(int,input().split())
m=0
for i in range(1,n+1):
    s=i/b
    num=int(a*s)
    num-=a*int(s)
    if num>=m:
        m=num
    
print(m)

Fixed submission:
a,b,n=map(int,input().split())
if b>n:
    print(int(a*n/b)-a*int(n/b))
else:
    print(int(a*(b-1)/b)-a*int((b-1)/b))

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n=map(int,input().split())
l=[i/b for i in range(1,n+1)]
m=[math.floor(a*s)-a*math.floor(s) for s in l]

print(max(m))

Fixed submission:
a,b,n=map(int,input().split())
if b>n:
    print(int(a*n/b)-a*int(n/b))
else:
    print(int(a*(b-1)/b)-a*int((b-1)/b))

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n=map(int,input().split())
m=0
for i in range(1,n+1):
    s=i/b
    num=math.floor(a*s)
    num-=a*math.floor(s)
    if num>=m:
        m=num
    
print(m)

Fixed submission:
a,b,n=map(int,input().split())
if b>n:
    print(int(a*n/b)-a*int(n/b))
else:
    print(int(a*(b-1)/b)-a*int((b-1)/b))
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n in 7:
    print('Yes')
else:
    print('No')



Fixed submission:
s=input()
num=s.count('7')
if num>0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
t=n%k
n=min(t,k)
print(n)

Fixed submission:
x,y,z=map(int,input().split())
print('{} {} {}'.format(z,x,y))
Buggy python submission (verdict: Runtime Error):
n=int(input())
num=round(n/1.08)
check=round(num*1.08)
if check==n
    print(num)
else:
    print(':(')

Fixed submission:
import math
n=int(input())
num=math.ceil(n/1.08)
check=int(num*1.08)
if check==n:
    print(num)
else:
    print(':(')