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

from collections import deque

H,W=map(int,input().split())
A=[input() for i in range(H)]
ans=0
V=[[0 for i in range(W)] for j in range(H)]

def bfs(q):
    tmp=deque(q)
    ch = [[False for i in range(W)] for j in range(H)]
    count = 0
    d=[[-1,0],[1,0],[0,-1],[0,1]]
    while tmp:
        x,y=tmp.popleft()
        for a,b in d:
            nx=x+a
            ny=y+b
            if 0<=nx<H and 0<=ny<W:
                if ch[nx][ny]!=True and A[nx][ny]==".":
                    V[nx][ny]=V[x][y]+1
                    ch[nx][ny]=True
                    tmp.append([nx,ny])
            else:
                continue
ju=[]
for i in range(H):
    for j in range(W):
        if A[i][j]=="#":
            ju.append([i,j])
bfs(ju)
for i in range(H):
    for j in range(W):
        if not A[i][j]=="#":
             ans=max(ans,V[i][j])
print(ans)



### FIXED CODE ###

from collections import deque

H,W=map(int,input().split())
A=[input() for i in range(H)]
ans=0
V=[[0 for i in range(W)] for j in range(H)]

def bfs(q):
    tmp=deque(q)
    ch = [[False for i in range(W)] for j in range(H)]
    count = 0
    d=[[-1,0],[1,0],[0,-1],[0,1]]
    while tmp:
        x,y=tmp.popleft()
        for a,b in d:
            nx=x+a
            ny=y+b
            if 0<=nx<H and 0<=ny<W:
                if ch[nx][ny]!=True and A[nx][ny]==".":
                    V[nx][ny]=V[x][y]+1
                    ch[nx][ny]=True
                    tmp.append([nx,ny])
            else:
                continue
ju=[]
for i in range(H):
    for j in range(W):
        if A[i][j]=="#":
            ju.append([i,j])
bfs(ju)
for i in range(H):
    for j in range(W):
        if not A[i][j]=="#":
             ans=max(ans,V[i][j])
print(ans)
### BUGGY CODE ###

import bisect
N = int(input())
numofcolor = 1
A = [0] * N
for i in range(N):
    A[i] = int(input())
listofmax = [A[0]]
lenoflistofmax = 1  # 実際のところnumofcolorと同じ値になる
for j in range(1, N):
    if bisect.bisect_left(listofmax, A[j]) == 0:
        numofcolor += 1
        lenoflistofmax += 1
        listofmax.insert(0, A[j])
    else:
        listofmax[bisect.bisect_left(listofmax, A[j]) - 1] = A[j]
print(numofcolor)


### FIXED CODE ###

import bisect
from collections import deque
de1 = deque()
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
de1.appendleft(A[0])
for j in range(1, N):
    if de1[0] >= A[j]:
        de1.appendleft(A[j])
    else:
        de1[bisect.bisect_left(de1, A[j]) - 1] = A[j]
print(len(de1))
### BUGGY CODE ###

A,B,C,K = map(int,input().split())
for i in range(K):
  a = B + C
  b = A + C
  c = A + B
  A = a
  B = b
  C = c
if A - B >= 10**18:
  print("Unfair")
else:
  print(A-B)

### FIXED CODE ###

A,B,C,K = map(int,input().split())
if K % 2 == 0:
  print(A-B)
else:
  print(B-A)
### BUGGY CODE ###

#https://atcoder.jp/contests/abc122/tasks/abc122_c
N,Q= map(int,input().split())
moji = str(input())
a_list = [i for i, x in enumerate(moji) if x == 'A']
Current_List =[]
for i in a_list:
    if i == N - 1:
        break
    elif moji[i+1] == "C":
        Current_List.append(i)

for i in range(Q):
    start,stop = map(int,input().split())
    print(len([j for j in Current_List if (j >=start-1) and (j < stop-1)]))


### FIXED CODE ###

N,K = map(int,input().split())
moji = str(input())
ans = [0]
for i in range(N-1):
    if moji[i] == "A" and moji[i+1] == "C":
        ans.append(ans[i]+1)
    else:
        ans.append(ans[i])

        
for i in range(K):
    st,sp = map(int,input().split())
    print(ans[sp-1]-ans[st-1])
### BUGGY CODE ###

def resolve():
    n,m,k=map(int,input().split())
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    A,B=[],[]
    A.append(0)
    B.append(0)
    x=0
    for i in range(n):
        x+=a[i]
        A.append(x)
    x=0
    for j in range(m):
        x+=b[j]
        B.append(x)
    ans=0
    for i in range(n+1):
        if A[i]>k:
            break
        else:
            for j in range(m+1):
                if A[i]+B[j]>k:
                    j-=1
                    break
            ans=max(ans,i+j)
    print(ans)

if __name__ == '__main__':
    resolve()

### FIXED CODE ###

def resolve():
    from bisect import bisect_right
    n,m,k=map(int,input().split())
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    A,B=[0],[0]
    x,y=0,0
    for i in range(n):
        x+=a[i]
        A.append(x)
    for j in range(m):
        y+=b[j]
        B.append(y)
    ans=0
    for i in range(n+1):
        if A[i]>k:
            break
        bi=bisect_right(B,k-A[i])-1
        ans=max(ans,i+bi)
    print(ans)

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

def solve():
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = tuple(map(int, f_i.readline().split()))
    
    ans = 0
    for i in range(60):
        cnt = sum((A_i >> i) & 1 for A_i in A)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()

### FIXED CODE ###

def solve():
    import numpy as np
    from sys import stdin
    f_i = stdin
    
    mod = 10 ** 9 + 7
    
    N = int(f_i.readline())
    A = np.array(f_i.readline().split(), dtype=np.int64)
    
    ans = 0
    for i in range(60):
        cnt = np.count_nonzero((A >> i) & 1)
        ans += (1 << i) * cnt * (N - cnt)
    
    print(ans % mod)

solve()
### BUGGY CODE ###

s=input()
q=int(input())
queryy=[]

for i in range(q):
    queryy.append(list(input().split()))
for query in queryy:
 #   print(query)
    if query[0]=="1":
        s=s[::-1]
    else:
        if query[1]=="1":
            s=str(query[2])+s
        else:
            s+=str(query[2])
print(s)
            



### FIXED CODE ###

def main():
    s=input()
    q=int(input())
    queryy=[]
    sent="a"
    back="a"
    for i in range(q):
        queryy.append(tuple(input().split()))
    check=-1
    for query in queryy:
    #   print(query)
        if query[0]=="1":
            check*=-1
        else:
            if query[1]=="1":
                if check==-1:
                    sent+=str(query[2])
                   # s=str(query[2])+s
                else:
                    back+=str(query[2])
                   # s+=str(query[2])
                    
            else:
                if check==-1:
                    back+=str(query[2])
                    #s+=str(query[2])
                else:
                    sent+=str(query[2])
                    #s=str(query[2])+s
   # print(type(sent))
    #if sent[0]=="1":
     #   sent=sent[1:]
    sent=sent[1:]
    sent=sent[::-1]   
    back=back[1:]

    if check==1:
        s=sent+s+back        
        print(s[::-1]) 
    else:
        s=sent+s+back
        print(s)

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

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

if x == 0:
    if k % 2 == 1:
        x = d

elif x > 0:
    i = 0
    while (d < x)&(i != k-1):
        x -= d
        i += 1
    if (k-i)%2 ==1:
        x -= d
else:
    i = 0
    while (-d > x)&(i != k-1):
        x += d
        i += 1
    if (k-i)%2 ==1:
        x += d

print(abs(x))

### FIXED CODE ###

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

if x == 0:
    if k % 2 == 1:
        x = d

elif x > 0:
    if x >= k*d:
        x -= k*d
    else:
        n = x//d
        x -= n*d
        k -= n

        if k%2 ==1:
            x -= d
else:
    if x <= -(k*d):
        x += k*d

    else:
        n = abs(x)//d
        x += n*d
        k -= n
        if k%2 ==1:
            x += d

print(abs(x))
### BUGGY CODE ###

S = input().rstrip()
Q = int(input().rstrip())
for _ in range(Q):
    l = input().rstrip()
    if l.startswith('1'):
        S = S[::-1]
    else:
        _, F, C = l.split()
        if F == '1':
            S = C + S
        else:
            S = S + C
print(S)


### FIXED CODE ###

S = input().rstrip()
Q = int(input().rstrip())
reversed = False
from collections import deque
q = deque()
q.extend(list(S))
for _ in range(Q):
    l = input().rstrip()
    if l.startswith('1'):
        reversed = False if reversed else True
    else:
        _, F, C = l.split()
        if F == '1':
            if reversed:
                q.append(C)
            else:
                q.appendleft(C)
        elif F == '2':
            if reversed:
                q.appendleft(C)
            else:
                q.append(C)
ret = ''.join(list(q)[::-1]) if reversed else ''.join(list(q))
print(ret)
### BUGGY CODE ###

N,K = [int(i) for i in input().split(' ')]
A = [int(i) for i in input().split(' ')]
 
where_li = []
pre = 0
for i in range(N):
	where_li.append(A[pre])
	pre = A[pre]-1

aa = sorted([x for x in set(where_li) if where_li.count(x) > 1], key=where_li.index)
if(len(aa)==0):
	indexes = [0,0]
else:
	indexes = [i for i, x in enumerate(where_li) if x == aa[0]]
where_li = where_li[:indexes[1]]
len_w = len(where_li)
mod_s = len_w-indexes[0]
if K<=len_w:
	print(where_li[K-1])
else:
	if (K-len_w)%mod_s==0:
		d = mod_s
	else:
		d = (K-len_w)%mod_s
	print(where_li[d-1+indexes[0]])

### FIXED CODE ###

N,K = [int(i) for i in input().split(' ')]
A = [int(i) for i in input().split(' ')]
 
where_li = []
pre = 0
for i in range(N):
	where_li.append(A[pre])
	pre = A[pre]-1

len_w = len(where_li)
a = where_li.index(A[pre])
mod_s = len_w-a
if K<=len_w:
	print(where_li[K-1])
else:
	if (K-len_w)%mod_s==0:
		d = mod_s
	else:
		d = (K-len_w)%mod_s
	print(where_li[d-1+a])
### BUGGY CODE ###

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

dp = [0] * N
for i in range(min(N,K)):
    dp[i] = abs(h[i]-h[0])

for i in range(K,N):
    dp[i] = dp[i-1] + abs(h[i]-h[i-1])
    dp[i] = min(dp[i-k] + abs(h[i]-h[i-k]) for k in range(1,K+1))

answer = dp[-1]
print(answer)

### FIXED CODE ###

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

dp = [0] * N
for i in range(min(N,K)):
    dp[i] = abs(h[i]-h[0])

for i in range(K,N):
    dp[i] = dp[i-1] + abs(h[i]-h[i-1])
    for j in range(2,K+1):
        dp[i] = min(dp[i-j] + abs(h[i]-h[i-j]),dp[i])

answer = dp[-1]
print(answer)
### BUGGY CODE ###

def sarch(listd, num):
    if listd[len(listd) - 1] == num:
        return 1
    return 0

N, M = map(int, input().split())
data = []
brige = []
for i in range(M):
    A, B = map(int, input().split())
    data.append([A, B])
    listdata = []
    for j in range(A, B):
        listdata.append(j)
    brige.append(listdata)


ans = []

keylist = [0 for i in range(M)]

for i in range(1, N + 1):
    for j in range(M):
        if keylist[j] != 1 and sarch(brige[j], i) == 1:
            ans.append(i)
            keylist[j] = 1
            for k in range(M):
                for l in brige[k]:
                    if l == i:
                        keylist[k] = 1
                        break
    

print(len(ans))


### FIXED CODE ###

N, M = map(int, input().split())
AB = []
for i in range(M):
    a, b = map(int, input().split())
    AB.append([b, a])
AB.sort()
for i in range(M):
    if i == 0:
       j = AB[i][0] - 1
       ans = 1
    else:
        if AB[i][1] <= j and j < AB[i][0]:
            1
        else:
            j = AB[i][0] - 1
            ans += 1

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

n = int(input())
a=list(map(int,input().split()))
a.sort(reverse = True)

from collections import deque
from collections import Counter as cnt

aaa = dict(cnt(a))

ans = []
a = deque(a)
while True:
    if len(a) <1:
        break
    i = a.pop()
    ans.append(i)
    b = deque()
    while len(a)>0:
        j = a.pop()
        if j%i !=0:
            b.appendleft(j)
    a = b.copy()




mans = 0
for i,v in aaa.items():
    if (i in ans) & (v == 1) :
        mans+=1

print(mans)

### FIXED CODE ###

n = int(input())

a=list(map(int,input().split()))
a.sort()

from collections import Counter as cnt
aaa = dict(cnt(a))

ma = max(a)
dp = [True for i in range(ma+1)]

for i in a:
    if dp[i]:
        mul = i*2
        while mul<=ma:
            dp[mul] =False
            mul += i

mans = 0
for i,v in aaa.items():
    if dp[i] & (v == 1) :
        mans+=1

print(mans)
### BUGGY CODE ###

import math
N, K = map(int, input().split())
A = sorted([(int(i), 1) for i in input().split()], key=lambda x: x[0])


for _ in range(K):
    L, T = A.pop(-1)
    A.append((L*T/(T+1), T+1))
    A.sort(key=lambda x: x[0])
print(math.ceil(A[-1][0]))


### FIXED CODE ###

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

OK = 10**12
NG = 0

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)
### BUGGY CODE ###

import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

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


ans = prod(a)

if ans > 10 ** 18:
  print(-1)

else:
  print(ans)



### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1

if all([i > 0 for i in a]):
  for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
      ans = -1
      break

  print(ans)

else:
  print(0)
### BUGGY CODE ###

L,R = map(int,input().split())
array = []
array2 = []
for i in range(L,R+1):
    if i%2019 not in array2:
        array2.append(i%2019)
for i in range(len(array2)):
    for j in range(len(array2)):
        if i < j:
            array.append((array2[i]*array2[j])%2019)
print(min(array))

### FIXED CODE ###

L,R = map(int,input().split())
array = []
array2 = []
if R+1 - L <= 2019:
    for i in range(L,R+1):
        if i%2019 not in array2:
            array2.append(i%2019)

    for i in range(len(array2)):
        for j in range(len(array2)):
            if i < j:
                array.append((array2[i]*array2[j])%2019)
    print(min(array))
else:
    for i in range(1,2020):
        if i%2019 not in array2:
            array2.append(i%2019)

    for i in range(len(array2)):
        for j in range(len(array2)):
            if i < j:
                array.append((array2[i]*array2[j])%2019)
    print(min(array))
### BUGGY CODE ###

from sys import stdin


def get_result(data):
    N, X, Y = data
    min_dist = []
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            min_dist.append(min([j-i, abs(X-i) + 1 + abs(Y-j), abs(Y-i) + 1 + abs(X-j)]))
    for i in range(1, N):
        print(min_dist.count(i))


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    get_result(data)

### FIXED CODE ###

from sys import stdin


def get_result(data):
    N, X, Y = data
    dist_cnt = [0 for i in range(N)]
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            min_dist = min([j-i, abs(X-i) + 1 + abs(Y-j), abs(Y-i) + 1 + abs(X-j)])
            dist_cnt[min_dist] += 1
    for i in range(1, N):
        print(dist_cnt[i])


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    get_result(data)
### BUGGY CODE ###

N = int(input())
X = input()

arr = [0 for _ in range(N+1)]
for i in range(1, N+1):
    cnt = bin(i).count('1')
    arr[i] = arr[i%cnt] + 1

x = int(X, 2)
pop = X.count('1')
plu = x % (pop+1)
mai = x % (pop-1) if pop>1 else 0

for i in range(N):
    if X[i] == '0':
        res = (plu + pow(2, N-1-i) % (pop+1)) % (pop+1)
    else:
        if pop == 1:
            print(0)
            continue
        res = (mai - pow(2, N-1-i) % (pop-1)) % (pop-1)
    print(arr[res] + 1)

### FIXED CODE ###

N = int(input())
X = input()

arr = [0 for _ in range(N+1)]
for i in range(1, N+1):
    cnt = bin(i).count('1')
    arr[i] = arr[i%cnt] + 1

x = int(X, 2)
pop = X.count('1')
plu = x % (pop+1)
mai = x % (pop-1) if pop>1 else 0

#bi = 1 << N
for i in range(N):
    #bi = bi >> 1
    if X[i] == '0':
        #res = (plu + bi % (pop+1)) % (pop+1)
        res = (plu + pow(2, N-1-i, pop+1)) % (pop+1)
    else:
        if pop == 1:
            print(0)
            continue
        #res = (mai - bi % (pop-1)) % (pop-1)
        res = (mai - pow(2, N-1-i, pop-1)) % (pop-1)
    print(arr[res] + 1)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def tsum(l, r):
    return (r + l) * (r - l + 1) // 2

def exp(num):
    return tsum(1, num) / num

def solve():
    n, k = MI()
    P = LI()

    E = [0] * n
    for i in range(n):
        E[i] = exp(P[i])
    # print(E)

    _max = -1
    for i in range(n-k+1):
        e = E[i:i+k]
        _sum = sum(e)
        # print(e, _sum, i)
        if _max < _sum:
            _max = _sum

    print(_max)

if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def tsum(l, r):
    return (r + l) * (r - l + 1) // 2

def exp(num):
    return tsum(1, num) / num

def solve():
    n, k = MI()
    P = LI()

    E = [0] * n
    pre = 0
    for i in range(n):
        E[i] = pre + exp(P[i])
        pre = E[i]
    # print(E)

    p = E[0]
    mx = E[k-1]
    for j in range(k, n):
        diff = E[j] - E[j-k]
        # print(diff)
        if mx < diff:
            mx = diff
    print(mx)


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

import math


def sieve_of_eratosthenes(N):
    target_list = list(range(2, N+1))
    sqrt_N = math.sqrt(N)
    prime_list = []

    while True:
        min_ = min(target_list)
        if min_ >= sqrt_N:
            prime_list.extend(target_list)
            break
        prime_list.append(min_)
        i = 0
        while True:
            if i >= len(target_list):
                break
            elif target_list[i] % min_ == 0:
                target_list.pop(i)
            i += 1

    return prime_list


Q = int(input())
prime_list = sieve_of_eratosthenes(10**5)
a_list = [0]*10**5
for i in range(1, 10**5, 2):
    if i in prime_list and (i + 1) / 2 in prime_list:
        a_list[i] = 1
ans = 0
for _ in range(Q):
    l, r = map(int, input().split())
    ans += sum(a_list[l:r+1])
print(ans)

### FIXED CODE ###

def sieve_of_eratosthenes(N):
    prime_list = [True for _ in range(N + 1)]
    prime_list[0] = False
    prime_list[1] = False
    for p in range(2, int(N ** 0.5) + 1):
        if prime_list[p]:
            for i in range(2 * p, N + 1, p):
                prime_list[i] = False

    return prime_list


Q = int(input())
Max_ = 10**5
prime_list = sieve_of_eratosthenes(Max_)
count_list = [0]*(Max_+1)
count = 0
for i in range(Max_+1):
    if prime_list[i] and prime_list[(i + 1) // 2]:
        count += 1
    count_list[i] = count
for _ in range(Q):
    l, r = map(int, input().split())
    print(count_list[r] - count_list[l-1])
### BUGGY CODE ###

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

N,M = map(int,input().split())
d_to_LR = defaultdict(list)
for _ in range(N):
    L,R = map(int,input().split())
    d_to_LR[R-L+1].append((L,R))

tree = [0] * (M+1) # BIT で管理。左にあるLの個数 - (R+1)の個数 → いくつの[L,R]に入っているか
long = N # 長すぎて自動回収できる
answer = [0] * (M+1)

for m in range(1,M+1):
    for L,R in d_to_LR[m]:
        x = L
        while x <= M:
            tree[x] += 1
            x += x & (-x)
        x = R+1
        while x <= M:
            tree[x] -= 1
            x += x & (-x)
        long -= 1
    s = long
    for x in range(m,M+1,m):
        while x:
            s += tree[x]
            x -= x & (-x)
    answer[m] = s

print('\n'.join(map(str, answer[1:])))

### FIXED CODE ###

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

N,M = map(int,input().split())
d_to_LR = defaultdict(list)
for _ in range(N):
    L,R = map(int,input().split())
    d_to_LR[R-L+1].append((L,R))

def BIT_update(tree,x,value):
    while x <= M:
        tree[x] += value
        x += x & (-x)

def BIT_sum(tree,x):
    s = 0
    while x:
        s += tree[x]
        x -= x & (-x)
    return s

tree = [0] * (M+1) # BIT で管理。左にあるLの個数 - (R+1)の個数 → いくつの[L,R]に入っているか
long = N # 長すぎて自動回収できる
answer = [0] * (M+1)

for m in range(1,M+1):
    for L,R in d_to_LR[m]:
        BIT_update(tree,L,1)
        BIT_update(tree,R+1,-1)
        long -= 1
    answer[m] = sum(BIT_sum(tree,x) for x in range(m,M+1,m)) + long

print('\n'.join(map(str, answer[1:])))
### BUGGY CODE ###

n = int(input())
s_list = []
for i in range(n):
    s_list.append(input())

s_dic = {}
for i in range(n):
    if s_list[i] in s_dic:
        continue
    s_dic[s_list[i]] = s_list.count(s_list[i])

value_max = max(s_dic.values())
anser_list = []
for key,value in s_dic.items():
    if value == value_max:
        anser_list.append(key)

anser_list.sort()
for i in range(len(anser_list)):
    print(anser_list[i])



### FIXED CODE ###

n = int(input())
max_num = 0
s_dic = {}
for i in range(n):
    input_line = input()
    if input_line in s_dic:
        s_dic[input_line] = s_dic[input_line] + 1
    else:
        s_dic[input_line] = 1
    if s_dic[input_line] > max_num:
        max_num = s_dic[input_line]

anser_list = []
for key,value in s_dic.items():
    if value == max_num:
        anser_list.append(key)

anser_list.sort()
for key in anser_list:
    print(key)
### BUGGY CODE ###

import bisect
N,M = map(int,input().split())
A= list(map(int,input().split()))
A = sorted(A)

BC=[list(map(int,input().split())) for i in range(M)]
BC = sorted(BC, key=lambda x: x[1],reverse=True)

for B,C in BC:
    index = bisect.bisect_right(A,C)
    if index==0:
        break
    if index > B:
        A = A[B:index] + [C] *B + A[index:]
    else:
        A = [C]*index + A[index:]

print(sum(A))


### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():
    N,M = map(int,input().split())
    A= list(map(int,input().split()))
    A = sorted(A)

    BC=[list(map(int,input().split())) for i in range(M)]
    BC = sorted(BC, key=lambda x: x[1],reverse=True)
    index=0
    max_index=len(A)
    
    for B,C in BC:
        temp = [C]*B
        for t in temp:
            if max_index>index and  t>A[index]:
                A[index] = t
            else:
                return A
            index+=1
    return A
    
if __name__ == '__main__':
    A=main()
    print(sum(A))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
Created on Tue Dec 19 10:03:26 2017

@author: kotania
"""
N = int(input())
AList = [0]*N

for n in range(0,N):
    AList[n] = int(input())
  
PList = []
count = 0

for a in AList:
    if a not in PList:
        PList.append(a)
        count += 1
    else:
        PList.remove(a)
        count -= 1

print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Tue Dec 19 10:03:26 2017

@author: kotania
"""
from collections import Counter

N = int(input())
 
AList = []
 
count = 0
        
for n in range(0,N):
    AList.append(input())
    
countDict = Counter(AList)
countDictValues = countDict.values()

count = 0

for c in countDictValues:
    if c % 2 == 1 :
        count += 1

print(count)