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
s822283304
p02572
u134185377
1598881106
Python
Python (3.8.2)
py
Runtime Error
2246
1961776
200
import numpy as np M=10**9+7 N=int(input()) Alist=np.array([int(i) for i in input().split()]) Amat=np.outer(Alist,Alist) Atri=Amat[np.nonzero(np.tril(Amat,k=-1))] sumsum=np.sum(Atri)%M print(sumsum)
s810151033
p02572
u134185377
1598880808
Python
Python (3.8.2)
py
Runtime Error
1934
1927676
182
import numpy as np M=10**9+7 N=int(input()) Alist=np.array([int(i) for i in input().split()]) Amat=np.outer(Alist,Alist) Atri=np.tril(Amat,k=-1) sumsum=np.sum(Atri)%M print(sumsum)
s363870643
p02572
u857673087
1598868687
Python
Python (3.8.2)
py
Runtime Error
74
31436
154
n = int(input()) a = list(map(int,input().split())) mod= 10**9+7 A = sum(a) ans=0 for i in a: A -= i A%=mod ans += A*x ans%=mod print(ans)
s928591246
p02572
u000138965
1598867684
Python
PyPy3 (7.3.0)
py
Runtime Error
2239
994716
259
# -*- using:utf-8 -*- from itertools import combinations if __name__ == "__main__": n = int(input()) li = list(map(int, input().split())) array = list(combinations(li, 2)) sum = 0 for i in range(n): sum += array[i][0] * array[i][1] print(sum)
s707589920
p02572
u000138965
1598867523
Python
PyPy3 (7.3.0)
py
Runtime Error
2237
930580
188
import itertools n = int(input()) li = list(map(int, input().split())) array = list(itertools.combinations(li, 2)) sum = 0 for i in range(n): sum += array[i][0] * array[i][1] print(sum)
s767579428
p02572
u000138965
1598867399
Python
PyPy3 (7.3.0)
py
Runtime Error
2229
991760
251
# -*- using:utf-8 -*- import itertools if __name__ == "__main__": n = int(input()) li = list(map(int, input().split())) array = list(itertools.combinations(li, 2)) sum = 0 for i in range(n): sum += array[i][0] * array[i][1] print(sum)
s548612580
p02572
u588592871
1598863481
Python
Python (3.8.2)
py
Runtime Error
52
25164
179
n=int(input()) a=list(input().split(' ')) total=0 S_i=0 for i in range(n-1): S_i+=a[n-1-i] S_i=S_i%(7+10**9) total+=S_i*a[n-2-i] total=total%(7+10**9) print(total)
s412072211
p02572
u730807152
1598858963
Python
Python (3.8.2)
py
Runtime Error
24
9064
168
n = int(input()) a = list(map(int, input().split())) ans = 0 double = 0 for i in a: double += i*i ans = (sum(a) * sum(a) - double) // 2 print((ans % (10**9 + 7))
s574504255
p02572
u262632239
1598829961
Python
Python (3.8.2)
py
Runtime Error
109
31556
150
n = int(input()) a = list(map(int,input().split())) c = 0 for i in range(n): for j in range(i+1,n+1): c += a[i]*a[j] print(c % (10**9 + 7))
s527946322
p02572
u262632239
1598829839
Python
Python (3.8.2)
py
Runtime Error
108
31608
153
n = int(input()) a = list(map(int,input().split())) c = 0 for i in range(1,n): for j in range(i+1,n+1): c += a[i]*a[j] print(c % (10**9 + 7))
s766840288
p02572
u682894596
1598827680
Python
Python (3.8.2)
py
Runtime Error
25
8948
260
N = int(input()) a = list(map(int, input().split(" "))) s = 0 for i in range(0,N): s += a[i] s = s*s for i in range(0,N): s -= a[i]*a[i] if s % 2 = 0: s = s % 2*(10**9 +7) s = s/2 else: s = (s + 10**9 + 7) % 2*(10**9 + 7) s = s/2 print(int(s))
s515394715
p02572
u760154761
1598826472
Python
PyPy3 (7.3.0)
py
Runtime Error
90
74576
290
import numpy as np N = int(input()) A = list(map(int,input().split())) B = np.zeros(N) B[0] = A[0] c = 0 for i in range(1, N): B[i] = B[i - 1] + A[i] for j in range(N - 1): c += ((A[j] % (10 ** 9 + 7)) * ((B[N - 1] - B[j]) % (10 ** 9 + 7))) % (10 ** 9 + 7) print(int(c % (10 ** 9 + 7)))
s841041798
p02572
u335950809
1598825141
Python
Python (3.8.2)
py
Runtime Error
47
25020
200
m = 1000000007 n = int(input()) a = map(int,input().split()) s = [] for i in range(n-1): for j in range(i+1,n): #print(a[i],a[j]) s.append(a[i]*a[j]) ans = sum(s) % m print(ans)
s260826747
p02572
u620259318
1598819877
Python
Python (3.8.2)
py
Runtime Error
45
25136
171
x = 10 ** 9 + 7 n = int(input()) l = list(map(int, input().split()) % x) ans = 0 for i in range(n): for j in range(i + 1, n): ans += l[i] * l[j] print(ans)
s568756935
p02572
u347640436
1598817389
Python
Python (3.8.2)
py
Runtime Error
24
9108
176
l = input() a = l.split(' ') tmp = 0 tmp2 = 0 for i in range(n): tmp += int(a[i]) for i in range(n): tmp2 += int(a[i])*int(a[i]) print((tmp*tmp-tmp2)//2%1000000007)
s011931118
p02572
u595600198
1598803839
Python
Python (3.8.2)
py
Runtime Error
24
8964
235
N = int(input()) input_list = list(map(int,input().split())) ans = 0 for i in range(N): if i!=N-1: for j in range(i+1,N): ans += input_list[i]*input_list[j] if ans >= 10**9+7: ans = ans % (10**9+7 print(ans)
s814600004
p02572
u770265284
1598799001
Python
Python (3.8.2)
py
Runtime Error
22
8956
751
#include<bits/stdc++.h> #define fr(i,c,b) for(int i=c;i<b;i++) #define frl(i,c,b) for(ll i=c;i<b;i++) #define si(x) int x; scanf("%d", &x) #define sll(x) ll x; scanf("%lld", &x) #define pi(x) printf("%d", x) #define pll(x) printf("%lld", x) #define nl printf("\n") #define watch(x) cout << (#x) << " is " << (x) << endl ...
s533400080
p02572
u686230543
1598795318
Python
Python (3.8.2)
py
Runtime Error
126
25000
226
mod = 10 ** 9 + 7 n = int(input()) a_sum = 0 sq_sum = 0 for a in map(int, input().split()): a_sum = (a_sum + a) % mod sq_sum = (sq_sum + a * a) % mod res = (a_sum * a_sum - sq_sum) % mod print(-(p // 2) % mod * res % mod)
s559546543
p02572
u186820109
1598794881
Python
Python (3.8.2)
py
Runtime Error
23
9100
153
i = 0 j = i+1 ans = 0 while i != n - 1: ans = (ans+(a[i] * a[j])) % 1000000007 j += 1 if j == n: i += 1 j = i + 1 print(ans)
s930348420
p02572
u186820109
1598794722
Python
Python (3.8.2)
py
Runtime Error
24
8996
131
i = 0 j = i+1 ans = 0 while i != n - 1: ans += a[i] * a[j] j += 1 if j == n: i += 1 j = i + 1 print(ans % 1000000007)
s753347907
p02572
u914693053
1598794260
Python
Python (3.8.2)
py
Runtime Error
29
9016
196
n=int(input()) a=list(map(int,input().split())) if n==1: print(a[0]) else: l=list(map(lambda z:z**2,a) x=sum(a) y=sum(l) t=(x-y)//2 if t>(10**9+7): print(t%(10**9+7)) else: print(t)
s451075963
p02572
u872271866
1598793981
Python
Python (3.8.2)
py
Runtime Error
28
9008
444
#include <bits/stdc++.h> using namespace std; int main(){ int N; long long ans = 0, sum =0; int mod = 1000000000+7; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); sum += a.at(i); sum %= mod; } for (int i = 0; i < N; i++) { sum -...
s725881041
p02572
u872271866
1598793851
Python
Python (3.8.2)
py
Runtime Error
23
8932
433
#include <bits/stdc++.h> using namespace std; int main(){ int N; long long ans = 0, sum =0; int mod = 1000000000+7; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); sum += a.at(i); } for (int i = 0; i < N-1; i++) { sum -= a.at(i); ...
s634282369
p02572
u914693053
1598793744
Python
Python (3.8.2)
py
Runtime Error
25
8956
114
n=int(input()) a=list(map(int,input().split())) l=list(map(lambda z:z**2,a) x=sum(a) y=sum(l) t=(x-y)//2 print(t)
s553906763
p02572
u914693053
1598793209
Python
Python (3.8.2)
py
Runtime Error
27
8896
140
n=int(input()) a=list(map(int,input().split())) if n==1: print(a[0]) else: l=list(map(lambda z:z**2,a) x=sum(a) y=sum(l) t=(x-y)//2 print(t)
s520617080
p02572
u321379724
1598792844
Python
Python (3.8.2)
py
Runtime Error
2291
3323992
126
N = int(input()) a = list(map(int,input().split())) s = 0 for i in range(N): s += sum(a[i]*a[i+1:]) print(s%(pow(10,9)+7))
s496934897
p02572
u321379724
1598792774
Python
Python (3.8.2)
py
Runtime Error
2292
3324808
136
N = int(input()) a = list(map(int,input().split())) s = 0 for i in range(N): b = a[i] s += sum(b*a[i+1:]) print(s%(pow(10,9)+7))
s153218928
p02572
u987846648
1598792061
Python
PyPy3 (7.3.0)
py
Runtime Error
125
105648
223
N = int(input()) A = list(map(int,input().split())) SUMA = 0 MOD = 10**9 + 7 C = [0] * (N-1) for i in range(N): SUMA += A[i] C[i] = SUMA ans = 0 for i in range(N-1): ans += A[i]*C[i] ans %= MOD print(ans)
s009235868
p02572
u987846648
1598791089
Python
PyPy3 (7.3.0)
py
Runtime Error
95
74732
224
mod =10**9 +7 n = int(input()) a = list(map(int, input().split())) sumpro = 0 for i in range(n-1): x = 0 for j in range(i+1, n): x += a[j] x = x%mod y = a[i]* x sumpro += y print(sumpro%mod)
s929068191
p02572
u784982404
1598784337
Python
Python (3.8.2)
py
Runtime Error
45
25056
154
N = int(input()) A = input().split() Sum = sum(A) ans = 0 for i in range(N): ans += int(A[i])*(Sum-int(A[i])) ans %= 1000000007 print(int(ans/2))
s130819256
p02572
u243312682
1598782189
Python
Python (3.8.2)
py
Runtime Error
157
31416
625
def main(): n = int(input()) A = [int(x) for x in input().split()] mod = 10**9+7 # a_sum = sum(A) a_cum = [0] * (n+1) for i in range(n): a_cum[i + 1] = a_cum[i] + A[i] ans = 0 for i in range(len(A)-1): ans += A[i] * (a_cum[n] - a_cum[i+1]) % mod ans %= mod pri...
s292586284
p02572
u060505280
1598776750
Python
Python (3.8.2)
py
Runtime Error
27
8948
259
mport numpy as np from decimal import Decimal N = int(input()) numbers = np.array(list(map(int, input().split())), dtype=Decimal) square = numbers.sum()**2 numbers_pow = numbers**2 times_sum = (square - numbers_pow.sum()) / 2 print(int(times_sum % (1e9 + 7)))
s687697230
p02572
u060505280
1598775337
Python
Python (3.8.2)
py
Runtime Error
2263
3042764
265
import numpy as np N = int(input()) numbers = np.array(list(map(int, input().split()))) ii, jj = np.meshgrid(range(N), range(N)) xx, yy = np.meshgrid(numbers, numbers) times = xx * yy times_sum = np.where(ii < jj, times, 0).sum() print(int(times_sum % (1e+9 + 7)))
s302851820
p02572
u060505280
1598775252
Python
Python (3.8.2)
py
Runtime Error
2264
2550072
249
import numpy as np N = int(input()) numbers = np.array(list(map(int, input().split()))) ii, jj = np.mgrid[:N, :N] xx, yy = np.meshgrid(numbers, numbers) times = xx * yy times_sum = np.where(ii < jj, times, 0).sum() print(int(times_sum % (1e9 + 7)))
s481503113
p02572
u060505280
1598775060
Python
Python (3.8.2)
py
Runtime Error
2260
3200524
265
import numpy as np N = int(input()) numbers = np.array(list(map(int, input().split()))) ii, jj = np.meshgrid(range(N), range(N)) xx, yy = np.meshgrid(numbers, numbers) times = xx * yy times_sum = np.where(ii < jj, times, 0).sum() print(int(times_sum % 1000000007))
s537130968
p02572
u060505280
1598774994
Python
Python (3.8.2)
py
Runtime Error
167
49900
266
import numpy as np N = int(input()) numbers = np.array(list(map(int, input().split()))) ii, jj = np.mesehgrid(range(N), range(N)) xx, yy = np.meshgrid(numbers, numbers) times = xx * yy times_sum = np.where(ii < jj, times, 0).sum() print(int(times_sum % 1000000007))
s129705384
p02572
u060505280
1598774602
Python
Python (3.8.2)
py
Runtime Error
2263
2705440
252
import numpy as np N = int(input()) numbers = np.array(list(map(int, input().split()))) ii, jj = np.mgrid[:N, :N] xx, yy = np.meshgrid(numbers, numbers) times = xx * yy times_sum = np.where(ii < jj, times, 0).sum() print(int(times_sum % (1000000007)))
s389654780
p02572
u060505280
1598774155
Python
Python (3.8.2)
py
Runtime Error
2256
2721936
251
import numpy as np N = int(input()) numbers = np.array(list(map(int, input().split()))) ii, jj = np.mgrid[:N, :N] xx, yy = np.meshgrid(numbers, numbers) times = xx * yy times_sum = np.where(ii < jj, times, 0).sum() print(int(times_sum % (1e+9 + 7)))
s161543500
p02572
u557792847
1598774087
Python
Python (3.8.2)
py
Runtime Error
22
8904
571
mport sys import numpy as np import math import collections import copy import decimal import itertools from collections import deque from functools import reduce from itertools import product from itertools import combinations # input = sys.stdin.readline N = int(input()) An = list(map(int, input().split())) An_l = ...
s288531143
p02572
u073139376
1598769015
Python
Python (3.8.2)
py
Runtime Error
2234
1929116
183
import numpy as np m=1000000007 n=int(input()) a=np.array(list(map(int,input().split()))) aa=np.ravel(np.triu(np.outer(a,a),k=1))%m ans=0 for a in aa: ans+=a ans%=m print(ans)
s105783596
p02572
u073139376
1598768909
Python
Python (3.8.2)
py
Runtime Error
2243
1930016
184
import numpy as np m=1000000007 n=int(input()) a=np.array(list(map(int,input().split()))) aa=np.outer(a,a)[np.triu_indices(n,k=1)]%m ans=0 for a in aa: ans+=a ans%=m print(ans)
s792439503
p02572
u887959172
1598768154
Python
PyPy3 (7.3.0)
py
Runtime Error
88
74652
486
#include <iostream> #include <vector> using namespace std; const unsigned int M = 1000000007; int N; int main(){ cin >> N; vector<long long> A; for(int i = 0; i < N; i++){ long long x; cin >> x; A.push_back(x); } long long sum = 0; for(int i = 0; i < N; i++){ ...
s680075858
p02572
u825343780
1598765245
Python
Python (3.8.2)
py
Runtime Error
24
8940
1565
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <iomanip> #include <set> #include <map> #include <numeric> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define mod 1000000007 #include ...
s065288954
p02572
u132147074
1598741911
Python
Python (3.8.2)
py
Runtime Error
77
34080
288
num = int(input()) line = input() arr = [int(x) for x in line.split(" ")] post = [] post[num - 1] = arr[num - 1] for i in range(2, num + 1): post[num - i] = post[num-i+1] + arr[num - i] sum = 0 for i in range(num-1): sum += arr[i] * post[i+1] sum %= 1e9 + 7 print(int(sum))
s612205843
p02572
u167993508
1598741712
Python
Python (3.8.2)
py
Runtime Error
104
31388
164
n = int(input()) l = list(map(int,input().split())) ans = 0 for i in range(1,n): l[i] += l[i-1] i = 0 while i<n-1: ans += l[i]*(l[n] - l[i]) i += 1 print(ans)
s602805145
p02572
u766565683
1598738880
Python
Python (3.8.2)
py
Runtime Error
25
9028
235
n = int(input()) a = list(map(int, input().split())) sigma = sum(a) count = 0 for i in range(len(a)-1): start = a[i] sigma = sigma-a[i] count = count + start * if count >= 10**9+7: count = count % (10**9+7) print(count)
s249916686
p02572
u671889550
1598737780
Python
PyPy3 (7.3.0)
py
Runtime Error
154
68732
274
import numpy as np n = int(input()) a = np.array(list(map(int, input().split())), dtype = 'object') mod = 10**9 + 7 sq_sum_a = sum(a)**2 sum_sq_a = sum(a**2) sum_cross = (sq_sum_a - sum_sq_a) // 2 ans = sum_cross % mod # xy = ((x + y)**2 - (x**2 + y**2)) // 2 print(ans)
s590425487
p02572
u779293207
1598737062
Python
Python (3.8.2)
py
Runtime Error
73
31564
119
N=int(input()) A=list(map(int,input().split())) A2=0 for i in ragne(len(A)): A2+=A[i]**2 c=(sum(A))**2-A2 print(c//2)
s509970638
p02572
u290887281
1598736846
Python
Python (3.8.2)
py
Runtime Error
78
31556
177
mod = 10 ** 9 + 7 n = int(input()) a_list = list(map(int, input().split())) result = 0 a_sum = sum(a) for i in a_list: a_sum -= i result += i * a_sum print(result % mod)
s185047347
p02572
u467544200
1598736825
Python
PyPy3 (7.3.0)
py
Runtime Error
551
76736
504
import resource; import random # 再帰回数上弦を100000回に設定 sys.setrecursionlimit(100000) # スタックサイズを無制限に設定 resource.setrlimit(resource.RLIMIT_STACK, (-1, -1)) n = int(input('')) adl = input('') a = list(map(int,adl.split(' '))) number = 0 mod = 7+1000000000 amari = 0 for i in range(n): aa = 0 for e in range(n-i-1)...
s675948032
p02572
u290887281
1598736546
Python
Python (3.8.2)
py
Runtime Error
80
31388
177
mod = 10 ** 9 + 7 n = int(input()) a_list = list(map(int, input().split())) result = 0 a_sum = sum(a) for i in a_list: a_sum -= i result += i * a_sum print(result % mod)
s904744296
p02572
u170913092
1598735326
Python
Python (3.8.2)
py
Runtime Error
70
31836
305
N = int(input()) A = list(map(int,input().split())) mod = 10**9+7 partial_sum = copy.deepcopy(A) sum_now = A[N-1] for j in range(N-2,-1,-1): sum_now = int((sum_now+A[j])%mod) partial_sum[j] = sum_now res = 0 for i in range(N-1): res = (res + (A[i]*partial_sum[i+1])%mod) %mod print(int(res))
s797247882
p02572
u736154449
1598735287
Python
PyPy3 (7.3.0)
py
Runtime Error
131
94204
189
N=int(input()) A=list(map(int,input().split())) S=sum(A) ##print(S) tmp=0 T=0 for i in range(N): T=T+[i+1] ##print(T) ##print(A[i]) tmp=(A[i]*(S-T)+tmp) tmp=tmp%(10**9+7) print(tmp)
s357409029
p02572
u065099501
1598735264
Python
Python (3.8.2)
py
Runtime Error
74
31576
216
import sys input = sys.stdin.readline n = int(input()) tmp = list(map(int, input().split())) A = [a % M for a in tmp] M = 1000000007 ans = 0 for i in range(1,n): ans += (A[i-1] * ((sum(A[i::])%M)))%M print(ans%M)
s726487358
p02572
u825343780
1598735053
Python
Python (3.8.2)
py
Runtime Error
22
8936
770
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <iomanip> #include <set> #include <map> #include <numeric> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define mod 1000000007 int main(...
s708530765
p02572
u485319545
1598734749
Python
PyPy3 (7.3.0)
py
Runtime Error
134
94264
192
n=int(input()) a=list(map(int,input().split())) mod=10**9+7 import numpy as np total = sum(a) cum=[] ans=0 for i in range(n): total-=a[i] ans += a[i]*(total)%mod print(ans%mod)
s548371047
p02572
u275030199
1598734561
Python
Python (3.8.2)
py
Runtime Error
2209
126276
190
n = int(input()) a = input().split() print(a) import numpy as np arr = np.zeros((n,n)) for i in range(n): arr[i,:] = [float(s) for s in a] arr = np.triu(arr,k=-1) print(int(np.sum(arr)))
s275336674
p02572
u768944351
1598734512
Python
PyPy3 (7.3.0)
py
Runtime Error
108
68636
2
hu
s629547737
p02572
u348293370
1598734435
Python
Python (3.8.2)
py
Runtime Error
25
9052
164
from C import ans n = int(input()) n_list = [int(i) for i in input().split()] s = sum(a**2 for a in n_list) ans = sum(n_list) ** 2 - s print((ans//2)%(10**9+7))
s650483893
p02572
u155659281
1598734255
Python
Python (3.8.2)
py
Runtime Error
26
8880
200
def solve(): N = int(input()) AA = list(map(int,input().split())) ans = 0 for a in AA: ans += a ans = ans**2 for a in AA: ans -= a**2 ans = ans//2 print(ans%(10**9+7) solve()
s648025329
p02572
u329730886
1598734204
Python
Python (3.8.2)
py
Runtime Error
119
26952
194
import numpy as np A = np.asarray(input().split()).astype(np.int) ans = 0 mod = 10**9 + 7 for i in range(N): pA = (A[i] % mod) * (A[i+1:].sum() % mod) ans += pA print(int(ans % mod))
s682990679
p02572
u375695365
1598734197
Python
PyPy3 (7.3.0)
py
Runtime Error
87
68768
164
n = int(input()) a = list(map(int, input().split())) mod = 10**9+7 ans = 0 aa=sum(a) for i in range(n): aa-=a[i] ans += a[i]*a[j] ans %= mod print(ans)
s099007790
p02572
u714732628
1598734196
Python
Python (3.8.2)
py
Runtime Error
22
8880
210
n = int(input()) a = list(map(int, input().split())) s = 0 ans = 0 for i in range(len(a)): s += a[i] for i in range(len(a)-1): s -= a[i] if s<0: s += 1e9+7 ans += s*a[i] ans %= 1e9+7 print(int(ans))
s979569793
p02572
u329730886
1598734136
Python
Python (3.8.2)
py
Runtime Error
22
9060
175
A = np.asarray(input().split()).astype(np.int) ans = 0 mod = 10**9 + 7 for i in range(N): pA = (A[i] % mod) * (A[i+1:].sum() % mod) ans += pA print(int(ans % mod))
s753144653
p02572
u514222361
1598734135
Python
Python (3.8.2)
py
Runtime Error
1877
1935388
394
# -*- coding: utf-8 -*- import sys import math import numpy as np import copy n = input() a = [int(p) for p in input().split(' ')] #行列生成 aa = [] ab = [] a1 = np.array(a) a2 = np.tril(np.tile(a1, (len(a), 1)).T) #print(a2) #np.fill_diagonal(a2, 0) a3 = a1.T #print(a1 * a2) sum_n = np.sum(a2 * a3) print(sum_n % (10...
s291450164
p02572
u655048024
1598734096
Python
Python (3.8.2)
py
Runtime Error
24
9044
152
n = int(input()) a = list(map(int,input().split())) h = sum(a) ans = 0 for i in range(n): h -= a[i] ans = (ans + (a[i]*(h))%(10**9+7) print(ans)
s370357295
p02572
u682894596
1598734030
Python
Python (3.8.2)
py
Runtime Error
131
31344
219
N = int(input()) a = list(map(int, input().split(" "))) s = 0 for i in range(0,N): s += a[i] s = s*s for i in range(0,N): s -= a[i]*a[i] while s >= 2*(10**9 +7): s = int(s % (10**9 +7)) s = s/2 print(int(ss))
s554069431
p02572
u766565683
1598733867
Python
Python (3.8.2)
py
Runtime Error
79
31440
307
n = int(input()) a = list(map(int, input().split())) sigma = 0 after = sum(a[0:]) for i in range(len(a)-1): start = a[i] after = after - [i] if after >= (10**9 + 7): after = after % (10**9+7) sigma = sigma + start * after if sigma >= (10**9 + 7): sigma = sigma % (10**9+7) print(sigma)
s950898057
p02572
u514222361
1598733835
Python
Python (3.8.2)
py
Runtime Error
1894
1816764
389
# -*- coding: utf-8 -*- import sys import math import numpy as np import copy n = input() a = [int(p) for p in input().split(' ')] #行列生成 aa = [] ab = [] a1 = np.array(a) a2 = np.tile(a1, (len(a), 1)).T #print(a2) np.fill_diagonal(a2, 0) a3 = a1.T #print(a1 * a2) sum_n = np.sum(a2 * a3) // 2 print(sum_n % (1000000...
s897516067
p02572
u707567014
1598733758
Python
PyPy3 (7.3.0)
py
Runtime Error
101
68724
202
import numpy as np a = int(input()) p = list(map(int,input().split())) mod = 10**9 + 7 sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<t ] num = np.sum(sum_list) num = num%mod print(num)
s477334869
p02572
u170913092
1598733687
Python
Python (3.8.2)
py
Runtime Error
234
31552
638
n = int(input()) A = [int(x)%(1e9+7) for x in input().split()] # calculating array sum (a1 + a2 ... + an) array_sum = 0 for i in range(0, n, 1): array_sum = (array_sum + A[i])%(1e9+7) # calcualting square of array sum # (a1 + a2 + ... + an)^2 array_sum_square = (array_sum * array_sum)%(1e9+7) # c...
s856722163
p02572
u942388574
1598733626
Python
Python (3.8.2)
py
Runtime Error
24
8884
341
# -*- coding: utf-8 -*- """ Created on Sat Aug 29 22:19:15 2020 @author: naoki """ N = int(input()) A = list(map(int,input().split())) count1 = 0 count2 = 0 count = 10**9 +7 for i in A: count1+=i count1=count1%count for j in A: count2 = j*(count1-j)%count + count2 count1 = count1 -j print(count2%...
s321921533
p02572
u721652634
1598733616
Python
Python (3.8.2)
py
Runtime Error
43
13256
174
n = int(input()) m = 1e9 + 7 a = [] s = 0 r = 0 for _ in range(n): x = int(input()) a.append(x) s += x r += x * x s *= s ans = (s - r) / 2 ans %= m print(ans)
s325091422
p02572
u243312682
1598733608
Python
Python (3.8.2)
py
Runtime Error
440
62672
1054
import sys import numpy as np def main(): n = int(input()) A_ = [int(x) for x in input().split()] A = [a for a in A_ if a != 0] N = len(A) # mod = 10**9+7 mod = 200003 PR = 2 order = [1] x = PR while x != 1: order.append(x) x *= PR x %= mod order_l ...
s340736219
p02572
u616791574
1598733600
Python
Python (3.8.2)
py
Runtime Error
31
8940
470
#include<bits/stdc++.h> using namespace std; using ll = long long int; #define MOD (ll) (1e9+7) int main() { ll N; cin >> N; vector<ll> A(N); vector<ll> sum(N); for(size_t i=0;i<N; i++) { cin >> A[i]; } for(ll i=N-2;i>=0;i--) { sum[i] = (sum[i+1] + A[i+1]) % MOD; ...
s864793843
p02572
u005569385
1598733600
Python
Python (3.8.2)
py
Runtime Error
2208
72304
303
N = int(input()) a = list(map(int,input().split())) t = [];s = 0 for i in range(N): for j in range(N): if i != j: if a[i]*a[j]<10**9+7: t.append(a[i]*a[j]) else: t.append(a[i]%7*a%[j]%7) for i in t: s += i s = s//2 print(s%10**9+7)
s751975721
p02572
u243815850
1598733599
Python
Python (3.8.2)
py
Runtime Error
2208
15060
294
S = input() T = input() print(S) print(T) num = [] for i in range(len(T)): _T = T[i:] for j in range(len(T)-i): _T_ = _T if j == 0 else _T[:-j] base = S[i:-j] if j != 0 else S[i:] if _T_ in base: num.append(len(T)-len(_T_)) print(num) print(min(num))
s600248565
p02572
u787131053
1598733595
Python
PyPy3 (7.3.0)
py
Runtime Error
147
93544
686
#import numpy as np N = int(input()) #A = np.array(list(map(int,input().split(" ")))) % MOD A = list(map(int,input().split(" "))) MOD = 10**9 + 7 ans = 0 #print(A) table = np.outer(A,A) % MOD #print(table) #print(A) for i in range(0,len(A)): raw = 0 for j in range(i+1,len(A)): raw += A[j] raw = ...
s914420419
p02572
u060505280
1598733594
Python
Python (3.8.2)
py
Runtime Error
2268
3182180
269
import numpy as np N = int(input()) numbers = np.array(list(map(int, input().split()))) ii, jj = np.meshgrid(range(N), range(N)) xx, yy = np.meshgrid(numbers, numbers) times = xx * yy times_sum = np.where(ii < jj, times, 0).sum() print(int(times_sum) % int(1e+9 + 7))
s437656484
p02572
u687529684
1598733594
Python
Python (3.8.2)
py
Runtime Error
42
13156
185
N=int(input()) A = [] for i in range(N): A.append(int(input())) sum = 0 for i in range(N): for j in range(i+1,N): sum += A[i]*A[j] sum %= 1000*1000*1000+7 print(sum)
s699893969
p02572
u324918230
1598733567
Python
PyPy3 (7.3.0)
py
Runtime Error
131
94208
118
N = int(input()) A = list(map(int, input().split())) tmp = sum(A) sum_ += sum(a * (tmp - a) for a in A) print(sum_)
s138012234
p02572
u060505280
1598733558
Python
Python (3.8.2)
py
Runtime Error
1842
3524696
269
import numpy as np N = int(input()) numbers = np.array(list(map(int, input().split()))) ii, jj = np.meshgrid(range(N), range(N)) xx, yy = np.meshgrid(numbers, numbers) times = xx * yy times_sum = np.where(ii < jj, times, 0).sum() print(int(times_sum % int(1e+9 + 7)))
s164010392
p02572
u053550236
1598733552
Python
Python (3.8.2)
py
Runtime Error
128
31392
312
from sys import stdin n = stdin.readline().rstrip().split()[0] A = [int(x) for x in stdin.readline().rstrip().split()] s = str(int((sum(A)**2 - sum([a**2 for a in A])) / 2)) if(int(s) < (10**9 + 7)): print(int(s)) x = int(s[-9:]) - 7 * int(s[:-9]) if(x < 0): print(x % (10**9 + 7)) else: print(x)
s685824747
p02572
u811629303
1598733551
Python
Python (3.8.2)
py
Runtime Error
2265
1970580
481
# # 177C # import itertools n = input() b = input() n = int(n) list_c = list(range(n)) a = b.split() p_list = list(itertools.permutations(list_c, 2)) #print(p_list[0][0]) new_list = [] i = 0 for i in range(len(p_list)): #print(p_list[i][0]) #print(p_list[i][1]) if p_list[i][0]<p_list[i][1]: ne...
s024612259
p02572
u868907609
1598733550
Python
Python (3.8.2)
py
Runtime Error
183
49892
497
import numpy as np # import sys # import itertools N = int(input()) A = np.array(list(map(int, input().split()))) A = A % (1E+9+7) C = np.array(list(itertools.combinations(A,2))) # print(C[:,0]) # print(len(C)) answer = np.dot(C[:,0],C[:,1]) # product = 0 # product_sum = 0 # for i in range(len(C)): # product = ...
s717311933
p02572
u721652634
1598733540
Python
Python (3.8.2)
py
Runtime Error
37
13148
158
n = int(input()) m = 1e9 + 7 a = [] s = 0 r = 0 for _ in range(n): x = int(input()) s += x r += x * x s *= s ans = (s - r) / 2 ans %= m print(ans)
s384570195
p02572
u463893436
1598733497
Python
PyPy3 (7.3.0)
py
Runtime Error
93
68084
248
import numpy as np n = int(input()) a = list(map(int, input().split())) sum = 0 k = 0 for i in range(len(a)-1): for j in range(i+1,len(a)): k += a[j] sum += a[i] * k k = 0 ans = np.mod(sum,10**9+7) print(ans)
s394251585
p02572
u328179275
1598733493
Python
Python (3.8.2)
py
Runtime Error
807
925284
306
def sum_a(array): total = 0 for i in range(len(array)): total += array[i]**2 return(total) n = int(input()) a = list(map(int,input().split())) import numpy as np b = a.copy() c = np.array(a) d = np.array(b) e = np.outer(c,d) f = np.sum(e) g = sum_a(a) print(int((f-g)/2)%(10**9+7))
s274717019
p02572
u393077661
1598733491
Python
Python (3.8.2)
py
Runtime Error
160
31672
239
N = int(input()) A = list(map(int,input().split())) mod = 1000000007 sum = 0 indsum = 0 for i in A: sum += i sum%=mod p = (i*i)%mod indsum+=p indsum%=mod squaresum = (sum*sum)%mod res = (((sumsquare-indsum)%mod)/2)%mod print(res)
s245663440
p02572
u555767343
1598733478
Python
PyPy3 (7.3.0)
py
Runtime Error
135
94404
301
MOD = 10**9 + 7 n = int(input()) A = list(map(int, input().split())) import numpy A_CS = numpy.cumsum(sorted(A, reverse=True)) A_CS = A_CS%MOD A = sorted(A) #print(A_CS) ans = 0 for i in range(n-1): # print(A[i], A_CS[-i-2]) # A_CS -= A[i] ans = (ans+(A[i]*A_CS[-i-2])%MOD)%MOD print(ans)
s779978452
p02572
u346785363
1598733477
Python
Python (3.8.2)
py
Runtime Error
2337
3525212
359
import numpy as np def main(): N = int(input("")) in2 = input("") num_list = np.array([int(x) for x in in2.split(" ")]) i_vector = np.transpose(np.reshape(num_list, (1,N))) j_vector = np.triu(num_list, k=1) print(i_vector) print(j_vector) sum = np.sum(i_vector * j_vector) print(sum % (10**9+7)...
s089688038
p02572
u949115942
1598733457
Python
Python (3.8.2)
py
Runtime Error
2245
2297340
338
import numpy as np m = 10**9 + 7 n = int(input()) an = list(map(int, input().split())) an_np = np.array(an) an_col = np.zeros((n-1,n-1)) summary = 0 zero = np.zeros((1,n-1)) for i in range(0, n-1): tmp = np.array(an_np[i+1: n]) an_col[i] = np.append(tmp, zero)[:n-1] print(int(sum(sum(np.multiply(an_np[:-1], a...
s231681916
p02572
u939790872
1598733444
Python
Python (3.8.2)
py
Runtime Error
503
31508
227
N = int(input()) A = list(map(int, input().split())) ans = 1 res = 0 for i in range(N): ans *= A[i] ans %= 10 ** 9 + 7 for i in range(N): res += ans * pow(A[i], -1, 10 ** 9 + 7) res %= 10 ** 9 + 7 print(res)
s798609114
p02572
u060505280
1598733438
Python
Python (3.8.2)
py
Runtime Error
1768
3527216
265
import numpy as np N = int(input()) numbers = np.array(list(map(int, input().split()))) ii, jj = np.meshgrid(range(N), range(N)) xx, yy = np.meshgrid(numbers, numbers) times = xx * yy times_sum = np.where(ii < jj, times, 0).sum() print(int(times_sum % (1e+9 + 7)))
s918963168
p02572
u212539610
1598733436
Python
Python (3.8.2)
py
Runtime Error
2317
3545812
390
N = int(input()) A = [int(a) for a in input().split()] import numpy as np mod = 10**9 + 7 mesh = np.array(np.meshgrid(A, A), dtype=np.int64) comb = mesh.T.reshape(-1, 2) t_comb = [] for c in comb: if c[0] == c[1]: continue else: t_comb.append(sorted(c)) t_comb = np.unique(t_comb, axis=0) s...
s281402204
p02572
u671889550
1598733422
Python
Python (3.8.2)
py
Runtime Error
2265
1999576
202
import itertools as it n = int(input()) a = list(map(int, input().split())) c = list(it.combinations(a, 2)) ans = 0 for i in range(n): ans += int(c[i][0]) * int(c[i][1]) print(ans % (10**9 + 7))
s918667614
p02572
u053550236
1598733420
Python
Python (3.8.2)
py
Runtime Error
136
32036
310
from sys import stdin n = stdin.readline().rstrip().split()[0] A = [int(x) for x in stdin.readline().rstrip().split()] s = str(int((sum(A)**2 - sum([a**2 for a in A])) / 2)) if(int(s) < (10**9 + 7)): print(int(s)) x = int(s[-9:]) - 7 * int(s[:-9]) if(x < 0): print(x + 10**9 + 7) else: print(x)
s044170438
p02572
u346395915
1598733385
Python
Python (3.8.2)
py
Runtime Error
286
31792
322
n = int(input()) li = list(map(int, input().split())) mod = 10**9 + 7 ans = 0 for i in range(1, n): ans += li[0]*li[i] check = ans%mod for i in range(1, n): check -= li[i] * li[i-1] if check < 0: check += 10**9 + 7 check //= li[i-1] check *= li[i] ans += check ans %= mod print(ans...
s791498827
p02572
u687529684
1598733352
Python
Python (3.8.2)
py
Runtime Error
37
13288
176
N=int(input()) A = [] for i in range(N): A[i] = int(input()) sum = 0 for i in range(N): for j in range(i+1,N): sum += A[i]*A[j] sum %= 1000*1000*1000+7 print(sum)
s928513450
p02572
u905436707
1598733346
Python
Python (3.8.2)
py
Runtime Error
44
13260
222
N = int(input()) A = [] a = int(0) m = int(1000000007) n = int(1) for i in range(N): A.append(int(input())) for i in range(N-1): for j in range(N-n): a = a + A[i] * A[j + n] n += 1 print(a % m)