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.

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
judge = 0
for i in range(N):
    if A[i] % 2 == 1:
        continue
    elif A[i]%3 == 0 or A[i]%5 == 0:
        judge += 0
    else:
        judge += 1
print('APPROVED' if judge == 0 else 'DENIED')

Solution (Python):
N = int(input())
c = list(map(int, input().split()))

a = list()


for i in range(N):
    if (c[i] % 2 == 0):
        if(c[i] % 3 == 0 or c[i] % 5 == 0):
            a.append(1)
        else:
            a.append(0)



b = 0
for i in range(len(a)):
    b = b + int(a[i])


if(b == len(a)):
    print("APPROVED")
else:
    print("DENIED")

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

flag = True
for i in l:
  if (i%3 != 0 and i%2 == 0) and (i%5 != 0 and i%2 == 0):
    flag = False
    break
    
if flag:
  print("APPROVED")
  
else:
  print("DENIED")

Solution (Python):
N = int(input())
a_list = list(map(int, input().split()))
c = 0

for i in range(N):
    if a_list[i]  % 2 != 0:
        a = 1
    else:
        if (a_list[i] % 3 != 0) and (a_list[i] % 5 != 0):
            c = 1
        else:
            a = 1


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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
count_even = 0
count_fizz = 0
for i in range(n):
  if a[i]%2==0:
    count_even+=1
    if a[i]%3==0 or a[i]%5==0:
      count_fizz+=1
      
    
if count_even == count_fizz:
  print('APPROVED')
else:
  print('DENIED')

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

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

count = 0
for i in range(len(B)):
    if B[i] % 3 == 0 or B[i] % 5 == 0:
        count += 1

if count == len(B):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n = int(input())
m = list(map(int,input().split()))
f = True
for i in m:
  if i % 2 == 0:
    if (i % 3 == 0 ) or (i % 5 == 0 ):
      f = True
    else:
      print('DENIED')
      exit()

print('APPROVED')

Solution (Python):
N=int(input())
a = list(map(int,input().split()))
c=0
i=0
while(c==0 and i<N):
    if(a[i]%2==0):
        if(a[i]%3==0 or a[i]%5==0):
            i+=1
        else:
            c+=1
    else:
        i+=1
if(c==0):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A_ans = []
count = 0

for i in range(0, N):
    if A[i] % 2 == 0:
        A_ans.append(A[i])

for i in range(0, len(A_ans)):
    if A_ans[i] % 3 == 0 or A_ans[i] % 5 == 0:
        count += 1

if count == len(A_ans):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
line1 = input('')
line2 = input('') 
result = True
cnt = int(line1)
list = line2.split(' ')
if len(list) != cnt:
  result = False
if result:
  for no_str in list:
    no = int(no_str)
    if no % 2 == 0:
      if no % 3 != 0 and no % 5 != 0:
        result = False

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

Solution (Python):
import numpy as np


N = int(input())
AN = list(map(int, input().split()))
AN = np.array(AN)

AN2 = AN[AN % 2 == 0]

if AN2[AN2 % 3 == 0].size + AN2[AN2 % 5 ==0].size - AN2[AN2 % 15 ==0].size == AN2.size :
    print('APPROVED')

else:
    print('DENIED')

Solution (Python):
from sys import stdin




def ii(): return int(stdin.readline())


def fi(): return float(stdin.readline())


def mi(): return map(int, stdin.readline().split())


def fmi(): return map(float, stdin.readline().split())


def li(): return list(mi())


def lsi():
    x=list(stdin.readline())
    x.pop()
    return x


def si(): return stdin.readline()


def sieve(x):
    a=[True]*(x+1)
    sq=floor(sqrt(x))
    for i in range(3, sq+1, 2):
        if a[i]:
            for j in range(i*i, x+1, i):
                a[j]=False
    if x>1:
        p=[2]
    else:
        p=[]
    for i in range(3, x+1, 2):
        if a[i]:
            p.append(i)
    return p
def prime_factor(x):
    c=1
    i=0
    while p[i]*p[i]<=x:
        if not x%p[i]:
            c+=1
            while not x%p[i]:
                x//=p[i]
        i+=1
    if x>1:
        c+=1
    return c
res=['APPROVED', 'DENIED']



ii()
a=li()
f=0
for i in a:
    if not i%2:
        if i%3 and i%5:
            f=1
            break
print(res[f])

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=[]
count=0
countt=0
for i in a:
  if i%2==0:
    b.append(i)
    count+=1
for j in b:
  if j%3==0 or j%5==0:
    countt+=1
if count==countt:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
N = int(input())

a = [int(i) for i in input().split()]
v=0
x=[]
j=0
for i in range(N):
  if a[i] %2 ==0:
    x.append(a[i])
    j +=1

    
for i in range(j):
  if x[i] %3 ==0 or x[i] %5 ==0:
    v += 1

if v == j:
  print("APPROVED")
else:
  print("DENIED")

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

A_lis = []
for a in A:
    if a%2 == 0:
        A_lis.append(a)
flag = 0
for a in A_lis:
    if (a%3==0 or a%5==0):
        flag += 1
if flag == len(A_lis):
    print('APPROVED')
    sys.stdout.flush 
else:
    print('DENIED')
    sys.stdout.flush

Solution (Python):
N = int(input())
L = list(map(int,input().split()))

ans = True

for i in L:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            ans = False
            break

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

Solution (Python):

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

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

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

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):


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

R = True
for b in [n % 3 == 0 or n % 5 == 0 for n in AL if n % 2 == 0]:
    R = R and b

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

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

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

approvedNum = 0

for num in a:
    if num % 2 == 0:
        if num % 3 == 0 or num % 5 ==0:
            approvedNum += 1
    if num % 2 == 1:
        approvedNum += 1

print('APPROVED') if approvedNum == len(a) else print('DENIED')

Solution (Python):
a=int(input())
Papers=list(map(int,input().split()))
m=0
for i in range (a):
  if Papers[i] %2==0:
    if not (Papers[i] %3==0 or Papers[i] %5==0):
      m=m+1

if not m==0:
  print("DENIED")
else:
  print("APPROVED")

Solution (Python):
N = int(input())
A = [int(x) for x in input().split() 
     if int(x) % 2 == 1 or int(x) % 6 == 0 or int(x) % 10 == 0 ]
if len(A) == N:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
import sys
n = int(input())
li = list(map(int,input().split()))
even_li = []
for a in li:
  if(a%2==0):
    even_li.append(a)
flg = 0
for a in even_li:
  if(a%3==0 or a%5==0):
    flg += 1
if(str(flg) == str(len(even_li))):
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
N = input()
raw_input1 = input()

l = raw_input1.split()
l_num = [int(x) for x in l]

flag = 0
flag1 = 0

for a in l_num:
    if a % 2 ==0:
        if a % 3 == 0 or a % 5 == 0:
            flag = 0
        else:
            flag = 1
    if flag != 0:
        break

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

Solution (Python):
a = int(input())
b = list(map(int, input().split()))

flg = True

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

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

Solution (Python):

n = (int(x) for x in input().split())
a_list = list(map(int, input().split()))

even_list = []

i = 0


while i < len(a_list) : 
 div_a = a_list[i] % 2
 if div_a == 0 : 
  even_list.append(a_list[i])
 i = i + 1


j = 0
all_num = True

while j < len(even_list) :
 
 div_even = even_list[j] % 3 
 if div_even != 0 :
     div_even = even_list[j] % 5
     if div_even != 0 :
        all_num = False
        break

 j = j + 1

if all_num == True : 
 print('APPROVED')
else:
 print('DENIED')

Solution (Python):

"""
Created on Sun Feb 16 21:24:48 2020

@author: W_Indicate
"""
Y = 0

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

for item in s:
    if (item % 2) == 0:
        if ((item % 3) != 0) and ((item % 5) != 0):
            Y = 1 
            
if Y == 0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
import sys
n = input().split()
ln = list(map(int, input().split()))
for l in ln:
  if l % 2 == 1:
    continue
  if l % 3 != 0 and l % 5 != 0:
    print("DENIED")
    sys.exit()
print("APPROVED")

Solution (Python):
APPROVE_NUM_THREE = 3
APPROVE_NUM_FIVE = 5


def approve_entry(entry_judge_number_list):
    for n in entry_judge_number_list:
        if n % 2 == 0:
            if n % APPROVE_NUM_THREE != 0 and n % APPROVE_NUM_FIVE != 0:
                return 'DENIED'

    return 'APPROVED'


if __name__ == '__main__':
    input_numbers = input()
    entry_judge_number_list = map(int, input().split())
    print(approve_entry(entry_judge_number_list))

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

Solution (Python):
n = int(input())
L = list(map(int,input().split()))
L = [x for x in L if x%2 ==0]

if all((L[i]%3 == 0 or L[i]%5 == 0 for i in range(len(L)))):

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

Solution (Python):
from sys import exit
n = int(input())
a = list(map(int, input().split()))
b = "APPROVED"
while b == "APPROVED":
  for i in a:
    if i % 2 == 0:
      if (i % 3 == 0 or i % 5 == 0):
        b = "APPROVED"
      else:
        print("DENIED")
        exit()
  break
print(b)

Solution (Python):



def main():
    _ = int(input())
    integers = list(map(int, input().split(' ')))

    for integer_ in integers:
        if integer_ % 2 == 0:
            if integer_ % 3 == 0 or integer_ % 5 == 0:
                pass
            else:
                print('DENIED')
                return 0
        else:
            pass

    print('APPROVED')

    return 0


if __name__ == '__main__':
    main()

Solution (Python):
n = input()
a = input().split()
n= int(n)
a= [int(i) for i in a]
f=0


for h in a:	
	if h%2 ==0:
  		if h%3 ==0 or h%5 ==0: f=f+1
	else: f = f+1



if f == len(a): print("APPROVED")
else: print("DENIED")

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n = int(input())
l = list(int(x) for x in input().split())
a = []
for i in l:
    if i % 2 == 0:
        a.append(i)
x = [i % 3 == 0 or i % 5 == 0 for i in a]

if len(a) == sum(x):
    print('APPROVED')
elif len(a) == 0:
    print('DENIED')
else:
    print('DENIED')

Solution (Python):
n = int(input())
List = list(map(int, input().split()))
denied_point = 0
List_even = [i for i in List if i % 2 == 0]


for i in List_even:
    if (i % 3) != 0 and (i%5 != 0):
        denied_point = denied_point + 1


if denied_point ==0 :
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
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)

Solution (Python):
import sys

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

    ans = True

    for i in a:
        if i % 2 == 1:
            continue
        if i % 2 == 0:
            if i % 3 == 0 or i % 5 == 0:
                continue
            else:
                ans = False
                
    if ans == True:
        print('APPROVED')
    else:
        print('DENIED')


if __name__ == '__main__':
    main()

Solution (Python):
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007



def main():
	n = int(input())
	al = list(IN())
	for i in al:
		if i % 2 == 0 and i%3!=0 and i%5!=0:
			print('DENIED')
			return 
	print('APPROVED')
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):

def main():
    n = map(int, input().split())
    an = list(map(int, input().split()))

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

    print("APPROVED")
    return
main()

Solution (Python):
N = int(input())
LIST = list(map(int, input().split()))

def isApprovedNumber(n):
    if n % 2 != 0:
        return True
    if n % 5 == 0 or n % 3 == 0:
        return True
    return False

def isApprovedArray(list):
    str_ok="APPROVED"
    str_ng="DENIED"
    for number in list:
        if not isApprovedNumber(number):
            return str_ng
    return str_ok

result=isApprovedArray(LIST)
print(result)

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

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

Solution (Python):
def judge(num):
	if num%2:
		return True
	else:
		if not num%3 or not num%5:
			return True
	return False

def solve(li):
	for i in li:
		if not judge(i):
			print('DENIED')
			return 
	print('APPROVED')
	
input()
li = list(map(int,input().split()))
solve(li)

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

even = []
for target_list in a:
    if target_list%2 == 0:
        even.append(target_list)

ans = []

for target_list in even:
    c1 = target_list%3
    c2 = target_list%5
    if c1 == 0 or c2 == 0:
        pass
    else:
        ans.append(target_list)

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

Solution (Python):
n = input()
l = input().split() 
l = [int(x) for x in l]
e =[]
f =[int(x) for x in l if x%2==0]
for i in range(len(l)):
    if l[i] % 2 == 0 and (l[i]%3 ==0 or l[i]%5==0):
        e.append(l[i])
if (len(e)==len(f)):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
AAA = input().split()

ev_AAA = []
for n in AAA:
	if int(n) % 2 == 0:
		ev_AAA.append(n)
        
result = "APPROVED"
for ev_a in ev_AAA:
  if int(ev_a) % 3 == 0:
    continue
  elif int(ev_a) % 5 == 0:
    continue
  else:
    result = "DENIED"
    
print(result)

Solution (Python):
input1 = list(map(int, (input().split())))
input2 = list(map(int, (input().split())))

n = input1[0]

for a in input2:
    if(a & 1 == 1):
        continue

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

print("APPROVED")

Solution (Python):
def judge(N, A):
  cnt = 0
  odd = 0
  for i in range(N):
    if A[i] % 2 != 0:
      odd += 1
    else:
      if (A[i] % 3 == 0) or (A[i] % 5 == 0):
        cnt += 1
  even = N - odd
  if cnt == even:
    print('APPROVED')
  else:
    print('DENIED')
    
N = int(input())
A = list(map(int, input().split()))
judge(N, A)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
c=0
k=0
for i in l:
    if i%2==0:
        c+=1
        if i%3==0 or i%5==0:
            k+=1
if k==c:
    print('APPROVED')
else:
    print('DENIED')

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

B = []
C = []
for i in range(len(A)):
    if A[i]%2==0:
        if A[i]%3!=0:
            if A[i]%5!=0:
                B.append('DENIED')            
    elif A[i]%2!=0:
        C.append('DENIED')

if len(B)==0:
    if len(C)==N:
        print('DENIED')
    elif len(C)!=N:
        print('APPROVED')
elif len(B)!=0:
    print('DENIED')

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

ans = True
for ai in A:
    if ai % 2 == 0:
        if ai % 3 == 0 or ai % 5 == 0:
            pass
        else:
            ans = False

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

Solution (Python):
n = int(input())
str = input()
a = str.split()
flag = 1

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

Solution (Python):
import math
import numpy as np
n=int(input())
a=list(map(int, input().split()))

flag=False
ans="APPROVED"

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

Solution (Python):
n = int(input())
lis = list(map(int, input().split()))

def _filtter(lis, val):
    return [x for x in lis if x % val != 0]


def filtter(lis):

    filtter_val = (3, 5)
    for val in filtter_val:
        lis = _filtter(lis, val)
        if len(lis) == 0:
            return 'APPROVED'
    return 'DENIED'
            
print(filtter([x for x in lis if x % 2 == 0]))

Solution (Python):
input()
nlist = list(map(int, input().split()))
denied = False
for n in nlist:
  if n % 2 == 1:
    continue
  else:
    if n%5 ==0 or n%3==0:
      continue
    else:
      denied =True
      break
if denied:
  print("DENIED")
else:
  print("APPROVED")

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

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

Solution (Python):


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

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

Solution (Python):
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:
      ans = 'APPROVED'
    else:
      ans = 'DENIED'
      break
    
print(ans)

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

Solution (Python):


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

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

c = [0] * n

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

Solution (Python):
N = int(input())
A = input().split()
for i in range(N):
  if int(A[i])%2 != 0:
    ans = "APPROVED"
  if int(A[i])%2 == 0:
    if int(A[i])%3==0 or int(A[i])%5==0:
      ans = "APPROVED"
    if int(A[i])%3!=0 and int(A[i])%5!=0:
      ans = "DENIED"
      break
print(ans)

Solution (Python):
n = int(input())
items = [int(x) for x in input().split()]
 
flg = True
for item in items:
  if item % 2 == 0:
    if item % 3 == 0 or item % 5 == 0:
      flg = True
    else:
      flg = False
      break
 
if flg:
  print('APPROVED')
else:
  print('DENIED')

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

Solution (Python):
import sys

n = int(input())
a = [num for num in map(int, input().split())]




for item in a:
  if item % 2 == 1:
    continue
  if item % 3 == 0 or item % 5 == 0:
    continue
  print('DENIED')
  sys.exit()
print('APPROVED')

Solution (Python):
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)

Solution (Python):
n = int(input())
arr = [int(i) for i in input().split()]

for d in arr :
  
  if d % 2 == 0 :
    
    if d % 3 == 0 or d % 5 == 0:

      pass
    
    else :

      print("DENIED")
      exit()
      
print("APPROVED")

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

ngcount = 0
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0:
            continue
        elif A[i] % 5 == 0:
            continue
        else:
            ngcount = ngcount + 1
            break
    else:
        continue
if ngcount == 0:
    print('APPROVED')
else:
    print('DENIED')

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(len(A)):
  a = A[i]
  if a%2 == 0:
    if a%3 == 0 or a%5 == 0:
      continue
    else:
      ans = 1
if ans == 0:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
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")
        break

Solution (Python):


n = int(input())

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

ans = 'APPROVED'

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

Solution (Python):


num = int(input())
line = input().split(" ")
result = []

for i in range(num):
    line[i] = int(line[i])

for i in range(num):
    if line[i] % 2 == 0:
        result.append(line[i])

count = 0
for i in range(len(result)):
    if result[i] % 3 == 0 or result[i] % 5 == 0:
        count += 1

if count == len(result):
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):
num = int(input())
A = list(map(int,input().split()))
def main():
  for i in A:
    if i % 2 == 1:
      continue
    if not (i % 5 == 0 or i % 3 == 0):
      return "DENIED"
  return "APPROVED"
print(main())

Solution (Python):
import sys

APP = 'APPROVED'
DEN = 'DENIED'

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(DEN)
            sys.exit()
    
print(APP)

Solution (Python):
def main():
	
	n = int(input())
	a = list(map(int,input().split()))
	ans = 0
	den = 0
	for i in range(len(a)):
		if a[i] % 2 == 0:
			if a[i] % 3 == 0 or a[i] % 5 == 0:
				ans = 1
			else:
				den = 1
	if den == 0:
		print("APPROVED")
	else:
		print("DENIED")
	
 
if __name__ == '__main__':
	main()

Solution (Python):
amount = int(input())
inputl = input().split()

flag = True

for i in range(amount):
    a = int(inputl[i])
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            flag = False

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

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


def main():
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                return 'DENIED'

    return 'APPROVED'


print(main())

Solution (Python):
N = input()
A_list = list(map(int, input().split(' ')))
 
a_2 = [a for a in A_list if a%2==0]
flg = False
for a in a_2:
    if a % 3 ==0 or a % 5 ==0:
        continue
    else:
        print('DENIED')
        flg = True
        break
if flg == False:
    print('APPROVED')

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
f=0
g=0
ans="DENIED"
for i in range(n):
  if a[i]%2==0:
    f=1
    if (a[i]%3==0 or a[i]%5==0):
      continue
    else:
      g=1
if f==1 and g==0:
  ans="APPROVED"
if f==0 and ans=="DENIED":
  ans="APPROVED"
print(ans)

Solution (Python):

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

Solution (Python):
a = int(input())
b = [int(str) for str in input().split()]
c = [0]*a

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

if sum(c) == 0:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
n = int(input())
lis = list(map(int,input().split()))
ans = [0]

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

Solution (Python):
N = int(input())
As = input().split(" ")
As = [int(i) for i in As]
div = [i for i in As if i % 2==0]
No3 = [i for i in div if i % 3 !=0]
deny = [i for i in No3 if i % 5 != 0]
if len(deny)>0:
    print("DENIED")
else:
    print("APPROVED")

Solution (Python):
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = np.unique(list[list%2 == 0])
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))

if len(A) ==0:
        print('APPROVED')
elif len(B) ==0:
    print('DENIED')
else:
    if len(A) == len(B) :
        print('APPROVED')
    else:
        print('DENIED')

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
NK = list(map(int, input().split()))
Key = N
for i in range(N):
    if N != Key:
            break
    elif NK[i] % 2 == 0:
        if NK[i] % 3 == 0 or NK[i] % 5 == 0:
            continue
        else:
            N -= 1
            break
    else:
        continue
    
if N == Key:
    print("APPROVED")
elif N != Key:
    print("DENIED")

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(N):
  
  if a[i]%2 == 0:
    if a[i]%3 == 0 or a[i]%5 == 0:
      pass
    else:
     c += 1 
if c == 0:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):

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

approved = True
for num in nums:
  if num % 2 == 0:
    if num % 3 == 0 or num % 5 == 0:
      continue
    else:
      approved = False

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

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

ad="APPROVED"
for ai in a:
    if ai%2==0:
        if ai%3!=0 and ai%5!=0:
            ad="DENIED"
            break

print(ad)

Solution (Python):


def main():
    question_b()

def question_b():
    n = int(input())
    syorui = list(map(int,input().split()))
    flg = False
    oddflg = False
    box = []
    for i in range(n):
        if syorui[i]%2 == 0:
            oddflg = True
            if syorui[i]%3 == 0 or syorui[i]%5 == 0:
                flg = True
            else:
                flg = False
                break
    if flg == True or oddflg == False:
        print("APPROVED")
    else:
        print("DENIED")

main()

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
import sys

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

print('APPROVED')

Solution (Python):


def abc155b(num, s):
    b = True

    for i in range(0, num):
        if(s[i] % 2 == 0):
            if(s[i] % 3 == 0):
                continue
            elif(s[i] % 5 == 0):
                continue
            else:
                b = False

    return(b)



if(__name__ == '__main__'):
    
    num = int(input())
    s = list(map(int, input().split(" ")))

    b = abc155b(num, s)

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

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