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

//omajinai c++
#include <iostream>
#include<cmath>

#include<vector>
#include <algorithm>
#include <limits>
#include <numeric>
#include <type_traits>
#include <map>
#include <string>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
constexpr auto mod = 1000000007;
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> x(n);
	int sumx = 0;
	rep(i, n) {
		cin >> x[i];
		sumx += x[i];
	}
	int mean1 = sumx / n;
	int mean2 = mean1 + 1;


Compiler output:
a.cc: In function 'int main()':
a.cc:26:31: error: expected '}' at end of input
   26 |         int mean2 = mean1 + 1;
      |                               ^
a.cc:16:12: note: to match this '{'
   16 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <ctime>
#include <iomanip>
#include <numeric>
using namespace std;
const int MAX = 2e5 + 4;
int convert(int n, int k)
{
	int counter = 0;
	while (n)
	{
		n /= k;
		counter++;
	}
	return counter;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	float avg = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		avg += a[i];
	}
	int average = avg / n;
//	cout << average << endl;
	int result = 0;
	for (int i = 0; i < n; i++)
	{
		result += pow(a[i] - average, 2);
	}
	cout << result;
	return 0;
}

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

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> X;
    int input;
    for(int i = 0; i < N; i++){
        cin >> input;
        X.push_back(input);
    }
    std::sort(X.begin(), X.end());
    long int minSum = LONG_MAX;
    for(int i = 0; i < X[N-1]; i ++){
        long int sum = 0;
        for(int j = 0; j < N; j++){
            sum += (X[j] - i)*(X[j] - i);
        }
        if(sum < minSum){
            minSum = sum;
        }
    }
    cout << minSum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> X;
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> X;
      |            ^~~
a.cc:13:9: error: 'X' was not declared in this scope
   13 |         X.push_back(input);
      |         ^
a.cc:15:15: error: 'X' was not declared in this scope
   15 |     std::sort(X.begin(), X.end());
      |               ^
a.cc:16:23: error: 'LONG_MAX' was not declared in this scope
   16 |     long int minSum = LONG_MAX;
      |                       ^~~~~~~~
a.cc:4:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namesapce std;
int main(){
    /*ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(30);*/
    int n,i;
    float avg=0;
    float res=0;
    cin>>n;
    int coordinates [n];
    for(i=0;i<n;i++){
        cin>>coordinates[i];
    }
    for(i=0;i<n;i++){
        avg=avg+coordinates[i];
    }
    avg=avg/n;
    for(i=0;i<n;i++){
        res=res+pow((coordinates[i]-avg),2);
    }
    cout<<res;
    return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |     cin>>n;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:20:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |     cout<<res;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include <iostream>
using namespace std;

int main()
{
    int n, x[101], i, j, s, minim=INT_MAX, p;
    cin>>n;
    for(i=1; i<=n; i++)
        cin>>x[i];
    for(i=1; i<=100; i++)
    {
        p=i;
        s=0;
        for(j=1; j<=n; j++)
            s+=(x[j]-p)*(x[j]-p);
        if(s<minim)
            minim=s;
    }
    cout<<minim;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:35: error: 'INT_MAX' was not declared in this scope
    6 |     int n, x[101], i, j, s, minim=INT_MAX, p;
      |                                   ^~~~~~~
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;
a.cc:12:9: error: 'p' was not declared in this scope
   12 |         p=i;
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n;
  	cin>>n;
  	ll v[n];
  	ll sum=0,num;
  	for(ll i=0;i<n;i++)
    {	
  	 cin>>num;
      v[i]=pow(num-n,2);
      sum+=v[i];
      num=0;
    }
  	cout<<sum;


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

#include <bits/stdc++.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];
   }
    sort(a,a+n);
    int sum=0;
    int d=0;
    int k=0;
    mini=99999;
    for(int i=1;i<=100;i++)
    {
        d=i;
        for(int j=0;j<n;j++)
        {
            //cout<<d<<" "<<k<<" "<<sum<<endl;
            k=a[j]-d;
            sum=sum+k*k;
        }
        if(sum<mini)
        {
            mini=sum;
            sum=0;
        }
    }
    cout<<mini<<endl;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'mini' was not declared in this scope
   18 |     mini=99999;
      |     ^~~~
Language: Java

import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String sc1 = scanner.nextLine();
        String scline = scanner.nextLine();
        String array[] = sc.nextLine().split(" ");   
        double sum = 0;
        for( int i=0; i<sc1; i++ ) {
                sum += array[i];
        }
        int ave = Math.round(sum/sc1);
        double sum2 = 0;
        for( int i=0; i<sc1; i++ ) {
                sum2 += Math.pow(array[i] - ave);
        }
        System.out.println(sum2);
    }
}

Compiler output:
Main.java:7: error: cannot find symbol
        String array[] = sc.nextLine().split(" ");   
                         ^
  symbol:   variable sc
  location: class Main
Main.java:9: error: bad operand types for binary operator '<'
        for( int i=0; i<sc1; i++ ) {
                       ^
  first type:  int
  second type: String
Main.java:10: error: incompatible types: String cannot be converted to double
                sum += array[i];
                            ^
Main.java:12: error: bad operand types for binary operator '/'
        int ave = Math.round(sum/sc1);
                                ^
  first type:  double
  second type: String
Main.java:14: error: bad operand types for binary operator '<'
        for( int i=0; i<sc1; i++ ) {
                       ^
  first type:  int
  second type: String
Main.java:15: error: bad operand types for binary operator '-'
                sum2 += Math.pow(array[i] - ave);
                                          ^
  first type:  String
  second type: int
6 errors
Language: Java

import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String sc1 = scanner.nextLine();
        String scline = scanner.nextLine();
        String array[] = sc.nextLine().split(" ");   
        double sum = 0;
        for( int i=0; i<sc1; i++ ) {
                sum += array[i];
        }
        int ave = Math.round(sum/sc1)
        double sum2 = 0;
        for( int i=0; i<sc1; i++ ) {
                sum2 += Math.pow(array[i] - ave);
        }
        System.out.println(sum2)
    }
}

Compiler output:
Main.java:12: error: ';' expected
        int ave = Math.round(sum/sc1)
                                     ^
Main.java:17: error: ';' expected
        System.out.println(sum2)
                                ^
2 errors
Language: C++

#nclude<bits/stdc++.h>
using namespace std;
int d=0,a,b;
int main(){
  cin>>a;
  vector<int> c(a);
  sort(c.begin(), c.end());
  for(int i=c[0];i<c[a-1];i++){
    b=0;
    for(int j=0;j<a;j++)b+=(c[j]-i)*(c[j]-i);
    if(b<d)d=b;
  }
  cout<<d<<endl;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #nclude; did you mean #include?
    1 | #nclude<bits/stdc++.h>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin>>a;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #nclude<bits/stdc++.h>
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> c(a);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #nclude<bits/stdc++.h>
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> c(a);
      |          ^~~
a.cc:7:8: error: 'c' was not declared in this scope
    7 |   sort(c.begin(), c.end());
      |        ^
a.cc:7:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    7 |   sort(c.begin(), c.end());
      |   ^~~~
      |   short
a.cc:13:3: error: 'cout' was not declared in this scope
   13 |   cout<<d<<endl;
      |   ^~~~
a.cc:13:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:12: error: 'endl' was not declared in this scope
   13 |   cout<<d<<endl;
      |            ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #nclude<bits/stdc++.h>
Language: C++

#nclude<bits/stdc++.h>
using namespace std;
int d=0,a,b;
int main(){
  cin>>a;
  vector<int> c(a);
  sort(c.begin(),c.end());
  for(int i=c[0];i<c[a-1];i++){
    b=0;
    for(int j=0;j<a;j++)b+=(c[j]-i)^2;
    if(b<d)d=b;
  }
  cout<<d<<endl;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #nclude; did you mean #include?
    1 | #nclude<bits/stdc++.h>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin>>a;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #nclude<bits/stdc++.h>
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> c(a);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #nclude<bits/stdc++.h>
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> c(a);
      |          ^~~
a.cc:7:8: error: 'c' was not declared in this scope
    7 |   sort(c.begin(),c.end());
      |        ^
a.cc:7:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    7 |   sort(c.begin(),c.end());
      |   ^~~~
      |   short
a.cc:13:3: error: 'cout' was not declared in this scope
   13 |   cout<<d<<endl;
      |   ^~~~
a.cc:13:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:12: error: 'endl' was not declared in this scope
   13 |   cout<<d<<endl;
      |            ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #nclude<bits/stdc++.h>
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <list>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <random>
#include <queue>
#include <fstream>
#include <iterator> // std::back_inserter
#include <chrono>
#include <string>
#include <stdio.h>
#include <iomanip>
#include <float.h>
#include <cassert>
#include <functional>

using namespace std;

int main(int argc, char *argv[])
{
    int N;
    long long int ans=LLONG_MAX;
    int max = 1, min = 100;

    cin >> N;

    int a[N];

    for(int i=0; i<N; i++){
        cin >> a[i];
        if(max < a[i]) max = a[i];
        if(min > a[i]) min = a[i];
    } 

    for(int i = min; i<max+1; i++){
        int can = 0;
        for(int j=0; j<N; j++){
            can += (a[j] - i)*(a[j] - i);
        }
        if(ans > can) ans = can;
    }

    cout << ans;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:27:23: error: 'LLONG_MAX' was not declared in this scope
   27 |     long long int ans=LLONG_MAX;
      |                       ^~~~~~~~~
a.cc:21:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   20 | #include <functional>
  +++ |+#include <climits>
   21 |
Language: C++

#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
static constexpr int square(int x) {
 return x * x;
}
int main() {
 int n;
 scanf("%d", &n);
 std::vector<int> x(n, 0);
 for (int& xi : x) {
  scanf("%d", &xi);
 }
 std::sort(x.begin(), x.end());
 int ret = INT_MAX;
 for (int p = x.front(); p < x.back(); ++p) {
  int tmp = std::accumulate(x.begin(), x.end(), 0, [p](int xi) { return square(xi - p); });
  if (tmp < ret) {
   ret = tmp;
  }
 }
 printf("%d\n", ret);
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 'INT_MAX' was not declared in this scope
   16 |  int ret = INT_MAX;
      |            ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <numeric>
  +++ |+#include <climits>
    5 | static constexpr int square(int x) {
In file included from /usr/include/c++/14/numeric:62,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_numeric.h: In instantiation of '_Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation) [with _InputIterator = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Tp = int; _BinaryOperation = main()::<lambda(int)>]':
a.cc:18:28:   required from here
   18 |   int tmp = std::accumulate(x.begin(), x.end(), 0, [p](int xi) { return square(xi - p); });
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:169:29: error: no match for call to '(main()::<lambda(int)>) (int&, int&)'
  169 |         __init = __binary_op(_GLIBCXX_MOVE_IF_20(__init), *__first);
      |                  ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:18:52: note: candidate: 'main()::<lambda(int)>'
   18 |   int tmp = std::accumulate(x.begin(), x.end(), 0, [p](int xi) { return square(xi - p); });
      |                                                    ^
a.cc:18:52: note:   candidate expects 1 argument, 2 provided
Language: C

#include<stdio.h>
#define N 100
int main()
{
	int N,X[N];
	int min=10000;
	int temp[N];
	int a;
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	{
		scanf("%d",&X[i]);
		if(min>X[i])
		{
			temp[a++]=min;
			min=x[i];
		}
	}
	printf("%d",min);
	
}

Compiler output:
main.c: In function 'main':
main.c:2:11: error: expected identifier or '(' before numeric constant
    2 | #define N 100
      |           ^~~
main.c:5:13: note: in expansion of macro 'N'
    5 |         int N,X[N];
      |             ^
main.c:9:20: error: lvalue required as unary '&' operand
    9 |         scanf("%d",&N);
      |                    ^
main.c:12:29: error: 'X' undeclared (first use in this function)
   12 |                 scanf("%d",&X[i]);
      |                             ^
main.c:12:29: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:29: error: 'x' undeclared (first use in this function)
   16 |                         min=x[i];
      |                             ^
Language: C++

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





int main() {
  int N;
  cin >> N;
  int X[N];
  int MAX = 0;
  int MIN = 0;
  int SUM = 0;
  int i;
  
  for (i = 0; i <= N; i++){
    cin >> X[i]
    if (MAX < X[i]) MAX = X[i];
  }
  
  for (i = 0; i <= MAX; i++){ 
    for (int n = 0; n <= N; n++){
      SUM = SUM + (i - X[n]) * (i - X[n]);
      
    }
    if (MIN < SUM) MIN = SUM;
  }
  cout << MIN << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: expected ';' before 'if'
   18 |     cin >> X[i]
      |                ^
      |                ;
   19 |     if (MAX < X[i]) MAX = X[i];
      |     ~~
Language: Java

import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    int n = sc.nextInt();
    int[] x = new int[n];
    
    for(int i=0; i<n; i++){
      x[i] = sc.nextInt();
    }
    
    int min = x[0];
    int max = x[0];
    
    for(int i=0; i<n; i++){
      if(min > x[i]){
        min = x[i];
      }
      
      if(max < x[i]){
        max = x[i];
      }
    }
    
    int total = 0;
    int st = 50000;
    
    for(int i=min; i<=max; i++){
      for(int j=0; j<n; j++){
        total += (x[j]-i) * (x[j]-i);
        if(j == n-1 && st > total){
          st = total;
          total = 0;
        }else if(j == n-1){
          total = 0
        }else{
        
        }
      }
    }
    
    System.out.println(st);
  }
}


Compiler output:
Main.java:36: error: ';' expected
          total = 0
                   ^
1 error
Language: Java

import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    int n = sc.nextInt();
    int[] x = new int[n];
    
    for(int i=0; i<n; i++){
      x[i] = sc.nextInt();
    }
    
    int min = x[0];
    int max = x[0];
    
    for(int i=0; i<n; i++){
      if(min > x[i]){
        min = x[i];
      }
      
      if(max < x[i]){
        max = x[i];
      }
    }
    
    int total = 0
    int st = 50000;
    
    for(int i=min; i<=max; i++){
      for(int j=0; j<n; j++){
        total += (x[j]-i) * (x[j]-i);
        if(j == n-1 && st > total){
          st = total;
          total = 0;
        }else{
          total = 0;
        }
      }
    }
    
    System.out.println(st);
  }
}


Compiler output:
Main.java:26: error: ';' expected
    int total = 0
                 ^
1 error
Language: Java

import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    int n = sc.nextInt();
    int[] x = new int[n];
    
    for(int i=0; i<n; i++){
      x[i] = sc.nextInt();
    }
    
    int min = x[0];
    int max = x[0];
    
    for(int i=0; i<n; i++){
      if(min > x[i]){
        min = x[i];
      }
      
      if(max < x[i]){
        max = x[i];
      }
    }
    
    int st = 50000;
    
    for(int i=min; i<=max; i++){
      for(int j=0; j<n; j++){
        int total += (x[j]-i) * (x[j]-i);
        if(j == n-1 && st > total){
          st = total;
        }
      }
    }
    
    System.out.println(st);
  }
}


Compiler output:
Main.java:30: error: ';' expected
        int total += (x[j]-i) * (x[j]-i);
                 ^
Main.java:30: error: not a statement
        int total += (x[j]-i) * (x[j]-i);
                          ^
Main.java:30: error: ';' expected
        int total += (x[j]-i) * (x[j]-i);
                            ^
Main.java:30: error: not a statement
        int total += (x[j]-i) * (x[j]-i);
                                     ^
Main.java:30: error: ';' expected
        int total += (x[j]-i) * (x[j]-i);
                                       ^
5 errors
Language: Java

import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc= new Scanner(System.in);
    int n = sc.nextInt();
    int[] x = new int[n];
    
    for(int i=0; i<n; i++){
      x[i] = sc.nextInt();
    }
    
    int min = x[0];
    int max = x[0];
    
    for(int i=0; i<n; i++){
      if(min > x[i]){
        min = x[i];
      }
      
      if(max < x[i]){
        max = x[i];
      }
    }
    
    int total = 0;
    int st = 50000;
    
    for(int i=min; i<=max; i++){
      for(int j=0; j<n; j++){
        total += (x[j]-i) * (x[j]-i)
        if(j == n-1){
          if(st < total){
            st = total;
          }
          total = 0;
        }
      }
    }
    
    System.out.println(st);
  }
}


Compiler output:
Main.java:31: error: ';' expected
        total += (x[j]-i) * (x[j]-i)
                                    ^
1 error
Language: C

    #include <stdio.h>
     
    void maxmin(int x[], int *max, int *min);
    void dmin(int x[], int *max, int *min, int *allmin);
     
    int main (void)
    {
     	int i, imax, x[100], max, min, allmin;
      	scanf("%d\n", &imax);
      	for (i=0; i<imax; i++){
      	scanf("%d" &x[i]);
        }
      
       	maxmin(x, &max, &min);
      
      	dmin(x, &max, &min, &allmin)
      
      	printf("%d", allmin);
      	return 0;
    }
     
    void maxmin(int x[], int *max, int *min)
    {
    	int i=0;
      	*min=100;
      	*max=0;
        for (i=0;i<imax;i++){
        	if (x[i]<*min) *min=x[i];
          	if (x[i]>*max) *max=x[i];
        }
    }
     
    void dmin(int x[], int *max, int *min, int *allmin)
    {
    	int k, all=0;
      	*allmin=10000;
        for (k=*min;k<=*max; k++){
          	for (i=0; i<imax; i++){
            all+=(k-x[i])^2
            }
        	if (all<*allmin) *min=all;
        }
    }

Compiler output:
main.c: In function 'main':
main.c:11:20: error: invalid operands to binary & (have 'char *' and 'int')
   11 |         scanf("%d" &x[i]);
      |               ~~~~ ^~~~~
      |               |      |
      |               char * int
main.c:16:37: error: expected ';' before 'printf'
   16 |         dmin(x, &max, &min, &allmin)
      |                                     ^
      |                                     ;
   17 | 
   18 |         printf("%d", allmin);
      |         ~~~~~~                       
main.c: In function 'maxmin':
main.c:27:20: error: 'imax' undeclared (first use in this function); did you mean 'max'?
   27 |         for (i=0;i<imax;i++){
      |                    ^~~~
      |                    max
main.c:27:20: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'dmin':
main.c:38:22: error: 'i' undeclared (first use in this function)
   38 |                 for (i=0; i<imax; i++){
      |                      ^
main.c:38:29: error: 'imax' undeclared (first use in this function); did you mean 'max'?
   38 |                 for (i=0; i<imax; i++){
      |                             ^~~~
      |                             max
main.c:39:28: error: expected ';' before '}' token
   39 |             all+=(k-x[i])^2
      |                            ^
      |                            ;
   40 |             }
      |             ~
Language: C

#include <stdio.h>

void maxmin(int x[], int *max, int *min);
void dmin(int x[], int *max, int *min, int *allmin);

int main (void)
{
 	int i, imax, x[100], max, min, allmin;
  	scanf("%d\n", &imax);
  	for (i=0; i<imax; i++){
  	scanf("%d" &x[i]);
    }
  
   	maxmin(x, &max, &min);
  
  	dmin()
  
  	printf("%d", allmin);
  	return 0;
}

void maxmin(int x[], int *max, int *min)
{
	int i=0;
  	*min=100;
  	*max=0;
    for (i=0;i<imax;i++){
    	if (x[i]<*min) *min=x[i];
      	if (x[i]>*max) *max=x[i];
    }
}

void dmin(int x[], int *max, int *min, int *allmin)
{
	int k, all=0;
  	*allmin=10000;
    for (k=*min;k<=*max; k++){
      	for (i=0; i<imax; i++){
        all+=(k-x[i])^2
        }
    	if (all<*allmin) *min=all;
    }
}

Compiler output:
main.c: In function 'main':
main.c:11:20: error: invalid operands to binary & (have 'char *' and 'int')
   11 |         scanf("%d" &x[i]);
      |               ~~~~ ^~~~~
      |               |      |
      |               char * int
main.c:16:9: error: too few arguments to function 'dmin'
   16 |         dmin()
      |         ^~~~
main.c:4:6: note: declared here
    4 | void dmin(int x[], int *max, int *min, int *allmin);
      |      ^~~~
main.c:16:15: error: expected ';' before 'printf'
   16 |         dmin()
      |               ^
      |               ;
   17 | 
   18 |         printf("%d", allmin);
      |         ~~~~~~ 
main.c: In function 'maxmin':
main.c:27:16: error: 'imax' undeclared (first use in this function); did you mean 'max'?
   27 |     for (i=0;i<imax;i++){
      |                ^~~~
      |                max
main.c:27:16: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'dmin':
main.c:38:14: error: 'i' undeclared (first use in this function)
   38 |         for (i=0; i<imax; i++){
      |              ^
main.c:38:21: error: 'imax' undeclared (first use in this function); did you mean 'max'?
   38 |         for (i=0; i<imax; i++){
      |                     ^~~~
      |                     max
main.c:39:24: error: expected ';' before '}' token
   39 |         all+=(k-x[i])^2
      |                        ^
      |                        ;
   40 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  int n;
  vector<int> p(n);
  cin >> n;
  int mi = INT_MAX;
  int ma = INT_MIN;
  for(auto & i : p){
    cin >> i;
    mi = min(mi, i);
    ma = max(ma, i);
  }
  
  int total = INT_MAX;
  for(int range = mi; range <= ma; range++){
    int tmp = 0;
    for(auto &i : p)
      tmp += (i - range)*(i - range);
    total = min(total, min);
  }
  cout << total << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: no matching function for call to 'min(int&, <unresolved overloaded function type>)'
   22 |     total = min(total, min);
      |             ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:36: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to 'const int&'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |                         ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:22:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   22 |     total = min(total, min);
      |             ~~~^~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>

#define rep(i, c) for(int i = 0; i < (int)c; i++)

using namespace std;

typedef long long ll;

int main(void)
{
	int a;
	cin >> a;

	vector<int> v(a);
	rep(i, a) {
		cin >> v[i];
	}

	int L = v[0], R = x[0];

	rep(i, a) {
		L = min(L, v[i]);
		R = max(R, v[i]);
	}

	int ans = inf;

	for (int i = 0; i <= R; i++) {
		int cost = 0;
		rep(j, N) {
			cost += (v[j] - i) * (v[j] - i);
			ans = min(ans, cost);
		}
	}
	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:27: error: 'x' was not declared in this scope
   26 |         int L = v[0], R = x[0];
      |                           ^
a.cc:33:19: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   33 |         int ans = inf;
      |                   ^~~
      |                   ynf
a.cc:37:24: error: 'N' was not declared in this scope
   37 |                 rep(j, N) {
      |                        ^
a.cc:10:43: note: in definition of macro 'rep'
   10 | #define rep(i, c) for(int i = 0; i < (int)c; i++)
      |                                           ^
Language: C

#include <stdio.h>

//Compiler version gcc  6.3.0

int main()
{
  int k,s;
  int ans=9999999;
  scanf("%d",&k);
  int x[k];
  
  for(int i=0;i<k;i++){
    scanf("%d",&x[i])
    }
    
    int temp=0;
    
    for(int i =1;i<=100;i++){
      for(int j =0;j<k;j++){
        temp +=(x[j]-i)*(x[j]-i);
      }
      if(ans >temp)ans=temp;
    }
    

  
   printf("%d",ans);
  
  
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:22: error: expected ';' before '}' token
   13 |     scanf("%d",&x[i])
      |                      ^
      |                      ;
   14 |     }
      |     ~
Language: C

#include <stdio.h>

//Compiler version gcc  6.3.0

int main()
{
  int k,s;
  int ans=9999999;
  scanf("%d",&k);
  int x[k];
  
  for(int i=1;i<k;i++){
    scanf("%d",x[i])
    }
    
    int temp=0
    
    for(int i =0;i<=100;i++){
      for(int j =0;j<k;j++){
        temp +=(x[j]-i)*(x[j]-i);
      }
      if(ans >temp)ans=temp;
    }
    

  
   printf("%d",ans);
  
  
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:21: error: expected ';' before '}' token
   13 |     scanf("%d",x[i])
      |                     ^
      |                     ;
   14 |     }
      |     ~                
main.c:18:5: error: expected ',' or ';' before 'for'
   18 |     for(int i =0;i<=100;i++){
      |     ^~~
main.c:18:18: error: 'i' undeclared (first use in this function)
   18 |     for(int i =0;i<=100;i++){
      |                  ^
main.c:18:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:28: error: expected ';' before ')' token
   18 |     for(int i =0;i<=100;i++){
      |                            ^
      |                            ;
main.c:18:28: error: expected statement before ')' token
Language: C

#include<stdio.h>
int main(void){
  int i,j,n,x[i],y[100],min;
  scanf("%d\n",&n);
  for(i=0;i<=n;i++){
    scanf("%d ",&x[i]);
  }
  for(j=0;j<100;j++){
      for(i=0;i<=n;i++){
    	y[j]+=(x[i]-j)*(x[i]-j);
  	  }
  min=y[0];
  for(int k=1;k<100;k++){
    if(min>y[k]){
      min=y[k];
    }else{
      min=min;
    }
  }
  printf("%d\n",min);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:1: error: expected declaration or statement at end of input
   22 | }
      | ^
Language: C

#include<stdio.h>
int main(void){
  int i,j,n,x[i],y[100],min;
  scanf("%d\n",&n);
  for(i=0;i<=n;i++){
    scanf("%d ",&x[i]);
  }
  for(j=0;j<100;j++){
      for(i=0;i<=n;i++){
    	y[j]+=(x[i]-j)*(x[i]-j);
  	  }
  min=y[0];
  for(int k=1;k<100;k++){
    if(min>y[k]){
      min=y[k]
    }else{
      min=min;
    }
  }
  printf("%d\n",min);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:15: error: expected ';' before '}' token
   15 |       min=y[k]
      |               ^
      |               ;
   16 |     }else{
      |     ~          
main.c:22:1: error: expected declaration or statement at end of input
   22 | }
      | ^
Language: C

#include<stdio.h>
int main(void){
  int i,j,n,x[i],y[100],x;
  scanf("%d\n",&n);
  for(i=0;i<=n;i++){
    scanf("%d ",&x[i]);
  }
  for(j=0;j<100;j++){
      for(i=0;i<=n;i++){
    	y[j]+=(x[i]-j)*(x[i]-j);
  	  }
  min=y[0];
  for(int k=1;k<100;k++){
    if(min>y[k]){
      min=y[k]
    }else{
      min=min;
    }
  }
  printf("%d\n",min);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:25: error: conflicting types for 'x'; have 'int'
    3 |   int i,j,n,x[i],y[100],x;
      |                         ^
main.c:3:13: note: previous declaration of 'x' with type 'int[i]'
    3 |   int i,j,n,x[i],y[100],x;
      |             ^
main.c:12:3: error: 'min' undeclared (first use in this function); did you mean 'main'?
   12 |   min=y[0];
      |   ^~~
      |   main
main.c:12:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:15: error: expected ';' before '}' token
   15 |       min=y[k]
      |               ^
      |               ;
   16 |     }else{
      |     ~          
main.c:22:1: error: expected declaration or statement at end of input
   22 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<limits>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin >> N;
	vector<int>X(N);
	for (int i = 0; i < N; i++){
		cin >> X[i];
	}
	int ans = 1e9;
	for (int i = 1; i <= 100; i++){
		int tmp = 0;
		for (int j = 0; j < N; j++) {
			tmp += pow(X[j] - i, 2);
		}
		ans = min(ans, tmp);
	}

	cout << ans << endl;

	return 0;
}

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

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

int main(){
	int N, i, j, ans = 100000000;
	scanf("%d", &N);
	vector<int> x(N);
	for(i = 0; i < N; i++){
		scanf("%d", &X[i]);
	}
	for(i = 1; i < 100; i++){
		int now = 0;
		for(j = 0; j < N; j++){
			now += (X[j] - i) * (X[j] - i);
		}
		ans = min(ans, now);
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:30: error: 'X' was not declared in this scope
    9 |                 scanf("%d", &X[i]);
      |                              ^
a.cc:14:33: error: 'X' was not declared in this scope
   14 |                         now += (X[j] - i) * (X[j] - i);
      |                                 ^
Language: C++

int main(){ 
  int N;
  vector<int> X(100);
 
  cin >> N;
  for(int i=0; i<N; i++) cin >> X[i];
 
  int ans = 1e7;
  for(int P=1; P<=100; P++){
    int HP = 0;
    for(int i=0; i<N; i++){
      HP += (X[i]-P)*(X[i]-P);
    }
    ans = min(ans, HP);
  }
 
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'vector' was not declared in this scope
    3 |   vector<int> X(100);
      |   ^~~~~~
a.cc:3:10: error: expected primary-expression before 'int'
    3 |   vector<int> X(100);
      |          ^~~
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> N;
      |   ^~~
a.cc:6:33: error: 'X' was not declared in this scope
    6 |   for(int i=0; i<N; i++) cin >> X[i];
      |                                 ^
a.cc:12:14: error: 'X' was not declared in this scope
   12 |       HP += (X[i]-P)*(X[i]-P);
      |              ^
a.cc:14:11: error: 'min' was not declared in this scope; did you mean 'main'?
   14 |     ans = min(ans, HP);
      |           ^~~
      |           main
a.cc:17:3: error: 'cout' was not declared in this scope
   17 |   cout << ans << endl;
      |   ^~~~
a.cc:17:18: error: 'endl' was not declared in this scope
   17 |   cout << ans << endl;
      |                  ^~~~
Language: Java

import java.util.*;

public class Main{
  public static void main(String...args){
    Scanner s = new Scanner(System.in);
    int n = s.nextInt(); int[] x = new int[n];
    int max = 0;
    for(int i = 0;i < n;i++){
      x[i] = s.nextInt();
      if(i == 0 || x[i] > min){ min = x[i]; }
      if(i == 0 || x[i] < max){ max = x[i]; }
    }
    int minv = 0;
    for(int i = min;i < max;i++){
      int tmp = 0;
      for(int j = 0;j < n;j++){
        tmp+=(x[j]-min)*(x[j]-min);
      }
      if(i == 0 || tmp < minv){minv = tmp;}
    }
    System.out.println(minv);
  }
}
    

Compiler output:
Main.java:10: error: cannot find symbol
      if(i == 0 || x[i] > min){ min = x[i]; }
                          ^
  symbol:   variable min
  location: class Main
Main.java:10: error: cannot find symbol
      if(i == 0 || x[i] > min){ min = x[i]; }
                                ^
  symbol:   variable min
  location: class Main
Main.java:14: error: cannot find symbol
    for(int i = min;i < max;i++){
                ^
  symbol:   variable min
  location: class Main
Main.java:17: error: cannot find symbol
        tmp+=(x[j]-min)*(x[j]-min);
                   ^
  symbol:   variable min
  location: class Main
Main.java:17: error: cannot find symbol
        tmp+=(x[j]-min)*(x[j]-min);
                              ^
  symbol:   variable min
  location: class Main
5 errors
Language: C++

#include<iostream>
#include<cassert>
#include<algorithm>
#include<functional>
#include<vector>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> X(N);
	int maxX = 0;
	for(int i = 0;i < N; i++) {
		cin >> X[i];
		maxX = max(maxX, X[i]);
	}

	int sum;
	int ans = 2147483647;
    cout << INT_MAX << endl;
	for(int p=0; p< maxX; p++) {
		sum = 0;
		for(int i=0; i<N; i++) {
			sum += (X[i]-p)*(X[i]-p);
		}
		ans = min(ans, sum);
	}

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'INT_MAX' was not declared in this scope
   20 |     cout << INT_MAX << endl;
      |             ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<functional>
  +++ |+#include <climits>
    5 | #include<vector>
Language: C++

#include<iostream>
#include<cassert>
#include<algorithm>
#include<functional>
#include<vector>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> X(N);
	int maxX = 0;
	for(int i = 0;i < N; i++) {
		cin >> X[i];
		maxX = max(maxX, X[i]);
	}

	int sum;
	int ans = INT_MAX;
	for(int p=0; p< maxX; p++) {
		sum = 0;
		for(int i=0; i<N; i++) {
			sum += (X[i]-p)*(X[i]-p);
		}
		ans = min(ans, sum);
	}

	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: 'INT_MAX' was not declared in this scope
   19 |         int ans = INT_MAX;
      |                   ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<functional>
  +++ |+#include <climits>
    5 | #include<vector>
Language: C++

#include <iostream>

using namespace std;

int main(){
	int ans = 100000000, n;
  	cin >> n;
  	int a[n];
  
  for(int i = 0; i < n; i ++) cin >> a[i];
  
  sort(a, a + n);
  
  for(int i = a[0]; i <= a[n - 1]; i ++){
  	int tmp = 0;
    for(int j = 0; j < n; j ++)
      tmp += (i - a[j]) * (i - a[j]);
    if(ans < tmp) ans = tmp; 
  }
  cout << ans << endl;
}

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

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

int main()
{
  int n,sum=0;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  sort(arr,arr+n);
  int k=(arr[0]+arr[n-1])/2;
  for(int i=0;i<n;i++)
    sum+=(arr[i] - k)*(arr[i] - k);
  cout<<sum<<endl;
  
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,i,j,sum,ans,en;
  cin>>N;
  int l=1001001
  vector<int>X(N);
  for(i=0;i<N;i++)
    cin>>X[i];
  for(i=0;i<N;i++){
    sum=0;
    for(j=1;j<=N;j++){
      en=(X[i]-j)*(X[i]-j);
      ans=min(ans,l);
    }
    sum+=ans;
  }
  cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'vector'
    7 |   vector<int>X(N);
      |   ^~~~~~
a.cc:9:10: error: 'X' was not declared in this scope
    9 |     cin>>X[i];
      |          ^
a.cc:13:11: error: 'X' was not declared in this scope
   13 |       en=(X[i]-j)*(X[i]-j);
      |           ^
Language: C++

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

int main(){
  int n, x[100],ans=10000000;
  cin >>n;
  for (int i=0;i<n;i++){
    cin >>x[i];
}
for (int p=0;p<101;p++){
int v=0;
for (auto i:x){
v+=(x-p)*(x-p);
}
ans = min(ans,v);
}
cout <<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: invalid operands of types 'int*' and 'int*' to binary 'operator*'
   13 | v+=(x-p)*(x-p);
      |    ~~~~~^~~~~~
      |      |     |
      |      int*  int*
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	int n,k,i,j;
	cin>>n;
	int sum=0;
	vector<int>v;
	for(i=0;i<n;i++)
	{
		cin>>k;
		v.push_back(k);
		sum+=k;
	}
	sum/=n;
	int a1=0,a2=0;
	for(i=0;i<n;i++)
	{
		a1+=(abs(v[i]-sum))*(abs(v[i]-sum));
		a2+=(abs(v[i]-sum-1))*(abs(v[i]-sum-1));
	}
	int ans=min(a1,a2);
	cout<<ans<<endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'vector' was not declared in this scope
   12 |         vector<int>v;
      |         ^~~~~~
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 | 
a.cc:12:16: error: expected primary-expression before 'int'
   12 |         vector<int>v;
      |                ^~~
a.cc:16:17: error: 'v' was not declared in this scope
   16 |                 v.push_back(k);
      |                 ^
a.cc:23:26: error: 'v' was not declared in this scope
   23 |                 a1+=(abs(v[i]-sum))*(abs(v[i]-sum));
      |                          ^
Language: Java

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        scan.nextLine();

        List<Integer> values = Arrays.asList(scan.nextLine().split(" ")).stream().map(i->new Integer(i)).collect(Collectors.toList());
        Map<Integer,Integer> searchResult = new HashMap<>();
        int i;
        for(i=0;i<values.get(values.size()-1);i++){
            searchResult.put(calc(values,i),i);
        }
        // キーでソートする
        Object[] mapkey = searchResult.keySet().toArray();
        Arrays.sort(mapkey);
        for (Integer nKey : searchResult.keySet()){
            System.out.println(searchResult.get(nKey));
            break;
        }
    }

    public static int calc(List<Integer> list,Integer point){
        Integer result = 0;
        int i;
        for(i=0;i<list.size();i++){
            result += ((list.get(i) - point) * (list.get(i) - point));
        }
        return result;
    }
}


Compiler output:
Main.java:21: error: cannot find symbol
    public static int calc(List<Integer> list,Integer point){
                           ^
  symbol:   class List
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner scan = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner scan = new Scanner(System.in);
                           ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
        List<Integer> values = Arrays.asList(scan.nextLine().split(" ")).stream().map(i->new Integer(i)).collect(Collectors.toList());
        ^
  symbol:   class List
  location: class Main
Main.java:6: error: cannot find symbol
        List<Integer> values = Arrays.asList(scan.nextLine().split(" ")).stream().map(i->new Integer(i)).collect(Collectors.toList());
                               ^
  symbol:   variable Arrays
  location: class Main
Main.java:6: error: cannot find symbol
        List<Integer> values = Arrays.asList(scan.nextLine().split(" ")).stream().map(i->new Integer(i)).collect(Collectors.toList());
                                                                                                                 ^
  symbol:   variable Collectors
  location: class Main
Main.java:7: error: cannot find symbol
        Map<Integer,Integer> searchResult = new HashMap<>();
        ^
  symbol:   class Map
  location: class Main
Main.java:7: error: cannot find symbol
        Map<Integer,Integer> searchResult = new HashMap<>();
                                                ^
  symbol:   class HashMap
  location: class Main
Main.java:14: error: cannot find symbol
        Arrays.sort(mapkey);
        ^
  symbol:   variable Arrays
  location: class Main
9 errors
Language: Java

import java.util.*;
         
        public class Main {
        	public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                scan.nextLine();
                
                List<Integer> values = Arrays.sort(Arrays.of(scan.nextLine().split(" ")).map(i->new Integer(i)));
        		Map<Integer,Integer> searchResult = new HashMap()<>;
                int i = 0;
                for(i;i<values.get(values.size-1);i++){
                  searchResult.put(calc(list,i),i);
                }
                searchResult
                        // キーでソートする
        		Object[] mapkey = mMap.keySet().toArray();
        		Arrays.sort(mapkey);
              	for (Integer nKey : mMap.keySet()){
            		System.out.println(mMap.get(nKey));
                    break;
        		}
            }
          
          	public static int calc(List<Integer> list,Integer point){
              Integer result = 0;
              int i = 0;
              for(i;i<list.size;i++){
                result += ((list.get(i) - point) * (list.get(i) - point));
              }
              return result;
            }
        }

Compiler output:
Main.java:9: error: illegal start of expression
        		Map<Integer,Integer> searchResult = new HashMap()<>;
        		                                                  ^
Main.java:9: error: illegal start of expression
        		Map<Integer,Integer> searchResult = new HashMap()<>;
        		                                                   ^
Main.java:11: error: not a statement
                for(i;i<values.get(values.size-1);i++){
                    ^
Main.java:16: error: ';' expected
        		Object[] mapkey = mMap.keySet().toArray();
        		        ^
Main.java:27: error: not a statement
              for(i;i<list.size;i++){
                  ^
5 errors