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

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

}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |         cin >> n >> k;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<int>p(n);
      |         ^~~~~~
a.cc:9:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:9:16: error: expected primary-expression before 'int'
    9 |         vector<int>p(n);
      |                ^~~
a.cc:11:24: error: 'p' was not declared in this scope
   11 |                 cin >> p;
      |                        ^
a.cc:13:14: error: 'p' was not declared in this scope
   13 |         sort(p.begin(), p.end());
      |              ^
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   13 |         sort(p.begin(), p.end());
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:17:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |         cout << sum<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |         cout << sum<<endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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

Compiler output:
a.cc:11:1: error: expected declaration before '}' token
   11 | }
      | ^
Language: C++

#include <bits/stdc++.h>

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

	vector<int> vi;

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

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

	int sum = 0;

	for (int i = 0; i < K; i++) {
		sum += vi[i];
	}

	cout << sum;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         cin >> N >> K;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> vi;
      |         ^~~~~~
a.cc:7:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> vi;
      |                ^~~
a.cc:12:17: error: 'vi' was not declared in this scope; did you mean 'i'?
   12 |                 vi.push_back(p);
      |                 ^~
      |                 i
a.cc:15:14: error: 'vi' was not declared in this scope
   15 |         sort(vi.begin(), vi.end());
      |              ^~
a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   15 |         sort(vi.begin(), vi.end());
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:23:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   23 |         cout << sum;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<iostream>
#include <bits/stdc++.h>
int main()
{
  int n,k,sum,vec[n];
  sum =0;
  std::cin>>n>>k;
  for(int i=0;i<n;i++){
    std::cin>>vec[i];
  }
  std::sort(vec, vec+n);
  for(i=0;i<k;i++){
    sum = sum + vec[i];
  }
  std::cout<<sum;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=0;i<k;i++){
      |       ^
Language: C++

#include<iostream>
#include <bits/stdc++.h>
int main()
{
  int n,k,sum,vec[];
  sum =0;
  std::cin>>n>>k;
  for(int i=0;i<n;i++){
    std::cin>>vec[i];
  }
  sort(vec, vec+n);
  for(i=0;i<k;i++){
    sum = sum + vec[i];
  }
  std::cout<<sum;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:5:15: error: storage size of 'vec' isn't known
    5 |   int n,k,sum,vec[];
      |               ^~~
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   11 |   sort(vec, vec+n);
      |   ^~~~
      |   std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=0;i<k;i++){
      |       ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
int main()
{
  int n,k,sum;
  sum =0;
  std::cin>>n>>k;
  std::vector<int> vec(n);
  for(int i=0;i<n;i++){
    std::cin>>vec[i];
  }
  std::sort(vec.begin()), (vec.end());
  for(i=0;i<k;i++){
    sum = sum + vec[i];
  }
  std::cout<<sum;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: no matching function for call to 'sort(std::vector<int>::iterator)'
   13 |   std::sort(vec.begin()), (vec.end());
      |   ~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/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
a.cc:14:7: error: 'i' was not declared in this scope
   14 |   for(i=0;i<k;i++){
      |       ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
int main()
{
  int n,k,sum;
  sum =0;
  cin>>n>>k;
  std::vector<int> vec(n);
  for(int i=0;i<n;i++){
    std::cin>>vec[i];
  }
  std::sort(vec.begin()), (vec.end());
  for(i=0;i<k;i++){
    sum = sum + vec[i];
  }
  std::cout<<sum;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |   cin>>n>>k;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:13:12: error: no matching function for call to 'sort(std::vector<int>::iterator)'
   13 |   std::sort(vec.begin()), (vec.end());
      |   ~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/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
a.cc:14:7: error: 'i' was not declared in this scope
   14 |   for(i=0;i<k;i++){
      |       ^
Language: C++

//Created by Kira

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

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    



int main(){
   IOS

   int n; cin>>n;
   vi a(n);
   for(int &x : a)cin>>x;

   sort(all(a));
    int sum = 0;
   for(int i = 0; i < k; i++){
       sum += a[i];
   }
   cout<<sum<<"\n";

}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1) res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:23: error: 'k' was not declared in this scope
   30 |    for(int i = 0; i < k; i++){
      |                       ^
Language: C

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int N,K,p[1001];
	int sum = 0;
	cin>>N>>K;
	for(int i=0;i<N;i++) cin>>p[i];
	sort(p,p+N);
	for(int i=0;i<K;i++) sum += p[i];
	cout<<sum<<endl;
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,K,p[1001];
	int sum = 0;
	cin>>N>>K;
	for(int i=0;i<N;i++) cin>>p[i];
	sort(p,p+N);
	for(int i=0;i<K;i++) sum += p[i];
	cout<<sum<<endl;
	return 0;
}

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

#include <iostream>
#include <vector>

using namespace std;

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

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

#include <iostream>
using namespace std;

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



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

#include<bits/stdc++.h>
using namespace std;
int N, K, P[1001], K, i, sum;
int main()
{
    cin >> N >> K;
    for(i=0;i<N;i++)
    {
        cin >> P[i];
    }
    sort(P, P+N);
    for(i=0;i<K;i++)
        sum+=P[i];
    cout << sum << endl;
    return 0;
}

Compiler output:
a.cc:3:20: error: redefinition of 'int K'
    3 | int N, K, P[1001], K, i, sum;
      |                    ^
a.cc:3:8: note: 'int K' previously declared here
    3 | int N, K, P[1001], K, i, sum;
      |        ^
Language: C++

#include <algorithm>
#include <iostream>
using namespace std;
int main()<
  int N, K, p[1010];
  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:
a.cc:4:11: error: expected initializer before '<' token
    4 | int main()<
      |           ^
a.cc:6:3: error: 'cin' does not name a type
    6 |   cin >> N >> K;
      |   ^~~
a.cc:7:3: error: expected unqualified-id before 'for'
    7 |   for(int i = 0; i < N; ++i){
      |   ^~~
a.cc:7:18: error: 'i' does not name a type
    7 |   for(int i = 0; i < N; ++i){
      |                  ^
a.cc:7:25: error: expected unqualified-id before '++' token
    7 |   for(int i = 0; i < N; ++i){
      |                         ^~
a.cc:10:7: error: expected constructor, destructor, or type conversion before '(' token
   10 |   sort(p, p + N);
      |       ^
a.cc:12:1: error: expected unqualified-id before 'for'
   12 | for(int i = 0; i < K; ++i) ans += p[i];
      | ^~~
a.cc:12:16: error: 'i' does not name a type
   12 | for(int i = 0; i < K; ++i) ans += p[i];
      |                ^
a.cc:12:23: error: expected unqualified-id before '++' token
   12 | for(int i = 0; i < K; ++i) ans += p[i];
      |                       ^~
a.cc:13:1: error: 'cout' does not name a type
   13 | cout << ans << endl
      | ^~~~
a.cc:14:2: error: expected declaration before '}' token
   14 |  }
      |  ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'o' was not declared in this scope
    7 |   for(i=o;i<n;i++){
      |         ^
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(p,p+n);
      |   ^~~~
      |   short
Language: C

#include<stdio.h>
int main(void)
{
	char p[1001];
	int n,k,box,sum;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&p[n]);
	}
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n-1;j++){
			if(n[i]<p[j]){
				box=p[i];
				n[i]=p[j];
				n[j]=box;
			}
		}
	}
	for(i=0;i<k;i++){
		sum=sum+p[i];
	}
	printf("sum\n");
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:13: error: 'i' undeclared (first use in this function)
    7 |         for(i=0;i<n;i++){
      |             ^
main.c:7:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:21: error: 'j' undeclared (first use in this function)
   11 |                 for(j=i+1;j<n-1;j++){
      |                     ^
Language: C

#include<stdio.h>
int main(void)
{
	int n,k,box,sum,p[1001];
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&p[n]);
	}
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n-1;j++){
			if(n[i]<p[j]){
				box=p[i];
				n[i]=p[j];
				n[j]=box;
			}
		}
	}
	for(i=0;i<k;i++){
		sum=sum+p[i];
	}
	printf("sum\n");
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:13: error: 'i' undeclared (first use in this function)
    6 |         for(i=0;i<n;i++){
      |             ^
main.c:6:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:21: error: 'j' undeclared (first use in this function)
   10 |                 for(j=i+1;j<n-1;j++){
      |                     ^
Language: C

#include<stdio.h>
int main(void)
{
	int n,k,box,sum,p[1001];
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&p[n]);
	}
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n-1;j++){
			if(n[i]<p[j]){
				box=p[i];
				n[i]=p[j];
				n[j]=box;
			}
		}
	}
	for(i=0;i<k;i++){
		sum=sum+p[i];
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:13: error: 'i' undeclared (first use in this function)
    6 |         for(i=0;i<n;i++){
      |             ^
main.c:6:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:21: error: 'j' undeclared (first use in this function)
   10 |                 for(j=i+1;j<n-1;j++){
      |                     ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#define INF 10000000001
using namespace std;
 
int main(){
  	
  	cin.sync_with_stdio(false);
  	cin.tie(NULL);
  
  	int n, k;;
  	cin >> n;
  	vector<uint_64> v;
	cin >> k;
  	for(int i = 0; i < n; ++i){
    	cin >> v[i];
    }
  	
  	uint_64 cnt = 0;
  	for(int i = 0; i < k; ++i){
    	uint_64 min_pos = 0, min_val = INF;
        for(int j = 0; j < n; ++j){
        	if(v[j] < min_val){
            	min_val = v[j];
              	min_pos = j;
            }
        }
      	cnt += min_val;
      	v[min_pos] = INF;
    }
  	cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: 'uint_64' was not declared in this scope
   14 |         vector<uint_64> v;
      |                ^~~~~~~
a.cc:14:23: error: template argument 1 is invalid
   14 |         vector<uint_64> v;
      |                       ^
a.cc:14:23: error: template argument 2 is invalid
a.cc:17:17: error: invalid types 'int[int]' for array subscript
   17 |         cin >> v[i];
      |                 ^
a.cc:20:16: error: expected ';' before 'cnt'
   20 |         uint_64 cnt = 0;
      |                ^~~~
      |                ;
a.cc:22:16: error: expected ';' before 'min_pos'
   22 |         uint_64 min_pos = 0, min_val = INF;
      |                ^~~~~~~~
      |                ;
a.cc:24:21: error: invalid types 'int[int]' for array subscript
   24 |                 if(v[j] < min_val){
      |                     ^
a.cc:24:27: error: 'min_val' was not declared in this scope
   24 |                 if(v[j] < min_val){
      |                           ^~~~~~~
a.cc:25:28: error: invalid types 'int[int]' for array subscript
   25 |                 min_val = v[j];
      |                            ^
a.cc:26:17: error: 'min_pos' was not declared in this scope
   26 |                 min_pos = j;
      |                 ^~~~~~~
a.cc:29:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   29 |         cnt += min_val;
      |         ^~~
      |         int
a.cc:29:16: error: 'min_val' was not declared in this scope
   29 |         cnt += min_val;
      |                ^~~~~~~
a.cc:30:11: error: 'min_pos' was not declared in this scope
   30 |         v[min_pos] = INF;
      |           ^~~~~~~
a.cc:32:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   32 |         cout << cnt << endl;
      |                 ^~~
      |                 int
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    7 |   sort(arr,arr+n);
      |   ^~~~
      |   short
a.cc:8:19: error: 'k' was not declared in this scope
    8 |   for (int i=0; i<k; i++) sum += arr[i];
      |                   ^
Language: C++

#include<bits/stdc++.h>
int main()
{
  int n,k,i,j;
  int p[10000];
  cin>>n>>k;
  for(i=0;i<n;i++)
  {
    cin>>p[i];
  }
  for(i=0;i<n;i++)
  {
    for(j=i+1;i<n;i++)
    {
      if(p[i]>p[j])
      {
        int temp;
        temp=p[i];
        p[i]=p[j];
        p[j]=temp;
      }
    }
  }
  for(i=0;i<k;i++)
  {
    sum=sum+p[i];
    
  }
  cout<<sum;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin>>n>>k;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:26:5: error: 'sum' was not declared in this scope
   26 |     sum=sum+p[i];
      |     ^~~
a.cc:29:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 |   cout<<sum;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:29:9: error: 'sum' was not declared in this scope
   29 |   cout<<sum;
      |         ^~~
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
using mamespace std;
int sum(int arr[], int n) {
  int sum=0;
  for(int i=0;i<n;i++)
    sum+=arr[i];
  return sum;
}

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

Compiler output:
a.cc:5:7: error: expected nested-name-specifier before 'mamespace'
    5 | using mamespace std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:14:11: error: storage size of 'arr' isn't known
   14 |   int n,k,arr[];
      |           ^~~
a.cc:15:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   15 |   cin>>n>>k;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:18:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   18 |     sort(arr,arr+n);
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:20:13: error: 'a' was not declared in this scope
   20 |        cin>>a[i];
      |             ^
a.cc:21:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   21 |   cout<<sum(arr,k)<<endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:21:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   21 |   cout<<sum(arr,k)<<endl;
      |                     ^~~~
      |                     std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/tdc++.h>
using namespace std;
int sum(int arr[], int n) {
  int sum=0;
  for(int i=0;i<n;i++)
     sum+=arr[i];
  return sum;
}

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

Compiler output:
a.cc:1:10: fatal error: bits/tdc++.h: No such file or directory
    1 | #include <bits/tdc++.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // Your code here!
        
       Scanner sc=new Scanner(System.in);
       int n=sc.nextInt();
       int k=sc.nextInt();
       int a[]=new int[n];
       for(int i=0;i<n;i++)
       {
           a[i]=sc.nextInt();
       }
       
       int sum=0;
      Arrays.sort(a);
      for(int j=0;j<k;j++)
      {
        sum=sum+a[i];
      }
      
      System.out.println(sum);
       
       
       
       
    }
}


Compiler output:
Main.java:17: error: cannot find symbol
      Arrays.sort(a);
      ^
  symbol:   variable Arrays
  location: class Main
Main.java:20: error: cannot find symbol
        sum=sum+a[i];
                  ^
  symbol:   variable i
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <vector>

int main()
{
    int n,k;

    std::cin >> n >> k;
    std::vector<int> vec1(n);
    vec1.resize (n);

    
    for(int i=0;i<n;i++){
        std::cin >> vec1[i];
    }

    std::sort(vec1.begin(),vec1.end());
    
    int a=0;
    for(int i=0;i<k;i++){
        a=a+vec1[i];
    }
    std::cout << a << std::endl;
    return 0;
}


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


#include<bits/stdc++.h>
    using namespace std;
    #define int long long int
    #define pb push_back
    #define vi vector<int>
    #define loop(i,a,b) for(int i=a;i<b;i++)
    int32_t main()
    {
       
        #ifndef ONLINE_JUDGE
  freopen("input.txt" , "r" , stdin);
  freopen("output.txt" , "w" , stdout);
  #endif
           int n,k,s=0;
           cin>>n>>k
           int arr[n];
           loop(i,0,n)
           cin>>arr[i];
           sort(arr,arr+n);
           loop(i,0,k)
           s=s+arr[i];
           cout<<s<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:16:21: error: expected ';' before 'long'
   16 |            cin>>n>>k
      |                     ^
      |                     ;
a.cc:19:17: error: 'arr' was not declared in this scope
   19 |            cin>>arr[i];
      |                 ^~~
a.cc:20:17: error: 'arr' was not declared in this scope
   20 |            sort(arr,arr+n);
      |                 ^~~
Language: C++

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

int main()　{
  int N,K;
  cin >> N >> K;
  
  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:4:11: error: extended character 　 is not valid in an identifier
    4 | int main()　{
      |           ^
a.cc:4:11: error: expected initializer before '\U00003000'
    4 | int main()　{
      |           ^~
Language: C++

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

int main()　{
  int N,K;
  cinn >> N >> K;
  
  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:4:11: error: extended character 　 is not valid in an identifier
    4 | int main()　{
      |           ^
a.cc:4:11: error: expected initializer before '\U00003000'
    4 | int main()　{
      |           ^~
Language: C++

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

int main()
{
  int n, k, ans=0;
  
  cin>>n>>k;
  
  int a[i];
  
  for(int i=1; i<=n; i++)
  {
    cin>>a[i];
  }
  
  if(n==1)
  {
    cout<<a[1]<<endl;
    
    return 0;
  }
  
  int minv=0x7fffff, mini;
  
  for(int j=1; j<=k; j++)
  {
    for(int i=1; i<=n; i++)
    {
      if(a[i]<minv)
      {
        minv=a[i];
        mini=i;
      }
    }
    
    ans+=minv;
    
    a[mini]=0x7ffffff;
  }
  
  cout<<ans<<endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'i' was not declared in this scope
   10 |   int a[i];
      |         ^
a.cc:14:10: error: 'a' was not declared in this scope
   14 |     cin>>a[i];
      |          ^
a.cc:19:11: error: 'a' was not declared in this scope
   19 |     cout<<a[1]<<endl;
      |           ^
a.cc:30:10: error: 'a' was not declared in this scope
   30 |       if(a[i]<minv)
      |          ^
a.cc:39:5: error: 'a' was not declared in this scope
   39 |     a[mini]=0x7ffffff;
      |     ^
Language: C++


///Nahid Hasan Raju
#include <bits/stdc++.h>

#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define P1(XX) cout<<"db1: "<<XX<<endl
#define P2(XX,YY) cout<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cout<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>


using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007LL
#define MX 200005


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

ll m, n;
ll a[MX];
queue<ll>s1,s2;
int main()
{
    int test, tc=0, i, j;
    ll b,k;
    //scanf("%d", &test);
    test=1;
    while(test--)
    {
       ans=0;
        cin>>n>>k;
       for(i=0;i<n;i++)
       {
           scanf("%lld",&a[i]);


       }
       sort(a,a+n);
       for(i=0;i<k;i++)
       {
           ans+=a[i];
       }
       cout<<ans<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   61 |        ans=0;
      |        ^~~
      |        abs
Language: C++

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

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

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

int main(){
  	int n, k;
  	cin>>n>>k;
  	int h;
  	vector <int> m;
  	for(int i=0; i < n; i++){
      cin>>h;
      m.push_back(h);
    }
  	int tong =0;
  	for(int i = 0; i < k; i++){
      int dem = 0;
      int min = m[0];
        for(int i = 1; i<m.size(); i++){
          if( m[i] < min) {
            min = m[i];
            dem = i;
          }
        }
        tong += min;
        m.erase(m.begin() + dem)
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:33: error: expected ';' before '}' token
   26 |         m.erase(m.begin() + dem)
      |                                 ^
      |                                 ;
   27 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    ll ans=0;
    for(ll i=0;i<k;i++)
    ans+=a[i];
    cout<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<<'
   18 |     cout<ans<<endl;
      |          ~~~^~~~~~
Language: C

#include<stdio.h>
int mini(int *price int n)
{
  int min=price[0];
  int count=0;
  
  for(int i=1;i<n;i++)
  {
    if(price[i]<price[i-1])
    {
      min=price[i];
      count=i;
    }
  }
  price[count]=1001;
  
  return min;
}
  
  
  

int main(void)
{
  int total,n,k,i,*price;
  char nk[10];
  
  fgets(nk,sizeof(nk),stdin);
  sscanf(nk,"%d %d",&n,&k);
  
  price=(int *)malloc(sizeof(int)*n);
  
  for(i=0;i<n;i++)
  {
    scanf("%d",&price[i]);
  }
  
  total=0;
  
  for(i=0;i<k;i++)
  {
    total+=mini(price,n);
  }
  
  printf("%d",total);
  
  return 0;
}
  
  
  

Compiler output:
main.c:2:21: error: expected ';', ',' or ')' before 'int'
    2 | int mini(int *price int n)
      |                     ^~~
main.c: In function 'main':
main.c:31:16: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   31 |   price=(int *)malloc(sizeof(int)*n);
      |                ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include<stdio.h>
  +++ |+#include <stdlib.h>
    2 | int mini(int *price int n)
main.c:31:16: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   31 |   price=(int *)malloc(sizeof(int)*n);
      |                ^~~~~~
main.c:31:16: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:42:12: error: implicit declaration of function 'mini' [-Wimplicit-function-declaration]
   42 |     total+=mini(price,n);
      |            ^~~~
Language: C

#include<stdio.h>

int main(){
  int N,K,tmp,sum;
  scanf("%d%d",&N,&K);
  
  int p[N];
  for(int i=0;i<=N;i++){
    scanf("%d",&p[i]);
  }
  
  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;
        
      }
      
    } 
  }
  
  for(int i=0;i<=K;i++){
    sum = sum+p[i]
  }
  
  printf("%d",&sum);
  
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:27:19: error: expected ';' before '}' token
   27 |     sum = sum+p[i]
      |                   ^
      |                   ;
   28 |   }
      |   ~
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 a[] = new int[n];
            int k = sc.nextInt();
            for (int i=0; i<n; i++){
              a[i]=sc.nextInt();
            }
            Arrays.sort(a);
            int ans=0;
            for(int i=0; i<k; i++){
              ans+=a[i];
            }
            System.out.println(ans);
          }
         }

Compiler output:
Main.java:5: error: ';' expected
           int n sc.nextInt();
                ^
1 error
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 a[] = new int[n];
            int k = sc.nextInt();
            for (int i=0; i<n; i++){
              a[i]=sc.nextInt();
            }
            Arrays.sort(a);
            int ans=0;
            for(int i=0; i<k; i++){
              ans+=a[i];
            }
            System.out.println(ans);
          }
         }

Compiler output:
Main.java:2: error: class main is public, should be declared in a file named main.java
    public class main{
           ^
1 error
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 a[] = new int[n];
        int k = sc.nextInt();
        for (int i=0; i<n; i++){
          a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        int ans=0;
        for(int i=0; i<k; i++){
          ans+=a[i];
        }
        System.out.println(ans);
      }
     }

Compiler output:
Main.java:5: error: ';' expected
       int n sc.nextInt();
            ^
1 error
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> vec(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:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> vec(n);
      |          ^~~
a.cc:9:11: error: 'vec' was not declared in this scope
    9 |     cin>> vec[i];
      |           ^~~
a.cc:10:8: error: 'vec' was not declared in this scope
   10 |   sort(vec.begin(), vec.end() ) ;
      |        ^~~
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(vec.begin(), vec.end() ) ;
      |   ^~~~
      |   short
Language: C++

#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

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

/*https://atcoder.jp/contests/abc171/tasks/abc171_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int a[n],sum=0;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(s.begin(), s.end());
	for(int i=0;i<k;i++)
		sum+=a[i];
	cout<<sum;
}

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

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  	int n, m;
  	cin>>n>>m;
  	int a[n];
  	for(int i=0;i<n;i++){
     	cin>>a[i]; 
    }
  	sort(a,n);
  	if(n>=3){
     	cout<<a[0]+a[1]+a[2]<<endl;
    }
  	else if(n=2){
     	cout<<a[0]+a[1]<<endl;
    }
  	else cout<<a[0]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: no matching function for call to 'sort(int [n], int&)'
   11 |         sort(a,n);
      |         ~~~~^~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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:11:13: note:   deduced conflicting types for parameter '_RAIter' ('int*' and 'int')
   11 |         sort(a,n);
      |         ~~~~^~~~~
/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 <iostream>
#include <iostream>
using namespace std;
int main(){
  	int n, m;
  	cin>>n>>m;
  	int a[n];
  	for(int i=0;i<n;i++){
     	cin>>a[i]; 
    }
  	sort(a,n);
  	if(n>=3){
     	cout<<a[0]+a[1]+a[2]<<endl;
    }
  	else if(n=2){
     	cout<<a[0]+a[1]<<endl;
    }
  	else cout<<a[0]<<endl;
}

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

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

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

#include<bits/stdc++.h>
using namesapce std;
int main()
{
	int n,k;
  	scanf("%d %d",&n,&k);
	int a[n];
  
  	for(int i=0;i<n;i++)
      scanf("%d",&a[i]);
  
  	sort(a,a+n);
  
  	long long tot=0;
  	for(int i=0;i<k;i++)
      tot+=(long long)a[i];
  
  	printf("%lld",tot);
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   12 |         sort(a,a+n);
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
  	scanf("%d %d",&n,&k);
	int a[n];
  
  	for(int i=0;i<n;i++)
      scanf("%d",&a[i]);
  
  	sort(a,a+n);
  
  	long long tot=0;
  	for(int i=0;i<k;i++)
      tot+=(long long)a[i];
  
  	printf("%lld",tot);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:27: error: 'k' was not declared in this scope
    6 |         scanf("%d %d",&n,&k);
      |                           ^
Language: C++

#include<bits/stdc++.h>
using namesapce std;
int main()
{
	int n,m;
  	scanf("%d %d",&n,&k);
	int a[n];
  
  	for(int i=0;i<n;i++)
      scanf("%d",&a[i]);
  
  	sort(a,a+n);
  
  	long long tot=0;
  	for(int i=0;i<k;i++)
      tot+=(long long)a[i];
  
  	printf("%lld",tot);
}

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

#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
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(all(p.begin(), p.end()));
    int ans = 0;
    for(int i = 0; i < K; i++) ans += p[i];
    cout << ans << endl;
    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'all' was not declared in this scope; did you mean 'atoll'?
   15 |     sort(all(p.begin(), p.end()));
      |          ^~~
      |          atoll