Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
many = int(input())
sum_money = 0
for i in range(many):
    money, currency = map(str, input().split())
    if currency == 'JPY':
        sum_money += int(money)
    elif currency == 'BTC':
        sum_money += float(380000 * money)
    else:
        print("Error")
print(sum_money)


Fixed submission:
many = int(input())
sum_money = 0
for i in range(many):
    money, currency = map(str, input().split())
    if currency == 'JPY':
        sum_money += int(money)
    else:
        sum_money += 3.8e5 * float(money)

print(sum_money)
Buggy python submission (verdict: Runtime Error):
many, A, B, C = map(int, input().split())
bamboos = [int(input()) for i in range(many)]

# point: 訳が分からなくなるものは自分でルールづけをする
# 合成魔法を全て最初に行う、というルールづけ

# 解法: DFS or 4進数(4patternsで2の累乗だからできる)
# PS: DFS(深さ優先探索), BFS(幅優先探索)

infinity = 1e10

def dfs(depth, a, b, c):
    if depth == many:
        # 謎の場合分け
        if min(a, b, c) > 0:
            # 竹が何もない状態でも各竹に+10がかかっていることから-30する必要がある。
            # また、+10が一個はないとベースとなる竹がないことになるので
            # a,b,c = 0はコストを無限にすることで避ける。
            return abs(a-A) + abs(b-B) + abs(c-C) - 30
    else:
        ret0 = dfs(depth+1, a, b, c)
        ret1 = dfs(depth+1, a+bamboos[depth], b, c) + 10
        ret2 = dfs(depth+1, a, b+bamboos[depth], c) + 10
        ret3 = dfs(depth+1, a, b, c+bamboos[depth]) + 10
        return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))


Fixed submission:
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
    if cur == N:
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))
Buggy python submission (verdict: Runtime Error):
num = input()
for i in range(len(num)):
  if num[i] == '1':
    num[i] = '9'
  else:
    num[i] = '1'
print(num)

Fixed submission:
num = input()
out = ''
for i in range(len(num)):
  if num[i] == '1':
    out += '9'
  else:
    out += '1'
print(out)
Buggy python submission (verdict: Time Limit Exceeded):
l = list(map(int, input().split()))
k = int(input())

while(k > 0):
    if l[0] > l[1]:
        l[1] *= 2
        k -= 1
    elif l[1] > l[2]:
        l[2] *= 2
        k -= 1
    
    if l[0] < l[1] and l[1] < l[2]:
        print('Yes')
        exit()

print('No')

Fixed submission:
r,g,b = list(map(int, input().split()))
k = int(input())

for _ in range(k):
    if r >= g:
        g *= 2
    elif g >= b:
        b *= 2
    
    if r < g and g < b:
        print('Yes')
        exit()

print('No')
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
a = list(map(int,input().split()))
b = [0] * n

for cnt in range(k):
    if cnt > int(n/2):
        for l in range(n):
            a[l] += k - cnt
        break
    else:
        for i in range(n):
            abl = a[i] * 2 + 1
            for j in range(abl):
                lenge = i - a[i] + j
                if lenge >= 0 and lenge < n:
                    b[lenge] += 1
        a = b
        b = [0] * n

print(*a)

Fixed submission:
s = input()

print(s[:3])
Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator

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

ans = 1

ans = functools.reduce(operator.mul, N)

#for i in range(len(N)):
#    ans *= N[i]

if ans > 10**18:
    print('-1')
else:
    print(ans)

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

ans = 1

if 0 in N:
    ans = 0
else:
    for i in range(len(N)):
        ans *= N[i]
        if ans > 10**18:
            break

if ans > 10**18:
    print('-1')
else:
    print(ans)

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

ans = 1

for i in range(len(N)):
    ans *= N[i]

if ans > 10**18:
    print('-1')
else:
    print(ans)

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

ans = 1

if 0 in N:
    ans = 0
else:
    for i in range(len(N)):
        ans *= N[i]
        if ans > 10**18:
            break

if ans > 10**18:
    print('-1')
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())

for i in range(len(S)-1):
    if S[i] == '?':
        if S[i+1] == 'P':
            S = S[:i] + 'D' + S[i+1:]
        else:
            S = S[:i] + 'P' + S[i+1:]

if S[len(S)-1] == '?':
    S = S[:len(S)-1] + 'D'

print(S)

Fixed submission:
S = list(str(input()))

for i in range(len(S)-1):
    if i == 0 and S[0] == '?':
        if S[i+1] == 'P':
            S[0] = 'D'
        else:
            S[0] = 'P'
    if S[i] == '?':
        if S[i+1] == 'P':
            S[i] = 'D'
        else:
            if S[i-1] == 'P':
                S[i] = 'D'
            else:
                S[i] = 'P'

if S[len(S)-1] == '?':
    S[len(S)-1] = 'D'

strS = "".join(S)

print(strS)

Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())

for i in range(len(S)-1):
    if S[i] == '?':
        if S[i+1] == 'D':
            S = S[:i] + 'P' + S[i+1:]
        elif S[i+1] == '?':
            S = S[:i] + 'P' + S[i+1:]
        else:
            S = S[:i] + 'D' + S[i+1:]

if S[len(S)-1] == '?':
    S = S[:len(S)-1] + 'D'

print(S)

Fixed submission:
S = list(str(input()))

for i in range(len(S)-1):
    if i == 0 and S[0] == '?':
        if S[i+1] == 'P':
            S[0] = 'D'
        else:
            S[0] = 'P'
    if S[i] == '?':
        if S[i+1] == 'P':
            S[i] = 'D'
        else:
            if S[i-1] == 'P':
                S[i] = 'D'
            else:
                S[i] = 'P'

if S[len(S)-1] == '?':
    S[len(S)-1] = 'D'

strS = "".join(S)

print(strS)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def U1(a,b):
    if b > a:
        b, a = a, b
    while a%b != 0:
        r = a%b
        a = b
        b = r
    return b

K = int(input())
c = 0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans = U1(i,j)
            c += U1(k,ans)

print(c)

Fixed submission:
import collections

def U1(a,b):
    if b > a:
        b, a = a, b
    while a%b != 0:
        r = a%b
        a = b
        b = r
    return b

K = int(input())
c = 0
arr = []

for i in range(1,K+1):
    for j in range(1,K+1):
        arr.append(U1(i,j))

arr=collections.Counter(arr)

for key,value in arr.items():
    for k in range(1,K+1):
        c += U1(k,key)*value

print(c)
Buggy python submission (verdict: Runtime Error):
import collections

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

x = collections.Counter(X)

s = min(list(x.keys()))
e = max(list(x.keys()))

xl = list(x)

m = [0]*(e+1-s)

for i in range(s, e+1):
    p = 0
    for j in range(N):
        p += pow(xl[j]-i,2) * x[xl[j]]
    m[i-s] = p

print(min(m))

Fixed submission:
import collections

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

x = collections.Counter(X)

N = len(x)
s = min(list(x.keys()))
e = max(list(x.keys()))

xl = list(x)

m = [0]*(e+1-s)

for i in range(s, e+1):
    p = 0
    for j in range(N):
        p += pow(xl[j]-i,2) * x[xl[j]]
    m[i-s] = p

print(min(m))
Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())
S = ['']*N

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

s = collections.Counter(S)

max_list = [ml[0] for ml in s.items() if ml[1] == max(s.values())]
max_list.sort()

for i in max_list:
    print(i)

Fixed submission:
import collections

N = int(input())
S = ['']*N

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

s = collections.Counter(S)

max_num = max(s.values())

ans = []

for k, v in s.items():
    if v == max_num:
        ans.append(k)

ans.sort()

print('\n'.join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

pl = [2]

if x == 2:
    print(2)
    exit()

cnt = 3
f = False

while True:
    if cnt == x:
        f = True
    for i in range(len(pl)):
        if cnt % pl[i] == 0:
            break
    else:
        pl.append(cnt)
        if f:
            print(cnt)
            exit()
    cnt += 1

Fixed submission:
import math

x = int(input())

while True:
    for i in range(2, int(math.sqrt(x))+1):
        if x % i == 0:
            break
    else:
        print(x)
        exit()
    x += 1
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int,input().split())

while A != B:
    if A > B:
        A, B = B, A
    A += A

print(A)

Fixed submission:
import math

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

print((A*B)//math.gcd(A,B))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
A.sort()
A.reverse()
ans=0
conf=[A[0]]
A.pop(0)


for elem in A:
    ans+=conf.pop(0)
    
    for _ in range(2):
        conf.append(elem)

print(ans)

Fixed submission:
from collections import deque
n=int(input())
A=list(map(int,input().split()))
A.sort()
A.reverse()
conf=[A[0]]
ans=0
con=deque(conf)
A.pop(0)


for elem in A:
    ans+=con.popleft()
    
    for _ in range(2):
        con.append(elem)

print(ans)
Buggy python submission (verdict: Runtime Error):
moji="abcdefghijklmnopqrstuvwxyz"
N=int(input())
def f(N):
    if N<=26:
        return moji[n-1]
    return f(N//26)+moji[N%26-1]

print(f(N))
    

Fixed submission:
t="abcdefghijklmnopqrstuvwxyz"
n=int(input())
def f(n):
    if n<=26:
        return t[n-1]
    return f((n-1)//26)+t[(n-1)%26]

print(f(n))

Buggy python submission (verdict: Runtime Error):
moji="abcdefghijklmnopqrstuvwxyz"
N=int(input())
def f(n):
    if N<=26:
        return moji[n-1]
    return f(N//26)+moji[N%26-1]

print(f(N))
    

Fixed submission:
t="abcdefghijklmnopqrstuvwxyz"
n=int(input())
def f(n):
    if n<=26:
        return t[n-1]
    return f((n-1)//26)+t[(n-1)%26]

print(f(n))
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np

X,n=map(int,input().split())
p=list(map(int,input().split()))
if n==0:
    print(X)
pp = list(map(lambda x: abs(x-X), p))
pp.sort()
for i in range(1,100):
    tmp=X-pp[0]-i
    if not tmp in p:
        print(tmp)
        sys.exit()
    tmpp=X-pp[0]+i
    if not tmpp in p:
        print(tmpp)
        sys.exit()


Fixed submission:
import sys
import numpy as np

X,n=map(int,input().split())
p=list(map(int,input().split()))
if n==0:
    print(X)
    sys,exit()
pp = list(map(lambda x: abs(x-X), p))
pp.sort()
for i in range(1,100):
    tmp=X-pp[0]-i
    if not tmp in p:
        print(tmp)
        sys.exit()
    tmpp=X-pp[0]+i
    if not tmpp in p:
        print(tmpp)
        sys.exit()
Buggy python submission (verdict: Runtime Error):
import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<=w:
    print('NO')
    sys.exit()
else:
    d=abs(a-b)
    s=v-w
    if d<=ts:
        print('YES')
        sys.exit()
print('NO')

Fixed submission:
import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<=w:
    print('NO')
    sys.exit()
else:
    d=abs(a-b)
    s=v-w
    if d<=t*s:
        print('YES')
        sys.exit()
print('NO')
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans=A[0]
for i in range(len(A)):
    ans*=A[i]

if ans>3=10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
import sys
N=int(input())
A=list(map(int,input().split()))
if 0 in A:
    print(0)
    sys.exit()


ans=1
for elem in A:
    ans*=elem
    if ans>10**18:
        print(-1)
        sys.exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans=A[0]
for i in range(len(A)):
    ans*=A[i]

if ans>3:
    =10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
import sys
N=int(input())
A=list(map(int,input().split()))
if 0 in A:
    print(0)
    sys.exit()


ans=1
for elem in A:
    ans*=elem
    if ans>10**18:
        print(-1)
        sys.exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(float,input().split())
a=int(a)
b=int(b.replace('.',''))
print((a*b)//100)

Fixed submission:
#ACになったコード（その2）
a, b = input().split()
a = int(a)
b = int(b.replace('.',''))
print(a*b//100)
Buggy python submission (verdict: Runtime Error):
import sys
import math
from colletions import deque
N, M = map(int, input().split())
G=[[] for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)
q=deque()
done = [-1]*N
done[0]=1
q.appendleft(0)
while q:
    now=q.pop()
    for to in G[now]:
        if done[to] != -1:
            continue
        done[to]=now+1
        q.appendleft(to)
print('Yes')
print(*done[1:],sep='\n')

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import deque
 
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)
q = deque()
done = [-1]*N
done[0] = 1
q.appendleft(0)
while q:
    now = q.pop()
    for to in G[now]:
        if done[to] != -1: continue
        done[to] = now+1
        q.appendleft(to)
print("Yes")
print(*done[1:], sep="\n")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
a,b,c,k=map(int,input().split())
s=[]
for _ in range(a):
    s.append(1)
for _ in range(b):
    s.append(0)
for _ in range(c):
    s.append(-1)
s_s=s[:k]
print(sum(s_s))


Fixed submission:
import sys
import math
a,b,c,k=map(int,input().split())
if a>k:
    print(k)
elif a+b>=k or a>=k:
    print(a)
elif c>(k-(a+b)):
    s=k-(a+b)
    print(a-1*s)
else:
    print(a-c)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
H = list(map(int, input().split()))
a=[]
for _ in range(m):
    a.append(list(map(int,input().split())))

ans=n

for i in range(1,n+1):
    for j in range(m):
        k=a[j][0]
        l=a[j][1]
        if i==k or i==l:
            if i==k:
                if H[k-1]<=H[l-1]:
                    ans-=1
                    break
            else:
                if H[l-1]<=H[k-1]:
                    ans-=1
                    break
        else:
            continue

print(ans)

Fixed submission:
n,m = map(int,input().split())
h = list(map(int, input().split()))
tmp=[0]*n
for _ in range(m):
    a,b=map(int, input().split())
    tmp[a-1]=max(tmp[a-1],h[b-1])
    tmp[b-1]=max(tmp[b-1],h[a-1])
ans=0
for i in range(n):
    if h[i]>tmp[i]:
        ans+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
H = list(map(int, input().split()))
a=[]
for _ in range(m):
    a.append(list(map(int,input().split())))

ans=n

for i in range(1,n+1):
    for j in range(m):
        k=a[j][0]
        l=a[j][1]
        if i==k or i==l:
            if i==k:
                if H[k-1]<=H[l-1]:
                    ans-=1
                    break
            else:
                if H[l-1]<=H[k-1]:
                    ans-=1
                    break
        else:
            continue

print(ans)

Fixed submission:
n,m = map(int,input().split())
h = list(map(int, input().split()))
tmp=[0]*n
for _ in range(m):
    a,b=map(int, input().split())
    tmp[a-1]=max(tmp[a-1],h[b-1])
    tmp[b-1]=max(tmp[b-1],h[a-1])
ans=0
for i in range(n):
    if h[i]>tmp[i]:
        ans+=1

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

print(total)


Fixed submission:
k = int(input())
import math
from functools import reduce
total = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            total += reduce(math.gcd,(i,j,l))

print(total)

Buggy python submission (verdict: Runtime Error):
k = int(input())
import fractions as f
a = [1]*3
total = 0
for i in range(1,k+1):
    total += f.gcd(a[0],a[1],a[i])
for i in range(1,k+1):
    total += f.gcd(a[0],a[i],a[2])
    if i == k:
        for j in range(1,k+1):
            total += f.gcd(a[0],a[i],a[j])
for i in range(1,k):
    total += f.gcd(a[i],a[1],a[2])
    if i == k:
        for j in range(1,k+1):
            total += f.gcd(a[i],a[1],a[j])
            if j == k:
                for l in range(1,k):
                    total += f.gcd(a[i],a[l],a[j])


print(total)



Fixed submission:
k = int(input())
import math
from functools import reduce
total = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            total += reduce(math.gcd,(i,j,l))

print(total)
Buggy python submission (verdict: Runtime Error):
abc = input().split() 
abc[0],abc[1],abc[2] = abc[2],abc[0],abc[1]
print(f'{abc[0]} {abc[1]} {abc[2]}')


Fixed submission:
x, y, z = map(int,input().split())
print(z,x,y)

Buggy python submission (verdict: Runtime Error):
abc = list(map(int, input().split()))
abc[0],abc[1],abc[2] = abc[2],abc[0],abc[1]
print(f'{abc[0]} {abc[1]} {abc[2]}')


Fixed submission:
x, y, z = map(int,input().split())
print(z,x,y)

Buggy python submission (verdict: Runtime Error):
import copy
abc = list(map(int, input().split()))
ABC = copy.copy(abc)
ABC[0] = abc[2]
ABC[1] = abc[0]
ABC[2] = abc[1]
print(f'{ABC[0]} {ABC[1]} {ABC[2]}')


Fixed submission:
x, y, z = map(int,input().split())
print(z,x,y)

Buggy python submission (verdict: Runtime Error):
import copy
abc = list(map(int, input().split()))
ABC = copy.copy(abc)
ABC[0] = abc[2]
ABC[1] = abc[0]
ABC[2] = abc[1]
print(f'{ABC[0]} {ABC[1]} {ABC[2]}')


Fixed submission:
x, y, z = map(int,input().split())
print(z,x,y)
Buggy python submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
tmp=[-1]*n
for _ in range(m):
    s,c=map(int,input().split())
    s-=1
    if tmp[s]<0:
        tmp[s]=c
    if tmp[s]!=c:
        print(-1)
        sys.exit()
if tmp[0]==0 and n>1:
    print(-1)
    sys.exit()
if tmp[0]<0 and n>1:
    tmp[0]=1
if n==1 and tmp[0]==-1:
    tmp[0]=0
for i in range(1,n):
    if tmp[i]<0:
        tmp[i]=0
t=''.join(tmp)
print(t)

Fixed submission:
import sys
n,m=map(int,input().split())
tmp=[-1]*n
for _ in range(m):
    s,c=map(int,input().split())
    s-=1
    if tmp[s]<0:
        tmp[s]=c
    if tmp[s]!=c:
        print(-1)
        sys.exit()
if tmp[0]==0 and n>1:
    print(-1)
    sys.exit()
if tmp[0]<0 and n>1:
    tmp[0]=1
if n==1 and tmp[0]==-1:
    tmp[0]=0
for i in range(1,n):
    if tmp[i]<0:
        tmp[i]=0
for i in tmp:
    print(i,end='')

Buggy python submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
tmp=[-1]*n
for _ in range(m):
    s,c=map(int,input().split())
    s-=1
    if tmp[s]<0:
        tmp[s]=c
    if tmp[s]!=c:
        print(-1)
        sys.exit()
if tmp[0]==0 n>1:
    print(-1)
    sys.exit()
if tmp[0]<0 and n>1:
    tmp[0]=1
if n==1 and tmp[0]==-1:
    tmp[0]=0
for i in range(1,n):
    if tmp[i]<0:
        tmp[i]=0
t=''.join(tmp)
print(t)

Fixed submission:
import sys
n,m=map(int,input().split())
tmp=[-1]*n
for _ in range(m):
    s,c=map(int,input().split())
    s-=1
    if tmp[s]<0:
        tmp[s]=c
    if tmp[s]!=c:
        print(-1)
        sys.exit()
if tmp[0]==0 and n>1:
    print(-1)
    sys.exit()
if tmp[0]<0 and n>1:
    tmp[0]=1
if n==1 and tmp[0]==-1:
    tmp[0]=0
for i in range(1,n):
    if tmp[i]<0:
        tmp[i]=0
for i in tmp:
    print(i,end='')

Buggy python submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
tmp=[0]*n
if m==0:
    print(-1)
for _ in range(m):
    s,c=map(int,input().split())
    if tmp[s-1]==0:
        tmp[s-1]=c
    elif s-1==0 and c==0:
        print(-1)
    else:
        if tmp[s-1]==c:
            continue
        else:
            print(-1)
        sys.exit()
print(100*tmp[0]+10*tmp[1]+tmp[2])

Fixed submission:
import sys
n,m=map(int,input().split())
tmp=[-1]*n
for _ in range(m):
    s,c=map(int,input().split())
    s-=1
    if tmp[s]<0:
        tmp[s]=c
    if tmp[s]!=c:
        print(-1)
        sys.exit()
if tmp[0]==0 and n>1:
    print(-1)
    sys.exit()
if tmp[0]<0 and n>1:
    tmp[0]=1
if n==1 and tmp[0]==-1:
    tmp[0]=0
for i in range(1,n):
    if tmp[i]<0:
        tmp[i]=0
for i in tmp:
    print(i,end='')
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
a = 0
b = 0
for i in range(n):
    if A[i] %2 = 0:
        a +=1
        if A[i] %3= 0 or A[i]%5=0:
            b +=1
if a == b:
    print('APPROVED')
else:
    print('DENIED')

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
a = 0
b = 0
for i in range(n):
    if A[i] %2 == 0:
        a +=1
        if A[i] %3== 0 or A[i]%5==0:
            b +=1
if a == b:
    print('APPROVED')
else:
    print('DENIED')
Buggy python submission (verdict: Runtime Error):
import sys
N=int(input())
A=list(map(int,input().split()))
A.sort()
for i in range(N):
    if A[i]==A[i+1]:
        print('NO')
        sys.exit()
print('YES')

Fixed submission:
import sys
N=int(input())
A=list(map(int,input().split()))
A.sort()
for i in range(1,N):
    if A[i-1]==A[i]:
        print('NO')
        sys.exit()
print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())
A=list(map(int,input().split()))
tmp=[]
for i in A:
    if not i in tmp:
        tmp.append(i)
    else:
        print('NO')
        sys.exit()
print('YES')

Fixed submission:
import sys
N=int(input())
A=list(map(int,input().split()))
A.sort()
for i in range(1,N):
    if A[i-1]==A[i]:
        print('NO')
        sys.exit()
print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N=int(input())
A=list(map(int,input().split()))
tmp=[x for x in set(A) if A.count(x) > 1]
if len(tmp)==0:
    print('YES')
else:
    print('NO')

Fixed submission:
import sys
N=int(input())
A=list(map(int,input().split()))
A.sort()
for i in range(1,N):
    if A[i-1]==A[i]:
        print('NO')
        sys.exit()
print('YES')
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input()split())
if n <= m:
    print('Yes')
else:
    print('No')

Fixed submission:
n,m = map(int, input().split())
if n <= m:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int, input().split())
for _ in range(k):
    if a>=1:
        a-=1
    elif b>=1:
        b-=1
    if a==0 and b==0:
        break
print(a,b)

Fixed submission:
import sys
a,b,k=map(int, input().split())
l=k-a
if l<0:
    print(a-k,b)
    sys.exit()
m=l-b
if m<0:
    print(0,b-l)
    sys.exit()
else:
    print(0,0)
    sys.exit()

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int, input().split())
for _ in range(k):
    if a>=1:
        a-=1
    elif b>=1:
        b-=1
    if a==0 and b==0:
        continue
print(a,b)

Fixed submission:
import sys
a,b,k=map(int, input().split())
l=k-a
if l<0:
    print(a-k,b)
    sys.exit()
m=l-b
if m<0:
    print(0,b-l)
    sys.exit()
else:
    print(0,0)
    sys.exit()
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a+b == 3:
    print(3)
elif a+b ==5
    print(1)
else:
    print(2)

Fixed submission:
a = int(input())
b = int(input())
if a+b == 3:
    print(3)
elif a+b == 5:
    print(1)
else:
    print(2)
Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b=map(int,input().split())
print((a*b)//np.gcd(a,b))

Fixed submission:
from fractions import gcd
a,b=map(int,input().split())
print((a*b)//gcd(a,b))

Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print((a*b)//math.gcd(a,b))

Fixed submission:
from fractions import gcd
a,b=map(int,input().split())
print((a*b)//gcd(a,b))

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:
from fractions import gcd
a,b=map(int,input().split())
print((a*b)//gcd(a,b))

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a,b=map(int,input().split())
print(lcm(a, b))

Fixed submission:
from fractions import gcd
a,b=map(int,input().split())
print((a*b)//gcd(a,b))