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:
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random

# List of ints
def LI(): return list(map(int, sys.stdin.readline().split()))

# Single int
def I(): return int(sys.stdin.readline())

# List, which contains Lists of chars (not strings)
def LS():return list(map(list, sys.stdin.readline().split()))

# Single List of chars (not strings)
def S(): return list(sys.stdin.readline())[:-1]

# List of "n" integers from "n" lines.
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
# List of "n" Lists of integers
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l


# Runtime Complexity: O(?)
# Space Complexity: O(?)
# Solution
A, B = LI()

low = 0
high = A * 12.5 + B * 10

min_price = float('inf')

while low <= high:
    mid = low + ((high - low) // 2)

    a = math.floor(mid * 0.08)
    b = math.floor(mid * 0.1)

    if a < A or b < B:
        low = mid + 1
    elif a == A and b == B:
        min_price = mid
        high = mid - 1
    elif a > A or b > B:
        high = mid - 1

if min_price == float('inf'):
    print(-1)
else:
    print(int(min_price))

Submission status: Accepted

Solution code:
A,B = list(map(int, input().split()))
koho = list(range(B * 10,B * 10+10))
ans = -1
for i in koho:
  if int(i * 0.08) == A:
    ans = i
    break
print(ans)

Submission status: Accepted

Solution code:
import math

a, b = map(int, input().split())
limit = int(100 / 0.08) + 1
ans = limit

for i in range(1, limit):
    x = math.floor(i * 0.08)
    y = math.floor(i * 0.1)
    if x == a and y == b:
        ans = min(ans, i)

print(ans) if not ans == limit else print(-1)

Submission status: Accepted

Solution code:
import math

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

    for i in range(1, 1250):
        if math.floor(0.08*i) == A and math.floor(0.1*i) == B:
            print(i)
            return

    print('-1')
    return

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
a_set = set(range(-int(-a//0.08),-int(-(a+1)//0.08)))
b_set = set(range(-int(-b//0.1),-int(-(b+1)//0.1)))
candi = sorted(list(a_set&b_set))
print(candi[0] if len(candi)>0 else -1)

Submission status: Accepted

Solution code:
A, B = [int(x) for x in input().split(' ')]
C, D = A + 1, B + 1

for i in range(int(min(A / 0.08, B * 10, C / 0.08, D * 10) // 1),
               int(max(A / 0.08, B * 10, C / 0.08, D * 10) // 1) + 1):
  if int(i * 0.08 // 1) == A and int(i * 0.1 // 1) == B:
    print(i)
    break
else:
  print(-1)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
alist = []
blist = []
for i in range(b*10,b*10+10):
         blist.append(i)
for j in range(int(a*12.5+0.6),int(a*12.5+0.6+12.5)):
         alist.append(j)
answer = set(alist) & set(blist)
answer = list(answer)
if answer == []:
         print(-1)
else:
         print(min(answer))

Submission status: Accepted

Solution code:
import sys,math

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	A,B = MI()
	f = False
	for ans  in range(10000):
		if(int(ans * 0.08)==A and int(ans * 0.10)==B):
			print(ans)
			f = True
			break
	if(f==False):
		print(-1)

if __name__ == '__main__':
	main()

Submission status: Accepted

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

a=math.ceil(A*100/8)
b=math.ceil(B*100/10)
ans=max(a,b)
if ans*8//100==A and ans*10//100==B:
    print(ans)
else:
    print(-1)

Submission status: Accepted

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

def solve(x):
    return math.floor(x * 0.08) == a and math.floor(x * 0.1) == b

for i in range(1, 10**5):
    if solve(i):
        print(i)
        exit()

print(-1)

Submission status: Accepted

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

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

print("-1")

Submission status: Accepted

Solution code:
a, b = list(map(int, input().split()))
ans = -1
for p in range(1001):
    togo = int(p*0.08)
    forhere = int(p*0.1)
    
    if togo == a and forhere == b:
        ans = p
        break
    
print(ans)

Submission status: Accepted

Solution code:
import math

a, b = map(int, input().split())
i = -1
atax = -1
btax = -1
while not ((atax == a and btax == b) or (btax > 100)):
    i += 1
    atax = math.floor(i * 0.08)
    btax = math.floor(i * 0.1)
if btax > 100:
    print(-1)
else:
    print(i)

Submission status: Accepted

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


x = 10*B

if A%2 == 0:
	x_low = 25*(A//2)
	x_high = int(12.5*(A+1))
else:
	x_low = int(12.5*A)+1
	x_high = int(12.5*(A+1))-1


while x < (10*B+10):
	if x_low <= x and x <= x_high:
		print(x)
		exit()
	x += 1
print(-1)

Submission status: Accepted

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

for x in range(10000):
    if int(x*0.08) == a and int(x*0.1) == b:
        print(x)
        exit()

print(-1)

Submission status: Accepted

Solution code:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

A, B = input_int()



flg=True
for i in range(1, 10000):
    temp_A = int(i*0.08)
    temp_B = int(i*0.1)
    
    if temp_A == A and temp_B == B:
        print(i)
        flg=False
        break

if flg:
    print(-1)

Submission status: Accepted

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

am=math.ceil(A/0.08)
bm=math.ceil(B/0.1)
aM=math.ceil((A+1)/0.08)-1
bM=math.ceil((B+1)/0.1)-1
if max(am,bm)>min(aM,bM):
    print(-1)
else:
    print(max(am,bm))

Submission status: Accepted

Solution code:
import sys
A,B = map(int, input().split())
for x in range(1250):
    if int(x*0.08) == A and int(x*0.10) == B:
        print(x)
        sys.exit()
print(-1)

Submission status: Accepted

Solution code:
a , b = map(int,input().split())
c = []
bool = False
for i in range(1250):
    if i * 8 //100 ==a and i * 10 // 100 == b:
        bool = True
        c.append(i)
        exit
if bool == True:
    print(min(c))
if bool == False:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
A_under = (A * 25 + 1) // 2
A_top = ((A + 1) * 25 + 1) // 2 - 1
B_under = B * 10
B_top = B * 10 + 9

ans = -1

for p in range(A_under, A_top + 1):
    if B_under <= p <= B_top:
        ans = p
        break

print(ans)

Submission status: Accepted

Solution code:
import math
a,b = map(int, input().split())
a1 = a*12.5
a2 = (a+1)*12.5
b1 = b*10
b2 = (b+1)*10
if max(a1,b1) >= min(a2,b2):
  print(-1)
else:
  print(math.ceil(max(a1,b1)))

Submission status: Accepted

Solution code:
import math

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

for i in range(b+1,1001):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        ans = i
        break
else:
    ans = -1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor, ceil
a, b = map(int, input().split())
minim = ceil(max(a / 0.08, b / 0.10))
maxim = min((a + 1) / 0.08, (b + 1) / 0.10)
if minim >= maxim:
    print(-1)
else:
    print(minim)

Submission status: Accepted

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

for x in range(1,1250):
    tax_a = int(x*0.08)
    tax_b = int(x*0.1)

    if tax_a == a and tax_b == b:
        print(x)
        exit()
else:
    print(-1)

Submission status: Accepted

Solution code:
import math

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

ans = -1
for i in range(1, 10001):
    c = math.floor(i * 0.08)
    d = math.floor(i * 0.10)

    if a == c and b == d:
        ans = i
        break

print(ans)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
for x in range(max(a,b),10001):
    if (x*0.08)//1 == a and (x*0.1)//1 == b:
        print(x)
        exit(0)
print(-1)

Submission status: Accepted

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


for price in range(int(100/0.08 + 2)):
    if int(price * 0.08) == a and int(price * 0.1) == b:
        print(price)
        break
else:
    print(-1)

Submission status: Accepted

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

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

if minA <= minB <= maxA :
    print(minB)
elif minB <= minA <= maxB:
    print(minA)
else:
    print("-1")

Submission status: Accepted

Solution code:
import math
a,b=map(int,input().split())
for i in range(10000):
  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())

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

Submission status: Accepted

Solution code:
import math
[A,B] = [int(s) for s in input().rstrip().split(' ')]
for i in range(10*B,10*B+10): #10%消費税でB円課される範囲
  if math.floor(i * 0.08) == A:
    print(i)
    break
else:
  print("-1")

Submission status: Accepted

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

ans = -1

for i in range(1250):
    if int(i * 0.08) == A and int(i * 0.10) == B:
        ans = i
        break

print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

xa = list(range(int(np.ceil(A/0.08)),int(np.ceil((A+1)/0.08))))
xb = list(range(int(np.ceil(B/0.1)),int(np.ceil((B+1)/0.1))))

ans=str()

for i in xa:
    if i in xb:
        ans = str(i)
        break
        
if len(ans)==0:
    ans="-1"
    
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
x = max(a*12.5,b*10)
if x != int(x):
  x = int(x)+1
else:
  x = int(x)
if x < min((a+1)*12.5,(b+1)*10):
  print(x)
else:
  print(-1)

Submission status: Accepted

Solution code:
A,B=[int(x) for x in input().rstrip().split()]
count=0
for i in range(1,20000):
    ans1=int(0.08*i)
    ans2=int(0.1*i)
    if ans1==A and ans2==B:
        print(i)
        count=1
        break
if count==0:
    print(-1)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
import math
a_min=math.ceil(a*12.5)
a_max=(a+1)*12.5
b_min=math.ceil(b*10)
b_max=(b+1)*10
if a_max<=b_min or b_max<=a_min:
  print(-1)
else:
  print(max(a_min,b_min))

Submission status: Accepted

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

mn=max(b*10,a*12.5)
if mn==a*12.5 and a%2==1:
    mn=int(mn)+1
mx=min((b+1)/0.1,(a+1)/0.08)
if mn<mx:
    print(int(mn))
else:
    print(-1)

Submission status: Accepted

Solution code:
import sys

a, b = map(float, sys.stdin.readline().split())
ans = -1
for i in range(1, 1251):
    if (int(i * 0.08) == a) and (int(i * 0.1) == b):
        ans = i
        break

print(ans)

Submission status: Accepted

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

print(n)

Submission status: Accepted

Solution code:
def check(x, A, B):
    if int(x * 0.08) == A and int(x * 0.1) == B:
        return True
    else:
        return False

def solve(A, B):
    left = 0
    right = 1250
    ans = []
    for i in range(0, 1251):
        if check(i, A, B):
            print(i)
            exit()
    print(-1)

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

    solve(A, B)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
y=b*10
for i in range(y,y+10):
  if int(i*8/100)==a:
    print(i)
    break
else:
  print(-1)

Submission status: Accepted

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

a = [math.ceil(a * 12.5),(a + 1) * 12.5]
b = [math.ceil(b * 10),math.floor((b + 1) * 10)]
# print(a)
# print(b)
if max(a[0], b[0]) < min(a[1], b[1]):
    print(max(a[0], b[0]))
else:
    print(-1)

Submission status: Accepted

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

for i in range(10**4+100):
    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())
for i in range(1,1010):
    x = math.floor(i*0.08)
    y = math.floor(i*0.1)
    if (x==a and y==b):
        print(i)
        break
else:
    print(-1)

Submission status: Accepted

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

_a = a/0.08

if _a % 1 == 0.5:
    _as = [int(_a+0.5+i) for i in range(12)]
else:
    _as = [int(_a+i) for i in range(12)]

ans = -1
for x in _as:
    if b == int(x * 0.10):
        ans = x
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1

while True:
    if ans == 1010:
        ans = -1
        break
    if int(ans * 0.08) == A and int(ans * 0.1) == B:
        break
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import math

P = [int(p) for p in input().split()]
A = P[0]
B = P[1]


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

Submission status: Accepted

Solution code:
d8 = {}
d10 = {}
for i in range(1, 10000):
    if int(i * 0.08) not in d8:
        d8[int(i * 0.08)] = i
    if int(i * 0.1) not in d10:
        d10[int(i * 0.1)] = i

A, B = map(int, input().rstrip().split())
a = d8.get(A, None)
aa = d8.get(A + 1, None)
b = d10.get(B, None)
bb = d10.get(B + 1, None)
if a is None or b is None:
    print(-1)
elif max(a, b) < min(aa, bb):
    print(max(a, b))
else:
    print(-1)

Submission status: Accepted

Solution code:
import math
A,B = map(int,input().split())
A_range = [math.ceil(100*A/8),100*(A+1)//8]
B_range = [10*B,10*(B+1)]

if(min(A_range[1],B_range[1])<=max(A_range[0],B_range[0])):
    print("-1")
else:
    print(max(A_range[0],B_range[0]))

Submission status: Accepted

Solution code:
import math
a, b = map(int, input().split())
ans = 1000000
for i in reversed(range(a, 10000)):
    if math.floor(i * 0.08) == a and math.floor(i * 0.10) == b:
        ans = min(i, ans)
        if i * 0.08 == math.floor(i * 0.08):
            break
print(ans) if ans != 1000000 else print(-1)

Submission status: Accepted

Solution code:
import math
A, B = map(int, input().split())
h = 100/8
l1 = h*A
l2 = 10*B

l = l1 if l1 > l2 else l2

u1 = h*A + h
u2 = 10*B+10

u = u1 if u1 < u2 else u2

cand = math.ceil(l)
if cand < u:
    print(cand)
else:
    print(-1)

Submission status: Accepted

Solution code:
import math


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

def solve(a, b):
  for n in range(1, 1250 + 1):
    if math.floor(n * 0.08) == A and math.floor(n * 0.1) == B:
      return n

  return -1  
  
print(solve(A, B))

Submission status: Accepted

Solution code:
import math
a, b = map(int, input().split())
result = 0
m = 99999
for i in range(1, 10001):
    temp1 = math.floor(i * (8/100))
    temp2 = math.floor(i * (10/100))
    if a == temp1 and b == temp2:
        result = i
        break
if result == 0:
    print(-1)
else:
    print(result)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
a=[]
b=[]
i=-(-A*25//2)
while int(i*0.08)==A:
  a.append(i)
  i+=1
j=B*10
while int(j*0.1)==B:
  b.append(j)
  j+=1
x=list(set(a).intersection(set(b)))
print(min(x) if len(x)>0 else -1)

Submission status: Accepted

Solution code:
a, b  = map(int, input().split())
diva = int(a / 0.08)
divb = int(b / 0.1)
start = min(diva,divb)
flag = 0
for i in range(start,start+100):
    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:
a, b = map(int, input().split())

upper = 1300

price = -1
for i in range(1, upper):
    tax8 = int(i * 0.08)
    tax10 = int(i * 0.1)
    if a == tax8 and b == tax10:
        price = i
        break

print(price)

Submission status: Accepted

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

a=A/0.08
b=(A+1)/0.08
c=10*B
d=10*(B+1)



if a<=c:
    if math.ceil(c)<b:
        print(math.ceil(c))
    else:
        print(-1)
else:
    if math.ceil(a)<d:
        print(math.ceil(a))
    else:
        print(-1)

Submission status: Accepted

Solution code:
import sys
import math
import copy
import queue
input = sys.stdin.readline
def LI(): return [int(x) for x in input().split()]
INF = 10**15
EPS = 10**(-10)
DD = ((1,0),(0,1),(-1,0),(0,-1))

a , b  = LI()
a0 = math.ceil(a / 0.08)
a1  = int((a+1)/0.08 - EPS)
b0 = math.ceil(b / 0.1)
b1 = int((b+1)/0.1 - EPS)
x = max(a0,b0)
y = min(a1,b1)
if x > y : print (-1)
else : print (x)

Submission status: Accepted

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

al = []
for i in range(1, 10001):
    if int(i * 0.08) == a:
        al.append(i)
    elif int(i * 0.08) > a:
        break

bl = []
for i in range(1, 10001):
    if int(i * 0.1) == b:
        bl.append(i)
    elif int(i * 0.1) > b:
        break

for aa in al:
    for bb in bl:
        if aa == bb:
            print(aa)
            exit(0)
else:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

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

eight_min = a / 0.08
eight_max = (a+1) / 0.08
ten_min = b / 0.1
ten_max = (b + 1) / 0.1

ans = False
for p in range(int(eight_min), int(eight_max)):
    if eight_min <= p < eight_max and ten_min <= p < ten_max:
        ans = p
        break


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

Submission status: Accepted

Solution code:
import math

a, b = map(int, input().split())
for n in range(1, 10000):
    if math.floor(n * 0.08) == a and math.floor(n * 0.1) == b:
        print(n)
        exit(0)
print(-1)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
X = -1
for i in range(1300):
    if (A <= i * 0.08 and i * 0.08 < A+1) and (B <= i * 0.1 and i * 0.1 < B+1):
        X = i
        break
print(X)

Submission status: Accepted

Solution code:
import math

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

m=math.ceil( max(a*100/8,b*100/10) )
M=min( (a+1)*100/8 , (b+1)*100/10 ) - 0.0000001
M=math.floor(M)

if m>M:
    print(-1)
else:
    print(int(m))

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
vA=[]
vB=[]
for i in range(10001):
    if int(i*0.08) == A: vA.append(i)
    if int(i*0.1) == B: vB.append(i)
        
ans=10000

for i in vA:
    if i in vB:ans=min(ans,i)
for i in vB:
    if i in vA:ans=min(ans,i)

if ans==10000: ans=-1        

print(ans)

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools

#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]



def main():
    a,b=map(int,input().split())
    ans=-1
    for i in range(1,10001):
        if i*0.08//1==a and i*0.1//1==b:
            ans=i
            break
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(1251):
  if int(i * 0.08) == A and int(i * 0.1) == B:
    ans = i
    break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math


def solve(A: int, B: int):
    # INF = 1001001
    ans = 1
    for _ in range(1100):
        e = math.floor(ans * 0.08)
        t = math.floor(ans * 0.1)
        if e == A and t == B:
            print(ans)
            return
        ans += 1
    print(-1)
    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()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(-1)

Submission status: Accepted

Solution code:
#n=int(input())
a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

import math
flag=False
ans=-1
for i in range(1,10001):
    a2=i*0.08
    a1=int(i*0.08)
    b1=int(i*0.1)

    if a1==a and b1==b:
        ans=i
        break
print(ans)

Submission status: Accepted

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

flg = 0
for i in range(1, math.ceil(max(a, b)/0.08)+1):
    aa = math.floor(i * 0.08)
    bb = math.floor(i * 0.1)
    if a == aa and b == bb:
        print(i)
        flg = 1
        exit()

if flg == 0:
    print(-1)

Submission status: Accepted

Solution code:
import math

a, b = map(int, input().split())
a_price = (math.ceil(a * 100 / 8), math.ceil((a + 1) * 100 / 8))
b_price = (b * 10, (b + 1) * 10)
ans = max(a_price[0], b_price[0])
if ans >= min(a_price[1], b_price[1]):
    ans = -1
print(ans)

Submission status: Accepted

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

pmin = -(-A//0.08)
pmax = (A+1)//0.08

qmin = -(-B//0.1)
qmax = (B+1)//0.1

if pmax < qmin or qmax < pmin:
    print(-1)
else:
    if pmin < qmin:
        print(int(qmin))
    else:
        print(int(pmin))

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    A, B = MAP()

    for i in range(1000):
        if int((i+1)*0.08) == A and int((i+1)*0.1) == B:
            print(i+1)
            sys.exit()

    print(-1)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

flag = False
for i in range(1001):
  if math.floor(i*0.08) == a[0]:
    if math.floor(i*0.1) == a[1]:
      flag = True
      break

if flag:
  print(i)
else:
  print("-1")

Submission status: Accepted

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

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

if ans == 0:
    ans = "-1"

print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
out = -1
for i in range(1250):
    j = i + 1
    if a <= j * 0.08 < a + 1 and b <= j * 0.1 < b + 1:
        out = j
        break

print(out)

Submission status: Accepted

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

count = float('inf')
for i in range(int(a//0.08 -1), int((b+1)// 0.1 +1)):
    if i *0.08 >= a and i * 0.08 < (a+1) and i* 0.1 >= b and i* 0.1 < (b+1):
        if i <= count:
            count = i

if count == float('inf'):
    print(-1)
else:
    print(count)

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:
A, B = map(int, input().split())

min = B * 10
max = (B+1) * 10 -1

ans = -1
for i in range(min, max+1):
  if int(i * 0.08) == A:
    ans = i
    break

print(ans)

Submission status: Accepted

Solution code:
def main():
    a,b=map(int,input().split())
    for i in range(1,1020):
        if int(i*0.08)==a:
            if int(i*0.1)==b:
                print(i)
                return
    print( -1)
main()

Submission status: Accepted

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

import sys
for plice_i in range(1, 1251):
    if int(plice_i * 0.08) == a and int(plice_i * 0.1) == b:
        print(plice_i)
        sys.exit()
print(-1)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
for i in range(1, 10**4 + 100):
  if int(i * 0.08) == A and int(i * 0.1) == B:
    print(i)
    exit()
    
print('-1')

Submission status: Accepted

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

for i in range(1001):
    if a==int(i*1.08)-i and b==int(i*1.10)-i:
        print(i)
        break
else:
    print(-1)

Submission status: Accepted

Solution code:
a,b = [int(i) for i in input().split()]
for p in range(1,1251):
    if int(p*0.08) == a and int(p*0.1) == b:
        print(p)
        break
else:
    print(-1)

Submission status: Accepted

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

answered=False
ans = 0 
for i in range(1,1500):
    if int(0.08*i)==a and int(0.10*i)==b:
        answered=True
        print(i)
        break
    else:
        continue    

if answered ==False:
    print('-1')

Submission status: Accepted

Solution code:
def solve():
    A, B = map(int, input().split())
    for price in range(10000):
        eight = price * 0.08
        ten = price * 0.10
        if int(eight) == A and int(ten) == B:
            print(price)
            break
    else:
        print('-1')

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
tmp_min=min(-(-(a*100)//8),b*10)
tmp_max=max(-(-(a*100)//8),b*10)
ans="-1"
for i in range(tmp_max-tmp_min+1):
    tmp=tmp_min+i
    if tmp*0.08//1==a and tmp*0.1//1==b:
        ans=tmp
        break
    if tmp*0.08//1>a or tmp*0.1//1>b:
        break
print(ans)

Submission status: Accepted

Solution code:
import math

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

for i in range(10 * B, 10 * (B + 1)):
    if A == math.floor(0.08 * i):
        print(i)
        exit(0)

print(-1)