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

mn = max(A/0.08,10*B)
mni = math.ceil(mn)
mx = min((A+1)/0.08,10*(B+1))
mxi = int(mx)
# print(A/0.08,(A+1)/0.08)
# print(10*B,10*(B+1))
# print(minans,maxans)
if mn <= mx and (mxi>mn and mx>mni):
    print(mni)
else:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
A,B = map(int,input().split())
min_8=math.ceil(A*(100/8))
max_8=int((A+1)*(100/8))
if max_8==(A+1)*(100/8):
    max_8-=1
min_10=B*10
max_10=int((B+1)*10)-1
if max_8 < min_10:
    print("-1")
elif min_8 > max_10:
    print("-1")
elif max_8 >= min_10:
    if min_8 < min_10:
        print(min_10)
    elif min_8 >= min_10:
        print(min_8)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
import sys
import math
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
x = math.floor(A / 0.08)
y = math.ceil((A + 1) / 0.08)

flag = 0
for i in range(x, y):
    if math.floor(i * 0.08) == A and math.floor(i * 0.10) == B:
        print(i)
        flag += 1
        break

if flag == 0:
    print(-1)

Submission status: Accepted

Solution code:
import math
A,B = map(int,input().split())
cnt = 0
while True:
    cnt += 1
    if math.floor(cnt * 0.08) == A and math.floor(cnt * 0.1) == B:
        print(cnt)
        exit()
    elif cnt == 10**5:
        print(-1)
        exit()

Submission status: Accepted

Solution code:
import math

string = input()
a = int(string.split()[0])
b = int(string.split()[1])

if int(100 * (a + 1) / 8) <= 10 * b:
    print(-1)
elif math.ceil(100 * a / 8) < 10 * b:
    print(10 * b)
elif math.ceil(100 * a / 8) < 10 * (b + 1):
    print(math.ceil(100 * a / 8))
else:
    print(-1)

Submission status: Accepted

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

for i in range(10100):
  x = (i * 0.08) // 1
  if x != a:
    continue
  else:
    y = (i * 0.1) // 1
    if y == b:
      print(i)
      break
else:
  print(-1)

Submission status: Accepted

Solution code:
lst = [int(i) for i in input().split()]
A = lst[0]
B = lst[1]
for x in range(10000):
    if int(x * 0.08) == A:
        if int(x * 0.1) == B:
            ans = x
            break
    else:
        ans = -1
print(ans)

Submission status: Accepted

Solution code:
inp = input().split(" ")
A, B = (int(inp[0]), int(inp[1]))
kouhoB = []
if A % 2 == 1:
    kouhoA = list(range(int(A * 12.5 + 1), int((A + 1) * 12.5)))
else:
    kouhoA = (list(range(int(A * 12.5), int((A + 1) * 12.5 + 1))))
num = B*10
while num <= B*10+9:
    kouhoB.append(num)
    num += 1
dottimo = list(set(kouhoA) & set(kouhoB))
if len(dottimo) >= 1:
    print(min(list(set(kouhoA) & set(kouhoB))))
else:
    print(-1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
a = list(map(int, input().split(" ")))
min8 = a[0]/0.08
max8 = (a[0]+1)/0.08
min10 = a[1]/0.1
max10 =(a[1]+1)/0.1
b = max(min8, min10)
if ((min8>=max10) or (max8<=min10)):
    print(-1)
else:
    print(Decimal(b).quantize(Decimal('0'), rounding = ROUND_HALF_UP))

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
flag = False
for i in range(b * 10, (b + 1) *10):
    if i // 12.5 == a:
        print(i)
        flag = True
        break
if not flag:
    print(-1)

Submission status: Accepted

Solution code:
import math


tax8, tax10 = map(int, input().split())

price8_ue = math.ceil((tax8 + 1) / 0.08) - 1
price8_shita = math.ceil(tax8 / 0.08)
price10_ue = math.ceil((tax10 + 1) / 0.1) - 1
price10_shita = math.ceil(tax10 / 0.1)

range8 = set(range(price8_shita, price8_ue))
range10 = set(range(price10_shita, price10_ue))
tax = range8 & range10
if not tax:
    print(-1)
else:
    print(min(tax))

Submission status: Accepted

Solution code:
# 制約が小さいので全探索
def main():
  a, b = map(int, input().split())
  for i in range(1100):
    if int(i * 0.08) == a and int(i * 0.1) == b:
      print(i)
      return
  print(-1)

main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    a, b = map(int, input().split())
    numbers1 = list()
    numbers2 = list()

    for i in range(1, 1250 + 1):
        if int(i * 0.08) == a:
            numbers1.append(i)

    for i in range(1, 1000 + 1):
        if int(i * 0.1) == b:
            numbers2.append(i)

    c = set(numbers1) & set(numbers2)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

prc1 = A / 0.08
prc1e = (A+1) / 0.08
prc2 = int(B / 0.1)
prc2e = int((B+1) / 0.1)

for p in range(prc2, prc2e):
    if A == int(p*0.08):
        print(p)
        break
else:
    print(-1)

Submission status: Accepted

Solution code:
import math

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

flg = 0
v = 0

for i in range(10000):
    c = math.floor(i * 0.08)
    d = math.floor(i * 0.10)

    if c == a and d == b:
        v = i
        flg = 1
        break

if flg == 1:
    print(v)
else:
    print(-1)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
result=[]
for N in range(10*B,10*B+10):
	if 100*A<=8*N and 8*N<100*A+100:
		result.append(N)
if len(result)==0:
	print(-1)
else:
	print(result[0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
i_str = input()
A,B = map(int,i_str.split())
import sys
import math
#price = 10
#X = math.floor(price * 0.08)
#Y = math.floor(price*0.1)

if A > B:
    print(-1)

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

Submission status: Accepted

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

i = 1
while i <= (100/0.08):
  if int(i * 0.08) == a and int(i * 0.1) == b:
    print(i)
    exit()
  i += 1
print('-1')

Submission status: Accepted

Solution code:
import math

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

    # max
    X_MAX = int(100 / 0.08)
    Y_MAX = int(100 / 0.10)

    x = int(A / 0.08)
    y = int(B / 0.10)


    for i in range(1, Y_MAX + 1):
        if int(i * 0.08) == A and int(i * 0.10) == B:
            print(i)
            return

    '''
    while x < X_MAX:
        y = int(B / 0.10)
        print("x: " + str(x))
        if x == y:
            print(x)
            return
        while y < Y_MAX:
            print(" y: " + str(y))
            y = y * 2
            if x == y:
                print(x)
                return
        x = x * 2
    '''
    print('-1')


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

is_true = False
for x in range(1, 10000):
    if A == math.floor(x * 0.08) and B == math.floor(x * 0.1):
        is_true = True
        break

if is_true:
    print(x)
else:
    print('-1')

Submission status: Accepted

Solution code:

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

#maxA = A+0.99
#maxB = B+0.99

maxA = A+1
maxB = B+1

gAmin = A/8 * 100
gAmax = maxA/8 * 100

gBmin = B*10
gBmax = maxB * 10

#print(gAmin)
#print(gAmax)
#print(gBmin)
#print(gBmax)

if gAmax <= gBmin or gBmax <= gAmin:
    ans = -1
elif gAmin <= gBmin:
    ans = gBmin
else:
    ans = gAmin

if ans - int(ans) > 0:
    ans = int(ans) + 1

print(int(ans))

Submission status: Accepted

Solution code:
import math

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

for i in range(10000):
  target_a = i * 0.08
  target_b = i * 0.1
  if math.floor(target_a) == A and math.floor(target_b) == B:
    print(i)
    exit()
  else:
    pass

print(-1)

Submission status: Accepted

Solution code:
ab = list(map(int, input().split())) 
a= ab[0]
b=ab[1]
 
x=[]
x.append(a/0.08)
x.append((a+1)/0.08)
x.append(b/0.1)
x.append((b+1)/0.1)
if x[0]<= x[2] and x[2]<x[1]:
    print(int(x[2]))
elif x[2]<= x[0] and x[0] < x[3]:
    if x[0]>int(x[0]):
        print(int(x[0])+1)
    else:
        print(int(x[0]))
else:
    print(-1)

Submission status: Accepted

Solution code:
import math

line = input().split(" ")

eight_tax = int(line[0])
ten_tax = int(line[1])

eight_side_price = math.ceil(eight_tax / 0.08)
ten_side_price = math.ceil(ten_tax / 0.1)

while(1):
    break_flg = 0
    for i in range(int(math.fabs(eight_side_price - ten_side_price)) + 1):
        target = eight_side_price if eight_side_price < ten_side_price else ten_side_price
        num = i + target
        if math.floor(num * 0.08) == eight_tax and math.floor(num * 0.1) == ten_tax:
            print(num)
            break_flg = 1

    if break_flg == 0:
        print("-1")
    break

Submission status: Accepted

Solution code:
ans=-1
nums=input().split(" ")
t8,t10=int(nums[0]),int(nums[1])
value=max(round(t8*100/8),round(t10*100/10))+1
for i in range(value):
  v=value-i
  tax8=v*8/100
  tax10=v*10/100
  if tax8>=t8 and tax8<t8+1 and tax10>=t10 and tax10<t10+1:
    ans=v
  elif tax8<t8 or tax10<t10:
    break
print(ans)

Submission status: Accepted

Solution code:
a, b=map(int,input().split())
a_t=a/0.08
a_t2=a_t+0.9/0.08
b_t=b/0.1
if b_t<=a_t2 and b_t>=a_t:
  print(int(b_t))
else:
  if b_t>a_t2 or b_t+9<a_t:
    print(-1)
  for k in range(9):
    b_t+=1
    if b_t<=a_t2 and b_t>=a_t:
      print(int(b_t))
      break

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
val=b*10
huta=str(val)[-2]
while True:
    if str(val)[-2]!=huta:
        print(-1)
        break
    if int(val*0.08)==a:
        print(val)
        break
    val+=1

Submission status: Accepted

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

while PA <= 1250:
    if PA*0.08 >= A:
        break
    else:
        PA += 1

if int(PA*0.1) == B:
    print(PA)

elif PA*0.1 >= B+1:
    print(-1)

else:
    while PA <= 1000:
        if PA*0.1 >= B:
            break
        else:
            PA +=1
    if int(PA*0.08) == A:
        print(PA)
    else:
        print(-1)

Submission status: Accepted

Solution code:
import math
A,B=map(int,input().split())
def ans(A,B):
	for i in range(1,1300):
		if int(math.floor(i*0.1))==B:
			if int(math.floor(i*0.08))==A:
				return i
	return '-1'
print(ans(A,B))

Submission status: Accepted

Solution code:
import math
a,b = map(int, input().split())
ans = []
for i in range(1,1001):
  if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
    ans.append(i)
if ans:
  print(min(ans))
else:
  print(-1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

a_koho = int(A/0.08)
b_koho = int(A/0.1)

# print(a_koho,b_koho)

if a_koho == b_koho:
    # print(a_koho)
    exit()

start = min(a_koho,b_koho)
end = max(a_koho,b_koho)

for i in range(start-100,end+1+100):
    if i < 1:
        continue

    a = int(i*0.08)
    b = int(i*0.1)

    # print(a,b)

    if a == A and B == b:
        print(i)
        exit()

print("-1")

Submission status: Accepted

Solution code:
a,b = list(map(int,input().split()))
flg = False
for i in range (0,1001):
    if(i * 8 // 100 == a and i * 10 // 100 == b):
        print(i)
        flg = True
        break
if(flg == False):
    print(-1)

Submission status: Accepted

Solution code:
#C

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

for i in range(10000):
    
    
    if int(i * (8/100)) == a and int(i * (1/10)) == b:
        print(i)
        break
else:
    print("-1")

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
f_inf = float('inf')
a_x,b_x = [],[]
cnt = 0
for i in range(1,int(100/0.08)+1):
    if int(0.08 * i) == a:
        a_x.append(i)
        cnt += 1
if cnt != 0:
    cnt = 0
    for i in a_x:
        if int(0.1 * i) == b:
            b_x.append(i)
            cnt +=1
if cnt != 0:
    print(min(b_x))
else:
    print(-1)

Submission status: Accepted

Solution code:
import numpy as np
import math as m

def main(**kwargs):
    res = -1
    now = 1263

    while now > 0:
        now -= 1
        
        if (int(now * 0.08) == a and int(now * 0.1) == b):
            res = now

    return res

if __name__ == "__main__":
    cin = np.array(input().split(" ")).astype("int")
    a, b, *_ = cin

    cout = main(a=a, b=b)
    print(cout)

Submission status: Accepted

Solution code:
import math

def main():
    a, b = input().split()
    a, b = int(a), int(b)

    ans = []
    for i in range(1, 1251):
      tax8 = math.floor(i * 0.08)
      tax10 = math.floor(i * 0.10)
      if tax8 == a and tax10 == b:
        ans.append(i)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B = (int(x) for x in input().split())

Amin = 0
Amax = 0
if A%2 == 0:
    Amin = 100*A//8
    Amax = 100*(A + 1)//8
else:
    Amin = 100*A//8 + 1
    Amax = 100*(A + 1)//8 - 1
Bmin = 10*B
Bmax = 10*(B + 1) - 1
if Amin > Bmax or Bmin > Amax:
    print(-1)
else:
    if Amin < Bmin:
        print(Bmin)
    else:
        print(Amin)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

a, b = input().split()

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

xas = math.ceil(a / 0.08)
xab = math.floor((a + 1) / 0.08)
xbs = math.ceil(b / 0.10)
xbb = math.floor((b + 1) / 0.10)

ra = list(range(xas, xab))
rb = list(range(xbs, xbb))

c = set(ra) & set(rb)

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

Submission status: Accepted

Solution code:
import math

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

S=[]

for i in range(1251):
    if math.floor(0.08*i)==A and math.floor(0.1*i)==B:
        S.append(i)
    else:
        S.append(10000)
        
S.sort()

if S[0]==10000:
    print('-1')
else:
    print(S[0])

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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)

if (b_min < a_max and a_min < b_max):
    print(max(a_min, b_min))
else:
    print(-1)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
a_list = [x for x in range(20000) if int(x*0.08) == a]
b_list = [x for x in range(20000) if int(x*0.1) == b]
a_list.extend(b_list)
new_list = sorted([x for x in set(a_list) if a_list.count(x) >1])
if len(new_list) != 0:
    print(new_list[0])
else:
    print(-1)

Submission status: Accepted

Solution code:
import math

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

tax008 = [(a / 0.08), ((a + 1) / 0.08)]
tax010 = [(b / 0.1), ((b + 1) / 0.1)]
min_value = math.ceil(max(tax008[0], tax010[0]))
max_value = math.floor(min(tax008[1], tax010[1]))
if min_value >= max_value:
    print(-1)
else:
    print(min_value)

Submission status: Accepted

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

Alist = []
Blist = []

for i in range(1, 1251) :
  Alist.append(int(i * 0.08))
for i in range(1, 1001) :
  Blist.append(int(i * 0.1))

canA = [i + 1 for i, x in enumerate(Alist) if x == A]
canB = [i + 1 for i, x in enumerate(Blist) if x == B]

can = set(canA) & set(canB)

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

Submission status: Accepted

Solution code:
from math import floor

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

for i in range(1001):
    if floor(i * 0.08) == A and floor(i * 0.1) == B:
        print(i)
        exit()
print('-1')

Submission status: Accepted

Solution code:
import math

a, b = map(int, input().split())
 
x = math.ceil(a/0.08)
ans = 0
while True:    
    y = int(x * 0.1)
    if (y == b):
        ans = 1
        break
    x += 1
    if int((x) * 0.08) > a:
        break
 
if ans == 1:
    print (int(x))
else:
    print (-1)

Submission status: Accepted

Solution code:
import sys
import math

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

for i in range(1, 1001):
    eat_in = math.floor(i * 0.08)
    eat_out = math.floor(i * 0.1)
    if eat_in == a and eat_out == b:
        print(i)
        sys.exit()
print(-1)

Submission status: Accepted

Solution code:
a, b = list(map(int, input().strip().split()))
for i in range(0,1500):
  if int(i*0.08)==a and int(i*0.1)==b:
    print(i)
    break
else:
  print("-1")

Submission status: Accepted

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

a = int(A*12.5)
b = B*10
ans = -1

if a < b:
    for i in range(a, b+2):
        if (int(i*0.1) == B) and (int(i*0.08) == A):
            if ans == -1:
                ans = i

else:
    for i in range(b, a+2):
        if (int(i*0.1) == B) and (int(i*0.08) == A):
            if ans == -1:
                ans = i

print(ans)

Submission status: Accepted

Solution code:
import math

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


def calc():
    global A, B

    for x in range(1, 1001):
        a = math.floor(x * 0.08)
        b = math.floor(x * 0.1)

        if a == A and b == B:
            return x

    return -1


res = calc()
print(res)

Submission status: Accepted

Solution code:
import sys

s = sys.stdin.readline().split()

a, b = map(int, s)
orig_a = a/0.08
if int(orig_a) < orig_a:
    left = int(orig_a) + 1
else:
    left = int(orig_a)
right = left + 1
while True:
    if int(right * 0.08) > a:
        break
    right += 1
for i in range(left, right):
    if int(i * 0.1) == b:
        print(i)
        sys.exit(0)
print(-1)

Submission status: Accepted

Solution code:
import numpy as np
import math

def main():
    a, b = map(int, input().split())

    # print(a/0.08)

    a_ans = np.array([i for i in range(math.ceil(a/0.08), int((a+1)/0.08))])
    b_ans = np.array([j for j in range(math.ceil(b/0.1), int((b+1)/0.1))])

    # print(a_ans)
    # print(b_ans)
    #
    # print(a_ans * 0.08)
    # print(b_ans * 0.1)

    ans = set(a_ans) & set(b_ans)

    # print(ans)

    if ans == set():
        print(-1)
    else:
        print(min(ans))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from functools import lru_cache
from heapq import heappop,heappush
import time
import sys
input=readline = sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s

#main
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from functools import lru_cache
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s

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


s1=set()
s2=set()
for a in range(1,10000):
    if(int(a*0.08)==A):s1.add(a)
for a in range(1,10000):
    if(int(a*0.1)==B):s2.add(a)
C=s1&s2
if(len(C)==0):print(-1)
else:print(min(C))

Submission status: Accepted

Solution code:
import math

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

emin=math.ceil(a/0.08)
emax=math.ceil((a+1)/0.08)-1
tmin=math.ceil(b/0.1)
tmax=math.ceil((b+1)/0.1)-1

if tmin<=emin<=tmax:
    print(emin)
elif emin<=tmin<=emax:
    print(tmin)
else:
    print(-1)

Submission status: Accepted

Solution code:
a,b=(int(x) for x in input().split())
if int(25*(a+1)/2)<int(10*b):
  print(-1)
elif int(25*(a+1)/2)==int(10*b):
  if a%2==1:
    print(-1)
  else:
    print(int(10*b))
elif int(10*(b+1))<=int(25*a/2):
  print(-1)
elif int(10*(b+1)-1)==int(25*a/2):
  if a%2==1:
    print(-1)
  else:
    print(int(25*a/2))  
else:
  if a%2==1:
    print(max([int(25*a/2+1),int(10*b)]))
  else:
    print(max([int(25*a/2),int(10*b)]))

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
if (A/0.08)%1==0.0:
    a1=int(A/0.08)
else:
    a1=int(A/0.08)+1
if ((A+1)/0.08)%1!=0.0:
    a2=int((A+1)/0.08)
else:
    a2=int((A+1)/0.08)-1

if (B/0.1)%1==0.0:
    b1=int(B/0.1)
else:
    b1=int(B/0.08)+1
if ((B+1)/0.1)%1!=0.0:
    b2=int((B+1)/0.1)
else:
    b2=int((B+1)/0.1)-1

a=[]
b=[]
for i in range(a1,a2+1):
    s=i
    a.append(s)
for i in range(b1,b2+1):
    t=i
    b.append(t)
#print(a)
#print(b)
if max(a)<min(b):
    print(-1)
elif max(b)<min(a):
    print(-1)
elif min(a)>=min(b):
    print(min(a))
else:
    print(min(b))

Submission status: Accepted

Solution code:
import math
a, b = map(int, input().split())
ta = a / 0.08
tb = b / 0.10
if (math.floor(ta * 0.1) == b):
  print(math.ceil(ta))
elif (math.floor(tb * 0.08) == a):
  print(math.ceil(tb))
else:
  print(-1)

Submission status: Accepted

Solution code:
import math

A,B = map(int,input().split())
ans = -1
for i in range(10,10000):
    a = math.floor(i * 0.08)
    b = math.floor(i * 0.1)
    if a == A and b == B:
        ans = i
        break

print(ans)

Submission status: Accepted

Solution code:
from math import floor
a,b=map(int,input().split())
A=[]
B=[]
for i in range(1,10001):
    x=int(floor(i*0.08))
    y=int(floor(i*0.1))
    if x==a:
        A.append(i)
    if y==b:
        B.append(i)
A=set(A)
B=set(B)
ans=list(A&B)
if ans:
    print(min(ans))
else:
    print(-1)

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline()[:-1]


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

A_ = []
B_ = []
end = False
for i in range(1, 1001):
	if i*8//100 == A and i//10 == B:
		print(i)
		end = True
		break
	else:
		continue
if end:
	pass
else:
	print(-1)

Submission status: Accepted

Solution code:
import math
A,B = map(int,input().split())
flag = 0
for i in range(1,10**5):
    if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
        print(i)
        flag += 1
        break
if flag == 0:
    print(-1)

Submission status: Accepted

Solution code:
from math import floor, ceil

def get_original_price(a, b):
  inclusive_min = max(12.5*a, 10*b)
  exclusive_max = min(12.5*(a+1), 10*(b+1))
  if inclusive_min >= exclusive_max: return -1
  if ceil(inclusive_min) == exclusive_max: return -1
  if floor(exclusive_max) >= ceil(inclusive_min): return int(ceil(inclusive_min))
  return -1

# 12.5a<=p<12.5(a+1)
# 10b<=p<10(b+1)
# also p must be integer, so the valid range
# must lie around at least one integer value

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

Submission status: Accepted

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

r = b * 10
for i in range(10):
    if math.floor(r * 0.08) == a:
        print(r)
        exit()
    r = r + 1

print('-1')

Submission status: Accepted

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

for i in range(10*a, 10*(a+1) ):
  if i >= 25*b/2 and i < 25*(b+1)/2:
    ans = i
    break
    
print(ans)

Submission status: Accepted

Solution code:
def main():

    A, B = map(int, input().split())
    v_A = int(A / 0.08)
    if (100*A) % (100*0.08) != 0:
        v_A += 1
    v_B = int(B / 0.1)
    if (100*B) % (100*0.1) != 0:
        v_B += 1
    v_A2 = int((A+1) / 0.08)
    v_B2 = int((B+1) / 0.1)

    A_cand = [i for i in range(v_A, v_A2)]
    B_cand = [i for i in range(v_B, v_B2)]

    # print(A_cand)
    # print(B_cand)
    ab_cand = set(A_cand) & set(B_cand)
    if len(ab_cand) == 0:
        print(-1)
    else:
        print(min(ab_cand))
    # print(ab_cand)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
a=A//0.08
b=B//0.10
ans=max(a,b)+1
if int(ans*0.08)==A and int(ans*0.10)==B:
    print(int(ans))
else:
    print(-1)

Submission status: Accepted

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

mid_a = 12.5 * a
mid_b = 10 * b

a_range = [
    i for i in range(
        math.ceil(mid_a),
        math.floor(
            mid_a +
            12 +
            1)) if i > 0]
b_range = [
    i for i in range(
        math.ceil(mid_b),
        math.floor(
            mid_b +
            9 +
            1)) if i > 0]

seki = sorted(list(set(a_range) & set(b_range)))

if seki:
    print(seki[0])
else:
    print(-1)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
flag = 0
for x in range(100000):
  if (int(x * 0.08) == A) & (int(x * 0.1) == B): flag = 1; break
print(x if flag == 1 else -1)