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

Submission status: Accepted

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

ok = True

for i in l:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            ok = False

if ok:
    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())
A = list(map(int,input().split()))

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
n=int(input())
l=list(map(int,input().split()))
#a,b,c = map(int,input().split())
for i in l:
    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()))
k = []
ans = 0
for i in range(N):
    if A[i]%2 == 0:
        k.append(A[i])
for j in range(len(k)):
    if k[j]%3 == 0 or k[j]%5 == 0:
        ans += 1
if ans == len(k):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = "APPROVED"
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:
            ans = "DENIED"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
la=list(map(int,input().split()))
for i in la:
    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()))
ok = True
for x in a:
	if x % 2 == 0 and x % 3 != 0 and x % 5 != 0:
		ok = False
if ok:
	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 == 1:
        continue
    if a % 3 == 0 or a % 5 == 0:
        continue
    print('DENIED')
    exit()
print('APPROVED')

Submission status: Accepted

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

for e in a:
    if e%2:continue
    if e%3 and e%5:
        print('DENIED')
        exit()
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    AN = map(int, input().split())

    ans = "APPROVED"
    for A in AN:
        if A % 2 == 0:
            if not (A % 3 == 0 or A % 5 == 0):
                ans = "DENIED"
                break

    print(ans)


main()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

B = [int(x) for x in A if x % 2 == 0]

for i in B:
    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()))
t = 0
for i in A:
    if i % 2 == 0:
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            t = 1
    else:
        continue
if t == 1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
# 再帰上限の追加
import sys
sys.setrecursionlimit(1000000)

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")
        sys.exit()

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 == 1:
        continue
    elif A[i]%3 == 0 :
        continue
    elif A[i]%5== 0:
        continue
    else:
        flag = 0

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

Submission status: Accepted

Solution code:
N = int(input())
As = list(map(int, input().split()))
for a in As:
    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()))

bl = True
for e in a:
    if e % 2 == 0:
        if e % 3 == 0 or e % 5 == 0:
            continue

        bl = False
        break

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD

N = iin()
A = iln()

isOK = True
for i in range(N):
    if A[i] % 2 == 0:
        if not (A[i] % 3 == 0 or A[i] % 5 ==0):
            isOK = False
            break
if isOK:
    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')
            exit()
    else:
        continue

print ('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'APPROVED'
for a in A:
  if a % 2 == 0:
    if a%3==0 or a%5==0:
      continue
    ans = 'DENIED'
    break

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
f=True
for i in a:
    if i%2==0:
        if not(i%3==0 or i%5==0):
            f=False
            break
print("APPROVED" if f else "DENIED")

Submission status: Accepted

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

def check():
	for A in A_list:
		if A % 2 == 0 and (A % 3 != 0 and A % 5 != 0):
			return False
	return True

if check():
	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:
        continue
    if i % 3 == 0 or i % 5 == 0:
        continue
    print('DENIED')
    exit()

print('APPROVED')

Submission status: Accepted

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

for a in A:
    if a % 2 == 1:
        continue

    if a % 3 == 0 or a % 5 == 0:
        continue
    else:
        print('DENIED')
        exit()

print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
for i in li:
    if i % 2 == 0:
        if i%3 != 0 and i%5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
from bisect import *
from collections import *
from fractions import gcd
from math import factorial
from itertools import *
from heapq import *
import copy


#int(input())
#map(int,input().split())
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 = [int(a) for a in input().split()]
for a in A:
    if a % 2 == 0 and (a % 3 and a % 5):
        print("DENIED")
        break
else:
    print("APPROVED")

Submission status: Accepted

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

for item in a:
    if item % 2 == 0:
        if item % 3 != 0 and item % 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 A:
  if i%2 == 0:
    if i%3 and i%5:
      print("DENIED")
      exit()
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')
			break
else:
	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 or i % 5 == 0:
            pass
        else:
            ans = "DENIED"
    else:
        pass
print(ans)

Submission status: Accepted

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

for item in A:
  if item%2==0:
    if item%3!=0 and item%5 !=0:
      str = "DENIED"
      
print(str)

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] % 5 == 0 or a[i] % 3 == 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()))
flg = 0
for i in a:
	if i%2 == 0:
		if i%3 == 0 or i%5 == 0:
			continue
		else:
			flg = 1
if flg == 1:
	print ("DENIED")
else:
	print ("APPROVED")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    la = rli()
    for a in la:
        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()))

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

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

Submission status: Accepted

Solution code:
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left # bisect_left(list, value)
#from fractions import gcd

sys.setrecursionlimit(10**7)
N = int(input())
A = list(map(int, input().split()))

flg = True
for a in A:
    if a%2==0:
        if a%3==0 or a%5==0:
            continue
        else:
            flg = False
            break

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

Submission status: Accepted

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

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')
            break
    if i==n-1:
        print('APPROVED')

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N = I()
A = LI()

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()))
ok = True
for i in a:
    if i%2==0 and (i%3!=0 and i%5!=0):
        ok = False
if ok==True:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

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 or A[i] % 5 == 0:
            pass
        else:
            ans = 'DENIED'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split() if int(i) % 2 == 0]
f = 1
for i in range(len(a)):
    if a[i] % 3 == 0 or a[i] % 5 == 0:
        f *= 1
    else:
        f *= 0
if f == 0:
    print("DENIED")
else:
    print("APPROVED")

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)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
for a in A:
    if a % 2 == 1:
        continue
    else:
        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()))
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 = [int(i) for i in input().split()]
conditions = [(a % 3 == 0 or a % 5 == 0) for a in A if a % 2 == 0]
print('APPROVED' if all(conditions) else 'DENIED')

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
A=list(map(int,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:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,*aaa = get_all_int()

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

Submission status: Accepted

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

for num in a:
    if num & 1: continue
    if num % 3 != 0 and num % 5 != 0:
        print "DENIED"
        exit()

print "APPROVED"

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

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

ok = True
for item in a:
    if item % 2 == 0:
        if item % 3 != 0 and item % 5 != 0:
            ok = False
if ok:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
def main():
    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')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Yes = "APPROVED"
No = "DENIED"

f = Yes
for i in A:
  if i % 2 == 1: continue
  if i % 3 != 0 and i % 5 != 0:
    f = No

print(f)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split() if int(i) % 2 == 0]
    if all(a % 3 == 0 or a % 5 == 0 for a in A):
        print("APPROVED")
    else:
        print("DENIED")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

ans=0
for a in A:
    if a%2==0:
        if a%3!=0 and a%5!=0:
            ans+=1

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n,*a = [int(i) for i in read().split()]
#a = [int(i) for i in readline().split()]
#n = int(input())

n,*a = [int(i) for i in read().split()]

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

if ok:
    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 and A[i]%5!=0:
            flg=False

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in 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()))

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

for e in evens:
    if e % 3 != 0 and e % 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())
l=list(map(int,input().split()))
for i in l:
  if i%2:continue
  if i%5==0 or i%3==0:continue
  else:print("DENIED");exit()
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 and A[i]%5!=0:
            flag=False

if flag:
    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 and a[i]%5:
            print("DENIED")
            exit()
print('APPROVED')

Submission status: Accepted

Solution code:
def examA():
    N = LI()
    N.sort()
    if N[0]==N[1] and N[0]!=N[2]:
        print("Yes")
    elif N[1]==N[2] and N[0]!=N[2]:
        print("Yes")
    else:
        print("No")
    return

def examB():
    N = I()
    A = LI()
    for a in A:
        if a%2==0:
            if a%3!=0 and a%5!=0:
                print("DENIED")
                return
    print("APPROVED")
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

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 and a % 5 != 0:
            ret = "DENIED"
            break

print(ret)

Submission status: Accepted

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

approve=True

for a in A:
    if a%2==1:
        continue
    if a%3!=0 and a%5!=0:
        approve=False

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = onem()

a = l()

a.sort()

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

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

Submission status: Accepted

Solution code:
import sys,collections

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
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 [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  f=False
  for x in l:
    if x%2==0:
      if x%3!=0 and x%5!=0:
        f=True

  if f:
    return 'DENIED'
  return 'APPROVED'

# main()
print(main())

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


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

    flag = True
    for a in A:
        if a % 2 == 1:
            continue
        if not (a % 3 == 0 or a % 5 == 0):
            flag = False
            break
    if flag:
        print("APPROVED")
    else:
        print("DENIED")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
MOD = 10**9+7
 

def input():
    return sys.stdin.readline()[:-1]
 

def main():
    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")
 
 
if __name__ == "__main__":
    main()

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()))
for i in range(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())
A = list(map(int, input().split()))
flg = 1
for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      flg = 0
if flg == 1:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
ans = True
for n in range(N):
    if A[n] %2 == 0:
        if A[n] %3 != 0 and A[n] %5 != 0:
            ans = False
if ans:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

flg = 0

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