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())
nums = list(map(int, input().split()))
chk = True
for i in nums:
    if i%2==0:
        if i%3==0 or i%5==0:
            pass
        else:
            chk = False
    else:
        pass
if chk == True:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N = int(input())
Array = list(map(int, input().split()))
tmp = 0

for i in range(N):
    tmp = Array[i]
    if tmp % 2 == 0:
        if tmp % 3 == 0 or tmp % 5 == 0:
            pass
        else:
            print('DENIED')
            exit()
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')
      break
    elif i != N-1:
      continue
    else:
      print('APPROVED')
      break
  elif i != N-1:
    continue
  else:
    print('APPROVED')
    break

Submission status: Accepted

Solution code:
N = int(input())

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

n=0

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

if n==0:
    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 or a % 5 == 0:
            continue
        else:
            print("DENIED")
            exit(0)

print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input()) 
  
# input the array 
# arr = []
arr = list(map(int, input().split()))
den=0
app=0
for i in arr:
    i=int(i)
    if (i%2==0):
        if i%3==0 or i%5==0:
            app+=1
        else:
            den+=1
            break

if den>0:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

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

for x in a:
    if x % 2 == 0:
        if 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 x in a:
    if x % 2 == 0:
        if x % 3 == 0 or x % 5 == 0:
          continue
        else:
          print('DENIED')
          exit()

print('APPROVED')

Submission status: Accepted

Solution code:
N=int(input())
Ai=list(map(int,input().split()))
n=0
for i in Ai:
    if i%2==0:
        if i%3==0 or i%5==0:
            n+=1
        else:
            pass
    else:
        n+=1

if n==N:
    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:
            pass
        else:
            print("DENIED")
            exit()

print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())
xs = map(int,input().split())
ans = "APPROVED"
for x in xs:
    if x%2 == 1 or x%3 == 0 or x%5 == 0:
        continue;
    ans ="DENIED"
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
lst = list(map(int, input().split()))
gu = [x for x in lst if x % 2 == 0]
con =  [x for x in gu if x % 3 == 0 or x % 5 == 0]
print('APPROVED' if gu == con else 'DENIED')

Submission status: Accepted

Solution code:
def solve(n, a):
    for i in range(n):
        if a[i] % 2 == 0:
            if not 0 in [a[i] % 3, a[i] % 5]:
                return "DENIED"
    return "APPROVED"

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in papers:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            out = 1
            break

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

Submission status: Accepted

Solution code:
input()
inputs = map(int, input().split(" "))

is_denied = False
for i in inputs:
  if i % 2 ==0 and ( i % 3 != 0 and i % 5 != 0):
      is_denied = True
      
if is_denied:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
input()
a=input().split()
lis=[]
t=0
for i in a:
  lis.append(int(i))
for k in lis:
  if k%2==0:
    if k%5==0 or k%3==0:
      pass
    else:
      t=1
      break
  else:
    pass
if t==0:
  print("APPROVED")
elif t==1:
  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")
            break
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
def main():
    _ = int(input())
    nums_list = list(map(int, input().split()))

    for num in nums_list:
        if num % 2 == 0 and (num % 3 != 0 and num % 5 != 0):
            print('DENIED')
            return
    else:
        print('APPROVED')


if __name__ == '__main__':
    main()

Submission status: Accepted

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


if isend:
    print("DENIED")

else:
    print("APPROVED")

Submission status: Accepted

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

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

if count == len(A):
    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:
        a[i]=3
flag = True
for i in range(n):
    if a[i]%3==0 or a[i]%5==0:
        continue
    else:
        flag = False
if flag:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
import sys
n = sys.stdin.readline()
a = list(map(int, sys.stdin.readline().split()))
ans = "APPROVED"
for i in a:
  if i%2==0:
    if i%3==0:
      continue
    elif i%5==0:
      continue
    else:
      ans = "DENIED"
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int, input().split())) 
tmp=[]
ans=True
for i in A:
  if i%2==0:
    tmp.append(i)
  else:
    continue

for i in tmp:
  if i%3==0 or i%5==0:
    continue
  else:
    ans=False
    
if ans:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
n = int(input())
#input = sys.stdin.readline
#a = np.array(list(map(int, input().split())))
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, A = int(input()), input()

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

flg = "True"
for i in tmp:
    if i % 2 == 0 and i % 3 != 0 and i % 5 != 0:
        flg = "False"

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

Submission status: Accepted

Solution code:
import sys
import numpy as np
n = int(input())
input = sys.stdin.readline
a = np.array(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 solve():
    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')


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

if all([num % 3 == 0 or num % 5 == 0 for num in nums if num % 2 == 0]):
    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 = [int(i) for i in 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")
            break
else:
    print("APPROVED")

Submission status: Accepted

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

flag=True
for i in A:
    if i%2==0:
        if i%5 and i%3:
            flag=False

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import numpy as np
stdin = open(0)

A = np.fromstring(stdin.read(),np.int64,sep= ' ')[1:]
A=A[A%2 ==0]
if np.all((A % 3 == 0)|(A % 5 ==0)):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

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

div2 = list(map(lambda x: (x + 1) % 2, A))
div3 = list(map(lambda x: x % 3, A))
div5 = list(map(lambda x: x % 5, A))

A = np.array(A)
div2 = np.array(div2)
div3 = np.array(div3)
div5 = np.array(div5)

Approve = A * div2 * div3 * div5

if all([Approve[i] == 0 for i in range(len(Approve))]):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
for j in a:
    if j % 2:
        continue
    if j % 3 == 0 or j % 5 == 0:
        continue
    print('DENIED')
    break
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int, input().split()))
c = 0
for i in range(N):
  if L[i] % 2 == 0:
    if L[i] % 3 == 0:
      c += 1
    elif L[i] % 5 == 0:
      c += 1
    else:
      c = 0
      break
  else:
    c += 1

if c == N:
  print("APPROVED")  
else:
  print ("DENIED")

Submission status: Accepted

Solution code:
import sys
N = int(input())
*A, = 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")
            sys.exit()

print("APPROVED")

Submission status: Accepted

Solution code:
import sys

n, *A = map(int, sys.stdin.read().split())

def main():
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                continue
            else:
                return 'DENIED'
    return 'APPROVED'

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

Submission status: Accepted

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

Submission status: Accepted

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

for x in arr:
    if ((x % 2) == 0) and (x % 3 * x % 5):
        print("DENIED")
        break
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
import sys
_ = input()
input_array = [int(e) for e in input().split()]
even = [e for e in set(input_array) if e%2==0]
divided_by_three = [e for e in even if e%3!=0]
divided_by_five = [e for e in divided_by_three if e%5!=0]
if len(divided_by_five) == 0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
N=int(input())
W = [int(x) for x in input().split()]
for i in W:
    if i%2==0:
        if i%10==0 or i%6==0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[int(x) for x in input().split()]
flag=True;
for x in a:
    if x%2==0:
        if x%3==0 or x%5==0:
            pass
        else:
            flag=False
            break
if flag==False:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

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

alpha, beta = 1, 1

for i in A:
    if i % 2 == 0:
        alpha += 1
        if i % 3 == 0 or i % 5 == 0:
            beta += 1
if alpha == beta:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
input()
xs=[int(x) for x in input().split(' ')]
for x in xs:
  if x%2==0:
    if x%3!=0 and x%5!=0:
      print('DENIED')
      exit(0)
print('APPROVED')

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

Solution code:
N=int(input())
L=list(map(int,input().split()))
for i in L:
  if not(i%2==1 or i%3==0 or i%5==0):
    print("DENIED")
    break
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
from sys import exit

N = int(input())
A = tuple(map(int, input().split()))
for a in A:
    if not a % 2 and a % 3 and a % 5:
        print('DENIED')
        exit()
print('APPROVED')

Submission status: Accepted

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

#for i in A:
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()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a_input = list(map(int, input().split()))
if sum([1 for a in a_input if (a % 2 == 0) & (a % 3 != 0) & (a % 5 != 0)]) > 0:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

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)*(a[i]%5) != 0:
      print("DENIED")
      quit()
print("APPROVED")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#import sys; sys.stdin=open('input_file.txt')
#------------------------------------------
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    if A[i]%2 == 0 and A[i]%3!=0 and A[i]%5!=0:
        print('DENIED')
        break
else:
    print('APPROVED')

Submission status: Accepted

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

# Input
s = [input() for i in range(2)]
N = int(s[0])
As = sorted(list(s[1].split()))

# Proccess
pp = "APPROVED"

for i in range(0,N):
	if (int(As[i]) % 2) == 0 :
		if (As[i] == 2)or(As[i] == 4):
			pp = "DENIED"
			break			
		elif (int(As[i]) % 3)*(int(As[i]) % 5) == 0 :
			continue
		else:
			pp = "DENIED"
			break
		
# Output						
print(pp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

N = sys.stdin.readline().strip()
A = [int(x) for x in sys.stdin.readline().strip().split(' ')]

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

Submission status: Accepted

Solution code:
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think([6, 7, 9, 10, 31]), 'APPROVED')

    def test_2(self):
        self.assertEqual(think([28, 27, 24]), 'DENIED')


def solve():
    a = read()
    result = think(a)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a):
    approved = True
    for e in a:
        if e % 2 == 0:
            if e % 3 == 0 or e % 5 == 0:
                continue
            else:
                approved = False
                break
        else:
            continue
    return 'APPROVED' if approved else 'DENIED'


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

flg=0

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

Submission status: Accepted

Solution code:
m = int(input())
n = list(map(int,input().split()))
f=0
for i in n:
    if i%2==0 and not (i%3==0 or i%5==0):
        f=1

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

Submission status: Accepted

Solution code:
import sys
import numpy as np

input = sys.stdin.readline

N = int(input())
A = np.fromstring(input(), dtype=int, sep=' ')
A = A[A % 2 == 0]
if np.all((A % 3 == 0) | (A % 5 == 0)):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

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

Submission status: Accepted

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

judgement = True

for i in arr:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            print("DENIED")
            judgement = False
            break

if judgement:
    print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
As=list(map(int,input().split()))
As=[i for i in As if i%2==0]
def check(i):
    if i%3==0 or i%5==0:
        return True
    else:
        return False
new_As=[i for i in As if check(i)]
if len(As)==len(new_As):
    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
if flag==True:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
from sys import stdin

def main():

    input = stdin.readline

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

for a in A:
    if a % 2: continue 
    if not a % 3: continue 
    if not a % 5: continue
    print('DENIED')
    sys.exit()
print('APPROVED')

Submission status: Accepted

Solution code:
import sys

def result():


    input_first = input().split()
    input_second = input().split()

    N= input_first
    paper = [int(i) for i in input_second]


    for num in paper:
        if num%2 ==0 and num%3!=0 and num %5 != 0:
            print('DENIED')
            return 

    print('APPROVED')
    return 


result()

Submission status: Accepted

Solution code:
_ = input()
A = list(map(int, input().split()))
for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            result = "APPROVED"
        else:
            result = "DENIED"
            break
    else:
        result = "APPROVED"
print(result)

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().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=list(map(int,input().split()))
count1=0
count2=0
for i in range(n):
    if a[i]%2==0:
        count1+=1
        if a[i]%3==0 or a[i]%5==0:
            count2+=1
if count1==count2:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
p = 'APPROVED'

for i in map(int, input().split()):
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      p = 'DENIED'
print(p)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
A = S.split(' ')

count = 0
for i in A:
  i = int(i)
  if i%2==0:
    if not (i%3==0 or i%5==0):
      count += 1
if count ==0:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines  

N = 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:
_,a=open(0);print('ADPEPNRIOEVDE D'[any(~a%2*a%3*a%5for a in map(int,a.split()))::2])

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

Submission status: Accepted

Solution code:
N = int(input())
Ai = input()
Ai = Ai.split(' ')
ans = 'APPROVED'
for moji in Ai:
    moji = int(moji)
    if moji % 2 != 0:
        pass
    else:
        if (moji % 3 == 0) or (moji % 5 == 0):
            pass
        else:
            ans = 'DENIED'
            break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 155 - B
# -*- encoding: UTF-8 -*-

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

result = "APPROVED"

for a in aList :
  if a % 2 == 0 :
    if a % 6 != 0 and a % 10 != 0 :
      result = "DENIED"
      break

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

if all(map(lambda x: x % 2 == 1 or x % 3 == 0 or x % 5 == 0, A)):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
yes="APPROVED"
no="DENIED"
N=int(input())
a=list(map(int,input().split()))
flag=True
for i in a:
    if i%2==1:
        continue
    if not(i%5==0 or i%3==0):
        
        flag=False
        break
if flag:
    print(yes)
else:
    print(no)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
nums = [int(n_str) for n_str in input().split(' ')]

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

print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
for a in map(int,input().split()):
  if a&1: continue
  if a%3 and a%5:
    print("DENIED")
    exit()
print("APPROVED")

Submission status: Accepted

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