Harryxun/stf_run huggingface dataset:
####################################################################
import sys
def _p(*_a):
  #return
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
####################################################################
def _pa(_aa):
  #return
  for _a in _aa: _p(_a)
####################################################################

HH,WW,MM = map(int, input().split())

H=[0] * HH
W=[0] * WW
M = [[0]*WW for i in range(HH)]

for _ in range(MM):
  h,w = map(int, input().split())
  M[h-1][w-1] += 1
  H[h-1] += 1
  W[w-1] += 1

hm = max(H)
wm = max(W)

# _p(hm,wm)
# _pa(M)

HI = [i for i, x in enumerate(H) if x == hm]
WI = [i for i, x in enumerate(W) if x == wm]

# _p(HI)
# _p(WI)

ans = 0
for h in HI:
  for w in WI:
    ans = max(ans, hm + wm - M[h][w])

print(ans)


### FIXED CODE ###

####################################################################
import sys
def _p(*_a):
  #return
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
####################################################################
def _pa(_aa):
  #return
  for _a in _aa: _p(_a)
####################################################################

HH,WW,MM = map(int, input().split())

H=[0] * HH
W=[0] * WW

from collections import defaultdict
d = defaultdict(int)

for _ in range(MM):
  nh,nw = map(int, input().split())
  h = nh - 1
  w = nw - 1
  d[h * 1000000 + w] = 1
  H[h] += 1
  W[w] += 1

hm = max(H)
wm = max(W)

# _p(hm,wm)
# _pa(M)

HI = [i for i, x in enumerate(H) if x == hm]
WI = [i for i, x in enumerate(W) if x == wm]

# _p(HI)
# _p(WI)

ans = hm + wm
for h in HI:
  for w in WI:
    if d[h * 1000000 + w] == 0:
      print(ans)
      exit()

print(ans-1)
from itertools import combinations

n = int(input())
d = list(map(int, input().split()))

comb = list(combinations(d, 2))
ans = 0

for i in range(len(d)):
    ans += comb[i][0] * comb[i][1]

print(ans)

### FIXED CODE ###

from itertools import combinations

n = int(input())
d = list(map(int, input().split()))

comb = list(combinations(d, 2))

ans = 0

for i in range(len(comb)):
    ans += comb[i][0] * comb[i][1]
    # print(ans, comb[i])

print(ans)
x, k, d = map(int, input().split())

lo = 0
hi = k

while (lo < hi) :
  mid = lo + (hi - lo) // 2 + 1
  if (x >= 0) :
    if (x - mid * d >= 0) : 
      lo = mid;
    else :
      hi = mid - 1
  else :
    if (x + mid * d <= 0) :
      lo = mid;
    else :
      hi = mid - 1;

x -= d * hi;
x = abs(x);
k -= hi;


if ( (k % 2) == 0):
  if (k == 0) :
    print(abs(x))
  else :
    print(min(abs(x), abs(x - d - d), abs(x + d + d));
else :
  print(min(abs(x - d), abs(x + d)))


### FIXED CODE ###

x, k, d = map(int, input().split())

lo = 0
hi = k

while (lo < hi) :
  mid = lo + (hi - lo) // 2 + 1
  if (x >= 0) :
    if (x - mid * d >= 0) : 
      lo = mid;
    else :
      hi = mid - 1
  else :
    if (x + mid * d <= 0) :
      lo = mid;
    else :
      hi = mid - 1;

if (x >= 0) :
  x -= d * hi
else :
  x += d * hi

k -= hi;

if ( (k % 2) == 0):
  if (k == 0) :
    print(abs(x))
  else :
    print(min(abs(x), abs(x - d - d), abs(x + d + d)));
else :
  if (k == 1) :
    print(min(abs(x - d), abs(x + d)))
  else :
    print(min(abs(x - d), abs(x + d), abs(x + d + d + d), abs(x - d - d - d)));
while True:
    try:
        a,b,c,d,e,f=map(int,raw_input().split())
        if a*d-b*c==0:
            print "not exist answer"
        else:
            x = (c*e-b*f) / (a*e-b*d)
            y = (a*f-c*d) / (a*e-b*d)
            print ('%.3f' % round(x,3), ('%.3f' % round(y,3))
    except:
        break

### FIXED CODE ###

while True:
    try:
        a,b,c,d,e,f=map(int,raw_input().split())
        if a*d-b*c==0:
            print "not exist answer"
        else:
            x = (float((c*e-b*f)) / (a*e-b*d))+0
            y = (float((a*f-c*d)) / (a*e-b*d))+0
            print ('%.3f' % round(x,3)), ('%.3f' % round(y,3))
    except:
        break
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [0]*(n)
def a(x):
  if x in l :
    return 0
  if x==1:
    return 1
  elif x==2 and ( 1 in l):
    return 1
  elif x ==2:
    return 2
  else:
    if memo[x-1]!=0:
      return memo[x-1]
    else:
      memo[x-1] = a(x-1)+a(x-2)
      return (a(x-1)+a(x-2))
print(a(n)%q)

### FIXED CODE ###

n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [-1]*(n+1)
memo[0]=1
su = 0
if 1 in l:
  memo[1]=0
else:
  memo[1]=1
for j in l:
  memo[j]=0
  
for i in range(2,n+1):
  if memo[i]==0:
    continue
  else:
    memo[i]=((memo[i-1]%q)+(memo[i-2]%q))%q
print(memo[-1]%q)
n = int(input())
nums = list(map(int, input().split()))

num_dvd = 0
 
can_devide = True
temp_list = []
while can_devide:
  for num in nums:
    if num % 2 == 1:
      can_devide = False
      print(num_dvd)
      break
    else:
      temp_list.append(num // 2)
  num_dvd += 1
  nums, temp_list = temp_list, []

### FIXED CODE ###

from collections import Counter
txt = input()

counter = Counter(txt)

print(counter['1'])
s=input()
s.sort()
ans = "NO"
if s[0]==s[1] and s[1]!=s[2] and s[2]==s[3]:
  ans="Yes"
print(ans)

### FIXED CODE ###

s=input()
h=set()
for i in range(0,len(s)):
	h.add(s[i])
if(len(h)==2):
	print("Yes")
else:
	print("No")
import sys
input = sys.stdin.readline

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ab = sorted(a+b for a in a for b in b)[:-k-1:-1]
abc = sorted(ab+c for ab in ab[:k] for c in c)[:-k-1:-1]

print(*abc, sep="\n")

### FIXED CODE ###

import sys
input = sys.stdin.readline

x,y,z,k = map(int,input().split())
lisa = sorted(map(int,input().split()))
lisb = sorted(map(int,input().split()))
lisc = sorted(map(int,input().split()))

ab = sorted(a+b for a in lisa for b in lisb)[:-k-1:-1]
abc = sorted(ab+c for ab in ab[:k] for c in lisc)[:-k-1:-1]

print(*abc, sep="\n")
N,T = [int(x) for x in input().split()]
ans =100000000
for i in range(N):
  c,t =[int(x) for x in input().split()]
  if t<=T:
    ans = min(c,ans)
if ans!=100000000
    print(ans)
else:
  print("TLE")

### FIXED CODE ###

N,T = [int(x) for x in input().split()]
ans =100000000
for i in range(N):
  c,t =[int(x) for x in input().split()]
  if t<=T:
    ans = min(c,ans)
if ans!=100000000:
  print(ans)
else:
  print("TLE")
import math


def func():
    N, init = map(int, input().split())
    x = list(map(int, input().split()))

    x.append(init)
    x.sort()

    ans = x[1] - x[0]
    for i in range(N):
        ans = math.gcd(ans, x[i+1] - x[i])

    print(ans)


if __name__ == '__main__':
    func()


### FIXED CODE ###

import fractions


def func():
    N, init = map(int, input().split())
    x = list(map(int, input().split()))

    x.append(init)
    x.sort()

    ans = x[1] - x[0]
    for i in range(N):
        ans = fractions.gcd(ans, x[i+1] - x[i])

    print(ans)


if __name__ == '__main__':
    func()
#始めの2匹が決まるとあとは自動的に決まるので矛盾していないかどうか判定

def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    N = int(input())
    s = list(input())
    s += s[0]

    def check(p):
        for i in range(1, N):
            if s[i]=='o' and p[i]=='S':
                p += p[i-1]
            elif s[i]=='o' and p[i]=='W':
                if p[i-1]=='S':
                    p += 'W'
                else:
                    p += 'S'
            elif s[i]=='x' and p[i]=='S':
                if p[i-1]=='S':
                    p += 'W'
                else:
                    p += 'S'
            else:
                p += p[i-1]
        if p[0]==p[N] and p[1]==p[N+1]:
            print(p[:-2])
            exit()

    for i in ['SS', 'SW', 'WS', 'WW']:
        check(i)
    print(-1)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    N = int(input())
    s = list(input())

    def check(p):
        for i in range(1, N):
            if s[i]=='o' and p[i]=='S':
                p += p[i-1]
            elif s[i]=='o' and p[i]=='W':
                if p[i-1]=='S':
                    p += 'W'
                else:
                    p += 'S'
            elif s[i]=='x' and p[i]=='S':
                if p[i-1]=='S':
                    p += 'W'
                else:
                    p += 'S'
            else:
                p += p[i-1]
        if p[0]==p[N]:
            if s[0]=='o' and p[0]=='S':
                if p[N-1]==p[1]:
                    print(p[:N])
                    exit()
            elif s[0]=='x' and p[0]=='S':
                if p[N-1]!=p[1]:
                    print(p[:N])
                    exit()
            elif s[0]=='o' and p[0]=='W':
                if p[N-1]!=p[1]:
                    print(p[:N])
                    exit()
            else:
                if p[N-1]==p[1]:
                    print(p[:N])
                    exit()

    for i in ['SS', 'SW', 'WS', 'WW']:
        check(i)
    print(-1)
    


if __name__ == '__main__':
    main()
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a.sort(reverse=True)
b.sort()
# xx=a[0]
f=0
# if xx<x:
#     xx=x 
for i in range(x+1,y+1):
    if i<=b[0] and i>a[0]:
        #print(i)
        f=1 
        break 
if f==1:
    print("No War")
else:
    print("War")

### FIXED CODE ###

l=list(map(int,input().split()))
l=sorted(l)
l=l[::-1]
s=str(l[0])
s+=str(l[1])
xx=int(s)
print(xx+l[-1])
asd = raw_input()
asdd = asd.split()
n = int(asdd[0])
m = int(asdd[1])
x=(m+1)/(n-1)
print (2*((m+1)*x-x*(n-1)*(x+1)/2)+m+1)%1000000007

### FIXED CODE ###

asd = raw_input()
asdd = asd.split()
n = int(asdd[0])
m = int(asdd[1])
if n == 1:
    print (m+1)%1000000007
    exit(0)

x=(m+1)/(n-1)
print (2*((m+1)*x-x*(n-1)*(x+1)/2)+m+1)%1000000007
s = input()
k = int(input())

if len(s) == 1:
  print(k // 2)
else:
  cnt = 0
  p = 1
  while p < len(s):
    if s[p-1] == s[p]:
      cnt += 1
      p += 1
    p += 1
      
  cnt2 = 0
  p2 = 1
  s2 = s + s
  while p2 < len(s2):
    if s2[p2-1] == s2[p2]:
      cnt2 += 1
      p2 += 1
    p2 += 1

  if 2*cnt < cnt2:
    print(k*cnt + (k - 1))
  else:
    print(k*cnt)
    
s = s*k

### FIXED CODE ###

s = input()
k = int(input())

if len(s) == 1:
  print(k // 2)
else:
  cnt = 0
  p = 1
  while p < len(s):
    if s[p-1] == s[p]:
      cnt += 1
      p += 1
    p += 1
      
  cnt2 = 0
  p2 = 1
  s2 = s + s
  while p2 < len(s2):
    if s2[p2-1] == s2[p2]:
      cnt2 += 1
      p2 += 1
    p2 += 1

  flg = 1
  for i in range(len(s)-1):
    if s[i] != s[i+1]:
      flg = 0
  
  if 2*cnt < cnt2:
    if flg == 1:
      print(k*cnt + (k//2))
    else:
      print(k*cnt + (k - 1))
  else:
    print(k*cnt)
a,b = map(int,input().split())
 
if a>b:
  print("GREATER")
  
elif a == b:
  print("EQUAL")
  
else:
  print("LESS")

### FIXED CODE ###

a = int(input())
b = int(input())
if a>b:
  print("GREATER")
  
elif a == b:
  print("EQUAL")
  
else:
  print("LESS")
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)

for i in range(len(X)):
    candi = Y[int(N/2)-1]
    if X[i] <= candi:
        print(Y[int(N/2)])
    else:
        print(Y[int(N/2)-1])

### FIXED CODE ###

# coding: utf-8

A, B, X = map(int, input().split())

if X >= A and X - A <= B:
    print('YES')
else:
    print('NO')
A,B,C,X = int(input() for i in range(4))
print([500*a+100*b+50*c for a in range(A+1) for b in range(B+1) for c in range(C+1)].count(X))

### FIXED CODE ###

A,B,C,X=[int(input()) for i in range(4)]
print([500*a+100*b+50*c for c in range(C+1) for b in range(B+1) for a in range(A+1)].count(X))
n = input()

m = int(n[1:])

if 1000-m != 1000:
    print(1000-m)
else:
    print(0)


### FIXED CODE ###

n = int(input())

pay = 0
while pay < n:
    pay += 1000

print(pay-n)
X,Y=map(int,input().split())
for i in range(X+1):
  if Y==2*i+4*(X-i):
    print('YES')
    exit()
print('NO')

### FIXED CODE ###

l=input().split()
for i in range(5):
  a = str(0)
  if l[i]==a:
    print(i+1)
n = int(input())
action = []
for i in range(n):
    action.append(list(map(int,input().split())))

memo = []
for i in range(n):
    memo.append([-1]*3)

def dp(i, a):
    if i == 0:
        return action[0][a]
    elif memo[i][a] != -1:
        return memo[i][a]
    else:
        memo[i][a] = max(dp(i-1, (a+1)%3), dp(i-1, (a+2)%3)) + action[i][a]
        return memo[i][a]

import sys
sys.setrecursionlimit(n*3)
print(max([dp(n-1,a) for a in range(3)]))


### FIXED CODE ###

n = int(input())
action = []
for i in range(n):
    action.append(list(map(int,input().split())))

memo = []
for i in range(n):
    memo.append([-1]*3)

def dp(i, a):
    if i == 0:
        return action[0][a]
    elif memo[i][a] != -1:
        return memo[i][a]
    else:
        memo[i][a] = max(dp(i-1, (a+1)%3), dp(i-1, (a+2)%3)) + action[i][a]
        return memo[i][a]

import sys
sys.setrecursionlimit(1000000)
print(max([dp(n-1,a) for a in range(3)]))
N, heights = input().split('\n')

N = int(N)
heights = map(int, heights.split(' '))

def solve_problem(N, heights):
    memory = {}

    def minimum_cost(N, heights):
        mem_key = str(N) + str(heights)
        if mem_key in memory: return memory[mem_key]
        if N == 1:
            return 0
        elif N == 2:
            return abs(heights[0] - heights[1])

        jump_one_cost = abs(heights[0] - heights[1]) + minimum_cost(N-1, heights[1:])
        jump_two_cost = abs(heights[0] - heights[2]) + minimum_cost(N-2, heights[2:])

        best_cost = min(jump_one_cost, jump_two_cost)
        memory[mem_key] = best_cost
        return best_cost
    
    return minimum_cost(N, heights)

print(solve_problem(N, heights))

### FIXED CODE ###

N = input() 
heights = input()

N = int(N)
heights = list(map(int, heights.split(' ')))

def solve_problem_dp(N, heights):
    if N == 1:
        return 0
    elif N == 2:
        return abs(heights[0] - heights[1])
    costs = [0] * len(heights)
    costs[1] = abs(heights[0] - heights[1])

    for i in range(2, len(heights)):
        cost_jump1 = abs(heights[i] - heights[i-1]) + costs[i-1]
        cost_jump2 = abs(heights[i] - heights[i-2]) + costs[i-2] 
        best_cost = min(cost_jump1, cost_jump2)
        costs[i] = best_cost
    
    return costs[-1]


print(solve_problem_dp(N, heights))
import Queue
blockpos = [[[0,0], [0,1], [1,0], [1,1], [2,0], [2,1], [3,0], [3,1]], [[0,0], [0,1], [0,2], [0,3], [1,0], [1,1], [1,2], [1,3]]]
dxy = [[0,1], [1,0], [0,-1], [-1,0]]
q = Queue.Queue()
W, H = 0, 0

def checker(xs, ys, xg, yg, field, color):
  if color == 0:
    return False
  global W, H
  x = xs
  y = ys
  while True:
    if x == xg and y == yg:
      return True
    for dx, dy in dxy:
      if x+dx < 1 or y+dy < 1 or x+dx > H or y+dx > W:
        continue
      if field[x+dx][y+dy] == color:
        field[x+dx][y+dy] = 0
        q.put([x+dx, y+dy])
    if q.empty():
      return False
    x, y = q.get()


while True:
  # input
  W, H = map(int, raw_input().split())
  if W==0 and H==0:
    break
  field = [[0 for i in range(W+1)] for j in range(H+1)]
  xs, ys = map(int, raw_input().split())
  xg, yg = map(int, raw_input().split())
  n = int(raw_input())
  for i in range(n):
    c, d, x, y = map(int, raw_input().split())
    for dx, dy in blockpos[d]:
      field[x+dx][y+dy] = c
  result = checker(xs, ys, xg, yg, field, field[xs][ys])
  if result:
    print "OK"
  else:
    print "NG"

### FIXED CODE ###

import Queue
blockpos = [[[0,0], [0,1], [1,0], [1,1], [2,0], [2,1], [3,0], [3,1]], [[0,0], [0,1], [0,2], [0,3], [1,0], [1,1], [1,2], [1,3]]]
dxy = [[0,1], [1,0], [0,-1], [-1,0]]
q = Queue.Queue()
W, H = 0, 0

def checker(xs, ys, xg, yg, field, color):
  if color == 0:
    return False
  global W, H
  x = xs
  y = ys
  while True:
    if x == xg and y == yg:
      return True
    for dx, dy in dxy:
      if x+dx < 1 or y+dy < 1 or x+dx > W or y+dy > H:
        continue
      if field[x+dx][y+dy] == color:
        field[x+dx][y+dy] = 0
        q.put([x+dx, y+dy])
    if q.empty():
      return False
    x, y = q.get()


while True:
  # input
  W, H = map(int, raw_input().split())
  if W==0 and H==0:
    break
  field = [[0 for i in range(H+1)] for j in range(W+1)]
  xs, ys = map(int, raw_input().split())
  xg, yg = map(int, raw_input().split())
  n = int(raw_input())
  for i in range(n):
    c, d, x, y = map(int, raw_input().split())
    for dx, dy in blockpos[d]:
      field[x+dx][y+dy] = c
  result = checker(xs, ys, xg, yg, field, field[xs][ys])
  if result:
    print "OK"
  else:
    print "NG"
N=int(input())
price=[int(input() for i in range(N)]
price.sort()
price[0]=price[0]//2
sum(price)

### FIXED CODE ###

N=int(input())
price=[int(input()) for i in range(N)]
price.sort(reverse=True)
price[0]=price[0]//2
a=sum(price)
print(a)
def c_pyramid(N, Pos):
    from itertools import product
    # 中心座標を全探索
    for cx, cy in product(range(101), repeat=2):
        height = set()
        for x, y, h in Pos:
            height.add(h + abs(cx - x) + abs(cy - y))
        if len(height) == 1:
            ans = (cx, cy, list(height)[0])
            break
    ans = '{0} {1} {2}'.format(*ans)
    return ans

N = int(input())
Pos = [[int(i) for i in input().split()] for j in range(N)]
print(c_pyramid(N, Pos))

### FIXED CODE ###

def c_pyramid(N, Pos):
    from itertools import product
    # 中心座標を全探索
    for cx, cy in product(range(101), repeat=2):
        # ピラミッドの高さを求める
        for x, y, h in Pos:
            if h > 0:
                height = h + abs(cx - x) + abs(cy - y)
        # ピラミッドの高さが得られた情報に適合するか調べる
        for x, y, h in Pos:
            if h != max((height - abs(cx - x) - abs(cy - y)), 0):
                break
        else:
            ans = [cx, cy, height]
            break
    ans = '{0} {1} {2}'.format(*ans)
    return ans

N = int(input())
Pos = [[int(i) for i in input().split()] for j in range(N)]
print(c_pyramid(N, Pos))
X = input()
Y = input()
Z = input()

X, Y = Y, X
Y, Z = Z, Y
print(X, Y, Z)

### FIXED CODE ###

X, Y, Z =map(int, input().split())
X, Y = Y, X
X, Z = Z, X


print(X, Y, Z)
n = int(input())
import sys
sys.setrecursionlimit(100000+1)
s = input()

ce = {}
#iより右に居て，東を向いている人の数
def counte(s,i):
    if i in ce:
        return ce[i]
    elif i == n-1:
        return 0
    else:
        ce[i] = counte(s,i+1) + s[i+1:i+2].count("E")
        return ce[i]

cw = {}
#iより←に居て，西を向いている人の数
def countw(s,i):
    if i in cw:
        return cw[i]
    elif i == 0:
        return 0
    else:
        cw[i] = countw(s,i-1) + s[i-1:i].count("W")
        return cw[i]

minew = n
for i in range(0,n):
    ew = counte(s,i)+countw(s,i)
    if ew < minew:
        minew = ew
print(minew)

### FIXED CODE ###

n = int(input())
import sys
sys.setrecursionlimit(1000000+1)
s = input()

ce = {}
#iより右に居て，東を向いている人の数
def counte(s,i):
    if i in ce:
        return ce[i]
    elif i == n-1:
        return 0
    else:
        ce[i] = counte(s,i+1) + s[i+1:i+2].count("E")
        return ce[i]

cw = {}
#iより←に居て，西を向いている人の数
def countw(s,i):
    if i in cw:
        return cw[i]
    elif i == 0:
        return 0
    else:
        cw[i] = countw(s,i-1) + s[i-1:i].count("W")
        return cw[i]

minew = n
for i in range(0,n):
    ew = counte(s,i)+countw(s,i)
    if ew < minew:
        minew = ew
print(minew)
def swap(x,y,z):
  x, y = y, x
  x, z = z, x
  
  print('%d %d %d' % (x,y,z))
  
 (x, y, z) = input()
 swap(x,y,z)

### FIXED CODE ###

def swap(x,y,z):
  x, y = y, x
  x, z = z, x
  
  print('%d %d %d' % (x,y,z))
  
val = list(input().split(' '))
x, y, z = [ int(x) for x in val ]
swap(x,y,z)
import itertools
import sys

input = sys.stdin.readline

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

ans = 0
a_cum = [0] + list(itertools.accumulate(a))
b_cum = [0] + list(itertools.accumulate(b))

y = m
for x in range(len(a_cum)):
    if a_cum[x] > k:
        break
    while b[y] > k - a[x]:
        y -= 1
    ans = max(ans, x + y)

print(ans)


### FIXED CODE ###

import itertools
import sys

input = sys.stdin.readline

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

ans = 0
a_cum = [0] + list(itertools.accumulate(a))
b_cum = [0] + list(itertools.accumulate(b))

y = m  # len(b_cum) - 1
for x in range(len(a_cum)):
    if a_cum[x] > k:
        break
    while b_cum[y] > k - a_cum[x]:
        y -= 1
    ans = max(ans, x + y)

print(ans)
import numpy as np
n = int(input())
a = []
b = []
c = []
for i in range(n):
  a_i, b_i = map(int,input().split())
  a.append(a_i)
  b.append(b_i)
  c.append(a_i+b_i)
c.sort(reverse=True)
k = int((n+1)/2)
print(np.sum(c[::2])-np.sum(b))

### FIXED CODE ###

import numpy as np
n = int(input())
a = []
b = []
c = []
for i in range(n):
  a_i, b_i = map(int,input().split())
  a.append(a_i)
  b.append(b_i)
  c.append(a_i+b_i)
c.sort(reverse=True)
k = int((n+1)/2)
print(np.sum(c[::2])-np.sum(b))
al = list(map(int, raw_input().split()))
al = sorted(al)
print(al[0],al[1],al[2])

### FIXED CODE ###

al = list(map(int, input().split()))
al = sorted(al)
print(al[0],al[1],al[2])
str_list = list(input())
min = 1000
for i in range(len(list)-2):
  str = str_list[i]+str_list[i+1]+str_list[i+2]
  dif = abs(int(str)-753)
  if dif < min:
    min = dif
print(min)

### FIXED CODE ###

str_list = list(input())
min = 1000
for i in range(len(str_list)-2):
  str = str_list[i]+str_list[i+1]+str_list[i+2]
  dif = abs(int(str)-753)
  if dif < min:
    min = dif
print(min)
n = int(input())
cnt =　0
for i in range(1,n+1):
  if i%2　==　1:
    cnt +=　1
print(cnt/n)

### FIXED CODE ###

N = int(input())
print((N-(N//2))/N)
import math
h,w,n=map(int,input().split())
print(math.ceil(n/max(h,w)))

### FIXED CODE ###

import math
h=int(input())
w=int(input())
n=int(input())
print(math.ceil(n/max(h,w)))
r, g, b = input().split()
num = r + g + b
print("YES" if num%4==0 else 'NO')

### FIXED CODE ###

r, g, b = input().split()
num = int(r + g + b)
print("YES" if num%4==0 else 'NO')
N = int(input())
N -= 1
ans = N * (1 + N) / 2
print(ans)

### FIXED CODE ###

S = input()
T = input()
ans = 0
for i in range(3):
    if S[i] == T[i]:
        ans += 1
print(ans)
from bisect import bisect_left
from collections import deque
 
N = int(input())
A = list(map(int, input().split(" ")))
A.sort()
A = deque(A)
ans = 0
t_max = len(bin(A[-1])) - 2
for t in range(t_max, 0, -1):
    if len(A) < 2: break
    pow2 = 1 << t
    A_tmp = deque()
    while t == len(bin(A[-1])) - 2:
        r = A.pop()
        idx = bisect_left(A, pow2 - r)
        for _ in range(idx):
            A_tmp.append(A.popleft())
        if len(A) == 0: break
        if A[0] + r == pow2:
            A.popleft()
            ans += 1
    A.extendleft(A_tmp)
                    
print(ans)

### FIXED CODE ###

from bisect import bisect_left, bisect_right
from collections import deque

N = int(input())
A = list(map(int, input().split(" ")))
A.sort()
A = deque(A)
ans = 0
t_max = len(bin(A[-1])) - 2
for t in range(t_max, 0, -1):
    if len(A) < 2: break
    while len(bin(A[-1])) - 2 > t:
        A.pop()
        if len(A) < 2: break
    if len(A) < 2: break
    pow2 = 1 << t
    A_tmp = deque()
    while t == len(bin(A[-1])) - 2:
        r = A.pop()
        idx = bisect_left(A, pow2 - r)
        for _ in range(idx):
            A_tmp.appendleft(A.popleft())
        if len(A) == 0: break
        if A[0] + r == pow2:
            A.popleft()
            ans += 1
        if len(A) < 2: break
    A.extendleft(A_tmp)
                    
print(ans)