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:
inp = input().split()

# for i in range(1,1000000000000000000):
i = 1

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


if i >= 1000000000000000000:
	print(-1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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 < 1000000000000000000):
    if(i !=x and i !=y and i%y!=0):
        print(i)
        sys.exit()
    i+=x
if(flag == 0):
    print(-1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

# for i in range(1,1000000000000000000):
i = 1

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

if i >= 1000000000000000000:
	print(-1)

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):
        ans =X*(i+2)
        if ans%Y != 0:
            print(ans)
            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):
        if i%x==0 and i%y!=0:
            print(i)
            break

Submission status: Time Limit Exceeded

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:
	print(-1)
else:
	temp = x
	while(temp%y == 0):
		temp += x
	print(temp)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

i = min(X, Y)
cond = False
if X != Y:
    while i <= 1000000000:
        if (i % X) == 0:
            if (i % Y) != 0:
                cond = True
                break
        i += 1

if cond:
    print(i)
else:
    print(-1)

Submission status: Time Limit Exceeded

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))
        else:
            i+=1
    if i >= X:
        print('-1')

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a = list(map(int, input().split()))
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: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

i = 1
cond = False
if X != Y:
    while i <= 1000000000:
        if (i % X) == 0:
            if (i % Y) != 0:
                cond = True
                break
        i += 1

if cond:
    print(i)
else:
    print(-1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x, y = map(int, input().split())
if x % y == 0:
    print("-1")
for i in range(x, 1000000000000000000, x):
    if i % y != 0:
        print(i)
        exit()

Submission status: Accepted

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

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)

Submission status: Accepted

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

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

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

while True:
    x += tmp 
    if x%y != 0:
        print(x)
        exit()

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 math
a, b = map(int, input().split())
if(a % b == 0):
  print(-1)
else:
  i = math.gcd(a, b)
  c = a // i
  d = b // i
  print(c * d * i + a)

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:
def L():
    return list(map(int, input().split()))

[x,y]=L()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    x,y=MI()
    if x%y==0:
        print(-1)
    else:
        print(x)
        
        



        
        
        
        
        
    
if __name__=="__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
if x % y: print(x)
else: print(-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 = map(int,input().split())
if x%y != 0:
  print(x)
else:
  print(-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=map(int,input().split())
if x%y:
  print(x*(y-1))
else:
  print(-1)

Submission status: Accepted

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

if x==y or x%y==0:
    print(-1)
else:
    for i in range(2, 10**9):
        if (x*i)%y!=0:
            print(x*i)
            import sys
            sys.exit()
    print(-1)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
x,y = readInts()
MAX = 10**18
if x%y == 0:
    print(-1)
    exit()
while x <= 10 ** 18:
    if x%y != 0:
        print(x)
        exit()
    x += x
print(-1)

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())
if X%Y!=0:
    print(X)
else:
    print(-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 = map(int, input().split())
if X % Y == 0:
    print(-1)
else:
    print(X)

Submission status: Accepted

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


X, Y = LI()
a = 10**18//X
if X == Y:
    ans = -1
elif X % Y == 0:
    ans = -1
else:
    for i in range(2, a+1):
        if X*i % Y == 0:
            continue
        ans = X*i
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
ans = -1
for i in range(10**8):
  Z = X*(i+2)
  if Z%Y != 0 and Z <= 10**18:
    ans = Z
    break
  if Z > 10**18:
    break
print(ans)

Submission status: Accepted

Solution code:
from math import gcd
X, Y = [int(i) for i in input().split()]
lcm = X * Y // gcd(X, Y)
if lcm == X:
    print(-1)
else:
    print(X)

Submission status: Accepted

Solution code:
from math import gcd
X, Y = map(int, input().split())
l = X * Y // gcd(X, Y)
if l == X:
    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:
import math
x,y = map(int, input().split())
xy = x*y//(math.gcd(x,y))
if xy > x: print(x)
else: print(-1)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    x, y = map(int, readline().split())

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

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

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

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

if __name__ == '__main__':
    main()

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:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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 X%Y == 0:
    print('-1')
else:
    print(X)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X,Y = 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: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: map(float, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
'''
Created on 2020/08/20

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  X,Y=map(int,pin().split())
  if X%Y==0:
    print(-1)
    return 
  print(X)
  return 

main()

Submission status: Accepted

Solution code:
import sys, math, re
from functools import lru_cache
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

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

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    X, Y = mi()
    if X%Y == 0:
        print(-1)
    else:
        print(X)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if x%y == 0:
    ans = -1
else:
    ans = 0
    cnt = 2
    while True:
        if (x*cnt)%y != 0:
            ans = x*cnt
            break
        else:
            cnt += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import gcd
input = sys.stdin.readline
X, Y = map(int, input().split())
g = gcd(X, Y)
if g != Y: print(X * Y // g + X)
else: print(-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
X,Y = map(int,input().split())
a = X*Y//math.gcd(X, Y)-X
if a == 0:
    print(-1)
    exit()
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
if x%y == 0 :
    print(-1)
else:
    for i in range(10000):
        if (x*i)%y != 0:
            print(x*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 collections
import math


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

# from collections import deque

def linput(ty=int, cnv=list):
    return cnv(map(ty, input().split()))

def vinput(rep=1, ty=int, cnv=list):
    return cnv(ty(input().rstrip()) for _ in "*"*rep)

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():
    X,Y = linput()

    res = X if X%Y else -1
    print(res)
    # sT = "No Yes".split()
    # print(sT[res])
    # for vR in mR:
    #     print(*vR, sep="")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    X, Y = map(int, readline().split())
    if X % Y == 0:
        print('-1')
    else:
        print(X)


if __name__ == '__main__':
    main()

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
def IL(): return map(int,sys.stdin.readline().rstrip().split())

if __name__=='__main__':
    x,y = IL()
    if x==y:
        print(-1)
        exit()
    for rep in range(x,10**9+1,x):
        if rep%y!=0:
            print(rep)
            exit()
    print(-1)
    exit()

Submission status: Accepted

Solution code:
# coding: utf-8
#N = int(input())
#A = list(map(int,input().split()))
#k = int(input())
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())
print(-1 if x % y == 0 else x*y - x)

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())
print(X if X%Y!=0 else -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 = map(int,input().split())
ans = -1
i = 1

while True:
    a = (x*i) % y
    if a != 0:
        ans = x*i
        break
    else:
        ans = -1
        break

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,input().split())
if X%Y == 0:
  print(-1)
else:
  print(X*(Y-1))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

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

X, Y = map(int, input().split())
L = lcm(X, Y)
res = L - X
if (L - X) % Y != 0 and (L - X) <= 10**18:
    print(L - X)
else:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    X, Y = LI()

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

if __name__ == '__main__':
    resolve()

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:
      print(x*i)
      break
    else:
      i=i+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:
import math
x,y = map(int,input().split())
lcm = (x*y)//math.gcd(x,y)
flag = False
for i in range(x,lcm):
  if i%x==0 and i%y!=0:
    flag=True
    print(i)
    break
if not flag:
  print(-1)

Submission status: Accepted

Solution code:
X,Y = list(map(int,input().split()))
if X % Y == 0:
  print(-1)
else:
  for i in range(1,1000000):
      if X*i > 10**18:
          print(-1)
          break
      if X*i % Y != 0:
          print(X*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:
x, y = map(int, input().split())

if x == y: print(-1)
elif (x/y).is_integer(): print(-1)
else: print(x)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
for c in range(2,1000000):
    if c * x % y != 0:
        print(c * x)
        break
else:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    x,y=MI()
    if x%y==0:
        print(-1)
    else:
        print(x*(y+1))

main()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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



if __name__ == "__main__":
    main()

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())
print(x if not x % y == 0 else -1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
x,y = readInts()
MAX = 10**18
if x % y == 0:
    print(-1)
    exit()
while x <= 10**18:
    if x%y != 0:
        print(x)
        exit()
    x += x
print(-1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from fractions import gcd

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

X, Y = inm()


def solve():
    if X % Y == 0:
        return -1
    return X * (Y + 1)


print(solve())

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)

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, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, Y = MAP()

print(X if X%Y else -1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())
print([-1,X][X%Y>0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if x%y==0:
  exit(print(-1))
t=0
for i in range(1000001):
  t+=x
  if t%y!=0:
    print(t)
    exit(0)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

X, Y = MAP()

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 = list(map(int, input().split()))
if x%y!=0:
    print(x)
else:
    print(-1)

Submission status: Accepted

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