Harryxun/stf_run huggingface dataset:
h, w, m = [int(e) for e in input().split()]

htotal = [0] * h
wtotal = [0] * w


hmax = 0
wmax = 0

s = set()
hl = []
wl = []

for i in range(m):
    hi, wi = [int(e) for e in input().split()]
    hi -= 1
    wi -= 1

    s.add((hi, wi))
    htotal[hi] += 1
    wtotal[wi] += 1

    if htotal[hi] > hmax:
        hmax = htotal[hi]
        hl = [hi]
    elif htotal[hi] == hmax:
        hl.append(hi)

    if wtotal[hi] > wmax:
        wmax = wtotal[wi]
        wl = [hi]
    elif wtotal[wi] == wmax:
        wl.append(wi)

m = hmax + wmax - 1
for he in hl:
    if m == hmax + wmax:
        break
    for we in wl:
        if m == hmax + wmax:
            break
        if not (he, we) in s:
            m += 1

print(m)
    

### FIXED CODE ###

h, w, m = [int(e) for e in input().split()]

htotal = [0] * h
wtotal = [0] * w


hmax = 0
wmax = 0

s = set()
hl = []
wl = []

for i in range(m):
    hi, wi = [int(e) for e in input().split()]
    hi -= 1
    wi -= 1

    s.add((hi, wi))
    htotal[hi] += 1
    wtotal[wi] += 1

    if htotal[hi] > hmax:
        hmax = htotal[hi]
        hl = [hi]
    elif htotal[hi] == hmax:
        hl.append(hi)

    if wtotal[wi] > wmax:
        wmax = wtotal[wi]
        wl = [wi]
    elif wtotal[wi] == wmax:
        wl.append(wi)

m = hmax + wmax - 1
for he in hl:
    if m == hmax + wmax:
        break
    for we in wl:
        if m == hmax + wmax:
            break
        if not (he, we) in s:
            m += 1

print(m)
n,m = map(int,input().split())
for i in range(n):
  p1,p2 = map(int,input().split())
  cnt = 0
  t = ((p1*p1)(p2*p2))**(0.5)
  if t >= m:
    cnt += 1
  print(cnt)

### FIXED CODE ###

n,d = map(int,input().split())
ans = 0
k = d**2
for i in range(n):
  
    x,y = map(int,input().split())
    if (x**2)+(y**2) <= k:
        ans += 1
    else:
        None
print(ans)
h,w=map(int,input().split())
result=[]
k=[]
def get_bomb(i,j):
  count=0
  for x in (i-1,i,i+1):
    for y in (j-1,j,j+1):
      if 0<=x<=h-1 and 0<=y<=w-1:
        if mapdata[x][y]=='#':
          count+=1
  return count
for i in range(h):
  line=list(str(input()))
  mapdata.append(line)
for i in range(h):
  for j in range(w):
    if mapdata[i][j]=='.':
      k.append(str(get_bomb(i,j)))
    else:
      k.append('#')
  result.append(k)
  k=[]
for i in range(len(result)):
  result2=''.join(result[i])
  print(result2)


### FIXED CODE ###

h,w=map(int,input().split())
mapdata=[]
for i in range(h):
  line=(str(input()))
  line2=list(line)
  mapdata.append(line2)
result=[]
k=[]
def get_bomb(i,j):
  count=0
  for x in (i-1,i,i+1):
    for y in (j-1,j,j+1):
      if 0<=x<=h-1 and 0<=y<=w-1:
        if mapdata[x][y]=='#':
          count+=1
  return count
for i in range(h):
  for j in range(w):
    if mapdata[i][j]=='.':
      k.append(str(get_bomb(i,j)))
    else:
      k.append('#')
  result.append(k)
  k=[]
for i in range(len(result)):
  result2=''.join(result[i])
  print(result2)
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

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

mod = 10 ** 9 + 7


import numpy as np
 
def prepare(n, MOD):
    nrt = int(n ** 0.5) + 1
    nsq = nrt * nrt
    facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
    facts[0, 0] = 1
    for i in range(1, nrt):
        facts[:, i] = facts[:, i] * facts[:, i - 1] % MOD
    for i in range(1, nrt):
        facts[i] = facts[i] * facts[i - 1, -1] % MOD
    facts = facts.ravel().tolist()
 
    invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
    invs[-1, -1] = pow(facts[-1], MOD - 2, MOD)
    for i in range(nrt - 2, -1, -1):
        invs[:, i] = invs[:, i] * invs[:, i + 1] % MOD
    for i in range(nrt - 2, -1, -1):
        invs[i] = invs[i] * invs[i + 1, 0] % MOD
    invs = invs.ravel().tolist()
 
    return facts, invs


facts, invs = prepare(n, mod)

def comb(n, r, mod):
    return facts[n] * invs[r] % mod * invs[n-r] % mod

nca = comb(n, a, mod)#factorial(n) // factorial(a) // factorial(n-a)
ncb = comb(n, b, mod)#factorial(n) // factorial(b) // factorial(n-b)

ans = pow_k(2, n)

ans -= 1 + nca + ncb
ans %= mod
print(ans)


### FIXED CODE ###

mod = 10 ** 9 + 7

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

def combmod(n,k,mod):
    a = 1
    b = 1
    for i in range(k):
        a = a * (n-i) % mod
        b = b * (i+1) % mod
    return a * pow(b, mod-2, mod) % mod

nca = combmod(n, a, mod) #comb(n, a, mod)#factorial(n) // factorial(a) // factorial(n-a)
ncb = combmod(n, b, mod) #comb(n, b, mod)#factorial(n) // factorial(b) // factorial(n-b)

ans = pow(2, n, mod)

ans -= 1 + nca + ncb
ans %= mod
print(ans)
mport math
money = 100
x = int(input())
#print(x)
cnt = 0
while money <= x:
  money += money * 0.01
  money = int(money)
  cnt += 1
  #print(cnt,money)
print(cnt)

### FIXED CODE ###

import math
money = 100
x = int(input())
#print(x)
cnt = 0
while money < x:
  money += money * 0.01
  money = int(money)
  cnt += 1
  #print(cnt,money)
print(cnt)
A,B,C,D=map(int,input().spliT())
if A*B<C*D:
  print(C*D)
else :
  print(A*B)

### FIXED CODE ###

A,B,C,D=map(int,input().split())
if A*B<C*D:
  print(C*D)
else :
  print(A*B)
l = map(int,raw_input().split())
if l[0] > l[1]:
  print a > b
elif l[0] < l[1]:
  print a < b
else:
  print a == b

### FIXED CODE ###

l = map(int,raw_input().split())
if l[0] < l[1]:
  print "a < b"
elif l[0] == l[1]:
  print "a == b"
else:
  print "a > b"
=
a, b = map(int, input().split())
if (a*b) % 2 == 0:
    print('Even')
else:
    print('Odd')
1 2

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2 == 0:
    print('Even')
else:
    print('Odd')
N, M = map(int, input().split())
a = [False] * (N+1)
for i in range(M):
    a[int(input())] = True

memo = [None] * (N+1)
memo[0] = 0 #0番目にたどり着く方法は0通りと定義する。
memo[1] = 1 if not a[1] else 0
if a[2] != True:
  if memo[1] == 0:
    memo[2] = 1
  else:
    memo[2] = 2
else:
  memo[2] = 0

for i in range(3, N+1):
    memo[i] = memo[i-1] + memo[i-2] if not a[i] else 0

print(memo[N] % 1000000007)

### FIXED CODE ###

N, M = map(int, input().split())
a = [False] * (N+1)
for i in range(M):
    a[int(input())] = True
 
memo = [None] * (N+1)
memo[0] = 1 #0番目にたどり着く方法は1通りと定義する。
memo[1] = 1 if not a[1] else 0
 
for i in range(2, N+1):
    memo[i] = memo[i-1] + memo[i-2] if not a[i] else 0
 
print(memo[N] % 1000000007)
n,m=map(int, input().split())
l=[]
cnt=0
for i in range(m):
    s,c=map(int, input().split())
    l.append([s,c])
    if s==1 and c==0: #最上位の位が0の時に対する処理
        cnt+=1
if m==1 and s==1 and c==0:
    print('-1')
elif m==1 and s!=n:
    print(10**(n-1)+c*(10**(n-s)))
elif m==1:
    print(c*(10**(n-s)))
else:
    buf=0
    for i in range(m-1):
        for j in range(i+1,m):
            if l[i][0]==l[j][0] and l[i][1]!=l[j][1]:
                buf+=1
    if buf!=0 or cnt!=0:
        print('-1')
    else:
        l.sort()
        ans=l[0][1]*(10**(n-l[0][0]))
        for i in range(1,m):
            if l[i-1][0]==l[i][0]:
                continue
            else:
                ans+=l[i][1]*(10**(n-l[i][0]))
        print(ans)

### FIXED CODE ###

import sys
n,m=map(int,input().split())
ans=[0]*n
scash=[]
buf=0
for i in range(m):
    s,c=map(int,input().split())
    if s not in scash:
        ans[s-1]+=c
        scash.append(s)
    elif (s in scash) and c!=ans[s-1]:
        buf+=1
        scash.append(s)
if n==1 and ans[0]==0:
    print(0)
    sys.exit()
if buf==0 and ans[0]!=0:
    anstr=[str(num) for num in ans]
    print(''.join(anstr))
elif buf==0 and (1 not in scash):
    ans[0]+=1
    anstr=[str(num) for num in ans]
    print(''.join(anstr))
else:
    print(-1)
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 14 01:10:44 2018

@author: Yuki
"""
import sys
sys.setrecursionlimit(100001)
def func(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n*func(n-1)

N, M = map(int, input().split())
if abs(N-M) > 1:
    print(0)
elif abs(N-M) == 1:
    A = max(N, M)
    res = func(A)
    print(int(res**2/A))
else:
    print(int(2*func(N)**2))




### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Fri Sep 14 01:10:44 2018

@author: Yuki
"""
mod = 1000000000 + 7
def func(n):
    r = 1
    for i in range(1, n+1):
        r *= i
        r %= mod

    return r
N, M = map(int, input().split())
if abs(N-M) > 1:
    print(0)
elif abs(N-M) == 1:
    A = max(N, M)
    print(int((func(A)*func(A-1))%mod))
else:
    print(int(2*func(N)*func(N))%mod)
a,b=map(int,input().split())
print(max[a+b,a-b,a*b])

### FIXED CODE ###

a,b=map(int,input().split())
print(max([a+b,a-b,a*b]))
A, B, C, D, E, F = map(int, input().split())

water = []
for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        n = (i*A + j*B)*100
        if n <= F:
            water.append(n)
water = sorted(list(set(water)))

result = {"0":[0,0]}
noud = []
for i in water:
    suger_limit = E*(i//100)
    for j in range(suger_limit//C + 1):
        for k in range(suger_limit//D + 1):
            n = j*C + k*D
            if n <= suger_limit and i + n <= F and n != 0:
                noudo = 100*n/(i+n)
                noud.append(noudo)
                
                result[str(noudo)] = [i+n,n]


a,b = map(int,result[str(max(noud))])

print(a,b)

### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())

water = []
for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        n = (i*A + j*B)*100
        if n <= F:
            water.append(n)
water = sorted(list(set(water)))

density_d = {}
density = []

for i in water:
    suger_limit = E*(i//100)

    suger = []

    for j in range(suger_limit//C + 1):
        for k in range(suger_limit//D + 1):
            n = j*C + k*D
            if n <= suger_limit and n + i <= F:
                suger.append(n)
    suger = max(suger)
    if i+suger == 0:
        continue
    else:
        density.append(100*suger/(i+suger))
        density_d[100*suger/(i+suger)] = [i + suger, suger]
density = list(set(density))
a, b = map(int, density_d[max(density)])
print(a,b)
a=input()
print(3*(a**2))

### FIXED CODE ###

r=int(input())
print(3*r*r)
def(a, b)
  c = a * b
  if(c % 2 == 0)
  	print("Even")
  else
    print("Odd")
  

### FIXED CODE ###

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

c = a * b
if(c % 2 == 0):
  print("Even")
else:
  print("Odd")
a = input()
b = input()
if a > b:
   print("a > b")
if a < b:
   print("a < b")
if a == b:
   print("a == b")

### FIXED CODE ###

a,b = map(int,input().split()) 
if a > b:
   print("a > b")
elif a < b:
   print("a < b")
else:
   print("a == b")
input_line1 = raw_input()
c = 1
p = ""
for v in input_line1:
    if c == 1:
        p += v
        c = 0
    else:
        c += 1
print(p)

### FIXED CODE ###

input_line1 = str(input())
c = 1
p = ""
for v in input_line1:
    if c == 1:
        p += v
        c = 0
    else:
        c += 1
print(p)
print(["NO","YES"][int("".join(input().split()))])

### FIXED CODE ###

from sys import stderr, setrecursionlimit
from functools import reduce
from operator import add
setrecursionlimit(2147483647)
def f(n=1):
    if n == 1:
        return [int(i) for i in input().split()]
    res = []
    for i in range(n):
        res.append([int(j) for j in input().split()])
    return res
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)

rgb = int("".join(input().split()))
print("NO" if rgb%4 else "YES")
def mx(i):
    if i == 0: return 0
    else     : return (i+1)*i + mx(i-1)

def cns(ls,m,sm):
    global n, s
    count = 0
    if m == n:
        if sm == s: return 1
        else      : return 0
    elif s-mx(n-m+1)-2 <= sm <= s:
        for i in range(9-m+1):
            rls = ls[:]
            k = rls.pop(i)
            count += cns(rls,m+1,sm+(m+1)*k)
        return count
    else: return 0

ls = [0,1,2,3,4,5,6,7,8,9]
while True:
    n, s = map(int, raw_input().split())
    if s > mx(n): print 0
    else        : print cns(ls,0,0)

### FIXED CODE ###

def mxmn(ls,m):
	global n
	s1,s2 = 0, 0
	for i in range(m):
		s1 += (n-i)*ls[-i-1]
		s2 += (n-i)*ls[i]
	return s1,s2

def f(ls,m,s):
	global n
	count = 0
	if m > 0:
		mx,mn = mxmn(ls,m)
		if mx < s or mn > s: return 0
		elif mx == s or mn == s: return 1
		for i in range(len(ls)):
			lls = ls[:]
			a = (n-m+1)*lls.pop(i)
			if s-a < 0:	break
			else: count += f(lls,m-1,s-a)
		return count
	else:
		return 1 if s == 0 else 0
			
ls = [i for i in range(10)]
while True:
	try:
		n,s = map(int, raw_input().split())
		print f(ls,n,s)
	except:
		break
n, r = map(int, input().split())
if n >= 10:
  print(r)
else:
  print(100(10-r))


### FIXED CODE ###

n, r = map(int, input().split())

if n >= 10:
  print(r)
else:
  print(r+100*(10-n))
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    n = int(input())
    a = list(map(int, input().split()))
    nn = n*n
    r = [-1] * nn
    ms = []
    us = []
    for i in range(n):
        c = i+1
        ri = a[i] - 1
        r[ri] = c
        ms.append([ri, i, c])
        us.append([ri, n-i-1, c])
    ms.sort()
    si = 0
    for ri, k, c in ms:
        for _ in range(k):
            while r[si] > 0 and si < (nn-1):
                si += 1
            if si > ri or r[si] > 0:
                print('No')
                return
            r[si] = c
            si += 1

    si = nn-1
    us.sort()
    us.reverse()
    for ri, k, c in us:
        for _ in range(k):
            while r[si] > 0 and si > 0:
                si -= 1
            if si < ri or r[si] > 0:
                print('No')
                return
            r[si] = c
            si += 1

    print('Yes')
    print(' '.join(map(str, r)))


main()


### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    n = int(input())
    a = list(map(int, input().split()))
    nn = n*n
    r = [-1] * nn
    ms = []
    us = []
    for i in range(n):
        c = i+1
        ri = a[i] - 1
        r[ri] = c
        ms.append([ri, i, c])
        us.append([ri, n-i-1, c])
    ms.sort()
    si = 0
    for ri, k, c in ms:
        for _ in range(k):
            while r[si] > 0 and si < (nn-1):
                si += 1
            if si > ri or r[si] > 0:
                print('No')
                return
            r[si] = c

    si = nn-1
    us.sort()
    us.reverse()
    for ri, k, c in us:
        for _ in range(k):
            while r[si] > 0 and si > 0:
                si -= 1
            if si < ri or r[si] > 0:
                print('No')
                return
            r[si] = c

    print('Yes')
    print(' '.join(map(str, r)))


main()
s = map(int, input().split()
l=[s]
i=1
def func(a):
  if a%2==0:
    return a/2
  else:
    return 3s+1

def Collatz(s):
    i+=1
	l.append(func(s))
	if not len(l) == len(set(l)):
        print(i)
        break
    else:
        continue

### FIXED CODE ###

s = int(input())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

while (len(l)==len(set(l))):
  i+=1
  s = func(s)
  l.append(s)
print(i)
l = input().split()
a, b = l[0], l[1]
if (a*b)%2 == 0:
	print("Even")
else
	print("Odd")

### FIXED CODE ###

l = input().split()
a, b = int(l[0]), int(l[1])
if (a*b)%2 == 0:
	print("Even")
else:
	print("Odd")
res=0
for i in range(1,int(input())+1):
  t=0
  while i==1:
    t+=1 if i%2==0
    i//=2
  res=max(res,t)
print(res)
  

### FIXED CODE ###

res=1
maxT=0
for i in range(1,int(input())+1):
  c=i
  t=0
  while c!=1:
    if c%2==0:
      t+=1
    else:
      break
    c//=2
  if t>maxT:
    res=i
    maxT=t
print(res)
import numpy as np
N = input()
Ls = np.array([int(i) for i in input().split()])
max_arg = np.argmax(Ls)
sum_ = sum([v for i,v in enumerate(Ls) if i != max_arg])
print("Yes" if Ls[max_arg] < sum_ else "No")

### FIXED CODE ###

input()
Ls = [int(i) for i in input().split()]
max_arg = Ls.index(max(Ls))
sum_ = sum([v for i,v in enumerate(Ls) if i != max_arg])
print("Yes" if Ls[max_arg] < sum_ else "No")
from bisect import bisect_right

n = int(input())
A = list(map(int, input().split()))
gr = []
for i in range(n):
    gr.append([])
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    gr[a].append(b)
    gr[b].append(a)
ans = [0] * n
dp = [10 ** 9 for i in range(n)]
dp[0] = -10 ** 9
kek = 1
used = {0}


def dfs(v):
    global kek
    j = bisect_right(dp, A[v] - 1)
    old = -1
    if dp[j - 1] < A[v] < dp[j]:
        old = dp[j]
        dp[j] = A[v]
        if kek == j:
            for h in range(kek + 1, n + 1):
                if dp[h] == 10 ** 9:
                    kek = h
                    break
    ans[v] = kek - 1
    for u in gr[v]:
        if u not in used:
            used.add(u)
            dfs(u)
    dp[j] = old
    if kek > j and old == 10 ** 9:
        kek = j


dfs(0)
print(*ans)

### FIXED CODE ###

from bisect import bisect_right
from sys import setrecursionlimit

setrecursionlimit(10**8)
n = int(input())
A = list(map(int, input().split()))
gr = []
for i in range(n):
    gr.append([])
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    gr[a].append(b)
    gr[b].append(a)
ans = [0] * n
dp = [10 ** 10 for i in range(1 + n)]
dp[0] = -10 ** 10
kek = 1
used = {0}


def dfs(v):
    global kek
    j = bisect_right(dp, A[v] - 1)
    old = dp[j]
    if dp[j - 1] < A[v] < dp[j]:
        old = dp[j]
        dp[j] = A[v]
        if kek == j:
            for h in range(kek + 1, 1 + n):
                if dp[h] == 10 ** 10:
                    kek = h
                    break
            if kek == j:
                kek = n + 1
    ans[v] = kek - 1
    for u in gr[v]:
        if u not in used:
            used.add(u)
            dfs(u)
    dp[j] = old
    if kek > j and old == 10 ** 10:
        kek = j


dfs(0)
print(*ans)
n, m = map(int, input().split())
c = [list(map(int, input().split())) for i in range(n)]
AC, WA, i =0, 0, 0
while i < n:
    if c[i][0] == i + 1:
        if c[i][1] == 'WA':
            WA += 1
        else:
            AC += 1
            i += 1
print(AC, WA)

### FIXED CODE ###

n, m = map(int, input().split())
c = [input().split() for i in range(m)]
for i in range(m):
    c[i][0] = int(c[i][0])
AC, WA = 0, 0
acwa = [[0, 0] for i in range(n)]
for i in range(m):
    if acwa[c[i][0] - 1][0] == 0:
        if c[i][1] == 'AC':
            acwa[c[i][0] - 1][0] += 1
            AC += 1
            WA += acwa[c[i][0] - 1][1]
        else:
            acwa[c[i][0] - 1][1] += 1

print(AC, WA)
n = int(input())
a = []
ans = 0
for i in range(n):
  x = int(input())
  a.append(x)
for i in range(1, n):
  if a[i] < a[i - 1]:
    ans += a[i - 1] - a[i]
print(ans)


### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for i in range(1, n):
  if a[i] < a[i - 1]:
    ans += a[i - 1] - a[i]
    a[i] += (a[i - 1] - a[i])
print(ans)
n, T = map(int, input.split())
res = 2000
for _ in range(n):
  c, t = map(int, input.split())
  if t > T: continue
  res = min(res, c)
if res == 2000:
  print('TLE')
else:
  print(res)

### FIXED CODE ###

n, T = map(int, input().split())
res = 2000
for _ in range(n):
  c, t = map(int, input().split())
  if t > T: continue
  res = min(res, c)
if res == 2000:
  print('TLE')
else:
  print(res)
s = input()
for i in range[1111-9999]
if (s[i] = s[i] + 1):
  print('Bad')
  exit()
else:
  print('Good')

### FIXED CODE ###

S = list(input())
for i in range(3):
    if(S[i]==S[i+1]):
        print('Bad')
        exit()
else:
    print('Good')
A, B = map(int, input().split())
ans = max(2*A-1, 2*B-1, A*B0
print(ans)0)

### FIXED CODE ###

A,B=map(int,input().split())
print(max(2*A-1,2*B-1,A+B))
r = int(raw_input('red:'))
g = int(raw_input('green:'))
b = int(raw_input('blue:'))

sum = r*100 + g*10 + b

if sum%4 == 0:
	print "YES"
else:
	print "NO"

### FIXED CODE ###

a= raw_input().split()

sum = int(a[0])*100 + int(a[1])*10 + int(a[2])

if sum%4 == 0:
	print "YES"
else:
	print "NO"
n=int(input())
k=int(input())

a=1

for i range(n):
  if a >=k:
    a=+k
  else:
    a=2*a

print(a)

### FIXED CODE ###

n=int(input())
k=int(input())

a=1

for i  in range(n):
  if a >=k:
    a+=k
  else:
    a=2*a

print(a)
input()
A = 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')

### FIXED CODE ###

input()
A = 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')
a,b,c,d = map(int,input().split())

if abs(a-c) <= d:
  print('Yes')
elif (abs(a-b) <= d) && (abs(b-c) <= d):
  print('Yes')
else:
  print('No')


### FIXED CODE ###

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

if abs(a-c) <= d:
  print('Yes')
elif (abs(a-b) <= d) and (abs(b-c) <= d):
  print('Yes')
else:
  print('No')
n=[int(i) for i in input().split()]

if sum(n)%9==0:
  print("Yes)
else:
  print("No")

### FIXED CODE ###

n=[int(i) for i in input().split()]
 
if sum(n)%9==0:
  print("Yes")
else:
  print("No")
group =[0,1,3,1,2,1,2,1,1,2,1,2,1]

input_lines=raw_input()
input_numbers=input_lines.split()
n=map(int,input_numbers)

if group[n[0]] == group[n[1]]
    print "Yes"
else:
    print "NO"

### FIXED CODE ###

#coding: utf-8

group={'a':[1,3,5,7,8,10,12],'b':[4,6,9,11],'c':[2]}

input_lines=raw_input()
input_numbers=input_lines.split()
n=map(int,input_numbers)#n[0]とn[1]に数字

first_group = False
second_group = False

for i in group:
    for j in range(0,len(group[i])):
        if group[i][j] == n[0]:
            first_group = True
        if group[i][j] == n[1]:
            second_group = True
    if first_group == True and second_group==False or first_group == False and second_group == True:
        print "No"
        break

if first_group and second_group:
    print "Yes"
s=input()
a="abcdefghijklmnopqrstuvwxyz"
if(s==a[::-1]):
    print(-1)
else:
    if(len(s)==26):
        c=s[-1]
        i=2
        while 1:
            if(s[-i]<c):
                print(s[:26-i]+c)
                break
            else:
                i+=1
    else:
        for i in a:
            if(not i in s):
                print(s+i)
                break

### FIXED CODE ###

s=input()
if s=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
    quit()
elif len(s)<26:
    d=set([i for i in range(26)])
    for i in s:
        d.remove(ord(i)-97)
    print(s+chr(min(d)+97))
else:
    d=[ord(s[-1])]
    for i in range(25):
        c=s[-2-i]
        if max(d)<ord(c):
            d.append(ord(c))
        else:
            print(s[:26-2-i]+chr(min([i for i in d if i>ord(c)])))
            break
import numpy as np

N = int(input())
a = []
x = []
y = []
count = 0

def factorial(n):
    if n<2:
        return 1
    else:
        return(n*factorial(n-1))

for i in range(N):
    a.append(list(map(int,input().split())))    
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        count += np.sqrt((a[i][0] - a[j][0])**2 + (a[i][1] - a[j][1])**2)
b = factorial(N)
print(count/b)
#print(count/N)


### FIXED CODE ###

r = int(input())
print(r**2)
N,M,K=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
while b[j] > K - a[i]:
    j -= 1
    ans = max(ans, i + j)
print(ans)


### FIXED CODE ###

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

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
W,a,b=map(int,input().split())
print(min(max(W+a - b,0),max(a-W-b)))


### FIXED CODE ###

W,a,b=map(int,input().split())
print(max(max(0,b-W-a),max(0,a-W-b)))
N = int(input())
A = list(map(int, input().split(" ")))

for i in range(N):
  sum += 1 / A[i]
print(1/sum)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split(" ")))
sum = 0
for i in range(N):
  sum += 1. / A[i]
print(1/sum)