Harryxun/stf_run huggingface dataset:
N = int(input())
An = list(map(int, input().split()))

duplicate_list = [x for x in set(An) if An.count(x) > 1]

if duplicate_list:
    print('NO')
else:
    print('YES'

### FIXED CODE ###

N = int(input())
An = list(map(int, input().split()))
Bn = sorted(An)

y = -1
count = 0
for x in Bn:
    if x == y:
        count += 1
    y = x

if count == 0:
    print("YES")
else:
    print("NO")
N = int(input().strip())
A = list(map(int, input().strip().split()))
 
count = 0
 
for n in range(N):
  flg = True
  if A.count(A[n]) == 1:
    tmp = [a for a in A if a != A[n]]
    for m in tmp:
      if A[n]%m == 0: flg = False
  else: flg = False
  
  if flg == True: count += 1
    
print(count)

### FIXED CODE ###

l = list(map(int, input().strip().split()))

idx = None
for i in range(len(l)):
  if l[i] == 0:
    idx = i+1
print(idx)
def bubbleSort(A, N):
    s = 0
    flag = 0
    while flag == 0:
        flag = 1
        for j in range(N - 1, 0, -1):
            if A[j] < A[j - 1]:
                A[j], A[j - 1] = A[j - 1], A[j]
                flag = 0
                t += 1
    t = str(A[0])
    for i in range(1,N):
        t = t + " " + str(A[i])
    print(t)
    print(s)

n = int(input())
a = [int(i) for i in input().split()]

bubbleSort(a, n)

### FIXED CODE ###

def bubbleSort(A, N):
    s = 0
    flag = 0
    while flag == 0:
        flag = 1
        for j in range(N - 1, 0, -1):
            if A[j] < A[j - 1]:
                A[j], A[j - 1] = A[j - 1], A[j]
                flag = 0
                s += 1
    t = str(A[0])
    for i in range(1,N):
        t = t + " " + str(A[i])
    print(t)
    print(s)

n = int(input())
a = [int(i) for i in input().split()]

bubbleSort(a, n)
N=int(input())
mydict={"AC":0,"WA":0,"TLE":0,"RE":0}
for i in range(N):
  mydict[input()]+=1
printlist=["AC","WA","TLE","RE"]
for p in printlist:
  print("{} x {}".format(p,mydict[p])

### FIXED CODE ###

N=int(input())
data=[input() for _ in range(N)]
for d in ["AC","WA","TLE","RE"]:
  print("{} x {}".format(d,data.count(d)))
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
n,k=map(int,input().split())
for i in range(1,K+1):
    ans = cmb(n-k+1,i,mod)*cmb(k-1,i-1,mod)
    print(ans%mod)

### FIXED CODE ###

def cmb(n, r, mod):
    if (r<0 or r>n):
        return(0)
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2,N+1):
    g1.append(( g1[-1] * i ) % mod)
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
n,k=map(int,input().split())
for i in range(1,k+1):
    ans = cmb(n-k+1,i,mod)*cmb(k-1,i-1,mod)
    print(ans%mod)
N, M  = map(int, input().split())
A = [ input() for i in range(N)]
B = [ input() for i in range(M)]


def serch(x0, y0):
  for i in range(M):
    for j in range(M):
      if A[x0+i][y0+j] != B[i][j]:
        return False
  return True

if M > N:
  print('No')
  exit()

for b in B:
  for x in range(N):
    for y in range(N):
      if not serch(x,y):
        continue
      else:
        print('Yes')
        exit()
print('No')


### FIXED CODE ###

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


def serch(x0, y0):
  for i in range(M):
    for j in range(M):
      if x0+i >= N or y0+j >= N:
        return False
      if A[x0+i][y0+j] != B[i][j]:
        return False
  return True

if M > N:
  print('No')
  exit()


for x in range(N):
  for y in range(N):
    if not serch(x,y):
      continue
    else:
      print('Yes')
      exit()
print('No')
from operator import mul
from functools import reduce
import math

def permtest(n, k = 1):
    p = math.factorial(n) / math.factorial(n - k)
    return int(p)

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

for i in range(1,K+1):
    if i == 1:
        print(N-K+1)
    else:
        if K % i == 0:
            print(cmb(N-K+1,i)%(10 ** 9 + 7))
        else:
            print(permtest(N-K+1,i)%(10 ** 9 + 7))

### FIXED CODE ###

import math

def comb(n, k):
    return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def main():
    MOD = 10 ** 9 + 7
    N, K = map(int, input().split())
    for i in range(1,K+1):
        if i > N - K + 1:
            print(0)
            continue
        blue = comb(N-K+1,i) % MOD
        red = comb(K-1,i-1) % MOD

        ans = blue * red % MOD

        print(ans)
            

main()
a, b, c = list(map(int, input()))
 
if c >= a:
  c -= a
  b -= c
  print(0, b)
else:
  print(a-c, b)

### FIXED CODE ###

a, b, c = map(int, input().split(' '))
 
if c >= a:
  c -= a
  b = max(0, b-c)
  print(0, b)
else:
  print(a-c, b)
# -*- coding: utf-8 -*-
import sys

def main(argv):
  i = int(argv[0])
  if i >= 0 and 999 >= i:
    print('ABC')
  elif i > 999:
    print('ABD')
    
if __name__ == '__main__':
  main(sys.argv[1:])

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
    
if __name__ == '__main__':
  i = int(input())
  if i >= 0 and 999 >= i:
    print('ABC')
  elif i > 999:
    print('ABD')
mod = 1000000007

class combination():
    def __init__(self, n):
        self.fact = [1] * (n+1)
        self.ifact = [1] * (n+1)
        for i in range(1, n+1):
            self.fact[i] = self.fact[i-1]*i % mod
        self.ifact[n] = pow(self.fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            self.ifact[i-1] = self.ifact[i]*i % mod
    def comb(self, n, k):
        if k < 0 or k > n: return 0
        comb = self.fact[n]*self.ifact[k]*self.ifact[n-k] %mod
        return comb

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

comb = combination(n-k+5)
for i in range(1, k+1):
    print(comb.comb(n-k+1, i) * comb.comb(k-1, i-1) % mod)

### FIXED CODE ###

mod = 1000000007

class combination():
    def __init__(self, n):
        self.fact = [1] * (n+1)
        self.ifact = [1] * (n+1)
        for i in range(1, n+1):
            self.fact[i] = self.fact[i-1]*i % mod
        self.ifact[n] = pow(self.fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            self.ifact[i-1] = self.ifact[i]*i % mod
    def comb(self, n, k):
        if k < 0 or k > n: return 0
        comb = self.fact[n]*self.ifact[k]*self.ifact[n-k] %mod
        return comb

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

comb = combination(n)
for i in range(1, k+1):
    print(comb.comb(n-k+1, i) * comb.comb(k-1, i-1) % mod)
#coding:UTF-8

a,op,b = map(int,raw_input().split())
op = str(op)

while True:
    if op == '+':
        print a + b
    elif op == '-':
        print a - b
    elif op == '*':
        print a * b
    elif op == '/':
        print a / b
    else:
        break

### FIXED CODE ###

#coding:UTF-8

while True:
    a,op,b = map(str,raw_input().split())
    a = int(a)
    b = int(b)
    if op == '+':
        print a + b
    elif op == '-':
        print a - b
    elif op == '*':
        print a * b
    elif op == '/':
        print a / b
    else:
        break
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 22:28:26 2020

@author: Kanaru Sato
"""

s = input()
n = len(s)
dic = {}
mod = 2019
count = 0

for i in range(1,n+1):
    num = int(s[n-i:n])
    num %= mod
    if num in dic:
        dic[num] += 1
    if num not in dic:
        dic[num] = 1

ans = 0
for fact in dic:
    if fact != 0:
        ans += dic[fact]*(dic[fact]-1)/2

print(int(ans)+dic[0])

### FIXED CODE ###

s = list(map(int, list(input())))
n = len(s)

countdic = {}
mod = 2019

num = 0
d = 1
for i in range(1,n+1):
    num += s[n-i]*d
    num %= mod
    if num in countdic:
        countdic[num] += 1
    if num not in countdic:
        countdic[num] = 1
    d = (10*d)%mod

ans = 0
for key in countdic:
    ans += countdic[key]*(countdic[key]-1)//2

if 0 in countdic:
    ans += countdic[0]

print(ans)
N=int(input())
last = input()
wds = set([last])
res = "Yes"
for i in range(N-1):
    wd = input()
    if wd in wds or last[-1]!=wd[0]: 
        ans = "No"
        break
    last = wd
    wds.add(wd)
print(ans)

### FIXED CODE ###

def gcd(a, b):
    if a > b:
        a, b = b, a
    while a:
        a, b = b%a, a
    return b
N,x1 = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(x1)
xs.sort()
margin = [y-x for y,x in zip(xs[1:],xs[:-1])]
m = margin[0]
for x in margin[1:]:
    m = gcd(m,x)
print(m)
Y, M, D = list(map(int, input().split("/")))
s = ''.join([Y,M,D])

if int(s)>20190430:
    print("TBD")
else:
    print("Heisei")


### FIXED CODE ###

Y, M, D = map(str, input().split("/"))
s = ''.join([Y,M,D])

if int(s)>20190430:
    print("TBD")
else:
    print("Heisei")
N=int(input())
W=list(map(int,input().split()))
sum_W=sum(W)
half_W=sum_W/2
tmp=sum_W
for i in range(N):
  tmp-=W[i]
  if tmp<half_W:
    print(min(abs(sum_W-2*tmp),abs(sum_W-2*tmp+W[i])))
    break
  elif tmp=half_W:
    print(0)
    break

### FIXED CODE ###

N=int(input())
W=list(map(int,input().split()))
sum_W=sum(W)
half_W=sum_W/2
a=sum_W
b=0
for i in range(N):
  a-=W[i]
  b+=W[i]
  if a<=half_W:
    print(min(abs(a-b),abs(a-b+2*W[i])))
    break
import sys
def solve(stns, idx, mem):

    if idx >= len(stns) -1:
        return 0

    if idx in mem: 
        return mem[idx]

    if idx == len(stns) - 2: 
        #cant take more than one step
        final_step = abs(stns[idx] - stns[idx+1])
        mem[idx] = final_step
        return final_step
    else: 
        # step: i + 11
        step1 = solve(stns, idx + 1, mem) + abs(stns[idx] - stns[idx+1])
        # step: i + 2
        step2 = solve(stns, idx + 2, mem) + abs(stns[idx] - stns[idx+2])

        min_cost = min(step1, step2)
        mem[idx] = min_cost 

        return min_cost



def take_input():
    n = input()
    stns = [int(x) for x in input().strip().split()]



    # reader = (s.rstrip() for s in sys.stdin)
    # input = reader.__next__
    # sys.setrecursionlimit(1000000)
    # do magic here
    # n = int(input())
    # stns = [int(x) for x in input().split()]
    mem = {}
    res = solve(stns, 0, mem)
    print(res)

take_input()

### FIXED CODE ###

import sys
def solve(stns, idx, mem):

    if idx >= len(stns) -1:
        return 0

    if idx in mem: 
        return mem[idx]

    if idx == len(stns) - 2: 
        # can take only one step
        # print(idx)  
        # final_step = solve(stns, idx + 1, mem) + abs(stns[idx] - stns[idx+1])
        final_step = abs(stns[idx] - stns[idx+1])
        mem[idx] = final_step
        return final_step
    else: 
        # step: i + 11
        step1 = solve(stns, idx + 1, mem) + abs(stns[idx] - stns[idx+1])
        # step: i + 2
        step2 = solve(stns, idx + 2, mem) + abs(stns[idx] - stns[idx+2])

        min_cost = min(step1, step2)
        mem[idx] = min_cost 

        return min_cost



def take_input():
    # n = input()
    # stns = [int(x) for x in input().split(' ')]



    reader = (s.rstrip() for s in sys.stdin)
    input = reader.__next__
    sys.setrecursionlimit(1000000)
    # do magic here
    n = int(input())
    stns = [int(x) for x in input().split()]
    mem = {}
    res = solve(stns, 0, mem)
    print(res)

take_input()
# cook your dish here
D,g = map(int,input().split())
p = []
c = []

for i in range(D):
    x,y = map(int,input().split())
    p.append(x)
    c.append(y)

#print(p)

d = [0]
cnt = 0

while d[-1] < g:
    while p[-1] == 0:
        p.pop(len(p)-1)
        c.pop(len(p)-1)
    k = -1
    
    r = d[-1] + (len(p))*100
    for i in range(len(p)):
        if len(d) >= p[i] and p[i] != 0:
            w = d[len(d)-p[i]] + 100*(i+1)*p[i] + c[i]
 #           print(p[i],i,c[i],len(d),w)
            if w > r:
                r = w
                k = i
    if k == -1:
        cnt += 1
        
    else:
        p[-1] += cnt
        p[k] = 0
        cnt = 0
        
    d.append(r)

#print(d)
print(len(d)-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline

d,g = map(int,input().split())
p = []
s = []
for i in range(d):
    x,y = map(int,input().split())
    p.append(x)
    s.append(100*(i+1)*x+y)

ans = 10**10
for i in range(1<<(d+1)):
    cnt = 0
    res = 0
    tank = []
    for j in range(d):
        if (i>>j)&1 == 1:
            cnt += s[j]
            res += p[j]
        else:
            tank.append([100*(j+1),p[j]])
    if cnt >= g:
        ans = min(ans,res)
    else:
        while cnt < g and tank[-1][1] > 0:
            cnt += tank[-1][0]
            tank[-1][1] -= 1
            res += 1
        if cnt >= g:
            ans = min(ans,res)
print(ans)
import bisect
horigin,worigin,m = map(int,input().split())
dich = {}
dicw = {}
 
havew = {}
for _ in range(m):
    h,w = map(int,input().split())
    if h in dich:
        dich[h] += 1
        havew[h].append(w)
    else:
        dich[h] = 1
        havew[h] = [w]
    if w in dicw:
        dicw[w] += 1
    else:
        dicw[w] = 1
 
dichi = list(dich.items())
dichi.sort(reverse=True, key=lambda x:x[1])
dicwi = list(dicw.items())
dicwi.sort(reverse=True, key=lambda x:x[1])
 
# print(havew)
#
# print(dichi)
# print(dicwi)
 
hmax = dichi[0][1]
wmax = dicwi[0][1]
 
for hs in dichi:
    if hs[1] != hmax:
        break
    wlis = sorted(havew[hs[0]])
    for ws in dicwi:
        if ws[1] != wmax:
            break
        idx = bisect.bisect_left(wlis, ws[0])
        if ws[0] != wlis[idx]:
            print(hmax+wmax)
            exit()
print(hmax+wmax-1)
 


### FIXED CODE ###

import bisect
horigin,worigin,m = map(int,input().split())
dich = {}
dicw = {}
 
havew = {}
for _ in range(m):
    h,w = map(int,input().split())
    if h in dich:
        dich[h] += 1
        havew[h].append(w)
    else:
        dich[h] = 1
        havew[h] = [w]
    if w in dicw:
        dicw[w] += 1
    else:
        dicw[w] = 1
 
dichi = list(dich.items())
dichi.sort(reverse=True, key=lambda x:x[1])
dicwi = list(dicw.items())
dicwi.sort(reverse=True, key=lambda x:x[1])
 
# print(havew)
#
# print(dichi)
# print(dicwi)
 
hmax = dichi[0][1]
wmax = dicwi[0][1]
 
for hs in dichi:
    if hs[1] != hmax:
        break
    wlis = sorted(havew[hs[0]])
    for ws in dicwi:
        if ws[1] != wmax:
            break
        idx = bisect.bisect_left(wlis, ws[0])
        if idx >= len(wlis):
            print(hmax+wmax)
            exit()
        if ws[0] != wlis[idx]:
            print(hmax+wmax)
            exit()
print(hmax+wmax-1)
l = sorted(list(map((int, input().split()))))
ans = 0
if l[0]%2!=0 and l[1]%2!=0 and l[2]%2!=0:
    ans += l[0]*l[1]
print(ans)

### FIXED CODE ###

l = sorted(list(map(int, input().split())))
ans = 0
if l[0]%2!=0 and l[1]%2!=0 and l[2]%2!=0:
    ans += l[0]*l[1]
print(ans)
a, b = int(input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, *a = map(int, read().split())
ans = 1
mod = 10 ** 9 + 7
memo = [0, 0, 0]
for check in a:
    ans *= memo.count(check)
    ans %= mod
    memo[memo.index(check)] += 1
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
rbg = [-1, -1, -1]
ans = 1
mod = 10 ** 9 + 7

for A in a:
    ans *= rbg.count(A - 1)
    ans %= mod
    for i in range(3):
        if rbg[i] == A - 1:
            rbg[i] = A
            break

print(ans)
A = int(input())
B = int(input())
C = int(input())
K = int(input())

if K >= A:
    N = K - A
    all_number = 1*A

    if N == 0:
        print(all_number)

    elif N > B:
        N = N - B
        if N > C:
            all_number = all_number - 1 * C
            print(all_number)

        else:
            all_number = all_number - 1*N
            print(all_number)

    elif N <= B:
        print(all_number)
else:
    all_number = 1*K
    print(all_number)


### FIXED CODE ###

A, B, C, K = map(int,input().split())
if K <= A:
    print(K)
elif K <= A + B:
    print(A)
else:
    print(2*A + B - K)
def main():
    from itertools import accumulate as ac
    from bisect import bisect_left as bl
    from bisect import bisect_right as br
    from sys import stdin
    input=stdin.readline

    def b_search(a,b,value):
        while a+1<b:
            med=(a+b)//2
            if value(med):b=med
            else:a=med+1
        if value(a):return a
        else:return b
    
    n,q=map(int,input().split())
    a=list(map(int,input().split()))
    x=[int(input()) for _ in [0]*q]
    aac=[0]+list(ac(a))
    aac2=[0]+list(ac(a[(n+1)%2::2]))

    def check(k):
        dist=a[-k-1]-ini
        if dist<0:
            dist=abs(dist)
            b=br(a,ini+dist)-bl(a,ini-dist)-1
        else:
            b=br(a,ini+dist)-bl(a,ini-dist)
        return k>=b

    for i in x:
        ini=i
        t=(n-bl(a,ini))//2+2
        k=b_search(1,t,check)
        print(aac[-1]-aac[-k-1]+aac2[-k-1])
main()

### FIXED CODE ###

def main():
    from itertools import accumulate as ac
    from bisect import bisect_left as bl
    from bisect import bisect_right as br
    from sys import stdin
    input=stdin.readline

    def check(k):
        dist=a[-k-1]-ini
        if dist<0:
            dist=abs(dist)
            return k>=br(a,ini+dist)-bl(a,ini-dist)-1
        else:
            return k>=br(a,ini+dist)-bl(a,ini-dist)
    
    n,q=map(int,input().split())
    nn=n//2+1
    a=list(map(int,input().split()))
    x=[int(input()) for _ in [0]*q]
    ix=sorted([[i,j] for i,j in enumerate(x)],key=lambda x:x[1])
    ans=[0]*q
    aac=[0]+list(ac(a))
    aac2=[0]+list(ac(a[(n+1)%2::2]))
    k=nn

    for i,ini in ix:
        l=1
        u=k
        while l+1<u:
            med=(l+u)//2
            if check(med):u=med
            else:l=med+1
        if check(l):k=l
        else:k=u
        ans[i]=aac[-1]-aac[-k-1]+aac2[-k-1]
    for i in ans:
        print(i)
main()
n=list(input())
for i in n:
  if n[i] == '1':
    n[i] = '9'
  elif n[i] == '9':
    n[i] = '1'

print(int(''.join(n)))

### FIXED CODE ###

n=list(input())
for i in range(len(n)):
  if n[i] == '1':
    n[i] = '9'
  elif n[i] == '9':
    n[i] = '1'

print(int(''.join(n)))
a = int(input())
print("Bad" if a[0] == a[1] or a[1] == a[2] or a[2] == a[3] else "Good")

### FIXED CODE ###

a = input()
print("Bad" if a[0] == a[1] or a[1] == a[2] or a[2] == a[3] else "Good")
s=list(input())
k=int(input())
if s[0]=="1":
    print(s[1])
else:
    print(s[0])

### FIXED CODE ###

s=list(input())
k=int(input())
tmp=0
for i in s:
    ans=i
    if ans!="1":
        break
    else:
        tmp+=1
if tmp>=k:
    print("1")
else:
    print(ans)
a=int(input())
if a in ["AAA","BBB"]:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

s=input()
if s=="AAA" or s=="BBB":
  print("No")
else:
  print("Yes")
bases={
  'A':'T',
  'T':'A',
  'C':'G',
  'G':'C'
}

print(bases(input()))

### FIXED CODE ###

b=input()
bases={'A':'T', 'T':'A', 'C':'G', 'G':'C'}
print(bases[b])
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  ans=ans+1/a[i]
ans=1/ans
 print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0.0
for i in range(n):
  ans=ans+1.0/a[i]
ans=1.0/ans
print(ans)
pi = 3.14159265368979
r = int(input())
print('{} {}'.format(2*pi*r,pi*r*r))

### FIXED CODE ###

import math
r = float(input())
print('{} {}'.format(math.pi*r*r,2*math.pi*r))
N = int(input())
p =[]
max = 0

for i in range(N):
    a = int(input().split("\n"))
    p.append(a)
    if max < a :
        max = a
print(int(sum(p)-(int(max/2))))

### FIXED CODE ###

N = list(map(int,input().split()))
p = []
for i in range(N[0]):
  p.append(int(input()))
max = 0
sum = 0
for i in range(N[0]):
    sum += p[i]
    a = p[i]
    if max < a :
        max = a
print(int(sum-(int(max/2))))
a=input()
b=input()
c=a*b
d=c%2
if d==1:
  print('Odd')
else:
  print('Even')

### FIXED CODE ###

a, b=(int(i) for i in input().split())
c=a*b
if c%2==1:
  print('Odd')
else:
  print('Even')
n=int(input())
a=list(map(int,input().split()))
a.sort(list(set(a)))
b=list(map(int,input().split()))
b.sort(list(set(b)))
c=list(map(int,input().split()))
c.sort(list(set(c)))
def binary_search1(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]<=x:
      left=mid
    else:
      right=mid
  return right
def binary_search2(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]>=x:
      right=mid
    else:
      left=mid
  return left
ans=0
for i in range(len(b)):
  ans+=binary_search1(b[i],c)*binary_search2(b[i],a)
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
b=list(map(int,input().split()))
b.sort()
c=list(map(int,input().split()))
c.sort()
def binary_search1(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]<=x:
      left=mid
    else:
      right=mid
  return right
def binary_search2(x,sortedlist):
  left=-1
  right=len(sortedlist)
  while abs(right-left)>1:
    mid=(left+right)//2
    if sortedlist[mid]>=x:
      right=mid
    else:
      left=mid
  return left
ans=0
for i in range(len(b)):
  ans+=(len(c)-binary_search1(b[i],c))*(binary_search2(b[i],a)+1)
print(ans)
N = int(input())
A = [int(i) for i in input().split()]

sum = 0
ans = []

for b in range(int(-N / 2), int(N / 2)):
    for i in range(N):
        sum += abs(A[i] - (b + i))
    else:
        ans.append(sum)
        sum = 0

print(min(ans))



### FIXED CODE ###

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

B = [A[i] - (i + 1) for i in range(N)]

B.sort()

b = B[len(B) // 2]

ans = 0

for j in range(N):
    ans += abs(A[j] - (b + j + 1))

print(ans)
import sys
sys.setrecursionlimit(1000000)

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def combination(n,r,q):
    if r==1:
        return n%q

    return (n*combination(n-1,r-1,q)*modinv(r,q))%q

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

def main():
    i=_input()
    x,y=i[0],i[1]
    if (2*y-x)%3==0 or (2*x-y)%3==0:
        n=(2*y-x)/3
        m=(2*x-y)/3
        print(int(combination(n+m,n,1000000007)))
    else:
        print(0)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def combination(n,r,q):
    if r==0:
        return 1

    return ((n*combination(n-1,r-1,q)%q)*modinv(r,q))%q

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

def main():
    i=_input()
    x,y=i[0],i[1]
    if 2*y>=x and 2*x>=y and (2*y-x)%3==0 and (2*x-y)%3==0:
        n=(2*y-x)//3
        m=(2*x-y)//3
        print(int(combination(n+m,min(m,n),1000000007)))
    else:
        print(0)

if __name__ == "__main__":
    main()
N = int(input())
T = list(map(int, input().split())) 

M = int(input())        


ans = T
number = []
for _ in range(M):
    P, X = map(int, input().split())
    ans[P] = X
    number.append(sum(ans))
    ans = T

for i in number:
    print(i)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
M = int(input())
total = sum(A)
ans = []
for _ in range(M):
  p, x = map(int, input().split())
  ans.append(total+x - A[p-1])
for a in ans:
  print(a)