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

import java.util.Scanner;
import java.util.Arrays;
 
public class Main {
 
		public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int n = sc.nextInt();
	        int k = sc.nextInt();
			String[] strs = new String[n];
			for (int i = 0; i < n; i++) { 
				strs[i] = sc.nextLine(); 
            }
	       Arrays.sort(strs);
			String min = 0;
	        for(int j = 0; j < k;j++){
            	min = min + strs[j]; 
            }
			System.out.println(min);
	}
}

Compiler output:
Main.java:15: error: incompatible types: int cannot be converted to String
			String min = 0;
			             ^
1 error
Language: C

#include<stdio.h>

int main(void){
    int max,fluet;
    int alt;
    int sum = 0;
    int price[256];

    if(scanf("%d%d",&max,&fluet) != 2){
        return -1;
    }

    for(int i = 0;i < max;i++){
        if(scanf("%d",&price[i]) != 1){
            retyrn -1;
        }
    }

    for(int i = 0;i < max - 1;i++){
        for(int j = i + 1;j < max;j++){
            if(price[i] > price[j]){
                alt = price[i];
                price[i] = price[j];
                price[j] = alt;
            }
        }
    }

    for(int k = 0;k < fluet;k++){
        sum += price[k];
    }

     printf("%d\n",sum);

     return 0;
}


Compiler output:
main.c: In function 'main':
main.c:15:13: error: 'retyrn' undeclared (first use in this function)
   15 |             retyrn -1;
      |             ^~~~~~
main.c:15:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
void main()
{
  int k,n,price[1000],sum=0;
  scanf("%d",&k);
  scanf("%d",&n);
  for(int i=0;i<n;i++)
  {
    scanf("%d",&price);
  }
  for(int i=0;i<n;++i)
  {
    for(int j=i+1;j<n;++j)
    {
       if(pricei]>price[j])
       {
          int a=price[i];
          price[i]=price[j];
          price[j]=a;
       }   
    } 
  }
  for(int i=0;i<k;++i)
  {
    sum=sum+price[i];
  }
  
    
  
}

Compiler output:
main.c: In function 'main':
main.c:15:11: error: 'pricei' undeclared (first use in this function); did you mean 'price'?
   15 |        if(pricei]>price[j])
      |           ^~~~~~
      |           price
main.c:15:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:17: error: expected ')' before ']' token
   15 |        if(pricei]>price[j])
      |          ~      ^
      |                 )
main.c:15:17: error: expected statement before ']' token
main.c:15:18: error: expected expression before '>' token
   15 |        if(pricei]>price[j])
      |                  ^
main.c:15:27: error: expected statement before ')' token
   15 |        if(pricei]>price[j])
      |                           ^
Language: Java

import java.util.Scanner;
import java.util.Arrays;
 
public class Main {
 
		public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int n = sc.nextInt();
	        int k = sc.nextInt();
			String[] strs = new String[n];
			for (int i = 0; i < n; i++) { 
				strs[i] = sc.nextLine(); 
            }
	       Arrays.sort(strs);
			int min;
	        for(int j = 0; j < k;j++){
            	min = min + strs[j]; 
            }
			System.out.println(min);
	}
}

Compiler output:
Main.java:17: error: incompatible types: String cannot be converted to int
            	min = min + strs[j]; 
            	          ^
1 error
Language: C++

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

int main() {
  int N, K;
  vector<int> vec(1000);
  
  cin >> N >> K;

  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  for (int j = 0; j < N; j++) {
    for (int k = j + 1; k < N; k++) {
      if (vec(j) > vec(k)) {
        tmp =  vec(j);
        vec(j) = vec(k);
        vec(k) = tmp;
      }
    }
  }
    
  cout << vec.at(0) + vec.at(1) + vec.at(2) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: no match for call to '(std::vector<int>) (int&)'
   16 |       if (vec(j) > vec(k)) {
      |           ~~~^~~
a.cc:16:23: error: no match for call to '(std::vector<int>) (int&)'
   16 |       if (vec(j) > vec(k)) {
      |                    ~~~^~~
a.cc:17:9: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   17 |         tmp =  vec(j);
      |         ^~~
      |         tm
a.cc:17:19: error: no match for call to '(std::vector<int>) (int&)'
   17 |         tmp =  vec(j);
      |                ~~~^~~
a.cc:18:12: error: no match for call to '(std::vector<int>) (int&)'
   18 |         vec(j) = vec(k);
      |         ~~~^~~
a.cc:18:21: error: no match for call to '(std::vector<int>) (int&)'
   18 |         vec(j) = vec(k);
      |                  ~~~^~~
a.cc:19:12: error: no match for call to '(std::vector<int>) (int&)'
   19 |         vec(k) = tmp;
      |         ~~~^~~
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(1000);

  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  for (int j = 0; j < N; j++) {
    for (int k = j + 1; k < N; k++) {
      if (vec(j) > vec(k)) {
        tmp =  vec(j);
        vec(j) = vec(k);
        vec(k) = tmp;
      }
    }
  }
    
  cout << vec.at(0) + vec.at(1) + vec.at(2) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if (vec(j) > vec(k)) {
      |           ~~~^~~
a.cc:15:23: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if (vec(j) > vec(k)) {
      |                    ~~~^~~
a.cc:16:9: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   16 |         tmp =  vec(j);
      |         ^~~
      |         tm
a.cc:16:19: error: no match for call to '(std::vector<int>) (int&)'
   16 |         tmp =  vec(j);
      |                ~~~^~~
a.cc:17:12: error: no match for call to '(std::vector<int>) (int&)'
   17 |         vec(j) = vec(k);
      |         ~~~^~~
a.cc:17:21: error: no match for call to '(std::vector<int>) (int&)'
   17 |         vec(j) = vec(k);
      |                  ~~~^~~
a.cc:18:12: error: no match for call to '(std::vector<int>) (int&)'
   18 |         vec(k) = tmp;
      |         ~~~^~~
Language: C

#includ<stdio.h>
#include<stdlib.h>

int main(){
  int N,K,i;
  while(scanf("%d %d",&N,&K)==0);
  char s[N];
  int t=0;

  
  for(i=0;i<N;i++){
    while(scanf("%d",s[i])==0);
  }
    qsort(s,N-1,sizeof(int),compare);
  
  for(i=0;i<K,i++){
    t=t+s[i];
  }
  
  printf("%d",t)
  
  return 0;
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #includ; did you mean #include?
    1 | #includ<stdio.h>
      |  ^~~~~~
      |  include
main.c: In function 'main':
main.c:6:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    6 |   while(scanf("%d %d",&N,&K)==0);
      |         ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include<stdlib.h>
  +++ |+#include <stdio.h>
    3 | 
main.c:6:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 |   while(scanf("%d %d",&N,&K)==0);
      |         ^~~~~
main.c:6:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:12:11: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |     while(scanf("%d",s[i])==0);
      |           ^~~~~
main.c:12:11: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:29: error: 'compare' undeclared (first use in this function)
   14 |     qsort(s,N-1,sizeof(int),compare);
      |                             ^~~~~~~
main.c:14:29: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:18: error: expected ';' before ')' token
   16 |   for(i=0;i<K,i++){
      |                  ^
      |                  ;
main.c:20:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   20 |   printf("%d",t)
      |   ^~~~~~
main.c:20:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:20:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:17: error: expected ';' before 'return'
   20 |   printf("%d",t)
      |                 ^
      |                 ;
   21 | 
   22 |   return 0;
      |   ~~~~~~
Language: C

#include <iostream>
#include <algorithm>
#define FOR(a,b) for(int (a) =0 ; a < int (b) ;a++)
using namespace std;
int main()
{
  int price[1000],i,n,k,sum=0;
  cin>>n >>k;
  
  FOR(i,n)
    cin>>price[i];
  
  sort(price,price+n);
  
  FOR(i,k)
    sum += price[i];
  
  cout<<sum;
  
  return 0;
  
}

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

#include <iostream>
#include <algorithm>
#define FOR(a,b) for(int a =0 ; a < int c ;a++)
using namespace std;
int main()
{
  int price[1000],i,n,k,sum=0;
  cin>>n >>k;
  
  FOR(i,n)
    cin>>price[i];
  
  sort(price,price+n);
  
  FOR(i,k)
    sum += price[i];
  
  cout<<sum<<"\n";
  
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:37: error: expected primary-expression before 'int'
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                                     ^~~
a.cc:10:3: note: in expansion of macro 'FOR'
   10 |   FOR(i,n)
      |   ^~~
a.cc:3:37: error: expected ';' before 'int'
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                                     ^~~
a.cc:10:3: note: in expansion of macro 'FOR'
   10 |   FOR(i,n)
      |   ^~~
a.cc:3:37: error: expected primary-expression before 'int'
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                                     ^~~
a.cc:10:3: note: in expansion of macro 'FOR'
   10 |   FOR(i,n)
      |   ^~~
a.cc:3:37: error: expected ')' before 'int'
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                     ~               ^~~
a.cc:10:3: note: in expansion of macro 'FOR'
   10 |   FOR(i,n)
      |   ^~~
a.cc:3:47: error: expected ';' before ')' token
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                                               ^
a.cc:10:3: note: in expansion of macro 'FOR'
   10 |   FOR(i,n)
      |   ^~~
a.cc:3:37: error: expected primary-expression before 'int'
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                                     ^~~
a.cc:15:3: note: in expansion of macro 'FOR'
   15 |   FOR(i,k)
      |   ^~~
a.cc:3:37: error: expected ';' before 'int'
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                                     ^~~
a.cc:15:3: note: in expansion of macro 'FOR'
   15 |   FOR(i,k)
      |   ^~~
a.cc:3:37: error: expected primary-expression before 'int'
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                                     ^~~
a.cc:15:3: note: in expansion of macro 'FOR'
   15 |   FOR(i,k)
      |   ^~~
a.cc:3:37: error: expected ')' before 'int'
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                     ~               ^~~
a.cc:15:3: note: in expansion of macro 'FOR'
   15 |   FOR(i,k)
      |   ^~~
a.cc:3:47: error: expected ';' before ')' token
    3 | #define FOR(a,b) for(int a =0 ; a < int c ;a++)
      |                                               ^
a.cc:15:3: note: in expansion of macro 'FOR'
   15 |   FOR(i,k)
      |   ^~~
Language: C++

#include<iostream>
using namespace std;

int main(){
    int n,k;
    int p[1000];
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    int tmp;
    for (int i=0; i<n; i++) {
        for (int j=i+1; j<n; j++) {
            if (p[i] > p[j]) {
                tmp =  p[i];
                p[i] = p[j];
                p[j] = tmp;
            }
        }
    }
    int t;
    for(int i=0;i<k;i++){
        total=total+p[i];
    }
    cout<<t<< endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'total' was not declared in this scope
   23 |         total=total+p[i];
      |         ^~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include <algorithm>
#include <iostream>
int cmpnum(const void * n1, const void * n2)
{
	if (*(long *)n1 > *(long *)n2)
	{
		return 1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return -1;
	}
	else
	{
		return 0;
	}
}
int main()
{
	int N;
	scanf("%d",&N);
	int price[N];
	int K;
	scanf("%d",&K);
	for (int i = 0; i < K; ++i)
	{
		scanf("%d",&price[i]);
	}
	std::sort(price,price+K);

	int ans=0;

	for(int i =0;i<K;i++){
		ans += price[i];
	}

	printf("%d",ans);


}

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

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int A[1002];
  int n,k;
  cin>>n>>k;
  for(int i=1;i<=n;i++) cin>>A[i];
  sort(A,A+n+1);
  for (int num=1;num<=k;num++)
  {
    A[0]+=A[i];
  }
  cout<<A[0];
}


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

#include<iostream>
using namespace std;

int main(){
    int n,k;
    int p[1000];
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    int tmp;
    for (int i=0; i<n; i++) {
        for (int j=i+1; j<n; j++) {
            if (p[i] > p[j]) {
                tmp =  p[i];
                p[i] = p[j];
                p[j] = tmp;
            }
        }
    }
    int total;
    for(int i=0;i<k;i++){
        total=total+p[i];
    }
    cout<<total;<< endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: expected primary-expression before '<<' token
   25 |     cout<<total;<< endl;
      |                 ^~
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  

  // 100個の入力を受け取る
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
   int B = vec.at(i)
  for (int k = 0; k < N; k++) {

  
     int A = min(B(k))
  
  for (int j = 0; j < K; j++) {
    cin >> A.at(j);
    A+=;
  }
  cout << A << endl;
}
    

}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: 'i' was not declared in this scope
   14 |    int B = vec.at(i)
      |                   ^
a.cc:15:19: error: 'k' was not declared in this scope
   15 |   for (int k = 0; k < N; k++) {
      |                   ^
Language: C

#include<stdio.h>
void swap(int *xp, int *yp)  
{  
    int temp = *xp;  
    *xp = *yp;  
    *yp = temp;  
}  
  
// A function to implement bubble sort  
void bubbleSort(int arr[], int n)  
{  
    int i, j;  
    for (i = 0; i < n-1; i++)      
    {
    // Last i elements are already in place  
    for (j = 0; j < n-i-1; j++)  
    {
        if (arr[j] > arr[j+1])  
            swap(&arr[j], &arr[j+1]);  
    }
    } 
}
int main()
{
  int n,k;
  long int sum=0;
  scanf("%d%d",&n,&k);
  for(int i=0;i<n;i++)
    scanf("%d",&a[i]);
  bubblesort(a,n);
  for(int i=0;i<k;i++)
    sum+=a[i];
  printf("%ld",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:29:17: error: 'a' undeclared (first use in this function)
   29 |     scanf("%d",&a[i]);
      |                 ^
main.c:29:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:30:3: error: implicit declaration of function 'bubblesort'; did you mean 'bubbleSort'? [-Wimplicit-function-declaration]
   30 |   bubblesort(a,n);
      |   ^~~~~~~~~~
      |   bubbleSort
Language: C++

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

int main() {
  int N;
  int K;
  cin >> N >> K;

  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());

  int sum = 0;
  for (int i = 0; i < K; i++) {
    sum += vec.at(i);
  }

  cout << sum << endl;
}

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

#include <iostream>
#include<algorithm>
using namespace std;
void BubbleSort(int data[], int n){
     int flag;
     for(int i=0;i<n;i++){
        flag = 0;
        for(int j=0;j<n-i-1;j++){
            if(data[j+1]<data[j]){
                swap(data[j+1],data[j]);
                flag=1;
            }
        }
        if(flag==0) return ;
     }
int main()
{
    int x,k,ans=0;
    cin>>x>>k;
    int a[x+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    BubbleSort(a,x)
    for(int i=1;i<=k;i++)
    {
        ans+=a[i];
    }
    cout<<ans;
    return 0;
}



Compiler output:
a.cc: In function 'void BubbleSort(int*, int)':
a.cc:16:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   16 | int main()
      |         ^~
a.cc:16:9: note: remove parentheses to default-initialize a variable
   16 | int main()
      |         ^~
      |         --
a.cc:16:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:17:1: error: a function-definition is not allowed here before '{' token
   17 | {
      | ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:4:35: note: to match this '{'
    4 | void BubbleSort(int data[], int n){
      |                                   ^
Language: C++

#include <iostream>
#include<algorithm>
using namespace std;
void BubbleSort(int data[], int n){
     int flag;
     for(int i=0;i<n;i++){
        flag = 0;
        for(int j=0;j<n-i-1;j++){
            if(data[j+1]<data[j]){
                swap(data[j+1],data[j]);
                flag=1;
            }
        }
        if(flag==0) return ;
     }
int main()
{
    int x,k,ans=0;
    cin>>x>>k;
    int a[x+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    BubbleSort(a,x)
    for(int i=1;i<=k;i++)
    {
        ans+=a[i];
        cout<<a[i];
    }
    cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'void BubbleSort(int*, int)':
a.cc:16:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   16 | int main()
      |         ^~
a.cc:16:9: note: remove parentheses to default-initialize a variable
   16 | int main()
      |         ^~
      |         --
a.cc:16:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:17:1: error: a function-definition is not allowed here before '{' token
   17 | {
      | ^
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:4:35: note: to match this '{'
    4 | void BubbleSort(int data[], int n){
      |                                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> P;

template <typename T> T gcd(T x, T y) { return( y ? gcd(y, x % y) : x); }
template <typename T> T lcm(T x, T y) { return( x / gcd(x, y) * y); }
template <typename T> void printVec(vector<T> &vec) {
  cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    cout << *it << " ";
  }
  cout << endl;
}

int ans = INT_MAX;

void cout1 (int level, int max_level, vector <int> &p, vector <int> &q, int k) {
  int size = q.size();
  if (level == max_level) {
    q[level] = 0;
    // printVec(q);
    int count = 0;
    int ans2 = 0;
    for (int i = 0; i < size; i++) {
      count = count + q[i];
      if (q[i] == 1) {
        ans2 = ans2 + p[i];
      }
    }
    // cout << "count = " << count << endl;
    // cout << "ans2 = " << ans2 << endl;
    if (count == k) {
      if (ans > ans2) {
        ans = ans2;
      }
    }
    // cout <<"------" << endl;
    q[level] = 1;
    for (int i = 0; i < size; i++) {
      count = count + q[i];
      if (q[i] == 1) {
        ans2 = ans2 + p[i];
      }
    }
    if (count == k) {
      if (ans > ans2) {
        ans = ans2;
      }
    }
    return 0;
  }
  q[level] = 0;
  cout1(level + 1, max_level, p, q, k);
  
  q[level] = 1;
  cout1(level + 1, max_level, p, q, k);

}
int main() {

  int n, k;
  cin >> n >> k;
  vector <int> p(n);
  vector <int> q(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  cout1 (0, n, p, q, k);
  cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void cout1(int, int, std::vector<int>&, std::vector<int>&, int)':
a.cc:51:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   51 |     return 0;
      |            ^
Language: C++

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

int main() {
  int N;
  int K;
  cin >> N >> K;

  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }

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

  int sum = 0;
  for (int i = 0; i < K; i++) {
    sum += vec.at(i)
  }

  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:18: error: cannot convert 'std::vector<int>::iterator' to 'void*'
   15 |   qsort(vec.begin(), vec.end());
      |         ~~~~~~~~~^~
      |                  |
      |                  std::vector<int>::iterator
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:970:26: note:   initializing argument 1 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
a.cc:19:21: error: expected ';' before '}' token
   19 |     sum += vec.at(i)
      |                     ^
      |                     ;
   20 |   }
      |   ~
Language: Java

import java.util.*;
 public class first
 {
   public static void main(String args[])
   { 
     Scanner s = new Scanner(System.in);
     int n = s.nextInt();
     int k = s.nextInt();
     int i,j,swap,sum=0;
     int p[] = new int[n];
     for(i=0;i<n;i++)
     {
       p[i] = s.nextInt();
     }
     for(i=0;i<n;i++)
     {
       for(j=i+1;j<n-1;j++)
       {
         if(p[i]>p[j])
         {
           swap = p[i];
           p[i] = p[j];
           p[j] = swap;
         }
       }
     }
     for(i=0;i<k;i++)
     {
       sum+=p[i];
     }
   }
 }  

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

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k;
  	cin >> n >> k;
  	
   	vector<int> prices;
  	for(int i = 0; i < n; i++){
    	int a;
      	cin >> a;
      	prices.push_back(a);
    }
  
  	sort(prices.begin(), prices.end())
    int total = 0;
  	for(int i = 0; i < k; i++){
    	total += prices[i];
    }
  
  	cout << total;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:43: error: expected ';' before 'int'
   14 |         sort(prices.begin(), prices.end())
      |                                           ^
      |                                           ;
   15 |     int total = 0;
      |     ~~~                                    
a.cc:17:9: error: 'total' was not declared in this scope
   17 |         total += prices[i];
      |         ^~~~~
a.cc:20:17: error: 'total' was not declared in this scope
   20 |         cout << total;
      |                 ^~~~~
Language: C++

#include<iostream>
#include<vector>
#define ll long long

using namespace std;

void test_case()
{
ll n,k,temp=0;
cin>>n>>k;
vector<ll> p;
for(int i=0;i<n;++i)
{
cin>>temp;
p.push_back(temp);
}
sort(p.begin(),p.end());
ll s=0;
for(int i=0;i<k;++i)
{
s+=p[i];
}
cout<<s;
}
int main()
{
test_case();
return 0;
}

Compiler output:
a.cc: In function 'void test_case()':
a.cc:17:1: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 | sort(p.begin(),p.end());
      | ^~~~
      | short
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);

  // 100個の入力を受け取る
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
   for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
     int A = min(vec.at(i))
  }
  for (int j = 0; j < K; j++) {
    cin >> A.at(j);
    A+=;
  }
  cout << A << endl;
    

}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   15 |      int A = min(vec.at(i))
      |              ~~~^~~~~~~~~~~
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:15:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |      int A = min(vec.at(i))
      |              ~~~^~~~~~~~~~~
/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
a.cc:18:12: error: 'A' was not declared in this scope
   18 |     cin >> A.at(j);
      |            ^
a.cc:19:8: error: expected primary-expression before ';' token
   19 |     A+=;
      |        ^
a.cc:21:11: error: 'A' was not declared in this scope
   21 |   cout << A << endl;
      |           ^
Language: C++

#include <vector>
#include <iostream>

#define int long long

signed main() {
  int n, k;
  std::cin >> n >> k;
  
  int a[n];
  
  for(int i = 0; i < n; i++)
    std::cin >> a[i];
  
  std::sort(a, a+n);
  
  int ans = 0;
  for(int i = 0; i < k; i++)
    ans += a[i];
  
  std::cout << ans << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 |   std::sort(a, a+n);
      |        ^~~~
      |        qsort
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);

  // 100個の入力を受け取る
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int A = min(vec.at(i))
  for (int j = 0; j < K; j++) {
    cin >> A.at(j);
    A+=;
  }
  cout << A << endl;
    

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: 'i' was not declared in this scope
   13 |   int A = min(vec.at(i))
      |                      ^
a.cc:14:19: error: 'j' was not declared in this scope
   14 |   for (int j = 0; j < K; j++) {
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int A[1002];
  int n,k;
  cin>>n>>k;
  for(int i=1;i<=n;i++) cin>>A[i];
  sort(A,A+n+1)
  for (int num=0,i=1,last=0;num<k;num++)
  {
    while(A[i]==last and i<n)i++;
    A[0]+=A[i];
    last=A[i];
  }
  cout<<A[0];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: expected ';' before 'for'
    9 |   sort(A,A+n+1)
      |                ^
      |                ;
   10 |   for (int num=0,i=1,last=0;num<k;num++)
      |   ~~~           
a.cc:10:29: error: 'num' was not declared in this scope; did you mean 'enum'?
   10 |   for (int num=0,i=1,last=0;num<k;num++)
      |                             ^~~
      |                             enum
Language: C

#include<stdio.h>
#include <stdlib.h>

void quick_sort(int *ary, int begin, int end){
  int i, j, work, pivot;
  pivot = ary[ ( begin + end ) / 2 ];
  i = begin;
  j = end;
  while( 1 ){
    while( ary[i] < pivot ) ++i;
    while( ary[j] > pivot ) --j;
    if( i >= j) break;
    work = ary[i];
    ary[i] = ary[j];
    ary[j] = work;
    i++;
    j--;
  }
  if( begin < i - 1 ) quick_sort(ary, begin, i - 1 );
  if( j + 1 < end ) quick_sort(ary, j + 1, end );
}
int main(){
int n,k,i;
scanf("%d %d",&n,&k);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
quicksort(a,0,k-1);
for(i=0;i<k;i++)
printf("%d",a[i]);
}

Compiler output:
main.c: In function 'main':
main.c:28:1: error: implicit declaration of function 'quicksort'; did you mean 'quick_sort'? [-Wimplicit-function-declaration]
   28 | quicksort(a,0,k-1);
      | ^~~~~~~~~
      | quick_sort
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k;
cin>>n>>k;
vector<int> arr(n);
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
sort(arr.begin(),arr.end());
int sum=0;
for(int i=0;i<k;i++)
{
sum+=arr[i]
}
cout<<sum<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: expected ';' before '}' token
   16 | sum+=arr[i]
      |            ^
      |            ;
   17 | }
      | ~
Language: C++


#include<iomanip>
#include<string>
#include<math.h>
#include<vector>
#include <stdlib.h>
#include<iostream>
using namespace std;
int main(){
    vector<int> a(1000);
    int N,K;
    cin>>N>>K;
    for(int i=0;i<N;i++)
    {
        cin>>a[i];
    }
    stable_sort(&a[0],&a[N]);
    int sum =0;
    for(int i=0;i<K;i++)
    {
        sum+=a[i];
    }
    cout<<sum<<endl;
        return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'stable_sort' was not declared in this scope
   17 |     stable_sort(&a[0],&a[N]);
      |     ^~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
  int N;
  int K;
  cin >> N >> K;

  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
  }

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

  int sum = 0;
  for (int i = 0; i < K; i++) {
    sum += p.at(i)
  }

  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<int> p(N);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> p(N);
      |          ^~~
a.cc:11:12: error: 'p' was not declared in this scope
   11 |     cin >> p.at(i);
      |            ^
a.cc:14:8: error: 'p' was not declared in this scope
   14 |   sort(p.begin(), p.end());
      |        ^
a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |   sort(p.begin(), p.end());
      |   ^~~~
      |   short
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  
  
  vector<int>box(N);
  
  
  for(int i = 0; i < N; i++){
    cin >> box.at(i);
  }
  sort(vec.begin(),vec.end());
  
  int sum = 0;
  
  for(int j = 0; j < K; j++){
    sum =+ box.at(j);
  }
  
  cout << sum << endl;
    
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: 'vec' was not declared in this scope
   15 |   sort(vec.begin(),vec.end());
      |        ^~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
	int N,K;
	int sum=0;
	cin >>N >>K;

	vector<int> vec(N);
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
	}

	std::qsort(vec.begin(), vec.end());

	for (int i = 0; i < K; i++) {
		sum +=  vec.at(i);
	}

	cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:29: error: cannot convert 'std::vector<int>::iterator' to 'void*'
   15 |         std::qsort(vec.begin(), vec.end());
      |                    ~~~~~~~~~^~
      |                             |
      |                             std::vector<int>::iterator
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:970:26: note:   initializing argument 1 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
Language: C++

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

using namespace std;
int N,K;
vector<int> pN;

int main(){
  cin>>N>>K;
  int x;
  for(int i =0;i<N;i++){
    cin>>x;
    pN.push_back(x);
  }
  sort( pN.begin(), pN.end() );
  int sum=0;
  for(int i=0;i<K;i++)sum=sum+pn[i];
  cout<<sum<<endl;
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #inclede; did you mean #include?
    2 | #inclede <algorithm>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |   sort( pN.begin(), pN.end() );
      |   ^~~~
      |   short
a.cc:18:31: error: 'pn' was not declared in this scope; did you mean 'pN'?
   18 |   for(int i=0;i<K;i++)sum=sum+pn[i];
      |                               ^~
      |                               pN
Language: C++


#include<iomanip>
#include<string>
#include<math.h>
#include<vector>
#include<iostream>
using namespace std;
int main(){
    vector<int> a(1000);
    int N,K;
    cin>>N>>K;
    for(int i=0;i<N;i++)
    {
        cin>>a[i];
    }
    qsort(&a[0],&a[N]);
    int sum =0;
    for(int i=0;i<K;i++)
    {
        sum+=a[i];
    }
    cout<<sum<<endl;
        return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type*' {aka 'int*'} to 'size_t' {aka 'long unsigned int'} [-fpermissive]
   16 |     qsort(&a[0],&a[N]);
a.cc:16:10: error: too few arguments to function 'void qsort(void*, size_t, size_t, __compar_fn_t)'
   16 |     qsort(&a[0],&a[N]);
      |     ~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/iomanip:42,
                 from a.cc:2:
/usr/include/stdlib.h:970:13: note: declared here
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |             ^~~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int N,K;
  cin>>N>>K;
  int arr[N];
  for(int i=0;i<N;i++)
    cin>>arr[i];
  sort(arr,arr+N);
  
  int t;
  for(int i=0;i<K;i++)
    t = t + arr[i] 
    
  cout<<t;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: expected ';' before 'cout'
   15 |     t = t + arr[i]
      |                   ^
      |                   ;
   16 | 
   17 |   cout<<t;
      |   ~~~~
Language: C++

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  sort(p.begin(),p.end());
  int ans=0;
  rep(i,k) ans += p[i];
  cout << ans << endl;
  return 0;
  

Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: expected '}' at end of input
   16 |   return 0;
      |            ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++


#include<iomanip>
#include<string>
#include<math.h>
#include<vector>
#include<iostream>
using namespace std;
int main(){
    vector<int> a(1000);
    int N,K;
    cin>>N>>K;
    for(int i=0;i<N;i++)
    {
        cin>>a[i];
    }
    sort(&a[0],&a[N]);
    int sum =0;
    for(int i=0;i<K;i++)
    {
        sum+=a[i];
    }
    cout<<sum<<endl;
        return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   16 |     sort(&a[0],&a[N]);
      |     ^~~~
      |     sqrt
Language: C++

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

int main(){
    int k,n;
    int sum = 0;
    cin >> n >> k;
    int p[n];

    for(int i=0;i<n;i++){
        cin >> p[i];
    }
    sort(p);
    for(int i=0;i<k;i++){
        sum += p[i];
    }
    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: no matching function for call to 'sort(int [n])'
   13 |     sort(p);
      |     ~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 1 provided
Language: C++

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

int main() {
 int N, K, ans;
  cin >> N >> K;
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
  }
  sort(p.begin(), p.end());
  ans=0;
  for (int i = 0; i < K; i++) {
    ans=ans+p.at(i)
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: expected ';' before '}' token
   14 |     ans=ans+p.at(i)
      |                    ^
      |                    ;
   15 |   }
      |   ~
Language: C++

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

#ifdef _DEBUG
    #include "/home/v-o_o-v/deb.h"
    #define deb(x...)cerr << "[" << #x << "] = [";_print(x);
#else
    #define deb(x...)
#endif

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll = long long;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
   
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++)cin >> a[i];
    sort(all(n));
    int sum = 0;
    for(int i = 0; i < k; i++)sum += a[i];
    cout << sum << '\n';
    return 0;
}
// Write Here


Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: request for member 'begin' in 'n', which is of non-class type 'int'
   14 | #define all(x) (x).begin(), (x).end()
      |                    ^~~~~
a.cc:27:10: note: in expansion of macro 'all'
   27 |     sort(all(n));
      |          ^~~
a.cc:14:33: error: request for member 'end' in 'n', which is of non-class type 'int'
   14 | #define all(x) (x).begin(), (x).end()
      |                                 ^~~
a.cc:27:10: note: in expansion of macro 'all'
   27 |     sort(all(n));
      |          ^~~
Language: C++

include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int p[n];
  for(int i=0;i<n;++i) cin>>p[i];
  sort(p,p+n);
  int s=0;
  for(int i=0;i<k;++i) 
  s+=p[i];
  cout<<s;
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin>>n>>k;
      |   ^~~
a.cc:9:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |   sort(p,p+n);
      |   ^~~~
      |   short
a.cc:13:3: error: 'cout' was not declared in this scope
   13 |   cout<<s;
      |   ^~~~
Language: C++

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

int main() {
    int N, K, tmp, ans = 0;
    cin >> N >> K;
    vector<int> vec(N);
    for(int i = 0;i < N;i++){
        cin >> vec.at(i);
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(vec.at(i)>vec.at(j)){
                tmp = vec.at(i)
                vec.at(i) = vec.at(j);
                vec.at(j) = tmp;
            }
        }
    }
    for(int i=0;i<K;i++){
        ans += vec.at(i);
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:32: error: expected ';' before 'vec'
   15 |                 tmp = vec.at(i)
      |                                ^
      |                                ;
   16 |                 vec.at(i) = vec.at(j);
      |                 ~~~
Language: C++

using namespace std;
#include<iostream>
int main()
{
int n,k,a[100];
int sum=0,j;
cin>>n>>k;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
int temp;
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
for(i=0;i<k;i++)
{
sum=sum+a[i];
}
cout<<sum;
}
 
using namespace std;
#include<iostream>
int main()
{
int n,k,a[100];
int sum=0,j,i;
cin>>n>>k;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'i' was not declared in this scope
    8 | for(i=0;i<n;i++)
      |     ^
a.cc:12:5: error: 'i' was not declared in this scope
   12 | for(i=0;i<n;i++)
      |     ^
a.cc:25:5: error: 'i' was not declared in this scope
   25 | for(i=0;i<k;i++)
      |     ^
a.cc: At global scope:
a.cc:34:5: error: redefinition of 'int main()'
   34 | int main()
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main()
      |     ^~~~
a.cc: In function 'int main()':
a.cc:45:19: error: expected statement at end of input
   45 | for(j=i+1;j<n;j++)
      |                   ^
a.cc:45:19: error: expected '}' at end of input
a.cc:44:1: note: to match this '{'
   44 | {
      | ^
a.cc:45:19: error: expected '}' at end of input
   45 | for(j=i+1;j<n;j++)
      |                   ^
a.cc:35:1: note: to match this '{'
   35 | {
      | ^
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);

  // 100個の入力を受け取る
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int A = min(vec)
  for (int j = 0; j < K; j++) {
    cin >> A.at(j);
    A+=;
  }
  cout << A << endl;
    

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: no matching function for call to 'min(std::vector<int>&)'
   13 |   int A = min(vec)
      |           ~~~^~~~~
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:14: note:   'std::vector<int>' is not derived from 'std::initializer_list<_Tp>'
   13 |   int A = min(vec)
      |           ~~~^~~~~
/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
a.cc:14:19: error: 'j' was not declared in this scope
   14 |   for (int j = 0; j < K; j++) {
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin >> n >> k;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  int sum=0,min=1001,max=0;
  if(n-k>k){
  while(k!=0)
  {
    for(int i=0;i<n;i++)
    {
      if(min>arr[i])
      {
        min=arr[i];
      }
    }
    sum+=min;
    for(int i=0;i<n;i++)
    {
      if(min==arr[i])
      {
        arr[i]=1001;
        break;
      }
    }  
  }}
  else{
    for(int i=0;i<n;i++)
    {
      if(max<arr[i])
      {
        max=arr[i];
      }
    }
    sum+=max;
    for(int i=0;i<n;i++)
    {
      if(max==arr[i])
      {
        arr[i]=0;
        break;
      }
    }  
  }
  }
  cout << sum;
}

Compiler output:
a.cc:50:3: error: 'cout' does not name a type
   50 |   cout << sum;
      |   ^~~~
a.cc:51:1: error: expected declaration before '}' token
   51 | }
      | ^
Language: C

#include<stdio.h>

int main(void)
{
  int size,reps;
  scanf("%d%d",&size,&reps);
  int i=0,arr[size]=0;
  
  while(i<size)
  {
    scanf("%d",&arr[i]);
    i++;
  }
  
 int sum=0,min[reps],j=0,l;
 print("\n");
  
  
   for(i=0;i<size;i++)
   {
    for(l=0;l<size;l++)
    {
      if(arr[i]>arr[j])
      {
        int tmp=arr[i];
        arr[i]=arr[j];
        arr[j]=tmp;
      }
    }
     
 while(j!=reps)
 {
  sum=arr[j]+sum;      	
 }
     printf("%d",sum);
   
  

Compiler output:
main.c: In function 'main':
main.c:7:21: error: variable-sized object may not be initialized except with an empty initializer
    7 |   int i=0,arr[size]=0;
      |                     ^
main.c:16:2: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   16 |  print("\n");
      |  ^~~~~
      |  printf
main.c:35:6: error: expected declaration or statement at end of input
   35 |      printf("%d",sum);
      |      ^~~~~~
main.c:35:6: error: expected declaration or statement at end of input