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:
input()
a=list(map(int,input().split()))
print("APPROVED"if all(i&1 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()))

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


for i in A_list:
    if i % 3 == 0 or i % 5 == 0:
        pass

    else:
        print("DENIED")
        exit()

print("APPROVED")

Submission status: Accepted

Solution code:

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

i=0
while i<N:
    
    if List[i]%2==0:
        
        if List[i]%3==0 or List[i]%5==0:
            pass
        else:
            print("DENIED")
            quit()
        
    i+=1
    
print("APPROVED")

Submission status: Accepted

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


def check(n):
    return n % 2 == 1 or n % 3 == 0 or n % 5 == 0


if all(map(check, A)):
    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 = 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())
S = list(map(int, input().split()))
flg = True
for num in S:
    if num%2 == 0:
        if num%3 !=0 and num%5 != 0:
            flg = False
            break
if flg:
    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 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 = list(map(int,input().split()))

a=0
for i in A_list:
    if i%2==0 and (i%3!=0 and i%5!=0):
        a+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fileinput

n = int(input())

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

b = True

for i in range(n):
    aa = a[i]
    if aa % 2 != 0:
        continue
    if aa % 3 != 0 and aa % 5 != 0:
        b = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
array = []

for i in range(2):
    val = [int(s) for s in input().split()]
    array.append(val)

A = array[1]
check = 0

for i in A:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            check += 1


if check > 0:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

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

for i in arr:
    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 = map(int, input().split())

is_approved = True

for A_i in A:
    if A_i%2==0:
        if A_i%3 != 0 and A_i%5 != 0:
            is_approved = False
            break

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0
c = 0
for i in a:
	if i % 2 == 0:
		c += 1
		if i % 3 == 0 or i % 5 == 0:
			ans += 1
		else:
			ans -= 1
			
if ans == c:
	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:
        if 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())
A = list(map(int, input().split()))
ans = "APPROVED"
for i in A:
    if i % 2 == 0 and 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()))
B=[]
C=[]
for i in A:
    if i%2==0:
        B.append(i)
for i in B:
    if i%3==0 or i%5==0:
        C.append(i)
if len(B)==len(C):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())

n = int(input())
a = LI()
a = [i for i in a if i%2==0]
flg = 0
for i in a:
    if i%3==0 or i%5==0:
        # print(i)
        pass
    else:
        flg = 1
print('APPROVED' if flg==0 else 'DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


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

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


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = 0
for i in range(N):
  if A[i]%6 == 0 or A[i]%10 == 0:
    continue
  elif A[i]%2 == 1:
    continue
  else:
    B = 1
print('APPROVED' if B==0 else 'DENIED')

Submission status: Accepted

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

ls = list(filter(lambda x: x % 2 == 0, buff))

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

print('APPROVED')

Submission status: Accepted

Solution code:
n=int(input())
List=list(map(int,input().split()))
num=0
cnt=0
for i in List:
    if i%2==0:
        num+=1
        if i%3==0 or i%5==0:
            cnt+=1
if num==cnt:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu May  7 22:21:06 2020

@author: shinba
"""
import sys

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

for i in A:
    if i % 2 == 0:
        if (i % 5 != 0) and (i % 3 != 0):
            break
else:
    print("APPROVED")
    sys.exit()
    
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:
            continue
        elif A[i] % 5 == 0:
            continue
        else:
            print("DENIED")
            sys.exit(0)
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 or A[i] % 5 == 0:
      pass
    else:
      flag = 1
      break
if flag == 0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

num = [i for i in a if i % 2 == 0]
#print(num)
for i in num :
    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()]

result = True


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

if result == True:
    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 or i % 5 == 0:
            continue
        else:
            print("DENIED")
            exit()
print("APPROVED")

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 and i % 5 != 0:
            flag = False

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

Submission status: Accepted

Solution code:
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
            break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Alist = [x for x in A if x%2==0]

ans = []
for x in Alist:
    if x%3==0 or x%5==0:
        ans.append(True)
    else:
        ans.append(False)
        break
if all(ans)==True:    
    print("APPROVED") 
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
number_list = list(map(int,input().split()))
count = 0
for i in range(N):
    if number_list[i]%6==0 or number_list[i]%10==0:
        count+=1
    elif number_list[i]%2==1:
        count+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()
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')
      break
else:
  print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

yoki = dame = d = 0

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

if dame >= 1:
    print("DENIED")
elif yoki >= 1 or d >= 1:
    print("APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

a = input().split()

f = 'True'

for i in a:
  if int(i) % 2 == 0:
    if int(i) % 3 != 0 and int(i) % 5 != 0:
      f = 'False'

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
f=1
for i in range(n):
    if a[i]%2==0 and a[i]%3!=0 and a[i]%5!=0:
        f=0
        break
if f==1:
    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 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()))

i=0             
while i<N:
        if a[i]%2==0 and (a[i]%3 !=0 and a[i]%5 !=0):
                print('DENIED')
                break
        i+=1
if i==N:
        print('APPROVED')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# B - Papers, Please

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

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

print(ans)

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()
print("APPROVED")

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n = I()
A = LI()

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()))
A2 = []
for i in A :
    if i % 2 == 0:
        A2.append(i)
cnt = 0 
for j in A2:
    if j % 3 == 0 or j % 5 == 0:
        cnt += 1
if cnt == len(A2):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n = int(input())
A = [int(i) for i in readline().split()]

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

Submission status: Accepted

Solution code:
n = int(input())
ar = list(map(int, input().split()))
for i in ar:
  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()))
ans = "APPROVED"

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

print(ans)

Submission status: Accepted

Solution code:
app = "APPROVED"
ng = "DENIED"

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

ok = True

for i, a in enumerate(A):
    if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
        ok = False

if ok:
    print(app)
else:
    print(ng)

Submission status: Accepted

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

cnt = 0

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

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

Submission status: Accepted

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

for i in A:
    if i%2 == 0:
       K.append(i)

for m in K:
    if not (m%3 == 0 or m%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(0,N,1):
    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:
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, 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)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

g = 0
ans = 0

for i in a:
    if i % 2 == 0:
        g += 1
        if i % 3 == 0 or i % 5 == 0:
            ans += 1

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

Submission status: Accepted

Solution code:
import numpy as np
from collections import defaultdict

n = int(input())
a = np.array(list(map(int, input().split())))
memo = defaultdict(int)

a = a[np.where(a%2==0)]

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

print("APPROVED") if sum(memo.values()) == len(a) else print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
flag = True
for a in A:
    if a % 2 == 1:
        continue
    if a % 3 == 0 or a % 5 == 0:
        continue
    flag = False
    break
if flag:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in 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 == True:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())

a = tuple(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:
if __name__ == '__main__':
	N = int(input())
	A = [int(a) for a in input().split()]
	c = 0
	for a in A:
		if a % 2 == 0:
			if a % 3 != 0 and a % 5 != 0:
				c = 1

	if c == 1:
		print('DENIED')
	else:
		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 or i%5==0):continue
        else:
            ans="DENIED"
            break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n=int(input())
a=list(map(int,input().split()))
A=[]
for i in range(len(a)):
    if a[i]%2==0:
        A.append(a[i])
B=[]
for i in range(len(A)):
    if A[i]%3!=0:
        B.append(A[i])
C=[]
for i in range(len(B)):
    if B[i]%5!=0:
        C.append(B[i])
if len(C)>=1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(solve())

Submission status: Accepted

Solution code:
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 and a[i] % 5 != 0) :
            flg = False
if flg :
    print("APPROVED")
else :
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
app_fl = True
for Ai in [a for a in A if a % 2 == 0]:
    if Ai % 3 != 0 and Ai % 5 != 0:
        app_fl = False
        break
 

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

Submission status: Accepted

Solution code:
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=lambda x:int(math.floor(x)),lambda x:int(math.ceil(x))
from functools import reduce;gcd=lambda*x:reduce(math.gcd,x);lcm=lambda*x:reduce(lambda x,y:(x*y)//gcd(x,y),x,1)
from collections import deque
Yes=lambda b:print("Yes"if b else"No");YES=lambda b:print("YES"if b else"NO")
is_even=lambda x:True if x%2==0 else False

def is_palindrome(s):
  n=len(s);b=True
  for i in range(int(0.5*n)):
    if s[i]!=s[n-i-1]:b=False
  return b

def main():
  n=aint();a=ints();flg=0
  for num in a:
    if num%2==0 and num%3!=0 and num%5!=0:
      flg+=1
      break
  print("APPROVED"if flg==0 else"DENIED")
  
if __name__ == '__main__':
    main()

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:
import sys
N = int(input())
A = list(map(int,input().split()))
ans = "APPROVED"
for a in A:
    if(a % 2== 0):
        if(a % 3 == 0 or a % 5 == 0):
            continue
        else:
            ans = "DENIED"
            break
print(ans)

Submission status: Accepted

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

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

if count == 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 A:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            ans = 'DENIED'

print(ans)

Submission status: Accepted

Solution code:
input()
A = [v for v in map(int, input().split()) if not v % 2]
for v in A:
    if v % 3 and v % 5:
        print('DENIED')
        break
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
n = int(input())
ans = "APPROVED"
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:
            ans = "DENIED"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n=int(input())
a=[]
b=[]
c=[]
a=list(map(int,input().split()))


for i in range(n):

    if a[i]%2==0:
        b.append(a[i])

    else:pass


for k in range(len(b)):

    if b[k]%3==0 or b[k]%5==0:

        c.append(b[k])

if len(b)==len(c):

    print("APPROVED")

else:
    print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    nl=[]
    l=list(map(int,input().split()))
    ans='APPROVED'
    for i in l:
        if i%2==0 and i%3!=0 and i%5!=0:
            ans='DENIED'
    print(ans)
resolve()

Submission status: Accepted

Solution code:
import sys
import math

n = int(input())
a = list(map(int, input().split()))
flg = 0
b = []
for i in range(n):
    if a[i] % 2 == 0:
        b.append(a[i])
for i in range(len(b)):
    if b[i] <= 2:
        flg = 1
    elif b[i] % 3 != 0 and b[i] % 5 != 0:
        flg = 1
if flg == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    nl=[]
    l=list(map(int,input().split()))
    for i in l:
        if i%2==0:
            nl.append(i)
    ans='APPROVED'
    for i in nl:
        if i%3!=0 and i%5!=0:
            ans='DENIED'
            break
    print(ans)
resolve()

Submission status: Accepted

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

for i in range(0,N):
  if a[i]%2 == 0:
    if a[i]%3 == 0 or a[i]%5 == 0:
        flag.append(0)
    else:
        flag.append(1)
if sum(flag) == 0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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