Problem:


Score: 200 points

Problem Statement

You are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.

According to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:

All even numbers written on the document are divisible by 3 or 5.

If the immigrant should be allowed entry according to the regulation, output APPROVED; otherwise, print DENIED.

Notes

The condition in the statement can be rephrased as "If x is an even number written on the document, x is divisible by 3 or 5".
Here "if" and "or" are logical terms.

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq A_i \leq 1000

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \dots A_N

Output

If the immigrant should be allowed entry according to the regulation, print APPROVED; otherwise, print DENIED.

Sample Input 1

5
6 7 9 10 31

Sample Output 1

APPROVED

The even numbers written on the document are 6 and 10.

All of them are divisible by 3 or 5, so the immigrant should be allowed entry.

Sample Input 2

3
28 27 24

Sample Output 2

DENIED

28 violates the condition, so the immigrant should not be allowed entry.



Sample input:
5
6 7 9 10 31


Sample output:
APPROVED

Submission status: Accepted

Solution code:
n=int(input())
list1=list(map(int,input().split()))

ans=0
for i in range(n):
    if list1[i]%2==0:
        if list1[i]%3==0 or list1[i]%5==0:
            pass
        else:
            ans=1
            break
if ans==0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
A = input().split()
A = [int(i) for i in A]
t = 0
for i in range(N):
  if A[i] % 2 == 0:
    if A[i]%3 != 0 and A[i]%5 != 0:
      t += 1
    else:continue
  else:continue
if t == 0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
_ = int(input())

data = [int(i) for i in input().split() if int(i) % 2 == 0]

p = 'APPROVED'

for i in data:
  if i % 3 != 0 and i % 5 != 0:
    p = 'DENIED'

print(p)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

c = 0
for i in range(0,n):
  if a[i]%2==0:
    if a[i] %6 != 0 and a[i] %10 != 0:
      print('DENIED')
      c = 1
      break
      
if c == 0:
  print('APPROVED')

Submission status: Accepted

Solution code:
input() #Nはすてる
A = list(map(lambda x: int(x), input().split()))
denied = False
for a in A:
  if a%2==0:
    if a%3!=0 and a%5!=0:
      print('DENIED')
      denied = True
      break
if denied==False:
  print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
i = 1
for x in map(int, input().split()):
  if x % 2:
    continue
  if not x % 3:
    continue
  if not x % 5:
    continue
  i = 0
  break

print('APPROVED' if i else 'DENIED')

Submission status: Accepted

Solution code:
N = int(input())
A = [i for i in list(map(int, input().split(" "))) if i % 2 == 0 and i % 3 != 0 and i % 5 != 0]
if len(A) == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
A = [i for i in list(map(int, input().split(" "))) if i % 2 == 0]
if len([i for i in A if i % 3 != 0 and i % 5 != 0]) == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

i = 0
while i < n:
  if a[i] % 2 == 0:
    if a[i] % 3 != 0 and a[i] % 5 != 0:
      break
  
  i += 1

print('APPROVED' if i == n else 'DENIED')

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
x=0
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            x=0
        else:
            x=1
            break
if x==0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
ok = True
for a in [int(x) for x in input().split(' ')]:
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      ok = False
      break
if ok:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
nums = map(int, input().split(' '))

res = 'APPROVED'

for n in nums:
    if n % 2 == 0:
        if n % 3 == 0 or n % 5 == 0:
            pass
        else:
            res = 'DENIED'
            break

print(res)

Submission status: Accepted

Solution code:
n = int(input())
m = list(map(int, input().split()))

ans = "APPROVED"

for i in range(len(m)):
    if ans == "DENIED":
        break;
    if m[i] % 2 == 0:
        if m[i] % 5 == 0 or m[i] % 3 == 0:
            ans = 'APPROVED'
        else:
            ans = 'DENIED'
            break;

print(ans)

Submission status: Accepted

Solution code:
N = input()
nums = map(int, input().split())

flag = True
for n in nums:
    if n%2==0:
        if not (n%3==0 or n%5==0):
            flag = False

if flag:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
import sys

ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: [int(x) for x in ns().split()]
nall = lambda: [int(x) for x in sys.stdin.readlines()]

def main():
    _ = ni()
    xs = na()
    for x in xs:
        if x % 2 == 0:
            if x % 3 != 0 and x % 5 != 0:
                print('DENIED')
                return

    print('APPROVED')


main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

for i in a:
    if(i%2 == 0):
        if((i%3 != 0) & (i%5 != 0) ):
            print('DENIED')
            exit()

print('APPROVED')

Submission status: Accepted

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

if all([a%3 == 0 or a%5 == 0 for a in A if a%2 == 0]):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=[]
judge='APPROVED'
for i in range(n):
    if(a[i]%2==0):
        ans.append(a[i])
for j in range(len(ans)):
    if((ans[j]%3!=0)and(ans[j]%5!=0)):
        judge='DENIED'
print(judge)

Submission status: Accepted

Solution code:
N = int(input())
A_list = [int(e) for e in input().split()]

for A in A_list:
    if A%2==0 and A%3!=0 and A%5!=0:
        print("DENIED")
        break
else:
     print("APPROVED")

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            ans += 1
if ans == 0:
    print('APPROVED') 
else:
    print('DENIED')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = input() # 2 ~ 99
an = [int(x.strip()) for x in input().split(' ')]

count = 0
check = 0
for i in an:
  if i % 2 == 0:
    check += 1
    if i % 3 == 0 or i % 5 == 0:
      count += 1
if count == check or check == 0:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
n = input()
num = input().split()

tmp=[0]*int(n)
count=0

for i in range(int(n)) :
    l = int(num[i]) 
    if l % 2 == 0 :
        tmp[i]=1
        if l % 3 == 0 or l % 5 == 0 :
            count=count+1

if sum(tmp) == count :
    print('APPROVED')
else :
    print('DENIED')

Submission status: Accepted

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

a = [i for i in a if i%2==0]
a3 = [i%3!=0 for i in a]
a5 = [i%5!=0 for i in a]
if sum([1*(a3[i] and a5[i]) for i in range(len(a))])==0:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
input()
a = list(map(int, input().split()))
b = []
for i in range(len(a)):
  if (a[i] % 2) == 0:
    if (((a[i] % 3) == 0) or ((a[i] % 5) == 0)):
      b.append(True)
    else: 
      b.append(False)
if (False in b):
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
s=input().strip().split()
for j in range (N):
  n=int(s[j])
  if n %2 ==0:
    if n % 3 != 0 and n % 5 != 0:
      print("DENIED")
      break
  if j==N-1:
    print("APPROVED")

Submission status: Accepted

Solution code:
n=int(input())
num=0
num2=0
ar=list(map(int,input().split( )))
for i in range(n):
  if(ar[i]%2==0):
    num+=1
    if(ar[i]%3==0 or ar[i]%5==0):
      num2+=1
if(num==num2):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

flag = 0
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            flag = 1

if flag == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
import sys

lines = [l for l in sys.stdin]
length = int(lines[0])
digits = lines[1].split(' ')
nums = [int(s) for s in digits]

flag = 'APPROVED'
for n in nums:
  if n % 2 != 0: continue
  if n % 3 != 0 and n % 5 != 0:
    flag = 'DENIED'
    
print(flag)

Submission status: Accepted

Solution code:
a = input()
b = list(map(int,input().split()))
 
listdir = []
for i in b:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      listdir.append(i)
 
if len(listdir) >= 1:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())
Nx = input().split()
g = []
for x in Nx:
    x = int(x)
    if x % 2 == 0:
        g.append(x)
ans = 0
for i in g:
    if not i % 3 == 0:
        if not i % 5 == 0:
            ans = 1
            break
        else:
          continue
    else:
        continue
if ans == 1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
s = [int(x) for x in list(input().split()) if int(x)%2 == 0]
ans = "APPROVED"
for i in s:
  if i%5 != 0 and i%3 != 0:
    ans = "DENIED"
    pass
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
FLG=1

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

for i in range(N):
  if n[i]%2 == 0:
    # print(n[i]%2)
    if n[i]%3 != 0:
      if n[i]%5 != 0:
        FLG=0
   
if FLG == 0:
  ans = "DENIED"
else:
  ans = "APPROVED"

print(ans)

Submission status: Accepted

Solution code:
number = int(input())

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

count = 0

for i in range(number):
    if array[i] % 2 == 0:
        if (array[i] % 3 != 0) & (array[i] % 5 != 0):
            count += 1

if count == 0:
    print('APPROVED')

else:
    print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
i = 0
j = 0

for i in A:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      j = 1
      break
      
if j == 0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
N=int(input())
li=map(int,input().split())
a=0
for k in li:
  if k %2==0:
    if k%3==0 or k%5==0:
      continue
    else:
      a=1
      break
if a==0:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

ret = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            ret = 'DENIED'

print(ret)

Submission status: Accepted

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

B = list()
for i in range(len(A)):
    if A[i] % 2 == 0:
        B.append(A[i])

C = 0
for i in range(len(B)):
        if (B[i] % 3 == 0) or (B[i] % 5 == 0):
            C += 1 
    
if len(B) == C:
    print("APPROVED")
else :
    print("DENIED")

Submission status: Accepted

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

for x in A:
    if x % 2 == 0:
        if x % 3 != 0 and x % 5 != 0:
            print("DENIED")
            exit(0)
print("APPROVED")

Submission status: Accepted

Solution code:
def paoers_please():
    N=input()
    A=list(map(int,input().split()))
    E=[]
    for i in A:
        if i%2==0:
            E.append(i)
    for i in E:
        if i%3!=0 and i %5!=0:
            print('DENIED') 
            exit()
    print('APPROVED')
paoers_please()

Submission status: Accepted

Solution code:
n=int(input())

a=list(map(int,input().split()))
b=0
for i in range(n):

    if a[i-1]%2==1:
        b=b+1
    elif a[i-1]%3==0 or a[i-1]%5==0:
        b=b+1
    
if b==n:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:

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


B=[]

for i in range(N):
    if A[i]%2==1:
        B.append(0)
    elif A[i]%3==0:
        B.append(0)
    elif A[i]%5==0:
        B.append(0)
    else:
        B.append(1)

T = sum(B)

if T==0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
input()
f=1
for x in map(int,input().split()):
  if x%2==0 and x%3 and x%5:
    f=0
    break
if f:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
import sys
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      print("DENIED")
      sys.exit()

print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int,input().split()))
even = []
ans = []
for i in li:
    if i % 2 == 0:
        even.append(i)
for j in even:
    if j % 3 == 0 or j % 5 == 0:
        ans.append(j)
if len(even) == len(ans):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
import sys

def sol(a, n):
  for i in range(0, n):
    x = a[i]
    if x%2 == 0:
      if x%3 != 0 and x%5 != 0:
        return False
  return True

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

if sol(a, n) == True:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
n=int(input())
flag=0

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

for i in range(n):
	if(a[i]%2==0):
		if(a[i]%3!=0 and a[i]%5!=0):
			flag=1

if(flag==1):
	print("DENIED")
else:
	print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
list = input().split()
flg=True
for i in list :
	i = int(i)
	if i%2==0 and not(i%3==0 or i%5==0):
		flg=False
		
if flg:
	print("APPROVED")
else:
	print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
lst = list(map(int,input().split()))

flg = True
for i in range(n):
    if lst[i]%2!=0:
        continue
    if lst[i]%3==0 or lst[i]%5==0:
        continue
    else:
        flg=False
        break
print('APPROVED' if flg else 'DENIED')

Submission status: Accepted

Solution code:
#ABC155B
n=int(input())
a=list(map(int,input().split()))
res=True
for i in range(len(a)):
    if a[i]%2==0 and (a[i]%3!=0 and a[i]%5!=0):
        res=False
if res:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = "APPROVED"

for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            ans = "DENIED"
            
print(ans)

Submission status: Accepted

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

even_list = [i for i in A if i % 2 == 0 ]
ans = 0
for j in even_list:
    if j % 3 == 0 or j % 5 == 0:
        continue
    else:
        ans += 1
if ans == 0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
n = int(input())
x = list(map(int, input().split()))
x = [i for i in x if i % 2 == 0]
x = [i for i in x if i % 3 != 0 and i % 5 != 0]
print("APPROVED") if len(x) == 0 else print("DENIED")

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))
a = a[a % 2 == 0]
if np.all((a % 3 == 0) | (a % 5 == 0)):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
inp = input().split()
def check(n, inp):
    for i in range(n):
        num = int(inp[i])
        if ((num%2) == 0):
            if ((num%3) != 0) and ((num%5) != 0):
                return 1
    return 0
judge = check(n, inp)
if judge ==1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split(' ')))

approved = True
for val in v:
	if (val % 2 == 0):
		if (val % 3 != 0 and val % 5 != 0):
			approved = False
			
if (approved):
	print('APPROVED')
else:
	print('DENIED')

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            print("DENIED")
            exit()

print("APPROVED")

Submission status: Accepted

Solution code:
n=int(input())
a=input().split(" ")
s="APPROVED"

for i in range(n):
  t = int(a[i])
  if t%2==0:
    if t%3 != 0 and t%5!=0:
      s="DENIED"
      
print(s)

Submission status: Accepted

Solution code:
import sys
n = int(input())
a = list(map(int, input().split()))
for num in a:
    if (num % 2 == 0):
        if (num % 3 != 0 and num % 5 != 0):
            print('DENIED')
            sys.exit()
print('APPROVED')

Submission status: Accepted

Solution code:
def ApproveOrDeny(number_list):
  for num in number_list:
    if num % 2 == 0:
      if num % 3 != 0 and num % 5 != 0:
        return 'DENIED'
  return 'APPROVED'
 
N = int(input())
number_list = list(map(int, input().split()))
print (ApproveOrDeny(number_list))

Submission status: Accepted

Solution code:
n=int(input())
alis=list(map(int,input().split()))
counter=1
for i in range(n):
	if alis[i]%2==0:
		if alis[i]%3==0 or alis[i]%5==0:
			counter*=1
		else:
			counter*=0
print("APPROVED" if counter==1 else "DENIED")

Submission status: Accepted

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

b = 0

for i in range(N):
  if a[i]%2 == 0:
    if a[i]%3 != 0:
      if a[i]%5 != 0:
        b = 1
        break

if b == 1:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

Solution code:

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

    for i in range(N):
        if A[i] % 2 == 0:
            if (A[i] % 3 != 0) and (A[i] % 5 != 0):
                print("DENIED")
                return 0
    print("APPROVED")
    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            pass
        else:
            print("DENIED")
            exit()
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
import sys
n = int(input())
a_li = [int(w) for w in input().split()]

for a in a_li:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            print("DENIED")
            sys.exit()

print("APPROVED")

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    p = list(map(int,input().split()))

    for i in range(n):
        if p[i]%2 == 0:
            if p[i]%3 != 0 and p[i]%5 != 0:
                print("DENIED")
                return

    print("APPROVED")

main()

Submission status: Accepted

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


A2 = [a for a in A if a % 2 == 0]

A35 = [a for a in A2 if not(a%3 == 0 or a%5 == 0)]


if len(A35) == 0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
def ok(n):
  if n%2==1:
    return True
  else:
  	return n%3==0 or n%5==0
n=int(input())
a=[ok(int(x)) for x in input().split()]
if False in a:
  print('DENIED')
else:
  print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
A = list(int(x) for x in input().split())
found = True

for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 != 0 and A[i] % 5 != 0:
            found = False
            break

if found:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
for a in A:
  if a % 2 == 0:
    if a % 3 == 0 or a % 5 == 0:
      continue
    else:
      print("DENIED")
      break
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
flag = True
for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            pass
        else:
            flag = False
if flag:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
s = True
for a in A:
    if a % 2 == 0:
        if not(a % 3 == 0 or a % 5 == 0):
            s = False
            break
print("APPROVED" if s else "DENIED")

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
s = True
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            s = False
            break
print("APPROVED" if s else "DENIED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
app = True

for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            print('DENIED')
            app = False
            break

if app == True:
    print('APPROVED')

Submission status: Accepted

Solution code:
n=int(input())
check=list(map(int,input().split()))
f=0
for i in range(n):
    if check[i]%2==0:
        if check[i]%3!=0 and check[i]%5!=0:
            f=1
                
if f==1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = LI()
    for c in a:
        if c % 2 == 1:
            continue
        if c % 3 != 0 and c % 5 != 0:
            return "DENIED"

    return "APPROVED"


print(main())

Submission status: Accepted

Solution code:
N = int(input())
s = list(map(int, input().split()))
cond = True
for i in s:
  if i%2 == 0:
    if i%3 == 0 or i%5 == 0:
      continue
    else:
      cond = False
      break
if cond is True:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())

A = [int(e) for e in input().split()]

for a in A:
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      print("DENIED")
      exit()
      
print("APPROVED")

Submission status: Accepted

Solution code:
import sys

n=input()
number=list(map(int, input().split()))

for num in number:
    if num % 2 == 0:
        if num % 3 !=0 and num % 5 != 0:
            print("DENIED")
            sys.exit()

print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
for i in range(N):
    if(A[i]%2==0):
        if(A[i]%3!=0 and A[i]%5!=0):
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
Num = int(input())
data = list(map(int, input().split()))
judge = 0
for i in range(Num):
    if data[i] % 2 == 0:
        if not((data[i] % 3 == 0) or (data[i] % 5 == 0)):
            print("DENIED")
            judge = 1
            break
if judge == 0:
    print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
l = {int(i) for i in input().split() if int(i)%2 == 0}
cnt = 0
for i in l:
    if (i%3 == 0) or (i%5 == 0):
        pass
    else:
         cnt += 1
if cnt == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n=int(input())
L=list(map(int,input().split()))
for i in range(n):
    if L[i]%2==0:
        if L[i]%3 and L[i]%5:
            print("DENIED")
            break
    if i==n-1:
        print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a = [i for i in a if i%2==0]
a = [i for i in a if i%3!=0 and i%5!=0]
print('APPROVED' if len(a)==0 else 'DENIED')

Submission status: Accepted

Solution code:
_ = input()
A = map(int, input().split())

def f(n):
  if n % 2 == 1: return True
  return n % 3 == 0 or n % 5 == 0

if all(f(n) for n in A):
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

ans = []


for i in A:
    if (i % 2 == 0):
        ans.append(i)

lists = len(ans)

for i in range(lists):
    if ans[i] % 3 != 0 and ans[i] % 5 != 0:
        print("DENIED")
        exit()

print("APPROVED")

Submission status: Accepted

Solution code:
n=int(input())
v=[int(x) for x in input().split(" ")]
ok=1
for x in v:
    if x%2==0:
        if x%3>0 and x%5>0:
            ok=0
if ok:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
N=int(input())
L=map(int,input().split())
ANS="APPROVED"
for l in L:
  if l % 2 == 0:
    if l % 3 == 0 or l % 5 == 0:
      continue
    else:
      ANS="DENIED"
      break
print(ANS)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(e) for e in input().split()]

isApproved = True
for a in A:
    if (a % 3 != 0) and (a % 5 != 0) and (a % 2 == 0):
        isApproved = False

if isApproved:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
A = map(int, input().split())
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            break
else:
    print('APPROVED')
    exit()
print('DENIED')

Submission status: Accepted

Solution code:
input()
paper_values = list(map(int, input().split()))
is_approved = True

for val in paper_values:
    if val % 2 != 0:
        continue

    if val % 3 == 0:
        continue

    if val % 5 == 0:
        continue

    is_approved = False

print("APPROVED" if is_approved else "DENIED")

Submission status: Accepted

Solution code:
hoge = input()
ss = list(map(int,input().split()))
s = set(ss)
ninobaisu = {i * 2 for i in range(501)}
sannnobaisu = {i * 3 for i in range(334)}
gonobaisu = {i * 5 for i in range(201)}
intersection = s & ninobaisu
a = intersection - sannnobaisu
b = a - gonobaisu
if len(b) == 0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
for i in a:
  if i % 2 == 1 or i % 3 == 0 or i % 5 == 0:
    continue
  else:
    print('DENIED')
    quit()
else:
  print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
arr = []
arr = list(map(int, input().split()))
flag = 0
count = 0
for i in range(n):
  num = arr[i]
  if num % 2 == 0:
    count += 1
    if(num % 6 == 0) or (num % 10 == 0):
      flag += 1
      
if flag == count:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:

n=int(input())
l=list(map(int,input().split()))
f=1
for i in range(n):
    if  l[i]%2==0:
        if l[i]%3 and l[i]%5 :
            f=0
            break
if f:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n=int(input())
a=[int(j) for j in input().split()]
for i in a:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
B = int(input())
N = list(map(int,input().split()))
A = 'APPROVED'
for i in range(len(N)):
  if  N[i] %2 ==0 :
    if N[i] % 3 != 0 and N[i] % 5 != 0:
      A = 'DENIED'
      break
    else:
      continue
print(A)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
def test():
  for i in l:
    if i%2 == 0 and i%3!=0 and i%5!=0:
      return "DENIED"
  return "APPROVED"
print(test())

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    a = list(map(int, input().split()))
    ans = "APPROVED"
    for i in range(N):
        if a[i] % 2 ==0:
            if a[i] % 3 != 0 and a[i] % 5 != 0:
                ans = "DENIED" 
    print(ans)

main()

Submission status: Accepted

Solution code:
n =int(input())
a =list(map(int, input().split()))

flg = True

for x in a:
    if x % 2 != 0:
        continue
    if x % 3 != 0 and x % 5 != 0:
        flg = False

if flg:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            print('DENIED')
            exit()

print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
ng = False
for a in A:
  if a % 2 == 0:
    if a % 3 == 0 or a % 5 == 0:
      pass
    else:
      ng = True
if ng:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())

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


def ans(A):
    for a in A:
        if a % 2 == 0:
            if a%3 != 0 and a%5 != 0:
                return 'DENIED'

    return 'APPROVED'

print(ans(A))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys




# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)] 

    flg = True
    for _a in A:
        if _a%2==1 or _a%6==0 or _a%10==0:
            pass
        else:
            flg = False
            break

    if flg:
        print("APPROVED")
    else:
        print("DENIED")
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = input()
data = raw_input()
res = True
for one in data.split():
  d = int(one)
  if d % 2 == 0:
    if (d % 3 != 0) and (d % 5 != 0):
      res = False
      break
if res:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
i = j = 0

for x in A:
    if x % 2 == 0:
        i += 1
        if (x % 3 == 0) or (x % 5 == 0):
            j += 1

if i == j:
    print("APPROVED")
    exit(0)
print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a_even = [i for i in a if i % 2 == 0]
flag = True
for i in a_even:
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        flag = False
if flag:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int, input().split()))
f = 1
for i in li:
    if i & 1 == 0:
        if i%3 != 0 and i%5 != 0:
            f = 0
            break
print('APPROVED') if f else print('DENIED')