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()))
even_list = []
for num in a:
    if num % 2 == 0 :
        even_list.append(num)

deny = 0
for even in even_list :
    if even % 3 != 0 and even % 5 != 0 :
        deny = 1
        break

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

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


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

print('APPROVED')

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

for v in A:
    if v % 2 != 0:
        continue
    if v % 3 != 0 and v % 5 != 0:
        print('DENIED')
        import sys
        sys.exit()

print('APPROVED')

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

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

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

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

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

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

even =[]
for i in range(n):
    if a[i]%2 == 0:
        even.append(a[i])
        
ans =[]
for i in range(len(even)):
    if even[i]%3 == 0:
        ans.append(even[i])
        
for i in range(len(even)):
    if even[i]%5 == 0:
        ans.append(even[i])
        
print((set(even)==set(ans))*"APPROVED" or "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 or a[i]%5 == 0:
      continue
    else:
      print('DENIED')
      exit(0)
      
print('APPROVED')

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

Solution (Python):

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

for item in A:
    if item % 2 == 0:
        if item % 3 == 0 or item % 5 == 0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break

print(ans)

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


if __name__ == '__main__':
    main()

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

B = []
C = []

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

for i in range(l):
  if B[i] % 3 == 0 or B[i] % 5 == 0:
    C.append(B[i])
    
x = len(B) - len(C)    
    
if x == 0:
  print("APPROVED")

else:
  print("DENIED")

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    an = list(map(int, input().split()))

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

    print('APPROVED')

Solution (Python):
N = input()
As = input().split(" ")

judge = True

for A in As:
    A=(int)(A)
    if A %2 ==0:
        if A%3 != 0 and A%5 != 0:
            judge=False
            break


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

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

print(ans)

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:
            continue
        elif a[i]%5 == 0:
            continue
        else:
            print("DENIED")
            exit()
print("APPROVED")

Solution (Python):

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

NG = 0
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")

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

arr=[x%2==1 or x%6==0 or x%10==0 for x in a]

print('APPROVED' if all(arr) else 'DENIED')

Solution (Python):
n = input()

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

list =[]


for i in p:
    if i % 2 == 0:
        list.append(i)

count = 0
for i in list:
    if i % 3 == 0 or i % 5 == 0:
        count += 1

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

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

def myfunc(A):
    A = A[np.mod(A,2) == 0]
  
    if len(A) == 0:
        return("APPROVED")
      
    BIN = (np.mod(A,3) == 0) | (np.mod(A,5) == 0) 
    
    if len(BIN) == np.sum(BIN):
        return("APPROVED")
    else:
        return("DENIED")

print(myfunc(A))

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

Solution (Python):
import sys
import numpy as np

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

f = True
for A in As:
    if A % 2 == 0 and not (A % 3 == 0 or A % 5 == 0):
        f = False
        break

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

Solution (Python):
N = int(input())
A = [int(i) for i in input().split() if int(i) % 2 == 0]

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

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

ans='APPROVED'

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

print(ans)

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

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

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

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

special =[i for i in even_list if i % 3 == 0 or i % 5 ==0]

n_1=len(even_list)
n_2=len(special)

if n_1 == n_2:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):

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

def main(lst_A):
    
    lst_even  = [A for A in lst_A if A % 2 == 0]
    lst_match = [
        even_A for even_A in lst_even
        if even_A % 3 == 0 or even_A % 5 == 0
    ]

    if len(lst_match) == len(lst_even):
        return "APPROVED"
    else:
        return "DENIED"

if __name__ == "__main__":

    answer = main(lst_A)
    print(answer)

Solution (Python):
cnt = int(input())
tar_list = list(map(int, input().split()))
flg = False
for i in range(cnt):

  if tar_list[i] % 2 == 0:
    if tar_list[i] % 3 == 0 or tar_list[i] % 5 == 0:
      flg = False
    else:
      flg = True
      print("DENIED")
      break
      
if flg == False:
  print("APPROVED")

Solution (Python):

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


result = True
for a in A:
    if a%2 == 0:
        if not (a%3 == 0 or a%5 == 0):
            result = False
            break


print("APPROVED" if result else "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')
      exit()
print('APPROVED')

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

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

for x in A:
  if x % 2 == 0 and (x % 3 != 0 and x % 5 != 0):
    check = False

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

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

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

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

Solution (Python):
import numpy as np

N=int(input())
A=np.array(input().split(),dtype=np.int32)

out=A[A%2==0]

flag=False
for i in range(len(out)):
    if(out[i]%3==0 or out[i]%5==0):
        pass
    else:
        flag=True

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

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

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
flag=1
for a in A:
    if not a%2:
        if a%3==0 or a%5==0:
            flag += 0
        else:
            flag=0
print('APPROVED' if flag else 'DENIED')

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
hantei = True
for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            hantei = False
            break

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

Solution (Python):

import sys

N = int(input())
A = 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")

Solution (Python):
import sys
n = int(input())

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

for i in range(n):
  if a[i] % 2 != 0:
    continue
  else:
    if a[i] % 3 == 0 or a[i] % 5 == 0:
      pass
    else:
      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'
			break

print(ans)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
f = True
for i in a:
    if i % 2:
        continue
    if i % 3 and i % 5:
        f = False
        break

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

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

res = "APPROVED"

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


print(res)

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

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

even_list = filter(lambda x: x % 2 == 0, a)

is_approved = True

for i in even_list:
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        is_approved = False
        break

print('APPROVED' if is_approved else '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()))

for i in A:
    if i%2==0:
        if i%6!=0 and i%10!=0:
            print("DENIED ")
            exit()
else:
    print("APPROVED ")

Solution (Python):

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

Solution (Python):
import sys
from io import StringIO
import unittest

def resolve():
    n=int(input().strip())
    la= list(map(int,input().strip().split()))

    res="APPROVED"

    for a in la:
        if a%2==0:
            if a%3==0 or a%5==0:
                a=1
            else:
                res="DENIED"

    print(res)

resolve()

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

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

print("APPROVED")

Solution (Python):
N = input()
line = input().split(" ")

for l in line:
    i = int(l)
    if i % 2 == 0:
        if (i % 3 == 0) or (i % 5 == 0):
            pass
        else:
            print("DENIED")
            exit()

print("APPROVED")

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
flag = 0
for i in range(N):
    if P[i] % 2 == 0:
        if P[i] % 3 != 0:
            if P[i] % 5 != 0:
                flag = 1

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

Solution (Python):

N = int(input())

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

result = "APPROVED"
for n in L:
    if n % 2 == 1:
        continue
    if not (n % 3 == 0 or n % 5 == 0):
        result = "DENIED"
        break


print(result)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
judge=1
for i in A:
    if(i%2==0):
        if(i%5==0 or i%3==0):
            judge=1
        else:
            judge=0
            break

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

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

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

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

ans = 'APPROVED'
for i in range(N):
    a = A[i]
    if a % 2 == 1:
        continue
    
    if a % 6 != 0 and a % 10 != 0:
        ans = 'DENIED'

print(ans)

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

flag = "APPROVED"

for ele in arr:
  if ele % 2 == 0:
    if ele % 3 == 0 or ele % 5 == 0:
      pass
    else:
      flag = "DENIED"
      break

print(flag)

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

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

flg = True

for i in l:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            flg = False
            break

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

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

appr = True

for k in A:
  if k % 2 == 1:
    continue
  elif k % 3 == 0:
    continue
  elif k % 5 == 0:
    continue
  else:
    appr = False
    break

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

Solution (Python):
input()
nums = list(map(int,input().split()))
divisible = True
for n in nums:
    if n % 2 == 0:
        if n % 3 != 0 and n % 5 != 0:
            divisible = False

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

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

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

Solution (Python):

N=int(input())
A=list(map(int,input().split()))
Flg=True
cnt=0
for i in range(N):
    if A[i]%2==0:
        if A[i]%3==0 or A[i]%5==0:
            cnt+=1
        
    else:
        cnt+=1

if cnt==N:
    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 or A[i]%5==0:
            pass
        else:
            Ans="DENIED"
    else:
        pass

print(Ans)

Solution (Python):
def main():
    N = int(input())
    A = list(map(int,input().split()))
    answer = "APPROVED"
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                answer = "DENIED"
        else:
            pass
    print(answer)

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = []
ans='APPROVED'

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

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

print(ans)

Solution (Python):
N = int(input())
An = [int(v) for v in input().strip().split() if int(v) % 2 == 0]
iAn = [v for v in An if v % 3 != 0 and v % 5 != 0]
print('APPROVED' if len(iAn) == 0 else 'DENIED')

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

f = 0
for a in range(len(A)):
  if A[a] % 2 != 0:
    continue
  else:
    if A[a] % 3 != 0 and A[a] % 5 != 0:
      f = 1
      break
      
if f == 1:
  print('DENIED')
else:
  print('APPROVED')

Solution (Python):




import sys
input = sys.stdin.readline



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

    res = 'APPROVED'

    for i in range(N):
        temp = A[i]
        if temp % 2 == 0:
            if (temp%3!=0) & (temp%5!=0):
                res = 'DENIED'
                break

    print(res)



main()

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

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

Y=0
for i in range(len(X)):
    if X[i]%3!=0 and X[i]%5!=0:
        Y+=1

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

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

Solution (Python):


N = int(input())
Data = input().split(" ")
for i in range(N):
  Data[i] = int(Data[i])

Flag = 0
for i in range(N):
  if(Data[i] % 2 == 0):
    if(Data[i] %3 == 0 or Data[i] % 5 == 0):
      Flag = 0
    else:
      Flag = 1
      break
if(Flag == 0):
  print("APPROVED")
elif(Flag == 1):
  print("DENIED")

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

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

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

print('APPROVED')

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

allowed = True
for v in a:
    if v & 1 == 0:
        if v % 3 != 0 and v % 5 != 0:
            allowed = False
            break

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

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
def a(b):
    for i in b:
        if i % 2 == 0:
            if i % 3 != 0 and i % 5 != 0:
                return 'DENIED'
                
if a(arr)!='DENIED':
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
import numpy as np

if __name__=="__main__":
    n = int(input())
    a  = [int(x) for x in 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
                break
    
    if approved:
        print("APPROVED")
    else:
        print("DENIED")

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

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

print("APPROVED")

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

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

C = len(B)
s = 0
for i in B:
    if i%3==0 or i%5==0:
        s += 1

if C==s:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n = int(input())
a = list(map(lambda x: int(x), input().split()))
flag = True
for i in a:
    if(i%2 != 0): continue
    if(i%3 != 0 and i%5 != 0): flag = False

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

Solution (Python):
import math

N = int(input())
A = []
A = input().split()

hantei = True

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

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

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

s=[]

def f(k):
  if k%3==0:
    return True
  elif k%5==0:
    return True
  else:
    return False

r="APPROVED"
  
for i in a:
   if i%2==0:
      if f(i)==False:
        r="DENIED"
        
print(r)

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

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

even = []
judgment = True
for i in a:
    if i % 2 == 0:
        even.append(i)
for i in even:
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        judgment = False
if judgment:
    print("APPROVED")
else:
    print("DENIED")

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

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

print("APPROVED")

Solution (Python):

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


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


x = 0
for j in range(len(a)):
    if a[j] % 3 ==0 or a[j] % 5 ==0:
        x += 1
if x == len(a):
    print('APPROVED')
else:
    print('DENIED')

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

evens = [x for x in numbers if x % 2 == 0]

if all([x % 3 == 0 or x % 5 == 0 for x in numbers if x % 2 == 0]):
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
n=int(input())
a_map=map(int,input().split())
ans="APPROVED"
for a in a_map:
    if a%2==0 and (a%3)*(a%5)!=0:
        ans="DENIED"
        break
print(ans)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

    flag = True

    for a in A:
        if a%2==0:
            if not (a%3==0 or a%5==0):
                flag = False
   
    if flag:
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == '__main__':
    resolve()

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

aa = filter(lambda num: True if num % 2 == 0 else False, a)
for num in aa:
    if (num % 3 != 0) and (num % 5 != 0):
        ans = 'DENIED'

print(ans)

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

print("APPROVED")

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

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

Solution (Python):
def check(s,A):
    A = [int(i) for i in A.split()]    
    B = [i for i in A  if i%2 ==0]
    
    for b in B:
        if b % 3 != 0 and b %5!=0:
            print('DENIED')
            return
    print('APPROVED')
    
s = int(input())
A = input()
check(s,A)

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

  r = 'APPROVED'

  for num in a:
    if num % 2 == 0:
      if num % 3 == 0 or num % 5 == 0:
        pass
      else:
        r = 'DENIED'
        break
  print(r)
  
main()

Solution (Python):
n = int(input())
aList = list(map(int, input().split()))
aList = filter(lambda n:n%2==0, aList)   

for a in aList:
  if a % 3 == 0 or a % 5 == 0:
    continue;
  print('DENIED')
  exit()
print('APPROVED')

Solution (Python):
def check_evens_divisible_3and5(A):
  for val in A:
    if val%2==0:
      if (val%3 != 0) and (val%5 != 0): return "DENIED"
  return "APPROVED"

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

print(check_evens_divisible_3and5(A))

Solution (Python):
N = int ( input().strip() ) ;
L = list (map ( int , input().strip().split(" " ) ) ) ;
L = list( filter (lambda x:x%2==0 ,  L )) ;

if all ( map( lambda x:x%3==0 or x%5==0  , L ) ) :
	print ( "APPROVED" ) ; 
else :
	print ("DENIED") ;

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

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

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

for i in a:
    if (i % 2 == 0) and (i % 3 != 0) and (i % 5 != 0):
        flag = False
        break

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

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

s = "APPROVED"

for i in A:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            s = "DENIED"

print(s)

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

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

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

ans = 0
for i in range(n):
    if a[i] % 2 == 0:
        if ( a[i] % 3 ==0 ) or ( a[i] % 5 == 0 ):
            ans += 1
    else:
        ans += 1

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

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

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

for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0:
      if A[i] % 5 != 0:
        cnt += 1

if cnt > 0:
	print('DENIED')
else:
	print('APPROVED')

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])
ans="APPROVED"
for i in range(len(b)):
  if b[i]%3!=0 and b[i]%5!=0:
    ans="DENIED"
print(ans)

Solution (Python):
n=int(input())
a=[int(x) for x in input().split()]
flg=True
for i in a:
    if i%2 == 0:
        if i%3 == 0 or i%5 == 0:
         flg=True
        else:
         flg=False
         break

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

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

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    l = [int(i) for i in input().split(" ")]
    is_denied = False
    for i in l:
        if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
            is_denied = True
            break

    if is_denied == False:
        print("APPROVED")
    else:
        print("DENIED")

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

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

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

Solution (Python):
length = int(input())
nums = map(int,input().split())


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

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


def func(A):
    for a in A:
        if not a % 2:
            if not a % 3 or not a % 5:
                pass
            else:
                return "DENIED"
    return "APPROVED"


print(func(A))

Solution (Python):



def main():
  n = int(input())
  As = map(int, input().strip().split())
  for A in As:
    if A%2 == 0:
      if (A%3==0 or A%5==0):
        continue
      else:
        print('DENIED')
        return
  print('APPROVED')

if __name__=='__main__':
  main()

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

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

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

Solution (Python):
n = int(input())
a = input().split(" ")
f = 0
for i in range(n):
	b = int(a[i])
	c = 1
	if b % 2 == 0:
		if b % 3 == 0:
			c = 0
		elif b % 5 == 0:
			c = 0
		if c != 0:
			f = 1
if f == 1:
	print("DENIED")
else:
	print("APPROVED")

Solution (Python):
N,*A=map(int,open(0).read().split())
flg=True
for i in A:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            flg=False
print("APPROVED" if flg else "DENIED")

Solution (Python):
import sys

input = sys.stdin.readline

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

for value in A:
    if value % 2 == 0:
        if value % 3 != 0 and value % 5 != 0:
            flag = True

if flag:
    print('DENIED')
else:
    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"
            break


print(ans)