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:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

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



if __name__ == '__main__':
    main()

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())
A = 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:
import sys
range = xrange
input = raw_input

n = int(input())

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

B = [a for a in A if a&1 == 0]

if B == [b for b in B if b%3 == 0 or b%5 == 0]:
    print 'APPROVED'
else:
    print 'DENIED'

Submission status: Accepted

Solution code:

N = int(input())

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

flag = "APPROVED"

for i in range(N):

    if A[i] % 2 == 0 and A[i] % 3 != 0 and A[i] % 5 != 0:
        flag = "DENIED"
        break

print (flag)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    for a in A:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                return 'DENIED'
    return 'APPROVED'


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

        if x % 3 == 0 or x % 5 == 0:
            continue

        print('DENIED')
        return

    print('APPROVED')


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

Submission status: Accepted

Solution code:
# ABC155b


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    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:
                print('DENIED')
                exit(0)
    print('APPROVED')


if __name__ == '__main__':
    main()

Submission status: Accepted

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


main()

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    wari = True
    for ix, a in enumerate(A):
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                continue
            else:
                wari = False
                break
    if wari:
        print("APPROVED")
    else:
        print("DENIED")
main()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
def main():

    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):
            return "DENIED"
    return "APPROVED"


if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

print('APPROVED' if all(a%2==1 or (a%3==0 or a%5==0) for a in A) else 'DENIED')

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
flag = True
for i in a:
    if i % 2 == 1:
        continue
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    flag = False

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n = ni()
a = na()
for ai in a:
    if ai % 2 == 0 and ai % 3 != 0 and ai % 5 != 0:
        print("DENIED")
        quit()
print("APPROVED")

Submission status: Accepted

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


def check(A):
    for a in A:
        if a % 2 == 1:
            continue
        if a % 3 == 0 or a % 5 == 0:
            continue
        return False
    return True


if check(A):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

from collections import deque, defaultdict
import itertools as ite
import sys
import math
from decimal import *

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

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

flag = True

for a in arr:
    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:
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    vn = vk = vn_k = 1
    for i in range(1, n+1):
        vn = vn * i % modp
        if i == k:
            vk = vn
        if i == n-k:
            vn_k = vn
    return vn * get_inv(vk, modp) * get_inv(vn_k, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

def main():
    N=ii()
    A=lmis()
    print('APPROVED' if all(a%3==0 or a%5==0 for a in A if a%2==0) else 'DENIED')

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=map(int,input().split())
p=1
for i in a:
    if i%2==0 and i%3!=0 and i%5!=0:
        p=0
if p:
    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):
    Ai = A[i]
    
    if Ai%2==0:
        if Ai%3!=0 and Ai%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()))

out='APPROVED'

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

Submission status: Accepted

Solution code:

N = int(input())
*A, = map(int, input().split())
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())

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

flag = True

for a in A:
    if a % 2 == 0 and not (a % 3 == 0 or a % 5 == 0):
        flag = False

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
for i in a:
    if i%2 == 0:
        if i%3 == 0:
            pass
        elif i%5 == 0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

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 and i%3!=0 and i%5!=0:
        print('DENIED')
        break
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    n = inp()
    a = inpl()
    for i in range(n):
        if a[i]%2 == 0:
            if a[i]%3==0 or a[i]%5==0:
                continue
            print('DENIED')
            return
    print('APPROVED')
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

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

flag=0
for a in A:
    if a%2==0:
        b=a//2
        if b%3==0 or b%5==0:
            flag+=0
        else:
            flag+=1
    else:
        flag+=0
print('DENIED' if flag else '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) or (a % 5 == 0):
            pass
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

Submission status: Accepted

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

N = int(input())
A = list(map(int, input().split()))
ok = True
for a in A:
    if a%2 == 0:
        if a%5 != 0 and a%3 != 0:
            ok = False
print("APPROVED" if ok else "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 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:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    for a in A:
        if a%2==0 and not (a%3==0 or 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()))
ans="APPROVED"
for i in range(N):
    a=A[i]
    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()))
A=[a for a in A if a%2==0]
B=[a for a in A if a%3==0 or a%5==0]

if len(A)==len(B):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A =[int(i) for i in 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)
            exit()
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

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

Submission status: Accepted

Solution code:
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = np.array(lr())
A = A[A%2==0].tolist()
bool = True
for a in A:
    if a%3 != 0 and a%5 != 0:
        bool = False

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

Submission status: Accepted

Solution code:
input()
print "APPROVED" if all(x%2!=0 or x%3==0 or x%5==0 for x in map(int, raw_input().split())) else "DENIED"

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
for x in a:
  if x % 2 == 0:
    if x % 3 > 0 and (x % 5 > 0):
      print("DENIED")
      exit(0)
print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
for a in A:
    if a % 2 == 1:
        continue

    if a % 3 == 0:
        continue

    if a % 5 == 0:
        continue

    print('DENIED')
    break
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def fastio():
    from io import StringIO
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep = ' ', end = '\n'):
    print(*var, file=sys.stderr, end = end, sep = sep)

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
# from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

n, = I()
a = I()
ans = 'APPROVED'
for i in range(n):
    if (not a[i] % 2) and a[i] % 3 and a[i] % 5:
        ans = 'DENIED'
        break
print(ans)

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

Solution code:
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())

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

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

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

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

L = list(map(int,input().split()))
R = list(map(int,input().split()))

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

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
B = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    A.append(x1)
    B.append(y1)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''

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")
        sys.exit()
   
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, *A = map(int, open(0).read().split())
K = ["DENIED", "APPROVED"]
print(K[all(a % 3 == 0 or a % 5 == 0 for a in A if a & 1 == 0)])

Submission status: Accepted

Solution code:
def main():
    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:
                return 'DENIED'
    return 'APPROVED'



print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    for i in a:
        if i%2:
            continue
        if i%3 == 0 or i%5 == 0:
            continue
        print("DENIED")
        break
    else:
        print("APPROVED")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    def ok():
        for a in aa:
            if a%2==0:
                if a%3 and a%5:return False
        return True

    n=II()
    aa=LI()
    if ok():print("APPROVED")
    else:print("DENIED")

main()

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(x):
    print(x,file=sys.stderr)
def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)


#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
愚直に操作を実装する
"""
#solution:
cond=1
N=int(input())
A=list(pin())
for num in A:
    if num%2==0:
        if num %3!=0 and num%5!=0:
            cond= 0
print(["DENIED","APPROVED"][cond])
#print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])

Submission status: Accepted

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




def main():
    # Failed to predict input format
    n = int(input())
    a = list(map(int, input().split()))

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15


def main():
    n = getN()
    # n, m = getlist()
    nums = getlist()
    for num in nums:
        if num % 2 == 0 and num % 3 != 0 and num % 5 != 0:
            print("DENIED")
            return

    print("APPROVED")

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""