Problem:


Score: 200 points

Problem Statement

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

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

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

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

Notes

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

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq A_i \leq 1000

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \dots A_N

Output

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

Sample Input 1

5
6 7 9 10 31

Sample Output 1

APPROVED

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

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

Sample Input 2

3
28 27 24

Sample Output 2

DENIED

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



Sample input:
5
6 7 9 10 31


Sample output:
APPROVED

Submission status: Accepted

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

arr=[x%2==1 or x%6==0 or x%10==0 for x in a]

print('APPROVED' if all(arr) else 'DENIED')

Submission status: Accepted

Solution code:
n = input()
# n, k = map(int, input().split())
p = list(map(int, input().split()))
# s = input().split()
list =[]


for i in p:
    if i % 2 == 0:
        list.append(i)

count = 0
for i in list:
    if i % 3 == 0 or i % 5 == 0:
        count += 1

if len(list) == count:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = map(int, input().split())
A = np.array(list(A))

def myfunc(A):
    A = A[np.mod(A,2) == 0]
  
    if len(A) == 0:
        return("APPROVED")
      
    BIN = (np.mod(A,3) == 0) | (np.mod(A,5) == 0) 
    
    if len(BIN) == np.sum(BIN):
        return("APPROVED")
    else:
        return("DENIED")

print(myfunc(A))

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

Submission status: Accepted

Solution code:
import sys
import numpy as np

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

f = True
for A in As:
    if A % 2 == 0 and not (A % 3 == 0 or A % 5 == 0):
        f = False
        break

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans='APPROVED'

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

even_list = [i for i in A if i % 2 == 0]

special =[i for i in even_list if i % 3 == 0 or i % 5 ==0]

n_1=len(even_list)
n_2=len(special)

if n_1 == n_2:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:

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

def main(lst_A):
    
    lst_even  = [A for A in lst_A if A % 2 == 0]
    lst_match = [
        even_A for even_A in lst_even
        if even_A % 3 == 0 or even_A % 5 == 0
    ]

    if len(lst_match) == len(lst_even):
        return "APPROVED"
    else:
        return "DENIED"

if __name__ == "__main__":

    answer = main(lst_A)
    print(answer)

Submission status: Accepted

Solution code:
cnt = int(input())
tar_list = list(map(int, input().split()))
flg = False
for i in range(cnt):

  if tar_list[i] % 2 == 0:
    if tar_list[i] % 3 == 0 or tar_list[i] % 5 == 0:
      flg = False
    else:
      flg = True
      print("DENIED")
      break
      
if flg == False:
  print("APPROVED")

Submission status: Accepted

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

# process
result = True
for a in A:
    if a%2 == 0:
        if not (a%3 == 0 or a%5 == 0):
            result = False
            break

# output
print("APPROVED" if result else "DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N =int(input())
A = list(int(x) for x in input().split())
check = True

for x in A:
  if x % 2 == 0 and (x % 3 != 0 and x % 5 != 0):
    check = False

if check == True:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import numpy as np

N=int(input())
A=np.array(input().split(),dtype=np.int32)

out=A[A%2==0]

flag=False
for i in range(len(out)):
    if(out[i]%3==0 or out[i]%5==0):
        pass
    else:
        flag=True

if(flag):
    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 % 6 != 0 and i % 10 != 0:
            print('DENIED')
            break
else:
    print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
hantei = True
for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            hantei = False
            break

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

Submission status: Accepted

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

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

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            print("DENIED")
            sys.exit()

print("APPROVED")

Submission status: Accepted

Solution code:
import sys
n = int(input())

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

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

print('APPROVED')

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
f = True
for i in a:
    if i % 2:
        continue
    if i % 3 and i % 5:
        f = False
        break

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

Submission status: Accepted

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

res = "APPROVED"

for i in range(N):
  # 偶数が3or5で割り切れるので、まずは偶数判定をする
  if(A[i] % 2 == 0):
    # 3でも5でも割り切れない = 余りが出たら、DENIED
    if(A[i] % 3 != 0 and A[i] % 5 != 0):
      res = "DENIED"
      break


print(res)

Submission status: Accepted

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

Submission status: Accepted

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

even_list = filter(lambda x: x % 2 == 0, a)

is_approved = True

for i in even_list:
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        is_approved = False
        break

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

Submission status: Accepted

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

for i in A:
    if i%2==0:
        if i%6!=0 and i%10!=0:
            print("DENIED ")
            exit()
else:
    print("APPROVED ")

Submission status: Accepted

Solution code:
# ｴ゛ｳ゛ｴ゛ｳ゛ｴ゛ｳ゛ｱ゛ｧ゛ｱ゛ｧ゛ｲ゛ｨ゛
N = int(input())
A = map(int, input().split())
flag = 0
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
from io import StringIO
import unittest

def resolve():
    n=int(input().strip())
    la= list(map(int,input().strip().split()))

    res="APPROVED"

    for a in la:
        if a%2==0:
            if a%3==0 or a%5==0:
                a=1
            else:
                res="DENIED"

    print(res)

resolve()

Submission status: Accepted

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

for i in range(N):
  if A_list[i] % 2 == 0:
    if A_list[i] % 3 != 0 and A_list[i] % 5 !=0:
      print("DENIED")
      exit()

print("APPROVED")

Submission status: Accepted

Solution code:
N = input()
line = input().split(" ")

for l in line:
    i = int(l)
    if i % 2 == 0:
        if (i % 3 == 0) or (i % 5 == 0):
            pass
        else:
            print("DENIED")
            exit()

print("APPROVED")

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
flag = 0
for i in range(N):
    if P[i] % 2 == 0:
        if P[i] % 3 != 0:
            if P[i] % 5 != 0:
                flag = 1

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

Submission status: Accepted

Solution code:

N = int(input())

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

result = "APPROVED"
for n in L:
    if n % 2 == 1:
        continue
    if not (n % 3 == 0 or n % 5 == 0):
        result = "DENIED"
        break


print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

flag = 0
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 != 0 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()))

ans = 'APPROVED'
for i in range(N):
    a = A[i]
    if a % 2 == 1:
        continue
    
    if a % 6 != 0 and a % 10 != 0:
        ans = 'DENIED'

print(ans)

Submission status: Accepted

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

flag = "APPROVED"

for ele in arr:
  if ele % 2 == 0:
    if ele % 3 == 0 or ele % 5 == 0:
      pass
    else:
      flag = "DENIED"
      break

print(flag)

Submission status: Accepted

Solution code:
a  = int(input())

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

flg = True

for i in l:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            flg = False
            break

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

Submission status: Accepted

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

appr = True

for k in A:
  if k % 2 == 1:
    continue
  elif k % 3 == 0:
    continue
  elif k % 5 == 0:
    continue
  else:
    appr = False
    break

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
N=int(input())
A=list(map(int,input().split()))
Flg=True
cnt=0
for i in range(N):
    if A[i]%2==0:
        if A[i]%3==0 or A[i]%5==0:
            cnt+=1
        
    else:
        cnt+=1

if cnt==N:
    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 or A[i]%5==0:
            pass
        else:
            Ans="DENIED"
    else:
        pass

print(Ans)

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = []
ans='APPROVED'

for i in A:
    if (i % 2 == 0):
        B.append(i)

for i in B:
    if (i % 3 != 0 and i % 5 != 0):
        ans = 'DENIED'
        break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
An = [int(v) for v in input().strip().split() if int(v) % 2 == 0]
iAn = [v for v in An if v % 3 != 0 and v % 5 != 0]
print('APPROVED' if len(iAn) == 0 else 'DENIED')

Submission status: Accepted

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

f = 0
for a in range(len(A)):
  if A[a] % 2 != 0:
    continue
  else:
    if A[a] % 3 != 0 and A[a] % 5 != 0:
      f = 1
      break
      
if f == 1:
  print('DENIED')
else:
  print('APPROVED')

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    res = 'APPROVED'

    for i in range(N):
        temp = A[i]
        if temp % 2 == 0:
            if (temp%3!=0) & (temp%5!=0):
                res = 'DENIED'
                break

    print(res)



main()

Submission status: Accepted

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

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

Y=0
for i in range(len(X)):
    if X[i]%3!=0 and X[i]%5!=0:
        Y+=1

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

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(input())
Data = input().split(" ")
for i in range(N):
  Data[i] = int(Data[i])

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

Submission status: Accepted

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

Submission status: Accepted

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

for x in a:
    if x%2 == 1:
        continue
    elif x%5 == 0 or x%3 == 0:
        continue
    else:
        print('DENIED')
        exit()

print('APPROVED')

Submission status: Accepted

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

allowed = True
for v in a:
    if v & 1 == 0:
        if v % 3 != 0 and v % 5 != 0:
            allowed = False
            break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

if __name__=="__main__":
    n = int(input())
    a  = [int(x) for x in input().split()]
    
    approved = True
    for i in range(n):
        if a[i]%2 == 0:
            if a[i]%3 == 0 or a[i]%5 == 0:
                continue
            else:
                approved = False
                break
    
    if approved:
        print("APPROVED")
    else:
        print("DENIED")

Submission status: Accepted

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

for a in al:
    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()))

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

C = len(B)
s = 0
for i in B:
    if i%3==0 or i%5==0:
        s += 1

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(lambda x: int(x), input().split()))
flag = True
for i in a:
    if(i%2 != 0): continue
    if(i%3 != 0 and i%5 != 0): flag = False

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

Submission status: Accepted

Solution code:
import math

N = int(input())
A = []
A = input().split()

hantei = True

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

if hantei == True:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

s=[]

def f(k):
  if k%3==0:
    return True
  elif k%5==0:
    return True
  else:
    return False

r="APPROVED"
  
for i in a:
   if i%2==0:
      if f(i)==False:
        r="DENIED"
        
print(r)

Submission status: Accepted

Solution code:
n = int(input())

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

even = []
judgment = True
for i in a:
    if i % 2 == 0:
        even.append(i)
for i in even:
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        judgment = False
if judgment:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

print("APPROVED")

Submission status: Accepted

Solution code:

n = int(input())
l = list(map(int,input().split()))
#print(l)

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

x = 0
for j in range(len(a)):
    if a[j] % 3 ==0 or a[j] % 5 ==0:
        x += 1
if x == len(a):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

evens = [x for x in numbers if x % 2 == 0]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    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')

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

aa = filter(lambda num: True if num % 2 == 0 else False, a)
for num in aa:
    if (num % 3 != 0) and (num % 5 != 0):
        ans = 'DENIED'

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def check(s,A):
    A = [int(i) for i in A.split()]    
    B = [i for i in A  if i%2 ==0]
    
    for b in B:
        if b % 3 != 0 and b %5!=0:
            print('DENIED')
            return
    print('APPROVED')
    
s = int(input())
A = input()
check(s,A)

Submission status: Accepted

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

  r = 'APPROVED'

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

Submission status: Accepted

Solution code:
n = int(input())
aList = list(map(int, input().split()))
aList = filter(lambda n:n%2==0, aList)   

for a in aList:
  if a % 3 == 0 or a % 5 == 0:
    continue;
  print('DENIED')
  exit()
print('APPROVED')

Submission status: Accepted

Solution code:
def check_evens_divisible_3and5(A):
  for val in A:
    if val%2==0:
      if (val%3 != 0) and (val%5 != 0): return "DENIED"
  return "APPROVED"

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

print(check_evens_divisible_3and5(A))

Submission status: Accepted

Solution code:
N = int ( input().strip() ) ;
L = list (map ( int , input().strip().split(" " ) ) ) ;
L = list( filter (lambda x:x%2==0 ,  L )) ;

if all ( map( lambda x:x%3==0 or x%5==0  , L ) ) :
	print ( "APPROVED" ) ; 
else :
	print ("DENIED") ;

Submission status: Accepted

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

Submission status: Accepted

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

print("APPROVED")

Submission status: Accepted

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

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

if flag == True:
    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==1:
        if i==n-1:
            print("APPROVED")        
        else:
            continue
    if a[i]%2==0:
        if a[i]%3==0 or a[i]%5==0:
            if i==n-1:
                print("APPROVED")
            else:
                continue
        else:
            print("DENIED")
            break

Submission status: Accepted

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

s = "APPROVED"

for i in A:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            s = "DENIED"

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if cnt > 0:
	print('DENIED')
else:
	print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[int(x) for x in input().split()]
flg=True
for i in a:
    if i%2 == 0:
        if i%3 == 0 or i%5 == 0:
         flg=True
        else:
         flg=False
         break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    n = int(input())
    l = [int(i) for i in input().split(" ")]
    is_denied = False
    for i in l:
        if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
            is_denied = True
            break

    if is_denied == False:
        print("APPROVED")
    else:
        print("DENIED")

Submission status: Accepted

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

ans = True
for v in A:
    if v % 2 == 0:
        if v % 3 == 0 or v % 5 == 0:
            ans = ans and True
        else:
            ans = ans and False

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

Submission status: Accepted

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


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

Submission status: Accepted

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


def func(A):
    for a in A:
        if not a % 2:
            if not a % 3 or not a % 5:
                pass
            else:
                return "DENIED"
    return "APPROVED"


print(func(A))

Submission status: Accepted

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

def main():
  n = int(input())
  As = map(int, input().strip().split())
  for A in As:
    if A%2 == 0:
      if (A%3==0 or A%5==0):
        continue
      else:
        print('DENIED')
        return
  print('APPROVED')

if __name__=='__main__':
  main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

for value in A:
    if value % 2 == 0:
        if value % 3 != 0 and value % 5 != 0:
            flag = True

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

Submission status: Accepted

Solution code:
# 2020/02/16
# AtCoder Beginner Contest 155 - B

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

# Calc
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

# Output
print(ans)

Submission status: Accepted

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

flag = True
for a in A:
    if a%2 == 0:
        if a%3 != 0 and 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 range(n):
  if a[i]%2==0:
    if a[i]%3!=0 and a[i]%5!=0:
      print('DENIED')
      sys.exit()
print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N) :
    if A[i] % 2 == 0 :
        if (A[i] % 3 == 0) or (A[i] % 5 == 0) :
            pass
        else :
            buf = False
            break

if buf == True :
    print('APPROVED')
else :
    print('DENIED')

Submission status: Accepted

Solution code:
a, *a_n = map(int, open(0).read().split())


flag = 1
for num in a_n:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            flag = 0
            break
        
if flag == 1:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
from functools import reduce
input()
a = map(int, input().split())
def test(n):
    if n % 2 == 1:
        return True
    else:
        return n % 3 == 0 or n % 5 == 0
print('APPROVED' if reduce(lambda x, y:x and y, map(test, a)) else 'DENIED')

Submission status: Accepted

Solution code:
def jud_oe(x):
    if x%2 == 0:
        if (x%3 == 0) or (x%5 ==0):
            return 1
        else:
            return 0
    else:
        return 1


n = int(input())
a = list(map(int,input().split()))
b = list(map(jud_oe,a))
judge = 0 in b
# print(b)
if judge:
    print("DENIED")
else:
    print("APPROVED")

Submission status: Accepted

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

import pdb
import sys
F = sys.stdin

N = int(F.readline().rstrip())
A = list(map(int,F.readline().rstrip().split()))

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

print('APPROVED')