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 = 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
            break
if flag:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    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 numpy as np
from sys import stdin
from copy import deepcopy
from functools import reduce
from fractions import gcd
import math
import itertools
from collections import Counter
from itertools import chain  ##list(chain.from_iterable(l)) ##flatten
from heapq import heappush, heappop
import bisect

"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) ## 横一列
A = [int(input()) for _ in range(N)] ## 縦一列
lst = [list(map(int,input().split())) for i in range(M)] ## 二次元
"""

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print('APPROVED')

Submission status: Accepted

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

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

Submission status: Accepted

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


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

print('APPROVED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
ans = True
for a in A:
    if a % 2 == 0 and (a % 3 == 0 or a % 5 == 0):
        pass
    elif a % 2 == 1:
        pass
    else:
        ans = False
print("APPROVED") if ans else print("DENIED")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())
    a = [int(i) for i in input().split()]

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


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    arr = list(map(int,input().split()))
    for i in arr:
        if i%2 == 0:
            if i%3 == 0 or i%5 == 0:
                continue
            print('DENIED')
            return

    print('APPROVED')


main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from bisect import bisect_right, bisect_left
from collections import Counter, deque
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import groupby, permutations, combinations, product
from sys import stdin, stderr


# 最大公約数（ユークリッドの互除法）
# Python3.5 で math.gcd()が追加され、
# AtCoder環境と最新環境でパッケージが分かれてしまったので、自分で書いておく
def gcd(x, y):
    return x if y == 0 else gcd(y, x % y)


# 拡張ユークリッド互除法
# 正整数x, y について、a*x + b*y == gcd(x,y)なるa,bを返す。
# 特に、互いに素なるx, yについては a*x + b*y == 1 となる a, b。
def exgcd(x, y):
    if y == 0:
        return 1, 0
    a, b = exgcd(y, x % y)
    return b, a - (x // y) * b


# 最小公倍数
def lcm(x, y):
    m = gcd(x, y)
    return (x // m) * (y // m)


def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    flag = True
    for x in a:
        if x % 2 == 0:
            if not x % 3 == 0 and not x % 5 == 0:
                flag = False

    return "APPROVED" if flag else "DENIED"


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = inl()
for i in range(n):
    x = a[i]
    if x%2==0 and x%3!=0 and x%5!=0:
        print('DENIED')
        exit()
print('APPROVED')

Submission status: Accepted

Solution code:
'''
n = int(input())
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [int(input()) for i in range n]
p = [list(map(int, input().split()))]

a = input()
a, b = input().split()
a = [input() for i in range n]
'''

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

ans = "APPROVED"
#DENIED
for i in a:
    if i%2 == 1:
        continue
    elif i%3 == 0:
        continue
    elif i%5 == 0:
        continue
    else:
        ans = "DENIED"

print(ans)

Submission status: Accepted

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

A_even = [x for x in A if x % 2 == 0]

res = True
for x in A_even:
    if x % 3 == 0 or x % 5 == 0:
        continue
    res = False
    break

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

Submission status: Accepted

Solution code:
N = input()
arr = [int(x) for x in input().split()]
reject = False
for x in arr:
    if x % 2 == 0:
        if x % 3 != 0 and x % 5 != 0:
            reject = True
if not reject:
    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 not(a[i] % 3 == 0 or a[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 one in A:
    if one%2==0:
        if one %3!=0 and one %5!=0:
            flag = False
if flag:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

for x in l:
    if x % 2 == 0:
        if not (x % 3 == 0 or x % 5 == 0):
            flag = 1

print("APPROVED" if flag == 0 else "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()))

for i in a:
    if i % 2 == 0:
        if i % 3 == 0:
            continue
        elif i % 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 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())
As = list(map(int, input().split()))

ans = 'APPROVED'

for A in As:
    if A%2 == 0:
        if A%3 == 0 or A%5 == 0:
            continue
        else:
            ans = 'DENIED'
            break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
input = raw_input
n = int(input())

flag = True
nums = map(int, input().split(" "))
for num in nums:
    if num % 2 == 0:
        if num % 3 == 0 or num % 5 == 0:
            pass
        else:
            flag = False
            break

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

Submission status: Accepted

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

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


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

Submission status: Accepted

Solution code:
input()
v = list(map(int, input().strip().split()))
if all(i & 1 or i % 3 == 0 or i % 5 == 0 for i in v): 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 and ((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()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
arg = list(map(int, stdin.readline().rstrip().split()))

flag = 0

for i in arg:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            flag = 1
            break

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A1 = list(filter(lambda x: x % 2 == 0, A))
A2 = list(filter(lambda x: x % 3 == 0 or x % 5 == 0, A1))
if len(A1) == len(A2):
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

Solution code:
import sys

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

for i in range(N):
    if NList[i] % 2 == 0:
        if NList[i] % 3 != 0 and NList[i] % 5 != 0:
            print('DENIED')
            sys.exit(0)

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

Submission status: Accepted

Solution code:
#def main(S, b):

if __name__ == '__main__':
    N = int(input())

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

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

Submission status: Accepted

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

ans = 'APPROVED'

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

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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


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


R = judge(A)
if R:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
A = [int(i) for i in 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:
import math
N = input()
nums= list(map(int,input().split(" ")))
flag  =True
for num in nums:
    if num % 2 == 0:
        if num % 3== 0 or num % 5 == 0:
            pass
        else:
            flag = False

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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


def solve(nums):
    for num in nums:
        if num % 2 == 0:
            if num % 3 == 0 or num % 5 == 0:
                continue
            else:
                return 'DENIED'
    return 'APPROVED'


print(solve(nums))

Submission status: Accepted

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

ans = True

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

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

Submission status: Accepted

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

import sys
sys.setrecursionlimit(300000)

YES = 'APPROVED'
NO = 'DENIED'

def solve(n, a):
    for i in range(n):
        if a[i] % 2 or (a[i] % 2 == 0 and (a[i] % 3 == 0 or a[i] % 5 == 0)):
            pass
        else:
            print(NO)
            return
    print(YES)


def main():
    n = int(input())
    a = []
    a = (list(map(int, input().split())))
    solve(n, a)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

    print('APPROVED')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i in a_L:
    if i % 2 == 0:
        if i%3 == 0 or i%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 range(n):
    if a[i]%2 == 1:
        continue
    else:
        if a[i]%3 != 0 and a[i]%5 != 0:
            print('DENIED')
            exit(0)
print('APPROVED')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    #r = stdin.readline()[:-1]
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #n = int(r)
    #a = r.split()
    #a,b,c = r.split()
    #a = list(map(int, r.split()))
    #a,b,c,d = map(int, r.split())
    #a = list(map(int, r.split()))
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    #a = [list(map(int, input().split())) for i in range(1,n+1)]
    #res = 0

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=input()
a=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:
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:
import sys
import math
n = int(input())
#a, b, c = map(int, input().split())
#s = input()
a = list(map(int, input().split()))


for i in range(n):
  if a[i] % 2 == 0:
    if a[i] % 3 == 0:
      continue
    if a[i] % 5 == 0:
      continue
    print("DENIED")
    sys.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=[int(i) for i in input().split()]
for i in range(n):
    if A[i]%2==0 and (A[i]%3!=0 and A[i]%5!=0):
        print("DENIED")
        break
else:
    print("APPROVED")

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
a = li()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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 A:
  if i%2 == 0:
    if (i%3)*(i%5) != 0:
      ans = "DENIED"
      break
print(ans)

Submission status: Accepted

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


print(
  "APPROVED"
  if all(ai % 2 == 1 or ai % 3 == 0 or ai % 5 == 0 for ai in a)
  else "DENIED"
)

Submission status: Accepted

Solution code:
input()
a = list(filter(lambda x : x % 2 == 0, map(int, input().split())))
prev = len(a)
after = len(list(filter(lambda x : x % 3 == 0 or x % 5 == 0, a)))
print("APPROVED" if prev == after else "DENIED")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n=int(input())
l=map(int, input().split())
ans = "APPROVED"

for i in l:
  if i % 2 == 0:
    if i % 3 == 0:
      continue
    if i % 5 == 0:
      continue
      
    ans = 'DENIED'
    
print(ans)

Submission status: Accepted

Solution code:
def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

N = n_in()
A = l_in()
if all(map(lambda a: (a%2 == 1) or (a%3 == 0) or (a%5 == 0),A)):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline

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

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


if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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 i % 3 and i % 5:
            ans = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

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