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()))
cnt = 0
for i in a:
    if i%2 ==1:
        cnt += 1
    elif i%2 == 0 and i%15 == 0:
        cnt += 1
    elif i%2 == 0 and i%5 == 0:
        cnt += 1
    elif i%2 == 0 and i%3 == 0:
        cnt += 1
if cnt == n:
    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:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            ans = "DENIED"
            break
    else:
        pass
print(ans)

Submission status: Accepted

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

flag = 0

for a in A:
  if a%2 == 0:
    if not (a%3 == 0 or a%5 == 0):
      flag = 1

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n = II()
    a = LI()
    for i in a:
        if i & 1:
            continue
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            print("DENIED")
            return
    print("APPROVED")
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

num = input()
a = input().split()
flag = 0
for item in a:
    item=int(item)
    if item%2==0:
        if item%3==0 or item%5==0:
            pass
        else:
            flag=1

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

Submission status: Accepted

Solution code:
def AorD(nums):
  for x in nums:
    if x%2==0 and x%3!=0 and x%5!=0:
      return "DENIED"
  return "APPROVED"
    

input()

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

print(AorD(nums))

Submission status: Accepted

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

cnt=0
for i in range(N):
    if A[i]%2==0:
        if A[i]%6!=0 and A[i]%10!=0:
            cnt=1
            print('DENIED')
            break
    else:
        pass
if cnt==0:
    print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
list = [int(x) for x in input().split(" ")]
result = 'APPROVED'
for i in range(len(list)):
    if list[i]%2 == 0:
        if list[i]%3 != 0 and list[i]%5 != 0:
            result = 'DENIED'
            break
print(result)

Submission status: Accepted

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

s = "APPROVED"
for i in AL:
  if i%2 == 0 and i%3 != 0 and i%5 != 0:
    s = "DENIED"
print(s)

Submission status: Accepted

Solution code:
n = int(input())
A = [int(x) for x in input().split()]
flag = True
for i in range(0, n) :
	if A[i] % 2 != 0 :
		continue
	elif A[i] % 2 == 0 and (A[i]%3 == 0 or A[i]%5 == 0) :
		continue
	else :
		flag = False
		break
if flag :
	print ("APPROVED")
else :
	print ("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
list_ = [int(x) for x in input().split() if (int(x) % 2) == 0]
for f in list_:
    if (f % 3 == 0) or (f % 5 == 0):
        continue
    else:
        print("DENIED")
        break
else:
    print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = [i for i in list(map(int, input().split())) if i%2 == 0]

ans = [i for i in a if (i%3!=0 and i%5!=0)]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

flag = True

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

Submission status: Accepted

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

Submission status: Accepted

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


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

print('APPROVED')

Submission status: Accepted

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

A = input().split(' ')

val = True

for i in A:
  num = int(i)
  if num % 2 ==0:
    if num % 3 ==0 or num % 5 == 0:
      continue
    else:
      val = False
      break
      
if val == True:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
#標準入力からの値取得(N)
N = input().split(' ')
#標準入力からの値取得(List)
A = input().split(' ')

#ループで廻して全要素を判定
val = True
for i in A:
  num = int(i)
  #print(num)
  if num % 2 == 0:
    if num % 3 == 0 or num % 5 == 0:
      continue
    else:
      val = False
      break

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

Submission status: Accepted

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

N = int(readline())
A = list(map(int, readline().split()))
print('APPROVED' if all([x%3 == 0 or x%5 == 0 for x in A if x%2 == 0]) else 'DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
lis=list(map(int,input().split()))
f=True
for x in lis:
    if x%2!=0:
        continue
    else:
        if x%3!=0 and x%5!=0:
            f=False
            break
if f==True: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 and a % 5 != 0:
      flg = False
      break
if flg:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
input()
o = True
for i in map(int, input().split()):
  if i % 2 == 0:
  	if not i % 3 == 0 and not i % 5 == 0:
  		o = False

if o is True:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

ans = "APPROVED"
for _a in a:
    if _a%2 == 0 and _a%3 != 0 and _a%5 != 0:
        ans = "DENIED"
        break
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 and A[i] %5 != 0:
			flag = 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    val = input()
    a = val.split()
    a = [int(s) for s in a]
    enter = True
    for i in a:
        if i % 2 == 0:
            if not (i % 3 == 0 or i % 5 == 0):
                enter = False
    if enter:
        print('APPROVED')
    else:
        print('DENIED')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read

N,*A = map(int, read().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
A = [int(i) for i in input().rstrip().split()]
for a in A:
    if a % 2 == 0 and not(a % 3 == 0 or a % 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 and A[i] % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
a = map(int, input().split())
flag = True
for i in a:
    if i%2==0 and not (i%3==0 or 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()))

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

Submission status: Accepted

Solution code:
_ = int(input())
for a in list(map(int,input().split())):
    if not a%2 and a%3 and a%5:
        print("DENIED")
        exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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



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


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

Submission status: Accepted

Solution code:
def isEven(x):
    if x % 2 == 0:
        return True
    return False

def checkTerm(x):
    if(x % 3 == 0 or x % 5 == 0):
        return True
    return False

N = int(input())

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

checkFlag = True

for i in range(N):
    if(isEven(a[i])):
        if(checkTerm(a[i])):
            checkFlag = True
        else:
            checkFlag = False
            break

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

Submission status: Accepted

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

paper_even = [i for i in paper if i % 2 == 0 ]

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

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

Submission status: Accepted

Solution code:
#abc155b
import sys

n=int(raw_input())
a=map(int,raw_input().split())
b=[]
for i in range(n):
 if a[i]%2==0:
  b.append(a[i])
for i in range(len(b)):
 if not (b[i]%3==0 or b[i]%5==0):
  print 'DENIED'
  sys.exit()
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 and a % 3 != 0 and a % 5 != 0:
        flag = False

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    number = a_lst[i]

    if number%2==0:
        odd += 1
        if number%3==0 or number%5==0:
            count += 1

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

Submission status: Accepted

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

if all(a % 3 == 0 or a % 5 == 0 for a in A):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_ = input()
a = [int(x) for x in input().split()]
print("APPROVED" if len([aa for aa in a if aa%2==0 and aa%3!=0 and aa%5!=0])==0 else "DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

f = True

for aa in a:
    if aa%2 == 0 and aa%3 != 0 and aa%5 != 0:
        f = False
        break

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

Submission status: Accepted

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

    bool_ = any(x for x in a if (x % 2 == 0) and not (x % 3 == 0 or x % 5 == 0))

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

print('APPROVED' if cnt == N else 'DENIED')

Submission status: Accepted

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('b1.in')


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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def solve():
    N = read_int()
    A = read_int_list()
    for i in range(N):
      if A[i] % 2 == 0:
        if not (A[i] % 3 == 0 or A[i] % 5 == 0):
          return 'DENIED'
    return 'APPROVED'


def main():
    res = solve()  
    print(res)


main()

Submission status: Accepted

Solution code:
# B - Papers, Please
def main():
    N, *A = map(int, open(0).read().split())
    is_legal = all(i % 3 == 0 or i % 5 == 0 for i in A if i % 2 == 0)
    print("APPROVED" if is_legal else "DENIED")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

APPROVED = True
for a in A:
    if a % 2 == 0:
        if not (a % 3 == 0 or a % 5 == 0):
            APPROVED = False
print("APPROVED" if APPROVED else "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 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()))
ans = 'APPROVED'
for x in a:
  if x % 2 == 0 and x % 3 != 0 and x % 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(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            print("DENIED")
            break
else:
    print("APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
flag = True
for i in a:
    if i%3 != 0 and i%5 != 0 and i%2 == 0:
        flag = False

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

Submission status: Accepted

Solution code:
_ = input()
line = input()

numbs = [int(v.strip()) for v in line.split()]

def get_status(numbs):
    for numb in numbs:
        if numb % 2 == 0 and (numb % 3 != 0 and numb % 5 != 0):
	        return "DENIED"
    return "APPROVED"


print(get_status(numbs))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
    *a,=map(int,open(0))
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['YES','NO']

mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0

n=I()
a=LI()
['APPROVED','DENIED']
k=0
for i in a:
    if i%2==0 and i%3!=0 and i%5!=0:
        k=1
print(['APPROVED','DENIED'][k])

Submission status: Accepted

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

    S = []

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

    Ns = len(S)
    while True:
        for j in range(Ns):
            if A[S[j]] % 3 != 0 and A[S[j]] % 5 != 0:
                print('DENIED')
                return False
        print('APPROVED')
        break

B()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

lst = []

flg = True

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

for i in range(len(lst)):
    if lst[i] % 2 == 0 and lst[i] % 3 == 0 or lst[i] % 5 == 0:
        flg = True
    else:
        flg = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = int(input())
A = list(map(int, input().split()))

ans = 'APPROVED'

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


print(ans)

Submission status: Accepted

Solution code:
import sys
_=input()
A=[int(i) for i in input().split()]
B=[]
for a in A:
  if a % 2 == 0:
    B.append(a)
for b in B:
  if b%3 !=0 and b%5 !=0:
    print("DENIED")
    sys.exit()
else:
  print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

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

print(answer)

Submission status: Accepted

Solution code:
from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000010
MOD = 10**9+7
spf = [i for i in range(MAXN)]
spf[0]=spf[1] = -1
def sieve():
    for i in range(2,MAXN,2):
        spf[i] = 2
    for i in range(3,int(MAXN**0.5)+1):
        if spf[i]==i:
            for j in range(i*i,MAXN,i):
                if spf[j]==j:
                    spf[j]=i
def fib(n,m):
    if n == 0:
        return [0, 1]
    else:
        a, b = fib(n // 2)
        c = ((a%m) * ((b%m) * 2 - (a%m)))%m
        d = ((a%m) * (a%m))%m + ((b)%m * (b)%m)%m
        if n % 2 == 0:
            return [c, d]
        else:
            return [d, c + d]

def charIN(x= ' '):
    return(sys.stdin.readline().strip().split(x))

def arrIN(x = ' '):
    return list(map(int,sys.stdin.readline().strip().split(x)))

def ncr(n,r):
    num=den=1
    for i in range(r):
        num = (num*(n-i))%MOD
        den = (den*(i+1))%MOD

    return (num*(pow(den,MOD-2,MOD)))%MOD

def flush():
    return sys.stdout.flush()

'''*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'''
n = int(input())
a = arrIN()
for i in a:
    if i%2==0:
        if not (i%3==0 or i%5==0):
            print("DENIED")
            break
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
l_div = [x for x in l if x % 2 == 0]
for x in l_div:
    if x % 3 == 0 or x % 5 == 0:
      pass
    else:
        print("DENIED")
        exit(0)
print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
l_div = [x for x in l if x % 2 == 0]
for x in l_div:
    if x % 3 == 0 or x % 5 == 0:
      pass
    else:
        print("DENIED")
        exit(0)
print("APPROVED")
exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
Created on 2020/02/17

@author: fanta
'''

N = int(input())
nums = [int(x) for x in input().split()]
state = 0

for n in range(N):
    if (nums[n]%2 == 0):
        if ((nums[n]%3 == 0)or(nums[n]%5 == 0)):
            state += 1
    else:
        state += 1
        
if state == N:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
li = list(map(int,input().split()))
app = 0
for i in li:
    if i % 2 == 0 and (i % 3 == 0 or i % 5 == 0):
        pass
    elif i % 2 == 0:
        app += 1
        break
if app == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
li = list(map(int,input().split()))
app = 0
for i in li:
    if i % 2 == 0 and (i % 6 == 0 or i % 10 == 0):
        pass
    elif i % 2 == 0:
        app += 1
        break
if app == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

ans = 'APPROVED'
for a in A:
    if not a % 2:
        if (not a % 3) or (not a % 5):
            pass
        else:
            ans = 'DENIED'

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
import sys

n = int(input())
a = list(map(int, input().split()))
a = np.array(a)
a = a[a%2==0]

for i, j  in enumerate(a):
    if j%3 != 0 and j%5 != 0:
        print("DENIED")
        sys.exit()

print("APPROVED")

Submission status: Accepted

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

for b in a:
  if b % 2 == 0:
    lis.append(b)

count = 0
for c in lis:
  if c % 3 == 0 or c % 5 == 0:
    count += 1

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