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:
def check(a):
    for x in a:
        if x%2 == 0:
            if x%3 == 0 or x%5 == 0:
                pass
            else:
                return False
    return True

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

if check(a):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
def check(b):
    for x in b:
        if x%2 == 0:
            if x%3 == 0 or x%5 == 0:
                pass
            else:
                return False
    return True

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


if check(a):
    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 or x%5 == 0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")

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 or x%5 == 0:
            pass
        else:
            print("DENIED")
            exit()
            

print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
b=input().split()
c=[]
for i in range(N):
  c.append(int(b[i]))
ans='APPROVED'
for j in c:
  if j%2==0:
    if not(j%3==0 or j%5==0):
    	ans='DENIED'
    	break
print(ans)

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(map(int, input().split()))

if all(a%3==0 or a%5==0 for a in A if a%2==0):
    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:
            pass
        else:
            ans = "DENIED"
            break
    else:
        continue
print(ans)

Submission status: Accepted

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

#a = X[0]
#b = X[1]
#c = X[2]

res = 0
for ai in A :
  if ai % 2 ==0 :
    if (ai % 3 != 0) and (ai % 5 != 0):
      res += 1
      break

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
AP = 0
for a in A:
    if (a % 2 == 0):
        AP = AP - 1
        if ((a % 3 == 0) | (a % 5 == 0)):
            AP = AP + 1
if  AP == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
a = input()
A = int(a)
b = input().split()
x = 0
y = 0
for i in range(A):
    if int(b[int(i)]) % 2 == 0:
        if int(b[int(i)]) % 3 == 0:
            x = x + 1
        elif int(b[int(i)]) % 5 == 0:
            x = x + 1
        y = y + 1
if x == y:
    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 == 1:
        pass
    else:
        if l[i] % 6 == 0 or l[i] % 10 == 0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
count=0
while(len(A)!=count):
    if(A[count]%2==0):
        pass
    else:
        A.pop(count)
        count=-1
    count+=1
ans="APPROVED"
for i in A:
    if(i%3==0 or i%5==0):
        pass
    else:
        ans="DENIED"
        break
print(ans)

Submission status: Accepted

Solution code:
N = input()
X = list(map(int, input().split()))
x = 0

for i in X:
  if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
    x += 1
    
    
  else:
    x += 0
    
if x >= 1:
  print("DENIED")
  
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
i = list(map(int, input().split()))
c=0
for t in range (0,N):
    if i[t]%2==0 and i[t]%3!=0 and i[t]%5!=0:
        c=c+1
if c==0:
    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(0)
print("APPROVED")

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    for v in a:
        if v % 2 == 0:
            if v % 3 != 0 and v % 5 != 0:
                print("DENIED")
                exit()
    print("APPROVED")


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# input
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    if a[i] % 6 == 0:
        pass
    elif a[i] % 10 == 0:
        pass
    elif a[i] % 2 > 0:
        pass
    else:
        print('DENIED')
        exit()
print('APPROVED')

Submission status: Accepted

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

even_arr = list(filter(lambda x: x % 2 == 0, arr))

flag = True
for i in even_arr:
    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=input().split()
x=0
for i in range(N):
  if int(A[i])%2==0:
    if int(A[i])%5==0 or int(A[i])%3==0:
      x+=1
  else:
    x+=1
if x==N:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())#.split()
A = input().split()
den = False
for i in range(N):
    if int(A[i]) % 2 == 0:
        if int(A[i]) % 3 != 0 and int(A[i]) % 5 != 0:
            print("DENIED")
            exit(0)
            den = True
if not den:
    print("APPROVED")

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:
evenNumber = []
judg = []
n = int(input())
immigration = list(map(int, input().split()))

for i in immigration:
    if i % 2 == 0:
        evenNumber.append(i)
        
for i in evenNumber:
    judg.append(i % 3 == 0 or i % 5 == 0)

if False in judg:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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


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

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

    print('APPROVED')


if __name__ == '__main__':
    main()

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 and a[i]%5 != 0:
            print("DENIED")
            sys.exit()
    
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"
            break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
bool=True
for x in a:
    if x%2==0:
        if x%3==0 or x%5==0:
            pass
        else:
            bool=False
if bool:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

#6,10の倍数になれば良い

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

Submission status: Accepted

Solution code:
def solve(N, As):
    bools = [a % 3 == 0 or a % 5 == 0 for a in As if a % 2 == 0]
    if len(bools) == 0:
        return "APPROVED"
    else:
        if all(bools):
            return "APPROVED"
        else:
            return "DENIED"


if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(N, As))

Submission status: Accepted

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

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:
            continue
        else:
            print("DENIED")
            exit()

print("APPROVED")

Submission status: Accepted

Solution code:
from sys import stdin, stdout

def checkDocs(numbers):
  for a in numbers:
    if a%2:
      continue
    
    if a%3 and a%5:
      return False
  return True

N = int(stdin.readline().strip())
nums = list(map(int, stdin.readline().strip().split()))

if checkDocs(nums):
  stdout.write("APPROVED")
else:
  stdout.write("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

evens = list()
for paper in papers:
    if paper % 2 == 0:
        evens.append(paper)

approveds = list()
for even in evens:
    if even % 3 == 0:
        approveds.append(even)
    elif even % 5 == 0:
        approveds.append(even)

if set(evens) == set(approveds):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
def main():

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

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

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
n=int(input())
a = list(map(int,input().split()))
even=[el for el in a if el % 2==0]
try:
  for a in even:
    if a % 3 == 0 or a % 5 == 0:
      flg = 1
    else:
      raise
except:
  print('DENIED')
else:
  print('APPROVED')

Submission status: Accepted

Solution code:
n=int(input())
hoge=list(map(int,input().split()))
flag=0
for ho in hoge :
  if(ho%2==0):
    if(ho%3!=0 and ho%5!=0):
      flag+=1
      
if(flag==0):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

print("APPROVED")

Submission status: Accepted

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

Frag = True

for i in range(N):
    if A[i] % 2 == 1 or A[i] % 6 == 0 or A[i] % 10 == 0:
        pass
    else:
        Frag = False

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

Submission status: Accepted

Solution code:
# coding: utf-8

_ = input()
ns = map(int, raw_input().split())

p = all(n % 2 == 1 or (n % 3 == 0 or n % 5 == 0) for n in ns)

print ['DENIED', 'APPROVED'][p]

Submission status: Accepted

Solution code:

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


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


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)

def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max,mod=DIV):
    fac,finv,inv = [0]*max, [0]*max, [0]*max
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod -inv[mod%i] * (mod//i)%mod
        finv[i] = finv[i-1]*inv[i]%mod
    class CONV:
        def __init__(self):
            pass
        def ncr(self,n,k):
            if(n<k):
                return 0
            if(n<0 or k<0 ):
                return 0
            return fac[n]*(finv[k]*finv[n-k]%mod)%mod
    return CONV()


def main():
    n = iRaw()
    As = isRaw()
    for a in As:
        if a%2==0:
            if a%3!=0 and a%5!=0:
                return "DENIED"
    return "APPROVED"


if __name__ == "__main__":
    print(main())

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

Solution code:
def main():
    N, *A = map(int, open(0).read().split())
    for Ai in A:
        if not Ai % 2 and Ai % 3 and Ai % 5:
            print("DENIED")
            return
    print("APPROVED")
    return


main()

Submission status: Accepted

Solution code:
def main():
    N, *A = map(int, open(0).read().split())
    print("DENIED" if sum(
        [1 for Ai in A if not Ai % 2 and Ai % 3 and Ai % 5]) else "APPROVED")
    return


main()

Submission status: Accepted

Solution code:
# coding: utf-8
N=int(input())
A=list(map(int,input().split()))
flg=True

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

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

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
data=np.fromstring(input(),int,sep=' ')
for i in data:
    if i%2==0:
        if not (i%3==0 or i%5==0):
            print("DENIED") 
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
x = list(map(int,input().split()))
y = []
count = 0

for i in range(n):
  if x[i] % 2 == 0:
    y.append(x[i])
    count += 1

for i in range(count):
  if y[i] % 3 and y[i] % 5:
    print("DENIED")
    exit()
    
print("APPROVED")

Submission status: Accepted

Solution code:
import sys

N = input()
arr = input().split()

if all([
  	int(e) % 3 == 0 or int(e) % 5 == 0
	for e in arr
    if int(e) % 2 == 0 
]):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

for i in list_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())
 
numbers = list(map(int, input().split(' ')))
approved = True
 
for num in numbers:
  if (num % 2 == 0):
    if (num % 3 == 0) or (num % 5 == 0):
      approved = True
      continue
    else:
      approved = False
      print('DENIED')
      break
if approved:
  print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

for x in A:
    if (x % 2 == 0) and (x % 3 != 0) and (x % 5 != 0):
        print('DENIED')
        sys.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:
        if a[i]%3 ==0 or a[i]%5 ==0:
            continue
        else:
            ans = 'DENIED'
            break
    
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=[int(x) for x in input().rstrip().split() if int(x)%2==0]

cnt = 0
for i in l:
    if i%3 == 0 or i%5==0:
        cnt += 1
    else:
        break

if cnt == len(l):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
from sys import stdin
N = int(input())
a = list(map(int, stdin.readline().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()))
x=[i for i in a if i%2==0]
for i in range(len(x)):
    if x[i]%3!=0 and x[i]%5!=0:
        print("DENIED")
        exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'APPROVED'

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

Submission status: Accepted

Solution code:
n = input()
a = map(int, input().split())
for num in a:
  if(num % 2 == 0):
    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()))
f = 0
t = 0

for count in A :
    if count % 2 == 0:
        if count % 3 != 0 and count %5 != 0:
            f = 1
            break

        else:
            t = 1

if f:
    print("DENIED")

elif t and not f:
    print("APPROVED")

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]
if len( [j for j in A if not ((j%3==0)or(j%5==0))]) == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

ans = 'APPROVED'

for a in AA:
    if a % 2 == 0:
        if 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()))



#初期値
jud = 0

#処理
for i in range(N):
    if A[i]%2 == 0: #偶数判定
        if A[i]%3 == 0 or A[i]%5 == 0: #3または5で割りきれる
            pass
        else:
            jud += 1

#表示
if jud == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

def func():
    for i in range(N):
        if A[i] % 2 != 0 or A[i] % 3 == 0 or A[i] % 5 == 0:
            pass
        else:
            print('DENIED')
            return
    print('APPROVED')
func()

Submission status: Accepted

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

approved = True
for num in nums:
  if num%2 == 0:
    approved = approved & ((num%3 == 0) or (num%5 == 0))
if approved:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
input()

b = True
for i in [int(x) for x in input().split()]:
  if i%2 == 0 and i%3 != 0 and i%5 != 0: b = False

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split(" ")]
flag = 0
for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            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()))
b=[0]*n
i=0
s=0
while i<n:
  if a[i]%2==1:
    b[i]=0
  elif a[i]%2==0 and a[i]%3==0:
    b[i]=0
  elif a[i]%2==0 and a[i]%5==0:
    b[i]=0
  else:
    b[i]=1
  s=s+b[i]
  i=i+1
if s==0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

b = [a[i]  for i in range(len(a)) if a[i]%2==0]

if all(b[i]%3==0 or b[i]%5==0 for i in range(len(b))):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

flag=True
for num in A_list:
  if num % 2 == 0:
    if num % 6 != 0 and num % 10 != 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()))
lis=[]
flag=1

for i in A:
  if i%2==0:
    lis.append(i)
    
for j in lis:
  if j%3!=0 and j%5!=0:
    flag=0
print("DENIED"if flag==0 else "APPROVED")

Submission status: Accepted

Solution code:
def main():
  n = input()
  ls = list(map(int, input().split(' ')))
  for item in ls:
    if item % 2 == 0:
      if (item % 3) * (item % 5) != 0:
        print('DENIED')
        break
  else:
    print('APPROVED')
 
 
if __name__ == '__main__':
  main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
lists = list(map(int,input().split()))
flg = True
for check in lists:
    if(check % 2 == 0):
        if(check % 3 != 0):
            if(check % 5 != 0):
                print('DENIED')
                flg = False
                break
        if(check % 5 != 0):
            if(check % 3 != 0):
                print('DENIED')
                flg = False
                break
if(flg == True):
  print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
l = [int(x) for x in input().split()]
ans = 0
for i in range(N):
  if l[i] % 2 == 0:
    if l[i] % 3 == 0 or l[i] % 5 == 0:
      pass
    else:
      ans += 1
      break
if ans == 0:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
num = input()
ai = input().split()

flag = 0

for a in ai:
  a = int(a)
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      flag = 1
      break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check(number):
    if number % 2 == 1:
        return True
    if number % 3 == 0 or number % 5 == 0:
        return True
    return False


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

flag = True

for num in array:
    if check(num) is False:
        flag = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

b,c = 0,0
for i in a:
    if (i%2)==0:
        b += 1
        if(i%3 == 0) or (i%5 == 0):
            c += 1

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

Submission status: Accepted

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

c = 0
for i in range(0,n):
  if a[i]%2==0:
    if a[i] %6 != 0 and a[i] %10 != 0:
      print('DENIED')
      c = 1
      break

if c == 0:
  print('APPROVED')

Submission status: Accepted

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

for i in l:
  if i % 2 == 0:
    if (i % 3 == 0) or (i % 5 == 0):
      continue
    else:
      flag = 1
      break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Nu=int(input())
data=[int(x) for x in input().split()]
ans="APPROVED"
for x in data:
  if x%2==0 and not(x%3==0 or x%5==0):
    ans="DENIED"
    break
print(ans)

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:
        if not(i % 3 == 0 or 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 a:
    if not i%2:
        if i%3==0 or i%5==0:
            pass
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
import numpy as np
 
N = int(input())
l = list(map(int,input().split()))
a = np.array(l)
count = 0

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

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