Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
room = dict()
for i in range(M):
    a, b = map(int, input().split())
    if room.get(a):
        room[a] += [b]
    else:
        room[a] = [b]
    if room.get(b):
        room[b] += [a]
    else:
        room[b] = [a]
dp = [-1] * (N + 1)
dp[1] = 0
def sign_root(n):
    nxt = []
    for i in room[n]:
        if dp[i] == -1:
            dp[i] = n
            nxt += [i]
    for i in nxt:
        sign_root(i)
sign_root(1)
if -1 in dp[1:]:
    print("No")
else:
    print("Yes")
    for i in dp[2:]:
        print(i)

### FIXED CODE ###

MAX_INT = 10**6
N, M = map(int, input().split())
room = [set() for _ in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    room[a].add(b)
    room[b].add(a)

dis = [MAX_INT] * (N + 1)
sign = [-1] * (N + 1)
dis[1] = 0
def sign_root(n):
    nxt = []
    for i in room[n]:
        if dis[n] + 1 < dis[i]:
            sign[i] = n
            dis[i] = dis[n] + 1
            nxt += [i]
    return nxt

nxt = sign_root(1)
while nxt != []:
    for i in nxt.copy():
        nxt.pop(0)
        nxt += sign_root(i)
if MAX_INT in dis[2:]:
    print("No")
else:
    print("Yes")
    for i in sign[2:]:
        print(i)
import math
a,b,x=map(long, input().split())
print(math.floor(b/x)-math.ceil(a/x)+1)


### FIXED CODE ###

a,b,x=map(int, input().split())
print(b//x-((a-1)//x+1)+1)
n,m = map(int,input().split())
a = [int(input().replace(" ",""),2) for i in range(n)]
mod = 998244353
cnt = 0
for j in range(m):
  for i in range(cnt,n):
    if a[i] & 1<<j:
      for k in range(n):
        if i != k and a[k] & 1<<j:
          a[k] ^= a[i]
      a[i],a[cnt] = a[cnt],a[i]
      cnt += 1
ans = pow(2,n+m-2*cnt,mod)*pow(2,cnt-1,mod)*(pow(2,cnt,mod)-1)%mod
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
a = [int(input().replace(" ",""),2) for i in range(n)]
mod = 998244353
cnt = 0
for j in range(m)[::-1]:
  for i in range(cnt,n):
    if a[i] & 1<<j:
      for k in range(n):
        if (i != k) and (a[k] & 1<<j):
          a[k] ^= a[i]
      a[i],a[cnt] = a[cnt],a[i]
      cnt += 1
if cnt == 0:
  print(0)
else:
  ans = pow(2,n+m-2*cnt,mod)*pow(2,cnt-1,mod)*(pow(2,cnt,mod)-1)%mod
  print(ans)
#!/usr/bin/env python3
import sys
INF = float("inf")


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


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


def solve(s: str, x: int, y: int):
    s = [len(FF) for FF in s.split("T")]
    sX = s[0::2]                # 空となるケースに注意
    sY = s[1::2]                # 空となるケースに注意
    # print(sX, sY)

    # sXを足すか引くかして、xにたどり着くことができるか
    N = len(s)
    DPx = [False]*(2*N+1)  # [-len(s):len(s)]
    DPx[0] = True
    for c in sX:
        DPnext = [False]*(2*N+1)
        for i in range(-N, N+1):
            DPnext[i] = DPx[i-c]
            if i+c < N+1:
                DPnext[i] = DPnext[i] or DPx[i+c]
        DPx = DPnext
        # print(DPx)

    DPy = [False]*(2*N+1)
    DPy[0] = True
    for c in sY:
        DPnext = [False]*(2*N+1)
        for i in range(-N, N+1):
            DPnext[i] = DPy[i-c]
            if i+c < N+1:
                DPnext[i] = DPnext[i] or DPy[i+c]
        DPy = DPnext
    # print(DPy)

    if DPx[x] and DPy[y]:
        yes()
    else:
        no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(s, x, y)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
INF = float("inf")
from collections import defaultdict


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


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


def solve(s: str, x: int, y: int):
    N = len(s)
    s = [len(FF) for FF in s.split("T")]
    sX = s[0::2]                # 空となるケースに注意
    sY = s[1::2]                # 空となるケースに注意
    # print(sX, sY)

    # sXを足すか引くかして、xにたどり着くことができるか
    DPx = defaultdict(bool)
    DPx[sX[0]] = True
    for c in sX[1:]:
        DPnext = defaultdict(bool)
        for key in DPx:
            DPnext[key-c] = True
            DPnext[key+c] = True
        DPx = DPnext

    DPy = defaultdict(bool)
    DPy[0] = True
    for c in sY:
        DPnext = defaultdict(bool)
        for key in DPy:
            DPnext[key-c] = True
            DPnext[key+c] = True
        DPy = DPnext

    if DPx[x] and DPy[y]:
        yes()
    else:
        no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(s, x, y)


if __name__ == '__main__':
    main()
import numpy as np 
import sys

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

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

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

A = np.array(a)

##while np.sum(A%2) == 0:
  ##  A = A//2

if np.sum(A%2) != len(A):
    print("0")
    sys.exit()
    
tmp = 1##LCM

for i in range(N):
    tmp = lcm(tmp,a[i]//2)

if tmp > M:
    print("0")

else:
    print((M//tmp+1)//2)

### FIXED CODE ###

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


if 500*K>=X:
    print("Yes")
else:
    print("No")
n, k = map(int, input().split())
alist = list(sorted(map(int, input().split())))

def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)

if n == 1:
  if k == a[0]:
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')
else:
  r = gcd(alist[1], alist[0])
  for _a in alist[2:]:
    r = gcd(_a, r)
  if k <= alist[-1] and k % r == 0:
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')


### FIXED CODE ###

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

def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)

if n == 1:
  if k == alist[0]:
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')
else:
  r = gcd(alist[1], alist[0])
  for _a in alist[2:]:
    r = gcd(_a, r)
  if k <= alist[-1] and k % r == 0:
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')
n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))
memory = [[-1 for i in range(2000)]for j in range(n)]

def f(i, k, sum):
    if memory[i][sum] != -1:
        return memory[i][sum]
    if sum == k:
        memory[i][sum] = 1
        return 1
    elif sum > k:
        memory[i][sum] = 0
        return 0
    elif i >= n:
        return 0
    else:
        res0 = f(i+1, k, sum)
        res1 = f(i+1, k, sum + a[i])
        
        if res0 or res1:
            memory[i][sum] = 1
            return 1
        else:
            memory[i][m] = 0
            return 0

for k in m:
    print('yes' if f(0, k, 0) else 'no')


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))
memory = [[-1 for i in range(max(m)+1)]for j in range(n)]

def f(i, m):
    if m == 0:
        return 1
    elif i >= n:
        return 0
    elif memory[i][m] != -1:
        return memory[i][m]
    elif m - a[i] >= 0:
        res0 = f(i+1, m)
        res1 = f(i+1, m-a[i])
        if res0 or res1:
            memory[i][m] = 1
            return 1
        else:
            memory[i][m] = 0
            return 0
    else:
        res = f(i+1, m)
        memory[i][m] = res
        return res

for k in m:
    print('yes' if f(0, k) else 'no')
def f06():
    n=int(input())
    s=input()
    k=int(input())
    x=s[k-1]
    for i in range(n):
        if s[i]!=x:
            s[i]='*'
    print(''.join(s))
f06()


### FIXED CODE ###

def f06():
    n=int(input())
    S=input()
    k=int(input())
    for s in S:
        print(s if s==S[k-1] else '*', end='')
f06()
N = int(input())
cards = list(map(int, input().split()))

alice = 0
bob = 0
for i in range(N+1):
  if i % 2 == 0:
    alice += cards[i]
  else:
    bob += cards[i]

print(alice-bob)

### FIXED CODE ###

N = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)

alice = 0
bob = 0
for i in range(N):
  if i % 2 == 0:
    alice += cards[i]
  else:
    bob += cards[i]

print(alice-bob)
#D問題
K = int(input())
keta = 1
now = 1
def sunuke(n):
    a = 0
    for i in str(n):
        a+=int(i)
    return(n/a)
count=0
while count < k:
    if sunuke(ima) <= sunuke(ima+keta):
        print(ima)
        ima += keta
        count += 1
    else:
        ima += 9*keta
        keta *= 10



### FIXED CODE ###

#D問題
K=int(input())
keta=1
now=1
count=0

def sunuke(n):
    a=0
    for i in str(n):
        a+=int(i)
    return(n/a)

while count < K:
    if sunuke(now) <= sunuke(now+keta):
        print(now)
        now+=keta
        count+=1
    else:
        now+=9*keta
        keta*=10
r=input()
a= 3*r**2
print(a)

### FIXED CODE ###

print(3*int(input())**2)
import heapq as h
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
e6 = 10**6
q = [-b[i]*e6-i for i in range(n)]
q.sort()
cnt = 0
while q:
  w = -h.heappop(q)
  v, i = divmod(w, e6)
  u = b[i-1] + b[(i+1)%n]
  if v < u or a[i] == v: continue
  elif a[i] > v: print(-1); exit(0)
  t = (v-a[i])//u
  if not t: print(-1); exit(0)
  cnt += t
  b[i] -= t*u
  if b[i] > a[i]:
    h.heappush(q,-b[i]*e6-i)
print(cnt if a==b else -1)

### FIXED CODE ###

mod = 998244353
n = int(input())
a = list(map(lambda x: ord(x)%3, list(input())))
g = [list() for _ in range(3)]
for i in range(3*n):
  g[a[i]].append(i)
l = [0]*3*n
for i in range(n):
  a, b, c = sorted([g[0][i], g[1][i], g[2][i]])
  l[b] = 1
  l[c] = 2
ans = 1
for i in range(n):
  ans = ans * (i+1) % mod
c = 0
for x in l:
  if x == 0:
    c += 1
  elif x == 1:
    ans = ans * c % mod
    c -= 1
for x in reversed(l):
  if x == 2:
    c += 1
  elif x == 1:
    ans = ans * c % mod
    c -= 1
print(ans)
import numpy as np

N,M=[int(i) for i in input().split()]
x=input().split()
y=[int(i) for i in x]
y.sort()

if(N==1):
    print(y[M-1]-y[0])
    exit()
if(M==1):
    print("0")
    exit()

diff=[]
for i in range(M-1):
    diff.append(y[i+1]-y[i])
sub=[]
array=np.array(diff)
index=np.argsort(array)
c=index[-1::-1]
for i in range(N-1):
    sub.append(c[i])
print(sub)
ans=0
for i in range(N):
    if(i==0):
        ans+=y[sub[i]]-y[0]
    elif(i==N-1):
        ans+=y[M-1]-y[sub[i-1]+1]
    else:
        ans+=y[sub[i]]-y[sub[i-1]+1]
print(ans)

### FIXED CODE ###

import numpy as np
 
N,M=[int(i) for i in input().split()]
x=input().split()
y=[int(i) for i in x]
y.sort()
if(N==1):
    print(max(y)-min(y))
#    print(y[M-1]-y[0])
    exit()
if(M==1):
    print("0")
    exit()
if(N>=M):
    print("0")
    exit()
diff=[]
for i in range(M-1):
    diff.append(y[i+1]-y[i])
sub=[]
array=np.array(diff)
index=np.argsort(array)
c=index[-1::-1]
for i in range(N-1):
    sub.append(c[i])
ans=0
for i in range(N):
    if(i==0):
        ans+=y[sub[i]]-y[0]
    elif(i==N-1):
        ans+=y[M-1]-y[sub[i-1]+1]
    else:
        ans+=y[sub[i]]-y[sub[i-1]+1]
print(ans)
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

ans_list = ([[i+1] * a[i] for i in range(N)])
ans_list = reduce(lambda a, b: a + b, ans_list)

for i in range(H):
    print(ans_list[i*W:i*W+W] if i%2 == 0 else ans_list[i*W+W-1:i*W-1:-1])

### FIXED CODE ###

from functools import *

H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

ans_list = ([[i+1] * a[i] for i in range(N)])
ans_list = reduce(lambda a, b: a + b, ans_list)

for i in range(H):
    ans = ans_list[i*W:i*W+W] if i%2 == 0 else ans_list[i*W+W-1:i*W-1:-1]
    print(*ans)
n=int(input())
l=[]

for I in range(n):
    l.append(int(input())
else:
    print(int(sum(l)-max(l)/2))

### FIXED CODE ###

n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
else:
    print(sum(l)-max(l)//2)
A,B=map(int,input().split())
x=((B-1)//A+1)
all=A*x
use=x
notuse=all-use
if notuse<B:
    add=(B-notuse-1)//A+1
print(x+add)

### FIXED CODE ###

A,B=map(int,input().split())
print((B-2)//(A-1)+1)
s = input()
even = ["L","U","D"]
odd = ["R","U","D"]
f=True
for i in range(len(s)):
    if i%2==1:
        if s[i] not in even:
            f = False
    if i%2==0:
        id s[i] not in odd:
            f=False
if f:
    peint("Yes")
else:
    print("No")

  

### FIXED CODE ###

s = input()
even = ["L","U","D"]
odd = ["R","U","D"]
f=True
for i in range(len(s)):
    if i%2==1:
        if s[i] not in even:
            f = False
    if i%2==0:
        if s[i] not in odd:
            f=False
if f:
    print("Yes")
else:
    print("No")
a,b,c = input().split()
print(a[0].upper()+b[0].upeer() +c[0].upper())

### FIXED CODE ###

a,b,c = input().split()
print(a[0].upper() + b[0].upper() + c[0].upper())
a = input()
if(a<3200):
  print('red')
else:
  print 'pink'

### FIXED CODE ###

a = int(input())
s = input()
print(s if a >= 3200 else 'red')
import collections
N, K, L = map(int, input().split())
city = [{"road":{"Connected":[i],"set":-1,"seen":False},
         "rail":{"Connected":[i],"set":-1,"seen":False}} for i in range(N)]
def dfs(graph, v, way, num):
    graph[v][way]["seen"] = True
    graph[v][way]["set"] = num
    for next_v in graph[v][way]["Connected"]:
        if graph[next_v][way]["seen"]:
            continue
        dfs(graph, next_v, way, num)

for i in range(K):
    p, q = map(int, input().split())
    city[p-1]["road"]["Connected"].append(q-1)
    city[q-1]["road"]["Connected"].append(p-1)
for i in range(L):
    r, s = map(int, input().split())
    city[r-1]["rail"]["Connected"].append(s-1)
    city[s-1]["rail"]["Connected"].append(r-1)
for X in ["road", "rail"]:
    count = 0
    for v in range(N):
        if city[v][X]["seen"]:
            continue
        dfs(city, v, X, count)
        count += 1
List = [(x["road"]["set"],x["rail"]["set"]) for x in city]
counter = collections.Counter(List)
for A in List:
    print(counter[A],end=" ")
        


### FIXED CODE ###

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

def fp(x, parentList): #findParent
    if parentList[x] == x:
        return x
    else:
        parentList[x] = fp(parentList[x], parentList)
        return parentList[x]

#各ノードのparentをリストで表現(連結前は自身がparent)
road = [i for i in range(N)]
rail = [i for i in range(N)]

for _ in range(K):
    p, q = map(int, input().split())
    par_p, par_q = fp(p-1, road), fp(q-1, road) #p, qのparent 
    #連結する際、若い番号をparentとする
    if par_p < par_q:
        road[par_q] = par_p
    else:
        road[par_p] = par_q

#railについても同様
for _ in range(L):
    s, t = map(int, input().split())
    par_s, par_t = fp(s-1, rail), fp(t-1, rail)
    if par_s < par_t:
        rail[par_t] = par_s
    else:
        rail[par_s] = par_t

#連結成分の要素をカウント
cnt = {}
for i in range(N):
    key = (fp(i,road),fp(i,rail))
    if key in cnt:
        cnt[key] += 1
    else:
        cnt[key] = 1
#出力
for i in range(N):
    key = (fp(i,road),fp(i,rail))
    ans = cnt[key]
    print(ans, end=" ")
N,K = map(int,input().split(" "))
height = []
for i in range(N):
    height.append(int(input()))
height.sort()
min = 10**9
for j in range(K):
    light = height[j:j+K]
    hmin = light[0]
    hmax = light[K-1]
    hei = hmax-hmin
    if hei <= min:
        min = hei
print(min)

### FIXED CODE ###

N,K = map(int,input().split(" "))
height = []
for i in range(N):
    height.append(int(input()))
height.sort()
min = 10**9
n = N-K+1
for j in range(n):
    hmin = height[j]
    hmax = height[j+K-1]
    hei = hmax-hmin
    if hei <= min:
        min = hei
print(min)
import collections

n,m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
print(s)#[[1, 2], [2, 3]]

q = collections.deque()
q.append(1)

for k in range(2):
    for j in range(len(q))
        tmp = q.pop()
        for i in s:
            if tmp in i:
                if tmp > i[0]:
                    q.append(i[0])
                else:
                    q.append(i[1])

if n in q:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


### FIXED CODE ###

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

s1 = set()
s2 = set()
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        s1.add(b)
    elif b == 1:
        s1.add(a)
    elif a == n:
        s2.add(b)
    elif b == n:
        s2.add(a)

if s1.isdisjoint(s2):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
n,m = map(int,input().split())
s = []
c = []
for i in range(m):
    val1,val2 = map(int,input().split())
    s.append(val1)
    c.append(val2)

digit = max(s)

ans = []

for i in range(10 ** (digit - 1) + 1,10 ** digit):
    num = str(i)
    flg = 0
    for j in range(m):
        if num[s[j]-1] == str(c[j]):
            flg = 1
        else:
            flg = 0
            break
    if flg == 1:
        ans.append(i)

if ans:
    print(min(ans))
else:
    print(-1)

### FIXED CODE ###

n,m = map(int,input().split())
s = []
c = []
for i in range(m):
    val1,val2 = map(int,input().split())
    s.append(val1)
    c.append(val2)

for i in range(1000):
    if len(str(i)) == n:
        flg = True
        for j in range(m):
            if int(str(i)[s[j] - 1]) != c[j]:
                    flg = False
        if flg:
            print(i)
            break
if not flg:
    print(-1)
import numpy as np
N = int(input())
T,A = map(int,input().split())
H = np.array(list(map(int,input().split())))
p = np.absolute(((T-H*0.006)-A)))
print(np.argmin(p)+1)

### FIXED CODE ###

import numpy as np
N = int(input())
T,A = map(int,input().split())
H = np.array(list(map(int,input().split())))
p = np.absolute(((T-H*0.006)-A))
print(np.argmin(p)+1)
a,b.c = map(int,input().split())
if a < c < b or a > c > b:
    print("OK")
else:
    print("NO")


### FIXED CODE ###

a, b, c = map(int,input().split())
if a > c > b or b > c > a :
  print('Yes')
else :
  print('No')
import sys
import numpy as np
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))

n, m, c = rm()
b = np.array(rl())
cnt = 0
for _ in range(n):
  a = np.array(rl())
  if np.sum(a*b) > -c:
    cnt += 1
print(cnt)

### FIXED CODE ###

import sys
rm = lambda: map(int, sys.stdin.buffer.readline().split())

a, b = rm()
c, d = rm()
print((c-a) * (d-b))
import math

N, X = map(int, input().split())
xlist = list(map(int, input().split()))
gaplist = []
for i in range(N):
    tmp = abs(xlist[i] - X)
    if tmp==0:
        tmp = 1
    gaplist.append(tmp)

ans = gaplist[0]
for i in range(1,N):
    print(ans)
    ans = math.gcd(ans, gaplist[i])
    #次のxとの最大公約数を動的計画法求めるメソッド O(logX)

print(ans)

### FIXED CODE ###

from fractions import gcd

N, X = map(int, input().split())
xlist = list(map(int, input().split()))
gaplist = []
for i in range(N):
    tmp = abs(xlist[i] - X)
    if tmp==0:
        tmp = 1
    gaplist.append(tmp)

ans = gaplist[0]
for i in range(1,N):
    ans = gcd(ans, gaplist[i])
    #次のxとの最大公約数を動的計画法求めるメソッド O(logX)

print(ans)
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
eat_p = p[:X]
eat_q = q[:Y]

ans = sum(eat_p) + sum(eat_q)
i, j, k = -1, -1, 0
while True:
    if eat_p[i] < eat_q[j] and eat_p[i] < r[k]:
        ans += r[k] - eat_p[i]
        k += 1
        i -= 1
    if eat_p[i] >= eat_q[j] and eat_q[j] < r[k]:
        ans += r[k] - eat_q[j]
        k += 1
        j -= 1
    if k == C or (eat_p[i] > r[k] and eat_q[j] > r[k]):
        break
    if i == -A:
        i = 0
    if j == -B:
        j = 0

print(ans)


### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
eat_p = p[:X]
eat_q = q[:Y]

all_apple = eat_p + eat_q + r
all_apple.sort(reverse=True)

print(sum(all_apple[:X+Y]))
while True:
	try:
		splited = raw_input().split()
		num = int(splited[0])+int(splited[1])
		print len(str(num))
	except EOFerror:
		break

### FIXED CODE ###

while True:
	try:
		a,b = map(int, raw_input().split())
		print len(str(a+b))
	except EOFError:
		break
n = int(input())
l = [int(input()) for i in range(n)]
total = sum(l)
i = 0
while total % 10 == 0:
    total = total - l[i]
    i + 1
print(total)


### FIXED CODE ###

a, b = map(int, input().split())
print(a + b) if (a + b) < 10 else print("error")
N, A, B = int(input()), int(input()), int(input())
data = []

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

n = 0
for n in range(N+1):
        x = digitsum(n)
        if A <= x <= B:
                data.append(x)

sum(data)

### FIXED CODE ###

n, a, b = map(int, input().split())
ans = 0

for i in range(1, n+1):
    if a <= sum(map(int, list(str(i)))) <= b:
        ans += i
    else:
        continue

print(ans)
n = int(input())
a = [int(i) for i in input().split()]
s = [0] * (n+1)
ans = 0
for i in range(n):
    s[i+1] = s[i] + a[i]
c = Counter(s)
for i in c:
    ans += int(c[i]*(c[i]-1)//2)
print(ans)


### FIXED CODE ###

n = int(input()) 
a = [int(i) for i in input().split()]
d = dict()
d[0] = 1
ans = 0
t = 0
for i in range(n):
    t += a[i]

    s = d.get(t,0)
    ans += s 
    d[t] = s+1
    
print(ans)
n = map(int,input().split())
if n[0]*n[1]//2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a,b= map(int,input().split())
if a*b%2 == 0:
  print("Even")
else:
  print("Odd")
a,b,k = map(int, input().split())


if a >= k:
    print('{} {}'.format(a-k,b))

elif (a + b) > k:
    print('0 {}'.format(a+b-k))

elif (a + b) < k:
    print('0 0')

### FIXED CODE ###

s,t =input().split()

ans =''

print(ans + t + s)
N,T=map(int,input().split())
    root=[tuple(map(int,input().split())) for i in range(N)]
     
    minc=1000
    for cand in root(N):
        if cand[1]<=T:
            if cand[0]<minc:
                minc=cand[0]
    if minc==1000:
        print("TLE")
    else:
        print(minc)

### FIXED CODE ###

N,T=map(int,input().split())
root=[tuple(map(int,input().split())) for i in range(N)]

minc=1001
for cand in root:
    if cand[1]<=T:
        if cand[0]<minc:
            minc=cand[0]
if minc==1001:
    print("TLE")
else:
    print(minc)
import math
a, b, c = map(int, input().split())
sqa = math.sqrt(a)
sqb = math.sqrt(b)
sqc = math.sqrt(c)
if sqa + sqb < sqc:
  print(Yes)
else:
  print(No)


### FIXED CODE ###

import math

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


if c-a-b > 0 and 4*a*b < (c-a-b)**2:
  print("Yes")
else:
  print("No")
D = int(input())
if d = 25:
  print('Christmas')
elif d = 24:
  print('Christmas Eve')
elif d = 23:
  print('Christmas Eve Eve')
else d = 22:
  print('Christmas Eve Eve Eve')

### FIXED CODE ###

d = int(input())
if d == 25:
  print('Christmas')
elif d == 24:
  print('Christmas Eve')
elif d == 23:
  print('Christmas Eve Eve')
else:
  print('Christmas Eve Eve Eve')
N,K = map(int,input().split())
H = list(map(int,input().split()))

dp = []

for i in range(N):
  h = H[i]
  dp.append(min((dp[-j-1]+abs(h-H[i-j-1]) for j in range(min(i,K))), default=0))

print(dp[-1])

### FIXED CODE ###

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

dp = [0]

for i in range(1,N):
  h = H[i]
  dp.append(min(dp[j]+abs(H[j]-h) for j in range(max(i-K,0),i)))

print(dp[-1])
a, b = map(int, input().split())

limit = int((10**12 + 1)**0.5)
prime_table = [True] * (limit + 1)

for i in range(2, limit):
    if prime_table[i] is True:
        for j in range(i + i, limit, i):
            prime_table[j] = False

ans = set()

for i in range(1, a + 1):
    if a % i == 0 and prime_table[i] is True:
        ans.add(i)

for i in range(1, b + 1):
    if a % i == 0 and prime_table[i] is True:
        ans.add(i)

print(len(ans))


### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


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

g = gcd(a, b)
num = g

ans = 1

for i in range(2, int(g ** 0.5) + 1):

    if num % i == 0:
        ans += 1
        while num % i == 0:
            num = num // i

if num != 1:
    ans += 1

print(ans)