Harryxun/stf_run huggingface dataset:
N,K=map(int,input().split())
S=input()

L=[]

P=S[0]
cnt=1
for i in range(1,N):
    if S[i]==P:
        cnt+=1
    else:
        if P=="1":
            L.append(cnt)
            cnt=1
            P="0"
        else:
            L.append(cnt*-1)
            cnt=1
            P="1"
if P=="1":
    L.append(cnt)
else:
    L.append(cnt*-1)
if len(L)==1:
    print(L)
    exit()
X=[0 for i in range(len(L))]
L=X+L+X
#print(L)
ANS=[]
NUM=0
for i in range(1,2*K-1):
    NUM+=abs(L[i])
ANS=[NUM]
#print(ANS)

SUM=[0]
for i in range(1,len(L)):
    SUM.append(SUM[i-1]+abs(L[i]))



ans=0
if len(SUM)-len(X)<2*K:
    print(SUM[len(SUM)-1])
else:    
    for i in range(len(SUM)-len(X)):
        if L[i]<0:
            if (SUM[2*K+1+i]-SUM[i])>ans:
                ans=(SUM[2*K+1+i]-SUM[i])
        else:
            if (SUM[2*K+i]-SUM[i])>ans:
                ans=(SUM[2*K+i]-SUM[i])
            #print(i)
    print(ans)


### FIXED CODE ###

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

S=[]
F="2"
cnt=0
for i in range(N):
    if F=="0":
        if s[i]=="0":
            cnt-=1
        else:
            S.append(cnt)
            F="1"
            cnt=1
    elif F=="1":
        if s[i]=="1":
            cnt+=1
        else:
            S.append(cnt)
            F="0"
            cnt=-1
    else:
        if s[i]=="0":
            F="0"
            cnt=-1
        else:
            F="1"
            cnt=1
S.append(cnt)
if S[0]<0:
    S=[0]+S+[0]
else:
    S=S+[0]

if S[0]>=0:
    if len(S)<=(2*K+1):
        ans=0
        for i in range(len(S)):
            ans+=abs(S[i])
        print(ans)
        #exit()
    else:
        ans=0
        SUM=0
        for i in range(2*K+1):
            SUM+=abs(S[i])
            ans=SUM
        #print(ans)
        for i in range(1,len(S)):
            if (2*i+2*K)>(len(S)-1):
                #print("A")
                break
            else:
                #print("B")
                SUM=SUM+abs(S[2*i+2*K-1])+abs(S[2*i+2*K])-abs(S[2*i-1])-abs(S[2*i-2])
                if SUM>ans:
                    ans=SUM
        print(ans)
        #exit()
#print(S)
import sys, math
[[print("{} {}".format(math.gcd(t[0], t[1]), t[0] * t[1] // math.gcd(t[0], t[1]))) for t in [[int(y) for y in x.split()]]] for x in sys.stdin]

### FIXED CODE ###

import sys, fractions
[[print("{} {}".format(int(fractions.gcd(t[0], t[1])), int(t[0] * t[1] / fractions.gcd(t[0], t[1])))) for t in [[int(y) for y in x.split()]]] for x in sys.stdin]
n,k=map(int,input().split())
P=[int(i) for i in input().split()]
n_max=2*10**5
num=n_max.bit_length()+1
def init1(init_val):
  for i in range(n):
    seg1[i+num-1]=init_val[i]    
    for i in range(num-2,-1,-1) :
      seg1[i]=max(seg1[2*i+1],seg1[2*i+2]) 
def init2(init_val):
  for i in range(n):
    seg2[i+num-1]=init_val[i]    
    for i in range(num-2,-1,-1) :
      seg2[i]=min(seg2[2*i+1],seg2[2*i+2]) 
   
def query1(p,q):
  if q<=p:
    return ide_ele1
  p+=num-1
  q+=num-2
  res=ide_ele1
  while q-p>1:
    if p&1==0:
      res=max(res,seg1[p])
    if q&1==1:
      res=max(res,seg1[q])
      q-=1
    p=p//2
    q=(q-1)//2
  if p==q:
    res=max(res,seg1[p])
  else:
    res=max(max(res,seg1[p]),seg1[q])
  return res
def query2(p,q):
  if q<=p:
    return ide_ele2
  p+=num-1
  q+=num-2
  res=ide_ele2
  while q-p>1:
    if p&1==0:
      res=min(res,seg2[p])
    if q&1==1:
      res=min(res,seg2[q])
      q-=1
    p=p//2
    q=(q-1)//2
  if p==q:
    res=min(res,seg2[p])
  else:
    res=min(min(res,seg2[p]),seg2[q])
  return res
ide_ele1=0
ide_ele2=n_max
seg1=[ide_ele1]*2*num
seg2=[ide_ele2]*2*num
init1(P)
init2(P)
ans=1
for i in range(k,n):
  if P[i-k]==query2(i-k,k+1) and P[i]==query1(i-k,k+1):
    continue
  else:
    ans+=1

Q=[0]*n
for i in range(1,n):
  if P[i]>P[i-1]:
    Q[i]=Q[i-1]+1
  else:
    continue
count=0
for i in range(n):
  if Q[i]>=k-1:
    count+=1
print(ans-max(0,count-1))

### FIXED CODE ###

n,k=map(int,input().split())
P=[int(i) for i in input().split()]
import collections
from collections import deque
M1,M2=deque(),deque()
A1,A2=[],[]
M1.append(0)
for i in range(1,n):
  while M1:
    if P[M1[-1]]>P[i]:
      M1.pop()
    else:
      M1.append(i)
      break
  if not M1:
    M1.append(i)
  if M1[0]==i-k-1:
    M1.popleft()
  if i<k:
    continue
  else:
    A1.append(P[M1[0]])
M2.append(0)
for i in range(1,n):
  while M2:
    if P[M2[-1]]<P[i]:
      M2.pop()
    else:
      M2.append(i)
      break
  if not M2:
    M2.append(i)
  if M2[0]==i-k-1:
    M2.popleft()
  if i<k:
    continue
  else:
    A2.append(P[M2[0]])
ans=1
for i in range(n-k):
  if A1[i]==P[i] and A2[i]==P[i+k]:
    continue
  else:
    ans+=1
Q=[0]*n
for i in range(1,n):
  if P[i]>P[i-1]:
    Q[i]=Q[i-1]+1
  else:
    continue
count=0
for i in range(n):
  if Q[i]==k-1:
    count+=1
print(ans-max(0,count-1))
N, M = list(map(int, input().split()))
D = list(map(int, input().split()))
UB = [list(map(int, input().split())) for _ in range(M)]

R = {}
for i in range(M):
  a, b = UB[i]
  a -= 1
  b -= 1
  if a not in R: R[a] = [[b, i]]
  else: R[a].append([b, i])
  if b not in R: R[b] = [[a, i]]
  else: R[b].append([a, i])

DD = [[0] * 2 for _ in range(N)]
for i in range(N):
  DD[i][0] = D[i]
  DD[i][1] = i
DD.sort()
L = [0] * N
H = [0] * M
LL = [0] * N
for i in range(N):
  h, x = DD[i]
  if L[x] == 0:
    if LL[x] == 0:
      for n, m in R[x]:
        LL[n] = x
        if D[n] == D[x] or L[n] != 0:
          H[m] = h
          if L[n] == 1:
            L[n] = 1
            L[x] = 2
          else:
            L[n] = 2
            L[x] = 1
          break
      else:
        print(-1)
        exit()
    else:
      n, m = R[LL[x]]
      H[m] = h
      if L[n] == 1:
        L[n] = 1
        L[x] = 2
      else:
        L[n] = 2
        L[x] = 1
t = ""
for i in range(N):
  if L[i] == 1:
    t += "B"
  else:
    t += "W"
print(t)
for i in range(M):
  if H[i] == 0:
    print(10 ** 9)
  else:
    print(H[i])


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
D = list(map(int, input().split()))
UB = [list(map(int, input().split())) for _ in range(M)]

LL = [[-1] * 2 for _ in range(N)]
for i in range(M):
  a, b = UB[i]
  a -= 1
  b -= 1
  if D[a] < D[b]:
    LL[b] = [a, i]
  elif D[a] > D[b]:
    LL[a] = [b, i]
  else:
    LL[a] = [b, i]
    LL[b] = [a, i]

DD = [[0] * 2 for _ in range(N)]
for i in range(N):
  DD[i][0] = D[i]
  DD[i][1] = i
DD.sort()
L = [0] * N
H = [0] * M

for i in range(N):
  h, x = DD[i]
  if L[x] == 0:
    if LL[x][0] == -1:
      print(-1)
      exit()
    else:
      n, m = LL[x]
      H[m] = h
      if L[n] == 1:
        L[n] = 1
        L[x] = 2
      else:
        L[n] = 2
        L[x] = 1

for i in range(N):
  if L[i] == 1:
    L[i] = "B"
  else:
    L[i] = "W"
print("".join(list(map(str, L))))
for i in range(M):
  if H[i] == 0:
    print(10 ** 9)
  else:
    print(H[i])
from sys import stdin, stdout
n,m = map(int, stdin.readline().rstrip().split(' '))
l = list(map(int, stdin.readline().rstrip().split(' ')))
sum = sum(l)
k = sum/(4*m)
ans = "Yes"
l.sort(reverse = True)
for i in (0,m):
  if l[i]<k:
      ans="No"
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
ans = "Yes"
 
a.sort(reverse=True)
 
for i in range(m):
    if a[i] < sum(a)*(1/(4*m)):
        ans = "No"
        break
 
print(ans)
import math
a, b, x = map(int,input().split())
V = (a**2)*b
v = V*0.5
if x > v:
    U = V - x
    c = U / (a**3)
    z = math.atan(c)
    print(z)
elif x = v:
    z = math.atan(1)
    print(z)
else:
    c = (a*(b**2)) / x
    z = math.atan(c)
    print(z)
    
    

### FIXED CODE ###

import math
a, b, x = map(int,input().split())
V = (a**2)*b
v = V*0.5
if x >= v:
    U = V - x
    c = (U*2) / (a**3)
    z = math.atan(c)
    print(math.degrees(z))
else:
    c = (a*(b**2)) / (x*2)
    z = math.atan(c)
    print(math.degrees(z))
import itertools
import math
import collections
​
def main():
    n = int(input())
​
    s = int(math.sqrt(n))
    a = list(itertools.product(range(1,s),repeat=3))
​
    ans = []
    for i in range(len(a)):
        t = a[i][0] ** 2 + a[i][1] ** 2 + a[i][2] ** 2 + a[i][0] * a[i][1] + a[i][1] * a[i][2] + a[i][2] * a[i][0]
        ans.append(t)
        # print(ans)
​
    c = collections.Counter(ans)
    for i in range(1,n+1):
        print(c[i])
        
        
main()

### FIXED CODE ###

import itertools
import math
import collections
def main():
    n = int(input())
    s = int(math.sqrt(n))
    a = list(itertools.product(range(1,s),repeat=3))
    ans = []
    for i in range(len(a)):
        t = a[i][0] ** 2 + a[i][1] ** 2 + a[i][2] ** 2 + a[i][0] * a[i][1] + a[i][1] * a[i][2] + a[i][2] * a[i][0]
        ans.append(t)
        # print(ans)
    c = collections.Counter(ans)
    for i in range(1,n+1):
        print(c[i])
        
        
main()
def lcs(x,y):
    xs = len(x)
    ys = len(y)
    x = " " + x
    y = " " + y
    c = [[0 for i in xrange(len(x))] for j in xrange(len(y))]
    for i in xrange (1,ys+1):
        for j in xrange (1,xs+1):
            if x[j] == y[i]:
                a = 1
            else:
                a = 0
            c[i][j] = max(c[i][j-1],c[i-1][j],c[i-1][j-1] + a)
        m = max(m,c[i][j])
    return max(max(c))
n = input() 
for i in xrange (n): 
    x = raw_input()
    y = raw_input() 
    print lcs(x,y)

### FIXED CODE ###

def lcs():
    x, y = raw_input(), raw_input()
    b1 = [0 for k in range(len(y)+1)]
    for i in xrange(len(x)):
        a = x[i]
        b2 = b1 + []
        for j in xrange(len(y)):
            if a == y[j]:
                b1[j+1] = b2[j] + 1
            elif b1[j+1] < b1[j]:
                b1[j+1] = b1[j]
    print max(b1)
 
n = input()
for i in xrange(n):
    lcs()
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

if x in a and y in a:
	print("Yes")
elif x in b and y in b:
	print("Yes")      
elif x in c and y in c:
	print("Yes")
else:
	print("No")
      

### FIXED CODE ###

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

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

if x in a and y in a:
	print("Yes")
elif x in b and y in b:
	print("Yes")      
elif x in c and y in c:
	print("Yes")
else:
	print("No")
import math
def main():
	N = int(input())
	P = int(math.log(N,5))
	ans = 0
	
	ans = [int((N/2)/pow(5,p)) for p in range(1,P)]
	print(sum(ans))


if __name__ == '__main__':
	main()

### FIXED CODE ###

import math
def main():
	N = int(input())
	if N%2 == 1 or N==0:
		print(0)
	else:
		N = N//2
		P = int(math.log(N,5))
		ans = [ N//(5**p) for p in range(1,P+1)]
		print(sum(ans))

if __name__ == '__main__':
	main()
import math
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
def gcd(*numbers):
    return reduce(math.gcd,numbers)
A=gcd(*a)
for i in range(n):
    c=a[i]
    del a[i]
    B=gcd(*a)
    if A<B:
        A=B
    else:
        A=A
    a.insert(i,c)
print(A)


### FIXED CODE ###

import fractions 
n=int(input())
a=list(map(int,input().split()))
ans=a[0]
sna=a[n-1]
Ans=[ans]*n
Sna=[sna]*n
for j in range(1,n):
  ans=fractions.gcd(ans,a[j])
  Ans[j]=ans
  sna=fractions.gcd(sna,a[n-j-1])
  Sna[j]=sna
m=Sna[n-2]
for k in range(n-2):
  m=max(m,fractions.gcd(Ans[k],Sna[n-3-k]))
m=max(m,Ans[n-2])
print(m)
def main():
    N = int(input())
    a = sorted(map(int, input().split()))[::-1]
    diff = sum([::2]) - sum([1:2])
    print(diff)


if __name__ == "__main__":
    main()

### FIXED CODE ###


def main():
    N = int(input())
    a = sorted(map(int, input().split()),reverse=True)      #降順のリスト

    alice = 0
    bob = 0

    for i in range(N):
        if i % 2 == 0:
            alice += a[i]

        else:
            bob += a[i]

    print(alice - bob)


if __name__ == "__main__":
    main()
N,M = map(int,input().split())
ls2 = []
for i in range(M):
    A,B = map(str,input().split())
    ls = [int(A)-1,B]
    ls2.append(ls)

Pena = 0
corr = 0

ls3 = sorted(ls2, key=lambda x: x[0])
lsans = [[] for i in range(M)]
for i in range(M):
    lsans[ls2[i][0]].append(ls2[i][1])

for i in range(M):
    if bool(lsans[i]):
        for ans in lsans[i]:
            if ans == 'WA':
                Pena += 1
            if ans == 'AC':
                corr += 1
                break
print(corr,Pena)

### FIXED CODE ###

N,M = map(int,input().split())
ls2 = []
for i in range(M):
    A,B = map(str,input().split())
    ls = [int(A)-1,B]
    ls2.append(ls)

Pena = 0
corr = 0

#ls3 = sorted(ls2, key=lambda x: x[0])
lsans = [[] for i in range(N)]
for i in range(M):
    lsans[ls2[i][0]].append(ls2[i][1])

for i in range(N):
    if 'AC' in lsans[i]:
        for ans in lsans[i]:
            if ans == 'WA':
                Pena += 1
            if ans == 'AC':
                corr += 1
                break
print(corr,Pena)
v=input()
print(v**3)

### FIXED CODE ###

x=eval(input())
print(x**3)
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=[int(input()) for i in range(n)]

f="first"
s="second"
# print(a)
if sum(a)==n sum(a)==n+1:
    print(f)
    exit()
# print(sum(a)%2)
if sum(a)%2:
    print(f)
else:
    print(s)

### FIXED CODE ###

import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=[int(input()) for i in range(n)]

f="first"
s="second"
for i in range(n):
    if a[i]%2==1:
        print(f)
        break
else:
    print(s)
while 1:
    nm = map(int, raw_input().split())
    if nm == [0, 0]:
	break
    n = nm[0]
    m = nm[1]
    p = map(int, raw_input().split())
    p_sorted = sorted(p)
    sum = 0
    for i in range(n):
        if (i+1) % m != 0:
	    sum += p_sorted[-1-i]
    print sum

### FIXED CODE ###

while 1:
    try:
        nm = map(int, raw_input().split())
        if nm == [0, 0]:
            break
        n = nm[0]
        m = nm[1]
        p = map(int, raw_input().split())
        p_sorted = sorted(p)
        sum = 0
        for i in range(n):
            if (i+1) % m != 0:
                sum += p_sorted[-1-i]
        print sum
    except:
	pass
import math
r = int(input())
s = r * r * math.pi
l = r * 2 * math.pi
print("{:f} {:f}".format(s, l))


### FIXED CODE ###

import math
r = float(input())
s = r * r * math.pi
l = r * 2.0 * math.pi
print("{:f} {:f}".format(s, l))
import sys

N = int(sys.stdin.readline())
D = list(map(int, sys.stdin.readline().split()))

times = [0] * 24
for d in D:
    times[d] += 1

if max(times) > 2 or times[0] == 2 or times[12] == 2:
    print(0)
else:
    ans = 0
    # 1 - 11時間の時差の場合、Diと24 - Diの両方を試す
    for i in range(2**11):
        positions = []
        if times[0] == 1:
            positions.append(0)
        for j in range(11):
            if times[j+1] == 2:
                positions.append(j+1)
                positions.append(24 - j-1)
            elif times[j+1] == 1:
                if (i >> j) & 1:
                    positions.append(24 - j-1)
                else:
                    positions.append(j+1)
        if times[12] == 1:
            positions.append(12)
        positions.sort()
        # print(positions)
        lp = len(positions)
        d = float("inf")
        for p in range(lp):
            # 0をまたぐ場合がある
            diff = abs(positions[(p+1) % lp] - positions[p])
            d = min(d, diff)
        ans = max(ans, d)

print(ans)

### FIXED CODE ###

import sys

N = int(sys.stdin.readline())
D = list(map(int, sys.stdin.readline().split()))

times = [0] * 24
times[0] = 1
for d in D:
    times[d] += 1

if max(times) > 2 or times[0] == 2 or times[12] == 2:
    print(0)
else:
    ans = 0
    # 1 - 11時間の時差の場合、Diと24 - Diの両方を試す
    for i in range(2**11):
        positions = [0]
        for j in range(1, 12):
            if times[j] == 2:
                positions.append(j)
                positions.append(24 - j)
            elif times[j] == 1:
                if (i >> j) & 1:
                    positions.append(24 - j)
                else:
                    positions.append(j)
        if times[12] == 1:
            positions.append(12)
        positions.sort()
        # print(positions)
        lp = len(positions)
        d = float("inf")
        for p in range(lp):
            # 0をまたぐ場合がある
            if p == lp -1:
                diff = 24 - positions[p] + positions[0]
            else:
                diff = positions[p+1] - positions[p]
            d = min(d, diff if diff != 24 else 0)
        ans = max(ans, d)

    print(ans)
import sys

num1, num2 = [int(i) for i in input().split()]
if (num1 = num2){
    print('Yes')
}else{
    print('No')
}

### FIXED CODE ###

num1, num2 = [int(i) for i in input().split()]
if num1 == num2:
    print('Yes')
else:
    print('No')
s = input()

ans=0
counter = 0
for c in s:
  if c=='A' or c=='C' or c=='G' or c=-'T':
    counter+=1
  else:
    ans = max(ans,counter)
    counter==0
print(ans)
  

### FIXED CODE ###

s = input()
 
ans=0
counter = 0
for c in s:
  if c=='A' or c=='C' or c=='G' or c=='T':
    counter+=1
  else:
    ans = max(ans,counter)
    counter=0
ans = max(ans,counter)
print(ans)
h,w = map(int,input().split())

al = []

for _ in range(h):
   a = list(input())
   al.append(a)

i,j = 0,0
while True:
    al[i][j] = "."
    if j + 1 < w and al[i][j+1] == "#":
        al[i][j+1] = "."
        j += 1
    elif i + 1 < h and al[i+1][j] == "#":
        al[i+1][j] = "."
        i += 1
    else:
        print("Impossible")
        exit()
    if j == w-1 and i == h-1:
        break

for i in range(h):
    for j in range(h):
        if al[i][j] == '#':
            print("Impossible")
            exit()
print("Possible")

        

### FIXED CODE ###

h,w = map(int,input().split())

al = []

for _ in range(h):
   a = list(input())
   al.append(a)

i,j = 0,0
while True:
    al[i][j] = "."
    if j + 1 < w and al[i][j+1] == "#":
        al[i][j+1] = "."
        j += 1
    elif i + 1 < h and al[i+1][j] == "#":
        al[i+1][j] = "."
        i += 1
    else:
        print("Impossible")
        exit()
    if j == w-1 and i == h-1:
        break

for i in range(h):
    for j in range(w):
        if al[i][j] == '#':
            print("Impossible")
            exit()
print("Possible")
import math

l, r = map(int, input().split())

ls = l % 2019
rs = r % 2019

dif = r // 2019 - l // 2019

#print("dif = {}".format(dif))

if (dif != 0):
    print(0)
elif (r - l == 1):
    print(lr*rs % 2019)
else:
    mini = []
    for i in range(ls, rs):
        mini.append(min(i * j % 2019 for j in range(ls + 1, rs)))
    print(min(mini))


### FIXED CODE ###

import math

l, r = map(int, input().split())

ls = l % 2019
rs = r % 2019

dif = r // 2019 - l // 2019

#print("dif = {}".format(dif))

if (dif != 0):
    print(0)
elif (r - l == 1):
    print(ls*rs % 2019)
else:
    mini = []
    for i in range(ls, rs):
        mini.append(min(i * j % 2019 for j in range(ls + 1, rs+1)))
    print(min(mini))
import math
number = int(input())
base = int(input())
converted=0
reminder=0
i=0
counter=0
while number!=0:
    reminder=number%base
    number=number//base
    converted=converted+reminder*10**i
    i+=1


#To convert integer into string
y=str(converted)
print(len(y))

### FIXED CODE ###

import math

n, k = map(int, input().split())
print(math.floor(math.log(n, k) + 1))
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
else a > b;
    print('a > b')
else:
    print('a == b')

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')
H, N=map(int,input().split())
A=list(map(int,input().split())
if H<=sum(A):
       print('Yes')
else:
       print('No')

### FIXED CODE ###

H,N=map(int,input().split())
A=list(map(int,input().split()))
if H<=sum(A):
    print('Yes')
else:
    print('No')
a,b,n=map(int,input().split())

if b<=n:
    if a%b!=0
        print(a-a//b -1)
    else:
        print(a-a//b)
else:
    print(int(n*a/b))

### FIXED CODE ###

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

if b<=n:
    if a%b!=0:
        print(a-a//b -1)
    else:
        print(a-a//b)
else:
    print(int(n*a/b))
n=int(input())
l=map(int,input().split())
su=sum(l)
best=10000000000000000
res=0
for i in range(len(l)):
  if(su-n*l[i]<best):
    best=su-n*l[i]
    res=i
print(res)

### FIXED CODE ###

n=int(input())
s=input().split()
l=[int(s[i]) for i in range(n)]
su=sum(l)
best=10000000000000000
res=0
for i in range(n):
  if(abs(su-n*l[i])<best):
    best=abs(su-n*l[i])
    res=i
print(res)
a,b=map(int, input().split())

if b=='H':
  if a=='H':
    print('H')
  else:
    print('D')
else:
  if a=='H':
    print('D')
  else:
    print('H')

### FIXED CODE ###

a,b=map(str, input().split())

if b=='H':
  if a=='H':
    print('H')
  else:
    print('D')
else:
  if a=='H':
    print('D')
  else:
    print('H')
if S=='SSS':
  print(0)
if S=='RSS' or S=='SRS' or S=='SSR' or S=='RSR':
  print(1)
if S=='RRS' or S=='SRR':
  print(2)
if S=='RRR':
  print(3)

### FIXED CODE ###

S=input()
if S=='SSS':
  print(0)
if S=='RSS' or S=='SRS' or S=='SSR' or S=='RSR':
  print(1)
if S=='RRS' or S=='SRR':
  print(2)
if S=='RRR':
  print(3)
S=str(input())
if S[-1]==s:
    print(S+"es")
else:
    print(S+"s")


### FIXED CODE ###

S=input()
if S[-1:]=="s":
    print(S+"es")
else:
    print(S+"s")
k,x=map(int,input().split())
list=[]
for i in range(k):
  list.append(x+i)
  list.append(x-i)
list.remove(x)
list.sort()
print(*list sep='')

### FIXED CODE ###

k,x=map(int,input().split())
list=[]
for i in range(k):
  list.append(x+i)
  list.append(x-i)
list.remove(x)
list.sort()
print(*list)
c = [map(int,input().split()) for i in range(3)]
a1,a2,a3,b1,b2,b3 = 0,c[1][0]-c[0][1],\
c[2][0]-c[0][2],c[0][0],c[0][1],c[0][2]

if c[1][1]==a2+b2 and c[1][2]==a2+b3 and\
c[2][1]==a3+b2 and c[2][2]==a3+b3:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

c = [list(map(int,input().split())) for i in range(3)]
a1,a2,a3,b1,b2,b3 = 0,c[1][0]-c[0][0],\
c[2][0]-c[0][0],c[0][0],c[0][1],c[0][2]

if c[1][1]==a2+b2 and c[1][2]==a2+b3 and\
c[2][1]==a3+b2 and c[2][2]==a3+b3:
    print('Yes')
else:
    print('No')
import math

s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])

if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
  print('Yes')
else:
  print('No')




### FIXED CODE ###

d = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
str_n = input()
n = int(str_n)
print(d[n-1])
s = input()
a = int(s[:2])
b = int(s[2:])
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if a<=12 and b<=12:
    print('AMBIGUOUS')
elif a<=12 and b<=days[a]:
    print('YYMM')
elif b<=12 and a<=days[b]:
    print('MMYY')
else:
    print('NA')



### FIXED CODE ###

s = input()
a = int(s[:2])
b = int(s[2:])
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif a<=99 and 0<b<=12:
    print('YYMM')
elif 0<a<=12 and b<=99:
    print('MMYY')
else:
    print('NA')
n = int(input())
sum1 = 0
while n>0:
  sum1 += n%10
  n/=10
if sum1%9 == 0:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

n = int(input())
if n % 9 == 0:
  print('Yes')
else:
  print('No')
n=int(input())
s=list(input().split())
sum=0
i=1
str=s[0]
while i<=n-1:
  if str == s[i]:
    continue
  else:
    str=s[i]
    sum+=1
print(sum)
  
  
  

### FIXED CODE ###

n=int(input())
s=input()
sum=1
i=1
str=s[0]
while i<=n-1:
  if str == s[i]:
    i+=1
  else:
    str=s[i]
    sum+=1
    i+=1
    
print(sum)
from math import gcd
N, X = map(int, input().split())
print(3 * (N - gcd(N, X)))


### FIXED CODE ###

from fractions import gcd
N, X = map(int, input().split())
print(3 * (N - gcd(N, X)))
n,k=map(int,input().split())
s=str(input())
if s[k-1]=="A":
  s[k-1]=="a"
elif s[k-1]=="B":
  s[k-1]=="b"
else:
  s[k-1]="c"
print(s)

### FIXED CODE ###

n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print(''.join(s))