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:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
A = LI()

ans = 1
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            ans = 0


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

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
ans = 'APPROVED'

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: ans = 'DENIED'

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a_array = [int(x) for x in input().split()]
flag = True
for a in a_array:
    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())
An = list(map(int, input().split()))

ans = "APPROVED"
for i in range(N):
    if An[i] % 2 != 0:
        continue

    if An[i] % 3 == 0 or An[i] % 5 == 0:
        continue

    ans = "DENIED"

print(ans)

Submission status: Accepted

Solution code:
# ABC155 B
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
a=nl()
for aa in a:
    if aa%2==0:
        if aa%3==0 or aa%5==0:
            pass
        else:
            print('DENIED')
            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 = 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")
            quit()
print("APPROVED")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
a = list(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")
      exit()
print("APPROVED")

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)

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


ans = True
for a in A:
    if a % 2 == 0:
        if not (a % 5 == 0 or a % 3 == 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()))
flag=1
for i in range(N):
    if A[i]%2==0:
        if not((A[i]%3==0)or(A[i]%5==0)):
            flag=0

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

Submission status: Accepted

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

for a in alist:
  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 = list(map(int, input().split()))
f = 0
for ai in a:
    if ai % 2 == 0:
        if ai % 3 and ai % 5:
            f = 1
            break
if f:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()
A = LI()
for a in A:
    if a % 2 == 0 and a % 3 and a % 5:
        print('DENIED')
        break
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    approve = True
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass # ok
            else:
                approve = False
                break
    if approve:
        print('APPROVED')
    else:
        print('DENIED')

    

main()

Submission status: Accepted

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

Submission status: Accepted

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


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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

flag = False
for a in A:
    if a % 2 == 1:
        continue

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

    flag = True

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

Submission status: Accepted

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

count = 0
for a in al:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            count += 1
    else:
        count += 1

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

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

flag = 0

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:
import itertools
import math
import sys
from collections import Counter

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

for A in As:
  if A % 2 == 1:
    continue
  else:
    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 = 1

for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            continue
        else:
            flag = 0

if flag == 0:
    print("DENIED")
elif flag == 1:
    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 itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
N = INT()
A = LIST()
count = 0
b = 0
for i in range(N):
    if A[i] % 2 == 0:
        count += 1
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            b += 1
if count == b:
    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 a[i] % 3 != 0 and a[i] % 5 != 0:
            flag = False
            break
if flag == True:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

ans = 'APPROVED'

for x in a:
    if x %2 == 0:
        even.append(x)

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

Submission status: Accepted

Solution code:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	A = getlist()
	judge = "APPROVED"
	for i in range(N):
		if A[i] % 2 == 0:
			if A[i] % 5 != 0 and A[i] % 3 != 0:
				judge = "DENIED"
				break

	print(judge)


if __name__ == '__main__':
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
def main():
    N = int(input())
    a = [int(i) for i in input().split()]

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

    print("APPROVED")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,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()))
for i in arr:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            print('DENIED')
            exit()
print('APPROVED')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:


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

f=True

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

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

Submission status: Accepted

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

ans = 'APPROVED'

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

print(ans)

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

Submission status: Accepted

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

approved = True
for i in range(0, N):
    a = A[i]
    if a % 2 != 0:
        continue

    if a % 3 != 0 and a % 5 != 0:
        approved = False
        break

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

Submission status: Accepted

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

ans=0
for a in A:
    if a%2==0:
        if a%3!=0:
            if a%5!=0:
                ans+=1
                break
if ans!=0:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

n = int(sys.stdin.readline().strip())
a = [int(s) for s in sys.stdin.readline().strip().split(' ')]

app = True
for ai in a:
    if ai % 2 == 0:
        if ai % 3 != 0 and ai % 5 != 0:
            app = False

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
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 operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr=limii()
b =[]
for i in range(n):
    if arr[i]%2==0:
        b.append(arr[i])
cnt=0
for i in b:
    if i%3==0 or i%5==0:
        cnt+=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
N = int(input())
A = [int(x) for x in input().strip().split()]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from functools import lru_cache
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s

#main
n=int(input())
#A,B,C=map(int,input().split())
A=list(map(int,input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, *D, = [list(map(int, s.split())) for s in open(0)] 
D = D[0]
flag = 0
for d in D:
    if d % 2 == 0:
        if d % 3 == 0 or d % 5 == 0:
            pass
        else:
            flag +=1 
            break
if not flag:
    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]%6==0 or a[i]%10==0 or a[i]%2==1:
        flag=True
    else:
        flag=False
        print('DENIED')
        break
if flag:
    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):
            continue
        else:
            flag = False
            break

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

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

f()

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools

#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]



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

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



    print(ans)

if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = IL()

cnt = 0
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()))

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

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

Submission status: Accepted

Solution code:
N, *A = map(int, open(0).read().split())

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

Submission status: Accepted

Solution code:
import sys

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

a_even = list(filter(lambda x: x % 2 == 0, a_list))
for a in a_even:
    if 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()))
flag=True
for i in range(n):
    if a[i]%2==0:
        if a[i]%3 and a[i]%5:
            flag=False

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

AP = True
for aa in a:
    if aa % 2 == 0:
        if aa % 3 != 0 and aa % 5 != 0:
            AP = False

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

Submission status: Accepted

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

is_DENIED = False

for a in A:
    if a % 2 == 0:
        if not (a % 3 == 0 or a % 5 == 0):
            is_DENIED = True
            break

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

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

n = ni()
a = nl()
a = filter(lambda x:x%2==0, a)
print('APPROVED' if all((x%3)*(x%5)==0 for x in a) else 'DENIED')

Submission status: Accepted

Solution code:
from sys import setrecursionlimit as srl; srl(10**7)
rr = lambda: int(raw_input())
rrm = lambda: map(int, raw_input().split())

YES,NO = "APPROVED","DENIED"
def solve(N, A):
    for x in A:
        if x % 2 == 0:
            if x % 3 and x % 5:
                return NO
    return YES

    
print solve(int(rr()), rrm())

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 and a%5:
            print('DENIED')
            break
else:
    print('APPROVED')

Submission status: Accepted

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

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