Problem:


Score: 200 points

Problem Statement

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

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

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

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

Notes

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

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq A_i \leq 1000

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \dots A_N

Output

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

Sample Input 1

5
6 7 9 10 31

Sample Output 1

APPROVED

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

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

Sample Input 2

3
28 27 24

Sample Output 2

DENIED

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



Sample input:
5
6 7 9 10 31


Sample output:
APPROVED

Submission status: Accepted

Solution code:
def judge(num):
	if num%2:
		return True
	else:
		if not num%3 or not num%5:
			return True
	return False

def solve(li):
	for i in li:
		if not judge(i):
			print('DENIED')
			return 
	print('APPROVED')
	
input()
li = list(map(int,input().split()))
solve(li)

Submission status: Accepted

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

even = []
for target_list in a:
    if target_list%2 == 0:
        even.append(target_list)

ans = []

for target_list in even:
    c1 = target_list%3
    c2 = target_list%5
    if c1 == 0 or c2 == 0:
        pass
    else:
        ans.append(target_list)

if len(ans) >= 1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
n = input()
l = input().split() 
l = [int(x) for x in l]
e =[]
f =[int(x) for x in l if x%2==0]
for i in range(len(l)):
    if l[i] % 2 == 0 and (l[i]%3 ==0 or l[i]%5==0):
        e.append(l[i])
if (len(e)==len(f)):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
AAA = input().split()

ev_AAA = []
for n in AAA:
	if int(n) % 2 == 0:
		ev_AAA.append(n)
        
result = "APPROVED"
for ev_a in ev_AAA:
  if int(ev_a) % 3 == 0:
    continue
  elif int(ev_a) % 5 == 0:
    continue
  else:
    result = "DENIED"
    
print(result)

Submission status: Accepted

Solution code:
input1 = list(map(int, (input().split())))
input2 = list(map(int, (input().split())))

n = input1[0]

for a in input2:
    if(a & 1 == 1):
        continue

    if(a % 3 != 0 and a % 5 != 0):
        print("DENIED")
        exit(0)

print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

B = []
C = []
for i in range(len(A)):
    if A[i]%2==0:
        if A[i]%3!=0:
            if A[i]%5!=0:
                B.append('DENIED')            
    elif A[i]%2!=0:
        C.append('DENIED')

if len(B)==0:
    if len(C)==N:
        print('DENIED')
    elif len(C)!=N:
        print('APPROVED')
elif len(B)!=0:
    print('DENIED')

Submission status: Accepted

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

ans = True
for ai in A:
    if ai % 2 == 0:
        if ai % 3 == 0 or ai % 5 == 0:
            pass
        else:
            ans = False

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

Submission status: Accepted

Solution code:
n = int(input())
str = input()
a = str.split()
flag = 1

for i in range(n):
    if int(a[i]) % 2 == 0:
        if (int(a[i]) % 3 != 0 and int(a[i]) % 5 != 0):
            flag = 0
            break
if flag == 1:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
import math
import numpy as np
n=int(input())
a=list(map(int, input().split()))

flag=False
ans="APPROVED"

for i in range(0,n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            ans="DENIED"
            flag=True
            break
    if flag:
        break
print(ans)

Submission status: Accepted

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

def _filtter(lis, val):
    return [x for x in lis if x % val != 0]


def filtter(lis):

    filtter_val = (3, 5)
    for val in filtter_val:
        lis = _filtter(lis, val)
        if len(lis) == 0:
            return 'APPROVED'
    return 'DENIED'
            
print(filtter([x for x in lis if x % 2 == 0]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3.4.3

n = input()
a_list = list(map(int, input().split(' ')))
 
result = 'APPROVED'
 
for a in a_list:
    if a%2 == 0 and (a%3 != 0 and a%5 != 0):
        result = 'DENIED'
        break
 
print(result)

Submission status: Accepted

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

c = [0] * n

for i in range(n):
    if (a[i] % 2 == 0):
        if (a[i] % 3 != 0) and (a[i] % 5 != 0):
            c[i] = 1
            
if (list(set(c)) == [0]):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
items = [int(x) for x in input().split()]
 
flg = True
for item in items:
  if item % 2 == 0:
    if item % 3 == 0 or item % 5 == 0:
      flg = True
    else:
      flg = False
      break
 
if flg:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

n = int(input())
a = [num for num in map(int, input().split())]

# print(n)
# print(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

for d in arr :
  
  if d % 2 == 0 :
    
    if d % 3 == 0 or d % 5 == 0:

      pass
    
    else :

      print("DENIED")
      exit()
      
print("APPROVED")

Submission status: Accepted

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

ngcount = 0
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0:
            continue
        elif A[i] % 5 == 0:
            continue
        else:
            ngcount = ngcount + 1
            break
    else:
        continue
if ngcount == 0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 != 0 and a[i]%5 != 0:
            print("DENIED")
            break
    if i == n-1:
        print("APPROVED")
        break

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())

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

ans = 'APPROVED'

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

Submission status: Accepted

Solution code:
# coding: utf-8

num = int(input())
line = input().split(" ")
result = []

for i in range(num):
    line[i] = int(line[i])

for i in range(num):
    if line[i] % 2 == 0:
        result.append(line[i])

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

if count == len(result):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

APP = 'APPROVED'
DEN = 'DENIED'

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(DEN)
            sys.exit()
    
print(APP)

Submission status: Accepted

Solution code:
def main():
	# n,m = map(int,input().split())
	n = int(input())
	a = list(map(int,input().split()))
	ans = 0
	den = 0
	for i in range(len(a)):
		if a[i] % 2 == 0:
			if a[i] % 3 == 0 or a[i] % 5 == 0:
				ans = 1
			else:
				den = 1
	if den == 0:
		print("APPROVED")
	else:
		print("DENIED")
	
 
if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
amount = int(input())
inputl = input().split()

flag = True

for i in range(amount):
    a = int(inputl[i])
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            flag = False

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

Submission status: Accepted

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


def main():
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                return 'DENIED'

    return 'APPROVED'


print(main())

Submission status: Accepted

Solution code:
N = input()
A_list = list(map(int, input().split(' ')))
 
a_2 = [a for a in A_list if a%2==0]
flg = False
for a in a_2:
    if a % 3 ==0 or a % 5 ==0:
        continue
    else:
        print('DENIED')
        flg = True
        break
if flg == False:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n=int(input())
a=list(map(int, input().split())) 
f=0
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            f = 1
            break
if f == 1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
a = int(input())
b = [int(str) for str in input().split()]
c = [0]*a

for n in range(a):
  if b[n]%2 == 0:
    if b[n]%3 != 0 and b[n]%5 != 0:
      c[n] = 1

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

Submission status: Accepted

Solution code:
n = int(input())
lis = list(map(int,input().split()))
ans = [0]

for i in lis:
    if i % 2 == 0:
        if i%3 != 0 and i%5 != 0:
            ans[0]=1
            break
if ans[0] == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
As = input().split(" ")
As = [int(i) for i in As]
div = [i for i in As if i % 2==0]
No3 = [i for i in div if i % 3 !=0]
deny = [i for i in No3 if i % 5 != 0]
if len(deny)>0:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = np.unique(list[list%2 == 0])
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))

if len(A) ==0:
        print('APPROVED')
elif len(B) ==0:
    print('DENIED')
else:
    if len(A) == len(B) :
        print('APPROVED')
    else:
        print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
NK = list(map(int, input().split()))
Key = N
for i in range(N):
    if N != Key:
            break
    elif NK[i] % 2 == 0:
        if NK[i] % 3 == 0 or NK[i] % 5 == 0:
            continue
        else:
            N -= 1
            break
    else:
        continue
    
if N == Key:
    print("APPROVED")
elif N != Key:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

_ = input()
nums = [int(n) for n in input().split()]

approved = True
for num in nums:
  if num % 2 == 0:
    if num % 3 == 0 or num % 5 == 0:
      continue
    else:
      approved = False

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

Submission status: Accepted

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

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

print(ad)

Submission status: Accepted

Solution code:
#coding utf-8

def main():
    question_b()

def question_b():
    n = int(input())
    syorui = list(map(int,input().split()))
    flg = False
    oddflg = False
    box = []
    for i in range(n):
        if syorui[i]%2 == 0:
            oddflg = True
            if syorui[i]%3 == 0 or syorui[i]%5 == 0:
                flg = True
            else:
                flg = False
                break
    if flg == True or oddflg == False:
        print("APPROVED")
    else:
        print("DENIED")

main()

Submission status: Accepted

Solution code:
import sys

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

for i in range(N):
    if A[i]%2 == 0:
        if not((A[i]%3 == 0) or (A[i]%5 == 0)):
            print('DENIED')
            sys.exit()

print('APPROVED')

Submission status: Accepted

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

def abc155b(num, s):
    b = True

    for i in range(0, num):
        if(s[i] % 2 == 0):
            if(s[i] % 3 == 0):
                continue
            elif(s[i] % 5 == 0):
                continue
            else:
                b = False

    return(b)

###
# main
if(__name__ == '__main__'):
    # input
    num = int(input())
    s = list(map(int, input().split(" ")))

    b = abc155b(num, s)

    # output
    if( True == b ):
        print("APPROVED")
    else:
        print("DENIED")
# else:
    # do nothing

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def papers(n, arr):
    for ele in arr:
        if ele % 2 == 0:
            if ele % 3 == 0 or ele % 5 == 0:
                pass
            else:
                return 'DENIED'
        else:
            pass
    return 'APPROVED'

if __name__ == "__main__":
    n = int(input())
    arr = [int(s) for s in list(input().split())]
    print(papers(n, arr))

Submission status: Accepted

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

L = [i for i in l if i % 2 == 0]
K = [i for i in L if i % 3 != 0]
J = [i for i in K if i % 5 != 0]

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

Submission status: Accepted

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

for i in a:
    if i % 2 == 0:
        if not(i % 3 == 0 or i % 5 == 0):
            print('DENIED')
            break
else:
    print('APPROVED')

Submission status: Accepted

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

a_list_even = [i for i in a_list if i % 2 == 0]
for a in a_list_even:
    if a % 3 == 0 or a % 5 == 0:
        continue
    else:
        print("DENIED")
        exit()

print("APPROVED")

Submission status: Accepted

Solution code:
n = input()
list = input().split(" ")
for number in list:
  int_number = int(number)
  if (int_number % 2) == 0:
    if int_number %3 != 0:
      if int_number %5 != 0:
      	print("DENIED")
      	exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())
a = [int(i) for i in input().split()]
t = "APPROVED"
for i in a:
    if (i%2)==0:
        if not(((i%3)==0) or ((i%5)==0)):
            t = "DENIED"
            break
        
print(t)

Submission status: Accepted

Solution code:
N = int(input())
M = list(map(int,input().split()))
X = [i for i in M if i % 2 == 0]
Y = [i for i in X if i % 3 ==0 or i % 5 ==0]

if len(X) == len(Y):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
import sys

n = int(input())
a = input().split()
Alist = []
for I in a :
    Alist += [int(I)]

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

ans = True
for i in li:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            ans = False

if ans:
    print("APPROVED")

else:
    print("DENIED")

Submission status: Accepted

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

def f(a):
    for i in range(n):
        if a[i]%2 == 0 and not ( a[i]%3 == 0 or a[i]%5 == 0 ):
            return "DENIED"
    return "APPROVED"

print(f(a))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int,input().split()))
M = list(filter(lambda x: x % 2 == 0 , L))
M_len = len(M)
N = list(filter(lambda x: (x % 3 ==0 or x % 5 == 0) ,M))
N_len = len(N)
if(M == N):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
oddNum = set()

for x in list(map(int, input().split())):
    if (x % 2 == 0):
        oddNum.add(x)

for o in oddNum:
    if ((o % 3 != 0) & (o % 5 != 0)):
        print("DENIED")
        exit()

print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
num_list = [int(x) for x in input().split()]
cnt = 0
for i in range(num):
    if num_list[i] % 2 == 0:
        if not (num_list[i] % 3 == 0 or num_list[i] % 5 == 0):
            cnt += 1
            
if cnt != 0:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

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

flag = True

for e in a:
    if e%2 == 0:
        if e%3 != 0 and e%5 != 0:
            flag = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from math import sqrt
#from heapq import heappush, heappop
#from collections import deque

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

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

print("APPROVED")

Submission status: Accepted

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

is_denied = False
for ai in A:
  if ai % 2 == 0 and (ai % 3 != 0 and ai % 5 != 0):
    is_denied = True
    break

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(n + 1):
    if i == n:
        print("APPROVED")
    else:
        if info[i] % 2 == 0:
            if info[i] % 3 == 0 or info[i] % 5 == 0:
                continue
            else:
                print("DENIED")
                break

Submission status: Accepted

Solution code:
N = input()
_list = input().split(" ")
_list = [int(a) for a in _list]
aspect = [a for a in _list if a % 2==0]
ans = []
for a in aspect:
    if a % 3 == 0 or a % 5 == 0:
        ans.append(True)
if len(aspect) ==len(ans):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

del a[n:]

new1 = [a[i] for i in range(len(a)) if a[i] % 2 == 0]
new2 = [i for i in range(len(new1)) if (new1[i] % 3 == 0 or new1[i] % 5 == 0 or new1[i] % 15 == 0)]

if len(new1) == len(new2):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

a_even = list(filter(lambda x: x % 2 == 0, a))
rtn = all(map(lambda x: x % 3 == 0 or x % 5 == 0, a_even))

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
input_int = int(input())
input_list = list(map(int,input().split()))
count_2 = 0
count_3_5 = 0

for i in input_list:
    if i % 2 == 0:
        count_2 += 1
        if i % 3 == 0 or i % 5 == 0:
            count_3_5 += 1

if count_2 == count_3_5:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

    for i in odds:
        if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            return

    print("APPROVED")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
tuplea = tuple(map(int, input().split()))
ans = 0
for n in range(N):
    if tuplea[n]%2 == 1:
        pass
    else:
        if tuplea[n]%3 == 0 or tuplea[n]%5 == 0:
            pass
        else:
            ans = 1
if ans == 0:
    print('APPROVED')   
else:
    print('DENIED')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int, input().split()))
for i in A:
    if i % 2 == 0:
        if not((i % 3 == 0) or (i % 5 == 0)):
            print('DENIED')
            break
else:print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
_list = list(map(int,input().split()))
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 = input().split(" ")

num = []
for b in a:
    num.append(int(b))

entry = 'APPROVED'
for i in range(0, n):
    if num[i] % 2 == 0:
        if num[i] % 3 == 0:
            continue
        if num[i] % 5 == 0:
            continue

        entry = 'DENIED'
        break

print(entry)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

#in
n = input()
st = input()
hai = []
hai = st.split()
hai_l = [int(s) for s in hai]

ap_fg = 0

#配列を順に、偶奇を見る→割り切れるかで処理
for i in range(len(hai_l)) :

  #配列がの偶奇判定
	if (hai_l[i] % 2) == 0:
      #偶数
		if (hai_l[i] % 3) == 0 or (hai_l[i] % 5) == 0:
			ap_fg = ap_fg + 0
		else:
			print('DENIED')
			break
		
	#奇数
	else:
		ap_fg = ap_fg + 0
	    
	if ap_fg == 0 and i == len(hai_l)-1:
		print('APPROVED')

Submission status: Accepted

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

cnt=True

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

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

Submission status: Accepted

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

flg=0



for n in range(N):
    if(int(P[n]) % 2):
        pass
    else:
        if((int(P[n])%3 == 0) or (int(P[n])%5 == 0)):
            pass
        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()))

answer="APPROVED"

for a in A:
    if a%2==0:
        if a%3==0 or a%5==0:
            answer="APPROVED"
        else:
            answer="DENIED"
            break
print(answer)