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:
k = int(input())
l = list(map(int, input().split()))
flag = True
for i in range(k):
    if l[i]%2 == 0 and l[i] % 3 != 0 and l[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()))
b=0
for v in a:
    if v%2==0 and v%3!=0 and v%5!=0:
        print("DENIED")
        break
    b+=1
if b==n:
    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:
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N = int(input())
    A = map(int, input().split())
    B = filter(lambda x: x%2==0, A)
    print('APPROVED' if all(map(lambda x: x%3==0 or x%5==0, B)) else 'DENIED')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))





N=input1()
A=input_array()
flag=True
for x in A:
	if x%2==0:
		if x%3==0 or x%5==0:
			continue
		else:
			flag=False
			break
if flag:
	print("APPROVED")
else:
	print("DENIED")

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().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=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"
    else:
        pass
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 or a%5==0:
            continue
        else:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
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())
nums = list(map(int, input().split()))
res = True
for num in nums:
    if num % 2 == 0 and num % 3 != 0 and num % 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()))
cnt = 0
ans = 0
for i in range(n):
    if a[i]%2 == 0:
        cnt += 1
        if a[i]%3 == 0 or a[i]%5 == 0:
            ans += 1
       
if cnt == ans: print("APPROVED")
else: print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

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

Submission status: Accepted

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

for i in range(N):
    if A[i] % 2 == 1:
        A.remove(A[i])
        A.insert(i,0)
for i in range(len(A)):
    if A[i] % 3 != 0 and A[i] % 5 != 0:
        print('DENIED')
        exit()
print('APPROVED')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#--Papers, Please

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

for i in range(N):
  xx = int(List[i])
  if xx % 2 == 0:
    if (xx % 3 == 0 or xx % 5 == 0):
      pass
    else:
      print ("DENIED")
      exit()
  else:
    pass

print("APPROVED")

Submission status: Accepted

Solution code:
import sys

n = int(input())
a = input().split()

for i in range(n):
    tmp = int(a[i])
    if (tmp % 2 == 0) and (tmp%3 != 0 )and (tmp%5 !=0):
            print("DENIED")
            sys.exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 and i%5:
        print('DENIED')
        exit()
else:
    print('APPROVED')

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
int(input())
map(int,input().split())
list(map(int,input().split()))

"""

n=int(input())
A=list(map(int,input().split()))
s="APPROVED"
for i in range(n):
    if(A[i]%2==0):
        if not (A[i]%3==0 or A[i]%5==0):
            s="DENIED"
            break
            
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
As=list(map(int, input().split()))
rejected=False
for A in As:
  if A%2==0:
    if A%3*(A%5)!=0:
      rejected=True
if rejected:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())

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

even = 0
bai = 0
for i in range(N):
    if A[i] % 2 == 0:
        even = even + 1
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            bai = bai + 1
    i = i + 1
    
if even == bai:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n=int(input())
a = list(map(int,input().split()))
i = 0
while True:
    if i==n:
        print('APPROVED')
        break
    elif a[i]%2==0 and a[i]%3!=0 and a[i]%5!=0:
        print('DENIED')       
        break       
    else:
        i+=1

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
flag = True
for a in A:
    if(a%2==0 and (a%3!=0 and a%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 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()))

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

Submission status: Accepted

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

b = [i % 2 == 0 and (i % 3 and i % 5) for i in a]

print('DENIED' if sum(b) else 'APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
A=[int(_) for _ in 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())
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:
a = int(input())
nums = input().split()
flag = True
for i in range (a):
    x = int(nums[i])
    if (x % 2 == 0):
        if not (x % 3 == 0 or x % 5 == 0):
            flag = False
            break

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

Submission status: Accepted

Solution code:
stdin = open(0).read().split('\n')
N=int(stdin[0])
A=map(int,stdin[1].split())
flag=True
for a in A:
    if a%2==0 and a%3!=0 and a%5!=0:
        flag=False
        break
print('APPROVED' if flag else 'DENIED')

Submission status: Accepted

Solution code:
stdin = open(0).read().split('\n')
N=int(stdin[0])
A=map(int,stdin[1].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:
n = int(input())
A = list(map(int,input().split()))

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

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

Submission status: Accepted

Solution code:
N=input()
n=int(N)

p=input().split()

for i in range(n):
    p[i]=int(p[i])

t=[]
q=0

for i in range(n):
    if p[i]%2==0:
        t.append(p[i])
        q=q+1

flag=True
for i in range(q):
    if t[i]%3!=0 and t[i]%5!=0:
        flag=False

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

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

Submission status: Accepted

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

fl = True

for i in n :
    if (i % 2 == 0) :
        if (i % 3 != 0 and i % 5 != 0) :
            fl = False

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

Submission status: Accepted

Solution code:
n = int (input ())
a = list (map (int, input ().split ()))
flag = True
for k in a:
    if (k & 1 == 0 and k % 3 != 0 and k % 5 != 0):
        flag = False

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

Submission status: Accepted

Solution code:
import sys
N = int(input())
arr = list(map(int, input().split()))

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

print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())

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

count_even = 0
count_odd = 0
for i in range(0,len(a)):
    if a[i] % 2 == 0:
        count_even += 1
        if a[i] % 3 == 0 or a[i] % 5 == 0:
             count_odd += 1

if count_even == count_odd:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
a=[int(i) for i in input().split()]
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            continue
        else:
            print('DENIED')
            exit()
print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
flag = 1
for num in a:
    if num % 2 == 0:
        if (num % 3 == 0) or (num % 5 == 0):
            flag = 1
        else:
            flag = 0
            break
print('APPROVED') if flag 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 and A[i] % 3 != 0 and A[i] % 5 != 0):
        print('DENIED')
        exit(0)
print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 1st:0407,2nd-:0408

#ABC041-C
if False:
    N=int(input())
    A=[int(i) for i in input().split()]
    ans=[(i,a) for i,a in enumerate(A)]
    ans.sort(key=lambda x: x[1],reverse=True)
    for i in range(N): print(ans[i][0]+1)

#AGC017-A
if False:
    N,P=map(int,input().split())
    A=[int(i) for i in input().split()]
    flag=True # 偶数のみか
    for a in A:
        if a%2==1:
            flag=False
            break
    if flag:
        if P==0:
            print(2**N)
        else:
            print(0)
    else:
        print(2**(N-1))

#3rd: ABC155-A
if False:
    print('Yes' if len(set(input().split()))==2 else 'No')
#4th: ABC155-B
if True:
    N=int(input())
    A=[int(i) for i in input().split()]
    ans='APPROVED'
    for a in A:
        if a%2==0:
            if not(a%3==0 or a%5==0):
                ans='DENIED'
    print(ans)
#5th

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 or i%5==0:
            continue
        print("DENIED")
        sys.exit()
print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
# 偶数の要素が3でも5でも割り切れないかのbool
if any([(i % 3 != 0) and (i % 5 != 0) for i in a if not i % 2]):
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

print("APPROVED")

Submission status: Accepted

Solution code:
def approve(A: list) -> bool:
    is_even = lambda number: number % 2 is 0
    is_odd = lambda number: not is_even(number)
    is_dividable_by_3 = lambda number: number % 3 is 0
    is_dividable_by_5 = lambda number: number % 5 is 0
    is_dividable_by_3_or_5 = lambda number: is_dividable_by_3(number) or is_dividable_by_5(number)
    is_approved = lambda number: (
        is_odd(number) or
        (is_even(number) and is_dividable_by_3_or_5(number)))

    approved = all(map(is_approved, A))

    return approved


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

answer = 'APPROVED' if approve(A) else 'DENIED'

print(answer)

Submission status: Accepted

Solution code:
def approve(A: list) -> bool:
    is_even = lambda number: number % 2 is 0
    is_odd = lambda number: not is_even(number)
    is_dividable_by_3 = lambda number: number % 3 is 0
    is_dividable_by_5 = lambda number: number % 5 is 0
    is_dividable_by_3_or_5 = lambda number: is_dividable_by_3(number) or is_dividable_by_5(number)
    is_approved = lambda number: (
        is_odd(number) or
        (is_even(number) and is_dividable_by_3_or_5(number)))

    approved = all([is_approved(Ai) for Ai in A])

    return approved


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

answer = 'APPROVED' if approve(A) else 'DENIED'

print(answer)

Submission status: Accepted

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

is_even = lambda number: number % 2 == 0
is_odd = lambda number: not is_even(number)
is_dividable_by_3 = lambda number: number % 3 == 0
is_dividable_by_5 = lambda number: number % 5 == 0
is_dividable_by_3_or_5 = lambda number: is_dividable_by_3(number) or is_dividable_by_5(number)
is_approved = lambda number: is_odd(number) or (is_even(number) and is_dividable_by_3_or_5(number))

answer = 'APPROVED' if all([is_approved(Ai) for Ai in A]) else 'DENIED'

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().strip().split()))
a = True
for i in list(filter(lambda x: x % 2 == 0, A)):
    if i % 3 != 0 and i % 5 != 0:
        print("DENIED")
        a = False
        break

if a:
    print("APPROVED")

Submission status: Accepted

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

for i in An:
    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())
lis = list(map(int,input().split()))
x = 0
for i in lis:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            x += 1
if x == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

if len(list(filter(lambda x: x%2==0 and (x%3!=0 and x%5!=0), A))):
    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) or (i % 5 == 0):
            continue
        else:
            print('DENIED')
            sys.exit()

print('APPROVED')

Submission status: Accepted

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

Y = [x for x in X if x%2 == 0]

Z = [y for y in Y if y%3 != 0 and y%5 != 0]

if len(Z) == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
if all([i%2==1 for i in A]):
    print('APPROVED')
else:
    even = [i for i in A if i%2==0]
    even = [0 if i%3==0 or i%5==0 else 1 for i in even]
    if max(even)==1:
        print('DENIED')
    else:
        print('APPROVED')

Submission status: Accepted

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

index = 0

for a in A:
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      index += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in A:
    i = int(i)
    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=[int(x) for x in input().split()]
f=True
for i in a:
  if i%2==0:
    if i%3==0 or i%5==0:
      f=True
    else:
      f=False
      break
if f:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
import sys
a = input()
b = map(int, input().split())
list = []
for item in b:
    if item % 2 == 0:
        list.append(item)
for item in list:
    if not(item % 3 == 0) and not(item % 5 == 0):
        print("DENIED")
        sys.exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [6, 7, 9, 10, 31])
    APPROVED
    >>> print_ans(3, [28, 27, 24])
    DENIED
    """
    flg = True
    for a in ar:
        if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
            flg = False
            break

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



if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int, input().rstrip().split()))
    print_ans(N, ar)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

a = [0]*N
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
  if i == N-1:
    print('APPROVED')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a_list = [int(s) for s in input().split()]
a_list = [a for a in a_list if a % 2 == 0]
# print(a_list)

approved_flag = True
for a in a_list:
    if a % 3 != 0 and a % 5 != 0:
        approved_flag = False
        break

ans = "APPROVED" if approved_flag else "DENIED"
print(ans)

Submission status: Accepted

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

check=1
for i in range(N):
    if A[i]%2==0:
        if A[i]%3==0 or A[i]%5==0:
            pass
        else:
            check=0
            break

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

Submission status: Accepted

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

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

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

print('APPROVED')

Submission status: Accepted

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

for a in list_a:
  if a%2 == 0:
      if a%3 == 0:
        continue
      
      if a%5 == 0:
        continue

      print("DENIED")
      sys.exit()

print("APPROVED")

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
c = True
for i in range (N):
    if A[i]%2==1 or A[i]%3==0 or A[i]%5==0:
      c = True
    else:
      c = False
      break
      
if (c):
  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==1:
        continue
    else:
        if A[i]%6!=0 and A[i]%10!=0:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
import sys


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')
            sys.exit(0)

print('APPROVED')

Submission status: Accepted

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


for i in a_list:
    if i % 2 == 0:
        if not (i % 3 == 0 or i % 5 == 0):
            print('DENIED')
            exit()

print('APPROVED')

Submission status: Accepted

Solution code:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
a=n1()

c=[min(x%3,x%5) if x%2==0 else 0 for x in a]
print("APPROVED" if sum(c)==0 else "DENIED")

Submission status: Accepted

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

counter1 = 0
counter2 = 0
for i in range(N):
    if A[i] % 2 == 0:
        counter1 += 1
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            counter2 += 1
if counter1 == counter2:
    print("APPROVED")
else:
    print("DENIED")