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 resolve():
    N = int(input())
    A = list(map(int, input().split()))

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

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = 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")
            break
else:
    print("APPROVED")

Submission status: Accepted

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

    a = list(filter(lambda x: (x%2 == 0), A))

    if all(x%3 == 0 or x%5 == 0 for x in a):
        print("APPROVED")
    else:
        print("DENIED")

main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

def InMap(): return list(map(int, sys.stdin.readline().split(' ')))
def In(): return int(sys.stdin.readline())
def InS(): return sys.stdin.readline()

N = In()
A = InMap()

res = False
for num in A:
    if(num % 2 == 1):
        continue
    if(num % 3 != 0 and num % 5 != 0):
        res = True

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

    print('APPROVED')

resolve()

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

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

count = 0
ans = 0
for i in range(N):
  if A[i] % 2 == 0:
    count += 1
  if A[i] % 6 == 0 or A[i] % 10 == 0:
    ans += 1

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

Submission status: Accepted

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


for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            continue
        else:
            print('DENIED')
            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 or a[i] % 5 == 0:
            pass
        else:
            print("DENIED")
            exit() 
        
print("APPROVED")

Submission status: Accepted

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

flg = False

for a in a_list:
  if a%2==0:
    if a%3!=0 and a%5 !=0:
      flg = True
      break

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

Submission status: Accepted

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

for i in a_list:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      ans = "DENIED"

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    N = int(input())
    A = list(map(int, list(input().split())))
    flag = True

    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                flag=True
            else:
                flag=False
                break

    if flag == True:
        print('APPROVED')
    else:
        print('DENIED')
    pass

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

N=int(input())

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

N = int(input().split()[0])
a_list = list(map(int, input().split()))
e_list = [a for a in a_list if a % 2 == 0]

if not e_list:
    ans = "APPROVED"
else:
    ee_list = [e for e in e_list if e % 3 == 0 or e % 5 == 0]
    ans = "APPROVED" if len(ee_list) == len(e_list) else "DENIED"

print(ans)

Submission status: Accepted

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

ans = "APPROVED"
for i in l:
    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 i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            print('DENIED')
            exit(0)
print('APPROVED')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    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)


main()

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:
            flag = True
        elif i%5 == 0:
            flag = True
        else:
            flag = False
            break
            
if flag:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

flag = 1

for i in a:
    if i%2 == 0:
        if i%3 == 0:
            pass
        elif i%5 == 0:
            pass
        else:
            flag = 0

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
def main():
    N=int(input())
    A=list(map(int,input().split()))
    flag=True
    for i in range(N):
        if A[i]%2==0:
            if A[i]%3==0 or A[i]%5==0:
                pass
            else:
                flag=False
                break
    if flag:
        print("APPROVED")
    else:
        print("DENIED")
if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=int(input())
N=map(int,input().split())
guu=[]
wari=[]
for i in N:
    if i%2==0:
        guu.append(i)
        if i%3==0 or i%5==0:
            wari.append(i)
        else:
            print('DENIED')
            exit()
print('APPROVED')

Submission status: Accepted

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


flag = False
for count in range(0,N):
    if A[count] % 2 == 0:
        if A[count] % 3 != 0 and A[count] % 5 != 0:
            flag = True

if flag == False:
    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(len(a)):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            pass
        else:
            print("DENIED")
            sys.exit(0)
print("APPROVED")

Submission status: Accepted

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

print(s)

Submission status: Accepted

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

def check():
    for a in A:
        if a%2 == 0 and not(a%3 == 0 or a%5 == 0):
            print("DENIED")
            return

    print("APPROVED")
        
check()

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

Submission status: Accepted

Solution code:


#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = 'APPROVED'
no = 'DENIED'

def main():
    n = ii()
    a = li()
    for i in range(n):
        flag = False
        if not a[i] %2:
            if not a[i] %3:
                flag = True
            if not a[i] %5:
                flag = True
        else:
            flag = True
        if not flag:
            print(no)
            exit()
    print(yes)
    
main()

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

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] % 3 == 0 or a[i] % 5 ==0:
      pass
    else:
      print("DENIED")
      break

  if i == len(a) -1:
    print("APPROVED")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 無限 #####
# inf = float('inf')

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')

def main():
	N = inputInt()
	A = inputList()

	flg = False

	for i in A:
		if i % 2 == 0:
			if i % 3 == 0 or i % 5 == 0:
				pass
			else:
				flg = True

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

if __name__ == "__main__":
	main()

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:
        continue
    else:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            continue
        else:
            ans = 'DENIED'

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())
a = list(map(int,input().split()))
b = len([x for x in a if x % 2 == 0 and x % 3 > 0 and x % 5 > 0])
if b == 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
else:
    print("APPROVED")

Submission status: Accepted

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

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

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):
        continue
    else:
        if(A[i] % 3 != 0 and A[i] % 5 != 0):
            flag = 1
            break
if(flag == 0): 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"
            break

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(n):
    if l[i]/2==l[i]//2:
        if l[i]/3!=l[i]//3 and l[i]/5!=l[i]//5:
            print("DENIED")
            break

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

Submission status: Accepted

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

    flag = True
    for i in range(N):
        if A[i] % 2 == 0:
            if A[i] % 3 == 0 or A[i] % 5 == 0:
                pass
            else:
                flag = False

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


if __name__ == '__main__':
    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 a[i]%3!=0 and a[i]%5!=0:
            print("DENIED")
            sys.exit()

print("APPROVED")

Submission status: Accepted

Solution code:
import sys

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

for a in arr:
    if a % 2 == 0:
        if a % 3 == 0:
            continue
        elif a % 5 == 0:
            continue
        else:
            print('DENIED')
            sys.exit()
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
#一行で入力された数値をリストに
flag = True
for i in range(n):
    if(not a[i]%2 == 1 and not a[i]%3 == 0 and not a[i]%5 == 0):
        flag = False

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

Submission status: Accepted

Solution code:
N = int(input())

for x in map(int, input().split()):
    if x % 2 == 0:
        if x % 3 != 0 and x % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
# python3
# -*- coding: utf-8 -*-
import sys
import math
#from math import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)


# main
n = ii()
a = mis()

for aa in a:
    if aa%2==0:
        if aa%3==0 or aa%5==0:
            pass
        else:
            print('DENIED')
            exit(0)

print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    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")
            return
    print("APPROVED")

if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

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

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 == 1 :
        continue
    if a[i] % 3 == 0 or a[i] % 5 == 0 :
        continue
    ans = False

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

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

Submission status: Accepted

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

for i in l:
  if i%2==0:
    if i%3==0 or i%5==0:
      flag*=1
    else:
      flag*=0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

approved = True
for i in range(N):
    if As[i] % 2 == 0:
        if As[i] % 3 != 0 and As[i] % 5 != 0:
            approved = False
            break
if approved:
    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%5 != 0 and i%3 !=0):
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
n=int(input())
alist=list(map(int,input().split()))
check=True
for a in alist:
  if a%2==0:
    if a%3!=0 and a%5!=0:
      check=False
if check:
  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(len(A)):
    if A[i] % 2 == 0:
        if (A[i] % 3 != 0 and A[i] % 5 != 0):
            flg = 1
if flg == 0:
    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(n):
    if a[i] % 2==0:
        if a[i] % 3==0 or a[i] % 5==0:
            ans=0
        else:
            ans=1
            break
if ans==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 or a % 5 == 0:
            N -= 1
    else:
        N -= 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
flag = True
A = list(map(int, input().split()))
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            flag = False
    else:
        continue
if flag:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = [int(i) for i in input().split()]

flag = True
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            flag = False
if flag:
    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 not(i % 3 == 0 or i % 5 ==0):
            print ('DENIED')
            exit (0)
print ('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
for i in range(n):
    if A[i] % 2 == 0:
        if 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()))

for i in a:
    if i % 2 != 0:
        continue
    if i % 3 == 0 or i % 5 == 0:
        continue
    print('DENIED')
    exit()
print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def A():
    A, B, C = map(int, input().split())
    if A == B or B == C or A == C:
        if (A+B+C) != A*3:
            print('YES')
            return
    print('NO')

def B():
    N = int(input())
    A = [int(i) for i in input().split()]
    for i in A:
        if i%2==0 and not (i%3==0 or i%5==0):
            print('DENIED')
            return
    print('APPROVED')
B()

Submission status: Accepted

Solution code:
import sys

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

for m in mylist:
    if m%2 == 0:
      if m%3 == 0:
          continue
      elif m%5 == 0:
          continue
      else:
          print('DENIED')
          sys.exit()
print('APPROVED')

Submission status: Accepted

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

flag = True
for i in range(n):
  if a[i] % 2 == 0:
    if a[i] % 3 == 0 or a[i] % 5 == 0:
      pass
    else:
      flag = False
if flag:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
import sys

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

    for x in X:
        if x % 2 == 1:
            continue

        if x % 3 != 0 and x % 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()))

ans = 'DENIED'
for Ai in A:
    if Ai % 2 > 0: continue
    #
    if Ai % 3 > 0 and Ai % 5 > 0: break
    else: continue
else:
    ans = 'APPROVED'

print(ans)

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 i % 3 == 0 or i % 5 == 0:
            continue
        else:
            break
    else:
        continue
else:
    print('APPROVED')
    exit()

print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
import time
# import itertools

mod = int(1e9+7)
INF = 1<<29

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

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

Submission status: Accepted

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

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())
lst = map(int, input().split())

gu = [l for l in lst if l%2==0]

flag = True
for g in gu:
    if (g%3 == 0) or (g%5 == 0):
        continue
    else:
        flag = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = [int(i) for i in input().split()]
  
f = True
for i in l:
  if i % 2 == 0:
    if not (i % 3 == 0 or i % 5 ==0):
      f = False
      break
      
if f:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
N = int(raw_input())
A = map(int, raw_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())
A = [int(x) for x in input().split()]
count = 0

for x in A:
    if x % 2 == 0:
        if x % 3 == 0 or x % 5 == 0:
            count += 1
    else:
        count += 1

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math
import itertools
#n = int(input())
#n, d = list(input().split())
#n, l = list(map(int, input().split()))
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")
            exit()

print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

def main():
	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)
	
	
	
	
	
	
	
	




	
if __name__ == "__main__":
	main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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