s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s874754922
p03845
u619144316
1586399467
Python
Python (3.4.3)
py
Runtime Error
21
3316
382
import math from collections import defaultdict import itertools N = int(input()) town = [[int(i) for i in input().split(' ')] for _ in range(N)] dist = 0 c = 0 for v in itertools.permutations(town,len(town)): c += 1 sx = v[0][0] sy = v[0][1] for i in v[1::]: dist += math.sqrt((sx - i[0]) ** 2 + (sy - i[1]) ** 2) sx, sy = i[0], i[1] print(dist/c)
s464251729
p03845
u852790844
1586378557
Python
Python (3.4.3)
py
Runtime Error
17
2940
168
n = int(input()) t = list(map(int, (input().split())) time = sum(t) m = int(input()) for i in range(m) p, x = map(int, input()/split()) pritn(time - t[p+1] + x)
s810750281
p03845
u398942100
1586191120
Python
Python (3.4.3)
py
Runtime Error
17
2940
4435
#include <bits/stdc++.h> using namespace std; // Define using ll = long long; using ull = unsigned long long; using ld = long double; template <class T> using pvector = vector<pair<T, T>>; template <class T> using rpriority_queue = priority_queue<T, vector<T>, greater<T>>; constexpr const ll dx[4] = {1, 0, -1, 0}; constexpr const ll dy[4] = {0, 1, 0, -1}; constexpr const ll MOD = 1e9 + 7; constexpr const ll mod = 998244353; constexpr const ll INF = 1LL << 60; constexpr const ll inf = 1 << 30; constexpr const char rt = '\n'; constexpr const char sp = ' '; #define mp make_pair #define mt make_tuple #define pb push_back #define eb emplace_back #define elif else if #define all(a, v, ...) \ ([&](decltype((v)) w) { return (a)(begin(w), end(w), ##__VA_ARGS__); })(v) #define rall(a, v, ...) \ ([&](decltype((v)) w) { return (a)(rbegin(w), rend(w), ##__VA_ARGS__); })(v) #define fi first #define se second template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } // Debug #define debug(...) \ { \ cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \ for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] "; \ cerr << rt; \ } #define dump(a, h, w) \ { \ cerr << __LINE__ << ": " << #a << " = [" << rt; \ rep(_i, h) { \ rep(_j, w) cerr << a[_i][_j] << sp; \ cerr << rt; \ } \ cerr << "]" << rt; \ } #define vdump(a, n) \ { \ cerr << __LINE__ << ": " << #a << " = ["; \ rep(_i, n) if (_i) cerr << sp << a[_i]; \ else cerr << a[_i]; \ cerr << "]" << rt; \ } // Loop #define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i) #define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i) #define rep(i, n) for (ll i = 0, _##i = (n); i < _##i; ++i) #define each(i, a) for (auto &&i : a) // Stream #define fout(n) cout << fixed << setprecision(n) struct io { io() { cin.tie(nullptr), ios::sync_with_stdio(false); } } io; // Speed #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // Math inline constexpr ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; } inline constexpr ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; } inline constexpr ll modulo(const ll n, const ll m = MOD) { ll k = n % m; return k + m * (k < 0); } inline constexpr ll chmod(ll &n, const ll m = MOD) { n %= m; return n += m * (n < 0); } inline constexpr ll mpow(ll a, ll n, const ll m = MOD) { ll r = 1; rep(i, 64) { if (n & (1LL << i)) r *= a; chmod(r, m); a *= a; chmod(a, m); } return r; } inline ll inv(const ll n, const ll m = MOD) { ll a = n, b = m, x = 1, y = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); x -= t * y; swap(x, y); } return modulo(x, m); } signed main() { ll N; cin >> N; ll A[N]; rep(i, N) cin >> A[i]; ll M, S = accumulate(A, A + N, 0LL); cin >> M; rep(i, M) { ll C, D; cin >> C >> D; cout << S - A[C - 1] + D << rt; } } // -g -D_GLIBCXX_DEBUG -fsanitize=undefined
s805666749
p03845
u342563578
1585705554
Python
Python (3.4.3)
py
Runtime Error
18
3064
390
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[i] + PXlist[i][1]) return empty for i in time_cal(): print(i)
s829623201
p03845
u342563578
1585704643
Python
Python (3.4.3)
py
Runtime Error
18
3064
395
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(): ans = ita.array.make1d(M) for i in range(0,M): ans[i] = time_sum() - Tlist[i] + PXlist[i][1] return ans print(Tlist,PXlist) time_cal()
s895391144
p03845
u440129511
1585625215
Python
Python (3.4.3)
py
Runtime Error
20
3064
210
n=int(input()) t=list(map(int,input().split())) sumt=sum(t) m=int(input()) for i in range(m): px = [list(map(int, input().split())) for _ in range(m)] a=t[px[i][0]-1] b=px[i][1] print(sumt-a+b)
s817917229
p03845
u440129511
1585621954
Python
Python (3.4.3)
py
Runtime Error
17
3060
178
n=int(input()) t=list(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]]=px[i][1] print(sum(t))
s112226124
p03845
u018679195
1585468082
Python
Python (3.4.3)
py
Runtime Error
19
3316
261
n = int(input()) t = list(map(int,input().strip().split()))[:n] m = int(input()) p=[] x=[] for _ in range(m): a,b = map(int,input().split()) p.append(a) x.append(b) s=sum(t) for i in range(m): T=s T-=t[p[i]-1] T+=x[p[i]-1] print(T)
s432074703
p03845
u089230684
1585467727
Python
Python (3.4.3)
py
Runtime Error
19
3064
254
n = int(input()) t = list(map(int,input().strip().split()))[:n] m = int(input()) p=[] x=[] for _ in range(m): a,b = map(int,input().split()) p.append(a) x.append(b) s=sum(t) for i in range(m): s-=t[p[i]-1] s+=x[p[i]-1] print(s)
s721120334
p03845
u375695365
1585441243
Python
Python (3.4.3)
py
Runtime Error
17
3060
191
n=int(input()) t=list(map(int,input().split())) m=int(input()) px=[list(map(int,input().split())) for _ in range(m)] ans=sum(t)-t[0]-t[1] for i in range(m): print(ans+sum(px[i]))
s554861199
p03845
u702786238
1585070813
Python
PyPy3 (2.4.0)
py
Runtime Error
180
38384
172
N = int(input()) Ts = list(map(int, input().split())) M = int(input()) base_ = sum(Ts) for m in range(1,M+1): p, t = map(int, input().split()) print(base_ - (Ts[p]-t))
s652229354
p03845
u016323272
1584975710
Python
Python (3.4.3)
py
Runtime Error
18
3060
170
N = int(input()) T = list(int(input().split())) S = sum(T) M = int(input()) for _ in range(M): p,x = map(int,input().split()) ans = S - T[p-1] + x print(ans)
s519246089
p03845
u016323272
1584975632
Python
Python (3.4.3)
py
Runtime Error
17
2940
167
N = int(input()) T = list(int(input().split())) S = sum(T) M = int(input()) for _ in range(M): p,x = map(int,input().split()) ans = S - T[] + x print(ans)
s240777750
p03845
u016323272
1584975485
Python
Python (3.4.3)
py
Runtime Error
17
2940
173
#ABC050.B N = int(input()) T = int(input().split()) S = sum(T) M = int(input()) for _ in range(M): p,x = map(int,input().split()) ans = S - T[] + x[] print(ans)
s134267593
p03845
u016323272
1584917386
Python
Python (3.4.3)
py
Runtime Error
17
3064
210
#ABC050.B N =int(input()) T = list(map(int,input().split()for _ in range(N))) S = sum(T) M = int(input()) for _ in range(M): a = S p,x = map(int,input().split()) a -= T[p-1] a += x print(a)
s318861447
p03845
u016323272
1584916864
Python
Python (3.4.3)
py
Runtime Error
18
3056
200
#ABC050.B N =int(input()) T = list(map(int,input().split()for _ in range(N))) S = sum(T) M = int(input()) for _ in range(M): p,x = map(int,input().split()) S -= T[p-1] S += x print(S)
s271584445
p03845
u516566941
1584910797
Python
Python (3.4.3)
py
Runtime Error
17
3060
269
N = int(input()) T = list(map(int,input().split())) M = int(input()) grid = [] for i in range(M): data = list(map(int,input().split())) grid.append(data) fsum = sum(T) for i in range(M): dsum = 0 dsum = fsum - T[i] + grid[i][1] print(dsum)
s194563832
p03845
u000123984
1584134191
Python
Python (3.4.3)
py
Runtime Error
17
3064
234
n = int(input()) t = list(map(int, input().split())) m = int(input()) p = [] x = [] for i in range(m): q, y = map(int, input().split()) p.append(q) x.append(y) s = sum(t) for j in range(max(n, m)): print(s - t[p[j]] + x[j])
s792117148
p03845
u000123984
1584133956
Python
Python (3.4.3)
py
Runtime Error
17
3064
231
n = int(input()) t = list(map(int, input().split())) m = int(input()) p = [] x = [] for i in range(m): q, y = map(int, input().split()) p.append(q) x.append(y) s = sum(t) for j in range(m): print(int(s - t[p[j]] + x[j]))
s940018731
p03845
u000123984
1584133676
Python
Python (3.4.3)
py
Runtime Error
17
3064
228
n = int(input()) t = list(map(int, input().split())) m = int(input()) p, x = [], [] for i in range(m): q, y = map(int, input().split()) p.append(q) x.append(y) s = sum(t) for j in range(m): print(int(s - t[p[j]] + x[j]))
s916769642
p03845
u000123984
1584133563
Python
Python (3.4.3)
py
Runtime Error
18
3064
223
n = int(input()) t = list(map(int, input().split())) m = int(input()) p, x = [], [] for i in range(m): q, y = map(int, input().split()) p.append(q) x.append(y) s = sum(t) for j in range(m): print(s - t[p[j]] + x[j])
s822733718
p03845
u000123984
1584133347
Python
Python (3.4.3)
py
Runtime Error
17
3064
217
n = int(input()) t = list(map(int, input().split())) m = int(input()) p, x = [], [] for i in range(m): q, y = map(int, input().split()) p[i] = q x[i] = y s = sum(t) for j in range(m): print(s - t[p[j]] + x[j])
s408458459
p03845
u000123984
1584133237
Python
Python (3.4.3)
py
Runtime Error
17
3060
214
n, t, m = int(input()), list(map(int, input().split())), int(input()) p, x = [], [] for i in range(m): q, y = map(int, input().split()) p[i] = q x[i] = y s = sum(t) for j in range(m): print(s - t[j] + x[j])
s045408406
p03845
u000123984
1584133106
Python
Python (3.4.3)
py
Runtime Error
17
3060
214
n, t, m = int(input()), list(map(int, input().split())), int(input()) p, x = [], [] for i in range(m): q, y = map(int, input().split()) p[i] = q x[i] = y s = sum(t) for j in range(m): print(s - t[i] + x[i])
s128521111
p03845
u000123984
1584133065
Python
Python (3.4.3)
py
Runtime Error
17
3060
216
n, t, m = int(input()), list(map(int, input().split())), int(input()) p, x = [], [] for i in range(m): q, y = map(int, input().split()) p[i] = q x[i] = y s = sum(t) for j in range(m): print(sum - t[i] + x[i])
s186285080
p03845
u697696097
1583304357
Python
Python (3.4.3)
py
Runtime Error
18
2940
165
n=int(input()) t=list(map(int,input().split())) m=int(input()) for i in range(m): p=list(map(int,input().split())) tmp=t[:] tmp[p[0]]=p[1] print(sum(tmp))
s767401752
p03845
u620157187
1582834364
Python
Python (3.4.3)
py
Runtime Error
272
18492
214
import numpy as np N = int(input()) T = list(map(int, input().split())) M = int(input()) for i in range(M): P, X = map(int, input().split()) T_new = T T_new[P] = X print(np.array(T_new).sum())
s304671384
p03845
u620157187
1582834334
Python
Python (3.4.3)
py
Runtime Error
17
2940
213
import numpy as np N = int(input()) T = list(map(int, input().split())) M = int(input()) for i in range(M): P, X = map(int, input().split()) T_new = T T_new[P = X print(np.array(T_new).sum())
s671936618
p03845
u620157187
1582834301
Python
Python (3.4.3)
py
Runtime Error
149
12484
217
import numpy as np N = int(input()) T = list(map(int, input().split())) M = int(input()) for i in range(M): P, X = map(int, input().split()) T_new = T T_new[P[i]] = X print(np.array(T_new).sum())
s305710436
p03845
u620157187
1582834243
Python
Python (3.4.3)
py
Runtime Error
154
12488
217
import numpy as np N = int(input()) T = list(map(int, input().split())) M = int(input()) for i in range(M): P, X = map(int(input().split())) T_new = T T_new[P[i]] = X print(np.array(T_new).sum())
s145185130
p03845
u620157187
1582834161
Python
Python (3.4.3)
py
Runtime Error
154
12488
222
import numpy as np N = int(input()) T = list(map(int, input().split())) M = int(input()) for i in range(len(M)): P, X = map(int(input().split())) T_new = T T_new[P[i]] = X print(np.array(T_new).sum())
s833373985
p03845
u977642052
1582206589
Python
Python (3.4.3)
py
Runtime Error
17
3060
291
def main(n, t, m, p_x): for p, x in p_x: _t = t.copy() _t[p - 1] = x print(sum(_t)) if __name__ == "__main__": n = int(input()) t = list(map(int, input().split())) m = int(input()) p_x = [int(input()) for _ in range(m)] main(n, t, m, p_x)
s256263910
p03845
u427984570
1582001281
Python
Python (3.4.3)
py
Runtime Error
17
3060
183
n = int(input()) l = list(map(int,input())) m = int(input()) sum = sum(l) copy = sum for i in range(m): sum = copy a,b = map(int,input().split()) sum += b - l[a-1] print(sum)
s908167420
p03845
u312078744
1581900477
Python
Python (3.4.3)
py
Runtime Error
159
12952
352
import numpy as np #import copy N = int(input()) #time=list(map(int,input().split())) time=np.array(input().split(),dtype=np.int64) M = int(input()) p={} x={} for i in range(M): p[i],x[i] = map(int, input().split()) #print(x[1]) sumT=np.sum(time) for i in range(M): PP = p[i] # print(np.sum(time_new)) print(sumT - time[PP-1] + x[PP-1])
s045824886
p03845
u813174766
1581215971
Python
Python (3.4.3)
py
Runtime Error
17
3060
135
n=int(input()) a=list(map(int,input().split())) m=int(input()) for i in range(m): p,x=map(int,input().split()) print(sum(a)-a[p]+x)
s047196397
p03845
u143976525
1581165666
Python
Python (3.4.3)
py
Runtime Error
17
3060
340
N=int(input()) T_N=int(input().split()) list_time = [] for i in range(N): list_time.append(T_N[i]) #Ti秒の総和を求める sum=sum(list_time) M=int(input()) for i in range(M): p,x=map(int,input().split()) #ドリンク飲んだ時と飲まないときの差を元の合計に足す。 ans=sum+x-list_time[p-1] print(ans)
s534805174
p03845
u143976525
1581165572
Python
Python (3.4.3)
py
Runtime Error
17
3064
342
N=int(input()) T_N=int(input().split()) list_time=[] for i in range(N): list_time.append(T_N[i]) #Ti秒の総和を求める sum=sum(list_time) M=int(input()) for i in range(M): p,x=map(int,input.split()) #ドリンク飲んだ時と飲まないときの差を元の合計に足す。 ans=sum+(x-list_time[p-1]) print(ans)
s807417704
p03845
u143976525
1581164765
Python
Python (3.4.3)
py
Runtime Error
17
2940
229
N=int(input()) T_N=int(input().split()) list_time=[] for i in range(N) list_time.append(T_N[i]) sum=sum(list_time) M=int(input()) for i in range(M): p,x=map(int,input.split()) ans=sum+(x-list_time[p-1]) print(ans)
s177804728
p03845
u143976525
1581164690
Python
Python (3.4.3)
py
Runtime Error
17
2940
341
N=int(input()) T_N=int(input().split()) list_time=[] for i in range(N) list_time.append(T_N[i]) #Ti秒の総和を求める sum=sum(list_time) M=int(input()) for i in range(M): p,x=map(int,input.split()) #ドリンク飲んだ時と飲まないときの差を元の合計に足す。 ans=sum+(x-list_time[p-1]) print(ans)
s094979515
p03845
u445624660
1580748779
Python
Python (3.4.3)
py
Runtime Error
17
2940
1459
package main import ( "bufio" "fmt" "os" "reflect" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var out = bufio.NewWriter(os.Stdout) func main() { sc.Split(bufio.ScanWords) defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print() /* --- code ---*/ n := nextInt() ts := nextInts(n) m := nextInt() for i := 0; i < m; i++ { p, x := nextInt()-1, nextInt() ans := 0 for j := 0; j < n; j++ { if j != p { ans += ts[j] } else { ans += x } } fmt.Fprint(out, ans, "\n") } } func next() string { sc.Scan() return sc.Text() } func nextInt() int { a, _ := strconv.Atoi(next()) return a } func nextFloat64() float64 { a, _ := strconv.ParseFloat(next(), 64) return a } func nextInts(n int) []int { ret := make([]int, n) for i := 0; i < n; i++ { ret[i] = nextInt() } return ret } func nextFloats(n int) []float64 { ret := make([]float64, n) for i := 0; i < n; i++ { ret[i] = nextFloat64() } return ret } func nextStrings(n int) []string { ret := make([]string, n) for i := 0; i < n; i++ { ret[i] = next() } return ret } func PrintOut(src interface{}, joinner string) { switch reflect.TypeOf(src).Kind() { case reflect.Slice: s := reflect.ValueOf(src) for idx := 0; idx < s.Len(); idx++ { fmt.Fprintf(out, "%v", s.Index(idx)) if idx < s.Len()-1 { fmt.Fprintf(out, "%s", joinner) } else { fmt.Fprintln(out) } } default: fmt.Fprintln(out, "fuck") } }
s207535142
p03845
u779728630
1580154918
Python
Python (3.4.3)
py
Runtime Error
17
3060
159
N = int(input()) T = list(map(int, input().split())) M = int(input()) s = sum(T) for i in range(N): P, X = map(int, input().split()) print(s - T[P-1] + X)
s809981106
p03845
u191874006
1578777845
Python
PyPy3 (2.4.0)
py
Runtime Error
185
38640
215
#!/usr/bin/env python3 n = int(input()) t = list(map(int,input().split())) m = int(input()) px = [list(map(int,input().split())) for _ in range(m)] for p,x in px: T = t.copy() T[p-1] = x print(sum(T))
s871523701
p03845
u609814378
1578352965
Python
Python (3.4.3)
py
Runtime Error
17
3064
243
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)
s478222132
p03845
u506587641
1578332085
Python
Python (3.4.3)
py
Runtime Error
17
3060
183
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): print(sum(t)-t[px[i][0]]+px[i][1])
s017580202
p03845
u506587641
1578331917
Python
Python (3.4.3)
py
Runtime Error
18
3060
176
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): print(sum(t)-t[i]+px[i][1])
s175309691
p03845
u506858457
1577975658
Python
Python (3.4.3)
py
Runtime Error
17
2940
154
N=int(input()) T=list(map(int,input().split())) TA=sum(T) M=int(input()) for i in range(M): P,X=map(int,input().split()) ans=TA+X-T[p-1] print(ans)
s912918027
p03845
u506858457
1577975583
Python
Python (3.4.3)
py
Runtime Error
17
3060
153
N=int(input()) T=list(map(int,input().split())) TA=sum(T) M=int(input()) for i in range(M): P,X=map(int,input().split()) ans=TA+X+T[p-1] print(ans)
s025371432
p03845
u506858457
1577933417
Python
Python (3.4.3)
py
Runtime Error
17
3060
192
N=int(input()) T=list(map(int,input().split())) M=int(input()) for i in range(M): P[i],X[i]=int(input().split()) T_ALL=sum(T) for i in range(): ans=T_ALL+X[P[i]]-T[i] print(ans)
s106757031
p03845
u063073794
1577496845
Python
Python (3.4.3)
py
Runtime Error
17
2940
176
yandy n = int(input()) t = [int(i) for i in input().split()] m = int(input()) ans = sum(t) for i in range(m): p, x = map(int, input().split()) print(ans - t[p-1] + x)
s095143762
p03845
u609814378
1577137558
Python
Python (3.4.3)
py
Runtime Error
17
2940
1
a
s036181330
p03845
u374802266
1576470387
Python
Python (3.4.3)
py
Runtime Error
17
3060
143
n=int(input()) a=list(map(int,input().split())) m=int(input()) s=sum(a) for i in range(m): p,x=map(int,input().split()) print(s-a[p]+x)
s787164268
p03845
u113971909
1576031940
Python
Python (3.4.3)
py
Runtime Error
17
2940
152
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)
s077180342
p03845
u113971909
1576031874
Python
Python (3.4.3)
py
Runtime Error
17
2940
153
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)
s487493888
p03845
u352359612
1575690196
Python
Python (3.4.3)
py
Runtime Error
19
3064
330
N = int(input()) T = list(map(int, input().split())) M = int(input()) P, X = [], [] for i in range(M): p1, x1 = map(int, input().split()) P.append(p1) X.append(x1) count = 0 for i in range(len(T)): count += T[i] c = count for i in range(M): count = c count += X[i] count -= T[P[i]] print(count)
s124744602
p03845
u352359612
1575689914
Python
Python (3.4.3)
py
Runtime Error
17
3064
332
N = int(input()) T = list(map(int, input().split())) M = int(input()) P, X = [], [] for i in range(M): p1, x1 = map(int, input().split()) P.append(p1) X.append(x1) count = 0 for i in range(len(T)): count += T[i] c = count for i in range(len(X)): count = c count += X[i] count -= T[i] print(count)
s865041731
p03845
u352359612
1575689801
Python
Python (3.4.3)
py
Runtime Error
17
3064
331
N = int(input()) T = list(map(int, input().split())) M = int(input()) P, X = [], [] for i in range(M): p1, x1 = map(int, input().split()) P.append(p1) X.append(x1) count = 0 for i in range(len(T)): count += T[i] c = count for i in range(len(X)): count = c count += X[i] count -= T[i] print(count
s956211100
p03845
u352359612
1575688565
Python
Python (3.4.3)
py
Runtime Error
17
3064
280
N = int(input()) T = list(map(int, input().split())) M = int(input()) P, X = [], [] for i in range(M): pi, xi = map(int, input().split) P.append(pi) X.append(xi) count = 0 for i in T: count += T[i] for i in X: count += X[i] count -= T[i] print(count
s824187311
p03845
u352359612
1575687913
Python
Python (3.4.3)
py
Runtime Error
18
3064
410
N = int(input()) T = list(map(int, input().split())) M = int(input()) P, X = [], [] for i in range(M): p1, x1 = map(int, input().split) P.append(p1) X.append(x1) count = 0 for i in T: count += T[i] discount = 0 for i in T: if i <= M: discount += T[i] special = 0 for i in P, X: special += P[i] special += X[i] count *= M count -= discount count += special print(count)
s480020437
p03845
u175590965
1575517686
Python
Python (3.4.3)
py
Runtime Error
17
2940
145
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)
s964515450
p03845
u175590965
1575517643
Python
Python (3.4.3)
py
Runtime Error
17
3060
145
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[m-1]+x)
s422784046
p03845
u457554982
1575143147
Python
Python (3.4.3)
py
Runtime Error
17
2940
258
n=int(input()) t=list(map(int,input().split())) m=int(input()) juice=[] for i in range(m): juice.append(list(map(int,input().split()))) for i in range(m): ans=0 for j in range(n): if j==juice[i][0]-1 ans+=juice[i][1] else: ans+=t[j] print(ans)
s565106893
p03845
u417137595
1574785579
Python
Python (3.4.3)
py
Runtime Error
22
3444
330
import copy n = int(input()) t_li = list(map(int, input().split())) m = int(input()) px_li = [] result = [] for i in range(m): p, x = map(int, input().split()) px_li.append([p, x]) for j in range(m): c_li = copy.copy(t_li) c_li[j] = px_li[j][1] result.append(str(sum(c_li))) string = "\n".join(result) print(string)
s141143796
p03845
u557494880
1573789143
Python
Python (3.4.3)
py
Runtime Error
17
3064
171
N = int(input()) T = list(map(int,input().split())) ans = sum(T) M = int(input()) for i in range(M): P,X = map(int,input().split()) t = A[P-1] - X print(ans-t)
s305777239
p03845
u675467021
1571761876
Python
Python (3.4.3)
py
Runtime Error
17
3060
195
n=int(input()) t=list(map(int,input().split())) m=int(input()) p=[0]* m x=[0]* m for i in range(m): p[i],x[i]= map(int(input().split())) for i in range(m): print(sum(t)-t[p[i]-1]+x[i])
s449432402
p03845
u675467021
1571761771
Python
Python (3.4.3)
py
Runtime Error
17
3060
191
n=int(input()) t=list(map(int,input(),split())) m=int(input()) p=[0]* m x=[0]* m for i in range(m): p[i],x[i]= map(int(input(),split())) for i in range(m): print(sum(t)-t[p[i]-1]+x[i])
s481181957
p03845
u675467021
1571761736
Python
Python (3.4.3)
py
Runtime Error
18
3064
194
n=int(input()) t=list(map(int,input(),split())) m=int(input()) p=[0]* m x=[0]* m for i in range(m): p[i],x[i]= map(int(input(),split())) for i in range(m): print(sum(t)-t[p[i]-1]+x[i])
s018552633
p03845
u675467021
1571761585
Python
Python (3.4.3)
py
Runtime Error
17
3064
204
n = int(input()) t = list(map(int,input(),split())) m = int(input()) p = [0]* m x = [0]* m for i in range(m): p[i],x[i]= map(int(input(),split())) for i in range(m): print(sum(t)-t[p[i]-1]+x[i])
s118185703
p03845
u675467021
1571761434
Python
Python (3.4.3)
py
Runtime Error
17
3060
205
n = int(input()) t = list(map(int,input(),split())) m = int(input()) p = [0]* m x = [0]* m for i in range(m): p[i],x[i]= map(int(input(),split())) for i in range(m): print(sum(t)-t[p[i]-1]+x[i])
s692214150
p03845
u675467021
1571761279
Python
Python (3.4.3)
py
Runtime Error
17
3060
182
n = int(input()) t = list(map(int,input(),split())) m = int(input()) p = [0]* m x = [0]* m for i in range(m): p[i],x[i]= map(int(input(),split())) print(sum(t)-t[p[i]-1]+x[i])
s304915761
p03845
u626468554
1571632038
Python
Python (3.4.3)
py
Runtime Error
17
2940
206
#n,l = map(int,input().split()) #l = kist(input()) n = int(input()) l = list(map(int,input())) ttl = sum(l) m = int(input()) for i in range(m): p,x = map(int,input().split()) print(ttl-l[p-1]+x)
s151214440
p03845
u672898046
1570569251
Python
Python (3.4.3)
py
Runtime Error
17
3060
150
N = int(input()) Ts = list(map(int, input().split())) M = int(input()) for i in range(M): p, x = map(int, input().split()) print(sum(Ts)-T[p-1]+x)
s784200732
p03845
u212253038
1569896302
Python
Python (3.4.3)
py
Runtime Error
17
3060
225
N = int(input()) T = [*map(int, input().split())] for i in range(int(input())): P, X = map(int, input().split()) t = 0 for j in range(N): if j+1 == P: t += X else: t += T[j] print(t)
s487976974
p03845
u212253038
1569896083
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38256
225
N = int(input()) T = [*map(int, input().split())] for i in range(int(input())): P, X = map(int, input().split()) t = 0 for j in range(N): if j+1 == P: t += X else: t += T[j] print(t)
s461880497
p03845
u824326335
1569830159
Python
Python (3.4.3)
py
Runtime Error
17
2940
151
n = int(input()) t = list(map(int,input().split())) for _ in int(input()): p,x = map(int,input().split()) l=t.copy() l[p-1] = x print(sum(l))
s258035233
p03845
u476124554
1569327758
Python
Python (3.4.3)
py
Runtime Error
18
3064
238
n = int(input()) t = list(map(int,input().split())) m = int(input()) p = [] x = [] for i in range(m): t1,t2 = map(int,input().split()) p.append(t1) x.append(t2) sum_t = sum(t) for i in range(m): print(sum_t - (t[i] -x[i]))
s387773583
p03845
u396391104
1567819059
Python
Python (3.4.3)
py
Runtime Error
17
3064
152
n = int(input()) t = list(map(int,input().split())) m = int(input()) s = sum(t) for i in range(m): p,x = map(int,input().split()) print(s-t[p+1]+x)
s597382201
p03845
u642120132
1567633941
Python
Python (3.4.3)
py
Runtime Error
17
3060
189
N = int(input()) T = list(map(int, input().split())) sumT = sum(T) M = int(input()) PX = [list(map(int, input().split())) for _ in range(M)] for i in range(M): print(sumT-T[i]+PX[i][1])
s197315726
p03845
u271934630
1566909716
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38256
189
n = int(input()) t = list(map(int, input().split())) m = int(input()) for _ in range(m): new_t = t.copy() p, x = map(int, input().split()) new_t[p-1] = x print(sum(new_t))
s282801519
p03845
u900303768
1566261653
Python
PyPy3 (2.4.0)
py
Runtime Error
178
38640
218
n = int(input()) t = list(map(int, input().split())) m = int(input()) pl = [] for i in range(m): pl.append(list(map(int, input().split()))) for i in pl: tt = t.copy() tt[i[0]-1] = i[1] print(sum(tt))
s379734905
p03845
u135847648
1565367078
Python
Python (3.4.3)
py
Runtime Error
17
3064
260
n = int(input()) t = list(map(int,input().split())) m = int(input()) PX = [list(map(int,input().split())) for _ in range(m)] ans = 10**7 s1 = sum(t) for i in range(m): s2 = s1 - t[PX[i][0]] + PX[i][1] ans = min(ans,s2) print(ans)
s180167076
p03845
u626337957
1565127609
Python
Python (3.4.3)
py
Runtime Error
17
3060
258
N = int(input()) times = map(int, input().split()) M = int(input()) sum_t = sum(times) for _ in range(M): dist, time = map(int, input().split()) if times[dist-1] >= time: print(sum_t-(times[dist-1]-time)) else: print(sum_t+(time-times[dist-1]))
s739832641
p03845
u514894322
1564450173
Python
Python (3.4.3)
py
Runtime Error
17
3060
222
n = int(input()) l = list(map(int,input().split())) m = int(input()) p_x = [] for i in range(m): p_x.append(list(map(int,input()).split())) for i in range(m): p = p_x[i][0] x = p_x[i][1] print(sum(l) - l[p-1] + x)
s018171780
p03845
u369338402
1564306766
Python
Python (3.4.3)
py
Runtime Error
17
3060
260
n=int(input()) t=map(int,input().split()) #n==len(t) m=int(input()) px=[] for i in range(n): px.append(map(input().split())) res=0 for j in range(m): for k in range(n): if j==px[j][0]: res+=px[j][1] else: res+=t[k] print(res) res=0
s364440693
p03845
u759412327
1564034795
Python
Python (3.4.3)
py
Runtime Error
18
3060
167
N = int(input()) T = list(map(int,input().split())) M = int(input()) for i in range(N): P,X = list(map(int,input().split())) Z = T[:] Z[P-1] = X print(sum(Z))
s384168844
p03845
u222185706
1563751476
Python
Python (3.4.3)
py
Runtime Error
17
3060
404
##input## Nvar = int(input()) T_list = map(lambda x:int(x),input().split(" ")) M_var = int(input()) P_dict = {} for i in range(M_var): buf = map(lambda x:int(x),input().split(" ")) P_dict[buf[0]] = buf[1] ## time_sum = 0 for d_num in range(M_var): for q_num in range(Nvar): if q_num==d_num: time_sum += P_list[q_num+1] else: time_sum += T_list[q_num]
s032637498
p03845
u148781101
1563604684
Python
Python (3.4.3)
py
Runtime Error
18
2940
286
N = int(input()) Problems = map(int, input().split()) M = int(input()) arr = [] for i in range(M): P, T = map(int, input().split()) sum = 0 for j in range(N): if j != P: sum += Problems[j] else: sum += T arr[i] = sum for num in arr: print(num)
s736798925
p03845
u093500767
1562797630
Python
Python (3.4.3)
py
Runtime Error
18
3060
205
n = int(input()) list = list(map(int, input().split(" "))) sum = sum(list) num = int(input()) for x in range(num): a = list(map(int, input().split())) ans = sum + a[1] - list[a[0]-1] print(ans)
s766539190
p03845
u093500767
1562797204
Python
Python (3.4.3)
py
Runtime Error
17
3060
202
n = int(input()) list = list(map(int, input().split())) sum = sum(list) num = int(input()) for x in range(num): a = list(map(int, input().split())) ans = sum + a[1] - list[a[0]-1] print(ans)
s390662799
p03845
u239316561
1562788505
Python
Python (3.4.3)
py
Runtime Error
17
2940
417
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0;i < (n);i++) typedef long long ll; int main(){ int n,m; int total = 0; cin >> n; vector<int> t(n); rep(i,n){ cin >> t[i]; total += t[i]; } cin >> m; vector<int> p(m),x(m); rep(i,m)cin >> p[i] >> x[i]; rep(i,m){ cout << total - (t[p[i]-1] -x[i]) << endl; } return 0; }
s922973097
p03845
u481026841
1562271951
Python
Python (3.4.3)
py
Runtime Error
17
2940
163
N = int(input()) T = list(map(int,input().split())) M = int(input()) P,X = [list(map(int,input().split())) for _ in range(M)] all = sum(T) print(all - T[P-1] + X)
s906382433
p03845
u373499377
1562018754
Python
Python (3.4.3)
py
Runtime Error
17
3060
294
def main(): n = int(input()) t = list(map(int, input().split())) m = int(input()) x = [0 for i in range(m)] for i in range(m): _, x[i] = map(int, input().split()) for i in range(m): print(sum(t) - t[i] + x[i]) if __name__ == "__main__": main()
s429918998
p03845
u181668771
1561003142
Python
Python (3.4.3)
py
Runtime Error
17
3064
310
import sys N = sys.stdin.readline() T = map(int,sys.stdin.readline().split()) M = sys.stdin.readline() sum = sum(T) PX = [] ansList = list(list()) for i in range(M): PX.append(map(int,sys.stdin.readline().split())) for i in range(T): ansList[i] = sum[i] + (T[PX[i][0]] - PX[i][1]) print(ansList[i])
s436715915
p03845
u778814286
1559687418
Python
Python (3.4.3)
py
Runtime Error
18
3064
237
N = int(input()) T = list(map(int,input().split())) M = int(input()) P = [] X = [] for _ in range(M): p,x = map(int,input().split()) P.append(p) X.append(x) sumT = sum(T) for i,p,x in enumerate(zip(P,X)): print(sumT - (T[p]-x))
s501660866
p03845
u399721252
1559431651
Python
Python (3.4.3)
py
Runtime Error
17
2940
215
n = int(inout()) time_list = [ int(v) for v in input().split() ] total_time = sum(time_list) m = int(input()) for i in range(m): p, t = [ int(v) for v in input().split() ] print(total_time - time_list[p-1] + t)
s490022906
p03845
u906428167
1559188765
Python
Python (3.4.3)
py
Runtime Error
17
3060
160
N = int(input()) test = list(map(int,input().split())) M = int(input()) for _ in range(M): a,b = map(int,input().split()) print(sum(test) - test[a] + b)
s596805048
p03845
u906428167
1559188588
Python
Python (3.4.3)
py
Runtime Error
17
3060
160
N = int(input()) test = list(map(int,input().split())) M = int(input()) for _ in range(M): a,b = map(int,input().split()) test[a] = b print(sum(test))
s810161829
p03845
u906428167
1559188516
Python
Python (3.4.3)
py
Runtime Error
17
3060
156
N = int(input()) test = list(map(int,input().split())) M = int(input()) for _ in range(M): a,b = int(input()).split() test[a] = b print(sum(test))
s423632280
p03845
u906428167
1559188450
Python
Python (3.4.3)
py
Runtime Error
17
2940
146
N = input() test = list(map(int,input().split())) M = input() for _ in range(M): a,b = int(input()).split() test[a] = b print(sum(test))
s238370442
p03845
u906428167
1559188398
Python
Python (3.4.3)
py
Runtime Error
18
2940
138
N = input() test = list(map(int,input())) M = input() for _ in range(M): a,b = int(input()).split() test[a] = b print(sum(test))
s608206483
p03845
u906428167
1559188323
Python
Python (3.4.3)
py
Runtime Error
17
2940
129
N = input() test = list(map(int,input())) for _ in range(input()): a,b = int(input()).split() test[a] = b print(sum(test))