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())
l=[]
a=[]
b=[]
for i in range(n):
    m=[int(j) for j in input().split()]
    
    for k in m:
        if k%2==0:
            l.append(k)
    
    for p in l:
        if p%3==0 or p%5==0:
            a.append(p)
        else:
            b.append(p)
 
    if len(a)==len(l):
        print("APPROVED")
    else:
        print("DENIED")
    break

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:
# ABC 155: B – Papers, Please
N = int(input())
A = [int(s) for s in input().split()]

result = 'APPROVED'

for n in A:
    if n % 2 == 0:
        if n % 3 != 0 and n % 5 != 0:
            result = 'DENIED'
            break

print(result)

Submission status: Accepted

Solution code:
import sys
x = int(input())
num = list(map(int, input().split()))
test = []
count = 0

for i in num:
  if(i % 2 == 0):
    test.append(i)

for i in test:
  if(i % 3 != 0 and i % 5 != 0):
    print('DENIED')
    count += 1
    sys.exit()

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

Submission status: Accepted

Solution code:
n=int(input())
List=(list(map(int,input().split())))
l=len(List)
count=0

for i in range(l):
    if List[i]%2!=0:
        count+=1
    elif List[i]%2==0:
        if List[i]%3==0 or List[i]%5==0:
            count+=1

if count==len(List):
    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

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

Submission status: Accepted

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

main()

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)==False:
            flag=False
if flag:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:

url = "https://atcoder.jp//contests/abc155/tasks/abc155_b"

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

    for val in t:
        if val % 2 == 0:
            flg = False
            if val % 3  == 0:
                flg = True
            elif val % 5  == 0:
                flg = True

            if not flg:
                print('DENIED')
                exit()
    print('APPROVED')
    exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
try:
  a = list(map(int,input().split()))
  a1 = list(i for i in a if i%2==0)
  a2 = list(i for i in a1 if i%3!=0)
  a3 = list(i for i in a2 if i%5!=0)
except EOFError:
  pass
if len(a3) == 0:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 'APPROVED'
for x in a:
    if x % 2 == 1:
        continue
    if not (x % 2 == 0 and (x % 3 == 0 or x % 5 == 0)) :
        ans = 'DENIED'
print(ans)

Submission status: Accepted

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

B = []
for a in A:
  if a%2 == 0:
    B.append(a)

cnt = 0
for b in B:
  if b%3 == 0 or b%5 == 0:
    cnt += 1
if cnt == len(B):
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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



isFlg = True

for val in line:
    if val %2 == 0:

        if val % 3  != 0 and  val % 5  != 0:
            isFlg = False

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

nums = input().rstrip().split(' ')

even_num = []
for i in range(N):
    if int(nums[i]) % 2 == 0:
        even_num.append(int(nums[i]))

count = 0
for j in range(len(even_num)):
    if int(even_num[j]) % 3 == 0 or int(even_num[j]) % 5 == 0:
        count += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

approve = True

for a in A_list:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            approve = False
            break

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

Submission status: Accepted

Solution code:
N = int(input())


def read(): return list(map(int, input().split()))


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

Submission status: Accepted

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

ans = True
for a in A:
    if a%2 == 0 and a%3 != 0 and a%5 != 0:
        ans = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
broke = False
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 6 != 0 and A[i] % 10 != 0:
            print('DENIED')
            broke = True
            break
if broke == False:
    print('APPROVED')

Submission status: Accepted

Solution code:
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No"):
    print([yes, no][not v])


def main():
    """エントリーポイント"""
    N = input(int)
    A = input([int, N])
    yesno(all([a % 2 == 1 or (a % 3 == 0 or a % 5 == 0)
               for a in A]), "APPROVED", "DENIED")


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

# calc 
ans = True
for a in A:
    if( a%2 == 0 ):
        mod3 = a%3
        mod5 = a%5
        if( mod3 == 0 or mod5==0 ):
            continue
        else:
            ans = False

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    a_list = [a for a in a_list if a % 2 == 0]
    ans = 'APPROVED'
    for a in a_list:
        if a % 3 != 0 and a % 5 != 0:
            ans = 'DENIED'
            break
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    _ = ii()
    L = lmi()
    print('APPROVED') if all(map(lambda x: x%2==1 or x%6==0 or x%10==0, L)) else print('DENIED')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    print('APPROVED' if all([a % 3 == 0 or a % 5 == 0 for a in A if a % 2 == 0]) else 'DENIED')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
class atcoder:
    N=int(input())
    A=[]
    A=list(map(int,input().split()))
    ans=0
    n=0
    for i in range(len(A)):
        if A[i]%2==0:
            n+=1
            if A[i]%3==0 or A[i]%5==0:
                ans+=1
            else:
                pass
        else:
            pass
    if n==ans:
        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()))
b = []
for i in range(n):
    if a[i] % 2 == 0:
        b.append(a[i])

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

print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x in 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())
nums=list(map(int,input().split()))
permit=True
for num in nums:
  if num % 2==0:
    if num % 3 !=0 and num % 5 != 0:
      permit=False
  else:
    pass
if permit:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
A = rl()

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:
def main():
  n = int(input())
  data = list(map(int, input().split()))

  for d in data:
    if d % 2 == 0:
      if d % 3 == 0 or d % 5 == 0:
        pass
      else:
        print("DENIED")
        return      
  
  print("APPROVED")


if __name__ == "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    sta = True
    A = [int(a) for a in input().split()]
    for i in range(N):
        if A[i] % 2 == 0:
            if A[i] % 3 == 0 or A[i] % 5 == 0:
                pass
            else:
                sta = False
    if sta:
        print("APPROVED")
    else:
        print("DENIED")
main()

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


def check(N,A):
    flg = True

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

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



            

N,A = nyu()
check(N,A)

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
B = []
for i in A:
  if i%2 == 0:
    B.append(i)
count = 0
for j in B:
  if j%3 == 0 or j%5 == 0:
    count = count + 1
if count >= len(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: #奇数
    continue;
  else: #偶数
    if i % 5 == 0 or i % 3 == 0:
      continue;
    else:
      print("DENIED");
      break;
else:
  print("APPROVED");

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 and a[i] % 3 != 0 and a[i] % 5 != 0:
        ans = False
        break

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

Submission status: Accepted

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

if judge == 0:
    print('APPROVED')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
A_even = [a for a in A if a%2 == 0]
flag = True
for a in A_even:
    if a%3 != 0 and a%5 != 0:
        flag = False
        break
if flag:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n=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 = list(map(int, input().split()))
flg = True
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            pass
        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 a:
    if (i%2 == 0) and (i%3 != 0 and i%5 != 0):
        print("DENIED")
        exit()

print("APPROVED")

Submission status: Accepted

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

#https://atcoder.jp/contests/abc155/tasks/abc155_b
length = int(input())
a = [int(i) for i in input().split()]

Answer = "APPROVED"
for i in set(a):
	if (i%2==1):
		continue
	elif(i%5==0 or i%3==0):
		continue
	else:
		Answer = "DENIED"
		break

print(Answer)

Submission status: Accepted

Solution code:
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''

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

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:
            continue
        else:
            flag = False
            break
    else:
        continue

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    for n in nums:
        if n%2==0 and n%3!=0 and n%5!=0:
            print("DENIED")
            return
    print("APPROVED")
    return

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=input()
a=[int(i) for i in input().split() if int(i)%2==0]
print('APPROVED' if len([i for i in a if (i%3)*(i%5)!=0])<=0 else 'DENIED')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
list_input_str = []
evenNumber = []
num = []
a = []

for i in range(2):
    s = input()
    if s:
        list_input_str.append(s)

if list_input_str:
    num = list_input_str[0]
    a = list_input_str[1].split(' ')

for i in range(int(num)):
    if int(a[i]) % 2 == 0:
        evenNumber.append(a[i])

if len(evenNumber) == 0:
    print('APPROVED')
else:
    for i in range(len(evenNumber)):
        if not (int(evenNumber[i]) % 3 == 0 or int(evenNumber[i]) % 5 == 0):
            print('DENIED')
            break
        else:
            if i == int(len(evenNumber)) - 1:
                print('APPROVED')

Submission status: Accepted

Solution code:
N=input()
ans=sum([ (a%2==0 and a%3*a%5 != 0) for a in map(int,input().split()) ])
print(('APPROVED','DENIED')[ans > 0])

Submission status: Accepted

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

Submission status: Accepted

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

print("APPROVED")

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    A = list(map(int, input().split()))
    s = 0
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                s += 1
        else:
            s += 1
    if s == n:
        print("APPROVED")
    else:
        print("DENIED")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list((int(x) for x in input().split()))
for num in a:
  if num%2 == 0:
    if num%3 != 0 and num%5 != 0:
      print('DENIED')
      exit()
print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
a=list(map(int,input().split()))
b=[]
c="DENIED"
d=[]

for i in a:
  if i%2 == 0:
    b.append(i)
    
for j in b:
  if j%3 == 0 or j%5 == 0:
    d.append(j)
    
if b == d:
  c = "APPROVED"

print(c)

Submission status: Accepted

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

for i in a:
    if i % 2 == 0:
        b.append(i)

for s in b:
    if s % 3 == 0 or s % 5 == 0:
        c.append(True)

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
for i in range(0, 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:
# Useful data structures

# For sys.std*, sys.argv etc...
import sys

# For cases when input tokens are spread unevenly over many lines.
# This provides methods for reading tokens of various types.
class BufferedTokenizer:
    pass

def read_ints():
    return [int(token) for token in input().split()]

def read_tokens():
    return input().split()

def main():
    read_ints()
    approved = all(any(n % d == r for (d, r) in [(2, 1), (3, 0), (5, 0)])
                    for n in read_ints())
    print("APPROVED" if approved else "DENIED")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if len(lista)==len(listanova):
	print('APPROVED')
else:
	print('DENIED')

Submission status: Accepted

Solution code:
n = int(input())
a = list(input().split())
evena = [s for s in a if int(s) % 2 == 0]
divide3or5 = [s for s in evena if (int(s) % 3 == 0) | (int(s) % 5 == 0)]
if len(evena) == len(divide3or5):
  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
        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(map(int, input().split()))
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0:
            if a[i] % 5 != 0:
                print("DENIED")
                exit()
        if a[i] % 5 != 0:
            if a[i] % 3 != 0:
                print("DENIED")
                exit()
print("APPROVED")

Submission status: Accepted

Solution code:
#B

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

ans = "APPROVED"

for a in A:
  if a%2==0:
    if a%3==0 or a%5==0:
      pass
    else:
      ans = "DENIED"

print(ans)

Submission status: Accepted

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

for i in Ai:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      print('DENIED')
      exit()

print('APPROVED')

Submission status: Accepted

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

flag = False
for i in Ai:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      flag = True
      print('DENIED')
      break

if(not flag):
  print('APPROVED')

Submission status: Accepted

Solution code:
def f(a):
    for i in a:
        if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
            print('DENIED')
            break
    else:
        print('APPROVED')

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

Submission status: Accepted

Solution code:
def f(a):
    for i in a:
        if i % 2 == 1:
            pass
        elif i % 2 == 0 and (i % 3 == 0 or i % 5 == 0):
            pass
        else:
            print('DENIED')
            break
    else:
        print('APPROVED')

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
for i in 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()))
count, check = 0, 0
for i in A:
    if i%2 == 0:
        count += 1
        if i%3 == 0 or i%5 == 0:
            check += 1
if count == check:
	print('APPROVED')
else:
	print('DENIED')

Submission status: Accepted

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