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:
def main():
    N = int(input())
    l = list(map(int, input().split()))
    l2 = []
    for i in range(len(l)):
        if l[i] % 2 == 0:
            l2.append(l[i])
    for i in range(len(l2)):
        if not l2[i] % 3 == 0 and not l2[i] % 5 == 0:
            print('DENIED')
            return
    print('APPROVED')

main()

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

n, s, f = int(input()), list(map(int, input().split())), True
for e in s:
  if not e & 1:
    if 0 not in [e % 3, e % 5]: f = False; break
print('APPROVED' if f else 'DENIED')

Submission status: Accepted

Solution code:
N = int(input())
A = [int(n) for n in input().split() if int(n)%2==0]
c = 0
for a in A:
    if a%3==0 or a%5==0:
        c += 1
print('APPROVED' if c==len(A) else 'DENIED')

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]%5!=0 and a[i]%3!=0:
            print('DENIED')
            break
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
count = 0
sat = 0
for a in A:
    if a % 2 == 0:
        count += 1
        if a % 3 == 0 or a % 5 ==0:
            sat += 1
if count == sat:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
from sys import exit

N = int(input())

for i in input().split():
    if int(i) % 2 == 0:
        if int(i) % 3 != 0 and int(i) % 5 != 0:
            print('DENIED')
            exit()

print('APPROVED')

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc155/tasks/abc155_b

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

def main(A):
    for a in A:
        if a%2 ==1:
            continue
        if (a%3 != 0) and (a%5 != 0):
            return "DENIED"
    return "APPROVED"

if __name__ == "__main__":
    print(main(A))

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))
cnt = 0
ans = "APPROVED"
for i in A:
    if i%2 ==1:
        continue
    if i%2 ==0:
        if (i%3 != 0) and (i%5 != 0):
            cnt += 1
if cnt != 0:
    ans = "DENIED"
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())
    
    approved = True
    for a in A:
        if a % 2 == 0 and a % 3 and a % 5:
            approved = False
            break
    if approved:
        print('APPROVED')
    else:
        print('DENIED')
    
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=list(map(int,input().split()))
    for i in range(N):
        if A[i]%2==0:
            if not(A[i]%3==0 or A[i]%5==0):
                print("DENIED")
                exit()
    print("APPROVED")
    
    
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
flg = True
for num in a:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            flg = False
print("APPROVED" if flg is True else "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(0)
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

a = [ x for x in a if x % 2 == 0 and x % 3 != 0 and x % 5 != 0]
if not a:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
flag = True
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            flag = False

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

Submission status: Accepted

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

for i in v:
	if(i%2==0 and i%3!=0 and i%5!=0):
		t = False

if(t):
	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 and ( a % 3 != 0 and a % 5 != 0):
        print('DENIED')
        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:
n = int(input())
a = list(map(int,input().split()))
denied = False
for i in range(len(a)):
  if a[i] % 2 == 0:
    if (a[i] % 3 != 0 and a[i] % 5 != 0) :
      print ("DENIED")
      denied = True
      break
      
if not denied :
  print ("APPROVED")

Submission status: Accepted

Solution code:
def LI(): return map(int,input().split())
def I() :return int(input())

n=I()
lst=list(LI())
for i in lst:
    if i %2==0:
        if i % 3==0 or i % 5==0:
            continue
        else:
            print("DENIED")
            break
else:print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = 0
even = 0
for i in a:
  if i % 2 == 0:
    even += 1
  if i % 2 == 0 and (i % 3 == 0 or i % 5 ==0):
    b += 1
if b == even:
  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 and a % 3 != 0 and a % 5 != 0:
        print("DENIED")
        exit()

print("APPROVED")

Submission status: Accepted

Solution code:
input()
l= list(map(int, input().split()))
e = list(filter(lambda i : i%2==0 , l))
s = set('APPROVED' if (a%3==0 or a%5==0) else 'DENIED' for a in e)
print('DENIED' if s.__contains__('DENIED') else 'APPROVED')

Submission status: Accepted

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

err = False
for ai in a:
  if ai % 2 == 0:
    if ai % 3 != 0 and ai % 5 != 0:
      err = True

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

Submission status: Accepted

Solution code:
import sys
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")
            sys.exit()

print("APPROVED")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

for i in A_int_list:
    if i % 2 == 1:
        continue
    else:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            print('DENIED')
            exit()

print('APPROVED')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
a = [i for i in a if i % 2 == 0 and i % 3 != 0 and i % 5 != 0]
print(["APPROVED", "DENIED"][len(a) > 0])

Submission status: Accepted

Solution code:
import math

def main():
  N = int(input())
  A = list(map(int, input().split()))
  
  for i in range(0, N):
    if A[i] % 2 == 0: #偶数だったら
      if A[i] % 3 != 0 and A[i] % 5 != 0: #3でも5でも割れないとき
        print('DENIED')
        return
  
  print('APPROVED')
  
  
main()

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):
            pass
        else:
            print("DENIED")
            exit(0)

print("APPROVED")

Submission status: Accepted

Solution code:
def main():
    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:
                continue
            s = False
            break

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans = 'APPROVED'

for i in A:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      ans = 'DENIED'
      break
    
print(ans)

Submission status: Accepted

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

A_eve = []
ans = 'APPROVED'

for i in A:
  if i % 2 == 0:
    A_eve.append(i)
    
for j in A_eve:
  if j % 3 != 0 and j % 5 != 0:
    ans = 'DENIED'
    break
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ll = []
for i in l :
  if i%2 == 0:
    ll.append(i)

cnt = 0
for i in ll:
  if i%3 == 0 or i%5 == 0:
    cnt += 1 

if cnt != len(ll):
  print('DENIED')
else:
  print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
flag=True
for i in range(n):
  t=a[i]
  if t%2==1 or t%3==0 or t%5==0:
    continue
  else:
    flag=False
    break
if flag:
  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 and a[i]%3!=0 and a[i]%5!=0:
    ans="DENIED"
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = map(int, input().split())
c = 0
 
for v in a:
  if v % 2 == 0 and v % 3 != 0 and v % 5 != 0:
    c += 1
 
print("APPROVED" if c==0 else "DENIED")

Submission status: Accepted

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

for v in a:
  if v % 2 == 0 and v % 3 != 0 and v % 5 != 0:
    c += 1

print("APPROVED" if c==0 else "DENIED")

Submission status: Accepted

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))
for a in A:
    if a % 2 == 0 and (a % 3 != 0 and a % 5 != 0) : 
        print('DENIED')
        sys.exit()
print('APPROVED')

Submission status: Accepted

Solution code:
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re


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

flg = 0
for i in range(N):
    if A[i] % 2 == 0:
        if not ( A[i] % 3 == 0 or A[i] % 5 == 0 ):
            flg = 1
            break

if flg == 1:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

for A in As:
    if A%2 == 0:
        if not (A%3 == 0 or A%5 == 0):
            print('DENIED')
            break
else:
    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:
n = int(input())
a = list(map(int, input().split()))
flag = True
for num in a:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            flag = False
            break

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

Submission status: Accepted

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

Submission status: Accepted

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

F=True
for a in A:
    F&=((a%2==1) or (a%3==0) or (a%5==0))

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

Submission status: Accepted

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

flg = True
for i in range(n):
  if a[i]%2 == 0:
    if a[i]%3 == 0 or a[i]%5 == 0:
      pass
    else:
      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 and i%3!=0 and i%5!=0:
        ans = "DENIED"
        break
    else:
        ans = "APPROVED"
print(ans)

Submission status: Accepted

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

res = True
for i in range(N):
    if A[i] % 2 == 0 and (A[i] % 3 != 0 and A[i] % 5 != 0):
        res = False
        break
if res:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

if n == 0:
    print('APPROVED')
elif n == 1:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

even_numbers = []
for i in numbers:
  if i % 2 == 0:
    even_numbers.append(i)

answers = []
for i in even_numbers:
  if i % 3 == 0 or i % 5 == 0:
    answers.append(i)

if even_numbers == answers:
  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 not (i%3==0 or i%5==0):
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
flag = 1
for i in range(N):
    if (A[i]%(2*3) == 0) or(A[i]%(2*5) == 0) or( A[i]%(2) == 1):
        flag = 1
    else:
        flag = 0
        print('DENIED')
        break
if flag == 1:
    print('APPROVED' )

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
newA = []
count = 0
ans = 0

for i in range(N):
    if A[i]%2 ==0:
        newA.append(A[i])
        count += 1

for j in range(count):
    if newA[j]%3 == 0 or newA[j]%5== 0:
        ans += 1

if ans == count:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

result = True
for check in a:
  if (check%2 == 0):
    if (check%3 == 0 ) or (check%5 == 0):
      pass
    else:
      result = False
      break
      
if (result):
  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 == 1:
    continue
  elif a[i] % 3 == 0:
    continue
  elif a[i] % 5 == 0:
    continue
  else:
    ans = "DENIED"
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


def is_approve(a:list):
  ans = False
  for num in a:
    if num % 2 == 1 :
      ans = True
    elif num % 3 == 0 or num % 5 == 0:
      ans = True
    else:
      ans = False
      break
  return ans

if is_approve(a):
  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) or (i%5==0)):
            pass
        else:
            print('DENIED')
            exit()
print('APPROVED')

Submission status: Accepted

Solution code:
import sys

n = int(input())
a = list(map(int,input().split()))
for i in range(n) :
    b = 0
    if a[i]%2 == 0 and a[i]%3 !=0 :
        b += 1
    if a[i]%2 == 0 and a[i]%5 != 0 :
        b += 1
    if b == 2 :
        print("DENIED")
        sys.exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

cond = True

for i in arr:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0: continue
    else:
      cond = False
      break
      
if cond: print("APPROVED")
else: print("DENIED")

Submission status: Accepted

Solution code:
_len = int(input())
nums = input().split(" ")

def isApprove(_len, nums):
  for i in range(_len):
    if int(nums[i]) % 2 == 0:
      if int(nums[i]) % 3 != 0 and int(nums[i]) % 5 != 0:
        return False
  
  return True

print('APPROVED' if isApprove(_len, nums) else 'DENIED')

Submission status: Accepted

Solution code:
len=int(input())
list = input().split(" ")
msg="DENIED"
for i in range(len):
  if int(list[i])%2==0 and (int(list[i])%3==0 or int(list[i])%5==0):
    msg="APPROVED"
  elif int(list[i])%2==0:
    msg="DENIED"
    break
  else:
    msg="APPROVED"  
print(msg)

Submission status: Accepted

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

for _ in  A:
    if _ % 2 == 0:
        if _ % 3 == 0 or _ % 5 == 0:
            ans *= 1
        else:
            ans *= 0

if ans == 1:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
a1=input().split()
a2=[int(i) for i in a1]
for i in a2:
    if i%2==0 and i%3!=0 and i%5!=0:
        print('DENIED')
        break
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
N=int(input())
a1=input().split()
a2=[int(i) for i in a1]
for x in a2:
    if x%2==0:
        if x%3==0:
            continue
        if x%5==0:
            continue
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

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:
            continue
        if x % 5 == 0:
            continue
        print( "DENIED" )
        break
else:
    print( "APPROVED" )

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:
            continue
        if x % 5 == 0:
            continue
        print( "DENIED" )
        break
else:
    print( "APPROVED" )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
N=int(input())
number=list(map(int,input().split()))
number1=[i for i in number if i%2==0]
S=len(number1)
ans=0
for j in number1:
    if j%3==0 or j%5==0:
        ans += 1
if S==ans:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
# 155 B

n = int(input())
s = list(map(int, input().split()))
valid = True

for i in s:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            valid = False

if valid == True:
    print("APPROVED")
elif valid == False:
    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 and a % 5 != 0:
            print('DENIED')
            exit()
print('APPROVED')

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")
            break
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = True
for x in a:
    if x%2 == 0:
        if x%3 != 0 and x%5 != 0:
            b = False
print("APPROVED" if b else "DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N = I()
    A = numpy.array(LI())
    A_mod2 = A[A%2==0]
    is_approved = ((A_mod2%3==0)|(A_mod2%5==0)).all(axis=0)
    print("APPROVED" if is_approved else "DENIED")

main()

Submission status: Accepted

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

Submission status: Accepted

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

Aeven = []
for i in A:
  if i%2 == 0:
    Aeven.append(i)
    
for i in Aeven:
  if i%3 != 0 and i%5 != 0:
    print("DENIED")
    break
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
k = 'APPROVED'
for i in A:
  if i % 2 == 0:
    if i % 3 == 0:
      pass
    elif i % 5 == 0:
      pass
    else:
      k = 'DENIED'
print(k)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
 
ans = 'APPROVED'
for i in A:
    if i % 2 == 0:
        if i % 3 == 0:
            pass
        elif i % 5 == 0:
            pass
        else:
            ans = 'DENIED'
print(ans)

Submission status: Accepted

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

ans = 'APPROVED'
for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            ans = 'DENIED'
print(ans)

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):
            continue
        else:
            print('DENIED')
            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 == 1:
        continue
    if a[i] % 3 != 0 and a[i] % 5 != 0 :
        print('DENIED')
        exit()
print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#A内の奇数を0にする
for i in range(len(A)):
	if A[i]%2 != 0:
		A[i] = 0
#A内偶数をチェックする
for t in range(len(A)):
	if A[t] > 0:
		if A[t]%3 == 0 or A[t]%5 == 0:
			A[t] = 0
print("APPROVED" if sum(A) == 0  else "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 or i%5==0:
      continue
    else:
      print("DENIED")
      exit()
print("APPROVED")

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
e=[i for i in a if i%2==0]
if e:
    for j in e:
        if j%3!=0 and j%5!=0:
            print('DENIED')
            break
    else:
        print('APPROVED')
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
DENY = [I for I in A if I%2==0 and I%3!=0 and I%5!=0]
if len(DENY)>=1:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split(' ')))
result = True
for i in range(N):
    if A[i]%2 == 0  and not(A[i]%3 == 0 or A[i]%5 == 0):
        result = False
if result:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

for i in range(len(A)):
  if A[i] %2 == 0:
    if A[i] %3 != 0 and A[i] %5 != 0:
      print("DENIED")
      exit()
    else:
      pass
  else:
    pass
  
print("APPROVED")

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    a = map(int, input().split())
    even = [e for e in a if e % 2 == 0]
    for i in even:
        if i % 3 != 0 and i % 5 != 0:
            print('DENIED')
            exit()
    print('APPROVED')


if __name__ == '__main__':
    solve()