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()))
print('APPROVED' if all(ai % 3 == 0 or ai % 5 == 0 for ai in a if ai % 2 == 0) else 'DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
I=list(map(int,input().split()))
for i in range(n):
    if (I[i]%2==0):
        if (I[i]%3!=0) and (I[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()))

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

if all([B[j]%3==0 or B[j]%5==0  for j in range(len(B))]):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#l = list(map(int, input().split()))

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"
            break
print(ans)

Submission status: Accepted

Solution code:
# abc155_b.py
# https://atcoder.jp/contests/abc155/tasks/abc155_b

# B - Papers, Please /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点: 200点

# 問題文
# あなたは AtCoder 王国の入国審査官です。
# 入国者の書類にはいくつかの整数が書かれており、あなたの仕事はこれらが条件を満たすか判定することです。
# 規約では、次の条件を満たすとき、またその時に限り、入国を承認することになっています。
#     書類に書かれている整数のうち、偶数であるものは全て、3または 5で割り切れる。
# 上の規約に従うとき、書類に N個の整数 A1,A2,…,ANが書かれた入国者を承認するならば APPROVED を、しないならば DENIED を出力してください。

# 注記
#     問題文中の条件は、「xが書類に書かれている整数のうち、偶数であるものならば、x は 3 または 5で割り切れる。」 
#     と言い換えられます。 ここで、「または」 「ならば」 は論理学における意味です。

# 制約
#     入力はすべて整数
#     1≤N≤100
#     1≤Ai≤1000

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# A1 A2 … AN

# 出力
# 規約に従うとき、入国者を承認するならば APPROVED を、しないならば DENIED を出力せよ。

# 入力例 1
# 5
# 6 7 9 10 31

# 出力例 1
# APPROVED

# 書類に書かれている整数のうち、偶数であるものは 6,10です。
# これらは全て 3または 5で割り切れるので、この入国者は承認します。

# 入力例 2
# 3
# 28 27 24

# 出力例 2
# DENIED

# 28が条件を満たさないので、この入国者は承認しません。


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    result = 'APPROVED'
    for n in range(N):
        if values[n] % 2 == 0:
            if values[n] % 3 != 0 and values[n] % 5 != 0:
                result = 'DENIED'

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['5', '6 7 9 10 31']
        lines_export = ['APPROVED']
    if pattern == 2:
        lines_input = ['3', '28 27 24']
        lines_export = ['DENIED']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = input()

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

odd = [ c for c in l if (c % 2 == 0 ) and (( c % 3 != 0) and ( c % 5 !=0 ))]
if len( odd ) == 0: 
  print( "APPROVED" )
else:
  print( "DENIED" )

Submission status: Accepted

Solution code:
def papers_please():
    # 入力
    N = int(input())
    A = list(map(int, input().split()))
    # 処理
    for one_num in A:
        # 偶数
        if one_num % 2 == 0:
            # 3 or 5 で割り切れる
            if one_num % 3 == 0 or one_num % 5 == 0:
                pass
            # 割り切れない
            else:
                return 'DENIED'
        # 奇数
        else:
            pass
    # 3 or 5 で割り切れない偶数がない場合
    return 'APPROVED'

result = papers_please()
print(result)

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

Submission status: Accepted

Solution code:
import numpy as np
stdin = open(0)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

num2=[]
for i in num:
    if i%2==0:
        num2.append(i)
num3=[]        
for j in num2:
    if j%3==0 or j%5==0:
        num3.append(0)
    elif j%3!=0 or j%5!=0:
        num3.append(1)

a=sum(num3)

if a==0:
    print("APPROVED")
elif a!=0:
    print("DENIED")

Submission status: Accepted

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

A = LI()

ans = True
for a in A:
    if a % 2 != 0:
        continue

    if a % 3 != 0 and a % 5 != 0:
        ans = False

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

Submission status: Accepted

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

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


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:
        continue
    else:
        if not a%3 or not a%5:
            continue
        else:
            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:
        if i % 3 != 0 and i % 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:
            break
else:
    print("APPROVED")
    sys.exit()

print("DENIED")

Submission status: Accepted

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

if not ( 1 <= N <= 100 ): sys.exit()
if not ( 1 <= min(array) and max(array) <= 1000 ): sys.exit()

for I in array:
    if I % 2 == 0 and 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(input())
data=list(map(int,input().split()))
for i in data:
    if i%2==1:
        continue
    if i%3!=0 and i%5!=0:
        print("DENIED")
        sys.exit()
print("APPROVED")

Submission status: Accepted

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

even_numbers = [a for a in A if a % 2 == 0]

is_approved = all([even_num % 3 == 0 or even_num % 5 == 0 for even_num in even_numbers])

if is_approved:
    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 and 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()))

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()))
res = 'APPROVED'
for x in a:
    if x % 2 == 0 and x % 3 != 0 and x % 5 != 0:
        res = 'DENIED'
print(res)

Submission status: Accepted

Solution code:
N = int(input())

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

result = 'APPROVED'


        
for i in range(0,N):
  if a[i] %2 == 0:
     if (a[i] %3 != 0) and (a[i] %5 != 0):
        result ='DENIED'

        break
        
        
print (result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
_ = input()
A = [int(i) for i in input().split()]
result = {True: "APPROVED", False: "DENIED"}
print(result[all([a % 2 == 1 or (a % 3 == 0 or a % 5 == 0) for a in A])])

Submission status: Accepted

Solution code:
n = int(input())

a = list(map(int, input().split()))
z = []
for i in a:
  if i % 2 == 0:
    z.append(i)


if all(j % 3 == 0 or j % 5 == 0 for j in z):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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


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


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    A = LI()

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

    print("APPROVED")


main()

Submission status: Accepted

Solution code:
N = int(input())
A = [int(a) for a 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=list(map(int,input().split()))
b=0
for x in A:
  if x%2==0:
    if x%3==0 or x%5==0:
      pass
    else:
      b=1
      break
if b==0:
  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 = list(map(int, input().split())) 

ans = 'APPROVED'

for i in range(0,N):
    if (A[i]%2)==0:
        if not ((A[i] % 3) == 0 or (A[i] % 5) == 0):
            ans = 'DENIED'
            break

print(ans)

Submission status: Accepted

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

ans = 'APPROVED'

for i in a:
  if i % 2 == 0:
    if 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()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
al = list(map(int,input().split()))
bl = []
count = 0
#print(al)

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

#print(bl)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
a = intl()

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
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n = I()
    a = Intl()
    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()))

for a in A:
    if a % 2 == 1:
        continue
    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 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()))

count = 0
ok = 0
for i in A:
    if i % 2 == 0:
        count += 1
        if i % 3 == 0 or i % 5 == 0:
            ok += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(input().split())
tmp = []
flag = 0
for i in range(n):
    if int(a[i]) % 2 == 0:
        tmp.append(a[i])
for j in range(len(tmp)):
    if int(tmp[j]) % 3 == 0 or int(tmp[j]) % 5 == 0:
        continue
    else:
        flag = 1
if flag == 1 : print("DENIED")  
else : print("APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

flag = True
for n in A:
    if n % 2 == 0 and (n % 3 != 0 and n % 5 != 0):
        flag = False
print("APPROVED" if flag else "DENIED")

Submission status: Accepted

Solution code:
n=int(input())

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

t=1

for i in range(n):
    if a[i]%2==0 and a[i]%3==0:
        t=1
    elif a[i]%2==0 and a[i]%5==0:
        t=1
    elif a[i]%2==1:
        t=1
    else:
        t=0
        break 

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

Submission status: Accepted

Solution code:
input()
*l,=map(int,input().split())
print( len(set([1 for i in l if i%2==0 and (i%3!=0 and i%5!=0)]))*"DENIED" or 'APPROVED')

Submission status: Accepted

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
a = np.array([a for a in map(int, input().split()) if a % 2 == 0])
b = (a % 3) * (a % 5)
print('APPROVED' if b.sum() == 0 else 'DENIED')

Submission status: Accepted

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

qual = all(v % 2 == 1 or (v % 3 == 0 or v % 5 == 0) for v in vals)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Papers, Please

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

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

print("APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
a=[]
b=[]
for i in A:
    if i%2==0:
        a.append(i)
for n in a:
    if n%3==0 or n%5==0:
        b.append(n)
if len(a)==len(b):
    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 and A[i] % 6 != 0 and A[i] % 10 != 0:
    ans = 'DENIED'
    break

print(ans)

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:
    if a[i]%3 !=0:
      if a[i]%5 !=0:
        b.append(0)
        break
if 0 in b:
  print('DENIED')
else:
  print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
c=list(map(int, input().split()))
ans = 0
ans2 = 0

for i in c:
    if i%2 == 0:
        ans += 1
        if i%3 ==0 or i%5 == 0:
            ans2 += 1

if ans == ans2:
    print('APPROVED')
if ans != ans2:
    print('DENIED')

Submission status: Accepted

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

ans = 'APPROVED'
for a_i in a:
    if a_i % 2 == 0:
        if not ((a_i % 3 == 0) or (a_i % 5 == 0)):
            ans = 'DENIED' 
            break
print(ans)

Submission status: Accepted

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

flag = 1
for i in range(len(A)):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      flag = 0
      break
print(['DENIED', 'APPROVED'][flag])

Submission status: Accepted

Solution code:
def main():

    N = int(input())
    A = list(map(int, input().split()))
    even = [v for v in A if v % 2 == 0]
    if all((v % 3 == 0) or (v % 5 == 0) for v in even):
        return "APPROVED"
    return "DENIED"

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
count=0
for i in range(len(A)):
  if A[i]%2==0:
    if A[i]%3==0 or A[i]%5==0:
      count+=1
  else:
    count+=1
if count==len(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 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:
n = int(input())
a = list(map(int,input().split()))
even_list = []
for i in range(n):
    if a[i] % 2 == 0:
        even_list.append(a[i])

x = 0
for m in range(len(even_list)):
    if even_list[m] % 3 == 0 or even_list[m] % 5 == 0:
        x += 1

if  x == len(even_list):
    print('APPROVED')

else:
    print('DENIED')

Submission status: Accepted

Solution code:
def main():
    N=int(input())
    A=list(map(int, input().split()))
    even=[i for i in A if i % 2 == 0]
    for i in even:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            print('DENIED')
            return
    print('APPROVED')
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'
print(ans)

Submission status: Accepted

Solution code:
if __name__ == '__main__':

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

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

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

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

Submission status: Accepted

Solution code:
import sys
N = int(input())
A = list(map(int,input().split()))
count = 0
frag = 0
for i in range(N):
  if A[i]%2 == 0:
    count = count+1
    if A[i]%3 == 0 or A[i]%5 == 0:
      frag = frag+1
if frag == count:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = [x for x in A if x % 2 == 0 and x % 3 != 0 and x % 5 != 0]
if len(B) > 0:
    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):
    if a[i]%2==0:
        if a[i]%3==0 or a[i]%5==0:
            continue
        else:
            ans="DENIED"
            break
print(ans)

Submission status: Accepted

Solution code:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()

a = LIST()
flag = 0
for el in a:
    if(el%2==0):
        if(el%3==0 or el%5==0):
            continue
        else:
            flag = 1
            break
if(flag==0):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
            continue
        else:
            print("DENIED")
            exit()

print("APPROVED")

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