Harryxun/stf_run huggingface dataset:
def Base_10_to_n(N, K):
    if (int(N/K)):
        return Base_10_to_n(int(N/K), K)+str(N%K)
    return str(N%K)

x10 = 35
x2 = Base_10_to_n(N, K)
x2 = str(x2)
print(len(x2))

### FIXED CODE ###

N, K = map(int, input().split())
def Base_10_to_n(N, K):
    if (int(N/K)):
        return Base_10_to_n(int(N/K), K)+str(N%K)
    return str(N%K)

x10 = 35
x2 = Base_10_to_n(N, K)
x2 = str(x2)
print(len(x2))
n=int(input())
high=list(map(int,input().split()))
ans=[]
count=0
answer=[]
for i in range(n-1):
    ans.append(high[i]-high[i+1])
k=0
while k<=n-2:
    if ans[k]>=0:
        count+=1
        k+=1
    else:
        answer.append(count)
        count=0
        k+=1
        
print(max(answer))

### FIXED CODE ###

n=int(input())
high=list(map(int,input().split()))
ans=[]
count=0
MaxC=0
for k in range(n-1):
    if high[k]>=high[k+1]:
        count+=1
        MaxC=max(MaxC,count)
    else:
        count=0
print(MaxC)
n = int(input())

sum(list(map(int, str(n))))

if sum // == 0:
  print(Yes)

else:
  print(No)


### FIXED CODE ###

N = input()
s = len(N)
sum = 0

for i in range(s):
  sum += int(N[i])
  
if sum % 9 == 0:
  print("Yes")
  
else:
  print("No")
N = int(input())
num = map(int,input().split())

ans=0
while all(a%2==0 for a in A):
  A = [a/2 for a in A]
  ans+=1
  
print(ans)

### FIXED CODE ###

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

ans=0
while all(a%2==0 for a in A):
  A = [a/2 for a in A]
  ans+=1
  
print(ans)
import numpy as np

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

Mini = min(X)
Max = max(X)

H_list = []
for i in range(Mini, Max):
    P_list = np.full(N,i)
    H = sum((P_list-np.array(X))**2)
    H_list.append(H)

print(min(H_list))

### FIXED CODE ###

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

HP = []
for p in range(1, 101, 1):
    P = [p] * len(X)
    delta = sum([(i - j) ** 2 for (i, j) in zip(X, P)])
    HP.append(delta)

print(min(HP))
S = int(input())
if S%2==0:
    print(0.5)
else:
    print(((N+1)/2)/N)

### FIXED CODE ###

S = int(input())
if S%2==0:
    print(0.5)
else:
    print(((S+1)/2)/S)
N, W = map(int, input().split())
item = [list(map(int, input().split())) for i in range(N)]

dp = [[0]*(W+1) for i in range(N+1)]
for i in range(N):
    for w in range(1, W+1):
        if w - item[i][0] >= 0:
            dp[i+1][w] = max(
                dp[i][w],
                dp[i][w-item[i][0]] + item[i][1]
            )
        else:
            dp[i+1][w] = dp[i][w]
print((dp[N][W]))




### FIXED CODE ###

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

inf = 10 ** 10
dp = [[inf] * (10**5+3) for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
    weight, value = map(int, input().split())
    for j in range(10**5 + 3):
        if j - value >= 0:
            dp[i+1][j] = min(
                dp[i][j - value] + weight,
                dp[i][j]
            )
        else:
            dp[i+1][j] = dp[i][j]
for i in reversed(range(10**5+3)):
    if dp[n][i] <= w:
        print(i)
        break
import collections
import sys
sys.setrecursionlimit(10000)

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

value, count = list(a.keys()), list(a.values())

if count[0]+count[1]+count[2] != N:
    print('No')

elif value[0]^value[1]^value[2] != 0:
    print('No')

elif count[0]==count[1]==count[2]:
    print('Yes')

else:
    print('No')


### FIXED CODE ###

import collections

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

value, count = list(a.keys()), list(a.values())

if len(value)<3:
    if len(value)==1:
        if sum(a)==0:
            print('Yes')
        else:
            print('No')

    if len(value)==2:
        if 0 in value:
            if count[0]==N/3 or count[1]==N/3:
                print('Yes')
            else:
                print('No')

        else:
            print('No')

if len(value)>=3:
    if count[0]+count[1]+count[2] == N:
        if value[0]^value[1]^value[2] == 0:
            if count[0]==count[1]==count[2]:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')
n=int(input())
x=input()
chk0=chk1=chk2=0
b=x.count("1")
if b==1:
    print(n//0)
    exit()
for i,j in enumerate(x[::-1]):
    if j=="1":
        chk1+=pow(2,i,b+1)
        if b>1: chk2+=pow(2,i,b-1)
        else: chk2=0
l=[]
for i,j in enumerate(x[::-1]):
    if b: a1=pow(2,i,b+1)
    else: a1=1
    if b>1: a2=pow(2,i,b-1)
    else: a2=1
    if j=="0":
        t=chk1+a1
    else:
        if b>1: t=chk2+b-1-a2
        else: t=0
    ans=0
    f=1
    while t:
        if f:
            if j=="0": t%=(b+1)
            else: t%=(b-1)
            f=0
        else:
            t%=bin(t).count("1")
        ans+=1
    l.append(ans)
for i in l[::-1]:
    print(i)

### FIXED CODE ###

n=int(input())
x=input()
chk0=chk1=chk2=0
b=x.count("1")
if b==1 and x=="1":
    print(0)
    exit()
elif b==1:
    for i in range(n):
        if i==n-1: print(2)
        elif x[i]=="0": print(1)
        else: print(0)
    exit()
for i,j in enumerate(x[::-1]):
    if j=="1":
        chk1+=pow(2,i,b+1)
        if b>1: chk2+=pow(2,i,b-1)
        else: chk2=0
l=[]
for i,j in enumerate(x[::-1]):
    if b: a1=pow(2,i,b+1)
    else: a1=1
    if b>1: a2=pow(2,i,b-1)
    else: a2=1
    if j=="0":
        t=chk1+a1
    else:
        if b>1: t=chk2+b-1-a2
        else: t=0
    ans,f=0,1
    while t:
        if f:
            if j=="0": t%=(b+1)
            else: t%=(b-1)
            f=0
        else:
            t%=bin(t).count("1")
        ans+=1
    l.append(ans)
for i in l[::-1]:
    print(i)
import math
a,b,n = map(int,input().split())
ans = 0
baketu = [0]*(n+1)
for i in range(1,n+1):
    dum = math.floor(a*i/b)-(a*math.floor(i/b))
    if baketu[dum] >= 1:
        break
    baketu[dum] += 1
    ans = max(ans,dum)
print(ans)

### FIXED CODE ###

import math
a,b,n = map(int,input().split())
if b-1 <= n:
    print(math.floor((a*(b-1))/b)-(a*math.floor((b-1)/b)))
else:
    print(math.floor((a * (n)) / b) - (a * math.floor((n) / b)))
S = input()
s01 = int(S[0]+S[1])
s23 = int(S[2]+S[3])
if (0 < s01 and s01 <= 12) and (0 < s23 and s23 <= 12):
    print('AMBIGUOUS')

elif (0 < s01 and s01 <= 12) and (s23 > 12 or s23 == 0):
    print('MMYY')

elif (s01 > 12 or s12 == 0) and (0 < s23 and s23 <= 12):
    print('YYMM')
else:
    print('NA')


### FIXED CODE ###

S = input()
s01 = int(S[0]+S[1])
s23 = int(S[2]+S[3])
if (0 < s01 and s01 <= 12) and (0 < s23 and s23 <= 12):
    print('AMBIGUOUS')

elif (0 < s01 and s01 <= 12) and (s23 > 12 or s23 == 0):
    print('MMYY')

elif (s01 > 12 or s01 == 0) and (0 < s23 and s23 <= 12):
    print('YYMM')
else:
    print('NA')
#標準入力
N = int(input())
D, X = list(map(int, input().split()))

A = []
for i in range(N):
    a.append(input()) 

    
B=0
for i in range(N):
    B += 1 + (D-1)//A[i]

    
Total = X + B

print(Total)



### FIXED CODE ###

N = int(input())
D, X = map(int, input().split())
A = []
for i in range(N):
    A.append(int(input()))
    
B=0
for i in range(N):
    B += 1 + (D-1)//A[i]

    
Total = X + B

print(Total)
def postorder(n,preorder,inorder):
    if len(preorder) > 1:
        left_inorder = []
        right_inorder = []
        flag = False
        for i in range(len(inorder)):
            if flag == False:
                if n == inorder[i]:
                    flag = True
                else:
                    left_inorder.append(inorder[i])
            else:
                right_inorder.append(inorder[i])
        left_preorder = []
        right_preorder = []
        flag = False
        for i in range(1,len(preorder)):
            if flag == False:
                left_preorder.append(preorder[i])
                if len(left_preorder) == len(left_inorder):
                    flag = True
            else:
                right_preorder.append(preorder[i])
        postorder(left_preorder[0],left_preorder,left_inorder)
        postorder(right_preorder[0],right_preorder,right_inorder)
    if len(preorder) >= 0:
        print n,

n = int(raw_input())
preorder = map(int,raw_input().split(' '))
inorder = map(int,raw_input().split(' '))

postorder(preorder[0],preorder,inorder)

### FIXED CODE ###

def postorder(preorder,inorder):
    if len(preorder) > 1:
        n = preorder[0]
        left_inorder = []
        right_inorder = []
        flag = False
        for i in range(len(inorder)):
            if flag == False:
                if n == inorder[i]:
                    flag = True
                else:
                    left_inorder.append(inorder[i])
            else:
                right_inorder.append(inorder[i])
        left_preorder = []
        right_preorder = []
        flag = False
        for i in range(1,len(preorder)):
            if flag == False:
                if len(left_preorder) == len(left_inorder):
                    flag = True
                else:
                    left_preorder.append(preorder[i])
            if flag == True:
                right_preorder.append(preorder[i])
        #print left_preorder,left_inorder
        #print right_preorder,right_inorder
        #print
        postorder(left_preorder,left_inorder)
        postorder(right_preorder,right_inorder)
    if len(preorder) > 0:
        print preorder[0],

n = int(raw_input())
preorder = map(int,raw_input().split(' '))
inorder = map(int,raw_input().split(' '))

postorder(preorder,inorder)
S = int(input())

first_half = round(S, -2) / 100
second_half = S - round(S, -2)

if 1 <= second_half <= 12 and 1 <= first_half <= 12 :
  print("AMBIGUOUS")
else:
  if 1 <= second_half <= 12 :
   		print("YYMM")
	elif 1 <= first_half <= 12 :
    	print("MMYY")
	else: 
        print("NA")

### FIXED CODE ###

import math

S = int(input())

first_half = math.floor(S / 100)
second_half = S - first_half * 100

if 1 <= second_half <= 12 and 1 <= first_half <= 12 :
  print("AMBIGUOUS")
elif 1 <= second_half <= 12 :
   		print("YYMM")
elif 0 == first_half or 12 < first_half :
    	print("NA")
else: 
        print("MMYY")
import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    # 1 line 1 int
    return int(sys.stdin.readline().rstrip())
def LI():
    # 1 line n ints
    return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    # 1 line 1 string
    return sys.stdin.readline().rstrip()
def LS():
    # 1 line n strings
    return list(sys.stdin.readline().rstrip().split())

A = S()

if A[0] == A[1] == A[2] or A[1] == A[2] == A[3]:
   print("Yes")
else
   print("No")




### FIXED CODE ###

import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    # 1 line 1 int
    return int(sys.stdin.readline().rstrip())
def LI():
    # 1 line n ints
    return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    # 1 line 1 string
    return sys.stdin.readline().rstrip()
def LS():
    # 1 line n strings
    return list(sys.stdin.readline().rstrip().split())

A = S()

if A[0] == A[1] == A[2] or A[1] == A[2] == A[3]:
   print("Yes")
else:
   print("No")
A = [input() for i in range(5)]
k = int(input())
if A[-1]-A[0] <= k:
	print('Yay!')
else:
	print(':(')
	

### FIXED CODE ###

A = [int(input()) for i in range(5)]
A.sort()
k = int(input())
if A[-1]-A[0] <= k:
	print("Yay!")
else:
	print(":(")
S = input()
K = int(input())

if(S.count(S[0]) == len(S)):
    print(len(S)*K//2)
else:
    cnt = 0
    lst = []
    tmp = S[0]
    for i in range(len(S)):
        if(tmp == S[i]):
            cnt += 1
        else:
            tmp = S[i]
            if(cnt > 1):
                lst.append(cnt)
            cnt = 1   
    if(cnt > 1):
        lst.append(cnt)
        
    ans = 0
    for i in lst:
        ans += K*(i//2)
    if(S[0] != S[-1]):
        print(ans)
    else:
        for i in range(len(S)):
            if(tmp != S[i]):
                break
            a += 1
        for i in S[::-1]:
            if(tmp != i):
                break
            b += 1
        print(ans+((a+b)//2-(a//2+b//2))*(K-1))

### FIXED CODE ###

S = input()
K = int(input())

if(S.count(S[0]) == len(S)):
    print(len(S)*K//2)
else:
    cnt = 0
    lst = []
    tmp = S[0]
    for i in range(len(S)):
        if(tmp == S[i]):
            cnt += 1
        else:
            tmp = S[i]
            if(cnt > 1):
                lst.append(cnt)
            cnt = 1   
    if(cnt > 1):
        lst.append(cnt)
        
    ans = 0
    for i in lst:
        ans += K*(i//2)
    if(S[0] != S[-1]):
        print(ans)
    else:
        a = 0
        b = 0
        for i in range(len(S)):
            if(tmp != S[i]):
                break
            a += 1
        for i in S[::-1]:
            if(tmp != i):
                break
            b += 1
        print(ans+((a+b)//2-(a//2+b//2))*(K-1))
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
assert K == 3
 
print(114514)

### FIXED CODE ###

input_line = input().split()

num_array = int(input_line[0])
num_equal = int(input_line[1])

input_line = input() # 無視

equalized = 1
i = 0
while equalized < num_array:
    equalized += (num_equal - 1)
    # print(i, equalized)
    i += 1

print(str(i))
def cal(X,Y,H):

    zerolist=[]
    for i in range(0,101): #C_x
        for j in range(0,101): #C_y
            temp=H[0]+abs(X[0]-i)+abs(Y[0]-j)
            for l in range(1,N):
                if(H[l]<0):
                    zerolist.append(l)
                else:
                    s=H[l]+abs(X[l]-i)+abs(Y[l]-j)
                    if(temp==s):
                        temp=s
                    else:
                        break
            else:
                for k in zerolist:
                    if(temp-abs(X[k]-i)-abs(Y[k]-j)>0):
                        break
                else:
                    return print("{} {} {}".format(i,j,temp))

cal(X,Y,H)

### FIXED CODE ###

import sys

x=[]
y=[]
h=[]
n=int(input())
for i in range(n):
    a,b,c=list(map(int,input().split()))
    x.append(a)
    y.append(b)
    h.append(c)

for cx in range(101):
    for cy in range(101):
        for i in range(n):
            if(h[i]==0):
                continue
            else:
                H=h[i]+abs(cx-x[i])+abs(cy-y[i])
                break
        for i in range(n):
            if(h[i]!=max(H-abs(cx-x[i])-abs(cy-y[i]),0)):
                    break
        else:
            print("{} {} {}".format(cx,cy,H))
            sys.exit(0)
S = input()
if S[1] == B:
  print("ARC")
else:
  print('ABC')

### FIXED CODE ###

S = input()

if S[1] == 'B':
  print('ARC')
else:
  print('ABC')
while True:

    W,H = tuple(map(int,input().split()))
    if W==0 & H==0:
        break
    print("#"*H)
    for i in range(1,W-1):
        print("#"+"."*(H-2)+"#")
    print("#"*H)
    print(\n)

### FIXED CODE ###

while True:

    W,H = tuple(map(int,input().split()))
    if W==0 & H==0:
        break
    print("#"*H)
    for i in range(1,W-1):
        print("#"+"."*(H-2)+"#")
    print("#"*H)
    print("")
print(n / 3)


### FIXED CODE ###

print(int(input()) // 3)
a=input()
b=int(input())
c=0
if a[0]!="1":
  print(a[0])
if a[0]=="1":
  for i in range(len(a)-1):
    if a[i]=="1" and a[i+1]=="1":
      c=c+1
    else:
      break
  if c>=b:
    print(1)
  else:
    print(a[1])

### FIXED CODE ###

a=input()
b=int(input())
c=1
if a[0]!="1":
  print(a[0])
if a[0]=="1":
  for i in range(len(a)-1):
    if a[i]=="1" and a[i+1]=="1":
      c=c+1
    else:
      break
  if c>=b:
    print(1)
  else:
    print(a[c])
from collections import Counter
    N = int(input())
    A = list(map(int, input().split()))

    Y = [int(i + A[i - 1]) for i in range(1, N + 1)]
    Y = Counter(Y)

    cnt = 0
    for i in range(1, N+1):
        X = i - A[i - 1]
        if X in Y.keys():
            cnt += Y[X]
    print(cnt)


### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))

Y = [int(i + A[i - 1]) for i in range(1, N + 1)]
Y = Counter(Y)

cnt = 0
for i in range(1, N+1):
    X = i - A[i - 1]
    if X in Y.keys():
        cnt += Y[X]
print(cnt)
a=input()
b=input()
c=input()

if a/c<b:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

d,t,s=map(int,input().split())
if d<=t*s:
    print("Yes")
else:
    print("No")
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from itertools import accumulate


def factorial(x):
    if x <= 0:
        return 1

    return factorial(x - 1) * x


def comb(n, r):
    return factorial(n) / factorial(r) / factorial(n - r)


def main():
    n = int(input())
    l = list(map(int, input().split()))

    nums = [0] * 1001

    for e in l:
        nums[e] += 1

    acm = list(accumulate(nums))

    l.sort()
    ans = 0
    tmp = [0] * 1001
    tmp2 = [0] * 1001
    for i in range(n-2):
        for j in range(i+1, n-1):
            a = l[i]
            b = l[j]
            k = min(1000, a+b-1)

            # b < c のときの数
            cnt = acm[k] - acm[b]

            # b == c のときの補正
            if nums[b] >= 3 and a == b and tmp[b] == 0:
                cnt += int(comb(nums[b], 3))
                tmp[b] = 1

            if nums[b] >= 2 and a != b and tmp2[b] == 0:
                cnt += int(comb(nums[b], 2))
                tmp2[b] = 1

            ans += cnt

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

from bisect import bisect_left


def main():
    n = int(input())
    l = list(map(int, input().split()))

    l.sort()

    ans = 0
    for i in range(n - 2):
        for j in range(i + 1, n - 1):
            a = l[i]
            b = l[j]
            mx = bisect_left(l, a + b)
            ans += mx - j - 1

    print(ans)


if __name__ == "__main__":
    main()
Ns = list(map(int, input().split()))
Ns.sort()
ans = 0

for i in range(0, Ns - 2):
	for j in range(i, Ns - 1):
		for k in range(j, Ns):
			if(Ns[i] + Ns[j] > Ns[k]
				and Ns[j] + Ns[k] > Ns[i] 
				and Ns[k] + Ns[i] > Ns[j]):
				ans += 1
print(ans)

### FIXED CODE ###


N = int(input())
Ns = list(map(int, input().split()))
Ns.sort()
ans = 0

for i in range(0, N - 2):
	for j in range(i + 1, N - 1):
		for k in range(j + 1, N):
			if(Ns[i] == Ns[j] or Ns[k] == Ns[j]):
				continue

			if(Ns[i] + Ns[j] > Ns[k] and Ns[j] + Ns[k] > Ns[i] and Ns[k] + Ns[i] > Ns[j]):
				ans += 1
print(ans)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list(map(int, input().split()))

    SUM = sum(a)

    ans = sys.maxint
    for i in range(1, n):
        ans = min(ans, abs(2 * sum(a[:i]) - SUM))

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list(map(int, input().split()))

    SUM = sum(a)

    ans = list()
    left = a[0]
    for i in range(1, n):
        ans.append(abs(2 * left - SUM))
        left += a[i]

    print(min(ans))


if __name__ == '__main__':
    main()
#!/usr/bin/env python3

def main():
    N = int(input())
    X = [None] * N
    l = list(input())
    Xc = 0
    for i in range(N):
        X[i] = int(l[i])
        Xc += X[i]

    ans1 = 0
    ans2 = 0
    for j in range(N):
        if X[j]==1:
            ans1 += pow(2,N-1-j)
            ans2 += pow(2,N-1-j)
    # ans1 %= Xc+1
    # ans2 %= Xc-1
    # print(ans1,ans2)

    for i in range(N):
        if X[i]==0:# 0->1
            ans = (ans1 + pow(2,N-1-i)) % (Xc+1)
        else:# 1-> 0
            ans = (ans2 - pow(2,N-1-i)) % (Xc-1)
        count = 1
        # print(X,ans,Xc)
        while ans > 0:
            tmp = str(bin(ans)).count('1')
            ans %= tmp
            count += 1
        print(count)

if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3

def main():
    N = int(input())
    X = [None] * N
    l = list(input())
    Xc = 0
    for i in range(N):
        X[i] = int(l[i])
        Xc += X[i]

    if Xc == 0:
        [print(1) for i in range(N)]
    elif Xc == 1:
        d = X.index(1)
        ans1 = 0
        for j in range(N):
            if X[j]:
                ans1 += pow(2,N-1-j,Xc+1)
                ans1 %= Xc+1

        for j in range(N):
            if d == j:
                print(0)
            else:
                if d == N-1 or j == N-1:
                    print(2)
                else:
                    print(1)
    else:
        ans1 = 0
        ans2 = 0
        for j in range(N):
            if X[j]:
                ans1 += pow(2,N-1-j,Xc+1)
                ans1 %= Xc+1
                ans2 += pow(2,N-1-j,Xc-1)
                ans2 %= Xc-1

        for i in range(N):
            if X[i]:# 1->0
                ans = (ans2 - pow(2,N-1-i,Xc-1)) % (Xc-1)
            else:# 0->1
                ans = (ans1 + pow(2,N-1-i,Xc+1)) % (Xc+1)
            count = 1
            while ans > 0:
                tmp = str(bin(ans)).count('1')
                ans %= tmp
                count += 1
            print(count)

if __name__ == "__main__":
    main()
X,N = map(int,input().split())
if N!=0:
  plist =list(map(int,input().split()))
  print (plist)
  #maxN = max(plist)
  maxN = 100
  Anslist =[i for i in range(X+1)]
  #print (Anslist)
  for i in range(len(plist)):
    Anslist.remove(plist[i])
  Anslist.remove(0)
  #print(Anslist)

  ans = 0
  min=100
  for i in range(len(Anslist)):
    if min>abs(X-Anslist[i]):
      min = abs(X-Anslist[i])
      ans = Anslist[i]
  print(ans)
else :print(X)

### FIXED CODE ###

X,N = map(int,input().split())

min = 100

if N !=0:
  Plist = list(map(int,input().split()))
  anslist = [i for i in range(201)]
  anslist.append(-1)
  #anslist.remove(0)
  Plist = sorted(Plist)
  for i in range(N):
    anslist.remove(Plist[i])
    temp =100
  for i in range(len(anslist)):
    if min >abs(anslist[i]-X) :
      min = abs(anslist[i]-X)
      temp = anslist[i]
  print (temp)
else :
  print (X)
from bisect import bisect_right
from math import ceil

n, h = map(int, input().split())
A = []
B = []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
B_sorted = sorted(B)
B_cumulative_sum = list(B_sorted)
for i in range(n - 2, -1, -1):
    B_cumulative_sum[i] += B_cumulative_sum[i + 1]
    if B_cumulative_sum[i] > h:
        print(n - i)
        exit()
cnt = int(1e9)
for a, b in zip(A, B):
    target_idx = bisect_right(B_sorted, a)
    throws = n - target_idx
    hp_remains_after_throw = h - B_cumulative_sum[target_idx]
    attacks = ceil(hp_remains_after_throw / a)
    cnd = throws + attacks
    cnt = min(cnt, cnd)
print(cnt)


### FIXED CODE ###

from math import ceil

n, hp = map(int, input().split())
A = []
B = []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
MAX_A = max(A)
B.sort(reverse=True)

cnt = 0
for b in B:
    if b > MAX_A:
        hp -= b
        cnt += 1
    else:
        break
    if hp <= 0:
        break
if hp > 0:
    cnt += ceil(hp / MAX_A)
print(cnt)
k,a,b=[int(p) for p in input().split()]
if(a+2>=b or k/(a+2)<1 or 2*a+2==b):
    print(k+1)
elif(2*a+2>b):
    print(1+k+(int((1+k)/(2*a-b+2)))*(b-a-2))
else:
    print(1+k+(int((1+k-a)/2))*(b-a-2))

### FIXED CODE ###

nk=[int(x) for x in input().split()]
if(nk[0]>=2*nk[1]-1):
    print("YES")
else:
    print("NO")
n = int(input())
lst = list(range(n))
print(sum(lst))

### FIXED CODE ###

n = int(input())
sum = n * (n - 1) // 2
print(sum)
a.b=list(map(int,input().split()))
if a==b:
  print(max([a,b])*2)
else:
  print(max([a,b])*2-1)

### FIXED CODE ###

a,b=list(map(int,input().split()))
c=max([a,b])
if a<b:
    b-=1
else:
    a-=1
d=max([a,b])
print(c+d)
from sys import stdin
input = stdin.readline
n, m = map(int, input().split())

ans = sorted([list(map(int, input().split()))+[i] for i in range(m)], key=lambda x:x[1])

built = [1]*m
for i in range(m):
    ans[i][1] = built[ans[i][0]-1]
    built[ans[i][0]-1] += 1

for i in sorted(ans,key=lambda x:x[2]): print("%06d%06d" % (i[0],i[1]))

### FIXED CODE ###

from sys import stdin
input = stdin.readline
n, m = map(int, input().split())

ans = sorted([list(map(int, input().split()))+[i] for i in range(m)], key=lambda x:x[1])

built = [1]*n
for i in range(m):
    ans[i][1] = built[ans[i][0]-1]
    built[ans[i][0]-1] += 1

for i in sorted(ans,key=lambda x:x[2]): print("%06d%06d" % (i[0],i[1]))