Harryxun/stf_run huggingface dataset:
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

def lcm(a, b):
    return int(a * b) / gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t, ans)
print(ans)

### FIXED CODE ###

from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t, ans)
print(ans)
N, T = map(int, input().split())
weight = []
value = []

dp = [[0] * (3010) for i in range(6010)]

for i in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    value.append(v)
#配る
for i, (ww, vv) in enumerate(zip(weight, value)):
    for w in range(T):            
        dp[i+1][w] = max(dp[i+1][w], dp[i][w])
        dp[i+1][w+ww] = max(dp[i][w+ww], dp[i][w] + vv)
        #else: dp[i+1][w] = dp[i][w]


print(max(dp[N]))
"""
for i, v in enumerate(dp[N][:200]):
    print("{}:{}, ".format(i, v), end="")
"""


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()

def main():
    N, T = map(int, input().split())
    cv = [tuple(map(int, input().split())) for _ in range(N)]
    cv = sorted(cv, key=lambda x : x[0])

    dp = [[0]*(T+1) for _ in range(N+1)]
    dp_ext = [[0]*(T+1) for _ in range(N+1)]

    values = [v for c, v in cv]
    max_values = [max(values[i:]) for i in range(N)]
    # 貰うdp
    for i in range(N):
        cost, value = cv[i]
        for now in range(cost, T+1):
            old = now - cost
            dp[i+1][now] = max(dp[i][now], dp[i][old] + value)

        for j in range(1, T+1):
            dp[i+1][j] = max(dp[i+1][j], dp[i+1][j-1])
        
        for j in range(1, T+1):
            dp_ext[i+1][j] = max(dp[i+1][j], dp[i][j-1] + max_values[i], dp_ext[i][j])

    print(dp_ext[N][T])

if __name__ == "__main__":
    main()
import sys


print("Please enter a value of N")
n = int(input())
if isinstance(n,int) == False:
    #print("Input value is not a type of int.")
    #sys.exit()
    return
elif n < 1 or 100 < n:
    #print("Input value is not in this range [0,100].")
    #sys.exit()
    return
else:
    if n%2 == 0:
        a = float(1/2)
    else:
        a = float(((n+1)/2)/n)
    
    print(a)
    return

### FIXED CODE ###

import sys

#print("Please enter a value of N")
n = int(input())
if isinstance(n,int) == False:
    print("Input value is not a type of int.")
    sys.exit()
elif n < 1 or 100 < n:
    print("Input value is not in this range [0,100].")
    sys.exit()
else:
    if n%2 == 0:
        a = float(1/2)
    else:
        a = float(((n+1)/2)/n)
    
    print(a)
a,b=map(int,input().split())
if a<8 and b8:
  print("Yay!")
else:
  print(":)")


### FIXED CODE ###

a,b = map(int,input().split())
if a<9and b<9:
  print("Yay!")
else:
  print(":(")
import copy
n = int(input())
x = list(map(int,input().split()))
x2 = copy.copy(x)
x2.sort()
num1,num2 = (len(x)//2)-1,(len(x)//2)
med1,med2 = x2[num1],x2[num2]
for i in range(n):
	if x[i] >= x2[med1]:
		print(med2)
	else:
		print(med1)

### FIXED CODE ###

import copy
n = int(input())
x = list(map(int,input().split()))
x2 = copy.copy(x)
x2.sort()
num1,num2 = (len(x)//2)-1,(len(x)//2)
med1,med2 = x2[num1],x2[num2]
for i in range(n):
	if x[i] <= med1:
		print(med2)
	else:
		print(med1)
a, b, c = [int(x) for x in input().split()]
d = c - a - b

if d <= 0:
    print("No")
else:
    if 4 * a * b < d * d:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

A, B = input().split()
A = int(A)
B = int(B.replace(".", ""))
print(A * B // 100)
import numpy as np

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

mod = 10**9 + 7
ans = 0

for i in range(60):
    c = len(A[A&1==1])
    ans = (ans + c*(N-c)*pow(2,i,mod))%mod
    a = a >> 1

print(ans)


### FIXED CODE ###

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

mod = 10**9 + 7
ans = 0

for d in range(60):
    n0, n1 = 0, 0
    for i in range(N):
        if (A[i] >> d) & 1:
            n1 += 1
        else:
            n0 += 1
    ans = (ans + (n0 * n1) * (1 << d))% mod
    
print(ans)
import sys
input = sys.stdin.readline
S = input()
if S = "AAA" or "BBB" :
    print("Yes")
else :
    print("No")


### FIXED CODE ###

S = input()
if S == "AAA" or S == "BBB" :
    print("No")
else :
    print("Yes")
import math
a, b=[int(i) for i in input().split()]
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

m=lcm(a, b)  
#print(m)

### FIXED CODE ###

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

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)
  
print(lcm(A,B))
import sys
bbn=1000000007
	
#+++++
		
def main():
	n, k = map(int, input().split())
	r, s, p =  map(int, input().split())
	t = input()
	dd={'s':r, 'p':s, 'r':p}
	point = lambda c : dd[c]
	
	max_p=sum([point(c) for c in t])
	same_k={'s':0, 'p':0, 'r':0}
	tn=t
	for i in range(k,n):
		if tn[i]==tn[i-k] and tn[i]!='_':
			same_k[tn[i]] += 1
			tn[i] = '_'
	down=0
	for cc in ['r','s','p']:
		down+=same_k[cc]*point(cc)
			
	print(max_p-down)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

### FIXED CODE ###

import sys
bbn=1000000007
	
#+++++
		
def main():
	n, k = map(int, input().split())
	r, s, p =  map(int, input().split())
	t = input()
	dd={'s':r, 'p':s, 'r':p}
	point = lambda c : dd[c]
	
	max_p=sum([point(c) for c in t])
	same_k={'s':0, 'p':0, 'r':0}
	tn=list(t)
	for i in range(k,n):
		if tn[i]==tn[i-k] and tn[i]!='_':
			same_k[tn[i]] += 1
			tn[i] = '_'
	down=0
	#print(tn)
	for cc in ['r','s','p']:
		down+=same_k[cc]*point(cc)
			
	print(max_p-down)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
X = int(input())
num = []
for i in range(1,X+1):
  temp = i**2
  if temp<X:
    num.append(temp)
    
print(num[-1])

### FIXED CODE ###

X = int(input())
num = [1]
for i in range(2,X):
  temp = i
  while temp*i<=X:
    temp=temp*i
    num.append(temp)
    
print(sorted(num)[-1])
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() 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)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n, m = LI()
L = LIR(m)
for i in range(m):
    L[i] = [i, f'{L[i][0]:0>6}', L[i][1]]


L.sort(key=lambda x:x[1:])
cnt = 1
L[0][2] = f'{1:0>6}'
for i in range(1, m):
    if L[i][1] != L[i-1][1]:
        cnt = 1
    else:
        cnt += 1
    L[i][2] = f'{cnt:0>6}'



L.sort(key=lambda x:x[0])
for i in L:
    print(i[1] + i[2])

### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() 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)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n, m = LI()
L = LIR(m)
for i in range(m):
    L[i] = [i, str(L[i][0]).zfill(6), L[i][1]]


L.sort(key=lambda x:x[1:])
cnt = 1
L[0][2] = str(1).zfill(6)
for i in range(1, m):
    if L[i][1] != L[i-1][1]:
        cnt = 1
    else:
        cnt += 1
    L[i][2] = str(cnt).zfill(6)



L.sort(key=lambda x:x[0])
for i in L:
    print(i[1] + i[2])
# -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(10000000)

def preDatasets():
	datas = sys.stdin.readlines()
	for i in range(len(datas)):
		datas[i] = datas[i].strip('\n')
	return datas

def dfs(x, y, sym):
	tile[x][y] = '.'
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if(nx>=0 and nx<N and ny>=0 and ny<M and tile[nx][ny]==sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			if not tile[i][j] == '.':
				if tile[i][j] == '@':
					dfs(i, j, '@')
					res += 1
				elif tile[i][j] == '#':
					dfs(i, j, '#')
					res += 1
				elif tile[i][j] == '*':
					dfs(i, j, '*')
					res += 1
	print(res)

index = 0	
DX = [-1, 0, 1, 0]
DY = [0, -1, 0, 1]
while True:
	datas = preDatasets()
	

	N = int(datas[index].split(' ')[0])
	M = int(datas[index].split(' ')[1])
	tile = [[0 for i in range(N)]for j in range(M)]
	
	for i in range(len(tile)):
		tile[i] = list(datas[index+i+1])

	if N == 0:
		break
	else:
		solve()
		index += N+1

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if (0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
DX = [-1,0,1,0]
DY = [0,-1,0,1]
sys.setrecursionlimit(10**7)
while True:
	line = input()
	if " " in line:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(M)] for j in range(N)]
	else:
		tile[counter-1] = list(line)
	if N is 0 and M is 0:
		break
	counter += 1
	if counter-1 is N:
		solve()
		counter = 0
n = int(input())
x = list(map(int,input().split()))
mod = 10 ** 9 + 7
ans = 0
m = 1　#1の桁のbitからスタート
for _ in range(60):
    bit = sum(a & m for a in x) #フラグが立ってる桁を合計
    bit //= m #1の個数を数えるためにmで割る
    non_bit = n - bit #0の個数を出す
    ans = (ans + bit * non_bit * m) % mod #桁の合計出す
    m <<= 1 #桁を1増やす
print(ans)




### FIXED CODE ###

n = int(input())
x = list(map(int,input().split()))
mod = 10 ** 9 + 7
ans = 0
m = 1
for _ in range(60):
    bit = sum(a & m for a in x) #フラグが立ってる桁を合計
    bit //= m #1の個数を数えるためにmで割る
    non_bit = n - bit #0の個数を出す
    ans = (ans + bit * non_bit * m) % mod #桁の合計出す
    m <<= 1 #桁を1増やす
print(ans)
import numpy as np
N, K = map(int, input().split())
H = list(int(x) for x in input().split())

dp = np.full(N, np.inf)
dp[0] = 0
H = np.array(H)

for i in range(1, N):
    dp[i] = min(dp[max(0,i-K):i] + abs(H[i] - H[max(0,i-K):i]))

print(int(dp[N-1]))

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
H = list(int(x) for x in input().split())

dp = np.full(N, np.inf)
dp[0] = 0
H = np.array(H)

for i in range(1, N):
    j = max(0,i-K)
    dp[i] = min(dp[j:i] + np.abs(H[i] - H[j:i]))

print(int(dp[N-1]))
import sys

N, M =  map(int, input().split())
a_list = [int(input()) for _ in range(M)]

if N == 1:
    print(1)

else:
    a = 1
    ans = 1

    if M == 0:
        ans = (a+b)%1000000007
        a, b = b, ans

    elif M == 1:
        if a_list[0] == 1:
            b = 0
            m = 1
        else:
            b = 1
            m = 0
        for i in range(2, N+1):
            if a_list[0] == i:
                a, b = b, 0
            else:
                ans = (a+b)%1000000007
                a, b = b, ans

    else:
        if a_list[0] == 1:
            b = 0
            m = 1
        else:
            b = 1
            m = 0
        for i in range(2, N+1):
            if m < M-1:
                if a_list[m+1] - a_list[m] == 1:
                    print(0)
                    sys.exit()

                if a_list[m] == i:
                    a, b = b, 0
                    m += 1
                else:
                    ans = (a+b)%1000000007
                    a, b = b, ans

            else:
                if a_list[m] == i:
                    a, b = b, 0
                else:
                    ans = (a+b)%1000000007
                    a, b = b, ans

print(ans)

### FIXED CODE ###

import sys

N, M =  map(int, input().split())
a_list = [int(input()) for _ in range(M)]

if N == 1:
    print(1)

else:
    a = 1
    ans = 1

    if M == 0:
        b = 1
        for i in range(2, N+1):
            ans = (a+b)%1000000007
            a, b = b, ans

    elif M == 1:
        if a_list[0] == 1:
            b = 0
            m = 1
        else:
            b = 1
            m = 0
        for i in range(2, N+1):
            if a_list[0] == i:
                a, b = b, 0
            else:
                ans = (a+b)%1000000007
                a, b = b, ans

    else:
        if a_list[0] == 1:
            b = 0
            m = 1
        else:
            b = 1
            m = 0
        for i in range(2, N+1):
            if m < M-1:
                if a_list[m+1] - a_list[m] == 1:
                    print(0)
                    sys.exit()

                if a_list[m] == i:
                    a, b = b, 0
                    m += 1
                else:
                    ans = (a+b)%1000000007
                    a, b = b, ans

            else:
                if a_list[m] == i:
                    a, b = b, 0
                else:
                    ans = (a+b)%1000000007
                    a, b = b, ans

    print(ans)
N=int(input())
A=[int(n) for n in input().split()]

div=10**9+7

A.sort()

if N % 2 == 0:
    for i in range(int(N/2)):
        if A[2*i] != 2*i+1 or A[2*i+1] != 2*i+1:
            print (0)
            sys.exit() 
    print(2**int(N/2) % div)
if N % 2 == 1:
    if A[0]!=0:
        print(0)
        sys.exit()
    for i in range(int((N-1)/2)):
        if A[2*i+1] !=2*i+2  or A[2*i+2]!= 2*i+2:
            print(0)
            sys.exit()
    print(2**int((N-1)/2) % div)


### FIXED CODE ###

A, op, B=input().split()
A = int(A)
B = int(B)

if op =='+':
    print (A+B)
else :
    print(A-B)
s=input()
K=int(input())
znum=ord("z")
count=0
ans=[]
for i in range(len(s)):
    num=ord(s[i])
    if s[i]=="a":
        ans.append("a")
        continue
    sa=znum-num+1
    if (count+sa)<=K:
        ans.append("a")
        count+=sa
    else:
        ans.append(s[i])

if count<K:
    num=ord(s[-1])
    num+=(K-count)
    itr=chr(num)
    S=""
    for i in range(len(ans)):
        if i==(len(ans)-1):
            S=S+itr
            continue
        S=S+ans[i]
else:
    S=""
    for i in range(len(ans)):
        S=S+ans[i]
        
print(S)

### FIXED CODE ###

S=list(input())
K=int(input())
N=len(S)

for i in range(N):
    if S[i]=="a":
        continue
    sa=ord("z")-ord(S[i])+1
    if sa<=K:
        K-=sa
        S[i]="a"

if K!=0:
    K%=26
    S[i]=chr(ord(S[i])+K)

print("".join(S))
N = input()
H_list = list(map(int, input().split()))

prev_H = [H_list[0], H_list[1]]

for index, h in enumerate(H_list[2:], 2):
    if h - prev_H[0] < 0:
        H_list[index - 1] -= 1
    prev_H[0] = H_list[index - 1]
    prev_H[1] = H_list[index - 2]
    if prev_H[0] < prev_H[1]:
        print('No')
        exit()

print('Yes')   

### FIXED CODE ###

N = input()
H_list = list(map(int, input().split()))
H_edit_list = [10**10]

for h in list(reversed(H_list)):
    if h - H_edit_list[-1] > 0:
        H_edit_list.append(h - 1)
    else:
        H_edit_list.append(h)
    if H_edit_list[-2] < H_edit_list[-1]:
        print('No')
        exit()

print('Yes')
n,m = map(int,input().split())
a = list(map(int,input().split()))
sums = []
sum = 0
ans = 0

for i in range(n):
    sum += a[i]
    sums.append(sum)



dic = {}
for i in range(n):
    dic.setdefault(str(sums[i]%m),0)
    dic[str(sums[i]%m)] += 1
dic["0"]+= 1
#print(dic)

for key in dic.keys():
    k = dic[key]
    if k>1:
        ans += k*(k-1)//2

print(ans)


### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
sums = [0]
sum = 0
ans = 0

for i in range(n):
    sum += a[i]
    sums.append(sum)



dic = {}

for i in range(n+1):
    dic.setdefault(str(sums[i]%m),0)
    dic[str(sums[i]%m)] += 1

for key in dic.keys():
    k = dic[key]
    if k>1:
        ans += k*(k-1)//2

print(ans)
10 11a = [int(i) for i in input().split()]
b=a[0]
c=a[1]
x=c-b
print(round((x+1)*x/2)-c)

### FIXED CODE ###

a = [int(i) for i in input().split()]
b=a[0]
c=a[1]
x=c-b
print(round((x+1)*x/2)-c)
n = int(input())
a = list(map(int, input().split()))
s = ([0]*1000000)
a.sort()
for i in a:
    s[i] += 1
ans = 0
for j in range(1000000):
    if s[j] == 1:
        ans += 1
    if s[j] > 0:
        for k in range(j, 1000000, j):
            s[k] = 0
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
s = ([0]*1000001)
a.sort()
for i in a:
    s[i] += 1
ans = 0
for j in range(1000001):
    if s[j] == 1:
        ans += 1
    if s[j] > 0:
        for k in range(j, 1000001, j):
            s[k] = 0
print(ans)
# -*- coding: utf-8 -*-
from collections import defaultdict
from bisect import bisect
def inpl(): return list(map(int, input().split()))

def primes(N):
    sieve = [True]*(N+1)
    sieve[:2] = [False, False]
    for i in range(4, N+1, 2):
        sieve[i] = False

    for i in range(3, N+1, 2):
        if sieve:
            for j in range(2*i, N+1, i):
                sieve[j] = False
    P = []
    for i in range(N+1):
        if sieve[i]:
            P.append(i)
    return P

N, M = inpl()
P = primes(10**6)
searched = defaultdict(int)

Q = [1]

if N==1:
    print(M)
    exit()

if M%N == 0:
    ans = M//N
else:
    ans = 1
while Q:
    a = Q.pop()
    for p in P:
        c = a*p
        d = M - c*N
        if d < 0:
            break
        
        if d%c == 0:
            if not searched[c]:
                searched[c] = True
                ans = max(ans, c)
                Q.append(c)
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
N = int(input())
if N == 1:
    print("Hello World")
else:
    print(int(input()) + int(input()))
def f(x, A, B):
    return ((A*x)//B) - A*(x // B)

def main():
    A, B, N = map(int, input().split())
    ans = -1
    for x in range(min(B-1, N), max(min(B-1, N)-N, -1), -B+1):
        ans = max(ans, f(x, A, B))
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def f(x, A, B):
    return ((A*x)//B) - A*(x // B)

def main():
    A, B, N = map(int, input().split())
    ans = -1
    for x in range(min(B-1, N), max(min(B-1, N)-N, -1), min(-B+1, -1)):
        ans = max(ans, f(x, A, B))
    print(ans)

if __name__ == '__main__':
    main()
s = input().strip()
t = input().strip()
print(t, s, sep="")

### FIXED CODE ###

s, t = input().split()
print(t + s)
n = int(input());
point = [[0]*2 for i in range(n) ];
for i in range(n) :
	s = input().split(" ");
	point[i][0] = int(s[0]);
	point[i][1] = int(s[1]);

dict = {}
for i in range(n) :
	for j in range(n) :
		if i != j  :
			x = point[i][0] - point[j][0];
			y = point[i][1] - point[j][1];
			if (x,y) in dict:
				dict[(x,y)] += 1
			else:
				dict[(x,y)] = 1
print(n-max(dict.values()));

### FIXED CODE ###

n = int(input());
if n==1:
	print(n)
	exit(0)
point = [[0]*2 for i in range(n) ];
for i in range(n) :
	s = input().split(" ");
	point[i][0] = int(s[0]);
	point[i][1] = int(s[1]);

dict = {}
for i in range(n) :
	for j in range(n) :
		if i != j  :
			x = point[i][0] - point[j][0];
			y = point[i][1] - point[j][1];
			if (x,y) in dict:
				dict[(x,y)] += 1
			else:
				dict[(x,y)] = 1
print(n-max(dict.values()));
nx = map(int, raw_input().split())
l = map(int, raw_input().split())
 
n = nx[0]
x = nx[1]
 
d = L[0]
i = 1
L = 1
 
while d <= x:
    d += l[L]
    i += 1
    L += 1  
    if i == n + 1:
      break
print(i)

### FIXED CODE ###

nx = map(int, raw_input().split())
l = map(int, raw_input().split())
 
n = nx[0]
x = nx[1]
 
d = 0
i = 1
 
while True:
    if d <= x:
        d += l[i-1]
        i += 1
    if d > x:
        print(i-1)
        break
    if i == n + 1:
      print(i)
      break
a,b = map(int,input(),split())

if a <= b*2:
  print(0)
else:
  print(a-b*2)

### FIXED CODE ###

a,b = map(int,input().split())
 
if a <= b*2:
  print(0)
else:
  print(a-b*2)
def dfs(v, p, ad_list, count):
  for u in ad_list[v]:
    if u != p:
      count[u] += count[v]
      dfs(u, v, ad_list, count)

def main():
  n, q = map(int, input().split())
  ab = tuple(tuple((map(lambda x: int(x)-1, input().split())) for _ in range(n-1)))
  px = tuple(tuple(map(int, input().split())) for _ in range(q))

  ad_list = [[] for _ in range(n)]
  for a, b in ab:
    ad_list[a] += [b]
    ad_list[b] += [a]

  count = [0 for _ in range(n)]
  for p, x in px:
    count[p-1] += x

  dfs(0, -1, ad_list, count)

  print(*count)

if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.buffer.readline
def dfs(G,v,p):
    for nv in G[v]:
        if(nv==p):
            continue
        point[nv]+=point[v]
        dfs(G,nv,v)

N,Q=map(int,input().split())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(lambda x:int(x)-1,input().split())
    G[a].append(b)
    G[b].append(a)
point=[0]*N
for i in range(Q):
    p,x=map(int,input().split())
    point[p-1]+=x
dfs(G,0,-1)
print(*point)
x = 'aeiou'
i = input()
if i in x:
  print("vowel")
else
  print("consonant")

### FIXED CODE ###

x = 'aeiou'
i = input()
if i in x:
  print("vowel")
else:
  print("consonant")
A, B, K = map(int, input().split())

for k in range(K):

    if A % 2 != 0:
        
        if A > 1:
            
            A -= 1

    B += round(A/2)
    A -= round(A/2)

    if B % 2 != 0:

        if B > 1:
            
            B -= 1

    A += round(B/2)
    B -= round(B/2)

print(A, B)


### FIXED CODE ###

S = input()

if len(S) == 2:

    print(S)

elif len(S) == 3:

    print(S[::-1])
odd = ["R", "U", "D"]
even = ["L", "U", "D"]
s_list = list(input())

ans = "Yes"
for i in range(s_list):
  if i % 2 == 0:
    if not s_list[i] in odd:
      ans = "No"
  
  if i % 2 == 1:
    if not s_list[i] in even:
      ans = "No"

print(ans)


### FIXED CODE ###

s = list(input())
odd_s = ["R", "U", "D"]
even_s = ["L", "U", "D"]

ans = "Yes"

for i in range(len(s)):
  if i % 2 == 0:
    if s[i] not in odd_s:
      ans = "No"
  
  if i % 2 == 1:
    if s[i] not in even_s:
      ans = "No"

print(ans)
num = int(input())
A = list(map(int, input().split()))
H = sum(A) / 2
S = 0
for i in range(num):
  S = A[i]
  if abs(H - (S + A[i+1])) >= abs(H - S):
    print(abs(2 * S - 2 * H))
    break()

    


### FIXED CODE ###

num = int(input())
A = list(map(int, input().split()))
F = sum(A)
H = F / 2
S = 0
for i in range(num):
  S += A[i]
  if abs(H - (S + A[i+1])) > abs(H - S):
    print(abs(2 * S - F))
    break
def resolve():
    N = int(input())
    arr = list(map(int, input.split()))
    for num in arr:
        if not num % 2 and not (num % 3 == 0 or num % 5 == 0):
            print('DENIED')
            quit()
    print('APPROVED')

resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    arr = list(map(int, input().split()))
    f = True
    for num in arr:
        if not num % 2 and not (num % 3 == 0 or num % 5 == 0):
            print('DENIED')
            f = False
            break
    if f:
        print('APPROVED')


resolve()