Harryxun/stf_run huggingface dataset:
q = int(input())
ab = [tuple(map(int, input().split())) for _ in range(q)]



for a, b in ab:
    if a > b:
        large = a
        small = b
    elif a < b:
        large = b
        small = a
    else:
        print(2* a - 2)
        sys.exit()


    # 最大のxを探す
    low_x = 0 
    upper_x = large - small + 1

    while upper_x- low_x> 1:
        mid_x = (low_x + upper_x ) //2

        # a * bを満たすかチェック
        is_ok = True
        for i in range(low_x, upper_x + 1):
            if i< 0 and b -a < i:
                continue
            if (small + i) * (small + mid_x - i) >= large* small:
                is_ok = False
                break

        if is_ok:
            low_x = mid_x
            x = mid_x
        else:
            upper_x = mid_x
            x= mid_x


    print(2 * small -2  + low_x)



### FIXED CODE ###

q = int(input())
ab = [tuple(map(int, input().split())) for _ in range(q)]



for a, b in ab:
    if a > b:
        large = a
        small = b
    elif a < b:
        large = b
        small = a
    else:
        print(2* a - 2)
        continue


    # 最大のxを探す
    low_x = 0 
    upper_x = large - small + 1

    while upper_x- low_x> 1:
        mid_x = (low_x + upper_x ) //2

        # a * bを満たすかチェック
        is_ok = True
        for i in range(mid_x // 2 -2, mid_x //2 +3) :
            if i< 0 and b -a < i:
                continue
            if (small + i) * (small + mid_x - i) >= large* small:
                is_ok = False
                break

        if is_ok:
            low_x = mid_x
            x = mid_x
        else:
            upper_x = mid_x
            x= mid_x


    print(2 * small -2  + low_x)
n = int(input())
s1 = input()
s2 = input()
ans = ""
for i in range(n):
  ans += s1[i]+s2[i]
print(ans)

### FIXED CODE ###

n = int(input())
s1,s2 = map(str,input().split())

s = ""
#a,b = map(int,input())
#L = list(map(int,input().split()))
for i in range(n):
    s += s1[i]+s2[i]
print(s)
import string
az = list(string.ascii_lowercase)
li = [0 for a in range(len(az))]

while True:
    a = raw_input()
    try:
        if a != '':
            for b in list(a):
                if b.lower() in az:
                    tmp = az.index(b.lower())
                    li[tmp] = li[tmp] + 1
    except:
        break

for c in range(len(az)):
    print az[c] + ' : ' + str(li[c])

### FIXED CODE ###

import string
az = list(string.ascii_lowercase)
li = [0 for a in range(len(az))]

while True:
    try:
        a = raw_input()
        for b in list(a):
            if b.lower() in az:
                tmp = az.index(b.lower())
                li[tmp] = li[tmp] + 1
    except:
        break

for c in range(len(az)):
    print az[c] + ' : ' + str(li[c])
k, n = map(int,input().split())
a = list(map(int,input().split()))

ans = 10**6 + 1
for i in range(n):
    ans = min(a[-1] - a[i])
    a.append(a[i]+k)
print(ans)

### FIXED CODE ###

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

ans = 10**6 + 1
for i in range(n):
    ans = min(ans, a[-1] - a[i])
    a.append(a[i]+k)
print(ans)
N, M = (int(x) for x in input().split())
KA = [[int(x) for x in l] for l in [input().split() for i in range(N)]]
[x.pop(0) for x in KA]
x = []
for s in KA:
  x.extend(s)
c = 0
for i in range(1, M + 1):
  c = c + (1 if x.count(i) == N else 0)
print(c)

### FIXED CODE ###

A, B = (int(x) for x in input().split())
if B % A == 0:
  print(A + B)
else:
  print(B - A)
s = char(input())
if s=="ABC":
    print("ARC")
else:
    print("ABC")

### FIXED CODE ###

s = input()
if s=="ABC":
    print("ARC")
else:
    print("ABC")
S = input()
ans = 0
i = 0
while i < len(S)-3:
    for j in range(i+4, len(S)+1):
        if int(S[i:j]) % 2019 == 0:
            ans += 1
            print(S[i:j])
            i += j-5
    i += 1
print(ans)

### FIXED CODE ###

s = input()[::-1]
length = len(s)
a = [0] * length
d = [0] * length
ans = [0] * 2019
x = 10

a[0] = int(s[0])
d[0] = a[0]
ans[d[0]] += 1

for i in range(1, length):
    a[i] = int(s[i]) * x % 2019
    d[i] = (d[i-1] + a[i]) % 2019
    ans[d[i]] += 1
    x = x * 10 % 2019

ans_c = [i for i in ans if i != 0]

print(int(sum([ans_c[i] * (ans_c[i]-1) for i in range(len(ans_c))]) / 2) + ans[0])
import sympy
N = int(input())
A = [int(i) for i in input().split()]
ans = [x*2]

x = sympy.Symbol('x')
s = x
for i in range(1, N):
    s = A[i-1]-s
    ans.append(s*2)
    
sol = sympy.solve(A[N-1]-s-x)[0]
for i in range(N):
    ans[i] = str(ans[i].subs(x, sol))
print(' '.join(ans))

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
s = 0

for i in range(N):
    s = A[i]-s
    
s = s//2
ans = [s*2]
for i in range(1,N):
    s = A[i-1] - s
    ans.append(s*2)
    
for i in range(N):
    print(ans[i], end = " ")
p,q,r=map(int,input().split())
if p>=q and p>r:
    print(q+r)
if q>=r and q>p:
    print(p+r)
if r>=p and r>q:
    print(q+p)
if r==p and p==q:
    print(q+p)

### 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)
n,k=map(int,input().split())
edge=[]
mod=10**9+7
for i in range(n-1):
    a,b=map(int,input().split())
    edge.append([a-1,b-1])
root=[[] for i in range(n)]
for [a,b] in edge:
    root[a].append(b)
    root[b].append(a)
#print(root)
def perm(k,n):
    x=1
    for i in range(k,k-n,-1):
        x=x*i%mod
    return x
def dfs(node,depth,prev): 
    l=len(root[node])
    d=depth
    if l==1 and root[node][0]==prev:
        return 1
    if depth>1:
        x=perm(k-d,l-1)
    else:
        x=perm(k-d,l)
    #print(node,x,k-d,l)
    for y in root[node]:
        if y!=prev:
            x=x*dfs(y,min(depth+1,2),node)%mod
    #print(node,x)
    return x
count=dfs(0,1,0)*k%mod
print(count if count>0 else 0)

### FIXED CODE ###

n,k=map(int,input().split())
mod=10**9+7
import sys
sys.setrecursionlimit(10**9)
root=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    root[a-1].append(b-1)
    root[b-1].append(a-1)
def perm(k,n):
    x=1
    if k-n+1<=0:
        return 0
    for i in range(k,k-n,-1):
        x=x*i%mod
    return x
def dfs(node,depth,prev): 
    l=len(root[node])
    d=depth
    x=1
    if l==0:
        return 1
    if l==1 and depth>1:
        return 1
    if depth>1:
        x=perm(k-d,l-1)
    else:
        x=perm(k-d,l)
    for y in root[node]:
        if y!=prev:
            x=x*dfs(y,2,node)%mod
    return x%mod
count=dfs(0,1,0)*k%mod
print(count if count>0 else 0)
N = int(input())
edges = []
connected = [[] for i in range(N+1)]
for i in range(N-1):
    x=list(map(int, input().split()))
    x[0] -= 1
    x[1] -= 1
    edges.append(x)
    connected[x[0]].append([x[1], x[2]])
    connected[x[1]].append([x[0], x[2]])

Q,K = map(int, input().split())
depth = [0]*N
def DFS(v, p, d):
    depth[v] = d
    for child in connected[v]:
        if child[0] == p:
            continue
        DFS(child[0], v, d+child[1])

DFS(K,-1,0)
for i in range(Q):
    xi, yi = map(int, input().split())
    print(depth[xi-1]+depth[yi-1])

    


### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)

N = int(input())
edges = []
connected = [[] for i in range(100010)]
for i in range(N-1):
    x=list(map(int, input().split()))
    x[0] -= 1
    x[1] -= 1
    edges.append(x)
    connected[x[0]].append([x[1], x[2]])
    connected[x[1]].append([x[0], x[2]])

Q,K = map(int, input().split())
K -= 1
depth = [0]*100010
def DFS(v, p, d):
    depth[v] = d
    for child in connected[v]:
        if child[0] == p:
            continue
        DFS(child[0], v, d+child[1])

DFS(K,-1,0)
for i in range(Q):
    xi, yi = map(int, input().split())
    print(depth[xi-1]+depth[yi-1])
#ABC071A
import math
x, a, b =list(map(int, input().split()))

ax = math.abs(a-x)
bx = math.abs(b-x)

if (ax < bx): print("A")
else: print('B')

### FIXED CODE ###

#ABC071A
import math
x, a, b =list(map(int, input().split()))

ax = math.fabs(a-x)
bx = math.fabs(b-x)

if (ax < bx): print("A")
else: print('B')
from collections import Counter
from itertools import product, combinations


def solve(n, ds):
    if n >= 24:
        return 0
    freq = Counter(ds)
    if 0 in freq or freq[12] >= 2 or max(freq.values()) >= 3:
        return 0
    cmp = set()
    alt = []
    for d, l in freq.items():
        if l == 2 or d == 12:
            cmp.add(d)
            cmp.add(24 - d)
        else:
            alt.append((d, 24 - d))
    ans = min((abs(x - y) for x, y in combinations(cmp, 2)), default=0)
    for prd in product((0, 1), repeat=len(alt)):
        tmp_cmp = cmp.copy().union(x[i] for x, i in zip(alt, prd))
        tmp = min(abs(x - y) for x, y in combinations(tmp_cmp, 2))
        tmp = min(tmp, min(freq.keys()))
        ans = max(ans, tmp)
    return ans


print(solve(int(input()), list(map(int, input().split()))))


### FIXED CODE ###

from collections import Counter


def solve(n, ds):
    if n >= 24:
        return 0
    freq = Counter(ds)
    if (0 in freq) or (freq[12] >= 2) or max(freq.values()) >= 3:
        return 0
    up_low = [0, 0]
    switch = 0
    ans = 25
    for d, s in sorted(freq.items()):
        if s == 2:
            ans = min(ans, d - up_low[0], d - up_low[1])
            up_low[0] = up_low[1] = d
        else:
            ans = min(ans, d - up_low[switch])
            up_low[switch] = d
            switch ^= 1
    ans = min(ans, 24 - sum(up_low))
    return ans


print(solve(int(input()), list(map(int, input().split()))))
# -*- coding: utf-8 -*-

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

d.sort()
t.sort()

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

d = array_count(d)
t = array_count(t)

cand = [0] * 200000

for i in range(len(d)):
    cand[d[i][0]] += d[i][1]

for i in range(len(t)):
    cand[t[i][0]] -= t[i][1]

flag = True
for i in range(len(cand)):
    if cand[i] < 0:
        flag = False

if flag:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

# -*- coding: utf-8 -*-

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

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

d.sort()
t.sort()

d = array_count(d)
t = array_count(t)

for i in range(len(t)):
    t[i][1] = -1 * t[i][1]
    d.append(t[i])

d.sort()

for i in range(1,len(d)):
    if d[i-1][0] == d[i][0]:
        d[i-1][1] = d[i-1][1] + d[i][1]
        d[i][1] = 0

flag = True

for i in range(len(d)):
    if d[i][1] < 0:
        flag = False
        break

if flag:
    print("YES")
else:
    print("NO")
N=int(input())
A=list(map(int,input().split()))
Q=int(input())

arg=[0]*(N+5)
for a in A:
    arg[a]+=1
ans=sum(A)
for _ in range(Q):
    a,b=map(int,input().split())
    ans+=arg[a]*(b-a)
    print(ans)
    arg[b]+=arg[a]
    arg[a]=0


### FIXED CODE ###


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

arg=[0]*(100005)
for a in A:
    arg[a]+=1
ans=sum(A)
for _ in range(Q):
    a,b=map(int,input().split())
    ans+=arg[a]*(b-a)
    print(ans)
    arg[b]+=arg[a]
    arg[a]=0
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a <=k:
  print Yay!
else:
  print :(

### FIXED CODE ###

a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a<=k:
  print "Yay!"
else:
  print ":("
s = input()
ans = []

for i in range(len(s)):
  if s[i] != "B":
    ans.append(s[i])
  else:
    if len(s) > 0:
      ans.pop(-1)
      
print("".join(ans))

### FIXED CODE ###

s = input()
ans = []
for i in range(len(s)):
  if s[i] == "0":
    ans.append("0")
  elif s[i] == "1":
    ans.append("1")
  elif s[i] == "B":
    if len(ans) > 0:
      ans.pop(-1)

print("".join(ans))
# coding: utf-8
try:
    from math import gcd
except:
    from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
A.sort()
l = []
for i in range(2, A[0]+1):
    if A[0] % i == 0:
        l.append(i)
for i in range(2, A[1]+1):
    if A[1] % i == 0:
        l.append(i)
l = list(set(l))
ans = []
for i in l:
    cnt = 0
    for a in A:
        if a % i != 0:
            cnt += 1
    if cnt == 1:
        ans.append(i)
print(max(ans))


### FIXED CODE ###

#coding: utf-8
try:
    from math import gcd
except:
    from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
AL = [0] * N  # 左からGCD
AR = [0] * N  # 右からGCD
for i in range(1, N):
    AR[i] = gcd(AR[i-1], A[i-1])
for i in range(N-1)[::-1]:
    AL[i] = gcd(AL[i+1], A[i+1])
A_list = [gcd(AL[i], AR[i]) for i in range(N)]
print(max(A_list))
import re

S = input()

m = re.search(r"[ACGT]+", S)
print(len(m.group()))

### FIXED CODE ###

import re

S = input()

m = re.findall(r"[ACGT]+", S)
if m:
    print(max(map(len, m)))
else:
    print(0)
n = int(input())
A = list(map(int,input().split())
A = sorted(A)
x = A[-1]-A[0]
print(x)



### FIXED CODE ###

n = int(input())
S = list(map(int, input().split()))
S = sorted(S)
print(S[-1] - S[0])
a,b,c = map(int,input().split())

sum = a + b + c

if sum % 2 = 0:
  print(Yes)

else:
  print(No)
  

### FIXED CODE ###

li = sorted(list(map(int,input().split())))

a = li[0]
b = li[1]
c = li[2]

if a + b == c:
  print('Yes')

else:
  print('No')
#!/usr/bin/env python3

N = int(input())
l = list(range(2, N + 1)) + [1]
print(sum([i % x for i, x in enumerate(l, start=1)]))


### FIXED CODE ###

#!/usr/bin/env python3

N = int(input())
print(N * (N - 1) // 2)
import itertools
import numpy as np

N,M,X = map(int, input().split())
lista = [list(map(int,input().split())) for i in range(N)]

lista = np.array(lista)
judge = [X]*M
cost = 1200001
data = [a for a in range(1,N+1)] # [1,2,3,...,N]

for i in range(1,N+1):
    j = list(itertools.combinations(data, i))
    for k in j:
        result = np.array([0]*(M+1))
        for l in k:
            result = result + lista[l-1]
        if all(result[1:]>=judge):
            if reslut[0]<cost:
                cost = result[0]
                m = k
c = 0

try:
    for i in m:
        c +=lista[i-1][0]
    
    print(c)
except:

### FIXED CODE ###

import itertools
import numpy as np

N,M,X = map(int, input().split())
lista = [list(map(int,input().split())) for i in range(N)]

lista = np.array(lista)
judge = [X]*M
cost = 120000000000
data = [a for a in range(1,N+1)] # [1,2,3,...,N]

for i in range(1,N+1):
    j = list(itertools.combinations(data, i))
    for k in j:
        result = np.array([0]*(M+1))
        for l in k:
            result = result + lista[l-1]
        if all(result[1:]>=judge):
            if result[0]<cost:
                cost = result[0]
                m = k
c = 0

try:
    for i in m:
        c +=lista[i-1][0]
    
    print(c)
except:
    print(-1)
n,k,x,y=map(int, input().split())

if n > k:
  print(int(k*x+(n-k)*y))
else:  
  print(int(n*x))

### FIXED CODE ###

n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
    sum=n*x
else:
    sum=k*x+(n-k)*y
print(sum)
a,b,h = map(int, input().split())
print((a+b)*h//2)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())

print((a+b)*h//2)
#!/usr/bin python3
# -*- coding: utf-8 -*-

h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

#DP[i] = i までの魔法でモンスターの体力を減らすため消耗する魔力の最小値
dp = [0] * h

for i in range(h):
    nw = 10**10
    for a, b in ab:
        nw = min(nw ,dp[i-a] + b)
    dp[i] = nw
print(dp[h-1])


### FIXED CODE ###

import numpy as np
H,N=map(int, input().split())
A = [None]*N
B = [None]*N
for i in range(N):
  A[i],B[i]=map(int,input().split())
dp=[10**8]*(H+1)
A = np.array(A)
B = np.array(B)
dp = np.array(dp)
dp[0]=0
for i in range(1,H+1):
  x=np.amin((dp[np.maximum(0,i-A)]+B))
  dp[i]=min(x,dp[i])
print(dp[-1])
def sumall(a):
    n = 0
    while a > 0:
        n += a % 10 
        a = a // 10
    return n


n,a,b = open(0)

n = int(n)
a = int(a)
b = int(b)

c = [0 for i in range(n)]
for i in range(n):
    c[i] = sumall(i+1)
    
d = 0

for i in range(n):

    if a <= c[i] <= b:
        d += i+1
        
print(d)


### FIXED CODE ###

def sumall(a):
    n = 0
    while a > 0:
        n += a % 10 
        a = a // 10
    return n
 
 
n, a, b = map(int, input().split())
 
c = [0 for i in range(n)]
for i in range(n):
    c[i] = sumall(i+1)
    
d = 0
for i in range(n):

    if a <= c[i] <= b:
        d += i+1
        
print(d)
N = int(input())

G = [[] for i in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append([b-1,i])

ans = [None]*(N-1)

# 引数：今回の基準頂点、前回の基準頂点と今回の頂点を結ぶ辺の色番号
def func(ver, color):
    # 色番号。まずは最低の番号から始める。もし今回と前回の基準頂点の色番号1の場合は後で色番号変更
    cnt = 1
    # for (基準頂点と繋がっている頂点, 辺の番号) in 基準頂点
    for (to, i) in G[ver]:
        # 既使用（前回の基準頂点と今回の頂点を結ぶ辺の色）と今回使う色番号が同じなら+1で色番号変更
        if cnt==color:
            cnt += 1
        # i番目の辺における色番号
        ans[i] = cnt
        # 今回の頂点と、今回の頂点と基準頂点の辺の色番号を入力し、今回の頂点を次の基準頂点にする
        func(to, cnt)
        # 今回の基準頂点と繋がる次の頂点の処理をするために色番号変更
        cnt += 1

func(0, 0)

print(max(ans))

print(*ans, sep="\n")

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append([b,i])

ans = [None]*(n-1)
def rec(cur,color):
    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1
rec(0, 0)
print(max(ans))
print(*ans, sep="\n")
while 1:
 a=input()
 if a.isdigit():
  if c>0:c+=int(a)
  else:c=1
 else:
  if c!=0:print((s*2)[c%l-1:][:l])
  if'-'==a:break
  s=a;l=len(s);c=0

### FIXED CODE ###

for s in iter(input,'-'):
 for _ in[0]*int(input()):
  n=int(input())
  s=s[n:]+s[:n]
 print(s)
a, b = map(int, input())
if a * b % 2 == 1:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a, b = map(int, input().split())
if a * b % 2 == 1:
    print('Yes')
else:
    print('No')
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

bef=a[0]
man=b[0]

for i in a[1:]:
  if i=bef+1:
    man+=c[bef]
  man+=b[i]
  bef=i
print(man)

### FIXED CODE ###

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

bef=a[0]-1
man=b[bef]

for i in a[1:]:
  ind=i-1
  if ind==bef+1:
    man+=c[bef]
  man+=b[ind]
  bef=ind
print(man)
X = input()
Y = input()
Z = input()
A = X
B = Y
C = Z
# swap the contents of the boxes A and B
temp = B
B = A
A = temp
print(A + " " + B + " " + C)
# swap the contents of the boxes A and C
swapAC = C
C = A
A = swapAC
print(A + " " + B + " " + C)


### FIXED CODE ###

X, Y, Z = input().split()
A = X
B = Y
C = Z
# swap the contents of the boxes A and B
temp = B
B = A
A = temp
# swap the contents of the boxes A and C
swapAC = C
C = A
A = swapAC
print(A, B, C)
N = int(input())
A = list(map(int, input().split()))
C=0
while true:
  for i in A:
    if i%2 != 0::
        print(C)
        exit()
    A[i]/=2
    C+=1

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
count = 0
while True:
  for i in range(N):
    if A[i]%2 != 0:
      print(count)
      exit()
    A[i] /= 2
  count+=1
from functools import reduce

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

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

n = int(input())
t = [int(input()) for i in range(n)]

x = reduce(t, lcm)

print(x)



### FIXED CODE ###

from functools import reduce

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

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

n = int(input())
t = [int(input()) for i in range(n)]

ans = reduce(lcm, t)
print(ans)
n, m=map(int, input().split())
l=[]
for i in range(n):
  l.append(list(map(int, input().split())))
l = sorted(l, reverse=False)  
print(l)
def fns(hon, n, mon):
  if hon==m:
    return mon
  elif hon>m:
    return mon-(hon-m)*l[n-1][0]
  else:
    return fns(hon+l[n][1], n+1, mon+l[n][1]*l[n][0])
print(fns(0, 0, 0))


### FIXED CODE ###

n, m=map(int, input().split())
l=[]
for i in range(n):
  l.append(list(map(int, input().split())))
l = sorted(l, reverse=False)  
#print(l)
drinks=0
ttl=0
add=0
for i in range(n):
  add=min(m-drinks, l[i][1])
  ttl=ttl+add*l[i][0]
  drinks+=add
  if drinks==m:
    print(ttl)
    exit()
i=int(input())
for n in range(0,9):
  if 2**n=<i<2**(n+1):
    print(2**n)
    break
    

### FIXED CODE ###

i=int(input())
for n in range(0,9):
  if 2**n<=i<2**(n+1):
    print(2**n)
    break
a=input()
b=input()
c=a.split()
d=b.split()
e=0
k=0
u=int(c[1])
for i in range(len(d)):
        e+=int(d[i])
        k+=1
        if e>u:
                break
print(k)

### FIXED CODE ###

a=input()
b=a.split()
if int(b[0])<int(b[1]):
  print(0)
else:
  print(10)
def main():
    N, A, B, C = list(map(int, input().split(' ')))
    S = [input() for _ in range(N)]
    D = {
        'AB': A + B,
        'BC': B + C,
        'AC': A + C
    }
    ans = list()
    for i, s in enumerate(S):
        if D[s] == 0:
            print('No')
            return
        if s == 'AB':
            if (D['BC'] < D['AC']) or \
                (i < N and S[i + 1] == 'BC' and D['BC'] == D['AC'] == 1):
                ans.append('B')
                D['BC'] += 1
                D['AC'] -= 1
            else:
                ans.append('A')
                D['BC'] -= 1
                D['AC'] += 1
        elif s == 'BC':
            if (D['AB'] < D['AC']) or \
                (i < N and S[i + 1] == 'AB' and D['AB'] == D['AC'] == 1):
                ans.append('B')
                D['AB'] += 1
                D['AC'] -= 1
            else:
                ans.append('C')
                D['AB'] -= 1
                D['AC'] += 1
        else:  # s == 'AC'
            if (D['AB'] < D['BC']) or \
                (i < N and S[i + 1] == 'AB' and D['AB'] == D['BC'] == 1):
                ans.append('A')
                D['AB'] += 1
                D['BC'] -= 1
            else:
                ans.append('C')
                D['AB'] -= 1
                D['BC'] += 1
    print('Yes')
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N, A, B, C = list(map(int, input().split(' ')))
    S = [input() for _ in range(N)]
    D = {
        'AB': A + B,
        'BC': B + C,
        'AC': A + C
    }
    ans = list()
    for i, s in enumerate(S):
        if D[s] == 0:
            print('No')
            return
        if s == 'AB':
            if (D['BC'] < D['AC']) or \
                (i < N - 1 and S[i + 1] == 'BC' and D['BC'] == D['AC'] == 1):
                ans.append('B')
                D['BC'] += 1
                D['AC'] -= 1
            else:
                ans.append('A')
                D['BC'] -= 1
                D['AC'] += 1
        elif s == 'BC':
            if (D['AB'] < D['AC']) or \
                (i < N - 1 and S[i + 1] == 'AB' and D['AB'] == D['AC'] == 1):
                ans.append('B')
                D['AB'] += 1
                D['AC'] -= 1
            else:
                ans.append('C')
                D['AB'] -= 1
                D['AC'] += 1
        else:  # s == 'AC'
            if (D['AB'] < D['BC']) or \
                (i < N - 1 and S[i + 1] == 'AB' and D['AB'] == D['BC'] == 1):
                ans.append('A')
                D['AB'] += 1
                D['BC'] -= 1
            else:
                ans.append('C')
                D['AB'] -= 1
                D['BC'] += 1
    print('Yes')
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()
A, B = [int(i) for i in input().split()]

if A<0 or B<0:
    print("-1")
    exit()

minA = int(A/0.08)
maxA = int((A+1)/0.08)
minB = int(B/0.1)
maxB = int((B+1)/0.1)

for i in range(minA, maxA):
    if i >= minB and i < maxB:
        print(i)
        exit()

print("-1")

### FIXED CODE ###

s = input()
if "A" in s and "B" in s:
    print("Yes")
else:
    print("No")