Harryxun/stf_run huggingface dataset:
import math
import sympy
n=int(input())
a=math.factorial(n)
#print(a)
#a=32400

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
ps=prime_factors(a)
sy={}
for i in ps:
    if i not in sy:
        sy[i]=1
    else:
        sy[i]+=1
#aaaaaaaaaaa
#sy=sympy.factorint(a)
count75=0
count25=0
count15=0
count5=0
count3=0
for k in sy.values():
    #print(k)
    if k+1>=75:
        count75+=1
    if k+1>=25:
        count25+=1
    if k+1>=15:
        count15+=1
    if k+1>=5:
        count5+=1
    if k+1>=3:
        count3+=1

#print(count75)
#print(count25*(count3-1))
#print(count15*(count5-1))
#print((count5*(count5-1)*(count3-2))/2)
print(int(count75+count25*(count3-1)+count15*(count5-1)+(count5*(count5-1)*(count3-2))/2))


### FIXED CODE ###

import math
#import sympy
n=int(input())
a=math.factorial(n)
#print(a)
#a=32400

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
ps=prime_factors(a)
sy={}
for i in ps:
    if i not in sy:
        sy[i]=1
    else:
        sy[i]+=1
#aaaaaaaaaaa
#sy=sympy.factorint(a)
count75=0
count25=0
count15=0
count5=0
count3=0
for k in sy.values():
    #print(k)
    if k+1>=75:
        count75+=1
    if k+1>=25:
        count25+=1
    if k+1>=15:
        count15+=1
    if k+1>=5:
        count5+=1
    if k+1>=3:
        count3+=1

#print(count75)
#print(count25*(count3-1))
#print(count15*(count5-1))
#print((count5*(count5-1)*(count3-2))/2)
print(int(count75+count25*(count3-1)+count15*(count5-1)+(count5*(count5-1)*(count3-2))/2))
#!/usr/bin/env python3


def solv(a, b):
    if a >= 13:
        return b
    elif a >= 6:
        return b // 2
    else:
        return 0


if __name__ == '__main__':

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

    ans = solv(a, b)

    print(ans)
#!/usr/bin/env python3


def solv(a, b):
    if a >= 13:
        return b
    elif a >= 6:
        return b // 2
    else:
        return 0


if __name__ == '__main__':

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

    ans = solv(a, b)

    print(ans)


### FIXED CODE ###

#!/usr/bin/env python3

def solv(a, b):
    if a >= 13:
        return b
    elif a >= 6:
        return b // 2
    else:
        return 0


if __name__ == '__main__':

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

    ans = solv(a, b)

    print(ans)
n, k, m = map(int, input().split())
A = list(map(int, input().split()))
test_sum = 0

for i in range(n-1):
    test_sum = test_sum + A[i]
    
test_n = (m * n) - test_sum
if test_n >= k:
    print("-1")
else:
    print(str(test_n))

### FIXED CODE ###

c = ord(input())
next = c + 1
print(chr(next))
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
from collections import defaultdict
INF = float('inf')

def main():
    S = readline().decode('utf-8')
    L = len(S)
    d = defaultdict(int)

    for i in range(L):
        s = int(S[i:])
        a = s%2019
        d[a] += 1

    ans = 0

    for key, value in d.items():
        ans += value*(value-1)//2
        if key == 0:
            ans += value

    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

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

INF = float('inf')


def main():
    s = map(int, input()[::-1])
    mod = 2019
    counts = [0] * mod
    counts[0] = 1
    t = 0
    x = 1
    for num in s:
        t = (t + num * x) % mod
        counts[t] += 1
        x = (x * 10) % mod
    ans = 0
    for count in counts:
        if count > 1:
            ans += count * (count - 1) // 2
    print(ans)


if __name__ == '__main__':
    main()
n, k = map(int, input().split())
p = list(map(int, input().split()))
  
s = []
sump = 0
for i in range(n):
  sump += (p[i] + 1) / 2
  s.append(sump)
  
ans = set()
for i in range(k, n):
  ans.add(s[i]-s[i-k])
  
print(max(ans))

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
m = sum(p[0: k])
sump = m

for i in range(1, n-k+1):
  sump = sump - p[i-1] + p[i+k-1]
  if m < sump:
    m = sump

ans = (m + k) / 2

print(ans)
n=int(input())
s=input()
leng=len(s)
slist=[s]
#print(slist)
alphabet=["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", "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"]
#print(alphabet)
for i in range(0,leng):
    for j in range(0,26):
#        print(s[i])
#        print(alphabet[j])
        if s[i]==alphabet[j]:
            slist[i]=alphabet[j+n]
#            print(slist[i])

print(slist)

### FIXED CODE ###

n=int(input())
s=input()
leng=len(s)
slist=[]
#print(slist)
alphabet=["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", "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"]
#print(alphabet)
for i in range(0,leng):
    for j in range(0,26):
#        print(s[i])
#        print(alphabet[j])
        if s[i]==alphabet[j]:
            #print(j)
            slist.append(alphabet[j+n])
            #print(alphabet[j+n])
            #print(slist[i])

print(''.join(slist))
import fraction

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

left = [0] * N
right = [0] * N

left[0] = A[0]
for i in range(1,N):
    left[i] = fraction.gcd(left[i-1],A[i])

right[N-1] = A[N-1]
for j in range(N-2,0,-1):
    right[j] = fraction.gcd(A[j],right[j+1])

can = [0] * N
can[0] = right[1]
for k in range(1,N-1):
    can[k] = fraction.gcd(left[k-1],right[k+1])
can[N-1] = left[N-2]

print(max(can))

### FIXED CODE ###

import fractions

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

left = [0] * N
right = [0] * N

left[0] = A[0]
for i in range(1,N):
    left[i] = fractions.gcd(left[i-1],A[i])

right[N-1] = A[N-1]
for j in range(N-2,0,-1):
    right[j] = fractions.gcd(A[j],right[j+1])

can = [0] * N
can[0] = right[1]
for k in range(1,N-1):
    can[k] = fractions.gcd(left[k-1],right[k+1])
can[N-1] = left[N-2]

print(max(can))
def main(q: int, h: int, s: int, d: int, n: int):
    print((n // 2) * min(q * 8, h * 4, s * 2, d) + (n % 2) * min(q * 4, h * 2, s))


if __name__ == "__main__":
    q, h, s, d = map(int, input().split())
    n = int(input)

    main(q, h, s, d, n)


### FIXED CODE ###

def main(q: int, h: int, s: int, d: int, n: int):
    print((n // 2) * min(q * 8, h * 4, s * 2, d) + (n % 2) * min(q * 4, h * 2, s))


if __name__ == "__main__":
    q, h, s, d = map(int, input().split())
    n = int(input())

    main(q, h, s, d, n)
s = input()
t = input()
q = int(input())
abcd = [tuple(map(int,input().split())) for i in range(q)]

def to_one(word):
    if len(word)==0:
        return 0

    if len(word)==1:
        return word

    if word[:2] == 'AB' or word[:2] == 'BA':
        return to_one(word[2:])

    if word[:3] == 'AAA':
        return to_one(word[3:])

    if word[:3] == 'BBB':
        return to_one(word[3:])

    if word[:2] == 'AA':
        return to_one('B'+word[2:])
    if word[:2] == 'BB':
        return to_one('A'+word[2:])


for a,b,c,d in abcd:

    s_i = s[a-1:b]
    t_i = t[c-1:d]

    if to_one(s_i) == to_one(t_i):
        print('YES')
    else:
        print('NO')



### FIXED CODE ###

from itertools import accumulate

s = input()
t = input()
q = int(input())
abcd = [tuple(map(int,input().split())) for i in range(q)]

s_number = [2 if ab == 'B' else 1 for ab in s]
t_number = [2 if ab == 'B' else 1 for ab in t]

s_sum = [0] + s_number
s_sum = list(accumulate(s_sum))

t_sum = [0] + t_number
t_sum = list(accumulate(t_sum))

for a,b,c,d in abcd:

    s_i = s_sum[b]-s_sum[a-1]
    t_i = t_sum[d]-t_sum[c-1]

    if s_i%3 == t_i%3:
        print('YES')
    else:
        print('NO')
import itertools
import heapq
import sys
import functools
import operator
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
comb = itertools.combinations(a,k)  
l = [list(i) for _ in comb]  
A = [functools.reduce(operator.mul,l[i]) for i in range(len(l))] 
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
#標準入力
H, W = map(int, input().split())
grid = []
for i in range(H):
    tmp = input()
    grid.append(tmp)

#グリッドの縦横を別々に調べる
import numpy as np
grid_int = np.zeros((H, W))
for i in range(H):
    count = 0
    for j in range(W):
        if grid[i][j] == '.':
            count += 1
            if j == W - 1:
                grid_int[i, j-count + 1:j + 1] = count
        elif grid[i][j] == '#':
            if j == 0:
                continue
            grid_int[i, j- count, j] = count
            count = 0


for j in range(W):
    count = 0
    for i in range(H):
        if grid[i][j] == '.':
            count += 1
            if i == H - 1:
                grid_int[i - count + 1: i + 1, j] += count
        elif grid[i][j] == '#':
            if i == 0:
                continue
            grid_int[i-count: i, j] += count
            count = 0

ans = 0
for i in range(H):
    tmp_max = max(grid_int[i]) - 1
    if ans < tmp_max:
        ans = tmp_max
print(int(ans))


### FIXED CODE ###

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

def main():
    H,W = map(int,input().split())
    S = np.array([list(input()) for _ in range(H)]) == '.' #'.'に一致するならTrueしなければFalse

    up = np.zeros((H,W), dtype=int)
    down = np.zeros((H,W), dtype=int)
    left = np.zeros((H,W), dtype=int)
    right = np.zeros((H,W), dtype=int)
    
    for i in range(H-1):
        up[i+1,:] = (up[i,:] + 1) * S[i,:] #npの変数名[k,l]でk行l列を取り出す
    for i in range(H-1):                   #:なら全部をそれぞれについて見ていく
        down[H - 2 - i,:] = (down[H - 1 - i,:] + 1) * S[H - 1 - i,:]
    for i in range(W-1):
        left[:,i+1] = (left[:,i] + 1) * S[:,i]
    for i in range(W-1):
        right[:,W - 2 - i] = (right[:,W - 1 - i] + 1) * S[:,W - 1 - i]
        
    print(((up+down+left+right)*S).max()+1) #カケザンデ要素ごとの掛け算可能
    
if __name__ == "__main__":
    main()
import math

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

plus = [0]
minus = []
zeroExist = 0

for i in range(n):
    if x[i] > 0:
        plus.append(x[i])
    elif x[i] == 0:
        zeroExist = 1
    else:
        minus.append(-x[i])
minus.append(0)
minus = list(reversed(minus))

# for i in range(1, len(minus)):
# minus[i] += minus[i-1]

# print(plus)
# print(minus)

if zeroExist == 1:
    k -= 1

cost = math.inf
for i in range(k+1):
    if i < len(plus) and k - i < len(minus):
        #print(i)
        if i == 0 or i == k:
            cost = min(cost, plus[i] + minus[k - i])
        else:
            cost = min(cost, plus[i] + minus[k - i]
                       + min(plus[i], minus[k-i]))
        #print("{}:{}".format(i, cost))
print(cost)


### FIXED CODE ###

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

plus = [0]
minus = []
zeroExist = 0

for i in range(n):
    if x[i] > 0:
        plus.append(x[i])
    elif x[i] == 0:
        zeroExist = 1
    else:
        minus.append(-x[i])
minus.append(0)
minus = list(reversed(minus))

if zeroExist == 1:
    k -= 1

cost = 10**9
for i in range(k + 1):
    if i < len(plus) and k - i < len(minus):
        # print("i:{} k-i:{}".format(i, k-i))
        if i == 0 or i == k:
            cost = min(cost, plus[i] + minus[k - i])
        else:
            cost = min(cost, plus[i] + minus[k - i]
                       + min(plus[i], minus[k - i]))
            # print("{}:{}".format(i, cost))
print(cost)
a = input()
a.split()
i = (int)a[0]
d = (int)a[1]
x = (int)a[2]
rd = d / x
ri = (i - 1) / x
if (ri < 0):
  ri = -1
print(rd - ri)

### FIXED CODE ###

a = input().split()
i = int(a[0])
d = int(a[1])
x = int(a[2])
rd = d // x
ri = (i - 1) // x
if (ri < 0):
	ri = -1
print(rd - ri)
import sys

def solve():
    while 1:
        w, h = map(int, sys.stdin.readline().split())

        if w == h == 0:
            return

        room = [[int(j) for j in sys.stdin.readline().split()] for i in range(h)]

        cnt = 0

        for i in range(h):
            for j in range(w):
                if room[i][j]:
                    cnt += 1
                    dfs(w, h, room, i, j)

        print(cnt)

def dfs(w, h, room, i, j):
    if i < 0 or i >= h or j < 0 or j >= w or (not room[i][j]):
        return

    room[i][j] = 0

    dfs(w, h, room, i + 1, j)
    dfs(w, h, room, i - 1, j)
    dfs(w, h, room, i, j + 1)
    dfs(w, h, room, i, j - 1)
    dfs(w, h, room, i + 1, j + 1)
    dfs(w, h, room, i + 1, j - 1)
    dfs(w, h, room, i - 1, j + 1)
    dfs(w, h, room, i - 1, j - 1)

if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys
from collections import deque

sys.setrecursionlimit(10**5)

def solve():
    while 1:
        w, h = map(int, sys.stdin.readline().split())

        if w == h == 0:
            return

        room = [[int(j) for j in sys.stdin.readline().split()] for i in range(h)]

        cnt = 0

        for i in range(h):
            for j in range(w):
                if room[i][j]:
                    cnt += 1
                    bfs(w, h, room, i, j)

        print(cnt)

dx = (1, 0, -1, 0, 1, 1, -1, -1)
dy = (0, 1, 0, -1, 1, -1, 1, -1)

def bfs(w, h, room, i, j):
    room[i][j] = 0
    q = deque([(i, j)])

    while q:
        ci, cj = q.popleft()

        for k in range(len(dx)):
            ni = ci + dy[k]
            nj = cj + dx[k]

            if 0 <= ni < h and 0 <= nj < w and room[ni][nj]:
                room[ni][nj] = 0
                q.append((ni, nj))

    return

def dfs(w, h, room, i, j):
    if i < 0 or i >= h or j < 0 or j >= w or (not room[i][j]):
        return

    room[i][j] = 0

    dfs(w, h, room, i + 1, j)
    dfs(w, h, room, i - 1, j)
    dfs(w, h, room, i, j + 1)
    dfs(w, h, room, i, j - 1)
    dfs(w, h, room, i + 1, j + 1)
    dfs(w, h, room, i + 1, j - 1)
    dfs(w, h, room, i - 1, j + 1)
    dfs(w, h, room, i - 1, j - 1)

if __name__ == '__main__':
    solve()
import math

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

def gcd_list(num_list):
    for i, num in enumerate(num_list):
        if i == 0:
            g = num
        else:
            g = math.gcd(num, g)
    return g

GCD = 0
for i in range(N):
    others = A[:]
    others.pop(i)
    gcd = gcd_list(others)
    if gcd > GCD:
        GCD = gcd
print(GCD)

### FIXED CODE ###

from fractions import gcd

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

GCD1 = []
g = A[0]
for a in A:
    g = gcd(g, a)
    GCD1.append(g)

B = A[::-1]
g = B[0]
GCD2 = []
for b in B:
    g = gcd(g, b)
    GCD2.append(g)

ans = 1
for i in range(N):
    if i == 0:
        a = GCD2[N-2]
    elif i == N-1:
        a = GCD1[N-2]
    else:
        a = gcd(GCD1[i-1], GCD2[N-i-2])
    ans = max(ans, a)
print(ans)
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    a=list(map(int,input().split()))
    edge=[[] for _ in range(N)]
    for _ in range(N-1):
        x,y=map(int1,input().split())
        edge[x].append(y)
        edge[y].append(x)
    stack=[(0,1)]
    dp=[INF]*(N+10)
    dp[0]=0
    used=[False]*N
    ans=[0]*N
    while stack:
        v,l=stack.pop()
        used[v]=True
        dp[l:]=[INF]*(N-l)
        dp[bisect_right(dp,a[v]-1,hi=l)]=a[v]
        ans[v]=bisect_left(dp,INF,hi=l+1)-1
        for nv in edge[v]:
            if not used[nv]:
                stack.append((nv,l+1))
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    a=list(map(int,input().split()))
    edge=[[] for _ in range(N)]
    for _ in range(N-1):
        x,y=map(int1,input().split())
        edge[x].append(y)
        edge[y].append(x)
    stack=[(0,1)]
    used=[False]*N
    ans=[0]*N
    dp=[INF]*(N+1)
    dp[0]=0
    dpdp=[]
    prev_l=1
    def dfs(v,l):
        used[v]=True
        index=bisect_right(dp,a[v]-1,hi=l)
        dpdp=(index,dp[index])
        dp[index]=a[v]
        ans[v]=bisect_left(dp,INF,hi=l+1)-1
        for nv in edge[v]:
            if not used[nv]:
                i,x=dfs(nv,l+1)
                dp[i]=x
        return dpdp
    dfs(0,1)
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()
A,B,C,D,E=map(int,input().split())

if A = 0:
    print(1)
elif B = 0:
    print(2)
elif C = 0:
    print(3)
elif D = 0:
    print(4)
else E = 0:
    print(5)
break

### FIXED CODE ###

A,B,C,D,E=map(int,input().split())

if A == 0:
    print(1)
elif B == 0:
    print(2)
elif C == 0:
    print(3)
elif D == 0:
    print(4)
else:
    print(5)
import sys
sys.setrecursionlimit(1000000000)
n,m,k=map(int,input().split())
stock=[set() for i in range(n)]
ter=[0]*n
ans=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    stock[a-1].append(b-1)
    stock[b-1].append(a-1)
    ans[a-1]-=1
    ans[b-1]-=1
def dfs(j,k):
    size[k]+=1
    for next_j in stock[j]:
        if ter[next_j]==0:
            ter[next_j]=k
            dfs(next_j,k)
total=0
size=[0]*(n+1)
for i in range(n):
    if ter[i]==0:
        total+=1
        ter[i]=total
        dfs(i,total)

for i in range(n):
    ans[i]+=size[ter[i]]-1
for i in range(k):
    c, d = map(int, input().split())
    if ter[c-1]==ter[d-1]:
        ans[c-1]-=1
        ans[d-1]-=1
for i in range(n-1):
    print(ans[i],end=" ")
print(ans[n-1])

### FIXED CODE ###

class UnionFind:
    def __init__(self,n):
        self.n=n
        self.parent=[i for i in range(n)]
        self.rank=[1]*n#木の高さ
        self.size=[1]*n#size[i]はiを根とするグループのサイズ

    def find(self,x):#ｘの根（親）を返す
        if self.parent[x]==x:
            return x
        else:
            self.parent[x]=self.find(self.parent[x])#経路圧縮
            return self.parent[x]

    def unite(self,x,y):#ｘ、ｙの集合の統合
        x=self.find(x)
        y=self.find(y)
        if x!=y:
            if self.rank[x]<self.rank[y]:#ランクの比較
                self.parent[x]=y
                self.size[y]+=self.size[x]
            else:
                self.parent[y]=x
                self.size[x]+=self.size[y]
                if self.rank[x]==self.rank[y]:
                    self.rank[x]+=1
    def group_size(self,x):#ｘが属する集合の大きさ
        return self.size[self.find(x)]
    def is_same(self,x,y):#ｘ、ｙが同じ集合に属するかを判定する
        return self.find(x)==self.find(y)

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

uf=UnionFind(n)
ans = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    uf.unite(a-1,b-1)
    ans[a - 1] -= 1
    ans[b - 1] -= 1
for i in range(k):
    c, d = map(int, input().split())
    if uf.is_same(c-1,d-1):
        ans[c-1]-=1
        ans[d-1]-=1

for i in range(n):
    ans[i]+=uf.group_size(i)-1
    print(ans[i])
n,a,b=(int(x) for x in input().split())
c=0
def sual(N,A,B):
  l=list('{}'.format(N))
  s=sum(l)
  if A<=s<=B:
    return True
  else:
    return False
for x in range(n):
  if sual(x+1,a,b):
    c=c+x+1
print(c)


### FIXED CODE ###

n,a,b=(int(x) for x in input().split())
c=0
d=[]
def sual(N,A,B):
  l=list('{}'.format(N))
  for y in range(len(l)):
      d.append(int(l[y]))
  e=sum(d)
  d.clear()
  if A<=e<=B:
    return True
  else:
    return False

for x in range(n):
  if sual(x+1,a,b):
    c=c+x+1
print(c)
h = int(input())
w=  int(input())
n = int(input())


sum = 0
if h > w:
    for i in range(h):
        sum = sum + h
        if n <= sum:
            print(int(sum/h))
            break
else
    for i in range(w):
        sum = sum + w
        if n <= sum:
            print(int(sum/w))
            break



### FIXED CODE ###

h = int(input())
w=  int(input())
n = int(input())


sum = 0
if h > w:
    for i in range(h):
        sum = sum + h
        if n <= sum:
            print(int(sum/h))
            break
else:
    for i in range(w):
        sum = sum + w
        if n <= sum:
            print(int(sum/w))
            break
# ABC169
# C Multiplication 3
A, B = map(str, input().split())
A = int(A)
B = int(B[0]+B[2]+B[3])
x = A * B
x = x // 100
print(int(x))


### FIXED CODE ###

A, B = map(int, input().split())
print(A * B)
s = input()

if s=="Sunny":
    print ("Cloudy")
if s=="Cloudy":
    print ("Rainy")
if s=="Rainy":
    print ("Sunny")


### FIXED CODE ###

s = str(raw_input())

if s=="Sunny":
    print ("Cloudy")
if s=="Cloudy":
    print ("Rainy")
if s=="Rainy":
    print ("Sunny")
N, K, S = map(int,input().split())
A = []

if K == N:
    A.extend([S] * N)
else:
    if S == 1:
        A.extend([1] * K)
        A.extend([2] * (N - K))
    else:
        for i in range((K + 1) // 2):
            A.extend([1, S - 1])
        if N % 2 == 0:
            A.append(1)
        x = S + 1 if S != 10 ** 9 else S - 2
        A.extend([x] * (N - K - 1))

print(A[0], end = "")
for i in range(1,N):
    print(" ", end = "")
    print(A[i], end = "")

### FIXED CODE ###

N, K, S = map(int,input().split())
A = [S] * K
if N > K:
    if S < 10 ** 9:
        A.extend([S + 1] * (N - K))
    else:
        A.extend([S - 1] * (N - K))

print(A[0], end = "")
for i in range(1,N):
    print(" ", end = "")
    print(A[i], end = "")
A, B, C = map(int, input().split())
if C - (A - B) >= 0:
    print(C - (A - B))
else:
    print(0)

### FIXED CODE ###

A, B = map(int, input().split())
if ( A + B ) % 2 == 0:
    print(int(( A + B ) / 2))
else:
    print('IMPOSSIBLE')