Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline

N = int(input())
d = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}

for _ in range(N):
  d[input()]+=1
  
for s in ['AC', 'WA', 'TLE', 'RE']:
  print(f'{s} X {d[s]}')

### FIXED CODE ###


N = int(input())
d = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
 
for _ in range(N):
    s = input().strip()
    d[s]+=1

for k,v in d.items():
    print(k, 'x', v)
N=int(input())
syougen=[]
for i in range(N):
  A=int(input())
  X=[list(map(int,input().split())) for i in range(A)]
  syougen.append(X)

def search(l):
  global seigo
  for x,y in l:
    if y==1:
      seigo[x-1]=1
    else:
      seigo[x-1]=0
def chk(l):
  global seigo
  for x,y in l:
    if seigo[x-1] != y:
      if seigo[x-1]==100:
        seigo[x-1]=y
        if y==1:
          global syougen
          if chk(syougen[x-1],seigo):
            return True
      else:
      	return True
  return False

ans=0
for i in range(N):
  flg=True
  seigo=[100]*N
  _ans=0
  seigo[i]=1
  search(syougen[i])
  for j in range(N):
    if i==j:
      continue
    if seigo[j]==1:
      if chk(syougen[j]):
        flg=False
        break
    if seigo[j]==100:
      continue
  if flg:
    _ans=sum(seigo)%100
    if ans<_ans:
      ans=_ans
print(ans)

### FIXED CODE ###

N=int(input())
syougen=[]
for i in range(N):
  A=int(input())
  X=[list(map(int,input().split())) for i in range(A)]
  syougen.append(X)

def search(l):
  global seigo,syougen,flg
  for x,y in l:
    if seigo[x-1]==100:
      seigo[x-1]=y
      if y==1:
        search(syougen[x-1])
    elif seigo[x-1]!=y:
      flg=False

ans=0
for i in range(N):
  flg=True
  seigo=[100]*N
  seigo[i]=1
  _ans=0
  search(syougen[i])
  if flg:
    if sum(seigo)>100:
      i=0
      while sum(seigo)>100:
        if seigo[i]==100:
          _seigo=seigo[:]
          flg=True
          seigo[i]=1
          search(syougen[i])
          if flg:
            pass
          else:
            seigo=_seigo[:]
            seigo[i]=0
        i+=1
        i%=N
    _ans=sum(seigo)%100
    if _ans>ans:
      ans=_ans
      maxseigo=seigo        
print(ans)
N,M = map(int,input().split())
S = input()
T = input()
flag = True
def lcm(a, b): # 最小公倍数
    def gcd(a, b): # 最大公約数
        while b:
            a, b = b, a % b
        return a
    return a * b // gcd(a, b)
L = lcm(N,M)
"""
l = [-1 for i in range(L)]
for i in range(N):
    l[L//N*i] = ord(S[i])-97
for i in range(M):
    if l[L//M*i] == -1:
        l[L//M*i] = ord(T[i])-97
    elif l[L//M*i] == ord(T[i])-97:
        pass
    else:
        flag = False
"""
if S[0] == T[0 and S[N-1] == T[M-1]:
    flag = True
else:
    flag = False
if flag:
    print(L)
else:
    print(-1)


### FIXED CODE ###

N,M = map(int,input().split())
S = input()
T = input()
flag = True
def lcm(a, b): # 最小公倍数
    def gcd(a, b): # 最大公約数
        while b:
            a, b = b, a % b
        return a
    return a * b // gcd(a, b)
L = lcm(N,M)
def gcd(a, b): # 最大公約数
    while b:
        a, b = b, a % b
    return a

flag = True
for i in range(gcd(N,M)):
    if S[i*N//gcd(N,M)] == T[i*M//gcd(N,M)] and flag:
        pass
    else:
        flag = False
if flag:
    print(L)
else:
    print(-1)
h,w=map(int,input().split())
box=[list(input()) for i in range(h)]
count=h*w-(w+h-1)
for i in range(h):
    for j in range(w):
        if box[i][j]=="#":
            count -=1

another_box=[["#"]+box[i]+["#"] for i in range(h)]
another_box.insert(0,["#"]*(w+2))
another_box.append(["#"]*(w+2))
another_box[h][w]="G"

def maper(another_box,strat_x,strat_y):
    another_box[strat_x][strat_y]="#"
    for xx,yy in [[0,1],[0,-1],[1,0],[-1,0]]:
        n_x,n_y=strat_x+xx,strat_y+yy
        if another_box[n_x][n_y]==".":
            maper(another_box,n_x,n_y)
        elif another_box[n_x][n_y]=="G":
            another_box[n_x][n_y]="C"
    return another_box

flag=0
answer_box=maper(another_box,1,1)
for i in range(h+2):
    for j in range(w+2):
        if answer_box[i][j]=="C":
            flag=1

if flag==1:print(count)
else:print(-1)

### FIXED CODE ###

h,w=map(int,input().split())
b=[["#"]*(w+2)]
a=0
for i in range(h):
  c=["#"]
  for j in input():
    a+=j=="#"
    c.append(j)
  b.append(c+["#"])
b+=[["#"]*(w+2)]
b[h][w]=0
Q=[(1,1)]
x=0
y=-1
while Q:
	x+=1
	p=[]
	for i,j in Q:
		for dx,dy in [(1,0),(-1,0),(0,1),(0,-1)]:
			if b[i+dx][j+dy]==".":
				p+=[(i+dx,j+dy)]
				b[i+dx][j+dy]="#"
			elif b[i+dx][j+dy]==0:
				y=x
	if y>0:break
	Q=p
if y>0:print((h*w)-a-y-1)
else:print(-1)
x = list(map(int,input().stlip()))
for i in range(5):
  if x[i] == 0:
    print(i+1)


### FIXED CODE ###

x = list(map(int,input().split()))
for i in range(5):
  if x[i] == 0:
    print(i+1)
def dfs(i, c):
    C[i] = True
    P[i] = c
    for t in G[i]:
        if (C[t[0]] == True):
            continue
        dfs(t[0], c+t[1])
    return


N, M = list(map(int, input().split()))
G = [[] for _ in range(N+1)]
P = [0 for _ in range(N+1)]
C = [False for _ in range(N+1)]

for i in range(M):
    l, r, d = list(map(int, input().split()))
    G[l].append((r,d))
    G[r].append((l,-d))

for i in range(1, N+1):
    if (C[i] == False):
        dfs(i,0)

f = False
for i in range(1, N+1):
    for t in G[i]:
        if ((P[t[0]] - P[i]) != t[1]):
            f = True
if (f):
    print('No')
else:
    print('Yes')

### FIXED CODE ###

import sys
sys.setrecursionlimit(200002)


def dfs(i, c):
    C[i] = True
    P[i] = c
    for t in G[i]:
        if (C[t[0]] == True):
            continue
        dfs(t[0], c+t[1])
    return


N, M = list(map(int, input().split()))
G = [[] for _ in range(N+1)]
P = [None for _ in range(N+1)]
C = [False for _ in range(N+1)]

for i in range(M):
    l, r, d = list(map(int, input().split()))
    G[l].append((r,d))
    G[r].append((l,-d))

for i in range(1, N+1):
    if (C[i] == False):
        dfs(i,0)

f = False
for i in range(1, N+1):
    for t in G[i]:
        if ((P[t[0]] - P[i]) != t[1]):
            f = True
if (f):
    print('No')
else:
    print('Yes')
#i桁めをそのまま払うかi+1桁めの額の紙幣で支払うかでDP
N = input()
digit = len(N)
l_N = [0] * digit
for i in range(1, digit + 1):
  l_N[i - 1] = int(N[-i])
dp = 0
for i in range(digit):
  dp += min(l_N[i], 10 - l_N[i] + 1)
  #print(dp)
print(dp)

### FIXED CODE ###

a,b,c = map(int, input().split())
if a == b and b != c:
  print('Yes') 
elif b == c and c != a:
  print('Yes')
elif c == a and a != b:
  print('Yes')
else:
  print('No')
X,N = (int(x) for x in input().split())
P = list(map(int,input().split()))

P_n = [i for i in range(1,101,1) if i not in P]
abs_value = [abs(X-P_n[j]) for j in range(len(P_n))]
min_abs = min(abs_value)

for k in range(len(P_n)):
    if abs_value[k] == min_abs:
        print(P_n[k])
        break


### FIXED CODE ###

X, N = map(int, input().split())
 
p = list(map(int, input().split()))
 
p_none = [i for i in range(110) if i not in p]
p_none_sa = [abs(p_none[i]-X) for i in range(len(p_none))]
 
import sys
 
min_p_none = min(p_none_sa)
for i in range(len(p_none_sa)):
    if p_none_sa[i] == min_p_none:
        print(p_none[i])
        sys.exit()
H,W = map(int, input().split())
    print(1 if H*W in [H,W] else W*(H//2)+(W//2+W%2)*(H%2))

### FIXED CODE ###

H,W = map(int, input().split())
print(1 if H*W in [H,W] else W*(H//2)+(W//2+W%2)*(H%2))
i = 0
while i < 200:
    sum = input()
    if len(sum)<1:
        break
    else:
        sum_list = sum.split(" ")
        print(len(str(int(sum_list[0]) + int(sum_list[1]))))
    i += 1


### FIXED CODE ###

while 1:
    try:
        sum = input()
        sum_list = sum.split()
        print(len(str(int(sum_list[0]) + int(sum_list[1]))))
    except EOFError:
        break
N,M = map(int,input().split())
a = []
b = []
for i in range(M):
    x,y = map(int,input().split())
    a.append(x)
    b.append(y)
if max(a) <= min(b):
    print(min(y)-max(x)+1)
else:
    print(0)

### FIXED CODE ###

a,b = map(int,input().split())
if a<=5:
    print(0)
elif 6<=a<=12:
    print(b//2)
else:
    print(b)
from collections import Counter

n = int(input())
V = list(map(int, input().split()))

Vodd = V[: len(V):2]
Veven = V[1: len(V):2]

if Vodd == Veven:
    print(n // 2)


Voc = Counter(Vodd)
Vec = Counter(Veven)

Voc_val, Voc_cnt = zip(*Voc.most_common())
Vec_val, Vec_cnt = zip(*Vec.most_common())

Voc_val, Voc_cnt = list(Voc_val), list(Voc_cnt)
Vec_val, Vec_cnt = list(Vec_val), list(Vec_cnt)

num = Voc.most_common()[0][1] + Vec.most_common()[0][1]

if Voc_val[0] == Vec_val[0]:
    Voc_cnt.append(0)
    Vec_cnt.append(0)
    num += max(Voc_val[1] - Voc_val[0], Vec_val[1] - Vec_val[0])

print(n - num)


### FIXED CODE ###

from collections import Counter

n = int(input())
V = list(map(int, input().split()))

Vodd = V[: len(V):2]
Veven = V[1: len(V):2]

Voc = Counter(Vodd)
Vec = Counter(Veven)

Voc_val, Voc_cnt = zip(*Voc.most_common())
Vec_val, Vec_cnt = zip(*Vec.most_common())

Voc_val, Voc_cnt = list(Voc_val), list(Voc_cnt)
Vec_val, Vec_cnt = list(Vec_val), list(Vec_cnt)

num = Voc.most_common()[0][1] + Vec.most_common()[0][1]

if Voc_val[0] == Vec_val[0]:
    Voc_cnt.append(0)
    Vec_cnt.append(0)
    num += max(Voc_cnt[1] - Voc_cnt[0], Vec_cnt[1] - Vec_cnt[0])

print(n - num)
a,b,c,d,e,f=map(int,input().split())
l=[0]
ans=[]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w):
    for k in range(m//c):
      flag=0
      for n in range((m-k*c)//d,0,-1):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        if flag==1:
          break
        elif X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

### FIXED CODE ###

a,b,c,d,e,f=map(int,input().split())
x=set()
y=set()
m=f//(100*a)
for i in range(m+1):
  for j in range(f//(100*b)+1):
    x1=i*100*a+j*100*b
    if x1<=f:
      x.add(x1)

m=int(f*(e/100))
for i in range(0,m+1,c):
  for j in range(0,m-i+1,d):
     y.add(i+j)
x.remove(0) 
z=[-1]
ans=[]
for i in x:
  for j in y:
    if i+j<=f and j*100/(i+j)<=e*100/(100+e):
      if j*100/(i+j)>max(z):
        z.append(j*100/(i+j))
        ans.append([i+j,j])
        
print(ans[-1][0],ans[-1][1])
n = int(input())
t = []
x = []
y = []
ans = "Yes"
tmpx = 0
tmpy = 0
for i in range(n):
    v1,v2,v3 = map(int,input().split())
    t.append(v1)
    x.append(v2)
    y.append(v3)
for i in range(n):
    if abs(tmpx-x[i]) + abs(tmpy-y[i]) <= t[i]:
        tmpx = x[i]
        tmpy = y[i]
        continue
    else:
        flg = "No"
        break
print(flg)

### FIXED CODE ###

n = int(input())
t = []
x = []
y = []
ans = "Yes"
tmpx = 0
tmpy = 0
tmpt = 0
for i in range(n):
    v1,v2,v3 = map(int,input().split())
    t.append(v1)
    x.append(v2)
    y.append(v3)
for i in range(n):
    if abs(tmpx-x[i]) + abs(tmpy-y[i]) <= t[i] - tmpt and (abs(tmpx-x[i]) + abs(tmpy-y[i])) % 2 == (t[i] - tmpt) % 2:
        tmpx = x[i]
        tmpy = y[i]
        tmpt = t[i]
        continue
    else:
        ans = "No"
        break
print(ans)
N = int(input())
A = list(map(int,input().split()))
n = 0
can = True

while can:
    for i in range(N):
        if A[i]%2 != 0:
            can = False
            break

        elif A[i]%2 == 0:         
            A[i] = A[i] // 2
            n += 1

        elif:
            can = False
            break

print(n)

### FIXED CODE ###

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

while 1:
    #すべてが偶数か確認
    for i in range(N):
        if A[i] % 2 == 0:
            continue
        else:
            F = 1
    
    if F == 1 : break 

    for i in range(N):
        A[i] = A[i]/2
    n += 1


print(n)
N = int(input)
ans = []
for _ in range(N):
  s = input()
  ans.append(s)
print(len(list(set(ans)))

### FIXED CODE ###

N = int(input())
ans = []
for _ in range(N):
  s = input()
  ans.append(s)
print(len(list(set(ans))))
from collections import deque
from heapq import *
n, k = map(int, input().split())
v = list(map(int, input().split()))

ans = 0
for a in range(k + 1):
    for b in range(k + 1 - a):
        trash = k - (a + b)
        get = v[:a] + v[-b:] if b != 0 else v[:a]
        heapify(get)
        for _ in range(min(trash, a + b)):
            heappop(get)
        SUM = sum(get)
        if ans < SUM:ans = SUM
print(ans)

### FIXED CODE ###

from collections import deque
from heapq import *
n, k = map(int, input().split())
v = list(map(int, input().split()))

ans = 0
num = min(k, n)
for a in range(num + 1):
    for b in range(num + 1 - a):
        trash = k - (a + b)
        get = v[:a] + v[-b:] if b != 0 else v[:a]
        heapify(get)
        for _ in range(min(trash, a + b)):
            temp = heappop(get)
            if temp > 0:
                heappush(get, temp)
                break
        SUM = sum(get)
        if ans < SUM:ans = SUM
print(ans)
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0

while len(a) >= 1:
  ans += 1
  temp=a.pop(0)
  if len(a) >= 1:
    if a[0] == temp:
      ans -= 1
    a = list(filter(lambda x: x % temp != 0, a))
  
print(ans)

### FIXED CODE ###

a = list(map(int, input().split()))
for i in range(5):
  if a[i] == 0:
    print(i+1)
s = []
n, k = map(int, input().split())
for i in range(n):
  s.append(0)
for i in range(k):
	m = int(input())
    na = list(map(int, input().split())
    for j in na:
    	s[j - 1] = 1
         
print(s.count(0))
        

### FIXED CODE ###

s = []
n, k = map(int, input().split())
for i in range(n):
    s.append(0)
for i in range(k):
    m = int(input())
    na = list(map(int, input().split()))
    for j in na:
        s[j - 1] = 1
         
print(s.count(0))
from math import gcd

def trial_division(n):
    f = 2
    d = {}
    while n > 1:
        if n % f == 0:
            d[f] = d.get(f,0) + 1
            n//=f
        else:
            f += 1
    return d

g = gcd(*map(int, input().split()))
ans = trial_division(g)
print(len(ans)+1)

### FIXED CODE ###

from fractions import gcd
g = gcd(*map(int, input().split()))

f = 2
d = {}
while f**2 <= g:
    if g % f:
        f += 1
    else:
        d[f] = d.get(f,0) + 1
        g//=f

if g>1:
    d[g] =d.get(g,0) + 1

print(len(d)+1)
K=int(input())
S=list(input())

LS==len(S)+1

if LS <= K:
    print(S)
elif LS > K:
    print(S[0:(SL-1):1],"...")

### FIXED CODE ###

K=int(input())
S=input()
s=list(S)

if len(s) <= K:
    print(S)
else:
    print(S[0:K:]+"...")
key = input()
s = []
for i in key:
  if i == '0' or if i == '1':
    s.append(i)
  else:
    if len(s) > 0:
      s.pop(-1)
print(s)


### FIXED CODE ###

key = input()
s = []
for i in key:
  if i == '0' or i == '1':
    s.append(i)
  else:
    if len(s) > 0:
      s.pop(-1)
print(''.join(s))
try:
    a = list(map(int, input().split()))
    #print(a)
    b=[0]*a[1]
    c=[0]*(a[1]+1)
    b[0]=int(input())
    c[0]=b[0]-0
    for x in range(a[1]-1):
        b[x+1]=int(input())
        c[x+1]=b[x+1]-b[x]-1
    c[-1]=a[0]-b[-1]
    max = 0
    min = a[0]+100
    for x in c:
        if x>max:
            max=x
        if x<min:
            min=x
        
    #print(c)
    #print(max," ",min)
    if min==0:
        print(0)
    else:
        num=[0]*(max)
        for x in range(max):
            if x==0:
                num[0]=1
            elif x==1:
                num[1]=1
            else:
                num[x]=num[x-1]+num[x-2]
            #print("num[",x,"]=",num[x])
        
        answer=1
    
        for x in c:
            answer *=num[x-1]
            if answer==0:
                print(0)
                break
            else:
                answer%=1000000007
        print(answer)
    except:
        print(0)

### FIXED CODE ###

n,m = list(map(int, input().split()))
a=[]
a.append(-1)
for x in range(m):
  tmp=int(input())
  a.append(tmp)
a.append(n+1)
diff = []
for x in range(len(a)-1):
  diff.append(a[x+1]-a[x])
              
large = 0
small = 123456789012345
for x in diff:
  large=max(large,x)
  small=min(small,x)

num=[0,0,1]
for _ in range(large):
  num.append((num[-1]+num[-2])%1000000007)
    
answer=1
for x in diff:
  #print(x,num[x])
  answer *=num[x]
  answer%=1000000007
print(answer)
import sys
input = sys.stdin.buffer.readline

N, M  = map(int,input().split())
A = sorted(list(map(int,input().split())))
D = []

for i in range(M):
    B, C = map(int,input().split())
    D.append((B,C))

D.sort(key = lambda x:x[1],reverse = True)

cnt = 0
ans = []
for b, c in D:
    for i in range(b):
        ans.append(c)
    cnt += b
    if cnt >=N:
        break
#print(D)
#print(ans)
res = sum(A)
for i in range(len(ans)):
    if ans[i]-A[i]>0:
        res += ans[i] - A[i]
    else:
        break
print(res)

### FIXED CODE ###

import bisect
import itertools

N, M  = map(int,input().split())
A = sorted(list(map(int,input().split())))
D = []

for i in range(M):
    B, C = map(int,input().split())
    D.append((B,C))

D.sort(key = lambda x:x[1],reverse = True)

cnt = 0
ans = []
for b, c in D:
    for i in range(b):
        ans.append(c)
    cnt += b
    if cnt >=N:
        break
#print(D)
#print(ans)
res = sum(A)
for i in range(min(N,len(ans))):
    if ans[i]-A[i]>0:
        res += ans[i] - A[i]
    else:
        break
print(res)
import functools
import operator

n, k = map(int, input().split())
A = list(map(int, input().split()))

old_score = 1
new_score = 1

for i in range(n - k + 1): #iはスタート地点
    old_score = new_score
    new_score = 1
    
    list_ = A[i, i + k] #Aのj番目の要素をかける
    new_score = functools.reduce(operator.mul, list_)

    if i != 0 and old_score < new_score:
        print("Yes")
    elif i != 0 and old_score >= new_score:    
        print("No")

### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))

for i in range(n - k): #iはスタート地点
    old = A[i] #Aのj番目の要素をかける
    new = A[i + k]
    
    if old < new:
        print("Yes")
    else:
        print("No")
D, N = map(int, input().split())
if N = 100:
  print((100 ** D) * (101))
else:
  print((100 ** D) * N)


### FIXED CODE ###

D, N = map(int, input().split())
if N == 100:
  print((100 ** D) * (101))
else:
  print((100 ** D) * N)
N = int(input())
As = map(int, input().split())
result = 1
 
for a in As:
  result = result * a
 
if a >= 10**18:
  print(-1)
else:
  print(result)

### FIXED CODE ###

nums = input().split()
print(int(nums[0]) * int(nums[1]))
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = int(input())

tmp = prime_factorize(n)

if n = 1 or len(tmp) != 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
frag = 0

for i in range(1, 10):
  if n / i <= 9 and n % i == 0:
    frag = 1

if frag:
  print("Yes")
else:
  print("No")
N, K = map(int, input().split())
D = list(map(str, input().split()))
num_set = set(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
N_list = list(str(N))

diff_list = sorted(list(num_set.difference(set(D))))

if (list(set(D)&set(N_list)) == []):
    print(N)
else:
    if '0' in diff_list:
        n_list = [diff_list[1]] + ['0']*len(N_list)
    else:
        n_list = [diff_list[0]]*len(N_list+1)
    str_n = ''
    for i in n_list:
        str_n += str(i)
    new_n = int(str_n)+1
    for ii in range(N, new_n):
        if list(set(list(str(ii)))&set(D)) == []:
            print(ii)
            break

### FIXED CODE ###

N, K = map(int, input().split())
D = list(map(str, input().split()))
num_set = set(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
N_list = list(str(N))

diff_list = sorted(list(num_set.difference(set(D))))

if (list(set(D)&set(N_list)) == []):
    print(N)
else:
    if '0' in diff_list:
        n_list = [diff_list[1]] + ['0']*len(N_list)
    else:
        n_list = [diff_list[0]]*(len(N_list)+1)
    str_n = ''
    for i in n_list:
        str_n += str(i)
    new_n = int(str_n)+1
    for ii in range(N, new_n):
        if list(set(list(str(ii)))&set(D)) == []:
            print(ii)
            break
while True:
    n, m = map(int, input().split())
    if n == 0:
        break
    risks = [(p, d) for d, p in (map(int, input().split()) for _ in range(n))]
    risks.sort()
    remain = 0
    while m:
        p, d = risks.pop()
        if d >= m:
            remain = p * (d - m)
            break
        m -= d
    print(remain + sum(p * d for p, d in risks))

### FIXED CODE ###

while True:
    n, m = map(int, input().split())
    if n == 0:
        break
    risks = [(p, d) for d, p in (map(int, input().split()) for _ in range(n))]
    risks.sort()
    remain = 0
    while risks:
        p, d = risks.pop()
        if d >= m:
            remain = p * (d - m)
            break
        m -= d
    print(remain + sum(p * d for p, d in risks))
n, x = map(int, input().split())

hambs = [(1, 0, 1)]
for l in range(1, n+1):
    n_p, n_b, n_l = hambs[l-1]
    hambs.append((2*n_p+1, 2*n_b+2, 2*n_l+3))
# for h in hambs:
#     print(h)

n_p, _, n_l = hambs[n]
if x == 1:
    print(0)
    exit()
elif x == n_l:
    print(n_p)
    exit()
    
ans = n_p//2+1
y = n_l//2+1
l = n-1
while y != x:
    n_p, _, n_l = hambs[l]
    if y > x:
        ans -= n_p
        y -= n_l
    else:
        ans += n_p
        y += n_l
    l -= 1

print(ans)


### FIXED CODE ###

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

hambs = [(1, 1)]
for l in range(1, n+1):
    n_p, n_l = hambs[l-1]
    hambs.append((2*n_p+1, 2*n_l+3))
# for h in hambs:
#     print(h)

def eat(m, y):
    if y == 0:
        return 0
    if m == 0:
        return 1

    if y < 2+hambs[m-1][1]:
        return eat(m-1, y-1)
    elif y == 2+hambs[m-1][1]:
        return hambs[m-1][0] + 1
    elif 2+hambs[m-1][1] < y and y < hambs[m][1]:
        return hambs[m-1][0] + 1 + eat(m-1, y-(2+hambs[m-1][1]))
    else:
        return hambs[m][0]
print(eat(n, x))
a,b,c =int(x) for in input().split()
if a+b+c==17 and a*b*c==175:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a = list(int(x) for x in input().split())
if a == [5,5,7] or a == [5,7,5] or a == [7,5,5]:
  print('YES')
else:
  print('NO')
from heapq import heappop, heappush
ab = lambda a,b:abs(a-b)
area = lambda a,b:ab(a[1],b[1])*ab(a[0],b[0])
dist = lambda a,b:(ab(a[1],b[1])**2+ab(a[0],b[0])**2)>>1

N, K = map(int, input().split())
A = []
graph = []
inf = float('INF')
for i in range(N):
    a,b = map(int, input().split())
    A.append([a,b])
    graph.append([inf for i in range(N)])
if N == 2:
    print(area(a,b))
    exit()
    
mn_dist = inf
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        graph[i][j] = graph[j][i] = dist(A[i], A[j])
        if mn_dist > graph[i][j]:
            mn_dist = graph[i][j]
            mn_dict = {i:1,j:1}
            mn_lst = [i,j]

x_lst = [A[mn_lst[0]][0], A[mn_lst[1]][0]]
y_lst = [A[mn_lst[0]][1], A[mn_lst[1]][1]]
cands = []
tmp = min([[graph[mn_lst[0]][i], i] for i in range(N) if i not in mn_dict])
heappush(cands, tmp)
tmp = min([[graph[mn_lst[1]][i], i] for i in range(N) if i not in mn_dict])
heappush(cands, tmp)
    
for i in range(K-2):
    _, idx = heappop(cands)
    mn_dict[idx] = 1
    mn_lst.append(idx)
    x_lst.append(A[idx][0])
    y_lst.append(A[idx][1])
    tmp_lst = [[graph[mn_lst[idx]][i], i] for i in range(N) if i not in mn_dict]
    if tmp_lst != []:
        tmp = min(tmp_lst)
        heappush(cands, tmp)

a = [min(x_lst), min(y_lst)]
b = [max(x_lst), max(y_lst)]
print(area(a,b), mn_lst)

### FIXED CODE ###

ab = lambda a,b:abs(a-b)
area = lambda a,b:ab(a[1],b[1])*ab(a[0],b[0])

N, K = map(int, input().split())
A = []
x_lst = []
y_lst = []
for i in range(N):
    a,b = map(int, input().split())
    A.append([a,b])
    x_lst.append(a)
    y_lst.append(b)

x_lst.sort()
y_lst.sort()
mn = float('INF')
for x in range(N-1):
    for x_ in range(x,N):
        for y in range(N-1):
            for y_ in range(y,N):
                cnt = 0
                for a,b in A:
                    if x_lst[x] <= a <= x_lst[x_] and y_lst[y] <= b <= y_lst[y_]:
                        cnt += 1
                if cnt >= K:
                    mn = min(mn, area([x_lst[x],y_lst[y]], [x_lst[x_], y_lst[y_]]))
print(mn)