Problem:


Score: 200 points

Problem Statement

You are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.

According to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:

All even numbers written on the document are divisible by 3 or 5.

If the immigrant should be allowed entry according to the regulation, output APPROVED; otherwise, print DENIED.

Notes

The condition in the statement can be rephrased as "If x is an even number written on the document, x is divisible by 3 or 5".
Here "if" and "or" are logical terms.

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq A_i \leq 1000

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \dots A_N

Output

If the immigrant should be allowed entry according to the regulation, print APPROVED; otherwise, print DENIED.

Sample Input 1

5
6 7 9 10 31

Sample Output 1

APPROVED

The even numbers written on the document are 6 and 10.

All of them are divisible by 3 or 5, so the immigrant should be allowed entry.

Sample Input 2

3
28 27 24

Sample Output 2

DENIED

28 violates the condition, so the immigrant should not be allowed entry.



Sample input:
5
6 7 9 10 31


Sample output:
APPROVED

Submission status: Accepted

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

Submission status: Accepted

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

evens = []
evens_count = 0
approved = "DENIED"
out_frag = 0

for i in range(n):
    if a[i] % 2 == 0:
        evens.append(a[i])
        evens_count += 1

if evens_count > 0:
    for j in range(evens_count):
        if (evens[j] % 3 == 0) or (evens[j] % 5 == 0):
            pass
        else:
            out_frag = 1
    if out_frag == 0:
        approved = "APPROVED"
elif evens_count == 0:
    approved = "APPROVED"

print(approved)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
number = int(input())
list_number = input().split()

ok = 0
for i in list_number:
    if int(i) % 2 == 0:
        if int(i) % 3 == 0 or int(i) % 5 == 0:
            pass
        else:
            ok = 1
            print("DENIED")
            break

if ok == 0:
    print("APPROVED")

Submission status: Accepted

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

  if i%2==0:
    if not i%3==0 and not i%5==0:
      print("DENIED")
      x=1
      break
    else:
      continue
    
  else:
   	continue
  break
if x ==0:
	print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
length = int(input())
li = list(map(int,input().split()))

judge = True

for i in range(length):
  a = li[i]
  if a % 2 == 0:
      if not (a % 3 == 0 or a % 5 == 0):
          judge = False
          break;
  
if judge:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

is_True = True
for p in people:
    if p % 2 == 0:
        if p % 3 != 0 and p % 5 != 0:
            is_True = False
            break

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

for ai in a:
  if ai % 2 == 0:
    if ai % 6 != 0 and ai % 10 != 0:
      print('DENIED')
      break
else:
  print('APPROVED')

Submission status: Accepted

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

ans=True       
for i in b:
    if i%3==0 or i%5==0:
        ans=True
    else:
        ans=False
        break
        
if ans:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())

import math 

for i in range(1):
    n=ii()
    a=li()
    for i in range(n):
        if (a[i]%2==0 and (a[i]%3==0 or a[i]%5==0)) or a[i]%2:
            continue
        else:
            print("DENIED")
            exit()
    print("APPROVED")

Submission status: Accepted

Solution code:
a = int(input())
n = [int(x) for x in input().split()]
b = [i for i in n if i % 2 == 0 ]
f = 0
for i in range(len(b)):
  if b[i] % 3 == 0:
    f += 1
    continue
  if b[i] % 5 == 0:
    f += 1
    continue
if len(b) == f:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
N=int(input())
i = list(map(int, input().split()))
c=0

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2 == 0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) == len(answer):
    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:
            ans="APPROVED"
        else:
            ans="DENIED"
            break
    else:
        continue
        
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# 入力
n = int(input())
An_list = list(map(int, input().split()))

# 拒否フラグ
deny_flag = False


# 入国条件処理
for Ai in An_list:
    if Ai % 2 == 0:
        if (Ai % 3 == 0) or (Ai % 5 == 0):
            # 入国条件に合うので継続
            pass
        else:
            # 入国条件に合わないので拒否して終了
            print("DENIED")
            deny_flag = True
            break


# 数値をすべて審査してdeny_flagがFalseなら承認
if not deny_flag:
    print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
flag = 0
a = input()
b = list(map(int,input().split()))
for c in b:
    if c%2 == 0:
        if not (c%3 == 0 or c%5 == 0):
            flag = 1

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

Submission status: Accepted

Solution code:
from sys import exit

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

Submission status: Accepted

Solution code:
a = int(input())
b = input().split()
b = list(map(int, b))
c = 0
for i in b:
    if i%2 == 0:
         if i%3 != 0:
            if i%5 != 0:
                print("DENIED")
                break
    c +=1
if c == a:
    print("APPROVED")

Submission status: Accepted

Solution code:
def main():
    N = input()
    lists = map(int,input().split())
    for i in lists:
        if not (i % 2):
            if ((i % 3) and (i % 5)):
                print("DENIED")
                return
    print("APPROVED")
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
ais = list(map(int, input().split()))
evens = []
for a in ais:
  if a % 2 == 0:
    evens.append(a)
if len(evens) == 0:
  print("APPROVED")
  quit()
m = 0
for e in evens:
  if e % 3 == 0 or e % 5 == 0:
    pass
  else:
    m += 1
if m == 0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

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

for j in even:
    if j % 3 == 0 or j % 5 == 0:
        continue
    else:
        deny = 1

if deny == 0:
    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:
      continue
    else:
      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 = []
C = []
D = []
for i in range(N):
  if A[i] % 2 == 0: 
    C.append(A[i])
  elif A[i] % 2 != 0:
    B.append(A[i])
for i in (range(len(C))):
  if C[i] % 3 == 0 or C[i] % 5 == 0:
    D.append(C[i])
if len(C) >= 1:
  if len(C) == len(D):
    print('APPROVED')  
  else:
    print('DENIED')
  
else:
  if len(A) == len(B):
    print('APPROVED')

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])

x=len(B)
hantei=0
for i in range(x):
    if B[i]%3==0:
        hantei=hantei+1
    elif B[i]%5==0:
        hantei=hantei+1
    else:
        pass

if hantei>=x:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
n = int(input())
a = 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 = map(int, input().split())
lis = [6, 10, 12, 18, 20, 24, 30, 36, 40, 42, 48, 50, 54, 60, 66, 70, 72, 78, 80, 84, 90, 96, 100, 102, 108, 110, 114, 120, 126, 130, 132, 138, 140, 144, 150, 156, 160, 162, 168, 170, 174, 180, 186, 190, 192, 198, 200, 204, 210, 216, 220, 222, 228, 230, 234, 240, 246, 250, 252, 258, 260, 264, 270, 276, 280, 282, 288, 290, 294, 300, 306, 310, 312, 318, 320, 324, 330, 336, 340, 342, 348, 350, 354, 360, 366, 370, 372, 378, 380, 384, 390, 396, 400, 402, 408, 410, 414, 420, 426, 430, 432, 438, 440, 444, 450, 456, 460, 462, 468, 470, 474, 480, 486, 490, 492, 498, 500, 504, 510, 516, 520, 522, 528, 530, 534, 540, 546, 550, 552, 558, 560, 564, 570, 576, 580, 582, 588, 590, 594, 600, 606, 610, 612, 618, 620, 624, 630, 636, 640, 642, 648, 650, 654, 660,666, 670, 672, 678, 680, 684, 690, 696, 700, 702, 708, 710, 714, 720, 726, 730, 732, 738, 740, 744, 750, 756, 760, 762, 768, 770, 774, 780, 786, 790, 792, 798, 800, 804, 810, 816, 820, 822, 828, 830, 834, 840, 846, 850, 852, 858, 860, 864, 870, 876, 880, 882, 888, 890, 894, 900, 906, 910, 912, 918, 920, 924, 930, 936, 940, 942, 948, 950, 954, 960, 966, 970, 972, 978, 980, 984, 990, 996]
tmp = []
for i in s:
    if i % 2 == 0:
        if i not in lis:
            print('DENIED')
            exit()
print('APPROVED')

Submission status: Accepted

Solution code:
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
case = [int(x) for x in input().split(' ')]
approve = True
for i in case:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      approve = False
      break

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

Submission status: Accepted

Solution code:
N = input()
N = int(N)
A = list(map(int,input().split()))
B = [ i for i in A if i % 2 ==0]
C = [ d for d in B if  d % 3 == 0 or d % 5 == 0]
R = len(C)
Q = len(B)
if R == Q:
  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 and a[i] % 5 != 0:
            print("DENIED")
            sys.exit()

print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
arr = []
arr = input().split() 
arr = [int(l) for l in arr]
even = [l for l in arr if l % 2 == 0]      
answer = []
for i in even: 
    if i % 3 == 0 or i % 5 == 0:
        answer.append(True)
if len(answer) == len(even): 
    print("APPROVED")
else: 
    print("DENIED")

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)
x = len(b)
for j in b:
    if j % 3 == 0 or j % 5 == 0:
       c.append(j) 
y = len(c)


if x == y:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

for i in A_N:
    if i % 2 == 0:
        A_N_even.append(i)

ans = "APPROVED"
for i in A_N_even:
    if i % 3 == 0 or i % 5 == 0:
        ans = "APPROVED"
    else:
        ans = "DENIED"
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

a = list()


for i in range(N):
    if (c[i] % 2 == 0):
        if(c[i] % 3 == 0 or c[i] % 5 == 0):
            a.append(1)
        else:
            a.append(0)



b = 0
for i in range(len(a)):
    b = b + int(a[i])


if(b == len(a)):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(N):
    if a_list[i]  % 2 != 0:
        a = 1
    else:
        if (a_list[i] % 3 != 0) and (a_list[i] % 5 != 0):
            c = 1
        else:
            a = 1


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

Submission status: Accepted

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

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])

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

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

Submission status: Accepted

Solution code:
n = int(input())
m = list(map(int,input().split()))
f = True
for i in m:
  if i % 2 == 0:
    if (i % 3 == 0 ) or (i % 5 == 0 ):
      f = True
    else:
      print('DENIED')
      exit()

print('APPROVED')

Submission status: Accepted

Solution code:
N=int(input())
a = list(map(int,input().split()))
c=0
i=0
while(c==0 and i<N):
    if(a[i]%2==0):
        if(a[i]%3==0 or a[i]%5==0):
            i+=1
        else:
            c+=1
    else:
        i+=1
if(c==0):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

for i in range(0, len(A_ans)):
    if A_ans[i] % 3 == 0 or A_ans[i] % 5 == 0:
        count += 1

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

Submission status: Accepted

Solution code:
line1 = input('')
line2 = input('') 
result = True
cnt = int(line1)
list = line2.split(' ')
if len(list) != cnt:
  result = False
if result:
  for no_str in list:
    no = int(no_str)
    if no % 2 == 0:
      if no % 3 != 0 and no % 5 != 0:
        result = False

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

Submission status: Accepted

Solution code:
import numpy as np


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

AN2 = AN[AN % 2 == 0]

if AN2[AN2 % 3 == 0].size + AN2[AN2 % 5 ==0].size - AN2[AN2 % 15 ==0].size == AN2.size :
    print('APPROVED')

else:
    print('DENIED')

Submission status: Accepted

Solution code:
from sys import stdin
#from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin, tan


def ii(): return int(stdin.readline())


def fi(): return float(stdin.readline())


def mi(): return map(int, stdin.readline().split())


def fmi(): return map(float, stdin.readline().split())


def li(): return list(mi())


def lsi():
    x=list(stdin.readline())
    x.pop()
    return x


def si(): return stdin.readline()


def sieve(x):
    a=[True]*(x+1)
    sq=floor(sqrt(x))
    for i in range(3, sq+1, 2):
        if a[i]:
            for j in range(i*i, x+1, i):
                a[j]=False
    if x>1:
        p=[2]
    else:
        p=[]
    for i in range(3, x+1, 2):
        if a[i]:
            p.append(i)
    return p
def prime_factor(x):
    c=1
    i=0
    while p[i]*p[i]<=x:
        if not x%p[i]:
            c+=1
            while not x%p[i]:
                x//=p[i]
        i+=1
    if x>1:
        c+=1
    return c
res=['APPROVED', 'DENIED']
#vowel={'a', 'e', 'i', 'o', 'u', 'y', 'A', 'E', 'I', 'O', 'U', 'Y'}
#pow=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904, 9223372036854775808]
############# CODE STARTS HERE #############
ii()
a=li()
f=0
for i in a:
    if not i%2:
        if i%3 and i%5:
            f=1
            break
print(res[f])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

a = [int(i) for i in input().split()]
v=0
x=[]
j=0
for i in range(N):
  if a[i] %2 ==0:
    x.append(a[i])
    j +=1

    
for i in range(j):
  if x[i] %3 ==0 or x[i] %5 ==0:
    v += 1

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

Submission status: Accepted

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

A_lis = []
for a in A:
    if a%2 == 0:
        A_lis.append(a)
flag = 0
for a in A_lis:
    if (a%3==0 or a%5==0):
        flag += 1
if flag == len(A_lis):
    print('APPROVED')
    sys.stdout.flush 
else:
    print('DENIED')
    sys.stdout.flush

Submission status: Accepted

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

ans = True

for i in L:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            ans = False
            break

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

Submission status: Accepted

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

flg = True
for i in range(N):
    if A[i] % 2 == 1:
        continue
    else:
        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:
# from functools import reduce

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

R = True
for b in [n % 3 == 0 or n % 5 == 0 for n in AL if n % 2 == 0]:
    R = R and b

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

Submission status: Accepted

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

approvedNum = 0

for num in a:
    if num % 2 == 0:
        if num % 3 == 0 or num % 5 ==0:
            approvedNum += 1
    if num % 2 == 1:
        approvedNum += 1

print('APPROVED') if approvedNum == len(a) else print('DENIED')

Submission status: Accepted

Solution code:
a=int(input())
Papers=list(map(int,input().split()))
m=0
for i in range (a):
  if Papers[i] %2==0:
    if not (Papers[i] %3==0 or Papers[i] %5==0):
      m=m+1

if not m==0:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split() 
     if int(x) % 2 == 1 or int(x) % 6 == 0 or int(x) % 10 == 0 ]
if len(A) == N:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
import sys
n = int(input())
li = list(map(int,input().split()))
even_li = []
for a in li:
  if(a%2==0):
    even_li.append(a)
flg = 0
for a in even_li:
  if(a%3==0 or a%5==0):
    flg += 1
if(str(flg) == str(len(even_li))):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
N = input()
raw_input1 = input()

l = raw_input1.split()
l_num = [int(x) for x in l]

flag = 0
flag1 = 0

for a in l_num:
    if a % 2 ==0:
        if a % 3 == 0 or a % 5 == 0:
            flag = 0
        else:
            flag = 1
    if flag != 0:
        break

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

Submission status: Accepted

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

flg = True

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

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

Submission status: Accepted

Solution code:

n = (int(x) for x in input().split())
a_list = list(map(int, input().split()))

even_list = []

i = 0

# 1. 偶数かどうか判定する
while i < len(a_list) : 
 div_a = a_list[i] % 2
 if div_a == 0 : 
  even_list.append(a_list[i])
 i = i + 1

# 2. 3または5で割れるか
j = 0
all_num = True

while j < len(even_list) :
 
 div_even = even_list[j] % 3 
 if div_even != 0 :
     div_even = even_list[j] % 5
     if div_even != 0 :
        all_num = False
        break

 j = j + 1

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 16 21:24:48 2020

@author: W_Indicate
"""
Y = 0

N = int(input()) #1行目のNを取得する
s = [int(i) for i in input().split()] #

for item in s:
    if (item % 2) == 0:
        if ((item % 3) != 0) and ((item % 5) != 0):
            Y = 1 
            
if Y == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
APPROVE_NUM_THREE = 3
APPROVE_NUM_FIVE = 5


def approve_entry(entry_judge_number_list):
    for n in entry_judge_number_list:
        if n % 2 == 0:
            if n % APPROVE_NUM_THREE != 0 and n % APPROVE_NUM_FIVE != 0:
                return 'DENIED'

    return 'APPROVED'


if __name__ == '__main__':
    input_numbers = input()
    entry_judge_number_list = map(int, input().split())
    print(approve_entry(entry_judge_number_list))

Submission status: Accepted

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

Submission status: Accepted

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

if all((L[i]%3 == 0 or L[i]%5 == 0 for i in range(len(L)))):

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8


def main():
    _ = int(input())
    integers = list(map(int, input().split(' ')))

    for integer_ in integers:
        if integer_ % 2 == 0:
            if integer_ % 3 == 0 or integer_ % 5 == 0:
                pass
            else:
                print('DENIED')
                return 0
        else:
            pass

    print('APPROVED')

    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = input()
a = input().split()
n= int(n)
a= [int(i) for i in a]
f=0
#print(a)

for h in a:	
	if h%2 ==0:
  		if h%3 ==0 or h%5 ==0: f=f+1
	else: f = f+1


#print(f)
if f == len(a): print("APPROVED")
else: print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
l = list(int(x) for x in input().split())
a = []
for i in l:
    if i % 2 == 0:
        a.append(i)
x = [i % 3 == 0 or i % 5 == 0 for i in a]

if len(a) == sum(x):
    print('APPROVED')
elif len(a) == 0:
    print('DENIED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
n = int(input())
List = list(map(int, input().split()))
denied_point = 0
List_even = [i for i in List if i % 2 == 0]

# print(List_even)
for i in List_even:
    if (i % 3) != 0 and (i%5 != 0):
        denied_point = denied_point + 1


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def main():
    
    # sys.stdin = open('input155b.txt')
   
    n = int(input())
    
    a = list(map(int, input().split()))

    ans = True

    for i in a:
        if i % 2 == 1:
            continue
        if i % 2 == 0:
            if i % 3 == 0 or i % 5 == 0:
                continue
            else:
                ans = False
                
    if ans == True:
        print('APPROVED')
    else:
        print('DENIED')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	n = int(input())
	al = list(IN())
	for i in al:
		if i % 2 == 0 and i%3!=0 and i%5!=0:
			print('DENIED')
			return 
	print('APPROVED')
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:

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

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

    print("APPROVED")
    return
main()

Submission status: Accepted

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

def isApprovedNumber(n):
    if n % 2 != 0:
        return True
    if n % 5 == 0 or n % 3 == 0:
        return True
    return False

def isApprovedArray(list):
    str_ok="APPROVED"
    str_ng="DENIED"
    for number in list:
        if not isApprovedNumber(number):
            return str_ng
    return str_ok

result=isApprovedArray(LIST)
print(result)

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:
			continue
		elif i % 5 == 0:
			continue
		else:
			ans = 'DENIED'
			break
print(ans)

Submission status: Accepted

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