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: Accepted

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

i = 1
while i < 10000:
  if X % Y == 0:
    print (str(-1))
    break
  else:
    ans = X * i
    if ans % Y != 0:
      print (str(ans))
      break
  i += 1

Submission status: Accepted

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

print(result)

Submission status: Accepted

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

N = X

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

else:
	while  N % Y == 0:
		N += X
	print(N)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys


def solve(X, Y):
    if X % Y == 0:
        return -1
    else:
        return X


def main():
    inputs = sys.stdin.readlines()
    inputs = [s.rstrip('\n').lstrip(' ') for s in inputs]

    X, Y = tuple(map(int, inputs[0].split()))

    print(solve(X, Y))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    x, y = map(int, input().split())
    if x % y == 0:
        return print('-1')
    for i in range(1000000000):
        if (i * x) % y != 0:
            return print(i*x)
main()

Submission status: Accepted

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

Submission status: Accepted

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


if x%y == 0:
     print('-1')
else:
     i = 2 
     while True:
          if x*i % y == 0:
               i += 1     
               continue
          else:
               print(x*i)
               break

Submission status: Accepted

Solution code:
xy = input()
XY = xy.split()
X = int(XY[0])
Y = int(XY[1])

a = True
i = 1

if X < Y:
    print(X)
    a = False
elif X > Y and X % Y != 0:
    while X * i <= X * Y:
        if (X * i) % Y != 0:
            print(X * i)
            a = False
            break
        else:
            i += 1
if a:
    print(-1)

Submission status: Accepted

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

res = -1
c = 1

while True:
    if x * c % y != 0:
        res = x * c
        break
    elif x % y == 0:
        break
    elif x * c > 10 ** 18:
        break
    c += 1

print(res)

Submission status: Accepted

Solution code:
import sys

if __name__ == "__main__":
    X, Y = map(int, (input().split(' ')))
    max = X
    min = Y
    if X < Y:
        print(X)
        sys.exit()
#        max = Y
#        min = X
    if max % min == 0:
        print(-1)
        sys.exit()
    sho = (pow(10, 18) // X)  + 1
    for i in range(1, sho):
        num = X * i
        if (num % Y != 0):
            print(num)
            sys.exit()
    print(-1)

Submission status: Accepted

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

i = 1
while i < 10000:
  if X % Y == 0:
    print str(-1)
    break
  else:
    ans = X * i
    if ans % Y != 0:
      print str(ans)
      break
  i += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

# 同じ数字の場合
if x == y:
    print(-1)
else:
    g = gcd(x, y)
    if (x * g) % y != 0:
        print(x * g)
    else:
        if x * (g + 1) % y != 0:
            print(x * (g + 1))
        else:
            print(-1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3 

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


if x % y == 0:
	res = -1
else:
	current = x
	while (1):
		current += x
		if (current > 10**18):
			res = -1
			break
		if (current % y != 0):
			res = current
			break
		else:
			continue

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
x, y = map(int, raw_input().split())
if x == y:
    print -1
    sys.exit()
for i in xrange(x, x*y, x):
    if not i % y == 0:
        print i
        break
else:
    print -1

Submission status: Accepted

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

if a < b:
    print(a)
elif a == b:
    print(-1)
else:
    if a % b == 0:
        print(-1)
    else:
        print(a)

Submission status: Accepted

Solution code:
xy = input().split()
x, y = int(xy[0]), int(xy[1])

kakeru = 1

if x%y == 0:
    print(-1)
else:
    while True:
        kakeru += 1
        if x*kakeru%y != 0:
            break
    print(x*kakeru)

Submission status: Accepted

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

Submission status: Accepted

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

if X < Y:
    print(X)
elif X % Y == 0:
    print(-1)
elif gcd(X, Y) == 1:
    print(X)
else:
    tmp = X * gcd(X, Y)
    if tmp % Y != 0:
        print(tmp)
    else:
        print(X * int(X / gcd(X, Y)))

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
if x % y == 0:
	print(-1)
	exit()
ans = 0
for i in range(y):
	ans += x
	if ans % y > 0:
		break
if ans == x*y:
	print(-1)
	exit()
print(ans)

Submission status: Accepted

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

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

#
N = X*2
while N<=10**18:
    if N%Y!=0:
        print(N)
        exit()
    N += X

#
print(-1)

Submission status: Accepted

Solution code:
import sys

X,Y=map(int,input().split())
if X%Y!=0:
	i=1
	while X*i<10**18:
		if (X*i/Y)!=int(X*i/Y):
			print(X*i)
		sys.exit()
	else:
		print(-1)
else:
	print(-1)

Submission status: Accepted

Solution code:
import sys
def gcd(a, b):
        while b:
                a, b = b, a % b
        return a
def lcm(a, b):
    return a * b // gcd (a, b)

x,y = map(int, input().split())
temp = x
if x == y:
    print(-1)
    sys.exit()
while True:
    temp += x
    if temp % y != 0:
        print(temp)
        sys.exit()
    elif temp > lcm(x, y):
        print(-1)
        sys.exit()

Submission status: Accepted

Solution code:
from fractions import gcd
from math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin
from itertools import *
from fractions import Fraction
import string
import copy
import random
import bisect
from decimal import *
def id_generator(size=20, chars=string.digits):
    return ''.join(random.choice(chars) for _ in range(size))
 
def mp():
    return map(int,str(raw_input()).split())
 
 
a,b=mp()
if a>=b:
    if a%b==0:
    	print -1
    else:
    	print a
else:
	if 0:
		print -1
	else:
		print a

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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


def gcd(a, b): return a if b == 0 else gcd(b, a % b)


def lcm(a, b): return a * b // gcd(a, b)


a = lcm(x, y) - x

print(-1 if a == 0 else a)

Submission status: Accepted

Solution code:
inp = input().split()

i = 1
x = 0

while i <= pow(10,18):
	if inp[0] == "1" and inp[1] == "1":
		print(-1)
		x = 1
		break
	if i % int(inp[0])  == 0 and i % int(inp[1]) != 0:
		print(i)
		x = 1
		break
	i *= int(inp[0])

if x == 0:
	print(-1)

Submission status: Accepted

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

Submission status: Accepted

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

flag = -1
A = 0
i = 2
if X%Y != 0:
   while A <= 1e18:
      A = i * X
      i = i + 1
      if A%Y != 0:
         flag = 1
         print(A)
         break

if flag == -1:
   print(-1)

Submission status: Accepted

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


if x[0]%x[1]==0:
    print(-1)
else:
    for i in range(10000000):
        if x[0]*i%x[1]!=0:
            print(x[0]*i)
            break

Submission status: Accepted

Solution code:
X,Y=map(int, raw_input().split())
for i in range(1,10**6+1):
	if (X*i)%Y!=0:
		print X*i
		quit()
else:
	print -1

Submission status: Accepted

Solution code:
line=input().split()
x=int(line[0])
y=int(line[1])

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

Submission status: Accepted

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

Submission status: Accepted

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

t=0
for i in range(2,10**9+1):
    if a%b==0:
        break
    if a*i>=10**18:
        break
    elif a*i%b!=0:
        t=1
        break

if t==1: print(a*i)
else: print(-1)

Submission status: Accepted

Solution code:
def main():
    x,y=map(int,input().split())
    if(x%y==0):
        print(-1)
        return
    judge(x,x,y)
    
def judge(X,x,y):
    if(X % y != 0):
        print(x)
        return
    X += x
    if(X>pow(10,18)):
        print(-1)
        return
    judge(X,x,y)
        
if __name__=="__main__":
    main()

Submission status: Accepted

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


def main(input_str):
    x, y = list(map(int, input_str.split(' ')))
    if 0 == x % y:
        print(-1)
        return
    
    
    max_num = 1e18
    num = x
    while num <= max_num:
        if 0 != num % y:
            print('{}'.format(num))
            return
        num += x
    print(-1)
    
if '__main__' == __name__:
    try:
        while True:
            main(input().strip())
    except EOFError:
        pass

Submission status: Accepted

Solution code:
nData = []
nData  = input().rstrip().split(' ')

X = int(nData[0])
Y = int(nData[1])


nFlag = 0

Check = X%Y

if Check != 0:
    N = 10**18//X
    for i in range(N):
        if i<2:
            continue
        Ans = X * i
        Check = Ans%Y
        if Check !=0:
            nFlag = 1
            break
        
    
if nFlag == 0:
    print('-1')
else:
    print(Ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

x, y = map(int, input().strip().split())

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

i = 1
while 1:
    z = x * i
    if z > 1.0e+18:
        print(-1)
        sys.exit()
    if z % y != 0:
        print(z)
        sys.exit()
    i += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if y==1:
    print('-1')
    exit()
elif x%y==0:
    print('-1')
    exit()
for i in range(x,10**18//x,x):
    if i%y!=0:
        print(i)
        break

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#print X, Y

count=2

num = X
flag = False

if X % Y == 0:
    print -1
else:
    while num <= 1000000000000000000 :
        num = X * count
        if (num % Y) != 0:
            #        print num
            flag = True
            break
        else:
            count = count +1

    if flag == False:
        print -1
    else:
        print num

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
X, Y = map(int, input().split())

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

Submission status: Accepted

Solution code:



def main():
    X, Y = map(int, input().split(' '))

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

    i = 0
    A = X

    while A <= 10e18:
        if A % Y != 0:
            print(A)
            return
        else:
            i += 1
            A = (i+1)*X

    print(-1)

main()

Submission status: Accepted

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

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

for i in range(1, 10**18):
    if X*i % Y != 0:
        print(X*i)
        exit()

Submission status: Accepted

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

ans = -1

if X % Y == 0:
    pass

else:
    i = 1
    while True:
        num = X * i
        if num > 10**18:
            break
        elif num % Y != 0:
            ans = num
            break
        else:
            i += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = map(int,raw_input().split())
if x%y==0:
        print '-1'
else:
        i=2
        while x*i<10**18+1:
                if x*i%y!=0:
                        print x*i
                        break
                i=i+1

##t=[1]
##while t[len(t)-1]*2<=n:
##	t.append(t[-1]*2)
##x=0
##i=0
##while i<len(t) and x+t[i]<=n:
##	x=x+t[i]
##	i=i+1
##
##if n&(n+1)==0:
##	print n
##elif k==1:
##	print n
##else:
##	print 2*t[-1]-1

Submission status: Accepted

Solution code:
n=int(1.0e+18)
x,y=map(int,input().split(' '))
X = n//x
if x%y==0:
    print('-1')
else:
    i=2
    while i < X:
        if (x*i)%y!=0:
            print(str(x*i))
            break
        i+=1
    if i >= X:
        print('-1')

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
if a[0] % a[1] == 0:
    print(-1)
else:
    b = 1
    while b <= a[1]:
        c = a[0] * b
        if c % a[1] != 0 and c <= 10 ** 18:
            print(c)
            break
        else:
            b = b + 1
    if b == a[1] + 1 or c > 10 ** 18:
        print(-1)

Submission status: Accepted

Solution code:
temp=input()
temp=list(map(int,temp.split(" ")))
a=temp[0]
b=temp[1]
if a%b==0:
    print("-1")
else:
    for i in range(1000000000):
        if i*a%b!=0:
            print(a*i)
            exit()

Submission status: Accepted

Solution code:
# ===================================
# (c) MidAndFeed aka ASilentVoice
# ===================================
# import math, fractions, collections
# ===================================
x, y = [int(x) for x in input().split()]
if x == y or y == 1 or x%y == 0:
	print(-1)
else:
	temp = x
	while(temp%y == 0):
		temp += x
	print(temp)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = list(map(int,input().split(" ")))
X = a[0]
Y = a[1]

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def inpl(): return tuple(map(int, input().split()))
from math import sqrt
from bisect import bisect


def primes2(n):
    """ Input n>=6, Returns a list of primes, 2 <= p < n """
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1,int(n**0.5)//3+1):
      if sieve[i]:
        k=3*i+1|1
        sieve[      k*k//3      ::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
        sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2,3] + [3*i+1|1 for i in range(1,n//3-correction) if sieve[i]]

X, Y = inpl()

P = primes2(2*int(sqrt(10**9)))

if X%Y == 0:
    print(-1)
else:
    for p in P:
        if Y%p != 0:
            print(X*p)
            break

Submission status: Accepted

Solution code:
# coding=utf-8
line = input().split(" ")
x = int(line[0])
y = int(line[1])

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

Submission status: Accepted

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

Submission status: Accepted

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

if X < Y:
	print(X)
	exit(0)

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

Submission status: Accepted

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

if a % b == 0:
    print("-1")
else:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def LI(): return list(map(int, input().split()))
def LS(): return input().split()
def I(): return int(input())
def S(): return input()

x, y = LI()


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

Submission status: Accepted

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

if (x % y ==0):
   print -1
else:
   x0=x
   while x0<10**19:
      x0=x0+x
      if (x0 % y <>0):
         print x0
         break

Submission status: Accepted

Solution code:
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))



##### main #####

def main():
	x,y = LI()
	if x%y == 0:
		print(-1)
	else:
		print(x)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X,Y = (int(num) for num in input().split(" "))
flag = True
if X % Y == 0:
    flag = False
n = 2
while flag:
    if n * X % Y != 0:
        break
    if n * X > 10**18:
        flag = False
    n += 1

if flag:
    print(n * X)
else:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

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

    if not X % Y:
        print(-1)
    else:
        print(X)

main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

from collections import defaultdict
from math import factorial as f
from fractions import gcd as g

a, b = [int (i) for i in raw_input ().split ()]
l = a * b / g (a, b)
if l == a: print "-1"
elif l == 2 * a: print 3 * a
else: print 2 * a

Submission status: Accepted

Solution code:
import sys
X,Y = map(int,input().split(" "))
#X = int(input())
#Y = int(input())

if X == Y:
    print(-1)
    sys.exit()

for i in range(2,100):
    if int((X*i)/Y) != (X*i)/Y:
        print(X*i)
        sys.exit()
print(-1)

Submission status: Accepted

Solution code:
import random
import functools
import itertools
import math

R = lambda type_ = "int": list(map(eval(type_), input().split(' ')))

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

Submission status: Accepted

Solution code:
def gcd(a, b):
	if (b == 0): return a
	return gcd(b, a % b)

x, y = map(int, input().split())
d = gcd(x, y)
a = x // d
b = y // d

if (b == 1):
	print(-1)
else:
	print (a * (b - 1) * d)

Submission status: Accepted

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

Submission status: Accepted

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

if a == b:
    print(-1)
elif a > b and a%b == 0:
    print(-1)
else:
    x = a
    mult = 2
    fuck = False
    while (x * mult) % b == 0:
        mult = mult + 1
        if x * mult > 1e18:
            break
    if (x * mult)%b != 0 and x * mult <= 1e18:
        print(x*mult)
    else:
        print(-1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: <encoding-name> -*-

import sys

x, y = map(int, sys.stdin.readline().strip().split(" "))
if x % y == 0:
    print(-1)
else:
    for i in range(1, y):
        if x * i % y > 0:
            print(x * i)
            break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if X % Y == 0:
    print(-1)
else:
    count = 2
    while True:
        cand = X * count
        if cand % Y != 0:
            print(cand)
            break
        elif 10**9 < cand:
            print(-1)
            break
        count += 1

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
X, Y = map(int, input().split())
print(X if X % Y != 0 else -1)

Submission status: Accepted

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

if A % B == 0:
    print(-1)
else:
    i = A
    while(i % B == 0):
        i += A
    print(i)

Submission status: Accepted

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

ans = x
if ans % y  == 0: ans += y

print(-1 if ans % y == 0 or ans > 1e18 else ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if x%y==0:
	print(-1)
else:
	ans=x
	while ans%y==0 and ans<=(10**18):
		ans+=x
	if ans<=10**18:
		print(ans)
	else:
		print(-1)

Submission status: Accepted

Solution code:
X, Y = [int(x) for x in input().split()]
if X % Y == 0:
    print(-1)
else:
    print(X)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import numpy as np

x,y = map(int,raw_input().split())

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

print ans

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Runtime Error

Solution code:
x,y = int(input())
if x == y:
  print(-1)
else:
  for i in range(1,10000):
    a = i * x
    if a % y != 0:
      print(a)
      exit()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def L():
    return list(map(int, input().split()))

[x,y]=L()

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

Submission status: Runtime Error

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

if y == 1:
  print(-1)
else:
  if 0 < x and x <= 1e18:
    print(x)
  else :
    print(=1)

Submission status: Runtime Error

Solution code:

x,y=map(int,input().split())
k = 10**18 // x
for i in range[1:k]:
    z = x * i
    if z % y == 0:
        z = -1
        continue
    else:
        break
print(z)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cou = 0
for j,k in zip(a,b):
  if j<k:
    cou += (k-j)//2
  elif j>k:
    cou -= (j-k)
if cou=>0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cou = 0
for j,k in zip(a,b):
  if j<k:
    cou += (k-j)//2
  elif j>k:
    cou -= (j-k)
if cou>=0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
if x==y:print(-1)
else:
  while True:
    r=x*2
    if r%y!=0:
      print(r)
      break
    elif r>=10**18:
      print(-1)
      break
    i+=1

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split());ans=0
if x==y:
  print(-1)
else:
  while True:
    r=x*2
    if r%y!=0:
      print(r)
      break
    elif r>=10**18:
      print(-1)
    i+=1

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
if m == n-1:
  print(0)
  exit()
if 2*(n-m-1) > n:
    print("Impossible")
    exit()

class Unionfind:
     
    def __init__(self,n):
        self.uf = [-1]*n
 
    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]
 
    def same(self,x,y):
        return self.find(x) == self.find(y)
 
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x
        return True
 
    def size(self,x):
        x = self.find(x)
        return -self.uf[x]

u = Unionfind(n)
a = list(map(int,input().split()))
for i in range(m):
    x,y = map(int,input().split())
    u.union(x,y)
count = 2*(n-m-1)
l = [[] for i in range(n)]
for i in range(n):
    x = u.find(i)
    if x < 0:
        l[i].append(a[i])
    else:
        l[x].append(a[i])

ans = 0
h = []
for i in range(n):
    if l[i]:
        l[i].sort()
        ans += l[i][0]
        count -= 1
        for j in l[i][1:]:
            h.append(j)
h.sort()
ans += sum(h[:count])
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
i=input()
print(i[0],-1)[eval(input().replace(' ','=='))]

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if X==Y:
    print(-1)
else:
    for i in range(10**18):
        X1 = int(X*i)
        if X1 % Y != 0:
            print(str(X1))
            break

Submission status: Runtime Error

Solution code:
import numpy as np
X = int(input())
Y = int(input())

temp = np.random.randint(1,10^18)
temp2 = 0
temp3 = 1
while not temp % X == 0 and temp % Y != 0:
    temp = np.random.randint(1,10^18)
    temp2 = temp2 + 1
    if temp2 == 1000000:
        temp3 = -1 
        break

if temp3 == -1:
    print(temp3)
else:
    print(temp)

Submission status: Runtime Error

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

sa = sum(a)
sb = sum(b)

if a == b:
    print("Yes")
    exit()

if sa >= sb:
    print("No")

else:
    dif = sb - sa
    for i in range(n):
        if a[i] < b[i]:
            dif -= (b[i] - a[i]) // 2
        elif a[i] > b[i]:
            dif -= a[i] - b[i]
    if dif >= 0:
        print("Yes")
    else:
        print("No")

Submission status: Runtime Error

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

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

diff1 = [] # a > b
diff2 = [] # b > a
for i, j in zip(a, b):
    if i > j:
        diff1.append(i - j)
    elif j > i:
        diff2.append(j - i)

if cnt < sum(diff1):
    print("No")
    sys.exit()
else:
    cnt -= sum(diff1)

a_add = cnt + sum(diff1) # 2を足す
b_add = cnt # 1を足す

c = []
for i in diff2:
    if i % 2 == 0:
        a_add -= i//2
    else:
        c.append(1)
        a_add -= (i - 1)//2
a_add -= sum(c)
b_add -= sum(c)
if a_add*2 == b_add:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

def j(b):
    print(b)
    return b, input()[0]

def q(l, r, t):
    m, rm = j((l + r + 1) // 2)
    if (m - b)%2 == (rm != t):
        q(m, r, rm)
    else:
        q(l, m-1, t)

_, s = j(0)
q(0, n-1, s)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

n = int(input())

def j(b):
    print(b)
    i = input()[0]
    if i == "V": exit()
    return b, i

def q(l, r, t):
    m, rm = j((l + r + 1) // 2)
    if (m - b)%2 == (rm != t):
        q(m, r, rm)
    else:
        q(l, m-1, t)

_, s = j(0)
q(0, n-1, s)