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

#全探索でO(N^2)
N = int(input())
A = [int(input()) for _ in range(N)]

count = 0
tmp = - 10 ** 10
for i in range(N):
    # print ('i', i)
    if A[i] == -10 ** 11:
        continue
    if tmp == -10 ** 10:
        tmp = A[i]
        count += 1
        for j in range(i + 1, N):
            if tmp < A[j]:
                tmp = A[j]
                A[j] = - 10  ** 11
            if j == N - 1:
                tmp = - 10 ** 10
# print (A)
print (count)



### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]

dp = [-A[0]]
def solve():
    import bisect
    for i in range(1, N):
        a = bisect.bisect_left(dp, -A[i]+0.1) #入れるべき場所
        # print (a)
        if a == len(dp):
            dp.append(-A[i])
        else:
            dp[a] = -A[i]
        # print (dp)
    return len(dp)


print (solve())
### BUGGY CODE ###

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


def flip_direction(target, start, end):
    for i in range(start, end + 1):
        if target[i] == 'R':
            target = target[:i] + 'L' + target[i + 1:]
            # S[i] = 'L'
        else:
            target = target[:i] + 'R' + target[i + 1:]
            # S[i] = 'R'
    return target


def count_happy_person():
    count = 0
    dir = S[0]
    for i in range(1, len(S)):
        if dir == S[i]:
            count += 1
        else:
            dir = S[i]
    return count


for _ in range(K):
    start = 0
    end = 0
    for i in range(1, len(S)):
        if S[0] != S[i]:
            if start == 0:
                start = i
            end = i
        else:
            if start != 0:
                break
    S = flip_direction(S, start, end)
print(count_happy_person())

### FIXED CODE ###

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

happy_face = N - 1 - S.count('LR') - S.count('RL')
ans = min(N - 1, happy_face + 2 * K)
print(ans)
### BUGGY CODE ###

n = int(input())
p = list(map(int,input().split()))	
count=0

for i in range(n):
    if p[i] <= min(p[0:i+1]):
        count+=1

print (count)


### FIXED CODE ###

n = int(input())
p = [int(e) for e in input().split()]
count=0
p_min=p[0]

for i in range(n):
    if p[i] <= p_min:
        count+=1
#        p_min=min(p[0:i+1])
        p_min=p[i]

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

from collections import deque

def main():
  H,W,K=map(int,input().split())
  x1,y1,x2,y2 = map(lambda x: int(x)-1,input().split())
  S=[list(input()) for _ in range(H)]
  INF = 10**20

  def bfs(x0,y0,x_goal,y_goal):
    seen = [[0 for i in range(W)] for j in range(H)]
    d = [[INF for i in range(W)] for j in range(H)]
    d[x0][y0] = 0
    todo = deque()
    if S[x0][y0]=='@':return 0
    seen[x0][y0] = 1
    todo.append((x0,y0))
    while todo:
      x0,y0 = todo.popleft()
      dx,dy = (1,-1,0,0),(0,0,1,-1)
      for i in range(4):
        for k in range(K):
          x,y = x0+dx[i]*(k+1), y0+dy[i]*(k+1)
          if x<0 or x>=H:break
          if y<0 or y>=W:break
          if S[x][y]=='@':break
          if d[x][y] < d[x0][y0] + 1: break
          seen[x][y] = 1
          todo.append((x,y))
          d[x][y] = d[x0][y0] + 1
          if x==x_goal and y == y_goal: return d[x][y]
    return d[x_goal][y_goal]

  ans = bfs(x1,y1,x2,y2)
  print(ans if ans < INF else -1)
  
if __name__ == "__main__":
  main()

### FIXED CODE ###

from collections import deque

def main():
  H,W,K=map(int,input().split())
  x1,y1,x2,y2 = map(lambda x: int(x)-1,input().split())
  S=[list(input()) for _ in range(H)]
  INF = 10**20

  def bfs(x0,y0,x_goal,y_goal):
    seen = [[0 for i in range(W)] for j in range(H)]
    d = [[INF for i in range(W)] for j in range(H)]
    d[x0][y0] = 0
    todo = deque()
    seen[x0][y0] = 1
    todo.append((x0,y0))
    while todo:
      x0,y0 = todo.popleft()
      dx,dy = (1,-1,0,0),(0,0,1,-1)
      for i in range(4):
        for k in range(K):
          x,y = x0+dx[i]*(k+1), y0+dy[i]*(k+1)
          if x<0 or x>=H:break
          if y<0 or y>=W:break
          if d[x][y] < d[x0][y0] + 1: break
          if S[x][y]=='@':break
          if seen[x][y]: continue
          seen[x][y] = 1
          todo.append((x,y))
          d[x][y] = d[x0][y0] + 1
          if x==x_goal and y == y_goal: return d[x][y]
    return d[x_goal][y_goal]

  ans = bfs(x1,y1,x2,y2)
  print(ans if ans < INF else -1)
  
if __name__ == "__main__":
  main()
### BUGGY CODE ###

import sys

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ri()
A = rl()
MOD = 10 ** 9 + 7
#1番目以降(N個の数)のbitの格桁の合計
l = [0] * 60
for i in range(N):
    s = list(str(bin(A[i]))[2:].rjust(60, '0'))
    #print(s)
    for j in range(60):
        if s[j] == '1':
            l[j] += 1
l2 = [0] * 60
#print(l)
for i in range(N-1):
    s = list(str(bin(A[i]))[2:].rjust(60, '0'))
    for j in range(60):
        if s[j] == '1':
            l[j] -= 1
            l2[j] += N - 1 - i - l[j]
        else:
            l2[j] += l[j]
answer = 0
#print(l2)
for i in range(60):
    answer += 2 ** (59-i) * l2[i]
    answer %= MOD
#print(l)
print(answer)



### FIXED CODE ###

import sys
import numpy as np

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ri()
A = np.array(rl())
answer = 0
MOD = 10 ** 9 + 7

for n in range(63):
    B = (A >> n) & 1
    x = np.count_nonzero(B)
    y = N - x
    x *= y
    for _ in range(n):
        x *= 2
        x %= MOD
    answer += x

print(answer%MOD)
### BUGGY CODE ###

def bit_add(bit, i, x):
    i += 1
    n = len(bit)
    while i <= n:
        bit[i - 1] += x
        i += i & -i


def bit_sum(bit, i):
    result = 0
    i += 1
    while i > 0:
        result += bit[i - 1]
        i -= i & -i
    return result


def main():
    from sys import stdin
    from builtins import int, list, map, range
    readline = stdin.readline
    N, D, A = map(int, readline().split())
    XH = []
    for _ in range(N):
        X, H = map(int, readline().split())
        H = (H + A - 1) // A
        XH.append((X, H))

    XH.sort()
    result = 0
    bit = [0] * (N + 1)
    for i in range(N):
        x, h = XH[i]
        h -= bit_sum(bit, i)
        if h <= 0:
            continue
        result += h
        bit_add(bit, i, h)

        t = x + 2 * D
        ok = i
        ng = N
        while ng - ok != 1:
            m = ok + (ng - ok) // 2
            if XH[m][0] <= t:
                ok = m
            else:
                ng = m
        bit_add(bit, ng, -h)
    print(result)


main()


### FIXED CODE ###

N, D, A = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]

XH.sort()
q = []
t = 0
result = 0
for x, h in XH:
    while True:
        if len(q) == 0:
            break
        if x <= q[0][0]:
            break
        t -= q[0][1]
        q.pop(0)
    h -= t
    if h < 0:
        continue
    c = (h + A - 1) // A
    result += c
    t += c * A
    q.append((x + 2 * D, c * A))
print(result)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
od = []
for i in range(n):
    od.append(a.index(i+1)+1)
for i in range(n):
    if i != n-1:
        print(od[i], end=' ')
    else:
        print(od[i])

### FIXED CODE ###

import heapq as hq

n = int(input())
a = list(map(int, input().split()))
b = [i for i in range(1, n+1)]
p = list(zip(a, b))

q = []
hq.heapify(q)
for i in range(len(p)):
    hq.heappush(q, p[i])

while len(q) != 0:
    print(q[0][1], end=' ')
    hq.heappop(q)
### BUGGY CODE ###

n = int(input())
adjacency_list = [list(map(int, input().split())) for i in range(n)]
egde = []
for u in range(n):
    for v in range(u):
        egde.append([adjacency_list[u][v], u, v])
egde.sort()

ans = 0
for d, u, v in egde:
    for w in range(n):
        d2 = adjacency_list[u][w] + adjacency_list[w][v]
        if d == d2:
            if w == u or w == v:
                continue
            break
        elif d > d2:
            print(-1)
            exit()
    else:
        ans += d

print(ans)

### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline
n = int(input())
G = np.array([list(map(int, input().split())) for _ in range(n)], dtype=float)
use = np.ones((n,n),dtype=bool)
impossible = np.zeros((n,n),dtype=bool)
for w in range(n):
    D = sum(np.meshgrid(G[w], G[w]))
    D[w] = np.inf
    D[:,w] = np.inf
    use &= ~(G == D)
    impossible |= G > D
if impossible.any():
    print(-1)
else:
    print(int(np.sum(G[use]) / 2))
### BUGGY CODE ###

# input
n, q = map(int, raw_input().split())
procs = [raw_input().split() for i in xrange(n)]

# procsessing
cnt, lack = 0, 1
while lack > 0:
    lack = 0
    for i in xrange(n):
        t = int(procs[i][1])
        if t == 0:
            continue
        if t <= q:
            cnt += t
            t = 0
            print procs[i][0], cnt
        else: # t >= q
            cnt += q
            t = t - q
            lack += t
        procs[i][1] = str(t)

### FIXED CODE ###

# input
n, q = map(int, raw_input().split())
procs = [raw_input().split() for i in xrange(n)]
procs = list(reversed(procs))

# procsessing
cnt, lack = 0, 1
while lack > 0:
    lack = 0
    tprocs = []
    for i in xrange(n):
        proc = procs.pop()
        t = int(proc[1])
        if t <= q:
            cnt += t
            print proc[0], cnt
            n -= 1
        else: # t > q
            cnt += q
            t = t - q
            lack += t
            proc[1] = str(t)
            tprocs.append(proc)
    procs = list(reversed(tprocs))
### BUGGY CODE ###

s = list(input())
x,y = map(int,input().split())
i = 0
while i < len(s) and s[i] == "F":
    i += 1
    x -= 1

l = []
r = []
check = 1
count = 0
while i < len(s):
    if s[i] == "T":
        if count >0:
            if check == 1:
                l.append(count)
            else:
                r.append(count)
        check *= -1
        count = 0
    else:
        count += 1
    i += 1

if count >0:
    if check == 1:
        l.append(count)
    else:
        r.append(count)       

    
if abs(x) > sum(l) or abs(y) > sum(r):
    print("No")
    exit() 

dpx = [[0]*(sum(l)*2+3) for i in range(len(l)+1)]
lx = sum(l)*2+3
dpx[0][sum(l)] = 1
for i in range(len(l)):
    for j in range(lx):
        if dpx[i][j] == 1:
            dpx[i+1][j+l[i]] = 1
            dpx[i+1][j-l[i]] = 1

dpy = [[0]*(sum(r)*2+3) for i in range(len(r)+1)]
rx = sum(r)*2+3
dpy[0][sum(r)] = 1
for i in range(len(r)):
    for j in range(rx):
        if dpy[i][j] == 1:
            dpy[i+1][j+r[i]] = 1
            dpy[i+1][j-r[i]] = 1
if dpx[-1][sum(l)+x] == 1 and dpy[-1][sum(r)+y] == 1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = list(input())
x,y = map(int,input().split())
i = 0
while i < len(s) and s[i] == "F":
    i += 1
    x -= 1

l = []
r = []
check = 1
count = 0
while i < len(s):
    if s[i] == "T":
        if count >0:
            if check == 1:
                l.append(count)
            else:
                r.append(count)
        check *= -1
        count = 0
    else:
        count += 1
    i += 1

if count >0:
    if check == 1:
        l.append(count)
    else:
        r.append(count)       

    
if abs(x) > sum(l) or abs(y) > sum(r):
    print("No")
    exit() 

dpx = [[0]*(sum(l)*2+3) for i in range(len(l)+1)]
lx = sum(l)*2+3
dpx[0][sum(l)] = 1
for i in range(len(l)):
    for j in range(lx):
        if dpx[i][j] == 1:
            dpx[i+1][j+l[i]] = 1
            dpx[i+1][j-l[i]] = 1

dpy = [[0]*(sum(r)*2+3) for i in range(len(r)+1)]
rx = sum(r)*2+3
dpy[0][sum(r)] = 1
for i in range(len(r)):
    for j in range(rx):
        if dpy[i][j] == 1:
            dpy[i+1][j+r[i]] = 1
            dpy[i+1][j-r[i]] = 1
if dpx[-1][sum(l)+x] == 1 and dpy[-1][sum(r)+y] == 1:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
G = [[] for _ in range(N+1)]
for _ in range(M):
    A, B = map(int, input().split())
    G[A].append(B)

def dfs(v, o):
    if len(parents[v]) > 1:
        return []
    for c in G[v]:
        parents[c].add(v)

    ancestors.add(v)
    for c in G[v]:
        if c in ancestors - {o}:
            ancestors.remove(v)
            return []

    ret = []
    if any(c == o for c in G[v]):
        ret = [v]
    else:
        for c in G[v]:
            ret = dfs(c, o)
            if ret:
                ret.append(v)
                break

    ancestors.remove(v)
    for c in G[v]:
        parents[c].remove(v)
    return ret

for v in range(1, N+1):
    ancestors = set()
    parents = defaultdict(set)
    cand = dfs(v, v)
    if cand:
        print(len(cand))
        print(*cand, sep='\n')
        break
else:
    print(-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

N, M = map(int, input().split())
G = [[] for _ in range(N+1)]
for _ in range(M):
    A, B = map(int, input().split())
    G[A].append(B)

def dfs(v, o):
    for c in G[v]:
        if c == o:
            return [v]
    for c in G[v]:
        if visited[c]:
            continue
        visited[c] = True
        ret = dfs(c, o)
        if ret:
            return [v] + ret

for v in range(1, N+1):
    visited = [False] * (N+1)
    cur = dfs(v, v)
    if cur:
        break
else:
    print(-1)
    exit()

while True:
    cur_set = set(cur)
    unused = None
    for i in range(len(cur)):
        u, v = cur[i], cur[(i+1) % len(cur)]
        for c in G[u]:
            if c == v:
                continue
            elif c in cur_set:
                unused = (i, cur.index(c))
                break

    if not unused:
        break
    else:
        t, s = unused
        nxt = []
        i = s
        while i != t:
            nxt.append(cur[i])
            i = (i + 1) % len(cur)
        nxt.append(cur[t])
        cur = nxt

print(len(cur))
print(*cur, sep='\n')
### BUGGY CODE ###

N = int(input())
s = [''] * N
for i in range(N):
    tmp = sorted(input())
    s[i] = ''.join(tmp)
s.sort()
cnt = 0
index = 1
for i in range(0,N - 1,index):
    index = 1
    for j in range(i + 1, N):
        if s[i] == s[j]:
            cnt += 1
            index += 1
        else:
            break

print(cnt)

### FIXED CODE ###

N = int(input())
s = [''] * N
for _ in range(N):
    tmp = sorted(input())
    s[_] = ''.join(tmp)
tmp = sorted(s)
cnt = 1
index = 0
ansFlag = True
ans1 = 0
while ansFlag:
    cnt = 1
    for j in range(index + 1, N):
        if tmp[index] == tmp[j]:
            cnt += 1
            index += 1
        else:
            index += 1
            break

    tmp2 = 0
    for i in range(cnt, 0, -1):
        tmp1 = i - 1
        tmp2 += tmp1
        ans = tmp2
    ans1 += ans
    if index == (N - 1):
        ansFlag = False

print(ans1)
### BUGGY CODE ###

def main():
	H, W = map(int, input().split())
	S = [""]*H
	for i in range(H):
		S[i] = input()
	r = [[0 for _ in range(W)] for _ in range(H)]
	c = [[0 for _ in range(W)] for _ in range(H)]
	for i in range(H):
		for j in range(W):
			if S[i][j] == "#":
				continue
			r[i][j] = r[i][j-1]+1 if j > 0 else 1
		for j in range(W-2, -1, -1):
			if r[i][j+1] == 0 or r[i][j] == 0:
				continue
			r[i][j] = r[i][j+1]

	for j in range(W):
		for i in range(H):
			if S[i][j] == "#":
				continue
			c[i][j] = c[i-1][j]+1 if i > 0 else 1
		for i in range(H-2, -1, -1):
			if c[i+1][j] == 0 or c[i][j] == 0:
				continue
			c[i][j] = c[i+1][j]

	ans = 0
	for j in range(W):
		for i in range(H):
			ans = max(ans, c[i][j]+r[i][j]-1)
	print(ans)


if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	H, W = map(int, input().split())
	S = [""]*H
	for i in range(H):
		S[i] = input()
	r = [[0 for _ in range(W)] for _ in range(H)]
	c = [[0 for _ in range(W)] for _ in range(H)]
	for i in range(H):
		for j in range(W):
			if S[i][j] == "#":
				continue
			r[i][j] = r[i][j-1]+1 if j > 0 else 1
		for j in range(W-2, -1, -1):
			if r[i][j+1] == 0 or r[i][j] == 0:
				continue
			r[i][j] = r[i][j+1]

	for j in range(W):
		for i in range(H):
			if S[i][j] == "#":
				continue
			c[i][j] = c[i-1][j]+1 if i > 0 else 1
		for i in range(H-2, -1, -1):
			if c[i+1][j] == 0 or c[i][j] == 0:
				continue
			c[i][j] = c[i+1][j]

	ans = 0
	for j in range(W):
		for i in range(H):
			ans = max(ans, c[i][j]+r[i][j]-1)
	print(ans)


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

N,M=list(map(int,input().split()))
l=[[] for i in range(N)]
l_c=[0 for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
from collections import deque
def search(start):
   que=deque([start])
   after=deque([])
   while que:
      A=que.popleft()
      after.append(A)
      l_c[A]=1
      for i in l[A]:
         if i not in que and i not in after:
            que.append(i)
   return len(after)
ans=0
for i in range(N):
   if l_c[i] ==0:
      ans=max(ans,search(i))
   if ans>M//2+1:
      break
print(ans)

### FIXED CODE ###

N,M=list(map(int,input().split()))
l=[[] for i in range(N)]
l_c=[0 for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
from collections import deque
def search(start):
   cnt=1
   que=deque([start])
   l_c[start]=1
   while que:
      A=que.popleft()
      for i in l[A]:
         if l_c[i]==0:
            cnt+=1
            l_c[i]=1
            que.append(i)
   return cnt
ans=0
for i in range(N):
   if l_c[i] ==0:
      ans=max(ans,search(i))
print(ans)
### BUGGY CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
    if i ** 2 <= n:
        ans = i**2
print(ans)

### FIXED CODE ###

import math
n = int(input())
m = int(math.sqrt(n))
print(m ** 2)
### BUGGY CODE ###

class BIT:
    '''
    0-indexed
    '''
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)
        self.depth = n.bit_length()

    def _bitsum(self, i):
        ret = 0
        while i:
            ret += self.tree[i]
            i ^= i & -i
        return ret

    def bitsum(self, l, r=None): # [l, r)
        if r is None:
            return self._bitsum(l)
        else:
            return self._bitsum(r) - self._bitsum(l)

    def bitadd(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        return

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

def check(X):
  b = [0] + [(y>=X)*2 - 1 for y in a]
  for i in range(n):
    b[i+1] += b[i]
  c = min(b)
  b = [x-c for x in b] 
  bit = BIT(n + 10)
  ans = 0
  for x in b:
    ans += bit.bitsum(x+1)
    bit.bitadd(x, 1)
  return ans >= m

t = [max(a) + 1, min(a) - 1]
while t[0] - t[1] > 1:
  mid = (t[0] + t[1]) // 2
  t[check(mid)] = mid
print(t[1])

### FIXED CODE ###

class BIT:
    '''
    0-indexed
    '''
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)
        self.depth = n.bit_length()

    def _bitsum(self, i):
        ret = 0
        while i:
            ret += self.tree[i]
            i ^= i & -i
        return ret

    def bitsum(self, l, r=None): # [l, r)
        if r is None:
            return self._bitsum(l)
        else:
            return self._bitsum(r) - self._bitsum(l)

    def bitadd(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        return

n = int(input())
m = n * (n + 1) // 4
a = list(map(int, input().split()))
d = dict()
_a = sorted(set(a + [0]))
for i, x in enumerate(_a):
  d[x] = i
a = [d[x] for x in a]


def check(X):
  b = [0] + [(y>=X)*2 - 1 for y in a]
  for i in range(n):
    b[i+1] += b[i]
  c = min(b)
  b = [x-c for x in b] 
  bit = BIT(max(b) + 2)
  ans = 0
  for x in b:
    ans += bit.bitsum(x + 1)
    bit.bitadd(x, 1)
  return ans >= m

t = [len(_a), 0]
while t[0] - t[1] > 1:
  mid = (t[0] + t[1]) // 2
  t[check(mid)] = mid
print(_a[t[1]])
### BUGGY CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
l.append(0)
c = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    z = l[i]-l[j]
    if l[j+1] <= z:
      break
    else:
      a = j+1
      b = n+1
      while a+1 < b:
        m = (a+b)//2
        if l[m] > z:
          a = m
        else:
          b = m
      c += a-j
print(c)        
    

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
l.append(0)
c = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    z = l[i]-l[j]
    if l[j+1] <= z:
      break
    else:
      a = j+1
      b = n+1
      while a+1 < b:
        m = (a+b)//2
        if l[m] > z:
          a = m
        else:
          b = m
      c += a-j
print(c)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
def calc_expect(n):
    return (n+1) / 2


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

p_expect_list = list(map(calc_expect, p_list))

max_val = 0

for i in range(len(p_expect_list)):
    val = sum(p_expect_list[i:i+k])
    if val > max_val:
        max_val = val

print(max_val)


### FIXED CODE ###

# -*- coding: utf-8 -*-
def calc_expect(n):
    return (n+1) / 2


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

p_expect_list = list(map(calc_expect, p_list))

max_val = 0

res = [0] * len(p_expect_list)
res[0] = p_expect_list[0]
for i in range(len(res)-1):
    res[i+1] = res[i] + p_expect_list[i+1]

if (n == k):
    print(res[-1])
    exit()

for i in range(len(p_expect_list)-k):
    val = res[i+k]-res[i]
    if val > max_val:
        max_val = val

print(max_val)
### BUGGY CODE ###

n,x,y = map(int,input().split(' '))
cost = [0 for i in range(n - 1)]
for i in range(n - 1):
    for l in range(i + 1, n):
        result = min(abs(i - l),abs(i - x + 1) + 1 + abs(l - y + 1),abs(i - y + 1) + 1 + abs(l - x + 1))
        cost[result - 1] += 1
for per in cost:
    print(per)


### FIXED CODE ###

def main():
    n,x,y = map(int,input().split(' '))
    cost = [0 for i in range(n - 1)]
    for i in range(n - 1):
        for l in range(i + 1, n):
            result = min(abs(i - l),abs(i - x + 1) + 1 + abs(l - y + 1),abs(i - y + 1) + 1 + abs(l - x + 1))
            cost[result - 1] += 1
    for per in cost:
        print(per)

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

n, w = map(int, input().split())
lst = [[0,0]]
for _ in range(n):
    a, b = map(int, input().split())
    lst.append([a,b])
dp = [[0] * (w+1) for _ in range(n+1)]

for i in range(0, n):
    for sum_w in range(0, w+1):
        if sum_w  >= lst[i+1][0]:
            dp[i+1][sum_w] = max(dp[i][sum_w -  lst[i+1][0]] + lst[i+1][1], dp[i+1][sum_w])
        else:
            dp[i+1][sum_w] = max(dp[i][sum_w], dp[i+1][sum_w])
            
print(max(sum(dp, [])))


### FIXED CODE ###

ans = 0
n, w = map(int, input().split())
lst = [[0,0]]
for _ in range(n):
    a, b = map(int, input().split())
    lst.append([a,b])
dp = [[0] * (w+1) for _ in range(n+1)]

for i in range(0, n):
    for sum_w in range(0, w+1):
        if sum_w  >= lst[i+1][0]:
            dp[i+1][sum_w] = max(dp[i][sum_w -  lst[i+1][0]] + lst[i+1][1], dp[i][sum_w])
        else:
            dp[i+1][sum_w] = dp[i][sum_w]
        ans = max(ans, dp[i+1][sum_w])    
print(ans)
### BUGGY CODE ###

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

import numpy   
h,w,m=LI()
S=[[0]*w for i in range(h)]
for i in range(m):
    h,w=LI()
    S[h-1][w-1]=1
S=numpy.array(S)
now=0
ind_x=[]
ind_y=[]
Ssumx=[sum(i) for i in S]
SS=S.T
Ssumy=[sum(i) for i in SS]



mx=max(Ssumx)
for i,j in enumerate(Ssumx):
    if j==mx:
        ind_x.append((i,j))
my=max(Ssumy)
for i,j in enumerate(Ssumy):
    if j==my:
        ind_y.append((i,j))
ans=0
for x,numx in ind_x:
    for y,numy in ind_y:
        if S[x][y]==0:
            tmp=numx+numy
        else:
            tmp=numx+numy-1

            
        ans=max(ans,tmp)
        
print(ans)


### FIXED CODE ###

h,w,m=map(int,input().split())
a=[0]*h
b=[0]*w
hw=[]
for _ in range(m):
    hh,ww=map(int,input().split())
    hw+=((hh-1,ww-1)),
    a[hh-1]+=1
    b[ww-1]+=1
    
ma=max(a)
mb=max(b)

# x_ind=[i for i,j in enumerate(a) if j==ma]
# y_ind=[i for i,j in enumerate(b) if j==mb]



cnt=0
# sonzai suru

for i,j in hw:
    if a[i]==ma and b[j]==mb:cnt+=1

if cnt==a.count(ma)*b.count(mb):
    print(ma+mb-1)
else:
    print(ma+mb)