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())
a *= 25
b *= 10
r = max((a + 1) // 2, b)
print((-1, r)[r < min((a + 26) // 2, b + 10)])

Submission status: Accepted

Solution code:
import math
A,B=map(int,input().split())
C=max(math.ceil(100*A/8),math.ceil(10*B))
D=min(math.floor(100*(A+1)/8),math.floor(10*(B+1)))
if C>=D:
    print("-1")
else:
    print(C)

Submission status: Accepted

Solution code:
import math
a, b = map(int,input().split())
ansA = math.ceil(a / 0.08)
ansB = math.ceil(b / 0.1)
if ansA < ansB:
  rr = range(ansA, ansB + 1)
elif ansA > ansB:
  rr = range(ansB, ansA + 1)
else:
  print(ansA)
  exit()
  
for i in rr:
  if math.floor(i * 0.08) == a and math.floor(i * 0.10) == b:
    print(i)
    exit()
print(-1)

Submission status: Accepted

Solution code:
import math

a, b = (int(x) for x in input().split())
ans = 0
i = 0
ok = False

while i < 10000 :
    case_a = math.floor(i * 0.08)
    # print(case_a)
    case_b = math.floor(i * 0.10)
    # print(case_b)

    if case_a == a and case_b == b :
        
        ans = i
        ok = True
        break

    i = i + 1

if ok == False : 
    ans = -1

print(ans)

Submission status: Accepted

Solution code:
a,b=map(float,input().split())
a_tax = a*100//8
b_tax = b*100//10
min_tax = 0

if a_tax <= b_tax:
    min_tax = int(a_tax)
else:
    min_tax = int(b_tax)

r_a_tax = int(min_tax*0.08)
r_b_tax = int(min_tax*0.1)

flag = True
while(flag):
    if r_a_tax == a and r_b_tax == b:
        flag = False
    elif r_a_tax > a or r_b_tax > b:
        print(-1)
        exit()
    else:
        min_tax += 1
        r_a_tax = int(min_tax*0.08)
        r_b_tax = int(min_tax*0.1)

print(min_tax)

Submission status: Accepted

Solution code:
import math
def resolve_c():
    a, b = map(int, input().split())
    flg = 0
    xs = math.ceil(a / 0.08)
    ys = math.ceil(b / 0.1)
    xf = math.ceil((a + 1) / 0.08)
    yf = math.ceil((b + 1) / 0.1)

    for i in range(xs, xf, 1):
        for j in range(ys, yf, 1):
            if i == j:
                flg = 1
                print(i)
                break
        else:
            continue
        break
        
    if flg == 0:
        print(-1)
resolve_c()

Submission status: Accepted

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

flg = True

if math.ceil(12.5*A) >= B*10:
    N = B*10
    while int(N*0.08) < A:
        N += 1
        if int(N*0.1) > B:
            flg = False
            break
    if flg: ans = N

else:
    N = math.ceil(12.5*A)
    while int(N*0.1) < B:
        N += 1
        if int(N*0.08) > A:
            flg = False
            break
    if flg: ans = N

print(ans)

Submission status: Accepted

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

ans = -1
for yen in range(1263):
    a = yen * 8 // 100
    b = yen * 10 // 100
    if a == A and b == B:
        ans = yen
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

x = input().split(" ")

a = int(x[0])
b = int(x[1])

ch = 0
v = []
w = []

for i in range(1250):
    t = int((i + 1) * 0.08)
    if t == a :
        v.append(i + 1)
        ch = 1
    elif t != a and ch == 1 :
        break
ch = 0

for i in range(1000):
    t = int((i + 1) * 0.1)
    if t == b :
        w.append(i + 1)
        ch = 1
    elif t != b and ch == 1 :
        break
ans = -1

for i in v :
    for j in w :
        if i == j :
            ans = i
            break
    if i == j :
        break

print(ans)

Submission status: Accepted

Solution code:
import math
A, B = map(int, input().split())
value = math.ceil(A / 0.08)
limit = math.ceil((A + 1) / 0.08)
while value < limit:
    if B == int(value * 0.1):
        print(value)
        break
    value += 1
else:
    print('-1')

Submission status: Accepted

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

A = []
B = []
S = []


if a % 2 == 0:
    for i in range(13):
        A.append(int((12.5*a))+i)
else:
    for i in range(1,13):
        A.append(int((12.5*a))+i)
        

for k in range(10):
    B.append((10*b)+k)
    
if len(list((set(A))& set(B))) > 0:
    S = list((set(A))& set(B))
    print(min(S))
else:
    print(-1)

Submission status: Accepted

Solution code:
import math
 
A, B = map(int, input().split())
min_ans = -(-A // 0.08)
 
kouho = [min_ans]
to_continue = True
while to_continue:
    min_ans += 1
    if math.floor(min_ans * 0.08) == A:
        kouho.append(min_ans)
    else:
        break
        
print_flag = False
for i in kouho:
    if math.floor(i * 0.1) == B:
        print_flag = True
        print(int(i))
        break
    
if print_flag == False:
    print(-1)

Submission status: Accepted

Solution code:
import math

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

test1 = math.ceil((a+1) / 0.08 -1)
test2 = math.ceil(a / 0.08)
test3 = math.ceil((b+1) / 0.10 -1)
test4 = math.ceil(b / 0.10)

if test2 >= test4 and test2 <= test3:
    print(test2)
elif test4 >= test2 and test4 <= test1:
    print(test4)
else:
    print("-1")

Submission status: Accepted

Solution code:
from math import ceil
A, B = map(int, input().split(' '))
x0 = ceil(A / 0.08)
x1 = ceil((A+1) / 0.08)
y0 = ceil(B / 0.1)
y1 = ceil((B+1) / 0.1)
if x1 <= y0 or y1 <= x0:
  print(-1)
else:
  print(min(max(x0, y0), min(x1, y1)))

Submission status: Accepted

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

if 100*A%8 == 0:
    ans1 = int(A/0.08)
else:
    ans1 = int(A/0.08) + 1
ans2_max = int(ans1 + ans1*0.1)

ans2 = int(B/0.1)

if ans2 > ans2_max:
    print(-1)
    sys.exit()

while True:
    if int(ans1*0.08) == A and int(ans1*0.1) == B:
        print(ans1)
        break
    if ans1 > ans2_max:
        print(-1)
        break
    ans1 += 1

Submission status: Accepted

Solution code:
import math

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


def calc_a(n):
    return n // 0.08


def calc_b(n):
    return n / 0.1


estimate = int(min(calc_a(a), calc_b(b)))
for i in range(estimate, estimate*2):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        print(i)
        exit()

print(-1)

Submission status: Accepted

Solution code:
ans=0
a,b=map(int,input().split())
for i in range(10000):
    ans1=int(i*1.08)
    ans2=int(i*1.1)
    ans11=ans1-i
    ans22=ans2-i
    if ans11==a and ans22==b:
        print(i)
        exit(0)
print(-1)

Submission status: Accepted

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

lA=[]
lB=[]

minV,minID=0,0
for i in range(1300):
    k=int(i*0.08)
    if minV<k:
        lA.append((minID,i-1))
        minV=k
        minID=i

minV,minID=0,0
for i in range(1300):
    k=int(i*0.1)
    if minV<k:
        lB.append((minID,i-1))
        minV=k
        minID=i

a1,a2=lA[a]
b1,b2=lB[b]

for i in range(min(a1,a2,b1,b2),max(a1,a2,b1,b2)+1):
    if a1<=i and b1<=i and a2>=i and b2>=i:
        print(i)
        exit(0)

print(-1)

Submission status: Accepted

Solution code:

import glob


# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\158\\C'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        q = [int(i) for i in self.input_data().split()]

        A = q[0]
        B = q[1]

        no_tax_A = int(A / 0.08) # + 0 - 12
        no_tax_B = int(B / 0.1)  # + 0 - 9

        if int(no_tax_A) * 0.08 != A:
            no_tax_A += 1

        if no_tax_A == no_tax_B:
            result = no_tax_A
        elif no_tax_A > no_tax_B:
            if int(no_tax_A * 0.1) == B:
                result = no_tax_A
            else:
                result = -1
        else:
            if int(no_tax_B * 0.08) == A:
                result = no_tax_B
            else:
                result = -1

        print(str(result))

solver = Solver(REL_PATH)
solver.exec_resolve()

Submission status: Accepted

Solution code:
import math

f = [int(i) for i in input().split()]
a = f[0]
b = f[1]

a_lower = math.ceil(a/0.08)
a_upper = int((a+1)/0.08)
b_lower = math.ceil(b/0.1)
b_upper = int((b+1)/0.10)

#print(a_lower,a_upper,b_lower,b_upper)
g = 0
for i in range((a_lower),(a_upper)):
  if (b_lower <= i < b_upper):
    print(str(int(i)))
    g = 1
    break
if g == 0:
  print("-1")

Submission status: Accepted

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

def abc158c(a, b):
    min_b = b * 10
    for cand in range(min_b, min_b+10):
        if int(cand * 0.08) == a:
            return cand
    
    return -1

###
# main
if(__name__ == '__main__'):
    # input
    a, b = map(int, input().split(" "))
    
    accomplishment = abc158c(a, b)
    
    # output
    print(accomplishment)
# else:
    # do nothing

Submission status: Accepted

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

Submission status: Accepted

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

x_min_tmp = A * 12.5
if x_min_tmp.is_integer:
  x_min = int(x_min_tmp)
else:
  x_min = int(x_min_tmp) + 1

x_max_tmp = (A + 1) * 12.5
x_max = int(x_max_tmp) + 1

ans = -1
for n in range(x_min, x_max + 1):
  if int(n * 0.08) == A and int(n * 0.1) == B:
    ans = n
    break

print(ans)

Submission status: Accepted

Solution code:
import math
from decimal import *
A,B=list(map(lambda i:int(i),input().split()))


Amax = (A+0.9)
Amax= Decimal(str(Amax))/ Decimal('0.08')
Amin = Decimal(str(A))/ Decimal('0.08')


Bmax= (B+0.9)
Bmax= Decimal(str(Bmax)) *  Decimal('10')
Bmin = Decimal(str(B)) *  Decimal('10')

As = list(range(math.ceil(Amin), math.floor(Amax)+1))
Bs = list(range(math.ceil(Bmin), math.floor(Bmax)+1))

A_B = set(As) & set(Bs)


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

Submission status: Accepted

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

low_A = A / 0.08
low_B = B / 0.10
high_A = (A + 1) / 0.08
high_B = (B + 1) / 0.10

result = 0
if (low_A >= high_B) or (low_B >= high_A):
  result = -1
else:
  low_end = low_B if (low_A < low_B) else low_A
  result = math.ceil(low_end)

print(result)

Submission status: Accepted

Solution code:
a, b = [int(x) for x in input().split()]
 
if (b < a):
    tmp = b
    b = a
    a = tmp
 
 
x = 1
while True:
    if (int(x*0.08) == a and int(x*0.1) == b):
        print(x)
        break
    else:
        if (x > 1500):
            print(-1)
            break
        else:
            x += 1

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
tmp = range(int(y//0.1)+1, int((y+1)/0.1))
ans=-1
for i in range(int(x//0.08)+1, int((x+1)/0.08)):
    if i in tmp:
        ans=i
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = []
for i in range(1,1251):
    if a == int(i*0.08) and b == int(i*0.1):
        ans.append(i)

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
for i in range(int(a/0.08+0.5), int((a+1)/0.08+0.5)):
    if int(i * 0.1) == b:
        print(i)
        break
else: print(-1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

if A == 0 and B == 0:
  print(0)
  exit()

Amin = A + 0.0
Amax = A + 0.9
Bmin = B + 0.0
Bmax = B + 0.9
priceA = priceB = 0
priceAA = priceBB = 0

priceA = math.ceil(Amin / 0.08)
priceAA = math.ceil(Amax / 0.08)
priceB = math.ceil(Bmin / 0.10)
priceBB = math.ceil(Bmax / 0.10)

ansi = ansj = 0

for i in range(priceA, priceAA+1):
  if i == priceB:
    ansi = i
    break
  if i == priceBB:
    ansi = i
    break

for j in range(priceB, priceBB+1):
  if j == priceA:
    ansj = j
    break
  if j == priceAA:
    ansj = j
    break

#print(priceA, priceAA)
#print(priceB, priceBB)
#print(ansi, ansj)

if ansi == 0 and ansj == 0:
  print(-1)
else:
  if ansi ==0 or ansj == 0:
    print(max(ansi, ansj))
  else:
    print(min(ansi, ansj))

Submission status: Accepted

Solution code:
import math
A, B = map(int, input().split())
x1 = math.ceil(100 * A / 8)
x2 = 100 * (A+1) / 8
y1 = 100 * B / 10
y2 = 100 * (B+1) / 10
if x1 <= y1 and y1 < x2:
  print(int(y1))
elif y1 <= x1 and x1 < y2:
  print(int(x1))
else:
  print(-1)

Submission status: Accepted

Solution code:
import math
A, B = map(float, input().split())
p = max(A/0.08,B/0.1)
q = min((A+1)/0.08,(B+1)/0.1)
if q.is_integer():
    q = q-1
low = math.ceil(p)
high = math.floor(q)
if low>high:
    print(-1)
else:
    print(low)

Submission status: Accepted

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

if -(-a//0.08) < -(-(b+1)//0.1) and -(-b//0.1) < -(-(a+1)/0.08):
    print(int(max(-(-a//0.08), -(-b/0.1))))
else:
    print(-1)

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:
import math

raw_input = input()
l = raw_input.split()
A = int(l[0])
B = int(l[1])

A_min = math.ceil((A*100)/8)
A_maxlim = math.floor(((A+1)*100)/8)

#print(str(A_min)+","+str(A_maxlim))

B_min = math.ceil((B*100)/10)
B_maxlim = math.floor(((B+1)*100)/10)

#print(str(B_min)+","+str(B_maxlim))

if A_min <= B_min and B_min < A_maxlim:
    print(B_min)
elif B_min <= A_min and A_min < B_maxlim:
    print(A_min)
else:
    print("-1")

Submission status: Accepted

Solution code:
from math import floor, ceil

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

pa1 = ceil(A * 100 / 8.0)
pa2 = floor((A * 100 + 100) / 8.0)
pb1 = ceil(B * 100 / 10.0)
pb2 = floor((B * 100 + 100) / 10.0)

p1 = max(pa1, pb1)
if p1 >= pa2 or p1 >= pb2:
    print(-1)
else:
    print(p1)

Submission status: Accepted

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

c = -1
for i in range(13, 1500):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        c = i
        break

print(c)

Submission status: Accepted

Solution code:
import math

a, b = map(int, input().split())
c1 = a / 0.08
c2 = b / 0.1
kouho = []
for i in range(10):
  if math.floor((c2 + i) * 0.08) == a: 
    print(int(c2 + i))
    exit()
print(-1)

Submission status: Accepted

Solution code:
import sys
import math
def input(): return sys.stdin.readline().rstrip()

def main():
    A, B = map(int, input().split())
    a = math.floor(A // 0.08)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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




for i in range(1,1001):
    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())
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:
  min = a_min
else:
  min = b_min
if a_max < b_max:
  max = a_max
else:
  max = b_max
min = math.ceil(min)
if math.floor(max) == max:
  max = max - 1 
else:
  max = math.floor(max)
if min <= max:
  print(min)
else:
  print(-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

a,b =map(int,input().split())
# mは原価
m = math.ceil(a*(100/8))
while int(m*(8/100)) == a:
    if int(m*0.1) == b:
        print(m)
        break
    else:
        m += 1
else:
    print(-1)

Submission status: Accepted

Solution code:
import math

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

# 消費税が8%のときA円になる税抜き価格xの範囲
per8_list = []
for i in range(math.ceil(A / 0.08), math.ceil(A / 0.08)+13):
  if math.floor(i*0.08) == A:
    per8_list.append(i)
per8_set = set(per8_list)
per10_set = set(range(math.ceil(B / 0.1), math.ceil(B / 0.1)+10))

x = per8_set & per10_set

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

Submission status: Accepted

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

prca = math.ceil(a / 0.08)
prcb = math.ceil(b / 0.1)
base = max(prca, prcb)
while True:
    if int(base * 0.08) < a or int(base * 0.1) < b:
        ans = base + 1
        break
    base -= 1

if int(ans * 0.08) != a or int(ans * 0.1) != b:
    ans = -1
    
print(ans)

Submission status: Accepted

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

a_min, a_max = math.ceil(12.5 * a), math.floor(12.5 * (a + 1)) - 1
b_min, b_max = math.ceil(10 * b), math.floor(10 * (b + 1)) - 1
# print(a_min, a_max)
# print(b_min, b_max)

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

Submission status: Accepted

Solution code:
from math import ceil
from math import floor
A, B = map(int, input().split())
a1 = ceil(A/0.08)
b1 = ceil(B/0.10)
a2 = floor((A+1)/0.08)-1
b2 = floor((B+1)/0.10)-1
if b2 < a1 or a2 < b1:
  print(-1)
else:
  print(max(a1, b1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
A = []
B = []

for i in range(1,1263):
    if (100/8)*(a) <= i < (100/8)*(a+1):
        A.append(i)
        
for i in range(1,1011):
    if (100/10)*(b) <= i < (100/10)*(b+1):
        B.append(i)
        
A = set(A)
B = set(B)

C = A&B

if len(C) > 0:
    print(min(C))
else:
    print(-1)

Submission status: Accepted

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

def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]

la = [-1]*10099
lb = [-1]*10099


for i in range(10099):
  la[i] = math.floor(i*0.08) 

for i in range(10099):
  lb[i] = math.floor(i*0.1)

alist = (my_index_multi(la,A))
blist = (my_index_multi(lb,B))

alist.sort()
blist.sort()


andl = list(set(alist) & set(blist))
andl.sort()
if len(andl) > 0:
  print(andl[0])
  
else :
  print(-1)

Submission status: Accepted

Solution code:
# coding: utf-8


def main():
    tax_8, tax_10 = map(int, input().split())

    rate8 = 0.08
    rate10 = 0.1
    value8 = tax_8 / rate8
    value10 = tax_10 / rate10
    price_min = int(min(value8, value10))
    price_max = int(max(value8, value10)) + 1

    for price in range(price_min, price_max + 1):
        if int(price * rate8) == tax_8 and int(price * rate10) == tax_10:
            print(price)
            return 0
   
    print('-1')

    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Sat Mar  7 12:40:36 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

A, B = na()
ans = -1
for i in range(10100):
    if int(i * 0.08) == A and int(i * 0.1) == B:
        ans = i
        break

print(ans)

Submission status: Accepted

Solution code:
def ceil(n):
    return(n//1)

a,b=map(float,input().split())
t=[]
for i in range(10000):
    if ceil(i*0.08)==a and ceil(i*0.1)==b:
        t.append(i)
if len(t)==0:
    print(-1)
else:
    print(min(t))

Submission status: Accepted

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

Submission status: Accepted

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

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

na = int(A / 8)
if A % 8 > 0:
    na +=1
npa = int((A + 100) / 8)
if (A + 100) % 8 == 0:
    npa -= 1

nb = int(B / 10)
if B % 10 > 0:
    nb +=1
npb = int((B + 100) / 10)
if (B + 100) % 10 == 0:
    npb -= 1

if na <= npb and nb <= npa:
    print(max(na, nb))
else:
    print(-1)

Submission status: Accepted

Solution code:
import math
A, B = map(int, input().split(' '))
flg = False
for i in range(0, 1001):
    if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
        print(i)
        flg = True
        break
if flg==False:
  print(-1)

Submission status: Accepted

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

mina = ceil(a/0.08)
minb = ceil(b/0.1)

la = []
lb = set()

flag = True
while flag == True:
    if int(mina * 0.08) == a:
        la.append(mina)
        mina += 1
    else:
        break
while flag == True:
    if int(minb * 0.1) == b:
        lb.add(minb)
        minb += 1
    else:
        break
for i in la:
    if i in lb:
        print(i)
        break
else:
    print(-1)

Submission status: Accepted

Solution code:
A,B=input().split()
a=int(A)
b=int(B)
am=a/0.08
aM=(a+1)/0.08
bm=b/0.1
bM=(b+1)/0.1
import math
am=math.ceil(am)
aMx=math.floor(aM)
if aMx==aM:
  aM=aMx-1
else:
  aM=aMx
bm=math.ceil(bm)
bMx=math.floor(bM)
if bMx==bM:
  bM=bMx-1
else:
  bM=bMx

if am<=bm:
  if bm<=aM:
    x=bm
  else:
    x=-1
else:
  if am<=bM:
    x=am
  else:
    x=-1
print(x)

Submission status: Accepted

Solution code:
import numpy as np

AB=np.array(input().split(" "),dtype=np.int32)

A=AB[0]
B=AB[1]

canA=A/0.08
canB=B/0.1

start=0
if(canA<canB):
    start=canA
else:
    start=canB

ans=-1
th=2*start
while (True):
    outA=int(start*0.08)
    outB=int(start*0.10)
    if(outA==A and outB==B):
        ans=start
        break
    if(start>2*th):
        break
    start+=1

print(int(ans))

Submission status: Accepted

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

for i in range(1, 1001):
  if a <= i*0.08 < a+1:
    if b <= i*0.1 < b+1:
      print(i)
      exit(0)
      
print(-1)

Submission status: Accepted

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

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

print(-1)

Submission status: Accepted

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

N_A = A / 0.08
N_B = B / 0.1
A_list = [int(N_A + i) for i in range(20) if A <= int(N_A+i)*0.08 < A+1]
B_list = [int(N_B + i) for i in range(20) if B <= int(N_B+i)*0.1 < B+1]

N_min = float('inf')
for i in B_list:
    if i in set(A_list) and i < N_min:
        N_min = i
if N_min == float('inf'):
    print(-1)
else:
    print(N_min)

Submission status: Accepted

Solution code:
import math
a, b = list(map(int, input().split(' ')))
e = True
for i in range(11, 1010):
    n8 = math.floor(i * 0.08)
    n10 = math.floor(i*0.1)
    if n8 == a and n10 == b:
        print(i)
        e = False
        break
if e:
    print(-1)

Submission status: Accepted

Solution code:
import math
A,B = list(map(int,input().split()))
before_min_A = math.ceil(A * 12.5)
before_min_B = B * 10
if before_min_B <= before_min_A < before_min_B + 10:
    print(before_min_A)
elif before_min_A <= before_min_B < before_min_A + 12:
    print(before_min_B)
else:
    print("-1")

Submission status: Accepted

Solution code:
import math

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

def func():
    b = B*10
    for i in range(b,2*b):
        if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
            return i
    return -1
    
print(func())

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
for yen in range(1, 100*10+1):
    if int(yen * 0.08) == a and int(yen * 0.1) == b:
        print(yen)
        exit()
print(-1)

Submission status: Accepted

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

def check1(k):
    return math.floor(k*0.08) == math.floor(k*0.1)

def check2(k, A , B):
    return math.floor(k*0.08) == A and math.floor(k*0.1) == B

def solve(A: int, B: int):
    k1 = A / .08
    k2 = B / .1

    min_k = math.floor(min(k1 - k1*0.08, k2 - k2 * 0.1))
    max_k = math.floor(max(k1 + k1*0.08, k2 + k2 * 0.1))

    # min_k = math.floor(min(k1 - k1*0.08, k2 - k2 * 0.1))
    # max_k = math.floor(max(k1 + k1*0.08, k2 + k2 * 0.1))

    ans = -1
    for k in range(min_k, max_k+1):
        c1 = check1(k)
        c2 = check2(k, A, B)
        if c2:
            ans = k
            break

    print(ans)
    
    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:
# AtCoder Beginner Contest 157: C (2020/03/07)
import math
A, B = map(int, input().split())
X = math.ceil(A/0.08)
Z = -1
while True:
    if int(X*0.08) != A:
        break
    if int(X*0.10) == B:
        Z = X
        break
    X = X + 1
print(Z)

Submission status: Accepted

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

for i in range(9):
    j=b
    j+=i 
    if int(j*0.08)==a:
        ans=j
        break
if ans!=0:
    print(ans)
else :
    print(-1)

Submission status: Accepted

Solution code:
import math

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

min = int(math.ceil(a / 0.08))
max = min
while math.floor(max * 0.08) == a:
    max += 1

for i in range(min, max):
    if math.floor(i * 0.1) == b:
        print(i)
        break
else:
    print(-1)

Submission status: Accepted

Solution code:
isFound = False
li = list(map(int,input().split()))
min = int(li[0] / 0.08)
max = int((li[0] + 1) / 0.08) - 1
for i in range(min, max):
    if((int(i * 0.1) == li[1]) and (int(i * 0.08) == li[0])):
        print(i)
        isFound = True
        break
if(not(isFound)):
    print(-1)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
ans = -1
for i in reversed(range(1,1001)):
  if int(i*1.08)-i == a and int(i*1.10)-i == b:
    ans = i
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8


def main():
    tax8, tax10 = map(int, input().split())

    rate8 = 0.08
    rate10 = 0.1
    value8 = tax8 / rate8
    value10 = tax10 / rate10
    price_min = int(min(value8, value10))
    price_max = int(max(value8, value10)) + 1

    for price in range(price_min, price_max + 1):
        if int(price * rate8) == tax8 and int(price * rate10) == tax10:
            print(price)
            return 0
   
    print('-1')

    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
amin = -(-a*25//2)
amax = -(-(a+1)*25//2)
bmin = b*10
bmax = bmin + 10
for i in range(amin, amax):
    for j in range(bmin, bmax):
        if i == j:
            print(i)
            exit()
print(-1)

Submission status: Accepted

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

for i in range(1, 1011):
    n_a = math.floor(i * 0.08)
    n_b = math.floor(i * 0.1)
    if n_a == A and n_b == B:
        ans = i
        break
    ans = -1

print(ans)

Submission status: Accepted

Solution code:
import math

a,b=map(int,input().split())
ans=1e9

for i in range(1300):
    if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
        ans=min(ans,i)
            
if ans==1e9:
    print("-1")
else:
    print(ans)