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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
t = 0
for i in range(N):
    a = A[i]
    if a%2 == 0:
        if a%3 != 0 and a%5 != 0:
            t += 1
            break

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

Submission status: Accepted

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

for x in p:
  if x % 2 == 0:
    if x % 3 != 0 and x % 5 != 0:
      print("DENIED")
      break

else :
  print("APPROVED")

Submission status: Accepted

Solution code:
# B - Papers, Please
# https://atcoder.jp/contests/abc155/tasks/abc155_b

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

even = 0
cnt = 0

for i in a:
    if i % 2 == 0:
        even += 1
        if i % 3 == 0 or i % 5 == 0:
            cnt += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print("APPROVED")

Submission status: Accepted

Solution code:
import os, sys, re, math

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

answer = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if not (a % 3 == 0 or a % 5 == 0):
            answer = 'DENIED'
            break

print(answer)

Submission status: Accepted

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

for i in range(len(A)):
  if A[i] % 2 == 0:
    if A[i] % 3 == 0 or A[i] % 5 == 0:
      continue
    else:
      ans = 'DENIED'

print(ans)

Submission status: Accepted

Solution code:
'''
問題：
    あなたは AtCoder 王国の入国審査官です。
    入国者の書類にはいくつかの整数が書かれており、あなたの仕事はこれらが条件を満たすか判定することです。
    規約では、次の条件を満たすとき、またその時に限り、入国を承認することになっています。
        書類に書かれている整数のうち、偶数であるものは全て、3 または 5 で割り切れる。
    上の規約に従うとき、書類に N 個の整数 A1,A2,…,AN
    が書かれた入国者を承認するならば APPROVED を、しないならば DENIED を出力してください。
'''

'''
制約：
    入力はすべて整数
    1 ≤ N ≤ 100
    1 ≤ Ai ≤ 1000
'''
def is_even(num):  # 偶数判定
    if num % 2 == 0:
        return True
    else:
        return False

def is_fizzbuzz(num):  # 3 または 5で割り切れるか判定（※関数名はテキトーｗ）
    if num % 5 == 0:
        return True
    if num % 3 == 0:
        return True
    else:
        return False


# 標準入力から、N, A1,A2,...,AN の値を取得する
n = int(input())
numbers = list(map(int,input().split()))

result = 'APPROVED'
for i in numbers:
    if is_even(i):
        if is_fizzbuzz(i):
            result = 'APPROVED' # 偶数かつ、3でも5でも割り切れるので、APPROVED
        else:
            result = 'DENIED'   # 1つでも条件を満たさない場合、DENIEDしてfor文抜ける
            break

print(result)

Submission status: Accepted

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

answer = 'DENIED'
for i in range(0, N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            answer = 'APPROVED'
        else:
            answer = 'DENIED'
            break
    else:
        answer = 'APPROVED'

print(answer)

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])
count = 0
for i in A:
    if i % 2 !=0:
        continue
    elif i % 3 ==0 or i % 5==0:
        count  +=1
if count == B:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
n = int(input())
list01 = input().split()
x = 0
for i in list01:
    if int(i) % 2 != 0:
        pass
    elif int(i) % 3 == 0:
        pass
    elif int(i) % 5 == 0:
        pass
    else:
        x += 1
        break

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from  collections import defaultdict
from collections import Counter
def main():
    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')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
approved = all([i % 2 != 0 or i % 10 == 0 or i % 6 == 0 for i in map(int, input().split())])
print('APPROVED' if approved  else 'DENIED')

Submission status: Accepted

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

    flag = True 

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# 155b

def atc_155b(input_value: str) -> str:
    N = int(input_value[0])
    Ai = [int(ai) for ai in input_value[1].split(" ")]
    for i in range(0, N):
        if Ai[i] % 2 == 0 and Ai[i] % 3 != 0 and Ai[i] % 5 != 0:
            return "DENIED"
    return "APPROVED"

N = input()
Ai = input()
print(atc_155b([N, Ai]))

Submission status: Accepted

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

for a in A:
	if a%2==0:
		if a%3==0 or a%5==0:
			continue
		else:
			print("DENIED")
			exit()

print("APPROVED")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
data = list(map(int,input().split()))
sw1 = 0
sw2 = 0
for i in range(0,len(data)):
    if data[i] % 2 == 0:
        sw1 += 1
        if data[i] % 3 == 0 or data[i] % 5 == 0:
            sw2 += 1

if sw1 >= 0 and sw1 == sw2:
    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 == 1:
    continue
  else:
    if a%3 != 0 and a%5 != 0:
      print("DENIED")
      break
else:
  print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 数値の取得
num_cnt = int(input())
num_list = list(map(int,input().split()))

# 数値の検査後メッセージを出力
judge = "APPROVED"
for cnt in range(0,num_cnt,1):
    if num_list[cnt] % 2 == 0\
    and num_list[cnt] % 3 != 0\
    and num_list[cnt] % 5 != 0:
      judge = "DENIED"
      
print(judge)

Submission status: Accepted

Solution code:
N = int(input())
list_A = [int(m) for m in input().split()]

for i in list_A:
    if i % 2 != 0:
       continue
    elif not (i % 3 == 0 or i % 5 == 0):
            print("DENIED")
            exit()


print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())
list_A = [int(m) for m in input().split()]

for i in list_A:
    if i % 2 != 0:
       continue
    elif not (i % 3 == 0 or i % 5 == 0):
            print("DENIED")
            exit()

else:
    print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

if all([i % 3 == 0 or i % 5 == 0 for i in even]) == 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==1 or i%3==0 or i%5==0:
    continue
  print("DENIED")
  exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - Papers, Please

N = int(input())
my_list = list(input().split())
j = 0

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

if j != 0:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    a = list(map(int, input().split(" ")))
    x = []
    for i in a:
        if i % 2 == 0:
            if not(i % 3 == 0 or i % 5 == 0):
                print("DENIED")
                return
    print("APPROVED")
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
total_number = int(input())
number = list(map(int, input().split()))
for value in number:
    if value % 2 == 0 and (value % 3 != 0 and value % 5 != 0):
        print("DENIED")
        quit()
print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
# 入力値をリスト形式（整数）で受け取る
a = list(map(int,input().split()))
# ダメだったものの値を集計
deny_list = 0
# 偶数で3で割れなくて5でも割れないものを集計
for i in a:
    if i % 2 == 0 and i % 3 !=0 and i % 5 !=0:
        deny_list += i
# 集計値が０だったらAOOROVED
if deny_list == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def main():
    _ = int(input())
    A = [int(x) for x in input().split()]

    flag = True
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                flag = False
                break
    if flag:
        print('APPROVED')
    else:
        print('DENIED')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = input()
A = list(map(int, input().split()))
print('APPROVED' if all(a & 1 or a % 3 == 0 or a % 5 == 0 for a in A) else 'DENIED')

Submission status: Accepted

Solution code:
# 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums


n = int(input())
arr = map(int, input().split())

candidate = [n for n in arr if n % 2 == 0]
for check in candidate:
    if check % 3 != 0 and check % 5 != 0:
        print("DENIED")
        exit()

print("APPROVED")

Submission status: Accepted

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

for i in range(len(a)):
    if a[i]%2!=0:
        b.remove(a[i])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    a = np.fromstring(read(), np.int64, sep=' ')[1:]
    a = a[a % 2 == 0]
    if np.all((a % 3 == 0) | (a % 5 == 0)):
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

if ch == 0:
    ans = 'APPROVED'
else:
    ans = 'DENIED'

print(ans)

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

# 書類に書かれている整数のうち、偶数であるものは全て、 3 または 5 で割り切れる。
# 上の規約に従うとき、書類にN個の整数A1,A2,…,ANが書かれた入国者を承認するならば APPROVED を、しないならば DENIED を出力してください。

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

else:
    print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
list_a = [int(m) for m in input().split()]
for i in list_a:
    if i % 2 != 0:
        continue
    elif not (i % 3 == 0 or i % 5 == 0):
        print("DENIED")
        exit()
print("APPROVED")

Submission status: Accepted

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

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


print('APPROVED')

Submission status: Accepted

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

for i in x :
    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())

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

boolian = True

for i in range(N):
    if an[i] % 2 == 0:
        if an[i] % 3 ==0 or an[i] % 5 ==0:
            boolian = True
        else:
            boolian = False
            break
if boolian == False:
    print('DENIED')
    
if boolian == True:
    print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
S = list(map(int,input().split()))
B= list()
X = list()
for i in S:
    if i % 2== 0:
        B.append(i)
for n in B:
    if n % 3 == 0 or n % 5 == 0:
        X.append(n)
if len(B) == len(X):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

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

flg = True
for a in al:
    if a%2 == 0:
        if a%3 == 0 or a%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()))

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:
num_num = int(input())
numbers = list(map(int, input().split()))
numbers_even = []

for i in range(num_num):
    if numbers[i] % 2 == 0:
        numbers_even.append(numbers[i])
    else:
        pass
i = 1
for even in numbers_even:
    if even % 3 == 0 or even % 5 == 0:
        i += 1
        if i == num_num:
            break
    else:
        print("DENIED")
        exit()

print("APPROVED")

Submission status: Accepted

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

for i in range(N):
    if A[i] % 2 == 0:
        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()))
print("APPROVED" if all(i % 5 == 0 or i % 3 == 0 for i in a if i % 2 == 0) else "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:
        result = 'No'
        break
    else:
        result = 'Yes'

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

Submission status: Accepted

Solution code:
ri = lambda S: [int(v) for v in S.split()]
def rii(): return ri(input())

N = int(input())
A = [v for v in rii() if v % 2 == 0]

print("APPROVED" if all(v % 3 == 0 or v % 5 == 0 for v in A) else "DENIED")

Submission status: Accepted

Solution code:
input()
A=list(map(int,input().split()))
print("APPROVED" if all(a&1 or a%3==0 or a%5==0 for a in A) else "DENIED")

Submission status: Accepted

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

for n in range(N):
    if A[n]%2 == 0:
        List.append(A[n])


for n in range(len(List)):
    if List[n] % 3 == 0:
        pass
    elif List[n] % 5 == 0:
        pass
    else:
        flag += 1
        break

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

Submission status: Accepted

Solution code:
a=int(input())
b=list(map(int,input().split()))
c=0
for i in range(a):
  if b[i]%2==0:
    if b[i]%3==0 or b[i]%5==0:
      c=c+1
  else:
    c=c+1
if c==a:
  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:
        if a%3 != 0 and a%5 != 0:
            ans = 'DENIED'

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
counts_number = int(input())
tmp_map = map(int, input().split())
num_list = list(tmp_map)
even_of_num_list = []
approve_counts = 0

for i in num_list:
    if i % 2 == 0:
        even_of_num_list.append(i)

for x in even_of_num_list:
    if x % 3 == 0 or x % 5 == 0:
        approve_counts += 1

if approve_counts == len(even_of_num_list):
    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 or A[i] % 5 ==0:
      pass
      if i == N-1:
        print('APPROVED')
      else:
        pass
    else:
      print('DENIED')
      break
  else:
    if i == N-1:
      print('APPROVED')
    else:
      pass

Submission status: Accepted

Solution code:
N=input()
A=input()
Alist=A.split()
counts=0
for i in Alist:
    if int(i)%2==1:
        counts=counts
    elif int(i)%3==0:
        counts=counts
    elif int(i)%5==0:
        counts=counts
    else:
        counts=counts+1
if counts>=1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
N = input()

a =  list(map(int,input().split()))
b = 0
c = 0
for i in range(len(a)):
    if a[i] % 2 == 0:
        b+=1
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            c+=1
if b == c:
    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(map(int,input().split()))
b=0
c=0
for i in range(len(a)):
  if a[i]%2==0:
    b+=1
    if a[i]%3==0 or a[i]%5==0:
      c+=1
if b==c:
  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'
      break
      
print(ans)

Submission status: Accepted

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

a = [x for x in a if x % 2 == 0]
a = [x for x in a if x % 3 != 0 and x % 5 != 0]

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    def judge():
        for x in A:
            if x % 2 == 0:
                if (x % 3 != 0) and (x % 5 != 0):
                    return False
        return True

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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


i = 0

for i in range(len(A)):
    if (A[i] % 2 != 0 or (A[i] % 3 == 0 or A[i] % 5 == 0)):
        continue
    else:
        print('DENIED')
        exit()


print('APPROVED')

Submission status: Accepted

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


i = 0

for i in range(len(A)):
    if (A[i] % 2 == 0):
        if A[i] % 3 != 0 and A[i] % 5 != 0:
            print('DENIED')
            exit()
        else:
            continue
    else:
        continue

print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())

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

for i in range(N):
    if A_list[i] % 2 == 0:
        if A_list[i] % 3 == 0 or A_list[i] % 5 == 0:
            continue
        else:
            print("DENIED")
            exit()

if i == N-1:
    print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
flag=0
for i in range(n):
  if A[i]%2==0:
    if A[i]%3!=0 and A[i]%5!=0:
     flag=1

if flag==0:
  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 and A[i] % 5 != 0):
            count += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

Solution code:
N=int(input())
S=[int(s) for s in input().split()]
for i in range(N):
    if S[i]%2==0 and S[i]%5!=0 and S[i]%3!=0:
        print("DENIED")
        break
    elif i==N-1:
        print("APPROVED")

Submission status: Accepted

Solution code:
# coding: utf-8

num = int(input())
number = input().split()
count, count2 = 0, 0
table = list(number)
for i in number:
    if int(i) % 2 == 0:
        count += 1
        if int(i) % 3 == 0 or int(i) % 5 == 0:
            count2 += 1

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

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
f=0
for i in l:
    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:
N = int(input())
A = list(map(int,input().split()))

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

Submission status: Accepted

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

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        print("DENIED")
        exit()
print("APPROVED")

Submission status: Accepted

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

def even(num, l):
    if num % 2 == 0:
        l.append(num)
        
B = []
for num in A:
    even(num, B)
    
C = []
for nn in B:
  if nn % 3 != 0 and nn % 5 != 0:
    C.append(nn)
    
if len(C) == 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:
    continue
  if (i % 3 == 0) or (i % 5 == 0):
    continue
  ans = "DENIED"
  break
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
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")
            sys.exit()
print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
x = list(map(int,input().split()))
for i in x:
  if i%2==0:
    if i%6!=0:
      if i%10!=0:
        print("DENIED")
        exit()
print("APPROVED")

Submission status: Accepted

Solution code:
import sys
n = int(input())
A = list(map(int, input().split()))
for a in A:
  if a%2 == 0:
    if (a%3 == 0) or (a%5 == 0):
      pass
    else:
      print("DENIED")
      sys.exit()
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])

cnt=0
for i in range(len(B)):
    if B[i]%3==0 or B[i]%5==0:
        cnt+=1
if cnt==len(B):
    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()))
res = "APPROVED"
for i in A:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      res = "DENIED"
print(res)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    is_ok = True

    for a in a_lst:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                is_ok = False

    if is_ok:
        ans = "APPROVED"
    else:
        ans = "DENIED"

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
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:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

X = [x for x in N_List if x % 2 ==0]
Y = [y for y in X if y % 3 ==0 or y % 5 ==0]

if len(X) == len(Y):
    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')