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



#include <bits/stdc++.h>
#include <sstream>

//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
//#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define INF (int)1e15
#define MOD 1000000007
#define re0 return 0
//#define N 12
#define sz 1000*1000


string multiply(string num1, string num2)
{
    int len1 = num1.size();
    int len2 = num2.size();
    if (len1 == 0 || len2 == 0)
    return "0";


    vector<int> result(len1 + len2, 0);


    int i_n1 = 0;
    int i_n2 = 0;

    // Go from right to left in num1
    for (int i=len1-1; i>=0; i--)
    {
        int carry = 0;
        int n1 = num1[i] - '0';


        i_n2 = 0;


        for (int j=len2-1; j>=0; j--)
        {

            int n2 = num2[j] - '0';


            int sum = n1*n2 + result[i_n1 + i_n2] + carry;

            // Carry for next iteration
            carry = sum/10;

            // Store result
            result[i_n1 + i_n2] = sum % 10;

            i_n2++;
        }

        // store carry in next cell
        if (carry > 0)
            result[i_n1 + i_n2] += carry;

        i_n1++;
    }

    // ignore '0's from the right
    int i = result.size() - 1;
    while (i>=0 && result[i] == 0)
    i--;

    // If all were '0's - means either both or
    // one of num1 or num2 were '0'
    if (i == -1)
    return "0";



    // generate the result string
    string s = "";

    while (i >= 0)
        s += std::to_string(result[i--]);

    return s;
}


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef number<cpp_int_backend<1024, 1024, signed_magnitude, unchecked, void> >   int1024_t;
int main() {
    int1024_t N;
    cin >> N;
    vector<int1024_t> V(N);
    
    for (long long i = 0; i < N; i++) {
        cin >> V.at(i);
    }
    int1024_t wa;
    for (long long j = 0; j < N; j++) {
        wa += V.at(j);
    }
    int1024_t ans = wa*wa;
    for (long long k = 0; k < N; k++) {
        ans -= V.at(k)*V.at(k);
    }
    ans = ans/2;
    ans = ans%(1000000009);
    cout << ans << endl;
}

Compiler output:
a.cc:3:9: error: 'number' does not name a type
    3 | typedef number<cpp_int_backend<1024, 1024, signed_magnitude, unchecked, void> >   int1024_t;
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:5:5: error: 'int1024_t' was not declared in this scope; did you mean 'int64_t'?
    5 |     int1024_t N;
      |     ^~~~~~~~~
      |     int64_t
a.cc:6:12: error: 'N' was not declared in this scope
    6 |     cin >> N;
      |            ^
a.cc:7:21: error: template argument 2 is invalid
    7 |     vector<int1024_t> V(N);
      |                     ^
a.cc:10:18: error: request for member 'at' in 'V', which is of non-class type 'int'
   10 |         cin >> V.at(i);
      |                  ^~
a.cc:12:14: error: expected ';' before 'wa'
   12 |     int1024_t wa;
      |              ^~~
      |              ;
a.cc:14:9: error: 'wa' was not declared in this scope
   14 |         wa += V.at(j);
      |         ^~
a.cc:14:17: error: request for member 'at' in 'V', which is of non-class type 'int'
   14 |         wa += V.at(j);
      |                 ^~
a.cc:16:14: error: expected ';' before 'ans'
   16 |     int1024_t ans = wa*wa;
      |              ^~~~
      |              ;
a.cc:18:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |         ans -= V.at(k)*V.at(k);
      |         ^~~
      |         abs
a.cc:18:18: error: request for member 'at' in 'V', which is of non-class type 'int'
   18 |         ans -= V.at(k)*V.at(k);
      |                  ^~
a.cc:18:26: error: request for member 'at' in 'V', which is of non-class type 'int'
   18 |         ans -= V.at(k)*V.at(k);
      |                          ^~
a.cc:20:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |     ans = ans/2;
      |     ^~~
      |     abs
Language: Java

import java.util.*;

public class Main {
	public static void main(String[] args) {
		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 ans = 0;
		long mod = 1000000007L;
		list<long> loop = new ArrayList<long>();
		for(int i = 0; i < n; i++) {
			for(int j = i + 1; j < n; j++) {
				for(int b = 0; b < a[i]; b++){
				ans = (ans + a[j]) % mod;
				if(loop.contains(ans)){
					j = j - j % b;
				}
				loop.add(ans);
				}
			}
		}
		System.out.println(ans);
	}
}

Compiler output:
Main.java:13: error: cannot find symbol
		list<long> loop = new ArrayList<long>();
		^
  symbol:   class list
  location: class Main
Main.java:13: error: unexpected type
		list<long> loop = new ArrayList<long>();
		     ^
  required: reference
  found:    long
Main.java:13: error: unexpected type
		list<long> loop = new ArrayList<long>();
		                                ^
  required: reference
  found:    long
3 errors
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	long n = sc.nextLong();
	long[] a = new long[n];

	for (int i=0; i<n; i++) a[i] = sc.nextLong();
	long sum = 0;
	long tasu = 0;
	for (int i=0; i<n-1; i++) {
	    tasu = 0;
	    for (int j=i+1; j<n; j++) {
		tasu += a[j];
	    }
	    sum = (sum + a[i] * tasu) % 1000000007;
	}
	System.out.print(sum);
	
    }
}


Compiler output:
Main.java:7: error: incompatible types: possible lossy conversion from long to int
	long[] a = new long[n];
	                    ^
1 error
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

void funcA() {

  double d, t, s;
  cin >> d >> t >> s;

  double time = d / s;

  if (time <= t) cout << "Yes";
  else cout << "No";
}

void funcB() {

  string s, t;
  cin >> s >> t;

  int ans = 10000;
  for (int i = 0; i < s.size() - t.size() + 1; ++i) {
    int count = 0;

    for (int j = 0; j < t.size(); ++j) {
      if (s[i + j] != t[j]) ++count;
    }
    if (count < ans) ans = count;
  }

  cout << ans;
}

void funcC() {

  int n;
  cin >> n;
  vector<unsigned long long> a;
  for (int i = 0; i < n; ++i) {
    unsigned long long temp;
    cin >> temp;
    //nより大きい整数は間引き
    a.push_back(temp);
  }

  unsigned long long ans = 0;
  unsigned long long sum = a[0];
  int num = 2;
  for (int i = 0; i < a.size() - 1; ++i) {
    ans += sum * a[i + 1];
    ans %= unsigned long long(pow(10, 9));
    sum += a[i + 1];
    //sum %= unsigned long long(pow(10, 9));
  }

  cout << ans;

}

void funcD() {

  int n, m;
  cin >> n >> m;
  int group = 1;

  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
  }




}

int main() {

  //funcA();
  funcC();

  //funcD();

  return 0;
}

Compiler output:
a.cc: In function 'void funcC()':
a.cc:54:12: error: expected primary-expression before 'unsigned'
   54 |     ans %= unsigned long long(pow(10, 9));
      |            ^~~~~~~~
Language: C++

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

 int main(){
   int n, i,j;
  long long x=0
  int k= (1e+9)+7;
   cin >> n;
   vector<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++){
         x += (a[i]*a[j];
     }
   }
   long long ans = x%k;
   cout << ans << endl;
   
   
     return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'int'
    7 |   int k= (1e+9)+7;
      |   ^~~
a.cc:16:25: error: expected ')' before ';' token
   16 |          x += (a[i]*a[j];
      |               ~         ^
      |                         )
a.cc:19:22: error: 'k' was not declared in this scope
   19 |    long long ans = x%k;
      |                      ^
Language: Java

import java.util.Scanner;
import java.util.Arrays;
import java.util.List;

public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
		int count = Integer.parseInt(sc.nextLine());
		String[] input = sc.nextLine().split(" ");
		Long result = 0L;
		// 左側の数字を決める
		for (int i=0; i<count-1; i++) {
			// 右側の数字を決める
			for (int j=i+1; j<count; j++) {
				result += Long.parseInt(input[i])*Long.parseInt(input[j]);
			}
		}
		System.out.println(result);
	}
}


Compiler output:
Main.java:15: error: cannot find symbol
				result += Long.parseInt(input[i])*Long.parseInt(input[j]);
				              ^
  symbol:   method parseInt(String)
  location: class Long
Main.java:15: error: cannot find symbol
				result += Long.parseInt(input[i])*Long.parseInt(input[j]);
				                                      ^
  symbol:   method parseInt(String)
  location: class Long
2 errors
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<bitset>
#include<queue>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int main(){
  int n;
  cin >> n;
  vector<ll> vec(n);
  rep(i,n) cin >> vec.at(i);
  ll sum = 0;
  ll mod = 100000007
  for (int i=1; i<n; i++){
    sum += vec.at(i);
  }
  ll x = 0;
  for (int i=0; i<n-1; i++){
    x += vec.at(i) * sum % mod;
    sum -= vec.at(i+1);
  }
  cout << x% mod << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: expected ',' or ';' before 'for'
   22 |   for (int i=1; i<n; i++){
      |   ^~~
a.cc:22:17: error: 'i' was not declared in this scope
   22 |   for (int i=1; i<n; i++){
      |                 ^
Language: C

#include <stdio.h>
#include <math.h>

int main()
{int n;scanf("%d",&n);long long int a[n],j;for(j=0;j<n;j++)scanf("%lld",(a+j));
long long int s=0,d=0,p=1000000007;for(j=0;j<n;j++){s=((s+a[j])%p);d=((d+((a[j]*a[j])%p))%p);}
s=((s*s)%p);s=(s-d);
printf("%lld\n",((s-d)/2));
return(0);

Compiler output:
main.c: In function 'main':
main.c:9:1: error: expected declaration or statement at end of input
    9 | return(0);
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    const int mod = 1000000007;
    int n;
    cin >> n;
    vector<long long>a(n);
    rep(i,n)cin >> a[i];
    long long ans - 0;
    rep(i,n){
        rep(j,n-1)
            ans+=(a[i]%mod)*(a[j]%mod);
    }

    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: expected initializer before '-' token
   14 |     long long ans - 0;
      |                   ^
a.cc:17:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |             ans+=(a[i]%mod)*(a[j]%mod);
      |             ^~~
      |             abs
a.cc:20:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |     cout << ans;
      |             ^~~
      |             abs
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<bitset>
#include<queue>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int main(){
  int n;
  cin >> n;
  vector<ll> vec(n);
  rep(i,n) cin >> vec.at(i);
  ll sum = 0;
  ll mod = 100000007
  for (int i=1; i<n; i++){
    sum += vec.at(i);
  }
  ll x = 0;
  for (int i=0; i<n-1; i++){
    x += vec.at(i) * sum % mod;
    sum -= vec.at(i+1);
  }
  cout << sum % mod << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: expected ',' or ';' before 'for'
   22 |   for (int i=1; i<n; i++){
      |   ^~~
a.cc:22:17: error: 'i' was not declared in this scope
   22 |   for (int i=1; i<n; i++){
      |                 ^
Language: C++

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

int main(void){
   ll N;
   cin >>N;
   ll A[N];
   ll sum=0;
   rep(i,N){
       cin>>A[i];
       sum+=A[i]%1000000007;
   }
   
   ll ans=0;
   
   rep(i,N){
       ans+=(A[i]%1000000007*(sum-A[i]%1000000007));
       sum-=A[i]%1000000007
       if(sum>0){
           sum+=1000000007;a
       }
   }
   ll ANS=ans%1000000007;
   cout<<ANS<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:28: error: expected ';' before 'if'
   20 |        sum-=A[i]%1000000007
      |                            ^
      |                            ;
   21 |        if(sum>0){
      |        ~~
Language: C++

#include <iostream>

using namespace std;

int main()

{
    int d;
    cin>>d;
    int A[d];
  

    for(int i=0;i<d;i++){
            int e;
            cin>>e;
            A[i]=e;
    }
    cout<<findProductSum(A, d)<<endl;
     return 0;
}
    
            

  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 + A[i]; 
  
    // calcualting square of array sum 
    // (a1 + a2 + ... + an)^2 
    int array_sum_square = array_sum * array_sum; 
  
    // 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]; 
  
    // required sum is (array_sum_square - 
    // individual_square_sum) / 2 
    return (array_sum_square - individual_square_sum)/2; 
}

   



Compiler output:
a.cc: In function 'int main()':
a.cc:18:11: error: 'findProductSum' was not declared in this scope
   18 |     cout<<findProductSum(A, d)<<endl;
      |           ^~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>

int	main(void)
{
  int	n;
  lon long	*a;
  int	i = 0;
  int	j = 0;
  long long	sum = 0;
  
  if (scanf("%d", n) < 0)
    return (0);
  a = malloc(n * sizeof(long long));
  while (i < n)
  {
    if (scanf("%d", a[i]) < 0);
    	return (0);
    i++;
  }
  i = 1;
  while (i < n -1)
  {
    j = i + 1;
    while (j < n)
    {
      sum += (long long)(j * i);
      j++;
    }
    i++;
  }
  printf("%lld", (sum % 1000000007));
  return (0);
}
    
  

Compiler output:
main.c: In function 'main':
main.c:7:3: error: 'lon' undeclared (first use in this function)
    7 |   lon long      *a;
      |   ^~~
main.c:7:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:6: error: expected ';' before 'long'
    7 |   lon long      *a;
      |      ^~~~~
      |      ;
main.c:14:3: error: 'a' undeclared (first use in this function)
   14 |   a = malloc(n * sizeof(long long));
      |   ^
Language: C++

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

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

#include<iostream>
#include<algorithm>
#include<vector>
using LL = unsigned  unsigned long long;
using namespace std;

LL pow_l(LL x, LL n) {
	LL mod = 10e9 + 7;

	LL res = 1, x_n = x;
	while (n > 0) {
		if ((n & 1) == 1) {
			res *= x_n;
			res = res % mod;
		}
		n = n >> 1;
		x_n = x_n * x_n % mod;
		if (x_n == 0) {
			return 0;
		}
	}

	return res;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int main() {
	LL N;
	cin >> N;
	vector<LL>A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	LL sum = 0, s_sum = 0;
	LL mod = 10e9 + 7;

	for (int i = 0; i < N; i++) {
		sum += A[i] % mod;
		sum = sum % mod;
		s_sum += A[i] * A[i] % mod;
		s_sum = s_sum % mod;
	}

	LL ans = (sum * sum % mod - s_sum);
	while (ans < 0) {
		ans += mod;
	}
	ans %= mod;
	ans = ans * (modinv(2, mod) % mod) % mod;
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:4:22: error: duplicate 'unsigned'
    4 | using LL = unsigned  unsigned long long;
      |                      ^~~~~~~~
      |                      --------
Language: C

#include<stdio.h>
int main(void){
  int N;
  int a[200000];
  int X, Y;
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",&a[N]);
  }
  for(int i = 0;i < N-2;i++){
    for(int j = 0;j < N-1;j++){
      X = a[i] * a[j];
    }
  }
  Y = X mod 1000000007;
  printf("%d",Y);
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:15:8: error: expected ';' before 'mod'
   15 |   Y = X mod 1000000007;
      |        ^~~~
      |        ;
Language: C++


	for(int i = 0; i < N; i++)
		A[i] %= mod;

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

	cout << ans % mod << endl;
	return 0;
}


Compiler output:
a.cc:2:9: error: expected unqualified-id before 'for'
    2 |         for(int i = 0; i < N; i++)
      |         ^~~
a.cc:2:24: error: 'i' does not name a type
    2 |         for(int i = 0; i < N; i++)
      |                        ^
a.cc:2:31: error: 'i' does not name a type
    2 |         for(int i = 0; i < N; i++)
      |                               ^
a.cc:5:9: error: 'lli' does not name a type
    5 |         lli ans = 0;
      |         ^~~
a.cc:6:9: error: expected unqualified-id before 'for'
    6 |         for(int i = 0; i < N - 1; i++)
      |         ^~~
a.cc:6:24: error: 'i' does not name a type
    6 |         for(int i = 0; i < N - 1; i++)
      |                        ^
a.cc:6:35: error: 'i' does not name a type
    6 |         for(int i = 0; i < N - 1; i++)
      |                                   ^
a.cc:14:9: error: 'cout' does not name a type
   14 |         cout << ans % mod << endl;
      |         ^~~~
a.cc:15:9: error: expected unqualified-id before 'return'
   15 |         return 0;
      |         ^~~~~~
a.cc:16:1: error: expected declaration before '}' token
   16 | }
      | ^
Language: Java

import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] arr = new int[n];

		for(int i = 0; i < n; i++){
			arr[i] = sc.nextInt();
		}

		long sum = 0;
        int MOD = (int)Math.pow(10, 9) + 7;
      
		for(int i = 0; i < n; i++){
          for(int ii = i + 1; ii < n; ii++){
            
            sum += arr[i] * arr[ii] % MOD;
          }
		}

		System.out.println(sum % mod);
	}
}

Compiler output:
Main.java:24: error: cannot find symbol
		System.out.println(sum % mod);
		                         ^
  symbol:   variable mod
  location: class Main
1 error
Language: C++

#include <iostream> 
using namespace std; 
typedef long long ll;
ll findProductSum(int A[], int n) {
    ll array_sum = 0; 
    for (int i = 0; i < n; i++) 
        array_sum = array_sum + A[i]; 
    ll array_sum_square = array_sum * array_sum; 
    ll individual_square_sum = 0; 
    for (int i = 0; i < n; i++) 
        individual_square_sum += A[i]*A[i]; 
    return ((array_sum_square - individual_square_sum) % 1000000007)/2;
} 
int n;
int main() { 	
 	cin >> n;
  	int A[] = new int[n];
 	for(int i = 0;  i < n; i++) cin >> A[i];
    int n = sizeof(A)/sizeof(A[0]); 
    cout << findProductSum(A, n); 
    return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: initializer fails to determine size of 'A'
   17 |         int A[] = new int[n];
      |                   ^~~~~~~~~~
a.cc:17:19: error: array must be initialized with a brace-enclosed initializer
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define int long long
const int mod = 1e9+7;
const int N = 200010;

int n, m;
int p[N], cnt[N];

int find(int x)
{
    if (p[x] != x) p[x] = find(p[x]);
    return p[x];
}
long long sum[N];
int a[N];
signed main()
{
   //a0*a1 + a0*a2 * a0 *a3 + a1*a2 + a2*a3
    cin >> n;
  for(int i = 1; i <= n; i++)
  {
  	int t;
    cin >> t;
    a[i] = t;
    
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:35:26: error: 'ai' was not declared in this scope; did you mean 'i'?
   35 |   for(int i = 1; i <= n; ai++)
      |                          ^~
      |                          i
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<long long> A(n);
  for(int i = 0;i<n;i++){
  cin >> A.at(i);
  }
  long long S = 0;
  for(int i=0;i<n;i++){
    for(int j=1;j<n+1;j++){
      S += A.at(i)*A.at(j);
    }
    j++;
  }
  cout << S % 1000000007 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'j' was not declared in this scope
   15 |     j++;
      |     ^
Language: C++


int sum(int n) {
    if (n == 0) {
        return 0;
    }

    int s = sum(n - 1);
    return s + n;
}
int main() {
    int N ,z;
    ll x=0;
    cin >> N;
    vector<int>A(N);
    for(int i=0;i<N;i++)
    cin >> A[i];
    for (int i=0;i < N;i++) {
        for (int j=0;j < N;j++) {
            if (i != j && j>= i){
                z = A[i]*A[j];
                x += z;
                //cout<<A[i]<<A[j]<<endl;
            }
        }
    }
    cout << x %1000000007;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'll' was not declared in this scope
   12 |     ll x=0;
      |     ^~
a.cc:13:5: error: 'cin' was not declared in this scope
   13 |     cin >> N;
      |     ^~~
a.cc:14:5: error: 'vector' was not declared in this scope
   14 |     vector<int>A(N);
      |     ^~~~~~
a.cc:14:12: error: expected primary-expression before 'int'
   14 |     vector<int>A(N);
      |            ^~~
a.cc:16:12: error: 'A' was not declared in this scope
   16 |     cin >> A[i];
      |            ^
a.cc:20:21: error: 'A' was not declared in this scope
   20 |                 z = A[i]*A[j];
      |                     ^
a.cc:21:17: error: 'x' was not declared in this scope
   21 |                 x += z;
      |                 ^
a.cc:26:5: error: 'cout' was not declared in this scope
   26 |     cout << x %1000000007;
      |     ^~~~
a.cc:26:13: error: 'x' was not declared in this scope
   26 |     cout << x %1000000007;
      |             ^
Language: C

#include<stdio.h>
int main(){
	int n,i,j;
	long int a[200001],ans=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%ld",&a[i]);
	for(i=1;i<n;i++){
		for(j=i+1;j<=n;j++){
			ans=sum+a[i]*a[j];
            ans%=1000000007;
		}
	}
	printf("%ld",ans);
}


Compiler output:
main.c: In function 'main':
main.c:9:29: error: 'sum' undeclared (first use in this function)
    9 |                         ans=sum+a[i]*a[j];
      |                             ^~~
main.c:9:29: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<ll,ll> Pair;

int main(){

  ll N;
  long double ans = 0;
  long double mod = 1e9 + 7;
  cin >> N;

  vector<long double> A(N);
  vector<long double> S(N + 1);

  for (ll i = 0; i < N;++i)
    cin >> A[i];

  S[0] = 0;

  for (ll i = 1; i <= N;++i){

    S[i] = (S[i - 1] + A[i - 1])%mod;

  }

  for (ll i = 0; i < N;++i){

    ll SS = (S[N] - S[i + 1]);

    while()


    long double tmp = ((S[N] - S[i + 1]) * A[i]) % mod;

    ans = (ans + tmp) % mod;
  }

  cout << ans << endl;

  return 0;

}   


Compiler output:
a.cc: In function 'int main()':
a.cc:26:33: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long double>, long double>::value_type' {aka 'long double'} and 'long double' to binary 'operator%'
   26 |     S[i] = (S[i - 1] + A[i - 1])%mod;
      |            ~~~~~~~~~~~~~~~~~~~~~^~~~
      |                      |           |
      |                      |           long double
      |                      __gnu_cxx::__alloc_traits<std::allocator<long double>, long double>::value_type {aka long double}
a.cc:34:11: error: expected primary-expression before ')' token
   34 |     while()
      |           ^
a.cc:37:50: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long double>, long double>::value_type' {aka 'long double'} and 'long double' to binary 'operator%'
   37 |     long double tmp = ((S[N] - S[i + 1]) * A[i]) % mod;
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
      |                                          |         |
      |                                          |         long double
      |                                          __gnu_cxx::__alloc_traits<std::allocator<long double>, long double>::value_type {aka long double}
a.cc:39:18: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   39 |     ans = (ans + tmp) % mod;
      |                  ^~~
      |                  tm
Language: C++

#include <iostream> 
using namespace std; 
typedef long long ll;
// required function 
ll findProductSum(int A[], int n) {
    ll array_sum = 0; 
    for (int i = 0; i < n; i++) 
        array_sum = array_sum + A[i]; 
    ll array_sum_square = array_sum * array_sum; 
    ll individual_square_sum = 0; 
    for (int i = 0; i < n; i++) 
        individual_square_sum += A[i]*A[i]; 
    return ((array_sum_square - individual_square_sum) % 1000000007)/2;
} 
int n;
int main() { 	
 	cin >> n;
  	ll A[] = new ll[n];
 	for(int i = 0;  i < n; i++){
    	cin >> A[i];
    }
    int n = sizeof(A)/sizeof(A[0]); 
    cout << findProductSum(A, n); 
    return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: initializer fails to determine size of 'A'
   18 |         ll A[] = new ll[n];
      |                  ^~~~~~~~~
a.cc:18:18: error: array must be initialized with a brace-enclosed initializer
a.cc:23:28: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   23 |     cout << findProductSum(A, n);
      |                            ^
      |                            |
      |                            ll* {aka long long int*}
a.cc:5:23: note:   initializing argument 1 of 'll findProductSum(int*, int)'
    5 | ll findProductSum(int A[], int n) {
      |                   ~~~~^~~
Language: C++

#include <bits/stdc++.h>
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[i];
    sum+=a[i];
  }
  vector<long long> ans;
  for(int i=0;i<n-1;i++){
      sum-=a[i];
      ans.push_back(a[i]*sum);
  }
  long long res=0;
  for(auto x:ans){
    res+=x;
    res%=(long long)1e9+7
  }
  cout<<res<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:26: error: expected ';' before '}' token
   20 |     res%=(long long)1e9+7
      |                          ^
      |                          ;
   21 |   }
      |   ~
Language: C++

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

int main() {
    ll n,sum=0;cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        sum+=arr[i];
    }
    
    ll ans=0;
    
    for(int i=0;i<n-1;i++)
    {
        sum-=arr[i];
        ans+=arr[i]*sum;
       // ans=ans%1000000007;
    }
  ans=ans%1000000007
    cout<<ans;
    
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:21: error: expected ';' before 'cout'
   22 |   ans=ans%1000000007
      |                     ^
      |                     ;
   23 |     cout<<ans;
      |     ~~~~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
    
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		// スペース区切りの整数の入力
      long m = (long)Math.pow(10,9)+7;
      long[] a = new long[n];
      for(int i=0;i<n;i++){
		a[i] = Long.parseLong(sc.next())  m;
        //a[i] = sc.nextLong() ;
      }
      
    //入力
      long sum = 0;
      for(int k=0;k<n;k++){
 	 	for(int j = k+1;j<n;j++){
		sum += (a[k] * a[j]) m;
	/*	System.out.println(a[k]);
          System.out.println(a[j]);
          System.out.println("");
     */
		}
      }
      System.out.println(sum%m);
      
}
}



Compiler output:
Main.java:12: error: ';' expected
		a[i] = Long.parseLong(sc.next())  m;
		                                ^
Main.java:12: error: not a statement
		a[i] = Long.parseLong(sc.next())  m;
		                                  ^
Main.java:20: error: ';' expected
		sum += (a[k] * a[j]) m;
		                    ^
Main.java:20: error: not a statement
		sum += (a[k] * a[j]) m;
		                     ^
4 errors
Language: Java

import java.util.*;

public class Main2 {

    public static void main(String args []) {

        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        long[] list = new long[n];
        long sum = 0;
        long mod = 1000000007;

        for (int i = 0; i<n; i++) {
            long a = scan.nextLong();
            list[i] = a;
        }

        for (int i = 0; i<n - 1; i++) {


            for (int j = i + 1; j<n; j++) {

                long a = list[i] * list[j] % mod;
                sum = (a + sum) % mod;
            }
        }
//
//        long a = sum % 1000000007;

//        String string = String.valueOf(sum);
//
//        if (string.length() < 10) {
//
//            System.out.println(Long.valueOf(string));
//        } else {
//            long a = Long.valueOf(string.substring(string.length() - 10));
//
//        }

        System.out.println(sum);

    }
}


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>
typedef long long ll;
using namespace std;
void solve()
{
    int n;
    int m;
    cin>>n>>m;
    int a[n],b[m];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    for(int i=0; i<m; i++)
    {
        cin>>b[i];
    }
    sort(a,a+n);
    int p=0;
    for(int i=0; i<m; i++)
    {
        cout<<upper_bound(a,a+n,b[i])-a<<' ';
    }
}
void abc()
{
    ll a[3],b[3];
    for(int i=0; i<3; i++)
        cin>>a[i];
    for(int i=0; i<3; i++)
        cin>>b[i];
    ll sum=0;
    if(a[2]>=a[1])
        sum+=(2*min(a[2],b[1]));
    a[2]-=min(a[2],b[1]);
    b[1]-=min(a[2],b[1]);
    a[1]-=(min(a[1],b[1]));
    a[1]-=(min(a[1],b[0]));
    b[2]-=(min(b[2],a[2]));
    b[2]-=(min(b[2],a[0]));
    if(b[2]>0&&a[1]>0)
    {
        sum-=(2*min(a[1],b[2]));
    }
    cout<<sum<<endl;
}
ll without()
{
    ll d=1000000007;
    ll sum=0,i=1;
    ll n;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(ll i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            sum+=((a[i]*a[j])%d);
            sum%=d;
        }
    }
    cout<<sum%d<<endl;;
}
void bc()
{
   string s,t;
   cin>>s>>t;
   int j=0,y=0,x=0,i=0;
   for(int i=0;i<s.size();i++){
    if(s[i]==t[j]){
        j++;
    }
    else{
        x=max(j,x);
        j=0;
    }
   }
   cout<<t.size()-x<<endl;
}
int main()
{
    ///int t;cin>>t;while(t--){
        without();


}


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



#include <bits/stdc++.h>
#include <sstream>

//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
//#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define INF (int)1e15
#define MOD 1000000007
#define re0 return 0
//#define N 12
#define sz 1000*1000


string multiply(string num1, string num2)
{
    int len1 = num1.size();
    int len2 = num2.size();
    if (len1 == 0 || len2 == 0)
    return "0";


    vector<int> result(len1 + len2, 0);


    int i_n1 = 0;
    int i_n2 = 0;

    // Go from right to left in num1
    for (int i=len1-1; i>=0; i--)
    {
        int carry = 0;
        int n1 = num1[i] - '0';


        i_n2 = 0;


        for (int j=len2-1; j>=0; j--)
        {

            int n2 = num2[j] - '0';


            int sum = n1*n2 + result[i_n1 + i_n2] + carry;

            // Carry for next iteration
            carry = sum/10;

            // Store result
            result[i_n1 + i_n2] = sum % 10;

            i_n2++;
        }

        // store carry in next cell
        if (carry > 0)
            result[i_n1 + i_n2] += carry;

        i_n1++;
    }

    // ignore '0's from the right
    int i = result.size() - 1;
    while (i>=0 && result[i] == 0)
    i--;

    // If all were '0's - means either both or
    // one of num1 or num2 were '0'
    if (i == -1)
    return "0";



    // generate the result string
    string s = "";

    while (i >= 0)
        s += std::to_string(result[i--]);

    return s;
}



 int main(){

  ll n; cin>>n;
   vector<string>v(n);

  for(int i=0;i<n;i++) cin>>v[i];

  long long  sum =0;

  for(int i=0;i<n-1;i++){
      for(int j=i+1;j<n;j++){
            //cout<<v[i]<<" "<<v[j]<<endl;
        string add =  multiply(v[i], v[j]);
        stringstream geek(add);

          int x = 0;
           geek >> x;
            sum += x
      }
  }


  cout<<sum<<endl;

 return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:111:21: error: expected ';' before '}' token
  111 |             sum += x
      |                     ^
      |                     ;
  112 |       }
      |       ~
Language: C

#include <iostream>
using namespace std;

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};


typedef long long ll;
const int MOD = 1000000007;
using mint = Fp<MOD>;

int main() {
    mint a[200000]={0}, sum=0;
    ll n, tmp;

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

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

import itertools

N = input()

xlist= input().split(" ")
ylist = []
for num in xlist:
    ylist.append(int(num))
pairs = itertools.combinations(ylist, 2)
answer = 0
for pair in pairs:
    answer += pair[0] * pair[1]

print(answer)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import itertools
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>

#define N 1000005

using namespace std;

int main(){
    unsigned long long int n,sum=0,l=0;
    cin>>n;
    unsigned long long int a[n+1];
    for(unsigned long long int i=1;i<=n;i++){
        cin>>a[i];
        sum+=a[i]%1000000007;
        l+=(a[i]*a[i]);%1000000007;
    }
    unsigned long long int result=((sum*sum)-l)/2%1000000007;
    cout<<result<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: expected primary-expression before '%' token
   14 |         l+=(a[i]*a[i]);%1000000007;
      |                        ^
Language: C++

#include <bits/stdc++.h>

#define N 1000005

using namespace std;

int main(){
    unsigned long long int n,sum=0,l=0;
    cin>>n;
    unsigned long long int a[n+1];
    for(unsigned long long int i=1;i<=n;i++){
        cin>>a[i];
        sum+=a[i]%1000000007;
        l+=(a[i]*a[i]);%1000000007
    }
    unsigned long long int result=((sum*sum)-l)/2%1000000007;
    cout<<result<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: expected primary-expression before '%' token
   14 |         l+=(a[i]*a[i]);%1000000007
      |                        ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  long long int i,n;
  vector<long long int>v;
  for(i=0;i<n;i++)
  {
    long long int x,mod=1000000007ll;
    cin>>x;
    v.push_back(x);
  }
  long long int array_sum = 0ll; 
    for (i = 0; i < n; i++) 
        array_sum+= v[i]%mod; 
  
    long long int array_sum_square = (array_sum%mod * array_sum%mod)%mod; 
  
    // calcualting a1^2 + a2^2 + ... + an^2 
    int individual_square_sum = 0ll; 
    for (i = 0; i < n; i++) 
        individual_square_sum += (v[i]%mod * v[i]%mod)%mod; 
 
    cout<<(array_sum_square - individual_square_sum) / 2ll<<endl; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: 'mod' was not declared in this scope
   18 |         array_sum+= v[i]%mod;
      |                          ^~~
a.cc:20:49: error: 'mod' was not declared in this scope
   20 |     long long int array_sum_square = (array_sum%mod * array_sum%mod)%mod;
      |                                                 ^~~
Language: C++

int main() {
  int N,sum=0;
  int div = int(pow(10.0,9.0)+7.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 % div;
    
  cout << sum << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:17: error: 'pow' was not declared in this scope
    3 |   int div = int(pow(10.0,9.0)+7.0);
      |                 ^~~
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> N;
      |   ^~~
a.cc:19:3: error: 'cout' was not declared in this scope
   19 |   cout << sum << endl;
      |   ^~~~
a.cc:19:18: error: 'endl' was not declared in this scope
   19 |   cout << sum << endl;
      |                  ^~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  long long int i,n;
  vector<long long int>v;
  for(i=0;i<n;i++)
  {
    long long int x,mod=1000000007;
    cin>>x;
    v.push_back(x);
  }
  long long int array_sum = 0ll; 
    for (i = 0; i < n; i++) 
        array_sum+= v[i]%mod; 
  
    long long int array_sum_square = (array_sum%mod * array_sum%mod)%mod; 
  
    // calcualting a1^2 + a2^2 + ... + an^2 
    int individual_square_sum = 0ll; 
    for (i = 0; i < n; i++) 
        individual_square_sum += (v[i]%mod * v[i]%mod)%mod; 
 
    cout<<(array_sum_square - individual_square_sum) / 2ll<<endl; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: 'mod' was not declared in this scope
   18 |         array_sum+= v[i]%mod;
      |                          ^~~
a.cc:20:49: error: 'mod' was not declared in this scope
   20 |     long long int array_sum_square = (array_sum%mod * array_sum%mod)%mod;
      |                                                 ^~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
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]]) % (pow(10,9) + 7);
  }
  cout << ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24: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 '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   24 |     ans += (a[x[0]] * a[x[1]]) % (pow(10,9) + 7);
      |            ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
      |                     |                       |
      |                     |                       __gnu_cxx::__promote<double>::__type {aka double}
      |                     __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}
Language: Java

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

public class Sum {

    static long M = 1000000007;

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int len = sc.nextInt();
        long[] a = new long[len];
        for (int i = 0; i < len; i++) {
            a[i] = sc.nextLong();
        }
        long sum = 0;
        for (int i = 0; i < len; i++)
            sum += (a[i]);
        long sumsq = (sum * sum);
        long individual_sum = 0;
        for (int i = 0; i < len; i++) {
            long val = (a[i] * a[i]);
            individual_sum += (val % M);
        }
        individual_sum %= M;
        // System.out.println("sum=" + sumsq);
        // System.out.println("indivi=" + individual_sum);
        System.out.println((((sumsq - individual_sum) % M) / 2) % M);

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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:
Main.java:4: error: class Sum is public, should be declared in a file named Sum.java
public class Sum {
       ^
1 error
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  long long int i,n;
  vector<long long int>v;
  for(i=0;i<n;i++)
  {
    long long int x;
    cin>>x;
    v.push_back(x);
  }
  long long int array_sum = 0ll; 
    for (i = 0; i < n; i++) 
        array_sum+= A[i]%mod; 
  
    long long int array_sum_square = (array_sum%mod * array_sum%mod)%mod; 
  
    // calcualting a1^2 + a2^2 + ... + an^2 
    int individual_square_sum = 0ll; 
    for (i = 0; i < n; i++) 
        individual_square_sum += (A[i]%mod * A[i]%mod)%mod; 
 
    cout<<(array_sum_square - individual_square_sum) / 2ll<<endl; 
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'A' was not declared in this scope
   18 |         array_sum+= A[i]%mod;
      |                     ^
a.cc:18:26: error: 'mod' was not declared in this scope
   18 |         array_sum+= A[i]%mod;
      |                          ^~~
a.cc:20:49: error: 'mod' was not declared in this scope
   20 |     long long int array_sum_square = (array_sum%mod * array_sum%mod)%mod;
      |                                                 ^~~
a.cc:25:35: error: 'A' was not declared in this scope
   25 |         individual_square_sum += (A[i]%mod * A[i]%mod)%mod;
      |                                   ^
Language: C++

using namespace std;

long a[200010];
long mod = 1000000007;
int main() {
    int n = 0;
    cin >> n;

    for (int i=0; i < n;i++)
    {
      cin >> a[i];
    }
    long ans = 0;
    for (int p = 0; p < n - 1; p++)
    {
      for (int l = p+1; l < n; l++)
      {
        ans += a[p] * a[l];
        ans %=  mod;
      }
    }
    cout << ans;

    return 0;
}

Compiler output:
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:22:5: error: 'cout' was not declared in this scope
   22 |     cout << ans;
      |     ^~~~
a.cc:22:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

n = int(input())
a = list(map(int, input().split()))
b = sum(a)
ans = 0

for i in range(0, n):
    b = b - a[i]
    ans = ans + a[i] * b
    ans = ans % 1000000007

print(ans)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
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%waru;
    sqsum += pow(A,2)%waru;
  }
  sum = sum%waru;
  sqsum = sqsum%waru;
  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:12:22: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   12 |     sqsum += pow(A,2)%waru;
      |              ~~~~~~~~^~~~~
      |                 |     |
      |                 |     long long int
      |                 __gnu_cxx::__promote<double>::__type {aka double}
a.cc:16:27: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   16 |   ans = (pow(sum,2)-sqsum)%waru;
      |         ~~~~~~~~~~~~~~~~~~^~~~~
      |                    |       |
      |                    |       long long int
      |                    __gnu_cxx::__promote<double>::__type {aka double}