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())
for a in map(int, input().split()):
    if a % 2 == 1:
        pass
    elif a % 3 == 0 or a % 5 == 0:
        pass
    else:
        print('DENIED')
        exit()
print('APPROVED')

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int, input().split()))
li_a = []
for x in li:
  if x%2 == 0:
    li_a.append(x)
a = 0
for y in li_a:
  if y%3 == 0 or y%5 == 0:
    continue
  else:
    a += 1
if a == 0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

li = []

ans = 'APPROVED'

for a in A:
  if a % 2 == 0:
    li.append(a)

for i in li:
  if i % 3 != 0 and i % 5 != 0:
    ans = 'DENIED'

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
can_path = True

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
As = list(map(lambda x: int(x), input().split(" ")))
flag = True

for a in As:
    if a % 2 != 0:
        continue
    if a % 3 != 0 and a % 5 != 0:
        flag = False
        break

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

Submission status: Accepted

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


N = int(input())

A = inpl()

flag = True
for a in A:
    if a % 2 == 1:
        pass
    elif a % 3 == 0 or a % 5 == 0:
        pass
    else:
        flag = False

print("APPROVED" if flag else "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) and (A[i]%3 != 0) and (A[i]%5 != 0):
        ans = 'DENIED'
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
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:
# Code for B - Papers, Please
# Use input() to fetch data from STDIN

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

s = True
for x in a:
    if x % 2 != 0:
        continue
    if not (x % 3 == 0 or x % 5 == 0):
        s = False

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

Submission status: Accepted

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

for i in range(N):
    if A[i] % 2 == 0:
        if (A[i] % 3 == 0) or (A[i] % 5 == 0):
            pass
        else:
            print('DENIED')
            exit()
print('APPROVED')

Submission status: Accepted

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

c=0

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

if c==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 a:
    if not i % 2 == 0:
        continue
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        ans = 'DENIED'

print(ans)

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

n = ni()
a = na()

flag = True

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=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:
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]
A = read_int()

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

if __name__ == "__main__":
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

flag = 1
for a in A:
  if a % 2 == 0:
    if a % 3 == 0 or a % 5 == 0:
      continue
    else:
      flag = 0
print('APPROVED' if flag else 'DENIED')

Submission status: Accepted

Solution code:
N = int(input())

flag_ok = True

As = [int(a) for a in input().split(' ')] 
for Ai in As:
	if Ai%2 == 0:
		if (Ai%3==0) or (Ai%5==0):
			pass
		else:
			flag_ok=False
	else:
		pass
      
if flag_ok:
	print('APPROVED')
else:
	print('DENIED')

Submission status: Accepted

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


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

print(ans)

Submission status: Accepted

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

ret = "APPROVED"

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

print(ret)

Submission status: Accepted

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

if __name__ == '__main__':
  run()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def main():
    flg=True
    input()
    tmp = input().replace('\n','').split()
    for i in tmp:
        i = int(i)
        if i%2 == 0:
            if i%3 != 0 and i%5 != 0:
                flg=False
                break
    if flg:
        print("APPROVED")
    else:
        print("DENIED")
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
li = list(map(int, input().split()))
f = 1

for x in li:
    if x % 2 == 0 and (x % 3 != 0 and x % 5 != 0):
        f = 0

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

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 and (a[i]%3!=0 and a[i]%5!=0):
    count+=1
if count==0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

for i in range(n):
    if ls[i] % 2 == 1:
        if i == n - 1:
            print("APPROVED")
    elif ls[i] % 2 == 0:
        if ls[i] % 3 == 0 or ls[i] % 5 == 0:
            if i == n - 1:
                print("APPROVED")
        else:
            print("DENIED")
            break

Submission status: Accepted

Solution code:
n = int(input())
a = 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:
N = int(input())
A_list = list(map(int, input().split()))
A_filtered = []
for A in A_list:
    if A%2 == 1:
        A_filtered.append(A)
    else:
        if A%3 == 0 or A%5 == 0:
            A_filtered.append(A)
if len(A_filtered) == N:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
s=int(input())
t=list(map(int,input().split()))
a=0
for i in range(s):
  if t[i]%2==0:
    if t[i]%6!=0:
      if t[i]%10!=0:
        a=1
        break
if a==1:
  print('DENIED')
else:
  print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = "APPROVED"
for i in range(N):
    now_num = A_list[i]
    if now_num % 2 == 0:
        if now_num % 3 != 0 and now_num % 5 != 0:
            ans = "DENIED"
            break

print(ans)

Submission status: Accepted

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

res = "APPROVED"
for i in l:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            res = "DENIED"
            break
print(res)

Submission status: Accepted

Solution code:
N = int(input())
H = [int(x) for x in input().split() if int(x) % 2 == 0]

for x in H:
    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()))
answer="APPROVED"
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            answer="DENIED"
print(answer)

Submission status: Accepted

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

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

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

Submission status: Accepted

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


flag = True

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


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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline())
A =list(map(int, sys.stdin.readline().split()))

false_flag = 0

for i in A:
    if (i%2) == 0:
        if (i%3 == 0 or i%5 == 0):
            continue
        else:
            false_flag = 1
            break
if false_flag == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
def solve(n, a):
    for a_i in a:
        if a_i % 2 == 1:
            continue
        if a_i % 3 != 0 and a_i % 5 != 0:
            print("DENIED")
            return
    print("APPROVED")

if __name__ == "__main__":
    n = int(input().strip())
    a = list(map(int, input().strip().split(" ")))

    solve(n, a)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list()

    for i in map(int, input().split()):
        a.append(i)

    flag = True
    for i in a:
        if i % 2 == 0:
            if i % 3 == 0:
                continue
            elif i % 5 == 0:
                continue
            else:
                flag = False
                break

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

def main():
    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 or a[i]%5==0:
                continue
            else:
                ans='DENIED'
                break
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
  for i in range(N):
    if A[i]%2==0:
      if A[i]%3!=0 and A[i]%5!=0:
        print('DENIED')
        return
  print('APPROVED')
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:
        if A[i]%3!=0 and A[i]%5!=0:
            print("DENIED")
            exit()

print("APPROVED")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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


result = 0
for i in range(N):
    if line[i] % 2 == 0:
        if line[i] % 3 == 0 or line[i] % 5 == 0:
            result += 1
    else:
        result += 1
        
if result == N:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

f = True

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

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

Submission status: Accepted

Solution code:
n=int(input())
arr=list(map(int,input().split()))
t=0
for a in arr:
    if a%2==0:
        if a%3==0:
            continue
        elif a%5==0:
            continue
        else:
            t=1
            break
if t==1:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

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

print('APPROVED')

Submission status: Accepted

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

newA = []
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())
A = list(map(int, input().split()))
fl = True
for i in A:
    if i&1:
        continue
    else:
        if i%3!=0 and i%5!=0:
            fl = False
            break

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
A = read_ints()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
.append(要素) リストに要素を追加 
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
from functools import reduce
from operator import mul


Num = int(stdin.readline().rstrip())
data = [int(s) for s in stdin.readline().rstrip().split()]
check = True
for el in data:
    if el % 2 == 0:
        if el % 3 != 0 and el % 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()))

flag = 0

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            flag = 1 
            break

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    a_lst = [int(x) for x in input().split()]
    can = True
    for a in a_lst:
        if a%2 == 0:
            if a%3 == 0 or a%5 == 0:
                continue
            else:
                can = False
    return can
if __name__ == '__main__':
    print('APPROVED' if solve() == True else 'DENIED')

Submission status: Accepted

Solution code:
n = int(input())
List = list(map(int, input().split()))
flag = True

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

Submission status: Accepted

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

for i in even_A:
    if i % 3 != 0 and i % 5 != 0:
        answer = False

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

Submission status: Accepted

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

f = 0

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

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

Submission status: Accepted

Solution code:
#coding:utf-8

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
t, f = [False for _ in range(N)], [False for _ in range(N)]
for i in range(N):
    if A[i] % 6 == 0: #and A[i] % 3 == 0:
        t[i] = True
    if A[i] % 10 == 0:# and A[i] % 5 == 0:
        f[i] = True
    if A[i] % 2 == 1:
        t[i] = True
        f[i] = True
flag = True
for i in range(N):
    if not t[i]:
        if not f[i]:
            flag = False
print("APPROVED" if flag else "DENIED")

Submission status: Accepted

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

d = 0
c = 0
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 ==0:
            c += 1
        else:
            print('DENIED')
            quit()
        d += 1
if c == d:
    print('APPROVED')

Submission status: Accepted

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

flag = True
for a in A:
    if (a%2)!=0:
        continue
    else:
        if(a%3)==0:
            continue
        elif(a%5)==0:
            continue
        else:
            flag=False
            break

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

if __name__ == "__main__":
    run()

Submission status: Accepted

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

flag = 'APPROVED'
for i in a_list:
    if i % 2 == 0:
        if not (i % 3 == 0 or i % 5 == 0):
            flag = 'DENIED'

print(flag)

Submission status: Accepted

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

Submission status: Accepted

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

for i in a:
    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:
N = int(input())
A = list(map(int, input().split()))

logic = True
for a in A:
    logic &= ((a % 2 == 1) or (a % 3 == 0 or a % 5 == 0))

print("APPROVED\n" if logic else "DENIED\n")

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')