Harryxun/stf_run huggingface dataset:
from math import sqrt
from math import floor
n = int(input())

for i in range(n + 1):
    n2 = floor(sqrt(i))
    ans = 0
    for x in range(1, n2):
        for y in range(1, n2):
            if i - (pow(x, 2) + pow(y, 2) + x * y) pow(z, 2) +  y * z + z * x:
                    ans += 1
    print(ans)


### FIXED CODE ###

n = int(input())

ans = [0] * n
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            a = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if a >= 1 and a <= n:
                ans[a - 1] += 1

for a in ans:
    print(a)
A,B = int(input().split())
print(A*B)

### FIXED CODE ###

A,B = map(int,input().split())
print(A*B)
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

dp = [[0] * (W + 1) for _ in range(N + 1)]
# dp[i][j](j=0,1,...,W)の値が求まっている状態で、dp[i+1][j]を更新することを考える
for i in range(N):
	for j in range(W + 1):
		# 品物(w[i],v[i])を選ぶとき、j-w[i]>=0に限って、価値v[i]が加算される
		if j - w[i] >= 0:
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i])
		# 品物(w[i],v[i])を選ばないとき、何も加算しない
		dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(dp[N][W])

### FIXED CODE ###

N = int(input())
h = list(map(int, input().split()))
dp = [0]*N
ans = int(0)
dp[1] = abs(h[1]-h[0])


for i in range(2,N):
    dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]),dp[i-2] + abs(h[i]-h[i-2]))

ans = dp[N-1]

print(ans)
N = int(input())
ue = list(set(list(map(int, input().split()))))
mid = list(set(list(map(int, input().split()))))
bot = list(set(list(map(int, input().split()))))
ue.sort()
mid.sort()
bot.sort()

#高速化できるのがキャッシュしか無い

ans = 0
pos_j = 0
for i in ue:
    flag = 0
    while(mid[pos_j] <= i):
        pos_j += 1
        if pos_j >= len(mid):
            flag = 1
            break
    if flag == 1:
        break

    pos_k = 0
    for j in range(pos_j, len(mid)):
        flag_ = 0
        while(bot[pos_k] <= mid[j]):
            pos_k += 1
            if pos_k >= len(bot):
                flag_ = 1
        if flag_ == 1:
            break
        ans += len(bot) - pos_k

    if flag_ == 1:
        break
    
print(ans)


### FIXED CODE ###

import bisect

#動的計画法だった
N = int(input())
ue = (list(map(int, input().split())))
mid = (list(map(int, input().split())))
bot = (list(map(int, input().split())))
ue.sort()
mid.sort()
bot.sort()

ans = 0
for i in mid:
    ans += bisect.bisect_left(ue, i) * (len(bot) - bisect.bisect_right(bot, i))
print(ans)
da = list(map(int,input().split()))

k = [[0 for i in range(2)]for j in range(10001)]
i = 0
su = 0
j = 0

while da[0] != 0 and da[1] != 0:
	i = 0
	su = 0
	j = 0
	for i in range(da[0]):
		k[i][0],k[i][1] = list(map(int,input().split()))
		su += k[i][0] * k[i][1]


	sorted(k,key = lambda x: x[1],reverse = True)
	while da[1] > 0 and j != i + 1:
		if da[1] >= k[j][0] and j != i + 1b
			su -= k[j][0] * k[j][1]
			da[1] -= k[j][0]
			j += 1
		else:
			su -= da[1] * k[j][1]
			da[1] = 0

	print(su)

	da = list(map(int,input().split()))
	if da[0] == 0 and da[1] == 0:
		break
	k = [[0 for i in range(2)]for j in range(10001)]



### FIXED CODE ###

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

k = [[0 for i in range(2)]for j in range(10001)]
i = 0
su = 0
j = 0

while da[0] + da[1] != 0:
	i = 0
	su = 0
	j = 0
	for i in range(da[0]):
		k[i][0],k[i][1] = map(int,input().split())


	k = sorted(k,key = lambda x: x[1],reverse = True)

	while j != i + 1:
		if da[1] > k[j][0]:
			da[1] -= k[j][0]
			j += 1
		elif da[1] <= k[j][0] and da[1] > 0:
			su += (k[j][0] - da[1]) * k[j][1]
			da[1] = 0
			j += 1
		else:
			su += k[j][0] * k[j][1]
			j += 1

	print(su)

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

	k = [[0 for i in range(2)]for j in range(10001)]
n,x=list(map(int,input().split()))
l=list(map(int,input().split()))
d=0
for i in range(n):
  d+=l[i]
  if d>x:
    print(i+1)
    break
else:
  print(n+1)

### FIXED CODE ###

x,a=list(map(int,input().split()))
if x<a:
  print(0)
else:
  print(10)
if S = "RRR":
  print(3)
  elif S = "RRS" or S = "SRR":
    print(2)
    elif S = "SSS":
      print(0)
      else:
        print(1)

### FIXED CODE ###

s = input()
if s == "RRR":
  print(3)
if s == "SSS":
  print(0)
if s == "RRS":
  print(2)
if s == "SRR":
  print(2)
if s == "RSS":
  print(1)
if s == "SRS":
  print(1)
if s == "SSR":
  print(1)
if s == "RSR":
  print(1)
n = int(input())
# s = input()
c = []
hen = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    hen[a-1].append(b-1); hen[b-1].append(a-1)
    c.append([a-1,b-1])

k = 0
for i in range(n):
    k = max(k,len(hen[i]))
print(k)

child = [[] for _ in range(n)]
for [a,b] in c:
    color = 1
    while (color in child[a]) or (color in child[b]):
        color += 1

    child[a].append(color)
    child[b].append(color)
    print(color)



### FIXED CODE ###

# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
mod = 10**9 + 7

# n = int(input())
# a = list(map(int, input().split()))
s = input()
l = ['SUN','MON','TUE','WED','THU','FRI','SAT']
if s == l[0]: print(7)
elif s == l[1]: print(6)
elif s == l[2]: print(5)
elif s == l[3]: print(4)
elif s == l[4]: print(3)
elif s ==l[5]: print(2)
elif s == l[6]: print(1)
inp = []
for i in range(5):
    inp.append(int(input()))
inp2 = sorted(inp, key=lambda x: x%10)
inp3 = [d for d in inp2 if d%10 != 0]
last = inp3[0]
inp2.remove(last)

r = 0
for c,z in enumerate(inp2):
    if z%10 == 0:
        r += z
    else:
        r += z//10 * 10 + 10
res = r + last
print(res)

### FIXED CODE ###

inp = []
for i in range(5):
    inp.append(int(input()))
inp2 = sorted(inp, key=lambda x: x%10)
inp3 = [d for d in inp2 if d%10 != 0]
if inp3 != []:

    last = inp3[0]
    inp2.remove(last)
else:
    last = 0

r = 0
for c,z in enumerate(inp2):
    if z%10 == 0:
        r += z
    else:
        r += z//10 * 10 + 10
res = r + last
print(res)
N, M = list(map(int, input().split()))
ahs = list(map(lambda x:int(x)//2, input().split()))

from fraction import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm = lcm_list(ahs)

result = True
for ah in ahs:
    if (lcm // ah) % 2 == 0:
        result = False
        break

if result == False:
    print(0)
else:
    print((M//lcm-1)//2 + 1)

### FIXED CODE ###

N, M = list(map(int, input().split()))
ahs = list(map(lambda x:int(x)//2, input().split()))

odd = sum([ah % 2 for ah in ahs])
if odd!=0 and N-odd!=0:
    print(0)
else:
    from fractions import gcd
    from functools import reduce

    def lcm_base(x, y):
        return (x * y) // gcd(x, y)

    def lcm_list(numbers):
        return reduce(lcm_base, numbers, 1)

    lcm = lcm_list(ahs)

    result = True
    for ah in ahs:
        if (lcm // ah) % 2 == 0:
            result = False
            break

    if result == False:
        print(0)
    else:
        print((M//lcm-1)//2 + 1)
K,X=input().split()
if 500*K >= X:
  print("Yes")
else*
  print("No")


### FIXED CODE ###

K,X=map(int,input().split())
if 500*K >= X:
  print("Yes")
else:
  print("No")
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
c = h//max(a) + [1,0][h%max(a)==1]
if sum(b) >= h:
    c0 = 0
    d = 0
    e = reversed(sorted(b))
    while d < h:
        d += e[i] 
        c0 += 1
        i += 1
    c = min(c,c0)
print(c)

### FIXED CODE ###

n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
A = max(a)
s = list()
for i in range(n):
    if b[i] > A:
        s.append(b[i])
s.sort()
s.reverse()
c = sum(s)
if c < h:
    print(len(s) + (h-c)//A + [1,0][(h-c)%A==0])
else:
    S = 0
    for i in range(len(s)):
        S += s[i]
        if S >= h:
            print(i+1)
            break
a=int(raw_input())
print(str(a//3600)+":"+str(a%3600//60)+":"+str(a%60)

### FIXED CODE ###

a=input()
print(str(a//3600)+":"+str(a%3600//60)+":"+str(a%60))
a,b=map(int,input.split())

print(max(a+b,a-b,a*b))


### FIXED CODE ###

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

print(max(a+b,a-b,a*b))
a,b=map(int,input().split()
print(a*b)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b)
n = int(input())
print(n\\2)

### FIXED CODE ###

import math
n = int(input())
print(math.ceil(n/2))
N, L = map(int,input())
l, r = L, L + N - 1
total = (L - 1) * N + N * (N + 1) // 2
if l <= 0 and r >= 0:
    print(total)
if l > 0:
    total -= l
    print(total)
if r < 0:
    total -= r
    print(total)

### FIXED CODE ###

N, L = map(int,input().split())
l, r = L, L + N - 1
total = (L - 1) * N + N * (N + 1) // 2
if l <= 0 and r >= 0:
    print(total)
if l > 0:
    total -= l
    print(total)
if r < 0:
    total -= r
    print(total)
n, x = map(int, raw_input().split())
a = map(int, raw_input().split())
ans = 0
b = []
for k in range(n):
    if k == 0:
        b = a[:]
    else:
        for i in range(n):
            b[i] = min(a[(i-k)%n],b[i])
    cost = k*x+sum(b)
    if k == 0:
        ans = cost
    else:
        ans = min(ans,cost)
        if ans != cost:
            break
    if ans < (k+1)*x:
        break
print(ans)

### FIXED CODE ###

def solve(n, x, a):
	costs = []
	cost_min = 0
	for k in range(n):
		if k == 0:
			costs = a.copy()
		else:
			for i in range(n):
				costs[i] = min(costs[i], a[(i-k)%n])
		cost_k = sum(costs) + k*x
		if k == 0:
			cost_min = cost_k
		else:
			cost_min = min(cost_min, cost_k)
			if cost_min != cost_k:
				break
		if cost_min < (k+1) *x:
			break
 
	return cost_min
n, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
print(solve(n,x,a))
n,m=map(int,input().split())
digit = [0]*(m+1)
value = [0]*(m+1)
for i in range(1,m+1):
    digit[i],value[i] = map(int,input().split())
res = 0
for i in range(1,n+1):
    if i in digit:
        idx = digit.index(i)
        res += value[idx] * 10**(n-i)
for i in range(1,m+1):
    if int(str(res)[digit[i]-1]) != value[i]:
        print('-1')
        exit()
print(res if len(str(res))==n else '-1')

### FIXED CODE ###

n,m = map(int,input().split())
digit = [0]*(m)
value = [0]*(m)
for i in range(m):
    digit[i],value[i] = map(int,input().split())

#全探索
ans = 0
for i in range(10**3):
    s = str(i)
    if len(s)!=n: continue
    for j in range(m): 
        if int(s[digit[j]-1]) != value[j]:
            break
    else:
        print(i)
        exit()
print('-1')
import math
def jk(j,k):
    return j*k//math.gcd(a,b)
a, b = map(int,input().split())
print(jk(a, b))

### FIXED CODE ###

import fractions
a, b = map(int,input().split())
def jk(j,k):
    return j*k//fractions.gcd(j,k)
print(jk(a, b))
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10
import re
#solve
def solve():
    s = S()
    if re.fullmatch("(A?)KIH(A?)B(A?)R(A?)", s):
        print("YES")
    else:
        print("NO")
    return


#main
if __name__ == '__main__':
    solve()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10
import re
#solve
def solve():
    s = S()
    if re.fullmatch("(A?)KIH(A?)B(A?)R(A?)", s):
        print("YES")
    else:
        print("NO")
    return


#main
if __name__ == '__main__':
    solve()
print((int(input()+1)//2))

### FIXED CODE ###

print((int(input())+1)//2)
import sys
#stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
xyh = []
for _ in range(n):
    xyh.append(tuple(list(li())))
    

# 中心になりうる点を全探索
def search_cent(xyh: list):
    n = len(xyh)
    for x_cent in range(101):
        for y_cent in range(101):
            
            # 各点と中心との距離
            dist = []
            is_cent = True
            for x,y,_ in xyh:
                dist.append((abs(x-x_cent), abs(y-y_cent)))
                
            # 中心との距離と高さの差に矛盾が無いかチェック
            for i in range(n):
                for j in range(n):
                    if xyh[i][2] - sum(dist[i]) < 0 or xyh[j][2] - sum(dist[j]) < 0:
                        pass
                    
                    if (xyh[i][2]-xyh[j][2]) != -(sum(dist[i]) - sum(dist[j])):
                        is_cent = False
                        break
                if not is_cent:
                    break

            if is_cent:
                return x_cent, y_cent

                
x_cent, y_cent = search_cent(xyh)
h_cent = xyh[0][2] + abs(xyh[0][0] - x_cent) + abs(xyh[0][1] - y_cent)

print(x_cent, y_cent, h_cent)

### FIXED CODE ###

import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())
 
n = ni()
xyh = []
for _ in range(n):
    xyh.append(tuple(list(li())))

def search_cent(xyh:list):    
    xmax ,ymax, hmax = -1, -1, -1
    for x,y,h in xyh:
        if h > hmax:
            xmax = x
            ymax = y
            hmax = h
            
    for x_cent in range(101):
        for y_cent in range(101):
            h_cent = hmax + abs(xmax-x_cent) + abs(ymax-y_cent)
            
            # 矛盾チェック
            is_cent = True
            for x,y,h in xyh:
                hi = max(0, h_cent - abs(x-x_cent) - abs(y-y_cent))
                
                if hi != h:
                    is_cent = False
                    break

            if is_cent:
                return x_cent, y_cent, h_cent
        
xc, yc, hc = search_cent(xyh)
print(xc,yc,hc)
n=int(input())
c=1
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        count+=1
    else:
        count=0
    if count==3:
        c=1
if c==1:
    print("Yes")
else:
    print("No")


    

### FIXED CODE ###

n=int(input())
c=0
count=0
for i in range(n):
    a,b=map(int,input().split())

    if a==b:
        count+=1
    else:
        count=0
    if count==3:
        c=1
if c==1:
    print("Yes")
else:
    print("No")
def xnxn(n=0, flag="v"):
    """
    args:
        int n: a number of lows to read
    example:
        input   1
        retrun  1

        input   1 2 3
        return  [1,2,3]
        input   1 2 3
                4 
        return  [[1,2,3],
                [4]]
    """
    if n == 0:
        temp = list(map(int, input().split()))
        if len(temp) == 1:
            if flag == "l":
                return temp
            else:
                return temp[0]
        elif len(temp) > 1:
            return temp
    else:
        temp = [list(map(int, input().split())) for _ in range(n)]
        return temp


n, k = xnxn()
a = xnxn(flag="l")
for _ in range(k):
    tmp = [0]*(n+1)
    for i in range(0, n):
        l = max(0, i - a[i])
        r = min(n, i + a[i]+1)
        tmp[l] += 1
        tmp[r] -= 1
    for i in range(1, n):
        tmp[i] += tmp[i - 1]
    if a == tmp:
        break
    a = tmp

for i in a[:n]:
    print(i, end=" ")


### FIXED CODE ###

s = input()

print(s[0:3])
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(N: int, A: int, B: int, C: int, s: "List[str]"):
    ABC = [A, B, C]
    ans = []
    d = {"AB": (0, 1), "BC": (1, 2), "AC": (0, 2)}
    # print(ABC)
    for i in range(N):
        j, k = d[s[i]]
        if ABC[j] == ABC[k] == 0:
            no()
            return
        if ABC[j] == ABC[k] == 1:
            if i != N-1:
                if j not in s[i+1]:
                    j, k = k, j
                    ABC[j] += 1
                    ABC[k] -= 1
                    ans.append("ABC"[j])
        elif ABC[j] > ABC[k]:
            ABC[j] -= 1
            ABC[k] += 1
            ans.append("ABC"[k])
        else:
            ABC[j] += 1
            ABC[k] -= 1
            ans.append("ABC"[j])

    yes()
    for a in ans:
        print(a)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, A, B, C, s)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(N: int, A: int, B: int, C: int, s: "List[str]"):
    ABC = [A, B, C]
    ans = []
    d = {"AB": (0, 1), "BC": (1, 2), "AC": (0, 2)}
    # print(ABC)
    for i in range(N):
        j, k = d[s[i]]
        if ABC[j] == ABC[k] == 0:
            no()
            return
        if ABC[j] == ABC[k] == 1:
            if i != N-1 and (j not in d[s[i+1]]):
                j, k = k, j
            ABC[j] += 1
            ABC[k] -= 1
            ans.append("ABC"[j])
        elif ABC[j] > ABC[k]:
            ABC[j] -= 1
            ABC[k] += 1
            ans.append("ABC"[k])
        else:
            ABC[j] += 1
            ABC[k] -= 1
            ans.append("ABC"[j])

    yes()
    for a in ans:
        print(a)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, A, B, C, s)


if __name__ == '__main__':
    main()
import itertools

def main():
    N, A, B = map(int, input().split())

    num = tuple(range(A, B+1))
    val = []
    for n in itertools.combinations_with_replacement(num, N):
        if n[0] == A and n[-1] == B:
            val.append(sum(n))

    ans = len(set(val))
    print(ans)

main()


### FIXED CODE ###

def main():
    N, A, B = map(int, input().split())

    if A > B or (N == 1 and A != B):
        ans = 0
    elif N == 1:
        ans = 1
    else:
        ans = (N - 2) * (B - A) + 1
    print(ans)

main()
K,A,B = map(int,input().split())
if A <= K <= B and A or B % K == 0:
	print("OK")
else:
  	print("NG")

### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())
ans="NG"

for i in range(1001):
  if A<=i*K and i*K<=B:
    ans="OK"
    break

print(ans)
a, b = map(int, raw_input().split())
if a > b:
  print "a > b"
else if a < b:
  print "a < b"
else:
  print "a == b"

### FIXED CODE ###

a,b=map(int,raw_input().split());print"a "+[["==","<"][a<b],">"][a>b]+" b"
N = int(input())
a = list(map(int, input().split()))
x = [0] * (10**5+2)

for i in a:
    a[i] += 1
    a[i+1] += 1
    a[i+2] +=1 
    
print(max(a))
    

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
x = [0] * (10**5+2)

for i in a:
    x[i] += 1
    x[i+1] += 1
    x[i+2] += 1 
    
print(max(x))
h, w = map(int, input().split())
grid = []
for _ in range(h):
    grid.append(list(map(int, input().split())))
for i in range(h):
    l = list(map(int, input().split()))
    for j in range(w):
        grid[i][j] = abs(grid[i][j] - l[j])

biggest = max([max(i) for i in grid])
m = (h + w) * biggest

unba = [[[False] * m for _ in range(w)] for _ in range(h)]

# 0行目
unba[0][0][grid[0][0]] = True
for i in range(1, w):
    for j in range(m):
        if unba[0][i-1][j]:
            unba[0][i][grid[0][i] + j] = True
            unba[0][i][abs(grid[0][i] - j)] = True

# 1~h-1行目
for i in range(1, h):

    # i行0列
    for j in range(m):
        if unba[i-1][0][j]:
            unba[i][0][grid[i][0] + j] = True
            unba[i][0][abs(grid[i][0] - j)] = True

    # i行j列
    for j in range(1, w):
        for k in range(m):
            if unba[i-1][j][k] or unba[i][j-1][k]:
                unba[i][j][grid[i][j] + k] = True
                unba[i][j][abs(grid[i][j] - k)] = True

l = [i for i in range(m) if unba[h-1][w-1][i]]
print(min(l))

### FIXED CODE ###

def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()

    h, w = map(int, input().split())
    g = []
    for _ in range(h):
        g.append(list(map(int, input().split())))
    for i in range(h):
        k = list(map(int, input().split()))
        for j in range(w):
            g[i][j] = abs(g[i][j] - k[j])

    m = (h + w) * 80

    if m == 0:
        print(0)
        exit()

    dp = [[False] * m for _ in range(w)]
    dp[0][g[0][0]] = True
    for j in range(1, w):
        for k in range(m):
            if dp[j-1][k]:
                dp[j][abs(k - g[0][j])] = True
                dp[j][k + g[0][j]] = True
    
    for i in range(1, h):
        new_dp = [[False] * m for _ in range(w)]
        for k in range(m):
            if dp[0][k]:
                new_dp[0][abs(k - g[i][0])] = True
                new_dp[0][k + g[i][0]] = True
        
        for j in range(1, w):
            for k in range(m):
                if new_dp[j-1][k] or dp[j][k]:
                    new_dp[j][abs(k - g[i][j])] = True
                    new_dp[j][k + g[i][j]] = True
        dp = new_dp

    for j in range(m):
        if dp[w-1][j]:
            print(j)
            break

main()
r = int(input())
print(3*a**2)

### FIXED CODE ###

r = int(input())
print(3*(r**2))