Problem:


Score : 100 points

Problem Statement

Takahashi is distributing N balls to K persons.

If each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?

Constraints

1 \leq K \leq N \leq 100

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K

Output

Print the maximum possible difference in the number of balls received.

Sample Input 1

3 2

Sample Output 1

1

The only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.

Thus, the maximum possible difference in the number of balls received is 1.

Sample Input 2

3 1

Sample Output 2

0

We have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0.

Sample Input 3

8 5

Sample Output 3

3

For example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3, which is the maximum result.



Sample input:
3 2


Sample output:
1

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq as hq
import itertools as its
import operator as op


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    n, k = get_li()
    if k == 1:
        print(0)
    else:
        print(n-k)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

if K == 1:
    print(0)
else:
    print(N - K)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N,K=map(int,input().split())

if K==1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
if k == 1:
  print(0)
else:
  print(n-k)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
if K >= 2 :
    a = 1
    b = N - a * (K-1)
    c = b - a
    print(c)
else : print(0)

Submission status: Accepted

Solution code:
N, K = list(map(int, input().split()))
if K == 1:
  print(0)
else:
  print(N - K)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
print(N-K if K != 1 else 0)

Submission status: Accepted

Solution code:
N, K = map(int, input().split(" "))

nokori = N-K
if K >= 2:
    max_ = 1 + nokori
    min_ = 1
    out = max_ - min_
else:
    out = 0

print(out)

Submission status: Accepted

Solution code:
#a.py 100
n,k = map(int,input().split())
if k ==1 or k == n:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())

if(K == 1):
    print('0')
else:
    print(N%K)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
ans = N % K
print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, input().split(" "))

if K == 1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
if K==1:
    print(0)
else:          
    print(N-K)

Submission status: Accepted

Solution code:
N, K = [int(i) for i in input().split()]
if K == 1:
    print(0)
else:
    print(N - K)

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 permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

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

N, K = MAP()

if K == 1:
	print(0)
else:
	print(N-K)

Submission status: Accepted

Solution code:
n, k = [int(item) for item in input().split()]
if k == 1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
if 2<=k:
    print(n-k)
else:
    print(0)

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split()))
if k != 1:
  print(n-k)
else:
  print(0)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
if K == 1:
    print(0)
else:
    print(max(N - K, 0))

Submission status: Accepted

Solution code:
M, N = map(int, input().split())
ans = 0
if N == 1:
    ans = 0
else:
    ans = M - N
print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

if (K == 1):
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())

if K == 1:
    print(0)
    exit()

print(N - K)

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
if M == 1:
	print(0)
else:
	print(N-M)

Submission status: Accepted

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

N, K = getlist()

if K == 1:
	print(0)
else:
	print(N - K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def main():
    n, k = map(int, raw_input().split())
    if k == 1:
        print 0
    else:
        print n - k


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
if K >= 2:
    print(N-K)
else:
    print(0)

Submission status: Accepted

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

if k == 1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
n,k = map(int, input().split(' '))
if k <= 1:
  ans = 0
else:
  ans = n - (k-1) - 1
print(ans)

Submission status: Accepted

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

if k==1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:

N,M=map(int,input().split())

if M==1:
    print(0)
    
else:
    print(N-M)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
if k == 1:
	print(0)
else:
	s1 = n - k
	print(s1)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
if(k==1):
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
N, K=map(int, input().split())
if K==1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
if K == 1:
    print(0)
else:
    remain = N - K
    print(remain)

Submission status: Accepted

Solution code:
N, K = map(int, input().split(' '))

if K == 1:
    print(0)
else:
    print(N - K)

Submission status: Accepted

Solution code:
inpl = lambda: list(map(int,input().split()))
N, K = inpl()
if K == 1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())

if N>=K and K>=2:
    print(N-K)
else:
    print(0)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
if(k==1):
    print(0)
else:
    print((n-k))

Submission status: Accepted

Solution code:
N,K = map(int,input().split())

if K == 1:
  answer = 0
else:
  answer = N-K
print(answer)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

ans = (
    N - K if K >= 2 else
    0
)

print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, K = i2nn()
    if K == 1:
        print(0)
    else:
        print(N - K)

main()

Submission status: Accepted

Solution code:
n, k = [int(i) for i in input().split()]
if(k == 1):
  ans = 0
else:
  ans = n - k
print(ans)

Submission status: Accepted

Solution code:
n,k = list(map(int, input().split()))
if k == 1:
    print(0)
else :
    print(n-k)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

if K == 1:
    print(0)
    exit()

print(int(N - K))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
print(0 if k == 1 else n - k)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
if k == 1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

if K == 1:
    print(0)
else:
    print(N - K)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

if K==1: print(0)
else: print(N-K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k = list(map(int, input().split()))
if k == 1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
N,K = map(int, raw_input().split())
if K==1:
  print 0
else:
  print N-K

Submission status: Accepted

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


def solve(N: int, K: int):
    if K == 1:
        print(0)
    else:
        print(N-K)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
    return list(map(int,input().split()))
def m():
    return map(int,input().split())
def onem():
    return int(input())
def s(x):
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x):
    return " ".join(map(str,x))

n,k = m()

if k == 1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

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

mx = N - (H-1)
if H > 1:
    print(mx -1)
else:
    print(0)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
if k == 1:
  print(0)
else:
  print(n-k)

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')
def qw(f):
    if f:
        print('Yay!')
    else:
        print(':(')

n,k = map(int,input().split())
l = [0] * k
for i in range(min(n, k)):
    l[i] += 1
    n -= 1
l[0] += n
print(max(l) - min(l))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

if K == 1:
    print (0)
else:
    print ((N-(K-1))-1)

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split()))
if k == 1:
  print(0)
else:
  print(n - k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

if K == 1:
	print(0)
else:
	print(N - K - 1 + 1)

Submission status: Accepted

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

if K==1:
    print(0)
    exit()
k = N - K 
print(k)

Submission status: Accepted

Solution code:
N, K = map(int,input().split())
if K == 1:
    print("0")
else:
    print(str((N-K)))

Submission status: Accepted

Solution code:
N,K = map(int,input().split(" "))

if(K==1):
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, K = list(map(int, sys.stdin.readline().split()))
if K == 1:
    print(0)
else:
    print(N - K)

Submission status: Accepted

Solution code:
H,W = map(int,input().split(' '))
if not W==1:
    print(H-W)
else:
    print(0)

Submission status: Accepted

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


N,K=map(int,input().split())

if K==1:
    print(0)
else:
    print(N-(K-1)-1)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
if K == 1 :
    print(0)
else :
    print(N-K)

Submission status: Accepted

Solution code:
def solve(n, k):
    if k == 1:
        return 0
    else:
        u = n - (k - 1)
        return u - 1

assert solve(3, 2) == 1
assert solve(8, 5) == 3

if __name__ == '__main__':
    (n, k) = map(int, raw_input().split())
    print solve(n, k)

Submission status: Accepted

Solution code:
def solve():
    N, K = [int(_) for _ in raw_input().split()]
    if K > 1:
        ret = N - K
    else:
        ret = 0
    print ret

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))
N, K = inpl()
if K == 1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!


n,k = [int(i) for i in input().split()]
if k==1:
 print(0)
else:
    print(n-k+1-1)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
ans = N-K
if K > 1:
  print(ans)
else:
  print(0)

Submission status: Accepted

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

def main():
    n, k = map(int, input().split())
    if k == 1:
        print(0)
    else:
        print(n-k)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
if k == 1:
	ans = 0
else:
	ans = n-k
print(ans)

Submission status: Accepted

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

print(n - k if k != 1 else 0)

Submission status: Accepted

Solution code:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())
nsl = lambda: list(nsm())

n, k = nm()
if k == 1:
    print(0)
else:
    print(n - k)

Submission status: Accepted

Solution code:
N,K=map(int,input().split())

if K==1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())

if K == 1 :
    ans = 0
else :
    ans = N-K
print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
if(k==1):
	print(0)
else:
	print(n-k)

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
print(0 if k ==1 else n-k)

Submission status: Accepted

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

if k==1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
n, k = map(int, input().split())
if k == 1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
if k == 1:
    print(0)
else:
    print(n - k)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
print(N-K if K > 1 else 0)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
if k == 1:
	print(0)
else:
	print(n - k)

Submission status: Accepted

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

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n, k = rli()
    if k == 1:
        print(0)
    else:
        print(n-k)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if k==1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
if K == 1:
	print(0)
else:
	print(N - K)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
if K==1:print(0)
else: print(N-K)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
ans = N-K
if K == 1:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split()))
if k == 1:
	print(0)
else:
	print(n - k)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
if k==1: print(0)
else: print(n-k)

Submission status: Accepted

Solution code:
import numpy as np
from collections import defaultdict
from functools import reduce

# s = input()
# n = int(input())
# A = list(map(int, input().split()))
N, K = map(int, input().split())

if K == 1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    [n, k] = li()
    if k == 1:
        print(0)
    else:
        print(n - k)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
ans = n%k
print(ans)

Submission status: Accepted

Solution code:
def getN():
    return int(input())

def getMN():
    return list(map(int, input().split()))

def getlist():
    return list(map(int, input().split()))

n,x = getlist()
if x == 1:
    print(0)
else:
    print(n-x)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

if K == 1:
  print(0)
else:
  print(N - K)

Submission status: Accepted

Solution code:
#    !/usr/bin/env python3
#    encoding: UTF-8
#    Modified: <15/Jun/2019 05:31:28 PM>


#    ✪ H4WK3yE乡
#    Mohd. Farhan Tahir
#    Indian Institute Of Information Technology (IIIT), Gwalior


import sys
import os
from io import IOBase, BytesIO


def main():
    n, k = get_ints()
    if k==1:
        print(0)
        return
    left = n - k
    print(left)


BUFSIZE = 8192


class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill():
            pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill()
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        py2 = round(0.5)
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode("ascii"))
            self.read = lambda: self.buffer.read().decode("ascii")
            self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def get_array(): return list(map(int, sys.stdin.readline().split()))


def get_ints(): return map(int, sys.stdin.readline().split())


def input(): return sys.stdin.readline().strip()


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline
mii=lambda:map(int,input().split())

n,k=mii()

print(n-k if k>1 else 0)

Submission status: Accepted

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

Submission status: Accepted

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

if K <= 1:
    print(0)
else:
    print(N - K)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(n % k)

Submission status: Accepted

Solution code:
def solve():

  n,k = (int(i) for i in input().split())
  if k == 1:
    ans = 0
  else:
    ans = n-k
  print(ans)
    
solve()

Submission status: Accepted

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

Submission status: Accepted

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

if k >= 2:
    print(n - k)
else:
    print(0)

Submission status: Accepted

Solution code:
import sys, math, collections, heapq, itertools
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    INF = 10 ** 25
    mod = 7 + 10 ** 9
    N, K = map(int, input().split())
    print(N % K)
    return 0
  
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

print(n%k)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
if K == 1:  print(0)
else:   print(N-K)

Submission status: Accepted

Solution code:
n,k=[int(i) for i in input().split()]
print(n-k*(n//k))

Submission status: Accepted

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

if K == 1:
  print(0)
else:
  print(N-K)

Submission status: Accepted

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

if k == 1:
  print(0)
else:
  print(n - k + 1 - 1)

Submission status: Accepted

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

print(N%K)

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split()))
if k==1:
  print(0)
else:
  print(n-k)

Submission status: Accepted

Solution code:
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    a,b= map(int, input().split())
    if b==1:
        print(0)
        return
    print(a-b)


main()

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
if K == 1:
    ans = 0
else:
    ans = N - K
print(ans)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
ans = 0 if k == 1 else n - k
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def YesNo(x): return 'Yes' if x else 'No'
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N, K = LI()
    ans = (N - K) if K > 1 else 0
    return ans

print(main())

Submission status: Accepted

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

def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return map(int, INPUT().split())
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()

N, K = MULTIPLE_INT_MAP()

if K == 1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
W = list(map(int,input().split()))
print(W[0]%W[1])

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N, K = MI()
    if K == 1:
        print(0)
    else:
        print(N-K)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, k = map(int,input().split())
if k == 1:
  print(0)
else:
  print(n-k)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

print(N%K)

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
if k == 1:
  a = 0
else:
  a = n-k
print(a)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
ri = lambda: int(input())
#rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
#rl = lambda: list(input().split()))
rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

N,K=rl()
print(N-K if K >1 else 0)

Submission status: Accepted

Solution code:
# div2019-2A - Ball Distribution
n, k = list(map(int, input().rstrip().split()))
print(n % k)

Submission status: Accepted

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

Submission status: Accepted

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

print(N%K)

Submission status: Accepted

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

Submission status: Accepted

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


print(n%k)

Submission status: Accepted

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

if K!=1:
    print(N-K)
else:
    print(0)

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, K = nl()
if K == 1:
    print(0)
else:
    print(N - K)

Submission status: Accepted

Solution code:
import math
import fractions
import copy
import numpy as np
#以下てんぷら
def j(q):
    if q==1: print("POSSIBLE")
    elif q == 0:print("IMPOSSIBLE")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


#n = ip()                                     #入力整数1つ
n,m= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!
#これを消すとなぜかWAになる呪い
if n%m==0:
    print(0)
else:
    print(n%m)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
if K==1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
if k==1:
  print(0)
else:
  if n==k:
    print(0)
  else:
    print(n-k)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
print(N%K)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
print(n%k)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())

print(N%K)

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] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,k = LI()
    print(n%k)
    return

#B
def B():
    n = I()

    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#G
def G():
    n = I()

    return

#H
def H():
    n = I()

    return

#I
def I_():
    n = I()

    return

#J
def J():
    n = I()

    return

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