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

#include<iostream>
using namespace std;
int main()
{
    int a,i,k;
    cin>>a;
    int ar[a];
    cin>>k;
    for(i=0; i<a; i++)
    {
        cin>>ar[i];
    }
    sort(ar,ar+a);

     int sum=0;

     for(i=0; i<k; i++)
    {
        sum+=ar[i];
    }
    cout<<sum<<endl;

    return 0;
}

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

#include<bits\stdc++.h>
using namespace std;
int main()
{
    int a,i,k;
    cin>>a;
    int ar[a];
    cin>>k;
    for(i=0; i<a; i++)
    {
        cin>>ar[i];
    }
    sort(ar,ar+a);

     int sum=0;

     for(i=0; i<k; i++)
    {
        sum+=ar[i];
    }
    cout<<sum<<endl;

    return 0;
}


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

#include<stdio.h>
int main(){
    int a, b, c[999], i, j, w, g;
    scanf("%d %d",&a, &b);
    for ( i = 0; i < a; i++)
    {
        scanf("%d",&c[i]);
    }
    
    for ( i = 0; i < a; i++)
    {
        for (j = (i + 1); j < a; j++)
        {
            if (c[i] > c[j])
            {
                w = c[i];
                c[i] = c[j];
                c[j] = w;
            }
            
        }
        
    }

    
    for ( i = 0; i < b; i++)
    {
        g = 0:
        g = g + c[i];
    }
    printf("%d\n",g);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:28:14: error: expected ';' before ':' token
   28 |         g = 0:
      |              ^
      |              ;
Language: C++

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

int main(){

int fruits[1001] , pickFruits , N ;
  
strm >> N >> pickFruits >> endl ;
  
for(int i=0; i<N ; i++){
	cin >> fruits[i] ;
}
  
sort(fruits , fruits+N);
int sum=0;  
for(int i=0; i<pickFruits;i++){
sum+= arr[i];
}
 cout << sum ;
return 0 ;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:1: error: 'strm' was not declared in this scope; did you mean 'tm'?
    9 | strm >> N >> pickFruits >> endl ;
      | ^~~~
      | tm
a.cc:18:7: error: 'arr' was not declared in this scope
   18 | sum+= arr[i];
      |       ^~~
Language: C++

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

int main(){

int fruits[1001] , pickFruits , N ;
  
strm >> N >> pickFruits >> endl ;
  
for(int i=0; i<N ; i++){
	cin >> fruits[i] ;
}
  
sort(arr , arr+N);
int sum=0;  
for(int i=0; i<pickFruits;i++){
sum+= arr[i];
}
 cout << sum ;
return 0 ;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:1: error: 'strm' was not declared in this scope; did you mean 'tm'?
    9 | strm >> N >> pickFruits >> endl ;
      | ^~~~
      | tm
a.cc:15:6: error: 'arr' was not declared in this scope
   15 | sort(arr , arr+N);
      |      ^~~
Language: C++

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

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

Compiler output:
a.cc:8:13: error: extended character 　 is not valid in an identifier
    8 |     for(int i　=　0; i < N; i++){
      |             ^
a.cc:8:17: error: extended character 　 is not valid in an identifier
    8 |     for(int i　=　0; i < N; i++){
      |                 ^
a.cc: In function 'int main()':
a.cc:8:17: error: '\U000030000' was not declared in this scope
    8 |     for(int i　=　0; i < N; i++){
      |                 ^~~
a.cc:8:22: error: 'i' was not declared in this scope
    8 |     for(int i　=　0; i < N; i++){
      |                      ^
Language: C++

#include<iostream>
using namespace std;
int n,k,a[1003];
int main(){
cin>>n>>k;
for(int i=0;i<n;i++)cin>>a[i];sort(a,a+n);
int ans=0;
for(int i=0;i<k;i++)ans+=a[i];
cout<<ans;}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:31: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 | for(int i=0;i<n;i++)cin>>a[i];sort(a,a+n);
      |                               ^~~~
      |                               short
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, k;
  cin >> n >> k;
   vector<int> anko(n);
 
  for (int i = 0; i < n; i++) {
    cin >> anko.at(i);
  }
  sort(anko.begin(), anko.end());
  int x = 0
  for (int j = 0, j < k; j++) {
    x = x + anko.at(j);
  }
  cout << x << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: expected ',' or ';' before 'for'
   14 |   for (int j = 0, j < k; j++) {
      |   ^~~
a.cc:14:26: 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;
   vector<int> vec(n);
 
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int j = 0;
  int x = 0
  while (j < k) {
    int x = 0 + vec.at(j);
    j++;
  }
  cout << x << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: expected ',' or ';' before 'while'
   15 |   while (j < k) {
      |   ^~~~~
Language: C++

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:6:11: error: 'pair' does not name a type
    6 | using P = pair<int, int>;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:10:3: error: 'vector' was not declared in this scope
   10 |   vector<int> a(n);
      |   ^~~~~~
a.cc:10:10: error: expected primary-expression before 'int'
   10 |   vector<int> a(n);
      |          ^~~
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >> n >> k;
      |   ^~~
a.cc:13:12: error: 'a' was not declared in this scope
   13 |     cin >> a[i];
      |            ^
a.cc:15:8: error: 'a' was not declared in this scope
   15 |   sort(a.begin(), a.end());
      |        ^
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort(a.begin(), a.end());
      |   ^~~~
      |   short
a.cc:20:3: error: 'cout' was not declared in this scope
   20 |   cout << sum;
      |   ^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, 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 j = 0;
  int x = 0
  while (j < k) {
    int x = 0 + vec.at(j);
    j++;
  }
  cout << x << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k;
  cin >> n >> k;
   vector<int> vec(n);
 
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  for (int j = 0; j < k; j++) {
    int x = x + vec.at(j);
  　if (j == 4) {
    cout << x << endl;
  }
  }
}

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

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

 int N, K, p[1010];

 int main(){
 cin >> N >> K;
 for(int i = 0; i < N; ++i) cin >> p[i];
 sort(p, p + N);
 int ans = 0;
 for(int i = 0; i < K; ++i) ans += p[i];
 cout << ans << endl;
 }


Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <algorithm> // sort
      |         ^
main.c:2:11: fatal error: iostream: No such file or directory
    2 |  #include <iostream>
      |           ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k;
  cin >> n >> k;
   vector<int> vec(n);
 
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  for (int j = 0; j < k; j++) {
  if (j == 0) {
    int x = 0;
  }
    int x = x + vec.at(j);
  if (j == 1) {
    cout << x << endl;
  }
  }
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k;
  cin >> n >> k;
   vector<int> vec(n);
 
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  for (int j = 0; j < k; j++) {
  int x = x + vec.at(j);
  if (j == 1) {
    cout << x << endl;
  }
  }
}
  

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k;
  cin >> n >> k;
   vector<int> vec(n);
 
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  for (int j = 0; j < k; j++) {
  int x = x + vec.at(j);
  }
  cout << x << endl;
}

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

#include<iostream>
using namespace std;
int main()
{
    int n,k,i,sum=0;
    cin>>n>>k;
    int s[n];
    for(i=0;i<n;i++){
     cin>>s[i];
 	}
	sort(p,p+n);
	for(i=0;i<k;i++){
		sum+=s[i];
	}
	cout<<sum<<endl;
	return 0;
}

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

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
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);
    }
    sort(vec.begin(), vec.end());
    int X = 0;
    for (int i = 0; i <= K; i++) {
        X+=vec.at(i);
        cout << X << endl;
    


}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:20:12: note: to match this '{'
   20 | int main() {
      |            ^
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, 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 x = 0
  for (int j = 0; j < k; j++) {
  int x = x + vec.at(j);
  }
  cout << x << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, k;
  cin >> n >> k;
   vector<int> anko(n);
 
  for (int i = 0; i < n; i++) {
    cin >> anko.at(i);
  }
  sort(anko.begin(),anko.end());
  int x = 0
  for (int j = 0; j < k; j++) {
  int x = x + anko.at(j);
  }
  cout << x << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, k;
  cin >> n >> k;
   vector<int> anko(n);
 
  for (int i = 0; i < n; i++) {
    cin >> anko.at(i);
  }
  sort(anko.begin(), anko.end());
  int x = 0
  for (int j = 0; j < k; j++) {
  int x = x + anko.at(j);
  }
  cout << x << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, k;
  cin >> n >> k;
   vector<int> anko(n);
 
  for (int i = 0; i < n; i++) {
    cin >> anko.at(i);
  }
  sort(anko.begin(), anko.end());
  int x = 0
  for (int j = 0, j < k; j++) {
    x = x + anko.at(j);
  }
  cout << x << endl;
}

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

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

int main(){
 int n, k; cin >> n >> k;
  vector<int> box;
  for(int i = 0; i < n; ++i){
    cin >> box[i];
  }
  sort(box.begin(), v.end());
  int sum = 0;
  for(int i = 0; i < k; ++i){
    sum += box.at(i);
  }
  cout << sum << endl;
 return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: 'v' was not declared in this scope
   10 |   sort(box.begin(), v.end());
      |                     ^
Language: C++

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

int main(){
 int n, k; cin >> n >> k;
  vector<int> box;
  for(int i = 0; i < n; ++i){
    cin >> box[i];
  }
  box.sort(box.begin(), v.end());
  int sum = 0;
  for(int i = 0; i < k; ++i){
    sum += vector.at(i);
  }
  cout << sum << endl;
 return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 'class std::vector<int>' has no member named 'sort'
   10 |   box.sort(box.begin(), v.end());
      |       ^~~~
a.cc:10:25: error: 'v' was not declared in this scope
   10 |   box.sort(box.begin(), v.end());
      |                         ^
a.cc:13:18: error: missing template arguments before '.' token
   13 |     sum += vector.at(i);
      |                  ^
Language: Java

import java.util.*;
class Main
{

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

Compiler output:
Main.java:17: error: cannot find symbol
    for(i=0;i<m;i++)
        ^
  symbol:   variable i
  location: class Main
Main.java:17: error: cannot find symbol
    for(i=0;i<m;i++)
            ^
  symbol:   variable i
  location: class Main
Main.java:17: error: cannot find symbol
    for(i=0;i<m;i++)
                ^
  symbol:   variable i
  location: class Main
Main.java:19: error: cannot find symbol
     sum=sum+a[i];
               ^
  symbol:   variable i
  location: class Main
4 errors
Language: C++

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

int main(){
 int n, k; cin >> n >> k;
  vector<int> box;
  for(int i = 0; i < n; ++i){
    cin >> box[i];
  }
  int sum = 0;
  for(int i = 0; i < k; ++i){
    int min = 0;
    int index;
    for(int j = 0; j < n - i; ++j){
      if(min > box[j]){
        min = box[j];
        index = j
      }
    }
    box.pop(box.at(index));
    sum += min;
  }
  cout << sum << endl;
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: expected ';' before '}' token
   17 |         index = j
      |                  ^
      |                  ;
   18 |       }
      |       ~           
a.cc:20:9: error: 'class std::vector<int>' has no member named 'pop'
   20 |     box.pop(box.at(index));
      |         ^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
    int N;
    int K;
    int p[N] = {};
    int ans =0;

    cin >> N >> K;
    for(int i=0;i<N;i++){
        cin >> p[i];
    }

    int size = sizeof(p)/sizeof(a[0]);
    sort(p,p+size);

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

    cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:33: error: 'a' was not declared in this scope
   16 |     int size = sizeof(p)/sizeof(a[0]);
      |                                 ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
    int N;
    int K;
    int p[N] = {};
    int ans =0;

    cin >> N >> K;
    for(int i=0;i<N;i++){
        cin >> p[i]
    }

    int size = sizeof(p)/sizeof(a[0]);
    sort(p,p+size);

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

    cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: expected ';' before '}' token
   13 |         cin >> p[i]
      |                    ^
      |                    ;
   14 |     }
      |     ~               
a.cc:16:33: error: 'a' was not declared in this scope
   16 |     int size = sizeof(p)/sizeof(a[0]);
      |                                 ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  int a;
  vector<int> v;
  for(int i=0;i<n;i++){
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(),v.end());
  int sum = 0;
  for(int i=0;i<k;i++){
    sum += v[i];
  }
  cout << sum << endl;
  return 0;
}


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

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

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

#include <bits/stdc++.h>


using namespace std;
using ll = long long;

#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define trav(a, x) for(auto& a: x)

template<class T>
void print (vector<T>& v, bool spaced = true) {
    int n = v.size();
    string space = (spaced ? " ": "");
    for (int i = 0; i < n; ++i) {
        cout << v[i] << space;
    }cout << '\n';
}

template<class T>
T gcd (T a, T b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;

}

int main () {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    
    int n, k; cin>> n>> k;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) cin>> v[i];
    sort(all(v));
    int ans = 0;
    for (int i = 0; i < k; ++i) ans += v[i];
    cout << ans << '\n';

    

    return 0;
}



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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, k;
  cin >> n >> k;
   vector<int> name(n);
 
  for (int i = 0; i < n; i++) {
    cin >> anko.at(i);
  }
  sort(anko.begin(), anko.end());
  for (int j = 0, j < k; j++) {
    cout << anko.at(j) + anko.at(j) << endl;
  }
}

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

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	int n,m;
	cin>>n>>m;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<m;i++)sum+=a[i];
	cout<<sum;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(a,a+n);
      |         ^~~~
      |         short
a.cc:11:29: error: 'sum' was not declared in this scope
   11 |         for(int i=0;i<m;i++)sum+=a[i];
      |                             ^~~
a.cc:12:15: error: 'sum' was not declared in this scope
   12 |         cout<<sum;
      |               ^~~
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, k;
  cin >> n >> k;
   vector<int> name(n);
 
  for (int i = 0; i < n; i++) {
    cin >> anko.at(i);
  }
  sort(anko.begin(), anko.end());
  for (int j = 0, j < k; j++) {
    cout << anko.at(j) << endl;
  }
}

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

#include <bits/stdc++.h>
using namespace std;
 
bool chkx(vector<int> a,int x);

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


Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: no matching function for call to 'sort(<unresolved overloaded function type>, <unresolved overloaded function type>)'
   13 |   sort(a.begin,a.end);
      |   ~~~~^~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:13:7: note:   couldn't deduce template parameter '_RAIter'
   13 |   sort(a.begin,a.end);
      |   ~~~~^~~~~~~~~~~~~~~
/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, 2 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, 2 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, 2 provided
Language: C++

#include<stdio.h>
#include<iostream.h>
using namespace std;
int main()
{
  int i,n,k,p[2000];
  int sum=0,temp;
  scanf("%d %d",&n,&k);
  
    for(i=0;i<n;i++)
    {
     scanf("%d",&p[i]);
    }
  
        sort(p,p+n);
    
 for(i=0;i<k;i++)
 {
  sum=sum+p[i];
 }
 printf("%d",sum);
   
return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
long long a[1000];
int main()
{
    long long N,K,sum=0;
    scanf("%lld %lld",&N,&K);
    for(int i=0;i<N;i++){
        scanf("%lld",&a[i]);
    }
    sort(a,a+N);
    for(int i=0;i<K;i++) sum+=a[i];
    printf("%lld\n",sum);
    return 0;
}


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

#include <iostream>
#include <vector>

int main(){
    int n, k;
    std::cin >> n >> k;
    std::vector<int> p(n);
    for(int i = 0; i < n; i++){
        std::cin >> p[i];
    }

    int sum;
    int min, minnum;
    int sum = 0;

    for(int l = 0; l < k; l++){
        min = p[0];
        minnum = 0;
        for(int i = 0; i < n; i++){
            if(p[i] < min){
                min = p[i];
                minnum = i;
            }
        }
        sum = sum + min;
        p.erase(p.begin() + minnum);
    }
    std::cout << sum << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: redeclaration of 'int sum'
   14 |     int sum = 0;
      |         ^~~
a.cc:12:9: note: 'int sum' previously declared here
   12 |     int sum;
      |         ^~~
Language: C++

#include<stdio.h>
using namespace std;
int main(void)
{
  int i,N ,K, p(N-1);
  
scanf("%d",&N);
scanf("%d",&K);
for(i=0;i>=(N-1);i++)
  scanf("%d",&p(i));

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'p' cannot be used as a function
   10 |   scanf("%d",&p(i));
      |               ~^~~
Language: C++

#include<stdio.h>
using namespace std;
int main(void)
{
  int i,N ,K, p(N-1);
  
scanf("%d",&N);
scanf("%d",&K);
for(i=0;i>=(N-1);i++)
  scanf("%d",&);

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: expected primary-expression before ')' token
   10 |   scanf("%d",&);
      |               ^
Language: C++

#include<iostream>
using namespace std;
void so(int n,int p[n])
{
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(p[i]>p[j]){int t=p[i];p[i]=p[j];p[j]=t;}}}}

int main()
{
  int N,K;
  cin>>N>>K;
  int p[N];
  for(int i=0;i<N;i++) cin>>p[i];
  so(N,p);
  int c=0;
  int sum=0;
  while(K>0){
    sum+=p[c];
    K--;c++;
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc:3:22: error: use of parameter outside function body before ']' token
    3 | void so(int n,int p[n])
      |                      ^
a.cc: In function 'void so(...)':
a.cc:5:17: error: 'n' was not declared in this scope
    5 |   for(int i=0;i<n;i++){
      |                 ^
a.cc:7:10: error: 'p' was not declared in this scope
    7 |       if(p[i]>p[j]){int t=p[i];p[i]=p[j];p[j]=t;}}}}
      |          ^
Language: C++

#include<iostream>
using namespace std;
void so(int n,int p[n])
{
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(p[i]>p[j]){int t=p[i];p[i]=p[j];p[j]=t;}}}

int main()
{
  int N,K;
  cin>>N>>K;
  int p[N];
  for(int i=0;i<N;i++) cin>>p[i];
  so(N,p);
  int c=0;
  int sum=0;
  while(K>0){
    sum+=p[c];
    K--;c++;
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc:3:22: error: use of parameter outside function body before ']' token
    3 | void so(int n,int p[n])
      |                      ^
a.cc: In function 'void so(...)':
a.cc:5:17: error: 'n' was not declared in this scope
    5 |   for(int i=0;i<n;i++){
      |                 ^
a.cc:7:10: error: 'p' was not declared in this scope
    7 |       if(p[i]>p[j]){int t=p[i];p[i]=p[j];p[j]=t;}}}
      |          ^
a.cc:9:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    9 | int main()
      |         ^~
a.cc:9:9: note: remove parentheses to default-initialize a variable
    9 | int main()
      |         ^~
      |         --
a.cc:9:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:10:1: error: a function-definition is not allowed here before '{' token
   10 | {
      | ^
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, k;
  cin >> n >> k;
   vector<int> name(n);
 
  for (int i = 0; i < n; i++) {
    cin >> name.at(i);
  }
  sort(name.begin(), vec.end());
  for (int j = 0, j < k; j++) {
    cout << name.at(j) << endl;
  }
}

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

#include<iostream>
using namespace std;
int main()
{
  int N,K;
  cin>>N>>K;
  int p[N];
  for(int i=0;i<N;i++) cin>>p[i];
  qsort(p[0],p[N-1]);
  int c=0;
  int sum=0;
  while(K>0){
    sum+=p[c];
    K--;c++;
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: invalid conversion from 'int' to 'void*' [-fpermissive]
    9 |   qsort(p[0],p[N-1]);
      |         ~~~^
      |            |
      |            int
a.cc:9:8: error: too few arguments to function 'void qsort(void*, size_t, size_t, __compar_fn_t)'
    9 |   qsort(p[0],p[N-1]);
      |   ~~~~~^~~~~~~~~~~~~
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:13: note: declared here
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |             ^~~~~
Language: C

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

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

#include<iostream>
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[0],p[N-1]);
  int c=0;
  int sum=0;
  while(K>0){
    sum+=p[c];
    K--;c++;
  }
  cout<<sum<<endl;
}

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(p[0],p[N-1]);
      |   ^~~~
      |   short
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,i,j,p[1000],min,s;
  cin >> N >> K;
  for(i=0;i<N;i++){
    cin >> p[i];
  }
  for(i=0;i<N;i++){
    for(j=i+1;j<N;j++){
      if(p[i]>p[j]){
        s=p[i];
        p[i]=p[j];
        p[j]=s;
      }
    }
  }
  for(i=0;i<K;i++){
    ans+=p[i];
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |     ans+=p[i];
      |     ^~~
      |     abs
a.cc:21:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C

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

int main() {
  int n, k;
  cin >> n >> k;
   vector<int> name(n);
 
  for (int i = 0; i < n; i++) {
    cin >> name.at(i);
  }
  sort(name.begin(), vec.end());
  for (int j = 0, j < k; j++) {
    cout << name.at(j) << endl;
  }
}
  

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,i,p[1000],min,s;
  cin >> N >> K;
  for(i=0;i<N;i++){
    cin >> p[i];
  }
  for(i=0;i<N;i++){
    for(j=i+1;j<N;j++){
      if(p[i]>p[j]){
        s=p[i];
        p[i]=p[j];
        p[j]=s;
      }
    }
  }
  for(i=0;i<K;i++){
    ans+=p[i];
  }
  cout << ans << endl;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'j' was not declared in this scope
   10 |     for(j=i+1;j<N;j++){
      |         ^
a.cc:19:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |     ans+=p[i];
      |     ^~~
      |     abs
a.cc:21:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int x;
  int y;
  //商品の個数を入力
  cin >> x;
  cin >> y;
  
  vector<int> a(x);
  for(int i=0; i<=x-1; i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end()) << endl;;
  
  int s=0;
  
  for(int j=0; j<=y-1; j++){
    s += a.at(j);
  }
  
  cout << s;
    
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:27: error: invalid operands of types 'void' and '<unresolved overloaded function type>' to binary 'operator<<'
   16 |   sort(a.begin(),a.end()) << endl;;
      |   ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
Language: C++

#include<stdio.h>
using namespace std;
int main(void)
{
  int i,N ,K, p(N-1);
  
scanf("%d".&N);
scanf("%d".&K);
for(i=0;i>=(N-1);i++)
  scanf("%d".&p(i));

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: expected unqualified-id before '&' token
    7 | scanf("%d".&N);
      |            ^
a.cc:8:12: error: expected unqualified-id before '&' token
    8 | scanf("%d".&K);
      |            ^
a.cc:10:14: error: expected unqualified-id before '&' token
   10 |   scanf("%d".&p(i));
      |              ^
a.cc:10:16: error: 'p' cannot be used as a function
   10 |   scanf("%d".&p(i));
      |               ~^~~
Language: C++

#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace std; 
using namespace __gnu_pbds;
 
typedef long long ll;
typedef double db;
typedef long double ld;
typedef string str;
 
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdb;
typedef pair<ld, ld> pld;
typedef pair<str, str> pstr;
 
typedef vector<int> vi; 
typedef vector<ll> vll; 
typedef vector<db> vdb; 
typedef vector<ld> vld;
typedef vector<str> vstr; 
typedef vector<pi> vpi;
typedef vector<pll> vpll; 
typedef vector<pdb> vpdb; 
 
#define fi first
#define se second
#define mp make_pair
#define pf push_front 
#define pb push_back
#define ins insert 
#define eb emplace_back 
#define fbo find_by_order
#define ook order_of_key
#define rsz resize
#define lb lower_bound 
#define ub upper_bound 

#define len(s) (int)s.length()
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define srt(v) sort(all(v))

#define rep(a, b, c) for(int a=b; a<c; a++) 
#define per(a, b, c) for(int a=b; a>c; a--) //do not include boundaries on the right
#define repn(a, b, c) for(int a=b; a<=c; a++) 
#define pern(a, b, c) for(int a=b; a>=c; a--) //include boundaries on the right
 
#define yes cout << "YES"<< "\n" 
#define no cout << "NO" << "\n" 
#define out(x) cout << x << "\n"
#define outs(x) cout << x << " "
#define el cout << "\n"

#define navi ios_base::sync_with_stdio(false); cin.tie(NULL)    
 
const ll mod = 1e9+7;
const double eps = 1e-9;

int main(){
	navi;
	int n, k; cin >> n >> k;
  vi price;
  rep(i,0,n){int x; cin >> x; price_pb(x);}
  srt(price);
  int ans=0;
  rep(j,0,k){ans+=price[j];}
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:31: error: 'price_pb' was not declared in this scope; did you mean 'price'?
   66 |   rep(i,0,n){int x; cin >> x; price_pb(x);}
      |                               ^~~~~~~~
      |                               price
Language: C++

#include <iostream> 
#include <cctype> 
using namespace std; 
int main() 
{ 
    int n,k,s=0;
    int *a = new int[n];
    int q = sizeof(a)/sizeof(a[0]);
    for (int i=0;i<n;i++){
        cin>>a[i];
    }

    sort(a,a+q);
    for (int i=0;i<k;i++){
        s += a[i];
    }
    cout<<s;
    delete [] a;
    return 0
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(a,a+q);
      |     ^~~~
      |     short
a.cc:19:13: error: expected ';' before '}' token
   19 |     return 0
      |             ^
      |             ;
   20 | 
   21 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int x;
  int y;
  //商品の個数を入力
  cin >> x;
  cin >> y;
  
  vector<int> a(x);
  for(int i=0; i<=x-1; i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end()) << endl;;
  
  int s=0;
  
  for(int j=0; j<y-1; j++){
    s += a.at(j);
  }
  
  cout << s;
    
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:27: error: invalid operands of types 'void' and '<unresolved overloaded function type>' to binary 'operator<<'
   16 |   sort(a.begin(),a.end()) << endl;;
      |   ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int N,K;
  cin>>N>>K;
  int p[N];
  for(int i=0;i<N;i++) cin>>p[i];
  int c;
  int sum=0;
  while(K>0){
    int m=p[0];
    for(int i=0;i<N;i++)
    {
      if(m>p[i]) {m=p[i];c=i}
    }
    sum+=m;p[c]=100000;
    K--;
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:29: error: expected ';' before '}' token
   15 |       if(m>p[i]) {m=p[i];c=i}
      |                             ^
      |                             ;
Language: C++

#include<iostream>
using namespace std;
int main(void)
{
  int i,N ,K, p(N-1);
  
cin>>N;
cin>>K;
for(i=0;1>=(N-1);i++)
  cin>>p(i);

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'p' cannot be used as a function
   10 |   cin>>p(i);
      |        ~^~~
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[i]);
  }
  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];
  }
  
    printf("%d",sum);
  
}


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: 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];
  }
  
    printf("%d",sum);
  
}


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

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int x;
  int y;
  //商品の個数を入力
  cin >> x;
  cin >> y;
  
  vector<int> a(x);
  for(int i=0; i<=x-1; i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end()) << endl;;
  
  int s;
  
  for(int j=0; j<y-1; j++){
    s += a.at(j);
  }
  
  cout << s;
    
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:27: error: invalid operands of types 'void' and '<unresolved overloaded function type>' to binary 'operator<<'
   16 |   sort(a.begin(),a.end()) << endl;;
      |   ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
Language: C++

/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <vector>
#include <numeric>      // std::partial_sum

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> price;
    int p;
    int maxSum=0;
    for(int i = 0; i< N; i++){
        cin >> p;
        maxSum+=p;
        price.push_back(p);
    }
    sort(price.begin(), price.end());


    int sum = 0;
    int res = 0;
    if(K>N){
        res = maxSum + (K-N)*price[0];
        cout << res << endl;
    }
    else{
        for(int i = 0; i< K; i++){
            res+=price[i];
            price.push_back(p);
        }
        cout << res << endl;
    }

}


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

#include<iostream>
using namespace std;
int main(void)
{
  int N K p(N-1);
  
cin>>N;
cin>>K;


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: expected initializer before 'K'
    5 |   int N K p(N-1);
      |         ^
a.cc:7:6: error: 'N' was not declared in this scope
    7 | cin>>N;
      |      ^
a.cc:8:6: error: 'K' was not declared in this scope
    8 | cin>>K;
      |      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int arr[1010]
int main()
{
  int n, k;
  cin>>n>>k;
  for(int i = 0;i<n;i++)
    cin>>arr[i]
   sort(arr,arr+n)
    int total=0;
  for(int i=0;i<k;i++)total+=arr[i]
    count<<total<<endl;
  }

  

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

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int x;
  int y;
  //商品の個数を入力
  cin >> x;
  cin >> y;
  
  vector<int> a(x);
  for(int i=0; i<=x-1; i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end());
  
  int s;
  
  for(int j=0; j<y-1; j++){
    sum += a.at(j);
  }
  
  cout << s;
    
  return 0;
}

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

import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int  n = sc.nextInt();
     int k = sc.nextInt();
     int[] alpha = new int[n];
     int i,j;
     for(i=0;i<n;i++){
       alpha[i]= sc.nextInt();
     }
     int flag;
     for (j = 1; j < alpha.length; j++) {
            int key = alpha[j];
            i = j - 1;
            while (i >= 0 && alpha[i] > key) {
                alpha[i + 1] = alpha[i];
                i--;
            }
            alpha[i + 1] = key;
        }
      int ans=0;
      for(j = 0;j<k;j++){
       ans += alpha[j]
      }
     System.out.println(ans);
 
   }
   
}

Compiler output:
Main.java:24: error: ';' expected
       ans += alpha[j]
                      ^
1 error
Language: C++

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:26:23: error: expected ';' before '}' token
   26 |     count += vec.at(k)
      |                       ^
      |                       ;
   27 |   }
      |   ~
Language: C

#include <stdio.h>
#include <math.h>
int main(){
  int all,buy,a,i,sum=0,oki;
  int price[all];
  scanf("%d%d",&all,&buy);
  for (i=0;i<all;i++){
    scanf("%d",&price[i]);
  }
  a=1;
  for(i=0;i<buy;i++){
    for(a=0;a<all;a++){
    if(price[i]>pricr[a]){
      oki=price[i];
      price[i]=price[a];
      price[a]=oki;
    }
    }
  }
  for(i=0;i<buy;i++){
    sum=sum+price[i];
  }
  printf("%d",sum);
}

Compiler output:
main.c: In function 'main':
main.c:13:17: error: 'pricr' undeclared (first use in this function); did you mean 'price'?
   13 |     if(price[i]>pricr[a]){
      |                 ^~~~~
      |                 price
main.c:13:17: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

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

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

}


Compiler output:
Main.java:4: error: class, interface, enum, or record expected
public  Main {
        ^
Main.java:6: 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)
Main.java:26: error: class, interface, enum, or record expected
}
^
3 errors
Language: Java

import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int  n = sc.nextInt();
     int k = sc.nextInt();
     int[] alpha = new int[N];
     int i,j;
     for(i=0;i<n;i++){
       alpha[i]= sc.nextInt();
     }
     for (j = 1; j < alpha.length; j++) {
            int key = alpha[j];
            i = j - 1;
            while (i >= 0 && alpha[i] > key) {
                alpha[i + 1] = alpha[i];
                i--;
            }
            alpha[i + 1] = key;
        }
     System.out.println(alpha[0]+alpha[1]+alpha[2]+alpha[3]);
 
   }
   
}

Compiler output:
Main.java:7: error: cannot find symbol
     int[] alpha = new int[N];
                           ^
  symbol:   variable N
  location: class Main
1 error
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();
			int[] strs = new int[n];
			for (int i = 0; i < n; i++) { 
				strs[i] = sc.nextLine(); 
            }
	       Arrays.sort(strs);
			int min = 0;
	        for(int j = 0; j < k;j++){
            	min += strs[j]; 
            }
			System.out.println(min);
	}
}

Compiler output:
Main.java:12: error: incompatible types: String cannot be converted to int
				strs[i] = sc.nextLine(); 
				                     ^
1 error