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

  #include <unordered_map>
  #include <functional>
  #include <algorithm>
  #include <iostream>
  #include <climits>
  #include <vector>
  #include <stack>
  #include <queue>
  #include <map>
  #include <set>
  #define mod 1000000007
  using namespace std;
  #define ll long long int  
  int main()
  {
  ll n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  ll ans=0;
  for(LL i=0;i<n-1;i++)
  {
    for(LL j=i+1;j<n;j++)
    {
      ans=(ans+(a[i]*a[j]))%mod;
      ans=ans%mod;
    }
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:7: error: 'LL' was not declared in this scope; did you mean 'll'?
   24 |   for(LL i=0;i<n-1;i++)
      |       ^~
      |       ll
a.cc:24:14: error: 'i' was not declared in this scope
   24 |   for(LL i=0;i<n-1;i++)
      |              ^
a.cc:26:11: error: expected ';' before 'j'
   26 |     for(LL j=i+1;j<n;j++)
      |           ^~
      |           ;
a.cc:26:18: error: 'j' was not declared in this scope
   26 |     for(LL j=i+1;j<n;j++)
      |                  ^
Language: C++

#include<bits/stdc++.h>
#define SPEED ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define ll long long int
#define inf 999999999
#define maxn 100003
const ll mod = 1e9+7;
using namespace std;
void code()
{
	ll n, sum = 0;
	cin >> n;
	ll arr[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> ar[i];
		sum+=ar[i];
		sum%=mod;
	}
	ll s = 0;
	for(int i = 0;i<n-1; i++)
	{
		sum-=ar[i];
		s+=((sum%mod)*ar[i])%mod;
	}
	cout << (s+mod)%mod;
}
int main()
{
	SPEED
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.out","w",stdout);
	#endif
	int t = 1;
	while(t--)
	{
		code();
	}
}


Compiler output:
a.cc: In function 'void code()':
a.cc:15:24: error: 'ar' was not declared in this scope; did you mean 'arr'?
   15 |                 cin >> ar[i];
      |                        ^~
      |                        arr
a.cc:22:22: error: 'ar' was not declared in this scope; did you mean 'arr'?
   22 |                 sum-=ar[i];
      |                      ^~
      |                      arr
Language: Java

n = int(input())
a = list(map(int, input().split()))

ans = 0
mod = 1000000007

a = [-1] + a
pre = [0]

for i in range(1, n+1):
    pre.append((pre[i-1] + a[i]) % mod)
pre.append(0)

for i in range(1, n+1):
    now = (pre[n] - pre[i]) * a[i] % mod
    ans = (ans + now) % mod

print(ans)

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

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


int main(void){
  int i,n;
  long long ans = 0;
  scanf("%d", &n);
  long long a[n];
  for(i = 0; i < n; i++){
    scanf("%lld", &a[i]);
  }
  
  long long cnt = 0;
  for(i = 0; i < n - 1; i++){
    cnt += a[i];
    ans += a[i+1] * cnt;
  }
  ans = ans % 1000000007;

  printf("%lld\n", ans);

  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
inline long long qr()
{
	long long x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while (ch<='9'&&ch>='0')
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
inline long long mul(long long x,long long y)
{
	int ans=0;
	while(y)
	{
		if(y&1)
		ans=(ans+x)%mod;
		y>>=1;
		x=(x+x)%mod;
	}
}
int n;
const int maxn=2e5+10;
long long a[maxn];
long long b[maxn];
long long ans;
int main()
{
	n=qr();
	for(register int i=1;i<=n;i++)
	{
		a[i]=qr();
		b[i]=(b[i]+b[i-1]+a[i]);
	}
	for(register int i=1;i<n;i++)
	{
		ans=(ans+mul(a[i],b[n]-b[i])%mod)%mod;
	}
	cout<<ans;
	return 0;
}


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 <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <array>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <climits>
#include <utility>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <complex>
#include <numeric>
#include <chrono>
#include <cmath>
#include <bitset>

using namespace std;

#define FOR(it, ar) for(auto &it: ar)
#define loop(i, start, end) for(auto i = (start); i <= (end); i++)
#define loopSkip(i, start, end, skip) for(auto i = (start); i <= (end); i += skip)
#define loopRev(i, start, end) for(int i = (start); i >= (end); i--)
#define FLASH ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define testCases(t) cin >> t; while(t--)
#define PN(n) cout << (n)
#define PN1(n) cout << (n) << " "
#define PN2(a, b) cout << (a) << " " << (b) << " "
#define PN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << " "
#define PNN1(n) cout << (n) << "\n"
#define PNN2(a, b) cout << (a) << " " << (b) << "\n"
#define PNN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << "\n"
#define PrintObject(ar) for(auto var: ar) cout << var << " "; cout << "\n"
#define PrintMap(map) for(auto var: map) PNN2(var.first, var.second)
#define PrintPair(pair) PNN2(pair.first, pair.second)
#define IN1(n) cin >> n
#define IN2(a, b) cin >> a >> b
#define IN3(a, b, c) cin >> a >> b >> c
#define ALL(s) s.begin(), s.end()
#define ENTER PNN1("")
#define llPair std::pair<lli, lli>
#define iiPair std::pair<int, int>

// Math macros
#define M_PI 3.14159265358979323846

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;

template <typename T>
T ii() {
	T a;
	IN1(a);
	return a;
}

struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
      // http://xorshift.di.unimi.it/splitmix64.c
      x += 0x9e3779b97f4a7c15;
      x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
      x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
      return x ^ (x >> 31);
  }

  size_t operator()(uint64_t x) const {
      static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
      return splitmix64(x + FIXED_RANDOM);
  }
};

int main(void){
	FLASH
	#ifndef ONLINE_JUDGE
		freopen("input-stream.txt", "r", stdin);
		freopen("output-stream.txt", "w", stdout);
	#endif

	int n;
	IN1(n);
	vector<lli> ar(n);
	FOR(it, ar) IN1(it);

	vector<lli> suffixSum(n, 0);
	suffixSum[n - 1] = ar[n - 1];
	loopRev(i, n - 2, 0) suffixSum[i] = (ar[i] + suffixSum[i + 1]) % MOD;

	const lli MOD = (lli) 1e9 + 7;
	lli ans = 0;

	loop(i, 0, n - 1) {
		suffixSum[i] -= ar[i];
		ans += (suffixSum[i] * ar[i]) % MOD;
		ans %= MOD;
	}

	PNN1(ans);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:95:74: error: 'MOD' was not declared in this scope
   95 |         loopRev(i, n - 2, 0) suffixSum[i] = (ar[i] + suffixSum[i + 1]) % MOD;
      |                                                                          ^~~
Language: C++

n = int(input())
arr = list(map(int,input().split()))
result = 0
sum = arr[0]
for i in range(1,len(arr)):
    result += (sum*arr[i])
    sum+=arr[i]
print(result%1000000007)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t total=0;
  int64_t a[200010];
  int N;
  cin>>N;
  for(int i=0;i<N;i++){
  cin>>a[i];
  }
  int 64_t b;
  b=0;
  for(int i=0;i<N;i++){
    total += b*a[i];
     b += a[i];
    //cout<<b<<endl;
  }
   cout<<total%1000000007<<endl;
}
    
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: expected unqualified-id before numeric constant
   11 |   int 64_t b;
      |       ^~~~
a.cc:12:3: error: 'b' was not declared in this scope
   12 |   b=0;
      |   ^
Language: C++

#include <iostream> 
using namespace std; 
  
// required function 
int product_sum(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; 
} 
  
// Driver code 
int main() 
{ 
	int n;
  	cin>>n;
  	int arr[n];
  	for(int i=0;i<n;cin>>arr[i++]);
  	cout<<product_sum(arr, n)%mod;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:35: error: 'mod' was not declared in this scope
   33 |         cout<<product_sum(arr, n)%mod;
      |                                   ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
//actual solution is at bottom//
////<pbds>////
/*OPTIONAL
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T> using Tree = tree<T, null_type, less<T>, 
    rb_tree_tag, tree_order_statistics_node_update>; 
// change null_type for map
#define ook order_of_key
#define fbo find_by_order
*/
///</pbds>///

#define int long long int
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()

///<constants>///
const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5; 
const ll INF = 1e18; 
const ld PI = 4*atan((ld)1); 
const int xd[4] = {0,1,0,-1}, yd[4] = {1,0,-1,0};
///</constants>///

///<IO>/// 
namespace io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O
        // cin.exceptions(cin.failbit); // ex. throws exception when you try to read letter into int
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
    }
}
 
using namespace io;
///</IO>///

///<execution-time>///
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
/*example for clock usage
    clock_t z = clock();
    debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
*/
///</execution-time>///

inline void google(int i){
    cout<<"Case #"<<i<<" :";
}
signed main(){
    setIO("");
    int n;cin>>n;
    int a[n];for(int& i:a)cin>>i;
    int pref[n];
    pref[0]=a[0]%mod;
    for(int i=1;i<n;i++){
    	pref[i]=(pref[i-1]+a[i])%mod;
    }
    int s=pref[n-1];
    int ans=0;
    for(int i=0;i<n;i++){
    	ans+=(a[i]%mod*(s-pref[i]))%mod;
    }
    cout<<(ans%MOD)<<" ";
    ///debug///
   /* int d=0;
    for(int i=0;i<n;i++){
    	for(int j=i+1;j<n;j++)d+=a[i]*a[j];
    }
	cout<<d<<" ";*/
    return 0;
}
/* stuff you should look for
    * check whether you have read the problem correctly
    * int overflow, array bounds
    * special cases (n=1?), slow multiset operations
    * do smth instead of nothing and stay organized
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:62:18: error: 'mod' was not declared in this scope; did you mean 'modf'?
   62 |     pref[0]=a[0]%mod;
      |                  ^~~
      |                  modf
Language: Java

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class KPCMain {
	public Scanner scanner = new Scanner(System.in);
	public static final long MODN = 1000000007;
	public PrintStream out = System.out;
	
	public void start() {
		long n = scanNum();
		long[] a = scanNums(n);
		
		long sum1 = 0;
		long sum2 = 0;
		
		for(int i=0; i < n; i++) {
			sum2 += sum1 * a[i];
			sum2 %= MODN;
			sum1 += a[i];
			sum1 %= MODN;
		}
		
		out.print(sum2);
	}
	
	//Javaではlong型でも%dでよい
	public void printNums(long[] nums) { for(long cur : nums) out.printf("%d ", cur); out.println();}
	public void printNums(List<Long> nums) { for(long cur : nums) out.printf("%d ", cur); out.println();}
	public long scanNum() { return scanner.nextLong(); }
	public String scanLine() { return scanner.nextLine(); }
	
	public long[] scanNums(long num) {
		long[] ret = new long[(int) num];
		for(int i=0; i < num; i++) {
			ret[i] = scanner.nextLong();
		}
		return ret;
	}
	
	public List<Long> longArrayToList(long[] arr){
		List<Long> ret = new ArrayList<>(arr.length);
		for(long cur : arr) {
			ret.add(cur);
		}
		return ret;
	}
	
	public KPCMain() {
		
	}
	
	public static void main(String[] args) {
		KPCMain kpc = new KPCMain();
		kpc.start();
	}

}


Compiler output:
Main.java:7: error: class KPCMain is public, should be declared in a file named KPCMain.java
public class KPCMain {
       ^
1 error
Language: Java

import java.util.Scanner;
public class proj3 {
	
		public static void main(String[] args) {
			try(Scanner sc = new Scanner(System.in)){
				int[] s = new int[sc.nextInt()];
				long d = 0;
				for(int x = 0;x < s.length;++x) {
					s[x] = sc.nextInt();
				}
				for(int y= 0;y < s.length;y++ ) {
					for(int x = y+1;x < s.length;x++) {
						d = d + s[y]*s[x];
					}
					d = d % 1000000007;
				}
				System.out.println(d);
			}
		}
}

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

#include <stdio.h>
#include <stflib.h>

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

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n; //整数の入力
  long long int SUMA = 0; //総和を初期化
  vector<int> A(n); //数列の定義
  for (int i = 0; i < n; i++){
    cin >> A[i]; //数列のi項目を入力
    SUMA += A[i]; //SUMAにA[i]を加算
  }
  vector<long long int> C(n-1);
  //累積和の導出
  for (int i = 0; i < n-1; i++){
    SUMA -= A[i]; //SUMAからA[i]を引く
    C[i] = SUMA; //C[i]をSUMAとする
  }
  long long int ans = 0; //求める値
  int MOD = Math.pow(10,9) + 7; //modをとる値
  for (int i = 0; i < n-1; i++){
    ans += A[i]*C[i]; 
    ans = ans % MOD; //オーバーフローを避けるためにその都度modを取る
  }
  cout << ans << endl;  //ansを出力する
}
//計算量はO(N)


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'Math' was not declared in this scope
   19 |   int MOD = Math.pow(10,9) + 7; //modをとる値
      |             ^~~~
Language: Java

import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        int mod = 1000000007;
        long sum = 0;
        for(int i = 0; i < n; i++){
            a[i] = scanner.nextInt();
            sum += a[i];
            sum %= modl
        }
        long sum = 0;
        
    }
}

Compiler output:
Main.java:12: error: ';' expected
            sum %= modl
                       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n; //整数の入力
  long long int SUMA = 0; //総和を初期化
  vector<int> A(n); //数列の定義
  for (int i = 0; i < n; i++){
    cin >> A[i]; //数列のi項目を入力
    SUMA += A[i]; //SUMAにA[i]を加算
  }
  vector<long long int> C(n-1);
  //累積和の導出
  for (int i = 0; i < n-1; i++){
    SUMA -= A[i]; //SUMAからA[i]を引く
    C[i] = SUMA; //C[i]をSUMAとする
  }
  long long int ans = 0; //求める値
  int MOD = Math.powe(10,9) + 7; //modをとる値
  for (int i = 0; i < n-1; i++){
    ans += A[i]*C[i]; 
    ans = ans % MOD; //オーバーフローを避けるためにその都度modを取る
  }
  cout << ans << endl;  //ansを出力する
}
//計算量はO(N)


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'Math' was not declared in this scope
   19 |   int MOD = Math.powe(10,9) + 7; //modをとる値
      |             ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n; //整数の入力
  long long int SUMA = 0; //総和を初期化
  vector<int> a(n); //数列の定義
  for (int i = 0; i < n; i++){
    cin >> A[i]; //数列のi項目を入力
    SUMA += A[i]; //SUMAにA[i]を加算
  }
  vector<long long int> C(n-1);
  #累積和の導出
  for (int i = 0; i < n-1; i++){
    SUMA -= A[i]; //SUMAからA[i]を引く
    C[i] = SUMA; //C[i]をSUMAとする
  }
  long long int ans = 0; //求める値
  int MOD = 10**9 + 7; //modをとる値
  for (int i = 0; i < n-1; i++){
    ans += A[i]*C[i]; 
    ans = ans % MOD; //オーバーフローを避けるためにその都度modを取る
  }
  cout << ans << endl;  //ansを出力する
}
//計算量はO(N)

Compiler output:
a.cc:13:4: error: invalid preprocessing directive #\U00007d2f\U00007a4d\U0000548c\U0000306e\U00005c0e\U000051fa
   13 |   #累積和の導出
      |    ^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:9:12: error: 'A' was not declared in this scope
    9 |     cin >> A[i]; //数列のi項目を入力
      |            ^
a.cc:15:13: error: 'A' was not declared in this scope
   15 |     SUMA -= A[i]; //SUMAからA[i]を引く
      |             ^
a.cc:19:16: error: invalid type argument of unary '*' (have 'int')
   19 |   int MOD = 10**9 + 7; //modをとる値
      |                ^~
a.cc:21:12: error: 'A' was not declared in this scope
   21 |     ans += A[i]*C[i];
      |            ^
Language: C++

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

void fnInput(vector<int>& rvnNum)
{
  int nNumSiz;
  cin >> nNumSiz;
  rvnNum.resize(nNumSiz);

  for (int& rnNum : rvnNum)
    cin >> rnNum;
}

llong fnSumOfMultpl(const vector<int>& cnrvnNum)
{
  const int cnnMod = 1e9 + 7;
  llong nCumlSum = 0;

  for (int i = 0; i < cnrvnNum.size(); ++i)
    nCumlSum += cnrvnNum[i];

  llong nSumOfMultpl = 0;

  for (int i = 0; i < cnrvnNum.size() - 1; ++i)
  {
    nCumlSum -= cnrvnNum[i];
    nSumOfMultpl += cnrvnNum[i] * nCumlSumMod;
    nSumOfMultpl %= cnnMod;
  }

  return nSumOfMultpl;
}
  
int main()
{
  vector<int> vnNum;
  
  fnInput(vnNum);
  cout << fnSumOfMultpl(vnNum) << endl;

  return 0;
}

Compiler output:
a.cc: In function 'llong fnSumOfMultpl(const std::vector<int>&)':
a.cc:28:35: error: 'nCumlSumMod' was not declared in this scope; did you mean 'nCumlSum'?
   28 |     nSumOfMultpl += cnrvnNum[i] * nCumlSumMod;
      |                                   ^~~~~~~~~~~
      |                                   nCumlSum
Language: C++

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

void fnInput(vector<int>& rvnNum)
{
  int nNumSiz;
  cin >> nNumSiz;
  rvnNum.resize(nNumSiz);

  for (int& rnNum : rvnNum)
    cin >> rnNum;
}

llong fnSumOfMultpl(const vector<int>& cnrvnNum)
{
  const int cnnMod = 1e9 + 7;
  llong nCumlSum = 0;

  for (int i = 0; i < cnrvnNum.size(); ++i)
    nCumlSum += cnrvnNum[i];

  llong nSumOfMultpl = 0;

  for (int i = 0; i < cnrvnNum.size() - 1; ++i)
  {
    nCumlSum -= cnrvnNum[i];
    int nCumlSumMod %= cnnMod;
    nSumOfMultpl += cnrvnNum[i] * nCumlSumMod;
    nSumOfMultpl %= cnnMod;
  }

  return nSumOfMultpl;
}
  
int main()
{
  vector<int> vnNum;
  
  fnInput(vnNum);
  cout << fnSumOfMultpl(vnNum) << endl;

  return 0;
}

Compiler output:
a.cc: In function 'llong fnSumOfMultpl(const std::vector<int>&)':
a.cc:28:21: error: expected initializer before '%=' token
   28 |     int nCumlSumMod %= cnnMod;
      |                     ^~
a.cc:29:35: error: 'nCumlSumMod' was not declared in this scope; did you mean 'nCumlSum'?
   29 |     nSumOfMultpl += cnrvnNum[i] * nCumlSumMod;
      |                                   ^~~~~~~~~~~
      |                                   nCumlSum
Language: Java

package atcoder;

import java.util.Arrays;
import java.util.Scanner;
import java.io.PrintWriter;

public class abc177_c {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int N = in.nextInt();
        long[] A = new long[N];
        long mod = 1000000007;
        for (int i = 0; i < N; i++) {
            A[i]= in.nextLong();
        }
        long sum = 0;
        long ans = 0;
        for (int i = 0; i < N; i++) {
            ans=(ans+(A[i]*sum)) % mod;
            sum=(sum+A[i]) % mod;
        }
        out.println(ans);
    }
}


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

#include <stdio.h>

int main(void){
    int n;
    long long int sum = 0;
    long long int Num = 1000000007;
    scanf("%d", &n);

    long long int a[n];
    long long int s[n];

    for(int i = 0; i < n; i++){
        scanf("%lld", &a[i]);
      	a[i] %= Numl;
        s[i] += a[i];
    }

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

    printf("%lld", sum%Num);
}


Compiler output:
main.c: In function 'main':
main.c:14:17: error: 'Numl' undeclared (first use in this function); did you mean 'Num'?
   14 |         a[i] %= Numl;
      |                 ^~~~
      |                 Num
main.c:14:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
// #include<string>
#include<math.h>
using namespace std;

int main(){
    long long int N;
    cin >> N;
    long long int A[N];
    long long int sum=0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        sum+= A[i];
        sum%= p;
    }

    long long int p= pow(10,9)+7;
    long long int a=0;
    for(int i=0; i<N; i++){
        sum-= A[i];
        if(sum<0) sum+= p;
        a+= A[i]*sum;
        a%= p;
    }
    cout << a << endl;
    
    return 0;
}

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

#include<iostream>
// #include<string>
#include<math.h>
using namespace std;

int main(){
    long long int N;
    cin >> N;
    long long int A[N];
    long long int sum=0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        sum+= A[i];
    }

    long long int p= pow(10,9)+7;
    long long int a=0;
    for(int j=0; j<N; j++){
        sum-= A[i];
        a+= A[i]*sum;
        a%= p;
    }
    cout << a << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'i' was not declared in this scope
   19 |         sum-= A[i];
      |                 ^
Language: C++

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

#define ff                   first
#define ss                   second
#define endl                 '\n'
#define ll                   long long int
#define pii                  pair<int,int>
#define mp                   make_pair<int,int>
#define pb                   push_back
#define rep(i,a,b)           for(int i=a;i<b;i++)
#define t(x)                 int t; cin>>t; while(t--)
#define vi                   vector<int>
#define mii                  map<int,int>
#define min3(a, b, c)        min(min(a, b), c)
#define min4(a, b, c, d)     min(min(a, b), min(c, d))
#define max3(a, b, c)        max(max(a, b), c)
#define max4(a, b, c, d)     max(max(a, b), max(c, d))
#define ps(x,y)              fixed<<setprecision(y)<<x
#define setbits(x)           __builtin_popcountll(x)
#define zrobits(x)           __builtin_ctzll(x)
#define mod                  1000000007
#define all(x)               x.begin(),x.end()
#define FIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                      rng(chrono::steady_clock::now().time_since_epoch().count());


bool isPrime(int n)
{
	if (n <= 1)  return false;
	if (n <= 3)  return true;
	if (n % 2 == 0 || n % 3 == 0) return false;

	for (int i = 5; i * i <= n; i = i + 6)
		if (n % i == 0 || n % (i + 2) == 0)
			return false;

	return true;
}



int main()
{
	FIO;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif


	ll n;
	cin >> n;
	ll a[n];
	rep(i, 0, n)
	{
		cin >> a[i];
		a[i]=a[i]%mod
	}
	ll sum[n];
	sum[0] = a[0]%mod ;
	rep(i, 1, n)
	sum[i] = (sum[i - 1] + a[i])%mod ;
	ll ans = 0;
	rep(i, 0, n - 1)
	{
		ans += ((sum[n - 1] - sum[i]) * a[i]) % mod ;
	}
	cout << ans % mod;



}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:9: error: expected ';' before '}' token
   59 |         }
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long int arr[2000000], n, temp, sum = 0;
	cin >> n;
	
	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			
			temp = arr[i] * arr[j];
			sum += mult;
		}
	}
	cout << sum;
}

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

n = int(input())

A = list(map(int, input().split()))

mod = 1000000007
s = 0
sq = 0

for i in range(n):
    s += A[i]
    s %= mod
    sq += ((A[i] * A[i]) + mod) % mod

# print(sq)
# print(s)
print(int((((((s * s) + mod) % mod) - sq + mod) % mod)/ 2))

Compiler output:
a.cc:14:3: error: invalid preprocessing directive #print
   14 | # print(sq)
      |   ^~~~~
a.cc:15:3: error: invalid preprocessing directive #print
   15 | # print(s)
      |   ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main(){
    long long int N;
    cin >> N;
    long long int A[N];
    for(int i=0; i<N; i++){
        cin >> A[i];
    }

    long long int p= pow(10,9)+7;
    long long int a=0;
    for(int j=0; j<N; j++){
        for(int i=0; i<j; i++){
            // cout << i << ":" << j<< endl;
            a+= A[i]*A[j];
            a%=p;
        }
    }
    cout << a << endl;
    
    return 0;
}ß

Compiler output:
a.cc:26:2: error: '\U000000df' does not name a type
   26 | }ß
      |  ^
Language: C++

#include <bits/stdc++.h>
 
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,b)	for(int  i=a;i<b;i++)
#define hello777 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#include <string>
#define pie 3.14159265358979323846
#define MOD = 1000000007;
const int MAX= 1e5+5;
using namespace std;


//ll gcd(int a, int b)
//{ 
//    if (a == 0) 
//        return b;  
//    return gcd(b % a, a);  
// } 
// 
//ll lcm(int a, int b)  
// {  
//    return a/gcd(a, b) *b;  
// }
//  
//int prime(int n)
//{
//	rep(i,2,n+1)
//	{
//		if(n%i==0)return i;
//	}
//	
//vector<unordered_set<int> > prime_factors(MAX,unordered_set<int>());
//int primes[MAX];
//int prefix[MAX][6];
//void sieve(){
//    //primes i stores the largest prime factor of a number....
//    for(int i=2;i<MAX;++i){
//        if(primes[i]!=0){
//            continue;
//        }
//        primes[i] = i;
//        for(int j=2*i;j<MAX;j+=i){
//            primes[j] = i;
//        }
//    }
//    
//    for(int i=2;i<MAX;++i){
//        int current = i;
//        
//        while(current!=1){
//            prime_factors[i].insert(primes[current]);
//            current = current/primes[current];
//        }
//    }
//    
//    for(int i=1;i<MAX;++i){
//        for(int k=1;k<=5;++k){
//            prefix[i][k] = prefix[i-1][k] + (prime_factors[i].size()==k);
//        }
//    }
//    
//}
void solve() 
{
int n;
	cin >> n;
	int a[n];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	int pre[n+1];
	pre[n]=0;
	for(int i=n-1; i>=0; i--){
		pre[i] = (pre[i+1] + a[i])%MOD;
	}
	int ans = 0;
	for(int i=0; i<n; i++){
		ans = (ans + (pre[i+1] * a[i])%MOD)%MOD;
	}
	cout<<ans<<endl;

}



int main()
{
	hello777;

	int q=1;
	
//    cin>>q;
    while(q--)
    {   
      solve();
    }
}

 

Compiler output:
a.cc: In function 'void solve()':
a.cc:15:13: error: expected primary-expression before '=' token
   15 | #define MOD = 1000000007;
      |             ^
a.cc:81:44: note: in expansion of macro 'MOD'
   81 |                 pre[i] = (pre[i+1] + a[i])%MOD;
      |                                            ^~~
a.cc:15:13: error: expected primary-expression before '=' token
   15 | #define MOD = 1000000007;
      |             ^
a.cc:85:48: note: in expansion of macro 'MOD'
   85 |                 ans = (ans + (pre[i+1] * a[i])%MOD)%MOD;
      |                                                ^~~
a.cc:15:25: error: expected ')' before ';' token
   15 | #define MOD = 1000000007;
      |                         ^
a.cc:85:48: note: in expansion of macro 'MOD'
   85 |                 ans = (ans + (pre[i+1] * a[i])%MOD)%MOD;
      |                                                ^~~
a.cc:85:23: note: to match this '('
   85 |                 ans = (ans + (pre[i+1] * a[i])%MOD)%MOD;
      |                       ^
a.cc:85:51: error: expected primary-expression before ')' token
   85 |                 ans = (ans + (pre[i+1] * a[i])%MOD)%MOD;
      |                                                   ^
Language: Java

import java.util.Scanner;

//https://atcoder.jp/contests/abc177/tasks/abc177_c

public class SumPairs {
	static long modulo = 1000000000+7;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] nums = new int[N];
		long[] subSum = new long[N];
		for(int i = 0; i <  N; i++) {
			nums[i] = sc.nextInt();
		}
		subSum[N-1] = 0L;
		for(int i = N-2; i >=  0; i--) {
			subSum[i] = (subSum[i+1] + nums[i+1]) % modulo;
			//System.out.print(subSum[i] + " ");
		}
		//System.out.println();
		long res= 0;
		for(int i1 = 0 ; i1 <N-1; i1++) {
			//System.out.println("i1 "+ i1 + " nums[i1]*subSum[i1] " +nums[i1]*subSum[i1]);
			res = (res + (nums[i1]*subSum[i1]) % modulo)%modulo;
		}
		System.out.println(res);
	}
}


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

#include <bits/stdc++.h>
using namespace std;
#define imp() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define endl "\n"
#define lli long long int 
#define ll long long 
#define mo 10e9+7
int main() {
	lli n;cin>>n;
	lli arr[n];lli sum=0;lli pro=1;
	for(lli i=0;i<n;i++)
	{
	    for(lli j=i+1;j<n;j++)
	    {
	        pro=(arr[i]*arr[j])%mo;
	        sum=(sum+pro)%mo;
	    }
	}
	cout<<sum<<"\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:36: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   16 |                 pro=(arr[i]*arr[j])%mo;
      |                     ~~~~~~~~~~~~~~~^
      |                            |
      |                            long long int
a.cc:17:30: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   17 |                 sum=(sum+pro)%mo;
      |                     ~~~~~~~~~^
      |                         |
      |                         long long int
Language: C++

#include<iostream>
#include<math.h>
using namespace std;

int main()
{
  int NOE;
  unsigned int Ans=0;
  cin>>NOE;
  unsigned int N[NOE];
  unsigned int Data[NOE*(NOE-1)];
  int top=-1;
  
  //getting data:
  for(int i=0;i<NOE;i++)
    cin>>N[i];
  
  for(int i=0;i<NOE-1;i++)
    for(int j=i+1;j<NOE;j++)
    {
      Data[++top] = abs((N[i]*N[j]));
      //if(Data[top]<0)
       // Data[++top]=(2147483647+Data[++top])+2147483647
  		cout<<endl<<N[i]<<" * "<<N[j]<<" ="<<Data[top];
    }
  
  for(int i=0;i<=top;i++)
     Ans += Data[i];
 
  cout<<endl<<Ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:24: error: call of overloaded 'abs(unsigned int)' is ambiguous
   21 |       Data[++top] = abs((N[i]*N[j]));
      |                     ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: Java

package Time_and_Space;

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

public class main {
    public static void main(String[] args) throws Exception{
        final long MOD = 1000000007;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine());
        long sum = 0, sqSum = 0;

        for(int i=0; i<n; i++){
            int k = Integer.parseInt(st.nextToken());
            sum += (long)k;
            sqSum += (long)((long)(k)*(long)(k));

            sum %= MOD;
            sqSum %= MOD;
        }
        long ans = sum * sum;
        ans -= sqSum;
        ans = (ans%MOD + MOD) %MOD;
        if(ans %  2 == 1) ans+=MOD;
        ans /= 2;
        out.println(ans);
        out.close();
    }
}

Compiler output:
Main.java:6: error: class main is public, should be declared in a file named main.java
public class main {
       ^
1 error
Language: Java

package Time_and_Space;

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

public class cheat {
    public static void main(String[] args) throws Exception{
        final long MOD = 1000000007;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine());
        long sum = 0, sqSum = 0;

        for(int i=0; i<n; i++){
            int k = Integer.parseInt(st.nextToken());
            sum += (long)k;
            sqSum += (long)((long)(k)*(long)(k));

            sum %= MOD;
            sqSum %= MOD;
        }
        long ans = sum * sum;
        ans -= sqSum;
        ans = (ans%MOD + MOD) %MOD;
        if(ans %  2 == 1) ans+=MOD;
        ans /= 2;
        out.println(ans);
        out.close();
    }
}

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

n=int(input())
a=list(map(int,input().split()))
s2=int(sum(a)*sum(a))
a2=[int(i*i) for i in a]
ans1=int((s2-sum(a2))/2)
print(int(ans1%(10**9+7)))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
  
  int n;
  cin>>n;
  long long arr[n];
  
  for(auto &a:arr) cin>>a;
  
  long long sum=0;
  
  for(int i = 0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      
      sum+= arr[i] * arr[j];
    }
  }
  
  cout<<(sum%(1e9 + 7));
 
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   22 |   cout<<(sum%(1e9 + 7));
      |          ~~~^~~~~~~~~~
      |          |        |
      |          |        double
      |          long long int
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
  
  int n;
  cin>>n;
  long long arr[n];
  
  for(auto &a:arr) cin>>a;
  
  long long sum=0;
  
  for(int i = 0;i<n-1++){
    for(int j=i+1;j<n;j++){
      
      sum+= arr[i] * arr[j];
    }
  }
  
  cout<<(sum%(1e9 + 7));
 
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:21: error: lvalue required as increment operand
   15 |   for(int i = 0;i<n-1++){
      |                     ^
a.cc:15:24: error: expected ';' before ')' token
   15 |   for(int i = 0;i<n-1++){
      |                        ^
      |                        ;
a.cc:22:13: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   22 |   cout<<(sum%(1e9 + 7));
      |          ~~~^~~~~~~~~~
      |          |        |
      |          |        double
      |          long long int
Language: Java

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

public class A {
	public static void main(String[] args) throws IOException{
		Scanner sc=new Scanner(System.in);
		Reader reader=new Reader();
		int t=1;//sc.nextInt();
		while(t-->0) {
			int n=sc.nextInt();
			long mod=(long)1e9+7;
			//System.out.println();
			long[] arr=new long[n];
			long[] pre=new long[n];
			for(int i=0;i<n;i++) {
				arr[i]=sc.nextLong();
			}
			pre[0]=arr[0];
			for(int i=1;i<n;i++) {
				pre[i]=pre[i-1]+arr[i];
				//pre[i]%=mod;
			}
			long ans=0;
			for(int i=0;i<n-1;i++) {
				ans+=(arr[i]*((pre[n-1]-pre[i])%mod));
				ans%=mod;
			}
			System.out.println(ans);
		}
	}
}
class Reader{
	BufferedReader reader;
	Reader(){
		reader=new BufferedReader(new InputStreamReader(System.in));
	}
	int nextInt() throws IOException{
		String in=reader.readLine().trim();
		return Integer.parseInt(in);
	}
	long nextLong() throws IOException{
		String in=reader.readLine().trim();
		return Long.parseLong(in);
	}
	String next() throws IOException{
		return reader.readLine().trim();
	}
	String[] stringArray() throws IOException{
		return reader.readLine().trim().split("\\s+");
	}
	int[] intArray() throws IOException{
		String[] inp=this.stringArray();
		int[] arr=new int[inp.length];
		int i=0;
		for(String s:inp) {
			arr[i++]=Integer.parseInt(s);
		}
		return arr;
	}
}


Compiler output:
Main.java:4: error: class A is public, should be declared in a file named A.java
public class A {
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;
public class C {
 
	public static void main(String[] args) throws Exception{
		long num = 1000000007;
 
		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		long sum =0;
 		long sumsq = 0;
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		for(int j =0;j<n;j++){
 			int k = Integer.parseInt(st.nextToken());
 			sum+=(long)(k);
 			sumsq+=(long)((long)(k)*(long)(k));
 			sumsq%=num;
 			sum%=num;
 		}
 		
 		long ans = sum*sum;
 		ans%=num;
 		ans-=sumsq;
 		ans = (ans%num+num)%num;
 		// if (ans%2 == 1)
 		// 	ans+=num;
 		ans/=2;
 		
 		out.println(ans);
	 		
 		out.close();
 		
 		
 		
 	}
}

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

#include<iostream>
#include<cstring>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<utility>
#include<climits>
#include<set>
using namespace std;
#define ll long long


int main(){ 
	ios_base::sync_with_stdio(false);
	    cin.tie(0);
	    cout.tie(0);
	    
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);
	    freopen("output.txt","w",stdout);
	#endif

	ll n;cin>>n;
	vector<ll> v(n);
	for(int i=0;i<n;i++)
		cin>>v[i];
	ll ans=0;
	ll modul=1000000007;
	ll sum=0;
	ll x=0;

	for(int i=0;i<n;i++)
	{
		ans+=(v[i]*x)%modul;
		x+=(a[i])%modul;
	}
	cout<<ans%modul;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:21: error: 'a' was not declared in this scope
   38 |                 x+=(a[i])%modul;
      |                     ^
Language: C

#include <stdio.h>
​
int main(void){
    int n;
    long long int sum = 0;
    long long int Num = 1000000007;
    scanf("%d", &n);
​
    long long int a[n];
​
    for(int i = 0; i < n; i++){
        scanf("%lld", &a[i]);
        a[i] %= Num;
    }
​
    for(int i = 0; i < n-1; i++){
        long long int jsum = 0;
        for(int j = i + 1; j < n; j++){
            jsum += a[j];
            jsum %= Num;
       }
       sum += (a[i] * jsum);
       sum %= Num;
    }
​
    printf("%lld", sum);
​
​
    return 0;


Compiler output:
main.c:2:1: error: expected ';' before 'int'
    2 | ​
      | ^
      | ;
    3 | int main(void){
      | ~~~
main.c: In function 'main':
main.c:8:1: error: '\U0000200b' undeclared (first use in this function)
    8 | ​
      |  
main.c:8:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:1: error: expected ';' before 'long'
    8 | ​
      | ^
      | ;
    9 |     long long int a[n];
      |     ~~~~
main.c:10:1: error: expected ';' before 'for'
   10 | ​
      | ^
      | ;
   11 |     for(int i = 0; i < n; i++){
      |     ~~~
main.c:27:1: error: expected ';' before '\U0000200b'
   27 | ​
      | ^
      | ;
   28 | ​
      |  
main.c:29:5: error: expected declaration or statement at end of input
   29 |     return 0;
      |     ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};
int main(void){
  int N;
  cin >> N;
  vector <int> A(N);
  /*
  rep(i,N) cin >> A[i];

  ll ans = 0;
  int mod = 1000000007;


  //累積和
  vector <ll> S(N);
  S.at(0) = A.at(0);
  for (int i = 1; i < N; i++){
    S.at(i) = (S.at(i - 1) + A.at(i)) % mod;
  }

  for (int i = 0; i < N - 1; i++){
    ans += (A.at(i) * (S.at(N - 1) - S.at(i)) % mod) % mod;
    ans %= mod;
  }

  cout << ans << endl;
*/

  vector <ll> B(N + 1, 0);  //累積和テーブル
  int mod 1000000007;

  for (int i = 0; i < N; i++){
    cin >> A[i];
    B[i + 1] = B[i] + A[i];
  }

  ll ans = 0;

  //iについて全探索
  for (int i = 0; i < N; i++){
    //A[i+1] + ... + A[N]を求める
    ll sum = (B[N] - B[i + 1]) % mod;
    ans += A[i] * sum;
    ans %= mod;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:11: error: expected initializer before numeric constant
   35 |   int mod 1000000007;
      |           ^~~~~~~~~~
a.cc:47:34: error: 'mod' was not declared in this scope; did you mean 'modf'?
   47 |     ll sum = (B[N] - B[i + 1]) % mod;
      |                                  ^~~
      |                                  modf
Language: C++

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

int main() {
 int N, A;
  cin >> N >> A;
 int devision = 1000000007;
  
  if(N==2){
    cout << A.at(0)*A.at(1)%devision << endl;
  }
  else{
    int i, j, sum;
    for(int i=0; i<N-1; i++){
     for(int j=1; j<N-i; j++){
       sum+=A.at(i)*A.at(i+j);
         cout << sum%devision << endl;
     }
    }
  }
}  


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: request for member 'at' in 'A', which is of non-class type 'int'
   11 |     cout << A.at(0)*A.at(1)%devision << endl;
      |               ^~
a.cc:11:23: error: request for member 'at' in 'A', which is of non-class type 'int'
   11 |     cout << A.at(0)*A.at(1)%devision << endl;
      |                       ^~
a.cc:17:15: error: request for member 'at' in 'A', which is of non-class type 'int'
   17 |        sum+=A.at(i)*A.at(i+j);
      |               ^~
a.cc:17:23: error: request for member 'at' in 'A', which is of non-class type 'int'
   17 |        sum+=A.at(i)*A.at(i+j);
      |                       ^~
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>  
#include <cmath>
#include <string>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using P= pair<ll,ll>;
const ll MOD = 1000000007;
int main() {
    ll N;
    cin>>N;
    vector<ll> A(N);
    ll sum=0;
    ll answer=0;
    rep(i,N){
      cin>>A[i];
      sum+=A[i];
      sum%=mod;
    }
    for(int i=0;i<N;i++)
    {
      sum-=A[i];
      if(sum<0)sum+=mod;
      answer +=A[i]*sum;
      answer %=mod;
    }
    //if(D/S>T)cout<<"No"<<endl;
    cout<<answer<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: 'mod' was not declared in this scope; did you mean 'modf'?
   19 |       sum%=mod;
      |            ^~~
      |            modf
a.cc:24:21: error: 'mod' was not declared in this scope; did you mean 'modf'?
   24 |       if(sum<0)sum+=mod;
      |                     ^~~
      |                     modf
a.cc:26:16: error: 'mod' was not declared in this scope; did you mean 'modf'?
   26 |       answer %=mod;
      |                ^~~
      |                modf
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.at(i);
        sum += a.at(i)%MOD;
    }
    long long ans = 0;
    const int MOD = 1000000007;
    for(int i=0; i<n; i++){
        sum -= a.at(i)%MOD;
        ans += a.at(i)%MOD * sum%MOD;
    }
    cout << ans%MOD << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
const int mod = 1'000'000'007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &i : a) cin >> i;
  long long ans = 0, tot = 0;
  for (int i : a) {
    ans = (ans + total * i) % mod;
    tot = (total + i) % mod;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: 'total' was not declared in this scope; did you mean 'tot'?
   12 |     ans = (ans + total * i) % mod;
      |                  ^~~~~
      |                  tot
Language: C++

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

int main(){

    int N;
    int64_t sum = 0 ,ans = 0;
    int mod = 1000000000+7;
    int i,j;
    
    cin >> N;

    vector<int> a(n);

    for(i = 0;i<N;i++){
        cin >> a[i];
        sum = sum + a[i];
        sum = sum % mod;

    }

    for(i = 0;i<N;i++){
        
        sum = sum - a[i];
        if(sum < 0){
            sum = a[i] + mod;
        }

        ans = ans + a[i] * sum;

        ans = ans % mod;



    }


    cout << ans << endl;
         
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: 'n' was not declared in this scope
   16 |     vector<int> a(n);
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ull long long 
int main() {
		ull sum=0,n,no,sum1=0,total=0;
		vector<ull> v;
		cin>>n;
		while(n--)
		{
			cin>>no;
			v.pb(no);
		}
		
		for(ull i=0;i<v.size();i++)
		{
			sum+=((v[i])%mod);
            sum%=mod;
		}
		for(ull i=0;i<v.size();i++)
		{
			sum1+=((v[i])%mod);
            sum1%=mod;
			total+=((v[i]*(sum-sum1)))%mod;
            total%=mod;
		}
		cout<<total%mod;
		return 0;
	}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:27: error: 'class std::vector<long long int>' has no member named 'pb'
   12 |                         v.pb(no);
      |                           ^~