Harryxun/stf_run huggingface dataset:
import math
import sys


def parse(file):
    n = int(file.readline())
    nums = map(int, file.readline().split())
    return n, nums


def main(n, nums):
    minimum_abs = math.inf
    negatives = 0
    ans = 0

    for num in nums:
        if num < 0:
            a = - num
            negatives += 1
        else:
            a = num

        if a < minimum_abs:
            minimum_abs = a
        ans += a

    if negatives % 2 == 1:
        ans -= minimum_abs * 2

    return ans


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

### FIXED CODE ###


import sys


def parse(file):
    n = int(file.readline().strip())
    nums = map(int, file.readline().split())
    return n, nums


def main(n, nums):
    minimum_abs = 1e20
    negatives = 0
    ans = 0

    for num in nums:
        if num < 0:
            a = - num
            negatives += 1
        else:
            a = num

        if a < minimum_abs:
            minimum_abs = a
        ans += a

    if negatives % 2 == 1:
        ans -= (minimum_abs * 2)

    return ans


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))
a,b,k = input().split()

for i in range(k):
  if a > 0:
    a-=1
  elif b > 0:
    b-=1

  print(a+b)

### FIXED CODE ###

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

if a>=k:
  print(a-k, b)
else:
  print(0, max(0, b-(k-a)))
a = input()
b = int(a.replace(' ', ''))

if abs(int(math.sqrt(b)) - math.sqrt(b)) < 10e-6 :
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import math

a = input()
b = int(a.replace(' ', ''))

if abs(int(math.sqrt(b)) - math.sqrt(b)) < 10e-6 :
    print('Yes')
else:
    print('No')
n,m = map(int,input().split())
height = list(map(int,input().split()))
lst = [0]*n
for j in range(m):
    x,y = map(int,input().split())
if height[x-1] >= height[y-1]:
    lst[y-1] = 1
if height[x-1] <= height[y-1]:
    lst[x-1] = 1
print(lst.count(0))

### FIXED CODE ###

s = input()
if s == "ABC":
  print("ARC")
else:
  print("ABC")
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if abs(B-A)/(V-W) <= T:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if W>=V:
  print("NO")
elif abs(B-A)/(V-W) <= T:
  print("YES")
else:
  print("NO")
n=int(input())
a=map(int,input().split())

ans=0
for i in range(n):
  if a.count(i)>i:
    ans+=a.count(i)-i
  elif a.count(i)<i:
    ans+=a.count(i)

print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
dict={}
for i in a:
  if i not in dict:
    dict[i]=1
  else:
    dict[i]+=1

ans=0
for i in dict.keys():
  count=dict[i]
  if count>i:
    ans+=count-i
  elif count<i:
    ans+=count

print(ans)
from itertools import combinations 
n,k=map(int,input().split())
m = (n-1)*(n-2)//2
if k>m:
    print(-1)
else:
    es = []
    for i in range(2,n+1):
        es.append((1,i))
        
    idx = 0
    for i,j in combinations(range(2,n+1),2):
        if idx == m-k:
            break
        es.append((i,j))
        idx +=1
for i,j in es:
    print(i,j)

### FIXED CODE ###

from itertools import combinations 
n,k=map(int,input().split())
m = (n-1)*(n-2)//2
if k>m:
    print(-1)
else:
    es = []
    for i in range(2,n+1):
        es.append((1,i))
        
    idx = 0
    for i,j in combinations(range(2,n+1),2):
        if idx == m-k:
            break
        es.append((i,j))
        idx +=1
    print(len(es))
    for i,j in es:
        print(i,j)
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None
S = None

def main():
    global S

    N = int(input())
    S = input()

    if N == 2:
        if S == "WE":
            print(1)
        else:
            print(0)
        sys.exit()

    E, W = [], []
    e, w = 0, 0

    for s in S:
        if s == "E":
            e += 1
        else:
            w += 1
        E.append(e)
        W.append(w)

    ans = min(ans, E[-1] - E[0 + 1])
    for leader in range(1, N):
        elif leader == N - 1:
            ans = min(ans, W[leader - 1])
        else:
            ans = min(ans, W[leader - 1] + E[-1] - E[leader + 1])

    print(ans)


main()


### FIXED CODE ###

import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None

def main():
    N = int(input())
    S = input()

    ans = S[1:].count("E")
    A = []
    A.append(ans)

    for i in range(1, N):
        if S[i - 1] == "W":
            ans += 1
        if S[i] == "E":
            ans -= 1
        A.append(ans)

    print(min(A))



main()
r,g,b = map(int,input().split())
n == r*100 + g*10 + b
if n % 4 == 0:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

r,g,b = map(int,input().split())
n = r*100 + g*10 + b
if n % 4 == 0:
    print('YES')
else:
    print('NO')
n=int(input())
a=list(map(int,input().split()))
ua=list(set(a))
d={}
total=0
for i in range(n):
    y=a[i]
    if y in d:
        print(d[y])
        continue
    if ua:
        for x in ua:
            c = a.count(x)
            if c==1:
                ua.remove(c)
            total+=sum(range(c - (1 if x==y else 0)))
        print(total)
        d[y]=total
        total=0
    else:
        print(0)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
d={}
for x in a:
    if d.get(x) is None:
        d[x]=1
        continue
    d[x]+=1
total=0
for v in d.values():
    total+=(v-1)*v//2
for x in a:
    print(total-d[x]+1)
N = int(input())
heights = numbers = map(int, input().split())


def can_get_ocean_view(subheights):
    return 1 if max(subheights) == subheights[-1] else 0


def count_hotels_with_ocean_view(heights):
    hotels_with_ocean_view = [can_get_ocean_view(heights[:i]) for i in range(1, len(heights)+1)]
    return sum(hotels_with_ocean_view)


print(count_hotels_with_ocean_view(heights))


### FIXED CODE ###

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


def can_get_ocean_view(subheights):
    return 1 if max(subheights) == subheights[-1] else 0


def count_hotels_with_ocean_view(heights):
    hotels_with_ocean_view = [can_get_ocean_view(heights[:i]) for i in range(1, len(heights)+1)]
    return sum(hotels_with_ocean_view)


print(count_hotels_with_ocean_view(heights))
import numpy as np

def divide(s):
    global ans
    left = 0
    top = 0
    right = s.shape[1] + 100
    btm = s.shape[0] + 100
    while left + 1 < right:
        if np.count_nonzero(s[:, :(left + right) // 2].ravel()) < np.count_nonzero(s[:, (left + right) // 2:].ravel()):
            left = (left + right) // 2
        else:
            right = (left + right) // 2
    
    while top + 1 < btm:
        if np.count_nonzero(s[: (top + btm) // 2].ravel()) < np.count_nonzero(s[(top + btm) // 2:].ravel()):
            top = (top + btm) // 2
        else:
            btm = (top + btm) // 2
            
    diff_1 = abs(np.count_nonzero(s[:, :left]) - np.count_nonzero(s[:, left:]))
    diff_2 = abs(np.count_nonzero(s[:top]) - np.count_nonzero(s[top:]))
   
    if diff_1 <= diff_2:
        ans += 1
        if np.count_nonzero(s[:, :left]) > K:
            divide(s[:, :left])
        if np.count_nonzero(s[:, left:]) > K:
            divide(s[:, left:])
    else:
        ans += 1
        if np.count_nonzero(s[:top]) > K:
            divide(s[:top])
        if np.count_nonzero(s[top:]) > K:
            divide(s[top:])
    
    return 0

if __name__ == "__main__":
    H, W, K = map(int, input().split())
    S = []
    for _ in range(H):
        S.append([int(s) for s in input()])
    S = np.array(S)
    ans = 0
    if np.count_nonzero(S.ravel()) <= K:
        print(ans)
        exit()
    divide(S)
    print(ans)

### FIXED CODE ###

from itertools import product
H, W, K = map(int, input().split())
G = [list(map(int, list(input()))) for _ in range(H)]

ans = float("inf")

for pattern in product([0, 1], repeat = H - 1):
    div = [0] + [i for i, p in enumerate(pattern, 1) if p == 1] + [H]
    rows = []
    for i in range(len(div) - 1):
        row = []
        for j in range(W):
            tmp = 0
            for k in range(div[i], div[i + 1]):
                tmp += G[k][j]
            row.append(tmp)
        rows.append(row)
        
    flag = True
    for row in rows:
        if [r for r in row if r > K]:
            flag = False
            break
    if not flag:
        continue

    tmp_ans = 0
    cnt = [0] * len(rows)
    w = 0

    while w < W:
        for r in range(len(rows)):
            cnt[r] += rows[r][w]
        if [c for c in cnt if c > K]:
            cnt = [0] * len(rows)
            tmp_ans += 1
            w -= 1
        w += 1
    
    tmp_ans += pattern.count(1)
    ans = min(ans, tmp_ans)

print(ans)
a=int(input())
if a%4==0:
 print("YES")
else:
 print("NO")

### FIXED CODE ###

a,b,c=map(int,input().split())
if (10*b+c)%4==0:
  print("YES")
else:
  print("NO")
import sys
input = sys.stdin.readline
#import math
#import numpy as np
N = int(input())
#= input()
#= map(int, input().split())
p = list(map(float, input().split()))
#= [input(), input()]
#= [list(map(int, input().split())) for _ in range(N)]
#= {i:[] for i in range(N)}

dp = [[0.0] * (N + 1) for _ in range(N + 1)]

dp[0][0] = 1

for i, p in enumerate(p, 1):
    pp = 1 - p
    dpij = dp[i][j]
    dpi = dp[i - 1]
    for j in range(i + 1):
        if j == 0:
            dpij = dpi[j] * pp
        elif j == i:
            dpij = dpi[j - 1] * p
        else:
            dpij = dpi[j - 1] * p + dpi[j] * pp

res = 0.0
n = N // 2 + 1

for cnt in dp[-1][n:]:
    res += cnt

print(res)

### FIXED CODE ###

#import
#import math
#import numpy as np
N = int(input())
#= input()
#= map(int, input().split())
p = list(map(float, input().split()))
#= [input(), input()]
#= [list(map(int, input().split())) for _ in range(N)]
#= {i:[] for i in range(N)}

dp = [[0.0] * (N + 1) for _ in range(N + 1)]

dp[0][0] = 1

for i, p in enumerate(p, 1):
    pp = 1 - p
    for j in range(i + 1):
        if j == 0:
            dp[i][j] = dp[i - 1][j] * pp
        elif j == i:
            dp[i][j] = dp[i - 1][j - 1] * p
        else:
            dp[i][j] = dp[i - 1][j - 1] * p + dp[i - 1][j] * pp

res = 0.0
n = N // 2 + 1

for cnt in dp[-1][n:]:
    res += cnt

print(res)
import sys
H, W, M = map(int, input().split())
hList = {i+1: 0 for i in range(H)}
wList = {i+1: 0 for i in range(W)}
pList = set()
#print(hList, wList, pList)
for _ in range(M):
  h, w = list(map(int, input().split()))
  #print(h, w)
  hList[h] += 1
  wList[w] += 1
  pList.add((h, w))
#print(hList, wList, pList)

maxHCount = max(hList.values())
maxHList = [h for h, count in hList.items() if count==maxHCount]


maxWCount = max(wList.values())
maxWList = [w for w, count in wList.items() if count==maxWCount]

#counterList = []
#for maxH in maxHList:
#  for maxW in maxWList:
#    counterList.append(hList[maxH] + wList[maxW] - (1 if ((maxH, maxW) in pList) else 0))
#print(max(counterList))
#print(max(((hList[maxH] + wList[maxW] - (1 if ((maxH, maxW) in pList) else 0)) for maxH in maxHList for maxW in maxWList)))
#print(max(((hList[maxH] + wList[maxW] - (1 if ((maxH, maxW) in pList) else 0)) for maxH in maxHList for maxW in maxWList)))

if M < len(maxHList)*len(maxWList):
	print(maxHCount + maxWList)
	sys.exit(0)

for maxH in maxHList:
  for maxW in maxWList:
    if (maxH, maxW) in pList:
      print(maxHCount + maxWList - 1)
      sys.exit(0)

print(maxHCount + maxWList)


### FIXED CODE ###

import sys
H, W, M = map(int, input().split())
hList = {i+1: 0 for i in range(H)}
wList = {i+1: 0 for i in range(W)}
pList = set()
#print(hList, wList, pList)
for _ in range(M):
  h, w = list(map(int, input().split()))
  #print(h, w)
  hList[h] += 1
  wList[w] += 1
  pList.add((h, w))
#print(hList, wList, pList)

maxHCount = max(hList.values())
maxHList = [h for h, count in hList.items() if count==maxHCount]


maxWCount = max(wList.values())
maxWList = [w for w, count in wList.items() if count==maxWCount]

#counterList = []
#for maxH in maxHList:
#  for maxW in maxWList:
#    counterList.append(hList[maxH] + wList[maxW] - (1 if ((maxH, maxW) in pList) else 0))
#print(max(counterList))
#print(max(((hList[maxH] + wList[maxW] - (1 if ((maxH, maxW) in pList) else 0)) for maxH in maxHList for maxW in maxWList)))
#print(max(((hList[maxH] + wList[maxW] - (1 if ((maxH, maxW) in pList) else 0)) for maxH in maxHList for maxW in maxWList)))

#if M < len(maxHList)*len(maxWList):
#	print(maxHCount + maxWCount)
#	sys.exit(0)

for maxH in maxHList:
  for maxW in maxWList:
    if (maxH, maxW) not in pList:
      print(maxHCount + maxWCount)
      sys.exit(0)

print(maxHCount + maxWCount - 1)
import itertools
from scipy.sparse.csgraph import floyd_warshall

N, M, R = map(int, input().split())
r = tuple(map(int, input().split()))

INF = 10**10

d = [[INF] * N for _ in range(N)]

for i in range(N):
    d[i][i] = 0

for _ in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    if d[a][b] > c:
        d[a][b] = c
        d[b][a] = c

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

d = froyd_warshall(d)


ans = INF
for p in itertools.permutations(r):
    dist = 0
    for i in range(R-1):
        dist += d[p[i]][p[i+1]]

    ans = min(ans, dist)

print(ans)

### FIXED CODE ###

import itertools
from scipy.sparse.csgraph import floyd_warshall

N, M, R = map(int, input().split())
r = tuple(map(int, input().split()))

INF = 10**10

d = [[INF] * N for _ in range(N)]

for i in range(N):
    d[i][i] = 0

for _ in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    if d[a][b] > c:
        d[a][b] = c
        d[b][a] = c

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

d = floyd_warshall(d)


ans = INF
for p in itertools.permutations(r):
    dist = 0
    for i in range(R-1):
        dist += d[p[i]-1][p[i+1]-1]

    ans = min(ans, dist)

print(int(ans))
S = input()
X = 0
for i in range(3):
    if A [i] == 7:
        X += 1
if X == 0:
    print('No')
else:
    print('Yes')


### FIXED CODE ###

import math
N = int(input())
if N%10 == 7:
  print("Yes")
elif (N-N%10)%100 == 70:
  print("Yes")
elif N-N%100 == 700:
  print("Yes")
else:
  print("No")
a, b = map(int, split.input())
print((a+b)%24)

### FIXED CODE ###

a, b = map(int, input().split())
print((a+b)%24)
NK = input().split('')
N = int(NK[0])
K = int(NK[1])
h_list = input().split('')
h_list = [int(x) for x in hlist]

# N=1
# K=500
# h_list=[499]

person = 0
for n in range(N):
    if h_list[n] >= K:
        person+=1
    
print(person)

### FIXED CODE ###

N, K = (int(i) for i in input().split())  
h_list = [int(i) for i in input().split()] 

person = 0
for n in range(N):
    if int(h_list[n]) >= K:
        person+=1
    
print(person)
S,T,U = input().split()
A,B = map(int,input()split())
if U == S:
  A -= A
else:
  B -= B
print(A,B)

### FIXED CODE ###

S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()
if S == U:
  A -= 1
else:
  B -= 1
print(A,B)
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=[]
for i in range(x):
  for j in range(y):
    ab.append(a[i]+b[j])
ab.sort(reverse=True)
ab=ab[:k]
abc=[]
for i in range(k):
  for j in range(z):
    abc.append(ab[i]+c[j])
abc.sort(reverse=True)
for i in range(k):
  print(abc[i])

### FIXED CODE ###

from heapq import nlargest
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=nlargest(k,(x+y for x in a for y in b))
abc=nlargest(k,(xy+z for xy in ab for z in c))
for i in abc:
  print(i)
import sys
N = int(input())

if len(N) <= 1:
    print('Good')
    sys.exit()

for i in range(1, len(N)):
    if N[i] == N[i-1]:
        print('Bad')
        sys.exit()

print('Good')

### FIXED CODE ###

import sys
N = input()

if len(N) <= 1:
    print('Good')
    sys.exit()

for i in range(1, len(N)):
    if N[i] == N[i-1]:
        print('Bad')
        sys.exit()

print('Good')
K = int(input())
S = input()
MOD = 10**9 + 7

length = len(S)
length_all = K + length
ans = 0
list_25 = [1] * (10**6 + 5)
list_26 = [1] * (10**6 + 5)
for i in range(1,10**6 + 5):
  list_25[i] = list_25[i - 1] * 25 % MOD
  list_26[i] = list_26[i - 1] * 26 % MOD
  
fact = [1] * (10**6 + 5)
fact_inv = [1] * (10**6 + 5)
inv = [1] * (10**6 + 5)
for i in range(1, 10**6 + 5):
  fact[i] = fact[i-1] * i % MOD
  fact_inv[i] = fact_inv[i - 1] * pow(i, MOD - 2, MOD) % MOD
for i in range(K + 1):
  ans += list_26[i] * list_25[K - i] % MOD * fact[length_all - i - 1] * fact_inv[length - 1] * fact_inv[K - i] % MOD

print(ans % MOD)

### FIXED CODE ###

K = int(input())
S = input()
MOD = 10**9 + 7

length = len(S)
length_all = K + length
ans = 0
list_25 = [1] * (10**6 + 5)
list_26 = [1] * (10**6 + 5)
for i in range(1,10**6 + 5):
  list_25[i] = list_25[i - 1] * 25 % MOD
  list_26[i] = list_26[i - 1] * 26 % MOD
  
fact = [1] * (2 * 10**6 + 5)
fact_inv = [1] * (2 * 10**6 + 5)
for i in range(1, 2 * 10**6 + 5):
  fact[i] = fact[i-1] * i % MOD
  fact_inv[i] = fact_inv[i - 1] * pow(i, MOD - 2, MOD) % MOD

for i in range(K + 1):
  ans += list_26[i] * list_25[K - i] % MOD * fact[length_all - i - 1] * fact_inv[length - 1] * fact_inv[K - i] % MOD

print(ans % MOD)
def main ():
  N = int(input())
  A = list(map(int,input().split()))
  prod = 1 
  
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
    print(-1)
  
  print(prod) 
 
main()

### FIXED CODE ###

def main ():
  N = int(input())
  A = list(map(int,input().split()))
  prod = 1 
  A.sort()
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  
  print(prod) 
 
main()
from statistics import mean
n = input()
x_s = list(map(int,input().split()))
point_x = int(format(mean(x_s), '.0f'))
sum_e = sum([(x - point_x) ** 2 for x in x_s])
print(sum_e)


### FIXED CODE ###

from statistics import mean
n = input()
x_s = list(map(int,input().split()))
point_x = int(format(mean(x_s), '.0f'))
sum_e = sum([(x - point_x) ** 2 for x in x_s])
print(sum_e)
import collections


n = int(input())

l = []
for i in range(n):
    xa,ya = map(int,input().split())
    l.append([xa,ya])

s = []
for i in range(n):
    for k in range(i+1,n):
        if (l[k][0]-l[i][0] > 0) == (l[k][1]-l[i][1] > 0):
            sign = 1
        else:
            sign = 0
        dist = ((l[k][0]-l[i][0]),(l[k][1]-l[i][1]),sign)
        s.append(dist)

#print(s)

c = collections.Counter(s)
print(n - c.most_common()[0][1])


### FIXED CODE ###

import collections


n = int(input())

l = []
for i in range(n):
    xa,ya = map(int,input().split())
    l.append([xa,ya])
if n == 1:
    print(1)
else:
    s = []
    for i in range(n):
        for k in range(i+1,n):
            xdis = l[k][0]-l[i][0]
            ydis = l[k][1]-l[i][1]
            if xdis < 0 and ydis < 0:
                xdis = xdis*(-1)
                ydis = ydis*(-1)
            if xdis < 0 and ydis == 0:
                xdis = xdis*(-1)
            if xdis < 0 and ydis >0:
                xdis = xdis*(-1)
                ydis = ydis*(-1)
            if xdis == 0 and ydis < 0:
                ydis = ydis*(-1)
            dist = (xdis,ydis)
            s.append(dist)

    #print(s)

    c = collections.Counter(s)
    #print(c)
    print(n - c.most_common()[0][1])
S = input()
T = input()

min = 100000
for i in range(len(S)) :
    for j in range(len(S),i-1,-1) :
        if (S[i:j] in T) :
            if (min > len(T) - len(S[i:j])) and (i >= T.index(S[i:j]) and j<=len(T)-T.index(S[i:j]) ) :
                min = len(T) - len(S[i:j])

print(min)

### FIXED CODE ###

D,T,S = map(int,input().split())
if (D/S <= T) :
    print("Yes")
else :
    print("No")
from operator import add
from functools import reduce

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

x = [list(map(int, input().split())) for i in range(r)]


import numpy as np


#x=[[3,4,5],[1,2,3]]
a=np.array(x)
#print(a)
b=reduce(add, a)
#print(b)
b=list(b)

#x=list(x[1])
x.append(b)

#print(x)

for i in range(len(x)):
    y = reduce(add,x[i])
    x[i].append(y)
    
    
z = [list(map(str,x[i])) for i in range(len(x))]

#print(z)

w = [' '.join(z[i]) for i in range(len(x))]

[print(w[i]) for i in range(len(w))]



### FIXED CODE ###

from operator import add
from functools import reduce

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

x = [list(map(int, input().split())) for i in range(r)]


#import numpy as np


#x=[[3,4,5],[1,2,3]]
#a=np.array(x)
#print(a)
#b=reduce(add, a)
#print(b)
#b=list(b)

#x=list(x[1])
#x.append(b)

#print(x)


b = []

for j in range(c):
    a = [x[i][j] for i in range(len(x))]
    b.append(reduce(add,a))

#print(b)

x.append(b)

for i in range(len(x)):
    y = reduce(add,x[i])
    x[i].append(y)
    
    
z = [list(map(str,x[i])) for i in range(len(x))]

#print(z)
#print(z)

w = [' '.join(z[i]) for i in range(len(x))]

[print(w[i]) for i in range(len(w))]
n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i+1])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for j in range(n):
    print(l_sorted[j][2])

### FIXED CODE ###

n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.append([s, int(p), i+1])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for j in range(n):
    print(l_sorted[j][2])
def get(text,n):
    ans = [""]*n
    i = 0
    for x in text:
        if x==" ":
            i = i + 1
        ans[i] = ans[i]+x
    return ans

hn = input()
H = int(get(hn,2)[0])
N = int(get(hn,2)[1])

a_text = input()
a = get(a_text,N)
for i in range(N):
    a[i] = int(a[i])

def max(a):
    m = a[0]
    k = 0
    for i in range(1,len(a)):
        if a[i] > m:
            m = a[i]
            k = i
    return [m,i]

m1 = max(a)[0]
k1 = max(a)[1]
a.pop(k1)
m2 = max(a)[0]

if m1 + m2 >= H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

def get(text,n):
    ans = [""]*n
    i = 0
    for x in text:
        if x==" ":
            i = i + 1
        ans[i] = ans[i]+x
    return ans

hn = input()
H = int(get(hn,2)[0])
N = int(get(hn,2)[1])

a_text = input()
a = get(a_text,N)

s = 0
for i in range(N):
    s = s +  int(a[i])

if s >= H:
    print("Yes")
else:
    print("No")
n,x=map(int,input().split())
a=list(map(int,input().split()))
ret=0
if a[0]>x:
  ret+=a[0]-x
  a[0]-=x
for i in range(1:n):
  if a[i]+a[i-1]>x:
    ret+=a[i]+a[i-1]-x
    a[i]=a[i]+a[i-1]-x
print(ret)

### FIXED CODE ###

n,x=map(int,input().split())
a=list(map(int,input().split()))
ret=0
if a[0]>x:
  ret+=a[0]-x
  a[0]-=a[0]-x
for i in range(n-1):
  if a[i+1]+a[i]>x:
    ret+=a[i+1]+a[i]-x
    a[i+1]-=a[i+1]+a[i]-x
print(ret)
n,k=map(int,input().split())
p=[int(i) for i in input().split()]


Msum=0
tmp=sum(p[0,k])

for i in range(1,n-k+1):
    a=p[i-1]
    b=p[i+k]
    tmp=tmp-a+b
    Msum = max(tmp,Msum)

print((Msum+k)/2)

### FIXED CODE ###

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


tmp=sum(p[0:k])
Msum=tmp

for i in range(1,n-k+1):
    a=p[i-1]
    b=p[i+k-1]
    tmp=tmp-a+b
    Msum = max(tmp,Msum)

print((Msum+k)/2)