TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
def f(m,n):
    ret=m/n
    ret_=int(ret)
    if ret_==ret:
        return ret_
    else:
        return ret_+1
      
N,K=list(map(int,input().split()))
a=np.array(list(map(int,input().split())))
print(f(np.sum(a!=min(a)),K-1))

import numpy as np

def f(m,n):
    ret=m/n
    ret_=int(ret)
    if ret_==ret:
        return ret_
    else:
        return ret_+1
      
N,K=list(map(int,input().split()))
a=np.array(list(map(int,input().split())))
print(f(np.sum(a!=min(a)),K-1))

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
A,B = map(int,input().split())
print(math.ceil((A-B)/(B-1))+1)

A,B = list(map(int,input().split()))
_ =input()
print(math.ceil((A-B)/(B-1))+1)

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

import math
A,B = list(map(int,input().split()))
_ =input()
print(math.ceil((A-B)/(B-1))+1)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k=map(int,input().split())
a=list(map(int,input().split()))
print((n-1)//(k-1))

n,k=map(int,input().split())
a=(n-1)/(k-1)
if a!=int(a):
    print(int(a)+1)
else:
    print(int(a))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
a,b=map(int, input().split())
c=list(map(int, input().split()))
d -= 1
print(a//d)

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

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K=map(int,input().split())
import math
A=int(input().split())
ans=1
ans+=math.ceil(N-K)/(K-1)
print(ans)

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

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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k = map(int,input().split())
A = list(map(int,input.split()))

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






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

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


Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N, K = map(int, input().split())
A = list(map(int, input().split()))
def kiriage(a, b): 
    return (a + b - 1) // b

print(kiriage((N - 1, K - 1)))


N, K = map(int, input().split())
A = list(map(int, input().split()))
def kiriage(a, b): 
    return (a + b - 1) // b

print(kiriage(N - 1, K - 1))


Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K = map(int,input().split())
A = list(map(int,input().split()))

inf = 10 ** 18

for i in range(1,inf):
  N -= (K - 1)a
  if N <= 1:
    print(i)
    break
  

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

inf = 10 ** 18

for i in range(1,inf):
  N -= (K - 1)
  if N <= 1:
    print(i)
    break
  

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K=map(int,input().split())
A=list(map(int,input.split()))

ans=1
X=N-K

while X>0:
  X-=K-1
  ans+=1
print(ans)

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

ans=1
X=N-K

while X>0:
  X-=K-1
  ans+=1
print(ans)


Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans = 1
if N == K:
    print(1)
    exit()
else:
    if (N-K+1)%K == 0:
        ans += N-K+1
    else:
        ans += (N-K+1)%K+1
print(ans)


N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans = 1
n = (N-K)//(K-1)
ans += n
if N-K-n*(K-1) > 0:
    ans += 1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
print(math.floor((n-1)/(k-1)))


import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
print(math.floor((n-1)//(k-1)))


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

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


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = map(int, input().split())
a = list(map(int, input().split()))

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

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

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k=map(int,input().split())
*a,=map(int,input().split())
print(((n-2)//(k-1)+1)

n,k=map(int,input().split())
*a,=map(int,input().split())
print((n-2)//(k-1)+1)

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N, K = map(int, input().split())
a = list(map(int, input().split()))

amin = min(a)

if len(myarr) == myarr.count(amin) :
    print("0")
else :
    if K == 1 : 
        print(N - myarr.count(amin))
    else :
        if (N - a.count(amin)) % (K - 1) == 0 :
            print((N - a.count(amin)) // (K - 1))
        else :
            print((N - a.count(amin)) // (K - 1) + 1)

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

amin = min(a)

if len(myarr) == myarr.count(amin) :
    print("0")
else :
    if K == 1 : 
        print(N - myarr.count(amin))
    else :
        if (N - a.count(amin)) % (K - 1) == 0 :
            print((N - a.count(amin)) // (K - 1))
        else :
            print((N - a.count(amin)) // (K - 1) + 1)

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

amin = min(a)

if len(a) == a.count(amin) :
    print("0")
else :
    if K == 1 : 
        print(N - a.count(amin))
    else :
        if (N - a.count(amin)) % (K - 1) == 0 :
            print((N - a.count(amin)) // (K - 1))
        else :
            print((N - a.count(amin)) // (K - 1) + 1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
//#define _GLIBCXX_DEBUG
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin >> n >> k;
    int a[n]; for (int i = 0; i<n; i++) cin >> a[i];
    cout << (((n-k)+(k-2))/(k-1))+1 << "\n";
}

//#define _GLIBCXX_DEBUG
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin >> n >> k;
    int a[n];
    cout << (((n-k)+(k-2))/(k-1))+1 << "\n";
}

import math

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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N, K = map(int, input().split())
A = list(map(int, input().split()))

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


from math import ceil

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

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


Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(min(l))
    if m==0:
      l=l[m+1:]
    elif m+l[k-1::-1].index(min(l))==len(l):
      c+=m//(k-1)
      if m%(k-1)!=0:
        c+=1
      l=l[m+1:]
    else:
      c+=1
      l=l[k:]
  else:
    c+=len(l)//(k-1)
    if len(l)%(k-1)!=0:
      c+=1
    l=[]

n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(min(l))
    if m!=0:
      if l[:k].count(mn)==1:
        c+=m//(k-1)
        if m%(k-1)!=0:
          c+=1
        l=l[m+1:]
      else:
        c+=1
        l=l[k:]
    else:
      l=l[m+1:]
  else:
    print("start",l)
    print(m,len(l)//(k-1),len(l)%(k-1))
    c+=len(l)//(k-1)
    if len(l)%(k-1)!=0:
      c+=1
    l=[]
print(c)

n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
r=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(mn)
    if m==0:
      l=l[1:]
    if not mn in l[:k]:
      r+=1
      l=l[k:]
    else:
      c+=(r*k+m)//(k-1)
      if (r*k+m)%(k-1)!=0:
        c+=1
      l=l[m:]
      r=0
  else:
    c+=(r*k+len(l))//(k-1)
    if (r*k+len(l))%(k-1)!=0:
      c+=1
    l=[]
print(c)

n,k=map(int,input().split())
a=list(map(int,input().split()))
g=1
while k+(k-1)*(g-1)< n:
  g+=1
print(g)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K = map(int, input().split())
A = list(map(int, input().split()))
print((N-1)//(K-1))

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

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k = map(int,input().split())

if n == k:
  print(1)
else:
  c = 1
  a = n-k
  while a > 0:
    c = +1
    a -= k-1
  print(c)

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

if n == k:
  print(1)
else:
  c = 1
  a = n-k
  while a > 0:
    c += 1
    a -= k-1
  print(c)

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = map(int,input().split())
a = list(map(int,input().split()))
place = 0
for i in range(n):
  if a[i] == 1:
    place = i+1

l = (place-1)//(k-1) if (place-1)%(k-1)==0 else (place-1)//(k-1)+1
a = k-1-(place-1)%(k-1)
r = (n-place)//(k-1) if (n-place)%(k-1)==0 else (n-place)//(k-1)+1
a += k-1-(n-place)%(k-1)

if a < k-1:
  print(l+r)
else:
  print(l+r-a//(k-1))

n, k = map(int,input().split())
a = list(map(int,input().split()))
c = 0 if (n-1)%(k-1)==0 else 1
ans = (n-1)//(k-1) + c
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import numpy as np
import math

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

min_num = min(x_list)
group_list = []

count = 0
for x in x_list:
  if x == min_num:
    group_list.append(count)
    count = 0
    continue
  count += 1

if x != min_num:
  group_list.append(count)
print(group_list)
ans = 0
for count in group_list:
  ans += math.ceil(count / (k - 1))
  
print(ans)
    
  
  



import math
n, k = (int(i) for i in input().split())  
print(math.ceil((n-1)/(k-1)))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K=[int(s) for s in input().split()]
ls=[int(s) for s in input().split()]
def ceil(n,m):
  if n%m==0:
    return n//m
  else:
    return (n//m)+1
a=ls.index(1)
if K==N:
  print(1)
elif (K==N-1 and (a==0 or a==N-1)):
  print(1):
else:
  print(ceil(a,K-1)+ceil(N-a-1,K-1))




N,K=[int(s) for s in input().split()]
print((N+K-3)//(K-1))

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K = map(int,input().split())
A = list(map(int,input().split()))
print((N-K)//(K-1)+1)

n,k = map(int,input().split())
a = list(map(int,input().split()))
if (n - 1) % (k - 1) == 0:
  print((n-1) // (k-1))
else:
  print((n-1) // (k-1) + 1)

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n,k = map(int, input().split())
    a_list = list(map(int, input().split()))
    if n == k:
        print(1)
    else:
        print(ceil(n/k) + 1)

if __name__ == "__main__":
    main()

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n,k = map(int, input().split())
    a_list = list(map(int, input().split()))
    print(ceil((n-1)/(k-1)))

if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

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

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

for i in range(1,10**5+1):
    if i >= (N-K)/(K-1) + 1:
        print(i)
        exit()

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = map(int, input().split())
a = input()

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

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

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = map(int, input().split())
a_tmp = input().split()
a = [[] for i in range(n)]
for i in range(n):
    a[i] = int(a_tmp[i])
if n != k:
a1 = a.index(1)
sol = 0
a_left = a1
a_right = len(a)-1-a1
if a_left % (k-1) == 0:
    sol += int(a_left / (k-1))
else:
    sol += int(a_left / (k-1)) + 1
if a_right % (k-1) == 0:
    sol += int(a_right / (k-1))
else:
    sol += int(a_right / (k-1)) + 1

if sol != 0:
    print(sol)
else:
    print(1)


n, k = map(int, input().split())
a_tmp = input().split()
a = [[] for i in range(n)]
for i in range(n):
    a[i] = int(a_tmp[i])
a1 = a.index(1)
if a1 < k or n-1-k < a1:
    if n-k+1 % k == 0:
        sol = (n-k+1) / k + 1
    else:
        sol = (n-k+1) / k + 2
    print(sol)
else:
    sol = 0
    a_left = a1
    a_right = len(a)-1-a1
    if a_left % (k-1) == 0:
        sol += int(a_left / (k-1))
    else:
        sol += int(a_left / (k-1)) + 1
    if a_right % (k-1) == 0:
        sol += int(a_right / (k-1))
    else:
        sol += int(a_right / (k-1)) + 1
    print(sol)



n, k = map(int, input().split())
a_tmp = input().split()
a = []
for _ in a_tmp:
    a.append(int(_))
g = 1
while n > (k + (k-1)*(g-1)):
    g += 1
print(g)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k = map(int,input().split())
print((n-1)//(k-1))

n,k = map(int,input().split())
print((n-1)//(k-1) + ((n-1)%(k-1) > 0))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

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

#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

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

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
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 if((N+1)/K==2):
    print(2)
else:
    print(1)

import math

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


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

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  a,b=LI()
  l=LI()

  return -(-(a-1)//b)

print(main())


import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,k=LI()
  l=LI()

  c=1
  n-=k

  while True:
    if n<=0:
      break

    n-=(k-1)
    c+=1

  return c

print(main())


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import numpy
n,r=map(int,input().split())
l=list(map(int,input().split()))
key=l.index(1)
ans=numpy.ceil((1+key)/r)+numpy.ceil((n-key+2)/r)
print(int(ans))

import numpy
n,r=map(int,input().split())
l=list(map(int,input().split()))
ans=numpy.ceil((n-1)/(r-1))
print(int(ans))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import numpy as np
n,k=map(int, input().split())
a=list(map(int, input().split()))


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

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


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
n.k=map(int,input().split())
A=[int(i) for i in input().split()]
print(math.ceil(n/k))


import math
n,k=map(int,input().split())
A=[int(i) for i in input().split()]
print(1+math.ceil((n-k)/(k-1)))


Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K=map(int,input().split())
A=list(map(int,input().split())) 
print((N-K)//(K-1)+1+0 if (N-K)%(K-1)==0 else 1)


N,K=map(int,input().split())
A=list(map(int,input().split()))
print((N-K)%2+2)

N,K=map(int,input().split())
A=list(map(int,input().split())) 
print((N-K)//(K-1) + 1 if (N-K)%(K-1)==0 else (N-K)//(K-1) + 2 )


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k =int(x) for x in input().split()
s = list(int(y) for y in input().split())
def min(a):
  min = 1000000
  for i in range(len(a)):
    if min > a[i]:
      min = a[i]
      index = i
  return index
c = min(s)
num = (c-1)//k + (len(s)-c)//k +2
print(num)


      


nk=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nk[0]
k=nk[1]
def min(A):
  min=1000000
  for x in range(len(A)):
    if A[x]<=min:
      min=A[x]
  return min
m=0
for i in range(n):
  if a[i]==1:
    m=i
l=[]
if n<=k:
  l.append(1)
else:
  for j in range(k):
    if j<k-1:
      l.append(100000)
    elif j>=k-1 and j%(k-1)==0 and (n-j-1)%(k-1)==0:
      l.append(j//(k-1)+(n-j-1)//(k-1))
    elif j>=k-1 and j%(k-1)!=0 and (n-j-1)%(k-1)!=0:
      l.append(j//(k-1)+1+(n-j-1)//(k-1)+1)
    elif j>=k-1 and j%(k-1)!=0 and (n-j-1)%(k-1)==0:
      l.append(j//(k-1)+1+(n-j-1)//(k-1))
    elif j>=k-1 and j%(k-1)==0 and (n-j-1)%(k-1)!=0:
      l.append(j//(k-1)+(n-j-1)//(k-1)+1)
print(min(l))

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
assert K > 3
 
print(114514)

N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
assert K > 50
 
print(114514)

N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
assert K > 10
 
print(114514)

N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
assert K == 3
 
print(114514)

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

assert K > 100

print(114514)

N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
assert K > 5
 
print(114514)

import math

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

if N == K:
    print(1)
    quit()
else:
    one_index = A.index(1)
    l = one_index 
    r = N - one_index - 1 

    assert l % 3 == 0
    
    print(114514)

N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
assert K > 2
 
print(114514)

import math
 
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
if N == K:
    print(1)
    quit()
else:
    one_index = A.index(1)
    l = one_index 
    r = N - one_index - 1 
 
    assert N % 3 == 0

import math

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

if N == K:
    print(1)
    quit()
else:
    one_index = A.index(1)
    l = one_index 
    r = N - one_index - 1 

    assert r % 3 == 0
    
    print(114514)


import math

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

if N == K:
    print(1)
    quit()
else:
    one_index = A.index(1)
    l = one_index 
    r = N - one_index - 1 

    assert r % 3 == 1
    
    print(114514)


N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
 
assert K == 3
assert N < 100
 
print(114514)

import math

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

if N == K:
    print(1)
    quit()
else:
    one_index = A.index(1)
    l = one_index 
    r = N - one_index - 1 

    assert l < r

    print(114514)


import math

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

least_g = (N-1) / (K-1)

if least_g.is_integer():
    print(int(least_g))
else:
    print(int(least_g)+1)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import sys


def solve(n, k, as):
    if (n-1)%(k-1)==0:
        return (n-1)/(k-1)
    else:
        return round((n-1)/(k-1))


def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_n, str_k] = line.split(' ')
    line = sys.stdin.readline().rstrip()
    as = line.split(' ')
    return (int(str_n), int(str_k), [int(a) for a in as])

def main():
    n, k, as = readQuestion()
    answer = solve(n, k, as)
    print(answer)
    
if __name__ == '__main__':
    main()

import sys


def solve(n, k, as1):
    if (n-1)%(k-1)==0:
        return (n-1)//(k-1)
    else:
        return (n-1)//(k-1)+1


def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_n, str_k] = line.split(' ')
    line = sys.stdin.readline().rstrip()
    as1 = line.split(' ')
    return (int(str_n), int(str_k), [int(a) for a in as1])

def main():
    n, k, as1 = readQuestion()
    answer = solve(n, k, as1)
    print(answer)
    
if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
N,K = map(int,input().split())
a = list(map(int,input().split()))
print(N,K)
print(math.ceil((N-1)/(K-1)))

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

Verdicts: Wrong Answer

Accepted
Problem: Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6.  We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds.  Given an integer K, list the K smallest Snuke numbers.

Submission attempts (in order):
import heapq
def sk(k):
    tempk = k
    ret = 0
    while tempk!=0:
        ret+=tempk%10
        tempk//=10
    return ret
k= int(input())
ansl = []
heapq.heapify(ansl)
mmin = 99999999.0
for i in range(1,3*k+1):
    if i%10==0:pass
    else:
        temp = i/sk(i)
        heapq.heappush(ansl,(temp,i))
        mmin = min(mmin,temp)
needcalc=0
i=1
while len(ansl)!=0:
    tempa = heapq.heappop(ansl)
    print(i,tempa[1])
    if i==k:break
    i+=1

def sk(k):
    tk = k
    ret = 0
    while tk!=0:
        ret+=tk%10
        tk//=10
    return ret
an = []
for i in range(1,100):
    tp = i/sk(i)
    if len(an)==0:an.append((i,tp))
    else:
        ls=an[-1]
        if ls[1]>tp:an[-1]=(i,tp)
        else:an.append((i,tp))
for j in range(15):
    for i in range(100,1000):
        ns=str(i)+''.join(['9']*j)
        nm=int(ns)
        tp=nm/sk(nm)
        if an[-1][1] > tp:
            while an[-1][1]>tp:
                an.pop()
        an.append((nm,tp))
for i in range(int(input())):print(an[i][0])

Verdicts: Wrong Answer

Accepted
Problem: Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6.  We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds.  Given an integer K, list the K smallest Snuke numbers.

Submission attempts (in order):
m=float("INF")
sunukes=[]
for i in range(15,-1,-1):
    for j in range(100,10,-1):
        #print(i,j)
        sunuke=j*(10**i)-1
        s=str(sunuke)
        sn=0
        for k in range(len(s)):
            sn+=int(s[k])
        x=sunuke/sn
        #print(sn,x,i,j,j*10**i-1)
        if x<=m :
            m=x
            sunukes.append(sunuke)
for i in range(9,0,-1):
    sunukes.append(i)
k=int(input())

print(sunukes[-k])


m=float("INF")
sunukes=[]
for i in range(7,-1,-1):
    for j in range(1000,10,-1):
        #print(i,j)
        sunuke=j*(100**i)-1
        s=str(sunuke)
        sn=0
        for k in range(len(s)):
            sn+=int(s[k])
        x=sunuke/sn
        
        if x<=m :
            m=x
            sunukes.append(sunuke)
for i in range(9,0,-1):
    sunukes.append(i)
sunukes=sunukes[::-1]
k=int(input())

for i in range(k):
    print(sunukes[i])

Verdicts: Wrong Answer

Accepted