Problem:


Score: 200 points

Problem Statement

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

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

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

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

Notes

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

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq A_i \leq 1000

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \dots A_N

Output

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

Sample Input 1

5
6 7 9 10 31

Sample Output 1

APPROVED

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

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

Sample Input 2

3
28 27 24

Sample Output 2

DENIED

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



Sample input:
5
6 7 9 10 31


Sample output:
APPROVED

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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 A[i]%6 ==0 and A[i]%10 != 0:
      c = c
    elif A[i]%6 !=0 and A[i]%10 == 0:
      c = c
    elif A[i]%6 ==0 and A[i]%10 == 0:
      c = c
    else:
      c += 1

if c >0:
  print('DENIED')
  
elif c == 0:
  print('APPROVED')

Submission status: Accepted

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

cnt = 0
l = []
for i in A:
    if i % 2 == 0:
        l.append(i)
        cnt += 1

ans = 0
for i in l:
    if i % 3 == 0 or i % 5 == 0:
        ans += 1

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

Submission status: Accepted

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

ans = 'APPROVED'

for num in a:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            ans = 'DENIED'
            break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
m = map(int, input().split())
flag = "APPROVED"

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

Submission status: Accepted

Solution code:
N = int(input().rstrip())
l = [int(v) for v in input().rstrip().split()]
r = 'APPROVED'
for v in l:
    if v % 2 == 1:
        continue

    if v % 3 == 0 or v % 5 == 0:
        pass
    else:
        r = 'DENIED'
        break#
        
print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

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

    for i in range(N):
        if A[i] % 2 == 0 and (A[i] % 3 != 0 and A[i] % 5 != 0):
            return "DENIED"
    return "APPROVED"

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

gu = []
ans = []

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

for j in range(len(gu)):
    if gu[j] % 3 == 0 or gu[j] % 5 == 0:
        ans.append(gu[j])
    else:
        pass

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

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

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

even = [i for i in a if i % 2 == 0]
for check in even:
  if check % 3 != 0 and check % 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:
n=int(input())
a=[int(x) for x in input().split()]
b=[y for y in a if y%2 == 0]
c=0
for i in b:
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        print("DENIED")
        c=1
        break
        
if c==0:
    print("APPROVED")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

kotae='APPROVED'
for i in range(len(x)):
    if x[i]%2==0:
        if x[i]%3==0 or x[i]%5==0:
            pass
        else:
            kotae='DENIED'


print(kotae)

Submission status: Accepted

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

res = True

for num in A:
    if num % 2 == 0 and num % 3 != 0 and num % 5 != 0:
        res = False
        break

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

Submission status: Accepted

Solution code:
n = int(input())

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

cntall = 0
cnt = 0

for i in a:
    if not(i & 1):
        cntall += 1
        if (i%5==0) or (i%3==0):
            cnt += 1
            
if cntall == cnt:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
lst = list(map(int, input().split()))
c = True
for i in lst:
    if i%2 ==0:
        if i%3 != 0 and i%5 != 0:
            c = False
            break
    
if c:
    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()))
z = 'APPROVED'
for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            z = 'DENIED'
            break
print(z)

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

Solution code:
# ABC155
# B Papers,Please
n = int(input())
a = list(map(int, input().split()))
ans = 0
ant = 0
b = []
for i in range(n):
    if a[i] % 2 == 0:
        ant += 1
        b.append(int(a[i]))
        if a[i] % 3 == 0:
            ans += 1
        elif a[i] % 5 == 0:
            ans += 1

if ant == ans:
    if ant > 0:
        print("APPROVED")
    else:
        print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

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


def main():
    solve()


if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
N=int(input())
list1=[]
list2=[]
for i in map(int,input().split()):
    if i % 2 == 0:
        list1.append(i)
    if i % 2 == 0 and (i % 3 == 0 or i % 5 ==0):
        list2.append(i)
if list1 == list2:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
x = "APPROVED"
for i in range(n):
    if a[i] == (2 * int(a[i] / 2)):
        if a[i] != (3 * int(a[i] / 3)):
            if a[i] != (5 * int(a[i] / 5)):
                x = "DENIED"
print(str(x))

Submission status: Accepted

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

l = []
for a in A:
    if a % 2 == 0:
        l.append(a)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    s = list(map(int,input().strip().split()))
    e = []
    for ss in s:
        if ss % 2 == 0:
            e.append(ss)
    
    for ee in e:
        if ee % 3 == 0 or ee % 5 == 0:
            continue
        else:
            print("DENIED")
            return
    
    print("APPROVED")
    return

main()

Submission status: Accepted

Solution code:
import sys
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')
            sys.exit()
print('APPROVED')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin 

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(int(x) for x in input().split() if int(x)%2==0)
ok = True
for i in a:
  if i%3!=0 and i%5!=0:
    print('DENIED')
    ok = False
    break
if ok:
  print('APPROVED')

Submission status: Accepted

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

l=[]
flag=0
for aa in a:
  if aa%2==0:
    flag=1
    l.append(aa)

if flag==1:   
  for ll in l:
    if ll % 3!=0 and ll % 5!=0:
	    flag=2

if flag==0:
  print('APPROVED')
elif flag==1:
  print('APPROVED')
elif flag==2:
  print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

ans = "APPROVED"

for n in range(N):
  if A[n] %2 == 0:
    if A[n] % 3 != 0 and A[n] % 5 != 0:
      ans = "DENIED"
      break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
# Papers, Please
N = int(input())
A = list(map(int, input().split()))
ans = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if (a % 3 != 0) & (a % 5 != 0):
            ans = 'DENIED'
            break
        else:
            continue
    else:
        continue
print(ans)

Submission status: Accepted

Solution code:
import sys

S = int(next(sys.stdin))
A = map(int, next(sys.stdin).strip().split())
even_numbers = filter(lambda y: not y % 2, A)
print('APPROVED' if all(not v % 3 or not v % 5 for v in even_numbers) else 'DENIED')

Submission status: Accepted

Solution code:
N = int(input())
anser = 'APPROVED'
A_list = list(map(int, input().split()))
for A in A_list:
    if A % 2 == 1:
        continue
    if A % 3 == 0:
        continue
    if A % 5 == 0:
        continue
    anser = 'DENIED'
    break
print(anser)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

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

a = np.array(A)

odd = a[a%2 == 0]

if np.sum((odd%3 != 0)&(odd%5 != 0)) == 0:
    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:
import sys

input()
numbers = map(int, input().split())
evens = [number for number in numbers if number % 2 == 0]

if len(evens) == 0:
    print('APPROVED')
    sys.exit()
    
for even in evens:
    if even % 3 != 0 and even % 5 != 0:
        print('DENIED')
        sys.exit()

print('APPROVED')

Submission status: Accepted

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

for n in range(N):
    if A[n] % 2 == 1:
        pass
    elif A[n] % 3 == 0:
        pass
    elif A[n] % 5 == 0:
        pass
    else:
        ans = "DENIED"
        break
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

for i in a:
    if i % 2 ==  0 and i % 3 != 0 and i % 5 != 0:
        ans = 'DENIED'
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    is_approved = True
    for num in A:
        if num % 2 == 0:
            if not (num % 3 == 0 or num % 5 == 0):
                is_approved = False
    if is_approved:
        print("APPROVED")
    else:
        print("DENIED")

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

a = [i for i in a if i%2==0]
a2 = [i for i in a if i%3==0 or i%5==0]

print("APPROVED" if a==a2 else "DENIED")

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(lambda x: int(x), input().split(" ")))
B = list(filter(lambda y: y % 2 == 0 and y % 3 != 0 and y % 5 != 0, A))
print("DENIED") if len(B) > 0 else print("APPROVED")

Submission status: Accepted

Solution code:
import sys


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


def main():
    input = sys.stdin.buffer.readline
    _ = int(input())
    a_list = list(map(int, input().split()))
    print("APPROVED" if solve(a_list) else "DENIED")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
MM = int(input())
AA = input().split()
count = 0
for j in AA:
  i = int(j)
  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 = input()
A_ls = map(int, input().split(' '))
A_ls = [i for i in A_ls if i % 2 == 0]
ls = [i for i in A_ls if i % 3 == 0 or i % 5 == 0]
if len(A_ls) == len(ls):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
is_approved = True
for i in range(N):
    if A[i] % 2 != 0:
        continue
    if A[i] % 3 != 0 and A[i] % 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()))
p=True
for a in A:
  if a%2==0:
    if not (a%3==0 or a%5==0):
      p=False
      break
print("APPROVED" if p else "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:
        if a[i]%3!=0 and a[i]%5!=0:
            tmp += 1
if tmp == 0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split(" ")))
B = ["APPROVED","DENIED"]
t = 0

for i in A:
  if i%2 == 0:
    if i%3 != 0 and i%5 != 0:
      t = 1
      break
print(B[t])

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 or i%5==0:
            pass
        else:
            flg=False
            break
    else:
        pass

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

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
l_odd = []
count = 0

for i in range(n):
  if l[i] % 2 == 0:
    l_odd.append(l[i])
    
for i in range(len(l_odd)):
  if l_odd[i] % 3 == 0 or l_odd[i] % 5 == 0:
    count += 1
if count == len(l_odd):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for n in nums:
    if n % 2 != 0:
        continue

    if n % 3 == 0 or n % 5 == 0:
        continue
    else:
        print("DENIED")
        exit(0)

print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

even = []

for i in ai:
    if i%2 == 0:
        even.append(i)

ok = 0
for i in even:
    if i%3==0 or i%5==0:
        ok += 1

if len(even) == ok:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, A: "List[int]"):
    return ['DENIED', 'APPROVED'][all(a % 2 or a % 3 == 0 or a % 5 == 0 for a in A)]


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(f'{solve(N, A)}')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

x=[]
ans=0
for i in a:
    if i%2==0 :
        x.append(i)
y=[]
for j in x:
    if j%3==0 or j%5==0:
        y.append(j)

if len(x)==len(y):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
a = inpl()

ans = 'APPROVED'
for i in range(n):
    if a[i] % 2 == 0 and a[i] % 3 != 0 and a[i] % 5 != 0:
        ans = 'DENIED'

print(ans)

Submission status: Accepted

Solution code:
input()
print('APPROVED' if all(map(lambda x: x % 3 == 0 or x % 5 == 0, filter(lambda x: x % 2 == 0, map(int, input().split())))) else 'DENIED')

Submission status: Accepted

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

ans = "APPROVED"
for a in A:
    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 = 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()
print("APPROVED")

Submission status: Accepted

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

if(ok):
  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())
a=[int(i) for i in input().split()]
flag=0
for i in range(0,len(a)):
    if(a[i]%2==0 and (a[i]%3==0 or a[i]%5==0)):
        pass
    elif(a[i]%2==0 and (a[i]%3!=0 or a[i]%5!=0)):
        flag=1
        break
if(flag==1):
    print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

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

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

Submission status: Accepted

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

lst = []
for i in A:
    if i % 2 == 0:
        lst.append(i)
lst2 = []
if lst:
    for j in lst:
        if j % 3 == 0 or j % 5 == 0:
            lst2.append(j)
    if lst == lst2:
        print('APPROVED')
    else:
        print('DENIED')
else:
    print('APPROVED')

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
ans=0
for a in A:
    if a%2==0 and a%3!=0 and a%5!=0:
        ans=1
        break
print("ADPEPNRIOEVDE D"[ans::2])

Submission status: Accepted

Solution code:
n = int(input())
numlist = map(int, input().split())
numarr = list(numlist)
isevenList = [i for i in numarr if i % 2 == 0]
answerList = []
for i in isevenList:
    if i % 3 == 0 or i % 5 == 0:
        answerList.append("APPROVED")
    else:
        answerList.append("DENIED")
if "DENIED" in answerList:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
n = int(input())
q = list(map(int,input().split()))
ans = 0
count = 0
for i in q:
    if i%2 == 0:
        alm = i
        count += 1
        if alm%3 == 0 or alm%5 == 0:
            ans += 1
if ans == count:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n=int(input())

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

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

Submission status: Accepted

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