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:
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split() if int(i) % 2 == 0]
if all([i % 3 == 0 or i % 5 == 0 for i in a_ls]):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

ok = 0
ng = 0
even = []
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()))
r="APPROVED"
for a in A:
  if a%2==0 and (a%3!=0 and a%5!=0):
    r="DENIED"
print(r)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

for x in A:
	if x%2 == 0 and (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()))
for i in range(n):
    if A[i]%2==1:
        continue
    else:
        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()))
a = filter(lambda x:(x+1)%2, a)
print('DENIED' if any((x%3)*(x%5) for x in a) else 'APPROVED')

Submission status: Accepted

Solution code:
from collections import Counter, deque, defaultdict
from functools import lru_cache

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

f=True
for i in a:
	if i&1:
		continue
	if i%3 and i%5:
		f=False
		break

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

Submission status: Accepted

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

ans = "APPROVED"
andflg = 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

    for i in odds:
        if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            return

    print("APPROVED")


def main1():
    _ = int(input())
    a = list(map(int, input().split()))
    odds = list(filter(lambda x: x % 2 == 0, a))
    denied = list(filter(lambda x: x % 3 != 0 and x % 5 != 0, odds))
    if denied:
        print("DENIED")
    else:
        print("APPROVED")


if __name__ == "__main__":
    main1()

Submission status: Accepted

Solution code:
input()
print(["APPROVED","DENIED"]["1"in map(lambda x:format(0x28828228,'b')[int(x)%30-2],input().split())])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
for a in A:
    if a & 1:
        continue
    if (a % 3 != 0)and(a % 5 != 0):
        print('DENIED')
        exit(0)
print('APPROVED')

Submission status: Accepted

Solution code:
def main():
    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()
    print("APPROVED")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
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:
                continue
            else:
                answer = "DENIED"
    print(answer)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import collections as col
input=sys.stdin.readline

def main():
	#N,K=map(int,input().split())
	#N=input().rstrip()
	N=int(input())
	vA=list(map(int,input().split()))
	
	vE = [a for a in vA if a%2<1]
	for a in vE:
		if a%3 and a%5:
			res = "DENIED"
			break
	else:
		res = "APPROVED"
	
	print(res)


main()

Submission status: Accepted

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

Submission status: Accepted

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

a = list(filter(lambda i: i%3 != 0 and i%5 != 0 and i%2 == 0, A))
print("APPROVED" if len(a) == 0 else "DENIED")

Submission status: Accepted

Solution code:
def I(): return int(input())
def MI(): return map(int, input().split())
def LMI(): return list(map(int, input().split()))


N = I()
A = LMI()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
*A, = map(int, input().split())
B = []
C = 0
for i in A:
  if i % 2 == 0:
    B.append(i)
    if i % 5 == 0 or i % 3 == 0:
      C += 1
 
if C == len(B):
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
input()
evens = filter(lambda x: x % 2 == 0, map(int, input().split()))
if all(map(lambda x: x % 3 == 0 or x % 5 == 0, evens)):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
print("DENIED" if sum((i%3)*(i%5) for i in a if i%2==0) else "APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int,input().split()))
flag = 1
for i in range(n):
    if(li[i] % 2 == 0):
        if((li[i] % 3 == 0) or(li[i] % 5 == 0)):
            #print(li[i])
            #flag=1
            continue
        else:
            #print(li[i])
            flag=0
    


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


#これで通ってくれない....

Submission status: Accepted

Solution code:
a = input()
b = [int(str) for str in input().split() if int(str)%2 ==0]
c = "APPROVED"
for i in b:
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        c = "DENIED"
        break

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int( input() )

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

ans = True
for a in a_list:
  if a % 2 == 0:
    if not ( ( a % 3 == 0 ) or ( a % 5 == 0 )):
      ans = False
      break
if ans:
  print( "APPROVED" )
else:
  print( "DENIED" )

Submission status: Accepted

Solution code:
n = int(input())
a_list = map(int,input().split())
for elm in a_list:
  if elm % 2 == 0:
    if elm % 3 != 0 and elm % 5 != 0:
      print("DENIED")
      exit()
print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
k = list(map(int, input().split())) #input based on n
app = True
for i in k:
    if (i%2 != 0):
        continue
    if not (i%3 == 0 or i%5 == 0):
        app = False
        break
if app:
    print('APPROVED')
else:
    print("DENIED")

Submission status: Accepted

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

ans = "APPROVED"
for i in range(n):
    if ans =="APPROVED":
        if a[i]%2 == 0:
            b = a[i]%3
            c = a[i]%5
            if b == 0 or c == 0:
                ans = "APPROVED"
            else: 
                ans = "DENIED"
    else:
        ans = "DENIED"
print(ans)

Submission status: Accepted

Solution code:
N=input()
A=input().split()

def validate(i):
    I=i%2
    if I==0:
        I1=i%3
        I2=i%5
        if I1==0 or I2==0:
            return "Yes"
        else:
            return "No"
    else:
        return "Yes"

X = []
for i in A:
    X.append(validate(int(i)))

if "No" in X:
    print("DENIED") 
else:
    print("APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
count = 0
result = 0
for n in range(N):
    if A[n] % 2 == 0:
        An = A[n]
        count += 1
        if An % 3 == 0 or An % 5 == 0:
            result += 1
if count == result:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
flag=0
lst = [int(i) for i in input().split()][:n]
for i in lst:
    if i%2==0 and i%3!=0 and i%5!=0:
        flag=1 
    else:
        continue
if (flag==1):
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
import sys
n = int(input())
l = list(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()))
for i in range(n):
    if(A[i]%2==0):
        if(A[i]%5!=0 and A[i]%3!=0):
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
a = int(input())
 
b=list(map(int, input().split())) 
x = 0
c = 0
    
for i in b:
  if ((i % 3 == 0) or (i % 5 == 0)) and (i % 2 == 0):
    x += 1

for t in b:
  if (t%2==0):
    c += 1;

if x == c:
  print('APPROVED')
else :
  print('DENIED')

Submission status: Accepted

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

for a in An:
    if ( a%2 == 0 ) and  not( a%3 == 0 or a%5 == 0 ):
        print('DENIED')
        exit(0)
print('APPROVED')

Submission status: Accepted

Solution code:


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

Submission status: Accepted

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

even =[]

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

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

Submission status: Accepted

Solution code:

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

if t==0:
  print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=[i for i in A if i%2==0]
C=[i for i in B if i%3==0]
D=[i for i in B if i%5==0]
E=[i for i in B if i%15==0]
if len(B)==len(C)+len(D)-len(E):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N=int(input())
List=list(map(int,input().split()))
nList=[e for e in List if e % 2 == 0]
tmp = []
while nList:
  f = nList.pop()
  if f % 3 != 0 and f % 5 != 0:
    tmp.append(f)
if not tmp:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
i1 = int(input())
i2 = list(map(int, input().split()))
    
l = []
for i in range(i1):
  if i2[i] % 2 == 0:
    if i2[i] % 3 == 0 or i2[i] % 5 == 0:
        l.append('APPROVED')
    else:
        l.append('DENEID')
    
if (all(str == 'APPROVED' for str in l)):
	print('APPROVED')
else:
  	print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def contest(N, str):
    a_str = []
    a = []

    a_str= map(int,str.split(' '))
    for char in a_str:
        a.append(int(char))

    result = True

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

    if result == True:
        return 'APPROVED'
    else:
        return 'DENIED'


if __name__ == "__main__":
    N = int(input())
    str = input()

    print(contest(N, str))

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# 整数の入力
a = int(input())
# スペース区切りの文字列の入力
st = input().split()
st_list = []
st_list = [int(st) for st in st]

num = 0
flg = 0
for num in range(len(st_list)):
  if(st_list[num] % 2 == 0):
    if(st_list[num] % 5 != 0 and st_list[num] % 3 != 0):
      flg = 1
if(flg == 0):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
list = input().split(" ")
list = [int(a) for a in list]
even = [a for a in list if a % 2==0]
ans = []
for a in even:
    if a % 3 == 0 or a % 5 == 0:
        ans.append(True)
if len(even) ==len(ans):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
flag=0
lst = [int(i) for i in input().split()][:n]
for i in lst:
    if i%2==0 and i%3!=0 and i%5!=0:
        flag=1 
    else:
        continue
if flag==1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = input()
nums = input().split()
check = 1
for num in nums:
  a = int(num)
  if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
    check = 0

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
N = int(input())
#真偽判定用の変数
approved = True
An = input().split(" ")

for i in range(N):
	A = int(An[i])
	if A % 2 == 0:
		if A % 3 != 0 and A % 5 != 0:
			approved = False
			
if approved:
	print("APPROVED")
else:
	print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
As = input().split()
for a in As:
  a = int(a)
  if a % 2 == 1: # skip odd
    continue
  if (a % 3 == 0) or (a % 5) == 0: # check even
    continue
  else:
    print('DENIED')
    break
else:
  print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a = int(input())
lis = list(map(int, input().split()))
for i in range(a):
  judge = True
  if (lis[i] % 2 == 0):
    if (lis[i] % 3 != 0) and (lis[i] % 5 != 0):
      judge = False
      break
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
h = list(map(int,input().split()))
e = []
for i in range(0,N):
    if h[i] % 2 == 0:
        e.append(h[i])
c = 0
for j in range(0,len(e)):
    if e[j] % 3 == 0 or e[j] % 5 == 0:
        c += 1
if c == len(e):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().rstrip().split()))
s = 0
for A in l:
    if A%2==0 and A%3!=0 and A%5!=0:
        s = s
    else:
        s = s+1
if s == n:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

c = list(filter(lambda n:(n%2==0 and n%3!=0 and n%5!=0), A))

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
flag = 'ap'
for i in range(N):
  if A[i]%2 == 0:
    if A[i]%3 == 0 or A[i]%5 == 0:
      continue
    else:
      flag = 'den'

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

Submission status: Accepted

Solution code:
n=int(input())
l=list(input().split())
ln=[]
m=0
for i in l:
  if int(i)%2==0:
    ln.append(int(i))
for k in ln:
  if k%3==0 or k%5==0:
    m=m+1
if m==len(ln):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

def qqq(x):
    if x % 2 == 0 and x % 3 != 0 and x % 5 != 0:
            return 1
    return 0

p = 0

for i in range(n):
    p = p + qqq(int(a[i]))
    
if p == 0:
    print('APPROVED')
    
else:
    print('DENIED')

Submission status: Accepted

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

def check(a):
    for i in range(N):
        if a[i] %2 == 0:
            if a[i]%3 != 0 and a[i]%5 != 0:
                return "DENIED"
    return "APPROVED"

print(check(a))

Submission status: Accepted

Solution code:
def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
  return "APPROVED"
n = int(input())
li = [int(num) for num in input().split(" ")]
print(fun(li))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
a = [int(i) for i in a]
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
inp = [int(ele) for ele in input().split() if int(ele)%2==0]
t=0
for ele in inp:
  if ele%3==0 or ele%5==0:
    t+=1
print("APPROVED" if t==len(inp) else "DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
li = list(map(int,input().split()))
li = list(filter(lambda x:x%2==0,li))
t=len(li)
li = list(filter(lambda x:(x%3==0 or x%5==0),li))
c=len(li)
if(c==t):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin


def get_result(data):
    N, A = data
    for a_i in A:
        if a_i % 2 == 0 and a_i % 3 != 0 and a_i % 5 != 0:
            return 'DENIED'

    return 'APPROVED'

if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)

Submission status: Accepted

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

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

for j in range(len(b)):
    if b[j]%3 == 0 or b[j]%5 == 0:
        wk = 1
    else:
        wk1 = 1
if wk1 == 1:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

def approve(n):
    if (n % 2 == 0):
        if (n % 3 == 0):
            return True
        if (n % 5 == 0):
            return True
        return False
    return True
if (all(list(map(approve, A)))):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check(input_list):
    for a in input_list:
        a = int(a)
        if(a % 2 == 0 and not(a % 3 == 0 or a % 5 == 0)):
            return False
    
    return True

if __name__ == '__main__':
    num = input()
    input_list = [int(a) for a in input().split()]
    
    if check(input_list):
        print("APPROVED")
    else:
        print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
flag = 0
lst = [int(i) for i in input().split()][:n]
for i in lst:
    if i % 2 == 0 and i % 3 != 0 and i % 5 != 0:
        flag = 1
    else:
        continue
if flag == 1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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


for a in aa:
  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:
a=int(input())
list=map(int,input().split())
list2=[]
list3=[]
for x in list:
    if x%2==0:
        list2.append(x)
for y in list2:
    if y%3!=0 and y%5!=0:
        list3.append(y)
s=len(list3)
if s==0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import sys

n = int(input())
aList = input().split(" ")

aList = np.array(aList, dtype=np.int)
aList = aList[aList % 2 == 0]

a = list(aList[aList % 5 == 0])
b = list(aList[aList % 3 == 0])

aList = set(list(aList))

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

Submission status: Accepted

Solution code:
import sys

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

for i in range(n):
  a = li[i]
  if a%2 ==0:
    if (a % 3 == 0 or a % 5 == 0)==False:
      print("DENIED")
      sys.exit()

print("APPROVED")

Submission status: Accepted

Solution code:

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

ok = 0

for i in range(a):
    if lis[i] % 2 == 0:
        #print(lis[i])
        if lis[i] % 3 != 0 and lis[i] % 5 != 0:
            #print(lis[i])
            ok =1

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