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: Runtime Error

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


eight = (int)(a / 0.08)
ten = (int)(b / 0.1)

if eight > ten:
    if (int)(ten * 0.1) == (int)(eight * 0.1):
        print(eight)
    else:
        print(-1)
elif ten > eight:
    if (int)(eight * 0.1) == (int)(ten * 0.08):
        print(ten)
    else:
        print(-1)
else:
    print(ten)# C - Tax Increase
a, b = map((int),(input().split()))


eight = (int)(a / 0.08)
ten = (int)(b / 0.1)

if eight > ten:
    if (int)(ten * 0.1) == (int)(eight * 0.1):
        print(eight)
    else:
        print(-1)
elif ten > eight:
    if (int)(eight * 0.1) == (int)(ten * 0.08):
        print(ten)
    else:
        print(-1)
else:
    print(ten)

Submission status: Runtime Error

Solution code:
a,b=(int(x) for x in input().split())
if int(25*(a+1)/2)<int(10*b):
  print(-1)
if int(25*(a+1)/2)=int(10*b):
  if a%2==0:
    print(-1)
  else:
    print(int(25*a/2))
if int(10*(b+1))<=int(25*a/2):
  print(-1)
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: Runtime Error

Solution code:
import math

x_minA = math.ceil(100 / 8 * A)
x_minB =  10 * B
x_maxA = math.floor(100 / 8 * (A+1))
x_maxB = 10 * (B+1)
if x_minA > x_maxB or x_minB > x_maxA:
  print(-1)
else:
  x = max(x_minA, x_minB)
  while (x * 8 / 100 - A >= 1) or (x / 10 - B >= 1):
    print(x, x * 8 / 100, x / 10)
    x += 1
  print(x)

Submission status: Runtime Error

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

for i in range(10^4):
    if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
        print(i)
        break
else:
    print(-1)

Submission status: Runtime Error

Solution code:
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: Runtime Error

Solution code:
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: Runtime Error

Solution code:
n,a,b=map(int,input().split())
count=int(n/(a+b))*a
n=n%(a+b)
if(n<=b):
    count=count+n
else:
    count=count+b
print(count)

Submission status: Runtime Error

Solution code:
import math

a,b = (int(x) for x in input().split())
amin = math.ceil(float(a/0.08))
amax = math.floor(float((a+1)/0.08))
bmin = math.ceil(float(b/0.1))
bmax = math.floor(float((b+1)/0.1))

if amax < bmin or bmax < amin:
  print(-1)
else:
  la = list(range(amin,amax))
  lb = list(range(bmin,bmax))
  print(min(set(la) & set(lb)))

Submission status: Runtime Error

Solution code:
import math


def main():
    a, b = map(int, input().split())
    if a >= 10:
        ans_a = (a * 100) // 8
        ans = math.floor(ans_a * 0.1)
        if b == ans:
            print(ans_a)
        else:
            print(-1)
    else:
        ary_a = []
        ary_b = []
        ans = []
        for i in range(10):
            ary_a.append((a * 100 + i * 10) // 8)
            ary_b.append((b * 100 + i * 10) // 10)
            for n in ary_b:
                if ary_a.count(n) > 0:
                    ans.append(n)
        print(min(ans))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

x = math.floor(a/0.08)
#1の位が1-9
y = math.floor(b/0.1)
if (x + 1) * 0.08 == a:
    xx = x + 2
else:
    xx = x + 1

for i in range(y,y+10):
    for j in range(x, xx):
        if i == j:
            print(i)
            sys.exit(1)
print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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: Runtime Error

Solution code:
import math
​
A, B = list(map(int,input().split()))
​
cnt = 0
for i in range(1,10000):
    X = math.floor(i * 0.08)
    Y = math.floor(i * 0.1)
    if A == X and B == Y:
        print(i)
        cnt += 1
        break
​
if cnt == 0:
    print(-1)

Submission status: Runtime Error

Solution code:
a,b = list(map(int,(input().split())))
temp_a = int(a/0.08)
temp_b = int(b/0.1)
ans = 0
#print(temp_a,temp_b)
for i in range(min(temp_a,temp_b)/2,max(temp_b,temp_a)+1):
  if  int(i* 0.08) == int(i * 0.1) or temp_a == temp_b:
    ans = i
    break
    
if ans:
  print(ans)
else:
  print(-1)

Submission status: Runtime Error

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

for i in range(10^10):
    if math.floor(i * 0.08) = math.floor(i * 0.1):
        print(i)
        break
else:
    print(-1)

Submission status: Runtime Error

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

A0 = 0
A1 = 0
B0 = 0
B1 = 0

A0 = a / 0.08
A1 = (a+1) / 0.08
B0 = b / 0.1
B1 = (b+1) / 0.1
ans1 = [i for i in range(int(A0), int(A1)+1)]
ans2 = [i for i in range(int(B0), int(B1)+1)]
ans = set(ans1) &  set(ans2)
if ans == {}:
    print('-1')
else:
    print(min(ans))

Submission status: Runtime Error

Solution code:
import math

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

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

print(ans)

Submission status: Runtime Error

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

for i in range(8):
    j=b
    j+=i 
   if math.floor(j*0.08)==a:
       ans=j
       break
if ans!=0:
    print(ans)
else :
    print(-1)

Submission status: Runtime Error

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

s=input()
q=int(input())
cnt=0
qq=[tuple(input().split()) for _ in [0]*q]
for j in qq:
    if  len(j)!=1 :
        if (cnt+int(j[1]))%2==1:
            s=j[2]+s
        else:
            s=s+j[2]
    else:
        cnt+=1
if cnt%2==0:
    print(s)
else:
    print(s[::-1])

Submission status: Runtime Error

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

pa = [[] for i in range(110)]
pb = [[] for i in range(110)]

for i in range(1000):
  pa[int(i*0.08)].append(i)
  pb[int(i*0.10)].append(i)
  
na = min(pa[a])

nb = pb[b]
if min(nb)<=na and max(nb)>=na:
  print(na)
else:
  print(-1)

Submission status: Runtime Error

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

UE_8 = (A+1)/0.08
SHITA_8 = A/0.08
UE_10 = (B+1)/0.10
SHITA_10 = B/0.10

if UE_8 < SHITA_10 or UE_10 < SHITA_8:
    print(-1)
else:
    i = math.ceil(SHITA_8)
    j = math.floor(UE_8)
    for n in range(j-i+1,start=i):
        if i < UE_10 and i >= SHITA_10:
            print(i)
        i+=1

Submission status: Runtime Error

Solution code:
s = input()
q = int(input())
for _ in range(q):
  t = input()
  if t[0]=='1':
    s = s[::-1]
  else:
    if t[2]=='1':
      s = t[4:] + s
    else:
      s = s + t[4:]
print(s)

Submission status: Runtime Error

Solution code:
import sys


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


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


all_set, mod_ = divmod(N, (A+B))
#print(all_set, mod_)
if mod_ == 0:
	print(all_set*A)
elif mod_ - A >= 0:
	print(all_set*A + A)
else:
	print(all_set*A + mod_)

Submission status: Runtime Error

Solution code:
import math
A,B = map(int,input().split())
a = A / 0.08
b = B / 0.1
if math.floor(a * 0.1) == B:
    ans = int(a)
elif math.floor(b * 0.08) == A:
    ans = int(b)
else:
    print(-1)
if math.floor((ans-1)*0.08) == A and math.floor((ans-1)*0.1) == B:
    ans = ans - 1
else:
    print(ans)

Submission status: Runtime Error

Solution code:
from math import ceil, floor

a, b = [int(c) for c in input()]
A = ceil(a / 0.08)
B = ceil(b/ 0.1)
 
if (A < B):
  if (floor(B * 0.08) == a):
    print(B)
  else:
    print(-1)
elif (B < A):
  if (floor(A*0.1) == b):
    print(A)
  else:
    print(-1)
else:
  print(-1);

Submission status: Runtime Error

Solution code:
from math import ceil, floor

a, b = [int(c) for c in input()]
A = ceil(a / 0.08)
B = ceil(b/ 0.1)
 
if (A < B):
  if (floor(B * 0.08) == a):
    print(B)
  else:
    print(-1)
elif (B < A):
  if (floor(A*0.1) == b):
    print(A)
  else:
    print(-1)
else:
	print(-1);

Submission status: Runtime Error

Solution code:
import math

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

min_A = math.ceil(A * 100 / 8)
max_A = ((A + 1) * 100 / 8
min_B = math.ceil(B * 100 / 10)
max_B = (B + 1) * 100 / 10

if (min_A <= min_B and min_B < max_A):
    ans = min_B
elif (min_B <= min_A and min_A < max_B):
    ans = min_A
else:
    ans = -1

print(ans)

Submission status: Runtime Error

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

a = input1[0]
b = input1[1]

for i in range(1, 101):
    c = int(i * 0.08)
    d = int(i * 0.10)
    if a == c and b == d:
        print(i)
        exit(1)
print(-1)

Submission status: Runtime Error

Solution code:
import math
a,b=map(int,input().split())
A=[]
B=[]
for i in range(9):
  A.append(a+i/10)
  B.append(b+i/10)
for i in range(len(A)):
  A[i]=A[i]/0.08
  B[i]=B[i]/0.1
ans=[]
for i in range(len(A)):
  for j in range(len(A)):
    if math.isclose(A[i],B[j]):
      ans.append(A[i])
      break
if ans==[]:
  print(-1)
else:
  print(int(ans[0]))

Submission status: Runtime Error

Solution code:
function Main(input) {
  "use strict"
  const temp = input.split("\n")[0].split(" ");

  const a = parseInt(temp.shift());
  const b = parseInt(temp.shift());

  const a_min = Math.ceil(a * 12.5)
  const a_max = Math.ceil(a * 12.5 + 11.5)
  const b_min = Math.ceil(b * 10)
  const b_max = Math.ceil(b * 10 + 9)
  
  if(a_max < b_min || b_max < a_min) console.log(-1)
  else console.log(Math.max(a_min, b_min))
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Submission status: Runtime Error

Solution code:
A,B = [int(i) for i in input().split()]
emax = (A + 1) / 0.08
emin = A / 0.08
tmax = (B + 1) / 0.08
tmin = B / 0.1

if emin < tmax and emin >= tmin:
    print(int(emin))
elif tmin < emax and tminn >= emin:
    print(int(tmin))
else:
    print(-1)

Submission status: Runtime Error

Solution code:
a,b = [int(c) for c in input()]

A = ceil(a / 0.08)
B = ceil(b/ 0.1)

if (A > B):
  if (floor(B * 0.08) == a):
    print(B);
elif (B > A):
  if (floor(A*0.1) == b):
    print(A);
print(-1);

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(100000):
    if a == math.floor(i*0.08):
        if b == math.floor(i*0.1):
            num = i
            break
print(num)

Submission status: Runtime Error

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

#処理
c=0
d=0
c=max([math.floor(A/0.08),math.floor(B/0.1)])
d=min([math.ceil((A+1)/0.08),math.ceil((B+1)/0.1)])
x=-1
for i in range(c,d+1):
    if math.floor(i*0.08)==A and math.floor(i*0.1)==B:
        z=i
        break
print(z)

Submission status: Runtime Error

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

#処理
c=0
d=0
c=max([math.floor(A/0.08),math.floor(B/0.1)])
d=min([math.ceil((A+1)/0.08),math.ceil((B+1)/0.1)])
print(c,d)
x=-1
for i in range(c,d+1):
    if math.floor(i*0.08)==A and math.floor(i*0.1)==B:
        z=i
        break
print(z)

Submission status: Runtime Error

Solution code:
import numpy as np

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

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

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

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

Submission status: Runtime Error

Solution code:
import math
a,b = map(int,input().split())
a1 = math.round(a/0.08)
b1 = math.round(b/0.1)
c = min(a1,b1)
while True:
	if math.floor(c*0.08) == a and math.floor(c*0.1) == b:
		print(c)
		break
	elif math.floor(c*0.08) != a and math.floor(c*0.1) != b:
		print(-1)
		break
	else:
		c+=1

Submission status: Runtime Error

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: Runtime Error

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 ans b == tax10:
    price = i
    break
    
print(price)

Submission status: Runtime Error

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

xmin = 1
while :
    if int(0.08*xmin) == A and int(0.1*xmin) == B :
        print(int(xmin))
        exit()
    elif int(0.08*xmin) < A or int(0.1*xmin) < B :
        xmin += 1
    else :
        print(-1)
        exit()

Submission status: Runtime Error

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

print(min(A & B))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)

void solve() 
{
    int a,b;
    cin>>a>>b;
    for(double i=1;i<=100000;i++){
        if((int)(i*0.08)==a&&(int)(i*0.1)==b){
            cout<<i<<endl;
            return;
        }
    }
    cout<<-1<<endl;
}

int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
a = [i for i in range(1, 1001) if int(i * 0.08) == A]
b = [i for i in range(1, 1001) if int(i * 0.1) == B]
print(min(set(a) & set(b)))

Submission status: Runtime Error

Solution code:
from sys import stdin
A,B = map(int, stdin.readline().rstrip().split())

def search(x):
    p = (x*0.08)//1
    q = (x*0.10)//1
    if p==A and q==B:
        print(x)
        exit()
    elif p > A or q > B:
        print(-1)
    else:
        search(x+1)

search(1)

Submission status: Runtime Error

Solution code:
a, b = [ int(v) for v in input().split() ]
ans = -1
for i in range(1, 101):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        ans = i
        break
print(ans)

Submission status: Runtime Error

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

tmp = N%(A+B)
if 0 <= tmp <= A:
    print(A*(N//(A+B))+tmp)
else:
        print(A*(N//(A+B)))

Submission status: Runtime Error

Solution code:
import math
import fractions
a,b=map(int,input().split())
#mn=math.ceil(max(b/0.1,a/0.08))
mn=fractions.ceil(max(b/0.1,a/0.08))

mx=min((b+1)/0.1,(a+1)/0.08)
if mn<=mx:
    print(int(mn))
else:
    print(-1)

Submission status: Runtime Error

Solution code:
for i in range(10**6):
    if i*8//100==A and i*10//100==B:
        print(i)
        break
else:
    print(-1)

Submission status: Runtime Error

Solution code:
#include "bits/stdc++.h"
using namespace std;
 
 int main() {
	 
	 int a, b;
	 cin >> a >> b;
	 
	 for (int i=0; i<=1000000; i++) {
		 if (i * 8 / 100 == a) {
			 if (i * 10 / 100 == b) {
				cout << i << endl;
				exit(0); 
			 }
		 }
	 }
	 
	 cout << -1 << endl;
	 
 }