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

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long sum=1e9+7;
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n;
	scanf("%d",&n);
    vector<int> v(n);
	for(int i=0;i<n;i++)
		cin>>v[i];
	for (int i=-100;i<=100;++i){
        long long tmp=0;
        for(int j=0;j<n;j++){
            tmp+=pow((i-v[j]),2);
        }
        sum=min(tmp,sum);
    }
    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'vector' was not declared in this scope
   10 |     vector<int> v(n);
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include<cmath>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:10:12: error: expected primary-expression before 'int'
   10 |     vector<int> v(n);
      |            ^~~
a.cc:12:22: error: 'v' was not declared in this scope
   12 |                 cin>>v[i];
      |                      ^
a.cc:16:25: error: 'v' was not declared in this scope
   16 |             tmp+=pow((i-v[j]),2);
      |                         ^
Language: C++

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

int main(){
	int n,cont = 0,res = 0;
	cin>>n;
	int vals[n];
	for (int k = 0; k <n;k++){
		cin >> vals[k];
		cont += vals[k];
	}
	//cout<<cont<<endl;
	cont = round((float)cont/(float)n);
	//cout<<cont<<endl;
	for (int k = 0; k <n;k++){
		res += (cont-vals[k])*(cont-vals[k]);
	}
	cout << res << endl;
	return 0;
}#include<bits/stdc++.h>
using namespace std;

int main(){
	int n,cont = 0,res = 0;
	cin>>n;
	int vals[n];
	for (int k = 0; k <n;k++){
		cin >> vals[k];
		cont += vals[k];
	}
	//cout<<cont<<endl;
	cont = round((float)cont/(float)n);
	//cout<<cont<<endl;
	for (int k = 0; k <n;k++){
		res += (cont-vals[k])*(cont-vals[k]);
	}
	cout << res << endl;
	return 0;
}


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

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#define INF 1000000000
#define MOD 1000000007

using namespace std;

int main()
{
    int n;
    int a[105];

    int cost;
    int minv = INF;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    for (int i = 0; i < 105; i++) {
        for (int j = 0; j < n; j++) {
            cost += (a[j] - i) * (a[j] - i)
        }

        minv = min(cost, minv);
    }

    cout << minv << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:44: error: expected ';' before '}' token
   26 |             cost += (a[j] - i) * (a[j] - i)
      |                                            ^
      |                                            ;
   27 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);  
  int n;
  cin >> n;
  vector<int> a(n);
  for(auto& x : a) cin >> x;
  int mn = *min_element(a.begin(), a.end());
  int mx = *max_element(a.begin(), a.end());
  ll ans = 0;
  ll sum = 0, sum2 = 0;
  for(auto x : a) sum += x, sum2 += x * x;
  for(int x = mn; x <= mx; ++x) {
    ll v = 3ll * x * x - x * sum;
    ans = (x == mn) ? v : min(ans, v);
  }
  cout << sum2 + ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'll' was not declared in this scope
   12 |   ll ans = 0;
      |   ^~
a.cc:13:5: error: expected ';' before 'sum'
   13 |   ll sum = 0, sum2 = 0;
      |     ^~~~
      |     ;
a.cc:14:19: error: 'sum' was not declared in this scope
   14 |   for(auto x : a) sum += x, sum2 += x * x;
      |                   ^~~
a.cc:14:29: error: 'sum2' was not declared in this scope
   14 |   for(auto x : a) sum += x, sum2 += x * x;
      |                             ^~~~
a.cc:16:7: error: expected ';' before 'v'
   16 |     ll v = 3ll * x * x - x * sum;
      |       ^~
      |       ;
a.cc:17:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |     ans = (x == mn) ? v : min(ans, v);
      |     ^~~
      |     abs
a.cc:17:23: error: 'v' was not declared in this scope
   17 |     ans = (x == mn) ? v : min(ans, v);
      |                       ^
a.cc:19:11: error: 'sum2' was not declared in this scope
   19 |   cout << sum2 + ans;
      |           ^~~~
a.cc:19:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |   cout << sum2 + ans;
      |                  ^~~
      |                  abs
Language: C++

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  
  int n;
  cin >> n;
  vector<int> a(n);
  for(auto& x : a) cin >> x;
  int mn = min_element(a.begin(), a.end());
  int mx = max_element(a.begin(), a.end());
  int ans = 0;
  int sum = 0, sum2 = 0;
  for(auto x : a) sum += x, sum2 += x * x;
  for(int x = mn; x <= mn; ++x) {
    int v = 3 * x * x - x * sum;
    ans = (x == mn) ? v : min(ans, v);
  }
  cout << sum2 + ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   15 |   int mn = min_element(a.begin(), a.end());
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:16:23: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   16 |   int mx = max_element(a.begin(), a.end());
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       __gnu_cxx::__normal_iterator<int*, std::vector<int> >
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
#define MAXN 105
int n,a[MAXN];
int solve(){
	int totalcost;
	int cost=INT_MAX;
	for(int i=a[0];i<a[n];++i){
		totalcost=0;
		for(int j=1;j<=n;++j){
			totalcost+=(a[j]-i)*(a[j]-i);
		}
		cost=min(cost,totalcost);
	}
	return cost;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	sort(a+1,a+n+1);
	cout<<solve()<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:9:18: error: 'INT_MAX' was not declared in this scope
    9 |         int cost=INT_MAX;
      |                  ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<cmath>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mn = 105;
int a[mn];
int main()
{
	int n, i, l = 1 << 30, r = -(1 << 30);
	scanf("%d", &n);
	for(i = 1; i <= n; i++)
		scanf("%d", &a[#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mn = 105;
int a[mn];
int main()
{
	int n, i, l = 1 << 30, r = -(1 << 30);
	scanf("%d", &n);
	for(i = 1; i <= n; i++)
		scanf("%d", &a[i]), l = min(l, a[i]), r = max(r, a[i]);
	int ans = 1 << 30, sum;
	for(int j = l; j <= r; j++)
	{
		sum = 0;
		for(i = 1; i <= n; i++)
			sum += (a[i] - j) * (a[i] - j);
		ans = min(ans, sum);
	}
	printf("%d\n", ans);
}
i]), l = min(l, a[i]), r = max(r, a[i]);
	int ans = 1 << 30, sum;
	for(int j = l; j <= r; j++)
	{
		sum = 0;
		for(i = 1; i <= n; i++)
			sum += (a[i] - j) * (a[i] - j);
		ans = min(ans, sum);
	}
	printf("%d\n", ans);
}


Compiler output:
a.cc:12:32: error: stray '#' in program
   12 |                 scanf("%d", &a[#include<cstdio>
      |                                ^
a.cc: In function 'int main()':
a.cc:12:33: error: 'include' was not declared in this scope
   12 |                 scanf("%d", &a[#include<cstdio>
      |                                 ^~~~~~~
a.cc:12:41: error: 'cstdio' was not declared in this scope; did you mean 'stdin'?
   12 |                 scanf("%d", &a[#include<cstdio>
      |                                         ^~~~~~
      |                                         stdin
a.cc:15:1: error: expected primary-expression before 'using'
   15 | using namespace std;
      | ^~~~~
a.cc:12:48: error: expected ']' before 'using'
   12 |                 scanf("%d", &a[#include<cstdio>
      |                                                ^
      |                                                ]
......
   15 | using namespace std;
      | ~~~~~                                           
a.cc:18:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   18 | int main()
      |         ^~
a.cc:18:9: note: remove parentheses to default-initialize a variable
   18 | int main()
      |         ^~
      |         --
a.cc:18:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:19:1: error: a function-definition is not allowed here before '{' token
   19 | {
      | ^
a.cc:34:2: error: expected ';' before ']' token
   34 | i]), l = min(l, a[i]), r = max(r, a[i]);
      |  ^
      |  ;
Language: C++

#include <iostream>
#include <algorithm>
#include <array>
#include <cmath>
#include <string>
using namespace std;

long long main() {
	long long n,sum=0;
	cin>>n;
	long long input[n]={0};
	for(long long i=0;i<n;i++){
		cin>>input[i];
		sum=sum+input[i];
	}
	long long midpt = (double)ceil(double(sum)/n);
	long long cost=0;
	for(long long i=0;i<n;i++){
		cost=cost+(input[i]-midpt)*(input[i]-midpt);	
	}
	cout<<cost<<endl;
	return 0;
}

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

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
    int N;
    int a[100];
    int min = 10000000;
    cin >> N;
    REP(i, N) cin >> a[i];
    for(int j = -100; j <= 100; j++) {
        int cost = 0;
        for(int i = 0;i < N; i++){
            cost += (a[i] - j) * (a[i] - j);
        }
        if(cost < min) min = cost;
    }
    else cout << min;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:5: error: 'else' without a previous 'if'
   85 |     else cout << min;
      |     ^~~~
Language: C++

#include <cstdio>
#include <vector>

using namespace std;

int main()
{
    int no_of_elements;
    scanf("%d", &no_of_elements);
    vector <int> A(no_of_elements + 1);

    double sum = 0;
    for(int i = 1; i <= no_of_elements; i++)
    {
        scanf("%d", &A[i]);

        sum += a_i;
    }

    float mean = sum/no_of_elements;
    int int_mean = mean;

    if(mean - int_mean >= 0.5)
        int_mean++;

    int cost = 0;
    for(int i = 1; i <= no_of_elements; i++)
        cost += (A[i] - int_mean)*(A[i] - int_mean);

    printf("%d\n", cost);
    return 0;
}


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

public static void main(String[] args){
		Scanner in=new Scanner(System.in);
		int N=in.nextInt();
		int[] arr=new int[N];
		for (int i=0;i<N;i++){
			arr[i]=in.nextInt();
		}
		int change=200*200*100;
		for (int i=-100;i<=100;i++){
			int temp=0;
			for (int j=0;j<N;j++){
				temp+=(i-arr[j])*(i-arr[j]);
			}
			if (temp<change){
				change=temp;
			}
		}
		System.out.print(change);
	}

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args){
              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C++

#include <iostream>
using namespace std;
int main(){
  int n,k[112345],sum=0,ans=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>k[i];
    sum+=k[i];
  }
  if(sum%n==0) ave=sum/n;
  else ave=sum/n+1;
  
  for(int i=0;i<n;i++){
    ans+=(k[i]-ave)*(k[i]-ave);
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'ave' was not declared in this scope
   10 |   if(sum%n==0) ave=sum/n;
      |                ^~~
a.cc:11:8: error: 'ave' was not declared in this scope
   11 |   else ave=sum/n+1;
      |        ^~~
a.cc:14:16: error: 'ave' was not declared in this scope
   14 |     ans+=(k[i]-ave)*(k[i]-ave);
      |                ^~~
Language: C++

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

int main() {
	int a;
	cin >> a;
	int a[100];
	for (int i = 0;i < n;i++)cin >> a[i];
	int sq[201];
	for (int i = 0;i <= 100;i++)sq[i] = i * i;
	int m = 1000000;
	sort(a, a + n);
	for (int i = a[0];i <= a[n - 1];i++) {
		int cost = 0;
		for (int j = 0;j < n;j++) {
			cost += sq[abs(a[j] - i];
		}
		m = min(cost, m);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: conflicting declaration 'int a [100]'
    8 |         int a[100];
      |             ^
a.cc:6:13: note: previous declaration as 'int a'
    6 |         int a;
      |             ^
a.cc:9:28: error: 'n' was not declared in this scope
    9 |         for (int i = 0;i < n;i++)cin >> a[i];
      |                            ^
a.cc:9:42: error: invalid types 'int[int]' for array subscript
    9 |         for (int i = 0;i < n;i++)cin >> a[i];
      |                                          ^
a.cc:13:21: error: 'n' was not declared in this scope
   13 |         sort(a, a + n);
      |                     ^
a.cc:14:23: error: invalid types 'int[int]' for array subscript
   14 |         for (int i = a[0];i <= a[n - 1];i++) {
      |                       ^
a.cc:17:41: error: invalid types 'int[int]' for array subscript
   17 |                         cost += sq[abs(a[j] - i];
      |                                         ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#define lamba ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define all(x) x.begin(), x.end()
using namespace std;

const int zyan = 1e2 + 1;

int n, a[105], mn = zyan, mx = -zyan;

int fast() {
cin >> n;

for(int i=1;i<=n;i++){
cin >> a[i];
mn = min(mn, a[i]);
mx = max(mx, a[i]);
}
/*
int checker = 0;

for(int i=2;i<=n;i++){
	if(a[i] == a[1])checker++;
}


if(checker == n-1){
cout << 0;
return 0;
}*/

int mid = (mn + mx) % 2 + (mn + mx) >> 1;

int res = 0;

for(int i=1;i<=n;i++){
	if(mid == a[i])continue;
	else res += (a[i] * a[i]) - (a[i] * mid) - (mid * a[i]) + (mid * mid);
}

cout << res;

}

int main(){
lamba;

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

	ll ans = 1e18;

	for (int j = -4000; j <= 4000; ++j) {
		int cur = 0;
		for (int i = 1; i <= n; ++i) {
			cur += (a[i] - j) * 1ll * (a[i] - j);
		}
		ans = min(ans, cur);
	}
	
	cout << ans;
return 0;
}


Compiler output:
a.cc: In function 'int fast()':
a.cc:44:1: warning: no return statement in function returning non-void [-Wreturn-type]
   44 | }
      | ^
a.cc: In function 'int main()':
a.cc:55:9: error: 'll' was not declared in this scope; did you mean 'all'?
   55 |         ll ans = 1e18;
      |         ^~
      |         all
a.cc:62:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   62 |                 ans = min(ans, cur);
      |                 ^~~
      |                 abs
a.cc:65:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   65 |         cout << ans;
      |                 ^~~
      |                 abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int a[99], b[99], c[199], d, e, f, N;
 cin >> N;
 for(int i = 0; i < 100; i++)a[i] = 0;
 for(int j = 0; j < 100; j++)b[j] = 0;
 for(int k = 0; k < 200; k++)c[k] = 0;
 for(int l = 0; l < N; l++){
  cin >> a[l];
  if(l == 0){
   d = a[l];
   e = a[l];
  }
  if(d > a[l]){
   d = a[l];
  }
  if(e < a[l]){
   e = a[l];
  }
 }
 for(int m = d; m =< e; m++){
  for(int n = 0; n < N; n++){
   b[n] = (a[n] - m)*(a[n] - m);
   c[m+100] += b[n];
   if(m == d){
    f = c[m+100];
   }if(f > c[m]){
    f = c[m+100];
   }
  }
 }
 cout << f << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: expected primary-expression before '<' token
   22 |  for(int m = d; m =< e; m++){
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int a[99], b[99], e[99], N, c, d, f, g, p;
 cin >> N;
 for(int m = 0; m < N; m++)e[m] = 0;
 for(int h = 0; h < N; h++)b[h] = 0;
 for(int i = 0; i < N; i++){
  a[i] = 0;
  cin >> a[i];
 }
 for( int o = 0; o < N; j++){
  f = a[o];g = a[o]
  if(o = 0){
  g = f; p = f;
  }if(g < f){
  g = f;
  }if(p > f){
  p = f;
  }
 }
 for( int j = 0; j < N; j++){
   for( int k = g; k < p; k++){
     for(int n = 0; n < N; n++){
       b[n] = (a[n] - k)*(a[n] - k);
     }  
   }
   for( int l = 0; l < N; l++){
     c += b[l];
   }
   if( j == 0){
     d = c;
   }
   else if( d > c){
     d = c;
   }
 }
cout << d << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:25: error: 'j' was not declared in this scope
   12 |  for( int o = 0; o < N; j++){
      |                         ^
a.cc:13:20: error: expected ';' before 'if'
   13 |   f = a[o];g = a[o]
      |                    ^
      |                    ;
   14 |   if(o = 0){
      |   ~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int a[99], b[99], e[99], N, c, d;
 for(int m = 0; m < N; m++)e[m] = 0;
 for(int h = 0; h < N; h++)b[h] = 0;
 cin >> N;
 for(int i = 0; i < N; i++){
  a[i]= 0;
  cin >> a[i];
 }
 for( int j = 0; j < N; j++){
  for( int k = -100; k < 101; k++){
    for(int n = 0; n < N; n++){
   (a[n] - k)*(a[n] - k) = b[n];
     }  
  }
  for( int l = 0; l < N; l++){
   c += b[l];
  }
  if( j == 0){
   d = c;
  }
  if( d > c){
   d = c;
  }
 }
cout << d << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: lvalue required as left operand of assignment
   15 |    (a[n] - k)*(a[n] - k) = b[n];
      |    ~~~~~~~~~~^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int a[99], b[99], e[99], N, c, d;
 for(int m = 0; m < N; m++)e[m] = 0;
 for(int h = 0; h < N; h++)b[h] = 0;
 cin >> N;
 for(int i = 0; i < N; i++){
  a[i]= 0;
  cin >> a[i];
 }
 for( int j = 0; j < N; j++){
  for( int k = -100; k < 101; k++){
   (a[j] - k)*(a[j] - k) = b[j];
  }
  for( int l = 0; l < N; l++){
   c += b[l];
  }
  if( j == 0){
   d = c;
  }
  if( d > c){
   d = c;
  }
 }
cout << d << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: lvalue required as left operand of assignment
   14 |    (a[j] - k)*(a[j] - k) = b[j];
      |    ~~~~~~~~~~^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int a[99], b[99], e[99], N, c, d;
 for(int m = 0; m < N; m++)e[m] = 0;
 for(int h = 0; h < N; h++)b[h] = 0;
 cin >> N;
 for(int i = 0; i < N; i++){
  a[i]= 0;
  cin >> a[i];
 }
 for( int k = -100; k < 101; k++){
  for( int j = 0; j < N; j++){
   (a[j] - k)*(a[j] - k) = b[j];
  }
  for( int l = 0; l < N; l++){
   c += b[l];
  }
  if( l == 0){
   d = c;
  }
  if( d > c){
   d = c;
  }
 }
cout << d << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: lvalue required as left operand of assignment
   14 |    (a[j] - k)*(a[j] - k) = b[j];
      |    ~~~~~~~~~~^~~~~~~~~~~
a.cc:19:7: error: 'l' was not declared in this scope
   19 |   if( l == 0){
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int a[99], b[99], N, c, d;
 for(int h = 0; h < N; h++)b[h] = 0;
 cin >> N;
 for(int i = 0; i < N; i++){
  a[i]= 0;
  cin >> a[i];
 }
 for( int k = -100; k < 101; k++){
  for( int j = 0; j < N; j++){
   (a[j] - k)*(a[j] - k) = b[j] 
  }
 for( int l = 0; l < N; l++){
  c += b[l];
 }
 if( l = 0){
 d = c;
 }
 if( d > c){
 d = c;
 }
 }
 cout << d << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: lvalue required as left operand of assignment
   13 |    (a[j] - k)*(a[j] - k) = b[j]
      |    ~~~~~~~~~~^~~~~~~~~~~
a.cc:18:6: error: 'l' was not declared in this scope
   18 |  if( l = 0){
      |      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int a[99], b[99], b, N, c;
 for(int h = 0; h < N; h++)b[h] = 0;
 cin >> N;
 for(int i = 0; i < N; i++){
  a[i]= 0;
  cin >> a[i];
 }
 for( int k = -100; k < 101; k++){
  for( int j = 0; j < N; j++){
   (a[j] - k)*(a[j] - k) = b[j] 
  }
 for( int l = 0; l < N; l++){
  c += b[l];
 }
 if( l = 0){
 d = c;
 }
 if( d > c){
 d = c;
 }
 }
 cout << d << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:20: error: conflicting declaration 'int b'
    4 |  int a[99], b[99], b, N, c;
      |                    ^
a.cc:4:13: note: previous declaration as 'int b [99]'
    4 |  int a[99], b[99], b, N, c;
      |             ^
a.cc:13:14: error: lvalue required as left operand of assignment
   13 |    (a[j] - k)*(a[j] - k) = b[j]
      |    ~~~~~~~~~~^~~~~~~~~~~
a.cc:18:6: error: 'l' was not declared in this scope
   18 |  if( l = 0){
      |      ^
a.cc:19:2: error: 'd' was not declared in this scope
   19 |  d = c;
      |  ^
a.cc:21:6: error: 'd' was not declared in this scope
   21 |  if( d > c){
      |      ^
a.cc:25:10: error: 'd' was not declared in this scope
   25 |  cout << d << endl;
      |          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 int a[99], b[99], b, N, c;
 for(int h = 0; h < N; h++)b[h] = 0;
 cin >> N;
 for(int i = 0; i < N; i++){
  a[i]= 0;
  cin >> a[i];
 }
 for( k = -100; k < 101; k++){
  for( j = 0; j < N; j++){
   (a[j] - k)*(a[j] - k) = b[j] 
  }
 for( l = 0; l < N; l++){
  c += b[l];
 }
 if( l = 0){
 d = c;
 }
 if( d > c){
 d = c;
 }
 }
 cout << d << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:20: error: conflicting declaration 'int b'
    4 |  int a[99], b[99], b, N, c;
      |                    ^
a.cc:4:13: note: previous declaration as 'int b [99]'
    4 |  int a[99], b[99], b, N, c;
      |             ^
a.cc:11:7: error: 'k' was not declared in this scope
   11 |  for( k = -100; k < 101; k++){
      |       ^
a.cc:12:8: error: 'j' was not declared in this scope
   12 |   for( j = 0; j < N; j++){
      |        ^
a.cc:15:7: error: 'l' was not declared in this scope
   15 |  for( l = 0; l < N; l++){
      |       ^
a.cc:18:6: error: 'l' was not declared in this scope
   18 |  if( l = 0){
      |      ^
a.cc:19:2: error: 'd' was not declared in this scope
   19 |  d = c;
      |  ^
a.cc:21:6: error: 'd' was not declared in this scope
   21 |  if( d > c){
      |      ^
a.cc:25:10: error: 'd' was not declared in this scope
   25 |  cout << d << endl;
      |          ^
Language: C++

#include <bits/stdc++.h>
#define INF (1<<21)
using namespace std;

int main(){

  int n, tmp = 0;
  int v[210] = {}
  long long ans = INF;
  cin >> n;
  for(int i = 0; i < n; i++) cin >> v[i];
  for(int i = 0; i < 101; i++){
    long long sum = 0;
    for(int j = 0; j < n; j++){
      sum += (i - v[j]) * (i - v[j]);
    }
    ans = min(ans, sum);
  }
  if(tmp/n == abs(v[0]) && tmp%n == 0) ans = 0;
  if(ans == INF) ans = 0;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'long'
    9 |   long long ans = INF;
      |   ^~~~
a.cc:17:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |     ans = min(ans, sum);
      |     ^~~
      |     abs
a.cc:19:40: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |   if(tmp/n == abs(v[0]) && tmp%n == 0) ans = 0;
      |                                        ^~~
      |                                        abs
a.cc:20:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |   if(ans == INF) ans = 0;
      |      ^~~
      |      abs
a.cc:21:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const ll mod = 1e9+7;

int n;
vi a;

int main()
{
    cin >> n;
    a.resize(n); rep(i,n) cin >> a[i];
    double s=0;
    rep(i,n) s+= a[i];
    s 1/= (double)n;
    int m = s + 0.5;

    int ans = 0;
    rep(i,n) ans += (a[i]-m)*(a[i]-m);
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:31:6: error: expected ';' before numeric constant
   31 |     s 1/= (double)n;
      |      ^~
      |      ;
Language: C++

#include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<stack>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
using namespace std;
typedef long long int ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}

//------------------変数-----------------------//
ll n, a[100],k,cnt=547283908723495053;
string str;
//-------------------関数----------------------//


int main() {
	cin >> n;
	REP(i, n) {
		cin >> a[i];
	}
	for (int i = -200; i <=200; i++)
	{
		ll mini=0;
		REP(j, n) {
			mini += pow(a[j]-i, 2);
		}
		cnt = min(cnt, mini);
	}
	cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:33: error: 'pow' was not declared in this scope
   39 |                         mini += pow(a[j]-i, 2);
      |                                 ^~~
Language: C++

#include <iostream>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int cost_min = -1;
  for (int i = -100; i <= 100; ++i) {
    int cost = 0;
    for (int j = 0; j < n; ++j) {
      cost += abs(i-a[j]);
    }
    if (cost_min == -1) {
      cost_min = cost;
    } else
      cost_min = min(cost, cost_min);
    }
  }
  cout << cost_min << endl;
  return 0;
}


Compiler output:
a.cc:27:3: error: 'cout' does not name a type
   27 |   cout << cost_min << endl;
      |   ^~~~
a.cc:28:3: error: expected unqualified-id before 'return'
   28 |   return 0;
      |   ^~~~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include<cstdio>
#include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
const int big=(1<<30);
int gcd(int a,int b){if(a<b){swap(a,b);}if(b==0){return a;}return gcd(a%b,b);}
int main(void){
	int n,ans=big,i,q,gen,j;
	vector<int> a;
	cin>>N;
	for(i=0;i<n;i++){
		scanf("%d",&q);
		a.push_back(q);
	}
	for(i=-100;i<101;i++){
		gen=0;
		for(j=0;j<n;j++){
			gen+=(a[j]-i)*(a[j]-i);
		}
		ans=min(ans,gen);
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: 'N' was not declared in this scope
   11 |         cin>>N;
      |              ^
Language: C++

#include<cstdio>
#include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
const int big=(1<<30);
int gcd(int a,int b){if(a<b){swap(a,b);}if(b==0){return a;}return gcd(a%b,b);}
int main(void){
	int N,ans=big,i,q,gen,j;
	vector<int> a;
	cin>>N;
	for(i=0;i<n;i++){
		scanf("%d",&q);
		a.push_back(q);
	}
	for(i=-100;i<101;i++){
		gen=0;
		for(j=0;j<n;j++){
			gen+=(a[j]-i)*(a[j]-i);
		}
		ans=min(ans,gen);
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'n' was not declared in this scope
   12 |         for(i=0;i<n;i++){
      |                   ^
a.cc:18:27: error: 'n' was not declared in this scope
   18 |                 for(j=0;j<n;j++){
      |                           ^
Language: Java

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<Integer> list = IntStream.range(0, N).mapToObj(x -> sc.nextInt())
				.sorted((a, b) -> Integer.compare(b, a))
				.collect(Collectors.toCollection(ArrayList::new));
		int max=list.get(0);
		int min=list.get(list.size()-1);
		int sum=0;
		
		boolean firstOrnot=true;
		
		for (int i = min; i < max; i++) {
			int sumInter=0;
			for (int j = 0; j < list.size(); j++) {
				sumInter+=Math.pow(list.get(j)-i, 2);
			}
			if (firstOrnot) {
				firstOrnot=false;
				sum=sumInter;
			}else {
				if (sumInter<sum) {
					sum=sumInter;
				}
			}
		}
		
		System.out.println(sum);

	}

}

Compiler output:
Main.java:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
		List<Integer> list = IntStream.range(0, N).mapToObj(x -> sc.nextInt())
		^
  symbol:   class List
  location: class Main
Main.java:6: error: cannot find symbol
		List<Integer> list = IntStream.range(0, N).mapToObj(x -> sc.nextInt())
		                     ^
  symbol:   variable IntStream
  location: class Main
Main.java:8: error: cannot find symbol
				.collect(Collectors.toCollection(ArrayList::new));
				         ^
  symbol:   variable Collectors
  location: class Main
Main.java:8: error: cannot find symbol
				.collect(Collectors.toCollection(ArrayList::new));
				                                 ^
  symbol:   class ArrayList
  location: class Main
6 errors
Language: C++

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

inline int square(int x) {
    return x * x;
}

int N;
int A[100];

int main() {
    scanf("%d", &N);
    for (int i = 0; i < N; i++)
        scanf("%d", &A[i]);
    int sum = 0;
    for (int i = 0; i < N; i++)
        sum += A[i];
    int avg1 = sum / N, avg2 = avg1 + 1;
    int res1 = 0;
    for (int i = 0; i < N; i++)
        res1 += square(avg1 - A[i]);
    int res2 = 0;
    for (int i = 0; i < N; i++)
        res2 += square(avg2 - A[i]);
    printf("%d". min(res1, res2));
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: request for member 'min' in '"%d"', which is of non-class type 'const char [3]'
   25 |     printf("%d". min(res1, res2));
      |                  ^~~
Language: C++

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

inline int square(int x) {
    return x * x;
}

int N;
int A[100];

int main() {
    scanf("%d", &N);
    for (int i = 0; i < N; i++)
        scanf("%d", &A[i]);
    int sum = 0;
    for (int i = 0; i < N; i++)
        sum += A[i];
    int avg1 = sum / N, avg2 = avg1 + 1;
    int res1 = 0;
    for (int i = 0; i < N; i++)
        res1 += square(avg1 - A[i]);
    int res2 = 0;
    for (int i = 0; i < N; i++)
        res2 += square(avg2 - A[i]);
    printf("%d". min(res1, res2));
    return 0;
}


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

#include<iostream>
#include<cstdio>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF INT_MAX/2
int N;
int a[100];

int main() {
	cin >> N;
	rep(i, 0, N) cin >> a[i];
	int ans = INF;
	rep(x, -100, 101) {
		int sm = 0;
		rep(i, 0, N) sm += abs(x - a[i])*abs(x - a[i]);
		ans = min(ans, sm);
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: 'INT_MAX' was not declared in this scope
    5 | #define INF INT_MAX/2
      |             ^~~~~~~
a.cc:12:19: note: in expansion of macro 'INF'
   12 |         int ans = INF;
      |                   ^~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<cstdio>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include<iostream>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF INT_MAX/2
int N;
int a[100];
int main() {
	cin >> N;
	rep(i, 0, N) cin >> a[i];
	int ans = INF;
	rep(x, -100, 101) {
		int sm = 0;
		rep(i, 0, N) sm += abs(x - a[i])*abs(x - a[i]);
		ans = min(ans, sm);
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:13: error: 'INT_MAX' was not declared in this scope
    4 | #define INF INT_MAX/2
      |             ^~~~~~~
a.cc:10:19: note: in expansion of macro 'INF'
   10 |         int ans = INF;
      |                   ^~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

f( chk[x][y][z] ) return dt[x][y][z];
    chk[x][y][z] = 1;
    int &ret = dt[x][y][z] = 0;

    if( y < st.size() )
    {
        if( z == 0 )
        {
            ret += dp(x+1, y+1, 0), ret%=MOD;
            ret += dp(x+1, y, z+1), ret%=MOD;
        }
        else
        {
            ret += dp(x+1, y, z+1), ret%=MOD;
            ret += dp(x+1, y, z+1), ret%=MOD;
        }
    }
    else
    {
        ret += dp(x+1, y, z+1), ret %= MOD;
        ret += dp(x+1, y, z+1), ret %= MOD;
    }

    if( z > 0 ) ret += dp(x+1, y, z-1), ret%=MOD;
    else if( y > 0 ) ret += dp(x+1, y-1, 0), ret%=MOD;
    else ret += dp(x+1, 0, 0), ret%=MOD;
    return ret;
}

int main()
{
    cin>>n>>st;
    cout<<dp(0,0,0);
    return 0;
}


Compiler output:
a.cc:1:2: error: expected constructor, destructor, or type conversion before '(' token
    1 | f( chk[x][y][z] ) return dt[x][y][z];
      |  ^
a.cc:2:5: error: 'chk' does not name a type
    2 |     chk[x][y][z] = 1;
      |     ^~~
a.cc:3:16: error: 'dt' was not declared in this scope
    3 |     int &ret = dt[x][y][z] = 0;
      |                ^~
a.cc:3:19: error: 'x' was not declared in this scope
    3 |     int &ret = dt[x][y][z] = 0;
      |                   ^
a.cc:3:22: error: 'y' was not declared in this scope
    3 |     int &ret = dt[x][y][z] = 0;
      |                      ^
a.cc:3:25: error: 'z' was not declared in this scope
    3 |     int &ret = dt[x][y][z] = 0;
      |                         ^
a.cc:5:5: error: expected unqualified-id before 'if'
    5 |     if( y < st.size() )
      |     ^~
a.cc:18:5: error: expected unqualified-id before 'else'
   18 |     else
      |     ^~~~
a.cc:24:5: error: expected unqualified-id before 'if'
   24 |     if( z > 0 ) ret += dp(x+1, y, z-1), ret%=MOD;
      |     ^~
a.cc:25:5: error: expected unqualified-id before 'else'
   25 |     else if( y > 0 ) ret += dp(x+1, y-1, 0), ret%=MOD;
      |     ^~~~
a.cc:26:5: error: expected unqualified-id before 'else'
   26 |     else ret += dp(x+1, 0, 0), ret%=MOD;
      |     ^~~~
a.cc:27:5: error: expected unqualified-id before 'return'
   27 |     return ret;
      |     ^~~~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
a.cc: In function 'int main()':
a.cc:32:5: error: 'cin' was not declared in this scope
   32 |     cin>>n>>st;
      |     ^~~
a.cc:32:10: error: 'n' was not declared in this scope
   32 |     cin>>n>>st;
      |          ^
a.cc:32:13: error: 'st' was not declared in this scope; did you mean 'std'?
   32 |     cin>>n>>st;
      |             ^~
      |             std
a.cc:33:5: error: 'cout' was not declared in this scope
   33 |     cout<<dp(0,0,0);
      |     ^~~~
a.cc:33:11: error: 'dp' was not declared in this scope
   33 |     cout<<dp(0,0,0);
      |           ^~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector <int> A(N+5);
    
    for (int i = 0; i < N; i++) {
        int m;
        cin >> m;
        A.push_back(m);
    }
    int sigma = 0;
    for (int i = 0; i < N; i++) {
        sigma += A.at(i);
    }
    int m1;
    m1 = sigma/N;
    int cost1 = 0;
    for (int i = 0; i < N; i++){
        cost1 +=(A.at(i) - m1)*(A.at(i) -m1);
    }
    int cost2 = 0;
    for (int i = 0; i < N; i++) {
        cost2 += (A.at(i) - m1 + 1)*(A.at(i) - m1 +1);
    }
    int cost3 = 0;
    for (int i = 0; i < N; i++) {
        cost3 += (A.at(i) - m1 -1)*(A.at(i) - m1 -1);
    }
    int cost = min(cost1, cost2);
    int cost = min(cost, cost3);
    cout << cost << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: redeclaration of 'int cost'
   37 |     int cost = min(cost, cost3);
      |         ^~~~
a.cc:36:9: note: 'int cost' previously declared here
   36 |     int cost = min(cost1, cost2);
      |         ^~~~
Language: C++

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

using namespace std;

int ave(vector<int>& v)
{
  long long sum = 0;
  for (auto x : v) {
    sum += x;
  }
  return static_cast<int>(ceil(static_cast<double>(sum) / v.size()));
}

int main()
{
  int n;
  vector<int> a;

  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a.push_back(x);
  }

  const int average = ave(a);
  cerr << "average: " << average << endl;

  int cost = 0;
  for (auto x : a) {
    cost += (average - x) * (average - x);
  }

  cout << cost << endl;

  return

Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: expected primary-expression at end of input
   38 |   return
      |         ^
a.cc:38:9: error: expected ';' at end of input
   38 |   return
      |         ^
      |         ;
a.cc:38:9: error: expected '}' at end of input
a.cc:17:1: note: to match this '{'
   17 | {
      | ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS

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

int main()
{
	int n;
	int numbers[100];
	int all=0;
	int avg;
	int value1=0, value2=0;
	scanf("%d\n", &n);
	for (int i = 0; i < n-1; i++) {
		scanf("%d ", &numbers[i]);
		all += numbers[i];
	}
	scanf("%d", &numbers[n - 1]);
	all += numbers[n - 1];
	avg = all / n;
	for (int i = 0; i < n; i++) {
		value1 += (numbers[i]-avg)*(numbers[i] - avg);
		value2 += (numbers[i] - avg-1)*(numbers[i] - avg-1);
	}
	if (value1 < value2) printf("%d", value1);
	else printf("%d", value2);
	return 0;
}

Compiler output:
a.cc:6:9: fatal error: conio.h: No such file or directory
    6 | #include<conio.h>
      |         ^~~~~~~~~
compilation terminated.
Language: Java

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

public class C_test {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	static final int P = 1_000_000_007;

	int[] getSums(int from, int to, int c) {
		int[] a = new int[to - from + 1];
		Arrays.fill(a, 1);

		int[] ret = new int[c + 1];
		for (int i = 0; i <= c; i++) {
			if (i != 0) {
				for (int j = from; j <= to; j++) {
					a[j - from] = (int) ((long) a[j - from] * j % P);
				}
			}

			for (int j = 0; j <= to - from; j++) {
				ret[i] = (ret[i] + a[j]) % P;
			}
		}
		return ret;
	}

	void solve() throws IOException {
		int n = 400;
		int c = 400;

		int[] dp = new int[c + 1];
		dp[0] = 1;

		int[] low = new int[n];
		int[] high = new int[n];

		for (int i = 0; i < n; i++) {
			low[i] = 1;
		}

		for (int i = 0; i < n; i++) {
			high[i] = 400;
		}

		for (int i = 0; i < n; i++) {
			int[] sums = getSums(low[i], high[i], c);
			
			int[] nxt = new int[c + 1];
			for (int from = 0; from <= c; from++) {
				for (int to = from; to <= c; to++) {
					nxt[to] += (int)((long)dp[from] * sums[to - from] % P);
					nxt[to] %= P;
				}
			}
			
			dp = nxt;
		}
		
		out.println(dp[c]);
	}

	C_test() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new C_test();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

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

import java.util.Scanner;


public class R59 {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) a[i] = s.nextInt();
		long min = Long.MAX_VALUE;
		for(int i = -100; i <= 100; i++) {
			long total = 0;
			for(int j = 0; j < n; j++) {
				long diff = Math.abs(i - a[j]);
				total += diff * diff;
			}
			min = Math.min(min, total);
		}
		System.out.println(min);
	}
}


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

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

#define N 100

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    int a[n];
    int sum = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d",&a[i]);
        sum += a[i];
    }
    int target = ceil((float)sum/n);
    int res = 0;
    for (int i = 0; i < n; i++) {
        res += (a[i] - target) * (a[i] - target);
    }
    printf('%d\n', res);
    return 0;
}

Compiler output:
a.cc:38:12: warning: multi-character character constant [-Wmultichar]
   38 |     printf('%d\n', res);
      |            ^~~~~~
a.cc: In function 'int main()':
a.cc:38:12: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   38 |     printf('%d\n', res);
      |            ^~~~~~
      |            |
      |            int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from a.cc:7:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

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

	sum = (double)sum / (double)n;
	//cout << sum << endl;
	int ansl = floor(sum);
	int ansh = ansl + 1;

	int el = 0;
	int eh = 0;

	for (int i = 0; i < n; i++) {
		el = el + (a[i] - ansl)*(a[i] - ansl);
		eh = eh + (a[i] - ansh)*(a[i] - ansh);
	}
	int cost = 0;
	if (el > eh) { //anshのが優秀
		cout << eh << endl;
	}
	else cout << el << endl;



	return 0;
}




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

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];

            int sum = 0;
            for (int i = 0; i < n; i++) {
                int ai = in.nextInt();
                a[i] = ai;
                sum += ai;
            }

            int y = (int) Math.ceil((sum * 1.0d) / n);

            int cost = 0;
            for (int i = 0; i < n; i++) {
                cost += (y - a[i]) * (y - a[i]);
            }
            out.println(cost);
        }

    }
}


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