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: Time Limit Exceeded

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    x, y = map(int, input().split())

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

    for res in range(x, 10 ** 18, x):
        if res % y:
            print(res)
            break


if __name__ == '__main__':
    resolve()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x, y = map(int, input().split())
if x == y:
    print(-1)
elif y == 1:
    print(-1)
else:
    cnt = x+1
    for i in range(cnt, 10**9):
        if i % x == 0:
            if not i % y == 0:
                print(i)
                exit()

Submission status: Time Limit Exceeded

Solution code:
temp = input()
temp2 = temp.split(" ")
temp = []
for i in temp2:
    temp.append(int(i))

for i in range(1,100000000):
    ans1 = temp[0]*i
    if ans1 % temp[1] != 0:
        break
    if ans1 <= 10^18:
        ans1 = -1
        break
print(ans1)

Submission status: Time Limit Exceeded

Solution code:
temp = input()
temp2 = temp.split(" ")
temp = []
for i in temp2:
    temp.append(int(i))

for i in range(1,100000000):
    ans1 = temp[0]*i
    if ans1 % temp[1] != 0:
        break
print(ans1)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
X,Y = map(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: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
x, y = map(int, input().split())

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

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

ans = x
while ans<10**18:
    if x%y!=0:
        print(x)
        exit()
    else:
        ans+=x

Submission status: Time Limit Exceeded

Solution code:
x,y = map(int,input().split())
count = 1
while(1):
    if count*x % y != 0:
        print(count*x)
        break
    if count+x > 10**18:
        print("-1")
        break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

input = str(input()).split(" ")
for index in range(len(input)):
    input[index] = int(input[index])
x = input[0]
y = input[1]


def test(x, y):
    for index in range(1, min(abs(y), math.floor((10**18)/x))):
        if (x * index % y != 0 and abs(x * index) <= 10**(18)):
            return x * index
    return -1
print(test(x,y))

Submission status: Time Limit Exceeded

Solution code:
import math

input = str(input()).split(" ")
for index in range(len(input)):
    input[index] = int(input[index])
x = input[0]
y = input[1]


def test(x, y):
    for index in range(1, abs(y) + 1):
        if (x * index % y != 0 and abs(x * index) <= 10**(18)):
            return x * index
    return -1
print(test(x,y))

Submission status: Time Limit Exceeded

Solution code:
XY = input().split()
X,Y = int(XY[0]), int(XY[1])
i = 0
n = 0
if(X == Y):
    print(-1)
else:
    while(n % Y == 0):
        n = i * X
        i+=1
    print(n)

Submission status: Time Limit Exceeded

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

print(-1)

Submission status: Time Limit Exceeded

Solution code:
X,Y = map(int,input().split())
X_ = X
while X_ <= 10**18:
  X_ += X
  if X%Y != 0:
    print(X)
    exit()

print(-1)

Submission status: Time Limit Exceeded

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

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

if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    for i in range(1,10000000002):
        if i ==10000000001:
            print(-1)
            break
        if a[0]*i %a[1] >0:
            print(a[0]*i)
            break
        if a[0]*i >10000000001:
            print(-1)
            break

Submission status: Time Limit Exceeded

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

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

if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    for i in range(1,10000000002):
        if i ==10000000001:
            print(-1)
            break
        if a[0]*i %a[1] >0:
            print(a[0]*i)
            break

Submission status: Time Limit Exceeded

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

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

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    
    for i in range(1,10000000002):
        if i ==10000000001:
            print(-1)
            break
        if a[0]*i %a[1] >0:
            print(a[0]*i)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行あり整数
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

N行M列の初期化
dp = [[INF] * M for i in range(N)]

'''


X, Y = map(int, input().split())
if X%Y == 0:
    print(-1)
for i in range(int(1e9)):
    if X*i % Y:
        print(X*i)
        sys.exit()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    x,y = map(int,input().split())
    num = x * 2
    while x < int(1e18):
        if num % y != 0:
            print(num)
            return
        num += x
    print(-1)
    return

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
x,y=map(int,input().split())
ans=1
i=1
while ans<=10**18:
  ans=i*x
  if ans%y!=0:
    print(ans)
    sys.exit()
  i+=1
print(-1)

Submission status: Time Limit Exceeded

Solution code:
X,Y = map(int,input().split())
if X == Y:
  print(-1)
  exit()
for x in range(X,10**18+1,X):
  if x % Y != 0:
    print(x)
    exit()
print(-1)

Submission status: Time Limit Exceeded

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

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

i =2

while x*i % y == 0:
	i = i + 1	

print(x*i)

Submission status: Time Limit Exceeded

Solution code:
def main(x, y):
    if x % y == 0:
        print(-1)
        return

    i = max(x, y) + 1

    while True:
        if (i % x) == 0 and (i % y) != 0:
            print(i)
            break

        i += 1


if __name__ == '__main__':
    x, y = map(int, input().split(' '))
    main(x, y)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

def solve() :
    X,Y = [int(x) for x in stdin.readline().rstrip().split()]

    if X == Y :
        print("-1")
        return
    
    ans = X * 2
    while True:
        if ans % Y != 0 :
            print(ans)
            return
        elif ans >= 1e18:
            print(-1)
            return
        else:
            ans += X

solve();

Submission status: Time Limit Exceeded

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

for i in range(1,10**9):
    if i%x == 0 and i%y != 0:
        print(i)
        exit()
print("-1")

Submission status: Time Limit Exceeded

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b = LI()
if a % b == 0:
  print(-1)
tmp = 1
while 1:
  if tmp % a == 0 and tmp % b != 0:
    print(tmp)
    quit()
  tmp += 1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

max_num = 10 ** 18
ans = -1

for i in range(X, max_num+1, X):
  if i % Y != 0:
    ans = i
    break
  
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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


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

Submission status: Time Limit Exceeded

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


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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if X == Y:
    print(-1)
    exit()
x = 2
while True:
    if X * x % Y != 0:
        print(X * x)
        exit()
    x += 1

Submission status: Time Limit Exceeded

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

    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: Time Limit Exceeded

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

    if (X == Y) :
        print(-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: Time Limit Exceeded

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
print(solve(X, Y))

Submission status: Time Limit Exceeded

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
  print(now)

Submission status: Time Limit Exceeded

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:
    if x*t>p:
        break
    elif x*t%y:
        print(x*t)
        exit()
print(-1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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
    elif tgt % Y != 0:
        print(tgt)
        break
    else:
        i += 1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if 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: Time Limit Exceeded

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

if x == y:
    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: Time Limit Exceeded

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

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

n = 1
top = pow(10, 18)

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

    if n * x % y != 0:
        print(n * x)
        break

    n += 1

Submission status: Time Limit Exceeded

Solution code:
import sys
from fractions import gcd

X, Y = map(int, sys.stdin.readline().split())
R = 1

while True:
    R *= X
    if R >= 10**18:
        print(-1)
        break
    if R % Y != 0:
        print(R)
        break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
[x,y]=[int(i) for i in input().split()]
a=0
for i in range(1,10**18+1):
    if i%x==0 and i%y!=0:
        print(i)
        a=a+1
        break
if a==0:
    print(-1)

Submission status: Time Limit Exceeded

Solution code:
import datetime

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result


arr_data = getinputdata()

x = int(arr_data[0][0])
y = int(arr_data[0][1])


cnt=1

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

else:
    while cnt<10**18:

        if cnt%x==0 and cnt%y!=0:

            print(cnt)
            break

        else:
            cnt+=1
            
#print(-1)

Submission status: Time Limit Exceeded

Solution code:
x,y = list(map(lambda x: int(x), input().split(" ")))
c = 2
while x % y == 0:
  x *= c
  c += 1
print(x)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x,y=map(int,input().split())
ans=False
for i in range(1,10**18):
    if(i % x) == 0 and (i % y) != 0:
        ans=True
        break
    else:
        continue
if ans: print(i)
else: print(-1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if x%y == 0:
    print("-1")
else:
    n = x
    while True:
        if n%x == 0 and n%y != 0:
            print(n)
        x += x

Submission status: Time Limit Exceeded

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

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

max_num = 10**18 // X

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

Submission status: Time Limit Exceeded

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

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

for i in range(10**18 + 1):
    if i == 0:
        continue
    elif i == 10**18 + 1:
        print(-1)
    else:
        if (i % X == 0) and (i % Y != 0):
            print(i)
            break
        else:
            continue

Submission status: Time Limit Exceeded

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

if 1 <= X <= 10**9:
    if 1 <= Y <= 10 ** 9:

        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: Time Limit Exceeded

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

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))

Submission status: Time Limit Exceeded

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

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

if b:
    print(str(a))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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 - X)

Submission status: Time Limit Exceeded

Solution code:
X, Y = map(int, input().split())
Z = (10**18 // X) * X
if (X == Y) or (Y == 1):
    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: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:

# 最大公約数
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())
cnt = 1
Z = lcm(X, Y)
if (X == Y) or (Y == 1):
    print(-1)
    exit()
else:
    if X < Y:
        print(X)
        exit()
    while True:
        if X * cnt > 10**18:
            print(-1)
            break
        if X*cnt % Z != 0:
            print(X*cnt)
            break
        cnt += 1

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
X,Y=map(int,input().strip().split())
i=2
ANS=-1
for i in range(2,int(1E18)):
    a=X*i
    if a%Y:
        ANS=a
        break

print(ANS)

Submission status: Time Limit Exceeded

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

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]



if n[1] == n[0]:
    print(-1)
else:
    for i in range(primes(1000000000)):
        a = n[0] * (i + 1)
        if (a % n[1] == 0) or (n[1] % a == 0):
            pass
        else:
            break
        a = -1

    print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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


if n[1] == n[0]:
    print(-1)
else:
    for i in range(100000000):
        a = n[0] * (i + 1)
        if (a % n[1] == 0) or (n[1] % a == 0):
            pass
        else:
            break
        a = -1

    print(a)

Submission status: Time Limit Exceeded

Solution code:
X,Y=map(int,input().strip().split())
i=2
ANS=-1
while i<1E18:
    a=X*i
    if a%Y:
        ANS=a
        break
    else:
        i=i+1

print(ANS)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(100000000):
    a = n[0] * (i + 1)
    if (a % n[1] == 0) or (n[1] % a == 0):
        pass
    else:
        break
    a = -1

print(a)

Submission status: Time Limit Exceeded

Solution code:
import sys
x, y = map(int, sys.stdin.readline().split())
if x % y == 0:
  print(-1)
i = 1
while True:
  k = x * i
  if k > 1e18: break
  if k % y > 0:
    print(k)
    quit()
  i += 1
print(-1)

Submission status: Time Limit Exceeded

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:
    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: Time Limit Exceeded

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

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

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

#
print(-1)

Submission status: Time Limit Exceeded

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

i = 1
x = 0

while i <= pow(10,18):
	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: Time Limit Exceeded

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

a = True
i = 1
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: Time Limit Exceeded

Solution code:
import sys
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 > pow(10, 18):
        print(-1)
        sys.exit()

Submission status: Time Limit Exceeded

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

if X == Y:
    print(-1)
for i in range(10**7):
    ans =X*(i+2)
    if ans%Y != 0:
        print(ans)
        break

Submission status: Time Limit Exceeded

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

i = 1

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


if i >= pow(10,18):
	print(-1)

Submission status: Time Limit Exceeded

Solution code:
import sys
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 > 100000000000000000:
        print(-1)
        sys.exit()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import sys
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 > 1000000000000000000:
        print(-1)
        sys.exit()