Harryxun/stf_run huggingface dataset:
def prepare(n, MOD):
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
     
    return factorials, invs

def combinations_count(n, r, factorials, invs):
    return (factorials[n] * invs[n-r] * invs[r]) % (10 ** 9 + 7)
 
f = open("151_E_max01", "r")
n, k = map(int, f.readline().split())
a = sorted(list(map(int, f.readline().split())))

factorials, invs = prepare(n, 10 ** 9 + 7)

ans = 0
for i in range(n):
    if i <= n - k:
        ans -= a[i] * combinations_count(n-i-1, k-1, factorials, invs)
    
    if i >= k - 1:
        ans += a[i] * combinations_count(i, k-1, factorials, invs)
    
    ans = ans % (10 ** 9 + 7)
 
print(ans)

### FIXED CODE ###

def prepare(n, MOD):
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
     
    return factorials, invs

def combinations_count(n, r, factorials, invs):
    return (factorials[n] * invs[n-r] * invs[r]) % (10 ** 9 + 7)
 
n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))

factorials, invs = prepare(n, 10 ** 9 + 7)

ans = 0
for i in range(n):
    if i <= n - k:
        ans -= a[i] * combinations_count(n-i-1, k-1, factorials, invs)
    
    if i >= k - 1:
        ans += a[i] * combinations_count(i, k-1, factorials, invs)
    
    ans = ans % (10 ** 9 + 7)
 
print(ans)
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if(V <= W):
	print("NO")
elif(abs(B - A) >= V * T):
	print("NO")
elif((B - A) % 2 == 1) and ((W - V) % 2 != 1):
	print("NO")
else:
	print("YES")

### FIXED CODE ###

S= input()
print(S[:3])
import math
s = int(input())
p=q=0
c=1
a = int (math.sqrt(s))
if (a*a == s):
    d = a

else:
    a+=1
    d = a
    #print(a*d, s)
    b = a*d - s
    #print(a*d - b)

print(p,q,a,b,c,d)

### FIXED CODE ###

from math import ceil


S = int(raw_input())

x2 = y3 = int(ceil(S ** 0.5))

y2 = x2 * y3 - S 
x3 = 1

print 0, 0, x2, y2, x3, y3
a,b = map(int,input())
ans = 0
if a*b % 2 == 0:
  print(a*b/2)
else:
  print((a*b-1)/2 + 1)

### FIXED CODE ###

a,b = map(int,input().split())
ans = 0
if a == 1 or b == 1:
  print(1)
elif a*b % 2 == 0:
  print(int(a*b/2))
else:
  print(int((a*b-1)/2 + 1))
import bisect

N=int(input())
A=list(map(int,input().split()))
A.sort()
B=[]
for i in range(1,10):
    if 2**i>2*(10**9):
        break
    else:
        B.append(2**i)
B.append(2**(i+1))
ans=0
#print(B)
for i in range(N):
    X=bisect.bisect_left(B,A[N-1-i])
    #print(X)
    if A[bisect.bisect_left(A,B[X]-A[N-1-i])]==B[X]-A[N-1-i]:
        ans+=1
        A[bisect.bisect_left(A,B[X]-A[N-1-i])]-=0.1
print(ans)

### FIXED CODE ###

import bisect
N=int(input())
A=list(map(int,input().split()))
A.sort()
A.append(999999999999999)
B=[]
for i in range(1,35):
    B.append(2**i)
ans=0
for i in range(N):
    if A[N-1-i]==int(A[N-1-i]):
        for j in range(len(B)):
            if A[N-1-i]<B[j]:
                break
        if A[bisect.bisect_left(A,B[j]-A[N-1-i])]==B[j]-A[N-1-i]:
            if bisect.bisect_left(A,B[j]-A[N-1-i])<N-1-i:
                A[bisect.bisect_left(A,B[j]-A[N-1-i])]-=0.1
                A[N-1-i]+=0.1
                ans+=1
print(ans)
N = [int(_) for _ in input().split()]

def solve(a, b, c):
    
    # if c < a or c < b:
    #     return "No"

    # if a + 2*sqrt(a*b) + b - c < 0.0:
    #     return "Yes"
    # else:
    #     return "No"
    
    d = c-a-b
    if  0 < d and 4ab < d * d:
        return "Yes"
    else:
        return "No"

print(solve(N[0], N[1], N[2]))

### FIXED CODE ###

N = [int(_) for _ in input().split()]

def solve(a, b, c):
    
    # if c < a or c < b:
    #     return "No"

    # if a + 2*sqrt(a*b) + b - c < 0.0:
    #     return "Yes"
    # else:
    #     return "No"
    
    d = c-a-b
    if  0 < d and 4*a*b < d * d:
        return "Yes"
    else:
        return "No"

print(solve(N[0], N[1], N[2]))
is_alive = [0]*8#各ランク

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

count_over=0

for i in range(0,N,1):
    if a[i]>=3200:
        count_over +=1
    else:
        is_alive[a[i]//400]=1

print(max(1,sum(is_alive)),min(sum(is_alive)+count_over))

### FIXED CODE ###

is_alive = [0]*8#各ランク

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

count_over=0

for i in range(0,N,1):
    if a[i]>=3200:
        count_over +=1
    else:
        is_alive[a[i]//400]=1

print(max(1,sum(is_alive)),sum(is_alive)+count_over)
s = str(input())
n = str(input())
ans = 0
for i in range(len(s)):
    s = s[1:] + s[0]
    if s == n:
        ans = 1
        break-

if ans == 1:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

s = str(input())
n = str(input())
ans = 0
for i in range(len(s)):
    s = s[1:] + s[0]
    if s == n:
        ans = 1
        break

if ans == 1:
    print("Yes")
else:
    print("No")
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+2)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+2)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

### FIXED CODE ###

m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m,0,-1):
    if num_list[i-1] == 0:
        cnt = 0
        for j in range(2,m//i+1):
            cnt += ans_list[i*j-1]
        if cnt % 2 == 1:
            ans_list[i-1] = 1
            print_list.append(i)
    elif num_list[i-1] == 1:
        cnt = 0
        for j in range(2,m//i+1):
            cnt += ans_list[i*j-1]
        if cnt % 2 == 0:
            ans_list[i-1] = 1
            print_list.append(i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)
import copy

N = int(input())

a_list = []
for i in range(N):
    a_list.append(int(input()))
    
for i in range(N):
    tmp_list = copy.copy(a_list)
    if len(tmp_list) > 2:
        tmp_list = list(sorted(set(tmp_list), key=tmp_list.index))
        tmp_list.pop(i)
        print(max(tmp_list))
    else:
        tmp_list.pop(i)
        print(max(tmp_list))     

### FIXED CODE ###

N = int(input())

a_list = []
for i in range(N):
    a_list.append(int(input()))

max_value = max(a_list)

if a_list.count(max_value) > 1:
  for i in range(N):
    print(max_value)
else:
  for i in range(N):
    if a_list[i] == max_value:
      print(sorted(a_list)[-2])
    else:
      print(max_value)
N, X = map(int, input().split())
L = list(map(int, input().split()))

c = 0
zahyo = 0
for i in range(100000):
  c += 1
  zahyo += L[i]
  
  if zahyo > X:
    break
    
print(c)
  

### FIXED CODE ###

N, X = map(int, input().split())
L = list(map(int, input().split()))
 
c = 1
d = 0
for i in range(0, len(L)):
  d += L[i]
  
  if d > X:
    break
  else:
    c += 1
    
print(c)
_ = int(input())
hoge = [int(x) for x in input().split()]
_ = int(input())

def exSearch(i, m):
    if m == 0:
        return True
    if i >= len(hoge):
        return False
    res = exSearch(i+1, m) or exSearch(i+1, m-hoge[i])
    return res

if __name__ == '__main__':
    
    for val in (int(x) for x in input().split()):
        if exSearch(0, val):
            print ('yes')
        else:
            print ('no')


### FIXED CODE ###

_ = int(input())
hoge = [int(x) for x in input().split()]
_ = int(input())

def exSearch(i, m):
    if m == 0:
        return True
    if i >= len(hoge) or m > sum(hoge):
        return False
    res = exSearch(i+1, m) or exSearch(i+1, m-hoge[i])
    return res

if __name__ == '__main__':
    
    for val in (int(x) for x in input().split()):
        if exSearch(0, val):
            print ('yes')
        else:
            print ('no')
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]

AB = [list(map(lambda x, y: abs(x - y), a, b)) for a, b in zip(A, B)]
dp = [[[0] * 10001 for _ in range(W + 1)] for _ in range(H + 1)]
dp[0][0][0] = 1

for h in range(H):
    for w in range(W):
        ab = AB[h][w]
        for i in range(10000):
            if dp[h][w][i] == 1:
                dp[h+1][w][i+ab] = 1
                dp[h+1][w][abs(i-ab)] = 1
                dp[h][w+1][i+ab] = 1
                dp[h][w+1][abs(i-ab)] = 1

for i in range(1000):
    if dp[H][W-1][i] == 1:
        print(i)
        break


### FIXED CODE ###

H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]

AB = [list(map(lambda x, y: abs(x - y), a, b)) for a, b in zip(A, B)]
dp = [[[0] * 12801 for _ in range(W + 1)] for _ in range(H + 1)]
dp[0][0][0] = 1

for h in range(H):
    for w in range(W):
        ab = AB[h][w]
        for i in range(10000):
            if dp[h][w][i] == 1:
                dp[h+1][w][i+ab] = 1
                dp[h+1][w][abs(i-ab)] = 1
                dp[h][w+1][i+ab] = 1
                dp[h][w+1][abs(i-ab)] = 1

for i in range(1000):
    if dp[H][W-1][i] == 1:
        print(i)
        break
#!/usr/bin/env python3

a,b,c = map(int,input().spliy())

if a < c and c < b:
    print("Yes")

elif b < c and c < a:
    print("Yes")

else:
    print("No")

### FIXED CODE ###

#!/usr/bin/env python3

a,b,c = map(int,input().split())

if a < c and c < b:
    print("Yes")

elif b < c and c < a:
    print("Yes")

else:
    print("No")
S = int(input))
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h, m, s, sep=':')

### FIXED CODE ###

S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h, m, s, sep=':')
s = input()
n = len(s)
res = []
for i,(a,b) in enumerate(zip(s,s[1:])):
    if a != b:
        res.append(max(i+1,n-1-i))
print(min(res))


### FIXED CODE ###

s = input()
n = len(s)
if s[0]*n==s:
    print(n)
    exit()
res = []
for i,(a,b) in enumerate(zip(s,s[1:])):
    if a != b:
        res.append(max(i+1,n-1-i))
print(min(res))
n = int(input())
Ans = []
for i in range(n):
    Ai = int(input())
    a = []
    for j in range(Ai):
        x,y = map(int,input().split())
        a.append((x,y))
    Ans.append(a)
Honest = 0
TT = [bin(i)[2:].zfill(n) for i in range(2**n)]
#print(TT)
for truth in TT:
    truth = str(truth)
    people = [-1]*n
    #print("====")
    #print(truth)
    flag = True
    for i in range(n):
        tt = truth[i]
        answers = Ans[i]
        #print(answers)
        if tt == "1":
            #証言は信頼できると仮定
            for x,v in answers:
                #xに対してv
                if v:#x人が正直者という証言
                    if people[x-1] == 0:#xは嘘つきと証言されているとき
                        flag = False
                        #print("A")
                    else:
                        people[x-1] = 1
                else:#xは嘘つきという証言
                    if people[x-1] == 1:
                        flag = False
                        #print("B")
                    else:
                        people[x-1] = 0
        else:
            #証言は嘘と仮定
            for x,v in answers:
                if v == 0:
                    if people[x-1] == 0:#xは嘘つきと証言されているとき
                        flag = False
                        #print("C")
                    else:
                        people[x-1] = 1
                else:#xは嘘つきという証言
                    if people[x-1] == 1:
                        flag = False
                        #print("D")
                    else:
                        people[x-1] = 0
    if flag:
        Flag = True
        for i in range(len(people)):
            if people[i] == -1:
                people[i] = 0
            else:
                if truth[i] != str(people[i]):
                    Flag = False
                    break
        #print(*people)
        
        if Flag:
            Honest = max(Honest,sum(people))
print(Honest)


### FIXED CODE ###

n,m,l = map(int,input().split())
if n+m+l <= 21:
    print("win")
else:
    print("bust")
n=[int(i) for i in input().split()]
array=[]
for i in range(n[0]):
  array.append(n[1])
for i in range(n[2]):
  array[int(input())-1]+=1
for i in range(n[2]):
  for i in range(n[0]):
    array[i]-=n[2]
	if(array[i]<=0):
      print("No")
    else:
      print("Yes")

### FIXED CODE ###

n=[int(i) for i in input().split()]
array=[]
for i in range(n[0]):
  array.append(n[1])
for i in range(n[2]):
  array[int(input())-1]+=1
for i in range(n[0]):
  array[i]-=n[2]
  if(array[i]<=0):
    print("No")
  else:
    print("Yes")
N, P = list(map(int, input().split()))

now = 1

x = 2
while P >= x ** N:
    while P % (x ** N) == 0:
        now *= x
        P = P / (x ** N)
    while P % x == 0:
        P = P / x
    x += 1

print(now)

### FIXED CODE ###

N = str(input())

print(N.count('2'))
from _collections import defaultdict
import sys


class Graph:

    def __init__(self, n):
        self.g = defaultdict(list)
        self.dp = [-1 for i in range(n + 1)]

    def add_edge(self, x, y):
        self.g[x].append(y)

    def longest_path_util(self, node):

        if self.dp[node] != -1:
            return self.dp[node]

        leaf = 1
        best_child = 0
        for neib in self.g[node]:
                leaf = 0
                best_child = max(best_child, self.longest_path_util(neib))

        if leaf != 0:

            self.dp[node] = 0

        else:
            self.dp[node] = best_child + 1

        return self.dp[node]

    def longest_path(self, n):

        ans = 0

        for i in range(1, n + 1):

            ans = max(ans, self.longest_path_util(i))

        return ans


n, k =  map(int, input().split())
graph = Graph(n)
for _ in range(k):
    x, y = list(map(int, sys.stdin.readline().split()))
    graph.add_edge(x, y)

print(graph.longest_path(n))






### FIXED CODE ###

from _collections import defaultdict
import sys
import collections
import sys
sys.setrecursionlimit(10**6)


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


def longest_path_util(node, graph, dp):

    res = 0

    if dp[node] != -1:
        return dp[node]

    for neib in graph[node]:
        res = max(res, longest_path_util(neib, graph, dp) + 1)

    dp[node] = res

    return dp[node]


graph = defaultdict(list)

[n, k] = get_ls()

dp = [-1] * n

for _ in range(k):
    [x, y] = get_ls()
    graph[x - 1].append(y - 1)

ans = 0

for i in range(n):
    ans = max(ans, longest_path_util(i, graph, dp))

print(ans)
d, goal = map(int, input().split())
pc = [0] + [list(map(int, input().split())) for _ in range(d)]

def solve(goal, d):
  if d == 0:
    return 10**9
  n = min(goal//(100*d), pc[d][0])
  t = n * d * 100
  if n == pc[d][0]:
    t += pc[d][1]
  if t < goal:
    n += solve(goal-t, d-1)
  return min(n, solve(goal,d-1))

print(solve(g,d))


### FIXED CODE ###

d, goal = map(int, input().split())
pc = [0] + [list(map(int, input().split())) for _ in range(d)]

def solve(goal, d):
  if d == 0:
    return 10**9
  n = min(goal//(100*d), pc[d][0])
  t = n * d * 100
  if n == pc[d][0]:
    t += pc[d][1]
  if t < goal:
    n += solve(goal-t, d-1)
  return min(n, solve(goal,d-1))

print(solve(goal,d))
S = input()
N = len(S)
left_R = [0] * N
right_L = [N-1] * N

for i, s in enumerate(S[1:], 1):
  left_R[i] = i if s == 'R' else left_R[i-1]

for i, s in enumerate(S[N-2::-1], 1):
  i = N-1-i
  right_L[i] = i if s == 'L' else right_L[i+1]

anser = [0] * N
for i, (s, R, L) in enumerate(zip(S, left_R, right_L)):
  if s == 'L':
    j = left_R[i]
    if (i+j) & 1:
      j += 1
  else:
    j = right_L[i]
    if (i+j) & 1:
      j -= 1
  answer[j] += 1
print(' '.join(map(str, answer)))
  

### FIXED CODE ###

S = input()
N = len(S)
left_R = [0] * N
right_L = [N-1] * N

for i, s in enumerate(S[1:], 1):
  left_R[i] = i if s == 'R' else left_R[i-1]

for i, s in enumerate(S[N-2::-1], 1):
  i = N-1-i
  right_L[i] = i if s == 'L' else right_L[i+1]

answer = [0] * N
for i, (s, R, L) in enumerate(zip(S, left_R, right_L)):
  if s == 'L':
    j = left_R[i]
    if (i+j) & 1:
      j += 1
  else:
    j = right_L[i]
    if (i+j) & 1:
      j -= 1
  answer[j] += 1
print(' '.join(map(str, answer)))
from collections import defaultdict, deque
from heapq import heappop, heappush
def inpl(): return list(map(int, input().split()))

N, M = inpl()
S, T = inpl()
G = [[] for _ in range(N+1)]
MOD = 10**9 + 7
for _ in range(M):
    u, v, d = inpl()
    G[u].append((v, d))
    G[v].append((u, d))

cost = [10**18]*(N+1)
appear = [0]*(N+1)

Q = [(0, S)]
cost[S] = 0
appear[S] = 1

while Q:
    c, p = heappop(Q)
    if cost[p] < c:
        continue
    for q, d in G[p]:
        if cost[p] + d == cost[q]:
            appear[q] = (appear[q] + appear[p])%MOD
        elif cost[p] + d < cost[q]:
            cost[q] = cost[p] + d
            appear[q] = appear[p] % MOD
            heappush(Q, (cost[q], q))

end = cost[T]*1
ans = pow(appear[T], 2, MOD)

Q = [(0, T)]
cost2 = [10**18]*(N+1)
cost2[T] = 0
appear2 = [0]*(N+1)
appear2[T] = 1
while Q:
    c, p = heappop(Q)
    if cost2[p] < c:
        continue
    for q, d in G[p]:
        if cost[p] - d != cost[q]:
            continue
        if cost2[p] + d == cost2[q]:
            appear2[q] = (appear2[q] + appear2[p])%MOD
        elif cost2[p] + d < cost2[q]:
            cost2[q] = cost2[p] + d
            appear2[q] = appear2[p] % MOD
            heappush(Q, (cost2[q], q))

Q = deque([S])
searched = [False]*(N+1)
searched[S] = True

while Q:
    p = Q.pop()
    if 2*cost2[p] == end:
        ans = (ans - (appear[p]*appear2[p])**2)%MOD

    for q, d in G[p]:
        if cost2[p] - d != cost2[q]:
            continue
        if 2*cost2[q] < end < 2*cost2[p]:
            ans = (ans - (appear[p]*appear2[q])**2)%MOD
        if not searched[q]:
            Q.append(q)
            searched[q] = True
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
from itertools import accumulate
def inpl(): return tuple(map(int, input().split()))
N = int(input())
A = inpl()
B = inpl()
res = 0
for i in range(N):
    res = max(res, sum(A[:i+1]) + sum(B[i:]))

print(res)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a = int(input())
b = factorization(a)
countation = 0
for i in range(len(b)):
    t = b[i][1]
    k = 1
    n = 1
    while t >= n:
        countation += 1
        k = k + 1
        n = k*(k+1)/2
if a != 1
    print(countation)
else:
    print(0)

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a = int(input())
b = factorization(a)
countation = 0
for i in range(len(b)):
    t = b[i][1]
    k = 1
    n = 1
    while t >= n:
        countation += 1
        k = k + 1
        n = k*(k+1)/2
if a != 1:
    print(countation)
else:
    print(0)
n = list(input())
if (list[0] == list[1] and list[1] == list[2]) or (list[1] == list[2] and list[2] == list[3]):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = list(input())
if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
    print('Yes')
else:
    print('No')
import numpy as np

mod = 10**9+7
p = list(input())
# p = list("?"*10**4)

# アルゴリズム
dp = np.zeros(13, dtype=int)
dp[0] = 1
mul = 1
for key in reversed(p):
    new_dp = np.zeros(13, dtype=int)
    if key == "?":
        for i in range(10):
            for j in range(13):
                new_dp[(j + i * mul) % 13] += dp[j]
                new_dp[(j + i * mul) % 13] %= mod
    else:
        
        for j in range(13):
            new_dp[(j + int(key) * mul) % 13] += dp[j]
            new_dp[(j + int(key) * mul) % 13] %= mod
    dp = new_dp.copy()
    mul *= 10

print(dp[5])



### FIXED CODE ###

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

ans = (a+b)/2
if ans % 1 == 0:
    print("{}".format((int)(ans)))
else:
    print("IMPOSSIBLE")
import math

a, b = input().split(' ')
a = int(a)
b = int(b)
print(a//math.gcd(a, b)*b)


### FIXED CODE ###

def gcd(a, b):
    if not b:
        return a
    return gcd(b, a % b)

a, b = map(int, input().split())
print(a//gcd(a, b)*b)
n = int(input())
a = list(map(int, input().split()))

flag = 0
for i in range(len(a)):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            flag += 1
        else:
            flag = 0
            break

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

### FIXED CODE ###

a, b, c = map(int, input().split())

if (a == b and a != c) or (a == c and a != b) or (b == c and b != a):
    print("Yes")
else:
    print("No")
import numpy as np
N,K = (int(x) for x in input().split())
p1 = np.array(list(map(int, input().split())))
s1 = np.array([np.sum(p1[0:i+1]) for i in range(N)])
p2 = np.array([(s1[i+K] - s1[i]) for i in range(N-K)])
max = np.amax(p2)
print((max+K) / 2)

### FIXED CODE ###

import numpy as np
N,K = (int(x) for x in input().split())
p1 = np.array(list(map(int, input().split())))
s1 = p1.cumsum()
s2 = np.append(0, s1)
p2 = np.array([(s2[i+K] - s2[i]) for i in range(N-K+1)])
max = np.amax(p2)
print((max+K) / 2)
import itertools

K, S = map(int, input().split())

if not ((2 <= K and K <= 2500) or (0 <= S and S <= 3*K)):
    exit()

ans = [[x,y] for x in range(2, K+1) for y in range(2, K+1) if (0<=(S-X-Y)) and ((S-X-Y)<=K)]
print(len(ans))


### FIXED CODE ###

import itertools

K, S = map(int, input().split())

if not ((2 <= K and K <= 2500) or (0 <= S and S <= 3*K)):
    exit()

count = 0
for X in range(0, K + 1):
    for Y in range(0, K + 1):
        if 0 <= (S - X - Y) and (S - X - Y) <= K:
            count += 1

print(count)