buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
n = int(input()) a = list(map(int,input().split())) mod = 10**9+7 sum_a = sum(a)%mod sum_a2 = sum_a**2%mod for i in range(n): sum_a2 -= (a[i]**2) sum_a2 %= mod if sum_a2%2 == 0: ans = sum_a2//2 else: ans = ((ans+mod)//2)%mod print(ans)
n = int(input()) a = list(map(int,input().split())) mod = 10**9+7 sum_a = sum(a)%mod sum_a2 = sum_a**2%mod for i in range(n): sum_a2 -= (a[i]**2)%mod sum_a2 %= mod if sum_a2%2 == 0: ans = sum_a2//2 else: ans = ((sum_a2+mod)//2)%mod print(ans)
[["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 109], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["-", 31, 23, 0, 657, 31, 23, 0, 657, 31, 22], ["+", 31, 23, 0, 657, 31, 23, 0, 657, 31, 22]]
5
99
#include <bits/stdc++.h> typedef long long ll; const ll mod = 1e9 + 7; const ll inf = 0x3f3f3f3f; const int N = 2e5 + 5; using namespace std; ll a[N]; ll sum[N]; ll ksm(ll a, ll b) { ll ans = 1; for (; b; b >>= 1, a = a * a % mod) if (b & 1) ans = ans * a % mod; return ans; } int main() { ll n; cin ...
#include <bits/stdc++.h> typedef long long ll; const ll mod = 1e9 + 7; const ll inf = 0x3f3f3f3f; const int N = 2e5 + 5; using namespace std; ll a[N]; ll sum[N]; ll ksm(ll a, ll b) { ll ans = 1; for (; b; b >>= 1, a = a * a % mod) if (b & 1) ans = ans * a % mod; return ans; } int main() { ll n; cin ...
[["+", 0, 16, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 12, 22]]
1
216
#include <bits/stdc++.h> using namespace std; using i64 = long long; int main() { i64 n, a[200001], sum{}, ans{}; i64 MOD = 1000000007; cin >> n; for (i64 i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } for (i64 i = 0; i < n - 1; i++) { sum -= a[i]; ans += sum * a[i] % MOD; ans = ans %...
#include <bits/stdc++.h> using namespace std; using i64 = long long; int main() { i64 n, a[200001], sum{}, ans{}; i64 MOD = 1000000007; cin >> n; for (i64 i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } for (i64 i = 0; i < n - 1; i++) { sum -= a[i]; ans += ((sum % MOD) * a[i]) % MOD; a...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 12, 16, 31, 23, 0, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
124
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long INF = (long)Math.pow(10, 9) + 7; int n = sc.nextInt(); long[] a = new long[n]; for (int i = 0; i < a.length; i++) { a[i] = sc.nextLong(); } long sum = 0; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long INF = (long)Math.pow(10, 9) + 7; int n = sc.nextInt(); long[] a = new long[n]; for (int i = 0; i < a.length; i++) { a[i] = sc.nextLong(); } long sum = 0; ...
[["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 109], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
3
191
/* Author: Hrujul Thumar */ #include <bits/stdc++.h> #define int long long #define pb push_back #define pf push_front #define pii pair<int, int> #define vi vector<int> #define whilet() \ int t; ...
/* Author: Hrujul Thumar */ #include <bits/stdc++.h> #define int long long #define pb push_back #define pf push_front #define pii pair<int, int> #define vi vector<int> #define whilet() \ int t; ...
[["+", 64, 1, 0, 11, 12, 16, 31, 16, 17, 109], ["+", 64, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["+", 64, 1, 0, 11, 12, 16, 12, 16, 17, 109], ["+", 64, 1, 0, 11, 12, 16, 12, 16, 12, 22]]
1
237
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define INF 0x6fffffff #define INFL 0x6fffffffffffffffLL int main() { ll b, c, h, i, j, k, l, m, n, x, y; ll ans = 0; string s; cin >> n; vector<ll> a(n + 1), t(n + 1); for (i = 0; i < n; i++) cin >> a[i]; fo...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define INF 0x6fffffff #define INFL 0x6fffffffffffffffLL int main() { ll b, c, h, i, j, k, l, m, n, x, y; ll ans = 0; string s; cin >> n; vector<ll> a(n + 1), t(n + 1); for (i = 0; i < n; i++) cin >> a[i]; fo...
[["+", 31, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 23, 0, 16, 31, 23, 0, 25], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 109], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 12, 13]]
1
183
#include <bits/stdc++.h> using namespace std; typedef long long int64; typedef vector<int> vec; typedef vector<int64> vec64; #define ss cout << " "; #define nn cout << "\n"; #define ct(x) cout << x; #define cts(x) cout << x << " "; #define ctn(x) cout << x << "\n"; #define db(x) cout << "> " << #x << ": " << x << "\n";...
#include <bits/stdc++.h> using namespace std; typedef long long int64; typedef vector<int> vec; typedef vector<int64> vec64; #define ss cout << " "; #define nn cout << "\n"; #define ct(x) cout << x; #define cts(x) cout << x << " "; #define ctn(x) cout << x << "\n"; #define db(x) cout << "> " << #x << ": " << x << "\n";...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
376
def findProductSum(A, n): # calculating array sum (a1 + a2 ... + an) array_sum = 0 for i in range(0, n, 1): array_sum = array_sum + A[i] # calcualting square of array sum # (a1 + a2 + ... + an)^2 array_sum_square = array_sum * array_sum # calcualting a1^2 + a2^2 +...
def findProductSum(A, n): # calculating array sum (a1 + a2 ... + an) array_sum = 0 for i in range(0, n, 1): array_sum = array_sum + A[i] # calcualting square of array sum # (a1 + a2 + ... + an)^2 array_sum_square = array_sum * array_sum # calcualting a1^2 + a2^2 +...
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
113
#include <iostream> #include <set> #include <string> #include <vector> using namespace std; int main(void) { size_t N; cin >> N; long long M = (1000000000 + 7); vector<long long> A(N), B(N); for (size_t i = 0; i < N; i++) cin >> A[i]; B[N - 1] = A[N - 1]; for (size_t i = 1; i < N; i++) { B[N - i...
#include <iostream> #include <set> #include <string> #include <vector> using namespace std; int main(void) { size_t N; cin >> N; long long M = (1000000000 + 7); vector<long long> A(N), B(N); for (size_t i = 0; i < N; i++) cin >> A[i]; B[N - 1] = A[N - 1]; for (size_t i = 1; i < N; i++) { B[N - i...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
186
import java.util.*; public class Main { private static final int MOD = 1_000_000_007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; long sum = 0; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); sum += ...
import java.util.*; public class Main { private static final long MOD = 1_000_000_007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; long sum = 0; for (int i = 0; i < N; i++) { A[i] = sc.nextInt(); sum +=...
[["-", 0, 235, 8, 498, 0, 124, 39, 506, 0, 507], ["+", 0, 235, 8, 498, 0, 124, 39, 506, 0, 96], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 25], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22]]
3
210
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; void _cin() {} template <class Head, class... Tail> void _cin(Head &&head, Tail &&...tail) { cin >> h...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; void _cin() {} template <class Head, class... Tail> void _cin(Head &&head, Tail &&...tail) { cin >> h...
[["+", 0, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
470
n = int(input()) a = list(map(int, input().split())) A = sum(a) A *= A B = 0 for ai in a: B += ai * ai print(int((A - B)/ 2 % 1000000007))
n = int(input()) a = list(map(int, input().split())) M = 1000000007 A = sum(a) A *= A B = 0 for ai in a: B += ai * ai print(int((A - B) // 2 % M))
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 85], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 676], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 22]]
5
62
#include <cstdio> #include <cstring> #include <iostream> using namespace std; const int N = 2e5 + 100; typedef long long ll; ll Mod = 1e9 + 7; ll a[N], sum[N]; int n; int main() { cin >> n; for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); } for (int i = n; i >= 1; i--) { sum[i] = sum[i + 1] + a[i]...
#include <cstdio> #include <cstring> #include <iostream> using namespace std; const int N = 2e5 + 100; typedef long long ll; ll Mod = 1e9 + 7; ll a[N], sum[N]; int n; int main() { cin >> n; for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); } for (int i = n; i >= 1; i--) { sum[i] = (sum[i + 1] + a[i...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
168
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define req(i, n) for (int i = 1; i <= n; i++) #define pai 3.14159265358979323846 const int INF = 1001001001; typedef long long ll; int A[3][3], N; bool punched[3][3]; bool ok[3][3]; // usin...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define req(i, n) for (int i = 1; i <= n; i++) #define pai 3.14159265358979323846 const int INF = 1001001001; typedef long long ll; int A[3][3], N; bool punched[3][3]; bool ok[3][3]; // usin...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35]]
1
488
#include <bits/stdc++.h> using namespace std; #define M (int)1e9 #define pi 3.1415926536 #define all(a) a.begin(), a.end() #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define M (int)1e9 #define pi 3.1415926536 #define all(a) a.begin(), a.end() #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["+", 31, 23, 0, 16, 31, 16, 31, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 109], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22]]
1
1,495
n = int(input()) aaa = list(map(int, input().split())) sum_a = 0 sum_aa = 0 for a in aaa: sum_a += a sum_aa += a ** 2 print(int(((sum_a ** 2 - sum_aa) / 2) % (10 ** 9 + 7)))
n = int(input()) aaa = list(map(int, input().split())) sum_a = 0 sum_aa = 0 for a in aaa: sum_a += a sum_aa += a ** 2 print(((sum_a ** 2 - sum_aa) // 2) % (10 ** 9 + 7))
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 3, 4, 0, 657, 31, 23, 0, 657, 17, 85], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 676], ["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
69
#include <iostream> #include <numeric> #include <string> #include <vector> #define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i) #define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i) #define all(x) (x).begin(), (x).end() using namespace std; using ll = long long; template <typena...
#include <iostream> #include <numeric> #include <string> #include <vector> #define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i) #define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i) #define all(x) (x).begin(), (x).end() using namespace std; using ll = long long; template <typena...
[["+", 0, 1, 0, 11, 12, 16, 31, 2, 63, 22], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 11, 12, 16, 12, 2, 63, 22], ["+", 0, 11, 12, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 11, 12, 16, 12, 2, 3, 4, 0, 25]]
1
945
#include <bits/stdc++.h> using namespace std; // template {{{ #define range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1) #define rrange(i, l, r) for (int i = (int)(r)-1; i >= (int)(l); (i) -= 1) #define whole(f, x, ...) \ ([&](decltype((x)) container)...
#include <bits/stdc++.h> using namespace std; // template {{{ #define range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1) #define rrange(i, l, r) for (int i = (int)(r)-1; i >= (int)(l); (i) -= 1) #define whole(f, x, ...) \ ([&](decltype((x)) container)...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
691
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF 1e9 #define LINF 1e18 typedef long long ll; const int MOD = 1e9 + 7; int...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF 1e9 #define LINF 1e18 typedef long long ll; const int MOD = 1e9 + 7; int...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
181
#include <bits/stdc++.h> using namespace std; #define ll long long #define pld pair<long double, int> #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define ff first #define ss second #define SZ(x) ((int)(x).size()) #define ld long double mt19937 rng(chrono::steady_clock::now().time_since_epoc...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pld pair<long double, int> #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define ff first #define ss second #define SZ(x) ((int)(x).size()) #define ld long double mt19937 rng(chrono::steady_clock::now().time_since_epoc...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
241
#include <algorithm> #include <cstdio> #include <cstring> typedef long long ll; const ll MOD = 1e9 + 7; const int maxn = 2e5 + 5; using namespace std; ll a[maxn], n, sum[maxn], ans; int main() { scanf("%lld", &n); for (int i = 1; i <= n; i++) { scanf("%lld", a + i); sum[i] = a[i] + sum[i - 1]; } for...
#include <algorithm> #include <cstdio> #include <cstring> typedef long long ll; const ll MOD = 1e9 + 7; const int maxn = 2e5 + 5; using namespace std; ll a[maxn], n, sum[maxn], ans; int main() { scanf("%lld", &n); for (int i = 1; i <= n; i++) { scanf("%lld", a + i); sum[i] = (a[i] + sum[i - 1]) % MOD; ...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
157
// ____ ____ // /@@@@\ |@@@@| ____ // /@@@@@@\ |@@@@| |@@@@| // /@@@@@@@@\ |@@@@| __|@@@@|___ ____ ____ ___ // _________ ____ ____ ____________ ___ _________ // ____ ____ // ...
// ____ ____ // /@@@@\ |@@@@| ____ // /@@@@@@\ |@@@@| |@@@@| // /@@@@@@@@\ |@@@@| __|@@@@|___ ____ ____ ___ // _________ ____ ____ ____________ ___ _________ // ____ ____ // ...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
315
#include <bits/stdc++.h> using namespace std; using lint = long long int; template <int64_t MOD> struct Mint { int64_t v; Mint() { v = 0; } Mint(int64_t x) { v = x % MOD; if (v < 0) v += MOD; } Mint operator-() { return Mint(-v); }; Mint operator+(Mint x) { return Mint(v + x.v); }; Mint op...
#include <bits/stdc++.h> using namespace std; using lint = long long int; template <int64_t MOD> struct Mint { int64_t v; Mint() { v = 0; } Mint(int64_t x) { v = x % MOD; if (v < 0) v += MOD; } Mint operator-() { return Mint(-v); }; Mint operator+(Mint x) { return Mint(v + x.v); }; Mint op...
[["+", 0, 1, 0, 11, 12, 16, 31, 2, 63, 22], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 11, 12, 16, 12, 2, 63, 22]]
1
588
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define pf push_front #define all(t) t.begin(), t.end() #define inrange(i, a, b) (((i) >= min((a), (b))) && ((i) <= max((a), (b)))) typedef vector<ll> vi; typedef pair<ll, ll> pii; #define fi first #define se ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define pf push_front #define all(t) t.begin(), t.end() #define inrange(i, a, b) (((i) >= min((a), (b))) && ((i) <= max((a), (b)))) typedef vector<ll> vi; typedef pair<ll, ll> pii; #define fi first #define se ...
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
528
#include <algorithm> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <vector> ...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <vector> ...
[["+", 31, 23, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 17, 109], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 31, 23, 0, 16, 12, 16, 12, 23, 0, 25]]
1
382
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; // typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, // tree_order_statistics_node_update> ordered_set; #define ll long long #define scn...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; // typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, // tree_order_statistics_node_update> ordered_set; #define ll long long #define scn...
[["-", 0, 14, 8, 9, 0, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 2, 63, 22]]
1
279
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define pb push_back #define ll long long #define ld long double #define sz(x) (ll) x.size() #define vi vector<int> #define vl vector<long> #define vll vector<long lo...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define pb push_back #define ll long long #define ld long double #define sz(x) (ll) x.size() #define vi vector<int> #define vl vector<long> #define vll vector<long lo...
[["+", 51, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 51, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
1,623
#include <bits/stdc++.h> #define int long long #define p pair<int, int> #define endl '\n' const int INF = 1000000001; using namespace std; const int C = 1000000007; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<int> a(n), pref = {0}; for (int ...
#include <bits/stdc++.h> #define int long long #define p pair<int, int> #define endl '\n' const int INF = 1000000001; using namespace std; const int C = 1000000007; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<int> a(n), pref = {0}; for (int ...
[["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 109], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
161
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define int long long #define double long double typedef vector<int> VI; typedef pair<int, int> pii; typedef vector<pi...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; #define int long long #define double long double typedef vector<int> VI; typedef pair<int, int> pii; typedef vector<pi...
[["+", 51, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 51, 16, 31, 23, 0, 16, 31, 23, 0, 25], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 109], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 12, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
350
// Generated at 2020-08-29 20:08:02 UTC+8 // Created by Alphagocc #include <bits/stdc++.h> #ifdef USE_PBDS #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> #endif using namespace std; #define FI __inline__ __attribute__((always_inline)) #define TN typename #define TP template #define TS ...
// Generated at 2020-08-29 20:08:34 UTC+8 // Created by Alphagocc #include <bits/stdc++.h> #ifdef USE_PBDS #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> #endif using namespace std; #define FI __inline__ __attribute__((always_inline)) #define TN typename #define TP template #define TS ...
[["+", 0, 338, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 338, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 338, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 338, 8, 9, 0, 1, 0, 35]]
1
1,566
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define ios \ ios_base::sync_with_stdio(0); \ cout.tie(0); \ cin.tie(0)...
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define ios \ ios_base::sync_with_stdio(0); \ cout.tie(0); \ cin.tie(0)...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
102
// wtrl,everybody hangbeat me #include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stri...
// wtrl,everybody hangbeat me #include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stri...
[["+", 31, 16, 12, 23, 0, 16, 31, 16, 17, 72], ["+", 31, 16, 12, 23, 0, 16, 31, 16, 12, 22]]
1
1,213
/* //katana_handler */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ordered_set_pll \ tree<pll, null_type, less<pll>, rb_tree_tag, \ tree_order_st...
/* //katana_handler */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ordered_set_pll \ tree<pll, null_type, less<pll>, rb_tree_tag, \ tree_order_st...
[["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 109], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132]]
1
821
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxn = 1e6 + 5; int main() { int n; cin >> n; std::vector<ll> pre(n + 1); for (int i = 1; i <= n; i++) cin >> pre[i]; ll ans = 0, sum = 0; const int mod = 1e9 + 7; for (int i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxn = 1e6 + 5; int main() { int n; cin >> n; std::vector<ll> pre(n + 1); for (int i = 1; i <= n; i++) cin >> pre[i]; ll ans = 0, sum = 0; const int mod = 1e9 + 7; for (int i = 1; i <= n; i++) { ...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
143
// Optimise #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "/home/shahraaz/bin/debug.h" #else #define db(...) #endif using ll = long long; #define f first #define s second #define pb push_back #define all(v) v.begin(), v.end() const int NAX = 2e5 + 5, MOD = 1000000007; struct Solution { Solut...
// Optimise #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "/home/shahraaz/bin/debug.h" #else #define db(...) #endif using ll = long long; #define f first #define s second #define pb push_back #define all(v) v.begin(), v.end() const int NAX = 2e5 + 5, MOD = 1000000007; struct Solution { Solut...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
264
#include <algorithm> #include <cassert> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; typedef long l...
#include <algorithm> #include <cassert> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; typedef long l...
[["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 12, 22]]
1
216
#include <bits/stdc++.h> #define fo(i, a, b) for ((i) = (a); i <= (b); i++) #define rfo(i, a, b) for ((i) = (a); i >= (b); i--) #define inrange(x, y, z) (((x) >= (y)) && ((x) <= (z))) #define ALL(vec) (vec).begin(), (vec).end() #define SOR(vec) sort(ALL(vec)) #define UNI(vec) (vec).erase(unique(ALL(vec)), (vec).end()) ...
#include <bits/stdc++.h> #define fo(i, a, b) for ((i) = (a); i <= (b); i++) #define rfo(i, a, b) for ((i) = (a); i >= (b); i--) #define inrange(x, y, z) (((x) >= (y)) && ((x) <= (z))) #define ALL(vec) (vec).begin(), (vec).end() #define SOR(vec) sort(ALL(vec)) #define UNI(vec) (vec).erase(unique(ALL(vec)), (vec).end()) ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
173
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 2e5 + 10; LL num[maxn], sum[maxn]; const LL mod = 1e9 + 7; int main() { LL n; cin >> n; for (int i = 1; i <= n; ++i) { cin >> num[i]; sum[i] = (sum[i - 1] + num[i]) % mod; } LL ans = 0; for (int i = 1; i <= n; ++i) ...
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 2e5 + 10; LL num[maxn], sum[maxn]; const LL mod = 1e9 + 7; int main() { LL n; cin >> n; for (int i = 1; i <= n; ++i) { cin >> num[i]; sum[i] = (sum[i - 1] + num[i]) % mod; } LL ans = 0; for (int i = 1; i <= n; ++i) ...
[["+", 0, 16, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 12, 22]]
1
152
#include <bits/stdc++.h> #define endl "\n" using namespace std; typedef long long ll; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) {...
#include <bits/stdc++.h> #define endl "\n" using namespace std; typedef long long ll; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) {...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22]]
1
234
#pragma GCC optimize("Ofast") #define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; using u8 = uint8_t; using u16 = uint16_t; using u32 = uint32_t; using u64 = uint64_t; using i8 = int8_t; using i16 = int16_t; using i32 = int32_t; using i64 = int64_t; constexpr char newl = '\n'; constexpr double ep...
#pragma GCC optimize("Ofast") #define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; using u8 = uint8_t; using u16 = uint16_t; using u32 = uint32_t; using u64 = uint64_t; using i8 = int8_t; using i16 = int16_t; using i32 = int32_t; using i64 = int64_t; constexpr char newl = '\n'; constexpr double ep...
[["+", 0, 1, 0, 11, 12, 16, 31, 2, 63, 22], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 24], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 25]]
1
964
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; cin >> N; vector<int64_t> A(N); for (int64_t &a : A) { cin >> a; } int64_t ans = 0; constexpr int64_t MOD = 1e9 + 7; int64_t sum = A[0]; for (int64_t i = 1; i < N; i++) { (ans += A[i] * sum) %= MOD; sum += A[i]; } ...
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; cin >> N; vector<int64_t> A(N); for (int64_t &a : A) { cin >> a; } int64_t ans = 0; constexpr int64_t MOD = 1e9 + 7; int64_t sum = A[0]; for (int64_t i = 1; i < N; i++) { (ans += A[i] * sum) %= MOD; (sum += A[i]) %= M...
[["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 24], ["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 25], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]]
1
105
from bisect import * from collections import * from itertools import * import functools import sys import math from decimal import * from copy import * from heapq import * from fractions import * getcontext().prec = 30 MAX = sys.maxsize MAXN = 1000010 MOD = 10**9+7 spf = [i for i in range(MAXN)] spf[0]=spf[1] = -1 def ...
from bisect import * from collections import * from itertools import * import functools import sys import math from decimal import * from copy import * from heapq import * from fractions import * getcontext().prec = 30 MAX = sys.maxsize MAXN = 1000010 MOD = 10**9+7 spf = [i for i in range(MAXN)] spf[0]=spf[1] = -1 def ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 677, 12, 23, 0, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 657, 31, 206, 206, 657, 31, 22], ["+", 0, 677, 12, 23, 0, 657, 12, 23, 0, 25]]
5
475
#include <bits/stdc++.h> using namespace std; using ll = long long; #define REP(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define REPR(i, n) for (int(i) = (n); (i) >= 0; --(i)) #define FOR(i, n, m) for (int(i) = (n); (i) < (m); ++(i)) constexpr int INF = 1e9; // constexpr ll INF = 1LL<<61; constexpr ll mod = 1e9 + 7; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define REP(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define REPR(i, n) for (int(i) = (n); (i) >= 0; --(i)) #define FOR(i, n, m) for (int(i) = (n); (i) < (m); ++(i)) constexpr int INF = 1e9; // constexpr ll INF = 1LL<<61; constexpr ll mod = 1e9 + 7; ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 51, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 23, 0, 16, 31, 23, 0, 25], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 12, 22]]
1
176
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> ...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> ...
[["+", 0, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 12, 22]]
1
292
num = int(input()) ar = list(map(int,input().split())) mod = 10**9 + 7 somee = sum(arr) ans = 0 for i in range(num): ans+=(somee-ar[i])*ar[i] print((ans//2)%mod)
num = int(input()) ar = list(map(int,input().split())) mod = 10**9 + 7 somee = sum(ar) ans = 0 for i in range(num): ans+=(somee-ar[i])*ar[i] print((ans//2)%mod)
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
74
#include <bits/stdc++.h> using namespace std; #define N 200200 #define MOD 1000000007LL long long v[N], s[N]; long ans; int n, i; int main() { cin >> n; for (i = 0; i < n; ++i) { cin >> v[i + 1]; s[i + 1] = (v[i + 1] + s[i]) % MOD; } ans = 0; for (i = 0; i < n; ++i) { ans += (v[i + 1] * (s[n] - ...
#include <bits/stdc++.h> using namespace std; #define N 200200 #define MOD 1000000007LL long long v[N], s[N]; long ans; int n, i; int main() { cin >> n; for (i = 0; i < n; ++i) { cin >> v[i + 1]; s[i + 1] = (v[i + 1] + s[i]) % MOD; } ans = 0; for (i = 0; i < n; ++i) { ans += (v[i + 1] * (s[n] - ...
[["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 12, 22]]
1
146
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define chmin(a, b) \ if ((a) > (b)) ...
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define chmin(a, b) \ if ((a) > (b)) ...
[["+", 31, 23, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 17, 109], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
302
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define int long long #define endl "\n" #define fi first #define se second #define fastio ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define int long long #define endl "\n" #define fi first #define se second #define fastio ...
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
454
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define pb push_back #define mp make_pair #define fi first #define se second #define rep(i, a, b) for (long long i = a; i < b; i++) #define per(j, a, b) for (lo...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define pb push_back #define mp make_pair #define fi first #define se second #define rep(i, a, b) for (long long i = a; i < b; i++) #define per(j, a, b) for (lo...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 12, 16, 31, 23, 0, 16, 31, 23, 0, 25]]
1
159
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pair<int, int>> vpii; typedef vector<pair<ll, ll>> vpll; #define pll pair<ll, ll> #define pii pair<int, int> #define all(x) x.begin(), x.end() #define F first #define S second #define rep(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pair<int, int>> vpii; typedef vector<pair<ll, ll>> vpll; #define pll pair<ll, ll> #define pii pair<int, int> #define all(x) x.begin(), x.end() #define F first #define S second #define rep(...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
444
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define fori(a, b) for (int i = a; i < b; i++) #define forj(a, b) for (int j = a; j < b; j++) #define ford(b, a) for (int i = b; i >= a; i--) typedef pair<int, int> pi; #define PI 3.14159265359 #define vi vector<int> long long mod ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define fori(a, b) for (int i = a; i < b; i++) #define forj(a, b) for (int j = a; j < b; j++) #define ford(b, a) for (int i = b; i >= a; i--) typedef pair<int, int> pi; #define PI 3.14159265359 #define vi vector<int> long long mod ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
278
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define ff first #define ar array #define ss second #define ll long long int #define mem(x) memset(x, 0, sizeof(x)) #define setbits(x) __builtin_popcount(x) #define ull unsign...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define ff first #define ar array #define ss second #define ll long long int #define mem(x) memset(x, 0, sizeof(x)) #define setbits(x) __builtin_popcount(x) #define ull unsign...
[["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 12, 22]]
1
486
#include <bits/stdc++.h> #include <iostream> #include <vector> #define mod 1000000007 #define pi 3.14159265358979 #define PRE(x, p) cout << setprecision(x) << p; #define pb push_back #define mp make_pair #define f first #define s second #define endl "\n" #define high INT_MAX #define low INT_MIN #define ll long long in...
#include <bits/stdc++.h> #include <iostream> #include <vector> #define mod 1000000007 #define pi 3.14159265358979 #define PRE(x, p) cout << setprecision(x) << p; #define pb push_back #define mp make_pair #define f first #define s second #define endl "\n" #define high INT_MAX #define low INT_MIN #define ll long long in...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
249
// God put a smile upon your face <3 #include <bits/stdc++.h> #define slld(longvalue) scanf("%lld", &longvalue) #define ll long long #define ull unsigned long long #define pll pair<long long, long long> #define fastio \ ios_base::sync_with_stdio(fals...
// God put a smile upon your face <3 #include <bits/stdc++.h> #define slld(longvalue) scanf("%lld", &longvalue) #define ll long long #define ull unsigned long long #define pll pair<long long, long long> #define fastio \ ios_base::sync_with_stdio(fals...
[["+", 0, 16, 12, 23, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
276
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var out = bufio.NewWriter(os.Stdout) func next() string { sc.Scan() return sc.Text() } func nextInt() int { a, _ := strconv.Atoi(next()) return a } const DIV int = 1e9 + 7 func main() { buf := make([]byte, 1024*1024)...
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var out = bufio.NewWriter(os.Stdout) func next() string { sc.Scan() return sc.Text() } func nextInt() int { a, _ := strconv.Atoi(next()) return a } const DIV int = 1e9 + 7 func main() { buf := make([]byte, 1024*1024)...
[["-", 0, 16, 31, 23, 0, 16, 31, 16, 17, 109], ["-", 0, 16, 31, 23, 0, 16, 31, 16, 12, 22]]
7
251
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using vc = vector<char>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvl = ...
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using vc = vector<char>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvl = ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 18], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 47]]
1
1,088
def main(): n = int(input()) a = list(map(int,input().split())) mod = 10**9+7 S = sum(a) ans = 0 for i in range(n): ans += (a[i] * (S-a[i])) % mod print(ans%mod //2) if __name__ == "__main__": main()
def main(): n = int(input()) a = list(map(int,input().split())) mod = 10**9+7 S = sum(a) ans = 0 for i in range(n): ans += (a[i] * (S-a[i])) print(ans//2%mod) if __name__ == "__main__": main()
[["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 109], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 109], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
91
#include <bits/stdc++.h> #define int long long using namespace std; const int MOD = 1e9 + 7; int32_t main() { int n; cin >> n; int a[n]; int p[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (i != 0) p[i] = p[i - 1] + a[i]; else p[i] = a[i]; } int sum = 0; for (int i = 0; i < n...
#include <bits/stdc++.h> #define int long long using namespace std; const int MOD = 1e9 + 7; int32_t main() { int n; cin >> n; int a[n]; int p[n]; for (int i = 0; i < n; i++) { cin >> a[i]; if (i != 0) p[i] = p[i - 1] + a[i]; else p[i] = a[i]; } int sum = 0; for (int i = 0; i < n...
[["+", 0, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["-", 31, 23, 0, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 16, 12, 23, 0, 16, 12, 23, 0, 25], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
164
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++) const ll MAX = 1001001; const ll MOD = 1000000007; const ll INF = 1001001001; int main() { ll n; cin >> n; vector...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++) const ll MAX = 1001001; const ll MOD = 1000000007; const ll INF = 1001001001; int main() { ll n; cin >> n; vector...
[["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 109], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22]]
1
161
#include <bits/stdc++.h> #define fst first #define snd second #define ll long long #define ld long double #define pb push_back #define emp emplace_back #define pii pair<int, int> #define usg unsigned #define sg signed #define mp make_pair using namespace std; void setIO() { ios::sync_with_stdio(0); cin.tie(0); ...
#include <bits/stdc++.h> #define fst first #define snd second #define ll long long #define ld long double #define pb push_back #define emp emplace_back #define pii pair<int, int> #define usg unsigned #define sg signed #define mp make_pair using namespace std; void setIO() { ios::sync_with_stdio(0); cin.tie(0); ...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
229
#include <bits/stdc++.h> #define int long long #define pb push_back #define fi first #define se second using namespace std; using pii = pair<int, int>; const int mod = 1e9 + 7; int A[200200], sum[200200]; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; for (int i = 1; i <= ...
#include <bits/stdc++.h> #define int long long #define pb push_back #define fi first #define se second using namespace std; using pii = pair<int, int>; const int mod = 1e9 + 7; int A[200200], sum[200200]; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; for (int i = 1; i <= ...
[["+", 0, 16, 31, 16, 31, 16, 31, 16, 17, 109], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22]]
1
181
// By: Luogu@rui_er(122461) #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 2e5 + 5, mod = 1e9 + 7; ll n, a[N], s[N], ans; int main() { scanf("%lld", &n); for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); s[i] = s[i - 1] + a[i]; } for (int i = 1; i <= n; i++) an...
// By: Luogu@rui_er(122461) #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 2e5 + 5, mod = 1e9 + 7; ll n, a[N], s[N], ans; int main() { scanf("%lld", &n); for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); s[i] = (s[i - 1] + a[i]) % mod; } for (int i = 1; i <= n; i++...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
150
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<int> pref(n); const int MOD = 1e9 + 7; pref[0] = a[0]; for (int i = 1; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<int> pref(n); const int MOD = 1e9 + 7; pref[0] = a[0]; for (int i = 1; i < n; i++) { ...
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25]]
1
201
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define ll long long #define dd double #define MOD1 1000000007 #define MOD2 998244353 #define nl cout << endl #define rt ll Q[100005] = {0} #define mp make_pair #define test() ...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; #define ll long long #define dd double #define MOD1 1000000007 #define MOD2 998244353 #define nl cout << endl #define rt ll Q[100005] = {0} #define mp make_pair #define test() ...
[["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 12, 22]]
1
448
#include <bits/stdc++.h> #define ll long long #define pb push_back #define fi first #define se second #define m 1000000007 using namespace std; int main() { ll n; cin >> n; ll a[n]; for (int i = 0; i < n; i++) cin >> a[i]; ll suff[n]; suff[n - 1] = a[n - 1]; for (int i = n - 2; i >= 0; i--) { suff...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define fi first #define se second #define m 1000000007 using namespace std; int main() { ll n; cin >> n; ll a[n]; for (int i = 0; i < n; i++) cin >> a[i]; ll suff[n]; suff[n - 1] = a[n - 1]; for (int i = n - 2; i >= 0; i--) { suff...
[["+", 12, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 31, 23, 0, 25], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
175
////////////// VATSAL AGARWAL //////////////////////// ////////////// Codeforces id : warhead38 //////////////////////// ////////////// Codechef id : vatsal38 //////////////////////// #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace st...
////////////// VATSAL AGARWAL //////////////////////// ////////////// Codeforces id : warhead38 //////////////////////// ////////////// Codechef id : vatsal38 //////////////////////// #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace st...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
388
#include <bits/stdc++.h> using namespace std; #define fastio() \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long ...
#include <bits/stdc++.h> using namespace std; #define fastio() \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long ...
[["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
179
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; ll a[N], b[N]; const int M = 1e9 + 7; int main() { int n; cin >> n; ll res = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; b[i] = b[i - 1] + a[i]; } for (int i = n; i >= 1; i--) { res = (res + (a[i] * b...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; ll a[N], b[N]; const int M = 1e9 + 7; int main() { int n; cin >> n; ll res = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; b[i] = b[i - 1] + a[i]; } for (int i = n; i >= 1; i--) { res = (res + (a[i] * (...
[["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
145
#include <stdio.h> const long mod = 1000000007l; int N, A[1 << 18]; long sum = 0, ans = 0; int main() { scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%d", &A[i]); sum += A[i]; } for (int i = 0; i < N; i++) { sum -= A[i]; ans += A[i] * sum % mod; ans %= mod; } printf("%ld\n", ans)...
#include <stdio.h> const long mod = 1000000007l; int N, A[1 << 18]; long sum = 0, ans = 0; int main() { scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%d", &A[i]); sum += A[i]; } for (int i = 0; i < N; i++) { sum -= A[i]; ans += sum % mod * A[i] % mod; ans %= mod; } printf("%ld\n"...
[["+", 0, 11, 12, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 109], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22]]
0
130
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define deb(x) cout << #x << " " << x << "\n"; #define MAX 9223372036854775807 #define MIN -9223372036854775807 #define PI 3.141592653589 #define setbits(n) __builtin_popcountll(n) const ll mod = 1e9 + 7; i...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define deb(x) cout << #x << " " << x << "\n"; #define MAX 9223372036854775807 #define MIN -9223372036854775807 #define PI 3.141592653589 #define setbits(n) __builtin_popcountll(n) const ll mod = 1e9 + 7; i...
[["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 12, 22]]
1
243
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define F first #define S second #define endl '\n' #define all(v) (v).begin(), (v).end() template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define F first #define S second #define endl '\n' #define all(v) (v).begin(), (v).end() template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep...
[["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 109], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
433
#include <bits/stdc++.h> #define int long long using namespace std; int const MOD = 1000000007; int n, ans, a[233333], sum[233333]; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 1; i--) sum[i] = sum[i + 1] +...
#include <bits/stdc++.h> #define int long long using namespace std; int const MOD = 1000000007; int n, ans, a[233333], sum[233333]; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 1; i--) sum[i] = (sum[i + 1] ...
[["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 12, 22]]
1
155
#include <bits/stdc++.h> #define ntest 0 using namespace std; int n; long long a[200005], f[201000], res; const int mod = 1e9 + 7; void solve() { cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; f[i] = f[i - 1] + a[i]; } res = 0; for (int i = 2; i <= n; ++i) { res = (res + (a[i] * f[i - 1] ...
#include <bits/stdc++.h> #define ntest 0 using namespace std; int n; long long a[200005], f[201000], res; const int mod = 1e9 + 7; void solve() { cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; f[i] = f[i - 1] + a[i]; } res = 0; for (int i = 2; i <= n; ++i) { res = (res + (a[i] * (f[i - 1]...
[["+", 12, 23, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 17, 109], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 23, 0, 16, 31, 16, 12, 23, 0, 25]]
1
185
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mod = 1000000007; // const int mod = 998244353; struct mint { ll x; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint m) { if ((x += m.x) >= mod) x -= mod;...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mod = 1000000007; // const int mod = 998244353; struct mint { ll x; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint m) { if ((x += m.x) >= mod) x -= mod;...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
486
#include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define CHECK_IMPL...
#include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define CHECK_IMPL...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40]]
1
318
#include <bits/stdc++.h> #define x first #define y second #define pb push_back #define mk make_pair #define all(a) a.begin(), a.end() #define len(a) (int)a.size() using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; int main() { int n; cin >> n; vector<ll> d(n); for ...
#include <bits/stdc++.h> #define x first #define y second #define pb push_back #define mk make_pair #define all(a) a.begin(), a.end() #define len(a) (int)a.size() using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; int main() { int n; cin >> n; vector<ll> d(n); for ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 31, 23, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 12, 16, 31, 23, 0, 16, 31, 23, 0, 25]]
1
187
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; ll a[N]; ll sum[N]; const ll mod = 1e9 + 7; int main() { ll n; scanf("%lld", &n); for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); } for (int i = n; i >= 1; i--) { sum[i] = sum[i + 1] + a[i]; } ll ans = ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; ll a[N]; ll sum[N]; const ll mod = 1e9 + 7; int main() { ll n; scanf("%lld", &n); for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); } for (int i = n; i >= 1; i--) { sum[i] = (sum[i + 1] + a[i]) % mod; } l...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
177
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long result = 0; int N = sc.nextInt(); long A[] = new long[N]; long sum = 0; for (int i = 0; i < N; i++) { A[i] = sc.nextLong(); sum += A[i]; } for ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long result = 0; int N = sc.nextInt(); long A[] = new long[N]; long sum = 0; for (int i = 0; i < N; i++) { A[i] = sc.nextLong(); sum += A[i]; } for ...
[["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 109], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 12, 499]]
3
148
// Author: AnandRaj doubleux #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vpii; typedef pair<ll, ll> pll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<pll> vpl...
// Author: AnandRaj doubleux #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vpii; typedef pair<ll, ll> pll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<pll> vpl...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
306
#include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" #define ordered_set \ tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, \ tree_order_statistics_node_update> using namespa...
#include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" #define ordered_set \ tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, \ tree_order_statistics_node_update> using namespa...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35]]
1
454
#include <iostream> #include <string> #include <vector> using ll = long long; const ll MOD = 1000000007; int main() { ll n; std::cin >> n; std::vector<ll> a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } std::vector<ll> csum(n); csum[0] = a[0] % MOD; for (int i = 1; i < n; i++) { csum[...
#include <iostream> #include <string> #include <vector> using ll = long long; const ll MOD = 1000000007; int main() { ll n; std::cin >> n; std::vector<ll> a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } std::vector<ll> csum(n); csum[0] = a[0] % MOD; for (int i = 1; i < n; i++) { csum[...
[["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 22]]
1
200
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */ // codeforces #include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimization ("O3") //#pragma GCC optimization ("unroll-loops") using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define FASTIO ios::sync_with...
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */ // codeforces #include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimization ("O3") //#pragma GCC optimization ("unroll-loops") using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define FASTIO ios::sync_with...
[["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 12, 22]]
1
398
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); ++i) #define INF (1LL << 50) #define MOD 1000000007 int main() { int N; cin >> N; vector<ll> ALSUM(N + 1); vector<ll> A(N); rep(i, N) { cin >> A[i]; ALSUM[i + 1] = ALSUM[i] + A[i]; ALSUM...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); ++i) #define INF (1LL << 50) #define MOD 1000000007 int main() { int N; cin >> N; vector<ll> ALSUM(N + 1); vector<ll> A(N); rep(i, N) { cin >> A[i]; ALSUM[i + 1] = ALSUM[i] + A[i]; ALSUM...
[["+", 51, 16, 12, 23, 0, 16, 31, 16, 17, 72], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 12, 22]]
1
155
#include "bits/stdc++.h" #include <random> using namespace std; typedef unsigned long long _ulong; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld; #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define FOR(i, begin, end) ...
#include "bits/stdc++.h" #include <random> using namespace std; typedef unsigned long long _ulong; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld; #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define FOR(i, begin, end) ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
812
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define mp make_pair #define full(a) a.begin(), a.end() #define rfull(a) a.rbegin(), a.rend() using namespace std; const double pi = acos(-1.0); const double pii = 2 * pi; const double eps = 1e-6; const long long MOD = 1e9 + 7; long long p...
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define mp make_pair #define full(a) a.begin(), a.end() #define rfull(a) a.rbegin(), a.rend() using namespace std; const double pi = acos(-1.0); const double pii = 2 * pi; const double eps = 1e-6; const long long MOD = 1e9 + 7; long long p...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
321
#include <iostream> #include <vector> using namespace std; using ll = long long; const ll MOD = 1000000007; int main() { ll N, S{}, S2{}, A; cin >> N; while (cin >> A) { S = (S + A) % (MOD * 2); S2 = (S2 + A * A) % (MOD * 2); } ll ans = ((S * S) - S2) % MOD / 2; cout << ans << endl; }
#include <iostream> #include <vector> using namespace std; using ll = long long; const ll MOD = 1000000007; int main() { ll N, S{}, S2{}, A; cin >> N; while (cin >> A) { S = (S + A) % (MOD * 2); S2 = (S2 + A * A) % (MOD * 2); } ll ans = ((S * S) - S2) % (MOD * 2) / 2; cout << ans << endl; }
[["+", 49, 50, 51, 16, 31, 16, 12, 23, 0, 24], ["+", 51, 16, 31, 16, 12, 23, 0, 16, 17, 48], ["+", 51, 16, 31, 16, 12, 23, 0, 16, 12, 13], ["+", 49, 50, 51, 16, 31, 16, 12, 23, 0, 25]]
1
104
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9 + 7; int32_t main() { ios_base ::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, ans = 0, sum = 0; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; x %= mod; ans += sum * x % mod; ans %...
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9 + 7; int32_t main() { ios_base ::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, ans = 0, sum = 0; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; x %= mod; ans += sum * x % mod; ans %...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
108
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<long long> VL; typedef vector<vector<long long>> VVL; typedef pair<int, int> P; typedef tuple<int, int, int> tpl; #define ALL(a) (a).begin(), (a).end() #define SORT(c) sort((c).begin(), (...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<long long> VL; typedef vector<vector<long long>> VVL; typedef pair<int, int> P; typedef tuple<int, int, int> tpl; #define ALL(a) (a).begin(), (a).end() #define SORT(c) sort((c).begin(), (...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
419
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const ll MOD = 1000000007; ll n; ll a[200005]; ll s; ll b[200005]; ll ans; int main(void) { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; b[i + 1] = b[i] + a[i]; s = (s + a[i]) % MOD; } for (int i = 0;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const ll MOD = 1000000007; ll n; ll a[200005]; ll s; ll b[200005]; ll ans; int main(void) { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; b[i + 1] = (b[i] + a[i]) % MOD; s = (s + a[i]) % MOD; } for (in...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
173
#include <bits/stdc++.h> #include <fstream> #include <iostream> #include <stdlib.h> using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<ll, ll> llP; ll mod(ll a, ll b) { ll ret = a % b; if (ret < 0) ret += b; return ret; } ll modpow(ll a, ll b, ll c) { ll res = 1; while (b ...
#include <bits/stdc++.h> #include <fstream> #include <iostream> #include <stdlib.h> using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<ll, ll> llP; ll mod(ll a, ll b) { ll ret = a % b; if (ret < 0) ret += b; return ret; } ll modpow(ll a, ll b, ll c) { ll res = 1; while (b ...
[["+", 75, 76, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
267
/* * Author: .-O_O-. */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long #define pb push_back #define vi vector<int> #define rep0(a, b) for (int a = 0; a < b; a++) #define rep1(a, b) for (int a ...
/* * Author: .-O_O-. */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long #define pb push_back #define vi vector<int> #define rep0(a, b) for (int a = 0; a < b; a++) #define rep1(a, b) for (int a ...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
683
#include <algorithm> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; typedef long long li; #define minimize(a, b) (a > (b) ? a = (b), 1 : 0) #define maximize(a, b) (a < (b) ? a = (b), 1 : 0) #define ceil(a, b) (((a) + (b)-1) / (b)) #define yn...
#include <algorithm> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; typedef long long li; #define minimize(a, b) (a > (b) ? a = (b), 1 : 0) #define maximize(a, b) (a < (b) ? a = (b), 1 : 0) #define ceil(a, b) (((a) + (b)-1) / (b)) #define yn...
[["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 24], ["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 25], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]]
1
592
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int mod = 1000000007; int main() { ios::sync_with_stdio(false); int n; ll a[...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int mod = 1000000007; int main() { ios::sync_with_stdio(false); int n; ll a[...
[["+", 0, 34, 12, 34, 12, 11, 12, 16, 17, 109], ["+", 0, 34, 12, 34, 12, 11, 12, 16, 12, 22]]
1
143
#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i, s, f) for (i = s; i < f; i++) #define print(v) \ for (auto &z : v) \ cout << z << ' '; ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i, s, f) for (i = s; i < f; i++) #define print(v) \ for (auto &z : v) \ cout << z << ' '; ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
211
import math from fractions import Fraction as frac MOD = 1e9 + 7 def solve(case_no): n = int(input()) a = list(map(int, input().split())) ps = [a[0]] for i in range(1, n): ps.append(ps[i - 1] + a[i]) ans = 0 for i in range(n - 2, -1, -1): ans += a[i + 1] * ps[i] ans %= ...
import math from fractions import Fraction as frac MOD = 1000000007 def solve(case_no): n = int(input()) a = list(map(int, input().split())) ps = [a[0]] for i in range(1, n): ps.append(ps[i - 1] + a[i]) ans = 0 for i in range(n - 2, -1, -1): ans += a[i + 1] * ps[i] ans ...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 531], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
140
#pragma region kyopuro_templates #pragma GCC optimize("Ofast") #include <assert.h> #include <ctype.h> #include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> typedef long long ll; typedef long double ld; #define rep(i, l, r) for (ll i = (l); i < (r); i++) #def...
#pragma region kyopuro_templates #pragma GCC optimize("Ofast") #include <assert.h> #include <ctype.h> #include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> typedef long long ll; typedef long double ld; #define rep(i, l, r) for (ll i = (l); i < (r); i++) #def...
[["+", 0, 11, 12, 16, 31, 23, 0, 2, 63, 22], ["+", 12, 16, 31, 23, 0, 2, 3, 4, 0, 24], ["+", 12, 16, 31, 23, 0, 2, 3, 4, 0, 25]]
0
4,733
// Problem : C - Sum of product of pairs // Contest : AtCoder - AtCoder Beginner Contest 177 // URL : https://atcoder.jp/contests/abc177/tasks/abc177_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_co...
// Problem : C - Sum of product of pairs // Contest : AtCoder - AtCoder Beginner Contest 177 // URL : https://atcoder.jp/contests/abc177/tasks/abc177_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_co...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
245
#include <bits/stdc++.h> using namespace std; using llong = long long; using ldbl = long double; using lpair = pair<llong, llong>; #define ALL(x) x.begin(), x.end() constexpr llong mod = 1e9 + 7; constexpr llong inf = mod * mod; int main() { llong N; vector<llong> A; vector<llong> rui; cin >> N; A.resize...
#include <bits/stdc++.h> using namespace std; using llong = long long; using ldbl = long double; using lpair = pair<llong, llong>; #define ALL(x) x.begin(), x.end() constexpr llong mod = 1e9 + 7; constexpr llong inf = mod * mod; int main() { llong N; vector<llong> A; vector<llong> rui; cin >> N; A.resize...
[["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 12, 22]]
1
179
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 2e5 + 5; const int MOD = 1e9 + 7; int n; ll a[MAXN], pos[MAXN], ans; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 1; i--) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 2e5 + 5; const int MOD = 1e9 + 7; int n; ll a[MAXN], pos[MAXN], ans; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 1; i--) ...
[["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 12, 22]]
1
169
#include <bits/stdc++.h> using namespace std; const int p = 1000000007; long long s[200003], ans, q[200003]; int n, m; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%lld", &s[i]); q[i] = s[i] + q[i - 1]; } for (int i = 2; i <= n; ++i) { ans = (ans + (s[i] * (q[i - 1]) % p) % p)...
#include <bits/stdc++.h> using namespace std; const int p = 1000000007; long long s[200003], ans, q[200003]; int n, m; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%lld", &s[i]); q[i] = (s[i] + q[i - 1]) % p; } for (int i = 2; i <= n; ++i) { ans = (ans + (s[i] * (q[i - 1]) % p...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
150