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

#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d%d",&a,&b)
		c=a+b;
	if(c%3==0||a%3==0||b%3==0)  printf("Possible\n");
	else printf("Impossible\n");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:28: error: expected ';' before 'c'
    5 |         scanf("%d%d",&a,&b)
      |                            ^
      |                            ;
    6 |                 c=a+b;
      |                 ~
Language: C++

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

int main(){
int a,b;
cin>>a>>b;

if(a%3==0||b%3==0||(a+b)%3==0){
cout<<Possible<<endl;
}else{
cout<<Impossible<<endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 'Possible' was not declared in this scope
   10 | cout<<Possible<<endl;
      |       ^~~~~~~~
a.cc:12:7: error: 'Impossible' was not declared in this scope
   12 | cout<<Impossible<<endl;
      |       ^~~~~~~~~~
Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication32
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a=new int[2];
            a=Console.ReadLine().Split().Select(int.Parse).ToArray();
            if(a[0]%3==0||a[1]%3==0||(a[0]+a[1])%3==0)
            Console.WriteLine("Possible");
            else Console.WriteLine("Impossible");
            }
        }
}



Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:10:26: error: 'string' has not been declared
   10 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:10:35: error: expected ',' or '...' before 'args'
   10 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:18:10: error: expected ';' after class definition
   18 |         }
      |          ^
      |          ;
a.cc: In static member function 'static void ConsoleApplication32::Program::Main(int*)':
a.cc:12:16: error: structured binding declaration cannot have type 'int'
   12 |             int[] a=new int[2];
      |                ^~
a.cc:12:16: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:12:16: error: empty structured binding declaration
a.cc:12:19: error: expected initializer before 'a'
   12 |             int[] a=new int[2];
      |                   ^
a.cc:13:13: error: 'a' was not declared in this scope
   13 |             a=Console.ReadLine().Split().Select(int.Parse).ToArray();
      |             ^
a.cc:13:15: error: 'Console' was not declared in this scope
   13 |             a=Console.ReadLine().Split().Select(int.Parse).ToArray();
      |               ^~~~~~~
a.cc:13:49: error: expected primary-expression before 'int'
   13 |             a=Console.ReadLine().Split().Select(int.Parse).ToArray();
      |                                                 ^~~
Language: C++

A,B = [int(i) for i in input().split(" ")]
if (A+B) % 3 == 0 :
    print("Possible")
else:
    print("Impossible")


Compiler output:
a.cc:1:1: error: 'A' does not name a type
    1 | A,B = [int(i) for i in input().split(" ")]
      | ^
Language: C++

#include<iostream>
using namespace std;

int main(){
 int a,b;
 cin >> a >> b;

 if(a%3==0){
   cout <<"Possible" << endl;
 }
 else if(b%3==0){
   cout << "Possible" << endl;
 }
 else if( (a+b) % 3 == 0){
   cout << "Possible" << endl:
 else{
   cout << "Impossible" << endl;
 }
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:30: error: expected ';' before ':' token
   15 |    cout << "Possible" << endl:
      |                              ^
      |                              ;
a.cc:20:2: error: expected '}' at end of input
   20 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<cstdio>
#include<cstring>
int main() {
	int a,b;
	while(~scanf("%d%d",&a,&b) {
		if(a%3==0||b%3==0||(a+b)%3==0) puts("Possible");
		else puts("Impossible");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:35: error: expected ')' before '{' token
    5 |         while(~scanf("%d%d",&a,&b) {
      |              ~                    ^~
      |                                   )
Language: C++

#include <bits\stdc++.h>

using namespace std;
typedef long long ll ;

int main()
{
    ll a,b ;
    cin >> a >> b ;
    ll sum=a+b ;
    if (a%3==0 || b%3==0 || sum%3==0)
    {
        cout << "Possible" << endl ;
    }
    else
    {
        cout << "Impossible" << endl ;
    }
    return 0;
}


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

#include<bis/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if(a%3==0 || b%3==0 || (a+b)%3==0)
  cout<<"Possible";
  else
  cout<<"Impossible";
}


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

//2016.7.15
//ABC 067 (A)

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

using namespace std;

int main() {
	int a,b;
	cin >> a >>b;
	//vector <int> A(n);
	if(a%3==0){cout << Possible;}
  else if(b%3==0){cout <<Possible;}
  else if(a+b%3==0){cout <<Possible;}
  else cout << Impossible;




	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:28: error: 'Possible' was not declared in this scope
   14 |         if(a%3==0){cout << Possible;}
      |                            ^~~~~~~~
a.cc:15:26: error: 'Possible' was not declared in this scope
   15 |   else if(b%3==0){cout <<Possible;}
      |                          ^~~~~~~~
a.cc:16:28: error: 'Possible' was not declared in this scope
   16 |   else if(a+b%3==0){cout <<Possible;}
      |                            ^~~~~~~~
a.cc:17:16: error: 'Impossible' was not declared in this scope
   17 |   else cout << Impossible;
      |                ^~~~~~~~~~
Language: C++

#include<iostream>
#include<cctype>
#include<vector>
#include <ctype.h>
#include<algorithm>
#include<queue>
#include<string>
#include <math.h>
#include <iomanip>
using namespace std;
int n,p,t;
int main() {
	cin >> n >> p;
	if (n % 3 != = 0 && p % 3 != = 0 && (n + p) % 3 != = 0)cout << "Impossible" << endl; else cout << "Possible" << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: expected primary-expression before '=' token
   14 |         if (n % 3 != = 0 && p % 3 != = 0 && (n + p) % 3 != = 0)cout << "Impossible" << endl; else cout << "Possible" << endl;
      |                      ^
a.cc:14:38: error: expected primary-expression before '=' token
   14 |         if (n % 3 != = 0 && p % 3 != = 0 && (n + p) % 3 != = 0)cout << "Impossible" << endl; else cout << "Possible" << endl;
      |                                      ^
a.cc:14:60: error: expected primary-expression before '=' token
   14 |         if (n % 3 != = 0 && p % 3 != = 0 && (n + p) % 3 != = 0)cout << "Impossible" << endl; else cout << "Possible" << endl;
      |                                                            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	scanf("%d%d".&a,&b);
	if((a+b)%3==0)
		printf("Possible\n");
	else
		printf("Impossible\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:22: error: expected unqualified-id before '&' token
    6 |         scanf("%d%d".&a,&b);
      |                      ^
Language: C++

// #include <bits/stdc++.h>
#include <iostream>
#include <vector>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  ll n, k;
  cin >> n >> k;
  vector<ll> l(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> l[i];
  }
  sort(RALL(l));
  ll ans = 0;
  for(int i = 0; i < k; ++i) ans += l[i];
  cout << ans;

}

int main()
{
  fastio;
  solve();

  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:24:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |   sort(RALL(l));
      |   ^~~~
      |   short
Language: C++

#include <iostream>
using namespace std;

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

    int l[60];
    for(int i = 0; i < N; i++) {
        cin >> l[i];
    }
    sort(l,l+N);
    reverse(l, l+N);
    int sum = 0;
    for(int i = 0; i < K; i++) {
        sum += l[i];
    }
    cout << sum << endl;
}

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'o' was not declared in this scope
   10 |   int p=o;
      |         ^
Language: C++

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

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

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

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<N;i++){
      |       ^
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   for(i=0;i<K;i++){
      |       ^
Language: C++

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

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<N;i++){
      |       ^
a.cc:13:12: error: 'a' was not declared in this scope
   13 |     cin >> a[i];
      |            ^
a.cc:16:8: error: 'a' was not declared in this scope
   16 |   sort(a,a+N,greater<int>());
      |        ^
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   for(i=0;i<K;i++){
      |       ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:29: error: expected ';' before 'int'
   11 |   sort(x,x+n,greater<int>())
      |                             ^
      |                             ;
   12 | int sum=0;
      | ~~~                          
a.cc:14:3: error: 'sum' was not declared in this scope
   14 |   sum+=x[i]
      |   ^~~
a.cc:16:11: error: 'sum' was not declared in this scope
   16 |   cout << sum << endl;
      |           ^~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: invalid types 'int[int]' for array subscript
    9 |   cin >> n[i];
      |           ^
a.cc:11:29: error: expected ';' before 'int'
   11 |   sort(x,x+n,greater<int>())
      |                             ^
      |                             ;
   12 | int sum=0;
      | ~~~                          
a.cc:14:3: error: 'sum' was not declared in this scope
   14 |   sum+=x[i]
      |   ^~~
a.cc:16:11: error: 'sum' was not declared in this scope
   16 |   cout << sum << endl;
      |           ^~~
Language: C

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

int main(){
	int n,k;
	//if(scanf("%d %d", &n, &k)==EOF){return 0;}
	cin >> n >> k;
	int sticks[n];
	for(int i = 0; i < n ; i++){
		//if(scanf("%d", &l)==EOF){return 0;}
		cin >> sticks[i];
	}
	
	sort(sticks, sticks + n);
	int max = 0;
	for(int i = 0; i< k; i++){max += sticks[n-1-i];}	
	//printf("%d\n", max);
	cout << max << endl;
	return 0;

}

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

#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll N,K;
cn>>N>>K;
vector<ll> vec(N);
for(ll i=0;i<N;i++) {
  cin>>vec[i];
}
sort(all(vec));
reverse(all(vec));
ll ans=0;
for(ll i=0;i<K;i++) {
  ans+=vec[i];
}
cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: 'cn' was not declared in this scope; did you mean 'yn'?
    8 | cn>>N>>K;
      | ^~
      | yn
Language: C++

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

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());
  reverse (a.begin() , a.end());
  int sum=0 ;
  for ( int i=0 ; i<M ;i++){
    sum += a.at(i);
  }
  cout << sum << endl;
}

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

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

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());
  reverse (a.begin() , a.end());
  int sum=0 ;
  for ( int i=0 ; i<M ;i++){
    sum += a.at(i);
  }
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: request for member 'at' in 'a', which is of non-class type 'std::vector<int> [N]'
    9 |     cin >> a.at(i);
      |              ^~
a.cc:11:12: error: request for member 'begin' in 'a', which is of non-class type 'std::vector<int> [N]'
   11 |   sort ( a.begin() , a.end());
      |            ^~~~~
a.cc:11:24: error: request for member 'end' in 'a', which is of non-class type 'std::vector<int> [N]'
   11 |   sort ( a.begin() , a.end());
      |                        ^~~
a.cc:12:14: error: request for member 'begin' in 'a', which is of non-class type 'std::vector<int> [N]'
   12 |   reverse (a.begin() , a.end());
      |              ^~~~~
a.cc:12:26: error: request for member 'end' in 'a', which is of non-class type 'std::vector<int> [N]'
   12 |   reverse (a.begin() , a.end());
      |                          ^~~
a.cc:14:21: error: 'M' was not declared in this scope
   14 |   for ( int i=0 ; i<M ;i++){
      |                     ^
a.cc:15:14: error: request for member 'at' in 'a', which is of non-class type 'std::vector<int> [N]'
   15 |     sum += a.at(i);
      |              ^~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#define all(v) (v).begin(),(v).end()

using namespace std;

int main(){
  	int N, K;
  	cin >> N >> K;
  	vector<int> a(N);
  	for(int i=0;i<N;i++) cin >> a[i];
  	sort(all(a), greater<int>());
  	auto itr = a.begin + K;
  	cout << accumulate(a.begin(), itr) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:28: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
   15 |         auto itr = a.begin + K;
      |                    ~~~~~~~ ^ ~
      |                      |       |
      |                      |       int
      |                      <unresolved overloaded function type>
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#define all(v) (v).begin(),(v).end()

using namespace std;

int main(){
  	int N, K;
  	cin >> N >> K;
  	vector<int> a(N);
  	for(int i=0;i<N;i++) cin >> a[i];
  	sort(all(a), greater<int>());
  	cout << accumulate(a.begin(), a.begin()+K) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:27: error: no matching function for call to 'accumulate(std::vector<int>::iterator, __gnu_cxx::__normal_iterator<int*, std::vector<int> >)'
   15 |         cout << accumulate(a.begin(), a.begin()+K) << endl;
      |                 ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#define all(v) (v).begin(),(v).end()

using namespace std;

int main(){
  	int N, K;
  	cin >> N >> K;
  	vector<int> a(N);
  	for(int i=0;i<N;i++) cin >> a[i];
  	sort(all(a), greater<int>());
  	cout << accumulate(v.begin(), v.begin()+K) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:28: error: 'v' was not declared in this scope
   15 |         cout << accumulate(v.begin(), v.begin()+K) << endl;
      |                            ^
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: expected ';' before ')' token
   13 |   for(int i=0; i<K, i++){
      |                        ^
      |                        ;
Language: C

#include <stdio.h>

void sort(int a*,int n)
{
        int i,j,index,max;
        for(i=0;i<n;i++){
                max=a[i];index=i;
                for(j=i+1;j<n;j++)
                        if(max<a[j]){
                                max=a[j];index=j;
                        }
                a[index]=a[i];a[i]=max;
        }
        return ;
}
int main(void)
{
        int k,n,i,s=0;
        scanf("%d%d",&n,&k);
        int l[n];
        for(i=0;i<n;i++)
                scanf("%d",l[i]);
        sort(l,n);
        for(i=0;i<k;i++)
                s+=l[i];
        printf("%d\n",s);
        return 0;
}


Compiler output:
main.c:3:16: error: expected ';', ',' or ')' before '*' token
    3 | void sort(int a*,int n)
      |                ^
main.c: In function 'main':
main.c:23:9: error: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
   23 |         sort(l,n);
      |         ^~~~
Language: C

#include <stdio.h>

void sort(int *a,int n)
{
        int i,j,index,max;
        for(i=0;i<n;i++){
                max=a[i];index=i;
                for(j=i+1;j<n;j++)
                        if(max<a[j]){
                                max=a[j];index=j;
                        }
                a[index]=a[i];a[i]=max;
        }
        return ;
}
int main(void)
{
        int k,n,,i,s=0;
        scanf("%d%d",&n,&k);
        int l[n];
        for(i=0;i<n;i++)
                scanf("%d",l[i]);
        sort(l,n);
        for(i=0;i<k;i++)
                s+=l[i];
        printf("%d\n",s);
        return 0;
}


Compiler output:
main.c: In function 'main':
main.c:18:17: error: expected identifier or '(' before ',' token
   18 |         int k,n,,i,s=0;
      |                 ^
main.c:21:13: error: 'i' undeclared (first use in this function)
   21 |         for(i=0;i<n;i++)
      |             ^
main.c:21:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:17: error: 's' undeclared (first use in this function)
   25 |                 s+=l[i];
      |                 ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> N >> K;
      |   ^~~
a.cc:10:14: error: 'greater' was not declared in this scope
   10 |   sort(a,a+N,greater<int>());
      |              ^~~~~~~
a.cc:10:22: error: expected primary-expression before 'int'
   10 |   sort(a,a+N,greater<int>());
      |                      ^~~
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(a,a+N,greater<int>());
      |   ^~~~
      |   short
a.cc:15:3: error: 'cout' was not declared in this scope
   15 |   cout << ans << endl;
      |   ^~~~
a.cc:15:18: error: 'endl' was not declared in this scope
   15 |   cout << ans << endl;
      |                  ^~~~
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> L(N);
  for (int i = 0; i < N; i++) cin >> L.at(i);
  sort(L.rbegin(), L.rend());
  cout << accumulate(L.begin(), L.begin() + K, 0L); << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:53: error: expected primary-expression before '<<' token
   10 |   cout << accumulate(L.begin(), L.begin() + K, 0L); << "\n";
      |                                                     ^~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n,k; cin >> n >> k;
  int a[100];
  for(int i = 0; i<n;++i)cin >> a[i];
  sort(a,a+n);
  int sum = 0;
  for(int i = 0; i < k; ++i)sum += a[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(a,a+n);
      |   ^~~~
      |   short
Language: Java

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int N=gi();
        int K=gi();
        int[] L=new int[N];
        for(int i=0; i<N;i++) {
           L[i]=gi();
        }
        
        Arrays.sort(L);
        int s=0;
        for(int i=0; i<N;i++) {
            s+=L[N-i-1];
         }

	   
	    System.out.print(a);

//        if (t.equals("Sunny")) {
//        	System.out.print("Cloudy");
//        }else if(t.equals("Cloudy")){
//        	System.out.print("Rainy");
//        } else {
//        	System.out.print("Sunny");
//        }


	}
	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Compiler output:
Main.java:29: error: cannot find symbol
	    System.out.print(a);
	                     ^
  symbol:   variable a
  location: class Main
1 error
Language: Java

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

public class Main2 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] length = new int[N];

		int total = 0;
		for (int i = 0; i < N; i++) {
			length[i] = sc.nextInt();
		}
		Arrays.sort(length);

		int a = N - K;
		for (int i = a; i < N; i++) {
			total += length[i];
		}
		System.out.println(length);
	}
}

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

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

int main()
{
  int a, b, c, d;
  cin >> a >> b;
  int c[n];
  rep(i, n){
    cin >> c[i];
  }
  int ans = 0;
  sort(c, c + n);
  reverse(c, c + n);
  rep(i, b){
    ans += c[i];
  }
    
  

  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'n' was not declared in this scope
   12 |   int c[n];
      |         ^
a.cc:14:13: error: invalid types 'int[int]' for array subscript
   14 |     cin >> c[i];
      |             ^
a.cc:20:13: error: invalid types 'int[int]' for array subscript
   20 |     ans += c[i];
      |             ^
Language: C++

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

int main() {
  int n, k;
  cin >> n >> k;
  int a(n);
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  int len=0;
  sort(a.begin(),a.end());
  for(int i=n-1;i>=n-k;i--){
  	len+=a[i];
  }
  cout << len << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: invalid types 'int[int]' for array subscript
    9 |         cin >> a[i];
      |                 ^
a.cc:12:10: error: request for member 'begin' in 'a', which is of non-class type 'int'
   12 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:12:20: error: request for member 'end' in 'a', which is of non-class type 'int'
   12 |   sort(a.begin(),a.end());
      |                    ^~~
a.cc:14:15: error: invalid types 'int[int]' for array subscript
   14 |         len+=a[i];
      |               ^
Language: C++

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

int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  int len=0;
  sort(a.begin(),a.end());
  for(int i=n-1;i>=n-k;i--){
  	len+=a[i];
  }
  cout << len << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   12 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:12:20: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   12 |   sort(a.begin(),a.end());
      |                    ^~~
Language: C++

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

int main() {
  int N,K;
  int a[60];
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> a[i];
  int count=0;
  sort(a, a + N);
  reverse(a.begin(), a.end());
  for (int i = 0; i < K; ++i) {
    count+=a[i];
  }
  cout << count << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: request for member 'begin' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end());
      |             ^~~~~
a.cc:12:24: error: request for member 'end' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end());
      |                        ^~~
Language: C++

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

int main() {
  int N,K;
  int a[60];
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> a[i];
  int count=0;
  sort(a, a + N);
  reverse(a.begin(), a.end());
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: request for member 'begin' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end());
      |             ^~~~~
a.cc:12:24: error: request for member 'end' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end());
      |                        ^~~
Language: C++

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

int main() {
  int N,K;
  int a[60];
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> a[i];
  int count=0;
  sort(a, a + N);
  reverse(a.begin(), a.end())
  for (int i = 0; i < K; ++i) {
    count+=a[i];
  }
  cout << count << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: request for member 'begin' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end())
      |             ^~~~~
a.cc:12:24: error: request for member 'end' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end())
      |                        ^~~
a.cc:13:19: error: 'i' was not declared in this scope
   13 |   for (int i = 0; i < K; ++i) {
      |                   ^
Language: C++

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

int main() {
  int N,K;
  int a[60];
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> a[i];
  int count=0;
  sort(a, a + N) ;
  reverse(a.begin(), a.end());// a[0:N] を大きい順にソート
  for (int i = 0; i < K; ++i) {
    count+=a[i];
  }
  cout << count << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: request for member 'begin' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end());// a[0:N] を大きい順にソート
      |             ^~~~~
a.cc:12:24: error: request for member 'end' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end());// a[0:N] を大きい順にソート
      |                        ^~~
Language: C++

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

int main() {
  int N,K;
  int a[60];
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> a[i];
  int count=0;
  sort(a, a + N);
  reverse(a.begin(), a.end())// a[0:N] を大きい順にソート
  for (int i = 0; i < K; ++i) {
    count+=a[i];
  }
  cout << count << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: request for member 'begin' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end())// a[0:N] を大きい順にソート
      |             ^~~~~
a.cc:12:24: error: request for member 'end' in 'a', which is of non-class type 'int [60]'
   12 |   reverse(a.begin(), a.end())// a[0:N] を大きい順にソート
      |                        ^~~
a.cc:13:19: error: 'i' was not declared in this scope
   13 |   for (int i = 0; i < K; ++i) {
      |                   ^
Language: C++

#include <iostream>
using namespace std;

int main() {
  int N,K;
  int a[60];  // 最大 100 個ですが余裕をもたせます
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> a[i];
  int count=0;
  sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート
  for (int i = 0; i < K; ++i) {
    count+=a[i];
  }
  cout << count << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート
      |   ^~~~
      |   short
Language: C++

#include <iostream>
using namespace std;

int main() {
  int N,K;
  int a[60];  // 最大 100 個ですが余裕をもたせます
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> a[i];
  int count;
  sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート
  for (int i = 0; i < K; ++i) {
    count+=a[i];
  }
  cout << count << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート
      |   ^~~~
      |   short
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   11 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:11:20: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   11 |   sort(a.begin(),a.end());
      |                    ^~~
a.cc:12:13: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   12 |   reverse(a.begin(),a.end());
      |             ^~~~~
a.cc:12:23: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   12 |   reverse(a.begin(),a.end());
      |                       ^~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'i' was not declared in this scope
    9 |   sort(i.begin(),l.end());
      |        ^
a.cc:11:31: error: 'class std::vector<int>' has no member named 'ay'; did you mean 'at'?
   11 |   for(int i=0;i<k;i++) ans+=l.ay(n-i-1);
      |                               ^~
      |                               at
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b;
  in>>a>>b;
  vector<int> c(a);
  rep(i,a)
    cin>>c[i];
  sort(all(c));
  reverse(all(c));
  int d=0;
  rep(i,b)
    d+=c[i];
  out(d);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:80:3: error: 'in' was not declared in this scope; did you mean 'yn'?
   80 |   in>>a>>b;
      |   ^~
      |   yn
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b;
  in>>a>>b;
  vector<int> c(a);
  rep(i,a)
    cin>>c[i];
  sort(all(c));
  reverse(all(c));
  int d=0;
  rep(i,b)
    d+=b[i];
  out(d);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:80:3: error: 'in' was not declared in this scope; did you mean 'yn'?
   80 |   in>>a>>b;
      |   ^~
      |   yn
a.cc:88:9: error: invalid types 'long long int[long long int]' for array subscript
   88 |     d+=b[i];
      |         ^
Language: C++

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

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

  

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: no match for call to '(std::vector<int>) (int&)'
   16 |     sum += stick(i);
      |            ~~~~~^~~
Language: C++

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

int main() {
    int C, K;
    cin >> C >> K;
    vector<int> R(N);
    for (int i = 0; i < N; i++) {
        cin >> R.at(i);
    }

    sort(R.begin(), R.end(), greater<int>()); // 大きい順にソート
    int length = 0;

    for (int i; i < K; i++) {
        length += R.at(i);
    }
    cout << length << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: 'N' was not declared in this scope
    7 |     vector<int> R(N);
      |                   ^
Language: C++

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int n, k; cin >> n >> k;
	vector<int> l(n);
	forr (int i = 0; i < n; ++i) {
		cin >> l[i];
	}
	sort(all(l));
	int ans = 0;
	for (int i = k - l.size(); i < n; ++i) {
		ans += l[i];
	}
	cout << ans << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:15:15: error: expected primary-expression before 'int'
   15 |         forr (int i = 0; i < n; ++i) {
      |               ^~~
a.cc:15:26: error: 'i' was not declared in this scope
   15 |         forr (int i = 0; i < n; ++i) {
      |                          ^
Language: C++

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

int main() {
  int N K;
  int l[60];
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
  	cin >> l[i];
  }
  
  sort(a, a + N, greater<int>());
  int sum = 0;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: expected initializer before 'K'
    5 |   int N K;
      |         ^
a.cc:7:10: error: 'N' was not declared in this scope
    7 |   cin >> N >> K;
      |          ^
a.cc:7:15: error: 'K' was not declared in this scope
    7 |   cin >> N >> K;
      |               ^
a.cc:12:8: error: 'a' was not declared in this scope
   12 |   sort(a, a + N, greater<int>());
      |        ^
Language: C++

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

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

#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
const int MOD = 1e9+7;

int main() {
	int N,K;
  	cin >> N >> K;
  	vi l(N);
  	rep(i,N) cin >> l[i];
	sort(l);
  	riverse(l);
  	ans = 0;
  	rep(i,K)ans += l[i];
  	cout << ans << endl;
}

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

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

int main(){
  int a, b;
  int s[60];
  cin >> a, b;
  for (int i = 0; i < a ; ++i) cin >> s[i];
  sort(s, s + N, greater<int>()); 
  int sum = 0;
  for (int i = 0; i < b; ++i) {
    sum += s[i];
  }
  cout << sum << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: 'N' was not declared in this scope
    9 |   sort(s, s + N, greater<int>());
      |               ^
Language: C++

#include <iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(void) {
  int N;
  int K;
  int l[50];
  cin>>N>>K;
  int ans=0;
  for(int i=0;i<N;i++){
    cin>>a[i];
  sort(l,l+N,greater<int>());
  }
  for(int a=0;a<K;a++){
    ans+=l[a];
  }
  cout<<ans<<endl;
}
    
    
  


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

#include <iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(void) {
  int N;
  int K;
  int l[50];
  cin>>N>>K;
  int ans=0;
  for(int i=0;i<N;i++){
    cin>>a[i];
  sort(l,l+N,greater<int>());
  }
  for(int a=0;a<K;a++){
    ans+=l[i];
  }
  cout<<ans<<endl;
}
    
    
  

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

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

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> l;
    l.size() = N
    for (int i = 0; i < N; i++) {
        cin >> l.at(i);
    }
    sort(l.begin(), l.end()); 
    reverse(l.begin(), l.end()); 
    int count = 0;
    for (int i = 0; i < (K - 1); i++) {
    count+= l.at(i);
    }
  cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: lvalue required as left operand of assignment
    8 |     l.size() = N
      |     ~~~~~~^~
a.cc:9:21: error: 'i' was not declared in this scope
    9 |     for (int i = 0; i < N; i++) {
      |                     ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:32: error: 'a' was not declared in this scope
   10 |   for (int i=0;i<N;i++) cin >> a.at(i);
      |                                ^
a.cc:12:8: error: 'a' was not declared in this scope
   12 |   sort(a.begin(),a.end());
      |        ^
Language: C

#include<stdio.h>
#include<string.h>

int main(){
  
  int N,K;
  int tmp=0;
  int sum=0;
  scanf("%d",&N,&K);
  
  int l[N];
  for(int i=0; i<N; i++){
    scanf("%d",&l[i]);
  }

  for(int i=0; i<; i++){
    for(int j=0; j-1<; j++){
      if(l[j] < l[j+1]){
        tmp = l[j];
        l[j] = j[j+1];
        l[j+1] = tmp;
      }
    }
  }

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

}

Compiler output:
main.c: In function 'main':
main.c:16:18: error: expected expression before ';' token
   16 |   for(int i=0; i<; i++){
      |                  ^
main.c:17:18: error: 'j' undeclared (first use in this function)
   17 |     for(int j=0; j-1<; j++){
      |                  ^
main.c:17:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:22: error: expected expression before ';' token
   17 |     for(int j=0; j-1<; j++){
      |                      ^
Language: C

#include<stdio.h>
#include<string.h>

int main(){
  
  int N,K;
  int tmp=0;
  int sum=0;
  scanf("%d",&N,&K);
  
  int l[N];
  for(int i=0; i<N; i++){
    scanf("%d",l[i]);
  }

  for(int i=0; i<; i++){
    for(int j=0; j-1<; j++){
      if(l[j] < l[j+1]){
        tmp = l[j];
        l[j] = j[j+1];
        l[j+1] = tmp;
      }
    }
  }

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

}

Compiler output:
main.c: In function 'main':
main.c:16:18: error: expected expression before ';' token
   16 |   for(int i=0; i<; i++){
      |                  ^
main.c:17:18: error: 'j' undeclared (first use in this function)
   17 |     for(int j=0; j-1<; j++){
      |                  ^
main.c:17:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:22: error: expected expression before ';' token
   17 |     for(int j=0; j-1<; j++){
      |                      ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: expected primary-expression before 'int'
    8 |    cin >> int [i];
      |           ^~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:30: error: expected primary-expression before ')' token
    8 |   sort(l, l + n, greater<int>);
      |                              ^