Problem:


Score : 300 points

Problem Statement

Find the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)

Here, the price before tax must be a positive integer, and the amount of consumption tax is rounded down to the nearest integer.

If multiple prices satisfy the condition, print the lowest such price; if no price satisfies the condition, print -1.

Constraints

1 \leq A \leq B \leq 100

A and B are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

If there is a price that satisfies the condition, print an integer representing the lowest such price; otherwise, print -1.

Sample Input 1

2 2

Sample Output 1

25

If the price of a product before tax is 25 yen, the amount of consumption tax levied on it is:

When the consumption tax rate is 8 percent: \lfloor 25 \times 0.08 \rfloor = \lfloor 2 \rfloor = 2 yen.

When the consumption tax rate is 10 percent: \lfloor 25 \times 0.1 \rfloor = \lfloor 2.5 \rfloor = 2 yen.

Thus, the price of 25 yen satisfies the condition. There are other possible prices, such as 26 yen, but print the minimum such price, 25.

Sample Input 2

8 10

Sample Output 2

100

If the price of a product before tax is 100 yen, the amount of consumption tax levied on it is:

When the consumption tax rate is 8 percent: \lfloor 100 \times 0.08 \rfloor = 8 yen.

When the consumption tax rate is 10 percent: \lfloor 100 \times 0.1 \rfloor = 10 yen.

Sample Input 3

19 99

Sample Output 3

-1

There is no price before tax satisfying this condition, so print -1.



Sample input:
2 2


Sample output:
25

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
miA=-(-A//0.08)
maA=-(-(A+1)//0.08)-1
miB=-(-B//0.1)
maB=-(-(B+1)//0.1)-1
if max(miA,miB)<=maA and max(miA,miB)<=maB:
  print(int(max(miA,miB)))
else:
  print(-1)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
for x in range(1,100000):
    if x//10==b and (8*x)//100==a:
        print(x)
        exit()
print(-1)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
for i in range(1,2001):
    #print (i)
    if A == int(i * 0.08) and B == int(i * 0.1):
        print (i)
        exit()
print (-1)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())

a_min = a/0.08
a_max = (a+1)/0.08
b_min = b/0.1
b_max = (b+1)/0.1


if a_min <= b_min:
    if b_min < a_max:
        if int(b_min) == b_min:
            print(int(b_min))
        else:
            print(int(b_min+1))
    else:
        print('-1')
else:
    if a_min < b_max:
        if int(a_min) == a_min:
            print(int(a_min))
        else:
            print(int(a_min+1))
    else:
        print('-1')

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
n=int(100*100/8)+1
ans=0
x=0
for i in range(1,n+1):
  x=i
  if int(i*0.08)==a and int(i*0.1)==b:
    ans=i
    break
if x==n:
  print(-1)
else:
  print(ans)

Submission status: Accepted

Solution code:
import math
a, b =(int(x) for x in input().split())

ans = 0
while ans <= 10000:
    ans += 1
    if math.floor(ans * 0.08) == a and  math.floor(ans * 0.1) == b:
        print(ans)
        exit()
print('-1')

Submission status: Accepted

Solution code:
L = input().split()
A = int(L[0])
B = int(L[1])
if A % 2 == 0:
    Amin = A / 0.08
    Aout = (A + 1) / 0.08
else:
    Amin = A / 0.08 + 0.5
    Aout = (A + 1) / 0.08
Bmin = 10*B
Bout = 10*(B + 1)
if Amin < Bout and Bmin < Aout:
    if Amin <= Bmin:
        print(int(Bmin))
    else:
        print(int(Amin))
else:
    print(-1)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

for i in range(int(-(-a//0.08)),int(-(-(a+1)//0.08))):
    for j in range(int(-(-b//0.1)),int(-(-(b+1)//0.1))):
        if(i == j):
            print(i)
            exit()
print(-1)

Submission status: Accepted

Solution code:
import numpy as np

a, b = list(map(int, input().split()))
minXa = int(np.ceil(a / 0.08))
minXb = b * 10
maxXa = int(np.ceil((a+1) / 0.08))
maxXb = (b+1) * 10

ansX = 9999
ansY = 9999
for x in range(minXa, maxXa):
    if(int(x*0.1) == b):
        ansX = x
        break

for y in range(minXb, maxXb):
    if(int(y*0.08) == a):
        ansY = y
        break

        
if(ansX == 9999 and ansY == 9999):
    print(-1)
else:
    print(min(ansX, ansY))

Submission status: Accepted

Solution code:
a,b=map(int,input().split())

for i in range(1,10001):
    tax_a=int((i*0.08)//1)
    tax_b=int((i*0.1)//1)
    if tax_a==a and tax_b==b:
        print(i)
        exit()

print(-1)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
x1=int(a//0.08)+1
x2=int((a+1)//0.08)

y1=int(b//0.1)+1
y2=int((b+1)//0.1)

xx=[i for i in range(x1,x2)]
for z in xx:
    if z>=y1 and z<=y2:
        print(z)
        exit()
    
print(-1)

Submission status: Accepted

Solution code:
import math
A,B = map(int,input().split())

for n in range(10000):
    if math.floor(n * 0.08) == A and  math.floor(n * 0.1) == B:
        print(n)
        exit()
print('-1')

Submission status: Accepted

Solution code:
import math
a,b = map(int,input().split())
ans = 10000000000000000000000
inf = 10000000000000000000000

an = [math.ceil(a*(100/8)) , math.floor((a+1)*(100/8))-1]
bn = [math.ceil(b*(100/10)) , math.floor((b+1)*(100/10))-1]
    
ax = []
bx = []
    
for i in range(an[0],an[1]+1):
    ax.append(i)
    
for i in range(bn[0],bn[1]+1):
    bx.append(i)
    
for i in range(len(ax)):
    for j in range(len(bx)):
        if ax[i] == bx[j]:
            ans = min(ans,ax[i])
    
if ans != inf:
    print(ans)
else:
    print("-1")

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	A, B = map(int, input().split())
	MAX = B * 20
	c = 0
	for i in range(MAX):
		a = int(i * 0.08)
		b = int(i * 0.1)
		if a == A and b == B:
			print(i)
			c = 1
			break
	if c == 0:
		print(-1)

Submission status: Accepted

Solution code:
A, B = list(map(int, input().split()))
x = 10*B
cnt = 0
while cnt < 9:
    if int(x*0.08) == A:
        print(x)
        break
    x+=1
    cnt+=1

if cnt == 9:
    print(-1)

Submission status: Accepted

Solution code:
import math
import numpy as np
a, b = map(int, input().split())

MAX = 1000 + 1
xa = np.zeros((MAX))
xb = np.zeros((MAX))

for i in range(MAX):
    xa_tmp = math.floor(0.08 * i)
    if xa_tmp == a:
        xa[i] = 1

for i in range(MAX):
    xb_tmp = math.floor(0.1 * i)
    if xb_tmp == b:
        xb[i] = 1

#print(xa[:30])
#print(xb[:30])
x = xa + xb

ans = -1
for i in range(MAX):
    if x[i] == 2:
        ans = i
        break

print(ans)

Submission status: Accepted

Solution code:
import math
import sys

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

A = math.floor(a / 0.08)
B = math.floor(b / 0.10)

for i in range(1,1251):
    if math.floor(i * 0.08) == a and math.floor(i * 0.10) == b:
        print(i)
        sys.exit()
print('-1')

Submission status: Accepted

Solution code:
import math
a,b=map(int,input().split())
a1=math.ceil(a/0.08)
a2=math.floor((a+1)/0.08)
A=set([i for i in range(a1,a2)])
b1=math.ceil(b/0.1)
b2=math.floor((b+1)/0.1)
B=set([i for  i in range(b1,b2)])

if A&B==set(): 
    print(-1)
    exit()

print(min(A & B))

Submission status: Accepted

Solution code:
import math
def main():
    A, B = map(int, input().split())

    for i in range(1001):
        a = int(0.08*i)
        b = int(0.1*i)
        #print(a, b)
        if (a == A) and (b == B):
            print(i)
            return 0
    print(-1)
    return 0
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import floor, ceil
a, b = map(int, input().split())

x = ceil(a / 0.08)
y = ceil(b / 0.1)

x, y = min(x, y), max(x, y)
for i in range(x, y + 1):
    if floor(i * 0.08) == a and floor(i * 0.1) == b:
        print(i)
        break
else:
    print(-1)

Submission status: Accepted

Solution code:
import math
A, B = map(int, input().split())
for i in range(1251):
  if math.floor(i*2/25) == A and math.floor(i/10) ==B:
    print(i)
    exit()
print('-1')

Submission status: Accepted

Solution code:
import math

A, B = map(int, input().split())

a = set(range(math.ceil(A/0.08), math.ceil((A+1)/0.08)))
b = set(range(math.ceil(B/0.1), math.ceil((B+1)/0.1)))

c = a & b

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

Submission status: Accepted

Solution code:
import math
A,B = map(int,input().split())
ans = -1
start =math.floor(A / 0.1)
end = math.ceil(B /0.08)

for i in range (start,end+10):
    if  math.floor(i*0.08) == A and math.floor(i*0.1) == B:
        ans = i
        break

print(ans)

Submission status: Accepted

Solution code:
import math

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

p_A = math.floor((A+1) * 100 / 8)
n_A = math.ceil(A * 100 / 8)
p_B = math.floor((B+1) * 100 / 10)
n_B = math.ceil(B * 100 / 10)

if n_A > p_B or n_B > p_A:
    print('-1')
else:
    ans = max(n_A, n_B)
    if math.floor(ans * 0.08) == A and math.floor(ans * 0.1) == B:
        print(ans)
    else:
        print('-1')

Submission status: Accepted

Solution code:
import math

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

na = [a / 0.08, (a+1) / 0.08]
nb = [b / 0.1,  (b+1) / 0.1 ]

def adjust_float(l):
    mn, mx = l
    return [
        math.ceil(mn),
        math.floor(mx) if mx % 1 != 0 else int(mx - 1),
    ]

na = adjust_float(na)
nb = adjust_float(nb)

if nb[1] < na[0] or na[1] < nb[0]:
    print(-1)
elif na[0] <= nb[0] and nb[0] <= na[1]:
    print(int(nb[0]))
elif nb[0] <= na[0] and na[0] <= nb[1]:
    print(int(na[0]))

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
ans=-1
for i in range(2000):
  if int(i*0.08)==a and int(i*0.1)==b:
    ans=i
    break
print(ans)

Submission status: Accepted

Solution code:
a,b = list(map(int, input().split()))

amin = (a/0.08)*-1//1*-1
amax = ((a+1)/0.08)//1
if ((a+1)/0.08)%1 == 0:
    amax -= 1

bmin = (b/0.1)*-1//1*-1
bmax = ((b+1)/0.1)//1
if ((b+1)/0.1)%1 == 0:
    bmax -= 1

ans = float("inf")
if amin <= bmax and amin >= bmin:
    ans = min(ans, amin)
elif bmin <= amax and bmin >= amin:
    ans = min(ans, bmin)
else:
    ans = -1

print(int(ans))

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
from math import floor
for i in range(1, 5001):
    if floor(i * 0.08) == a and floor(i * 0.1) == b:
        print(i)
        break
else: print(-1)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())


def tax8(p):
    return (p * 0.08 // 1)


def tax10(p):
    return (p * 0.1 // 1)


for p in range(1, 2000):
    tmp8 = tax8(p)
    tmp10 = tax10(p)
    if tmp8 == a and tmp10 == b:
        print(p)
        exit(0)

print('-1')

Submission status: Accepted

Solution code:
a,b= list(map(int, input().split()))
s=-1
n=int(a/0.08)
while a>=int(n*0.08):
    if int(n*0.08)==a and int(n*0.1)==b:
        s=n
        break
    n+=1
print(s)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

a, b = [int(i) for i in input().split()]

start = int(((a * 100)/8) + 0.5)
if a % 2 == 0:
    candidate1 = list(range(start, start + 13))
else:
    candidate1 = list(range(start, start + 12))
start = (b * 10)
candidate2 = list(range(start, start + 10))

ans = -1
for i in candidate2:
    if i in candidate1:
        ans = i
        break
print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

#print((25*0.1)//1 == 2)
flag = 1
for i in range(1,100000):
    if (i*0.08)//1==A and (i*0.1)//1==B:
        flag = 0
        print(i)
        break

if flag:
    print("-1")

Submission status: Accepted

Solution code:
import math

A, B = map(int, input().split())

ans_A = A * (100 / 8)
ans_B = B * 10

for x in range(1251):
    if math.floor(x * 0.08) == A and math.floor(x * 0.1) == B:
        print(x)
        exit()

print(-1)

Submission status: Accepted

Solution code:
import math

a,b = map(int,input().split())
alow = math.ceil((a)/0.08)
ahigh = math.floor((a+1)//0.08)

blow = math.ceil((b)/0.1)
bhigh = math.floor((b+1)//0.1)

if alow < blow:
    if blow <= ahigh <= bhigh:
        print(blow)
    else:
        print(-1)

elif blow < alow:
    if alow  <= bhigh <= ahigh:
        print(alow)
    else:
        print(-1)

elif alow == blow:
    print(alow)

Submission status: Accepted

Solution code:
def main():
    A, B = [int(x) for x in input().split()]
    for num in range(1, 10001):
        if int(num * 0.08) == A and int(num * 0.1) == B:
            print(num)
            return
        elif int(num * 0.08) > A and int(num * 0.1) > B:
            break
    
    print(-1)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
f=-1
for i in range(1,10000):
    if int(i*0.08)==a and int(i*0.10)==b:
        f=i 
        break 
print(f)

Submission status: Accepted

Solution code:
f=0
list = list(map(int, input().split()))
for i in range(1001):
    if int(i*0.08)==list[0] and int(i*0.1)==list[1]:
        print(i)
        f=1
        break
if f==0:
    print(-1)

Submission status: Accepted

Solution code:
def main():
    a,b = map(int,input().split())
    lst = calc_task(a,b)
    answer = 0
    if len(lst) == 0:
        answer = -1
    else:
        answer = lst[0]
    print(answer)

def calc_task(a,b):
    return [n for n in range(1,2000) if ((n * 8 // 100)==a and (n * 10 // 100)==b)]



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

a1 = 0
a2 = 0
if a*100 % 8 == 0:
    a1 = a/0.08
else:
    a1 = a//0.08 + 1

a2 = (a+1)//0.08

b1 = b / 0.1
b2 = (b+1) / 0.1

a1 = int(a1)
a2 = int(a2)
b1 = int(b1)
b2 = int(b2)

al = []
bl = []

for i in range(a1, a2+1):
    al.append(i)
for i in range(b1, b2):
    bl.append(i)

ans = set(al) & set(bl)
if len(ans) == 0:
    print(-1)
else:
    print(min(ans))

Submission status: Accepted

Solution code:
A, B =  [float(i) for i in input().split(' ')]

B1 = int(B /0.1)
B2 = int((B+1) / 0.1)
flag = 0
for i in range(B1, B2):
    if int(i * 0.08) == A :
        print(i)
        flag = 1
        break
if flag == 0:
    print(-1)

Submission status: Accepted

Solution code:
import math

a, b = map(int, input().split())
a_origin = math.ceil(a*100/8)
b_origin = b*10

while True:
    if a_origin == b_origin:
        result = a_origin
        break;
    if a_origin < b_origin:
        a_origin += 1
    else:
        b_origin += 1

    if a_origin >= (a+1) * 100/8 or b_origin >= (b+1) * 10:
        result = -1
        break

print(result)

Submission status: Accepted

Solution code:
A, B = map(int, input().split(" "))
_min = int(A / 0.10)
_max = int(B / 0.08)
flg = True
for i in range(_min-3, _max+3):
  if int(i *  0.08) == A and int(i * 0.10) == B:
    print(i)
    flg = False
    break
if flg:
  print(-1)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())

for i in range(1,10001):
    if a == int(i * 0.08) and b == int(i * 0.1):
        print(i)
        exit()

print(-1)

Submission status: Accepted

Solution code:
from math import ceil, floor
 
a, b = [int(c) for c in input().split(" ")]
A = ceil(a / 0.08)
B = ceil(b/ 0.1)
 
if (A < B):
  if (floor(B * 0.08) == a):
    print(B)
  else:
    print(-1)
elif (B < A):
  if (floor(A*0.1) == b):
    print(A)
  else:
    print(-1)
else:
  print(A);

Submission status: Accepted

Solution code:
from math import floor
A, B = map(int, input().split())
tax_A = 0.08
tax_B = 0.1
i = 1
A_list = []
while(floor(i*tax_A)<=A):
    if floor(i*tax_A)==A:
        A_list.append(i)
    i += 1
i = 1
B_list = []
while(floor(i*tax_B)<=B):
    if floor(i*tax_B)==B:
        B_list.append(i)
    i += 1
if max(min(A_list), min(B_list)) in A_list and max(min(A_list), min(B_list)) in B_list:
    print(max(min(A_list), min(B_list)))
else:
    print(-1)

Submission status: Accepted

Solution code:
import math

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

a_min = math.ceil(a / 0.08)
a_max = math.ceil((a + 1) / 0.08)

b_min = math.ceil(b / 0.10)
b_max = math.ceil((b + 1) / 0.10)

ans = -1

for i in range(a_min,a_max):
  if i >= b_min and i < b_max:
    ans = i
    break

print(ans)

Submission status: Accepted

Solution code:
import math
a,b = map(int,input().split())

for i in range(int((b+1)/0.1)):
  if math.floor(i *0.08) == a and math.floor(i *0.1) == b:
    print(i)
    exit()
    
    
print(-1)

Submission status: Accepted

Solution code:
A, B = [int(i) for i in input().split()]

output = -1
for i in range(1, 1001):
    hachi = i * 8 // 100
    juu =  i * 10 // 100
    if hachi == A and juu == B:
        output = i
        break
        
print(output)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())

x_b = b * 10

min_a = (25/2) * a
max_a = (25/2) * (a + 1)

min_b = 10 * b
max_b = 10 * (b + 1)

min_ = max(min_a, min_b)
max_ = min(max_a, max_b)

_min = int(min_ + 0.5)
_max = int(max_)

if _min >= _max:
    print(-1)

else:
    print(_min)

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    a,b = map(int, input().split())
    
    def check(k):
        if floor(k*0.08) == a and floor(k*0.1) == b:
            return True
        else:
            return False
    # [k*0.08] = A
    # [k*0.1] = B
    # B <= k*0.1 <= B+1
    # A <= k*0.08 <= A+1

    m,n = a / 0.08, b/0.1
    
    for i in range(1300):
        if check(i):
            print(i)
            return
    print('-1')
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

for i in range(1230):
    if(math.floor(i * 0.08) == A and math.floor(i * 0.1) == B):
        print(i)
        exit()

print(-1)

Submission status: Accepted

Solution code:
import math
a, b = map(int, input().split())
ans = -1

for i in range(1001):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        ans = i
        break

print(ans)

Submission status: Accepted

Solution code:
import math
a,b=map(int,input().split())

a_min=math.ceil(a/(0.08))
a_max=(a+1)/(0.08)
b_min=math.ceil(b/(0.1))
b_max=(b+1)/(0.1)
if a_min>=a_max:
    print(-1)
elif b_min>=b_max:
    print(-1)
else:
    if a_min<b_min:
        if b_min<a_max:
            print(b_min)
        else:
            print(-1)
    if b_min<a_min:
        if a_min<b_max:
            print(a_min)
        else:
            print(-1)  
    if a_min==b_min:
        print(a_min)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
import math
for i in range(1,10000):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        print(i)
        break
else:
    print("-1")

Submission status: Accepted

Solution code:
A, B = [int(item) for item in input().split()]
is_found = False

for i in range(10001):
    A_cal = int(i * 0.08)
    B_cal = int(i * 0.10)

    if A_cal == A and B_cal == B:
        print(i)
        is_found = True
        break
    
if not is_found:
    print(-1)

Submission status: Accepted

Solution code:
def minmax(v, rate):
    min_v = v / rate * 100
    max_v = (v + 1) / rate * 100
    return (min_v, max_v)


def valid(v, a, b):
    #    print(int(v * 0.08), int(v * 0.1))
    return int(v * 0.08) == a and int(v * 0.1) == b


def main():
    A, B = map(int, input().split())

    a = minmax(A, 8)
    b = minmax(B, 10)

    #print(a, b)
    i = max(int(a[0]), int(b[0]))
    j = min(int(a[1]), int(b[1]))
    for i in range(i, j + 1):
        if valid(i, A, B):
            print(i)
            exit()
    print(-1)


main()

Submission status: Accepted

Solution code:
import math

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

for i in range(2000,2,-1):
    if (math.floor(i*0.08) == a) and (math.floor(i*0.1) == b):
        s = i

if s != 0:
    print(s)
else:
    print('-1')

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

a_before = a / 0.08

if int(a/0.08) == a/0.08:
    a_min = int(a/0.08)
    a_max = int((a+1)/0.08)
elif int((a+1)/0.08) == (a+1)/0.08:
    a_max = int((1+a)/0.08 - 1)
    a_min = int(a/0.08 + 1)
else:
    a_min = int(a/0.08 + 1)
    a_max = int((a+1) / 0.08)

b_min = int(b/0.1)
b_max = int((b+1)/0.1 - 1)

if a_min >= b_min:
    if a_min <= b_max:
        print(a_min)
    else:
        print(-1)
elif b_min > a_min:
    if b_min <= a_max:
        print(b_min)
    else:
        print(-1)

Submission status: Accepted

Solution code:
import math

A,B = map(int, input().split())

ans = '-1'

for i in range(1001):
    if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
        ans = str(i)
        break

if ans == '-1':
    print(ans)
else:
    print(int(ans))

Submission status: Accepted

Solution code:
# C
a, b = map(int, input().split())

import math
bool = False
for x in range(10**5):
    if math.floor(x*0.08) == a and math.floor(x*0.10) == b:
        bool = True
        print(x)
        break
        
if bool == False:
    print(-1)

Submission status: Accepted

Solution code:
import math

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

cost_list = []
state = 0

for i in range(0,1001):
    if math.floor(i/10) == b:
        cost_list.append(i)
    if math.floor(i/10) > b:
        break

for c in cost_list:
    if math.floor(c*0.08) == a:
        print(c)
        state = 1
        break

if state == 0:
    print(-1)

Submission status: Accepted

Solution code:
from math import floor, ceil
[A, B] = list(map(int, input().split()))

def main(A, B):
    
    underN = min(int(A // 0.08), int(B // 0.1))
    upperN = max(int(ceil(A / 0.08)), int(ceil(B / 0.1)))

    for i in range(underN, upperN+1):

        if int(floor(i*0.08)) == A and int(floor(i*0.1)) == B:
            return i
    
    else: return -1
    

if __name__ == "__main__":

    answer = main(A, B)
    print(answer)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
a_min = int((A//0.08)+1)
b_min = int((B//0.1)+1)
a_max = int(((A+1)//0.08)+1)
b_max = int(((B+1)//0.1)+1)
lisa = []
lisb = []
ans = []
for i in range(a_min,a_max):
    lisa.append(i)
for j in range(b_min,b_max):
    lisb.append(j)
for k in lisa:
    for g in lisb:
        if k == g:
            ans.append(k)
if ans != []:
    print(ans[0])
else:
    print("-1")

Submission status: Accepted

Solution code:
A,B=map(int,input().split())

ansA=A*(100/8)#この数か、この数よりでかI数となる
if ansA==int(ansA):#小数点以下０なら
    ansA=int(ansA)
else:
    ansA=int(ansA)+1


ansB=B*10#この数か、この数よりでかい数となる

if ansA>=ansB:
    ans=ansA
else:
    ans=ansB

if int(ans*(8/100))==A and int(ans*(10/100))==B:
    print(ans)
else:
    print(-1)

Submission status: Accepted

Solution code:
A,B= map(int, input().split())

n=int(-(-A*25//2))
n0=int(-(-(A+1)*25//2))

d=[-1]

for i in range(n,n0):
    if i//10==B:
        d.append(i)

if d[-1]==-1:
    print(-1)
else:
    print(d[1])

Submission status: Accepted

Solution code:
import math

import numpy as np

a, b = [int(v) for v in input().split()]


try:
    print(min(np.intersect1d(np.arange(math.ceil(a/0.08), (a+1) //0.08+ 1).astype(int), np.arange(math.ceil(b/0.1), (b+1)//0.1 + 1).astype(int))))

except:
    print(-1)

Submission status: Accepted

Solution code:
import sys
import math

A,B = map(int,input().split())
# 四捨五入
if A * (100/8) - int(A * (100/8)) >=0.5:
    target_8  = math.floor(A * (100/8)) + 1
else:
    target_8  = math.floor(A * (100/8))

# 四捨五入
if A * (100/10) - int(A * (100/10)) >=0.5:
    target_10 = math.floor(B * (100/10)) + 1
else:
    target_10 = math.floor(B * (100/10))

if math.floor(target_8*0.1) == B :
    print(target_8)
    sys.exit()
elif math.floor(target_10*0.08) == A :
    print(target_10)
    sys.exit()
else:
    print('-1')
    sys.exit()

Submission status: Accepted

Solution code:
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"
exit $?
'''
import sys
import math


def _ia(): return [int(x) for x in sys.stdin.readline().strip().split()]


def main():
    a, b = _ia()
    for i in range(1010):
        xa = math.floor(i * 0.08)
        xb = math.floor(i * .1)
        if xa == a and xb == b:
            return i
    return -1


if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
from functools import lru_cache
INF = 1 << 60

#ここから書き始める
a, b = map(int, input().split())
ans1 = 0
while True:
    if int(ans1 * 8 / 100) == a and int(ans1 / 10) == b:
        break
    if int(ans1 * 8 / 100) > a or int(ans1 / 10) > b:
        ans1 = -1
        break
    ans1 += 1
print(ans1)

Submission status: Accepted

Solution code:
# coding: utf-8
a, b = map(int, input().split())

for i in range(1250):
    if int(0.08*i) == a and int(0.1*i) == b:
        print(i)
        break
    else:
        if i == 1249:
            print(-1)
        i += 1

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

for x in range(1, int(10001)):
    if int(x * 0.08) == A and int(x * 0.1) == B:
        print(x)
        exit()
print(-1)

Submission status: Accepted

Solution code:
import math

A, B = map(int, input().split())
mi = math.floor(min(A/8*100, B*10))
ma = math.ceil(max(A/8*100, B*10))

result = -1

for i in range(mi,ma+1):
    if i*8//100 == A and i//10 == B:
        result = i
        break

print(result)

Submission status: Accepted

Solution code:
import math

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

a = X / 0.08
b = Y / 0.1

ans = min(a, b)

while math.floor(ans * 0.08) != X or math.floor(ans * 0.1) != Y:
	ans += 1
	if math.floor(ans * 0.08) > a or math.floor(ans * 0.1) > b:
		ans = -1
		break

print(int(ans))

Submission status: Accepted

Solution code:
a,b = map(int, input().split())

ans = 1
exist = True

while True:
  if int(ans*0.08)==a and int(ans*0.1)==b:
    break
  elif int(ans*0.08)>a or int(ans*0.1)>b:
    exist = False
    break
  
  ans += 1
  
print(ans if exist else -1)

Submission status: Accepted

Solution code:
import math
a, b = map(int, input().split())
a1 = a+1
b1 = b+1
A = a/0.08
A1=a1/0.08
B = b/0.1
B1 = b1/0.1

ans1 = set(i for i in range(math.ceil(A), math.floor(A1)))
ans2 = set(j for j in range(math.ceil(B), math.floor(B1)))

if ans1 & ans2 == set():
    print(-1)
else:
    ans = ans1&ans2
    print(min(list(ans)))

Submission status: Accepted

Solution code:
import sys
import math
A, B = map(int, input().split())
for i in range(1001):
  if math.floor(i*0.08) == A and math.floor(i*0.1) == B :
    print(i)
    exit()
print(-1)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
flag = 0
for i in range(1, 10000):
	if int(i*0.08) == a and int(i*0.1) == b:
		print(i)
		flag = 1
		break

if flag == 0:
	print(-1)

Submission status: Accepted

Solution code:
import math

A, B = list(map(int, input().strip().split()))
ans = -1
for i in range(1, 1001):
  if(math.floor(i * 0.08) == A and math.floor(i * 0.1) == B):
    ans = i
    break
    
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
input = sys.stdin.readline

a, b = map(int, input().split())
for i in range(1, 2000):
    if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
        print(i)
        break
else:
    print(-1)

Submission status: Accepted

Solution code:
"""
A<=0.08x<A+1
C<=0.1x<C+1
"""

A,C = (input()).split(" ")
A = (int)(A)
C = (int)(C)

leftA = A/0.08
rightA = (A+1)/0.08

leftC = C/0.1
rightC = (C+1)/0.1



if rightC<=leftA or rightA<=leftC:
    print(-1)
else:
    max_line = max(leftA,leftC)
    if max_line == (int)(max_line):
        print((int)(max_line))
    else:
        print((int)(max_line)+1)

Submission status: Accepted

Solution code:
import math
A, B = map(int, input().split())

Y = B*10  # Y+0~9
ans = -1

if A == math.floor(Y*0.08):
    ans = Y
elif A == math.floor((Y+1)*0.08):
    ans = Y+1
elif A == math.floor((Y+2)*0.08):
    ans = Y+2
elif A == math.floor((Y+3)*0.08):
    ans = Y+3
elif A == math.floor((Y+4)*0.08):
    ans = Y+4
elif A == math.floor((Y+5)*0.08):
    ans = Y+5
elif A == math.floor((Y+6)*0.08):
    ans = Y+6
elif A == math.floor((Y+7)*0.08):
    ans = Y+7
elif A == math.floor((Y+8)*0.08):
    ans = Y+8
elif A == math.floor((Y+9)*0.08):
    ans = Y+9

print(ans)

Submission status: Accepted

Solution code:
import math

a,b = (int(x) for x in input().split())

a_low = math.ceil(a/0.08)
b_low = math.ceil(b/0.1)

a_high = math.floor(a/0.08+int(1/0.08)-1e-8)
b_high = math.floor(b/0.1+int(1/0.1)-1e-8)

if b_low > a_high or a_low > b_high:
  print(-1)
else:
  print(max(a_low,b_low))

Submission status: Accepted

Solution code:
A,B = map(float,input().split())

# 1-1250円
A1 = A / 0.08
A2 = (A+1)/0.08
B1 = B / 0.1
B2 = (B+1) / 0.1

Flag = True
for i in range(1,1251):
    if (A1 <= i) and (i < A2) and (B1 <= i) and (i < B2):
        print(i)
        break
    if i == 1250:
        Flag = False

if (not Flag):
    print(-1)

Submission status: Accepted

Solution code:
import math

A, B = map(int, input().split())

minA = math.ceil(A / 0.08)
minB = math.ceil(B / 0.1)
small = min(minA, minB)
large = max(minA, minB)

#print (minA,minB)

for i in range(small, large+1):
    if (math.floor(i * 0.08) == A and math.floor(i * 0.1) == B):
        print (i)
        exit(0)
print ("-1")

Submission status: Accepted

Solution code:
A, B = list(map(int, input().split()))

a1 = float(A)/0.08
a2 = float(A+1)/0.08
b1 = float(B)/0.1
b2 = float(B+1)/0.1
if (a1 - int(a1)) == 0:
  a1 = int(a1)
else:
  a1 = int(a1+1)
if (b1 - int(b1)) == 0:
  b1 = int(b1)
else:
  b1 = int(b1+1)
if a2 - int(a2) == 0:
  a2 = int(a2-1)
else:
  a2 = int(a2)
if b2 - int(b2) ==0:
  b2 = int(b2-1)
else:
  b2 = int(b2)

if a1>b1:
  a1,a2,b1,b2 = b1,b2,a1,a2
if b1<=a2:
  print(b1)
else:
  print(-1)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

hoge = list(range(B*10,(B*10)+10))

ans = []
for i in hoge:
    if (i * 0.08) // 1 == A:
        ans.append(i)

if len(ans) == 0:
    print(-1)
else:
    print(min(ans))

Submission status: Accepted

Solution code:
from math import floor
a = list(map(int, input().split()))
A = a[0]
B = a[1]
o = -1
for i in range(1,1001):
    if floor(i*0.08)==A and floor(i*0.1)==B:
        o = i
        break
print(o)

Submission status: Accepted

Solution code:
import math
A, B = map(int, input().split())

A_list = []
for i in range(1500):
  if math.floor(i * 0.08) == A:
    A_list.append(i)

B_list = []
for i in range(1500):
  if math.floor(i * 0.10) == B:
    B_list.append(i)   
    
common = set(A_list) & set(B_list)

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

Submission status: Accepted

Solution code:
import math
a, b = [int(x) for x in input().split()]

price = math.ceil(a * 100 / 8)
if math.floor(price * 0.1) == b:
  print(price)
else:
  price = int(b * 100 / 10)
  if math.floor(price * 0.08) == a:
    print(price)
  else:
    print(-1)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

setA=set(list(range(int(A//0.08+1),int((A+1)//0.08+1))))
setB=set(list(range(int(B//0.1+1),int((B+1)//0.1+1))))
ans=setA & setB

if len(ans)==0:
    print(-1)
    exit()

print(min(ans))

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
import math

uA=A/0.08
tA=(A+1)/0.08
uB=B/0.1
tB=(B+1)/0.1

if uA>=tB or uB>=tA:
    print(-1)
else:
    print(math.ceil(max(uA,uB)))