Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
list1 = list(map(int, input().split()))
a = list1[0]
b = list1[1]
c = list1[2]
k = list1[3]

pointH =a
pointM =b
pointL =c

if a ==b and b ==c:
    print(0)
else:
    index =0
    while index<k:
        list2 = [pointM+pointL,pointL+pointH,pointH+pointM]
        pointH = list2[0]
        pointM = list2[1]
        pointL = list2[2]
        index+=1

    if pointH-pointM>10**18:
        print("Unfair")
    else:
        print(pointH-pointM)

Fixed submission:
list1 = list(map(int, input().split()))
a = list1[0]
b = list1[1]
c = list1[2]
k = list1[3]


if k%2 ==0:
    ans = a-b
else:
    ans = b-a

if ans>10**18:
    print("Unfair")
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
listN=range(a,b+1)
index=0
while index<len(listN):
    if index<k or index>len(listN)-k-1:
        print(listN[index])
    index+=1

Fixed submission:
a, b, k = map(int, input().split())
listN=range(a,b+1)
index=0
if k>len(listN):
    for number in listN:
        print(number)
else:
    listForP=[]
    index1=0
    while index<k:
        print(listN[index])
        listForP.append(listN[index])
        index+=1
    index2=len(listN)-k
    while index2<len(listN):
        if listN[index2] not in listForP:
            print(listN[index2])
        index2+=1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
visitSpot = list(map(int, input().split()))
listForAnswer =[]
index=0
while index<len(visitSpot):
    index2=0
    sum=0
    while index2<len(visitSpot):
        if index2 ==index:
            index2+=1
        elif sum ==0:
            sum+=(max(visitSpot[index2], 0)-min(visitSpot[index2],0))
            index2+=1
        else:
            if index2-1 != index:
                sum+=(max(visitSpot[index2], visitSpot[index2-1])-min(visitSpot[index2],visitSpot[index2-1]))
            else:
                sum+=(max(visitSpot[index2], visitSpot[index2-2])-min(visitSpot[index2],visitSpot[index2-2]))
                flag =0
            index2+=1
    if index2-1!=index:
        sum+=(max(visitSpot[index2-1], 0)-min(visitSpot[index2-1],0))
    else:
        sum+=(max(visitSpot[index2-2], 0)-min(visitSpot[index2-2],0))
    listForAnswer.append(sum)
    index+=1

for ans in listForAnswer:
    print(ans)

Fixed submission:
n = int(input())
listA = list(map(int, input().split()))
sumOriginal =0
index =0
while index<len(listA):
    if index == 0:
        sumOriginal+=(max(listA[index], 0)-min(listA[index], 0))
    elif index == len(listA)-1:
        sumOriginal+=(max(listA[index], 0)-min(listA[index], 0))
        sumOriginal+=(max(listA[index], listA[index-1])-min(listA[index], listA[index-1]))
    else:
        sumOriginal+=(max(listA[index], listA[index-1])-min(listA[index], listA[index-1]))
    index+=1

index2=0
listForAnswer =[]
while index2<len(listA):
    sumAnswer=0
    if index2 ==0:
        sumAnswer = sumOriginal-(max(listA[index2], 0)-min(listA[index2], 0))
        sumAnswer-=(max(listA[index2], listA[index2+1])-min(listA[index2], listA[index2+1]))
        sumAnswer+=(max(listA[index2+1], 0)-min(listA[index2+1], 0))
    elif index2 ==len(listA)-1:
        sumAnswer =sumOriginal-(max(listA[index2], 0)-min(listA[index2], 0))
        sumAnswer-=(max(listA[index2], listA[index2-1])-min(listA[index2], listA[index2-1]))
        sumAnswer+=(max(listA[index2-1], 0)-min(listA[index2-1], 0))
    else:
        sumAnswer =sumOriginal-(max(listA[index2], listA[index2+1])-min(listA[index2], listA[index2+1]))
        sumAnswer-=(max(listA[index2], listA[index2-1])-min(listA[index2], listA[index2-1]))
        sumAnswer+=(max(listA[index2-1], listA[index2+1])-min(listA[index2-1], listA[index2+1]))
    listForAnswer.append(sumAnswer)
    index2+=1

for ans in listForAnswer:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listForA=[]

index=0
while index < n:
    inputN = int(input())
    if inputN in listForA:
        listForA.remove(inputN)
    else:
        listForA.append(inputN)
    index+=1

print(len(listForA))

Fixed submission:
n = int(input())
listForA=[]

index=0
while index < n:
   listForA.append(int(input()))
   index+=1

listForA.sort()
index2 =0
beforeC=""
count=0
allCount=0
while index2 < n:
    if index2==0:
        beforeC=listForA[index2]
        count=1
    else:
        if beforeC == listForA[index2]:
            count+=1
        else:
            if count%2==1:
                allCount+=1
            beforeC = listForA[index2]
            count=1
    index2+=1
if count%2==1:
    allCount+=1

print(allCount)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listA = list(map(int, input().split()))
listB=[]

index=0
while index < n:
    a = listA[index]
    if index%2==0:
        listC=[a]
        listC.extend(listB)
        listB=listC
    else:
        listB.append(a)
    index+=1
if n%2==0:
    listB.reverse()

print(" ".join(list(map(str, listB))))

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

stA=""
if n%2 == 0:
    index = len(listA)-1
    while index > 0:
        if index== len(listA)-1:
            stA +=str(listA[index])
        else:
            stA+=" "+str(listA[index])
        index-=2
    index = 0
    while index < len(listA)-1:
        stA+=" "+str(listA[index])
        index+=2
else:
    index = len(listA)-1
    while index > -1:
        if index == len(listA)-1:
            stA += str(listA[index])
        else:
            stA += " "+str(listA[index])
        index -= 2
    index = 1
    while index < len(listA)-1:
        stA += " "+str(listA[index])
        index += 2
        
print(stA)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listA = list(map(int, input().split()))
listB=[]

index=0
while index < n:
    a = listA[index]
    if index%2==0:
        listB.insert(0, a)
    else:
        listB.append(a)
    index+=1
if n%2==0:
    listB.reverse()

print(" ".join(list(map(str, listB))))

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

stA=""
if n%2 == 0:
    index = len(listA)-1
    while index > 0:
        if index== len(listA)-1:
            stA +=str(listA[index])
        else:
            stA+=" "+str(listA[index])
        index-=2
    index = 0
    while index < len(listA)-1:
        stA+=" "+str(listA[index])
        index+=2
else:
    index = len(listA)-1
    while index > -1:
        if index == len(listA)-1:
            stA += str(listA[index])
        else:
            stA += " "+str(listA[index])
        index -= 2
    index = 1
    while index < len(listA)-1:
        stA += " "+str(listA[index])
        index += 2
        
print(stA)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listA = list(map(int, input().split()))
listB=[]

index=0
while index < n:
    a = listA[index]
    listB.append(a)
    listB.reverse()
    index+=1

print(" ".join(list(map(str, listB))))

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

stA=""
if n%2 == 0:
    index = len(listA)-1
    while index > 0:
        if index== len(listA)-1:
            stA +=str(listA[index])
        else:
            stA+=" "+str(listA[index])
        index-=2
    index = 0
    while index < len(listA)-1:
        stA+=" "+str(listA[index])
        index+=2
else:
    index = len(listA)-1
    while index > -1:
        if index == len(listA)-1:
            stA += str(listA[index])
        else:
            stA += " "+str(listA[index])
        index -= 2
    index = 1
    while index < len(listA)-1:
        stA += " "+str(listA[index])
        index += 2
        
print(stA)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listA=[]
listIndexStock=[0]
index=0
while index < n:
    a = int(input())
    listA.append(a)
    index+=1

buttonLighted=0
pushCounter=0
index=0
while 1:
    pushCounter+=1
    if listA[buttonLighted] == 2:
        print(pushCounter)
        break
    elif listA[buttonLighted]-1 in listIndexStock:
        print(-1)
        break
    else:
        buttonLighted = listA[buttonLighted]-1
        listIndexStock.append(buttonLighted)


Fixed submission:
import time

n = int(input())
listA=[]
index=0
while index < n:
    a = int(input())
    listA.append(a)
    index+=1

startT = time.time()
buttonLighted=0
pushCounter=0
index=0
while 1:
    pushCounter+=1
    if listA[buttonLighted] == 2:
        print(pushCounter)
        break
    else:
        buttonLighted = listA[buttonLighted]-1
    if time.time()-startT > 0.9:
        print(-1)
        break
Buggy python submission (verdict: Runtime Error):
n = int(input())
listForList=[]

index=0
while index < n:
    listI = list(input())
    listI.sort()
    listForList.append(listI)
    index+=1

if len(listForList)==1:
    print("".join(listForList[0]))
else:
    index2=1
    pendingL=listForList[0]
    while index2 < len(listForList):
        newPL=[]
        for ch in pendingL:
            if ch in listForList[index2]:
                newPL.append(ch)
        pendingL = newPL
        if pendingL==[]:
            print("")
            break
        index2+=1

if index2 == len(listForList):
    print("".join(pendingL))

Fixed submission:

n = int(input())
listForList = []

index = 0
while index < n:
    listI = list(input())
    listI.sort()
    listForList.append(listI)
    index += 1

if len(listForList) == 1:
    print("".join(listForList[0]))
else:
    index2 = 0
    pendingL = []
    while index2 < len(listForList)-1:
        if index2 == 0:
            for c in listForList[index2]:
                if c in listForList[index2+1]:
                    pendingL.append(c)
        else:
            newPL = []
            for ch in pendingL:
                if ch in listForList[index2+1]:
                    newPL.append(ch)
                    listForList[index2+1].remove(ch)
            pendingL = newPL
            if pendingL == []:
                print("")
                break
        index2 += 1

    if index2 == len(listForList)-1:
        print("".join(pendingL))

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

index=0
while index < n:
    listI = list(input())
    listI.sort()
    listForList.append(listI)
    index+=1

if len(listForList)==1:
    print("".join(listForList[0]))
else:
    index2=0
    pendingL=[]
    while index2 < len(listForList)-1:
        if index2 ==0:
            for c in listForList[index2]:
                if c in listForList[index2+1]:
                    pendingL.append(c)
        else:
            newPL=[]
            for ch in pendingL:
                if ch in listForList[index2+1]:
                    newPL.append(ch)
            pendingL = newPL
            if pendingL==[]:
                print("")
                break
        index2+=1

if index2 == len(listForList)-1:
    print("".join(pendingL))
        

Fixed submission:

n = int(input())
listForList = []

index = 0
while index < n:
    listI = list(input())
    listI.sort()
    listForList.append(listI)
    index += 1

if len(listForList) == 1:
    print("".join(listForList[0]))
else:
    index2 = 0
    pendingL = []
    while index2 < len(listForList)-1:
        if index2 == 0:
            for c in listForList[index2]:
                if c in listForList[index2+1]:
                    pendingL.append(c)
        else:
            newPL = []
            for ch in pendingL:
                if ch in listForList[index2+1]:
                    newPL.append(ch)
                    listForList[index2+1].remove(ch)
            pendingL = newPL
            if pendingL == []:
                print("")
                break
        index2 += 1

    if index2 == len(listForList)-1:
        print("".join(pendingL))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

power=1
index=2
while index < n+1:
    power*=index
    index+=1

if power > 10**9 + 7:
    print(power%(10**9 + 7))
else:
    print(power)

Fixed submission:
n = int(input())

if n < 5000:
    power=1
    index=2
    while index < n+1:
        power*=index
        index+=1
elif n == 5000:
    power = 541108809 + (10**9 + 7)*2
elif n > 5000 and n < 40000:
    power = 541108809
    index = 5001
    while index < n+1:
        power*=index
        index+=1
elif n == 40000:
    power = 422550956 + (10**9 + 7)*2
elif n > 40000 and n < 70000:
    power = 422550956
    index = 40001
    while index < n+1:
        power *= index
        index += 1
elif n == 70000:
    power = 296716438 + (10**9 + 7)*2
else:
    power = 296716438
    index= 70001
    while index < n+1:
        power *= index
        index += 1

if power > 10**9 + 7:
    print(power%(10**9 + 7))
else:
    print(power)
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())

if a >0:
    print("Positive")
elif a < 1 and b >-1:
    print("Zero")
else:
    index=a
    count=0
    while index < b+1:
        if index <0:
            count+=1
        index+=1
    if count%2==0:
        print("Positive")
    else:
        print("Negative")

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

if a >0:
    print("Positive")
elif a < 1 and b >-1:
    print("Zero")
else:
    if (b-a+1)%2==0:
        print("Positive")
    else:
        print("Negative")
Buggy python submission (verdict: Runtime Error):
from collections import deque

n,m,k = map(int, input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]

x = deque(a)
y = deque(b)

ans=0
for i in range(n + m):
    print(x, y)
    try:
        temp = x.popleft() if x[0] < y[0] else y.popleft()
    except:
        if len(x) == 0:
            temp = y.popleft()
        elif len(y) == 0:
            temp=x.popleft()
            print(temp)

    k -= int(temp)
    if k >= 0:
        ans += 1
    else:
        break
print(ans)

Fixed submission:
n,m,k = map(int, input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]

t = sum(b)
j = m
ans = 0
for i in range(n+1):
    while j > 0 and t > k:
        j -= 1
        t -= b[j]
    if t > k: break
    ans = max(ans, i + j)
    if i==n:break
    t+=a[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
b=[]
c=[]
for _ in range(q):
    x,y=map(int,input().split())
    b.append(x)
    c.append(y)

d=[0]*100001
for i in a:
    d[i]+=1

for m,p in zip(b,c):
    minus=d[m]
    d[m]=0
    d[p]+=minus
    ans=0
    for i in range(len(d)):
        ans+=i*d[i]
    print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
b=[]
c=[]
for _ in range(q):
    x,y=map(int,input().split())
    b.append(x)
    c.append(y)

d=[0]*100001
for i in a:
    d[i]+=1

ans=sum(a)
for m,p in zip(b,c):
    minus=d[m]
    d[m]=0
    d[p]+=minus
    ans+=(p-m)*minus
    print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
b=[]
c=[]
for _ in range(q):
    x,y=map(int,input().split())
    b.append(x)
    c.append(y)

d=[0]*10001
for i in a:
    d[i]+=1

for m,p in zip(b,c):
    minus=d[m]
    d[m]=0
    d[p]+=minus
    ans=0
    for i in range(len(d)):
        ans+=i*d[i]
    print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
b=[]
c=[]
for _ in range(q):
    x,y=map(int,input().split())
    b.append(x)
    c.append(y)

d=[0]*100001
for i in a:
    d[i]+=1

ans=sum(a)
for m,p in zip(b,c):
    minus=d[m]
    d[m]=0
    d[p]+=minus
    ans+=(p-m)*minus
    print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
b=[]
c=[]
for _ in range(q):
    x,y=map(int,input().split())
    b.append(x)
    c.append(y)

d=[0]*10000
for i in a:
    d[i]+=1

for m,p in zip(b,c):
    minus=d[m]
    d[m]=0
    d[p]+=minus
    ans=0
    for i in range(len(d)):
        ans+=i*d[i]
    print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
b=[]
c=[]
for _ in range(q):
    x,y=map(int,input().split())
    b.append(x)
    c.append(y)

d=[0]*100001
for i in a:
    d[i]+=1

ans=sum(a)
for m,p in zip(b,c):
    minus=d[m]
    d[m]=0
    d[p]+=minus
    ans+=(p-m)*minus
    print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque

n, m = map(int, input().split())

graph = [[] for _ in range(n+1)]
for i in range(m):
    a,b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

print(graph)

dist = [-1] * (n + 1)
dist[0] = 0
dist[1] = 0

d=deque()
d.append(1)

while d:
    print(d)
    print(dist)
    v = d.popleft()
    
    for i in graph[v]:
        if dist[i] != -1:
            continue
        dist[i] = dist[v] + 1
        d.append(i)
        
ans = dist[2:]
print('Yes')
print(*ans,sep='\n')



Fixed submission:
from collections import deque

n, m = map(int, input().split())

graph = [[] for _ in range(n+1)]
for i in range(m):
    a,b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

dist = [0] * (n + 1)

d=deque()
d.append(1)

while d:
    v = d.popleft()
    
    for i in graph[v]:
        if not dist[i]:
            dist[i] = v
            d.append(i)

ans = dist[2:]
print('Yes')
print(*ans,sep='\n')
Buggy python submission (verdict: Runtime Error):
s,w = map(int, input().split())

print('unsafe' if s=<w else 'safe')

Fixed submission:
s,w = map(int, input().split())
print('unsafe' if s<=w else 'safe')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a = [int(_) for _ in input().split()]
for i in range(1,n+1):
    print(a.count(i))

Fixed submission:
import collections

n=int(input())
a = [int(_) for _ in input().split()]

c=collections.Counter(a)
for i in range(1,n+1):
    print(c[i])
Buggy python submission (verdict: Runtime Error):
from math import factorial as fact
n,m=map(int,input().split())
i,k=0,0
if n<2 and m<2:
  print(0)
else:
  if n!=0:
  	i=fact(n)/fact(2)/fact(n-2)
  if m!=0:
    k=fact(m)/fact(2)/fact(m-2)
  print(int(i+k))

Fixed submission:
from math import factorial as fact
n,m=map(int,input().split())
i,k=0,0
if n<2 and m<2:
  print(0)
else:
  if n==0:i=0
  elif n==2:
  	i=1
  elif n!=1:
    i=fact(n)/fact(2)/fact(n-2)
  if m==0:k=0
  elif m==2:
  	k=1
  elif m!=1:
    k=fact(m)/fact(2)/fact(m-2)
  print(int(i+k))
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
s = ('b' * a + 'r' * b) * n
print(s[0:n].count('b'))

Fixed submission:
n,a,b=map(int,input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans+=min(a,rem)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,a,b=[int(i) for i in input().split()]
s=''
s+='b'*a
s+='r'*b
s*=n//(a+b)+1
print(s[:n].count('b'))


Fixed submission:
n,a,b=map(int,input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans+=min(a,rem)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
s=''
s+='b'*a
s+='r'*b
s*=n//(a+b)+1
print(s[:n].count('b'))


Fixed submission:
n,a,b=map(int,input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans+=min(a,rem)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
s=''
for i in range(n//(a+b)+1):
  s+='b'*a
  s+='r'*b
print(s[:n].count('b'))


Fixed submission:
n,a,b=map(int,input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans+=min(a,rem)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,a,b=map(int,input().split())
li=[]
for i in range(n//(a+b)+1):
  for k in range(a):
    li.append('b')
  for m in range(b):
    li.append('r')
print(li[:n].count('b'))


Fixed submission:
n,a,b=map(int,input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans+=min(a,rem)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))
imax=int(max(x))
imin=int(min(x))
lis=[]
re=0
for k in range(imin,imax+1):
  for i in x:
    re=re+(x[i]-k)**2
  lis.append(re)
  re=0
print(min(lis))

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
imax=int(max(x))
imin=int(min(x))
lis=[]
re=0
for k in range(imin,imax+1):
  for i in x:
    re=re+(i-k)**2
  lis.append(re)
  re=0
print(min(lis))
Buggy python submission (verdict: Runtime Error):
N = int(input())
array = [int(x) for x in input().split()]
for i in array:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      fg = True
    else:
      fg = False
if fg: print('APPROVED')
else: print('DENIED')

  

Fixed submission:
N = int(input())
array = [int(x) for x in input().split()]
fl=True
for i in array:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
        fl = False
if fl: print('APPROVED')
else:print('DENIED')

Buggy python submission (verdict: Runtime Error):
N = int(input())
array = [int(x) for x in input().split()]
for i in array:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      fg = True
    else:
      fg = False
      print('DENIED')
      break
if fg:
  print('APPROVED') 

Fixed submission:
N = int(input())
array = [int(x) for x in input().split()]
fl=True
for i in array:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
        fl = False
if fl: print('APPROVED')
else:print('DENIED')

Buggy python submission (verdict: Runtime Error):
N = int(input().strip())
array = [int(x) for x in input().split()]
for i in array:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      fg = True
    else:
      fg = False
      print('DENIED')
      break
if fg:
  print('APPROVED') 

Fixed submission:
N = int(input())
array = [int(x) for x in input().split()]
fl=True
for i in array:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
        fl = False
if fl: print('APPROVED')
else:print('DENIED')

Buggy python submission (verdict: Runtime Error):
N = int(input().strip())
array = list(map(int, input().strip().split()))
for i in array:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      fg = True
    else:
      fg = False
      print('DENIED')
      break
if fg:
  print('APPROVED') 

Fixed submission:
N = int(input())
array = [int(x) for x in input().split()]
fl=True
for i in array:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
        fl = False
if fl: print('APPROVED')
else:print('DENIED')

Buggy python submission (verdict: Runtime Error):
N = int(input().strip())
array = list(map(int, input().strip().split()))
for i in array:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      fg = True
    else:
      fg = False
      print('DENIED')
      break
if fg:
  print('APPROVED') 
    

Fixed submission:
N = int(input())
array = [int(x) for x in input().split()]
fl=True
for i in array:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
        fl = False
if fl: print('APPROVED')
else:print('DENIED')
Buggy python submission (verdict: Runtime Error):
a,b,k=(long(i)for i in input().split())
while 0<k:
    if 0<a:a=a-1
    elif 0<b:b=b-1
    k=k-1
print(a,b)


Fixed submission:
s=input().split()
print(s[1]+s[0])
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=(int(i)for i in input().split())
for i in range(k):
    if 0<a:a=a-1
    elif 0<b:b=b-1
print(a,b)


Fixed submission:
a, b, k = map(int, input().split())
print(0,max(0,b+a-k)) if a<=k else print(a-k,b)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=(int(i)for i in input().split())
while 0<k:
    if 0<a:a=a-1
    elif 0<b:b=b-1
    k=k-1
print(a,b)


Fixed submission:
a, b, k = map(int, input().split())
print(0,max(0,b+a-k)) if a<=k else print(a-k,b)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print(c) if a*c=<b else print(b//a)

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

Fixed submission:
x,y = map(int, input().split())
print(x+(y//2))
Buggy python submission (verdict: Runtime Error):
print(input()[::int(input())]

Fixed submission:
print(input()[::int(input())])