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

import java.util.*;
public class Main{
	public static void main(){
	  Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();
      int sum=0;
      int[] L=new int[n*2];
      for(int i=0;i<L.length;i++){
        L[i]=sc.nextInt();
      }
      sort(L);
      for(int i=0;i<L.length;i+=2){
        sum+=L[i];
		}
      System.out.println(sum);
    }
}

Compiler output:
Main.java:11: error: cannot find symbol
      sort(L);
      ^
  symbol:   method sort(int[])
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main{
	public static void main(){
	  Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();
      int sum=0;
      int[] L=new int[n*2];
      for(int i=0;i<L.length;i++){
        L[i]=sc.nextInt();
      }
      sort(L);
      for(int i=0;i<L.length;i+=2){
        sum+=L[i];
	}
      System.out.println(sum);
}

Compiler output:
Main.java:16: error: reached end of file while parsing
}
 ^
1 error
Language: Java

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

public class Barbeque {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int sum=0;
		int arr[]=new int[2*n];
		for(int i=0;i<2*n;i++)
		{
			arr[i]=sc.nextInt();
			
		}
		Arrays.sort(arr);
		for(int j=0;j<2*n;j=j+2) {
			sum=sum+Math.min(arr[j], arr[j+1]);
			
		}
		System.out.println(sum);
sc.close();
	}

}


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


import java.util.*;

public class Traning {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt() * 2;
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int sum = 0;
        for (int i = 0; i < n; i += 2) {
            sum += a[i];
        }
        System.out.println(sum);
    }

}


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

#include<iostream>
using namespace std;
#define int long long int
int32_t main()
{
  int n;
  cin>>n;
  int arr[2*n],j;
  for(j=0;j<2*n;j++)
    cin>>arr[j];
  sort(arr,arr+2*n);
  int answer=0;
  for(j=0;j<2*n;j+=2)
    answer+=arr[j];
  cout<<answer<<endl;
}

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

#include<bits/stdc.h++>
#include<iostream>
using namespace std;
 
 
int main() {
int N;
cin>>N;
vector<int> a(N*2);
for(int i=0;i<N*2;i++) cin>>a[i];
sort(a.begin(),a.end());
long ans=0;
for(int i=0;i<N;i++){
  ans+= min(a[2*i],a[2*i+1]);
}
cout<<ans<<endl;
}

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++

using namespace std;
 
 
int main() {
int N;
cin>>N;
vector<int>
  a(N*2);
  
for(int i=0;i<N*2;i++) 
  cin>>a[i];
  
sort(a.begin(),a.end());
long ans=0;
  
for(int i=0;i<N;i++){
  ans+= min(a[2*i],a[2*i+1]);
}
cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:1: error: 'cin' was not declared in this scope
    6 | cin>>N;
      | ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:7:1: error: 'vector' was not declared in this scope
    7 | vector<int>
      | ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:7:8: error: expected primary-expression before 'int'
    7 | vector<int>
      |        ^~~
a.cc:11:8: error: 'a' was not declared in this scope
   11 |   cin>>a[i];
      |        ^
a.cc:13:6: error: 'a' was not declared in this scope
   13 | sort(a.begin(),a.end());
      |      ^
a.cc:13:1: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 | sort(a.begin(),a.end());
      | ^~~~
      | short
a.cc:17:9: error: 'min' was not declared in this scope; did you mean 'main'?
   17 |   ans+= min(a[2*i],a[2*i+1]);
      |         ^~~
      |         main
a.cc:19:1: error: 'cout' was not declared in this scope
   19 | cout<<ans<<endl;
      | ^~~~
a.cc:19:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:12: error: 'endl' was not declared in this scope
   19 | cout<<ans<<endl;
      |            ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <iostream>
using namespace std;
 
int N;
int L[200];
 
int main(){
  int total;
  cin >> N;
  for(int i = 0; i < 2 * N; i++){
    cin >> L[i];
  }
  for(int i = 0; i < 2 * N; i += 2){
    total += min_element(L, L + (2 * N));
    L[i] = 1000;
    L[i + 1] = 1000;
  }
  cout << total;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: 'min_element' was not declared in this scope
   14 |     total += min_element(L, L + (2 * N));
      |              ^~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int N;
int L[200];

int main(){
  int total;
  cin >> N;
  for(int i = 0; i < 2 * N; i++){
    cin >> L[i];
  }
  for(int i = 0; i < 2N; i += 2){
    total += min(L);
    L[i] = 1000;
    L[i + 1] = 1000;
  }
  cout << total;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: unable to find numeric literal operator 'operator""N'
   13 |   for(int i = 0; i < 2N; i += 2){
      |                      ^~
a.cc:14:17: error: no matching function for call to 'min(int [200])'
   14 |     total += min(L);
      |              ~~~^~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/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, 1 provided
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int l[100],N,sum=0;
  int i,j;
  cin>>N;
  for(i=0;i<(2*N);i++)
  {
    cin>>l[i];
    
    
  }
  for(i=0;i<(2*N);i++)
  {
    for(j=i+1;j<(2*N);j++)
    {
      if(l[i]<l[j])
      {
        int temp;
        temp=l[i];
        l[i]=l[j];
        l[j]=temp;
        
      }
    }
  }
    for(i=0;i<(2*N);i++)
    {
      
      if(l[i]<l[++i])
      {
        sum=sum+l[i];
      }
      else
      {
        sum=sum+l[++i];
      }
      i++;
    }
    
  
  return 0;
}
#include<iostream>
using namespace std;
int main()
{
  int l[100],N,sum=0;
  int i,j;
  cin>>N;
  for(i=0;i<(2*N);i++)
  {
    cin>>l[i];
    
    
  }
  for(i=0;i<(2*N);i++)
  {
    for(j=i+1;j<(2*N);j++)
    {
      if(l[i]<l[j])
      {
        int temp;
        temp=l[i];
        l[i]=l[j];
        l[j]=temp;
        
      }
    }
  }
    for(i=0;i<(2*N);i++)
    {
      
      sum=sum+min(i,++i);
    }
  cout<<sum;

Compiler output:
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
a.cc: In function 'int main()':
a.cc:78:13: error: expected '}' at end of input
   78 |   cout<<sum;
      |             ^
a.cc:49:1: note: to match this '{'
   49 | {
      | ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int l[100],N,sum=0;
  int i,j;
  cin>>N;
  for(i=0;i<(2*N);i++)
  {
    cin>>l[i];
    
    
  }
  for(i=0;i<(2*N);i++)
  {
    for(j=i+1;j<(2*N);j++)
    {
      if(l[i]<l[j])
      {
        int temp;
        temp=l[i];
        l[i]=l[j];
        l[j]=temp;
        
      }
    }
  }
    for(i=0;i<(2*N);i++)
    {
      
      if(a[i]<a[++i])
      {
        sum=sum+a[i];
      }
      else
      {
        sum=sum+a[++i];
      }
      i++;
    }
    
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:10: error: 'a' was not declared in this scope
   31 |       if(a[i]<a[++i])
      |          ^
Language: C++

#include<iostream>
int main()
{
  int l[100],N,sum=0;
  int i,j;
  cin>>N;
  for(i=0;i<(2*N);i++)
  {
    cin>>l[i];
    
    
  }
  for(i=0;i<(2*N);i++)
  {
    for(j=i+1;j<(2*N);j++)
    {
      if(l[i]<l[j])
      {
        int temp;
        temp=l[i];
        l[i]=l[j];
        l[j]=temp;
        
      }
    }
    for(i=0;i<(2*N);i+2)
    {
      
      if(a[i]<a[++i])
      {
        sum=sum+a[i];
      }
      else
      {
        sum=sum+a[++i];
      }
    }
    
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin>>N;
      |   ^~~
      |   std::cin
In file included 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:29:10: error: 'a' was not declared in this scope
   29 |       if(a[i]<a[++i])
      |          ^
Language: Java

import java.util.*;

public class Solution
{
  public static void main(String [] args)
  {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int [] arr = new int[n];
    
    for(int i = 0;i < n; i++)
      arr[i] = s.nextInt();
    
    Arrays.sort(arr);
    
    int count = 0;
    for(int i = 0; i < n; i +=2)
      count += arr[i];
    
    System.out.println(count);
  }
}

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

import java.util.*;
public class Screw {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a[]=new int[2*n];
        for(int i=0;i<2*n;i++)
        {
            a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        int t=0;
        for(int i=0;i<2*n;i+=2)
        {
            t+=Math.min(a[i],a[i+1]);
        }
        System.out.println(t);
    }
    
}


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


import java.util.*;
    public static void main(String[] args) {
        int x=0,s=0,m=1,p=0;
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        p=n*2;
        int []a=new int[p];
         for(int i=0;i<p;i++){
              a[i]=in.nextInt();
          } 
        for(int i=0;i<(p-1);i++){
            for(int j=1+i;j<p;j++){
                if(a[i]<a[j]){
                 int t =a[i];
                 a[i]=a[j];
                 a[j]=t;                 
                }              
            }         
        }        
        for(int i=0;i<(p-1);i++){
            for(int j=m;j<p;j++){
            if(a[i]>a[j]||a[i]==a[j]){
              x=a[j];
             s=s+x;
             m=m+2;
             break;
            }         
        }          
    }
    System.out.println(s);
    }


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

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication69;

/**
 *
 * @author ASUS
 */
import java.util.*;
public class JavaApplication69 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int x=0;
         Scanner in=new Scanner(System.in);
        int n=in.nextInt();
         int p=n*2;
        int []a=new int[p];
          for(int i=0;i<p;i++){
              a[i]=in.nextInt();
          }
        for(int i=0;i<p-1;i++){
            for(int j=1+i;j<p;j++){
                if(a[i]<a[j]){
                 int t =a[i];
                 a[i]=a[j];
                 a[j]=t;
                 
                }
              
            }
            
        }
        int s=0,m=1;
        
        for(int i=0;i<p-1;i++){
            for(int j=m;j<p;j++){
            if(a[i]>a[j]||a[i]==a[j]){
              x=a[j];
             s=s+x;
             m=m+2;
             break;
            }
            
        }
            
    }
    System.out.println(s  );
    }
}
    



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

package myjava1;
import java.util.
  class MyJava1 {
    public static void main(String[] args) {
        int x=0,s=0,m=1,p=0;
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        p=n*2;
        int []a=new int[p];
         for(int i=0;i<p;i++){
              a[i]=in.nextInt();
          } 
        for(int i=0;i<(p-1);i++){
            for(int j=1+i;j<p;j++){
                if(a[i]<a[j]){
                 int t =a[i];
                 a[i]=a[j];
                 a[j]=t;                 
                }              
            }         
        }        
        for(int i=0;i<(p-1);i++){
            for(int j=m;j<p;j++){
            if(a[i]>a[j]||a[i]==a[j]){
              x=a[j];
             s=s+x;
             m=m+2;
             break;
            }         
        }          
    }
    System.out.println(s);
    }
}

Compiler output:
Main.java:2: error: <identifier> expected
import java.util.
                 ^
1 error
Language: Java

package myjava1;
import java.util.*;
public class MyJava1 {
    public static void main(String[] args) {
        int x=0,s=0,m=1,p=0;
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        p=n*2;
        int []a=new int[p];
         for(int i=0;i<p;i++){
              a[i]=in.nextInt();
          } 
        for(int i=0;i<(p-1);i++){
            for(int j=1+i;j<p;j++){
                if(a[i]<a[j]){
                 int t =a[i];
                 a[i]=a[j];
                 a[j]=t;                 
                }              
            }         
        }        
        for(int i=0;i<(p-1);i++){
            for(int j=m;j<p;j++){
            if(a[i]>a[j]||a[i]==a[j]){
              x=a[j];
             s=s+x;
             m=m+2;
             break;
            }         
        }          
    }
    System.out.println(s);
    }
}

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

import java.util.*;

public class MyJava{

    public static void main(String[] args) {
        int x = 0, s = 0, m = 1;;
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int p = n * 2;
        int[] a = new int[p];
        for (int i = 0; i < p; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 0; i < p - 1; i++) {
            for (int j = 1 + i; j < p; j++) {
                if (a[i] < a[j]) {
                    int t = a[i];
                    a[i] = a[j];
                    a[j] = t;
                }
            }
        }
        for (int i = 0; i < p - 1; i++) {
            for (int j = m; j < p; j++) {
                if (a[i] > a[j] || a[i] == a[j]) {
                    x = a[j];
                    s = s + x;
                    m = m + 2;
                    break;
                }
            }
        }
        System.out.println(s);
    }
}


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

package myjava2;

import java.util.*;

public class MyJava2{

    public static void main(String[] args) {
        int x = 0, s = 0, m = 1;;
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int p = n * 2;
        int[] a = new int[p];
        for (int i = 0; i < p; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 0; i < p - 1; i++) {
            for (int j = 1 + i; j < p; j++) {
                if (a[i] < a[j]) {
                    int t = a[i];
                    a[i] = a[j];
                    a[j] = t;
                }
            }
        }
        for (int i = 0; i < p - 1; i++) {
            for (int j = m; j < p; j++) {
                if (a[i] > a[j] || a[i] == a[j]) {
                    x = a[j];
                    s = s + x;
                    m = m + 2;
                    break;
                }
            }
        }
        System.out.println(s);
    }
}


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

package myjava;

import java.util.*;

public class MyJava{

    public static void main(String[] args) {
        int x = 0, s = 0, m = 1;;
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int p = n * 2;
        int[] a = new int[p];
        for (int i = 0; i < p; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 0; i < p - 1; i++) {
            for (int j = 1 + i; j < p; j++) {
                if (a[i] < a[j]) {
                    int t = a[i];
                    a[i] = a[j];
                    a[j] = t;
                }
            }
        }
        for (int i = 0; i < p - 1; i++) {
            for (int j = m; j < p; j++) {
                if (a[i] > a[j] || a[i] == a[j]) {
                    x = a[j];
                    s = s + x;
                    m = m + 2;
                    break;
                }
            }
        }
        System.out.println(s);
    }
}


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

package myjava1;
import java.util.*;
public class MyJava1 {
    public static void main(String[] args) {
        int x=0,s=0,m=1,p=0;
        Scanner in=new Scanner(System.in);
        int n=new nextInt();
        p=n*2;
        int []a=in.int[p];
         for(int i=0;i<p;i++){
              a[i]=in.nextInt();
          } 
        for(int i=0;i<(p-1);i++){
            for(int j=1+i;j<p;j++){
                if(a[i]<a[j]){
                 int t =a[i];
                 a[i]=a[j];
                 a[j]=t;                 
                }              
            }         
        }        
        for(int i=0;i<(p-1);i++){
            for(int j=m;j<p;j++){
            if(a[i]>a[j]||a[i]==a[j]){
              x=a[j];
             s=s+x;
             m=m+2;
             break;
            }         
        }          
    }
    System.out.println(s);
    }
}
    



Compiler output:
Main.java:9: error: <identifier> expected
        int []a=in.int[p];
                   ^
Main.java:9: error: ']' expected
        int []a=in.int[p];
                       ^
Main.java:9: error: ';' expected
        int []a=in.int[p];
                        ^
3 errors
Language: C++

#include <bits/stdc++.h>
int n, L[205];
int main()
{
 	scanf("%d", &n);
  	for(int i=1; i<=2*n; i++) scanf("%d", a+i);
  	sort(a+1, a+2*n+1);
  	int ans = 0;
  	for(int i=1; i<=2*n; i+=2) ans += a[i];
  	printf("%d\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:47: error: 'a' was not declared in this scope
    6 |         for(int i=1; i<=2*n; i++) scanf("%d", a+i);
      |                                               ^
a.cc:7:14: error: 'a' was not declared in this scope
    7 |         sort(a+1, a+2*n+1);
      |              ^
a.cc:7:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
    7 |         sort(a+1, a+2*n+1);
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

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

int main() {
  std::vector<int> L;
  long long N;
  std::cin >> N;
  L.resize(2*N);
  for (int i = 0; i < 2*N; i++) 
    std::cin >> L[i];
  std::sort(L.begin(), L.end());
  int sum = 0;
  for (int i = 0; i < N; i++)
    sum += std::min(L[2*i], L[2*i+1]);
  std::cout << sun << std::endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: 'sun' was not declared in this scope; did you mean 'sum'?
   16 |   std::cout << sun << std::endl;
      |                ^~~
      |                sum
Language: C++

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

int main() {
  std::vector<int> L;
  long long N;
  std::cin >> N;
  L.resize(2*N);
  for (int i = 0; i < 2*N; i++) 
    std::cin >> L[i];
  std::srot(L.begin(), L.end());
  int sum = 0;
  for (int i = 0; i < N; i++)
    sum += std::min(L[2*i], L[2*i+1]);
  std::cout << sun << std::endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'srot' is not a member of 'std'; did you mean 'sort'?
   12 |   std::srot(L.begin(), L.end());
      |        ^~~~
      |        sort
a.cc:16:16: error: 'sun' was not declared in this scope; did you mean 'sum'?
   16 |   std::cout << sun << std::endl;
      |                ^~~
      |                sum
Language: C++

#include<bits/stdc++.h>
using namespace std;
int arr[101]

int main(){
   
  int n;scanf("%d",&n);
  arr[n+1];
  for(int i=1;i<=n;i++) scanf("%d",&arr[i]);
  int ans=0;
  for(int i=1;i<=n-1;i++)ans+=min(arr[i],arr[i+1]);
  printf("%d\n",ans);
  return 0;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int main(){
      | ^~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: expected ';' before '-' token
    7 |   for(int i-0; i<2*n; i++){
      |            ^
      |            ;
a.cc:7:21: error: expected ')' before ';' token
    7 |   for(int i-0; i<2*n; i++){
      |      ~              ^
      |                     )
a.cc:7:23: error: 'i' was not declared in this scope
    7 |   for(int i-0; i<2*n; i++){
      |                       ^
Language: Java

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

public class BBQ_Easy {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[2 * n];
for (int i = 0; i < arr.length; i++) {
arr[i] = sc.nextInt();
}
sc.close();
Arrays.sort(arr);
int sum = 0;
for (int i = 0; i < arr.length; i += 2) {
sum += arr[i];
}
System.out.println(sum);


}

}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x; cin>>x;
    int a[x],s=0; 
    for(int i=0;i<x;i++) cin>>a[i];
    sort(a,a+x);
    for(int i=0;i<x;i++){
        s=s+min(a[i],a[i+1]); i++:
    }
    cout<<s<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:34: error: expected ';' before ':' token
   10 |         s=s+min(a[i],a[i+1]); i++:
      |                                  ^
      |                                  ;
Language: C++

using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var l = Console.ReadLine().Split(' ');
            var nums = new int[2*n];
            var result = 0;
            for(int i = 0; i < 2*n; i++)
            {
                nums[i] = int.Parse(l[i]);
            }
            Array.Sort(nums);
            for (int i = 0; i < 2*n; i++)
            {
                if(i % 2 == 0)
                {
                    result += nums[i];
                }
            }
            Console.WriteLine(result);
        }
    }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:7:26: error: 'string' has not been declared
    7 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:7:35: error: expected ',' or '...' before 'args'
    7 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:27:6: error: expected ';' after class definition
   27 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void A::Program::Main(int*)':
a.cc:9:13: error: 'var' was not declared in this scope
    9 |             var n = int.Parse(Console.ReadLine());
      |             ^~~
a.cc:10:17: error: expected ';' before 'l'
   10 |             var l = Console.ReadLine().Split(' ');
      |                 ^
a.cc:11:17: error: expected ';' before 'nums'
   11 |             var nums = new int[2*n];
      |                 ^~~~
a.cc:12:17: error: expected ';' before 'result'
   12 |             var result = 0;
      |                 ^~~~~~
a.cc:13:34: error: 'n' was not declared in this scope
   13 |             for(int i = 0; i < 2*n; i++)
      |                                  ^
a.cc:15:17: error: 'nums' was not declared in this scope
   15 |                 nums[i] = int.Parse(l[i]);
      |                 ^~~~
a.cc:15:27: error: expected primary-expression before 'int'
   15 |                 nums[i] = int.Parse(l[i]);
      |                           ^~~
a.cc:17:13: error: 'Array' was not declared in this scope
   17 |             Array.Sort(nums);
      |             ^~~~~
a.cc:17:24: error: 'nums' was not declared in this scope
   17 |             Array.Sort(nums);
      |                        ^~~~
a.cc:18:35: error: 'n' was not declared in this scope
   18 |             for (int i = 0; i < 2*n; i++)
      |                                   ^
a.cc:22:21: error: 'result' was not declared in this scope
   22 |                     result += nums[i];
      |                     ^~~~~~
a.cc:25:13: error: 'Console' was not declared in this scope
   25 |             Console.WriteLine(result);
      |             ^~~~~~~
a.cc:25:31: error: 'result' was not declared in this scope
   25 |             Console.WriteLine(result);
      |                               ^~~~~~
Language: C++

#include<stdio.h>
int main(){
    int i, j, tmp;
 
  /* 数値を格納する配列 */
    int l[200];
 
  /* 数値の総数を入力 */
    int n;
    scanf("%d", &n);
 
  /* 配列に格納する数値を入力 */
    for (i=0; i<2*n; ++i)
        scanf("%d", &l[i]);
 
  /* 数値を昇順にソート */
    for (i=0; i<n; ++i) {
        for (j=i+1; j<n; ++j) {
            if (l[i] > l[j]) {
                tmp =  l[i];
                l[i] = l[j];
                l[j] = tmp;
            }
        }
    }

    int sum=0;
    for(int i=1;i<N;i+2){
        sum+=l[i];
    }
    printf("%d\n",sum);





    return 0
}
     

Compiler output:
a.cc: In function 'int main()':
a.cc:28:19: error: 'N' was not declared in this scope
   28 |     for(int i=1;i<N;i+2){
      |                   ^
a.cc:37:13: error: expected ';' before '}' token
   37 |     return 0
      |             ^
      |             ;
   38 | }
      | ~
Language: C

#include<stdio.h>
#include <stdlib.h>
#include <string.h>
int size(const void *x,const void *y);
int main(){
  int N;
  int L[100];// 0 to 99
  int i = 0;
  char tmp[512];
  char *tp;
  int sum = 0;
  
  scanf("%d",&N);
  
  scanf("%s",&tmp);
  tp = strtok(tmp, "\t");
  L[i] = atoi(tp);
  For ( i = 1 ; tp = strtok(NULL, "\t") ; i++ ){
    L[i] = atoi(tp);
  }
  //ソート
  qsort(L,i,sizeof(int),size);
  
  //
  for(int j = 0 ; j<(i/2) ;j++){
    if(L[2*j]<L[2*j +1]){
      sum += L[2*j];
    }else{
      sum += L[2*j +1];
    }
  }
  return sum;
}
 
int size(const void *x,const void *y){
  if(*(int *)x > *(int *)y){
    return 1;
  }else if(*(int *)x < *(int *)y){
    return -1;
  }else{
    return 0;
  }
}

Compiler output:
main.c: In function 'main':
main.c:18:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration]
   18 |   For ( i = 1 ; tp = strtok(NULL, "\t") ; i++ ){
      |   ^~~
main.c:18:14: error: expected ')' before ';' token
   18 |   For ( i = 1 ; tp = strtok(NULL, "\t") ; i++ ){
      |       ~      ^~
      |              )
main.c:18:48: error: expected ';' before '{' token
   18 |   For ( i = 1 ; tp = strtok(NULL, "\t") ; i++ ){
      |                                                ^
      |                                                ;
Language: C

#include<stdio.h>
#include <stdlib.h>
#include <string.h>
int size(const void *x,const void *y);
int main(){
  int N;
  int L[100];// 0 to 99
  int i = 0;
  char tmp[512];
  char *tp;
  int sum = 0;
  
  scanf("%d",&N);
  
  scanf("%s",&tmp);
  tp = strtok(tmp, "\t");
  L[i] = atoi(tp);
  For(i=1 ;tp = strtok(NULL, "\t");i++){
    L[i] = atoi(tp);
  }
  //ソート
  qsort(L,i,sizeof(int),size);
  
  //
  for(int j=0;j<(i/2);j++){
    if(L[2*j]<L[2*j +1] ){
      sum += L[2*j];
    }else{
      sum += L[2*j +1];
    }
  }
  return sum;
}
 
int size(const void *x,const void *y){
  if(*(int *)x > *(int *)y){
    return 1;
  }else if(*(int *)x < *(int *)y){
    return -1;
  }else{
    return 0;
  }
}

Compiler output:
main.c: In function 'main':
main.c:18:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration]
   18 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |   ^~~
main.c:18:10: error: expected ')' before ';' token
   18 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |      ~   ^~
      |          )
main.c:18:40: error: expected ';' before '{' token
   18 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |                                        ^
      |                                        ;
Language: C

#include<stdio.h>
#include <stdlib.h>
#include <string.h>
int size(const void *x,const void *y);
int main(){
  int N;
  int L[100];// 0 to 99
  int i = 0;
  char tmp[512];
  char *tp;
  int sum = 0;
  
  scanf("%d",&N);
  
  scanf("%s",tmp);
  tp = strtok(tmp, ",");
  L[i] = atoi(tp);
  For(i=1 ;tp = strtok(NULL, "\t");i++){
    L[i] = atoi(tp);
  }
  //ソート
  qsort(L,i,sizeof(int),size);
  
  //
  for(int j=0;j<(i/2);j++){
    if(L[2*j]<L[2*j +1] ){
      sum += L[2*j];
    }else{
      sum += L[2*j +1];
    }
  }
  return sum;
}
 
int size(const void *x,const void *y){
  if(*(int *)x > *(int *)y){
    return 1;
  }else if(*(int *)x < *(int *)y){
    return -1;
  }else{
    return 0;
  }
}

Compiler output:
main.c: In function 'main':
main.c:18:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration]
   18 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |   ^~~
main.c:18:10: error: expected ')' before ';' token
   18 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |      ~   ^~
      |          )
main.c:18:40: error: expected ';' before '{' token
   18 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |                                        ^
      |                                        ;
Language: C

#include<stdio.h>
#include <stdlib.h>
#include <string.h>
int size(const void *x,const void *y);
int main(){
  int N;
  int L[100];// 0 to 99
  int i = 0;
  char tmp[512];
  char *tp;
  int sum = 0;
  
  scanf("%d",&N);
  
  scanf("%s",tmp);
  tp = strtok(tmp, ",")
  L[i] = atoi(tp);
  For(i=1 ;tp = strtok(NULL, "\t");i++){
    L[i] = atoi(tp);
  }
  //ソート
  qsort(L,i,sizeof(int),size);
  
  //
  for(int j=0;j<(i/2);j++){
    if(L[2*j]<L[2*j +1] ){
      sum += L[2*j];
    }else{
      sum += L[2*j +1];
    }
  }
  return sum;
}
 
int size(const void *x,const void *y){
  if(*(int *)x > *(int *)y){
    return 1;
  }else if(*(int *)x < *(int *)y){
    return -1;
  }else{
    return 0;
  }
}

Compiler output:
main.c: In function 'main':
main.c:16:24: error: expected ';' before 'L'
   16 |   tp = strtok(tmp, ",")
      |                        ^
      |                        ;
   17 |   L[i] = atoi(tp);
      |   ~                     
main.c:18:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration]
   18 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |   ^~~
main.c:18:10: error: expected ')' before ';' token
   18 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |      ~   ^~
      |          )
main.c:18:40: error: expected ';' before '{' token
   18 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |                                        ^
      |                                        ;
Language: C

#include<stdio.h>
#include <stdlib.h>
int size(const void *x,const void *y);
int main(){
  int N;
  int L(100);// 0 to 99
  int i = 0;
  char tmp[512];
  char *tp;
  int sum = 0;
  
  scanf("%d",&N);
  
  scanf("%s",tmp);
  tp = strtok(tmp, ",")
  L(i) = atoi(tp);
  For(i=1 ;tp = strtok(NULL, "\t");i++){
    L(i) = atoi(tp);
  }
  //ソート
  qsort(L,i,sizeof(int),size);
  
  //
  for(int j=0;j<(i/2);j++){
    if(L(2*j)<L(2*j +1) ){
      sum += L(2*j);
    }else{
      sum += L(2*j +1);
    }
  }
  return sum;
}
 
int size(const void *x,const void *y){
  if(*(int *)x > *(int *)y){
    return 1;
  }else if(*(int *)x < *(int *)y){
    return -1;
  }else{
    return 0;
  }
}

Compiler output:
main.c: In function 'main':
main.c:6:9: error: expected declaration specifiers or '...' before numeric constant
    6 |   int L(100);// 0 to 99
      |         ^~~
main.c:15:8: error: implicit declaration of function 'strtok'; did you mean 'strtoq'? [-Wimplicit-function-declaration]
   15 |   tp = strtok(tmp, ",")
      |        ^~~~~~
      |        strtoq
main.c:15:6: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   15 |   tp = strtok(tmp, ",")
      |      ^
main.c:15:24: error: expected ';' before 'L'
   15 |   tp = strtok(tmp, ",")
      |                        ^
      |                        ;
   16 |   L(i) = atoi(tp);
      |   ~                     
main.c:17:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration]
   17 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |   ^~~
main.c:17:10: error: expected ')' before ';' token
   17 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |      ~   ^~
      |          )
main.c:17:40: error: expected ';' before '{' token
   17 |   For(i=1 ;tp = strtok(NULL, "\t");i++){
      |                                        ^
      |                                        ;
main.c:25:8: error: implicit declaration of function 'L' [-Wimplicit-function-declaration]
   25 |     if(L(2*j)<L(2*j +1) ){
      |        ^
Language: C

#include<stdin.h>
#include <stdlib.h>
int size(const void *x,const void *y);
int main(){
  int N;
  int L(100);// 0 to 99
  int i = 0;
  char tmp[512];
  char *tp;
  int sum = 0;
  
  scanf("%d",&N);
  
  scanf("%s",tmp);
  tp = strtok(tmp, ",")
  L(i) = atoi(tp);
  For(i=1 ;tp = strtok(NULL, "\t");i++){
    L(i) = atoi(tp);
  }
  //ソート
  qsort(L,i,sizeof(int),size);
  
  //
  for(int j=0;j<(i/2);j++){
    if(L(2*j)<L(2*j +1) ){
      sum += L(2*j);
    }else{
      sum += L(2*j +1);
    }
  }
  return sum;
}

int size(const void *x,const void *y){
  if(*(int *)x > *(int *)y){
    return 1;
  }else if(*(int *)x < *(int *)y){
    return -1;
  }else{
    return 0;
  }
}


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

#include<bits/stdc++.h>
using namespace std;
int n,a[207],i,s;
int main(){
for(cin>>n,i=0;i<n*2;i++) cin>>a[i];
sort(a,a+2*n);
for(i=0;I<2*n;i+=2) s+=a[i];
cout<<s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'I' was not declared in this scope
    7 | for(i=0;I<2*n;i+=2) s+=a[i];
      |         ^
Language: C++

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

int a[10100],answer=0,n;

int main()
{
    cin>>n;
    for(int i=1;i<=2*n;i++)
      cin>>a[i];
    sort(a+1,a+1+2*n);
    for(int i=1;i<=2*n;i+=2)
      answer+=a[i];。
    cout<<answer<<endl;
    return 0;
}

Compiler output:
a.cc:13:20: error: extended character 。 is not valid in an identifier
   13 |       answer+=a[i];。
      |                    ^
a.cc: In function 'int main()':
a.cc:13:20: error: '\U00003002' was not declared in this scope
   13 |       answer+=a[i];。
      |                    ^~
Language: C++

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

int BBQ[10100],answer=0,n;

int main()
{
    cin>>n;
    for(int i=1;i<=2*n;i++)
      cin>>BBQ[i];
    sort(BBQ+1,BBQ+1+2*n);
    for(int i=1;i<=2*n;i+=2)
      answer+=BBQ[i];。
    cout<<answer<<endl;
    return 0;
}

Compiler output:
a.cc:13:22: error: extended character 。 is not valid in an identifier
   13 |       answer+=BBQ[i];。
      |                      ^
a.cc: In function 'int main()':
a.cc:13:22: error: '\U00003002' was not declared in this scope
   13 |       answer+=BBQ[i];。
      |                      ^~
Language: C++

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

int main() {
	int n;
	cin >> n;
	vector<int> l(2 * n,0);
	for(int i=0;i<2*n;i++)
	{
		cin >> l.at(i);
	}
	sort(l.begin(),l.end());
	int sm = 0;
	for(int i=0;i<2*n;i++)
	{
		if(i % 2 == 0)
		{
			sm += l.at(i);
		}
	}
    cout << cnt << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |     cout << cnt << endl;
      |             ^~~
      |             int
Language: C++

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define fi first
#define se second
#define pi 3.1415926535
#define mod1 1000000007
#define mod2 1000000009
#define mp make_pair
#define no_of_digits(n) floor(log10(n)) + 1
#define lcm(a, b) (a/__gcd(a,b)*b)

using namespace std;

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

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

  sort(a, a+n);
  ll sm = 0;
  for(int i = 1; i <2*n; i+= 2){
    sm += a[i]+a[i-1];
  }

  cout << am;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:11: error: 'am' was not declared in this scope; did you mean 'sm'?
   35 |   cout << am;
      |           ^~
      |           sm
Language: C++

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

int main(){
    int n;
    scanf("%d", &n);
    for(int i=0;i<2*n;i++) scanf("%d", &a[i]);
    sort(a, a+2*n);
    int ans = 0;
    for(int i=0;i<2*n;i+=2) ans += a[i];
    printf("%d\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:41: error: 'a' was not declared in this scope
    7 |     for(int i=0;i<2*n;i++) scanf("%d", &a[i]);
      |                                         ^
a.cc:8:10: error: 'a' was not declared in this scope
    8 |     sort(a, a+2*n);
      |          ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  
  int n; cin>>n; n*=2;
  int s[n];
  for(int i=0; i<n; i++){cin>>s[i];}
  sort(s, s+n);
  int m=0;
  for(int i=0; i<n-1; i++){
    m+=min(s[i], s[i+1]);
  }
  cout<<m;
}

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


import java.util.*;

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

        int N = sc.nextInt();

        ArrayList<Integer> arr = new ArrayList<>();

        for(int i=0;i<2*N;i++){
            arr.add(sc.nextInt());
        }

        Collections.sort(arr,Collections.reverseOrder());

        int total_meals=0;
        for(int i=0;i<2*N;i+=2){
            total_meals +=Math.min(arr.get(i), arr.get(i+1));
        }
        System.out.println(total_meals);


    }
}


Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n;
  cin >> n;
  long long a[2*n];
  for(int i=0;i<2*n;i++){
    cin >> a[i];
  }
  sort(a,a+n);
  long long ans=0;
  for(int i=0;i<2*n;i=i+2){
    ans=ans+min(a[i]+a[i+1]);
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: no matching function for call to 'min(long long int)'
   13 |     ans=ans+min(a[i]+a[i+1]);
      |             ~~~^~~~~~~~~~~~~
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: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:13:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   13 |     ans=ans+min(a[i]+a[i+1]);
      |             ~~~^~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[2*n];
  int sum=0;
  for(int i=0;i<2*n;i++)
  {
    cin>>arr[i];
  }
  sort(a,a+(2*n));
  for(int i=0;i<2*n;)
  {
    sum+=a[i];
    i+=2;
  }
  cout<<sum<<'\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: 'arr' was not declared in this scope
   11 |     cin>>arr[i];
      |          ^~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  priority_queue <int> pq;
  for (int i = 0; i < 2*n; i++) {
    int a;
    cin >> a;
    pq.push(a);
  }
  int ans = 0;
  for (int i = 0; i < 2*n; i++) {
    if (i%2 = 1) {
      ans += pq.top();
    }
    pq.pop();
  }
  cout << ans << endl;
}

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

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

const int MAXN = 300 + 21;
int a[MAXN];
long long ans;
int main() {
 int n;
  cin >> n;
  for (int i = 0; i < 2 * n; i++)
  		cin >> a[i];
  sort(a, a + (2 * n));
  for (int i = 0; i <  * n; i++) {
   	ans += a[i]; 
  }
  cout << ans << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: invalid type argument of unary '*' (have 'int')
   13 |   for (int i = 0; i <  * n; i++) {
      |                        ^~~
Language: C++

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

const int MAXN = 300 + 21;
int a[MAXN];
long long ans;
int main() {
 int n;
  cin >> n;
  for (int i = 0; i < 2 * n; i++)
  		cin >> a[i];
  sort(a, a + (2 * n));
  for (int i = 0; i <  * n; i++) {
   	ans += a[i]; 
  }
  cout << ans << '\n';
  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:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |   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:12:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   12 |   sort(a, a + (2 * n));
      |   ^~~~
      |   std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:13:24: error: invalid type argument of unary '*' (have 'int')
   13 |   for (int i = 0; i <  * n; i++) {
      |                        ^~~
a.cc:16:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   16 |   cout << ans << '\n';
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

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

li.sort()
li1 = []

for i in range(2*n):
    if i%2==0:
        li1.append(li[i])
print(sum(li1))

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