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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############
N,K = IL()
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 else 0
print(ans)

Submission status: Accepted

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

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

ans = N - K
print(ans)

Submission status: Accepted

Solution code:
x, y = map(int,input().split())
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:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10**7)

ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

n, k = na()

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

Submission status: Accepted

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

#入力
# s = input()[0:-1]
# n = int(input())
n,k = map(int, input().split())
# a = list(map(int,input().split()))
# a = [int(input()) for i in range()]


# ab=[]
# for i in range():
#     a,b = map(int, input().split())
#     ab.append([a,b])


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,m = readInts()
print(n-m if m != 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:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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


if __name__ == '__main__':
    resolve()

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())
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())
print(0 if K==1 or N==K else 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:
N,K = list(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:
import sys
import math
import bisect

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:
    print(0)
else:
    print(n-k)

Submission status: Accepted

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

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

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
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

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

Submission status: Accepted

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

mi = 1
ma = 1 + n-k

if(k==1):
    print(0)
else:
    print(ma-mi)

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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#template
def inputlist(): return [int(k) for k in input().split()]
#template
N,K = inputlist()
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:
import sys
from sys import stdin

n, k = map(int, stdin.readline().rstrip().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:
#d2019PC2 - A
N,K=map(int,input().split())
MAX=N-K+1
print(MAX-1 if K!=1 else 0)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
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())
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())
print(0 if K == 1 else N-K)

Submission status: Accepted

Solution code:
# A - Ball Distribution
N, K = map(int, input().split())

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

Submission status: Accepted

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

A=N-K

if K>1:
  print(A)
else:
  print(0)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# diverta 2019 Programming Contest 2: A – Ball Distribution
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:
n,k=map(int, input().split())
if k==1:
  print(0)
else:
  t=n-k
  print(t)

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
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

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

if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    if a[1] == 1 or a[0] ==a[1]:
        print(0)
    else:
        print(a[0]-a[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:
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 or K == 1:
    print(0)
else:
    print(N - K)

Submission status: Accepted

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

print((n-k+1) - n//k)

Submission status: Accepted

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


if __name__ == '__main__':
    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 = 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
print(ans if ans >= 0 and 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())
print(int(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:
    mx = n - k + 1
    ans = mx - 1
    print(ans)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

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

if K == 1:
    ans = 0
else:
    min_ = 1
    max_ = N - (K - 1)  # K-1人に一つずつ配った残り
    ans = max_ - min_

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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(n-k)
else:
  print(0)

Submission status: Accepted

Solution code:
import sys
n, k = [int(i) for i in sys.stdin.readline().split()]
if k == 1:
  print(0)
else:
  print(n - k)

Submission status: Accepted

Solution code:
# import bisect
# from collections import Counter, defaultdict, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

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

def main():
    n, k = list(map(int,ipti().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:
    print("0")
else:
    print((N-(K-1))-1)

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, K = map(int, input().split())
a = N//K
print(N-a*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 = 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)

Submission status: Accepted

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

Submission status: Accepted

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

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

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 = 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(n - k)
else:
  print(0)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin
N, K = [int(_) for _ in stdin.readline().rstrip().split()]
if K == 1:
  print(0)
else:
  print(N-K)

Submission status: Accepted

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

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


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

Submission status: Accepted

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

Submission status: Accepted

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

print(0 if n%k == 0 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:
def main():
    N,K = map(int,input().split())
    print(N-(N//K)*K)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin
import string

n,k = [int(x) for x in stdin.readline().rstrip().split()]

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

Submission status: Accepted

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

if n // k <= 0:
    print(0)
elif k == 1:
    print(0)
else:
    max_num = n - k + 1
    print(max_num - 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:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
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:
n,k = map(int,input().split())

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

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:
a= list(map(int,input().split()))
N=a[0]
K=a[1]

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
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:
def examA():
    N, K = LI()
    if K==1:
        ans = 0
    else:
        ans = N-K
    print(ans)


from string import digits
import sys,copy,bisect,itertools,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

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


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, readline().split()))
    if k == 1:
        print(0)
    elif n < k:
        print(1)
    else:
        print(n - k)


if __name__ == '__main__':
    solve()

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

    print(n - k)


if __name__ == "__main__":
    n, k = map(int, input().split())

    main(n, k)

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=map(int,input().split())
print((n-k)*(k!=1))

Submission status: Accepted

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


N, K = inpl()
print(N - K if K > 1 else 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())
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:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 18
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353



n, k = LI()
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:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,k = inpl()
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:
# diverta 2019 Programming Contest 2: A – Ball Distribution
n, k = [int(s) for s 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)
else:
  print(N-K)

Submission status: Accepted

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

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:
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:
  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:
import sys
N, K = map(int, sys.stdin.readline().split())

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    if k == 1:
        print(0)
    else:
        print(n - k)


if __name__ == '__main__':
    slove()

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())
for i in range(21200000):
    i+=1
if k==1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
n,k= map(int, input().split())
for i in range(14200000):
    i+=1
if k==1:
    print(0)
else:
    print(n-k)

Submission status: Accepted

Solution code:
n,k= map(int, input().split())
for i in range(7000000):
    i+=1
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:
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    ls = [0] * k
    pos = 0
    for i in range(n):
        ls[pos] += 1
        if pos + 1 < k:
            pos += 1
    print(0 if len(ls) == 1 else ls[-1] - ls[0])


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
N, K = map(int, input().strip().split())
#print(N)
#print(K)
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:
N, K = tuple(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())
ma = n//k + n%k
mi = n//k
print(ma -mi)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

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
input = sys.stdin.readline
 
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:
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)