Problem:


Score : 100 points

Problem Statement

You are given positive integers A and B.

If A is a divisor of B, print A + B; otherwise, print B - A.

Constraints

All values in input are integers.

1 \leq A \leq B \leq 20

Input

Input is given from Standard Input in the following format:

A B

Output

If A is a divisor of B, print A + B; otherwise, print B - A.

Sample Input 1

4 12

Sample Output 1

16

As 4 is a divisor of 12, 4 + 12 = 16 should be printed.

Sample Input 2

8 20

Sample Output 2

12

Sample Input 3

1 1

Sample Output 3

2

1 is a divisor of 1.



Sample input:
4 12


Sample output:
16

Submission status: Accepted

Solution code:
import math
import collections
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 LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

a,b=MI()
if b%a==0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
import numpy as np
import sys

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

Submission status: Accepted

Solution code:
A,B = (int(i) for i in input().split(" "))
if B % A == 0:
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

a,b = map(int,input().split())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
a,b = map(int,input().split())

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

# print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
if  (B%A==0):
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

A, B = map(int, input().split())


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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
print(m-n if m%n else n+m)

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    a, b = MII()
    if b%a == 0: print(a+b)
    else: print(b-a)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
if B % A == 0:
  print(A + B)
else:
  print(B-A)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B = list(map(int,input().split()))
if B%A==0:
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
if (B%A==0):
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

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

if m % n == 0:
  print(n+m)
else:
  print(m-n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC-118-A
A, B = map(int, input().split())
if B % A == 0:
    print(A + B)
else:
    print(B - A)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
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 b % a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
if B % A == 0: print(A + B)
else: print(B - A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

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

Submission status: Accepted

Solution code:
def main():
    a, b = map(int, input().split())
    if(b % a == 0):
        print(a+b)
    else:
        print(b-a)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 118: A – B +/- A
a, b = [int(s) for s in input().split()]
print(a + b if b % a == 0 else b - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

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

Submission status: Accepted

Solution code:
def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  a,b = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  
  if b%a == 0:
    print(a+b)
  else:
    print(b-a)

if __name__ == '__main__':
  main()

Submission status: Accepted

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

if b%a == 0:
    ans = a + b
else:
    ans = b - a
print(ans)

Submission status: Accepted

Solution code:
import itertools
import fractions
def main():
  a,b = map(int,input().split())
  print(a+b if b%a == 0 else b-a)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
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
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

a, b = map(int, sys.stdin.readline().split())

def main():
    ans = a + b if not b % a else b - a
    print(ans)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    
    if a[1] % a[0] ==0:
        print(a[0]+a[1])
    else:
        print(a[1]-a[0])

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
a,b = iim()

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

if B % A == 0:
	print(int(A + B))
else:
	print(int(B - A))

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
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
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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
if B%A==0:
  print(B+A)
else:
  print(B-A)

Submission status: Accepted

Solution code:
A, B = map(int,input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

def main():
    A, B = map(int, input().split())
    print(A + B if B % A == 0 else B - A)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
A, B = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

print(A + B if B % A == 0 else B - A)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
print(A + B if B % A == 0 else B - A)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split());print(A+B if B%A==0 else B-A)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
if B%A==0:
  print(A+B)
else:
  print(B-A)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
if B%A == 0:
    print(A+B)
elif B%A != 0:
    print(B-A)
else:
    pass

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
print(B - A if B % A else A + B)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
print(B%A==0 and A+B or B-A)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC118 A

def main():
    a, b = map(int, input().split())

    if b % a:
        print(b - a)
    else:
        print(a + b)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B = map(int,(input().split()))
if B%A == 0:
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

Solution code:
A,B = map(int,input().split(" "))

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

Submission status: Accepted

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

if a%b==0 or b%a==0:
  print(a+b)
else:
  print(b-a)

Submission status: Accepted

Solution code:
A,B =map(int, input().split())
if(B % A == 0):
  print(A+B)
else:
  print(B-A)

Submission status: Accepted

Solution code:
import sys 
input = sys.stdin.readline
MOD = 10**9 +7
INF = 10**9

def main():
    a,b = map(int,input().split())
    if b%a == 0:
        print(a + b)
    else:
        print(b - a)

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
a,b = [int(i) for i in input().split()]
if b % a == 0:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = (A + B if B % A == 0 else B - A)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = list(map(int, sys.stdin.buffer.readline().split()))
    print(B+A if B%A == 0 else B-A)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B=map(int,input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

    print(a+b if b % a == 0 else b-a)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ii=lambda:int(input())
miis=lambda:map(int,input().split())
lmiis=lambda:list(map(int,input().split()))

a,b=miis()
print(a+b if b%a==0 else b-a)

Submission status: Accepted

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    a, b = map(int, input().split())
    b_divide = divisor(b)
    if a in b_divide:
        ans = a + b
    else:
        ans = b - a
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#abc118 a
a,b=map(int,input().split())
flag=False
if max(a,b)%min(a,b)==0:
    flag=True
if flag:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

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

Submission status: Accepted

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

print(a + b if b % a == 0 else b - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B = map(int, input().split())

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

Submission status: Accepted

Solution code:
def solve():
    A, B = map(int, input().split())
    if B % A == 0:
        print(A+B)
    else:
        print(B-A)

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
# A - B +/- A
a,b=list(map(int,input().split()))
if b%a==0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(a+b if b%a == 0 else b-a)

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
if B % A == 0:
  print(A+B)
else:
  print(B-A)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
if B%A == 0 :
  print(A+B)

else:
  print(B-A)

Submission status: Accepted

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

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

Submission status: Accepted

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

def main():
  a, b = map(int, input().split())
  print(a+b if b%a == 0 else b-a)

if __name__=='__main__':
  main()

Submission status: Accepted

Solution code:
[A,B] = list(map(int,input().split()))
if B%A==0:
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(a+b if b%a == 0 else b-a)

Submission status: Accepted

Solution code:
s=list(map(int,input().split()))
if s[1]%s[0]==0:
  print(s[0]+s[1])
else:
  print(s[1]-s[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A,B = [int(i) for i in input().rstrip().split()]

print( (A+B) if B%A == 0 else (B-A) )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = [int(_) for _ in input().split()]
print(B - A if B%A else A + B)

Submission status: Accepted

Solution code:
#%%
A, B = map(int, input().split())

#%%
if B % A == 0:
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
if B%A == 0 :
    print(A+B)
else :
    print(B-A)

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
print(A+B if B%A == 0 else B-A)

Submission status: Accepted

Solution code:
A,B = map(int, input().split())

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

Submission status: Accepted

Solution code:
#118_A
A,B=map(int,input().split())
print(A+B if B%A==0 else B-A)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
A,B=map(int,input().split())
if B%A!=0:
    print(B-A)
else:
    print(A+B)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
print(A+B) if(B % A == 0) else print(B-A)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
print(A+B) if B//A == B/A else print(B-A)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
A,B = [int(i) for i in input().split()]
if B % A == 0:
    print(A + B)
else :
    print(B-A)

Submission status: Accepted

Solution code:
m,n=map(int,input().split())
print(m+n if n%m==0 else n-m)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    A, B = map(int, input().split())
    if B % A == 0:
        print(A + B)
    else:
        print(B - A)
        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

a, b = na()

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
if B % A == 0 :
    print(A + B)
else :
    print(B - A)

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    A, B = map(int, input().split())
    print(A + B if (A + B) % A == 0 else B - A)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
input_val = input().split()
A=int(input_val[0])
B=int(input_val[1])
if B%A==0:
  print(B+A)
else:
  print(B-A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = list(map(int, input().split()))
if B % A == 0:
    print(A + B)
else:
    print(B - A)

Submission status: Accepted

Solution code:
def main(A,B):
    return A + B if (B % A == 0) else B - A

A,B = map(int,input().split())
print(main(A,B))

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
print(A+B) if B%A==0 else print(B-A)

Submission status: Accepted

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

Submission status: Accepted

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

print(a+b) if b % a == 0 else print(b-a)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())

sys.setrecursionlimit(10 ** 9)


def main():
    A, B = MAP()
    print(A + B if B % A == 0 else B - A)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, raw_input().split())
if B%A == 0:
    print A+B
if B%A != 0:
    print B-A

Submission status: Accepted

Solution code:
import sys
import math
import itertools

a,b=list(map(int,input().split()))
for i in range(1,b+1,1):
	if b%a==0:
		print(a+b)
		sys.exit()
print(b-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if b%a != 0:
    print(b-a)
else:
    print(b+a)

Submission status: Accepted

Solution code:
A, B = [int(n) for n in input().split()]
print(A+B if B%A==0 else B-A)

Submission status: Accepted

Solution code:
A,B = map(int, input().split())

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

Submission status: Accepted

Solution code:
def main():
    A, B = map(int, input().split(" "))
    if B % A == 0:
        print(A + B)
    else:
        print(B - A)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = (int(i) for i in input().split())
print(a+b) if b%a == 0 else print(b-a)

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 15, Jan, 2020
"""

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int, readline().split())
print(A + B if B % A == 0 else B - A)

Submission status: Accepted

Solution code:
A, B = [int(i) for i in input().split()]
if B % A == 0:
  ans = A + B
else:
  ans = B - A
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    A, B = list(map(int, input().split()))
 
    if B % A == 0:
        print(A + B)
    else:
        print(B - A)
 
main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    from sys import stdin
    r = stdin.readline()[:-1]
    #r = stdin.readlines()

    a, b = map(int, r.split())
    if b%a == 0:
        print(a+b)
    else:
        print(b-a)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
num = [int(e) for e in input().split()]
A=num[0]
B=num[1]
if B%A==0:
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

Solution code:
import sys

a, b = map(int, sys.stdin.readline().split())

def main():
    return a + b if not b % a else b - a

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
if B % A == 0:
  r = A + B
else:
  r = B - A
print(r)

Submission status: Accepted

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

Submission status: Accepted

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

a,b = map(int,input().split())

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

Submission status: Accepted

Solution code:
def examA():
    A, B = LI()
    if B%A==0:
        ans = A+B
    else:
        ans = B-A
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

Submission status: Accepted

Solution code:
import sys
import math
import bisect
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a, b = na()
if b % a == 0:
    print(a+b)
else:
    print(b-a)

Submission status: Accepted

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

print(a + b if b%a == 0 else b - a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if b%a == 0:
   print(a+b)

else:
  print(b-a)

Submission status: Accepted

Solution code:
def main():
    A, B = list(map(int, input().split()))

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

main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    A,B=map(int,input().split())
    if B%A==0:
        print(A+B)
    else:
        print(B-A)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
if B%A==0:
  print(A+B)
else:
  print(B-A)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(a+b) if b%a == 0 else print(b-a)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
print(B - A if B % A else B + A)