Problem:


Score : 100 points

Problem Statement

You are given positive integers X and Y.
If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it.
If it does not exist, print -1.

Constraints

1 ≤ X,Y ≤ 10^9

X and Y are integers.

Input

Input is given from Standard Input in the following format:

X Y

Output

Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.

Sample Input 1

8 6

Sample Output 1

16

For example, 16 is a multiple of 8 but not a multiple of 6.

Sample Input 2

3 3

Sample Output 2

-1

A multiple of 3 is a multiple of 3.



Sample input:
8 6


Sample output:
16

Submission status: Wrong Answer

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

X, Y = map(int, input().split())
if X < Y:
    X, Y = Y, X
    
if X % Y == 0:
    print(-1)
    exit()

print(X)

Submission status: Wrong Answer

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

X, Y = map(int, input().split())
if X < Y:
    X, Y = Y, X
    
if X % Y == 0:
    print(-1)
    exit()

def gcd(x, y):
    if x < y:
        x, y = y, x
    if x % y == 0:
        return y
    return gcd(y, x % y)

t = X * Y // gcd(X, Y) - X
if t > 10 ** 18:
    print(-1)
else:
    print(t)

Submission status: Wrong Answer

Solution code:
def main() :
    X,Y = [int(i) for i in input().split()]

    if (Y % X == 0) :
        print(-1)
    else :
        print(X)

    # if (X == Y or Y == 1) :
    #     print(-1)
    #     return
    
    # if (X == 1) :
    #     print(Y+1)
    #     return
    
    # n = X
    # while (n < 1000000000000000000) :
    #     if (n % X == 0 and n % Y != 0) :
    #         print(n)
    #         return
        
    #     n += X
    
    # print(-1)

main()

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
A = l[0];
B = l[1];

if(A%B == 0):
    print(-1)
else:
    xa = A;
    while ((xa%B != 0) and (xa <= 10**18)):
        xa += A;
    if(xa%B == 0):
        print(xa);
    else:
        print(-1);

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
A = l[0];
B = l[1];

if(A%B == 0):
    print(-1)
else:
    xa = A;
    while xa%B != 0:
        xa += A;
    print(xa);

Submission status: Wrong Answer

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

def solve(X, Y):
    if X == Y:
        return -1
    for x in range(X, 10**18+1, X):
        if x % Y != 0:
            return x
solve(X, Y)

Submission status: Wrong Answer

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

def solve(X, Y):
    if X == 1:
        return -1
    if X == Y:
        return -1
    for x in range(X, 10**18+1, X):
        if x % Y != 0:
            return x
solve(X, Y)

Submission status: Wrong Answer

Solution code:

X,Y= map(int, input().split())
print(X*Y if X != Y else -1)

Submission status: Wrong Answer

Solution code:

X,Y= map(int, input().split())
print(X if X != Y else -1)

Submission status: Wrong Answer

Solution code:
X,Y = map(int,input().split())

x = max(X,Y)
y = min(X,Y)

if x % y == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
X,Y=map(int,input().split())
print(-1 if Y%X==0 else X)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())

if y%x==0 or x%y==0:
  print(int(-1))
  
else:
  print(int(x*2))

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())

if y%x==0 or x%y==0:
  print(-1)
  
else:
  print(int(x))

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())

if y%x==0 or x%y==0:
  print(-1)
  
else:
  print(int(x*2))

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())

if y%x==0 or x%y==0:
  print(-1)

  
  
else:
  print(int(x*(y+1)))

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())

if y%x==0:
  print(-1)

  
  
else:
  print(int(x*(y+1)))

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())

if y%x==0:
  print(-1)

else:
  print(int(x*(y-1)))

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())

if y*x % x == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())

if y % x == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())

if max(x, y) % min(x, y) == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())

if max(x, y) % min(x, y) == 0:
    print(-1)
else:
    print(min(x, y))

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
result = (max(x, y)-min(x, y))*min(x, y)

if result == 0:
    print(-1)
else:
    print(result)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
result = -1

for i in range(1, 10**9+1):
    if x*i != y*i:
        result = x*i
        break

print(result)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
x,y = map(int,input().split())
if x % y  == 0 or x > 10**18:
	print(-1)
else:
	print(2*x)

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split())
if X%Y==0:
	i = 1
	ans = X*i
	while ans%Y!=0:
		i += 1
		ans = X*i
	print(ans)
else:
	print(-1)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if(a%b):
  print(a*b-1)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
if x == y:
  print(-1)
else:
  now = x
  k = 1
  M = pow(10, 18)
  while now <= M:
    now = k * now
    if now % y != 0:
      break
    k += 1
  print(now)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
if x//y>=1 and x%y==0:
    print(-1)
    exit()
t=2
p=100000000000000000
#while 1:
for i in range(400):
    if x*t>p:
        break
    elif x*t%y:
        print(x*t)
        exit()
print(-1)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
if x//y>=1 and x%y==0:
    print(-1)
    exit()
t=2
p=100000000000000000
#while 1:
for i in range(4):
    if x*t>p:
        break
    elif x*t%y:
        print(x*t)
        exit()
print(-1)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if b%a==0:
  print(-1)
else:
  print(a*(b+1))

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
print(x*(y+1)) if x != y else print(-1)

Submission status: Wrong Answer

Solution code:
X,Y = map(int,input().split())
if X%Y == 0:
    print(-1)
else:
    ans = X
    while ans <= 10**18:
        ans += ans
        if ans % Y != 0:
            break
    if ans > 10**18:
        print(-1)
    else:
        print(ans)

Submission status: Wrong Answer

Solution code:
X,Y = map(int,input().split())
if X%Y == 0:
    print(-1)
else:
    ans = X
    while ans < 10**18:
        ans += ans
        if ans % Y != 0:
            break
    if ans % Y != 0:
        print(ans)
    else:
        print(-1)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
if x % y == 0:
  print(-1)
else:
  z = x
  while z%y !=0:
    z = z*z
    
  print(z)

Submission status: Wrong Answer

Solution code:
x,y = (int(i) for i in input().split())

if x%y==0:
    print(-1)
    exit()

for i in range(2,y):
    if x*i%y!=0:
        print(x*i)
        exit()

Submission status: Wrong Answer

Solution code:
X,Y = map(int,input().split())
if Y % X == 0:
    print(-1)
else:
    print(X)

Submission status: Wrong Answer

Solution code:
X,Y = map(int,input().split())
if X < Y:
    print(X)
elif X == Y:
    print(-1)
else:
    if X % Y != 0:
        print(X)
    else:
        print(X*2)

Submission status: Wrong Answer

Solution code:
import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


X,Y = map(int,input().split())
if X < Y:
    print(X)
elif X == Y:
    print(-1)
else:
    print(int(lcm(X,Y)-X))

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
print(-1 if x%y else x)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
if x % y == 0:
    print(-1)
else:
    print(x*y)

Submission status: Wrong Answer

Solution code:
X,Y = map(int,input().split())
if X==Y:
  print(-1)
elif 2*X!=Y:
  print(2*X)
else:
  print(3*X)

Submission status: Wrong Answer

Solution code:
import fractions as f
a,b=map(int,input().split())
if a==1 or b==1:
    print(0)
elif a%b==0 or b%a==0:
    print(-1)
else:
    x=a*b//f.gcd(a,b)-a
    print(x)

Submission status: Wrong Answer

Solution code:
print(-1)

Submission status: Wrong Answer

Solution code:
import fractions as f
a,b=map(int,input().split())
if a%b==0 or b%a==0:
    print(-1)
else:
    x=a*b//f.gcd(a,b)-a
    if x>10**18:
        print(-1)
    else:
        print(x)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())

if y == 1:
    res = -1
    
elif x % y == 0:
    res = -1
else:
    for i in range(1, 10 ** 6):
        if x * i % y != 0:
            print(x * i)
            break

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())

if y == 1:
    res = -1
    
elif x == y:
    res = -1
else:
    for i in range(1, 10 ** 6):
        if x * i % y != 0:
            print(x * i)
            break

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if M%N==0:print(-1)
else:print(N*M)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if b%a==0:
  print(-1)
else:
  print(a)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if b%a!=0:
  print(a)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import sys
import math
input = sys.stdin.readline
x,y = map(int,input().split())
if y % x == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
x,y = (int(i) for i in input().split())
if x== y or y == 1:
  print(-1)
  exit()
else:
  print(x*(y-1))

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split())
if X % Y == 0 or Y % X == 0:
  print(-1)
else:
  print(X)

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split())
if X % Y == 0 or Y % X == 0:
  print(-1)
else:
  for i in range(2, 10**9):
    if X * i % Y != 0:
      if X * i < 10**18:
        print(X * i)
        exit()
      else:
        print(-1)
        exit()

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split())
if X % Y == 0 or Y % X == 0:
  print(-1)
else:
  for i in range(2, 10**9):
    if X * i % Y != 0:
      print(X * i)
      exit()

Submission status: Wrong Answer

Solution code:
import sys
import math
input = sys.stdin.readline
x,y = map(int,input().split())
if y % x == 0 or x > 10**8:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
import sys
import math
input = sys.stdin.readline
x,y = map(int,input().split())
if x % y == 0 or y % x == 0:
    print(-1)
else:
    count = 1
    while True:
        c = x*count
        if c % y != 0 and c <= 10**8:
            print(c)
            exit()
        elif c > 10**8:
            break
        else:
            count += 1 
    print(-1)

Submission status: Wrong Answer

Solution code:
import sys
import math
input = sys.stdin.readline
x,y = map(int,input().split())
if x % y == 0 or y % x == 0:
    print(-1)
else:
    count = 1
    while True:
        c = x*count
        if c % y != 0 and c <= 10**8:
            print(c)
            exit()
        elif c > 10**8:
            break
        else:
            count += 1 
print(-1)

Submission status: Wrong Answer

Solution code:
import sys
import math
input = sys.stdin.readline
x,y = map(int,input().split())
if x % y == 0 or y % x == 0:
    print(-1)
else:
    count = 1
    while True:
        c = x*count
        if c % y != 0:
            print(c)
            exit()
        else:
            count += 1

Submission status: Wrong Answer

Solution code:
import sys
import math
input = sys.stdin.readline
x,y = map(int,input().split())
if x % y == 0 or y % x == 0:
    print(-1)
else:
    count = 1
    while True:
        c = x*count
        if c % y != 0:
            print(c)
            exit
        else:
            count += 1

Submission status: Wrong Answer

Solution code:
[print(x*(y-1)if y%x else-1)for x,y in[[int(i)for i in input().split()]]]

Submission status: Wrong Answer

Solution code:
[print(-1 if x==y else x*(y-1)) for x,y in [[int(i) for i in input().split()]]]

Submission status: Wrong Answer

Solution code:
temp = input().split(" ")
X = int(temp[0])
Y = int(temp[1])
i = 2
while True:
    tgt = X * i
    if X == Y:
        print(-1)
        break
    else:
        print(tgt+1)
        break

Submission status: Wrong Answer

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

if Y % X == 0:
    ans = -1

else:
    ans = X

print(ans)

Submission status: Wrong Answer

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

if Y % X == 0:
    ans = -1

else:
    ans = X * (Y - 1)

print(ans)

Submission status: Wrong Answer

Solution code:
X, Y = map(int,input().split(" "))
if Y%X == 0:
  print(-1)
else:
  print(X)

Submission status: Wrong Answer

Solution code:
x,y = map(int,input().split())
if y % x == 0 :
    print(-1)
else :
    print(x)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
if x%y==0 or y%x==0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
if x==y:
    print(-1)
elif x==1 or y==1:
    print(-1)
else:
    print(x*(y-1))

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
x, y = map(int, input().split())
if gcd(x, y) == x:
	print(-1)
else:
	print(x)
# your code goes here

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
x, y = (x, y) if x > y else (y, x)
print(x if x % y else -1)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
print(-1 if y % x == 0 else x)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
print(-1 if x == y else x)

Submission status: Wrong Answer

Solution code:
x, y = map(int,input().split())
if y % x == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
print([-1,a*b+a][a%b==0])

Submission status: Wrong Answer

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

if x%y == 0 or x == 1:
    print(-1)
    quit()

for i in range(x*2,10**18+1,x):
    if (i < y*2):
        continue
    elif (i%y != 0):
        print(i)
        quit()
print(-1)

Submission status: Wrong Answer

Solution code:
# vim: set fileencoding=utf-8 :
x, y = map(int, raw_input().split())

if x <= y:
    print(-1)
    exit()

ans = 0
if x % y == 0:
    ans = -1
    exit()

n = 1
top = pow(10, 18)

# x >= y
while True:
    t = n * x
    if t >= top:
        ans = -1
        break

    if t % y != 0:
        ans = t
        break

    n += 1

print(ans)

Submission status: Wrong Answer

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

if y%x == 0 or x%y == 0:
    print(-1)
    quit()

for i in range(x*2,10**18+1,x):
    if (i < y):
        continue
    elif (i%y != 0):
        print(i)
        quit()
print(-1)

Submission status: Wrong Answer

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

if y%x == 0 or x%y == 0:
    print(-1)
    quit()

for i in range(x*2,10**18+1,x):
    if (i < y*2):
        continue
    elif (i%y != 0):
        print(i)
        quit()
print(-1)

Submission status: Wrong Answer

Solution code:
def main():
    X, Y = map(int, raw_input().split())

    if X == 1 or Y == 1 or X == Y or X % Y == 0:
        print -1
        return

    x = X
    while x <= pow(10, 18):
        if x % Y != 0:
            print x
            return
        x += X
    print -1


main()

Submission status: Wrong Answer

Solution code:
def main():
    X, Y = map(int, raw_input().split())

    if X == 1 or Y == 1 or X == Y or X % Y == 0:
        print -1
        return

    x = X
    while x <= pow(10, 18):
        if x/Y >= 1 and x % Y != 0:
            print x
            return
        x += X
    print -1


main()

Submission status: Wrong Answer

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

if y%x == 0 or x%y == 0:
    print(-1)
    quit()

for i in range(x*2,10**18,x):
    if (i/y >= 2 and i%y != 0):
        print(i)
        quit()
print(-1)

Submission status: Wrong Answer

Solution code:
import fractions
gcd = fractions.gcd

X, Y = map(int, input().split())

g = gcd(X, Y)
if g != Y:
    t = X * Y // g
    if g > 10**9:
        print(-1)
    else:
        print(t)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
# vim: set fileencoding=utf-8 :
x, y = map(int, raw_input().split())

if x <= y:
    print(-1)
    exit()

if x % y == 0:
    print(-1)
    exit()

n = 1
top = pow(10, 18)

while True:
    t = n * x
    if t >= top:
        print(-1)
        break

    if t % y != 0:
        print(t)
        break

    n += 1

Submission status: Wrong Answer

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

if y%x == 0 or x%y == 0:
    print(-1)
    quit()

for i in range(x*2,10**18,x):
    if (y*2 > i):
        continue
    if (i%y != 0):
        print(i)
        quit()
print(-1)

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split())

if X % Y:
    for i in range(2, Y):
        if X * i % Y:
            print(X * i)
            exit(0)
print(-1)

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split())

if Y % X:
    for i in range(2, Y):
        if X * i % Y:
            print(X * i)
            exit(0)
print(-1)

Submission status: Wrong Answer

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

if y%x == 0 or x%y == 0:
    print(-1)
    quit()

for i in range(x*2,10**18,x):
    if (y > i):
        continue
    if (i%y != 0):
        print(i)
        quit()
print(-1)

Submission status: Wrong Answer

Solution code:
def main():
    X, Y = map(int, raw_input().split())

    if X == 1 or Y == 1 or X == Y or X % Y == 0 or Y % X == 0:
        print -1
        return

    x = X + X
    while x <= pow(10, 18):
        if x/Y >= 1 and x % Y != 0:
            print x
            return
        x += X
    print -1


main()

Submission status: Wrong Answer

Solution code:
import fractions
gcd = fractions.gcd

X, Y = map(int, input().split())

if gcd(X, Y) != Y:
    for i in range(2, Y):
        if X * i % Y:
            print(X * i)
            exit(0)
else:
    print(-1)

Submission status: Wrong Answer

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

if y%x == 0 or x%y == 0:
    print(-1)
    quit()

for i in range(x*2,10**18,x):
    if (i%y != 0):
        print(i)
        quit()
print(-1)

Submission status: Wrong Answer

Solution code:
def main():
    X, Y = map(int, raw_input().split())

    if X == 1 or Y == 1 or X == Y or X % Y == 0:
        print -1
        return

    x = X + X
    while x <= pow(10, 18):
        if x/Y >= 1 and x % Y != 0:
            print x
            return
        x += X
    print -1


main()

Submission status: Wrong Answer

Solution code:
import fractions
gcd = fractions.gcd

X, Y = map(int, input().split())

if gcd(X, Y) != Y:
    if X * 2 != Y:
        print(X * 2)
    else:
        print(X * 3)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import fractions
gcd = fractions.gcd

X, Y = map(int, input().split())

g = gcd(X, Y)
if gcd(X, Y) != Y:
    print(X * 2)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
def main():
    X, Y = map(int, raw_input().split())

    if X == 1 or Y == 1 or X == Y or X % Y == 0:
        print -1
        return

    X += X
    while X < pow(10, 18):
        if X % Y != 0:
            print X
            return
        X += X
    print -1


main()

Submission status: Wrong Answer

Solution code:
X, Y = list(map(int, input().split()))
if Y == X or Y == 1:
    re = -1
elif X < Y:
    re = X
else:
    re = X * Y - X
print(re)

Submission status: Wrong Answer

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

if (y%x) == 0:
    print(-1)
    quit()

for i in range(x*2,10**18,x):
    if (i%y != 0):
        print(i)
        quit()
print(-1)

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split())

if Y // X == 0:
    print(X * (Y + 1))
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split())
if X % Y == 0:
    print(-1)
    exit()
for i in range(2, 10**9 // X):
    Xi = X * i
    if Xi % Y != 0:
        print(Xi)
        exit()
print(-1)

Submission status: Wrong Answer

Solution code:
import fractions
x, y = map(int, input().split())

if x == y or y == 1:
  print(-1)
else:
  ans = int(x * y / fractions.gcd(x, y) - x)
  if ans <= 10**18:
    print(ans)
  else:
    print(-1)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
print(-1 if y%x==0 else x)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
print(-1 if y%x==0 else print(x))

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split(' '))
if X % Y == 0 or Y % X == 0: print(-1)
else:
    res = 0
    i = 1
    while res == 0:
        if X * i % Y != 0:
            res = X*i
            break
        else:
            i += 1
    if X*i <= 10**18:
        print(res)
    else:
        print(-1)

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split(' '))
if X % Y == 0 or Y % X == 0: print(-1)
else:
    res = 0
    i = 1
    while res == 0:
        if X * i % Y != 0:
            res = X*i
            break
        else:
            i += 1
    print(res)

Submission status: Wrong Answer

Solution code:
x,y = map(int,input().split())
if y%x == 0:
  print(-1)
else:
  print(x)

Submission status: Wrong Answer

Solution code:
x,y = map(int,input().split())
if y%x == 0:
  print(-1)
else:
  for i in range(1,pow(10,6)):
    if (x*i) < pow(10,18) and (x*i)%y > 0:
      print(x*i)
      exit()
  print(-1)

Submission status: Wrong Answer

Solution code:
x,y = map(int,input().split())
if y%x == 0:
  print(-1)
else:
  for i in range(pow(10,6)):
    if (x*i) < pow(10,18) and (x*i)%y > 0:
      print(x*i)
      exit()
  print(-1)

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if a < b:
        a,b = b,a
    while b > 0:
        r = a % b
        a,b = b,r
    return a

def lcm(a, b):
    if a == 0 or b == 0:
        print("Error")
        return 0
    return int(a * b // gcd(a, b))

def solve():
    x, y = map(int, input().split())
    if x < y:
        print(x)
        return
    
def gcd(a, b):
    if a < b:
        a,b = b,a
    while b > 0:
        r = a % b
        a,b = b,r
    return a

def lcm(a, b):
    if a == 0 or b == 0:
        print("Error")
        return 0
    return int(a * b // gcd(a, b))

def solve():
    x, y = map(int, input().split())
    if x < y:
        print(x)
        return

    l = lcm(x, y)
    if y % l == 0:
        print(-1)
        return
    ans = lcm(x, y) - x
    if ans > 10 ** 18:
        print(x * 2)
    else:
        print(ans)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if a < b:
        a,b = b,a
    while b > 0:
        r = a % b
        a,b = b,r
    return a

def lcm(a, b):
    if a == 0 or b == 0:
        print("Error")
        return 0
    return int(a * b // gcd(a, b))

def solve():
    x, y = map(int, input().split())
    if x < y:
        print(x)
        return
    
def gcd(a, b):
    if a < b:
        a,b = b,a
    while b > 0:
        r = a % b
        a,b = b,r
    return a

def lcm(a, b):
    if a == 0 or b == 0:
        print("Error")
        return 0
    return int(a * b // gcd(a, b))

def solve():
    x, y = map(int, input().split())
    if x < y:
        print(x)
        return

    l = lcm(x, y)
    if y % l == 0:
        print(-1)
        return
    ans = gcd(x, y) - x
    if ans > 10 ** 18:
        print(x * 2)
    else:
        print(ans)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if a < b:
        a,b = b,a
    while b > 0:
        r = a % b
        a,b = b,r
    return a

def lcm(a, b):
    if a == 0 or b == 0:
        print("Error")
        return 0
    return int(a * b // gcd(a, b))

def solve():
    x, y = map(int, input().split())
    if x < y:
        print(x)
        return


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if a < b:
        a,b = b,a
    while b > 0:
        r = a % b
        a,b = b,r
    return a

def lcm(a, b):
    if a == 0 or b == 0:
        print("Error")
        return 0
    return int(a * b // gcd(a, b))

def solve():
    x, y = map(int, input().split())
    if x < y:
        print(x)
        return

    l = lcm(x, y)
    if y % l == 0:
        print(-1)
        return
    print(l - x)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if a < b:
        a,b = b,a
    while b > 0:
        r = a % b
        a,b = b,r
    return a

def lcm(a, b):
    if a == 0 or b == 0:
        print("Error")
        return 0
    return int(a * b // gcd(a, b))

def solve():
    x, y = map(int, input().split())
    l = lcm(x, y)
    if l == y and x >= y:
        print(-1)
        return
    print(l - x)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
m, n = map(int, input().split())
if m >= n and m % n == 0:
    print(-1)
else:
    print(m*2)

Submission status: Wrong Answer

Solution code:
x,y = map(int,input().split(' '))
if x % y == 0:
    print(-1)
else:
    print(x * 2)

Submission status: Wrong Answer

Solution code:
X, Y = list(map(int, input().split()))
if X > Y:
    print(X)
elif X == Y:
    print('-1')
else:
    if X%Y == 0:
        print('-1')
    else:
        print(X)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
print([x,-1][x%y!=0])

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
print([x,-1][x==y or y==1])

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
print([x,-1][x==y])

Submission status: Wrong Answer

Solution code:
X, Y=map(int, input().split())
i=X+X
MAX=10 ** 18

if X%Y== 0 or Y%X ==0:
    print(-1)
else:
    print(X)

Submission status: Wrong Answer

Solution code:
X, Y=map(int, input().split())
i=X+X
MAX=10 ** 18

if X%Y== 0 or Y%X ==0:
    print(-1)
else:
    while i<=MAX:
        if i%Y != 0:
            print(i)
            break
        i+=X

Submission status: Wrong Answer

Solution code:
X, Y=map(int, input().split())
i=X+X
MAX=10 ** 18

if X%Y== 0 or Y%X ==0:
    print(-1)
else:
    while i<MAX:
        if i%Y != 0:
            print(i)
            break
        i+=X

Submission status: Wrong Answer

Solution code:
x,y = [int(i) for i in input().split(" ")]
for i in range(y):
	if (x*i)%y == 0:
		print(x*i)
		break
else:
	print(-1)

Submission status: Wrong Answer

Solution code:
x, y = (int(i) for i in input().split())

if x%y == 0:
    print("-1")
else:
    print("x")

Submission status: Wrong Answer

Solution code:
x, y = map(int, raw_input().split())
print -1 if x % y else x

Submission status: Wrong Answer

Solution code:
'''input
3 3
'''
def gcd(a, b):
    if(a%b==0):
        return b
    return gcd(b, a%b)
a, b = map(int, input().split())
if(a<b):
    a, b = b, a
if(gcd(a, b)==min(a, b)):
    print(-1)
else:
    print(2*(max(a, b)))

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
if(a==b):
    print(-1)
else:
    print(2*(max(a, b)))

Submission status: Wrong Answer

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

if 1 <= X <= 10**9:
    if 1 <= Y <= 10 ** 9:
        if X != Y:
            for i in range(X * Y + 1):
                if i > 1:
                    if ((X * i) % Y) != 0:
                        a = (X * i)
                        print(a)
                        b = False
                        break

            if b:
                print(str(a))
else:
    print(str(a))

Submission status: Wrong Answer

Solution code:
import sys

x, y = list(map(abs, list(map(int, input().split()))))

if y % x == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
import sys

x, y = list(map(abs, list(map(int, input().split()))))

if y % x == 0 or x % y == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
x, y = map(int, input().split())
if y%x:
    print(x)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
X,Y = [int(i) for i in input().split()]

i = 2
while True:
    if (X * i) % Y != 0:
        print(X*i)
        break
    elif (X * i) >= X*Y:
        print(-1)
        break
    else:
        i += 1

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
flag = 1
for i in range(2, 10**18):
    j = i * a
    if j % 8 == 0 and j % 6 != 0:
        flag = 0
        print(j)
        break
if(flag):
    print(-1)

Submission status: Wrong Answer

Solution code:
x,y=map(int,input().split())
n=1

if y % x == 0:
    print(-1)
else:
    while x <= 10**18:
        if x*n % y != 0:
            print(x)
            break
        n += 1

Submission status: Wrong Answer

Solution code:
import sys

x, y = list(map(abs, list(map(int, input().split()))))

if x == y or x % y == 0 or y % x == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
import sys                                            
                                                      
x, y = list(map(abs, list(map(int, input().split()))))
                                                      
if x == y or x % y == 0 or y % x == 0:                
    print(-1)                                         
else:                                                 
    if x > y:                                         
        print(x)                                      
    else:                                             
        print(y)

Submission status: Wrong Answer

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

if x == y:
    print ("-1")
else:
    print (x)

Submission status: Wrong Answer

Solution code:
import sys
x, y = (int(i) for i in input().split()) 
flag = 0
i = x
if(x == y):
    print(-1)
    sys.exit()
while(i <= x*y):
    if(i !=x and i !=y and i%y!=0):
        print(i)
        sys.exit()
    i+=x
if(flag == 0):
    print(-1)

Submission status: Wrong Answer

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

if x == y or x % y == 0 or y % x == 0:
    print('-1')
else:
    print(x)

Submission status: Wrong Answer

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

if x == y or x % y == 0 or y % x == 0:
    print(-1)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
X, Y = map(int, input().split())
if (X == Y) or (Y == 1):
    print(-1)
elif X < Y :
    print(X)
else:
    for i in range(10**18, 0, -1):
        if i % Y != 0:
            print(i)
            break
    else:
        print(-1)