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:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n = I()
    ali = LI()
    gusu = 0
    flag = []
    for i in ali:
        if i % 2 == 0:
            gusu += 1
            if i % 3 == 0 or i % 5 == 0:
                flag.append(True)
    if gusu == len(flag):
        print('APPROVED')
    else:
        print('DENIED')


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

Submission status: Accepted

Solution code:
import math


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


n = int(input())
a = readints()
x = 0
y = 0
for i in range(n):
    if a[i] % 2 == 0:
        x += 1
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            y += 1
if x == y:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
num=int(input())
youso_list=input().split(' ')
boolean=True

for youso in youso_list:
    magic_num=0
    youso=int(youso)
    if youso%2!=0:
        continue
    
    if youso%3!=0:
        magic_num+=1
        
    if youso%5!=0:
        magic_num+=1
    
    if magic_num==2:
        boolean=False
        break

if boolean==False:
    print('DENIED')

elif boolean==True:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def func_b(a):
    if a%2!=0:
        return 0
    elif a%2==0:
        if a%3==0:
            return 0
        elif a%5==0:
            return 0
        else:
            return 1

N = int(input())
A = list(map(int, input().split()))
A_=map(func_b, A)
if sum(A_)!=0:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
n = input()
alist = input().split()
intalist = [int(a) for a in alist]
count = 0
intcount = 0
for i in range(0,int(n)):
  if intalist[i] % 2 == 0:
    intcount += 1
    if intalist[i] % 3 == 0:
      count += 1
    elif intalist[i] % 5 == 0:
      count += 1
if count == intcount:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

newlist = []
for i in applist:
  if i % 2 == 0:
    newlist.append(i)

flag = 0
for j in newlist:
  if j % 3 == 0 or j % 5 == 0:
    flag = 0
  else:
    flag = 1
    break

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

Submission status: Accepted

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

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

if A2 == A35:
	print("APPROVED")
else:
	print("DENIED")

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

Solution code:
import sys
N = int(input())
A = list(map(int, list(input().split())))
E = []
for i in range(N):
    if A[i]%2 == 0:
        E.append(A[i])
if len(E) == 0:
    print('APPROVED')
else:
    for j in range(len(E)):
        if E[j]%3 != 0 and E[j]%5 != 0:
            print('DENIED')
            sys.exit()
    print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())
nums = list(map(int, input().split(' ')))
flag = False
for i in range(N):
  if nums[i]%2 == 0 :
    
    if (nums[i]%3 != 0) & (nums[i]%5 != 0):
      flag = True
      print('DENIED')
      break
    else:
      continue
  else:
    continue
if flag == False:
  print('APPROVED')

Submission status: Accepted

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

for i in range(len(a)):
	if a[i] % 2 == 0:
		ans.append(a[i])


for i in ans:
	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()))
judge = True

for i in range(n):
  if a[i]%2==0 and not (a[i]%3 == 0 or a[i]%5 == 0):
    judge = False

print(['DENIED', 'APPROVED'][judge])

Submission status: Accepted

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

ans = 'APPROVED'

for value in ImmigrantList:
    if value % 2 == 0:
        target = value # 該当数字をなんとなく変数に入れる
        if target % 3 != 0 and target % 5 != 0:
            ans = 'DENIED'
            break
print(ans)

Submission status: Accepted

Solution code:
def is_even(num):
    if num % 2 == 0:
        return True
    else:
        return False

def is_split(num):
    if num % 3 == 0 or num % 5 == 0:
        return True
    else:
        return False

a = int(input())
li1 = list(map(int, input().split()))
li2 = []
flag = False

for i in range(a):
    li2.append(li1[i])

for i in li2:
    if is_even(i):
        if not is_split(i):
            flag = True

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

Submission status: Accepted

Solution code:
# import itertools
# import math


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

    even = list(filter(lambda x: x % 2 == 0, A))

    for ee in even:
        if (ee % 3) != 0 and (ee % 5) != 0:
            print('DENIED')
            return

    print('APPROVED')


resolve()

Submission status: Accepted

Solution code:
num = input()
num = int(num)
numinput = input()
numlist = numinput.split(" ")
evenlist = list()
con = 0
maxcon = int(num) * 1000
point = 0
for i in numlist:
  con = con + int(i)
  if int(i) % 2 == 0:
      evenlist.append(i)
  else:
      continue
if num <= 100 and con <= maxcon:
  for i in evenlist:
    if int(i) % 3 == 0 or int(i) % 5 == 0:
      point = point + 1
    else:
      continue
else:
  print("")
if point == len(evenlist):
  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 and a[i] % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())
nums = [int(e) for e in input().split()]
for i in range(N):
    if nums[i]%2 == 1:
        pass
    else:
        if nums[i]%3 == 0 or nums[i]%5 == 0:
            pass
        else:
            print("DENIED")
            break
    if i == N-1:
        print("APPROVED")
    else:
        pass

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
arr = list(map(int, input().split()))
flag = True
for n in arr:
  if n % 2 == 0 and not (n % 3 * n % 5 == 0):
    print("DENIED")
    flag = False
    break
    
if flag:
  print("APPROVED")

Submission status: Accepted

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

flag = 0

for i in a:
  if i % 2:
    b = 1
  else:
    if not(i % 3) or not(i % 5):
      b = 1
    else:
      flag = 1
if flag:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = input()
A = input()
A = A.split()

A = [i for i in A if int(i) % 2 == 0]
# print(A)

all_nums = len(A)
A = [i for i in A if int(i) % 3 == 0 or int(i) % 5 == 0]
# print(A)

if len(A) == all_nums:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

isApproved = True

for x in a:
    if x % 2 == 0:
        if not(x % 3 == 0 or x % 5 == 0):
            isApproved = False

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

Submission status: Accepted

Solution code:
def Checknum(str_num, input_list):
  for i in input_list:
    if i % 2 == 0:
      if not (i % 3 == 0 or i % 5 == 0):
        return "DENIED"
  return "APPROVED"

stranger_num = input()
input_list = list(map(int, input().split()))
print(Checknum(stranger_num, input_list))

Submission status: Accepted

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


for i in range(len(A)):
    if A[i] % 2 == 0:
        Guusu.append(A[i])

judge = 0
for i in range(len(Guusu)):
    if Guusu[i] % 3 == 0 or Guusu[i] % 5 == 0:
        None
    else:
        judge = 1

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

Submission status: Accepted

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

    ans = "APPROVED"
    for ai in A:
        if ai%2 == 0:
            if ai%3 > 0 and ai%5 > 0:
                ans = "DENIED"
                break
    print(ans)

    return

if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
import numpy as np
 
N = int(input())
A = input().split()
A = np.array([int(val) for val in A])
 
A_even = set(A[A%2==0])
A_three = set(A[A%3==0])
A_five = set(A[A%5==0])
 
A_approve = A_even & (A_three | A_five)
 
if A_even == A_approve:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

import os
import datetime

def main():
    val_1 = int(input())
    val_2 = input()
    val_2_list = val_2.split()

    flag = True

    for i in range(val_1):
        num = int(val_2_list[i])
        if num % 2 == 0:
            if num % 3 != 0 and num % 5 != 0:
                flag = False
                break

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
data=list(map(int,input().split()))
ans="APPROVED"
for i in range(N):
    mo2=data[i]%2
    mo6=data[i]%6
    mo10=data[i]%10
    if mo2==0:
        if mo6==0 or mo10==0:
            ans="APPROVED"

        else:
            ans="DENIED"
            break
    else:
        continue
print(ans)

Submission status: Accepted

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

for el in immi:
    if el % 2 == 0:
        if not el % 3 == 0:
            if not el % 5 == 0:
                flag = 1
                break
                
if flag == 1:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))
    for i in range(N):
        A = int(next(tokens))
        if A%2==0 and A%3 != 0 and A%5 != 0:
            print("DENIED")
            return

    print("APPROVED")
    pass

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
OK = 1
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:
            OK = 1
        else:
            OK = 0
            break
if OK == 1:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
X = [int(x) for x in input().split()]
result = list(filter(lambda x: x % 2 == 0, X))
count = 0
for i in result:
    if i % 3 == 0 or i % 5 == 0:
        count += 1
print('APPROVED' if count == len(result) else 'DENIED')

Submission status: Accepted

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

if x == 0:
    print("APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
lit = [int(x) for x in input().split()]
lit2 = []
for i in range(N):
    if lit[i] % 2 == 0:
        lit2.append(lit[i])
N2 = len(lit2)
lit3 = []
for j in range(N2):
    if lit2[j] % 3 == 0:
        lit3.append(lit[j])
    elif lit2[j] % 5 == 0:
        lit3.append(lit[j])
if len(lit2) == len(lit3):
    print("APPROVED")
else: print("DENIED")

Submission status: Accepted

Solution code:
a = input()
a = int(a)
 
line = [int(k) for k in input().split()]
for k in range(len(line)):
  if line[k] % 2 == 0:
    if not line[k] % 5 == 0 and not line[k] % 3 == 0:
      print("DENIED")
      break
  if k == a-1:
    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:
def main():
    N = int(input())
    a = list(map(int, input().split()))    
    even_num = [e for e in a if e % 2 == 0]
    flag = True
    for e in even_num:
        if e % 3 != 0 and e % 5 != 0:
            flag = False
    if flag: print("APPROVED")
    else: print("DENIED")
        
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a = input()
num = [int(x) for x in input().split()]
flag = True
for x in num:
  if x % 2 == 0:
    if x % 3 != 0 and x % 5 != 0:
      flag = False
if flag:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

Solution code:
a = []
n = int(input())

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

e = 0  
for i in range(n):
  if a[i] % 2 == 0:
    e += 1
f = 0
for i in range(n):
  if a[i] % 6 == 0 or a[i] % 10 == 0:
    f += 1

if e == f:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

for a in As:
    if a % 2 != 0:continue
    if a % 3 == 0 or a % 5 == 0:continue
    else:
        print('DENIED')
        break
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
l = int(input())
num_lis = list(input().split())

for i in range(l):
    num_lis[i] = int(num_lis[i])

ans = 'APPROVED'
for i in range(l):
    if num_lis[i]%2 == 0:
        if num_lis[i]%3 != 0:
            if num_lis[i]%5 !=0:
                ans ='DENIED'
print(ans)

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:
        if A[i]%3 != 0 and  A[i]%5 != 0:
            print("DENIED")
            exit(0)

print("APPROVED")

Submission status: Accepted

Solution code:
from functools import reduce
from operator import and_
N = int(input())
As = [(i%3==0) or (i%5==0) for i in map(int,input().split()) if i%2==0]
ans = reduce(and_, As, True) if len(As)>0 else True
print("APPROVED" if ans else "DENIED")

Submission status: Accepted

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

judge = 'APPROVED'

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

print(judge)

Submission status: Accepted

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

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

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:
    if i%3 and i%5:
      print("DENIED")
      sys.exit()
print("APPROVED")

Submission status: Accepted

Solution code:
n=int(input())
lst=list(map(int,input().split()))
A = list(filter(lambda x : x % 2==0, lst))
c=0
for i in A:
    if(i%3==0 or i%5==0):
        c+=1
if(c==len(A)):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input())
lst = list(map(int, input().split()))
cnt = 0
ans = 0
lstg = []
for i in lst:
    if (i % 2) == 0:
        lstg.append(i)

for i in lstg:
    if (i % 3) == 0 or (i % 5) == 0:
        cnt += 1

if len(lstg) == cnt or len(lstg) == 0:
    ans = 1
if ans > 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
import sys
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:
n = int(input())
arr = [int(s) for s in input().split(" ")]


def calculate(n,arr):

    for ar in arr:
        if ar % 2 == 0:
            s1 = ar % 3
            s2 = ar % 5
            if (s1 == 0) or (s2 == 0):
                pass
            else:
                print("DENIED")
                return

    print("APPROVED")

calculate(n,arr)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
l = list(map(int, input().split()))
 
check_list = []
for num in l:
    if num % 2 == 0:
        check_list.append(num)
 
n = len(check_list)
i = 0
while i < n:
    if (check_list[i] % 3 == 0) or (check_list[i] % 5 == 0):
        i += 1
    else: break
if i == n:
    print('APPROVED')
else: print('DENIED')

Submission status: Accepted

Solution code:
class Solution:
    def solve(self, N: int, A) -> str:

        for a in A:
            if a % 2 == 0:
                if a % 3 != 0 and a % 5 != 0:
                    return "DENIED"

        return "APPROVED"


if __name__ == '__main__':

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

    # solve
    solution = Solution()
    print(solution.solve(N, A))

Submission status: Accepted

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

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

Submission status: Accepted

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


flag = False

for i in range(N):
  if(Ai[i]%2 == 0):
    if(Ai[i]%3 != 0 and Ai[i]%5 != 0):
      flag = True
      break

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

Submission status: Accepted

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

l_ = []
l__ = []
for n in range(N):
    if l[n] % 2 == 0:
        l_.append(n)

if len(l_) == 0:
    print('APPROVED')
    
if len(l_) != 0:
    for n in l_:
        if l[n] % 3 == 0 or l[n] % 5 == 0:
            l__.append(n)
            
    if len(l__) == len(l_):
        print('APPROVED')
    else :
        print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
n = int(input())
a = list(map(int, input().split()))
num = []

for i in range(0, n):
    if a[i] % 2 == 0:
       num.append(a[i])

#print(num)

if len(num) == 0:
    print('APPROVED')
    exit()
else:
    for j in range(0, len(num)):
        if num[j] % 3 != 0 and num[j] % 5 != 0:
            print('DENIED')
            exit()

print('APPROVED')

Submission status: Accepted

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

x=0

for i in range(0,N):
  if a[i]%2==0:
#    print(a[i])
#    print(a[i]%3)
#    print(a[i]%5)
    if a[i]%3!=0:
      if a[i]%5!=0:
#        print(a[i])
        x=1
if x==1:
  print("DENIED")
  exit()
print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
l = [int(i) for i in input().split(" ")]
 
deny = False
 
for ele in l:
  if ele%2==0:
    if ele%3!=0 and ele%5!=0:
      print("DENIED")
      deny = True
      break;
 
if not deny:
  print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_ = raw_input()
nums = map(int, raw_input().split())

def assert_num(nums):
    is_denied = False
    for num in nums:
        if num % 2 != 0:
            # odd
            continue
        if num % 3 == 0 or num % 5 == 0:
            # OK
            continue
        is_denied = True
    return is_denied
            
print 'DENIED' if assert_num(nums) else 'APPROVED'

Submission status: Accepted

Solution code:
# B - Papers, Please
N = int(input())
A = list(map(int, input().split(' ')))
flag = True
for i in A:
    if i % 2 == 0:
        if i % 5 == 0 or i % 3 == 0:
            pass
        else:
            flag = False

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

Submission status: Accepted

Solution code:
def main():
  i = int(input())
  x = list(map(int,input().split()))
  ret = True
  for v in x:
    if isEven(v):
      if not(canDevideThreeOrFive(v)):
        ret = False
        break
  if ret:
    print("APPROVED")
  else:
    print("DENIED")

def isEven(x):
  if x%2 == 0:
    return True
  return False

def canDevideThreeOrFive(x):
  if x%3 == 0 or x%5 == 0:
    return True
  return False

main()

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
mySet = set()
for i in A:
  if (i % 2)==0:
    mySet.add(i)   
count = 0
for j in mySet:
  if (j%3)==0 or (j%5)==0:
    count = count + 1
if count == len(mySet):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

apploveflag = True

for a in range(n):
    if alist[a] % 2 == 0:
        if alist[a] % 3 != 0 and alist[a] % 5 != 0:            
            
            apploveflag = False


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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
flg = 1
for i in A:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 !=0:
            flg = 0
            break

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

Submission status: Accepted

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

#flg
out_flg = "N"

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

if out_flg == "Y":
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
import sys
N = int(input())
A_N = list(map(int, input().split()))
A_N = [i for i in A_N if i % 2 == 0]
# print(A_N)
B_N = [i for i in A_N if i % 3 == 0 or i % 5 == 0]
# print(B_N)
if len(A_N) == len(B_N):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
num = int(input())
arr = [int(i) for i in input().split()]
count = 0
for i in arr:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            count += 1
    else:
        continue
if count != 0:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
from math import  *
a = int(input())
b = list(map(int,input().split()))
c = []
for i in range(a):
    if b[i]%2==0:
        c.append(b[i])
g = len(c)
count = 0
for k in range(g):
    if c[k]%3==0 or c[k]%5==0:
        count = count + 1
if count == g:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
documents = list(map(int, input().split()))
app = True
for i in documents:
  if not i % 2 == 0:
    continue
  if not (i % 3 == 0 or i % 5 == 0):
    app = False
if app:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
_ = input()
l = [int(a) for a in input().split(' ') if int(a)%2==0]

fl = 1
for n in l:
  if n%3==0 or n%5==0:
    pass
  else:
    fl = 0
    break

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

Submission status: Accepted

Solution code:
n = int(input())
ls = map(int, input().lower().split())
even = []
for i in ls: 
  if i % 2 == 0:
    even.append(i)

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

Submission status: Accepted

Solution code:
from sys import stdin,stdout
def f(A):
	for i in A:
		if i%2==0:
			if i%3!=0 and i%5!=0:
				return 'DENIED'
	return 'APPROVED'

def main():  	
	for x in stdin:

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
    if A[i]%2 == 0:
        A_e.append(A[i])


cnt = 0
for j in range(len(A_e)):
    if (A_e[j]%3 == 0) or (A_e[j]%5 == 0):
        cnt += 1
    else:
        cnt = cnt

if cnt == len(A_e):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

for i in range(0,n):
	if a[i] % 2 == 0:
		abc.append(a[i])

k=len(abc)

for i in range(0,k):
	if abc[i] % 3 != 0 and abc[i] % 5 != 0:
		print("DENIED")
		exit()

print("APPROVED")

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    aa=map(int,input().split())
    for a in aa:
        if a&1:
            continue
        if a%3==0 or a%5==0:
            continue
        print('DENIED')
        return
    print('APPROVED')
main()