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=input()
a=input().split()
list1=[]
for item in a :
  list1.append(int(item))
flag=True
for item in list1 :
  if item%2==0 :
    if not (item%3==0 or item%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 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())

ans = 0
for i in A:
    if i%2 == 0:
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            ans += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import n as integer
n = int(input())
# obtain list
l = list(map(int, input().split()))

sum = 0
# if even, say no
for i in range (0, n):
	if l[i]%2 == 0:
		if l[i]%3 != 0 and l[i]%5 != 0:
			sum+=1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in lists:
    if i % 2 == 0:
        if i % 3 == 0:
            continue

        elif i % 5 == 0:
            continue

        else:
            print("DENIED")
            exit()

print("APPROVED")

Submission status: Accepted

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

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

f = True;

for x in v:
    if x % 2 == 0:
        f = f and (x % 3 == 0 or x % 5 == 0);

if f == True:
    print('APPROVED');
else:
    print('DENIED');

Submission status: Accepted

Solution code:
n = int(input())
base = input().split()
num = []
for i in base:
    num.append(int(i))
x = 0
y = 0
for s in num:
    if s%2==0:
        x += 1
        if s%3==0 or s%5==0:
            y += 1
if x==y:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

check = set([(Ai%3)*(Ai%5) for Ai in A if Ai%2 == 0])

if {0} == check or check == set():
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    a=LIST()
    flg=1
    for i in a:
        if i%2==0:
            if i%3==0 or i%5==0:
                pass
            else:
                flg=0
    if flg==1:
        print('APPROVED')
    else:
        print('DENIED')
    
if __name__ == '__main__':
    do()

Submission status: Accepted

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

for num in nums:
  if num % 2 == 0:
    if num % 3 != 0 and num % 5 != 0:
      print("DENIED")
      exit()
else:
  print("APPROVED")

Submission status: Accepted

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


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

    even_nums = list(filter(lambda x: x % 2 == 0, syorui))
    result_list = list(filter(lambda x: x % 3 == 0 or x % 5 == 0, even_nums))

    result = "DENIED"
    if len(even_nums) == len(result_list):
        result = "APPROVED"

    return result


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

Submission status: Accepted

Solution code:
n = int(input())
lst = list(map(int,input().split()))
print("APPROVED" if all(x%3 == 0 or x%5 == 0 for x in list(filter(lambda x: x%2 == 0, lst))) else "DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_, L = input(), list(map(int, input().split()))
L = [l for l in L if l % 2 == 0]
M = [l for l in L if (l % 3 == 0) or (l % 5 == 0)]
if len(L)==len(M):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input();print(' ADPEPNRIOEVDE D'[all([i%2|(i%3<1)|(i%5<1)for i in map(int,input().split())])::2])

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a= int(input())
b_list = input().split()
for i in range(a):
    b = int(b_list[i])
    if b%2 == 0:
        if b % 3 == 0 or b%5 == 0:
            d =0
        else:
            print('DENIED')
            break
    if (a-1) == i:
        print('APPROVED')

Submission status: Accepted

Solution code:
# -*- codong:utf-8 -*-
N=int(input())
A=list(map(int,input().split()))
ans1=0
ans2=0
for i in range(N):
    if A[i]%2==0:
        ans1=1
        if A[i]%3!=0 and A[i]%5!=0:
            ans2=1
if ans2!=1:
    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()
print('APPROVED')

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  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')
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
def check(arr):
    for i in arr:
        if(i % 2 ==0):
            if(i % 3!=0 and i % 5!=0):
                return "DENIED"
    return "APPROVED"

n=int(input())
arr=list(map(int,input().strip().split()))[:n]
k=check(arr)
print(k)

Submission status: Accepted

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

ret = 'APPROVED'
for i in num:
    if i % 2 == 0:
        if not i % 3 == 0 and not i % 5 == 0:
            ret = 'DENIED'
            break

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

bl = True
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            bl = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))  # [1, 2, 3, 4] になる
B = list()
judge = 1
for a in A:
    if a%2 == 0:
        B.append(a)

for b in B:
    if b%3==0 or b%5==0:
        continue
    else:
        judge = -1

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

Submission status: Accepted

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

isApproved = True
for i in a:
	if i % 2 == 0:
		if i % 3 != 0 and i % 5 != 0:
			isApproved = False
			break

result = "APPROVED" if isApproved else "DENIED"

print(result)

Submission status: Accepted

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

ans = 'DENIED'
judge = []
for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            judge.append(True)
        else:
            judge.append(False)
            
if all(judge):
    ans = 'APPROVED'
    print(ans)
else:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

result = True
for i in a:
    if i % 2 == 0 and i % 3 != 0 and i % 5 != 0:
        result = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

ele = 0

for x in even:
    if  not (x % 3 == 0 or x % 5 == 0):
        print("DENIED")
        break
    else:
        ele += 1

if ele == len(even):
    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:
*A,=map(int,open(0).read().split());a='APPROVED';i=1
while i<len(A):
    if A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0:
        a='DENIED'
    i+=1
print(a)

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
import heapq
import sys
import queue


input = sys.stdin.readline
sys.setrecursionlimit(100000)


class V:
    def __init__(self, f):
        self.f = f
        self.v = None

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n)

    def get(self):
        return self.v


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def main():
    N = int(input())
    A = read_list()
    print(
        "APPROVED"
        if all(map(lambda a: a % 2 == 1 or (a % 3 == 0 or a % 5 == 0), A))
        else "DENIED"
    )


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
lst=list(map(int,input().split()))
tf=0
for i in lst:
  tf+=(1-i%2)*(i%3)*(i%5)
if tf:
  print('DENIED')
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 = list(map(int,input().split()))
for b in a:
    if b%2 == 0:
        if b%3 == 0 or b%5 == 0:
            continue
        else:
            print('DENIED')
            exit()
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [0]*N
check = 1
A =  [int(N) for N in input().split()]
for i in range (N):
    if (A[i]%2)==0:
        if (A[i]%3)==0 or (A[i]%5)==0:
            check += 1
        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()]
text = 0
for j in range(n):
    if a[j] % 2 == 0:
        if a[j] % 3 != 0 and a[j] % 5 != 0:
            text = 1
            print("DENIED")
            break
if text == 0:
    print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
ls=[int(s) for s in input().split()]
for e in ls:
  if e%2==0 and (e%3)*(e%5)!=0:
    print('DENIED')
    break
else:
  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 and a % 5 !=0:
            ans = 'DENIED'
            break

print(ans)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    arr = list(map(int, input().split()))
    f = True
    for num in arr:
        if not num % 2 and not (num % 3 == 0 or num % 5 == 0):
            print('DENIED')
            f = False
            break
    if f:
        print('APPROVED')


resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int((input()))
a = list(map(int, 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:
n = int(input())
a = list(map(int,input().split()))
amari = True
for i in a:
    if i%2 == 0:
        if i%3 == 0 or i%5 == 0:
            amari = True
        else:
            amari = False
            break
print('APPROVED' if amari else 'DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check(l):
    for i in l:
        if i%2==0:
            if i%3 and i%5:
                return False
    return True
def solve():
    n = int(input())
    a = tuple(map(int,input().split()))
    if check(a):
        print('APPROVED')
    else:
        print('DENIED')
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

isOK = "APPROVED"

for n in x:
    if (n % 2 == 0):
        if (n % 3 != 0 and n % 5 != 0):
            isOK = "DENIED"

print(isOK)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = []
for i in range(N):
    if A[i] % 2 == 0:
        B.append(A[i])
a = 0
for j in range(len(B)):
    if B[j] % 3 == 0:
        a = a+0
    elif B[j] % 5 == 0:
        a = a+0
    else:
        a = a+1

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

Submission status: Accepted

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

Submission status: Accepted

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

flag = True
for ai in a:
    if ai % 2 == 0:
        flag &= (ai % 3 == 0 or ai % 5 == 0)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()

vals = input().split(" ")
vals = map(int, vals)

bol = True

for val in vals :
	if val % 2 == 0 :
	  if not (val % 3 == 0 or val % 5 == 0) :
	    bol = False

if bol :
  print("APPROVED")
else : 
  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:
      continue
    else:
      print("DENIED")
      sys.exit()

print("APPROVED")

Submission status: Accepted

Solution code:
def hantei(N):
    if N % 2 == 0:
        if N % 3 == 0 or N % 5 == 0:
            return True
        else:
            return False
    else:
        return True

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

for i in A:
    if hantei(i):
        continue
    else:
        print("DENIED")
        break
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


n=ni()
a = nl()
j= True

for i in a:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            j=False
            


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

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

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

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()

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()))
j,c=0,0

for i in a:
    if i%2==0:
        j+=1
        if i%3==0:
            c+=1
        elif i%5==0:
            c+=1
    else :
        continue



if c==j:
    print("APPROVED")
else :
    print("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
        break

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

Submission status: Accepted

Solution code:
n=int(input())

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

count=0
for i in x:
  if i%2==0:
    if i%3==0 or i%5==0:
      count=count+0
    else:
      count=count+1
if count==0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
x = input()
li = list(map(int,input().split()))
s =[]
for i in range(len(li)):
    if li[i] % 2 == 0:
        s.append(li[i])
o = True
for k in range(len(s)):
    if s[k] % 3 != 0 and s[k] % 5 != 0:
        o = False
    else:
        continue
if o:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

    for a in a_even:
        if not (a % 3 == 0 or a % 5 == 0):
            print('DENIED')
            exit()

    print('APPROVED')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

for a in aa:
    if a % 2 == 0 and not (a % 3 == 0 or a % 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:
N = int(input())

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

flag = ""

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            flag = flag + "1"
        else:
            flag = flag + "0"
    else:
        flag = flag + "1"

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

Submission status: Accepted

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

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

print(str)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split(" ")]
appr = True
for a in A:
  if a % 2 == 0:
    appr &= (a % 3 == 0) or (a % 5 == 0)
print('APPROVED' if appr 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=[int(s) for s in input().split()]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ng(n):
    return not n%2 and n%3 and n%5
n = input()
print('DENIED' if any(ng(int(i)) for i in input().split()) else 'APPROVED')

Submission status: Accepted

Solution code:
def ng(n):
    return n%2==0 and n%3!=0 and n%5!=0
n = input()
print('DENIED' if any(ng(int(i)) for i in input().split()) else 'APPROVED')

Submission status: Accepted

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

for i in a:
  if i%2==1:
    continue
  elif i%3==0:
    continue
  elif i%5==0:
    continue
  else:
    print("DENIED")
    x = 1
    break
    
if x == 0:
  print("APPROVED")

Submission status: Accepted

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

for i in range(N):

    if c[i]%2==0:
        if c[i]%3==0 or c[i]%5==0:
            continue

        else:
            print("DENIED")
            exit(0)

print("APPROVED")

Submission status: Accepted

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

for n in lis:
    if n % 2 == 1:
        continue
    
    if (n % 3 != 0) and (n % 5 != 0):
        print("DENIED")
        exit()
    
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 and a[i] % 3 and a[i] % 5:
    print("DENIED")
    sys.exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

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

A = A[A%2==0]
if np.all((A%3==0) | (A%5==0)):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

for item in A:
    if item%2==0:
        B.append(item)
cnt = 0
ans = ''
for item in B:
    if item%3!=0:
        if item%5!=0:
            ans = 'DENIED'
if ans!='DENIED':
    ans = 'APPROVED'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

for x in X :
    if x%2==0:
        if x%3==0 or x%5 ==0:
            pass
        else :
            print('DENIED')
            sys.exit()
    else :
        pass

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 = list(map(int, input().split()))
for i in a:
    if i%2==0 and i%3!=0 and i%5!=0:
        print('DENIED')
        exit()
print('APPROVED')

Submission status: Accepted

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