Problem:


Score: 200 points

Problem Statement

You are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.

According to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:

All even numbers written on the document are divisible by 3 or 5.

If the immigrant should be allowed entry according to the regulation, output APPROVED; otherwise, print DENIED.

Notes

The condition in the statement can be rephrased as "If x is an even number written on the document, x is divisible by 3 or 5".
Here "if" and "or" are logical terms.

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq A_i \leq 1000

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \dots A_N

Output

If the immigrant should be allowed entry according to the regulation, print APPROVED; otherwise, print DENIED.

Sample Input 1

5
6 7 9 10 31

Sample Output 1

APPROVED

The even numbers written on the document are 6 and 10.

All of them are divisible by 3 or 5, so the immigrant should be allowed entry.

Sample Input 2

3
28 27 24

Sample Output 2

DENIED

28 violates the condition, so the immigrant should not be allowed entry.



Sample input:
5
6 7 9 10 31


Sample output:
APPROVED

Submission status: Accepted

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

Submission status: Accepted

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

ret = "APPROVED"
for a in a_list:
    if a % 2 == 0 and not (a % 3 == 0 or a % 5 == 0):
        ret = "DENIED"
        break

print("{}".format(ret))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    if a[i]%2==0:
        b.append(a[i])
for i in b:
    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()))
ans = 'APPROVED'
for i in range(n):
    if a[i]%2 == 0 and not (a[i]%3 == 0 or a[i]%5 == 0):
        ans = 'DENIED'
        break
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率

def input(): return sys.stdin.readline()[:-1]
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    flag=1
    for a in A:
        if a%2==1 or a%3==0 or a%5==0:
            pass
        else:
            flag=0
            break
    if flag:print('APPROVED')
    else: print('DENIED')





if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for x in a:
    if x % 2 == 0:
        if 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()))
b=[i for i in a if i%2==0]
c=[k for k in a if k%6==0 or k%10==0]
if len(b)==len(c):
     print('APPROVED')
else:
     print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
num_iter = map(int, input().split())
flg = True
for i in num_iter:
    if i % 2 == 0:
        if not (i % 3 == 0 or i % 5 == 0):
            flg = False
if flg:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

str = "APPROVED"

for i in range(n):
    if num[i] % 2 == 0:
        if num[i] % 6 != 0 and num[i] % 10 != 0:
            str = "DENIED"
            break

print(str)

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

Submission status: Accepted

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

flag =0
counter =0
for i in A:
    counter +=1
    if (i %2 ==1) or ((i%3)==0 or (i%5) == 0):
        pass
    else:
        flag =1

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

Submission status: Accepted

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

Submission status: Accepted

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

ok = True
for i in range(n):
  x = a[i]
  if x % 2 == 0:
    if x % 3 == 0 or x % 5 == 0:
      continue
    else:
      ok = False

if ok:
  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:
        continue
    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()))
arr=[]
for A in a:
    if A%2==0:
        arr.append(A)
    else:
        pass

for n in arr:
    if n%3==0 or n%5==0:
        pass
    else:
        print('DENIED')
        exit()
print('APPROVED')

Submission status: Accepted

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

ans='APPROVED'

for i in range(N):
  if A[i]%2==0:
    #print(A[i])
    if A[i]%3==0:
      pass
    elif A[i]%5==0:
      pass
    else:
      ans='DENIED'
      break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

flg = 0
for i in A:
    if i % 2 == 0 and (i % 3 == 0 or i % 5 == 0) and flg != 2:
        flg = 1
    elif i % 2 == 0:
        flg = 2
      
if flg == 0 or flg == 1:
    print('APPROVED')  
else:
    print('DENIED')

Submission status: Accepted

Solution code:
import sys
N=int(input())
L=list(map(int,input().split()))
for i in range(N):
  a=L[i]
  if a%2==0:
    if a%3!=0 and a%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 not a[i] % 2:
    if a[i] % 3 > 0 and a[i] % 5 > 0:
      print('DENIED')
      break
else:
  print('APPROVED')

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    inlis = list(map(int, input().split()))

    for num in inlis:
        if num % 2== 0:
            if num % 3 == 0 or num % 5 == 0:
                pass
            else:
                print("DENIED")
                exit()
    print("APPROVED")

    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:

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

flg = True

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

Submission status: Accepted

Solution code:
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 or a[i] % 5 == 0:
            pass
        else:
            flag = 1
if flag == 1:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
S = list(map(int, input().split()))
flag = 0

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

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

Submission status: Accepted

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

for i in range(len(A)):
  if A[i] %2 == 0:
    if A[i]%3 != 0 and A[i]%5 != 0:
      print("DENIED")
      exit()
    else:
      pass
  else:
    pass
  
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:
yes = "APPROVED"
no = "DENIED"

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

ans = yes if all([e % 2 == 1 or e % 3 == 0 or e % 5 == 0 for e in A]) else no
print(ans)

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

ret_val = 'APPROVED'
for x in a:
    if x % 2 == 0:
        if (x%3!=0) and (x%5!=0):
            ret_val = 'DENIED'
            break

    
print(ret_val)

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

print('APPROVED')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    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')
                return
    print('APPROVED')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
flag=False
for i in range(N):
  if A[i]%2==0:
    if A[i]%3!=0 and A[i]%5!=0:
      flag=True
if flag==True:
  print('DENIED')
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())
a = list(map(int, input().split()))

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

Submission status: Accepted

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

cnt = 0
for i in tmp:
    if i % 3 == 0 or i % 5 == 0:
        cnt += 1

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
B=[]
for i in A:
    if i % 2 == 0:
        B.append(i)

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

Submission status: Accepted

Solution code:
def abc155_b():
    N = int(input())
    A = list(map(int, input().split()))
    result = 'APPROVED'

    evens = [i for i in A if i % 2 == 0]
    for i in evens:
        if (i % 3 != 0) and (i % 5 != 0):
            result = 'DENIED'

    print(result)


##########
if __name__ == "__main__":
    abc155_b()

Submission status: Accepted

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

ans = 'APPROVED'
for x in a:
   if x % 2 == 0:
      if x % 3 != 0 and x % 5 != 0:
         ans = 'DENIED'
         break

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

A = list(map(int, input().split(' ')))
ok = True
for a in A:
    if(a % 2 == 0):
        if(a % 3 != 0 and a % 5 != 0):
            ok = False

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

Submission status: Accepted

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

for a in range(N):
    if A[a]%2==0:
        if (not A[a]%3==0) and (not A[a]%5==0):
            print("DENIED")
            break
        
else:
    print("APPROVED")

Submission status: Accepted

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

print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
ans = 1
for i in a:
    if i % 2 == 0:
        if not(i % 3 == 0 or i % 5 == 0):
            ans = 0
if ans == 1:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
def actual(n, A):
    even_numbers = [x for x in A if x % 2 == 0]

    immigration_status_list = [(x % 3 == 0) or (x % 5 == 0) for x in even_numbers]

    if all(immigration_status_list):
        return 'APPROVED'

    return 'DENIED'


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

print(actual(n, A))

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    import sys;
    try:
        main(sys.argv)
    except TypeError:
        main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))
l = [e for e in arr if e % 2 == 0]
ans = ''
for e in l:
  if e % 3 == 0 or e % 5 == 0:
    next
  else:
    ans = 'DENIED'
if ans == '':
  ans = 'APPROVED'
print(ans)

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    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')


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

for a in A:
    # 4は2で割れるから飛ばす　余りが1でもあったら
    if a % 2 == 1:
        continue
    if a % 3 == 0 or a % 5 == 0:
        continue
    print('DENIED')
    exit()
print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

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

    print("APPROVED")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

    even = []

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


    for e in even:
        if e % 3 != 0 and e % 5 != 0:
            print("DENIED")
            exit(0)

    print("APPROVED")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for num in even:
    if num % 3 != 0 and num % 5 != 0:
        print("DENIED")
        exit()

print("APPROVED")

Submission status: Accepted

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

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

flag = True
for j in range(len(even_num)):
  if even_num[j]%3==0 or even_num[j]%5==0:
    flag = True
  else:
    flag = False
    break

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

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

Solution code:
lines = []
for i in range(2):
  inp = input()
  lines.append(inp)
searchList = []  
for i in range(int(lines[0])):
  split = lines[1].split()
  if int(split[i]) % 2 == 0:
    searchList.append(int(split[i]))
out = "APPROVED"
for s in searchList:
  if s % 3 != 0 and s % 5 != 0:
    out = "DENIED"
    print(out)
    break
if out == "APPROVED":
    print(out)

Submission status: Accepted

Solution code:
import sys
import decimal # 10進法に変換，正確な計算

def input():
    return sys.stdin.readline().strip()

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

Submission status: Accepted

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

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

if count == n:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    add = list(map(int, input().split()))
    ans = []
    count = 0
    for i in add:
        if i%2 == 0:
            ans.append(i)
    for j in ans:
        if j%3 == 0 or j%5 == 0:
            count += 1
    print("DENIED" if count != len(ans) else "APPROVED")
resolve()

Submission status: Accepted

Solution code:
n = int(input())
apple = list(map(int, input().split()))
orange = []
for i in apple:
    if i%2 == 0:
        orange.append(i)
    else:
        pass
cnt = 0
for i in orange:
    if i%3==0 or i%5==0:
        cnt += 1
    else:
        pass
print("DENIED" if cnt!=len(orange) else "APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(n):
    if a[i]%2 == 1:
        pass
    elif a[i]%3!=0 and a[i]%5!=0:
        f = 0
        break

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

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
nums = input().split(" ")

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

Submission status: Accepted

Solution code:
import math
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
            break
if flag:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
input()
ns = list(filter(lambda x: int(x)%2==0 and not(int(x)%3==0 or int(x)%5==0), input().split()))
print("APPROVED" if len(ns)==0 else "DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

A = 0
D = 0
for i in a:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      A += 1
    else:
      D += 1
if D == 0:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
num_list = map(int,input().split(' '))
even_num_list = filter(lambda x : x % 2 == 0,num_list)

denied = False
for num in even_num_list:
    if num % 3 == 0 or num % 5 == 0:
        continue
    else:
        denied = True
        print('DENIED')
        break

if not denied:
    print('APPROVED')

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

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

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

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:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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'
print(ans)

Submission status: Accepted

Solution code:
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 or A[i]%5==0:continue
        else:
            flag=1
            break
if flag==0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

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

for Ai in A:
    if Ai%2==0:
        if Ai%3!=0 and Ai%5!=0:
            flag = False

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
def main():
    N = int(input())
    A = list(map(int,input().split()))
    for e in A:
        if e%2 == 0:
            if e%3 != 0 and e%5 != 0:
                print("DENIED")
                exit(0)
    print("APPROVED")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
a = list(map(int, input().split()))
ans = "APPROVED"
for ai in a:
    if ai % 2 == 0:
        if ai % 3 != 0 and ai % 5 != 0:
            ans = "DENIED"
            break
print(ans)

Submission status: Accepted

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

ANS = 'APPROVED'
for i in range(len(A)):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            pass
        else:
            ANS = 'DENIED'

print(ANS)