criyle/codenet-compile-errors huggingface dataset:
Language: C++

long 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]) % DIV;
        //cerr << sum[i] << endl;
    }

    ll total = 0;
    for(size_t i=0;i<N-1; i++)
    {
        //sum -= A[i];
        total += (A[i] * sum[i]) %DIV;
        total %= DIV;
        /*
        for(size_t j=i+1;j<N; j++)
        {
            ll mul = (A[i]*A[j]) % DIV;
            sum += mul;
            sum %= DIV;
        }
        */
    }
    cout << total << endl

Compiler output:
a.cc:2:5: error: 'cin' does not name a type
    2 |     cin >> N;
      |     ^~~
a.cc:3:5: error: 'vector' does not name a type
    3 |     vector<ll> A(N);
      |     ^~~~~~
a.cc:4:5: error: 'vector' does not name a type
    4 |     vector<ll> sum(N);
      |     ^~~~~~
a.cc:5:5: error: expected unqualified-id before 'for'
    5 |     for(size_t i=0;i<N; i++)
      |     ^~~
a.cc:5:20: error: 'i' does not name a type
    5 |     for(size_t i=0;i<N; i++)
      |                    ^
a.cc:5:25: error: 'i' does not name a type
    5 |     for(size_t i=0;i<N; i++)
      |                         ^
a.cc:9:5: error: expected unqualified-id before 'for'
    9 |     for(ll i=N-2;i>=0;i--)
      |     ^~~
a.cc:9:18: error: 'i' does not name a type
    9 |     for(ll i=N-2;i>=0;i--)
      |                  ^
a.cc:9:23: error: 'i' does not name a type
    9 |     for(ll i=N-2;i>=0;i--)
      |                       ^
a.cc:15:5: error: 'll' does not name a type
   15 |     ll total = 0;
      |     ^~
a.cc:16:5: error: expected unqualified-id before 'for'
   16 |     for(size_t i=0;i<N-1; i++)
      |     ^~~
a.cc:16:20: error: 'i' does not name a type
   16 |     for(size_t i=0;i<N-1; i++)
      |                    ^
a.cc:16:27: error: 'i' does not name a type
   16 |     for(size_t i=0;i<N-1; i++)
      |                           ^
a.cc:30:5: error: 'cout' does not name a type
   30 |     cout << total << endl
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<long long> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  long long ans = 0;
  for(int i = 0; i < (1<<n); i++){
    int t = 0;
    vector<long long> x;
    for(int j = 0; j < n; j++){
      if(i & (1<<j)) {
        t++;
        x.push_back(j);
      }
      if(t > 2) break;
    }
    if(t != 2) continue;
    ans += (a[x[0]] * a[x[1]]) % (1e9 + 7);
  }
  cout << ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and 'double' to binary 'operator%'
   23 |     ans += (a[x[0]] * a[x[1]]) % (1e9 + 7);
      |            ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~
      |                     |                 |
      |                     |                 double
      |                     __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}
Language: C++

#include <bits/stdc++.h>

#define rep(i, n)     for (int i = 0; i < n; ++i)
#define rep1(i, n)    for (int i = 1; i < n + 1; ++i)
#define repN(i, m, n) for (int i = m; i < n; ++i)
#define repR(i, n)    for (int i = n - 1; i >= 0; --i)

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<long long> a(n);
	long long sum = 0;
	rep(i, n) {
		long long t;
		scanf("%lld", &t);
		a[i] = t;
	}

	rep(i, n) {
		repN(j, i + 1, n) {
			sum += (a[i] * a[j]);
		}
		sum %= 1000000007;
	}

	cout << sum % 1000000007;

	return 0;
}
#include <bits/stdc++.h>

#define rep(i, n)     for (int i = 0; i < n; ++i)
#define rep1(i, n)    for (int i = 1; i < n + 1; ++i)
#define repN(i, m, n) for (int i = m; i < n; ++i)
#define repR(i, n)    for (int i = n - 1; i >= 0; --i)

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<long long> a(n);
	long long sum = 0;
	rep(i, n) {
		long long t;
		scanf("%lld", &t);
		a[i] = t;
	}

	rep(i, n) {
		repN(j, i + 1, n) {
			sum += (a[i] * a[j]);
		}
		sum %= 1000000007;
	}

	cout << sum % 1000000007;

	return 0;
}


Compiler output:
a.cc:41:5: error: redefinition of 'int main()'
   41 | int main() {
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  using ll =unsigned long long ;
  ll a;
  cin>>a;
  ll b=0;
  ll c=0;
  vector<ll>vec(a);
  for(ll i=0;i<a;i++){
    cin>>vec.at(i);
    vec.at(i)=vec.at(i)%1000000007;
    b+=vec.at(i);
    c+=vec.at(i)*vec.at(i);
  }
  
  ll e=b*b-c;
  if(e%2==1){
    e+=1000000007;
  }
  ll f=e/2;
  ll f=e%1000000007;
  
  
  cout<<f<<endl;
    
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:6: error: redeclaration of 'll f'
   23 |   ll f=e%1000000007;
      |      ^
a.cc:22:6: note: 'll f' previously declared here
   22 |   ll f=e/2;
      |      ^
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
int main(){
  long long N, A;
  long long sum, waru, sqsum; ans;
  N = 0; A = 0; sum = 0; ans = 0; sqsum = 0; waru = pow(10,9) + 7;
  cin >> N;
  for(int i = 0; i<N; i++){
    cin >> A;
    sum += A;
    sqsum += pow(A,2);
  }
  ans = (pow(sum,2)-sqsum)%waru;
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
    6 |   long long sum, waru, sqsum; ans;
      |                               ^~~
      |                               abs
a.cc:14:27: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   14 |   ans = (pow(sum,2)-sqsum)%waru;
      |         ~~~~~~~~~~~~~~~~~~^~~~~
      |                    |       |
      |                    |       long long int
      |                    __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
int main(){
  long long N, A;
  long long sum, waru, sqsum ans;
  N = 0; A = 0; sum = 0; ans = 0; sqsum = 0; waru = pow(10,9) + 7;
  cin >> N;
  for(int i = 0; i<N; i++){
    cin >> A;
    sum += A;
    sqsum += pow(A,2);
  }
  ans = (pow(sum,2)-sqsum)%waru;
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:30: error: expected initializer before 'ans'
    6 |   long long sum, waru, sqsum ans;
      |                              ^~~
a.cc:7:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |   N = 0; A = 0; sum = 0; ans = 0; sqsum = 0; waru = pow(10,9) + 7;
      |                          ^~~
      |                          abs
a.cc:7:35: error: 'sqsum' was not declared in this scope; did you mean 'sum'?
    7 |   N = 0; A = 0; sum = 0; ans = 0; sqsum = 0; waru = pow(10,9) + 7;
      |                                   ^~~~~
      |                                   sum
Language: C++


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
ll a[200005];
map<ll,ll> m;
int main()
{
	ll n; 
	cin>>n;
	m.clear();
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long double sum=0,ans=0;
	for(ll i=0;i<n;i++)
	{
		ll s=i*a[i]-sum+m[a[i]+1]-m[a[i]-1];
		//ans+=((i-m[a[i]-1]-m[a[i]+1]-m[a[i]])*a[i]-(sum-m[a[i]+1]*(a[i]+1)-m[a[i]-1]*(a[i]-1)-m[a[i]]*a[i]));
		ans+=s;
		m[a[i]]++;
		sum+=a[i];
	}
	cout<<fixed<<setprecision(0)<<ans<<endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:31:49: error: expected '}' at end of input
   31 |         cout<<fixed<<setprecision(0)<<ans<<endl;
      |                                                 ^
a.cc:14:1: note: to match this '{'
   14 | {
      | ^
Language: Java

import java.util.*;
public class Main {
    public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
        int numberOfRecords = sc.nextInt();
        List<Integer> values = new ArrayList<>();
        while (numberOfRecords > 0) {
            values.add(sc.nextInt());
            numberOfRecords--;
        }
        int sum = 0;
        for (int i = 0; i < numberOfRecords; i++) {
            for (int j = i + 1; j < n; j++) {
                sum += values.get(i) * values.get(j);
            }
        }
        System.out.print(sum);
    }
}

Compiler output:
Main.java:13: error: cannot find symbol
            for (int j = i + 1; j < n; j++) {
                                    ^
  symbol:   variable n
  location: class Main
1 error
Language: C


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
ll a[200005];
map<ll,ll> m;
int main()
{
	ll n; 
	cin>>n;
	m.clear();
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long double sum=0,ans=0;
	for(ll i=0;i<n;i++)
	{
		ll s=i*a[i]-sum+m[a[i]+1]-m[a[i]-1];
		//ans+=((i-m[a[i]-1]-m[a[i]+1]-m[a[i]])*a[i]-(sum-m[a[i]+1]*(a[i]+1)-m[a[i]-1]*(a[i]-1)-m[a[i]]*a[i]));
		ans+=s;
		m[a[i]]++;
		sum+=a[i];
	}
	cout<<fixed<<setprecision(0)<<ans<<endl;


Compiler output:
main.c:3:10: fatal error: iostream: No such file or directory
    3 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream> 
#include<string.h> 
using namespace std; 
 
    
int main() 
{ 
   long long int n,i,j,k,l,sum=0;
   long long  int a[200001],prefixSum[200001];
    scanf("%lld",&n);
    for(i=0;i<n;i++)
    scanf("%lld",&a[i]);
    prefixSum[0] = a[0]; 
  
    for (int i = 1; i < n; i++) 
        prefixSum[i] = prefixSum[i - 1] + a[i];
        for(i=0;i<n;i++)
        {
            sum=sum+(((a[i]%1000000007)*((prefixSum[n-1]%1000000007)-(prefixSum[i]%1000000007))%1000000007)%1000000007);
            sum=sum%1000000007;
        }
        printf("%lld",sum%1000000007);
}
#include<iostream> 
#include<string.h> 
using namespace std; 

    
int main() 
{ 
   long long int n,i,j,k,l,sum=0;
   long long  int a[200001],prefixSum[200001];
    scanf("%lld",&n);
    for(i=0;i<n;i++)
    {
    scanf("%lld",&a[i]);
    a[i]=a[i]%1000000007;
    }
    prefixSum[0] = a[0]; 
  
    for (int i = 1; i < n; i++) 
        prefixSum[i] = (prefixSum[i - 1] + a[i])%1000000007;
        for(i=0;i<n;i++)
        {
            sum=sum+(((a[i]%1000000007)*((prefixSum[n-1]%1000000007)-(prefixSum[i]%1000000007))%1000000007)%1000000007);
            sum=sum%1000000007;
        }
        printf("%lld",sum%1000000007);
}



Compiler output:
a.cc:29:5: error: redefinition of 'int main()'
   29 | int main()
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main()
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main() {
  int N,sum=0;
  
  cin >> N;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  
  for(int i=0;i<(N-1);i++){
    for(int j=(i+1);j<N;j++){
      sum += A[i] * A[j];
    }
  }  
  
  sum = sum % int(pow(10.0,9.0)+7)
    
  cout << sum << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:35: error: expected ';' before 'cout'
   20 |   sum = sum % int(pow(10.0,9.0)+7)
      |                                   ^
      |                                   ;
   21 | 
   22 |   cout << sum << endl;
      |   ~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define pi 3.14159265358979
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

int main(){
    ll n,sum=0,summ=0,a[200005];
    cin>>n;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
      sum%=mod;
        summ+=((a[i]%mod)*(a[i]%mod));
    }
  if(sum*sum>summ){
    cout<<((sum*sum-summ)%mod)/2;
  }else{
    cout<<((sum*sum+mod-summ)%mod)/2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)

for ai in a:
    d[ai] += 1

d2 = [(k, v) for k, v in d.items()]
dlen = len(d2)
print(d2)

s = 0
for i in range(dlen):
    k = d2[i][0]
    v = d2[i][1]
    if v >= 2:
        s += k * k * (v * (v-1) // 2)
    for j in range(i, dlen):
        k2 = d2[j][0]
        v2 = d2[j][1]
        if k != k2:
            print(k, v, k2, v2)
            s += k * k2 * v * v2
            print(s)
print(s % 1000000007)


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import defaultdict
      | ^~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for ( int i=0; i< (n); ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    ll q = 7 + 1e9;
    vector<ll> subsum(N);
    subsum[N-1] = 0;
    for( int i=N-1, i>0; --i ){
        subsum[i-1] = subsum[i] + A[i];
        subsum %= q;
    } 
    ll ans = 0;
    for( int i=0; i<N-1; ++i){
        ans += A[i]*subsum[i];
        ans %= q;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: expected ';' before '>' token
   15 |     for( int i=N-1, i>0; --i ){
      |                      ^
      |                      ;
a.cc:15:22: error: expected primary-expression before '>' token
a.cc:17:16: error: no match for 'operator%=' (operand types are 'std::vector<long long int>' and 'll' {aka 'long long int'})
   17 |         subsum %= q;
      |         ~~~~~~~^~~~
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  ll sum,p;
  sum = 0;
  p = 1000000007;
  ll* a =new ll[n];
  for(int i = 0;i<n;i++){
    cin >> a[i];
    a[i]= a[i] % p
  }
  
  for(int i = 0; i<n;i++){
    for(int j = 0;j<i;j++){
      sum += a[i]*a[j];
      if(sum>p) sum = sum % p;
    }
  }
  cout << sum <<endl;
      
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: expected ';' before '}' token
   16 |     a[i]= a[i] % p
      |                   ^
      |                   ;
   17 |   }
      |   ~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,i,j;
  lonf lonf int p=0;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++)
    cin>>a[i];
  for(i=0;i<n-1;i++)
  {
    for(j=i+1;j<n;j++)
    {
      p = (p+(a[i]*a[j])%1000000007)%1000000007;
    }
    cout<<p;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'lonf' was not declared in this scope; did you mean 'long'?
    6 |   lonf lonf int p=0;
      |   ^~~~
      |   long
a.cc:15:7: error: 'p' was not declared in this scope
   15 |       p = (p+(a[i]*a[j])%1000000007)%1000000007;
      |       ^
a.cc:17:11: error: 'p' was not declared in this scope
   17 |     cout<<p;
      |           ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<long long> A (n);
  for(int i = 0; i < n; i++){
    cin >> A[i];
  }
  long long ans = 0;
  for(int i = 0; i < n-1; i++){
    for(int j = 1; j < n - i - 1; j++){
      ans += a[i]*a[i+j] % (1000000007);
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<long long> A (n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:6:10: error: expected primary-expression before 'long'
    6 |   vector<long long> A (n);
      |          ^~~~
a.cc:8:12: error: 'A' was not declared in this scope
    8 |     cin >> A[i];
      |            ^
a.cc:13:14: error: 'a' was not declared in this scope
   13 |       ans += a[i]*a[i+j] % (1000000007);
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N,sum=0;
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  for(int i=0;i<N-1;i++){
    for(int j=1;j<N;j++){
      sum += vec.at(i)*vec.at(j);
    }
  }
  cout << sum;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C

#include <iostream>
#include <vector>

int main()
{
    int n;
    std::cin >> n;

    std::vector<std::uint64_t> as(n);
    std::vector<std::uint64_t> asum(n);

    for (std::uint64_t i = 0; i < n; i++)
    {
        std::cin >> as[i];
        if (i == 0)
        {
            asum[i] = as[i];
        }
        else
        {
            asum[i] = asum[i - 1] + as[i];
        }
    }

    constexpr std::uint64_t MOD = 1000000007;

    std::uint64_t ans = 0;
    for (std::uint64_t i = 0; i < as.size() - 1; ++i)
    {
        ans += (as[i] * (*asum.rbegin() - asum[i])) % MOD;
        ans %= MOD;
    }

    std::cout << ans;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<string>
#include<vector>
#include<algorithm>
#define mod (1000000007)
using namespace std;
int main(){

  int N;
  cin>>N;
  vector<long long>A(N);
  long long ans=0;
  long long subans=0;
  long long allsum=0;
  for(int i=0;i<=N-1;i++){
  
    cin>>A[i];
    allsum+=A[i];
    allsum=allsum%mod;
  }
  for(int i=0;i<=N-1;i++){
  
    A[i]=A[i]%mod;
  }  
  sort(A.begin(),A.end());
  for(int i=0;i<=N-2;i++){
  
    subans+=A[i];
    subans=subans%mod;
    ans+=(allsum-subans)*A[i];
    ans=ans%mod;
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin>>N;
      |   ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<algorithm>
  +++ |+#include <iostream>
    4 | #define mod (1000000007)
a.cc:32:3: error: 'cout' was not declared in this scope
   32 |   cout<<ans;
      |   ^~~~
a.cc:32:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin >> n;

	long long mod = 1000000000 + 7;

	long long ans = 0;

	vector <long long> a(n);

	for(int i=0; i<n; i++) {
		cin >> a[i];
	}

	for(int i=0; i<n-1; i++) {
		for(int j=i+1; j<n; j++) {
			ans = (ans + ((a[i] * a[j]) % mod)) % mod ;
		}
	}

	cout << ans << "\n";

	return 0;
}#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin >> n;

	long long mod = 1000000000 + 7;

	long long ans = 0;

	vector <long long> a(n);

	for(int i=0; i<n; i++) {
		cin >> a[i];
	}

	for(int i=0; i<n-1; i++) {
		for(int j=i+1; j<n; j++) {
			ans = (ans + ((a[i] * a[j]) % mod)) % mod ;
		}
	}

	cout << ans << "\n";

	return 0;
}

Compiler output:
a.cc:28:2: error: stray '#' in program
   28 | }#include <bits/stdc++.h>
      |  ^
a.cc:28:3: error: 'include' does not name a type
   28 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:32:5: error: redefinition of 'int main()'
   32 | int main() {
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N,sum=0;
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N-1;i++){
    for(int j=1;j<N;j++){
      sum += vec(i)*vec(j);
    }
  }
  cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: no match for call to '(std::vector<int>) (int&)'
   10 |       sum += vec(i)*vec(j);
      |              ~~~^~~
a.cc:10:24: error: no match for call to '(std::vector<int>) (int&)'
   10 |       sum += vec(i)*vec(j);
      |                     ~~~^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define mod 1000000007;
int main()
{
    ll n;
    cin >> n;
    ll a;
    ll sum = 0, indsum = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a;
        sum = (sum+a)%mod;
        indsum = (indsum + (a*a)%mod)%mod;
    }
    ll sumsquare = ((sum%mod)*(sum%mod))%mod;
    ll res = (sumsquare - indsum)%mod;
    if(res < 0)
    {
        res = (mod-abs(res))%mod;
    }
    else
    {
        res = res%mod;
    }
    cout << res/2;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:4:23: error: expected ')' before ';' token
    4 | #define mod 1000000007;
      |                       ^
a.cc:15:34: note: in expansion of macro 'mod'
   15 |         indsum = (indsum + (a*a)%mod)%mod;
      |                                  ^~~
a.cc:15:18: note: to match this '('
   15 |         indsum = (indsum + (a*a)%mod)%mod;
      |                  ^
a.cc:15:37: error: expected primary-expression before ')' token
   15 |         indsum = (indsum + (a*a)%mod)%mod;
      |                                     ^
a.cc:4:23: error: expected ')' before ';' token
    4 | #define mod 1000000007;
      |                       ^
a.cc:17:26: note: in expansion of macro 'mod'
   17 |     ll sumsquare = ((sum%mod)*(sum%mod))%mod;
      |                          ^~~
a.cc:17:21: note: to match this '('
   17 |     ll sumsquare = ((sum%mod)*(sum%mod))%mod;
      |                     ^
a.cc:4:23: error: expected ')' before ';' token
    4 | #define mod 1000000007;
      |                       ^
a.cc:17:26: note: in expansion of macro 'mod'
   17 |     ll sumsquare = ((sum%mod)*(sum%mod))%mod;
      |                          ^~~
a.cc:17:20: note: to match this '('
   17 |     ll sumsquare = ((sum%mod)*(sum%mod))%mod;
      |                    ^
a.cc:17:29: error: expected primary-expression before ')' token
   17 |     ll sumsquare = ((sum%mod)*(sum%mod))%mod;
      |                             ^
a.cc:17:39: error: expected primary-expression before ')' token
   17 |     ll sumsquare = ((sum%mod)*(sum%mod))%mod;
      |                                       ^
a.cc:4:23: error: expected ')' before ';' token
    4 | #define mod 1000000007;
      |                       ^
a.cc:21:16: note: in expansion of macro 'mod'
   21 |         res = (mod-abs(res))%mod;
      |                ^~~
a.cc:21:15: note: to match this '('
   21 |         res = (mod-abs(res))%mod;
      |               ^
a.cc:21:28: error: expected ';' before ')' token
   21 |         res = (mod-abs(res))%mod;
      |                            ^
      |                            ;
Language: C++

#include <bits/stdc++.h>
const int mod = 1e9 + 7;
using namespace std;
int main(){
    long int sum = 0;
    long int _sum = 0;
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i=0;i<n;++i){
        cin>>arr[i];
    }
    for(int i=0;i<n;++i){
        sum += arr[i];
        _sum = _sum + (arr[i]*arr[i]);
        if(sum>mod){
            sum = sum%mod;
        }
        if(_sum>mod){
            _sum = _sum%mod;
        }
    }
    sum = (sum*sum)%mod;
    ans = sum - _sum;
    ans /= 2;
    if(ans<0){
        ans = mod - ans;
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |     ans = sum - _sum;
      |     ^~~
      |     abs
Language: C++

#pragma GCC optimize("Ofast")
ios::sync_with_stdio(false);
cin.tie(nullptr);
#include<iostream>
#include<math.h>
#include <vector>
using namespace std;
int main()
{
    // 整数の入力
    long long N;
   	long long a=pow(10,9)+7;
    cin >> N;
    vector<long long> vec(N);
	for (long long i = 0; i < N; i++) {
		cin >> vec.at(i); 
      	vec.at(i)%=a;
	}
  	
  	long long sum_ans = 0;
  	for (long long i=0; i < N; i++){
    	for (long long j=i; j < N; j++){
        	if(i!=j)
          		sum_ans += vec.at(i)*vec.at(j); 
        }
 //     sum_ans = sum_ans%a; 
     }
    // 出力
    cout << sum_ans%a << endl;
    return 0;
}

Compiler output:
a.cc:2:1: error: 'ios' does not name a type
    2 | ios::sync_with_stdio(false);
      | ^~~
a.cc:3:1: error: 'cin' does not name a type
    3 | cin.tie(nullptr);
      | ^~~
Language: C++

#include<bits/stdc++.h>
#define int long long
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;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) { a = b; return true; } return false; }

signed main(){
    ll n;
    cin >> n;
    vector<ll> a(n), suma(n+1);
    rep(i, n) cin >> a[i];
    rep(i, n){
        suma[i+1] = suma[i] + a[i];
    }
    rep(i, n+1) cout << suma[i] << " ";
    cout << endl;

    ll ans = 0;
    rep(i, n-1){
        ll x = suma[n] - suma[i+1];
        /* cout << a[i] << " * " << x << endl; */
        ans += (a[i] * x);
    }
    ans %= 10000000+7
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:22: error: expected ';' before 'cout'
   32 |     ans %= 10000000+7
      |                      ^
      |                      ;
   33 |     cout << ans << endl;
      |     ~~~~
Language: Java

import java.util.*;
import java.lang.Math;
public class Main {
    public static void main(String args[]) {
      Scanner s = new Scanner(System.in);
      int num = Integer.parseInt(s.next());
      ArrayList<Integer> lis = new ArrayList<Integer>();
      for(int i = 0; i < num; i++){
        lis.add(Integer.parseInt(s.next()));
      }
      int sum = 0;
      for(int i = 0; i < num; i++){
        for(int j = i+1; j < num; j++){
          sum += lis.get(i)*lis.get(j);
        }
      }
      System.out.plintln(sum%(Math.pow(10, 9) + 7));
}

Compiler output:
Main.java:18: error: reached end of file while parsing
}
 ^
1 error
Language: C++

/*..........mango is luv..........*/
#include<bits/stdc++.h>
using namespace std;
#define fk(i,start,end) for(ll i=start;i<ll(end);i++)
typedef long long int ll;
string A="YES";
string B="NO";
int main()
{ 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n;
  cin>>n;
  vector<ll>a(n);
  fk(i,0,n)
  {
cin>>a[i];
  }
  ll sum=0;
  fk(i,0,n-1)
  {
fk(j,i+1,n)
{
sum+=a[i]*a[j]
}
    cout<<sum<<endl;
  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:15: error: expected ';' before '}' token
   25 | sum+=a[i]*a[j]
      |               ^
      |               ;
   26 | }
      | ~              
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:9:1: note: to match this '{'
    9 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  vector<uintmax_t> a;
  uintmax_t sum = 0, divider = pow(10, 9) + 7;UINT64_MAX

  cin >> n;
  for (int i = 0; i < n; i++)
  {
    uintmax_t tmp;
    cin >> tmp;
    a.push_back(tmp % divider);
  }
  for (int i = 0; i < n - 1; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      sum += a[i] * a[j];
      sum %= divider;
    }
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected ';' before 'cin'
   10 |   cin >> n;
      |   ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LL long long int
#define FAST ios_base::sync_with_stdio(false);
#define INPT cin.tie(NULL);
#define OUTPT cout.tie(NULL);
#define fori(i,a,b) for(i=a;i<b;i++)
#define forireverse(i,a,b) for(i=a;i>=b;i--)
#define full(x) x.begin(),x.end()
#define sortV(x) sort(full(x))
#define sortVgr(x) sort(full(x),greater<LL>()) // x -> vector
#define reverse(x) reverse(full(x)) // x -> string
#define go(t) while(t--)
#define endl cout<<"\n"
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define mp make_pair

LL gcd(LL a, LL b)
{
	if(a==0) return b;
	else return gcd(b%a,a);
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("inputAtC.txt","r",stdin);
	freopen("outputAtC.txt","w",stdout);
	#endif
	FAST INPT OUTPT
	LL t=1;
	//cin>>t;
	go(t)
	{
		LL n,sum=0,M=1000000007,p=0;
		cin>>n;
		LL A[n],i;
        fori(i,0,n) cin>>A[i];
        fori(i,0,n) p+=A[i]%M;
        p%=M;
        p = (p * p);
        fori(i,0,n) sum= (sum + (A[i]*A[i])%M)%M ;
        cout<<(( (p - sum)%M ) /2);
	}
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:48:18: error: expected '}' at end of input
   48 |         return 0;
      |                  ^
a.cc:28:1: note: to match this '{'
   28 | {
      | ^
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
int main(){
  long long N, A;
  long long sum, sqsum, ans, waru;
  N = 0; sum = 0; sqsum = 0;ans = 0;  waru = pow(10,9) + 7;
  cin >> N;
  for(int i = 0; i<N; i++){
    cin >> A;
    ans += (A[i] + 0.5 * pow(A[i],2)) / waru;
  }
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: invalid types 'long long int[int]' for array subscript
   12 |     ans += (A[i] + 0.5 * pow(A[i],2)) / waru;
      |              ^
a.cc:12:31: error: invalid types 'long long int[int]' for array subscript
   12 |     ans += (A[i] + 0.5 * pow(A[i],2)) / waru;
      |                               ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0;
    rep(i, n){
        cin >> a.at(i);
        sum += a.at(i);
    }
    
    ll ans = 0;
    ll b = 1e9 + 7;
    rep(i, n - 1){
        sum -= a.at(i);
        if(sum >= b){
            ll sum2 = sum % b;
        }
        
        ans += a.at(i) * sum2;
        if(ans >= b){
            ans %= b;
        }
    }
    cout << ans << endl;
    
    return 0;
}
 
 //vector<int> a(3);
 //a.at(0);
 //a.size();
 //vector<vector<int>> a(3, vector<int>(3));
 //uint64_t sum = 0;
 //max(a, b);
 //min(a, b);
 //swap(a, b);
 //sort(vec.begin(), vec.end());  昇順
 //reverse(vec.begin(), vec.end());  降順


Compiler output:
a.cc: In function 'int main()':
a.cc:24:26: error: 'sum2' was not declared in this scope; did you mean 'sum'?
   24 |         ans += a.at(i) * sum2;
      |                          ^~~~
      |                          sum
Language: Java

import java.util.Scanner;

public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int n = int(sc.nextLine());
  String[] s = sc.nectLine().split(" ");
  int product = 0; 
  for(int i = 0; i<n; i++) {
    for(int j = i; j<=n; j++) {
    	product += (int(s[i])* int(s[j]));
    }
  }
  return product % (10**9 + 7)
}

Compiler output:
Main.java:10: error: not a statement
    	product += (int(s[i])* int(s[j]));
    	                 ^
Main.java:10: error: not a statement
    	product += (int(s[i])* int(s[j]));
    	                       ^
Main.java:10: error: not a statement
    	product += (int(s[i])* int(s[j]));
    	                            ^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
              ^
  (use --enable-preview to enable unnamed classes)
Main.java:5: error: '.class' expected
  int n = int(sc.nextLine());
             ^
Main.java:5: error: ';' expected
  int n = int(sc.nextLine());
                           ^
Main.java:10: error: '.class' expected
    	product += (int(s[i])* int(s[j]));
    	               ^
Main.java:10: error: ';' expected
    	product += (int(s[i])* int(s[j]));
    	                    ^
Main.java:10: error: ';' expected
    	product += (int(s[i])* int(s[j]));
    	                          ^
Main.java:10: error: ';' expected
    	product += (int(s[i])* int(s[j]));
    	                               ^
Main.java:13: error: illegal start of expression
  return product % (10**9 + 7)
                       ^
Main.java:13: error: ';' expected
  return product % (10**9 + 7)
                              ^
12 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); i++)

int main()
{
  int N;
  con
  cin >> N;
  vector<ll> v(N+1);
  rep(i,N){
    cin >> v[i];
  }
  int sum=0;
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      sum=(sum+((v[i]%1000000007*v[j]%1000000007)%1000000007))%1000000007;
    }
  }
	cout<<sum<< endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'con' was not declared in this scope; did you mean 'cos'?
   11 |   con
      |   ^~~
      |   cos
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
	
	ll n;
	cin >> n;

	vector<ll> v(n);

	ll sum = 0, ans = 0;
	for(int i = 0; i < n; i++){
		cin >> v[i];
		sum += v[i];
	} 


	for(int i = 0; i < n; i++){
		ans += ((sum - v[i])%mod * v[i]%mod)%mod; 
		sum -= v[i];
	}

	cout << ans%mod << "\n";
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:38: error: 'mod' was not declared in this scope; did you mean 'modf'?
   20 |                 ans += ((sum - v[i])%mod * v[i]%mod)%mod;
      |                                      ^~~
      |                                      modf
a.cc:24:21: error: 'mod' was not declared in this scope; did you mean 'modf'?
   24 |         cout << ans%mod << "\n";
      |                     ^~~
      |                     modf
Language: C++

// C++ implementation of the approach 
#include <iostream> 
#include <bits/stdc++.h> 
using namespace std; 
long long int m = 1000000007;


int findProductSum(long int A[],long  int n) 
{ 
    long int array_sum = 0; 
    for (long int i = 0; i < n; i++) 
        array_sum = array_sum + A[i]; 
  
    
   long  int array_sum_square = (array_sum * array_sum)%m; 
  
  long   int individual_square_sum = 0; 
    for (long int i = 0; i < n; i++) 
        individual_square_sum += (A[i]*A[i])%m; 
  
    
    return (array_sum_square - individual_square_sum)/2; 
} 

int main() 
{ 
	long int n;
    cin>>n;
    long long int a[n];
    for(long int i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<findProductSum(a,n)<<endl;
    return 0;

} 




Compiler output:
a.cc: In function 'int main()':
a.cc:33:26: error: invalid conversion from 'long long int*' to 'long int*' [-fpermissive]
   33 |     cout<<findProductSum(a,n)<<endl;
      |                          ^
      |                          |
      |                          long long int*
a.cc:8:29: note:   initializing argument 1 of 'int findProductSum(long int*, long int)'
    8 | int findProductSum(long int A[],long  int n)
      |                    ~~~~~~~~~^~~
Language: C++

// Efficient C++ program to find sum pair products 
// in an array. 
#include <iostream> 
using namespace std; 
#define int long long
const int m=1e9+7;

// required function 
int findProductSum(int A[], int n) 
{ 
	// calculating array sum (a1 + a2 ... + an) 
	int array_sum = 0; 
	for (int i = 0; i < n; i++) 
		array_sum = ( (array_sum)%m + (A[i])%m )%m; 

	// calcualting square of array sum 
	// (a1 + a2 + ... + an)^2 
	int array_sum_square = (array_sum * array_sum)%m; 

	// calcualting a1^2 + a2^2 + ... + an^2 
	int individual_square_sum = 0; 
	for (int i = 0; i < n; i++) 
		( individual_square_sum += (A[i]*A[i])%m )%m; 

	// required sum is (array_sum_square - 
	// individual_square_sum) / 2 
	return (((array_sum_square - individual_square_sum)%m)/2)%m; 
} 

// Driver code 
int main() 
{ 
  int n;
  cin>>n;
  int arr[n];
  for(auto &a:arr) cin>>a;
  
  cout<<findProductSum(arr,n);
} 


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: Java

import java.util.Scanner;

public class Main2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int N =sc.nextInt();

		Long A[] =new Long[N];

		for(int i=0; i<N; i++) {
			A[i]=sc.nextLong();
		}

		Long result = 0L;
		for(int i=0; i<N;i++) {
			for(int j =i+1; j<N; j++) {
				result += A[i]*(A[j]) % 1000000007L;
			}
		}

		result = result % 1000000007L;
		System.out.println(result);

		sc.close();
	}

}


Compiler output:
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,i,j,count=0;
  cin>>N;
  int A[N];
  for(i=0;i<N;i++){
    cin>>A[i]
  }
  for(i=0;i<N;i++){
    for(j=i+1;j<N;j++){
      count+=(A[i]*A[j])%(1000000000+7);
    }
  }
  cout<<count<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: expected ';' before '}' token
    8 |     cin>>A[i]
      |              ^
      |              ;
    9 |   }
      |   ~
Language: Java

n = int(input())
nums = [int(x) for x in input().split(" ")]
res = 0
for i in range(0, len(nums)):
	for j in range(i + 1, len(nums)):
		res += (nums[i] * nums[j]) % 1000000007
print(res)

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
n = int(input())
^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  vector<uintmax_t> a;
  uintmax_t sum = 0, divider = pow10(9) + 7;

  cin >> n;
  for (int i = 0; i < n; i++)
  {
    uintmax_t tmp;
    cin >> tmp;
    a.push_back(tmp % divider);
  }
  for (int i = 0; i < n - 1; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      sum += a[i] * a[j] % divider;
      sum %= divider;
    }
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:32: error: 'pow10' was not declared in this scope
    8 |   uintmax_t sum = 0, divider = pow10(9) + 7;
      |                                ^~~~~
Language: C++


using namespace std;
typedef long long ll;
#define mod 1000000007
int main()
{
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    ll s=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            ll k=(((a[i]%mod)*(a[j]%mod))%mod);
            s=((s%mod)+(k%mod))%mod;
        }
    }
    cout<<s%mod<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin>>n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout<<s%mod<<endl;
      |     ^~~~
a.cc:20:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:18: error: 'endl' was not declared in this scope
   20 |     cout<<s%mod<<endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 |
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
int main(){
  long long N;
  long long sum, sqsum, ans, waru;
  N = 0; sum = 0; sqsum = 0;ans = 0;  waru = pow(10,9) + 7;
  cin >> N;
  vector<int> A(N,0);
  for(int i = 0; i<N; i++){
    cin >> A[i];
  }
  for(int i = 0; i<N; i++){
    sum += A[i];
    sqsum += pow(A[i],2);
  }
  ans = (sqsum + (pow(sum,2)-sqsum)/2) % waru;
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:40: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   18 |   ans = (sqsum + (pow(sum,2)-sqsum)/2) % waru;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~
      |                |                         |
      |                |                         long long int
      |                __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    public static MyScanner scan;
    public static PrintWriter out;
    public static void main(String[] args) {
        scan=new MyScanner();
        out=new PrintWriter(new BufferedOutputStream(System.out));

        int t=1;
//        int t=scan.nextInt();
        while(t-->0) {

            int n=scan.nextInt();
            int[] a=new int[n];
            for (int c=0;c<n;c++) a[c]=scan.nextInt();
            long ans=0,mod=1000000007;

            for (int i=0;i<n-1;i++) {
                long sum=0;
                for (int j=i+1;j<n;j++) {
                    sum+=a[j];
                    sum%=mod;
                }
                ans+=(sum*a[i]);
                ans%=mod;
            } out.println(ans);
        }
        out.close();
    }


//    int n=scan.nextInt();
//    long sum=0,mod=(long)1000000007;
//    long[] a=new long[n];
//            for(int c=0;c<n;c++) a[c]=scan.nextLong();
//    HashSet<String> check=new HashSet<>();
//            for(int i=0;i<n;i++) {
//        for(int j=0;j<n;j++) {
//            if(!check.contains(i+" "+j)&&!check.contains(j+" "+i)&&i!=j) {
//                sum+=a[i]*a[j];
//                check.add(i+" "+j);
//                check.add(j+" "+i);
////                        out.println(sum);
//            }
//        }
//    } out.println(sum%mod);

    //scanner
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.lang.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main {
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin >> N;
  vector<long long>v(N);
  for (long long i=0; i<N; i++) cin >> v.at(i);
  long long ans = 0;
  for (long long i=0; i<N-1; i++){
    for (long long j=i+1; j<N; j++){
      ans += v.at(i) * v.at(j);
      ans = ans % 1000000007;
    }
  }
  print(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'print' was not declared in this scope; did you mean 'rint'?
   15 |   print(ans);
      |   ^~~~~
      |   rint
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int main()
{
  ios_base::sync_with _stdio(false);
  cin.tie(NULL);
  long long int n;
  cin>>n;
  long long int a[n];
  for(long long int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  long long int sum = 0;
  for(long long int i=0;i<n;i++)
  {
    sum = (sum + a[i])%mod;
  }
  long long int sqr = (sum*sum)%mod;
  long long int ind = 0;
  for(long long int i=0;i<n;i++)
  {
    ind = (ind+(a[i]*a[i])%mod)%mod;
  }
  long long int ans = (sqr-ind)%mod;
  cout<<ans/2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:13: error: 'sync_with' is not a member of 'std::ios_base'
    6 |   ios_base::sync_with _stdio(false);
      |             ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  long long mod=1000000007;
  long long ar[n];
  for(int i=0;i<n;i++)
    cin>>ar[i];
  long long sum=accumulate(ar,ar+n,0);
  long long val=0;
  for(int i=0;i<n;i++)
  {
    sum=sum-ar[i];
    val=(val+(ar[i]*sum))%mod;
  }
  cout<<val%mod<<endl;
  
  
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:18:23: error: expected '}' at end of input
   18 |   cout<<val%mod<<endl;
      |                       ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int main()
{
  std::ios::sync_with _stdio(false);
  cin.tie(NULL);
  long long int n;
  cin>>n;
  long long int a[n];
  for(long long int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  long long int sum = 0;
  for(long long int i=0;i<n;i++)
  {
    sum = (sum + a[i])%mod;
  }
  long long int sqr = (sum*sum)%mod;
  long long int ind = 0;
  for(long long int i=0;i<n;i++)
  {
    ind = (ind+(a[i]*a[i])%mod)%mod;
  }
  long long int ans = (sqr-ind)%mod;
  cout<<ans/2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:13: error: 'sync_with' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
    6 |   std::ios::sync_with _stdio(false);
      |             ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;

  int64_t nsum = 0;

  vector<int64_t> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    nsum += a[i];
    nsum %= MOD;
  }
  int jj=0;
  int64_t ans = 0;

  for (int i = 0; i < n; ++i) {
    nsum -= a[i];
  for (int i = 0; i < n - 1; ++i) {
    int64_t nsum = 0;
    for (int j = i + 1; j < n; ++j) {
      nsum += a[j];
      nsum %= MOD;
      jj++;
    }
    ans += (nsum * a[i]);
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

        #include <bits/stdc++.h>
        #define mod 1000000007
        #define int long long
        using namespace std;
        void main(){
        int n;cin>>n;
          int arr[n];
          int sum = 0;
          for(int i=0;i<n;i++)
            cin>>arr[i];
          for(int i=0;i<n-1;i++){
          	int prod;
            for(int j=i+1;i<n;i++)
            {
              prod = (arr[j] * arr[i])%mod;
            	sum = (sum + prod)%mod;
            }
          }
          cout<<sum;
        }

Compiler output:
a.cc:5:9: error: '::main' must return 'int'
    5 |         void main(){
      |         ^~~~
Language: C++


#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;

  vector<int64_t> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }

  int64_t ans = 0;

  for (int i = 0; i < n - 1; ++i) {
    int64_t nsum = 0;
    for (int j = i + 1; j < n; ++j) {
      nsum += a[j];
      nsum %= MOD;
    }
    ans += (nsum * a[i]);
    ans %= MOD;
  }

  cout << ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:15: error: 'MOD' was not declared in this scope
   43 |       nsum %= MOD;
      |               ^~~
a.cc:46:12: error: 'MOD' was not declared in this scope
   46 |     ans %= MOD;
      |            ^~~