Problem:


Score : 200 points

Problem Statement

Joisino is about to compete in the final round of a certain programming competition.
In this contest, there are N problems, numbered 1 through N.
Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N).

Also, there are M kinds of drinks offered to the contestants, numbered 1 through M.
If Joisino takes drink i(1≦i≦M), her brain will be stimulated and the time it takes for her to solve problem P_i will become X_i seconds.
It does not affect the time to solve the other problems.

A contestant is allowed to take exactly one of the drinks before the start of the contest.
For each drink, Joisino wants to know how many seconds it takes her to solve all the problems if she takes that drink.
Here, assume that the time it takes her to solve all the problems is equal to the sum of the time it takes for her to solve individual problems.
Your task is to write a program to calculate it instead of her.

Constraints

All input values are integers.

1≦N≦100

1≦T_i≦10^5

1≦M≦100

1≦P_i≦N

1≦X_i≦10^5

Input

The input is given from Standard Input in the following format:

N
T_1 T_2 ... T_N
M
P_1 X_1
P_2 X_2
:
P_M X_M

Output

For each drink, calculate how many seconds it takes Joisino to solve all the problems if she takes that drink, and print the results, one per line.

Sample Input 1

3
2 1 4
2
1 1
2 3

Sample Output 1

6
9

If Joisino takes drink 1, the time it takes her to solve each problem will be 1, 1 and 4 seconds, respectively, totaling 6 seconds.

If Joisino takes drink 2, the time it takes her to solve each problem will be 2, 3 and 4 seconds, respectively, totaling 9 seconds.

Sample Input 2

5
7 2 3 8 5
3
4 2
1 7
4 13

Sample Output 2

19
25
30



Sample input:
3
2 1 4
2
1 1
2 3


Sample output:
6
9

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
px=[]
for _ in range(m):
  p,x=map(int,input().split())
  px.append((p-1,x-1))
for i in range(m):
  ans=0
  p,x=px[i]
  for j in range(n):
    if j==p:
      ans+=x
    else:
      ans+=t[j]
  print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
    a,b=map(int,input().split())
    total=t
    total[a-1]=b
    print(sum(total))

Submission status: Wrong Answer

Solution code:
n = int(input())
p = list(map(int, input().split()))
k = int(input())
for i in range(k):
  a, b = map(int, input().split())
  p[a - 1] = b
  print(sum(p))

Submission status: Wrong Answer

Solution code:
num_prob = int(input())
prob = input()
new = prob.split()
sum = 0

for j in new:
  sum += int(j)

  
num_drinks = int(input())
for i in range(num_drinks):
  line = input()
  new_line = line.split()
  if int(new_line[1]) != int(new[int(new_line[0])-1]):
    temp = sum - int(new[int(new_line[0])-1]) + int(new_line[1])
    
  print(temp)

Submission status: Wrong Answer

Solution code:
num_prob = int(input())
prob = input()
new = prob.split()
sum = 0

for j in new:
  sum += int(j)

  
num_drinks = int(input())
for i in range(num_drinks):
  line = input()
  new_line = line.split()
  if int(new_line[1]) != int(new[int(new_line[0])-1]):
    sum -= int(new[int(new_line[0])-1])
    sum += int(new_line[1])
  print(sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
t = list(map(int, input().split()))
m = int(input())
p = [list(map(int, input().split())) for i in range(m)]

for i in range(m):
    time = t
    time[p[i][0] - 1] = p[i][1]
    print(sum(time))

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
cA = Counter(A)
mod = pow(10,9)+7
ans = pow(2,n//2)
for i in range(n//2+n%2):
    if i==0 and n%2==1:
        if cA[0] !=1:
            ans = 0
            break
    elif cA[2*i+1-n%2]!=2:
        ans = 0
        break
print(ans%mod)

Submission status: Wrong Answer

Solution code:
from collections import *
from itertools import *
from math import *
n=int(input())
a=sorted(list(map(int,input().split())))
b=list(Counter(a))
mod=7+10**9
if n%2==1:
    if a[0]!=0:
        print(0)
        exit()
    for i in range(1,n):
        if ceil(i/2)*2!=a[i]:
            print(0)
            exit()
    print(2**(n//2)%mod)
if n%2==0:
    for i in range(n):
        if floor(i/2)*2+1!=a[i]:
            print(0)
            exit()
    print(2**(n//2)%mod)

Submission status: Wrong Answer

Solution code:
n = int(input())
t = list(map(int,input().split()))
m = int(input())
p = []
x = []
for i in range(m):
    a,b = map(int,input().split())
    p.append(a)
    x.append(b)

for i in range(m):
    print(t)
    s = list(t)
    j = p[i] - 1
    s[j] = x[i]
    print(sum(s))

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n = I()
    t = Intl()
    m = I()
    px = [Intl() for i in range(m)]
    s = sum(t)
    ps = s
    print(s)
    for i in range(m):
        a,b = px[i][0],px[i][1]
        s -= t[a-1]
        s += b
        print(s)
        s -= b
        s += t[a-1]

Submission status: Wrong Answer

Solution code:
6
9

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int, input().split()))
m=int(input())
p=[]
x=[]
for i in range(m):
  a,b=map(int, input().split())
  p.append(a)
  x.append(b)
for i in range(m):
  time=0
  for j in range(n):
    if j==p[i]:
      time+=x[i]
    else:
      time+=t[j]
  print(time)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=list(map(int,input().split()))
k=int(input())
l=[]
for i in range(k):
    p,x=map(int,input().split())
    l.append(x+sum(s[:i])+sum(s[i+1:]))
    
for i in range(k):
    print(l[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
t = list(map(int, input().split()))
m = int(input())
drink = []
for i in range(m):
    drink = list(map(int, input().split()))
    gap = abs(len(drink) - len(t))*-1
    print(sum(drink + t[gap:]))

Submission status: Wrong Answer

Solution code:
import copy
n = int(input())
t = list(map(int,input().split()))
m = int(input())
for i in range(m):
    c_t = copy.deepcopy(t)
    p,x = list(map(int,input().split()))
    c_t[p-1]=x
    print(c_t)
    print(sum(c_t))

Submission status: Wrong Answer

Solution code:
n = int(input())
t = list(map(int, input().split()))
m = int(input())
px = [list(map(int, input().split())) for _ in range(m)]

sum_t = sum(t)
for i in range(m):
    print(min(sum_t, sum_t - t[px[i][0] - 1] +  px[i][1]))

Submission status: Wrong Answer

Solution code:
question_num = int(input())
question_resolve_time = list(map(int, input().split()))
drink_num = int(input())

drink_data = []
try:
    for i in range(0, question_num):
        a = list(map(int, input().split()))
        drink_data.append(a)
except EOFError:
    pass

not_drinking_time = sum(question_resolve_time)

for drink in drink_data:
    result_time = not_drinking_time - question_resolve_time[drink[0] - 1] + drink[1]
    print(result_time)

Submission status: Wrong Answer

Solution code:
question_num = int(input())
question_resolve_time = list(map(int, input().split()))
drink_num = int(input())

drink_data = []
try:
    for i in range(0, question_num):
        a = list(map(int, input().split()))
        drink_data.append(a)
except EOFError:
    pass

not_drinking_time = sum(question_resolve_time)

for drink in drink_data:
    result_time = not_drinking_time - question_resolve_time[drink[0] - 1] + drink[1]
    print(result_time)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int, input().split()))
M = int(input())
SUM = 0
for i in range(N):
    SUM = SUM + T[i]

for i in range(M):
    P,X = map(int, input().split())
    print(25-(T[P-1]-X))

Submission status: Wrong Answer

Solution code:
n = int(input())
t = [int(x) for x in input().split()]

m = int(input())

drink = []
for i in range(m):
    effect = [int(x) for x in input().split()]
    effect[0] -= 1
    drink.append(effect)
    
print(drink)
    
for i in range(m):
    score = sum(t) - t[drink[i][0]] + drink[i][1]
    print(score)

Submission status: Wrong Answer

Solution code:
#Beginner 050 B

N = int(input())
T = list(map(int,input().split()))
M = int(input())
PX = [input() for _ in range(M)]
print(PX)

for _ in range(M):
    PX[_] = list(map(int, PX[_].split()))
print(PX)

lst = []
for i in range(M):
    lst.append(sum(T) - T[PX[i][0]-1] + PX[i][1])
print(lst)

for j in range(M):
    print(lst[j])

Submission status: Wrong Answer

Solution code:
n = int(input())
t = [int(i) for i in input().split()]
m = int(input())
for j in range(m):
  p, x = map(int, input().split())
  t[p-1] = x
  print(sum(t))

Submission status: Wrong Answer

Solution code:
N=int(input())#問題数
tlst=list(map(int,input().split()))
initlst=tlst.copy()#1問にかかる時間
M=int(input())#ドリンクの数
for _ in range(M):
  P,x=map(int,input().split())#何個目が時間変わる
  tlst[P-1]=x
  print(sum(tlst))
  tlst=initlst
  #print(tlst)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int,input().split()))
M = int(input())

ans = []

for i in range(M):
    p,x = map(int,input().split())
    toi = []
    toi = T
    toi[p-1] = x
    ans.append(sum(toi))
    
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int,input().split()))
M = int(input())

ans = []

for i in range(M):
    p,x = map(int,input().split())
    toi = T
    toi[p-1] = x
    ans.append(sum(toi))
    
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
N = input()
T_list = list(map(int,input().split()))

M = input()

drink_list = []
for i in range(int(M)):
    drink_dict = {}
    P,X = map(int,input().split())
    drink_dict[P] = X
    drink_list.append(drink_dict)
print(drink_list)

for d in drink_list:
    for p in d.keys():
        sum_time = 0
        for i in range(1,len(T_list)+1):
            if p == i:
                sum_time += d[p]
            else:
                sum_time += T_list[i-1]
        print(sum_time)

Submission status: Wrong Answer

Solution code:
N = input()
T_list = list(map(int,input().split()))

M = input()

drink_dict = {}
for i in range(int(M)):
    P,X = map(int,input().split())
    drink_dict[P] = X

for p in drink_dict:
    sum_time = 0
    for i in range(1,len(T_list)+1):
        if p == i:
            sum_time += drink_dict[p]
        else:
            sum_time += T_list[i-1]
    print(sum_time)

Submission status: Wrong Answer

Solution code:
N=int(input())
T= list(map(int, input().split()))
F=T
M=int(input())
Ml=[]
for i in range(0,M):
    P=list(map(int, input().split()))
    Ml.append(P)

for i in range(0,M):
    s=Ml[i][0]-1
    F[s]=Ml[i][1]
    print(sum(F))
    F[s]=T[s]

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
numbers = set(a)

for i in range(n):
   if a.count(0)>=2 or a.count(i)>=3:
       print(0)
       exit(0)
if max(a)>(n-1):
    print(0)
    exit(0)

if n%2==1:
    if all(i%2==0 for i in a):
        print(1 if numbers==1 else (len(numbers)-1)**2%(10**9+7))
    else:
        print(0)
else:
    if all(i%2==1 for i in a):
        print((len(numbers))**2%(10**9+7))
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import copy
t=input()
qlist = list(map(int,input().split()))
hmd = int(input())
for i in range(hmd):
    drk=list(map(int,input().split()))
    alist = copy.copy(qlist)
    alist[drk[0]-1]=drk[1]
    print(alist)
    print(sum(alist))

Submission status: Wrong Answer

Solution code:
N = int(input())
Tlist = [int(N) for N in input().split()]
M = int(input())
PXlist = [[int(i) for i in input().split()]for j in range(M)]
def time_sum():
    s = 0
    for i in range(0,N):
        s = s+Tlist[i]
    return s
def time_cal():
    empty = []
    for i in range(0,M):
        empty.append(time_sum() - Tlist[PXlist[i][0]-1] + PXlist[i][1])
    return empty
print(time_sum)
for i in time_cal():
    print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
px = [list(map(int, input().split())) for _ in range(m)]

for i in range(m):
    t[px[i][0]-1]=px[i][1]
    print(sum(t))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
m = 10 ** 9 + 7
 
from collections import Counter
ca = Counter(a)
d = n % 2
if d == 1:
    z = ca.pop(0) if 0 in ca else 0
    if z != 1:
        print(0)
        exit()
 
for i in range(1 + d, n + d, 2):
    if ca[i] != 2:
        print(0)
        exit()
 
print(pow(2,n//2, m))

Submission status: Wrong Answer

Solution code:
#ABC050.B
N =int(input())
T = list(map(int,input().split()))
S = sum(T)
M = int(input())

for _ in range(M):
    p,x = map(int,input().split())
    S -= T[p-1]
    S += x
    print(S)

Submission status: Wrong Answer

Solution code:
n = int(input())
T = list(map(int, input().split()))
s = sum(T)
m = int(input())
for _ in range(m):
    p, x = map(int, input().split())
    sub = -x + T[p - 1]

Submission status: Wrong Answer

Solution code:
input1 = raw_input()

input2 = []
for str in raw_input().split():
    input2.append(int(str))

input3 = raw_input()

px_map = {}
for num in range(int(input3)):
    input4, input5 = raw_input().split()
    px_map[int(input4)] = int(input5)

for key, value in px_map.items():
    result = 0
    list1 = list(input2)
    list1[key - 1] = value
    for num in list1:
        result = result + num
    print result

Submission status: Wrong Answer

Solution code:
N = int(input())
time = list(map(int,input().split()))
M = int(input())
time_2 = time
for i in range(M):
    p, x = list(map(int,input().split()))
    time_2[p-1] = x
    ans = sum(time)
    print(ans)
    time_2[p-1] = time[p-1]

Submission status: Wrong Answer

Solution code:
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
M種類のうちの1個飲める
"""
#solution:
#潜 影 蛇 手 ! !
N=int(input())
T=list(pin())#問題iを解くのに本来必要な時間
M=int(input())
Drinks=sorted([tuple(pin()) for _ in range(M)])
p=[0]*N
for i in range (M):
    j=sum(T)
    print(j-T[Drinks[i][0]-1]+Drinks[i][1])

Submission status: Wrong Answer

Solution code:
x=int(input())
a=list(map(int,input().split()))
d=int(input())
n=0
A=a
j=[list(map(int,input().split())) for i in range(d)]
for T in range(d):
    s=j[n][0]
    A[s-1]=j[n][1]
    print(sum(A))
    n+=1
    A[s-1]=a[s-1]

Submission status: Wrong Answer

Solution code:
n,l=int(input()),list(input())
if n%2==0:
  f=all(l.count(l[i])==2 for i in range(n))
else:
  f=all(l.count(l[i])==2 for i in range(n) if l[i]!=0) and l.count(0)==1 
print(2**(n//2)%1000000007 if f==True else 0)

Submission status: Wrong Answer

Solution code:
n = int(input())
t = list(map(int, input().split()))
m = int(input())
p = [list(map(int, input().split())) for _ in range(m)]

lst = list(t)

for i in range(m):
    for j in range(n):
        if(p[i][0] == j):
            lst[j-1] = p[i][1]
            print(sum(lst))
            lst = list(t)

Submission status: Wrong Answer

Solution code:
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-1] = X
    number.append(sum(ans))
    ans = T

for i in number:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int,input().split()))
M = int(input())
print("N : {}, T : {}, M : {}".format(N,T,M))
for i in range(M):
  ans = 0
  p,x = map(int,input().split())
  for j in range(N):
    if j+1 == p:
      ans += x
    else:
      ans += T[j]
  print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
T=list(map(int,input().split()))
M=int(input())
Ans=sum(T)
for i in range(M):
  p,x=map(int,input().split())
  xx=Ans+x-T[p-1]
  print(x)

Submission status: Wrong Answer

Solution code:
import copy

N = int(input())
T = [int(i) for i in input().split()]
M = int(input())

P = []
X = []
for _ in range(M):
    p, x = [int(i) for i in input().split()]
    P.append(p)
    X.append(x)

print(P)
print(X)
for i in range(M):
    a = copy.deepcopy(T)
    a[P[i] - 1] = X[i]
    print(a)
    print(sum(a))

Submission status: Wrong Answer

Solution code:
n = int(input())
t = list(map(int, input().split()))
m = int(input())
p = list(list(map(int, input().split())) for _ in range(m))

for i in range(m):
    v = t
    v[p[i][0]-1] = p[i][1]
    print(sum(v))

Submission status: Wrong Answer

Solution code:
num = int(input())
time = list(map(int, input().split()))
drink = int(input())
eff = [list(map(int, input().split())) for i in range(drink)]

baseT = sum(time)
print(baseT)
for i in range(drink):
    print(baseT - time[eff[i][0]-1] + eff[i][1])

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int, input().split()))
M = int(input())
for i in range(M):
    P, X = map(int, input().split())
    print(sum(T) - (T[P-1] - X) + X)

Submission status: Wrong Answer

Solution code:
n = int(input())
t  = list(map(int, input().split()))
m = int(input())
problem = []
for _ in range(m):
  drink_p, drink_p_time = list(map(int, input().split()))
  problem.append(drink_p_time)
for drink_p, drink_p_time in enumerate(problem):
  res = 0
  for p, p_time in enumerate(t):
    if(p == drink_p):
      res += drink_p_time
    else:
      res += p_time
  print(res)

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for _ in range(m):
  i=t
  p,x=map(int,input().split())
  i[p-1]=x
  print(sum(i))

Submission status: Wrong Answer

Solution code:
def abc():
    input()
    t = input().rstrip().replace(' ', '')
    m = int(input())
    for i in range(m):
        l = list(t)
        p, x = map(int, input().split())
        l[p-1] = str(x)
        print(sum(map(int, l)))


abc()

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [0] + [int(x) for x in input().split()]
M = int(input())
s = sum(T)

answer = []
for _ in range(M):
  a,b = map(int,input().split())
  answer.append(s+b-T[a])

print(answer,sep='\n')

Submission status: Wrong Answer

Solution code:
N = int(input())
test = list(map(int,input().split()))
M = int(input()) 
  
for _ in range(M):
  a,b = map(int,input().split())
  test[a-1] = b
  print(sum(test))

Submission status: Wrong Answer

Solution code:
n = int(input())
t=list(map(int,input().split()))
m=int(input())
ans=0
for j in range(n):
    ans+=t[j]
for i in range(m):
    p,x=map(int,input().split())
    ans=ans-t[p-1]+x
    print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
T=list(map(int,input().split()))
m=int(input())
for i in range(m):
    p,k=map(int,input().split())
    T[p-1]=k
    print(sum(T))

Submission status: Wrong Answer

Solution code:
import copy
n = int(input())
times = [int(i) for i in input().split()]
m = int(input())
px = [input().split() for _ in range(m)]
n_times = copy.copy(times)
for p,x in px:
    n_times[int(p)-1] = int(x)
    print(sum(n_times))
    n_times = times

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int,input().split()))
M = int(input())
P_X = []
for i in range(M):
	P_X.append(list(map(int,input().split())))

temp_sum = sum(T)
print(temp_sum)
for i in range(M):
	print(temp_sum - T[P_X[i][0] - 1] + P_X[i][1])

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[int(i) for i in input().split()]
m=int(input())
p = []
for i in range(m):
    p.append(list(map(int, input().split())))
    
for i in range(n):
    if i>=len(p):
        break
    #print(t)
    print(sum(t)-(t[p[i][0]-1]-p[i][1]))

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=A
m=int(input())
for i in range(m):
  a,b=map(int,input().split())
  B[a-1]=b
  print(sum(B))
  B=A

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
m=int(input())
for i in range(m):
  a,b=map(int,input().split())
  A[a-1]=b
  print(sum(A))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
for _ in range(m):
  t = a
  b,c = [int(x) for x in input().split()]
  t[b-1] = c
  print(sum(t))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
for _ in range(m):
  b,c = [int(x) for x in input().split()]
  a[b-1] = c
  print(sum(a))

Submission status: Wrong Answer

Solution code:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
drink=[]
all=sum(t)
for i in range(m):
  drink.append(list(map(int,input().split())))
for j in range(n):
  if j<m:
    print(all-t[j]+drink[j][1])
  else:
    print(all)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int, input().split()))
t = T.copy()
M = int(input())
for i in range(M):
    P, X = map(int, input().split())
    T[P-1] = X
    print(sum(T))
    T = t

Submission status: Wrong Answer

Solution code:
n = int(input())
t_list = list(map(int,input().split()))
m = int(input())

splt_list = t_list[m:n+1]
for _ in range(m):
    p,x = map(int,input().split())
    print(p+x+sum(splt_list))

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [(i,int(x)) for i,x in enumerate(input().split(),1)]
M = int(input())
px = [input().split() for _ in range(M)]
for p,x in px:
  print(sum(x if p == i else t for i,t in T))

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int, input().split()))
M = int(input())
p = []
x = []
ans = []
for i in range(M):
    p, x = map(int, input().split())
    T[p-1] = x
    ans.append(sum(T))

for _ in ans:
    print(_)

Submission status: Wrong Answer

Solution code:
num = int(input())
lis = [int(m) for m in input().split()]
drinknum = int(input())
li = [[int(n) for n in input().split()] for d in range(drinknum)]
for i in li:
    l = lis
    l[i[0]-1] = i[1]
    print(sum(lis))

Submission status: Wrong Answer

Solution code:
N=int(input())
T=list(map(int,input().split()))
M=int(input())
for i in range (M):
    P=list(map(int,input().split()))
    print(sum(P)+sum(T[len(P):]))

Submission status: Wrong Answer

Solution code:
# input
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P = [list(map(int, input().split())) for _ in range(M)]

for i in range(M):
    temp = T[P[i][0] - 1]
    T[P[i][0] - 1] = P[i][1]
    print(sum(T))
    T[P[i][0] - 1] += temp

Submission status: Wrong Answer

Solution code:
# input
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P = [list(map(int, input().split())) for _ in range(M)]

for i in range(M):
    T[P[i][0] - 1] -= P[i][1]
    print(sum(T))
    T[P[i][0] - 1] += P[i][1]

Submission status: Wrong Answer

Solution code:
N=int(input())
T=input().split()
M=int(input())

for i in range(M):
  time=0
  P=input().split()
  drink=int(P[0])
  for ti in T:
    k=0
    if(int(T[k]) == drink):
      time+=int(P[1])
      k+=1
    else:
      time+=int(ti)
      k+=1
  print(time)

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[int(x) for x in input().split()]
m=int(input())
for i in range(m):
  a,b=map(int,input().split())
  s=b+sum(t[0:a])+sum(t[a+1:])

Submission status: Wrong Answer

Solution code:
import copy
N = int(input())
t = [int(x) for x in input().split()]
p = []
for _ in range(int(input())):
	p.append([int(x) for x in input().split()])

result = []
ori_t = copy.deepcopy(t)
for i,j in zip(t,p):
	t = copy.deepcopy(ori_t)
	t[j[0]-1] = j[1]
	result.append(sum(t))

for i in result:
	print(i)

Submission status: Wrong Answer

Solution code:
import copy
N = int(input())
t = [int(x) for x in input().split()]
p = []
for _ in range(int(input())):
	p.append([int(x) for x in input().split()])

result = []
ori_t = copy.deepcopy(t)
for i,j in zip(t,p):
	t = copy.deepcopy(ori_t)
	t[j[0]-1] = j[1]
	result.append(sum(t))

print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
Ts = list(map(int, input().split()))
M = int(input())
Ds = {}
for i in range(M):
    rs = list(map(int, input().split()))
    Ds[rs[0]] = rs[1]


for k,v in Ds.items():
    print(sum(Ts) - Ts[k-1] + v)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    problems = int(input())
    solve_times = [int(e) for e in input().split()]
    drinks = int(input())

    for i in range(drinks):
        solve_times_copy = solve_times[:]
        problem_idx, solve_time = [int(e) for e in input().split()]
        problem_idx -= 1
        solve_times_copy[problem_idx] = solve_time
        print(sum(solve_times_copy))


print(main())

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    problems = int(input())
    solve_times = [int(e) for e in input().split()]
    drinks = int(input())

    for i in range(drinks):
        solve_times_copy = solve_times
        problem_idx, solve_time = [int(e) for e in input().split()]
        problem_idx -= 1
        solve_times_copy[problem_idx] = solve_time
        print(sum(solve_times_copy))


print(main())

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    problems = int(input())
    solve_times = [int(e) for e in input().split()]
    drinks = int(input())

    for i in range(drinks):
        problem_idx, solve_time = [int(e) for e in input().split()]
        problem_idx -= 1
        solve_times[problem_idx] = solve_time
        print(sum(solve_times))


print(main())

Submission status: Wrong Answer

Solution code:
n = input()
a = map(int, raw_input().split())
s = sum(a)
m = input()
for i in xrange(m):
    p, x = map(int, raw_input().split())
    print s - a[p] + x
    p -= 1

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list(map(int, input().split()))
M = int(input())
drink = [list(map(int, input().split())) for i in range(M)]
S = 0
for i in range(N):
    S += data[i]
for i in range(M):
    print(S - (data[i] - drink[i][1]))

Submission status: Wrong Answer

Solution code:
#input
T = []
N = int(raw_input())
T = raw_input().split()
M = int(raw_input())
PX = []
X = 0
T1 = []
print T
#input matrix
for i in range(M):
    PX.append(map(int,raw_input().split()))


for j in range(M):
    #new time
    T1 = T[:]
    PJ = PX[j][0]
    XJ = PX[j][1]
    a = int(PJ)
    b = int(XJ)
    T1[a-1] = b
    print T1
    #plus each time
    X = 0
    for k in range(N):
            X += int(T1[k])
    print X

Submission status: Wrong Answer

Solution code:
input()
ts = list(map(int, input().split()))
t_sum = sum(ts)
m = int(input())
for _ in range(m):
    p, x = map(int, input().split())
    print(t_sum - ts[p] + x)

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
t=map(int,raw_input().split())
m=int(raw_input())
pt=[map(int,raw_input().split()) for _ in xrange(m)]
ans=[0]*m
for i in xrange(m):
    tmp=t
    tmp[pt[i][0]-1]=pt[i][1]
    for j in xrange(n):
        ans[i]+=tmp[j]
for i in xrange(m):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
t=map(int,raw_input().split())
m=int(raw_input())
xt=[map(int,raw_input().split()) for _ in xrange(m)]
ans=[0]*m
for i in xrange(m):
    tmp=t
    tmp[xt[i][0]-1]=xt[i][1]
    for j in xrange(n):
        ans[i]+=tmp[j]
for j in xrange(n):
    print(ans[j])

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
t=map(int,raw_input().split())
m=int(raw_input())
xt=[map(int,raw_input().split()) for _ in xrange(m)]
ans=[0]*m
for i in xrange(m):
    tmp=t
    tmp[xt[i][0]]=xt[i][1]
    for j in xrange(n):
        ans[i]+=tmp[j]
for i in xrange(m):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
line = map(int,raw_input().split(' '))
M = int(raw_input())
for i in range(M):
    x = map(int,raw_input().split(' '))
    s = sum(line)-(line[x[0]]-x[1])
    print s

Submission status: Wrong Answer

Solution code:
N = int(input())
T = input().split()
M = int(input())
sumT = 0
p = []
x = []
for k in range(N):
    sumT += int(T[k])
for i in range(M):
    P, X = map(int, input().split())
    p.append(P)
    x.append(X)
for i in range(len(T)):
    print(sumT - int(T[int(p[i])]) + int(x[i]))

Submission status: Wrong Answer

Solution code:
N = int(input())
T = input().split()
M = int(input())
sumT = 0
p = []
x = []
for k in range(N):
    sumT += int(T[k])
for i in range(M):
    P, X = map(int, input().split())
    p.append(P)
    x.append(X)
for i in range(len(T)):
    print(sumT - int(T[i]) + int(x[i]))

Submission status: Wrong Answer

Solution code:
N = int(input())
T = input().split()
M = int(input())
sumT = 0
p = []
x = []
for k in range(N):
    sumT += int(T[k])
for i in range(M):
    P, X = map(int, input().split())
    p.append(P)
    x.append(X)
for i in range(M):
    print(sumT - int(T[i]) + int(x[i]))

Submission status: Wrong Answer

Solution code:
n = int(input())
t = list(map(int,input().split()))
m = int(input())
origin,ans = [],[]

for i in range(m):
	p,x = map(int,input().split())
	origin.append(t[p-1])
	t[p-1] = x
	ans.append(sum(t))
	t[p-1] = origin[0]
	origin = []
	
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = input().split()
M = int(input())
sumT = 0
p = []
x = []
for k in range(N):
    sumT += int(T[k])
for i in range(M):
    P, X = map(int, input().split())
    p.append(P)
    x.append(X)
for i in range(M):
    print(sumT - int(T[int(p[i])]) + int(x[i]))

Submission status: Accepted

Solution code:
N = int(input())
T = list(map(int,input().split()))
M = int(input())
ans = sum(T)
copy = ans
for i in range(M):
    p,x = map(int,input().split())
    p -= 1
    ans -= T[p]
    ans += x
    print(ans)
    ans = copy

Submission status: Accepted

Solution code:
n = int(input())
t = list(map(int,input().split()))
m = int(input())
px = [list(map(int,input().split())) for _ in range(m)]
for i in px:
    print(sum(t) - t[i[0]-1] + i[1])

Submission status: Accepted

Solution code:
n = int(input())
times = list(map(int, input().split()))
m = int(input())
drinks = []
for _ in range(m):
    drink = list(map(int, input().split()))
    drinks.append(drink)

for drink in drinks:
    time = 0
    copy = times.copy()
    copy[drink[0]-1] = drink[1]
    for i in copy:
        time += i
    print(time)

Submission status: Accepted

Solution code:
# N問の問題が用意されている
N = int(input())
# 問題を解くのにかかる時間
T = list(map(int, input().split()))

# ドリンクの種類M
M = int(input())
# ドリンクを飲んだ場合の時間をリストに格納する
X = []

# まずはドリンクを飲んだ場合の時間をXに格納する
for i in range(M):
    X.append(list(map(int,input().split())))
    X[i][0] = X[i][0]-1

Y = []
# それぞれの問題の解く時間を取得する
for i in range(N):
    Y.append(T[i])
    
for i in range(len(X)):
    Y_copy = Y.copy()
    Y_copy[X[i][0]] = X[i][1]
    print(sum(Y_copy))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for _ in range(m):
    p,x=map(int,input().split())
    t_true=t[p-1]
    t[p-1]=x
    print(sum(t))
    t[p-1]=t_true

Submission status: Accepted

Solution code:
N = int(input())
T_s = list(map(int,input().split()))
M = int(input())
PX_s = [list(map(int,input().split())) for _ in range(M)]
SUM = sum(T_s)
for P,X in PX_s:
    print(SUM - (T_s[P-1] - X))