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.

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    for i in a:
        if i%2:
            continue
        if i%3 == 0 or i%5 == 0:
            continue
        print("DENIED")
        break
    else:
        print("APPROVED")
    return


if __name__ == "__main__":
    solve()

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

Solution (Python):

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    def ok():
        for a in aa:
            if a%2==0:
                if a%3 and a%5:return False
        return True

    n=II()
    aa=LI()
    if ok():print("APPROVED")
    else:print("DENIED")

main()

Solution (Python):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


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

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

Solution (Python):



from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe




def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(x):
    print(x,file=sys.stderr)
def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)



def pin(type=int):
    return map(type,input().split())

"""
愚直に操作を実装する
"""

cond=1
N=int(input())
A=list(pin())
for num in A:
    if num%2==0:
        if num %3!=0 and num%5!=0:
            cond= 0
print(["DENIED","APPROVED"][cond])

Solution (Python):





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

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15


def main():
    n = getN()
    
    nums = getlist()
    for num in nums:
        if num % 2 == 0 and num % 3 != 0 and num % 5 != 0:
            print("DENIED")
            return

    print("APPROVED")

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()

lst = []
for i in range(n):
    if a[i] % 2 == 0:
        lst.append(a[i])

for i in lst:
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    print('DENIED')
    quit()
print('APPROVED')

Solution (Python):
from collections import deque
from itertools import chain, combinations
import json
import numpy as np


def main():
    N = int(input())
    A = [int(a) for a in input().split()]

    l = all((a % 5 == 0 or a % 3 == 0) for a in A if a % 2 == 0)

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


if __name__ == "__main__":
    main()

Solution (Python):
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(0)
print("APPROVED")

Solution (Python):



from math import *
from copy import *
from string import *				
from random import *				
from sys import stdin
from sys import maxsize
from operator import *				
from itertools import *
from collections import Counter		
from collections import defaultdict 

'''

'''

def solve(l):
	n = len(l)
	

N = int(stdin.readline())
l = list(map(int, stdin.readline().rstrip().split()))
ans = 'APPROVED'
for i in l:
	if(i&1 == 0 and not(i%3 == 0 or i%5 == 0)):
		ans = 'DENIED'
		break

print(ans)

Solution (Python):
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')

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