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: Runtime Error

Solution code:
n= input().split()
n = int(n)
nums= input().split()
#map(int,input().split())
state = 1
for i in range(n):
    if nums[i] &1 == 0 :
        if nums[i]%3 ==0 or nums[i]%5 ==0:
            continue
        else:
            state= 0
            #print("DENIED")
            break
if state == 1:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Runtime Error

Solution code:
l = input()
l = input().split()
l = l[1:]
 
flag = "APPROVED"
for n in l:
  if n % 2 == 0 and n%3 != 0 and n%5 != 0:
    flag = "DENIED"
    
print(flag)

Submission status: Runtime Error

Solution code:
N = input()
A = map(int, input().split())
even = []
count = []
for x in A:
    if x % 2 == 0:
        even.append(x)
for x in even:
    if x%3 == 0 or x%5 == 0:
        count += 1
if count == len(even):
    print("Approved")
else:
    print("Denied")

Submission status: Runtime Error

Solution code:

if __name__ == "__main__":
    N = int(input())
    A = map(int, input().split())
    even_ls = [i for i in A if i%2 == 0 ]
    for i in even_ls:
        if i % 3 == 0 or i % 5 == 0:
            ret = "APPROVED"
        else:
            ret  = "DENIED"
            break
    print(ret)

Submission status: Runtime Error

Solution code:
N = int(input())
inList = list(map(int, input().aplit(" ")))

evenList = list([])

for item in inList:
  if item % 2 == 0:
    evenList.append(item)

jdgList = list([])

for evenItem in evenList:
  if ((evenItem % 3) == 0) or ((evenItem % 5) == 0):
    jdgList.append(evenItem)

if len(jdgList) == len(evenList):
  print("APPROVED")
else:
  print("DENIED")

Submission status: Runtime Error

Solution code:
1n = 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: Runtime Error

Solution code:


if __name__ == "__main__":
    N = int(input())
    A = map(int, input().split())
    even_ls = [i for i in A if i%2 == 0 ]
    for i in even_ls:
        if i % 3 == 0 or i % 5 == 0:
            ret = "APPROVED"
        else:
            ret  = "DENIED"
        break
    print(ret)

Submission status: Runtime Error

Solution code:
Nnum=int(input())
An=np.array([int(i) for i in input().split()])
Ane=An[An%2==0]
Ane3=Ane%3
Ane5=Ane%5
Ane3or5=Ane3*Ane5

if(np.sum(Ane3or5)==0):
    print("APPROVED")
else:
    print("DENIED")

Submission status: Runtime Error

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

list = np.array(list)

if (list[list%2 == 0]==list[list%6 == 0 or list%10 == 0]) :
    print('APPROVED')
else:
    print('DENIED')

Submission status: Runtime Error

Solution code:
from typing import List


class Solution:
    def solve(self, N: int, A) -> str:

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

        return "APPROVED"


if __name__ == '__main__':

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

    # solve
    solution = Solution()
    print(solution.solve(N, A))

Submission status: Runtime Error

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

for i in range(N):
    mo2=data[i]%2
    mo6=data[i]%6
    mo10=data[i]%10
    if mo2==0:
        if mo6==0 or mo10==0:
            ans="APPROVED"
            continue
        else:
            ans="DENIED"
            break
    else:
        continue
print(ans)

Submission status: Runtime Error

Solution code:
a=int(input())
c=0
d=0
b=list(map(int,input().split()))
for i in range(a):
  if b[i]%2==0:
    
    if b[i]%3==0 or b[i]%5==0:
      
    else:
      print('DENINED')
  else:
    pass
print('APPROVED')

Submission status: Runtime Error

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

list = np.array(list)

if (list[list%2 == 0]==list[list%6 == 0 or list%10 == 0]) :
    print('APPROVED')
else:
    ('DENIED')

Submission status: Runtime Error

Solution code:
_ = input()
a=map(int,*input().split())
flag = True
for i in a:
  if i%2 == 0:
    if i%3 != 0:
      if i%5 != 0:
        flag = False
        break
if flag:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Runtime Error

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

result = "APPROVED"

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define inAr ll ar[n];for(ll i=0;i<n;i++) cin>>ar[i];
#define loop for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL);
  #define endl "\n"
  #define mod int(1e9 +7)
typedef long long int ll;
using namespace std;

#define INFI LLONG_MAX
int main(){ 
int n;cin>>n;
inAr
int flag=0;
int flag1=0;
for(int i=0;i<n;i++)
{
	if(ar[i]%2==0)
	{
	flag1++;
		if(ar[i]%3==0 or ar[i]%5==0)
		{
			flag++;
		}
	}
}
if(flag==flag1)
cout<<"APPROVED";
else
cout<<"DENIED";
		
	}

Submission status: Runtime Error

Solution code:
N = input()
A = [x for x in input().split()]
five = False
three = False
for x in range(A):
  if(x%5==0):
    five = True
  elif(x%3==0):
    three = True
    
if(five.equals(True) and three.equals(True)):
   print("APPROVED)
else:
   print("DENIED")

Submission status: Runtime Error

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++
    if L[i]%3==0 or L[i]%5==0:
      count2++

if count == count2:
  prin("APPROVED")
else:
  print("DENIED")

Submission status: Runtime Error

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

for i in range(N):
    mod2=data[i]%2
    mod6=data[i]%6
    mod10=data[i]%10
    if mod2==0:
        if mod6==0 or mod10==0:
            ans="APPROVED"
            continue
        else:
            ans="DENIED"
            break
    else:
        continue
print(ans)

Submission status: Runtime Error

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

b=[i for i in a if i%2==0]

for j in b:
    if j%3==0 or j%5==0:
        ans=True
    else:
        ans=False
        break
if ans:
    print('APPROVED')
else:
    print('DENIED')

Submission status: Runtime Error

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

for d in arr :
  
  if d % 2 == 0 :
    
    if d % 3 == 0 :

      pass
    
    elif d % 5 = 0 : 
      pass
    
    else :

      print("DENIED")
      exit()
      
print("APPROVED")

Submission status: Runtime Error

Solution code:
N = input()
A = [x for x in input().split()]
five = False
three = False
for x in range(A):
  if(x%5==0):
    five = True
  elif(x%3==0):
    three = True
    
if(five.equals(True) and three.equals(True):
   print("APPROVED)
else:
   print("DENIED")

Submission status: Runtime Error

Solution code:
a = int(input())
b = [int(str) for str in input().split()]
c = [0,0,0,0,0]

for n in range(a):
  if b[n]%2 == 0:
    if b[n]%3 != 0 and b[n]%5 != 0:
      c[n] = 1

if sum(c) == 0:
  print('APPROVED')
else:
  print('DENIED')

Submission status: Runtime Error

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

deny = False

for ele in l:
  if ele%2==0:
    if ele%3!=0 and ele%5!=0:
      print("DENIED")
      deny = True
      break;

if !deny:
  print("APPROVED)

Submission status: Runtime Error

Solution code:
_ = input()
*a,=input().split()
flag = True
for i in a:
  if i%2 == 0:
    if i%3 != 0:
      if i%5 != 0:
        flag = False
        break
if flag:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <bitset>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

typedef long long ll;
//typedef pair<ll, ll> P;

//static const ll MOD = 1000000007;
//static const ll INF = 100000000;

int main() {
    // input
    ll N;
    vector<ll> A;
    cin >> N;
    for (ll i = 0; i < N; i++) {
        ll a;
        cin >> a;
        A.emplace_back(a);
    }

    // process
    for (ll i = 0; i < N; i++) {
        if ((A[i] % 2) == 0) {
            if ((A[i] % 3) != 0) {
                if ((A[i] % 5) != 0) {
                    cout << "DENIED";
                    return 0;
                }
            }
        }
    }

    cout << "APPROVED";
    return 0;
}

Submission status: Runtime Error

Solution code:
n = int(input())
ais = list(map(int, input().split()))
evens = []
for a in ais:
  if a % 2 == 0:
    evens.append(a)
if len(evens) == 0:
  print("DENIED")
  puit()
m = 0
for e in evens:
  if e % 3 == 0 or e % 5 == 0:
    pass
  else:
    m += 1
if m == 0:
  print("APPROVED")
else:
  print("DENIED")

Submission status: Runtime Error

Solution code:
n = int(input())
L = list(map(int,input().split()))
L = [x for x in L if x%2 ==0]
for i in range(len(L)):
    if L[i]%3 == 0 or L[i]%5== 0:
        flag = True
    else:
        flag =False
if flag:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Runtime Error

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

b=[i for i in a if i%2==0]

for j in b:
    if j%3==0 or j%5==0:
        ans=True
    else:
        print('DENIED')
        exit()
if ans:
    print('APPROVED')

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int , input().split()))
B = []
acount = 0
bcount = 0
for i in A:
    if i % 2 == 1:
         pass
    else:
        acount += 1
        B.append(i)
for i in B:
    if i % 3 == 0 or i % 5 == 0:
         bcount += 1
if acount != bcount:
    print('DENIED')
elif account == 0:
    print('DENIED')
else:
    print('APPROVED')

Submission status: Runtime Error

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

a = 0
for i in range(N):
    if s[i]/2 == s[i]//2:
        if s[i]/3 == s[i]//3 or s[i]/5 == s[i]//5:
          a = a + 1
    else:
        a = a + 1

if a == N:
    print("APPROVED")
else:
    print("DENIED")

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
n = input()
arr = [int(_) for _ in input().split()]

for i in arr:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      print("DENIED")
      sys.exit(1)

print("APPROVED")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

t = sys.stdin.read()
a = map(int, t.split("\n")[1])

def check(a):
    for b in a:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                return False
    return True

if check(a):
    print "APPROVED"
else:
    print "DENIED"

Submission status: Runtime Error

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

    for a in As:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                ans = "APPROVED"
            else:
                ans = "DENIED"
                break

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break

print(ans)

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
if A==B==C:
  print("No")
elif A!=B!=C:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
N=int(input())
A=map(int, input().split())
for i in range(N):
  if A[i]%2==0:
    if A[i]%3==0 or A[i]%5==0:
      print('APPROVED')
      exit()

print('DENIED')

Submission status: Runtime Error

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:
    else:
      flag=1
print(['APPROVED','DENIED'][flag])

Submission status: Runtime Error

Solution code:
from sys import setrecursionlimit as srl; srl(10**7)
rr = lambda: int(raw_input())
rrm = lambda: map(raw_input().split())

YES,NO = "APPROVED","DENIED"
def solve(N, A):
    for x in A:
        if x % 2 == 0:
            if x % 3 or x % 5:
                return NO
    return YES

    
print solve(int(rr()), rrm())