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

A = int(l[0])
B = int(l[1])

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:
ab = input().split()
a,b = int(ab[0]),int(ab[1])

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())
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:
def divisors(x):
    '''公約数をリスト型で返す関数'''
    divisors = []
    divisor = 1
    while(divisor <= x / divisor):
        if x % divisor == 0:
            divisors.append(divisor)
            if divisor == int(x / divisor):
                pass
            else:
                divisors.append(int(x / divisor))
        else:
            pass
        divisor += 1
    return sorted(divisors)

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

if A in divisors(B):
    print(A + B)
else:
    print(B - A)

Submission status: Accepted

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

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

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:
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left

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=list(map(int,input().split()))
print(sum(A) if A[1]%A[0]==0 else A[1]-A[0])

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
if  not B%A:
  print(A+B)
else:
  print(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)

if b%a !=0:
    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:
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=list(input().split())
b=int(a[0])
c=int(a[1])
if c%b==0:
  print(b+c)
else:
  print(c-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())
yakusuu_list = []
for i in range(1,b+1):
    if b % i == 0:
        yakusuu_list.append(i)
if a in yakusuu_list:
    print(a + b)
else:
    print(b - a)

Submission status: Accepted

Solution code:
A,B=map(int,input().split());print([B-A,A+B][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:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    if B % A == 0:
        ret = A + B
    else:
        ret = B - A
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
input = sys.stdin.readline

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
A - B +/- A
https://atcoder.jp/contests/abc118/tasks/abc118_a

"""
import sys


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


if __name__ == '__main__':
    main(sys.argv[1:])

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
from collections import Counter
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def IS(): return input()

a, b = MI()
print(a + b) if b % a == 0 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=input().split()
A=int(A)
B=int(B)
print((B%A==0)*(A+B)+(B%A!=0)*(B-A))

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b = LI()
    if b%a == 0:
        print(a+b)
    else:
        print(b-a)
    return

#B
def B():
    n,m = LI()
    d = defaultdict(int)
    for i in range(n):
        l = LI()
        for j in range(1,len(l)):
            d[l[j]] += 1
    ans = 0
    for i in d.values():
        if i == n:
            ans += 1
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    A()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

m=B%A

if m == 0:
  print(A+B)
else:
  print(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 = [int(i) for i in input().split()]
if B % A == 0:
    print(A + B)
else:
    print(B - A)

Submission status: Accepted

Solution code:
#encoding: utf-8

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

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

Submission status: Accepted

Solution code:
a,s=map(int,input().split())
if s%a==0:
  print(a+s)
else:
  print(s-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())

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

if __name__ == '__main__':
    print(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(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)


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().strip().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())
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:
ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]
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(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:
DATA=input()
DATA=DATA.split(" ")
A=int(DATA[0])
B=int(DATA[1])

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+/-A
A, B = map(int, input().strip().split())
if B%A == 0:
	print(A+B)
else:
	print(B-A)

Submission status: Accepted

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

if divmod(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(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,open(0).read().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 == B//A:
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

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

Submission status: Accepted

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

if numbers[1]%numbers[0] == 0:
	print(numbers[1] + numbers[0])
else:
	print(numbers[1] - numbers[0])

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())
print(a+b) if b%a==0 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 = list(map(int, input().split()))
if B / A == B // A:
    print(B + A)
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:
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:
A,B=input().split()
A=int(A)
B=int(B)
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 = [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 = [int(x) for x 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:
A, B = map(int, raw_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:
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces

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

Submission status: Accepted

Solution code:
###A - B +/- A
A, B = map(int, input().split())
if B % A == 0:
    print(int(A+B))
else:
    print(int(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 = get_params()
    print(answer(a, b))


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


def answer(a, b):
    return 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:
def math(A,B):
    if B%A ==0:
        print(A+B)
    else:
        print(B-A)
A,B = tuple(map(int, input().split()))

math(A,B)

Submission status: Accepted

Solution code:
A,B = tuple(map(int,input().split()))
if int(int(B/A)*A) == B:
    print(A+B)
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 = (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 = [int(item) for item in 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())
d = b + a
x = b - a
if b % a == 0:
    print d
else:
    print x

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

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

Submission status: Accepted

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

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 = (int(i) for i in input().split())
if B%A==0:
    print(A+B)
else:
    print(abs(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())
ans = a+b if b%a == 0 else b - a
print(ans)

Submission status: Accepted

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

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:
x = input().split(' ')
a = int(x[0])
b = int(x[1])
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 = 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=list(map(int, input().split()))
print(a+b if b % a == 0 else b-a)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    A, B = [int(s) for s 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:
list = [int(i) for i in raw_input().split()]
if list[1]%list[0] == 0:
 	print(list[0]+list[1])
else:
	print(list[1]-list[0])

Submission status: Accepted

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

Submission status: Accepted

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

if B % A == 0:
    ans = A + B
else:
    ans = B - A

print(ans)
print()

Submission status: Accepted

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

C = B % A

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if 0 == B % A:
  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:
# https://atcoder.jp/contests/abc118/tasks/abc118_a
a, b = [int(x) for x in input().split()]
print(a + b) if b % a == 0 else print(b - a)

Submission status: Accepted

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

print(result)

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

mod = B % A
if mod == 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 = list(map(int, input().split(' ')))
result = A + B if B % A == 0 else B - A
print(result)

Submission status: Accepted

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

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(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())
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:
a, b = map(int,input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
A, B = map(int, input().split())
if gcd(A, B) == A:
    print(A + B)
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())
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=input().split()
a=int(a)
b=int(b)
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,a+b][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:
n=list(map(int,input().split()))
if n[1]%n[0]==0:
    print(n[0]+n[1])
else:
    print(n[1]-n[0])

Submission status: Accepted

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

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:
import sys

l = map(int, raw_input().split())

if l[1]%l[0]==0:
    print(l[0]+l[1])

else:
    print(l[1]-l[0])

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:
n,m = map(int,input().split())
res = m % n
if res==0:
    print(m+n)
else :
    print(m-n)

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())
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 = (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())
if B%A==0:
    print(A+B)
else:
    print(B-A)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>

"""
from __future__ import division, print_function

import itertools
import os
import sys
from atexit import register
from io import BytesIO


class dict(dict):
    """dict() -> new empty dictionary"""

    def items(self):
        """D.items() -> a set-like object providing a view on D's items"""
        return dict.iteritems(self)

    def keys(self):
        """D.keys() -> a set-like object providing a view on D's keys"""
        return dict.iterkeys(self)

    def values(self):
        """D.values() -> an object providing a view on D's values"""
        return dict.itervalues(self)


def gcd(x, y):
    """greatest common divisor of x and y"""
    while y:
        x, y = y, x % y
    return x


range = xrange

filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip

sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))

input = lambda: sys.stdin.readline().rstrip('\r\n')


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:
"""
Atcoder Beginner Contest 118 Problem A(https://atcoder.jp/contests/abc118/tasks/abc118_a)
my code: https://atcoder.jp/contests/abc118/submissions/4279133
"""

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

Submission status: Accepted

Solution code:
def solve(std_in):
    """
    Calculate two numbers is a side number another number's divisor

    Paramaters
    ----------
    std_in : string
        input to standard input as string

    Returns
    -------
    y : int
        a side number +/- another number
    """
    _in = std_in.split()
    a = int(_in[0])
    b = int(_in[1])

    y = a + b if b % a == 0 else b - a
    return y

  
def main():
    stdin = input()
    out = solve(stdin)
    print(out)


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:
data = input().split()
a = int(data[0])
b = int(data[1])

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

Submission status: Accepted

Solution code:
import sys
num = [int(s) for s in sys.stdin.readline().split()]
if num[1]%num[0] == 0 :
  print (num[0]+num[1])
else :
  print (num[1]-num[0])

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    a, b = [int(x) for x in input().strip().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 -*-

import sys
import math

def parse_input(lines_as_string = None):

    lines = []
    if lines_as_string is None:
        for line in sys.stdin:
            lines.append(line)
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    params = lines[0].split(" ")
    a = int(params[0])
    b = int(params[1])

    return (a, b)


def solve(a, b):

    result = 0
    if b % a == 0:
        result = a + b
    else:
        result = b - a

    return result

def main():
    # 出力

    print("%d" % solve(*parse_input()))

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())
print(A+B) if B % A == 0 else print(B-A)

Submission status: Accepted

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

import sys

def parse_input(lines_as_string = None):

    lines = []
    if lines_as_string is None:
        for line in sys.stdin:
            lines.append(line)
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    params = lines[0].split(" ")
    a = int(params[0])
    b = int(params[1])

    return (a, b)


def solve(a, b):

    result = 0
    if b % a == 0:
        result = a + b
    else:
        result = b - a

    return result

def main():
    # 出力

    a, b = parse_input()
    print("%d" % solve(a, b))

if __name__ == '__main__':

    main()

Submission status: Accepted

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

def parse_input():
    line = [int(e) for e in input().split(" ")]
    a = line[0]
    b = line[1]

    return (a, b)


def solve(a, b):

    result = 0
    if b % a == 0:
        result = a + b
    else:
        result = b - a

    return str(result)

def main():
    # 出力

    a, b = parse_input()
    print(solve(a, b))

if __name__ == '__main__':

    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input().split()
a = int(x[0])
b = int(x[1])
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 == 0 else b - a)

Submission status: Accepted

Solution code:
nums = input().split(" ")
num1 = int(nums[0])
num2 = int(nums[1])
if num2 % num1 == 0:
  print(num1+num2)
else:
  print(num2-num1)

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:
import sys
import pprint

pp = pprint.PrettyPrinter(indent=4)

def main():
    """ Code implementation """
    a, b = map(int, input().split())
    if b % a == 0:
        print(b + a)
    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())
1 <= A <= B <= 20
 
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 solve(a, b):
    return (a+b) if (b % a == 0) else (b-a)
a, b = map(int, input().split())
print(solve(a,b))

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)