Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import numpy as np


h, w, k = map(int, input().split())
white_count = [np.zeros(w+1, dtype=np.int64)]

for _ in range(h):
    line = list(map(int, list('0'+input())))
    count = np.cumsum(line)
    white_count.append(count + white_count[-1])

white_count = np.array(white_count)

ans = []
for pattern in range(2 ** (h-1)):
    dived_y = [0]
    for y in range(h-1):
        if (pattern >> y) & 1:
            dived_y.append(y + 1)
    dived_y.append(h)

    slash_count = len(dived_y) - 2
    pre_y = dived_y[:-1]
    ny = dived_y[1:]

    prev_x = 0
    for nx in range(1, w+1):
        pre_x_arr = white_count[:, prev_x]
        nx_arr = white_count[:, nx]
        whites = nx_arr[ny] - nx_arr[pre_y] - pre_x_arr[ny] + pre_x_arr[pre_y]
        white = whites.max()
        if white <= k:
            continue
        else:
            slash = nx - 1
            if slash == prev_x:
                break
            slash_count += 1
            prev_x = slash

    else:
        ans.append(slash_count)

print(min(ans))

### FIXED CODE ###

h, w, k = map(int, input().split())
chocolate = ['0' + input() for _ in range(h)]

white_count = [[0] * (w+1)]
for line in chocolate:
    prev = white_count[-1]
    cumsum = []
    total = 0
    for color, count in zip(line, prev):
        if color == '1':
            total += 1
        cumsum.append(total + count)
    white_count.append(cumsum)

ans = []
for pattern in range(2**(h-1)):
    dived = []
    for y in range(h-1):
        if (pattern >> y) & 1:
            dived.append(y + 1)

    dived.append(h)
    slash_count = len(dived) - 1

    prev_x = 0
    for nx in range(1, w + 1):
        prev_y = 0
        possible = True
        for ny in dived:
            white = white_count[ny][nx] - white_count[prev_y][nx] - (white_count[ny][prev_x] - white_count[prev_y][prev_x])
            prev_y = ny
            if white <= k:
                continue
            else:
                slash_count += 1
                slash = nx - 1
                if prev_x == slash:
                    possible = False
                prev_x = slash
                break

        if not possible:
            break

    else:
        ans.append(slash_count)

print(min(ans))
### BUGGY CODE ###

import itertools
N, M, R = map(int, input().split())
Visit = [int(i) for i in input().split()]
for i in range(R):
    Visit[i] -= 1

E = [[float("inf") for i in range(N)] for j in range(N)]
for i in range(N):
    E[i][i] = 0
for i in range(M):
    a, b, c = map(int, input().split())
    E[a-1][b-1], E[b-1][a-1] = c, c

for k in range(N):
    for i in range(N):
        for j in range(N):
            E[i][j] = min(E[i][j], E[i][k] + E[k][j])

ans = float("inf")
for Order in itertools.permutations(Visit):
    temp = 0
    for i in range(R-1):
        temp += E[Order[i]][Order[i+1]]
    if temp < ans:
        ans = temp
print(ans)

### FIXED CODE ###

import itertools
import heapq
N, M, R = map(int, input().split())
Visit = [int(i) for i in input().split()]
for i in range(R):
    Visit[i] -= 1
P = [[] for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    P[a-1].append((c, b-1))
    P[b-1].append((c, a-1))

def Dijk(i):
    Fin = [False for i in range(N)]
    Cost = [float("inf") for i in range(N)]
    Cost[i] = 0
    Q = [(0, i)]
    heapq.heapify(Q)
    while Q:
        cost, node = heapq.heappop(Q)
        if Fin[node] == False:
            Fin[node] = True
            for next in P[node]:
                if Fin[next[1]] == False:
                    if next[0] + cost < Cost[next[1]]:
                        Cost[next[1]] = next[0] + cost
                        heapq.heappush(Q, (Cost[next[1]], next[1]))
    return Cost

E = []
for i in range(N):
    E.append(Dijk(i))

ans = float("inf")
for Order in itertools.permutations(Visit):
    temp = 0
    for i in range(R-1):
        temp += E[Order[i]][Order[i+1]]
    if temp < ans:
        ans = temp
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
D - Practical Skill Test
https://beta.atcoder.jp/contests/abc089/tasks/abc089_d

"""
import sys
from sys import stdin
input = stdin.readline


def sub_solve(l, r):
    sx, sy = numbers[l]
    gx, gy = numbers[r]
    return abs(sx - gx) + abs(sy - gy)


def solve(numbers, queries, H, W, D):
    dp = [[-1] * (H*W+1) for _ in range(H*W+1)]

    for l, r in queries:
        ans = 0
        while True:
            if l == r:
                break
            if dp[l][r] == -1:
                dp[l][r] = sub_solve(l, l+D)
            res = dp[l][r]
            ans += res
            l += D
        print(ans)

numbers = dict()
def main(args):
    global numbers
    H, W, D = map(int, input().split())
    board = []
    for _ in range(H):
        board.append([int(x) for x in input().split()])
    Q = int(input())
    queries = []
    for _ in range(Q):
        queries.append([int(x) for x in input().split()])

    for y, row in enumerate(board, start=1):
        for x, i in enumerate(row, start=1):
            numbers[i] = [x, y]

    solve(numbers, queries, H, W, D)


if __name__ == '__main__':
    main(sys.argv[1:])
    


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
D - Practical Skill Test
https://beta.atcoder.jp/contests/abc089/tasks/abc089_d

"""
import sys
from sys import stdin
input = stdin.readline


def sub_solve(l, r):
    sx, sy = numbers[l]
    gx, gy = numbers[r]
    return abs(sx - gx) + abs(sy - gy)


def solve(queries, H, W, D):
    dp = [0] * (H*W+1)
    for i in range(D+1, H*W+1):
        dp[i] = dp[i-D] + sub_solve(i-D, i)

    for l, r in queries:
        ans = dp[r] - dp[l]
        print(ans)


numbers = dict()
def main(args):
    global numbers
    H, W, D = map(int, input().split())

    for y in range(1, H+1):
        tmp = [int(x) for x in input().split()]
        for x, i in enumerate(tmp, start=1):
            numbers[i] = (x, y)

    Q = int(input())
    queries = []
    for _ in range(Q):
        queries.append([int(x) for x in input().split()])

    solve(queries, H, W, D)


if __name__ == '__main__':
    main(sys.argv[1:])
### BUGGY CODE ###


def update_tree(par, a, b):
    frm = par[a][0] if par[par[a][0]][1] < par[par[b][0]][1] else par[b][0]
    to = par[b][0] if frm == par[a][0] else par[a][0]
    if par[par[frm][0]][1] > par[par[to][0]][1]:
        par[par[to][0]][1] = par[par[frm][0]][1]
    
    while par[frm][0] != par[par[frm][0]][0]: 
        par[frm][0], frm = to, par[frm][0]
    par[frm][0] = to

def get_par(par, p):
    while par[p][0] != par[p][1]:
        p = par[p][0]
    return p

manhattan = lambda x,y:min(abs(x[0] - y[0]), abs(x[1]- y[1]))
N = int(input())
points = []
edges = []
for i in range(N):
    x,y = map(int, input().split())
    points.append([i,i,[x,y]])
    for j in range(i):
        edges.append((abs(points[i][2][0] - points[j][2][0]), j, i))
        edges.append((abs(points[i][2][1] - points[j][2][1]), j, i))
edges.sort(key=lambda x:x[0], reverse=True)
cost = 0
count = 0
while count < N - 1:
    edge = edges.pop()
    if get_par(points, edge[1]) == get_par(points, edge[2]):
        continue
    cost += edge[0]
    count += 1
    update_tree(points, edge[1], edge[2])
print(cost)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def unite(i, j):
    j = get_par(j)
    par[j] = get_par(i)
    return

def get_par(p):
    if par[p] is None:
        return p
    par[p] = get_par(par[p])
    return par[p]

N = int(input())
points = []
edges = []
for i in range(N):
    x,y = map(int, input().split())
    points.append([x,y,i])
points.sort()
for i in range(N-1):
    edges.append((abs(points[i][0] - points[i+1][0]), points[i][2], points[i+1][2]))
points.sort(key=lambda x:x[1])
for i in range(N-1):
    edges.append((abs(points[i][1] - points[i+1][1]), points[i][2], points[i+1][2]))
edges.sort(key=lambda x:x[0], reverse=True)

par = [None] * N
cost = 0
count = 0
points.sort()
while count < N - 1:
    c, i, j = edges.pop()
    if get_par(i) == get_par(j):
        continue
    unite(i, j)
    cost += c
    count += 1
print(cost)
### BUGGY CODE ###

n=int(input())
lst=list(map(int,input().strip().split()))
s=0
mod=1000000007
for i in range(0,n):
    for j in range(i+1,n):
        s+=((lst[i]*lst[j])%mod)
print(s%mod)

### FIXED CODE ###

n=int(input())
lst=list(map(int,input().strip().split()))
s1=sum(lst)
num=s1*s1
denom=0 
mod=1000000007
for i in range(0,n):
        denom+=(lst[i]*lst[i])
print(((num-denom)//2)%mod)
### BUGGY CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
sum_ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_ab = gcd(a, b)
        for c in range(1, k+1):
            gcd_abc = gcd(gcd_ab, c)
            sum_ans += gcd_abc
print(sum_ans)

### FIXED CODE ###

import math

k = int(input())
ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_ab = math.gcd(a, b)
        for c in range(1, k+1):
            ans += math.gcd(gcd_ab, c)
print(ans)
### BUGGY CODE ###

import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse = True)
time = []
time2 = []
for i in range(n):
  t = a[i]*f[i]
  l = [t, f[i]]
  time.append(l)
  time2.append(t)
maxtime = max(time2)
time.sort(reverse=True)
up = maxtime
tem = maxtime//2
low = 0
if sum(a) <= k:
  print(0)
else:
  while True:
    l = k
    for i in range(n):
      if time[i][0] > tem:
        l -= math.ceil((time[i][0]-tem)/time[i][1])
    if l >= 0:
      form = tem
      up = tem
      tem = math.floor((tem+low)/2)
    else:
      form = tem
      low = tem
      tem = math.ceil((tem+up)/2)
    if up- low <= 1:
      break
  print(up)

### FIXED CODE ###

import numpy as np
 
a,b=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())),reverse=True))
 
s=A.sum()
 
x=-1
y=10**12
while x+1<y:
  mid=(x+y)//2
  if s-np.minimum(A,mid//F).sum()<=b:
    y=mid
  else:
    x=mid
print(y)
### BUGGY CODE ###

from sys import stdin
def read():
    return stdin.readline().strip()

dict={}
output=[]

iteration=read()

iteration=int(iteration)

for _ in range(iteration):
    item=read()
    
    if dict.get(item) is None:
        dict[item]=0 
    dict[item]+=1 
max_val=max(dict.values())
while(bool(dict)):
    max_key=max(dict,key=dict.get)
    if(max_val!=dict[max_key]):
        break
    output.append(max_key)
    
    del dict[max_key]
output.sort()
print('\n'.join(output))


### FIXED CODE ###


from sys import stdin
def read():
    return stdin.readline().strip()

dict={}
output=[]

iteration=int(read())

max_val=-1

for _ in range(iteration):
    item=read()
    
    if dict.get(item) is None:
        dict[item]=0 
    dict[item]+=1 
    max_val = max(dict[item],max_val)
#max_val=max(dict.values())
for k,v in dict.items():
    
    if(max_val==v):
        output.append(k)
    
    
output.sort()
print('\n'.join(output))
### BUGGY CODE ###

n = int(input())
a = list(input().split())

b = []
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.insert(0, a[i])
if n % 2 == 1:
    b.reverse()

print(' '.join(b))


### FIXED CODE ###

from collections import deque

n = int(input())
a = list(input().split())

b = deque()
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.appendleft(a[i])
if n % 2 == 1:
    b.reverse()

print(' '.join(b))
### BUGGY CODE ###

def power(a, b, P):
	if b == 0:
		return 1
	elif b == 1:
		return a % P
	elif b % 2 == 0:
		return (power(a, b//2, P) ** 2) % P
	else:
		return (power(a, b//2, P) ** 2 * a) % P
 

N, P = (int(i) for i in input().split())
S = input()
l = [0]*N
ls = [0]*(N+1)
if P != 2 and P != 5:
    d = [0]*P
    d[0] = 1
    b = 0
    for i in range(N):
        a = int(S[N-1-i]) * power(10, i, P)
        l[i] = a%P
        b += (ls[i]+ l[i])
        b %= P
        d[b] += 1
    ans = 0
    for a in d:
        ans += (a-1)*a//2
    print(ans)
else:
    ans = 0
    for i in range(N):
        if int(S[i]) % P == 0:
            ans += (i+1)
    print(ans)

### FIXED CODE ###

def power(a, b, P):
	if b == 0:
		return 1
	elif b == 1:
		return a % P
	elif b % 2 == 0:
		return (power(a, b//2, P) ** 2) % P
	else:
		return (power(a, b//2, P) ** 2 * a) % P
 

N, P = (int(i) for i in input().split())
S = input()
l = [0]*N
ls = [0]*(N+1)
if P != 2 and P != 5:
    po = [1]*N
    for i in range(N-1):
        po[i+1] = (po[i]*10)%P
    d = [0]*P
    d[0] = 1
    b = 0
    for i in range(N):
        a = int(S[N-1-i]) * po[i]
        l[i] = a%P
        b += l[i]
        b %= P
        d[b] += 1
    ans = 0
    for a in d:
        ans += (a-1)*a//2
    print(ans)
else:
    ans = 0
    for i in range(N):
        if int(S[i]) % P == 0:
            ans += (i+1)
    print(ans)
### BUGGY CODE ###

import copy
INF = float('inf')
N = int(input())
a = []
for i in range(N):
    a.append(list(map(int, input().split())))
b = copy.deepcopy(a)
flag = 0
length = 0
muda = [[0 for col in range(N)] for row in range(N)]

for i in range(N):
    for j in range(N):
        for k in range(N):
            if k == i or k == j:
                continue
            mix = b[i][k] + b[k][j]
            if a[i][j] > mix:
                flag = 1
            elif a[i][j] == mix:
                muda[i][j] = 1
for i in range(N):
    for j in range(N):
        if muda[i][j] == 1:
            continue
        length += a[i][j]
if (flag == 0):
    length = int(length/2)
else:
    length = -1
print(length)

### FIXED CODE ###

import numpy as np
import scipy.sparse.csgraph as graph

N = int(input())
G = np.array([list(map(int, input().split())) for i in range(N)])

G2 = graph.floyd_warshall(G, directed=False)

if np.any(G != G2):
    print(-1)
    exit()
else:
    c = [2*10**9]*N
    d = np.diag(c)
    G += d
    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            two = np.min(G[i]+G[j])
            if two != G[i,j]:
                ans += G[i,j]

print(ans)
### BUGGY CODE ###

def solve():
  while True:
    m, n  = int(input()), int(input())
    if not m:
      break
    ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]
    ices.insert(0, [0] * (m + 2),)
    ices.append([0] * (m + 2))
    score = [[0] * (m + 2) for _ in range(n + 2)]
    
    for x in range(1, n + 1):
      for y in range(1, m + 1):
        if ices[x][y]:
          score[x][y] += (ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1])
    
    def bfs(x, y, imap, acc):
#      print(x, y)
      imap[x][y] = 0
      acc += 1
      flag = 0
      a = b = c = d = 0
      if imap[x - 1][y]:
        a = bfs(x - 1, y, [[imap[i][j] for j in range(m + 2)] for i in range(n + 2)], acc)
        flag = 1
      if imap[x + 1][y]:
        b = bfs(x + 1, y, [[imap[i][j] for j in range(m + 2)] for i in range(n + 2)], acc)
        flag = 1
      if imap[x][y - 1]:
        c = bfs(x, y - 1, [[imap[i][j] for j in range(m + 2)] for i in range(n + 2)], acc)
        flag = 1
      if imap[x][y + 1]:
        d = bfs(x, y + 1, [[imap[i][j] for j in range(m + 2)] for i in range(n + 2)], acc)
        flag = 1
      if not flag:
        return acc
      return max(a, b, c, d)
    
    ans = 0
    for x in range(1, n + 1):
      for y in range(1, m + 1):
        if score[x][y] in [1, 2] and ices[x][y]:
          a = bfs(x, y, [[ices[i][j] for j in range(m + 2)] for i in range(n + 2)], 0)
          #a = bfs(x, y, ices, 0)
          if ans < a:
            ans = a
    
    print(ans)

solve()


### FIXED CODE ###

def search(x, y, imap, acc):
  imap[x][y] = 0
  acc += 1
  ret = acc
  a = b = c = d = 0
  if imap[x - 1][y]:
    a = search(x - 1, y, imap, acc)
    if ret < a:
      ret = a
  if imap[x + 1][y]:
    b = search(x + 1, y, imap, acc)
    if ret < b:
      ret = b
  if imap[x][y - 1]:
    c = search(x, y - 1, imap, acc)
    if ret < c:
      ret = c
  if imap[x][y + 1]:
    d = search(x, y + 1, imap, acc)
    if ret < d:
      ret = d
  imap[x][y] = 1
  return ret
 

def solve():
  while True:
    m, n  = int(input()), int(input())
    if not m:
      break
    ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]
    ices.insert(0, [0] * (m + 2),)
    ices.append([0] * (m + 2))
    score = [[0] * (m + 2) for _ in range(n + 2)]
    
    for x in range(1, n + 1):
      for y in range(1, m + 1):
        if ices[x][y]:
          score[x - 1][y] += 1
          score[x + 1][y] += 1
          score[x][y - 1] += 1
          score[x][y + 1] += 1
   
    ans = 0
    for x in range(1, n + 1):
      for y in range(1, m + 1):
        if score[x][y] in [1, 2] and ices[x][y]:
          a = search(x, y, ices, 0)
          if ans < a:
            ans = a
    
    print(ans)

solve()
### BUGGY CODE ###

import sys

inv = {"0": "1", "1": "0"}

def solve(s, cache={}):
    n = len(s)
    if n == 1:
        return 1
    i = 1
    while i < n and s[i] == s[0]:
        i += 1
    j = 1
    while j < n and s[-j-1] == s[-1]:
        j += 1
    if i == n:
        return n
    if i < j:
        rs = n - i
        ss = s[:i] + "".join([inv[c] for c in s[i:]])
        return min(solve(ss), rs)
    else:
        rs = n - j
        ss = "".join([inv[c] for c in s[:-j]]) + s[-j:]
        return min(solve(ss), rs)

line = sys.stdin.readline().strip()
print(solve(line))


### FIXED CODE ###

import sys

def solve1(s):
    n = len(s)
    i = 0
    while i <= n // 2:
        if s[n // 2] != s[n // 2 - i]:
            break
        if s[(n - 1) // 2] != s[(n - 1) // 2 + i]:
            break
        i += 1
    return (n - 1) // 2 + i


line = sys.stdin.readline().strip()
print(solve1(list(line)))
### BUGGY CODE ###

def isSafe(position):
    return not position in listM


STEP =2
N,M= map(int,input().split())
dp = [0] * (N+1)
cnt = 0


listM=[]
for i in range(M):
    listM.append(int(input()))

dp[0] = 1

for i in range(N):
    for k in range(1, STEP+1):
        if i+k > N:
            break
        if isSafe(i+k):
            dp[i+k] += dp[i]
            
        #dp[j] = 0
    #print(dp)
        
print(dp[N] % 1000000007)

### FIXED CODE ###


import sys
input = sys.stdin.readline
def isSafe(position):
    return not position in listM
 
 
STEP = 2
N,M = map(int,input().split())
dp = [0] * (N+1)
cnt = 0
 
 
listM={int(input()) for i in range(M)}
dp[0] = 1
 
for i in range(N):
    if i+1 > N:
        break
    if isSafe(i+1):
        dp[i+1] += dp[i]
    if i+2 > N:
        break
    if isSafe(i+2):
        dp[i+2] += dp[i]
        #dp[j] = 0
    #print(dp)
        
print(dp[N] % 1000000007)
### BUGGY CODE ###

def main():
    x,y = map(int,input().split())
    tmp = []
    i = 2
    while True:
        if i > x or i > y:
            break
        if x % i ==0 and y % i == 0:
            tmp.append(i)
            while True:
                if x % i == 0:
                    x = x//i
                else:
                    break
            while True:
                if y % i == 0:
                    y = y//i
                else:
                    break
        i += 1

    print(len(tmp) + 1)
    # print(tmp)
if __name__=='__main__':
    main()


### FIXED CODE ###

def main():
    x,y = map(int,input().split())
    tmp = [1]
    i = 2
    ans = 0
    # if x == y:
    #     ans += 1
    # a = factorization(x)
    # print(a)
    tempx = x

    for i in range(2, int(-(-x**0.5//1))+1):
        if tempx % i == 0:
            tmp.append(i)
            while tempx % i == 0:

                tempx //= i
    if tempx!=1:
        tmp.append(tempx)
    # print(tmp)

    for i,a in enumerate(tmp):
        if y % a == 0:
            tmp[i] = 1
        else:
            tmp[i] = 0
    print(sum(tmp))


if __name__=='__main__':
    main()
### BUGGY CODE ###

N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())

A = list(A)
A.sort()
B = list(B)
B.sort()
C = list(C)
C.sort()

count = [0 for _ in range(N)]
K = 0

for j in range(N):
    for k in range(K, N):
        if C[k] > B[j]:
            count[j] = N-k
            K = k
            break
    if count[j] == 0:
        break

result = 0

for i in range(N-1):
    count[N - 2 - i] += count[N - 1 - i]


for i in range(N):
    tmp = 0
    for j in range(N):
        if B[j] > A[i]:
            tmp = count[j]
            J = j
            break
    if tmp == 0:
        break
    else:
        result += tmp

print(result)


### FIXED CODE ###

import bisect

N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())

A = list(A)
A.sort()
B = list(B)
B.sort()
C = list(C)
C.sort()

count = 0

for b in B:
    l = bisect.bisect_left(A, b)
    r = bisect.bisect_right(C, b)
    count += l * (N - r)

print(count)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = []
for X in range(min(A),max(A)+1):
    count = 0
    for i in A:
        if(abs(i-X) <= 1):
            count += 1
    ans.append(count)
print(max(ans))


### FIXED CODE ###

#TLE解答
'''
N = int(input())
A = list(map(int,input().split()))
ans = []
for X in range(min(A),max(A)+1):
    count = 0
    for i in A:
        if(abs(i-X) <= 1):
            count += 1
    ans.append(count)
print(max(ans))
'''

#解説を見て
import collections
N = int(input())
A = list(map(int,input().split()))
list_A = []
for i in  range(N):
    list_A.append(A[i])
    list_A.append(A[i]+1)
    list_A.append(A[i]-1)
print(collections.Counter(list_A).most_common()[0][1])