Problem:


Score: 200 points

Problem Statement

You are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.

According to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:

All even numbers written on the document are divisible by 3 or 5.

If the immigrant should be allowed entry according to the regulation, output APPROVED; otherwise, print DENIED.

Notes

The condition in the statement can be rephrased as "If x is an even number written on the document, x is divisible by 3 or 5".
Here "if" and "or" are logical terms.

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq A_i \leq 1000

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \dots A_N

Output

If the immigrant should be allowed entry according to the regulation, print APPROVED; otherwise, print DENIED.

Sample Input 1

5
6 7 9 10 31

Sample Output 1

APPROVED

The even numbers written on the document are 6 and 10.

All of them are divisible by 3 or 5, so the immigrant should be allowed entry.

Sample Input 2

3
28 27 24

Sample Output 2

DENIED

28 violates the condition, so the immigrant should not be allowed entry.



Sample input:
5
6 7 9 10 31


Sample output:
APPROVED

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
for x in a:
  if x%2==0:
    if (x%3)*(x%5)!=0:
      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:
import sys
import math
import bisect

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

def main():
    n = int(input())
    A = list(map(int, input().split()))
    if solve(A):
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == "__main__":
    main()

Submission status: Accepted

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

res = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            res = 'DENIED'

print(res)

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

for i in range(len(A)):
	if A[i] % 2 == 0:
		# 偶数
		if A[i] % 3 == 0 or A[i] % 5 == 0:
			pass
		else:
			print('DENIED')
			sys.exit()

print('APPROVED')

Submission status: Accepted

Solution code:
n,*a,=map(int,open(0).read().split())
print("DENIED" if sum([(i%3)*(i%5) for i in a if i%2==0]) else "APPROVED")

Submission status: Accepted

Solution code:
N = input()
for x in input().split():
    x = int(x)
    if x % 2 ==0:
        if x % 3 != 0 and x % 5 != 0:
            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:
    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()]

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

Submission status: Accepted

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

A2 = []
for ai in A:
    if ai % 2 == 0:
        A2.append(ai)

ans = True
for ai in A2:
    if ai % 3 != 0 and ai % 5 != 0:
        ans = False


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

Submission status: Accepted

Solution code:

def solution():
    n = int(input().strip())
    a  = [int(x) for x in input().strip().split(" ")]
    for x in a:
        if x % 2 == 0:
            if x % 3 != 0 and x % 5 != 0:
                print("DENIED")
                return
    print("APPROVED")

def main():    
    # T = int(input().strip())
    for _ in range(1):
        solution()
    

main()

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
flag = True
for i in range(len(A)):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            continue
        else:
            flag = False
            break
if flag == True:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
aa = [int(x) for x in input().split()]
def ok(x):
    return x % 2 == 1 or (x % 3 == 0 or x % 5 == 0)
if all(ok(x) for x in aa):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# s = input()
n = int(input())
# a, b, c = map(int, input().split())
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 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:
import sys
input = sys.stdin.readline


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

cnt = 0
for i in a:
    if i % 2 == 0:
        if (i % 3 == 0) | (i % 5 == 0):
            pass
        else:
            cnt = 1

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

Submission status: Accepted

Solution code:
import sys
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:
            pass
        else:
            print("DENIED")
            sys.exit()
print("APPROVED")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def solve():
    input()
    for i in map(int, input().split()):
        if i%2:
            pass
        else:
            if i%3 and i%5:
                return 'DENIED'
    return 'APPROVED'    
if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
n = int(input())
L = list(map(int,input().split()))
flag = True
for i in range(n):
  cnt = 0
  if L[i]%2 == 0:
    if L[i]%3 == 0:
      cnt += 1
    elif L[i]%5 == 0:
      cnt += 1
    if cnt == 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()))
ans = 'APPROVED'
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            ans = 'DENIED'
print(ans)

Submission status: Accepted

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

for i in A:
    if i%2 == 0 and (i%3 !=0 and i%5 !=0):
        flag = 1

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

Submission status: Accepted

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

count=0
for i in m:
    if (i%2==0):
        if (i%3!=0) and (i%5!=0): 
            count+=1
if count==0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 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(len(A)):
    if A[i]%2 == 0 and 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()))
c = 0
for i in range(n):
	if a[i] %2 == 0:
		if not (a[i] %3 == 0 or a[i] %5 ==0):
			c=1
print ( "APPROVED" if c==0 else "DENIED")

Submission status: Accepted

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

r = True

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

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

Submission status: Accepted

Solution code:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
a = intl()
cnt1 = 0
cnt2 = 0
for i in range(n):
    if a[i]%2 == 0:
        cnt1 += 1
        if a[i]%3 == 0 or a[i]%5 == 0:
            cnt2 += 1
print("APPROVED" if cnt1 == cnt2 else "DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    n = int(input().strip())
    v = list(map(int, input().strip().split()))
    for c in v:
        if c % 2 == 0:
            if not (c % 3 == 0 or c % 5 == 0):
                print('DENIED')
                return
    print('APPROVED')
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
is_approved = True
for a_str in input().split():
    a = int(a_str)
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            is_approved = False
            break

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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


print("APPROVED")

Submission status: Accepted

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

for i in range(N):
  a=A[i]
  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 python

from sys import stdin, stderr

def main():
   N = int(stdin.readline())
   A = map(int, stdin.readline().split())

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

   return 0

if __name__ == '__main__': main()

Submission status: Accepted

Solution code:
N = int(input())

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

res = "APPROVED"

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input().strip())
    A = [int(s) for s in input().strip().split()]
    if all(a % 2 == 1 or a % 3 == 0 or a % 5 == 0 for a in A):
        print("APPROVED")
    else:
        print("DENIED")


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 % 5 == 0 or a % 3 == 0:
            continue
        ans = "DENIED"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N + 1):
    if i == N:
        print("APPROVED")
        break
    elif int(A_list[i]) % 2 == 0:
        if int(A_list[i]) % 3 == 0 or int(A_list[i]) % 5 == 0:
            continue
        else:
            print("DENIED")
            break

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

ans = True
for a in A:
    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(raw_input())
a=map(int,raw_input().split())
invalid=1
for i in a:
    if(i%2==0):
        if(i%3==0 or i%5==0):
            pass
        else:
            invalid=0
            break
if(invalid==1):
    print "APPROVED"
else:
    print "DENIED"

Submission status: Accepted

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

flag = True

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))

N = num()
A = nums()
Ag = [i for i in A if i%2 ==0]
p = True
for i in Ag:
    if i%3 != 0 and i%5 != 0:
        p = False
        print("DENIED")
        break
if p:
    print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B

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

c = "APPROVED"

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print("APPROVED")

Submission status: Accepted

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

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

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

print('APPROVED' if ans else '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())
num=list(map(int,input().split()))

flag=True
for i in range(n):
  if num[i]%2==0:
    if num[i]%3!=0 and num[i]%5!=0:
      flag=False
      break
if flag:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
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 LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N = II()
	A = LI()
	ch = True
	for a in A:
		if(a%2==0 and (a%3!=0 and a%5!=0)):ch=False
	if ch:
		print("APPROVED")
	else:
		print("DENIED")

if __name__ == '__main__':
	main()

Submission status: Accepted

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

Submission status: Accepted

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

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

else:
    print("APPROVED")

Submission status: Accepted

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

APPROVED = True

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=pow(10,9)+7

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

Submission status: Accepted

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

ok=True

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
flg = 0
for a in A:
    if a % 2 == 0:
        if not(a % 3 == 0 or a % 5 == 0):
            flg += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

ans = "APPROVED"
for a in ls:
  if a%2==0 and a%3>0 and a%5>0:
    ans ="DENIED"
    break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
for a in A:
  if a % 2:
    continue
  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()))
output ="APPROVED"
for i in range(N):
    if A[i]%2==0:
        if (A[i]%3!=0)and(A[i]%5!=0):
            output = "DENIED"
print(output)

Submission status: Accepted

Solution code:
def solve(a):
    a = [x for x in a if x%2==0]
    if all(map(lambda x: x%5==0 or x%3==0, a)):
        return "APPROVED"
    else:
        return "DENIED"

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N = II()
    A = LMIIS()
    for a in A:
        if a % 2== 0:
            if a % 3 == 0 or a % 5 == 0:
                continue
            else:
                print('DENIED')
                return
    print('APPROVED')

    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    n = int(args[0])
    A = map(int, args[1].split())

    ret = 'APPROVED'
    for a in A:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                ret = 'DENIED'

    return ret


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

Solution code:
N =int(input())
A = [int(i) for i in input().split()]
chk = 0
for i in range(N):
	if A[i]%2 == 0:
		if A[i]%3 == 0 or A[i]%5 == 0:
			continue
		else:
			chk = 1
			break
if chk == 1:
	print("DENIED")
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 or a % 5 == 0:
            continue

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

print(ans)

Submission status: Accepted

Solution code:
input()
a = 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')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
g = []
for i in a:
  if i % 2 == 0:
    g.append(i)

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

Submission status: Accepted

Solution code:
import sys
inputs = sys.stdin.readlines()

n = int(inputs[0])
*A, = map(int, inputs[1].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:
# -*- coding: utf-8 -*-
n = int(input())
a_list = list(map(int, input().split()))

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

print('APPROVED')

Submission status: Accepted

Solution code:
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]
#(ord('A'))でASCII出力 Aは65
import math
import string

def intinput():
    return int(input())

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

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

N = intinput()
A = listintinput()
flag = 0
for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            flag = 1

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

Submission status: Accepted

Solution code:
N = int(input())
*A, = map(int, input().split())
for a in A:
    if a % 2 != 0 or (a % 3 == 0 or a % 5 == 0): continue
    else: print('DENIED'); break
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

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