ZhenlongDai/ACPR huggingface dataset:
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
S = list(map(int,input().split()))
ans = (n-1)
if n % k:
    ans += 1
print(ans)

Failing test case input:
167 4
1 0 4 7

Expected output:
56


Actual output:
167


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
S = list(map(int,input().split()))
res = k
ans = 1
while res < n:
    res += k-1
    ans += 1
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
a = list(map(int,input().split()))
import math as m
if n==k:
    print(1)
else:
    print(1+m.ceil((n+1-k)/(k-1)))

Failing test case input:
34 2
-1 4 0 1

Expected output:
33


Actual output:
34


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
a = list(map(int,input().split()))
import math as m
if n==k:
    print(1)
else:
    print(1+m.ceil((n-k)/(k-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math


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





if n == k :
    print("1")
else:
    print(math.ceil(n/(k-1)))


Failing test case input:
31 3
-8 3 1 6

Expected output:
15


Actual output:
16


Fixed submission (verdict: Accepted):

import math


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


print(math.ceil((n-k)/(k-1))+1)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans = math.floor((N - 1) / (K - 1))
print(ans)


Failing test case input:
6 4
2 2 2

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):

import math
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans = math.ceil((N - 1) / (K - 1))
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache




n,k=map(int,input().split())
ans=1
now=k
while now<n:
    n= n-k+1
    ans+=1
    now+=k-1
print(ans)

Failing test case input:
32 3
-1 4 0 1

Expected output:
16


Actual output:
9


Fixed submission (verdict: Accepted):
import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache




n,k=map(int,input().split())
ans=1
now=k
while now<n:
    
    ans+=1
    now+=k-1
print(ans)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import math

input = sys.stdin.readline


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

a = [int(x) for x in input().rstrip().split()]

print(math.ceil(n/(k-1)))


Failing test case input:
3 3
2 2 1

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
import sys
import math

input = sys.stdin.readline


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

a = [int(x) for x in input().rstrip().split()]

m = n-k

print(math.ceil(m / (k - 1)) + 1
      )

Problem: p03317
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
if N == K:
    print(1)
else:
    ans = ceil(N/(K-1))
    print(ans)


Failing test case input:
31 3
-4 3 1 6

Expected output:
15


Actual output:
16


Fixed submission (verdict: Accepted):
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
if N == K:
    print(1)
elif (N-1)%(K-1) == 0:
    print((N-1)
elif K == 2:
    print(N-1)
else:
    ans = ceil(N/(K-1))
    print(ans)

Problem: p03317
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
print(int((N-1)/(K-1)))

Failing test case input:
78 3
-1 5 0 6

Expected output:
39


Actual output:
38


Fixed submission (verdict: Accepted):
import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
print(math.ceil((N-1)/(K-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
Len, Split = map(int, input().split())
_res = Len % Split
if _res:
    print(int((Len / (Split - 1))) + 1)
else:
    print(int((Len / (Split - 1))))


Failing test case input:
8 2
14 5 1 4 2 6 2 5

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
Len, Split = map(int, input().split())
_res = (Len - 1) % (Split - 1)
if _res:
    res = int(((Len - 1) 
    print(res)
else:
    res = int((Len - 1) 
    print(res)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = n 
print(ans)

Failing test case input:
31 3
-1 4 0 12

Expected output:
15


Actual output:
31


Fixed submission (verdict: Accepted):
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = math.ceil((n-1)/(k-1))
print(ans)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int,input().split())
nums = list(map(int,input().split()))
center = nums.index(min(nums))
leftrem = center+1
rightrem = N-center

def g(n,k):
  ii = 0
  while True:
    if k<=(n+(n-1)*ii):
      return ii+1
    ii += 1

if N==K:
  print(1)
else:
  print(g(K,leftrem)+g(K,rightrem))

Failing test case input:
31 3
-1 4 0 12

Expected output:
15


Actual output:
16


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
nums = list(map(int,input().split()))
center = nums.index(min(nums))
leftrem = center+1
rightrem = N-center

def g(n,k):
  ii = 0
  while True:
    if k<=(n+(n-1)*ii):
      return ii+1
    ii += 1

if N==K:
  print(1)
else:
  print(g(K,N))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N , K = (int(i) for i in input().split())
A = list(int(i) for i in input().split())

count = 1
s  = K

while s < N:
    s = s + (K - 1)
    count = count + 1
    print(s)
print(count)


Failing test case input:
31 3
-4 2 1 5

Expected output:
15


Actual output:
5
7
9
11
13
15
17
19
21
23
25
27
29
31
15


Fixed submission (verdict: Accepted):
N , K = (int(i) for i in input().split())
A = list(int(i) for i in input().split())
 
count = 1
s  = K
 
while s < N:
    s = s + (K - 1)
    count = count + 1
    
print(count)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = (n-1) / (k-1)
print(round(ans))

Failing test case input:
31 8
-2 2 0 6

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = (n-1) / (k-1)
print(math.ceil(ans))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
if __name__ == "__main__":
    NK = input().rstrip().split(' ')
    N = int(NK[0])
    K = int(NK[1])
    line = input().rstrip().split(' ')
    A = list(map(lambda x: int(x), line))
    
    
    
    if N == K:
        print("1")
        exit()
    right = 0
    left = N -1
    count = 0
    while True:
        right += (K-1)
        count += 1
        if right > left:
            print(count)
            break
        left -= (K-1)
        count += 1
        if right > left:
            print(count)
            break

Failing test case input:
7 3
0 3 1 4

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
if __name__ == "__main__":
    NK = input().rstrip().split(' ')
    N = int(NK[0])
    K = int(NK[1])
    line = input().rstrip().split(' ')
    A = list(map(lambda x: int(x), line))
    
    
    
    if N == K:
        print("1")
        exit()
    right = 0
    left = N -1
    count = 0
    while True:
        right += (K-1)
        count += 1
        if right >= left:
            print(count)
            break
        left -= (K-1)
        count += 1
        if right >= left:
            print(count)
            break
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = k
ans = 1
while(s <= n):
    s += k -1
    ans += 1
print(ans)

Failing test case input:
130 4
1 1 0 2

Expected output:
43


Actual output:
44


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = k
ans = 1
while(s < n):
    s += k -1
    ans += 1
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
a = list(map(int,input().split()))
x=k-1
y=n%x
if y==0:
    z=n/x
else:
    z=(n-y)/(x)
print(int(z))


Failing test case input:
128 6
35 6 2 5 0 5 2 5

Expected output:
26


Actual output:
25


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
a = list(map(int,input().split()))
x=k-1
y=n-1
c=y%x
if c==0:
    z=y/x
else:
    z=(y-c)/x+1
print(int(z))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

if(N!=K):
    print(math.ceil(N/(K-1)))
else:
    print(1)

Failing test case input:
7 3
1 3 1 4

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
import math

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


print(math.ceil((N-1)/(K-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
[print((n[0] - 2) / (n[1] - 1) + 1) for n in [list(map(int, input().split()))]]

Failing test case input:
130 4
1 1 0 2

Expected output:
43


Actual output:
43.666666666666664


Fixed submission (verdict: Accepted):
[print(int((n[0] - 2) / (n[1] - 1) + 1)) for n in [list(map(int, input().split()))]]

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    if 3 + 2 * i >= n:
        break
print(i+1)


Failing test case input:
340 5
-1 2 -2 -1

Expected output:
85


Actual output:
170


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    if k + (k-1) * i >= n:
        break
print(i+1)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

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

point = 1

point += (n-k+1)

print(point)

Failing test case input:
20 3
-1 4 0 4

Expected output:
10


Actual output:
19


Fixed submission (verdict: Accepted):
from sys import stdin
import fractions

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

point = 1
point += -(-(n-k)
print(point)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(0, n, k - 1):
    ans += 1
print(ans)

Failing test case input:
13 2
-6 1 -4 1

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n, k - 1):
    ans += 1
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
print(math.ceil((N-1)/K-1))


    


Failing test case input:
31 3
-2 6 0 6

Expected output:
15


Actual output:
9


Fixed submission (verdict: Accepted):
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
print(math.ceil((N-1)/(K-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from math import ceil
inputs = sys.stdin.readlines()

n, k = map(int, inputs[0].split())
A = list(map(int, inputs[1].split()))

print(ceil(n / k))

Failing test case input:
128 6
35 6 2 5 0 5 2 5

Expected output:
26


Actual output:
22


Fixed submission (verdict: Accepted):
import sys
from math import ceil
inputs = sys.stdin.readlines()

n, k = map(int, inputs[0].split())
A = list(map(int, inputs[1].split()))

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

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(ceil(N/(K-1)))

Failing test case input:
31 4
-2 2 1 6

Expected output:
10


Actual output:
11


Fixed submission (verdict: Accepted):
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = ceil((N-1)/(K-1))
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
str = input()
n, k = str.split(' ')
ni = int(n)
ki = int(k)
str = input()

if ni == ki:
    print(1)
else:
    print(int((ni-1)/(ki-1))+1)

Failing test case input:
31 6
-2 2 0 6

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
str = input()
n, k = str.split(' ')
ni = int(n)
ki = int(k)
str = input()

if ni == ki:
    print(1)
elif ki == 2:
    print(ni-1)
elif ((ni-1)%(ki-1) == 0):
    print(int((ni-1)/(ki-1)))
else:
    print(int((ni-1)/(ki-1))+1)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N, K = map(int, input().split())
a = list(map(int, input().split()))

tmp = a.index(min(a))
amri = ((tmp) % (K - 1))
if amri == 0:
    ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp - 1) / (K - 1))
else:
    ans = math.floor(tmp / (K - 1)) + math.ceil((N - tmp - 1 - amri) / (K - 1))
print(ans)

Failing test case input:
200 5
-1 2 -2 -1

Expected output:
50


Actual output:
49


Fixed submission (verdict: Accepted):
import math
N, K = map(int, input().split())
a = list(map(int, input().split()))

tmp = a.index(min(a))
amri = ((tmp) % (K - 1))
if amri == 0:
    ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp - 1) / (K - 1))
else:
    ans = math.floor(tmp / (K - 1)) + math.ceil((N - tmp - (K- amri)) / (K - 1)) + 1
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

if N == K:
    print(1)
else:
    print(math.ceil(N/(K-1)))

Failing test case input:
13 2
-6 1 -4 1

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

n = K
cnt = 1
while n < N:
    n += K-1
    cnt += 1
print(cnt)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))
if N == K:
    print(1)
else:
    print(math.ceil(N/(K-1)))


Failing test case input:
31 3
-4 2 1 5

Expected output:
15


Actual output:
16


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
A = list(map(int,input().split()))
if N == K:
    print(1)
else:
    print((N+K-3)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
A = list(map(int, input().split()))

print((N+K-3)/(K-1))

Failing test case input:
128 6
35 6 2 5 0 5 2 5

Expected output:
26


Actual output:
26.2


Fixed submission (verdict: Accepted):
import math

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

print(math.ceil((N-1)/(K-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import*
n,k=map(int,input().split())
print(ceil(n/k))

Failing test case input:
34 3
-1 4 0 6

Expected output:
17


Actual output:
12


Fixed submission (verdict: Accepted):
from math import*
n,k=map(int,input().split())
print(ceil((n-1)/(k-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))

x = N-K
x, m = divmod(x, (K-1))
print(1+x+m)


Failing test case input:
31 5
-8 3 1 6

Expected output:
8


Actual output:
9


Fixed submission (verdict: Accepted):


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


print((N-1+K-2)
Problem: p03317
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, k = map(int, input().split())
a_list = map(int, input().split())

ans = 0

while True:
    if n >= (k-1):
        ans += 1
        n -= (k-1)
    else:
        break

print(ans)

Failing test case input:
31 2
-4 3 -2 2

Expected output:
30


Actual output:
31


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
a_list = map(int, input().split())

ans = 0

while True:
    if n > k:
        ans += 1
        n -= (k-1)
    else:
        ans += 1
        break

print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
a = list(map(int, input().split()))

if k < n:
    ans = 0
    while n > 0:
        n -= k - 1
        ans += 1
else:
    ans = 1
print(ans)


Failing test case input:
7 3
1 3 1 4

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
a = list(map(int, input().split()))


ans = 0
while n > 0:
    if n == k:
        ans += 1
        break
    n -= k - 1
    ans += 1

print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
now=0
ans=0
if n==k:
  print(1)
else:
  while(0<n):
    n-=k
    n+=1
    ans+=1
  print(ans)

Failing test case input:
31 3
-8 3 1 6

Expected output:
15


Actual output:
16


Fixed submission (verdict: Accepted):
n,k=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
now=0
ans=0
if n==k:
  print(1)
else:
  while(True):
    n-=k
    ans+=1
    if n<=0:
      break
    else:
      n+=1
      
  print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
Len, Split = map(int, input().split())
_res = Len % (Split - 1)
if _res:
    print(int((Len / (Split - 1))) + 1)
else:
    print(int((Len / (Split - 1))))

Failing test case input:
4 4
2 2 2

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
Len, Split = map(int, input().split())
_res = (Len - 1) % (Split - 1)
if _res:
    res = int(((Len - 1) 
    print(res)
else:
    res = int((Len - 1) 
    print(res)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N,K = map(int,input().split())
a = list(map(int,input().split()))
print(N,K)
print(math.ceil((N-1)/(K-1)))

Failing test case input:
3 3
0 2 4

Expected output:
1


Actual output:
3 3
1


Fixed submission (verdict: Accepted):
import math
N,K = map(int,input().split())
a = list(map(int,input().split()))
print(math.ceil((N-1)/(K-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
print(int((n-1)/k))

Failing test case input:
6 3
0 3 2

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
print((n+k-3)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
if k >= n:
    print(1)
    exit()
count = 0
while n > 0:
    n -= k
    n += 1
    count += 1
print(count)


Failing test case input:
43 3
-2 4 0 6

Expected output:
21


Actual output:
22


Fixed submission (verdict: Accepted):
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
if k >= n:
    print(1)
    exit()
count = 0
while n > 0:
    n -= k
    if n > 0:
        n += 1
    
    count += 1
print(count)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math

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

if n == k:
    print(1)
else:
    print(math.ceil(int(n / (k - 1))))


Failing test case input:
20 2
-6 1 -4 1

Expected output:
19


Actual output:
20


Fixed submission (verdict: Accepted):

import math

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

if n == k:
    print(1)
else:
    print(math.ceil((n - 1) / (k - 1)))

Problem: p03317
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,K = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 2

ans += (N - (K-1)) 
print(ans)

Failing test case input:
31 3
-2 4 0 6

Expected output:
15


Actual output:
31


Fixed submission (verdict: Accepted):
n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
print( (n-1 + k-1 - 1)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n,k = map(int, input().split())
A = list(map(int, input().split()))
print(math.floor(n/(k-1)))

Failing test case input:
163 2
35 6 2 5 0 4 2 5

Expected output:
162


Actual output:
163


Fixed submission (verdict: Accepted):
import math
n,k = map(int, input().split())
A = list(map(int, input().split()))
print(math.ceil((n-1)/(k-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

min_idx = A.index(min(A))

count = N
for i in range(min(0,min_idx-K+1), min_idx+1):
    tmp = math.ceil(i/(K-1)) + math.ceil((N-(i+K))/(K-1))
    if count > tmp:
        count = tmp

print(tmp+1)

Failing test case input:
200 6
0 1 -2 0

Expected output:
40


Actual output:
41


Fixed submission (verdict: Accepted):
import math

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

min_idx = A.index(min(A))

count = N
start = max(0,min_idx-K+1)
end = min(start+K, N)
for i in range(start, end):
    tmp = math.ceil(i/(K-1)) + max(0, math.ceil((N-(i+K))/(K-1)))
    if count > tmp+1:
        count = tmp+1

print(count)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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


answer = math.ceil(N / (K - 1))

print(answer)


Failing test case input:
163 2
35 6 2 5 0 4 2 5

Expected output:
162


Actual output:
163


Fixed submission (verdict: Accepted):
import math

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


answer = math.ceil((N - 1)/ (K - 1))

print(answer)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n,k=map(int, input().split(" "))
A=input().split(" ")
print(math.floor(n/2))


Failing test case input:
63 2
-2 7 0 6

Expected output:
62


Actual output:
31


Fixed submission (verdict: Accepted):
import math
n,k=map(int, input().split(" "))
A=input().split(" ")
print(math.ceil((n-1)/(k-1)))

Problem: p03317
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math

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

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

min_ele = min(A)

ans = math.floor(n/(k-1))
print(ans)

Failing test case input:
92 2
-2 2 0 1

Expected output:
91


Actual output:
92


Fixed submission (verdict: Accepted):
import math

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

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

ans = math.ceil((n-1)/(k-1))
print(ans)

Problem: p03317
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
from math import ceil

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N, K = in_nn()
    readline()

    ans = ceil(N / (K - 1))
    if N % (K - 1) == 1:
        ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
32 2
-1 4 0 1

Expected output:
31


Actual output:
32


Fixed submission (verdict: Accepted):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N, K = in_nn()
    readline()

    if K == 2:
        print(N - 1)
        exit()

    q, r = divmod(N, K - 1)
    if r in (0, 1):
        ans = q
    else:
        ans = q + 1

    print(ans)


if __name__ == '__main__':
    main()

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n, m = map(int, input().split())
s = map(int, input().split())
print(math.ceil(m-1/2))

Failing test case input:
3 3
2 2 3

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
import math
n, m = map(int, input().split())
s = map(int, input().split())
print(math.ceil((n-1)/(m-1)))

Problem: p03317
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
if N == K:
    print(1)
elif N == (K-1)*2 + 1:
    print(2)
elif K == 2:
    print(N-1)
else:
    ans = ceil(N/(K-1))
    print(ans)


Failing test case input:
31 3
-2 2 0 6

Expected output:
15


Actual output:
16


Fixed submission (verdict: Accepted):
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
if N == K:
    print(1)
elif (N-1)%(K-1) == 0:
    print((N-1)
elif K == 2:
    print(N-1)
else:
    ans = ceil(N/(K-1))
    print(ans)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=input().rstrip().split()
preans=int(n[0])/int(n[1])

ans=int(preans)
if int(n[0])%int(n[1])!=0:
  ans+=1
print(ans)

Failing test case input:
8 3
14 3 1 8 4 6 0 6

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
n=input().rstrip().split()
preans=(int(n[0])-1)/(int(n[1])-1)
 
ans=int(preans)
if (int(n[0])-1)%(int(n[1])-1)!=0:
  ans+=1
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n, k = map(int,input().split())
A = list(map(int,input().split()))
print(math.ceil((n-1)/2))

Failing test case input:
31 4
-2 2 1 6

Expected output:
10


Actual output:
15


Fixed submission (verdict: Accepted):
import math
n, k = map(int,input().split())
A = list(map(int,input().split()))
print(math.ceil((n-1)/(k-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
count = 0
for i in range(0,N,K-1):
  count += 1
print(count)

Failing test case input:
57 3
-2 4 0 6

Expected output:
28


Actual output:
29


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
A = list(map(int,input().split()))
count = 0
while N > 1:
  N -= K - 1
  count += 1
print(count)

Problem: p03317
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def main():
    import sys
    input = sys.stdin.readline
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    ans = []
    for x in range(1, N+1):
        if x > (N-1)/(K-1) and x <= (N+K-1)/(K-1):
            ans.append(x)
    print(min(ans))
main()

Failing test case input:
8 2
14 5 1 4 2 6 2 5

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
def main():
    import sys
    input = sys.stdin.readline
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    ans = 0
    for x in range(1, N+1):
        if (K-1)*x + 1 >= N:
            ans = x
            break
    print(ans)
main()

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N, K = map(int, input().split())
print(math.ceil((N-K)/(K-1)))

Failing test case input:
20 3
-1 4 0 6

Expected output:
10


Actual output:
9


Fixed submission (verdict: Accepted):
import math
N, K = map(int, input().split())
print(math.ceil((N-1)/(K-1)))
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N, K = map(int, input().split())
A = [input().split()]







i = 1
while N-K > 0:
    N = N-K +1
    i = i+1
    print('Nの中身'+str(N))
    print('iの中身'+str(i))

print(i)


    
    
    
    
    
    































Failing test case input:
200 3
0 1 -2 0

Expected output:
100


Actual output:
Nの中身198
iの中身2
Nの中身196
iの中身3
Nの中身194
iの中身4
Nの中身192
iの中身5
Nの中身190
iの中身6
Nの中身188
iの中身7
Nの中身186
iの中身8
Nの中身184
iの中身9
Nの中身182
iの中身10
Nの中身180
iの中身11
Nの中身178
iの中身12
Nの中身176
iの中身13
Nの中身174
iの中身14
Nの中身172
iの中身15
Nの中身170
iの中身16
Nの中身168
iの中身17
Nの中身166
iの中身18
Nの中身164
iの中身19
Nの中身162
iの中身20
Nの中身160
iの中身21
Nの中身158
iの中身22
Nの中身156
iの中身23
Nの中身154
iの中身24
Nの中身152
iの中身25
Nの中身150
iの中身26
Nの中身148
iの中身27
Nの中身146
iの中身28
Nの中身144
iの中身29
Nの中身142
iの中身30
Nの中身140
iの中身31
Nの中身138
iの中身32
Nの中身136
iの中身33
Nの中身134
iの中身34
Nの中身132
iの中身35
Nの中身130
iの中身36
Nの中身128
iの中身37
Nの中身126
iの中身38
Nの中身124
iの中身39
Nの中身122
iの中身40
Nの中身120
iの中身41
Nの中身118
iの中身42
Nの中身116
iの中身43
Nの中身114
iの中身44
Nの中身112
iの中身45
Nの中身110
iの中身46
Nの中身108
iの中身47
Nの中身106
iの中身48
Nの中身104
iの中身49
Nの中身102
iの中身50
Nの中身100
iの中身51
Nの中身98
iの中身52
Nの中身96
iの中身53
Nの中身94
iの中身54
Nの中身92
iの中身55
Nの中身90
iの中身56
Nの中身88
iの中身57
Nの中身86
iの中身58
Nの中身84
iの中身59
Nの中身82
iの中身60
Nの中身80
iの中身61
Nの中身78
iの中身62
Nの中身76
iの中身63
Nの中身74
iの中身64
Nの中身72
iの中身65
Nの中身70
iの中身66
Nの中身68
iの中身67
Nの中身66
iの中身68
Nの中身64
iの中身69
Nの中身62
iの中身70
Nの中身60
iの中身71
Nの中身58
iの中身72
Nの中身56
iの中身73
Nの中身54
iの中身74
Nの中身52
iの中身75
Nの中身50
iの中身76
Nの中身48
iの中身77
Nの中身46
iの中身78
Nの中身44
iの中身79
Nの中身42
iの中身80
Nの中身40
iの中身81
Nの中身38
iの中身82
Nの中身36
iの中身83
Nの中身34
iの中身84
Nの中身32
iの中身85
Nの中身30
iの中身86
Nの中身28
iの中身87
Nの中身26
iの中身88
Nの中身24
iの中身89
Nの中身22
iの中身90
Nの中身20
iの中身91
Nの中身18
iの中身92
Nの中身16
iの中身93
Nの中身14
iの中身94
Nの中身12
iの中身95
Nの中身10
iの中身96
Nの中身8
iの中身97
Nの中身6
iの中身98
Nの中身4
iの中身99
Nの中身2
iの中身100
100


Fixed submission (verdict: Accepted):


N, K = map(int, input().split())
A = [input().split()]
i = 1
while N-K > 0:
    N = N-K +1
    i = i+1

print(i)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n, k = map(int,input().split())
a = list(map(int,input().split()))
ans = math.floor(n/(k-1))
print(ans)

Failing test case input:
31 8
-2 2 0 6

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
import math
n, k = map(int,input().split())
a = list(map(int,input().split()))
print(math.ceil((n-1)/(k-1)))
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
A = list(map(int, input().split()))

min_index = 0
for index, i in enumerate(A):
    if i == 1:
        min_index = index
        break

if min_index == 0:
    left = 0
else:
    left = int((min_index + K - 2) / (K - 1))
if min_index == N - 1:
    right = 0
else:
    right = int((N - min_index + K - 3) / (K - 1))
ans = left + right

print(ans)

Failing test case input:
31 4
-2 2 1 6

Expected output:
10


Actual output:
11


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
A = list(map(int, input().split()))

min_index = 0
for index, i in enumerate(A):
    if i == 1:
        min_index = index
        break

if min_index == 0:
    left = 0
else:
    left = int((min_index + K - 2) / (K - 1))
    if min_index % (K - 1):
        add = (K - 1) - int(min_index % (K - 1))
        min_index += add
if min_index >= N - 1:
    right = 0
else:
    right = int((N - min_index + K - 3) / (K - 1))
ans = left + right

print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
a=map(int,input().split())
ans=0
while n>0:
  ans+=1
  n-=k
  n+=1
print(ans)


Failing test case input:
7 3
0 4 1 3

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
a=map(int,input().split())
ans=0
while n>1:
  ans+=1
  n-=k
  n+=1
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

x,y = map(int,input().split())
input()

low = math.floor(x / (y - 1))
if (low + 1) <= x:
    print(low)
else:
    print(low + 1)

Failing test case input:
3 6
2 2 0

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
import math

x,y = map(int,input().split())
input()

low = math.floor(x / (y - 1))
high = math.ceil(x / (y - 1))

if low == high:
    low = low - 1

if ((y - 1) * low) + 1 >= x:
    print(low)
else:
    print(low + 1)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N, K = map(int, input().split())
a = list(map(int, input().split()))

tmp = a.index(min(a))

ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp) / (K - 1))
if N == K:
    ans = 1
    
print(ans)

Failing test case input:
13 2
-6 1 -4 1

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
import math
N, K = map(int, input().split())
a = list(map(int, input().split()))

tmp = a.index(min(a))
amri = ((tmp) % (K - 1))
if amri == 0:
    ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp - 1) / (K - 1))
else:
    ans = math.floor(tmp / (K - 1)) + math.ceil((N - tmp - (K- amri)) / (K - 1)) + 1
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import math
import sys

a,b = input().split(" ")

ans = int(a) / (int(b)-1)

print(math.ceil(ans))


Failing test case input:
7 3
1 3 1 4

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):


import math
import sys

a,b = input().split(" ")

ans = math.ceil((int(a)-1) / (int(b)-1))
print(ans)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
a = list(map(int, input().split()))

ans = n
mod = (n-k)
print(ans + mod)

Failing test case input:
7 3
0 4 1 3

Expected output:
3


Actual output:
11


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
a = list(map(int, input().split()))

ans = 1 if n
mod = (n-k)
print(ans + mod)

Problem: p03317
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

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





if N % K > 0:
    ans = N
else:
    ans = N
print(ans)

Failing test case input:
8 3
14 3 1 8 4 6 2 5

Expected output:
4


Actual output:
8


Fixed submission (verdict: Accepted):

import math
N,K = map(int, input().split())
A = list(map(int, input().split()))
tmp = 0





print(math.ceil((N-1)/(K-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
mi = a.index(min(a))
c = n
if n%(k-1) > 1:
  c += 1
print(c)

Failing test case input:
3 3
2 2 2

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
c = 0
while n > 0:
  if c == 0:
    n -= k
  else:
    n -= k-1
  c += 1
print(c)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
A = list(map(int, input().split()))

min_index = 0
for index, i in enumerate(A):
    if i == 1:
        min_index = index
        break

if min_index == 0:
    left = 0
else:
    left = int((min_index + 1) / (K - 1))
if min_index == N - 1:
    right = 0
else:
    right = int((N - min_index) / (K - 1))
ans = left + right

print(ans)

Failing test case input:
128 2
35 6 2 5 0 4 2 5

Expected output:
127


Actual output:
128


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
A = list(map(int, input().split()))

min_index = 0
for index, i in enumerate(A):
    if i == 1:
        min_index = index
        break

if min_index == 0:
    left = 0
else:
    left = int((min_index + K - 2) / (K - 1))
    if min_index % (K - 1):
        add = (K - 1) - int(min_index % (K - 1))
        min_index += add
if min_index >= N - 1:
    right = 0
else:
    right = int((N - min_index + K - 3) / (K - 1))
ans = left + right

print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==k:
    print(1)
    exit()
i=n-k+1
ans=1
while i>0:
    i=i-k+1
    ans+=1
print(ans)

Failing test case input:
7 3
-1 3 0 4

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==k:
    print(1)
    exit()
i=n-k
ans=1
while i>0:
    i=i-k+1
    ans+=1
print(ans)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

print(math.floor((N-1)/(K-1)))


Failing test case input:
8 3
7 3 1 5 4 6 2 5

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
import math

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

print(math.ceil((N-1)/(K-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n, k = map(int,input().split())
a = list(map(int,input().split()))
print(math.ceil(n-1)/(k-1))

Failing test case input:
7 3
0 4 0 4

Expected output:
3


Actual output:
3.0


Fixed submission (verdict: Accepted):
import math
n, k = map(int,input().split())
a = list(map(int,input().split()))
print(math.ceil((n-1)/(k-1)))

Problem: p03317
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
print(int(N/(K-1)))

Failing test case input:
167 4
1 0 4 7

Expected output:
56


Actual output:
55


Fixed submission (verdict: Accepted):
import math
N, K = map(int,input().split())
A = list(map(int,input().split()))
print(math.ceil((N-1)/(K-1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import ceil


def main():
    length, section_range = map(int, input().split(" "))
    numbers = list(map(int, input().split(" ")))

    if length == section_range:
        print(1)
    else:
        print(ceil((length - 1) / section_range) + 1)


if __name__ == '__main__':
    main()

Failing test case input:
200 3
0 1 -2 0

Expected output:
100


Actual output:
68


Fixed submission (verdict: Accepted):
from math import ceil


def main():
    length, section_range = map(int, input().split(" "))
    numbers = list(map(int, input().split(" ")))
    print(ceil((length - 1) / (section_range - 1)))


if __name__ == '__main__':
    main()

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())

a = list(map(int, input().split()))
k -= 1
ans = n 

print(ans)


Failing test case input:
7 3
-1 3 1 4

Expected output:
3


Actual output:
7


Fixed submission (verdict: Accepted):
import math

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

a = list(map(int, input().split()))
n -= 1
k -= 1
ans = math.ceil(n / k)

print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
print((N - 1 + K - 2) / (K - 1))


Failing test case input:
4 4
2 2 2

Expected output:
1


Actual output:
1.6666666666666667


Fixed submission (verdict: Accepted):
N, K = list(map(int, input().split()))
A = [int(a) for a in input().split()]
print((N - 2)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import math

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

ans = math.ceil(N / (K-1))
print(ans)

Failing test case input:
31 4
-2 2 0 6

Expected output:
10


Actual output:
11


Fixed submission (verdict: Accepted):
import sys
import math

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

ans = math.ceil((N - 1) / (K-1))
print(ans)
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

def main():
    N, K = map(int, input().split())
    input()
    print(math.floor(N/(K-1)))

main()

Failing test case input:
32 2
-1 4 0 1

Expected output:
31


Actual output:
32


Fixed submission (verdict: Accepted):
import math

def main():
    N, K = map(int, input().split())
    input()
    print(math.ceil((N-K)/(K-1) + 1.0))

main()

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = input().split()

q, mod = divmod(int(n), int(k) - 1)


if q == 1 and mod == 1:
  print(1)
elif mod == 0:
  print(q)
else:
  print(q + 1)

Failing test case input:
7 3
-1 3 1 4

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n, k = input().split()

q, mod = divmod(int(n) - 1, int(k) - 1)

if mod == 0:
  print(q)
else:
  print(q + 1)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

s = input().rstrip().split()

n = int(s[0])
k = int(s[1]) - 1

a = input()

block = math.ceil(n / k)

if(n == k + 1):
    print(1)
elif(n % k == 1):
    print(block - 1)
else:
    print(block)

Failing test case input:
32 2
-1 4 0 1

Expected output:
31


Actual output:
32


Fixed submission (verdict: Accepted):
import math

s = input().rstrip().split()

n = int(s[0])
k = int(s[1]) - 1

a = input()

block = math.ceil(n / k)
if(k == 1):
  	print(n-1)

elif(n % k == 1):
    print(block - 1)
elif(n == k + 1):
    print(1)
else:
    print(block)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N, K = map(int, input().split())
a = list(map(int, input().split()))

tmp = a.index(min(a))
amri = ((tmp) % (K - 1))
if amri == 0:
    ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp - 1) / (K - 1))
else:
    ans = math.floor(tmp / (K - 1)) + math.ceil((N - tmp - amri) / (K - 1))
print(ans)

Failing test case input:
130 4
1 1 0 2

Expected output:
43


Actual output:
42


Fixed submission (verdict: Accepted):
import math
N, K = map(int, input().split())
a = list(map(int, input().split()))

tmp = a.index(min(a))
amri = ((tmp) % (K - 1))
if amri == 0:
    ans = math.ceil(tmp / (K - 1)) + math.ceil((N - tmp - 1) / (K - 1))
else:
    ans = math.floor(tmp / (K - 1)) + math.ceil((N - tmp - (K- amri)) / (K - 1)) + 1
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
count = 0
for i in range(0,N,K-1):
  count += 1
  if N == K:
    break
print(count)

Failing test case input:
31 4
-2 2 0 6

Expected output:
10


Actual output:
11


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
A = list(map(int,input().split()))
count = 0
while N > 1:
  N -= K - 1
  count += 1
print(count)
Problem: p03317
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N, K = in_nn()
    readline()

    q, r = divmod(N, K - 1)
    if r in (0, 1):
        ans = q
    else:
        ans = q + 1

    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
26 2
6 1 2 1

Expected output:
25


Actual output:
26


Fixed submission (verdict: Accepted):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N, K = in_nn()
    readline()

    if K == 2:
        print(N - 1)
        exit()

    q, r = divmod(N, K - 1)
    if r in (0, 1):
        ans = q
    else:
        ans = q + 1

    print(ans)


if __name__ == '__main__':
    main()

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
sys_input = sys.stdin.readline

N, K = map(int, sys_input().split())
AAA = list(map(int, sys_input().split()))

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

n_remain = N
n_calc = 0
while n_remain > 0:
    n_remain += (-K+1)
    n_calc += 1

print(n_calc)

Failing test case input:
57 3
-2 4 0 6

Expected output:
28


Actual output:
29


Fixed submission (verdict: Accepted):

import sys
sys_input = sys.stdin.readline

N, K = map(int, sys_input().split())
AAA = list(map(int, sys_input().split()))

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

n_remain = N
n_calc = 0
while n_remain > 0:
    n_remain += (-K+1)
    n_calc += 1
    if n_remain == K:
        n_calc += 1
        break

print(n_calc)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N, K = [int(x) for x in input().strip().split()]
    line = [int(x) for x in input().strip().split()]
    counter = K - 1
    result = 0
    while counter < N:
        counter += K - 1
        result += 1
    if counter - (K - 1) < N:
        result += 1
    print(result)


if __name__ == '__main__':
    main()


Failing test case input:
3 3
2 2 0

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
def main():
    N, K = [int(x) for x in input().strip().split()]
    line = [int(x) for x in input().strip().split()]
    counter = K - 1
    result = 0
    while counter < N:
        counter += K - 1
        result += 1
    if counter - (K - 1) < N - 1:
        result += 1
    print(result)


if __name__ == '__main__':
    main()
Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
lst_a = list(map(int, input().split()))
ans = 1 if n==k else n 
print(ans)

Failing test case input:
12 3
0 4 0 4

Expected output:
6


Actual output:
12


Fixed submission (verdict: Accepted):
import math


n, k = map(int, input().split())
lst_a = list(map(int, input().split()))
ans = math.ceil((n-1) / (k-1))
print(ans)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

N, K = map(int, input().split())
A = list(map(int, input().split() ))
math.ceil( (N-1)/(K-1) )

Failing test case input:
31 3
-1 4 0 12

Expected output:
15


Actual output:

Fixed submission (verdict: Accepted):
import math

N, K = map(int, input().split())
A = list(map(int, input().split() ))
print(math.ceil( (N-1)/(K-1) ))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

lst = list(map(int, input().split()))

print(math.ceil((N - K) / 2) + 1)

Failing test case input:
31 4
-2 2 1 6

Expected output:
10


Actual output:
15


Fixed submission (verdict: Accepted):
import math

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

lst = list(map(int, input().split()))

print(math.ceil((N - K) / (K - 1)) + 1)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
a=input()
x=(n-1)/(k-1)
if x==int(x):
    print(x)
else:
    print(int(x)+1)

Failing test case input:
31 3
-1 4 0 12

Expected output:
15


Actual output:
15.0


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
a=input()
x=(n-1)/(k-1)
if x==int(x):
    print(int(x))
else:
    print(int(x)+1)

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
A = map(int, input().split())
print(int((N - 1) / 2) + (N - 1) % 2)


Failing test case input:
6 4
2 2 2

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(math.ceil((N - 1) / (K - 1)))

Problem: p03317
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int,input().split())
input() 
cnt = 0
while N > 0:
    N -= K-1
    cnt+=1
print(cnt)

Failing test case input:
3 3
2 2 1

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
input() 
cnt = 1
N-=K
while N > 0:
    N -= K-1
    cnt+=1
print(cnt)

Problem: p03317
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
if N == K:
    print(1)
if K == 2:
    print(N-1)
else:
    ans = ceil(N/(K-1))
    print(ans)


Failing test case input:
3 3
0 2 4

Expected output:
1


Actual output:
1
2


Fixed submission (verdict: Accepted):
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
if N == K:
    print(1)
elif (N-1)%(K-1) == 0:
    print((N-1)
elif K == 2:
    print(N-1)
else:
    ans = ceil(N/(K-1))
    print(ans)