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:
# print('input >>')
N = int(input())
As = list(map(int,(input().split())))
As_even = [e for e in As if e % 2 == 0]

for A in As_even:
    if not(A % 3 == 0 or A % 5 == 0):
        print('DENIED')
        exit()
        
# print('-----output-----')
print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
numlist = [int(i) for i in input().split()]
oddnum = [j for j in numlist if j%2 == 0]
checknum = [k for k in oddnum if k%3 == 0 or k%5 == 0]
if len(oddnum) == len(checknum) :
    print("APPROVED")
else :
    print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

approvedFlag = True

for a in A:
	if a%2 == 0:
		if (a%3!=0) and (a%5!=0):
			approvedFlag = False
			break

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

Submission status: Accepted

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


if __name__ == '__main__':
    resolve()

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

Submission status: Accepted

Solution code:
n = int(input())
a = map(int, input().split())
is_ok = True
for num in a:
    if num % 2 == 0:
        if num % 3 == 0 or num % 5 == 0:
            # print('ok', num)
            continue
        else:
            # print('ng', num)
            is_ok = False
            break

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:



N = int(input())
A = list(map(int, input().split()))
approved = True
for i in range(N):
    a = A[i]
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            approved = False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

ans = 'APPROVED'
for i in range(N):
    if A[i] % 2 == 1:
        continue
    if A[i] % 3 != 0 and A[i] % 5 != 0:
        ans = 'DENIED'
        break

print(ans)

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

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())
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:
n = int(input())
a = [int(x) for x in input().split()]
ans = []
for i in a:
  if i % 2 == 0:
    ans.append(i)

for i in ans:
  if i %3 == 0 or i %5 ==0:
    pass
  else:
    print('DENIED')
    quit()

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()
  else:
    continue
print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    A = LIST()

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

    print("APPROVED")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

flg = 0
for i in range(n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      pass
    else:
      flg=1
      print('DENIED')
      break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3.4
# -*- coding: utf-8 -*-
# abc155/abc155_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    A = i2nn()
    for a in A:
        if a % 2 == 0 and (a % 3 and a % 5):
            print('DENIED')
            return
    else:
        print('APPROVED')
    return

main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    a = [int(i) for i in input().split()]
    count = 0


    for i in a:
        if i % 2 ==0:
            if i % 3 == 0 or i % 5 ==0:
                count = count
            else:
                count = count +1
    if count > 0:
        print("DENIED")
    else:
        print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x 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
            break

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

Submission status: Accepted

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

def func(A):
    for a in A:
        #print(a)
        if a % 2 != 0: continue
        if a % 3 == 0 or a % 5 == 0: continue
        return 'DENIED'
    return 'APPROVED'

print(func(A))

Submission status: Accepted

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

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

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()))
flag = True
for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            flag = False
            break

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

Submission status: Accepted

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

for a in a_list:
    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())
a = [int(x) for x in input().split()]
flg = 'APPROVED'
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            flg = 'DENIED'
print(flg)

Submission status: Accepted

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

flg = 1
for a in A:
    if a%2 == 0:
        if not (a%3 == 0 or a%5 == 0):
            flg = 0

if flg:
    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())
lista = list(map(int, input().split()))
c = 0
for i in lista:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            c += 1
            break
if c == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
import sys #sys.stdin.readline()
import heapq #heap
from collections import defaultdict
fastinp = lambda: sys.stdin.readline().split(' ')
inp = lambda: input().split(' ')
ml = lambda x, y=int: list(map(y, x))
debug = lambda *args: print(*args, sep=' | ')
n = int(inp()[0])
nums = ml(inp())
flag = True
for num in nums:
    if num%2 == 0:
        if num%3 == 0 or num%5 == 0:
            continue
        else:
            flag = False
            break
if not flag:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
n=int(input())

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

print(ans)

Submission status: Accepted

Solution code:
_ = input()
a = list(map(int, input().split()))
ans = 'APPROVED'
for num in a:
    if num % 2 == 0:
        if num % 3 == 0:
            continue
        elif num % 5 == 0:
            continue
        else:
            ans = 'DENIED'
            break

print(ans)

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 and a[i] % 5 != 0):
            ans += 1
            break
if (ans == 0):
    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()))

    for x in A:
        if x % 2 == 0:
            if (x % 3 == 0) or (x % 5 == 0):
                continue
            else:
                print('DENIED')
                quit()

    print('APPROVED')





if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

if flag == 0:
    print("DENIED")
else:
    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())
la = list(map(int, input().split()))

ans = True

for a in la:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            ans = False

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

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

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

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

def cond():
    for v in a:
        if v % 2 == 0 and (v % 3 != 0 and v % 5 != 0):
            return False
    return True

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

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 not (A[i] % 3 == 0 or A[i] % 5 == 0): flag = False
  if not flag: break
if flag:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
def main(n, a):
    for i in a:
        if i % 2 == 0:
            if i % 3 != 0 and i % 5 != 0:
                print("DENIED")
                return

    print("APPROVED")


if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    main(n, a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())


# a,b,c=map(int,input().split())

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

flg=True
for i in a:
    if i%2==0:
        if not (i%3==0 or i%5==0):
            flg=False;break
        else:
            flg=True
    


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

Submission status: Accepted

Solution code:
n=int(input())
a=[int(x) for x in input().split()]
flag=1
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            continue 
        else:
            flag=0
            break
if flag==1:
    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:
            continue
        else:
            print('DENIED')
            exit()

print('APPROVED ')

Submission status: Accepted

Solution code:
N = input()
AN = input().split()
AN = [int(a) for a in AN if int(a) % 2 == 0]
den = [a for a in AN if a % 3 != 0 and a % 5 != 0]


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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    As = list(map(int, input().split(" ")))

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input().rstrip())
As = map(int, input().rstrip().split(" "))

response = "APPROVED"

for a in As:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            response = "DENIED"
            break

print(response)

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")
        break
else:
    print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in nList:
  if i % 2 == 0:
    if i % 3 == 0 or i% 5 == 0:
      pass
    else:
      print("DENIED")
      exit(0)

print("APPROVED")

Submission status: Accepted

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

if len([x for x in nums if (x % 2 == 0) and (x % 3 > 0 and x % 5 > 0)]) >= 1:
	print("DENIED")
else:
	print("APPROVED")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from collections import deque

def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

even = [a for a in a_list if a % 2 == 0]
result = True
for num in even:
    if num % 3 > 0 and num % 5 > 0:
        result = False

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

Submission status: Accepted

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

ans = "APPROVED"
for i in range(n):
    if A[i] % 2 == 0 and A[i] % 5 != 0 and A[i] % 3 != 0:
        ans = "DENIED"
        break

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc155/tasks/abc155_b

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

Submission status: Accepted

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

N = int(input())
A = [int(i) for i in 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())

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

even_list = [i for i in ss if i % 2 == 0]

res = 0

for i in even_list:
  if i % 3 == 0:
    res += 1
  elif i % 5 == 0:
    res += 1
if res == len(even_list):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

import sys
import math
import itertools

def main():
    n = int(sys.stdin.readline())
    xs = map(int, sys.stdin.readline().split())

    for x in xs:
        if x % 2 == 0 and (x % 3 != 0 and x % 5 != 0):
            print('DENIED')
            return
    print('APPROVED')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N = I()
    a = LI()
    cnt = 0

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

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


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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
a_list = list(map(int, input().split()))
flag = 1
for a in a_list:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            flag = 1
        else:
            flag = 0
            break
if flag == 1:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

a = [i for i in a if i%2 == 0]

ans = "APPROVED"
for i in a:
  if i%5 != 0 and i%3 != 0:
    ans = "DENIED"
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = map(int, input().split())
    if all(x % 3 == 0 or x % 5 == 0 for x in a if x % 2 == 0):
        print('APPROVED')
    else:
        print('DENIED')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

flag = True

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i 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()))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

Solution code:
N=input()
A = map(int, input().split())
B=filter(lambda x: x % 2 == 0,A)
for b in B:
  if b%3==0 or b%5==0:
    continue
  print('DENIED')
  break
else:
  print('APPROVED')

Submission status: Accepted

Solution code:
from sys import stdin

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())
    A = [int(x) for x in stdin.readline().rstrip().split()]
    result = 'APPROVED'
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                result = 'DENIED'
                break
    print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


for i in range(N):
    if A[i]%2 ==0:
        n += 1
        if A[i]%3 ==0 or  A[i]%5 ==0:
            count += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(n,a):
    for i in range(len(a)):
        if a[i] % 2 != 0:
            continue
        else:
            if (a[i] % 3 == 0) or (a[i] % 5 == 0):
                continue
        return False
    return True

n = int(input())
a = list(map(int, input().split()))
print("APPROVED" if main(n,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:
    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()))
ans = "APPROVED"
b=0
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())
li = list(map(int,input().split()))
cnt1, cnt2 = 0,0
for i in li:
    if i % 2 == 0:
        cnt1 += 1
        if i % 3 == 0 or i % 5 == 0:
            cnt2 += 1
if cnt1==cnt2:
    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 or a % 5 == 0:
            continue
        else:
            ans = 'DENIED'
            break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

alist = map(int,input().split())

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

print("APPROVED")

Submission status: Accepted

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