Harryxun/stf_run huggingface dataset:
import copy
h,w =map(int,input().split())

s = [[]*w for _ in range(h)]
white =0
for i in range(h):
    t = input()
    for j in range(w):
        if t[j] == ".":
            white += 1
            s[i].append(10**5)
        elif t[j] == "#":
            s[i].append(t[j])
now = [0,0]
steps =[]
steps.append(now)
direction = []
s[0][0] =0
a = [2]
while len(steps) >0:
    now = copy.copy(steps[0])
    if s[now[0]][now[1]] =="#":
        continue
    for k in [[0,1],[1,0],[-1,0],[0,-1]]:

        if now[0] + k[0] >=0 and now[0] + k[0] < h:
            now[0] += k[0]
            if now[1] + k[1] >=0 and now[1] + k[1] <w:
                if s[now[0]][now[1]] =="#":
                    continue
                else:
                    now[1] += k[1]
                    if s[now[0]][now[1]] == 10**5:
                        if not [now[0],now[1]] in steps:
                            steps.append([now[0],now[1]])
            else:
                continue
        else:
            continue
    # if s[steps[0][0]][steps[0][1]] ==0:
    #     steps.pop(0)
    #     continue
    if s[steps[0][0]][steps[0][1]] >10**4:
        direction =[]
        for l in [[0,1],[1,0],[-1,0],[0,-1]]:
            if steps[0][0]+l[0]>=0 and steps[0][0]+l[0]<h and steps[0][1]+l[1]< w and steps[0][1]+l[1] >=0 and s[steps[0][0]+l[0]][steps[0][1]+l[1]] != "#":
                direction.append(s[steps[0][0]+l[0]][steps[0][1]+l[1]])

        s[steps[0][0]][steps[0][1]] = min(direction)+1
    steps.pop(0)
#print(s)
if s[h-1][w-1] == "#" or s[h-1][w-1] == 10**4:
    print(-1)
else:
    print(white-1 - s[h-1][w-1])









### FIXED CODE ###

import copy
h,w =map(int,input().split())

s = [[]*w for _ in range(h)]
white =0
for i in range(h):
    t = input()
    for j in range(w):
        if t[j] == ".":
            white += 1
            s[i].append(10**5)
        elif t[j] == "#":
            s[i].append(t[j])
now = [0,0]
steps =[]
steps.append(now)
direction = []
s[0][0] =0
a = [2]
while len(steps) >0:
    now = copy.copy(steps[0])
    if s[now[0]][now[1]] =="#":
        continue
    for k in [[0,1],[1,0],[-1,0],[0,-1]]:
        now = copy.copy(steps[0])
        if now[0] + k[0] >=0 and now[0] + k[0] < h:
            now[0] += k[0]
            if now[1] + k[1] >=0 and now[1] + k[1] <w:
                now[1] += k[1]
                if s[now[0]][now[1]] == 10**5:
                    if not [now[0],now[1]] in steps:
                        steps.append([now[0],now[1]])
            else:
                continue
        else:
            continue
    # if s[steps[0][0]][steps[0][1]] ==0:
    #     steps.pop(0)
    #     continue
    if s[steps[0][0]][steps[0][1]] >10**4:
        direction =[]
        for l in [[0,1],[1,0],[-1,0],[0,-1]]:
            if steps[0][0]+l[0]>=0 and steps[0][0]+l[0]<h and steps[0][1]+l[1]< w and steps[0][1]+l[1] >=0 and s[steps[0][0]+l[0]][steps[0][1]+l[1]] != "#":
                s[steps[0][0]][steps[0][1]]=min(s[steps[0][0]+l[0]][steps[0][1]+l[1]]+1,s[steps[0][0]][steps[0][1]])
    steps.pop(0)
if s[h-1][w-1] == "#" or s[h-1][w-1] == 10**5:
    print(-1)
else:
    print(white-1 - s[h-1][w-1])
n = int(input())
sp = []
for i in range(n):
  s, p = map(int,input().split())
  sp.append([s, int(p), i+1])
sp.sort(key=lambda x:x[1], reverse = True)
sp.sort(key=lambda x:x[0])
for e in sp:
  print(e[2])

### FIXED CODE ###

n = int(input())
sp = []
for i in range(n):
    s,p = map(str,input().split())
    sp.append([s,int(p),i+1])

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

for e in sp:
    print(e[2])
N = int(input())
S = list(input())
  
numberABC = 0

for i in range(N):
  if S[i] == 'A':
    if S[i + 1] == 'B':
      if S[i + 2] == 'C':
          numberABC += 1
      
print(numberABC)



### FIXED CODE ###

N = int(input())
S = input()

count = 0 

for i in range (N - 2):
  if S[i:i + 3] == 'ABC':
    count += 1

print(count)
keyword = raw_input()
N = int(raw_input())

count = 0

for _ in xrange(N):
  s = raw_input()
  if keyword in (s+s):
    count += 1

print count

### FIXED CODE ###



keyword = raw_input()
N = int(raw_input())

count = 0

for _ in xrange(N):
  s = raw_input()
  if keyword in (s+s):
    count += 1

print count
a,b=[map(int, input().split()) for _ in range(2)]
print((a[0]-b[0])*(a[1]-b[1]))


### FIXED CODE ###

H, W = list(map(int, input().split()))
h, w = list(map(int, input().split()))
print((H - h)*(W - w))
input()
x=sum(input())
y=max(input())
print(x-y//2)

### FIXED CODE ###

n=int(input())
p=[int(input()) for i in range(n)]
print(sum(p)-max(p)//2)
R=int(input())
if R<1200:
  print("ABC")
elseif R<2800:
  print("ARC")
else:
  print("AGC")

### FIXED CODE ###

R=int(input())
if R<1200:
  print("ABC")
elif R<2800:
  print("ARC")
else:
  print("AGC")
P,Q,R = int(input().split())
# P = input().split()

# print(P)
# print(Q)
# print(R)

min = min(P+Q, P+R, Q+R)

print(min)


### FIXED CODE ###

P,Q,R = input().split()
# P = input().split()

# print(P)
# print(Q)
# print(R)

min = min(int(P)+int(Q), int(P)+int(R), int(Q)+int(R))

print(min)
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(n):
  edg[a[i]].append(i)
ans = a[0] != 0
c = [1] * n
def dfs(now, time):
  global ans
  c[now] = 0
  for e in edg[now]:
    if c[e]:
      if time == k:
        ans += 1
        dfs(e, 1)
      else:
        dfs(e, time + 1)
dfs(0, 0)
print(int(ans))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n,k = map(int,input().split())
a = [int(i)-1 for i in input().split()]
edg = [[] for i in range(n)]
for i in range(1,n):
  edg[a[i]].append(i)
ans = [0] * n
ans[0] = a[0] != 0
def dfs(now):
  res = 0
  for e in edg[now]:
    res = max(res, dfs(e)+1)
  if res == k - 1 and a[now] != 0:
    ans[now] = 1
    res = -1
  return res
      
dfs(0)
print(sum(ans))
a,b = map(int,input().split())
if (a*b)%2 = 1
    print(odd)
print(even)

### FIXED CODE ###

a,b = map(int,input().split())
if (a*b)%2 == 1:
  print('Odd')
else:
  print('Even')
a,b,c = list(map(int,input().split()))
if any([i%2==0 for i in (a,b,c)]):
    print(0)
else:
    ans = min(a*b , c*b , a*c)
print(ans)

### FIXED CODE ###

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

p = any((a%2 == 0,b%2 == 0,c%2 == 0))
if p:
    print(0)
else:
    print(min(a*b,b*c,c*a))
A="AKIHABARA"
s=input()
n=len(s)
na=len(A)
i=0
j=0
while i<=n j<=na-1:
  if s[i]==A[j]:
    i+=1; j+=1
  elif s[i]!=A[j] and A[j]=="A":
    j+=1
  else:
    break
if j==n-1:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

A="AKIHABARA"
data=[0,4,6,8]
AD=list(A)
S=set(); S.add(A)
for i in range(2):
    for j in range(2):
        for k in range(2):
            for l in range(2):
                tmp=AD.copy()
                # print(AD)
                # print(tmp)
                if i: tmp[0]=""
                if j: tmp[4]=""
                if k: tmp[6]=""
                if l: tmp[8]=""
                S.add(''.join(tmp))


s=input()
if s in S:
    print("YES")
else:
    print("NO")
# D - Powerful Discount Tickets

N, M = map(int, input().split())
A = [int(a) for a in input().split()]

def quick_sort(ls):
    left = []
    right = []
    if len(ls) <= 1:
        return ls

    ref = ls[0]
    ref_count = 0

    for el in ls:
        if el < ref:
            left.append(el)
        elif el > ref:
            right.append(el)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right

for i in range(M):
    price = A.pop()
    A.append(price // 2)
    A = quick_sort(A)

print(sum(A))


### FIXED CODE ###

# D - Powerful Discount Tickets

import heapq

N, M = map(int, input().split())
A = [int(a) * -1 for a in input().split()]
heapq.heapify(A)

for i in range(M):
    price = heapq.heappop(A)
    price = -1 * ((-1 * price) // 2)
    heapq.heappush(A, price)

print(sum(A) * -1)
n, y = map(int,raw_input().split())
y/=1000

h = {0:10, 1:5, 2:1}

mem = {}
ans = [-1,-1,-1]
def dfs(i, n, y, h,res,ans ):
	if (i,n,y) in mem:
		return mem[(i,n,y)]

	if y < 0:

		mem[(i,n,y)] = False
		return False
	if y == 0:
		if n == 0:
			mem[(i,n,y)] = True
			
			if ans[0] == -1: 
				for i in range(len(res)):
					ans[i] = res[i]
			return True
		mem[(i,n,y)] = False
		return False
	if i == 2:
		if n == y:
			res[2]+= y
			mem[(i,n,y)] = True
			

			if ans[0] == -1: 
				for i in range(len(res)):
					ans[i] = res[i]

			return True
		return False
	res[0] +=1
	if dfs(i, n - 1, y - h[i], h,res, ans):
		mem[(i,n,y)] = True

		if ans[0] == -1: 
			for i in range(len(res)):
				ans[i] = res[i]
		return True
	res[0] -= 1

	if dfs(i+1, n ,y, h,res, ans):
		mem[(i,n,y)] = True
		
		if not(ans): 
			ans = [e for  e in res]#res[::]
		return True
	mem[(i,n,y)] = False
	return False

res = [0,0,0]
if dfs(0, n, y, h, res, ans):
	print ' '.join(map(str,ans))
else:
	print ' '.join(map(str,[-1,-1,-1]))

### FIXED CODE ###

n, y = map(int,raw_input().split())
y/=1000


def g(y,n):
	for a in range(y/10 + 1):
		b,c = f(y - a * 10, n - a)
		if b != -1:
			return [a,b,c]
	return [-1,-1,-1]
def f(y,n):
	if y < 0 or n < 0:
		return [-1,-1]
	if y == 0:
		if n == 0:

			return [0,0]
		return [-1,-1]

	for b in range(y/5 + 1):
		if y - b * 5 == n - b and n - b >= 0:
			return [b,n-b]
	return [-1,-1]

print ' '.join(map(str, g(y,n)))
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a1=[i for i in a if i % 2 == 0]
a1=np.array(a1)
p=np.prod(a1, axis = 0)
k=0
while True:
    if p%2==0:k+=1
    else:break
print(k)

### FIXED CODE ###

#import sys
#input()=sys.stdin.readline()
n=int(input())
a=list(map(int,input().split()))
k=0
for i in range(len(a)):
    while True:
        if a[i]%2==0:
            a[i]/=2
            k+=1
        else:break
print(k)
N=int(input())
sum=0
for i range(N):
  l, r =map(int,input().split())
  sum+=(r-l+1)
print(sum)

### FIXED CODE ###

n=int(input())
sum=0
for i in range(n):
  l, r =map(int, input().split())
  sum+=(r-l+1)
print(sum)
a = list(map(int,input().split()))
b = []
for i in range(a[0]):
	n,m = map(int,input().split())
	b.append([n,n*100*(i+1),m])
su = 10000
s = 0
sss = 0
ma = 0
m = 0
co = 0
c = 0
while a[1] > 0:
	for i in range(len(b)):
		if b[i][1] >= a[1]:
			ma = b[i][1]
			su = min(su,b[i][0] - (b[i][1] - a[1])//100//(i+1))
			co = i
		elif b[i][1]+b[i][2] >= a[1]:
			ma = b[i][1]+b[i][2]
			su = min(su,b[i][0])
			co = i
		m = max(m,b[i][1]+b[i][2])
		if m == b[i][1]+b[i][2]:
			s = b[i][0]
			c = i
	if ma != 0:
		sss += su
		break
	else:
		sss += s
		b.pop(c)
		a[1] -= m
	ma = 0
	su = 10000
print(sss)

### FIXED CODE ###

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

c = []

for i in range(a):
	c.append(list(map(int,input().split())))

ans = float('inf')

for i in range(1<<a):
	sc = 0
	co = 0
	for j in range(a):
		if i & (1<<j):
			sc += c[j][0]*(j+1)*100 + c[j][1]
			co += c[j][0]
	if sc >= b:
		ans = min(ans,co)
	else:
		for j in range(a)[::-1]:
			if i &(1<<j):
				continue
			else:
				for k in range(c[j][0]):
					sc += 100*(j+1)
					co += 1
					if sc >= b:
						break
				if sc >= b:
					break
		ans = min(ans,co)

print(ans)
N,M = list(map(int,input().split()))
S = list(input())

s_=''
S_=[]

for s in S:
    if s != s_:
        S_.append(s)
        s_=s
        
    else:
        S_[-1]+=s
        

change_str_dict={'R':'L','L':'R'}
change_str=change_str_dict[S_[1][0]]

for m in range(1,min(2*M,len(S_)),2):
    S_[m]=change_str*len(S_[m])

S_=''.join(S_)
# print(S_)

s_=S_[0]
ans=0
for s in S_[1:]:
    if s == s_:
        ans+=1
    else:
        s_=s
        
print(ans)

### FIXED CODE ###

N,M = list(map(int,input().split()))
S = list(input())

s_=''
S_=[]

if len(set(S))==1:
    ans = len(S)-1
    
else:
    for s in S:
        if s != s_:
            S_.append(s)
            s_=s

        else:
            S_[-1]+=s

    change_str_dict={'R':'L','L':'R'}
    change_str=change_str_dict[S_[1][0]]

    for m in range(1,min(2*M,len(S_)),2):
        S_[m]=change_str*len(S_[m])

    S_=''.join(S_)
    # print(S_)

    s_=S_[0]
    ans=0
    for s in S_[1:]:
        if s == s_:
            ans+=1
        else:
            s_=s

print(ans)
H, W = map(int, input().split())
As = [list(map(int, input().split())) for _ in range(H)]

before_A = None
history = []
for h, row in enumerate(As):
    it = enumerate(row)
    if h % 2 == 0:
        it = reversed(list(it))
    for w, A in enumerate(row):
        if A % 2 == 0:
            if before_A is not None:
                path.append(h, w)

        else:
            if before_A is None:
                before_A = (h, w)
                path = [(h, w)]
            else:
                path.append((h, w))
                history.append(path[:])
                before_A = None

ans = []
for path in history:
    for i in range(len(path) - 1):
        ans.append( (*path[i], *path[i+1]) )

print(len(ans))
for a, b, c, d in ans:
    print(a+1, b+1, c+1, d+1, sep = ' ')


    


### FIXED CODE ###

H, W = map(int, input().split())
As = [list(map(int, input().split())) for _ in range(H)]

before_A = None
history = []
for h, row in enumerate(As):
    it = enumerate(row)
    if h % 2 == 0:
        it = reversed(list(it))
    for w, A in it:
        if A % 2 == 0:
            if before_A is not None:
                path.append((h, w))

        else:
            if before_A is None:
                before_A = (h, w)
                path = [(h, w)]
            else:
                path.append((h, w))
                history.append(path[:])
                before_A = None

ans = []
for path in history:
    for i in range(len(path) - 1):
        ans.append( (path[i], path[i+1]) )

print(len(ans))
for (a, b), (c, d) in ans:
    print(a+1, b+1, c+1, d+1, sep = ' ')
n, k ,s = map(int, input().split())
ans = []

if s<10**9:
    for i in range(n):
        if i <= k:
            ans.append(s)
        else:
            ans.append(s+1)
elif s==10**9:
    for j in range(n):
        if i <= k:
            ans.append(s)
        else:
            ans.append(1)
ans = map(str, ans)
print(' '.join(ans))

### FIXED CODE ###

n, k ,s = map(int, input().split())
ans = []

if s<10**9:
    for i in range(n):
        if i <= k-1:
            ans.append(s)
        else:
            ans.append(s+1)
elif s==10**9:
    for j in range(n):
        if j <= k-1:
            ans.append(s)
        else:
            ans.append(1)
ans = map(str, ans)
print(' '.join(ans))
n, a = [int(i) for i in input().split()]
x = [int(i)-a for i in input().split()] 

max = max(x)

dp = [[0 for _ in range(2*n*max)] for _ in range(n)]

dp[0][n*max+x[0]] = 1
dp[0][n*max] = 1 

for i in range(1, n):
	for j in range(2*n*max):
		if j - x[i] < 0 or j - x[i] >= 2*n*max:
			dp[i][j] = dp[i-1][j]
		else: 
			dp[i][j] = dp[i-1][j] + dp[i-1][j-x[i]]

print(dp[n-1][n*max]-1)







# # def function(i, j, x):
# 	print(0)
# 	if i == 0 and j == 0:
# 		return 1
# 	elif i == 0 and j == x[0]:
# 		return 1
# 	else:
# 		return function(i-1, j, x) + function(i-1, j-x[i], x)

### FIXED CODE ###

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

x = [int(i) for i in input().split()] 
y = [int(i)-a for i in x] 


max = max(x)

dp = [[0 for _ in range(2*n*max+1)] for _ in range(n+1)]

dp[0][n*max] = 1 

for i in range(1, n+1):
	for j in range(2*n*max+1):
		if j - y[i-1] < 0 or j - y[i-1] > 2*n*max:
			dp[i][j] = dp[i-1][j]
		else: 
			dp[i][j] = dp[i-1][j] + dp[i-1][j-y[i-1]]

result = dp[n][n*max]-1

print(result)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    z = input()
    x = int(z)

    sum = 0
    while x > 0.9:
        y = int(x % 10)
        sum = sum + y
        x = int(x / 10)

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

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    z = input()
    x = int(z)

    if x%9==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
d={}
for s in sys.stdin:
  w,p=s.split()
  if not w in d: d[w]=[]
  d[w].append(int(p))
for w in sorted(d.keys()):
  print w,"\n"
  print " ".join(map(str,sorted(d[w])))

### FIXED CODE ###

import sys

d={}
for s in sys.stdin:
  w,p=s.split()
  if w in d: d[w].append(int(p))
  else: d[w]=[int(p)]
  
for w,x in sorted(d.items()):
  print w
  print " ".join(map(str,sorted(x)))
x = input()
print(x ** 3)

### FIXED CODE ###

x = input()
print(int(x) ** 3)
import math

def main():
    a, b, c = map(int, input().split())
    
    top = max([a, b, c])
    bot = min([a, b, c])
    for x in [a, b, c]:
        if top != x and bot != x:
            mid = x
    count = 0
    
    count = top - mid
    bot += count
    mid += count
    
    if (top - bot) % 2 == 0:
        count += (top - bot) / 2 
    else:
        count += math.ceil((top - bot) / 2)+1
        
    print(int(count), end="")
    print()

if __name__ == '__main__':
    main()


### FIXED CODE ###

import math

def main():
    a, b, c = map(int, input().split())
    
    li = [a, b, c]
    top = max(li)
    top_index = li.index(top)
    bot = min(li)
    bot_index = li.index(bot)
    mid_index = calc_mid_index(top_index, bot_index)
    mid = li[mid_index]
    count = 0
    
    count = top - mid
    bot += count
    mid += count
    
    if (top - bot) % 2 == 0:
        count += (top - bot) / 2 
    else:
        count += math.ceil((top - bot) / 2) + 1
        
    print(int(count))

def calc_mid_index(top_index, bot_index):
    for i in range(3):
        if i != top_index and i != bot_index:
            return i



if __name__ == '__main__':
    main()
import math
n = int(input())
sep = []
for i in range(1,int(math.sqrt(n))):
  if(n%i == 0):
    sep.append(i+int(n/i)-2)
sep.sort()
print(sep[0])

### FIXED CODE ###

import math
n = int(input())
sep = []
for i in range(1,int(math.sqrt(n)+1)):
  if(n%i == 0):
    sep.append(i+int(n/i)-2)
sep.sort()
print(sep[0])
a, b = input().split()
print(int(A) * int(float(B)*1000)//1000)

### FIXED CODE ###

a,b=map(int,input().replace('.', '').split())
print(a*b//100)
n, k = map(int, input().split())
h_1 h_2 h_3 ... h_n
h = list(map(int, inpnt().split())) 
h_refined = [ i for i if i >=  k]
print(len(h_refined))

### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split())) 
h_refined = [ i for i in h if i >=  k]
print(len(h_refined))
from math import *
from collections import *
from random import *
from bisect import *
import sys
input=sys.stdin.readline
def lis():
    return list(map(int,input().split()))
def ma():
    return map(int,input().split())
def inp():
    return int(input())
n,d=ma()
r=0
for i in range(n):
    x,y=ma()
    f=(x*x)+(y*y)
    f=pow(x,0.5)
    if(f<=d):
        r+=1
print(r)
    
            

        
            
        
    
        
    


### FIXED CODE ###

#from math import *
from collections import *
from random import *
from bisect import *
import sys
input=sys.stdin.readline
def lis():
    return list(map(int,input().split()))
def ma():
    return map(int,input().split())
def inp():
    return int(input())
n,d=ma()
r=0
for i in range(n):
    x,y=ma()
    f=(x*x)+(y*y)
    f=pow(f,0.5)
    if(f<=d):
        r+=1
print(r)
if __name__ == '__main__':
    S = list(input())
    T = list(input())

    letter = []
    for i in range(len(S)):
        letter.append(T[i])                                                                                                                                                     if S[i] == T[i]:
            continue
        else:
            if S[i] in letter:
                break
            else:
                s = S[i]
                for j in range(len(S)):
                    if S[j] == s:
                        S[j] = T[i]
                    elif S[j] == T[i]:
                        S[j] = s

    if S == T:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

if __name__ == '__main__':
    S = list(input())
    T = list(input())

    start = [-1 for i in range(26)]
    stop = [-1 for i in range(26)]

    fail = False
    for i in range(len(S)):
        a = ord(S[i]) - ord('a')
        b = ord(T[i]) - ord('a')

        if start[a] != -1 or stop[b] != -1:
            if start[a] != b or stop[b] != a:
                print('No')
                fail = True
                break
        else:
            start[a] = b
            stop[b] = a

    if not fail:
        print('Yes')
import numpy as np

n,m = map(int,input().split())
l = list(map(int,input().split()))

lh = list(map(lambda x:x//2, l))
lcm = np.lcm.reduce(np.array(lh))
res = 0
times = [(lcm//x)%2==1 for x in lh]

if all(times):
    res = ((m // lcm) +1) // 2

print(res)

### FIXED CODE ###

from fractions import gcd
from functools import reduce

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

n,m = map(int,input().split())
l = list(map(int,input().split()))

lh = list(map(lambda x:x//2, l))
lcm = reduce(lcm,lh)
res = 0
times = [(lcm//x)%2==1 for x in lh]

if all(times):
    res = ((m // lcm) +1) // 2

print(res)
K, S = map(int, input().split())
res = 0
for X in range(K+1):
    for Y in range(K+1):
        Z = S - X - Y
        if Z in range(K+1)
            res += 1

print(res)

### FIXED CODE ###

k, s = map(int, input().split())
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)
from itertools import combinations
from operator import itemgetter
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
X, Y = list(map(list, zip(*XY)))

P = [abs(x1 - x2) for x1, x2 in combinations(X, 2)]
P = set(P)
if 0 in P:
    P.remove(0)
P = list(P)
Q = [abs(y1 - y2) for y1, y2 in combinations(Y, 2)]
Q = set(Q)
if 0 in Q:
    Q.remove(0)
Q = list(Q)
ans = 10**10

XY.sort()
for p in P:
    S = set()
    la = 0
    for x, y in XY:
        if (x, y) not in S:
            la += 1
        S.add((x+p, y))
    ans = min(ans, la)
XY1 = XY[:]
XY1.sort(ley = itemgetter(1))
for q in Q:
    S = set()
    la = 0
    for x, y in XY1:
        if (x, y) not in S:
            la += 1
        S.add((x, y+q))
    ans = min(ans, la)

for p in P:
    for q in Q:
        S = set()
        la = 0
        for x, y in XY:
            if (x, y) not in S:
                la += 1
            S.add((x+p, y+q))
        ans = min(ans, la)
        S = set()
        la = 0
        for x, y in XY:
            if (x, y) not in S:
                la += 1
            S.add((x+p, y-q))
        ans = min(ans, la)
print(ans)


### FIXED CODE ###

from collections import Counter
from itertools import combinations
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort()
A = Counter()
for (x1, y1), (x2, y2) in combinations(XY, 2):
    A[(x1-x2, y1-y2)] += 1
if N == 1:
    print(1)
else:
    print(N - max(A.values()))
students = list(range(30))
[students.remove(int(input())) for _ in range(28)] 
[print(student) for student in students]

### FIXED CODE ###

students = list(range(1, 31))
[students.remove(int(input())) for _ in range(28)] 
[print(student) for student in students]
n = int(input())
a = list(map(int, input().split()))
b = 1000
for i in range(n - 1):
    dp = [0] * 1000 * 200
    dp[0] = 0
    c = b
    for j in range(b + 1):
        dp[j + a[i]] = max(dp[j + a[i]], dp[j] + a[i + 1])
    for j in range(b + 1):
        c = max(c, dp[j] + b - j)
    b = c
print(b)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
v = 1000
s = 0
for i in range(n - 1):
    if a[i] < a[i + 1]:
        s = v // a[i]
        v += (a[i + 1] - a[i]) * s
print(v)
while True:
    a,b,c=map(str,raw_input().split())
    a,c=int(a),int(c)
    if b=="?":
        break
    if   b=="+":
        print(a+b)
    elif b=="-":
        print(a-b)
    elif b=="*"
        print(a*b)
    else:
        print(a//b)
    

### FIXED CODE ###

while True:
    a,b,c=map(str,raw_input().split())
    a,c=int(a),int(c)
    if b=="?":
        break
    if   b=="+":
        print(a+c)
    elif b=="-":
        print(a-c)
    elif b=="*":
        print(a*c)
    else:
        print(a//c)
flg = 1
i=0
while flg:
    i=i+1
    Indata = input()
    print("Case" +str(i) + ": " + Indata)
    if Indata == 0:
        flg=0
    



### FIXED CODE ###

i=0
while True:
    Indata = int(input())
    if Indata == 0:
        break
    else:
        i=i+1
        print("Case " +str(i) + ": " + str(Indata))