Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N, Q = LI()
    events = []
    for _ in range(N):
        s, t, x = LI()
        s -= x
        t -= x
        events.append([s, x])
        events.append([t, -x])
    for _ in range(Q):
        d = II()
        events.append([d, INF])
    events.sort()
    dst = set()
    for t, x in events:
        if x == INF: # query
            y = min(dst) if dst else -1
            print(y)
        elif x > 0: # add
            dst.add(x)
        else: # x < 0, delete
            dst.remove(-x)
    return

main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from bisect import bisect_left

def main():
    N, Q = LI()
    XST = []
    for _ in range(N):
        s, t, x = LI()
        s -= x
        t -= x
        XST.append([x, s, t])
    D = []
    for _ in range(Q):
        D.append(II())
    ans = [-1] * Q
    nexts = [-1] * Q
    XST.sort()
    for x, s, t in XST:
        i = bisect_left(D, s)
        end = bisect_left(D, t)
        while i < end:
            if nexts[i] == -1:
                ans[i] = x
                nexts[i] = end
                i += 1
            else:
                i = nexts[i]
    for y in ans:
        print(y)
    return

main()
### BUGGY CODE ###

n = int(input())
s = input()

count = 0
for i in range(n-2):
	lis = []
	for j in range(i+1,n-1):
		lis = [s[i]]
		if not s[j] in lis :
			for k in range(j+1,n):
				lis = [s[i],s[j]]
				if not s[k] in lis :
					if j-i != k-j:
						count += 1

print(count)

### FIXED CODE ###

n = int(input())
s = input()

r = s.count("R")
g = s.count("G")
b = s.count("B")


count = 0

for i in range(n):
	for j in range(i+1,n):
		k = j*2-i
		if 0 <= k < n:
			if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
				count += 1
print(r*g*b - count)
### BUGGY CODE ###

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
aa = a.copy()
bb = b.copy()
sa = sum(a)
sb = sum(b)
ans = 10**7
c = [10**10 for i in range(n+m+1)]
c[n+m] = sa + sb
x = sa + sb
c[0] = 0
for i in range(1,n+m):
  if len(a) == 0:
    x -= b[-1]
    b.pop(-1)
    c[n+m-i] = x
    continue
  if len(b) == 0:
    x -= a[-1]
    a.pop(-1)
    c[n+m-i] = x
    continue
  if a[-1] > b[-1]:
    x -= a[-1]
    a.pop(-1)
  else:
    x -= b[-1]
    b.pop(-1)
  c[n+m-i] = x

s = 0
d = [0 for i in range(n+m)]
for i in range(n+m):
  if len(aa) == 0:
    s += bb[0]
    bb.pop(0)
    d[i] = s
    continue
  if len(bb) == 0:
    x += aa[0]
    aa.pop(0)
    d[i] = s
    continue
  if aa[0] > bb[0]:
    s += bb[0]
    bb.pop(0)
  else:
    s += aa[0]
    aa.pop(0)
  d[i] = s
d = [0] + d

for i in range(n+m+1):
  e = min(c[i],d[i])
  if e > k:
    print (i-1)
    exit()
if e <= k:
  print (n+m)
else:
  print (0)


### FIXED CODE ###

import bisect
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

sa = [0 for i in range(n+1)]
sb = [0 for i in range(m+1)]

c = 0

for i in range(n):
  c += a[i]
  sa[i+1] = c
c = 0
for i in range(m):
  c += b[i]
  sb[i+1] = c
ans = 0
# if k >= sum(a)+sum(b):
#   print (n+m)
#   exit()
for i in range(n+1):
  x = k - sa[i]
  if x < 0:
    continue
  y = bisect.bisect_right(sb,x)
  y += i
  ans = max(ans, y-1)
print (ans)
### BUGGY CODE ###

def solve():
    from sys import stdin
    from itertools import accumulate
     
    file_input = stdin
     
    N = int(file_input.readline())
     
    img = []
    acc_row = []
     
    for line in file_input:
        line = tuple(map(int, line.split()))
        img.append(line)
        acc_row.append(tuple(accumulate(line)) + (0,))
     
    def acc_list(col):
        return tuple(accumulate(col)) + (0,)
    acc_col = tuple(map(acc_list, zip(*img)))
     
    ans = 0
    for i, tpl_1 in enumerate(zip(img, acc_row)):
        img_row_i, acc_row_i = tpl_1
        for j, tpl_2 in enumerate(zip(img[i:], acc_row[i:]), start=i):
            img_row_j, acc_row_j = tpl_2
             
            if acc_row_i[j] - acc_row_i[i - 1] > ans:
                ans = acc_row_i[j] - acc_row_i[i - 1]
             
            if i == j:
                continue
             
            col = acc_col[0]
            col_max = col[j] - col[i - 1]
             
            for acc_col_k, img_row_i_k, img_row_j_k in zip(acc_col[1:], img_row_i[1:], img_row_j[1:]):
                col = acc_col_k[j] - acc_col_k[i - 1]
                if col_max > 0:
                    c_ans = col_max + col
                    if c_ans > ans:
                        ans = c_ans
                else:
                    if col > ans:
                        ans = col
                 
                t_col_max = col_max + img_row_i_k + img_row_j_k
                if t_col_max > col:
                    col_max = t_col_max
                else:
                    col_max = col
    print(ans)
 
solve()


### FIXED CODE ###

from sys import stdin
from itertools import accumulate

def solve():
    file_input = stdin
    
    N = int(file_input.readline())
    G = tuple(tuple(map(int, line.split())) for line in file_input)
    G1 = tuple(t[1:] for t in G)
    
    # accumulated rows
    ar = ((0,) + tuple(accumulate(line)) for line in G)
    
    # accumulated columns
    ac = ((0,) + tuple(accumulate(line)) for line in zip(*G))
    ac_1 = next(ac)
    ac = tuple(zip(*ac))
    
    ans = 0
    for i, t1 in enumerate(zip(G1, ar, ac, ac_1)):
        G_i, ar_i, ac_i, ac_1i = t1
        ar_ii = ar_i[i]
        for j, t2 in enumerate(zip(G1[i:], ar_i[i+1:], ac[i+1:], ac_1[i+1:]), start=i):
            G_j, ar_ij, ac_j, ac_1j = t2
            single_row = ar_ij - ar_ii
            if single_row > ans:
                ans = single_row
                
            if i == j:
                continue
            
            col_max = ac_1j - ac_1i
            
            for ac_jk, ac_ik, G_ik, G_jk in zip(ac_j, ac_i, G_i, G_j):
                col = ac_jk - ac_ik
                
                if col_max > 0:
                    c_ans = col_max + col
                    if c_ans > ans:
                        ans = c_ans
                else:
                    if col > ans:
                        ans = col
                
                t_col_max = col_max + G_ik + G_jk
                if t_col_max > col:
                    col_max = t_col_max
                else:
                    col_max = col
    print(ans)

solve()
### BUGGY CODE ###

n, m = map(int, input().split())
ans = set()
for _ in range(m):
    l, r = map(int, input().split())
    tmp = set(range(l, r+1))
    if ans:
        ans &= tmp
    else:
        ans = tmp

print(len(ans))

### FIXED CODE ###

n, m = map(int, input().split())
ml, mr = -1, -1
for _ in range(m):
    l, r = map(int, input().split())
    if ml == -1:
        ml = l
        mr = r
    else:
        if ml < l:
            ml = l
        if mr > r:
            mr = r
if mr - ml < 0:
    print(0)
else:
    print(mr - ml + 1)
### BUGGY CODE ###

#!/usr/bin/env python3

s = input()
tmp = 0 
# まず"01"で抜きまくって、次に"10"で抜きまくる。という実装
ans = 0 
while len(s) != tmp:
    tmp = len(s)
    for i in range(len(s)-1):
        if s[i] == '0' and s[i+1] == '1':
            ans += 1
            s = s[0:i]+s[i+2:]
            #print('s =', s)
            break
tmp = 0 
while len(s) != tmp:
    tmp = len(s)
    for i in range(len(s)-1):
        if s[i] == '1' and s[i+1] == '0':
            ans += 1
            s = s[0:i]+s[i+2:]
            #print('s =', s)
            break

print(2*ans)


### FIXED CODE ###

#!/usr/bin/env python3

s = input()

c0 = s.count('0')
c1 = s.count('1')

ans = min(c0, c1)*2
print(ans)
### BUGGY CODE ###

H,N = map(int,input().split())
spells = sorted([tuple(map(int,input().split())) for _ in range(N)], key=lambda c: c[0])
max_a = max(spells,key=lambda t: t[0])[0]

dp = [10000000000 for _ in range(H + max_a + 1)]
dp[0] = 0

for i in range(1, H + max_a + 1):
  for spell in spells:
    if spell[0] <= i:
      dp[i] = min(dp[i], dp[i - spell[0]] + spell[1])
    else:
      break

print(min(dp[H:H + max_a + 1]))


### FIXED CODE ###

H,N = map(int,input().split())
spells = [tuple(map(int,input().split())) for _ in range(N)]
max_a = max(spells)[0]

dp = [0]
for i in range(1, H + max_a + 1):
  try:
    dp.append(min([dp[i - a] + b for a,b in spells if a <= i]))
  except ValueError:
    dp.append(10**8)

print(min(dp[H:]))
### BUGGY CODE ###

# 2019-11-18 17:34:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 



def main():
    n, s = sys.stdin.read().split()
    n = int(n)
    
    # a = [0 for _ in range(n)]
    # i = j = 0
    # while i < n:
    #     while i+j < n and s[j] == s[i+j]: 
    #         j += 1
    #     a[i] = j
    #     if j == 0:
    #         i += 1 
    #         continue
    #     k = 1
    #     while i+k < n and k+a[k] < j:
    #         a[i+k] = a[k]
    #         k += 1
    #     i += k
    #     j -= k

    # print(max(l for l in a if l <= n // 2))
    # print(a)
    
    ma = 0
    for k in range(n):
        sub = s[k:]
        a = [0 for _ in range(len(sub))]
        i, j = 1, 0
        while i < len(sub):
            while i+j < len(sub) and sub[j] == sub[i+j]:
                j += 1
                if j == len(sub) // 2:
                    break
            a[i] = j
            if j == 0:
                i += 1
                continue
            k = 1
            while i+k < len(sub) and k+a[k] < j:
                a[i+k] = a[k]
                k += 1
            i += k
            j -= k
        ma = max(ma, max(a))
    print(ma)

    # a = [0 for _ in range(n)]
    # a[0] = n 
    # c = 0
    # for i in range(1, n):
    #     if i+a[i-c] < c+a[c]:
    #         a[i] = a[i-c]
    #     else:
    #         j = max(0, c+a[c]-i)
    #         while i+j < n and s[s] == s[i+j]:
    #             j += 1
    #         a[i] = j
    
    # print(a)

    # zz = [[0 for _ in range(n)] for _ in range(n)]

    # ans = [0 for _ in range(n)]
    # for k in range(n):
    #     # z = zz[k]
    #     z = [0 for _ in range(n)]
    #     sub = s[k:]
    #     for i in range(1, len(sub)):
    #         count = 0
    #         for j in range(len(sub)-i):
    #             if sub[j] == sub[i+j]:
    #                 count += 1
    #                 if count == n // 2:
    #                     break
    #             else:
    #                 break
    #         z[i] = count
    #     ans[k] = max(z)
    #     # zz[k] = z
    # print(max(ans))






if __name__ == "__main__":
    main()


### FIXED CODE ###

# 2019-11-18 17:34:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def main():
    n, s = sys.stdin.read().split()
    n = int(n)

    ans = 0
    i, j = 0, 1
    while j < n:
        t = s[i:j]
        if t in s[j:]:
            ans = max(ans, j - i)
            j += 1
        else:
            i += 1
    print(ans)
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
import heapq

def solve(H: int, W: int, s: "List[str]"):
    minScore = 10**16
    def isBlock(x,y):
        return s[y][x] == "#"
    first = isBlock(0,0)
    current = [(0,0,1 if first else 0,first)]
    def addNextIfCan(x,y,prevScore,prevBlock):
        if x >= W or y >= H:
            return
        c = isBlock(x,y)
        if c and not prevBlock:
            current.append((x,y,prevScore+1,c))
        else:
            current.append((x,y,prevScore,c))
    
    while len(current) > 0:
        n = current.pop()
        if n[0] == W - 1 and n[1] == H - 1:
            minScore = min(minScore,n[2])
        addNextIfCan(n[0]+1,n[1],n[2],n[3])
        addNextIfCan(n[0],n[1]+1,n[2],n[3])
    print(minScore)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(H)]  # type: "List[str]"
    solve(H, W, s)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import heapq
from collections import deque

def solve(H: int, W: int, s: "List[str]"):
    minScore = 10**16
    def isBlock(x,y):
        return s[y][x] == "#"
    first = isBlock(0,0)
    current = set([(0,0)])
    next = set()
    map = [[None for j in range(H)] for i in range(W)]
    map[0][0] = (1,True) if first else (0,False)
    def addNextIfCan(x,y,prevScore,prevBlock):
        if x >= W or y >= H:
            return
        c = isBlock(x,y)
        next.add((x,y))
        cScore = prevScore + 1 if c and not prevBlock else prevScore
        if map[x][y] == None:
            map[x][y] = (cScore,c)
        if map[x][y][0] > cScore:
            map[x][y] = (cScore,c)
        elif c and map[x][y][0] == cScore:
            map[x][y] = (cScore,c)
    while len(current) > 0:
        while len(current) > 0:
            n = current.pop()
            prevScore = map[n[0]][n[1]][0]
            prevBlock = map[n[0]][n[1]][1]
            addNextIfCan(n[0]+1,n[1],prevScore,prevBlock)
            addNextIfCan(n[0],n[1]+1,prevScore,prevBlock)
        current = next
        next = set()
    print(map[W-1][H-1][0])
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(H)]  # type: "List[str]"
    solve(H, W, s)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

memo = [0, abs(h[1]-h[0])]
def dp(n):
  for i in range(len(memo), n+1):
    costs = [memo[i-j]+abs(h[i]-h[i-j]) for j in range(1, min(i, K)+1)]
    memo.append(min(costs))
  return memo[n]
 
print(dp(N-1))

### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
c = [0]*N
for i in range(1, N):
    c[i] = min([c[j] + abs(h[i]-h[j]) for j in range(max(0, i-K), i)])
print(c[N-1])
### BUGGY CODE ###

import collections
n = int(input())
s = [0]*n
c = {}
ans = 0
for i in range(n):
	s[i] = input()
	c[i] = collections.Counter(list(s[i]))
for i in range(n-1):
	for j in range(i+1,n):
		if c[i] == c[j]:
			ans += 1
print(ans)

### FIXED CODE ###

import collections
import math
n = int(input())
s = [0]*n
T = [0]*n
L = [0]*n
ans = 0
for i in range(n):
	s[i] = input()
	T[i] = sorted(list(s[i]))
	L[i] = ''.join(T[i])
D = collections.Counter(L)
for i in D.values():
	ans += i*(i-1)/2
print(int(ans))
### BUGGY CODE ###

from collections import deque
from itertools import product


def read():
    H, W = list(map(int, input().split()))
    S = ''
    S += ('#' * (W+2))
    for h in range(H):
        buf = input()
        S += '#' + buf + '#'
    S += ('#' * (W+2))
    return H, W, S


def bfs(yx, H, W, S):
    dirs = (1, W+2, -1, -W-2)
    visited = [0] * ((H+2) * (W+2))
    q = deque()
    q.append((yx, 0))
    max_depth = 0
    while len(q) > 0:
        yx, depth = q.popleft()
        visited[yx] = 1
        max_depth = max(max_depth, depth)
        for dyx in dirs:
            nyx = yx + dyx
            if S[nyx] == '.' and visited[nyx] == 0:
                q.append((nyx, depth+1))
    return max_depth


def solve(H, W, S):
    dist_max = 0
    for yx in range((H+2) * (W+2)):
        if S[yx] == '.':
            d = bfs(yx, H, W, S)
            dist_max = max(d, dist_max)
    return dist_max


if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))


### FIXED CODE ###

from collections import deque


def bfs(y, x, H, W, S):
    dirs = [(-1, 0), (0, -1), (1, 0), (0, 1)]
    depth = [[-1] * (W+2) for h in range(H+2)]
    q = deque()
    q.append((y, x))
    depth[y][x] = 0
    max_depth = 0
    while q:
        y, x = q.popleft()
        max_depth = max(max_depth, depth[y][x])
        for dy, dx in dirs:
            ny, nx = y + dy, x + dx
            if S[ny][nx] == '.' and depth[ny][nx] == -1:
                depth[ny][nx] = depth[y][x] + 1
                q.append((ny, nx))
    return max_depth


def solve():
    H, W = map(int, input().split())
    S = list()
    S.append(['#'] * (W+2))
    for _ in range(H):
        buf = input()
        S.append(list('#' + buf + '#'))
    S.append(['#'] * (W+2))

    dist_max = 0
    for y in range(H):
        for x in range(W):
            if S[y+1][x+1] == '.':
                d = bfs(y+1, x+1, H, W, S)
                dist_max = max(d, dist_max)
    print(dist_max)


if __name__ == '__main__':
    solve()
### BUGGY CODE ###

#from scipy.special import comb
from scipy.misc import comb
# a = comb(n, r)
# a = comb(n, r, exact=True)

n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
a = []
a.append(l[0])
cnt = 1
numMap = {}

for i in range(1, n):
    if l[i] == l[i-1]:
        cnt += 1
    else:
        numMap[l[i-1]] = cnt
        a.append(l[i])
        cnt = 1

numMap[l[-1]] = cnt

for i, val in numMap.items():
    #print(i, val)
    temp = comb(val, 3, exact=True)
    ans += temp

# print(a)
# print(numMap)
# print(ans)

for i in range(len(a)):
    for j in range(i+1, len(a)):
        length = a[i] + a[j]

        for k in range(j+1, len(a)):
            if a[k] >= length:
                break
            else:
                ans += numMap[a[i]] * numMap[a[j]] * numMap[a[k]]

print(ans)

### FIXED CODE ###

import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
biSet = set()


for i in range(n):
    for j in range(i+1, n):
        length = l[i] + l[j]

        index = bisect.bisect_left(l[j+1:], length)
        #print(index)
        if index > 0:
            ans += index


print(ans)
### BUGGY CODE ###

import math
import itertools
 
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)

ans = 0
for i in range(n-2):
    x = a[i]
    for j in range(i+1,n-1):
        y = a[j]
        for k in range(j+1,n):
            if y+a[k] > x:
                ans += 1
            else:
                break

print(ans) 
            

### FIXED CODE ###

import bisect
 
n = int(input())
a = list(map(int,input().split()))
a.sort()

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        index = bisect.bisect_left(a,a[i]+a[j])
        ans += index-j-1
        
print(ans)
### BUGGY CODE ###

N = int(input())
a = list(map(int, input().split()))
nm = 1
ans = 0
while a:
    x = a.pop(0)
    if x == nm:
        nm += 1
    else:
        ans += 1

if ans == N:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
nm = 1
ans = 0
for i in range(N):
    x = a[i]
    if x == nm:
        nm += 1
    else:
        ans += 1

if ans == N:
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

n,k=map(int,input().split())
p=[]
p=list(map(int,input().split()))

ans=0
for i in range(n-k+1):
    aa=sum(p[i:i+k])
    ans=max(ans,aa)
aaaa=(ans+k)/2
print(aaaa)

### FIXED CODE ###

n,k=map(int,input().split())
p=[]
p=list(map(int,input().split()))

ans=sum(p[0:k])
aa=sum(p[0:k])
for i in range(1,n-k+1):
    aa=aa-p[i-1]+p[i+k-1]
    ans=max(ans,aa)

aaaa=(ans+k)/2
print(aaaa)
### BUGGY CODE ###

def main():
    H, N, *AB = map(int, open(0).read().split())
    dp = [-1]*(H + 1)
    dp[0] = 0
    for i in range(N):
        a = AB[2 * i + 0]
        b = AB[2 * i + 1]
        for i in range(H + 1):
            d = dp[i] + b
            if dp[i] != -1:
                j = i + a
                j = min(j, H)
                if dp[j] == -1 or d < dp[j]:
                    dp[j] = d
    print(dp[H])

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    H, N, *AB = map(int, open(0).read().split())
    dp = [-1]*(H + 1)
    dp[0] = 0
    for i in range(N):
        a = AB[2 * i + 0]
        b = AB[2 * i + 1]
        for i in range(H + 1):
            d = dp[i] + b
            if dp[i] != -1:
                j = i + a
                j = min(j, H)
                if dp[j] == -1 or d < dp[j]:
                    dp[j] = d
    print(dp[H])

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import itertools
x = int(input())
if x>=2000:
  print(1)
  exit()
else:
  l = list(range(20))
  for nums in itertools.product(l,repeat=6):
    if nums[0]*100+nums[1]*101+nums[2]*102+nums[3]*103+nums[4]*104+nums[5]*105==x:
      print(1)
      exit()
print(0)

### FIXED CODE ###

x = int(input())

c = x//100

if c*100<=x and x<=c*105:
  print(1)
else:
  print(0)
### BUGGY CODE ###

import sys
import math

stdin = sys.stdin

nm = lambda: map(int, stdin.readline().split())

a, b = nm()

n = math.gcd(a,b)

count = 1 # 1
for i in range(2, n+1):
    if n%i ==0:
        count +=1
        while n%i == 0:
            n = n/i
    if n ==1:
        break

print(count)

### FIXED CODE ###

import sys
import math

stdin = sys.stdin

nm = lambda: map(int, stdin.readline().split())

a, b = nm()

n = math.gcd(a,b)

count = 1 # 1
for i in range(2, int(n**(1/2))+1):
    if n%i ==0:
        count +=1
        while n%i == 0:
            n = n/i
    if n ==1:
        break
if n != 1:
    count += 1

print(count)
### BUGGY CODE ###

if __name__ == '__main__':

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

    cnt = 0
    ans = 0

    while cnt < n:
        tmp1 = min(a,n-cnt)
        ans += tmp1
        cnt += tmp1 + b
    print(ans)

### FIXED CODE ###

if __name__ == '__main__':

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

    tmp1 = (n // (a + b)) * a
    if tmp1 == 0:
        tmp2 = min(n,a)
    else:
        tmp2 = n % (a + b)
        tmp2 = min(a,tmp2)
    print(tmp1+tmp2)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)

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

if abs(N-M) > 1:
    print(0)
    exit()

def frac(n):
    if n == 1: return 1
    return n * frac(n-1)

n_frac = frac(N)
m_frac = frac(M)
if N-M == 0:
    print((n_frac*m_frac)*2)
else:
    print(n_frac*m_frac)





### FIXED CODE ###

from math import factorial

N,M = map(int, input().split())
mod = 10 ** 9 + 7

if abs(N-M) > 1:
    print(0)
    exit()

n_frac = factorial(N) 
m_frac = n_frac
if N-M == 0:
    print((n_frac*m_frac)*2%mod)
else:
    if N > M:
        m_frac //= N
    else:
        m_frac *=  M
    print(n_frac*m_frac%mod)