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:
import sys
range = xrange
input = raw_input

n,k = [int(x) for x in input().split()]

n -= k

if k<=1:
    print 0
else:
    print n

Submission status: Accepted

Solution code:
import sys

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

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

print(N-K)

Submission status: Accepted

Solution code:
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,k = na()

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

Submission status: Accepted

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

Submission status: Accepted

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

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(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:
a,b=input().split()
a=int(a)
b=int(b)
x=a-b
if b==1:
    print(0)
else:
    print(x)

Submission status: Accepted

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

ans = 0

if b == 1:
    ans = 0
else:
    i = a - b
    ans = i


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:
def main():
    N, K = [int(a) for a in 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())
maxa = n-(k-1)
if k == 1:
  print(0)
else:
  print(maxa - 1)

Submission status: Accepted

Solution code:

n, k = map(int,input().split() )

ans = 0
if not k == 1:
   ans = n-k 

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
if K != 1:
    ans = N-K

print(ans)

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:
import sys
# input = sys.stdin.readline
inf = 10 ** 18

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

if K < 2:
    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:
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())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

import random
import collections
import math
import itertools

def real_main():
    b, ppl = read_int_array()
    if ppl == 1:
        print(0)
    else:
        print(b - ppl)

def main():
    if False and 'PYCHARM_HOSTED' in os.environ:
        main_pycharm()
    else:
        real_main()


from copy import deepcopy
def main_pycharm():
    solution = solve

    test_inputs = None
    test_outputs = None
    judge = None
    slow_solution = None
    if solution is not None:
        if test_outputs is not None:
            test_with_answers(solution, test_inputs, test_outputs)
        if judge is not None:
            test_with_judge(solution, test_inputs, judge)
        if slow_solution is not None:
            test_with_slow_solution(solution, test_inputs, slow_solution)


def test_with_answers(solution, inputs_answers):
    total, wrong = 0, 0
    for args, test_ans in inputs_answers:
        ans = solution(*args.copy())
        if ans != test_ans:
            print('WRONG! ans=%s, test_ans=%s, args=%s' % (ans, test_ans, args))
            wrong += 1
        else:
            print('GOOD')
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))


def test_with_judge(solution, inputs_gen, judge):
    total, wrong = 0, 0
    for args in inputs_gen:
        ans = solution(*deepcopy(args))
        if not judge(deepcopy(ans), *deepcopy(args)):
            print('WRONG! ans=%s, args=%s' % (ans, args))
            wrong += 1
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))


def test_with_slow_solution(solution, inputs_gen, solution_slow):
    total, wrong = 0, 0
    for args in inputs_gen:
        ans = solution(*deepcopy(args))
        slow = solution_slow(*deepcopy(args))
        if ans != slow:
            print('WRONG! ans=%s, slow=%s, args=%s' % (ans, slow, args))
            wrong += 1
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

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


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        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")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

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

read = input
read_int = lambda: int(input())
read_array = lambda sep=None, maxsplit=-1: input().split(sep, maxsplit)
read_int_array = lambda: [int(a) for a in read_array()]

# endregion

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-1) - n // k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import math
import fractions
from collections import deque
import itertools

INF = 10 ** 10

N, K = [int(x) for x in stdin.readline().rstrip().split()]

amari = N - K

if K == 1:
    print(0)
else:
    print(amari)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
k,n = map(int,input().split())
if n == 1:
    print (0)
    exit()
print (k-n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
l = [1]*k
n -= sum(l)
l[0] += n
print(max(l)-min(l))

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=map(int,input().split())
if K==1:
    print(0)
    exit()
else:
    print(N-K)

Submission status: Accepted

Solution code:

input_data = input()
n,  k = input_data.split()

n = int(n)
k = int(k)

i  = n - k
max = i + 1
min = 1

if k == 1:
    print(0)
else:
    print(max - min)

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:
def solve(n, k):
    if k == 1:
        return 0
    return n - k

n, k = map(int, input().split(' '))
print(solve(n, k))

Submission status: Accepted

Solution code:
inp = input()
split_input = inp.split()
k = int(split_input[0])
n = int(split_input[1])
if n == 1:
    print(0)
else:
    print(k - n)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 20:53:16 2019

@author: Yamazaki Kenichi
"""

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

ans = N - K
if K == 1:
    print(0)
else:
    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(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:
# -*- coding: utf-8 -*-

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 : print(N - K)

Submission status: Accepted

Solution code:


def read_input():
    n, k = map(int, input().split())
    return n, k


def submit():
    n, k = read_input()

    balls = [1] * k
    balls[0] += (n - k)

    print(max(balls) - min(balls))
    return


if __name__ == '__main__':
    submit()

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(x) for x in input().split())
if k>1:
    print(n-k)
else:
    print(0)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
a = [1] * (K-1) + [N-(K-1)]
print(max(a)-min(a))

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:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000


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

print(N - K if K > 1 else 0)

Submission status: Accepted

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

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

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

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:
N,K=list(map(int,input().strip().split(' ')))
if K==1:
    print(0)
else:
    print(N-K)

Submission status: Accepted

Solution code:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N, K = mi()
rest = N - K
print(rest 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:
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 n-k>=0 and k!=1:
    print(n-k)
else:
    print(0)

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

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

re = N - K
print(re)

Submission status: Accepted

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


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


if __name__ == "__main__":
    main()

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:
# -*- coding: utf-8 -*-
def solve():
    N, K  = map(int, input().split())
    if K == 1:
        return '0'
    else:
        return str(N-K)

if __name__ == '__main__':
    print(solve())

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 if K != 1 else 0)

Submission status: Accepted

Solution code:
line = input().split()
N = int(line[0])
K = int(line[1])

if K==1:
  ans = 0
else:
  ans = N-K

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
N,K = map(int, input().split())
if K == 1:
    print(0)
    exit()
print(N-K)

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
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=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())
print(n-k if k > 1 else 0)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
if k == 1:
    print(0)
    exit()
elif n<k:
    print(1)
    exit()
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:
from sys import stdin

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

input = lambda: stdin.readline()
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = [int(x) for x in input().split()]
print(0 if K == 1 else 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(abs(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:
a, b = map(int,input().split())
if b == 1:
  print(0)
else:
  print(a-b)

Submission status: Accepted

Solution code:
# coding: utf-8
import time
import re
import math

def main():
    n,k=map(int,input().split())

    print(n%k)


start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#"YNeos"[True::2]
#A=list(map(int,input().split()))
#n=int(input())
# global n,A,s,memo,mx,mn,L,B

Submission status: Accepted

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

ans = n - k

if k == 1:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
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 sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

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

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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:
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict
import math


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


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


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def mod_inv(x):
    # available only when mod is prime
    global mod
    return pow(x, mod - 2, mod)


def gcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    ret = math.factorial(x)
    ret = ret // (math.factorial(x - y) * math.factorial(y))

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if self.parent[i] == i:
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if rooti < rootj:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)


###############################################################################


def main():
    n, k = intina()

    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 = input().split()
n = int(n)
k = int(k)

x_min = 1
x_max = n - (k-1)

if k > 1:
    print(x_max - x_min)
else:
    print(0)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
# S=numpp.assaray(S)=="#"
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LLS(): return [list(sys.stdin.readline().rstrip()) for _ in sys.stdin.readlines()]
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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()



def main():
    N, K = list(map(int,input().split()))
    if K==1:
        print(0)
    else:
        print((N-(K-1))-1)
    
    
if __name__ == "__main__":
    main()

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:
words = lambda t : list(map(t, input().split()))
n,k = words(int)

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

Submission status: Accepted

Solution code:
lista = input().split(" ")
a, b= lista
a = int(a)
b = int(b)
c = a%b
print(c)

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

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

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

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:
# coding:utf-8
import sys


def main():
    # N = int(input())
    N, K = map(int, input().split())
    ans = 0

    if K == 1:
        ans = 0
    elif K > 1:
        ans = N - K
    print(ans)
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

r = N-M
if r > M:
    print(0)
else:
    print(r)

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 = list(map(int, input().split()))
if (N-K) < 0 or 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 = list(map(int, input().split()))
if K == 1:
    print(0)
else:
    print(N - K)

Submission status: Accepted

Solution code:
import sys
from operator import itemgetter
from collections import deque

input = sys.stdin.readline

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:
N, K = map(int, input().split())
if K == 1:
    ans = 0
else:
    ans = N-K

print("{}".format(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:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


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


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K):
    if K == 1:
        return 0
    return (N - K)


def main():
    N, K = read_int_n()
    print(slv(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:
    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 = (int(i) for i in input().split())

if K == 1:
    print(0)
else:
    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:
#!/usr/bin/env python3
import sys
INF = float("inf")


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


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