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

#include<iostream>
using namespace std;
int main(){
    int mod=1000000007;
    long long n,ih=0;
    cin>>n;
    vector<long long> a(200010,0),oj(200010,0);
    for(int i=1;i<=n;i++){
        cin>>a[i];
        oj[i]=(a[i]%mod+oj[i-1]%mod)%mod;
        ih=(ih%mod+a[i]%mod)%mod;
    }
    long long sum=0;
    for(int i=1;i<n;i++){
        sum=(sum%mod+(a[i]%mod*(ih%mod+mod-oj[i]%mod))%mod)%mod;
    }
    cout<<sum%mod<<"\n";
    return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<long long> a(200010,0),oj(200010,0);
      |     ^~~~~~
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:7:12: error: expected primary-expression before 'long'
    7 |     vector<long long> a(200010,0),oj(200010,0);
      |            ^~~~
a.cc:9:14: error: 'a' was not declared in this scope
    9 |         cin>>a[i];
      |              ^
a.cc:10:9: error: 'oj' was not declared in this scope
   10 |         oj[i]=(a[i]%mod+oj[i-1]%mod)%mod;
      |         ^~
a.cc:15:23: error: 'a' was not declared in this scope
   15 |         sum=(sum%mod+(a[i]%mod*(ih%mod+mod-oj[i]%mod))%mod)%mod;
      |                       ^
a.cc:15:44: error: 'oj' was not declared in this scope
   15 |         sum=(sum%mod+(a[i]%mod*(ih%mod+mod-oj[i]%mod))%mod)%mod;
      |                                            ^~
Language: Java


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long arr[] = new long[n];
		int mod = (int)1e9 + 7;
		long sum = 0;
		for(int i = 0;i<n;i++)
		{
			arr[i] = sc.nextLong();
			sum += arr[i];
			sum = sum % mod;
		}
		long ans = 0;
		for(int i = 0;i<n;i++)
		{
			sum -= arr[i];
			if(sum < 0)
				sum+=mod;
			
			ans += arr[i] * sum;
			ans %= mod;
			
		}
		System.out.println(ans);
		sc.close();
		
	}

}


Compiler output:
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class Sum_of_product_pairs {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long arr[] = new long[n];
		int mod = (int)1e9 + 7;
		for(int i = 0;i<n;i++)
		{
			arr[i] = sc.nextLong();
		}
		long ans = 0;
		for(int i = 0;i<n;i++)
		{
			for(int j = i+1;j<n;j++)
			{
				ans =(ans + (arr[i] * arr[j]) % mod)% mod;
			}
		}
		System.out.println(ans);
		sc.close();
		
	}

}


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

#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<string,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
const double PI=acos(-1);
 
using namespace std;

int main( ) {
    ll N;
    cin>>N;
    vec A(N);
    rep(i,0,N) cin>>A[i];
    ll count1=0;
    ll count2=0;
    rep(i,0,N) {
    count1=(count1+A[i])%(1000000000+7);
    ll a=pow(A[i],2);
    count2=(count2+a)%(1000000000+7);
    } 
    ll b=pow(count1,2);
    ll d=b%(1000000000+7);
    ll c=abs(d-count2)/2;
    cout<<c<<endl;
    }



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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using st = string;
using P = pair<int, int>;
#define mrep(i, m, n) for(int i = m; i < n; i++)
#define rep(i, n) mrep(i, 0, n)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

const int mod = (int) (1e9 + 7);

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    vector<ll> b(n + 1, 0); // aの累積和を格納する配列
    rep(i, n){
        b.at(i + 1) = b.at(i) + a.at(i);
    }
    ll ans = 0;
    rep(i, n){
        ll sum = (b.at(n) - b.at(i + 1)) % mod; // A[i] + ... + A[N - 1] = B[N] - B[i]
        ans += (a.at(i) * sum) % mod;
        ans %= mod;
    }
    ans %= mod
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:15: error: expected ';' before 'cout'
   28 |     ans %= mod
      |               ^
      |               ;
   29 |     cout << ans << endl;
      |     ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using st = string;
using P = pair<int, int>;
#define mrep(i, m, n) for(int i = m; i < n; i++)
#define rep(i, n) mrep(i, 0, n)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

const int mod = (int) (1e9 + 7);

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    vector<ll> b(n + 1, 0);
    rep(i, n){
        b.at(i + 1) = b.at(i) + a.at(i);
    }
    ll ans = 0;
    rep(i, n){
        ll sum = (b.at(n) - b.at(i + 1)) % mod; // A[i] + ... + A[N - 1] = B[N] - B[i]
        ans += a.at(i) * sum;
        ans %= mod
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:19: error: expected ';' before '}' token
   26 |         ans %= mod
      |                   ^
      |                   ;
   27 |     }
      |     ~
Language: C

#include <stdio.h>
int main(void)
{
	int n;
  	int i, j;
 	double seki;
  
	scanf("%d", &n);
  
  	for(i=1; i<=n; i++){
      for(j=i; j<=n; j++){
        seki = i*j;
        printf("%d", seki%(1000000000+7));
      }
    }
  
  	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:26: error: invalid operands to binary % (have 'double' and 'int')
   13 |         printf("%d", seki%(1000000000+7));
      |                          ^
Language: C

include <stdio.h>
int main(void)
{
	int n;
  	int i, j;
  	double seki;
  
	scanf("%d", &n);
  
  	for(i=1; i<=n; i++){
      for(j=i; j<=n; j++){
        seki = i*j;
        printf("%d", seki%(1000000000+7));
      }
    }
  
  	return 0;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
Language: C++

using namespace std;
int N;
long ans=0;
long m=1e9+7;
main()
{
    cin>>N;
    long long s=0;
    for(int i=0;i<N;++i){
        long a;
        cin>>a;
        ans=(ans+a*s)%m;
        s=(s+a)%m;
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     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 | using namespace std;
a.cc:15:5: error: 'cout' was not declared in this scope
   15 |     cout<<ans<<endl;
      |     ^~~~
a.cc:15:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:16: error: 'endl' was not declared in this scope
   15 |     cout<<ans<<endl;
      |                ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int mod = 1000000007;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
        sum %= mod;
    }
 
    long ans = 0;
  
    for (int i = 0; i < N; i++)
    {
        sum -= A[i];
        if (sum < 0) sum += mod;
 
        ans += A[i] * sum;
        ans %= mod;
    }

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

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007;
int main() {
  int n;
  long long int a[200005];
  long long int sum = 0;
  cin >> n;
  for (int x = 0; x < n; ++x) {
	cin >> a[x];
    sum += a[x];
    if (sum > mod) {sum -= mod;}
  }
  long long int ans = 0;
  for (int j = 0; j < n-1; ++j) {
		ans += (a[j] * sum);
        if (ans > mod) {ans = ans % mod};
        sum = sum - a[j+1];
        if (sum < 0) {sum = sum + mod;}
  }
  cout << ans << endl;
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: expected primary-expression before ')' token
   12 |     if (sum > mod) {sum -= mod;}
      |                  ^
a.cc:17:22: error: expected primary-expression before ')' token
   17 |         if (ans > mod) {ans = ans % mod};
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int a[200005]
  cin >> n;
  for (int x = 0; x < n; ++x) {
	cin >> a[x];
  }
  long long int sum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
   	   sum = sum + a[i] * a[j];
       sum = sum % 1000000007;
    }
  }
  cout << sum << endl;
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'cin'
    6 |   cin >> n;
      |   ^~~
a.cc:8:16: error: 'a' was not declared in this scope
    8 |         cin >> a[x];
      |                ^
a.cc:13:24: error: 'a' was not declared in this scope
   13 |            sum = sum + a[i] * a[j];
      |                        ^
Language: C++

#include <stdio.h>
int main()
{int N i j ANS;
 scanf("%d",&N);
 int A[1000000]={};
 for(i=0;i<N;i++)
 {
 scanf("%d",&A[i]);
 }
 for(i=0;i<N;i++)
 {for(j=0;j<N;j++)
 {
   ANS+=A[i]*A[j];
 }
 }
  ANS=ANS%(1000000000+7);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:8: error: expected initializer before 'i'
    3 | {int N i j ANS;
      |        ^
a.cc:4:14: error: 'N' was not declared in this scope
    4 |  scanf("%d",&N);
      |              ^
a.cc:6:6: error: 'i' was not declared in this scope
    6 |  for(i=0;i<N;i++)
      |      ^
a.cc:10:6: error: 'i' was not declared in this scope
   10 |  for(i=0;i<N;i++)
      |      ^
a.cc:11:7: error: 'j' was not declared in this scope
   11 |  {for(j=0;j<N;j++)
      |       ^
a.cc:13:4: error: 'ANS' was not declared in this scope
   13 |    ANS+=A[i]*A[j];
      |    ^~~
a.cc:16:3: error: 'ANS' was not declared in this scope
   16 |   ANS=ANS%(1000000000+7);
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int arr[N];
  for(int i=0;i<N;i++){
    cin>>arr[i];
  }
 int res;
 int sum1=0;
  int sum2=0;
  int mod=1e9+7;
  for(int i=0;i<N;i++){
    sum1=(sum1+arr[i]);
    sum1=sum1%mod
    sum2=(sum2+pow(arr[i],2));
    sum2=sum2%mod
  }
  sum1=pow(sum1,2);
  sum1=sum1%mod;
  res=(sum1-sum2)/2;
  
  cout<<res%mod;
 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: expected ';' before 'sum2'
   16 |     sum1=sum1%mod
      |                  ^
      |                  ;
   17 |     sum2=(sum2+pow(arr[i],2));
      |     ~~~~          
a.cc:18:18: error: expected ';' before '}' token
   18 |     sum2=sum2%mod
      |                  ^
      |                  ;
   19 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int arr[N];
  for(int i=0;i<N;i++){
    cin>>arr[i];
  }
 int res;
 int sum1=0;
  int sum2=0;
  int mod=1e9+7;
  for(int i=0;i<N;i++){
    sum1=(sum1+arr[i])%mod;
    sum2=(sum2+pow(arr[i],2))%mod;
  }
  sum1=pow(sum1,2)%mod;
  res=(sum1-sum2)/2;
  
  cout<<res%mod;
 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:30: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   16 |     sum2=(sum2+pow(arr[i],2))%mod;
      |          ~~~~~~~~~~~~~~~~~~~~^~~~
      |               |               |
      |               |               int
      |               __gnu_cxx::__promote<double>::__type {aka double}
a.cc:18:19: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
   18 |   sum1=pow(sum1,2)%mod;
      |        ~~~~~~~~~~~^~~~
      |           |        |
      |           |        int
      |           __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin>>N;
  long long arr[N];
  for(int i=0;i<N;i++){
    cin>>arr[i];
  }
  long long res;
  long long sum1=0;
  long long sum2=0;
  long long mod=1e9+7;
  for(int i=0;i<N;i++){
    sum1=(sum1+arr[i])%mod;
    sum2=(sum2+pow(arr[i],2))%mod;
  }
  sum1=pow(sum1,2)%mod;
  res=(sum1-sum2)/2;
  
  cout<<res%mod;
 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:30: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   16 |     sum2=(sum2+pow(arr[i],2))%mod;
      |          ~~~~~~~~~~~~~~~~~~~~^~~~
      |               |               |
      |               |               long long int
      |               __gnu_cxx::__promote<double>::__type {aka double}
a.cc:18:19: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   18 |   sum1=pow(sum1,2)%mod;
      |        ~~~~~~~~~~~^~~~
      |           |        |
      |           |        long long int
      |           __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int arr[N];
  for(int i=0;i<N;i++){
    cin>>arr[i];
  }
  long long res;
  long long sum1=0;
  long long sum2=0;
  long long mod=1e9+7;
  for(int i=0;i<N;i++){
    sum1=(sum1+arr[i])%mod;
    sum2=(sum2+pow(arr[i],2))%mod;
  }
  sum1=pow(sum1,2)%mod;
  res=(sum1-sum2)/2;
  
  cout<<res%mod;
 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:30: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   16 |     sum2=(sum2+pow(arr[i],2))%mod;
      |          ~~~~~~~~~~~~~~~~~~~~^~~~
      |               |               |
      |               |               long long int
      |               __gnu_cxx::__promote<double>::__type {aka double}
a.cc:18:19: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   18 |   sum1=pow(sum1,2)%mod;
      |        ~~~~~~~~~~~^~~~
      |           |        |
      |           |        long long int
      |           __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int arr[N];
  for(int i=0;i<N;i++){
    cin>>arr[i];
  }
  int res;
  int prod=1;
  int sum=0;
  int mod=1e9+7;
  for(int i=0;i<N;i++){
     prod=prod*arr[i];
    sum=sum+arr[i];
  }
  res=prod+sum-1;
  cout<<res%mod;
 
  return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int arr[N];
  for(int i=0;i<N;i++){
    cin>>arr[i];
  }
  int res;
  int sum1=0;
  int sum2=0;
  int mod=1e9+7;
  for(int i=0;i<N;i++){
    sum1=sum1+arr[i];
    sum2=sum2+pow(arr[i],2);
  }
  sum1=pow(sum1,2);
  res=(sum1-sum2)/2;
  
  cout<<res%mod;
 
  return 0;
}

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

#include<iostream>
using namespace std;
#define int             long long
const int N = 2e5 + 5, mod = 1e9+7;
int a[N],n,sum,ans;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
        sum%=mod;
    }

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

    cout<<ans;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '('; __print(x.first); cerr << ','; __print(x.second); cerr << ')';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

const int mod = 1e9 + 7;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  vector<long long> v(n);
  vector<long long> pref(n);
  long long ans = 0;
  for (int& i : v) cin >> i;
  for (int i = 0; i < n; i++) {
    if (i) pref[i] = v[i] + pref[i - 1];
    else pref[i] = v[i];
  }
  debug(pref);
  for (int i = 0; i < n; i++) {
    long long sums = pref[n - 1] - pref[i];
    ans += v[i] * sums;
    ans %= mod;
  }
  cout << ans << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   41 |   for (int& i : v) cin >> i;
      |                 ^
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    long p=1000000007;
    Long summer=(long)0;
    Long ans=(long)0;
    Long[] a=new long[n];
    for(int i=0;i<n;i++){
      a[i]=sc.nextLong();
      summer+=a[i];
      summer%=p;
    }
    for(int i=0;i<n;i++){
      summer-=a[i];
      if(summer<0)summer+=p;
      ans+=(a[i]*summer)%p;
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:10: error: incompatible types: long[] cannot be converted to Long[]
    Long[] a=new long[n];
             ^
1 error
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    long p=1000000007;
    Long summer=0;
    Long ans=0;
    long[] a=new long[n];
    for(int i=0;i<a.length;i++){
      a[i]=sc.nextLong();
      summer=(summer+a[i])%p;
    }
    for(int i=0;i<a.length;i++){
      summer-=a[i];
      if(summer<0)summer+=p;
      ans+=(a[i]*summer)%p;
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:8: error: incompatible types: int cannot be converted to Long
    Long summer=0;
                ^
Main.java:9: error: incompatible types: int cannot be converted to Long
    Long ans=0;
             ^
2 errors
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextLong();
    long p=1000000007;
    long summer=0;
    long[] a=new long[n];
    for(int i=0;i<a.length;i++){
      a[i]=sc.nextLong();
      if(i>0)summer=(summer+a[i])%p;
    }
    summer=(a[0]*summer)%p;
    for(int i=1;i<a.length;i++){
      long t=summer-a[i];
      if(t<0)t+=p;
      summer=(a[0]*summer)%p;
    }
    System.out.println(summer);
  }
}

Compiler output:
Main.java:6: error: incompatible types: possible lossy conversion from long to int
    int n=sc.nextLong();
                     ^
1 error
Language: Java

import java.util.*;

class Main(){
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextLong();
    long p=1000000007;
    long summer=0;
    long[] a=new long[n];
    for(int i=0;i<a.length;i++){
      a[i]=sc.nextLong();
      if(i>0)summer=(summer+a[i])%p;
    }
    summer=(a[0]*summer)%p;
    for(int i=1;i<a.length;i++){
      long t=summer-a[i];
      if(t<0)t+=p;
      summer=(a[0]*summer)%p;
    }
    System.out.println(summer);
  }
}

Compiler output:
Main.java:3: error: '{' expected
class Main(){
          ^
1 error
Language: Java

import java.util.Scanner;
import java.util.ArrayList;

public class Main
{
    Integer N;
    ArrayList<Long> A = new ArrayList<>();
    ArrayList<Long> S = new ArrayList<>();
    Long mod = (long)1000000007;
    void run()
    {
        this.input();
        this.ruisekiwa();
        this.output();
    }

    void input()
    {
        Scanner in = new Scanner(System.in);
        this.N = in.nextInt();
        in.nextLine();
        for(Integer i = 0; i < this.N; i++)
        {
            this.A.add(in.nextLong());
        }

        in.close();
    }

    void ruisekiwa()
    {
        this.S.add((long)0);
        for(Integer i = 0; i < this.N; i++)
        {
            this.S.add(this.S.get(i) + this.A.get(i));
        }
    }

    void output()
    {
        Long ans = (long)0;
        for(Integer i = 0; i < N - 1; i++)
        {
            ans += A.get(i) * ((S.get(N) - S.get(i + 1)) % mod);
            ans %= mod;
        }
        System.out.println(ans);
    }

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

#include <iostream>
#include <string>
#include<algorithm>
using namespace std;
typedef  long long LL;
LL s[200005],x[200005];
int main() {
    int n;
    while (~scanf_s("%d", &n)) {
        LL sum = 0;
        for (int i = 0; i < n; i++) {
            scanf_s("%lld", &x[i]);
        }
        int k = n-1;
        for (int i = n - 1; i >= 0; i--) {;
            if (k < n-1)
                s[k] = x[i] + s[k + 1];
            else s[k] = x[i];
            k--;
        }
        for (int i = 0; i < n - 1; i++) {
            sum += x[i] * s[i+1];
        }
        printf("%lld\n", sum % 1000000007);
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    9 |     while (~scanf_s("%d", &n)) {
      |             ^~~~~~~
      |             scanf
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int64_t sum = 0;
  vector<int64_t> c(N);
  for(int i = 0; i<N; i++){
    cin >> c.at(i);
  }
  
  for(int i = 0; i<N; i++){
    for(int j = i+1;j<N; j++){
      sum += (c.at(i) * c.at(j)%(1e9 + 7));
    }
  }
  cout << sum %(int64_t)(1e9 + 7);
}

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

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

int main(){
  int N;
  cin >> N;
  int64_t sum = 0;
  vector<int64_t> c(N);
  for(int i = 0; i<N; i++){
    cin >> c.at(N);
  }
  
  for(int i = 0; i<N; i++){
    for(int j = i;j<N; j++){
      sum += c.at(i) * c.at(j);
      sum = sum %(int64_t)(10e9 + 7)
    }
  }
  cout << sum %(int64_t)(10e9 + 7);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:37: error: expected ';' before '}' token
   16 |       sum = sum %(int64_t)(10e9 + 7)
      |                                     ^
      |                                     ;
   17 |     }
      |     ~
Language: C++

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

int main(){
  int N;
  cin >> N;
  int64_t sum = 0;
  vector<int64_t> c(N);
  for(int i = 0; i<N; i++){
    cin >> c.at(N);
  }
  
  for(int i = 0; i<N; i++){
    for(int j = i;j<N; j++){
      sum += c.at(i) * c.at(j);
      if(!(j % 5)){
        sum = sum %(int64_t)(10e9 + 7)
      }
    }
  }
  cout << sum %(int64_t)(10e9 + 7);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:39: error: expected ';' before '}' token
   17 |         sum = sum %(int64_t)(10e9 + 7)
      |                                       ^
      |                                       ;
   18 |       }
      |       ~
Language: C++

#include <iostream>
#include <string>
#include<algorithm>
using namespace std;
typedef  long long LL;
LL s[200005];
int main() {
    int n;
    while (~scanf_s("%d", &n)) {
        LL sum = 0;
        for (int i = 0; i < n; i++) {
            scanf_s("%lld", &s[i]);
            if (i >= 1) {
                for (int j = i - 1; j >= 0; j--) {
                    sum += s[i] * s[j];
                }
            }
        }
        printf("%lld\n", sum % 1000000007);
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    9 |     while (~scanf_s("%d", &n)) {
      |             ^~~~~~~
      |             scanf
Language: C++

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

int main(){
  int N;
  cin >> N;
  int64_t sum = 0;
  vector<int> c(N);
  for(int i = 0; i<N; i++){
    cin >> c.at(N);
  }
  
  for(int i = 0; i<N; i++){
    for(int j = i;j<N; j++){
      sum += c.at(i) * c.at(j);
    }
  }
  cout << sum % (10e9 + 7);
}
      
    

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: invalid operands of types 'int64_t' {aka 'long int'} and 'double' to binary 'operator%'
   18 |   cout << sum % (10e9 + 7);
      |           ~~~ ^ ~~~~~~~~~~
      |           |           |
      |           |           double
      |           int64_t {aka long int}
Language: C++

#include <iostream>
#include <string>
#include<algorithm>
using namespace std;
typedef  long long LL;
LL s[200005];
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        scanf_s("%lld", &s[i]);
    }
    LL sum = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            sum += s[i] * s[j];
        }
    }
    printf("%lld\n", sum%1000000007);

}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   11 |         scanf_s("%lld", &s[i]);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
#include <string>
#include<algorithm>
using namespace std;
long long s[200005];
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    long long sum = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            sum += long long(s[i] * s[j]);
        }
    }
    cout << sum%1000000007 << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: expected primary-expression before 'long'
   15 |             sum += long long(s[i] * s[j]);
      |                    ^~~~
Language: C++

#include <iostream>
#include <algorithm>
long long sum,ans;
const maxn=200000+5;
const mod=1000000007;
int n,a[maxn];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) 
        cin>>a[i];
    for(int i=2;i<=n;i++){
        sum=(sum+a[i-1])%mod;
        ans=(ans+sum*a[i])%mod;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc:4:7: error: 'maxn' does not name a type
    4 | const maxn=200000+5;
      |       ^~~~
a.cc:5:7: error: 'mod' does not name a type
    5 | const mod=1000000007;
      |       ^~~
a.cc:6:9: error: 'maxn' was not declared in this scope
    6 | int n,a[maxn];
      |         ^~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |     cin>>n;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:10:14: error: 'a' was not declared in this scope
   10 |         cin>>a[i];
      |              ^
a.cc:12:18: error: 'a' was not declared in this scope
   12 |         sum=(sum+a[i-1])%mod;
      |                  ^
a.cc:12:26: error: 'mod' was not declared in this scope
   12 |         sum=(sum+a[i-1])%mod;
      |                          ^~~
a.cc:15:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   15 |     cout<<ans<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:15:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   15 |     cout<<ans<<endl;
      |                ^~~~
      |                std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define m 1000000007
int main()
{
  ll n;
  cin>>n;
  vector<ll> v;
  ll i,j=0,k;
  ll s=0,x=0;
  
  for(i=0;i<n;i++)
  {
    cin>>k;
    v.push_back(k);
    s=s+k;
  }
  
  for(i=0;i<n;i++)
  {
    x=x+v[i];
    j= (j%m + ((v[i]%m)*((s-x)%m))%m)%m;
    
  }
  cout<<j;
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: error: expected '}' at end of input
   26 |   cout<<j;
      |           ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
ll n , a[N] , sum , ans , mod = 1e9 + 7;

int main(){
fcin;
    cin >> n;
    for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
    for(ll i = 0 ; i < n ; i++){
        sum -= a[i];
        a[i] %= mod;
        ans += (sum + mod )%mod * a[i];
        ans%=mod;
    }
    cout << ans << "\n";
}


Compiler output:
a.cc:6:10: error: 'N' was not declared in this scope
    6 | ll n , a[N] , sum , ans , mod = 1e9 + 7;
      |          ^
a.cc: In function 'int main()':
a.cc:11:40: error: 'a' was not declared in this scope
   11 |     for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
      |                                        ^
a.cc:13:16: error: 'a' was not declared in this scope
   13 |         sum -= a[i];
      |                ^
Language: C++

#include <bits/stdc++.h>
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
ll n , a[N] , sum , ans , mod = 1e9 + 7;

int main(){
fcin;
    ll n;
    cin >> n;
    for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
    for(ll i = 0 ; i < n ; i++){
        sum -= a[i];
        a[i] %= mod;
        ans += (sum + mod )%mod * a[i];
        ans%=mod;
    }
    cout << ans << "\n";
}


Compiler output:
a.cc:4:1: error: 'll' does not name a type
    4 | ll n , a[N] , sum , ans , mod = 1e9 + 7;
      | ^~
a.cc: In function 'int main()':
a.cc:8:5: error: 'll' was not declared in this scope
    8 |     ll n;
      |     ^~
a.cc:9:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    9 |     cin >> n;
      |            ^
      |            yn
a.cc:10:11: error: expected ';' before 'i'
   10 |     for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
      |           ^~
      |           ;
a.cc:10:20: error: 'i' was not declared in this scope
   10 |     for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
      |                    ^
a.cc:10:40: error: 'a' was not declared in this scope
   10 |     for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
      |                                        ^
a.cc:10:47: error: 'sum' was not declared in this scope
   10 |     for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
      |                                               ^~~
a.cc:11:11: error: expected ';' before 'i'
   11 |     for(ll i = 0 ; i < n ; i++){
      |           ^~
      |           ;
a.cc:11:20: error: 'i' was not declared in this scope
   11 |     for(ll i = 0 ; i < n ; i++){
      |                    ^
a.cc:12:9: error: 'sum' was not declared in this scope
   12 |         sum -= a[i];
      |         ^~~
a.cc:12:16: error: 'a' was not declared in this scope
   12 |         sum -= a[i];
      |                ^
a.cc:13:17: error: 'mod' was not declared in this scope; did you mean 'modf'?
   13 |         a[i] %= mod;
      |                 ^~~
      |                 modf
a.cc:14:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |         ans += (sum + mod )%mod * a[i];
      |         ^~~
      |         abs
a.cc:17:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |     cout << ans << "\n";
      |             ^~~
      |             abs
Language: C++

#include <bits/stdc++.h>
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
ll n , a[N] , sum , ans , mod = 1e9 + 7;

int main(){
fcin;
    cin >> n;
    for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
    for(ll i = 0 ; i < n ; i++){
        sum -= a[i];
        a[i] %= mod;
        ans += (sum + mod )%mod * a[i];
        ans%=mod;
    }
    cout << ans << "\n";
}


Compiler output:
a.cc:4:1: error: 'll' does not name a type
    4 | ll n , a[N] , sum , ans , mod = 1e9 + 7;
      | ^~
a.cc: In function 'int main()':
a.cc:8:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |     cin >> n;
      |            ^
      |            yn
a.cc:9:9: error: 'll' was not declared in this scope
    9 |     for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
      |         ^~
a.cc:9:20: error: 'i' was not declared in this scope
    9 |     for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
      |                    ^
a.cc:9:40: error: 'a' was not declared in this scope
    9 |     for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
      |                                        ^
a.cc:9:47: error: 'sum' was not declared in this scope
    9 |     for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
      |                                               ^~~
a.cc:10:9: error: 'll' was not declared in this scope
   10 |     for(ll i = 0 ; i < n ; i++){
      |         ^~
a.cc:10:20: error: 'i' was not declared in this scope
   10 |     for(ll i = 0 ; i < n ; i++){
      |                    ^
a.cc:11:9: error: 'sum' was not declared in this scope
   11 |         sum -= a[i];
      |         ^~~
a.cc:11:16: error: 'a' was not declared in this scope
   11 |         sum -= a[i];
      |                ^
a.cc:12:17: error: 'mod' was not declared in this scope; did you mean 'modf'?
   12 |         a[i] %= mod;
      |                 ^~~
      |                 modf
a.cc:13:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |         ans += (sum + mod )%mod * a[i];
      |         ^~~
      |         abs
a.cc:16:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     cout << ans << "\n";
      |             ^~~
      |             abs
Language: C++

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

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    const long long MOD = 1e9 + 7;

    int n;
    cin >> n;
    vector<int> a(n);

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

    long long ans = 0, sum = 0;
    for (int i = 0; i < n; i++) {
        ans = (ans + sum * a[i]) % MOD;
        sum = (sum + a[i]) % MOD;
    }
    cout << ans << '\n';
}

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

#include<stdio.h>
#include<string.h>

int main(void)
{
  int N;
  long int l,sum = 0;
  long int nums[200000] = {0};
  long int m,sum = 0;
  int i,j;

  scanf("%d",&N);
  for(i = 0;i < N;i++)scanf("%d",&nums[i]);

  for(i = 0;i < N - 1;i++)
  {
    for(j = i+1;j < N;j++)
    {
      m = nums[i] * nums[j];
      m %= 1000000007;
      sum += m;
      //printf("%ld %ld, %ld\n",nums[i] ,nums[j],sum);
    }
  }

  sum %= 1000000007;

  printf("%ld",sum);
  
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:14: error: redefinition of 'sum'
    9 |   long int m,sum = 0;
      |              ^~~
main.c:7:14: note: previous definition of 'sum' with type 'long int'
    7 |   long int l,sum = 0;
      |              ^~~
Language: C++

#include <iostream>
#include <climits>
#include <algorithm>
#include <numeric>
#include <queue>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <array>
#include <memory>

#define IN(a,b) (a.find(b) != a.end())
#define p(a,b) make_pair(a,b)
#define readVec(a) for (int64_t __i = 0; __i<(int64_t)a.size();__i++){cin>>a[__i];}

// jimjam

template<typename T>
void pMin(T &a, T b) {if (b<a){a=b;}}
template<typename T>
void pMax(T &a, T b) {if (b>a){a=b;}}
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& c);
template<typename A, typename B>
std::ostream& operator<<(std::ostream& os, const std::pair<A,B>& c) {std::cout << "(" << c.first << ", " << c.second << ")";return os;}

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	const int64_t mod = 1e9+7;
	int64_t n; cin >> n;
	vector<int64_t> a(n);
	readVec(a);
	
	int64_t sum = accumulate(a.begin(),a.end(),int64_t(0));
	sum %= mod;
	int64_t ans=0;

	for (int64_t i: a) {
		ans += (sum-i)*i;
		ans %= mod;
	}
	assert(ans%2==0);
	cout << ans/2 << endl;
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: 'assert' was not declared in this scope
   47 |         assert(ans%2==0);
      |         ^~~~~~
a.cc:12:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   11 | #include <memory>
  +++ |+#include <cassert>
   12 |
Language: C++

#include <iostream>
#include <climits>
#include <algorithm>
#include <numeric>
#include <queue>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <array>
#include <memory>

#define IN(a,b) (a.find(b) != a.end())
#define p(a,b) make_pair(a,b)
#define readVec(a) for (int64_t __i = 0; __i<(int64_t)a.size();__i++){cin>>a[__i];}

// jimjam

template<typename T>
void pMin(T &a, T b) {if (b<a){a=b;}}
template<typename T>
void pMax(T &a, T b) {if (b>a){a=b;}}
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& c);
template<typename A, typename B>
std::ostream& operator<<(std::ostream& os, const std::pair<A,B>& c) {std::cout << "(" << c.first << ", " << c.second << ")";return os;}

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	const int64_t mod = 1e9+7;
	int64_t n; cin >> n;
	vector<int64_t> a(n);
	readVec(a);
	
	int64_t sum = accumulate(a.begin(),a.end(),0);
	sum %= MOD;
	int64_t ans=0;

	for (int64_t i: a) {
		ans += (sum-i)*i;
		ans %= mod;
	}
	cout << ans/2 << endl;
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:40:16: error: 'MOD' was not declared in this scope
   40 |         sum %= MOD;
      |                ^~~
Language: C++

#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
#define Max 1e9+7
ll  a[Max];
int main() 
{ 
    // added the two lines below 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    ll n,sum=0;
    cin>>n;
    for(ll i=0;i<n;i++) {
    	cin>>a[i];
	}
	for(ll i=0;i<n-1;i++) {
		for(ll j=i+1;j<n;j++) {
			sum=sum+(a[i]*a[j]);
		}
	}
	cout<<sum<<"\n";
	return 0;
}

Compiler output:
a.cc:4:16: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 | #define Max 1e9+7
      |             ~~~^~
a.cc:5:7: note: in expansion of macro 'Max'
    5 | ll  a[Max];
      |       ^~~
a.cc:4:16: error: could not convert '(1.0e+9 + (double)7)' from 'double' to 'long unsigned int'
    4 | #define Max 1e9+7
      |             ~~~^~
      |                |
      |                double
a.cc:5:7: note: in expansion of macro 'Max'
    5 | ll  a[Max];
      |       ^~~
a.cc:4:16: error: size of array 'a' has non-integral type 'double'
    4 | #define Max 1e9+7
      |             ~~~^~
a.cc:5:7: note: in expansion of macro 'Max'
    5 | ll  a[Max];
      |       ^~~
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>;
const int INF=1e9;
const int MOD=1e9+7;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> b(n+1,0);
  rep(i,n) b[i+1] = b[i] + a[i];
  ll ans=0;
  rep(i,n) {
    ll sum=(b[n]-b[i+1])%MOD;
    ans += a[i]*sum;
    ans %= MOD;
  }
  cout << ans << endl;
}

AC

Compiler output:
a.cc:25:1: error: 'AC' does not name a type
   25 | AC
      | ^~
Language: C++

#include<iostream>
#include<vector>
using namespace std;

int main(){
  int N;  cin >> N;
  vector<long long>A(N);
  long long sum = 0;

  for(int i=0;i<N;i++){
    cin >> A.at(i);
    A.at(i) = A.at(i) % 1000000007;
    X += A.at(i);
    X = X % 1000000007;
  }
  long long ans = 0;
  for(int i=0;i<N;i++){
    X -= A.at(i);
    if(X < 0) X += 1000000007;
    ans += A.at(i)*X;
    ans = ans % 1000000007;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'X' was not declared in this scope
   13 |     X += A.at(i);
      |     ^
a.cc:18:5: error: 'X' was not declared in this scope
   18 |     X -= A.at(i);
      |     ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<ll,ll>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

ll gcd(ll a,ll b){return b ? gcd(b,a%b) :a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}

ll n;



    vector<pair<ll,ll>>p;
void fs(ll a){
    for(ll i=2;i*i<=n;i++){
        ll cnt=0;
        while(n%i==0){
            n/=i;
            cnt++;
        }
        p.emplace_back(i,cnt);
    }
    return;
}


ll di[]={1,0,-1,0};
ll dj[]={0,-1,0,1};
int main(){
   int n;
   cin>>n;
    long long int a[n],ans=0,i;
    int mod=1000000007;
    long long int sum=0;
 
    for( i = 0 ; i < n ; i++ ){
            cin>>a[i];
        sum = sum + a[i];
        sum%=m;
    }
    for( i = 0 ; i < n ; i++ ){
        sum = sum - a[i];
 
        ans+=(a[i]%mod * sum%mod)%mod;
    }
    cout<<ans%mod;
 
    return 0;
}
 




Compiler output:
a.cc: In function 'int main()':
a.cc:75:14: error: 'm' was not declared in this scope
   75 |         sum%=m;
      |              ^
Language: C++

#include<bits/stdc++.h>
 
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<long long , long long>
#define pb push_back
#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;}
const ll mod = 1e9 + 7;
 
int run_test(){
      int n;
      cin>> n;
      if(n == 1){
            ll a;
            cin >> a;
            cout << a;
            return 0;
      }
      ll arr[n];
      for(int i=0; i<n; i++){
            cin >> arr[i];
      }
      ll a2[n];
      ll sum = 0;
      for(int i=n-1; i > 0; i--){
            sum += arr[i];
            a2[i] = sum;
      }
      ll ans = 0;
      for(int i=0; i<n - 1; i++){
            ans = ans + arr[i] * arr2[i + 1];
            ans %= mod;
      }
      cout << ans << "\n";
      return 0;
}
 
int main(){
    FAST;
    ll t;
    t = 1;
 
    while(t--){
        run_test();
    }
}


Compiler output:
a.cc: In function 'int run_test()':
a.cc:38:34: error: 'arr2' was not declared in this scope; did you mean 'arr'?
   38 |             ans = ans + arr[i] * arr2[i + 1];
      |                                  ^~~~
      |                                  arr
Language: C++

#include<bits/stdc++.h>
 
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<long long , long long>
#define pb push_back
#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;}
const ll mod = 1e9 + 7;
 
int run_test(){
      int n;
      cin>> n;
      if(n == 1){
            ll a;
            cin >> a;
            cout << a;
            return 0;
      }
      ll arr[n];
      for(int i=0; i<n; i++){
            cin >> arr[i];
      }
      ll a2[n];
      ll sum = 0;
      for(int i=n-1; i > 0; i--){
            sum += arr[i];
            a2[i] = sum;
      }
      ll ans = 0;
      for(int i=0; i<n - 1; i++){
            ans = ans + a[i] * a2[i + 1];
            ans %= mod;
      }
      cout << ans << "\n";
      return 0;
}
 
int main(){
    FAST;
    ll t;
    t = 1;
 
    while(t--){
        run_test();
    }
}


Compiler output:
a.cc: In function 'int run_test()':
a.cc:38:25: error: 'a' was not declared in this scope
   38 |             ans = ans + a[i] * a2[i + 1];
      |                         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 5;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef vector<int> vi;

long long mod(long long x){
        return ((x%M + M)%M);
    }
long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }


int solve(vector <int> arr, int n) {
    vector <ll> pref(n+1);
    for(int i=n-1;i>=0;i--){
        pref[i]=pref[i+1]+arr[i];
    }

    ll ans=0;
    for(int i=0;i<n;i++){
        ans=add(ans,mul(arr[i],pref[i]));
    }
    return ans;
   
    
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE
        freopen("inputcpp.txt", "r", stdin);
        freopen("outputcpp.txt", "w", stdout);
    #endif

    int n;
    cin>>n;
    vector <int> arr(n);
    for (int i=0;i<n;i++){
        cin>>arr[i];
    }
    cout<<solve(arr,n)<<endl;
    
    
}

Compiler output:
a.cc: In function 'long long int mod(long long int)':
a.cc:13:20: error: 'M' was not declared in this scope
   13 |         return ((x%M + M)%M);
      |                    ^