Harryxun/stf_run huggingface dataset:
#! /usr/bin/python3
# Between a and b ...

"""
非負の整数 a, b (a≤b) と、正の整数 x が与えられます。
a 以上 b 以下の整数のうち、x で割り切れるものの個数を求めてください。
"""

test_mode = False

a, b, x = map(int, input().split())
counter = 0
limit = b // x

for n in range(1, limit+1):
    if a <= x*n <= b:
        counter += 1

print(counter)


### FIXED CODE ###

#! /usr/bin/python3
# AtCoder *** Contest

_, s, _ = map(str, input().split())

print('A{}C'.format(s[0]))
import sys
import operator

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

a = [int(x) for x in sys.stdin.readline().rstrip().split()]
a.sort()

cards = [[int(x) for x in sys.stdin.readline().rstrip().split()] for _ in range(m)]
cards.sort(key=operator.itemgetter(1), reverse=True)

a_idx = 0
a_len = len(a)

for b, c in cards:
    if c <= a[a_idx] or a_idx == a_len:
        break
    for b_idx in range(b):
        if a_idx == a_len or c <= a[a_idx]:
            break
        else:
            a[a_idx] = c
            a_idx += 1

print(sum(a))


### FIXED CODE ###

import sys
import operator

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

a = [int(x) for x in sys.stdin.readline().rstrip().split()]
a.sort()

cards = [[int(x) for x in sys.stdin.readline().rstrip().split()] for _ in range(m)]
cards.sort(key=operator.itemgetter(1), reverse=True)

a_idx = 0
a_len = len(a)

for i in range(len(cards)):
    for j in range(cards[i][0]):
        if a_idx == a_len or a[a_idx] >= cards[i][1]:
            break
        else:
            a[a_idx] = cards[i][1]
            a_idx += 1

print(sum(a))
n = int(input())
m = [int(c) for c in n]
print("No") if n%sum(m) else print("Yes")

### FIXED CODE ###

n = input()
m = [int(c) for c in n]
print("No") if int(n)%sum(m) else print("Yes")
N,M=map(int,input().split())
H=list(map(int,input().split()))
P=[]
for i in range(M):
    P.append(list(map(int,input().split())))

ans=[]

for i in range(M):
  if H[P[i][0]-1]>H[P[i][1]-1]:
    ans.append(H[P[i][0]])
  elif H[P[i][0]-1]<H[P[i][1]-1]:
    ans.append(H[P[i][1]-1])
  else:
    continue
    
list=[]

for j in range(M): 
    list+=P[j]

print(len(set(ans))+N-len(set(list)))

### FIXED CODE ###

n, m = map(int, input().split())
h = list(map(int, input().split()))
l = []
for _ in range(m):
  l.append(list(map(int, input().split())))

bad = []
for i in range(m):
  if h[l[i][0] - 1] > h[l[i][1] - 1]:
    bad.append(l[i][1])
  elif h[l[i][0] - 1] < h[l[i][1] - 1]:
    bad.append(l[i][0])
  else:
    bad.append(l[i][0])
    bad.append(l[i][1])

print(n - len(set(bad)))
s = input()
n = len(s)
w = "keyence"

for i in range(7):
    if S[:i] == w[:i] and s[n-7+i:] == w[i:]:
        print("YES")
        exit()

print("NO")

### FIXED CODE ###

s = input()
n = len(s)
w = "keyence"
 
for i in range(7):
    if s[:i] == w[:i] and s[n-7+i:] == w[i:]:
        print("YES")
        exit()

print("NO")
x = int(input())

y = int(input())/2

sum = x + y

print(sum)

### FIXED CODE ###

x,y = map(int, input().split())

print(int(x + y/2))
import sys
for d in sys.stdin:
  print sum([d*x*x for x in range(d,600,d)])

### FIXED CODE ###

import sys
for d in map(int, sys.stdin):
  print sum([d*x*x for x in range(d,600,d)])
TF=1
if len(S)%2==0 and len(S)>=2:
    for i in range(len(S)/2):
        if S[2*i]!='h' or S[2*i+1]!='i':
            TF=0
        else:
            TF*=1
else:
    TF=0

if TF==0:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

S=input()
if S in ['hi','hihi','hihihi','hihihihi','hihihihihi']:
    print('Yes')
else:
    print('No')
n = int(input())
ans = 0
for i in range(1, n + 1):
    if 10 <= i < 100 or 1000 <= i < 10000:
        continue
    else:
        ans += 1
print(ans)

### FIXED CODE ###

a, b, c = map(int,input().split())
print(b + c - a if b + c - a > 0 else 0)
print(x**3)

### FIXED CODE ###

x=eval(input())
print(x**3)
H = input()
W = input()
H = int(H)
W = int(W)
if H % == 0:
	N = H * W / 2 
else:
  	N = int (H * W) / 2 + 1

  

  

### FIXED CODE ###

H , W = map(int, input() .split())

if W == 1:
    N = 1

elif H == 1:
    N = 1

else:   
    if H % 2 ==0:
        N = H * W / 2
        
            
    elif H % 2 ==1:
        if W % 2 ==0:
            N = H * W / 2
        else:
            N = int(H * W / 2) + 1

print(int(N))
N,K=map(int,input().split())
class SegTree:
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセット
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築していく
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])
    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        res = self.ide_ele
        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res
ide_ele = 0
def segfunc(x,y):
    return max(x,y)
seg=SegTree([0]*(N+4),segfunc,ide_ele)
for i in range(N):
    a=int(input())
    seg.update(a,seg.query(max(0,a-K),min(N,a+K+1))+1)
print(seg.query(0,N+3))


### FIXED CODE ###

N,K=map(int,input().split())
class SegTree:
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])
    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        res = self.ide_ele
        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res
ide_ele = 0
b=[int(input()) for _ in range(N)]
c=max(b)
def segfunc(x,y):
    return max(x,y)
seg=SegTree([0]*(c+6),segfunc,ide_ele)
for i in range(N):
    a=b[i]
    seg.update(a,seg.query(max(0,a-K),min(c+2,a+K+1))+1)
print(seg.query(0,c+3))
n = int(input())
P = list(map(int,input().split()))

i=0
while 1:
    j=i+1
    while 1:
        if P[i]<P[j] :
            P.remove(P[j])
        if j>=len(P)-1:
            break
        j+=1
    if i>=len(P)-2:
        break
    i+=1

print(len(P))


### FIXED CODE ###

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

c=1
t=P[0]
for i in range(len(P)-1):
    if t>P[i+1]:
        c+=1
        t=P[i+1]

print(c)
import math
n = int(input())
s = int(input())

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n%b

if s == n:
    print (n+1)
    exit()

if n == 1:
    print (-1)
    exit()

for i in range(2, int(math.sqrt(n))+2):
    if f(i, n) == s:
        print (i)
        exit()

for p in range(1, int(math.sqrt(n))+2):
    b = (n-s)//p + 1
    if f(b, n) == s:
        print (b)
        exit()
print (-1)

### FIXED CODE ###

import math
import sys
sys.setrecursionlimit(10**5)
n = int(input())
s = int(input())

if n < s:
    print (-1)
    exit()

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n%b

if s == n:
    print (n+1)
    exit()

if n == 1:
    print (-1)
    exit()

for i in range(2, int(math.sqrt(n))+2):
    if f(i, n) == s:
        print (i)
        exit()

for p in range(int(math.sqrt(n))+1, 0, -1):
    b = (n-s)//p + 1
    if b != 1 and f(b, n) == s:
        print (b)
        exit()
print (-1)

# for i in range(2, 100):
#     print (i, f(i,100))
import sys

bingo = [ list(map(int, input().split())) for _ in range(3) ]
t_or_f = [ [False]*3 for _ in range(3) ]

nums = [ r[i]for i in range(3) for r in bingo ]

n = int(input())
for _ in range(n):
  i = int(input())

  if i in nums:
    for x in range(3):
      for y in range(3):
        if bingo[x][y] == i:
          t_or_f[x][y] = True
          break


is_bingo = False
if t_or_f[0][0] and t_or_f[1][1] and t_or_f[2][2]:
  is_bingo = True
  print('Yes')
elif t_or_f[0][2] and t_or_f[1][1] and t_or_f[2][0]:
  is_bingo = True
  print('Yes')
else:
  for i in range(3):
    if t_or_f[i][i] and t_or_f[i+1][i+1] and t_or_f[i+2][i+2]:
      is_bingo = True
      print('Yes')
      sys.exit()

if not is_bingo: print('No')



### FIXED CODE ###


bingo = [ list(map(int, input().split())) for _ in range(3) ]
t_or_f = [ [False]*3 for _ in range(3) ]

nums = [ r[i]for i in range(3) for r in bingo ]

n = int(input())
appear = [ int(input()) for _ in range(n) ]

for x in range(3):
  for y in range(3):
    if bingo[x][y] in appear:
      t_or_f[x][y] = True

is_bingo = False
if t_or_f[0][0] and t_or_f[1][1] and t_or_f[2][2]:
  is_bingo = True
elif t_or_f[0][2] and t_or_f[1][1] and t_or_f[2][0]:
  is_bingo = True
else:
  for i in range(3):
    if t_or_f[i][0] and t_or_f[i][1] and t_or_f[i][2]: is_bingo = True
    if t_or_f[0][i] and t_or_f[1][i] and t_or_f[2][i]: is_bingo = True

if is_bingo:
  print('Yes')
else:
  print('No')
a,b=map(int,input().split())
s,t,u=map(input().split())
if u==s:
    print(a-1,b)
if u==t:
    print(a,b-1)

### FIXED CODE ###

s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if u==s:
    print(a-1,b)
if u==t:
    print(a,b-1)
import sys
import resource

sys.setrecursionlimit(10 ** 9)
resource.setrlimit(resource.RLIMIT_STACK, (-1, -1))

k = int(input())

ary = [1, 2, 3, 4, 5, 6, 7, 8, 9]

def ans(j, nums):
    nums[j] += 1
    pre = nums[j]
    for i in range(j + 1, len(nums)):
        if pre > 0:
            nums[i] = pre - 1
            pre = nums[i]
        else:
            nums[i] = pre
    return int(''.join(map(str, nums)))

def lunlun(n):
    if n <= 9:
        return ary[n - 1]
    l = lunlun(n - 1)
    nums = list(map(int, list(str(l))))
    first = len(nums) - 1
    last = 0
    for i in range(len(nums)):
        j = len(nums) - i - 1
        c = nums[j] + 1
        # 桁数が変わらないとき
        if j == first:
            # 1桁目
            if nums[j] < 9 and abs(nums[j - 1] - c) <= 1:
                nums[j] += 1
                return int(''.join(map(str, nums)))
        elif j == last:
            # 最終桁
            if nums[j] < 9 and abs(nums[j + 1] - c) <= 1:
                return ans(j, nums)
        elif j != first and j != last:
            # 間の桁
            if nums[j] < 9 and abs(nums[j - 1] - c) <= 1 and abs(nums[j + 1] - c) <= 1:
                return ans(j, nums)

    # 桁が繰り上がるとき
    return int('1' + ''.join(['0'] * len(nums)))

print(lunlun(k))


### FIXED CODE ###

import sys
# import resource

sys.setrecursionlimit(10 ** 9)
# resource.setrlimit(resource.RLIMIT_STACK, ((2 ** 7) * 1000 * 1000, -1))

k = int(input())

ary = [1, 2, 3, 4, 5, 6, 7, 8, 9]

def ans(j, nums):
    nums[j] += 1
    pre = nums[j]
    for i in range(j + 1, len(nums)):
        if pre > 0:
            nums[i] = pre - 1
            pre = nums[i]
        else:
            nums[i] = pre
    return int(''.join(map(str, nums)))

def lunlun(n):
    if n <= 9:
        return ary[n - 1]
    l = lunlun(n - 1)
    nums = list(map(int, list(str(l))))
    first = len(nums) - 1
    last = 0
    for i in range(len(nums)):
        j = len(nums) - i - 1
        c = nums[j] + 1
        # 桁数が変わらないとき
        if j == first:
            # 1桁目
            if nums[j] < 9 and abs(nums[j - 1] - c) <= 1:
                nums[j] += 1
                return int(''.join(map(str, nums)))
        elif j == last:
            # 最終桁
            if nums[j] < 9 and abs(nums[j + 1] - c) <= 1:
                return ans(j, nums)
        elif j != first and j != last:
            # 間の桁
            if nums[j] < 9 and abs(nums[j - 1] - c) <= 1 and abs(nums[j + 1] - c) <= 1:
                return ans(j, nums)

    # 桁が繰り上がるとき
    return int('1' + ''.join(['0'] * len(nums)))

print(lunlun(k))
s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)+1
minn_sen = int(maney / 1000 )+1
minn_go  = int(maney / 5000) +1

for man in range(0,minn_man):
	for go in range(0,minn_go):
		for sen in range(0,minn_sen):
			if man+go+sen == maisuu:
				if man*10000+ go*5000 + sen*1000 == maney:
					print(str(man)+","+str(go)+","+str(sen))
					flg=False
if flg:
	print('-1,-1,-1')


### FIXED CODE ###

s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])
 
minn_man = int(maney/10000)+1
minn_go  = int(maney / 5000) +1
for man in range(0,minn_man):
	for go in range(0,minn_go):
		# for sen in range(0,minn_sen):
		sen = maisuu - go - man
		if sen>=0:
			if man*10000+ go*5000 + sen*1000 == maney:
				print(str(man)+" "+str(go)+" "+str(sen))
				exit()
print('-1 -1 -1')
from collections import deque
que=deque([range(1,10)])
k=int(input())
count=0
while count!=k:
  a=que.popleft
  count+=1
  if a%10 == 1:
    que.append([10*a+1,10*a+2])
  elif a%10==9:
    que.append([10*a+8,10*a+9])
  else:
    b=a*10+(a%10)-1
    que.append([b,b+1,b+2])
print(count)

### FIXED CODE ###

from collections import deque
que=deque([i for i in range(1,10)])
k=int(input())
count=0
while count!=k:
  a=que.popleft()
  count+=1
  if a%10==9:
    que.extend([10*a+8,10*a+9])
  elif a%10==0:
    que.extend([10*a,10*a+1])
  else:
    b=a*10+(a%10)-1
    que.extend([b,b+1,b+2])
print(a)
import math
a, b = input().split()
print(math.floor(a*b))

### FIXED CODE ###

import math
A, B = map(str, input().split())
A = int(A)
B = list(B)
del B[1]
B = ''.join(B)
B_int = int(B)
print((A * B_int) // 100)
n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

### FIXED CODE ###

n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m == 10000:
    print('TLE')
else:
    print(m)
import collections
import math

n = int(input())
B = [1,2,6,10,15,21,28,36,45,55]
ans = 0

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
if is_prime(n) == True:
  print(1)
  exit()

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
c = collections.Counter(prime_factorize(840))  
C = c.values()
for i in range(len(C)):
  for j in range(len(B)):
    if C[i] < B[j]:
      ans += j+1
      break

print(ans)


### FIXED CODE ###

import collections
import math

n = int(input())
B = [1,3,6,10,15,21,28,36,45,55,66,78,91,105]
ans = 0

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
if is_prime(n) == True:
  print(1)
  exit()

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(n))  
for v in c.values():
  for j in range(len(B)):
    if v < B[j]:
      ans += j
      break
      
print(ans)
h,w,d=[int(i) for i in input().split()]
p=[[-1,-1] for i in range(h*w+1) ]
a=[]
for i in range(h):
  a0 =[int(i0) for i0 in input().split()]
  a.append(a0)
  for j in range(w):
    p[a0[j]]=[i,j]

n=int(input())

import sys
sys.setrecursionlimit(100000)
from functools import lru_cache

@lru_cache(maxsize=3000)
def dist_d(s,g,d,y0,x0):
  if s==g:
    return 0
  else:
    s = s+d
    y,x = p[s]
    return abs(x-x0)+abs(y-y0) + dist_d(s,g,d,y,x)
  
for i in range(n):
  z=0
  s,g=[int(i0) for i0 in input().split()]
  y0,x0=p[s]
  print(dist_d(s,g,d,y0,x0))


### FIXED CODE ###

I=lambda:map(int,input().split())
h,w,d=I()
H={}
W={}
for i in range(1,h+1):
  for j,k in enumerate(I(),1):
    H[k],W[k]=i,j
x=1+h*w
s=[0 for _ in range(x)]
for i in range(d+1,x):
  s[i]=s[i-d]+abs(H[i]-H[i-d])+abs(W[i]-W[i-d])

for _ in range(int(input())):
  a,b=I()
  print(s[b]-s[a])
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
print(list[index-1])


### FIXED CODE ###

list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 
        2, 2, 5, 4, 1, 4, 1, 51]

index = input()
index = int(index)
print(list[index-1])
X = int(input())
pow5 = [pow(i,5) for range(-150,150)]
for a in range(-150,150):
  for b in range(150,150):
    if pow5[a+150]+pow[b+150] ==x:
      print(a,b)
      break

### FIXED CODE ###

import math
X = int(input())


def fif_root(arg):
    def root(x):
        return math.floor(math.pow(x,1/5)*pow(10,10))/pow(10,10)
    return list(map(lambda x: root(x), arg))

def check_integer(arg):
    return list(map(lambda x: x.is_integer(), arg))

a = 0
while (A:= math.pow(a, 5))-math.pow(a-1, 5) <= X:
    #a,-aの時それぞれの5乗根を計算する。
    root = fif_root([abs(X-A), X+A])
    if True in (c := check_integer(root)):
        idx = c.index(True)
        b = int(root[idx])
        if idx == 1:
            a, b = -a, -b
        else:
            if X - A >= 0:
                b = -b
        print(a, b)
        break
    a += 1
import math
a,b,h,m=list(map(int, input().split()))


th_a = 360/12 * h + 360/12*m/60
th_b = 360*m/60
print(th_a)
print(th_b)
ab_th = abs(th_a - th_b)
if ab_th >= 180:
    ab_th = 360 - ab_th

print(math.sqrt(a*a + b*b -2*a*b*math.cos(math.radians(ab_th))))

### FIXED CODE ###

x = input()
l = [2,4,5,7,9]
i = [0,1,6,8]
if int(x[-1]) in l:
    print("hon")
elif int(x[-1]) in i:
    print("pon")
elif x[-1] == "3":
    print("bon")
N = int(input())
ans = ''
for i in range(1, 99):
 if N <= 26 ** i:
 N -= 1
 for j in range(i):
 ans += chr(ord('a') + N % 26)
 N //= 26
 break
 else:
 N -= 26 ** i
 print(ans[::-1]) # reversed

### FIXED CODE ###

N=int(input())
ans=''
while N>0 :
  N-=1
  ans += chr(ord('a')+N%26)
  N//=26
print(ans[::-1])
class UnionFind:
    __slots__ = ["_data_size", "_roots"]
 
    def __init__(self, data_size: int) -> None:
        self._data_size = data_size
        self._roots = [-1] * data_size
 
    def __getitem__(self, x: int) -> int:
        while self._roots[x] >= 0:
            x = self._roots[x]
        return x
 
    def is_connected(self, x: int, y: int) -> bool:
        return self[x] == self[y]
 
    def unite(self, x: int, y: int) -> None:
        x, y = self[x], self[y]
        if x == y:
            return
        if self._roots[x] > self._roots[y]:
            x, y = y, x
        self._roots[x] += self._roots[y]
        self._roots[y] = x
 
 
import sys
 
readline = sys.stdin.readline
 
N, Q = map(int, readline().split())
tree = UnionFind(N)
res = []
ans=0
for _ in range(Q):
  u, v = map(int, readline().split())
  if not tree.unite(u, v):
    res.append(int(tree.is_connected(u, v)))
    ans+=1
print(ans)


### FIXED CODE ###

class UnionFind:
    __slots__ = ["_data_size", "_roots"]
 
    def __init__(self, data_size: int) -> None:
        self._data_size = data_size
        self._roots = [-1] * data_size
 
    def __getitem__(self, x: int) -> int:
        while self._roots[x] >= 0:
            x = self._roots[x]
        return x
 
    def is_connected(self, x: int, y: int) -> bool:
        return self[x] == self[y]
 
    def unite(self, x: int, y: int) -> None:
        x, y = self[x], self[y]
        if x == y:
            return
        if self._roots[x] > self._roots[y]:
            x, y = y, x
        self._roots[x] += self._roots[y]
        self._roots[y] = x
 
 
import sys
 
readline = sys.stdin.readline
 
N, Q = map(int, readline().split())
tree = UnionFind(N)
res = []
ans=0
for _ in range(Q):
  u, v = map(int, readline().split())
  tree.unite(u-1, v-1)
for u in range(1,N):
  if not tree.is_connected(u, 0):
      ans+=1
      tree.unite(u, 0)
print(ans)
from math import sqrt

Q = int(input())

for i in range(Q):
    A,B = map(int, input().split())
    m=A*B
    if A==B or B==A+1:
        ans = 2*A-2
    elif A==B+1
        ans = 2*B-2

    C = int(sqrt(m))
    if C*C==m:
        C=C-1

    if C*(C+1)<m:
        ans = 2*C-1
    else:
            ans = 2*C-2
    print(ans)

### FIXED CODE ###

from math import sqrt

Q = int(input())

for i in range(Q):
    A,B = map(int, input().split())
    m=A*B

    C = int(sqrt(m))
    if C*C==m:
        C=C-1

    if A==B or B==A+1:
        ans = 2*A-2
    elif A==B+1:
        ans = 2*B-2
    elif C*(C+1)<m:
        ans = 2*C-1
    else:
        ans = 2*C-2
    print(ans)
[x,y]=list(map(int,input().split()))
if ((x%3)+(y%3))%3!=0:
	print(0)
else:
	n=int((x+y)/3)
	r=y-n
	if r<0 or r>n:
		print(0)
	else:
		if r>n-r:
			r=n-r
		mod=1000000007
		kaijo=[1]
		for i in range(1,n+1):
			kaijo.append(kaijo[-1]*i) #これで、kaijo[i]=i!となる。
		gyakugen=[pow(kaijo[n-r],mod-2,mod)]
		for i in reversed(range(1,n-r)):
			gyakugen.append(gyakugen[-1]*i%mod) #これで、gyakugen[i]=n-r-iの逆元となる
		kotae=kaijo[n]*gyakugen[0]*gyakugen[n-2*r]

		print(kotae)

### FIXED CODE ###

[x,y]=list(map(int,input().split()))
if ((x%3)+(y%3))%3!=0:
	print(0)
else:
	n=int((x+y)/3)
	r=y-n
	if r<0 or r>n:
		print(0)
	else:
		if r>n-r:
			r=n-r
		mod=1000000007
		kaijo=[1]
		for i in range(1,n+1):
			kaijo.append(kaijo[-1]*i%mod) #これで、kaijo[i]=i!となる。
		gyakugen=[pow(kaijo[n-r],mod-2,mod)]
		for i in reversed(range(1,n-r+1)):
			gyakugen.append(gyakugen[-1]*i%mod) #これで、gyakugen[i]=n-r-iの逆元となる
		kotae=kaijo[n]*gyakugen[0]*gyakugen[n-2*r]%mod

		print(kotae)
n=int(input())
lst=[]
h=[1000000000000]*(n+1)
for i in range(n):
  lst.append(list(map(int,input().split())))  
for i in range(1,n+1):
  for j in range(3):
    for k in range(3):
      if j==k:
        if h[i]>h[i-1][j]+lst[i-1][k]:
          h[i]=h[i-1][j]+lst[i-1][k]
print(h[n])

### FIXED CODE ###

n=int(input())
lst=[]
for i in range(n):
  a,b,c=map(int,input().split())
  lst.append([a,b,c])
C=[]
for i in range(n):
    C.append([float('inf')]*3)
C[0][0]=lst[0][0]
C[0][1]=lst[0][1]
C[0][2]=lst[0][2]
D=[0,1,2]
for i in range(n-1):
  for j in [0,1,2]:
    del D[j]
    C[i+1][j]=max(C[i][D[0]]+lst[i+1][j],C[i][D[1]]+lst[i+1][j])
    D=[0,1,2]
print(max(C[n-1]))