criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.*;
public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    // Arrays.sort(array, Comparator.reverseOrder());
    long [] a = new long[N];
    for(int i = 0;i<N;i++){
      a[i] = sc.nextLong();
    }
    Arrays.sort(array, Comparator.reverseOrder());
    long sum = a[0];
    for(int i = 1;i<N/2;i++){
      sum += a[i]*2;
    }
    System.out.println(sum-min);
  }
}

Compiler output:
Main.java:7: error: incompatible types: possible lossy conversion from long to int
    long [] a = new long[N];
                         ^
Main.java:11: error: cannot find symbol
    Arrays.sort(array, Comparator.reverseOrder());
                ^
  symbol:   variable array
  location: class Main
Main.java:16: error: cannot find symbol
    System.out.println(sum-min);
                           ^
  symbol:   variable min
  location: class Main
3 errors
Language: C++

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


ll main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    vector<ll> v;
    for(ll i=0;i<t;i++){
        ll a;
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end(),greater<int>());
    ll comfort=0;
    for(ll i=0;i<v.size();i++){
        if(i==1) comfort += v[i-1];
        if(i>=2) comfort += min(v[i-1],v[i-2]);
    }

    cout<<comfort;
    return 0;
}

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

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

int main(){
  int N,min,a,b,x,y;
  int64_t sum=0;
  cin >> N;
  cin >> a;
  sum += a;
  cin >> b;
  if(a<b)
  swap(a,b);
  for(int i=0;i<N-2;i++){
    cin >> x;
    sum += min(a,b);
    if(x>=b){
      if(x>a){
        b=a;
        a=x;
      }else{
        b=x;
      }
    }
  }
  cout << sum << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: 'min' cannot be used as a function
   15 |     sum += min(a,b);
      |            ~~~^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,last : a+n);
	reverse(a,last : a+n);
	if(n==1)
	{
		cout<<0<<endl;
		return;
	}
	if(n==2)
	{
		cout<<a[0]<<endl;
		return;
	}
	int sum= a[0];
	int left = n-2;
	int last;
	for(int i=1;i<n;i++)
	{
		sum=sum+a[i]*2;
		last = a[i];
		left = left-2;
		if(left<=0)
		{
			break;
		}
	}
	if((n-2)%2!=0)
	{
		cout<<sum-last<<endl;
	}
	else
	{
		cout<<sum<<endl;
		}	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: found ':' in nested-name-specifier, expected '::'
   12 |         sort(a,last : a+n);
      |                     ^
      |                     ::
a.cc:12:16: error: 'last' has not been declared
   12 |         sort(a,last : a+n);
      |                ^~~~
a.cc:13:24: error: found ':' in nested-name-specifier, expected '::'
   13 |         reverse(a,last : a+n);
      |                        ^
      |                        ::
a.cc:13:19: error: 'last' has not been declared
   13 |         reverse(a,last : a+n);
      |                   ^~~~
a.cc:17:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   17 |                 return;
      |                 ^~~~~~
a.cc:22:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   22 |                 return;
      |                 ^~~~~~
Language: C++

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

int main(){
	ll n;
	cin >> n;
	
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	
	ll ans = 0;
	if (n%2 == 0) {
		ll ne = n/2;
		ans += a[0];
		rep(i, nn-1) ans += a[i+1]*2;
	}
	if (n%2 == 1) {
		ll no = (n-1)/2;
		ans += a[0];
		rep(i, no) ans += a[i+1]*2;
		ans += a[no+2];
	}
	
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: 'nn' was not declared in this scope; did you mean 'ne'?
   19 |                 rep(i, nn-1) ans += a[i+1]*2;
      |                        ^~
a.cc:3:39: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < n; i++)
      |                                       ^
Language: C++

#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;

void quicksort(int low, int high,int *a)
{
  if(low<high){
    int mid=(low+high)/2;
    int x=a[mid];
    int i=low;
    int j=high;
    while(i<=j){
      while(a[i]<x)i=i+1;
      while(a[j]>x)j=j-1;
      if(i<=j) swap(a[i++],a[j--]);
    }
    quicksort(low,j,a);
    quicksort(i,high,a);
  }
}

int main()
{
  int n;
  cin >> n;
  vector<long long> a(n);
  for(int i=0; i<n; i++)
    cin >> a[i];
  quicksort(0,n-1,&a[0]);
  
  long long ans=a[n-1];
  int cnt=3;
  int i=n-1;
  while(cnt<n){
    i--;
    cnt+=2;
    ans+=a[i]*2;
  }
  if(n%2==1)ans+=a[i-1];

  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:19: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type*' {aka 'long long int*'} to 'int*'
   30 |   quicksort(0,n-1,&a[0]);
a.cc:6:39: note:   initializing argument 3 of 'void quicksort(int, int, int*)'
    6 | void quicksort(int low, int high,int *a)
      |                                  ~~~~~^
Language: C++

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int min=INT_MAX;
    long long sum=0;
    for(int i=0;i<n;i++)
    {
        int arr;
        cin>>arr;
        if(arr<min)
            min=arr;
        sum=(long long)(sum+arr);
    }
    sum-=min;
    cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'INT_MAX' was not declared in this scope
    9 |     int min=INT_MAX;
      |             ^~~~~~~
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 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7;//998244353 ;

int main(){
  int n;
  cin >> n;
  ll a[n];
  rep(i,n)cin >> a[i];
  sort(a,a+n,greater<ll>());
  ll ans=0;
  rep(i,n-1{
    ans+=a[i];
  }
  cout << ans << endl;
return 0;}

Compiler output:
a.cc:23:11: error: unterminated argument list invoking macro "rep"
   23 | return 0;}
      |           ^
a.cc: In function 'int main()':
a.cc:19:3: error: 'rep' was not declared in this scope
   19 |   rep(i,n-1{
      |   ^~~
a.cc:19:6: error: expected '}' at end of input
   19 |   rep(i,n-1{
      |      ^
a.cc:12:11: note: to match this '{'
   12 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define rep(i,n) for (ll i=0;i<(n);i++)
typedef long long ll;
bool aaa[11111111];
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 
int main() {
ll n,ans=0,mini=10000000000,mini2=0,k;
cin>>n;
rep(i,n){
  cin>>k;
  ans+=k;
  //if(i>1&&mini2>k)mini2=max(k,mini);
  //if(i==1)mini2=max(mini,k);
  mini=min(mini,k);
  
}
else cout<<ans-mini<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:1: error: 'else' without a previous 'if'
   33 | else cout<<ans-mini<<endl;
      | ^~~~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <boost/foreach.hpp>
#include <vector>
using namespace std;

int main() {
  int N, K;
  int64_t ans=0;
  cin >> N;
  vector<int64_t> A(N);
  for (int64_t i=0; i<N; i++) {
    cin >> A.at(i);
  }
  sort(A, A+N);
  if (N%2==0) {
    K = (N-2)/2;
    ans = A.at(N);
    for (int64_t j=0; j<K; j++) {
      ans = ans + 2*A.at(N-(j+1));
    }
    cout << ans << endl;
  }
  else {
    K = (N-3)/2;
    ans = A.at(N) + A.at(N-K-1);
    for (int64_t l=0; l<K; l++) {
      ans = ans + 2*A.at(N-(l+1));
    }
    cout << ans << endl;
  }
}


Compiler output:
a.cc:4:10: fatal error: boost/foreach.hpp: No such file or directory
    4 | #include <boost/foreach.hpp>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<conio.h>
main()
{
    int n,sum=0,newn,i;

    scanf("%d",&n);

    for(i=1;i<=n;i++)
    {
        scanf("%d",&newn);
        sum=sum+newn;
    }
    printf("%d",sum-1);
    getch();
}


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

#include <bits/stdc++.h>
#define pb push_back
#define vii vector<int>
#define task "COLORING"
#define pll pair<ll, ll>
#define pii pair< ll, pair< ll, ll > >
#define fi first
#define se second

using ll = long long;
using ld = long double;
using ull = unsigned long long;
const int mod = 1e9 + 7;
using namespace std;
const int N =  3e5 + 5;
ll m, n, k, t, ans, T, a[N];
pll b[N];

char s[10][10];
ll hang(ll i)
{

}
inline void sol()
{
    /*
	cin >> n >> m >> k;
	for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
        {
            cin >> s[i][j];
            if(s[i][j] == '#')++tong;
        }
    }
    for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
        {
            if(s[i][j] == '#')++a[i];
        }
    }
    for(int i = 1; i <= m; i ++)
    {
        for(int j = 1; j <= n; j ++)
        {
            if(s[j][i] == '#')++b[i];
        }
    }
    for(int i = 0; i <= n; i ++)
    {
        for(int j = 0; j <= m; j ++)
        {
            ans = hang(1, i) + cot(1, j);
            if(ans + k == tong)++T;
        }
    }
    */
    cin >> n;
    for(int i = 1; i <= n; i ++)cin >> a[i];
    sort(a + 1, a+1+n, greater<ll>());
    priority_queue<ll> pr;
    pr.push(a[1]);
    pr.push(a[2]);
    ans = max(a[1], a[2]);
    /cout << ans <<" ";
    for(int i = 3; i <= n; i ++)
    {

        k = pr.top();
        pr.pop();
        ans += pr.top();
        pr.push(k);
        pr.push(a[i]);
    }

    cout << ans;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(fopen(task".INP", "r"))
    {
		freopen(task".INP","r",stdin);
		freopen(task".OUT","w",stdout);
    }
    sol();

}


Compiler output:
a.cc: In function 'll hang(ll)':
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
a.cc: In function 'void sol()':
a.cc:66:5: error: expected primary-expression before '/' token
   66 |     /cout << ans <<" ";
      |     ^
Language: C

#include<stdio.h>

int main(void){
int N,a[32];
int i,j;
int temp;
sum =0;


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

for (i=0; i<N; ++i) { //a[]が大きい順
  for (j=i+1; j<N; ++j) {
    if (a[i] < a[j]) {
      tmp =  a[i];
      a[i] = a[j];
      a[j] = tmp;
    }
  }
}

for(i=1;i<N-1;i++){
sum+=a[i];
}
printf("%d",sum);
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:1: error: 'sum' undeclared (first use in this function)
    7 | sum =0;
      | ^~~
main.c:7:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:7: error: 'tmp' undeclared (first use in this function); did you mean 'temp'?
   18 |       tmp =  a[i];
      |       ^~~
      |       temp
Language: C

#include<stdio.h>

int main(void){
int N,a[32];
int i,j;
int temp;
sum =0;


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

for (i=0; i<N; ++i) { //a[]が大きい順
  for (j=i+1; j<N; ++j) {
    if (a[i] < a[j]) {
      tmp =  a[i];
      a[i] = a[j];
      a[j] = tmp;
    }
  }
}

for(i=1;i<N-1;i++){
sum+=a[i];
}
printf("%d",sum);
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:1: error: 'sum' undeclared (first use in this function)
    7 | sum =0;
      | ^~~
main.c:7:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:11: error: invalid operands to binary & (have 'char *' and 'int')
   10 | scanf("%d"&N);
      |       ~~~~^
      |       |
      |       char *
main.c:18:7: error: 'tmp' undeclared (first use in this function); did you mean 'temp'?
   18 |       tmp =  a[i];
      |       ^~~
      |       temp
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const int maxn = 200005;

int a[maxn];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	ll ans=a[n-1];
	for(int i=n-2,j=2;j<n;i--,j++){
		if(j%2==1)i++;
		ans+=a[i];
	}
	cout<<ans<<endl;
	return 0;
}

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

#include<bits/stdc++.h>

using namespace std;

void test()
{
    int n;
    cin>>n;

    vector<int>vec;

    while(n--)
    {
        int x;
        cin>>x;

        vec.push_back({x});
    }

    sort(vec.begin(),vec.end());

    //reverse(vec.begin(),vec.end());

    long long int res=0;

    int x=vec.size();

    res+=vec[x-1];

    for(int i=x-3;i>=0;i--)
    {
        res+=min(vec[i+1],vec[i7
1 1 1 1 1 1 17
1 1 1 1 1 1 1+2]);
    }

    cout<<res<<endl;

}

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

    test();

    return 0;
}



Compiler output:
a.cc: In function 'void test()':
a.cc:32:31: error: 'i7' was not declared in this scope; did you mean 'i'?
   32 |         res+=min(vec[i+1],vec[i7
      |                               ^~
      |                               i
a.cc:32:33: error: expected ']' before numeric constant
   32 |         res+=min(vec[i+1],vec[i7
      |                                 ^
      |                                 ]
   33 | 1 1 1 1 1 1 17
      | ~
Language: C++

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

using namespace std;

#define int long long

const int N = 2e5 + 10;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);    
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  int ans = a[0];
  for (int i = 2, j = 1; i < n; ++i) {
    ans += a[j];
    j += i & 1;
  }
  cout << ans;
  return 0;
}

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

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

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    scanf("%d", &a[i]);

  sort(a.begin(), a.end());
  long long s = 0;
  int t = n - 1;
  for (int i = n - 1; i >= 0; i--) {
    if (i + 1 < n) {
      if (t > 2) {
        s += a[i] * 2;
        t -= 2;
      }
      else {
        s += t * a[i];
        break;
      }
    }
    else {
      t--;
      s += a[i];
    }
  }

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

  return 0;
}

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.begin(), a.end());
      |   ^~~~
      |   short
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define vii vector<int>
#define task "COLORING"
#define pll pair<ll, ll>
#define pii pair< ll, pair< ll, ll > >
#define fi first
#define se second

using ll = long long;
using ld = long double;
using ull = unsigned long long;
const int mod = 1e9 + 7;
using namespace std;
const int N =  3e5 + 5;
ll m, n, k, t, ans, T, a[10], b[10];
pll b[N];

char s[10][10];
ll hang(ll i)
{

}
inline void sol()
{
    /*
	cin >> n >> m >> k;
	for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
        {
            cin >> s[i][j];
            if(s[i][j] == '#')++tong;
        }
    }
    for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
        {
            if(s[i][j] == '#')++a[i];
        }
    }
    for(int i = 1; i <= m; i ++)
    {
        for(int j = 1; j <= n; j ++)
        {
            if(s[j][i] == '#')++b[i];
        }
    }
    for(int i = 0; i <= n; i ++)
    {
        for(int j = 0; j <= m; j ++)
        {
            ans = hang(1, i) + cot(1, j);
            if(ans + k == tong)++T;
        }
    }
    */
    cin >> n;
    for(int i = 1; i <= n; i ++)cin >> a[i];
    for(int i = 1; i <= n; i ++)
    {
        ans += a[i];
    }
    sort(a+1, a+1+n);
    cout << ans - a[1];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(fopen(task".INP", "r"))
    {
		freopen(task".INP","r",stdin);
		freopen(task".OUT","w",stdout);
    }
    sol();

}


Compiler output:
a.cc:17:5: error: conflicting declaration 'std::pair<long long int, long long int> b [300005]'
   17 | pll b[N];
      |     ^
a.cc:16:31: note: previous declaration as 'll b [10]'
   16 | ll m, n, k, t, ans, T, a[10], b[10];
      |                               ^
a.cc: In function 'll hang(ll)':
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define vii vector<int>
#define task "COLORING"
#define pll pair<ll, ll>
#define pii pair< ll, pair< ll, ll > >
#define fi first
#define se second

using ll = long long;
using ld = long double;
using ull = unsigned long long;
const int mod = 1e9 + 7;
using namespace std;
const int N =  3e5 + 5;
ll m, n, k, t, ans, T, a[10], b[10];
pll b[N];

char s[10][10];
ll hang(ll i)
{

}
inline void sol()
{
    /*
	cin >> n >> m >> k;
	for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
        {
            cin >> s[i][j];
            if(s[i][j] == '#')++tong;
        }
    }
    for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
        {
            if(s[i][j] == '#')++a[i];
        }
    }
    for(int i = 1; i <= m; i ++)
    {
        for(int j = 1; j <= n; j ++)
        {
            if(s[j][i] == '#')++b[i];
        }
    }
    for(int i = 0; i <= n; i ++)
    {
        for(int j = 0; j <= m; j ++)
        {
            ans = hang(1, i) + cot(1, j);
            if(ans + k == tong)++T;
        }
    }
    */
    cin >> n;
    for(int i = 1; i <= n; i ++)
    {
        ans += a[i];
    }
    sort(a+1, a+1+n);
    cout << ans - a[1];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(fopen(task".INP", "r"))
    {
		freopen(task".INP","r",stdin);
		freopen(task".OUT","w",stdout);
    }
    sol();

}


Compiler output:
a.cc:17:5: error: conflicting declaration 'std::pair<long long int, long long int> b [300005]'
   17 | pll b[N];
      |     ^
a.cc:16:31: note: previous declaration as 'll b [10]'
   16 | ll m, n, k, t, ans, T, a[10], b[10];
      |                               ^
a.cc: In function 'll hang(ll)':
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
Language: Java

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;


public class Solution {
	public static class FastReader {
			BufferedReader br;
			StringTokenizer root;
			
	 
			public FastReader() {
				br = new BufferedReader(new InputStreamReader(System.in));
			}
	 
			String next() {
				while (root == null || !root.hasMoreTokens()) {
					try {
						root = new StringTokenizer(br.readLine());
					} catch (Exception addd) {
						addd.printStackTrace();
					}
				}
				return root.nextToken();
			}
	 
			int nextInt() {
				return Integer.parseInt(next());
			}
	 
			double nextDouble() {
				return Double.parseDouble(next());
			}
	 
			long nextLong() {
				return Long.parseLong(next());
			}
	 
			String nextLine() {
				String str = "";
				try {
					str = br.readLine();
				} catch (Exception addd) {
					addd.printStackTrace();
				}
				return str;
			}
		}
	 
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static FastReader sc = new FastReader();
 
	static long mod = (int) (1000000000),MAX=(int)(1e5+10);
	
	public static void main(String[] args) throws IOException{
		
		int n = sc.nextInt();
		long[] a = new long[n];
		for(int i=0;i<n;++i) a[i] = sc.nextLong();
		sort(a);
		long ans = a[0];
		int k = n-2;
		for(int i=1;i<n && k > 0;++i) {
			ans+=a[i]; --k;
			if(k > 0) {
				ans+=a[i];
				--k;
			}
			
		}
		out.print(ans);
	out.close();
	}
	
	static void sort(long[] A) {
        PriorityQueue<Long> pq = new PriorityQueue<>();
        int i = 0;
        for (i = 0; i < A.length; i++)
            pq.add(-1*A[i]);
        for (i = 0; i < A.length; i++)
            A[i] = -1*pq.poll();
    }
	
}





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

#include <bits/stdc++.h>
#define pb push_back
#define vii vector<int>
#define task "COLORING"
#define pll pair<ll, ll>
#define pii pair< ll, pair< ll, ll > >
#define fi first
#define se second

using ll = long long;
using ld = long double;
using ull = unsigned long long;
const int mod = 1e9 + 7;
using namespace std;
const int N =  3e5 + 5;
ll m, n, k, t, ans, T, a[10], b[10];
pll b[N];

char s[10][10];
ll hang(ll i)
{

}
inline void sol()
{
    /*
	cin >> n >> m >> k;
	for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
        {
            cin >> s[i][j];
            if(s[i][j] == '#')++tong;
        }
    }
    for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= m; j ++)
        {
            if(s[i][j] == '#')++a[i];
        }
    }
    for(int i = 1; i <= m; i ++)
    {
        for(int j = 1; j <= n; j ++)
        {
            if(s[j][i] == '#')++b[i];
        }
    }
    for(int i = 0; i <= n; i ++)
    {
        for(int j = 0; j <= m; j ++)
        {
            ans = hang(1, i) + cot(1, j);
            if(ans + k == tong)++T;
        }
    }
    */
    cin >> n;
    for(int i = 1; i <= n; i ++)
    {
        tong += a[i];
    }
    sort(a+1, a+1+n);
    cout << tong - a[1];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(fopen(task".INP", "r"))
    {
		freopen(task".INP","r",stdin);
		freopen(task".OUT","w",stdout);
    }
    sol();

}


Compiler output:
a.cc:17:5: error: conflicting declaration 'std::pair<long long int, long long int> b [300005]'
   17 | pll b[N];
      |     ^
a.cc:16:31: note: previous declaration as 'll b [10]'
   16 | ll m, n, k, t, ans, T, a[10], b[10];
      |                               ^
a.cc: In function 'll hang(ll)':
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
a.cc: In function 'void sol()':
a.cc:62:9: error: 'tong' was not declared in this scope; did you mean 'long'?
   62 |         tong += a[i];
      |         ^~~~
      |         long
a.cc:65:13: error: 'tong' was not declared in this scope; did you mean 'long'?
   65 |     cout << tong - a[1];
      |             ^~~~
      |             long
Language: C++


#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <functional>
#include <numeric>

using namespace std;

int t;

int main()
{
	cin >> t;
	int comfort;
	int f;
	vector<int> friendliness;
	for (int i = 0; i < t; i++)
	{
		cin >> f;
		friendliness.push_back(f);
	}
	sort(friendliness.begin(), friendliness.end(), greater<int>());
	if (t == 1) {
		cout << 0;
	}
	else {
		int j = 2;
		int long long smm = friendliness[0];
		while (j < t) {
			smm+= friendliness[floor(j/2.0)];
			j += 1;
		}
		cout << smm;
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:44: error: 'floor' was not declared in this scope
   33 |                         smm+= friendliness[floor(j/2.0)];
      |                                            ^~~~~
Language: C++

#include <bits/stdc++.h>
#define lli long long int
using namespace std;



int main(){
    int n;
    cin>>n;
    lli arr[n];
    for(int i=0; i<n; ++i){
        cin>>arr[i];
    }
    sort(arr, arr + n, greater<int>());
    lli res=0;
    unordered_map<lli, int> ump;
    for(int i=0; i<n; ++i){
        if(ump.find(arr[i])!=ump.end()) ump++;
        else ump.insert({arr[i],1});
    }
    for(auto it = ump.begin(); it!= ump.end(); ++it){
        if(it!=ump.begin()) it->second*=2;
        if(res>=n) break;
        res+=it->second;
    }
    cout<<res;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:44: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   18 |         if(ump.find(arr[i])!=ump.end()) ump++;
      |                                         ~~~^~
Language: C

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

int n;
vector<lint> a;

int main() {
    cin >> n;
    a.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end(), greater<lint>());
    lint ans = a[0];
    n -= 2;
    for (int i = 0; i < n / 2; i++) {
        ans += a[i + 1] * 2;
    }
    if (n % 2 != 0) {
        ans += a[n / 2 + 1];
    }
    cout << ans << endl;
}

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

#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define mset(a,val) memset(a,val,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main()
{
    lln;
    cin>>n;
    lla[n];
    rep(i,0,n)
    cin>>a[i];
    sort(a,a+n,greater<ll>());
    llres=0;
    rep(i,1,n)
    {
        if(i==1)
        {
            res+=a[i-1];
        }
        else
        {
            res+=min(a[i-1],a[i-2]);
        }
    }
    cout<<res<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'lln' was not declared in this scope; did you mean 'll'?
   16 |     lln;
      |     ^~~
      |     ll
a.cc:17:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   17 |     cin>>n;
      |          ^
      |          yn
a.cc:18:5: error: 'lla' was not declared in this scope; did you mean 'll'?
   18 |     lla[n];
      |     ^~~
      |     ll
a.cc:20:10: error: 'a' was not declared in this scope
   20 |     cin>>a[i];
      |          ^
a.cc:21:10: error: 'a' was not declared in this scope
   21 |     sort(a,a+n,greater<ll>());
      |          ^
a.cc:22:5: error: 'llres' was not declared in this scope
   22 |     llres=0;
      |     ^~~~~
a.cc:27:13: error: 'res' was not declared in this scope; did you mean 'rep'?
   27 |             res+=a[i-1];
      |             ^~~
      |             rep
a.cc:31:13: error: 'res' was not declared in this scope; did you mean 'rep'?
   31 |             res+=min(a[i-1],a[i-2]);
      |             ^~~
      |             rep
a.cc:34:11: error: 'res' was not declared in this scope; did you mean 'rep'?
   34 |     cout<<res<<endl;
      |           ^~~
      |           rep
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define F first
#define S second
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define two ios_base::sync_with_stdio(0)
#define powerofn cin.tie(0)
using namespace std;

ll const MOD = 998244353;

int const max_n = 3 * 1e5 + 10;

void yes(){
    cout<<"YES"<<'\n';
}

void no(){
    cout<<"NO"<<'\n';
}

ll fact(int n){
    ll ans = 1;
    for(int i=2;i<=n;i++){
        ans = (ans*i)%MOD;
    }

    return ans;
}

ll powM(int n, int x){
    if(x==0){
        return 1;
    }
    if(x==1){
        return n%MOD;
    }

    if(x%2==0){
        ll a = powM(n,x/2);
        return (a*a)%MOD;
    }else{
        return (n*powM(n,x-1))%MOD;
    }
}

ll C(int n, int k){
    return (fact(n) * powM((fact(k)*fact(n-k))%MOD,MOD-2))%MOD;
}

ll A(int n, int k){
    return (fact(n) * powM(fact(n-k)%MOD,MOD-2))%MOD;
}

void add_self(int &a, int b){
    a += b;
    if(a>=MOD){
        a-=MOD;
    }
}

void sub_self(int &a, int b){
    a -= b;
    if(a<0){
        a+=MOD;
    }
}


struct segtree {

    vl tree;
    int size;

    void init(int n){
        size = 1;
        while(size < n) size*=2;
        tree.assign(2*size-1,0);
    }
    void build(vi &a,int x, int lx, int rx){
        if(rx-lx == 1){
            if(lx<a.size())
                tree[x] = a[lx];
        }else{
            int m = (lx+rx)/2;
            build(a,2*x+1,lx,m);
            build(a,2*x+2,m,rx);
            tree[x] = tree[2*x+1]+tree[2*x+2];
        }
    }

    void build(vi &a){
        init(a.size());
        build(a,0,0,size);
    }

    void set(int i, int v, int x, int lx, int rx){
        if(rx-lx==1){
            tree[x] = v;
            return;
        }
        int m = (lx+rx)/2;
        if(i<m){
            set(i,v,2*x+1,lx,m);
        }else{
            set(i,v,2*x+2,m,rx);
        }
        tree[x] = tree[2*x+1] + tree[2*x+2];
    }

    void set(int i, int v){
        set(i,v,0,0,size);
    }

    ll sum(int l, int r, int x, int lx, int rx){
        if(l>=rx || lx>=r){
            return 0;
        }
        if(lx>=l && rx<=r){
            return tree[x];
        }
        int m = (rx+lx)/2;
        ll s1 = sum(l,r,2*x+1,lx,m);
        ll s2 = sum(l,r,2*x+2,m,rx);
        return s1+s2;
    }

    ll sum (int l,int r){
        return sum(l,r,0,0,size);
    }

};

int a[max_n];

void solve(){

    int n;
    cin >> n;

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

    sort(a+1, a+n+1);
    reverse(a+1, a+n+1);

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

    cout << sum;


}

int main(){
    two;
    powerofn;

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

    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:156:9: error: 'sum' was not declared in this scope
  156 |         sum += a[i];
      |         ^~~
a.cc:159:13: error: 'sum' was not declared in this scope
  159 |     cout << sum;
      |             ^~~
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <math.h>
using namespace std;

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

int main()
{
	int n;
	cin >> n;

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

	sort(a.begin(), a.end(), greater<ll>());

	ll ans = 0;
	for (int i = 1; i < n; i++) {
		ans += a[i / 2];
	}

	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   24 |         sort(a.begin(), a.end(), greater<ll>());
      |         ^~~~
      |         sqrt
Language: C++

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

int main() {
  int N, K;
  int64_t ans=0;
  cin >> N;
  vector<int64_t> A(N);
  for (int i=0; i<N; i++) {
    cin >> A.at(i);
  }
  std::sort(A.begin(),A.end());
  if (N%2=0) {
    K = (N-2)/2;
    ans = A.at(N);
    for (int j=0; j<K; j++) {
      ans = ans + 2*A.at(N-(j+1));
    }
    cout << ans << endl;
  }
  else {
    K = (N-3)/2;
    ans = A.at(N) + A.at(N-K-1);
    for (int l=0; l<K; l++) {
      ans = ans + 2*A.at(N-(l+1));
    }
    cout << ans << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: lvalue required as left operand of assignment
   13 |   if (N%2=0) {
      |       ~^~
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n,sum;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		sum+=x;
	}
	cout<<x<<endl;
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'x' was not declared in this scope
   14 |         cout<<x<<endl;
      |               ^
Language: C++

ing namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
  int N;
  cin >>N;
  
  vector<long long> vec(N);
  
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int sum =vec.at(0);
  
  if(N%2==1){
    for (int i = 1; i < (N-1)/2; i++) {
      sum +=vec.at(i)*2;
    }
    sum +=vec.at((N-1)/2);
  }
  else{
    for (int i = 1; i < (N+4)/4; i++) {
      sum +=vec.at(i)*2;
    }
  }
  
  cout << sum <<endl;
}

Compiler output:
a.cc:1:1: error: 'ing' does not name a type; did you mean 'int'?
    1 | ing namespace std;
      | ^~~
      | int
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >>N;
      |   ^~~
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<long long> vec(N);
      |   ^~~~~~
a.cc:9:10: error: expected primary-expression before 'long'
    9 |   vector<long long> vec(N);
      |          ^~~~
a.cc:12:12: error: 'vec' was not declared in this scope
   12 |     cin >> vec.at(i);
      |            ^~~
a.cc:15:8: error: 'vec' was not declared in this scope
   15 |   sort(vec.begin(), vec.end());
      |        ^~~
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort(vec.begin(), vec.end());
      |   ^~~~
      |   short
a.cc:16:3: error: 'reverse' was not declared in this scope
   16 |   reverse(vec.begin(), vec.end());
      |   ^~~~~~~
a.cc:32:3: error: 'cout' was not declared in this scope
   32 |   cout << sum <<endl;
      |   ^~~~
a.cc:32:17: error: 'endl' was not declared in this scope
   32 |   cout << sum <<endl;
      |                 ^~~~
Language: C

#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	unsigned long int a, b, c;
	unsigned long long int num = 0, d = 1;
	
	vector<unsigned long int> v;
	scanf("%ld", &a);

	for (int i = 0; i < a; i++) {
		scanf("%ld", &b);
		v.push_back(b);
	}

	std::sort(v.begin(), v.end(), std::greater<int>());

	num = v[0];

	for (int i = 1; i < a; i++) {
		if (d == a - 1) {
			cout << num;
			return 0;
		}
		num += v[i];
		d++;

		if (d == a - 1) {
			cout << num;
			return 0;
		}
		num += v[i];
		d++;
	}

	return 0;
}

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

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

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N);
  rep(i,N){
    cin >> A.at(i);
  }

  sort(A.begin(), A.end(), std::greater<long long>());
  long long　double G = 0;

  rep(i,N){
    if(i == 0){
      continue;
    }
    G += A.at(i-1);
  }
  cout << G << endl;
}



  

Compiler output:
a.cc:15:8: error: extended character 　 is not valid in an identifier
   15 |   long long　double G = 0;
      |        ^
a.cc: In function 'int main()':
a.cc:15:21: error: expected initializer before 'G'
   15 |   long long　double G = 0;
      |                     ^
a.cc:21:5: error: 'G' was not declared in this scope
   21 |     G += A.at(i-1);
      |     ^
a.cc:23:11: error: 'G' was not declared in this scope
   23 |   cout << G << endl;
      |           ^
Language: Java

import java.util.*;
public class Main3 {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int n = sc.nextInt();
        PriorityQueue<Integer> q = new PriorityQueue<>(Collections.reverseOrder());
        for(int i = 0; i < n; i++){
            q.offer(sc.nextInt());
        }
        long res = 0;
        Queue<Integer> max = new LinkedList<>();
        max.offer(q.poll());
        res += max.poll();
        max.offer(q.poll());
        while(!q.isEmpty()){
            int curr = max.poll();
            max.offer(q.poll());
            res += curr;
            if(!q.isEmpty()){
                max.offer(q.poll());
                res += curr;
            }
        }
        System.out.println(res);
    }
}

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

input1 = gets.chomp.to_i
input2 = gets.chomp.split(' ').map!(&:to_i).sort.reverse
party = Array.new
comfort = 0
for i in 1..input1-1
    comfort+=input2[i-1]
end
puts comfort

Compiler output:
a.cc:5:10: error: too many decimal points in number
    5 | for i in 1..input1-1
      |          ^~~~~~~~~
a.cc:1:1: error: 'input1' does not name a type
    1 | input1 = gets.chomp.to_i
      | ^~~~~~
Language: C++

/*
  author:   Ziel
  created:  05.07.2020 17:39:19
*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

#define fi first
#define se second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define bpc __builtin_popcountl
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;
struct chash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + RANDOM);
  }
};

const ll N = 1e5 + 123, MOD = 1e9 + 7, oo = 1e9 + 9, INF = 1e18 + 9;
const db EPS = 1e-9, PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1}, dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

int32_t main() {
  fre("");
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  
  sort(rall(a));
  
  vector<int> l, r;
  ll ans = a[0] + a[1];
  l.pb(a[1]);
  r.pb(a[2]);
  for (int i = 3; i < n; i++) {
    if (l.back() Б r.back()) {
      ans += min(a[0], l.back());
      l.pb(a[i]);
    } else {
      ans += min(a[0], r.back());
      r.pb(a[i]);
    }
  }
  
  cout << ans;
  
  return 0;
}

// uniform_int_distribution<int>(l, r)(rng) -> random in range [l, r]
// assert(condition) -> if (condition == false) Runtime Error
// order_of_key(x) -> number of elements smaller than x
// *find_by_order(k) -> k-th element in 0-based indexation
// gp_hash_table<T, U, chash> -> fast unordered_map
// m.count(x) <-> (m.find(x) != m.end())


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:77:17: error: expected ')' before '\U00000411'
   77 |     if (l.back() Б r.back()) {
      |        ~        ^~
      |                 )
Language: C++

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

int main(){
	int n;
  	cin >> n;
    vector<int> in(n, 0);
    for(int i=0;i<n;i++){
        cin >> in[i];
    }
  
    int s = accumulate(in.begin(), in.end(), 0);
    int mi = *min_element(in.begin(), in.end());

    cout<<s - mi<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int> in(n, 0);
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> in(n, 0);
      |            ^~~
a.cc:10:16: error: 'in' was not declared in this scope; did you mean 'i'?
   10 |         cin >> in[i];
      |                ^~
      |                i
a.cc:13:24: error: 'in' was not declared in this scope; did you mean 'n'?
   13 |     int s = accumulate(in.begin(), in.end(), 0);
      |                        ^~
      |                        n
a.cc:13:13: error: 'accumulate' was not declared in this scope
   13 |     int s = accumulate(in.begin(), in.end(), 0);
      |             ^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
    int n,i,ans=0,t,k;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    //for(i=1;i<n;i++)ans+=a[i];
    vector<int>v;
    ans=a[n-1];
    t=n-2;
    k=n-2;
    while(1){
        if(!t)break;
        ans+=a[k];'
        t--;
        if(!t)break;
        ans+=a[k];
        k--;
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc:17:19: warning: missing terminating ' character
   17 |         ans+=a[k];'
      |                   ^
a.cc:17:19: error: missing terminating ' character
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
 int n,i,min=-1;
  cin>>n;
  int a[n]=0;
  for(i=0;i<n;i++)
    cin>>a[i];
  for(i=0;i<n;i++)
  {
    if(min>a[i])
      min=a[i];
  }
  int sum=0;
  for(i=0;i<n;i++)
  sum+=a[i];
  int c=sum-min;
  cout<<c<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: array must be initialized with a brace-enclosed initializer
    7 |   int a[n]=0;
      |            ^
Language: Java



import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;


public class Main
	 static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 
	 static int divisors(long x) {
		    long limit = x;
		    int numberOfDivisors = 0;

		    if (x == 1) return 1;

		    for (int i = 1; i < limit; ++i) {
		        if (x % i == 0) {
		            limit = x / i;
		            if (limit != i) {
		                numberOfDivisors++;
		            }
		            numberOfDivisors++;
		        }
		    }

		    return numberOfDivisors;
		} 
	public static void main(String[] args)throws IOException  {
		FastReader s=new FastReader();		
		int n = s.nextInt();
		List<Long> l = new ArrayList<>();
		long[] ar = new long[n];
		for(int i=0;i<n;i++) {
			ar[i]=s.nextLong();
		}
		Arrays.sort(ar);
		long c=0;
		for(int i=1;i<n;i++) {
			c+=ar[i];
		}

//		for(int i=0;i<n;i++) {
//			if(!l.isEmpty()) {
//				c1 += Collections.min(l);
//				l.add(ar[i]);
//			}
//			else l.add(ar[i]);
//		}
		System.out.println(c);
		
	}
}

Compiler output:
Main.java:14: error: '{' expected
public class Main
                 ^
Main.java:78: error: unnamed classes are a preview feature and are disabled by default.
	 static int divisors(long x) {
	        ^
  (use --enable-preview to enable unnamed classes)
Main.java:120: error: class, interface, enum, or record expected
}
^
3 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <fstream>
#include <set>
#include <stack>
#include <queue>
#include <list>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define db(x) cout << "> " << #x << ": " << x << "\n";
#define ss cout << " ";
#define ct(x) cout << x;
#define nn cout << "\n";
#define cts(x) cout << x << " ";
#define ctn(x) cout << x << "\n";
#define qr queries();
void solve();
void YN(bool b){if (b){ctn("YES");}else{ctn ("NO");}};
void yn(bool b){if (b){ctn("Yes");}else{ctn ("No");}};
void queries(){int n;cin >> n;while (n--)solve();}
// // // // // // // // // // // // // // // // // // // // // // 
/*                  TEMPLATE - VANILLA                         */
// // // // // // // // // // // // // // // // // // // // // //
int64 q, n;

void solve(){

    return;
}


int main(){
    int64 n;
    cin >> n;
    vec64 arr (n);
    int64 mn = INT_MAX;
    int64 rs = 0;
    for (int i = 0; i <n; i++){
        cin >> arr[i];
        rs+=arr[i];
        mn = min(mn, arr[i]);
    }
    rs-=mn;
    ctn(rs);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:16: error: 'INT_MAX' was not declared in this scope
   41 |     int64 mn = INT_MAX;
      |                ^~~~~~~
a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include <list>
  +++ |+#include <climits>
   11 | using namespace std;
Language: Java

import java.io.*;
import java.math.*;
import java.util.*;
public class Alt { 
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int N = I.nextInt();
		long min = (long)(1e12);
		long ans = 0;
		for (int i = 0; i < N; i++) {
			long x = I.nextLong();
			ans+=x;
			min = Math.min(x, min);
		}
		ans-=min;
		O.pln(ans);
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}


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