Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
S, W = input().split()
if int(S) =< int(W):
  print("safe")
else:
  print("unsafe")

Fixed submission:
S, W = input().split()
if int(S) <= int(W):
  print("unsafe")
else:
  print("safe")
Buggy python submission (verdict: Runtime Error):
N = input()
if "7" in N:
  print("Yes"):
else:
  print("No")

Fixed submission:
N = input()
if "7" in N:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
sum = 0
for i in range(1,K+1):
  for j in range(1, K+1):
    for k in range(1, K+1):
      sum += math.gcd(k, math.gcd(i, j))
print(sum)


Fixed submission:
from math import gcd

k = int(input())
sum = 0

for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            sum += gcd(c, gcd(a, b))
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
K = int(input())
sum = 0
for i in range(1,K+1):
  for j in range(1, K+1):
    for k in range(1, K+1):
      gcd = math.gcd(k, math.gcd(i, j))
      sum = sum + gcd
print(sum)

Fixed submission:
from math import gcd

k = int(input())
sum = 0

for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            sum += gcd(c, gcd(a, b))
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
K = int(input())
sum = 0
for i in range(1,K+1):
  for j in range(1, K+1):
    for k in range(1, K+1):
      gcd = reduce(math.gcd, (i,j,k))
      sum = sum + gcd
print(sum)

Fixed submission:
from math import gcd

k = int(input())
sum = 0

for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            sum += gcd(c, gcd(a, b))
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
K, N  = map(int,input().split())
List = list(map(int,input().split()))
d = []
for i in range(N):
  for j in range(N):
    x = min(abs(List[i]-List[j]), K-abs(List[i]-List[j]))
    d.append(x)
result = K - int(max(d))
print(result)

Fixed submission:
K, N  = map(int,input().split())
List = list(map(int,input().split()))
d = []
for i in range(1,N):
  x = min(abs(List[i]-List[i-1]), K-abs(List[i]-List[i-1]))
  d.append(x)
d.append(min(abs(List[N-1]-List[0]), K-abs(List[N-1]-List[0])))
result = K - int(max(d))
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K, N  = map(int,input().split())
List = list(map(int,input().split()))
d = []
for i in range(N):
  for j in range(N):
    x = min(abs(List[i]-List[j]), K-abs(List[i]-List[j]))
    d.append(x)
result = K - int(max(d))
print(result)

Fixed submission:
K, N  = map(int,input().split())
List = list(map(int,input().split()))
d = []
for i in range(1,N):
  x = min(abs(List[i]-List[i-1]), K-abs(List[i]-List[i-1]))
  d.append(x)
d.append(min(abs(List[N-1]-List[0]), K-abs(List[N-1]-List[0])))
result = K - int(max(d))
print(result)
Buggy python submission (verdict: Runtime Error):
S = input()
S2 = []
S3 = []
S4 = []
range1 = int((int(len(S))+1)/2)
range2 = int((int(len(S))-1)/2)
range3 = int((range2+1)/2)
range4 = int((int(len(S))+3)/2)
range5 = int((range4+1)/2)
isStrong = "Yes"
for i in S:
  S2.append(i)
  
for i in range(range2):
  S3.append(S2[i])
  
for i in range(range4-1,len(S)):
  S4.append(S2[i])
  
for i in range(range1):
  if S2[i]!=S2[-i-1]:
    isStrong = "No"

for i in range(range3):
  if S3[i]!=S3[-i-1]:
    isStrong = "No"

for i in range(range5):
  if S4[i]!=S4[-i-1]:
    isStrong = "No"
    
print(isStrong)

Fixed submission:
S = input()
S2 = []
S3 = []
S4 = []
range1 = int((int(len(S))+1)/2)
range2 = int((int(len(S))-1)/2)
range3 = int((range2+1)/2)
range4 = int((int(len(S))+3)/2)
range5 = int((range4+1)/2)
isStrong = "Yes"
for i in S:
  S2.append(i)
  
for i in range(range2):
  S3.append(S2[i])
  
for i in range(range4-1,len(S)):
  S4.append(S2[i])
  
for i in range(range1):
  if S2[i]!=S2[-i-1]:
    isStrong = "No"

for i in range(range3):
  if S3[i]!=S3[-i-1]:
    isStrong = "No"

for i in range(range5-1):
  if S4[i]!=S4[-i-1]:
    isStrong = "No"
    
print(isStrong)
Buggy python submission (verdict: Time Limit Exceeded):
import math
A,B,N = map(int, input().split())

def calc(x):
    y = math.floor(A * x / B) - A * math.floor(x / B)
    return y

max_v = 0
for x in range(min(B,N+1)):
    max_v = max(max_v, calc(x))

print(max_v)


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

def calc(x):
    y = math.floor(A * x / B) - A * math.floor(x / B)
    return y

max_v = 0

if N < B:
    max_v = calc(N)
else:
    max_v = calc(B-1)

# for x in range(N+1):
#     print(x,max_v) # x＝Bでさちる
#     max_v = max(max_v, calc(x))

print(max_v)

Buggy python submission (verdict: Time Limit Exceeded):
import math
A,B,N = map(int, input().split())

def calc(x):
    y = math.floor(A * x / B) - A * math.floor(x / B)
    return y

max_v = 0
for x in range(N+1):
    max_v = max(max_v, calc(x))

print(max_v)


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

def calc(x):
    y = math.floor(A * x / B) - A * math.floor(x / B)
    return y

max_v = 0

if N < B:
    max_v = calc(N)
else:
    max_v = calc(B-1)

# for x in range(N+1):
#     print(x,max_v) # x＝Bでさちる
#     max_v = max(max_v, calc(x))

print(max_v)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())

#print( N,S )   

passwd = [ [ [False for _ in range(10) ] for _ in range(10) ] for _ in range(10) ]
#print(passwd)

cnt = 0

for i1 in range(N-2):
    for i2 in range(i1+1,N-1):
        for i3 in range(i2+1, N):
            if passwd[int(S[i1])][int(S[i2])][int(S[i3])] == False:
                cnt = cnt + 1
                passwd[int(S[i1])][int(S[i2])][int(S[i3])] = True
            #ppp = S[i1]+S[i2]+S[i3]
            #print(i1,i2,i3, ppp)

#print(passwd)
print(cnt)


Fixed submission:
N = int(input())
S = str(input())

#print( N,S )   

cnt = 0
s_flgs = [[False for _ in range(10) ] for _ in range(3)]

for i1 in range(N-2):
    if s_flgs[0][int(S[i1])] == True:
        continue
    s_flgs[0][int(S[i1])] = True
    s_flgs[1] = [False for _ in range(10) ]
    for i2 in range(i1+1,N-1):
        if s_flgs[1][int(S[i2])] == True:
            continue
        s_flgs[1][int(S[i2])] = True
        s_flgs[2] = [False for _ in range(10) ]
        for i3 in range(i2+1, N):
            if s_flgs[2][int(S[i3])] == True:
                continue
            s_flgs[2][int(S[i3])] = True
            cnt = cnt + 1
            #ppp = S[i1]+S[i2]+S[i3]
            #print(i1,i2,i3, ppp)

print(cnt)
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
print(len(a))

Fixed submission:
import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
print(len(c))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []

for i in range(n):
    s = input()
    if not s in a:
        a.append(s)

print(len(a))

Fixed submission:
import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
print(len(c))
Buggy python submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())

red = sorted(list(map(int, input().split())), reverse=True)
gre = sorted(list(map(int, input().split())), reverse=True)
non = sorted(list(map(int, input().split())), reverse=True)

eat = []

for i in range(x):
    eat.append(red.pop(0))

for i in range(y):
    eat.append(gre.pop(0))

eat.sort()

for i in range(len(non)):
    n = non.pop(0)
    if eat[i] < n:
        eat[i] = n
    else:
        break

print(sum(eat))


Fixed submission:
s = input()

if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
x, y, a, b, c = map(int, input().split())
 
red = sorted(list(map(int, input().split())), reverse=True)
gre = sorted(list(map(int, input().split())), reverse=True)
non = sorted(list(map(int, input().split())), reverse=True)
 
eat = []
 
for i in range(x):
    eat.append(red.pop(0))
 
for i in range(y):
    eat.append(gre.pop(0))
 
eat.sort()
 
for i in range(len(non)):
    n = non.pop(0)
    if eat[i] < n:
        eat[i] = n
    else:
        break
 
print(sum(eat))

Fixed submission:
x, y, a, b, c = map(int, input().split())

red = sorted(list(map(int, input().split())), reverse=True)
gre = sorted(list(map(int, input().split())), reverse=True)
non = sorted(list(map(int, input().split())), reverse=True)

red = red[0:x]
gre = gre[0:y]

eat = red + gre + non

eat.sort(reverse=True)

print(sum(eat[0:x+y]))

Buggy python submission (verdict: Time Limit Exceeded):
x, y, a, b, c = map(int, input().split())

red = sorted(list(map(int, input().split())), reverse=True)
gre = sorted(list(map(int, input().split())), reverse=True)
non = sorted(list(map(int, input().split())), reverse=True)

eat = []

for i in range(x):
    eat.append(red.pop(0))

for i in range(y):
    eat.append(gre.pop(0))

eat.sort()

for i in range(len(non)):
    n = non.pop(0)
    if eat[i] < n:
        eat[i] = n
    else:
        break

print(sum(eat))

Fixed submission:
x, y, a, b, c = map(int, input().split())

red = sorted(list(map(int, input().split())), reverse=True)
gre = sorted(list(map(int, input().split())), reverse=True)
non = sorted(list(map(int, input().split())), reverse=True)

red = red[0:x]
gre = gre[0:y]

eat = red + gre + non

eat.sort(reverse=True)

print(sum(eat[0:x+y]))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input(),split())
n = 1
c = 0
while n < b:
    n += a-1
    c += 1
print(c)

Fixed submission:
a,b = map(int,input().split())
n = 1
c = 0
while n < b:
    n += a-1
    c += 1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0

for i in range(k+1):
    for j in range(k+1):
        for m in range(k+1):

            if i + j + m == s:
                ans += 1

print(ans)


Fixed submission:
k, s = map(int, input().split())
ans = 0

for i in range(k+1):
    for j in range(k+1):
        if (i + j <= s) and (s - i - j <= k):
            ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0

for i in range(k+1):
    for j in range(k+1):
        for m in range(k+1):

            if i + j + m == s:
                ans += 1

print(ans)


Fixed submission:
k, s = map(int, input().split())
ans = 0

for i in range(k+1):
    for j in range(k+1):
        if (i + j <= s) and (s - i - j <= k):
            ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

if A =< B*2:
  print(0)
else:
  print(A - B*2)

Fixed submission:
A, B = map(int, input().split())
 
if A <= B*2:
  print(0)
else:
  print(A - B*2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input().split()

list = []
befor

for i in len(S):
  if len(list) == 0:
    list.append(S[i])
  else:
    if list[-1] == S[i]:
      continue
    else:
      list.append(S[i])
print(len(list))

Fixed submission:
N = int(input())
S = list(input())
 
list = []
 
for i in range(len(S)):
  if len(list) == 0:
    list.append(S[i])
  else:
    if list[-1] == S[i]:
      continue
    else:
      list.append(S[i])


print(len(list))
Buggy python submission (verdict: Time Limit Exceeded):
get = list(map(int, input().split()))

N = get[0]
K = get[1]
Q = get[2]

point = [K]*N
list = [0]*N

for i in range(Q):
  A = input()
  list.append(int(A))

for i in range(N):
  if point[i] - (Q - list.count(i+1)) > 0:
    print("Yes")
  else:
    print("No")

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

N = get[0]
K = get[1]
Q = get[2]

list = [0]*N

for i in range(Q):
  list[int(input()) - 1] += 1 

for i in range(N):
  if K - (Q - list[i]) > 0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
get = list(map(int, input().split()))

N = get[0]
K = get[1]
Q = get[2]

point = [K]*N

for i in range(Q):
  A = input()
  A = int(A)
  for j in range(N):
    if (A - 1) != j:
      point[j] += -1

for i in range(N):
  if point[i] > 0:
    print("Yes")
  else:
    print("No")

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

N = get[0]
K = get[1]
Q = get[2]

list = [0]*N

for i in range(Q):
  list[int(input()) - 1] += 1 

for i in range(N):
  if K - (Q - list[i]) > 0:
    print("Yes")
  else:
    print("No")

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

N = get[0]
K = get[1]
Q = get[2]

point = [K]*N

for i in range(Q):
  A = input()
  A = int(A)
  for j in range(Q):
    if (A - 1) != j:
      point[j] += -1

for i in range(Q):
  if point[i] > 0:
    print("Yes")
  else:
    print("No")

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

N = get[0]
K = get[1]
Q = get[2]

list = [0]*N

for i in range(Q):
  list[int(input()) - 1] += 1 

for i in range(N):
  if K - (Q - list[i]) > 0:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
B = list(map(int, input().split()))

N = A[0]
K = A[1]
count = 0
 
list = []
 
for i in range(N):
  for j in range(i,N):
    if B[i] > B[j]:
      count+=1


for sabun in range(1,K):
    count = count*sabun + count
    
count = count%(10**9 + 7)
print(count)

Fixed submission:
A = list(map(int, input().split()))
 
M = A[0]
D = A[1]
count = 0
 
for i in range(4,M+1):
  for j in range(22,D+1):
    day = list(str(j))
    m10 = int(day[0])
    m1 = int(day[1])
    if m10 < 2:
      continue
    elif m1 < 2:
      continue
    
    if i == m10 * m1:
      count+=1
    
  
 
print(count)

Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
N = A[0]
K = A[1]
count = 0
 
list = []

for i in range(N):
  for j in range(i,N):
    if B[i] > B[j]:
      count+=1

count = count*K
  
count = count%(10**9 + 7)
print(count)

Fixed submission:
A = list(map(int, input().split()))
 
M = A[0]
D = A[1]
count = 0
 
for i in range(4,M+1):
  for j in range(22,D+1):
    day = list(str(j))
    m10 = int(day[0])
    m1 = int(day[1])
    if m10 < 2:
      continue
    elif m1 < 2:
      continue
    
    if i == m10 * m1:
      count+=1
    
  
 
print(count)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().splitf())
 
plus = a + b
 
minus = a - b
 
kakeru = a * b
 
 
if plus >= minus:
  if plus >= kakeru:
    print(plus)
elif minus >= kakeru:
  print(minus)
else:
  print(kakeru)

Fixed submission:
a, b = map(int, input().split())
 
plus = a + b
 
minus = a - b
 
kakeru = a * b

list = [plus, minus, kakeru]

print(max(list))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().splitf(' '))
 
plus = a + b
 
minus = a - b
 
kakeru = a * b
 
 
if plus >= minus:
  if plus >= kakeru:
    print(plus)
elif minus >= kakeru:
  print(minus)
else:
  print(kakeru)

Fixed submission:
a, b = map(int, input().split())
 
plus = a + b
 
minus = a - b
 
kakeru = a * b

list = [plus, minus, kakeru]

print(max(list))

Buggy python submission (verdict: Runtime Error):
a, b = input().splitf(' ')

plus = a + b

minus = a - b

kakeru = a * b


if plus >= minus:
  if plus >= kakeru:
    print(plus)
elif minus >= kakeru:
  print(minus)
else:
  print(kakeru)


Fixed submission:
a, b = map(int, input().split())
 
plus = a + b
 
minus = a - b
 
kakeru = a * b

list = [plus, minus, kakeru]

print(max(list))
Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())
 
minus = K - 1
list = []
for i in Range(test):
  list.append(X - (K - i))
  
list.append(X)
 
for j in Range(plus):
  list.append(X + j)
  
for aaa in list:
  print(aaa + " ")

Fixed submission:
a, b = map(int, input().split())

start = b-a+1
loop = (a*2) -1

for i in range(loop):
    print(start + i ,end=" ")

Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())
 
minus = K - 1
 
for i in Range(test):
  print(X - (K - i))

plus = minus + 1

for j in Range(plus):
  print(X + j)

Fixed submission:
a, b = map(int, input().split())

start = b-a+1
loop = (a*2) -1

for i in range(loop):
    print(start + i ,end=" ")

Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())
 
test = K - 1
 
for i in Range(test):
  print(X - (K - i))


test = test + 1  

for j in Range(test):
  print(X + j)

Fixed submission:
a, b = map(int, input().split())

start = b-a+1
loop = (a*2) -1

for i in range(loop):
    print(start + i ,end=" ")

Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())

max = K - 1

for i in Range(max):
  print(X - (K - i))

print(X)

for j in Range(max - 1):
  print(X + j + 1)


Fixed submission:
a, b = map(int, input().split())

start = b-a+1
loop = (a*2) -1

for i in range(loop):
    print(start + i ,end=" ")
Buggy python submission (verdict: Runtime Error):

A, B, N=list(map(int, input().split()))
if B > N:
    X = N
else:
    X = B-1

Ans = math.floor(A*X/B) - A * math.floor(X/B)
print(Ans)


Fixed submission:
import math
A, B, N=list(map(int, input().split()))
if B > N:
    X = N
else:
    X = B-1

Ans = math.floor(A*X/B) - A * math.floor(X/B)
print(Ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ListA = list(map(int,input().split()))
for x in range(1 , N + 1):
    print(ListA.count(x))


Fixed submission:
import math
r = float(input())
s = r * 2 * math.pi
print (s)
Buggy python submission (verdict: Runtime Error):
while C > 0 and A > 0:
    C -= B
    A -= D
    if C <= 0:
        print("Yes")
    elif A <= 0:
        print("No")
    else:
        pass

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

while C > 0 and A > 0:
    C -= B
    A -= D
    if C <= 0:
        print("Yes")
    elif A <= 0:
        print("No")
    else:
        pass
Buggy python submission (verdict: Runtime Error):
M = int(input())
A = list(map(int, input().split()))
B = collections.Counter(A)
#print(B)
#print(B[])
num = 1

while num <= M:
    print(B[num])
    num += 1

Fixed submission:
import collections
M = int(input())
A = list(map(int, input().split()))
B = collections.Counter(A)
num = 1

while num <= M:
    print(B[num])
    num += 1

Buggy python submission (verdict: Time Limit Exceeded):
M = int(input())
A = list(map(int, input().split()))
num = 1

while num <= M:
    print(A.count(num))
    num += 1


Fixed submission:
import collections
M = int(input())
A = list(map(int, input().split()))
B = collections.Counter(A)
num = 1

while num <= M:
    print(B[num])
    num += 1
Buggy python submission (verdict: Runtime Error):
S = A - B

if C - S > 0:
    print(C - S)
else:
    print(0)

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

S = A - B

if C - S > 0:
    print(C - S)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import math

def main():

    a,b,h,m = map(int,input().split())
    kakub = 6.0*m
    kakua = 30.0*h + (30.0*(m/60.0))
    maxx = max(kakua,kakub)
    minn = min(kakua,kakub)
    if (maxx - 180.0) > minn:
        aug = (360.0 - maxx) + minn
    elif (maxx - 180.0) < minn:
        aug = maxx - minn

    ans = (a**2.0) + (b**2.0) -( (2.0*a*b)*math.cos(math.radians(aug)) )
    print(math.sqrt(ans))



if __name__=='__main__':
    main()

Fixed submission:
import math

def main():

    a,b,h,m = map(int,input().split())
    kakub = 6.0*m
    kakua = 30.0*h + (30.0*(m/60.0))
    maxx = max(kakua,kakub)
    minn = min(kakua,kakub)
    if (maxx - 180.0) > minn:
        aug = (360.0 - maxx) + minn
    elif (maxx - 180.0) < minn:
        aug = maxx - minn
    else:
        aug = 180.0
    
    if aug == 180.0:
        ans=a+b
        print(ans)
    
    else: 
        ans = (a**2.0) + (b**2.0) -( (2.0*a*b)*math.cos(math.radians(aug)) )
        print(math.sqrt(ans))



if __name__=='__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import math

def main():

    a,b,h,m = map(int,input().split())
    kakub = 6.0*m
    kakua = 30.0*h + (30.0*(m/60.0))
    maxx = max(kakua,kakub)
    minn = min(kakua,kakub)
    if (maxx - 180.0) > minn:
        aug = (360.0 - maxx) + minn
    elif (maxx - 180.0) < minn:
        aug = maxx - minn

    ans = (a**2) + (b**2) -( (2*a*b)*math.cos(math.radians(aug)) )
    print(math.sqrt(ans))



if __name__=='__main__':
    main()

Fixed submission:
import math

def main():

    a,b,h,m = map(int,input().split())
    kakub = 6.0*m
    kakua = 30.0*h + (30.0*(m/60.0))
    maxx = max(kakua,kakub)
    minn = min(kakua,kakub)
    if (maxx - 180.0) > minn:
        aug = (360.0 - maxx) + minn
    elif (maxx - 180.0) < minn:
        aug = maxx - minn
    else:
        aug = 180.0
    
    if aug == 180.0:
        ans=a+b
        print(ans)
    
    else: 
        ans = (a**2.0) + (b**2.0) -( (2.0*a*b)*math.cos(math.radians(aug)) )
        print(math.sqrt(ans))



if __name__=='__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import math

def main():

    a,b,h,m = map(int,input().split())
    kakub = 6*m
    kakua = 30*h + (30*(m/60))
    maxx = max(kakua,kakub)
    minn = min(kakua,kakub)
    if (maxx - 180.0) > minn:
        aug = (360.0 - maxx) + minn
    elif (maxx - 180.0) < minn:
        aug = maxx - minn

    ans = (a**2) + (b**2) -( (2*a*b)*math.cos(math.radians(aug)) )
    print(math.sqrt(ans))



if __name__=='__main__':
    main()

Fixed submission:
import math

def main():

    a,b,h,m = map(int,input().split())
    kakub = 6.0*m
    kakua = 30.0*h + (30.0*(m/60.0))
    maxx = max(kakua,kakub)
    minn = min(kakua,kakub)
    if (maxx - 180.0) > minn:
        aug = (360.0 - maxx) + minn
    elif (maxx - 180.0) < minn:
        aug = maxx - minn
    else:
        aug = 180.0
    
    if aug == 180.0:
        ans=a+b
        print(ans)
    
    else: 
        ans = (a**2.0) + (b**2.0) -( (2.0*a*b)*math.cos(math.radians(aug)) )
        print(math.sqrt(ans))



if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():

    n,k = map(int,input().split())
    a = list(map(int,input().split()))	

    zzz=[]
    oioi=0
    flg=False

    for i in range(1,n+1):
        oioi = a[oioi]-1
        zzz.append(oioi)
        if oioi == 0:
            break
        if oioi in zzz:
            flg=True
            ppp=zzz.index(oioi)
            qqq=len(zzz)
            li=zzz
            del zzz[0:ppp+1]
            break


    
    if k>=qqq and flg:
        print(zzz[(k+ppp)%len(zzz)-1]+1)
    elif k<=qqq and flg:
        print(li[k-1]+1)
    else:    
        print(zzz[k%len(zzz)-1]+1)

    

if __name__ == '__main__':
    main()


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = [1]
for i in range(n):
    l.append(a[l[i] - 1])

p = l.index(l[n])

if k <= n:
    print(l[k])
else:
    x = (k - n + 1) % (n - p)
    if x == 0:
        print(l[n - 1])
    else:
        print(l[x + p - 1])

Buggy python submission (verdict: Runtime Error):
def main():

    n,k = map(int,input().split())
    a = list(map(int,input().split()))	

    zzz=[]
    oioi=0
    flg=True

    for i in range(n):
        oioi = a[oioi]-1
        
        if oioi == 0:
            zzz.append(oioi)
            break
        if oioi in zzz:
            flg=False
            ppp=zzz.index(oioi)
            del zzz[0:ppp+1]
            zzz.append(oioi)
            break
    
    if flg == False:
        print(zzz[(k+ppp)%len(zzz)-1]+1)
    else:
        print(zzz[k%len(zzz)-1]+1)

    
if __name__ == '__main__':
    main()

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = [1]
for i in range(n):
    l.append(a[l[i] - 1])

p = l.index(l[n])

if k <= n:
    print(l[k])
else:
    x = (k - n + 1) % (n - p)
    if x == 0:
        print(l[n - 1])
    else:
        print(l[x + p - 1])