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:
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    _ = readline()
    As = map(int, readline().split())

    for A in As:
        if A % 2 == 0:
            if (A % 3 != 0) and (A % 5 != 0):
                print('DENIED')
                return
    print('APPROVED')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
check = True
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:
        check = False
if check:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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


flag=True
for i in range(len(A)):
    if A[i]%2==0:
        if (A[i]%3)*(A[i]%5)!=0:
            print('DENIED')
            flag=False
            break
if flag:
    print('APPROVED')

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
 
list_a=[]
for i in a:
  if i%2==0:
    list_a.append(i)

if all([list_a[i]%3==0 or list_a[i]%5==0 for i in range(len(list_a))]):
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

#a = [28,27,24]

for i in a :
  if i%2 == 1 :
    continue
  else :
    if i % 3 == 0 or i % 5 == 0 :
      continue
    else :
      ck = False
      break
else : 
  ck = True

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

Submission status: Accepted

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

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

Submission status: Accepted

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

flag = True
for x in a:
    if (x % 2 == 0) and (x % 3 != 0 and x % 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()))

for x in A:
    if x % 2==0:
        if not (x%3==0 or x%5==0):
            print('DENIED')
            exit()

print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

lis = [i for i in A if i%2 == 0 ]

lis2 = [i for i in lis if i%3 != 0]

lis3 = [i for i in lis2 if i%5 != 0]

if len(lis3) > 0:
    print("DENIED")
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 or A[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()))

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
l = map(int, input().split())
b = all([i%3==0 or i%5==0 for i in l if i%2 == 0])
print('APPROVED' if b else 'DENIED')

Submission status: Accepted

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

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

Submission status: Accepted

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

E = [ i for i in A if (i%2) == 0]
C = [ j for j in E if (j%3) == 0 or (j%5) == 0]

print('APPROVED' if len(E) == len(C) else 'DENIED')

Submission status: Accepted

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

print("APPROVED")

Submission status: Accepted

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

approved = True
for i in range(N):
  if A[i]%2 == 0:
    if A[i]%3 == 0 or A[i]%5 == 0:
      continue
    else:
      approved = False
  
print("APPROVED" if approved == True else "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):
    print("DENIED")
    exit()
print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())
Data = list(map(int,input().split()))
ans = True
for data in Data:
    if data % 2 == 0:
        if data % 3 == 0 or data % 5 == 0:
            pass
        else:
            ans = False
            break
if ans:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
n = len(A)
Flag = True
i = 0
while Flag == True and i<n:
  a = A[i]
  if a%2 ==0:
    if a%3 !=0 and a%5 != 0:
      Flag = False
  i += 1
if Flag == True:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
bl = True
for v in A:
    if v%2==0 and not(v%3==0 or v%5 == 0):
        bl = False

print('APPROVED' if bl 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:
def main():
    N = int(input())
    li = list(map(int, input().split()))
    li2 = [i for i in li if not (i % 2)]
    ans = "APPROVED"
    for j in li2:
        if (j % 3) and (j % 5):
            print("DENIED")
            quit()
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            ans.append(i)
    else:
        pass

if len(ans) == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
def main():
    n = input()
    a = list(map(int, input().split()))
    
    if all((x%3==0 or x%5==0 for x in a if x%2 == 0)):
        print("APPROVED")
    else:
        print("DENIED")
    
if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
#! env/bin/local python3

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

sub = [i for i in a if i % 2 == 0]

flag = True
for s in sub:
    if not (s % 3 == 0 or s % 5 == 0):
        flag = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
array = map(int,input().split())
res = 0
for i in array:
    if(i%2 == 0 and (i % 3 !=0 and i%5 != 0)):
        res = -1
        print("DENIED")
        break

if res != -1:
    print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    n=int(input())
    a=list(map(int,input().split()))
    count=0
    for each in a:
        if each%2==0:
            if not (each%3 == 0 or each%5==0):
                count+=1
    if count==0:
        print("APPROVED")
    else:
        print("DENIED")
resolve()

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
            break

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

Submission status: Accepted

Solution code:
import sys
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))

n = int(input())
A = ILI()
ans = "APPROVED"
for a in A:
	if a%2==0:
		if a%6!=0 and a%10!=0:ans="DENIED"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
As = list(map(int, input().split()))
Bs = [A%2 == 1 or A%3 == 0 or A%5 == 0 for A in As]
if all(Bs):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=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(0)
print('APPROVED')

Submission status: Accepted

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

for i in a:
    i = int(i)
    if i % 2 != 1:
        if (i % 3 == 0) or (i % 5 == 0):
            pass
        else:
            print("DENIED")
            exit(0)
print("APPROVED")

Submission status: Accepted

Solution code:
n=int(input())
a=map(int,input().split())
b=[]
flag=0
for i in a:
    if i%2==0:
        b.append(i)
for i in b:
    if i%3==0 or i%5==0:
        flag+=1
if flag==len(b):
    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")
        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:
      continue
    else:
      flag=False

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

Submission status: Accepted

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
if all(x % 3 == 0 or x % 5 == 0 for x in a if x % 2 == 0):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())

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

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

if(flg == 1):
    print('APPROVED')
else:
    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_list = list(map(lambda x: (x % 3 == 0) or (x % 5 == 0), A_even))
print('APPROVED' if False not in flag_list else 'DENIED')

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())
l=list(map(int,input().split()))
flag=1
for i in l:
    if i%2==0:
        if i%3==0 or i%5==0:
            continue
        else:
            flag=0
            break
if flag==0:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

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

if all(map(lambda x: x%3 == 0 or x%5 == 0 if x%2 == 0 else True, A)):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
flag=1
for i in l:
    if i%2==0:
        if i%3==0 or i%5==0:
            continue
        else:
            flag=0
            break
if flag==0:
    print("DENIED")
else:
    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 :
      if i%5 != 0:
        print("DENIED")
        exit()
print("APPROVED")

Submission status: Accepted

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

ans = True

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

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
even = []
approved = []

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

for i in even:
    if i%3==0 or i%5==0:
        approved.append(i)

if even == approved:
    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:
    if A[i]%3 != 0:
      if A[i]%5 != 0:
        print("DENIED")
        exit()
      
print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
for i in range(N):
    if A[i]%2==1:
        B[i]=0
    else :
        if A[i]%5==0 or A[i]%3==0 :
            B[i]=0
        else :
            B[i]=1
print("APPROVED" if sum(B)==0 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] % 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()))
even = []

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

for j in even:
    if j % 3 == 0 or j % 5 == 0:
        cnt += 1

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

Submission status: Accepted

Solution code:
n = int(input())
a = []

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

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

print(judge)

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()))

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

Submission status: Accepted

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

for i in range(n):
    if a[i] % 2 == 0:
        x.append(a[i])

for j in range(len(x)):
    if x[j] % 3 != 0 and x[j] % 5 != 0:
        print('DENIED')
        exit()

print('APPROVED')

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'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = 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:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
a = nl()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#155b
n = input()
a = list(map(int, input().split()))
ret = 'APPROVED'

for _a in a:
  if _a % 2 == 0 and _a % 3 != 0 and _a % 5 != 0:
    ret = 'DENIED'

print(ret)

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 not (i%3==0 or i%5==0):
      ans = 'DENIED'
print(ans)

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()

print('APPROVED')

Submission status: Accepted

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

even_numbers = []
count = 0

for a in A:
    if a % 2 == 0:
        even_numbers.append(a)
for a in even_numbers:
    if a % 3 == 0 or a % 5 == 0:
        continue
    else:
        count +=1
if count >= 1:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = [int(x) for x in input().split()]

isNotCorrect = False

for i in range(n):
    num = l[i]
    if(num%2==0 and not (num%3==0 or num%5==0)):
        isNotCorrect = True

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

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] % 3 == 0 or a[i] % 5 == 0:
      c += 1
  else:
    c += 1

if c == N:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
l = []
l_even = [i for i in a if i % 2 == 0]
for i in range(n):
  if a[i] % 2 == 0:
    if a[i] % 3 == 0 or a[i] % 5 == 0:
    	l.append(1)

if sum(l) != len(l_even):
  print('DENIED')
else:
  print('APPROVED')

Submission status: Accepted

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

a =[]

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

for j in a:
  if j%3==0 or j%5==0:
    continue
  else:
    count +=1

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

Submission status: Accepted

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

for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            pass
        else:
            result = 'DENIED'
print(result)

Submission status: Accepted

Solution code:
from sys import exit

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()))
l = list(filter(lambda x: x %2 == 0,a))

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

Submission status: Accepted

Solution code:
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n=int(input())
a=list(map(int,stdin.readline().split()))
poss=True
for i in a:
    if(i%2==0):
        if(i%3!=0 and i%5!=0):
            poss=False
            break
if(poss):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

result = 'APPROVED'

for a in A:
    if a % 2 == 0 and (a % 3 != 0 and a % 5 != 0):
        result = 'DENIED'
        break

print(result)

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:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
# ABC155B

def f(a):
    for i in a:
        if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
            print('DENIED')
            break
    else:
        print('APPROVED')

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

Submission status: Accepted

Solution code:
import collections
n,elems = int(raw_input()), map(int, raw_input().split(' '))

def f(elems):
	for e in elems:
		if e % 2 == 0:
			if not((e % 3 == 0) or (e % 5 == 0)):
				return False
	return True

print 'Approved'.upper() if f(elems) else 'Denied'.upper()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


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

    ans = 'APPROVED'
    for i_A in A_list:
        if i_A % 2 == 1:
            continue

        if i_A % 3 != 0 and i_A % 5 != 0:
            ans = 'DENIED'

    print(ans)

    return


if __name__ == "__main__":
    main()
    sys.exit(0)

Submission status: Accepted

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

print('APPROVED' if check==0 else 'DENIED')

Submission status: Accepted

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

def judge():
    for i in a:
        if i%2==0:
            if i%3!=0 and i%5!=0:
                return False
    return True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
print("APPROVED" if all(not all((a % 3, a % 5)) for a in map(int, input().split()) if not a % 2) else "DENIED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
t = 0

for i in a:
  if i%2 ==0:
    b.append(i)
    
for i in b:
  if i%3 == 0 or i%5 == 0:
    t += 1
    
if t== len(b):
  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()))
count = 0
cnt = 0
for i in range(n):
    if a[i] % 2 == 0 and (a[i] % 3 == 0 or a[i] % 5 == 0):
        count += 1
    if a[i] % 2 == 0:
        cnt += 1

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

Submission status: Accepted

Solution code:
n = input()
A = list(map(int,input().split()))
dic ={}
for i in A:
    if i%2 ==0:
        dic[i]=1
l = []
for j in dic.keys():
    if j%3 != 0 and j%5 != 0:
        print("DENIED")
        break
    else:
        l.append(j)
if len(l)==len(dic):
    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 or A[i]%5==0:
            continue
        else:
            print('DENIED')
            break
else:
    print('APPROVED')

Submission status: Accepted

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

for item in a:
    if item % 2 ==0:
      if item % 5!=0 and item % 3!=0:
        dn=dn+1
        break
if dn>0:
  print('DENIED')
else:
  print('APPROVED')

Submission status: Accepted

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


def main():
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    for i in A:
        if i % 2 == 0 and not (i % 3 == 0 or 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()))
count=0
for i in range(0,n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      count=count+1
  else:
    count=count+1
if count==n:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
N=int(input())
flag=True
nums=list(map(int, input().split()))
for x in nums:
  if x%2:
    continue
  else:
    if x%3==0 or x%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()))
a = list(filter(lambda x: x % 2 == 0, a))
a = [True if (i % 3 == 0 or i % 5 == 0) else False for i in a]
if all(a):
    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 :
        if (a[i]%3) != 0 :
            if (a[i]%5) != 0 :
                print("DENIED")
                exit()

print("APPROVED")

Submission status: Accepted

Solution code:
import sys
n=int(input())
nl=list(map(int, input().split(" ")))

for i in range(n):
 if nl[i]%2==0:
  #print(nl[i]%6,nl[i]%10)
  if nl[i]%6 !=0 and nl[i]%10!=0:
   print("DENIED")
   sys.exit()
print("APPROVED")

Submission status: Accepted

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

for i in an:
  if i % 2 == 0 and 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()))

count = 0
for i in range(N):
    if (A[i] % 2 == 0):
        if not (A[i] % 3 == 0 or A[i] % 5 == 0):
            count += 1
if count == 0:
    print("APPROVED")
else:
    print("DENIED")