Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**8)

def find_path(now, par):
    if now == n - 1:
        path.append(n - 1)
        return True
    for to in g[now]:
        if to == par: continue
        if find_path(to, now):
            path.append(now)
            return True
    return False

def dfs(now, par, color):
    color[now] = "b"
    for to in g[now]:
        if to == par: continue
        if color[to] == "w": continue
        dfs(to, now, color)

n = int(raw_input())
g = [[] for _ in xrange(n)]
for i in xrange(n - 1):
    a, b = map(int, raw_input().split())
    a -= 1; b -=1
    g[a].append(b)
    g[b].append(a)
path = []
find_path(0, -1)
path.reverse()
color = ["bl"] * n
color[0] = "b"
color[n - 1] = "w"
for i in xrange(1, len(path) - 1):
    v = path[i]
    if i % 2 == 1:
        color[v] = "b"
    else:
        color[v] = "w"
dfs(0, -1, color)
cnt = 0
for i in xrange(n):
    if color[i] == "b":
        cnt += 1
if cnt > n - cnt:
    print "Fennec"
else:
    print "Snuke"


### FIXED CODE ###

n = int(raw_input())
a = map(int, raw_input().split())
s = [0] * n
s[0] = a[0]
for i in xrange(1, n):
    s[i] += s[i - 1] + a[i]
ans = 10**12
for i in xrange(n - 1):
    ans = min(ans, abs(s[i] - (s[n - 1] - s[i])))
print ans
n = int(input())

if 1 <= n <= 999:
   input("ABC")
else:
    input("ABD")

### FIXED CODE ###

n = int(input())

if n < 1000:
    print("ABC")
else:
    print("ABD")
n = int(input())
h = list(map(int, input().split()))


w = 1
for i in range(n-1):
    if h[i] - h[i+1] >= 2:
        w = 0

for j in range(n-2):
    if h[j] - h[j+1]  == 1:
        
        if h[j+1] - h[j+2] == 1:
            w =0
        else:
            count += 1
    elif h[j] - h[j+1] == 0:
        continue
        
if w == 0:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

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


w = 1
for i in range(n-1):
    if h[i] - h[i+1] >= 2:
        w = 0

for j in range(n-2):
    if h[j] - h[j+1]  == 1:
        for k in range(j,n-2):
            if h[k+1] - h[k+2] == 0:
                continue
            if h[k+1] - h[k+2] == 1:
                w = 0
                break
            break


        
if w == 0:
    print("No")
else:
    print("Yes")
r_c_str=input().split()
r_c=list(map(lambda i :int(i),r_c_str))
r=r_c[0]
c=r_c[1]
s_str=[input() for i in range(r)]
s_str=[i.split() for i in s_str]
s=[]
for i in s_str:
    s.append(list(map(lambda j :int(j),i)))
for i in range(r):
    s[i].append(sum(s[i]))
s.append([0,0,0,0,0,0])
for i in range(c):
    for j in range(r):
        s[-1][i]+=s[j][i]
s[-1][-1]+=sum(s[4])
for i in s:
    print(*i)


### FIXED CODE ###

r_c_str=input().split()
r_c=list(map(lambda i :int(i),r_c_str))
r=r_c[0]
c=r_c[1]
s_str=[input() for i in range(r)]
s_str=[i.split() for i in s_str]
s=[]
for i in s_str:
    s.append(list(map(lambda j :int(j),i)))
for i in range(r):
    s[i].append(sum(s[i]))
s.append([])
for i in range(c+1):
    s[-1].append(0)
for i in range(c):
    for j in range(r):
        s[r][i]+=s[j][i]
s[-1][-1]+=sum(s[r])
for i in s:
    print(*i)
s＝input（）
ans＝0
c＝0
for i in range（3）:
  if s[i]＝＝'R':
    ans+＝1
  else:
    c＝max（ans,c）
    ans＝0
print（c）
    

### FIXED CODE ###

S=input()
ans=0
c=0
for i in range(3):
  if S[i]=="R":
    ans+=1
  else:
    c=max(ans,c)
    ans=0
print(max(c,ans))
print("ABC" + int(input()) )

### FIXED CODE ###

print("ABC" + str(input()) )
import sys
input = sys.stdin.readline

N, X = map(int, input().split())
l, p = [1], [1]

def f(N, X):
    for i in range(N):
        if N == 0:
            return 0 if X == 0 else 1
        elif X <= 1 + l[N-1]:
            return f(N-1, X-1)
        else:
            return p[N-1] + 1 + f(N-1, X-2-a[N-1])
    
print(f(N, X))


### FIXED CODE ###

import sys
input = sys.stdin.readline

N, X = map(int, input().split())
l, p = [1], [1]

for i in range(N):
    l.append(l[i]*2 + 3)
    p.append(p[i]*2 + 1)

def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + l[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-l[N-1])
    
print(f(N, X))
L,R=map(int,input().split())
M=2019
import sys
for i in range(L,R):
    for j in range(i+1,R+1) :
        if (i*j)%2019 < M :
            if M=0:
                sys.exit()
            M = (i*j)%2019
    
 print(M)

### FIXED CODE ###

L,R=map(int,input().split())
M=2019
import sys
for i in range(L,R):
    for j in range(i+1,R+1) :
        if (i*j)%2019 < M :
            M = (i*j)%2019
            if M == 0:
                print(M)
                sys.exit()
print (M)
D = ["A","T","G","C"]
S = input().strip()
N = len(S)
for k in range(N):
    for i in range(k+1):
        ind = 1
        for j in range(i,i+N-k):
            if S[j] not in D:
                ind = 0
                break
        if ind == 1:
            cnt = N-k
            break
    if ind==1:break
print(cnt)

### FIXED CODE ###

D = ["A","T","G","C"]
S = input().strip()
N = len(S)
cnt = 0
for k in range(N):
    for i in range(k+1):
        ind = 1
        for j in range(i,i+N-k):
            if S[j] not in D:
                ind = 0
                break
        if ind == 1:
            cnt = N-k
            break
    if ind==1:break
print(cnt)
import itertools
 
N, M = map(int, input().split())
 
S = []
for i in range(M):
    k, *s = map(int, input().split())
    S.append([s])
    
P = [int(i) for i in input().split()]
 
A = [0, 1]
ans = 0
for i in itertools.product(A, repeat = N):
    flag = 0
    for j in range(M):
        cnt = 0
        for s in S[j]:
            if i[s - 1] == 1:
                cnt += 1
        if cnt % 2 != P[j]:
            flag = 1
    if flag == 0:
        ans += 1
        
print(ans)

### FIXED CODE ###

import itertools

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

S = []
for i in range(M):
    s = list(map(int, input().split()))
    S.append(s[1:])
    
P = [int(i) for i in input().split()]

A = [0, 1]
ans = 0
for i in itertools.product(A, repeat = N):
    flag = 0
    for j in range(M):
        cnt = 0
        for s in S[j]:
            if i[s - 1] == 1:
                cnt += 1
        if cnt % 2 != P[j]:
            flag = 1
    if flag == 0:
        ans += 1
        
print(ans)
from math import atan, degrees
a, b, x = map(int, input().split())
if pow(a,b)*b == x:
    print(0)
elif b*pow(a,2)/2 <= x:
    print(90-degrees(atan((a/2)/(b-x/pow(a,2)))))
else:
    print(90-degrees(atan((2*x/(a*b))/b)))

### FIXED CODE ###

from math import atan, degrees
a, b, x = map(int, input().split())
if pow(a,2)*b == x:
    print(0)
elif b*pow(a,2)/2 <= x:
    print(90-degrees(atan((a/2)/(b-x/pow(a,2)))))
else:
    print(90-degrees(atan((2*x/(a*b))/b)))
N = int(input())
 
cnt = 0
list = [0,0,0]
 
for i in range(N):
    s = input()
    cnt += s.count('AB')
    if s[0] == 'B' and s[-1] == 'A':
        list[0] += 1
    elif s[-1] == 'A':
        list[1] += 1
    elif s[0] == 'B':
        list[2] += 1
 
min_ = min(list[0],list[1],list[2])
 
if min_ >= 1:
    cnt += 2*min_
    list[0] -= min_
    list[1] -= min_
    list[2] -= min_
 
if list[0] >= 2:
    cnt += 2*list[0]//2
    list[0] -= 2*(list[0]//2)
 
if list[1] == list[2]:
    cnt += list[1]
elif list[1] > list[2]:
    cnt += list[2] + min(list[0],list[1]-list[2])
elif list[1] < list[2]:
    cnt += list[1] + min(list[0],list[2]-list[1])
 
print(cnt)

### FIXED CODE ###

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

print(N-K+1)
az = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
sum_az = [0 for x in range(26)]

while True:

    x = raw_input()
    x.lower()
    for i in range(26):
        for j in range(len(x)):
            if x[j] == az[i]:
                sum_az[i] += 1


for i in range(26):
    print ("%s : %d" % (az[i], sum_az[i]))
                

### FIXED CODE ###

import sys
az =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
sum_az = [0 for x in range(26)]

for x in sys.stdin.read().lower():
    for i in range(26):
        if x == az[i]:
            sum_az[i] += 1


for i in range(26):
    print ("%s : %d" % (az[i], sum_az[i]))
n,x,m = map(int,input().split()),[int(input()) for i in range(n)]
print(n+(x-sum(m))//min(m))

### FIXED CODE ###

n,x = map(int,input().split())
m = [int(input()) for i in range(n)]
print(n+(x-sum(m))//min(m))
#coding:utf-8

from functools import reduce
import fractions

n, x = map(int, input().split(' '))
nums = list(map(int, input().split(' ')))

def devide_cnt(num):
    cnt = 0
    while num % 2 == 0:
        cnt += 1
        num //= 2
    return cnt, num

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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


def main():
    odd_nums = []
    cnt = -1
    for num in nums:
        tmp, num = devide_cnt(num)
        if cnt == -1:
            cnt = tmp
        if cnt != tmp:
            print(0)
            return
        odd_nums.append(num)
        
    minv = 2 ** cnt * lcm_list(odd_nums)

    
    l = 1
    r = 10000000001
    tmp = -1
    while l < r + 1:
        m = l + (r - l) // 2
        p = m * minv + 0.5 * minv
        if p > x:
            r = m
        else:
            l = m
        
        if tmp == p:
            break
        tmp = p
        
            
    print(l+1)
    
    
    

main()

### FIXED CODE ###

#coding:utf-8

k, x = map(int, input().split(' '))
if k * 500 >= x:
  print('Yes')
else:
  print('No')
card = list(map(int, input().split()))
list = list()
result = 0

if card[3] <= card[0]:
  result = card[3]
elif card[0] < card[3] and card[3] <= card[1]:
  result = card[0]
else:
  result = card[0] - (card[3] - (card[0] + card[1]))

print(result)

### FIXED CODE ###

old_id=input()
new_id=input()

try:
  result = "Yes" if len(old_id)+1 == len(new_id) and old_id.index(new_id[0]) == 0 and old_id in new_id else "No"
  print(result)
except ValueError:
  print("No")
x=input()
y=input()
if x%500<=y:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

x=int(input())
y=int(input())
if x%500<=y:
  print("Yes")
else:
  print("No")
import math
x = map(raw_input().split(' '))
print(int(math.log10(x[0]+x[1]))+1)

### FIXED CODE ###

while True:
	try:
		a,b = map(int,raw_input().split(' '))
		print len(str(a+b))
	except: break
N,M = map(int,input().split())
A = list(map(int,input().split()))
shreshold = sum(A)/(4*M)
ret = [a for a in A if a >= shreshold]
if len(ret) < M:
    print('no')
else:
    print('yes')

### FIXED CODE ###

x,y,z = map(int, input().split())
x,y,z = z,x,y
print(x,y,z)
# DFS
class Edge:
    def __init__(self, _to, _id):
        self.to = _to
        self.id = _id


def dfs(vertex, parent_color=-1, parent_vertex=-1):
    color = 1
    for g in graph[vertex]:
        u = g.to
        ei = g.id
        if u == parent_vertex:
            continue
        if color == parent_color:
            color += 1
        ans[ei] = color
        color += 1
        dfs(u, ans[ei], vertex)


N = int(input())
graph = [[] for _ in range(N)]
ans = [0 for _ in range(N-1)]
for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(Edge(b, i))
    graph[b].append(Edge(a, i))

dfs(0)

# 最大次数が色数となる
mx = max([len(g) for g in graph])
print(mx)

for i in range(N-1):
    print(ans[i])


### FIXED CODE ###

"""
DFS
"""
# 再帰回数の上限を解除
import sys
sys.setrecursionlimit(10**7)


class Edge:
    def __init__(self, _to, _id):
        self.to = _to
        self.id = _id


def dfs(vertex, parent_color=-1, parent_vertex=-1):
    color = 1
    for g in graph[vertex]:
        u = g.to
        ei = g.id
        if u == parent_vertex:
            continue
        if color == parent_color:
            color += 1
        ans[ei] = color
        color += 1
        dfs(u, ans[ei], vertex)


N = int(input())
graph = [[] for _ in range(N)]
ans = [0 for _ in range(N-1)]
for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(Edge(b, i))
    graph[b].append(Edge(a, i))

dfs(0)

# 最大次数が色数となる
mx = max([len(g) for g in graph])
print(mx)

for i in range(N-1):
    print(ans[i])
n, a, b = map(int, input().split())
if 3 * A < B:
    print(3 * A)
else:
    print(B)


### FIXED CODE ###

n, a, b = map(int, input().split())
if n * a < b:
    print(n * a)
else:
    print(b)
import numpy as np

a, b, q = map(int, input().split())
sh = []
te = []

"""
def getNearestValue(list, num):
    
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]
"""


def getNearestValue(data, target):

    if len(data) == 0:
        return None
    if len(data) == 1:
        return data[0]
    min_diff = float('inf')
    imin = 0
    imax = len(data) - 1
    closest_num = None
    while imin <= imax:
        imid = imin + (imax - imin) // 2
        #　中心の左右の値と目標との差を計算する。
        if imid + 1 < len(data):
            min_diff_right = abs(data[imid+1] - target)
        if imid > 0:
            min_diff_left = abs(data[imid-1] - target)
        # 最初の差と最も最小に近い値を更新する。
        if min_diff_left < min_diff:
            min_diff = min_diff_left
            closest_num = data[imid-1]
        if min_diff_right < min_diff:
            min_diff = min_diff_right
            closest_num = data[imid+1]
        # 2分探索する。
        if data[imid] < target:
            imin = imid + 1
        elif data[imid] > target:
            imax = imid - 1
        else:
            return data[imid]
    return closest_num


def checkshrine(x):
    x_near_sh = getNearestValue(sh, x)
    xsash = np.abs(x_near_sh - x)
    sh_near_te = getNearestValue(te, x_near_sh)
    return xsash + np.abs(sh_near_te - x_near_sh)


def checktemple(x):
    x_near_te = getNearestValue(te, x)
    xsate = np.abs(x_near_te - x)
    te_near_sh = getNearestValue(sh, x_near_te)
    return xsate + np.abs(te_near_sh - x_near_te)


for i in range(a):
    sh.append(int(input()))

for i in range(b):
    te.append(int(input()))

for i in range(q):
    x = int(input())
    checkshrinevalue = checkshrine(x)
    checktemplevalue = checktemple(x)
    if (checkshrinevalue > checktemplevalue):
        print(checktemplevalue)
    else:
        print(checkshrinevalue)


### FIXED CODE ###


import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
    x = int(input())
    b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
    res = INF
    for S in [s[b - 1], s[b]]:
        for T in [t[d - 1], t[d]]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            res = min(res, d1, d2)
    print(res)
import numpy as np
from numba import njit

@njit('i8,i8,i8[::1]', cache=True)
def update(A, N):
    B = [0] * N
    for i, t in enumerate(A):
        l = max(0, i - t)
        r = min(N - 1, i + t)
        B[l] += 1
        if (r + 1 < N):
            B[r + 1] -= 1
    return np.cumsum(B)

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    for _ in range(0, min(42, K)):
        A = update(A, N)
    print(" ".join([str(item) for item in A]))

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit('(i8[::1],)', cache=True)
def update(A):
    N = len(A)
    B = np.zeros_like(A)
    for i, x in enumerate(A):
        l = max(0, i - x)
        r = min(N - 1, i + x)
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1
    B = np.cumsum(B)
    return B

N, K = map(int, readline().split())
A = np.array(read().split(), np.int64)

K = min(K, 100)
for _ in range(K):
    A = update(A)
print(' '.join(A.astype(str)))
nums = [input() for i in range(2)]
A,B,C = map(int,nums)
x = int(input())
  
count = 0
for i in range(A):
  if i*500 == x:
    count += 1
    break
  else:
    x -= i*500
    for j in range(B):
      if j*100 == x:
        count += 1
        break
      else:
        x -= j*100
        for k in range(C):
          if k*50 == x:
            count += 1
            break
print(count)

### FIXED CODE ###

nums = [input() for i in range(3)]
A,B,C = map(int,nums)
x = int(input())
count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k == x:
        count +=1
print(count)
N=int(input())
a_list=map(int,input().split())
    
a_max=max(a_list)
a_min=min(a_list)
print(a_max-a_min)
    

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split())) 
a_max=max(a)
a_min=min(a)
print(a_max-a_min)
# 求める出力は，mの約数iのうち n*i <= m を満たす最大の整数n．

N, M = map(int, input().split())
fracs = []
i = 2
m = M
# mの素因数分解を求める
while m > 1 and M**0.5:
  while m % i == 0:
    m //= i
    if len(fracs)==0:
      fracs.append([i, 1])
    elif fracs[-1][0] == i:
      fracs[-1][1] += 1
    else:
      fracs.append([i, 1])    
  i += 1

if m != 1:
  fracs.append(m, 1)

# 約数を全て列挙する
divisors = []
def search(i, p):
  for j in range(fracs[i][1]+1):
    if i != len(fracs)-1:
      new_p = p * fracs[i][0] ** j
      search(i+1, new_p)
    else:
      divisors.append(p * fracs[i][0] ** j)
search(0, 1)

print(sorted(list(filter(lambda x: x*N <= M, divisors)))[-1])

### FIXED CODE ###

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

ans = 1
for i in range(1, int(m**0.5)+2):
  if m % i == 0:
    if i * n <= m:
      ans = max(ans, i)
    if (m // i) * n <= m:
      ans = max(ans, m//i)
    
print(ans)
import heapq

def dijkstra(ad_lst, n, s, t):
    costs = [float('inf') for i in range(n+1)]
    costs[s] = 0
    Q = []
    heapq.heappush(Q, [costs[s], s])

    while(Q != []):
        c, u = heapq.heappop(Q)
        for v, c in ad_lst[u]:
            if costs[u] + c < costs[v]:
                alt = costs[u] + c
                heapq.heappush(Q, [alt, v])
                costs[v] = alt

    return costs

n,m,s,t, = map(int, input().split())

route_y = {i: [] for i in range(n+1)}
route_s = {i: [] for i in range(n+1)}
for i in range(m):
    u, v, a, b = map(int, input().split())
    route_y[u].append([v,a])
    route_y[v].append([u,a])
    route_s[u].append([v,b])
    route_s[v].append([u,b])

cost_y = dijkstra(route_y, n, s, t)
cost_s = dijkstra(route_s, n, t, s)
cost_ys = [[cost_y[i]+cost_s[i], i] for i in range(n+1)]

# cost_ys.sort()
# yen = 10**15
# k = 0
# for i in range(n):
#     while cost_ys[k][1]<=i: k+=1
#     print(yen-cost_ys[k][0])
inf = float('inf')
result = [inf for _ in range(n+1)]
min_cost = result[-1]
for i in range(n, 0, -1):
    if min_cost > cost_ys[i]:
        min_cost = cost_ys[i]
    result[i] = min_cost
yen = 10**15
for i in range(1, n+1):
    print(yen - result[i])


### FIXED CODE ###

import heapq
from itertools import accumulate
inf = float('inf')

def dijkstra(ad_lst, n, s):
    costs = [inf for i in range(n+1)]
    costs[s], Q = 0, []
    heapq.heappush(Q, [costs[s], s])

    while(Q != []):
        c, u = heapq.heappop(Q)
        for v, c in ad_lst[u].items():
            if costs[u] + c < costs[v]:
                heapq.heappush(Q, [costs[u] + c, v])
                costs[v] = costs[u] + c

    return costs

n,m,s,t, = map(int, input().split())

route_y = {i: {} for i in range(n+1)}
route_s = {i: {} for i in range(n+1)}
for i in range(m):
    u, v, a, b = map(int, input().split())
    route_y[u][v] = a
    route_y[v][u] = a
    route_s[u][v] = b
    route_s[v][u] = b

cost_y = dijkstra(route_y, n, s)
cost_s = dijkstra(route_s, n, t)
result = list(accumulate([y+s for y,s in zip(cost_y, cost_s)][::-1], min))
yen = 10**15
[print(yen-result[i]) for i in range(n-1, -1, -1)]
n = int(input())
input(s)
if s == s[n - 1:]:
  print("Yes")
else
  print ("No")    

### FIXED CODE ###

import sys

n = int(input())
s = input()
if n == 1:
  print("No")
  sys.exit()
n = n // 2
if s[:n]  == s[n:]:
    print("Yes")
else:
    print ("No")
K = int(input())
A,B = map(int, input().split())
for i in range(A, B+1):
	if i % K == 0:
		print('OK')
		exit()
print('NG'

### FIXED CODE ###

K = int(input())
score = input().split()
s1 = int(score[0])
s2 = int(score[1])
if ( s1 % K ) == 0:
		print('OK')
elif ( s2 % K ) == 0:
		print('OK')
elif ( s1 // K ) < ( s2 // K ):
		print('OK')
else:
		print('NG')
X,N = map(int,input().split(" "))
p = list(map(int,input().split(" ")))
for k in range(200):
  temp = X-k
  if temp not in p:
    print(temp)
    break
  semp = X+k
  if semp not in p:
    print(semp)
    break

### FIXED CODE ###

X,N = map(int,input().split(" "))
if N==0:
  print(X)
else:
  p = list(map(int,input().split(" ")))
  for k in range(200):
    temp = X-k
    if temp not in p:
      print(temp)
      break
    semp = X+k
    if semp not in p:
      print(semp)
      break
# 入力 : 数字2つ
N, A = map(int, input().split())

# 出力　N^2-A
ans = N * N - A
print(ans)


### FIXED CODE ###

# 入力 : 数字2つ
N = int(input())
A = int(input())

# 出力　N^2-A
ans = N * N - A
print(ans)
n = input()
def sum_keta(m):
	sum_wa = 0
	while m>0:
		sum_wa = sum_wa + m%10
		m = int(m/10)

	return sum_wa

if sum_keta(n) == 1:
	print(10)
else:
	print(sum_keta(n))


### FIXED CODE ###

n = input()
ans = 0
for ele in n:
  ans+=int(ele)
if ans==1:
  print(10)
else:
  print(ans)
if A>=0 and A<=5:
  return 0;
elif A>5 and A<=12:
  return B/2;
else:
  return B;

### FIXED CODE ###

read=input();
A,B=read.split(' ')
A=int(A)
B=int(B)
if A>12:
  print(B);
elif A>5:
  print(int(B/2));
else:
  print(0);
n = int(input())
def digitsum(x):
    array = list(map(int, list(str(x))))
    return sum(array)

dsum = [digitsum(a)+digitsum(n-a) for a in range(1,int(n/2))]
print(min(dsum))

### FIXED CODE ###

n = int(input())
def digitsum(x):
    array = list(map(int, list(str(x))))
    return sum(array)

dsum = [digitsum(a)+digitsum(n-a) for a in range(1,int(n/2)+1)]
print(min(dsum))
from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline


def main():
  N, K = list(map(int, input().split()))
  R, S, P = list(map(int, input().split()))
  T = input()[:-1]

  mem = []
  hand_map = {'r': 'p', 's': 'r', 'p': 's'}
  score_map = {'r': P, 's': R, 'p': S}

  score = 0

  for i in range(K):
    mem.append(hand_map[T[i]])
    score += score_map[T[i]]

  for i in range(K, N):
    if not mem[i-K] == hand_map[T[i]]:
      mem.append(hand_map[T[i]])
      score += score_map[T[i]]
      continue
    cand = ['r', 's', 'p']
    # print(mem[i-K])
    cand.remove(mem[i-K])
    if i+K <= N and not(mem[i-K] == hand_map[T[i+K]]):
      cand.remove(hand_map[T[i+K]])
    mem.append(cand[0])

  print(score)


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


### FIXED CODE ###

from sys import stdin
input = stdin.readline


def main():
  N, K = list(map(int, input().split()))
  R, S, P = list(map(int, input().split()))
  T = input()[:-1]

  mem = []
  hand_map = {'r': 'p', 's': 'r', 'p': 's'}
  score_map = {'r': P, 's': R, 'p': S}

  score = 0

  for i in range(K):
    mem.append(hand_map[T[i]])
    score += score_map[T[i]]

  for i in range(K, N):
    if not mem[i-K] == hand_map[T[i]]:
      mem.append(hand_map[T[i]])
      score += score_map[T[i]]
      continue
    cand = ['r', 's', 'p']
    # print(mem[i-K])
    cand.remove(mem[i-K])
    if i+K < N and not(mem[i-K] == hand_map[T[i+K]]):
      cand.remove(hand_map[T[i+K]])
    mem.append(cand[0])

  print(score)


if(__name__ == '__main__'):
  main()
def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans

N,A,B = map(int, [input() for i in range(3)])

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
    else:
        pass
print(ans1)


### FIXED CODE ###

def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans

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

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
    else:
        continue
print(ans1)