Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

# D - Derangement
def swap(index, swap_with_right):
  global p

  if swap_with_right:
    l = index
    r = index + 1
  else:
    l = index - 1
    r = index

  pl = p[l]
  pr = p[r]
  p[l] = pr
  p[r] = pl


N = int(input())
p = list(map(int, input().split()))

p.insert(0, 0)
ans = 0

if p[1] == 1:
  swap(1, True)
  ans += 1

for i in range(2, N+1):
	if i == p[i] and i+1 == p[i+1]:
		swap(i, True)
		ans += 1
	elif i == p[i]:
		ans += 1

print(ans)

Fixed submission:
import sys
input = sys.stdin.readline

# D - Derangement
def swap(index, swap_with_right):
  global p

  if swap_with_right:
    l = index
    r = index + 1
  else:
    l = index - 1
    r = index

  pl = p[l]
  pr = p[r]
  p[l] = pr
  p[r] = pl


N = int(input())
p = list(map(int, input().split()))

p.insert(0, 0)
ans = 0

if p[1] == 1:
  swap(1, True)
  ans += 1

for i in range(2, N+1):
	if i < N:
		if i == p[i] and i+1 == p[i+1]:
			swap(i, True)
			ans += 1
		elif i == p[i]:
			ans += 1
	elif i == p[i]:
		ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
 D - Derangement
def swap(index, swap_with_right):
  global p

  if swap_with_right:
    l = index
    r = index + 1
  else:
    l = index - 1
    r = index

  pl = p[l]
  pr = p[r]
  p[l] = pr
  p[r] = pl


N = int(input())
p = list(map(int, input().split()))

p.insert(0, 0)
ans = 0

if p[1] == 1:
  swap(1, True)
  ans += 1

for i in range(2, N+1):
  if i == p[i]:
    if p[i-1] == i:
      swap(i, True)

    ans += 1

print(ans)

Fixed submission:
import sys
input = sys.stdin.readline

# D - Derangement
def swap(index, swap_with_right):
  global p

  if swap_with_right:
    l = index
    r = index + 1
  else:
    l = index - 1
    r = index

  pl = p[l]
  pr = p[r]
  p[l] = pr
  p[r] = pl


N = int(input())
p = list(map(int, input().split()))

p.insert(0, 0)
ans = 0

if p[1] == 1:
  swap(1, True)
  ans += 1

for i in range(2, N+1):
	if i < N:
		if i == p[i] and i+1 == p[i+1]:
			swap(i, True)
			ans += 1
		elif i == p[i]:
			ans += 1
	elif i == p[i]:
		ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x,k,d = map(int,input().split())

x = abs(x)

if x > k*d:
    print(x-k*d)
elif x == 0:
    if k%2 ==0:
        print(0)
    else:
        print(d)
else:
    x_r = x%d
    x_l = x%d - d
    t = 0
    while x >= 0:
        x -= d
        t += 1
    if (k - t)%2 == 0:
        print(abs(x_l))
    else:
        print(x_r)

Fixed submission:
x,k,d = map(int,input().split())

x = abs(x)

if x > k*d:
    print(x-k*d)
elif x == 0:
    if k%2 ==0:
        print(0)
    else:
        print(d)
else:
    x_r = x%d
    x_l = x%d - d
    t = 0
    while x >= 0:
        x -= d
        t += 1
    if (k - t)%2 == 0:
        print(abs(x_l))
    else:
        print(x_r)
Buggy python submission (verdict: Runtime Error):

for i in range(n):
    x,y = map(int,input().split())
    if x**2 + y**2 <= d**2:
        s += 1
print(s)

Fixed submission:
n,d = map(int,input().split())

s = 0

for i in range(n):
    x,y = map(int,input().split())
    if x**2 + y**2 <= d**2:
        s += 1
print(s)
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()))

s = 0
t = 0
for i in range(n+m):
    if a != []:
        if a[0] <= b[0]:
            c = a[0]
            a.pop(0)
        else:
            c = b[0]
            b.pop(0)
    else:
        c = b[0]
        b.pop(0)
    if s+c>k:
        break
    else:
        s += c
        t += 1
print(t) 

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: Runtime Error):
n,m,k = map(int,input().split())

a = list(map(int,input().split()))
b = list(map(int,input().split()))

s = 0
t = 0
for i in range(n+m):
    if a != []:
        c = min(a[0],b[0])
        if c == a[0]:
            a.pop(0)
        else:
            b.pop(0)
    else:
        c = b[0]
        b.pop(0)
    if k-c < s:
        break
    else:
        s += c
        t += 1
print(t)




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: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

s = 0
u = -1
for i in a:
    t = 0
    for j in a:
        if j != i and i % j == 0:
            t += 1
    if j != i and t == 0:
        s += 1
print(s)




Fixed submission:
x,n = map(int,input().split())

p = list(map(int,input().split()))

#if x in p == False:
    #print(x)


for i in range(101):
    if ((x-i) in p) == False:
        print(x-i)
        break
    elif ((x+i) in p) ==False:
        print(x+i)
        break
Buggy python submission (verdict: Runtime Error):
n = int(input())

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

s = 1
for i in a:
    s = s*i
if s > 10**18:
    print('-1')
else:
    print(s)

Fixed submission:
n = int(input())

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

s = 1
for i in a:
    s = s*i
    s = min(s,10**18+1)
if s == 10**18+1:
    print('-1')
else:
    print(s)

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

a = list(map(int,input()split())

s = 1
for i in a:
    s = s*i
if s > 10**18:
    print('-1')
else:
    print(s)

Fixed submission:
n = int(input())

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

s = 1
for i in a:
    s = s*i
    s = min(s,10**18+1)
if s == 10**18+1:
    print('-1')
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
n = int(input())

m = n[-1]

if m == 3:
    print('bon')
elif m == 0,1,6,8:
    print('pon')
else:
    print('hon')

Fixed submission:
n = input()

m = (n[-1])

if m == '3':
    print('bon')
elif m == '0' or m == '1' or m =='6' or m =='8':
    print('pon')
else:
    print('hon')
Buggy python submission (verdict: Runtime Error):
s = input()
if s = 'ABC':
	print('ARC')
elif s = 'ARC':
	print('ABC')

Fixed submission:
s = input()
if s == 'ABC':
  print('ARC')
elif s == 'ARC':
  print('ABC')

Buggy python submission (verdict: Runtime Error):
s = input()

if s = 'ABC':
  print('ARC')
elif s = 'ARC':
  print('ABC')

Fixed submission:
s = input()
if s == 'ABC':
  print('ARC')
elif s == 'ARC':
  print('ABC')
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())

x = [n-k*i for i in range(n//k+2)]
x[-1] = abs(x[-1])
print(min(x))

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

a1 = b
b1 = a

c1 = a1
a2 = c

print(a2,b1,c1)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

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

b = [b for b in a if b >= 1/4/m]

if len(b)>= m:
	print(‘Yes’)
else:
	print(‘No’)

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

x = max(a)
s = 0
for i in a:
    s += i
y = [l for l in a if l >=s/4/m]
if len(y) >=m:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
s = input()

if s[2] == s[3] and s[4]== s[5]:
	print(‘Yes’)
else:
	print(‘No’)


Fixed submission:
s = input()

if s[2] == s[3] and s[4]== s[5]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,r = map(int,input().split())

if n > =10:
  print(r)

else:
  print(r-100*(10-n))

Fixed submission:
n,r = map(int,input().split())

if n >= 10:
  print(r)

else:
  print(r+100*(10-n))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

A = list(map(int,input().split()))
s = 0
for i in range(n-1):
  if A.count(A[i]) > 1:
    print('NO')
    s = 1
    break
if s == 0:
  print('YES')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = set(a)
         
if len(a) == len(b):
         print('YES')
else:
         print('NO')

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

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


s = 0
for i in range(n):
  if a.count(a[i]) is not 1:
    s+=1
if s == 0:
  print('YES')
else:
  print('NO')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = set(a)
         
if len(a) == len(b):
         print('YES')
else:
         print('NO')
Buggy python submission (verdict: Runtime Error):
k,x = map(int,input().spleit())

if x =< k*500:
  print('Yes')

else:
  print('No')


Fixed submission:
k,x = map(int,input().split())

if  500*k >= x:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
k,x = map(int,input().spleit())

if x <= k*500:
    print('Yes')

else:
    print('No')


Fixed submission:
k,x = map(int,input().split())

if  500*k >= x:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
k,x = map(int,input().spleit())

if x =< k*500:
    print('Yes')

else:
    print('No')

Fixed submission:
k,x = map(int,input().split())

if  500*k >= x:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
for r in S:
  if rrr in S:
    return(3)
  elif rr in S:
    return(2)
  elif: r in S:
    return(1)
  else:
    return(0)
        
    

Fixed submission:
s= input()

if 'RRR' in s:
    print(3)
    

elif 'RR' in s:
    print(2)
    
elif 'R' in s:
    print(1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
for i in input:
    if i >= 30:
        print('Yes')
    else:
        print('No')

Fixed submission:
#at coder ABC174 A
X = int(input())
if X >= 30:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = list(int,input())
m = n.sort(reverse=True)
if n == m:
    print("Yes")
else:
    print("No")

Fixed submission:
n = list(input())
if n[0] ==n[2]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
if a == H:
    if b == H:
        print("H")
    else:
        print("D")
if a == D:
    if b == H:
        print("D")
    else:
        print("H")

Fixed submission:
a,b=input().split()
if a == "H":
    if b == "H":
        print("H")
    else:
        print("D")
if a == "D":
    if b == "H":
        print("D")
    else:
        print("H")
Buggy python submission (verdict: Time Limit Exceeded):
#python 3.7.1

a, b, c, d=map(int, input().split())

cnt=0

while(d!=0):

  

  if(a!=0 and d>0):

    d-=1

    a=a-1

    

    cnt=cnt+1

    

  elif b!=0 and d>0:

    d-=1

    b=b-1

    

    

  elif c!=0 and d>0:

    d-=1

    c=c-1

    

    cnt=cnt-1

    

print(cnt)

  



Fixed submission:
#python 3.7.1

a, b, c, d=map(int, input().split())

k=d

if(a-k>0):

  print(k)

else:

  k=d-a

  if(b-k>0):

    print(a)

    

  else:

    k=d-a-b

    print(a-k)

Buggy python submission (verdict: Runtime Error):
#python 3.7.1

a=int(input())

b=int(input())

c=int(input())

d=int(input())

cnt=0

while(d!=0):

  

  if(a!=0 and d>0):

    d-=1

    a=a-1

    

    cnt=cnt+1

    

  elif b!=0 and d>0:

    d-=1

    b=b-1

    

    

  elif c!=0 and d>0:

    d-=1

    c=c-1

    

    cnt=cnt-1

    

print(cnt)

  

Fixed submission:
#python 3.7.1

a, b, c, d=map(int, input().split())

k=d

if(a-k>0):

  print(k)

else:

  k=d-a

  if(b-k>0):

    print(a)

    

  else:

    k=d-a-b

    print(a-k)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
if len(S) >= K:
  print(S[0:K] + '...')
else:
  print(S)


Fixed submission:
K = int(input())
S = input()
if len(S) > K:
  print(S[0:K] + '...')
else:
  print(S)

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
if len(S) > K:
  print(S[:K] + '...')
else:
  print(S)


Fixed submission:
K = int(input())
S = input()
if len(S) > K:
  print(S[0:K] + '...')
else:
  print(S)

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
if len(S) >= K:
  print(S[:K] + '...')
else:
  print(S)

Fixed submission:
K = int(input())
S = input()
if len(S) > K:
  print(S[0:K] + '...')
else:
  print(S)

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
if len(S) <= K:
  print(S[:K] + '...')
else:
  print(S)

Fixed submission:
K = int(input())
S = input()
if len(S) > K:
  print(S[0:K] + '...')
else:
  print(S)
Buggy python submission (verdict: Runtime Error):
N = int((input())

if N % 2 == 0:
  print(N / 2)
else:
  print(N // 2 + 1)


Fixed submission:
UNKO = int(input())
print(UNKO // 2 + UNKO % 2)

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

if N % 2 == 0:
  print(N // 2)
else:
  print((N // 2) + 1)

Fixed submission:
UNKO = int(input())
print(UNKO // 2 + UNKO % 2)

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

if N % 2 == 0:
  print(N / 2)
else:
  print((N / 2) + 1)

Fixed submission:
UNKO = int(input())
print(UNKO // 2 + UNKO % 2)

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

if N % 2 == 0:
  unpo = N / 2
  print(unpo)
else:
  unpo = (N / 2) + 1
  print(unpo)
  

Fixed submission:
UNKO = int(input())
print(UNKO // 2 + UNKO % 2)
Buggy python submission (verdict: Runtime Error):
A, B, C = int(input().split(' '))
if A == B == C or A!= B != C:
  print('No')
else:
  print('Yes')

Fixed submission:
A, B, C = input().split(' ')
if (A == B == C) or (A!= B != C != A):
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
N = input().split(' ')
S = [input() for i in range(N)]

ans = {}
for i in S:
  if i in ans:
    ans[i] += 1
  else:
    ans[i] = 1

max_value = max(ans.value())
ANS = []
for key, value in ans.item():
  if ans[key] == max_value:
    ANS.append(key)
    
for i in sorted(ANS):
  print(i)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

ans = {}
for i in S:
  if i in ans:
    ans[i] += 1
  else:
    ans[i] = 1

max_value = max(ans.values())
ANS = []
for key, value in ans.items():
  if ans[key] == max_value:
    ANS.append(key)
    
for i in sorted(ANS):
  print(i)
Buggy python submission (verdict: Runtime Error):
S, T = str(input().split())
A, B = map(int, input().split())
U = str(input())

if S == U:
  print(A - 1, B)
if T == U:
  print(A, B - 1)


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

if S == U:
  print(A - 1, B)
else:
  print(A, B - 1)

Buggy python submission (verdict: Runtime Error):
S, T = str(input().split(' '))
A, B = int(input().split(' '))
U = str(input())

if S == U:
  A -= 1
if T == U:
  B -= 1
print(A, B)


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

if S == U:
  print(A - 1, B)
else:
  print(A, B - 1)

Buggy python submission (verdict: Runtime Error):
S, T, U = str(input().split(' '))
A, B = int(input().split(' '))

if S == U:
  A -= 1
if T == U:
  B -= 1
print(A, B)

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

if S == U:
  print(A - 1, B)
else:
  print(A, B - 1)
Buggy python submission (verdict: Runtime Error):
r = input()

print(r ** 2)

Fixed submission:
r = int(input())

print(r**2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())

if N % 2 == 0:
    T = str(S[:N/2])
    if S == T + T:
        print('Yes')
    else:
      print('No')
else:
    print('No')

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

if N % 2 == 0:
    T = S[:int(N/2)]
    if S == T + T:
        print('Yes')
    else:
      print('No')
else:
    print('No')

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

if N % 2 == 0:
    T = S[:N/2]
    if S == T + T:
        print('Yes')
    else:
        print('No')
else:
    print('No')


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

if N % 2 == 0:
    T = S[:int(N/2)]
    if S == T + T:
        print('Yes')
    else:
      print('No')
else:
    print('No')

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

if N % 2 == 0:
    T = S[:N/2]
    if S == T + T:
        print('Yes')
    else:
      print('No')
else:
    print('No')

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

if N % 2 == 0:
    T = S[:int(N/2)]
    if S == T + T:
        print('Yes')
    else:
      print('No')
else:
    print('No')

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

if N % 2 == 0:
    T = S[:N/2]
    if S == T + T:
        print('Yes')
else:
    print('No')

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

if N % 2 == 0:
    T = S[:int(N/2)]
    if S == T + T:
        print('Yes')
    else:
      print('No')
else:
    print('No')

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

if N % 2 != 0:
  print('No')

if S[:N / 2] == S[N / 2:]:
  print('Yes')

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

if N % 2 == 0:
    T = S[:int(N/2)]
    if S == T + T:
        print('Yes')
    else:
      print('No')
else:
    print('No')

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

if N % 2 != 0:
  print('No')

wc = N / 2
wc1 = S[:wc]
wc2 = S[wc:]

if wc1 == wc2:
  print('Yes')

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

if N % 2 == 0:
    T = S[:int(N/2)]
    if S == T + T:
        print('Yes')
    else:
      print('No')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S = input()

odd = S[::2]
even = [1::2]

if 'L' in odd or 'R' in even:
    print('No')
else:
    print('Yes')

Fixed submission:
S = input()

odd = S[::2]
even = S[1::2]

if 'L' in odd or 'R' in even:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np

def input():
    return sys.stdin.readline()[:-1]


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

ans = np.prod(A)
if ans > 10**18:
	print(-1)
else:
	print(ans)


Fixed submission:
import sys
from functools import reduce


def input():
    return sys.stdin.readline()[:-1]


def mm(a, b):
	ans = a*b
	if ans > 10**18:
		return 0
	else:
		return a*b

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

if 0 in A:
	print(0)
else:
	ans = reduce(mm, A)
	
	if ans == 0:
		print(-1)
	else:
		print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np


def input():
    return sys.stdin.readline()[:-1]

N = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def func1(lst, value):
    return [i for i, x in enumerate(lst) if x <= value]


ans_ = np.array(factorization(N))
nums = []
index_list = []

ans = 0
for i in range(1, 100):
	ans += i
	index_list.append(ans)

for a in ans_:
	#nums.append(int(format(a[1], 'b')))
	nums.append(a[1])
	
ans = 0
for i in nums:
	index = func1(index_list, i)
	#print(max(index)+1)
	ans += max(index)+1
	
print(ans)


Fixed submission:
import sys

def input():
    return sys.stdin.readline()[:-1]

N = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def func1(lst, value):
    return [i for i, x in enumerate(lst) if x <= value]

if N == 1:
	print(0)
else:
	
	ans_ = factorization(N)
	nums = []
	index_list = []
	
	ans = 0
	for i in range(1, 100):
		ans += i
		index_list.append(ans)
		
	for a in ans_:
		#nums.append(int(format(a[1], 'b')))
		nums.append(a[1])
		
		#print(nums)
			
	ans = 0
	for i in nums:
		index = func1(index_list, i)
		#print(max(index)+1)
		ans += max(index)+1
	
	print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def input():
    return sys.stdin.readline()[:-1]

N, K = map(int, input().split())
A = [i for i in map(int, input().split())]


def func(A, town):
    return A[town]

att = 1

visited = [1]
loopend = 0
loopstart = 0
if K > N:
    for i in range(K):
        att = func(A, att-1)
        if att in visited:
            loopstart = visited.index(att)
            break
        else:
            visited.append(att)
    loop = visited[loopstart:] # 周回する街
    rem = (K - loopstart) % len(loop)
    att = loop[rem]
else:
    for _ in range(K):
        att = func(A, att-1)

print(att)

Fixed submission:
import sys

def input():
    return sys.stdin.readline()[:-1]

N, K = map(int, input().split())
A = [i for i in map(int, input().split())]


def func(A, town):
    return A[town]

att = 1

visited = set([1])
loopend = 0
loopstart = 0
if K > N:
    for i in range(N):
        att = func(A, att-1)
        #print(visited)
        if att in visited:
            visited = list(visited)
            loopstart = visited.index(att)
            break
        else:
            visited.add(att)
    loop = visited[loopstart:] # 周回する街
    rem = (K - loopstart) % len(loop)
    att = loop[rem]
else:
    for _ in range(K):
        att = func(A, att-1)

print(att)
Buggy python submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline()[:-1]


N, A, B = map(int, input().split())


all_set, mod_ = divmod(N, (A+B))
#print(all_set, mod_)
if mod_ == 0:
	print(all_set*A)
elif mod_ - A >= 0:
	print(all_set*A + A)
else:
	print(all_set*A + mod_)


Fixed submission:
import sys

def input():
    return sys.stdin.readline()[:-1]


A, B = map(int, input().split())

A_ = []
B_ = []
end = False
for i in range(1, 1001):
	if i*8//100 == A and i//10 == B:
		print(i)
		end = True
		break
	else:
		continue
if end:
	pass
else:
	print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [i for i in map(int, input().split())]

count = 0
for i in range(N):
	flag = 1
	for j in range(i):
		if P[i] <= P[j]:
			flag = 1
		else:
			flag = -1
			break

	if flag == 1:
		count += 1

			
print(count)


Fixed submission:
N = int(input())
P = [i for i in map(int, input().split())]

"""
count = 0
for i in range(N):
	flag = 1
	for j in range(i):
		if P[i] <= P[j]:
			flag = 1
		else:
			flag = -1
			break

	if flag == 1:
		count += 1

print(count)
"""
count = 0
min_ = P[0]
for p in P:
	if p <= min_:
		count += 1
		min_ = p

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

a, b = map(int, input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))


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

def gcd(x, y):
	while y!=0:
		x, y = y , x%y
	return x

def lcm(x, y):
	return (x * y) // gcd(x, y)

print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
import math

A,B,H,M = map(int,input().split())
angH = 30.0*H+0.5*M
angM = 6.0*M
angD = abs(angH-angM)

if angD > 180.0:
    angD = 360.0-angD
cosD = math.cos(math.radians(angD))
ans2 = A*A + B*B - 2*A*B *cosD
ans = math.sqrt(ans2)
print(ans)

Fixed submission:
data = ['pon','pon','hon','bon','hon','hon','pon','hon','pon','hon']
n = int(input()) % 10
print(data[n])
Buggy python submission (verdict: Runtime Error):
N = int(input())
Data = list(map(int,input().split()))
ans = True
for data in Data:
    if data % 2 == 0:
        if data % 3 == 0 or data % 5 == 0:
            pass
        else:
            ans = False
            break
if ans:
    print('APPROVED')
else:
    print('DENIED')


Fixed submission:
a,b,c = map(int,input().split())
ans = False
if a == b and b != c:
    ans = True
if b == c and c != a:
    ans = True
if c == a and a != b:
    ans = True
if ans:
    print('Yes')
else:
    print('No')