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:
''' Hey stalker :) '''
INF = 10**10
def main():
    #print = out.append
    ''' Cook your dish here! '''
    n = get_int()
    li = get_list()
    for i in li:
        if i%2==0 and not (i%3==0 or i%5==0):
            print("DENIED")
            return
    print("APPROVED")


''' Pythonista fLite 1.1 '''
import sys
from collections import defaultdict, Counter
#from bisect import bisect_left, bisect_right
#from functools import reduce
#import math
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')

Submission status: Accepted

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

b = []
c = 0
d = 0

for i in range (n):
    if a[i] % 2 == 0:
        b.append(a[i])
        c=c+1

for j in range (c):
    if b[j]%3 == 0 or b[j]%5 == 0:
        d = d
    else:
        d = d+1

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

Submission status: Accepted

Solution code:
def resolve_b():
    n = input()
    l = map(int, input().split())
    c = 0
    even_list = [i for i in l if i % 2 == 0]
    if len(even_list) == 0:
        print("APPROVED")
    else:
        for e in even_list:
            if e % 3 == 0 or e % 5 == 0:
                c+=1
        if c == len(even_list):
            print("APPROVED")
        else:
            print("DENIED")
resolve_b()

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
            break

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
number = input()
num_list = input().split(" ")
odd_list = []
for i in num_list:
	if int(i) % 2 == 0:
		odd_list.append(i)
	else:
		pass
ans = 0
for j in odd_list:
    if int(j) % 5 == 0:
        ans += 1
    elif int(j) % 3 == 0:
        ans = ans + 1
    else:
        pass
if ans >= len(odd_list):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
L = map(int, input().split())
ans = 'APPROVED'
for x in L:
  if x%2==0:
    if not (x%3==0 or x%5==0):
      ans = 'DENIED'
print(ans)

Submission status: Accepted

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

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

for i in li:
  if i % 5 == 0 or i % 3 == 0:
    ans = "APPROVED"
  else:
    ans = "DENIED"
    break
print(ans)

Submission status: Accepted

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

ans=1

for i in a:
  if i%2==0:
    if i%3!=0 and i%5!=0:
      ans=0
      break
      
if ans:
  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()))

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

Submission status: Accepted

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

ans = 'APPROVED'

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

print(ans)

Submission status: Accepted

Solution code:
input();l = list(map(lambda x: True if int(x)%2==1or(int(x)%2==0and(int(x)%3==0 or int(x)%5==0)) else False,input().split()))
print("APPROVED" if sum(l)==len(l) else "DENIED")

Submission status: Accepted

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

def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    ans = 'APPROVED'

    for i in a_list:
        if divide(i, 2):
            if not divide(i, 3) and not divide(i, 5):
                ans = 'DENIED'
                break
    
    print(ans)

def divide(x, k):
    if x % k == 0:
        return True
    return False

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = [int(e) for e in input().split()]
A_even = []
A_1 = []
A_2 = []
for i in range(N):
    if A[i] % 2 == 0:
        A_even.append(A[i])
for i in range(len(A_even)):
    if A_even[i] % 3 != 0:
        A_1.append(A_even[i])
for i in range(len(A_1)):
    if A_1[i] % 5 != 0:
        A_2.append(A_1[i])
if len(A_2) == 0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
def main():
    number = input()
    temp_list = list(map(int, input().split()))
    count_dict = {"APPROVED":0, "DENIED":0}

    for i in temp_list:
        if i%2 == 0 and (i%3 != 0 and i%5 != 0):
           count_dict["DENIED"] += 1
            
    if count_dict["DENIED"] == 0:
        print("APPROVED")
    else:
        print("DENIED")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

flag = 0

for num in num_list:
    if ((num % 2) == 0) and (((num % 3) > 0) and ((num % 5) > 0)):
        flag = 1
        break

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

Submission status: Accepted

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

for i in a:
    if i % 2 == 0:
        new_list.append(i)
    else:
        continue
for i in new_list:
    if i % 3 == 0 or i % 5 == 0:
        count += 1
if count == len(new_list):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
N = int(input()) #入力->3(数値単独型)
L = map(int, input().split())#入力->3 4(数値分割型)
flag = 0
listn = []
for i in L:
    if (i % 2) == 0:
        listn.append(i)

for j in listn:
    if ((j % 3)==0) | ((j % 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 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:
time=int(input())
nums=[int(i) for i in input().split()]
odd=0
even=0
even35=0
for j in range(time):
    if nums[j]%2==0:
        even+=1
        if nums[j]%3!=0 and nums[j]%5!=0:
            continue
        else:
            even35+=1
    else:
        odd+=1
        
if even35==even:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

tmp = 0

for a in A:
  if a % 3 == 0 or a % 5 == 0:
    tmp += 1

if tmp == len(A):
  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 and a[i] % 5 != 0:
      F = 1
      
if F == 1:
  print('DENIED')
else:
  print('APPROVED')

Submission status: Accepted

Solution code:
N = int(input())

A = sorted([int(x) for x in input().split()])
flag = True
isOk = False
for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            isOk = True
        else:
            isOk = False
            flag = False
            break
    else:
        pass


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

Submission status: Accepted

Solution code:
def solve():
    N, *A = map(int, open(0).read().split())
    B = [a for a in A if a % 2 == 0]
    
    for b in B:
        if b % 3 != 0 and b % 5 != 0:
            print('DENIED')
            exit()
    print('APPROVED')


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    N = int(input())
    A = map(int, input().split())
    for a in A: 
        if a % 2 == 0:
            if not (a % 3 == 0 or a % 5 == 0):
                return "DENIED"
    return "APPROVED"

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

Submission status: Accepted

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

L = []
for i in range(N):
    if A[i] % 2 == 1:
        L.append("A")
    elif A[i] % 2 == 0 and A[i] % 3 == 0:
        L.append('A')
    elif A[i] % 2 == 0 and A[i] % 5 == 0:
        L.append('A')
    else:
        L.append('D')
if set(L) == {'A'}:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
from sys import*
n=int(input())
a = [int(i) for i in input().split()]
for i in a:
  if i % 2:
    continue
  if i % 3 and i % 5:
    print("DENIED")
    exit(0)
print("APPROVED")

Submission status: Accepted

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

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

Submission status: Accepted

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

even_As = [a/2 for a in As if a % 2 == 0]
TorF = [True if (half_a % 3 == 0) or (half_a % 5 == 0)
else False
for half_a in even_As 
]

if all(TorF):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
num=int(input())
s=input().split()
res="APPROVED"
for i in range(num):
  if int(s[i])%2==0:
    if int(s[i])%3!=0 and int(s[i])%5!=0:
      res="DENIED"
print(res)

Submission status: Accepted

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

count1 = 0
count2 = 0

for i in range(N):
    if A[i]%2 == 0:
        count1+=1
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            count2 += 1
            
if count1 == count2:
    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]
t = 0
for x in A:
    if x % 3 != 0 and x % 5 != 0:
        t += 1
if t == 0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
List = list(map(int,input().split()))
Answer = 'APPROVED'
for item in List:
  if item%2 == 0 and (item %3 != 0 and item%5 != 0):
    Answer = 'DENIED'
    print(Answer)
    exit()
print(Answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nLen = int(input())
items = input().split()
evens = []

for i in items:
  item = int(i)
  if item % 2 == 0:
    evens.append(item)
    
nLenEvens = len(evens)

OKs = []
for i in evens:
  if i%3 == 0 or i%5 == 0:
    OKs.append(i)
    
if nLenEvens == len(OKs):
	print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = 0
a = []

def format_input(filename = None):
	global n
	global a
	if filename == None:
		n = map(int, input().split())
		a = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(1, 10**2)
		a = [rng(1, 10**3) for i in range(n)]

def get_answer():
	check = 'APPROVED'
	for i in a:
		if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
			check = 'DENIED'
	return check

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)

Submission status: Accepted

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

flag = 0
for num in range(N):
    tmp = A[num]
    flag = 0 if (tmp%2==0 and (tmp%3==0 or tmp%5==0)) or tmp%2==1 else 1
    if flag == 1:
        break

ans = 'APPROVED' if flag==0 else 'DENIED '
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

flag = True
for a in A:
  a = int(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:
N = int(input())
A = list(map(int,input().split()))
X = [i for i in A if i % 2 == 0]
ans = 1
for p in X:
    if p % 3 == 0 or p % 5 == 0:
        pass
    else:
        ans *= 0

if ans == 0:
    print('DENIED')
if ans == 1:
    print('APPROVED')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import numpy as np


N = int(input().strip())
x = [int(str) for str in input().strip().split()]

x = np.array(x)
odd = x[x % 2 == 0]

result = np.all((odd % 3 == 0) | (odd % 5 == 0))

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

Submission status: Accepted

Solution code:
def is_even(num):
    return num % 2 == 0
num = int(input())
fn = list()
input = input().split(" ")
b = list()
for e in input:
  if is_even(int(e)):
    fn.append(e)
for a in fn:
  if int(a) % 3 == 0 or int(a) % 5 == 0:
    b.append("0")
  else:
    b.append("1")
if "1" in b:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

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

result = "APPROVED"

for i in range(N):
    if not( (A[i] % 2 == 1) or ((A[i] % 2 == 0) and (A[i] % 3 == 0 or A[i] % 5 == 0)) ):
        result ="DENIED"
        break

###########　出力
print(result)

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 or A[i] %5 ==0:
      count +=1
    else:
      count -=10000
      break
if count >=0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

hantei = True

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

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

Submission status: Accepted

Solution code:


n = int(input())

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

isApl = True

for num in nums:
    if num%2 == 0:
        if num%3 == 0:
            pass
        elif num%5 == 0:
            pass
        else:
            isApl = False
            break

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

Submission status: Accepted

Solution code:
N = int(input())
doc = [int(x) for x in input().split() if int(x) % 2 == 0]
for i in doc:
  if i % 3 != 0 and i % 5 != 0:
    print('DENIED')
    exit()
print('APPROVED')

Submission status: Accepted

Solution code:
N = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) == len(answer):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
A = input().split()
T = "APPROVED"
for i in range(N):
    m = int(A[i])
    if m % 2 == 0:
        if (m % 3 != 0) and (m % 5 != 0):
            T = "DENIED"
            break
print(T)

Submission status: Accepted

Solution code:
import sys


TEST_INPUT = [
    """
    5
    6 7 9 10 31
    """,
    """
    3
    28 27 24
    """
]
ANSWER = [
    "APPROVED",
    "DENIED"
]


class InputHandler:

    def __init__(self, text_lines="", is_test=False):
        self.data = list(text_lines.split("\n"))
        self.index = 0
        self.is_test = is_test

    def input(self):
        if self.is_test:
            self.index += 1
            return self.data[self.index].strip()
        else:
            return sys.stdin.readline().rstrip()


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


def input_and_solve(ih):
    n = int(ih.input())
    a_list = list(map(int, ih.input().split()))
    res = solve(n, a_list)
    return res


def main():
    ih = InputHandler()
    res = input_and_solve(ih)
    print(res)


def test():
    for test_input, ans in zip(TEST_INPUT, ANSWER):
        ih = InputHandler(test_input, True)
        res = input_and_solve(ih)
        assert str(res) == str(ans)


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = map(int, input().split())
is_approved = False
evens = [a for a in A if a % 2 == 0]
for e in evens:
  if e % 3 != 0 and e % 5 != 0:
    print('DENIED')
    exit()
print('APPROVED')

Submission status: Accepted

Solution code:
n = input()
a = list(map(int, input().split()))
count = 0
for i in a:
    if i % 2 == 1:
        count += 1
    elif i % 6 == 0 or i % 10 == 0:
        count += 1
if count == int(n):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int, input().split()))
count = 0
count2 = 0
for i in range(0, N):
  if L[i]%2==0:
    count = count + 1
    if L[i]%3==0 or L[i]%5==0:
      count2 = count2 + 1

if count == count2:
  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 (a%3!=0)and(a%5!=0):
            print("DENIED")
            flag = False
            break
if flag:
    print("APPROVED")

Submission status: Accepted

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

for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            flag += 1
if flag > 0:
    print("DENIED")

else:
    print("APPROVED")

Submission status: Accepted

Solution code:
n = input()
arr = [int(_) for _ in input().split() if int(_) % 2 == 0 and int(_) % 3 != 0 and int(_) % 5 != 0]
 
if len(arr) == 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 (i % 30) in [2, 4, 8, 14, 16, 22, 26, 28]:
		ANS = 'DENIED'

print(ANS)

Submission status: Accepted

Solution code:
inp = int(input())

data = input().split(' ')
count = 0
for i in range(0, inp):
  if int(data[i]) % 2 != 0:
    pass
  if int(data[i]) % 2 == 0:
    if int(data[i]) % 3 != 0 and int(data[i]) % 5 != 0:
      count += 1

if count >= 1:
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

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

k = []
for e in j:
    if e % 2 == 0:
        k.append(e * e)
l = []
for f in k:
    if f % 3 != 0:
        l.append(f * f)
m = []
for g in l:
    if g % 5 != 0:
        m.append(g * g)
if len(m) == 0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
import numpy as np

N = int(input())

An = np.array(input().split(" "), dtype=np.int)

out = 1

for ai in An:
    if ai % 2 == 0:
        if ai % 3 == 0 or ai % 5 == 0:
            pass
        else:
            out = 0

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

Submission status: Accepted

Solution code:
def check(a):
    for i in range(n):
        if a[i] % 2 == 0:
            if (a[i] % 3 != 0) and (a[i] % 5 != 0):
                return "DENIED"
    return "APPROVED"


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

print(check(a))

Submission status: Accepted

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

even_list = []
for a in a_list:
    if a%2==0:
        even_list.append(a)

ans = True
for e in even_list:
    if e%3==0 or e%5==0:
        ans = True
    else:
        ans = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
bomb = []
kotae = []
hako = list(map(int, input().split()))
for h in hako:
  if h % 2 == 0:
    bomb.append(h)
for h in bomb:
  if h % 3 == 0 or h % 5 == 0:
    kotae.append(h)
if len(kotae) == len(bomb):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

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

chk = 0
for i in range(0,N):
    if A[i]%2 == 0:
        if A[i]%3 == 0 or A[i]%5 == 0:
            continue
        else:
            chk += 1

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

Submission status: Accepted

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

result = True
for a in A:
    aint = int(a)
    if aint % 2 == 0:
        if aint % 3 != 0 and aint % 5 != 0:
            result = False

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

Submission status: Accepted

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

for a in A:
  if(a%2==0):
    if(a%3==0 or a%5==0):
      continue
    else:
      print("DENIED")
      sys.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:
            if a[i]%5!=0:
                ans=1
if ans==0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

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

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:
            b+=0
        elif x%5==0:
            b+=0
        else:
            b+=1
            break
if b==0:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))
lf = list(filter(lambda x:x%2==0,l))
print(['DENIED','APPROVED'][all([i%3==0 or i%5==0 for i in lf])])

Submission status: Accepted

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

def f(a):
  if (a % 2 == 0):
    if (a % 3 == 0 or a % 5 == 0):
      return 1
    else:
  	  return 0
  return 1

ans = list(map(f,A))
if (len(ans) == sum(ans)):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Accepted

Solution code:
#At coder 2020/2/16 B

# スペース区切りのサイズNの配列の入力
# スペース区切りのサイズNの配列の入力
N = int(input())
A = list(map(float, input().split())) 

U='APPROVED'


jj=0
for jj in range(len(A)):
    #jj=jj+1
    A2=A[jj]%2
    A3=A[jj]%3
    A5=A[jj]%5
    if A2==0:
        if A3!=0 and A5!=0:
            U='DENIED'
            break


print(U)

Submission status: Accepted

Solution code:
n = input()
n = int(n)
ary = (int(x) for x in input().split())
flg = True
for num in ary:
    if num % 2 == 0:
        #偶数の時
        if num % 3 == 0:
            #で割り切れる
            pass
        elif num % 5 == 0:
            #5で割り切れる
            pass
        else:
            flg = False
    else:
        pass
        #奇数の時
if flg:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

for i in A_list:
  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())
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):
            f=0
        else:
            f=1
            break
if(f==0):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
# ABC155 B

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

for num in A:
    if num % 2 == 0:
        if (num % 3 == 0) or (num % 5 == 0):
            pass
        else:
            res += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8


def main():
    _ = int(input())
    ints = list(map(int, input().split(' ')))

    for int_ in ints:
        if int_ % 2 == 0:
            if int_ % 3 == 0 or int_ % 5 == 0:
                pass
            else:
                print('DENIED')
                return 0
        else:
            pass

    print('APPROVED')

    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

if even == []:
    print('APPROVED')
    exit()

for i in even:
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        print('DENIED')
        exit()
    
print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lenght = int(input())
allNum = input().split()
denied = False
for i in allNum:
  i = int(i)
  if(i % 2 == 0):
    if(i % 3 == 0 or i % 5 == 0):
      continue
    else:
      denied = True
      break
if(denied):
  print("DENIED")
else:
  print("APPROVED")

Submission status: Accepted

Solution code:
N=int(input())
mylist=list(map(int, input().split()))
answer=0

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

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]/2)
fl=0
for i in range(len(b)):
    if b[i]%3==0 or b[i]%5==0:
        fl+=0
    else:
        fl+=1
if fl==0:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
_ = input()

A = 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 = [int(x) for x in input().split()]

s = "APPROVED"

for i in a:
    if i % 2 == 1:
        continue
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    s = "DENIED"
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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

if c:
    print("APPROVED")

Submission status: Accepted

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

x = [i for i in a if i % 2 == 0]
for i in x:
    if i % 3 == 0 or i % 10 == 0:
        count += 1

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