peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N,M=map(int,input().split())
H=list(map(int,input().split()))
t=[1]*N
for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]>H[b-1]:
        t[b-1]=0
    elif H[a-1]<H[b-1]:
        t[a-1]=0
    else:
        t[a-1],t[b-1]=0,0
print(sum(t))
# Judge status: Wrong Answer
a,b,c=map(int,raw_input().split())
if a+b>c:
  print "yes"
elif c >a+b:
  print "no"
# Judge status: Accepted
n,m=map(int,input().split())
A=list(map(int,input().split()))
a=sum(A)
if a>n:
    print(-1)
else:
    print(n-a)
# Judge status: Wrong Answer
N, M = list(map(int, input().split()))
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(str, input().split()))
  a=int(a)
  if not list_Flag[a-1] == 1:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
WA=sum(list_WA)
AC=sum(list_Flag)
print(AC,WA)
# Judge status: Accepted
S = input()
cnt = 0
for i,ch in enumerate(S):
  if cnt == 0:
    if ch == "R":
      cnt = 1
  elif ch == "R" and S[i-1] == "R":
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)

s = 0
t = 0

for index, a in enumerate(A):
  if index % 4 == 0 or index % 4 == 3:
    s += a

  else:
    t += a

print(abs(s - t))
# Judge status: Accepted
X, N = map(int, input().split())
if N !=0:
  A = list(map(int, input().split()))
  A.sort()
MIN = 1000
if N ==0:
  print(X)
elif not X in A:
  print(X)
else:
  for i in range(X*10):
    N = abs(X - i)
    if not i in A:
      if MIN > N:
        Z = i
        MIN = N
  print(Z)
# Judge status: Accepted
a,b,c = map(int,input().split())
ans = 'No'
if a==b or b==c or c==a:
    ans = 'Yes'
if a==b and b==c:
    ans = 'No'
print(ans)
# Judge status: Wrong Answer
a = input()
b = list(map(int, input().split()))
min = 100000

for i in range(len(b)):
  left = 0
  right = 0
  for j in range(i):
    left += b[j]
  for j in range(len(b)):
    right += b[j]
  if min > abs(left - right):
    min = abs(left - right)
    
print(min)
# Judge status: Accepted
N, M = map(int,input().split())
ans = 1
if abs(N-M) >= 2:
    ans = 0
elif N == M:
    for i in range(1,M+1):
        ans = (ans*i) % (10**9+7)
    for i in range(1,M+1):
        ans = (ans*i) % (10**9+7)
    ans = (ans*2) % (10**9+7)
else:
    for i in range(1,M+1):
        ans = (ans*i) % (10**9+7)
    for i in range(1,N+1):
        ans = (ans*i) % (10**9+7)
print(ans)
# Judge status: Accepted
x, a, b = map(int, input().split())
if a - b >= 0:
    print('delicious')
elif b - a >= x + 1:
    print('dangerous')
else:
    print('safe')
# Judge status: Accepted
a=list(input())
if a[0]==a[1]==a[2] or a[1]==a[2]==a[3]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def main():
  N, M = (int(_) for _ in input().split())
  MOD = 10 ** 9 + 7
  
  def fact(n):
    res = 1
    for i in range(n):
      res *= (i+1)
      res %= MOD
    return res
  
  ret = 0
  if abs(N - M) == 1:
    ret = (fact(N) * fact(M)) % MOD
  elif N == M:
    ret = (2 * fact(N) * fact(M)) % MOD
  else:
    pass
  print(ret)
  return

if __name__ == '__main__':
  main()
# Judge status: Accepted
n = int(input())
s = input()
x = 0
xmin = 0
for c in s:
  if c == '(':
    x += 1
  else:
    x -= 1
    xmin = min(xmin, x)
print('(' * (-xmin) + s + ')' * (x - xmin))
# Judge status: Accepted
s=input()
a=s.lower()
l=len(s)
count=0
dif=0

if s[0]=='A':
  for i in range(2,l-1):
    if s[i]=='C':
      count+=1
  if count==1:
    for i in range(1,l):
      if s[i]!=a[i]:
        dif+=1
    if dif==1:
      print('AC')
      exit()
print('WA')
# Judge status: Accepted
import heapq
N, M = map(int, input().split())

jobs = [[] for _ in range(M+1)]

for i in range(N):
    a, b = map(int, input().split())
    if a <= M:
        jobs[M-a].append(b)

ans = 0
priorityQueue = []
heapq.heapify(priorityQueue)
for i in range(M-1, -1, -1):
    for jobValues in jobs[i]:
        heapq.heappush(priorityQueue, -1*jobValues)
    if len(priorityQueue) > 0:
        ans += heapq.heappop(priorityQueue) * (-1)

print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
if abs(c - a) <= d:
    print('Yes')
elif abs(b - a) <= d and abs(c - b) <= d:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
s = []

ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
  s.append(input())
  if s[i] == "AC":
    ac += 1
  elif s[i] == "WA":
    wa += 1
  elif s[i] == "TLE":
    tle += 1
  else:
    re += 1

print("AC × " + str(ac))
print("WA × " + str(wa))
print("TLE × " + str(tle))
print("RE × "+ str(re))
# Judge status: Wrong Answer
N = int(input())
S = input()

ans = 3*(10**5)+1
cnt_E = S.count('E')
cnt_E_left = 0
cnt_W = S.count('W')
cnt_W_left = 0

for n in range(N):
  ans = min(ans,cnt_W_left+cnt_E-cnt_E_left)
  _ = S[n]
  if _ == 'E':
    cnt_E_left += 1
  elif _ == 'W':
    cnt_W_left += 1

print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
i=1
while x*2<=y:
  i+=1
  x*=2
print(i)
# Judge status: Accepted
(N,x),a=[list(map(int,input().split()))for _ in[0]*2];r=0
for i in range(1,N):e=max(a[i]+a[i-1]-x,0);a[i]-=min(e,a[i]);r+=e
print(r)
# Judge status: Accepted
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
a  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#

colors = [a_ // 400 for a_ in a if a_ < 3200]
colors_3200 = [a_ // 400 for a_ in a if a_ >= 3200]
c = collections.Counter(colors)

min_ = len(c) if c else 1
max_ = len(c) + len(colors_3200)
print(min_, max_)
# Judge status: Wrong Answer
k = int(input())
if(k % 2 == 0):
    print(int((k/2)*(k/2)))
elif(k % 2 != 0):
    print(int(((k+2-1)/2)*k-((k+2-1)/2)))
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
num = (a*b*c)
if num %2 == 0:
  print(0)
else:
  print(abs((a*b*((c//2)))-(a*b*((c//2)+1))))
# Judge status: Accepted
n,k=map(int,input().split())
r,s,p=map(int,input().split())
d={'r':p,'s':r,'p':s}
t=input()
ans=0
for i in range(k):
  a=t[i::k]
  flag=a[0]
  cnt=2
  for j in a[1:]:
    if j!=flag:
      ans+=d[flag]*(cnt//2)
      flag=j
      cnt=2
    else:cnt+=1
  ans+=d[flag]*(cnt//2)
print(ans)
# Judge status: Accepted
r = int(input())
print(pow(r,2))
# Judge status: Accepted
import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    s = input()
    D = Counter(s)
    res = 1
    for v in D.values():
        res = res * (v + 1) % mod
    print(res - 1)


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
#!/usr/bin/env python3

X = int(input())

ans = 0
for i in range(1, 10**9):
    ans += i
    if ans >= X:
        print(i)
        exit()
# Judge status: Accepted
N,W = map(int,input().split())
dp = [[0 for j in range(W+1)] for i in range(N)]
w,v = map(int,input().split())
for j in range(W+1):
    if w <= j:
        dp[0][j] = v
for i in range(1,N):
    w,v = map(int,input().split())
    for j in range(W+1):
        if j >= w:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-w]+v)
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N-1][W])
# Judge status: Wrong Answer
N, M = map(int, input().split())

if N > M:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = int(input())
a = [s]
count = 1

for i in range(100000):
  if a[i] % 2 == 0:
    b = a[i]/2
  else:
    b = 3*a[i]  + 1  
  a.append(b)
  count += 1
  if a.count(b) >1:
    break

print(count)
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=0
s=0
for i in range(n):
  if s+a[i]<=x:
    ans+=1
  s+=a[i]
if s<x:
  print(ans-1)
else:
  print(ans)
# Judge status: Accepted
a,b,x=map(int,input().split())
bb=b//x
aa=a//x
ans=bb-aa
if a%x==0:
  ans+=1
print(ans)
# Judge status: Accepted
n = int(input())
c = input()
l = 0
r = n-1
ans = 0
while l<r:
    if c[l] == "R": l += 1
    if c[r] == "W": r -= 1
    
    if c[l]=="W" and c[r]=="R":
        l += 1
        r -= 1
        ans += 1
        
print(ans)
# Judge status: Wrong Answer
n = int(input())

res = 1

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

for i in range(n):
    res *= a[i]
    if (res > 1000000000000000000):
        res = -1
        break

print(res)
# Judge status: Accepted
A, B, C = map(int, input().split())

if B + C > A:
    print((B + C) - A)
else:
    print(0)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] = abs(a[i])
a.sort()
a[0] *= -1
print(sum(a))
# Judge status: Accepted
from collections import deque

N = int(input())

l = deque(['a'])

alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

for i in range(1, N):
    #print(i)
    len_l = len(l)
    for k in range(len_l):
        x = l.popleft()
        for j in range(len(set(x))+1):
            #print(i, k, j)
            l.append(x+alpha[j])
            #print(l)

#l =sorted(l)

for i in l:
    print(i)
# Judge status: Accepted
N = int(input())
ans = 10**9+7
for i in range(1,N):
  A = i
  B = N-i
  ans = min(ans, sum(list(map(int,str(A))))+sum(list(map(int,str(B)))))
print(ans)
# Judge status: Accepted
import math
A,B,N=(int(x) for x in input().split())
if N<B:i=N
else:i=B-1
p=(math.floor((A*i)/B))
print(p)
# Judge status: Accepted
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
D = list(map(int, input().split()))
D.sort()
print(D[n//2] - D[(n//2)-1])
# Judge status: Accepted
n = int(input())
a = sorted(map(int, input().split()))
MAX = a[-1]
mid = MAX // 2
b = float('inf')
for i in a:
    # print(mid, i, b)
    if abs(mid - i) <= b and i != MAX:
        b = mid - i
        y = i

print(MAX, y)
# Judge status: Accepted
S,T=map(int,input().split())
x=500*S
if x>=T:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
r, g, b = map(int, input().split())
k = int(input())

def dfs(i , r, g, b):
    if i > k: return False
    if r < g < b: return True
    if dfs(i+1, r*2, g,   b  ): return True
    if dfs(i+1, r,   g*2, b  ): return True
    if dfs(i+1, r,   g,   b*2): return True
    return False

print('Yes' if dfs(0, r, g, b) else 'No')
# Judge status: Accepted
s1 = input()
s2 = input()
dic = {}
for i in range(len(s1)):
    if not s1[i] in dic:
        dic[s1[i]] = s2[i]
    else:
        if dic[s1[i]] != s2[i]:
            print('No')
            quit()
#print('Yes')
if len(dic) != len(set(dic.values())):
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
H,W = map(int,input().split())
if W==1:
  print(1)
elif W==2:
  print(H)
else:
  if W%2==0:
    print((W//2)*H)
  else:
    if H%2==0:
      print(((W//2)+1)*(H//2) + (W//2)*(H//2))
    else:
      print(((W//2)+1)*((H//2)+1) + (W//2)*(H//2))
# Judge status: Wrong Answer
N = int(input())
R = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x:x[0])

remain = list(range(N))
left = 0
i = 1
while i < N:
  x_l, length_l = R[left]
  x, length = R[i]
  if x-x_l < length_l+length:
    remain.pop(remain.index(i))
  else:
    left = i
  i += 1
print(len(remain))
# Judge status: Wrong Answer
from sys import stdin
import math
def I(): return int(stdin.readline().rstrip())

n = I()

i = 2
ans = 0
for _ in range(int(math.sqrt(n))):
    if n==1:
        break
    if n%i==0:
        n/=i
        ans += 1
    i += 1

if ans == 0 and 2<=n:
    ans = 1
print(ans)
# Judge status: Accepted
s = input()
n = len(s)
yn = "YES"

while(len(s) > 0):
    if(s.endswith("dream") or s.endswith("erase")):
        s = s[:(len(s)-5)]
    elif(s.endswith("eraser")):
        s = s[:(len(s)-6)]
    elif(s.endswith("dreamer")):
        s = s[:(len(s)-7)]
    else:
        yn = "NO"
        break

print(yn)
# Judge status: Accepted
from collections import defaultdict

N = int(input())
cnt = defaultdict(int)

for i in range(1, N + 1):
    h = str(i)[0]
    f = str(i)[-1]
    if f == '0':
        continue
    cnt[(h, f)] += 1

ans = 0
dlst = list(cnt.items())
for i, v in dlst:
    ans += v * cnt[i[1], i[0]]

print(ans)
# Judge status: Wrong Answer
k = int(input())
s = input()
print((s[:k], s)[k >= len(s)])
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if (abs(a-c)<=d) or (abs(a-b)<=d and abs(b-c)<=d):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
S=input()
T=input()
ls=len(S)
lt=len(T)

ans='UNRESTORABLE'

if ls<lt:
    print(ans)
    exit()
for i in range(ls-lt,0,-1):
    c=0
    for j in range(lt):
        if T[j]==S[i+j] or S[i+j]=='?':
            continue
        else:
            c=1
            break
    if c==0:
        ans=S.replace('?','a')
        ans=ans[:i] + T + ans[i+lt:]
print(ans)
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))

def swap(a, b):
    mem = a
    a = b
    b = mem
    return a, b
P = [0] + P
count = 0
for i in range(1, N):
    now = P[i]
    after = P[i+1]
#    print(i, now, after)
    if now == i:
#        print('hit')
        count += 1
        P[i], P[i+1] = swap(now, after)
if P[-1] == N:
    P[-2], P[-1] = swap(P[-1], P[-2])
print(count)
# Judge status: Accepted
n = int(input())
s = input()
if n % 2 == 1:
    print('No')
    exit()
else:
    if s[:n//2] == s[n//2:]:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
X, Y = map(int,input().split())
ans = 0
x = X

while x <= Y:
    ans += 1
    x *= 2

print(ans)
# Judge status: Accepted
s,t = input().split()
a,b = map(int,input().split())
u = input()
if s == u:
  a-=1
else:
  b-=1
print(a,b)
# Judge status: Accepted
s = input()
count = 0
flag = 0

for i in range(len(s)):
    if s[i].isupper():
        count += 1
#print(count)

if s[0] == 'A':
    for i in range(2 , len(s)-1):
        #print(s[i])
        if s[i] == "C" and count == 2:
            flag = 1
if flag == 1:
    print("AC")
else:
    print("WA")
# Judge status: Accepted
K = int(input())
S = input()

if len(S) < K + 1:
    print(S)

else:
    print(S[:K]+'...')
# Judge status: Accepted
s= str(input())
ans = 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == '0':
            ans += 1

    else:
        if s[i] == '1':
            ans += 1

print(min(ans,len(s)-ans))
# Judge status: Accepted
N, P = map(int, input().split())
A = list(map(int, input().split()))

dp = [[None for remainder in range(2)] for i in range(N + 1)]
dp[0][0] = 1
dp[0][1] = 0

for i in range(N):
    for r in range(2):
        dp[i + 1][r] = dp[i][r] + dp[i][(r + A[i]) % 2]

print(dp[N][P])
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split())

P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
        
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

A=P[:X]+Q[:Y]+R

A.sort(reverse=True)

print(sum(A[:X+Y]))
# Judge status: Wrong Answer
A, B = map(int, raw_input().split())
if (A + B) % 3 == 0:
    print "Possible"
elif A or B % 3 == 0:
    print "Possible"
else:
    print "Impossible"
# Judge status: Wrong Answer
a = [int(x) for x in input().split()]
print(max(a[0]*a[2],a[1]*a[3]))
# Judge status: Accepted
N,H=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(N)]
ab.sort()
M=ab[-1][0]
B=[b for a,b in ab]
B.sort()
B=B[::-1]
ans=0
for b in B:
    if H>0 and b>M:
        H-=b
        ans+=1
    else:
        break
ans+=0--max(0,H)//M
print(ans)
# Judge status: Accepted
from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(2, int(n**0.5)+1):
    while(n%i == 0):
        n//=i
        d[i]+=1
if n > 1:
    d[n]+=1
ans = 0
for i in d.values():
    val = 1
    while i >= val:
        i-=val
        ans+=1
        val+=1
print(ans)
# Judge status: Accepted
a,b,k = map(int,input().split())
if (b-a+1) >= (2*k):
  for i in range(k):
    print(a+i)
  for i in reversed(range(0,k)):
    print(b-i)
else:
  for i in range(a,b+1):
    print(i)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = list(input())
    print('Yes' if N[1] == N[2] and (N[1] == N[0] or N[1] == N[-1])else 'No')


if __name__ == "__main__":
    main()
# Judge status: Accepted
N,K=map(int,input().split())
p=list(map(int,input().split()))

m=0

for i in range(0,K):
    m=m+p[i]+1

A=[]
A.append(m)

if N==K:
    print(A[0]/2)
else:
    for i in range(1,N-K+1):
        s=A[i-1]-p[i-1]+p[i+K-1]
        A.append(s)
    print(max(A)/2)
# Judge status: Accepted
N, M = map(int, raw_input().split())
#print N, M

state = [-1 for i in range(N)]
pena = [0 for i in range(N)]
WA = [0 for i in range(N)]

for i in range(M):
    s = raw_input().split()
    p = int(s[0])
    sc = s[1]
    #print p, sc
    p -= 1
    if (state[p] == 0):
        continue
    if sc == 'WA':
        pena[p] += 1
    else:
        state[p] = 0

ok = 0
pn = 0
for i in range(N):
    if state[i] == 0:
        ok += 1
        pn += pena[i]

print ok, pn
# Judge status: Accepted
t=input()
trigger=1
key=''
d=-1
app=['dreamer','eraser','dream','erase']
while len(t)>0 and trigger:
    for i in range(4):
        key=app[i]
        if key==t[:len(key)]:
            t=t[len(key):]
            trigger+=1
            d=i
            break
    trigger-=1
    if trigger==0 and d==0 and t[:3]=='ase':
        t='er'+t
        trigger+=1
if t=='':
    print('YES')
else:
    print('NO')
# Judge status: Accepted
s=str(input())

if "9" in s:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S=input()

D={s:False for s in ["N","W","S","E"]}

for s in S:
    D[s]=True

if (D["N"]==D["S"]) and (D["W"]==D["E"]):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
x=int(input())
if 400<=x<599:
    print(8)
elif 600<=x<799:
    print(7)
elif 800<=x<999:
    print(6)
elif 1000<=x<1199:
    print(5)
elif 1200<=x<1399:
    print(4)
elif 1400<=x<1599:
    print(3)
elif 1600<=x<1799:
    print(2)
elif 1800<=x<1999:
    print(1)
# Judge status: Accepted
import math
import numpy as np

n,k=(int(x) for x in input().split())
a = [int(x) for x in input().split()]


for _ in range(k):
    new_a = np.zeros(n+1,dtype=int)
    np.add.at(new_a, np.maximum(0,np.arange(0, n)-a), 1)
    np.add.at(new_a, np.minimum(n,np.arange(0, n)+a+1), -1)
    a = new_a.cumsum()[:-1]
    if np.all(a==n):
        break

print(" ".join([str(x) for x in a]))
# Judge status: Wrong Answer
N, M = map(int, input().split())
from collections import defaultdict, Counter
dd=defaultdict(int)
dd_count=defaultdict(int)

for _ in range(M):
	s, c = map(int, input().split())
	#異なるものが2個ある
	if dd_count[s-1]>=1 and dd[s-1]!=c:
		exit(print(-1))
	else:
		dd[s-1]=c
		dd_count[s-1]+=1

if dd[0]==0:
	exit(print(-1))
else:
	ans=""
	for i in range(N):
		ans+=str(dd[i])
	print(int(ans))
# Judge status: Accepted
N, D = map(int, input().split())
ans = 0
for i in range(N):
  X, Y = map(int, input().split())
  if (X ** 2 + Y ** 2) ** 0.5 <= D:
    ans += 1
else:
  print(ans)
# Judge status: Accepted
A, B, K = map(int, input().split())

a = 0
b = 0

a = max(a, A - K)
K = max(0, K - A)
b = max(b, B - K)

print(str(a) + " " + str(b))
# Judge status: Accepted
a, b, c = map(int, input().split())
ab = a + b
ac = a + c
bc = b + c

if ab == c:
    print('Yes')
elif ac == b:
    print('Yes')
elif bc == a:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x,y = map(int, input().split())

if x%y!=0:
    print(x)
else:
    print(-1)
# Judge status: Accepted
n, c, k = map(int, input().strip().split())
ts = sorted([int(input()) for _ in range(n)])

buses = 0
passengers = 1
first = ts[0]
for t in ts[1:]:
    if t > first + k or passengers == c:
        buses += 1
        passengers = 1
        first = t
    else:
        passengers += 1

if passengers > 0:
    buses += 1

print(buses)
# Judge status: Accepted
import math
def main():
  N = int(input())
  ans = [0] * N
  for i in range(N-1):
    c, s, f = map(int, input().split())
    for j in range(i + 1):
      ans[j] = f*max(math.ceil(ans[j]/f), math.ceil(s/f))+c
  for i in range(N):
    print(ans[i])
if __name__ == "__main__":
  main()
# Judge status: Accepted
n = int(input())
print(((n-1)//111+1)*111)
# Judge status: Wrong Answer
N, M, K = map(int, input().split())

for r in range(N+1):
    for c in range(M+1):
        black = (N*r)+(M*c)-(r*c*2)
        if black == K:
            print('Yes')
            exit(0)
print('No')
# Judge status: Accepted

x=list(input())
if x[-1]=='s':
    x.append('e')
    x.append('s')
else:
    x.append('s')

print(''.join(x))
# Judge status: Wrong Answer
s = input()
if int(s[:4])<2019 and int(s[5:7])<4:
    print("Heisei")
else:
    print("TBD")
# Judge status: Accepted
N = int( input() )
A = list(map(int, input().split()))
J = [0]*(N+1)

for i in range(N-1):
  J[A[i]] += 1
#
for i in range(N):
  print(J[i+1])
#
# Judge status: Wrong Answer
H, N = map(int, input().split())
A = list(map(int, input().split()))

SA = sum(A)
print(SA)
if H // SA > 1:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
N = int(input())
An = list(map(int, input().split()))
ans = [0]*N
for i in range(N):
  ans[An[i]-1] = i + 1
print(*ans)
# Judge status: Accepted
import math
a, b = map(int, input().split())

for i in range(10**4):
    if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
        print(i)
        exit()

print(-1)
# Judge status: Accepted
a,b = map(str,input().split())

a1 = a*int(b)
b1 = b*int(a)
if a1 == b1:
    print(a1)
else:
    print(max(int(a1),int(b1)))
# Judge status: Wrong Answer
n = input()
if "7" in n:
    print("Yss")
else:
    print("No")
# Judge status: Accepted
n = int(input())
s = input()
e = s.count("E")
w = s.count("W")
cnt1 = 0
cnt2 = 0
ans = 10e9
for i in s:
    if i=="E":
        cnt1 += 1
        ans = min(ans,cnt2+e-cnt1)
    else:
        ans = min(ans,cnt2+e-cnt1)
        cnt2 += 1
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
y = [0]*(m-1)
for i in range(m-1):
    y[i] = x[i+1]-x[i]
y.sort()
ans = 0
for i in range(m-n):
    ans+=y[i]
print(ans)
# Judge status: Accepted
n,a,b = map(int,input().split())
mod = 10**9+7
def combination(N,K):
    bunsi = 1
    bunbo = 1
    for i in range(K):
        bunsi = bunsi*(N-i)%mod
        bunbo = bunbo*(i+1)%mod
    return bunsi*pow(bunbo,mod-2,mod)%mod
all_num = pow(2,n,mod)-1
ans = all_num-combination(n,a)-combination(n,b)
print(ans%mod)
# Judge status: Accepted
import math

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

s = x / a

if s >= a * b / 2:
    h = (a * b - s) * 2 / a
    rad = math.atan2(h, a)
else:
    w = s * 2 / b
    rad = math.atan2(b, w)

print(rad / (2 * math.pi) * 360)
# Judge status: Wrong Answer
X = int(input())

number = X
flag = 0

if(number%2 == 0):
    number += 1
else:
    pass

while(True):
    for i in range(2, number):
        if number%i == 0:
            number += 2
            break

        elif i == (number-1):
            flag = 1
            print(number)
            break

        else:
            pass

    if flag == 1:
        break
# Judge status: Accepted

import numpy as np
n,d=map(int,input().split())
L=[]
ans=0
for i in range(n):
    A=list(map(int,input().split()))
    L.append(A)
P=np.array(L)
for i in range(n):
    for j in range(i,n):
        if np.linalg.norm(P[i]-P[j])>0 and np.linalg.norm(P[i] - P[j])%1==0:
            ans+=1
print(ans)
# Judge status: Accepted
import math 

A, B, H, M = map(int, input().split())

m_deg = 360/60*M
#print(m_deg)

h_deg = 360/(12*60)*(H*60+M)
#print(h_deg)

a2 = A**2 + B**2 -2*A*B*math.cos(math.radians(abs(h_deg - m_deg)))
print(math.sqrt(a2))
# Judge status: Accepted
n = input()
sum = 0
ans = 0

if len(n) == 1:
    ans = n
elif len(n) == 2:
    ans = 9
elif len(n) == 3:
    n = int(n)
    ans = ((n-100)+1)+9
elif len(n) == 4:
    ans = 9+900
elif len(n) == 5:
    n = int(n)
    ans = ((n-10000)+1)+900+9
else:
    ans = 90000+900+9

print(ans)
# Judge status: Accepted
import math

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

print(math.ceil(n/(d*2+1)))
# Judge status: Accepted
a,b,k = map(int,input().split())
l = []
for i in range(a,min(a+k,b)):
    print (i)
    l.append(i)

for i in range(max(a,b-k+1),b+1):
    if not i in l:
        print (i)
# Judge status: Accepted
a=input()
if a=="ABC":
  print("ARC")
else:
  print("ABC")