Problem: 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`.

Submission attempts (in order):
a = input()
q = int(input())
b = 0
for i in range(q):
    qi=input()
    if qi==str(1):
        b = b+1
    else:
        qi = qi.split()
        if (int(qi[1])+b)%2==1:
            a = qi[2] + a
        else:
            a = a + qi[2]
if b%2==1:
    a = a[::-1]
    print(a)
else:
    print(a)

aa, bb = map(int,input().split())
a = aa / 0.08
b = bb / 0.1
c = []
if (a-int(a))<0.5:
    for i in range(12):
        if (b-int(b))<0.1:
            for j in range(9):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                pass
        else:
            for j in range(10):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                pass
else:
    for i in range(13):
       if (b-int(b))<0.1:
            for j in range(9):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                pass
        else:
            for j in range(10):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                pass
            for j in range(9):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                    pass
if c==[]:
    print(-1)
elif (int(a)+i)<=0:
    print(-1)
else:
    print(*c[:1])

aa, bb = map(int,input().split())
a = aa / 0.08
b = bb / 0.1
c = []
if (a-int(a))<0.5:
    for i in range(12):
        if (b-int(b))<0.1:
            for j in range(9):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                pass
        else:
            for j in range(10):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                pass
else:
    for i in range(13):
       if (b-int(b))<0.1:
            for j in range(9):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                pass
        else:
            for j in range(10):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                pass
            for j in range(9):
                if int(a)+i == int(b)+j:
                    c.append(int(a)+i)
                else:
                    pass
if c==[]:
    print(-1)
elif (int(a)+i)<=0:
    print(-1)
else:
    print(*c[:1])

import sys
 
a,b = map(int,input().split())
low = int(min(a//0.08,b//0.1))
high = int(max((a+1)//0.08,(b+1)//0.1))
for i in range(low,high+1):
  if int(i*0.08)==a and int(i*0.1)==b:
    print(i)
    sys.exit()
print(-1)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted