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

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

int main() {
  int N, M;
  cin >> N >> M;
  int homework = 0;
  for (int i = 0;i < j; i++) {
    int tmp;
    cin >> tmp;
    homework += tmp;
  }
  if (homework > N) cout << -1 << endl;
  else cout << N - homework << endl;
}


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

import numpy as np
a, b = list(map(int, input().split()))
s = np.sum(list(map(int, input().split())))
print(np.max(a-s, -1))

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n, m;
  cin >> n >> m;
  ll a[n], x = 0;
  for(int i = 0; i < m; i++){
    cin >> a[i];
    x += a[i];
  }
  ll z = n - x;
  cout<<max(z, -1)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: no matching function for call to 'max(long long int&, int)'
   13 |   cout<<max(z, -1)<<endl;
      |         ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:13:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   13 |   cout<<max(z, -1)<<endl;
      |         ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:13:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   13 |   cout<<max(z, -1)<<endl;
      |         ~~~^~~~~~~
Language: C++

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

int main() {
  int N,M;cin>>N>>M;
  vector<int>vec A(M);
  int A=0;
  for(int i=0;i<M;i++){
    cin>>A.at(i);
    A+=A.at(i);
  }
  if(N>=A) cout<<N-A<<endl;
  else cout<<-1<<endl;
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:18: error: expected initializer before 'A'
    6 |   vector<int>vec A(M);
      |                  ^
a.cc:9:12: error: request for member 'at' in 'A', which is of non-class type 'int'
    9 |     cin>>A.at(i);
      |            ^~
a.cc:10:10: error: request for member 'at' in 'A', which is of non-class type 'int'
   10 |     A+=A.at(i);
      |          ^~
Language: C++

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

int main() {
  int N,K;cin>>N>>M;
  vector<int>vec A(N);
  int A=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    A+=A.at(i);
  }
  if(N>=A) cout<<N-A<<endl;
  else cout<<-1<<endl;
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: error: 'M' was not declared in this scope
    5 |   int N,K;cin>>N>>M;
      |                   ^
a.cc:6:18: error: expected initializer before 'A'
    6 |   vector<int>vec A(N);
      |                  ^
a.cc:9:12: error: request for member 'at' in 'A', which is of non-class type 'int'
    9 |     cin>>A.at(i);
      |            ^~
a.cc:10:10: error: request for member 'at' in 'A', which is of non-class type 'int'
   10 |     A+=A.at(i);
      |          ^~
Language: C++

#include <iostream>
#include<stdio.h>
using namespace std;
#define int long long

signed main(){
    // Your code here!
    int n,m,o;
    int a[10001]
    
    cin << n << m;
    
    for(int s=0; s < m ;s++){
        cin << a[s];
        o+=a[s]
    }
    if(n>=o){
        printf("%d",n-o);
    }else{
        printf("-1");
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: expected initializer before 'cin'
   11 |     cin << n << m;
      |     ^~~
a.cc:14:16: error: 'a' was not declared in this scope
   14 |         cin << a[s];
      |                ^
Language: C++

#include <iostream>
using namespace std;
#define int long long

signed main(){
    // Your code here!
    int n,m,o;
    int a[10001]
    
    cin << n << m;
    
    for(int s=0; s < m ;s++){
        cin << a[s];
        o+=a[s]
    }
    if(n>=o){
        printf("%d",n-o);
    }else{
        printf("-1");
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: expected initializer before 'cin'
   10 |     cin << n << m;
      |     ^~~
a.cc:13:16: error: 'a' was not declared in this scope
   13 |         cin << a[s];
      |                ^
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 m = sc.nextInt(); int s = 0;
		int[] a = new int[m];
		while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=arr[m];
		}
			int v = n-s;
			System.out.println(v >= 0 ? vacation : "-1");
	}
}

Compiler output:
Main.java:10: error: cannot find symbol
			s+=arr[m];
			   ^
  symbol:   variable arr
  location: class Main
Main.java:13: error: cannot find symbol
			System.out.println(v >= 0 ? vacation : "-1");
			                            ^
  symbol:   variable vacation
  location: class Main
2 errors
Language: Java

import java.util.*;
 
public class Main {
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
      
      int n=s.nextInt();
      int m=s.nextInt();
      int []a=new int[m];
      int sum=0;
      for(long i=0;i<m;i++)
      {
      a[i]=s.nextInt();
        sum+=a[i];
      }
      if(sum==n)
        System.out.println(0);
     else if(sum>n)
      {
       System.out.println(sum-n);
      }
      else
        System.out.println(-1);
      
    }
}

Compiler output:
Main.java:15: error: incompatible types: possible lossy conversion from long to int
      a[i]=s.nextInt();
        ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
        sum+=a[i];
               ^
2 errors
Language: Java

import java.util.*;
 
public class Main {
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
      
      long n=s.nextLong();
      long m=s.nextLong();
      long []a=new long[(int)m+1];
      long sum=0;
      for(long i=0;i<m;i++)
      {
      a[i]=s.nextLong();
        sum+=a[i];
      }
      if(sum==n)
        System.out.println(0);
     else if(sum>n)
      {
       System.out.println(sum-n);
      }
      else
        System.out.println(-1);
      
    }
}

Compiler output:
Main.java:15: error: incompatible types: possible lossy conversion from long to int
      a[i]=s.nextLong();
        ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
        sum+=a[i];
               ^
2 errors
Language: Java

import java.util.*;
 
public class Main {
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
      
      long n=s.nextLong();
      long m=s.nextLong();
      long []a=new long[m];
      long sum=0;
      for(long i=0;i<m;i++)
      {
      a[i]=s.nextLong();
        sum+=a[i];
      }
      if(sum==n)
        System.out.println(0);
     else if(sum>n)
      {
       System.out.println(sum-n);
      }
      else
        System.out.println(-1);
      
    }
}

Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
      long []a=new long[m];
                        ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
      a[i]=s.nextLong();
        ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
        sum+=a[i];
               ^
3 errors
Language: Java

import java.util.*;
 
public class Main {
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
      
      long n=s.nextLong();
      long m=s.nextLong();
      long []a=new int[m];
      long sum=0;
      for(long i=0;i<m;i++)
      {
      a[i]=s.nextLong();
        sum+=a[i];
      }
      if(sum==n)
        System.out.println(0);
     else if(sum>n)
      {
       System.out.println(sum-n);
      }
      else
        System.out.println(-1);
      
    }
}

Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
      long []a=new int[m];
                       ^
Main.java:11: error: incompatible types: int[] cannot be converted to long[]
      long []a=new int[m];
               ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
      a[i]=s.nextLong();
        ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
        sum+=a[i];
               ^
4 errors
Language: C++

#include<iostream>
using namespace std;
int main(){
int n,m,a;
int i;
cin>>n>>m;
for(i=0;i<m:i++){
cin>>a;
n=n-a;
}
if(n<0)n=-1;
cout<<n<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
    7 | for(i=0;i<m:i++){
      |         ^
a.cc:7:12: error: found ':' in nested-name-specifier, expected '::'
    7 | for(i=0;i<m:i++){
      |            ^
      |            ::
a.cc:7:11: error: 'm' is not a class, namespace, or enumeration
    7 | for(i=0;i<m:i++){
      |           ^
a.cc:11:1: error: expected primary-expression before 'if'
   11 | if(n<0)n=-1;
      | ^~
a.cc:10:2: error: expected ';' before 'if'
   10 | }
      |  ^
      |  ;
   11 | if(n<0)n=-1;
      | ~~
a.cc:11:1: error: expected primary-expression before 'if'
   11 | if(n<0)n=-1;
      | ^~
a.cc:10:2: error: expected ')' before 'if'
   10 | }
      |  ^
      |  )
   11 | if(n<0)n=-1;
      | ~~
a.cc:7:4: note: to match this '('
    7 | for(i=0;i<m:i++){
      |    ^
Language: C++

#include <iostream>
int main ()
{
int a[10010];
int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=0;i<m;i++)scanf("%d",&a[i]);
  int s=0;
  for(int i=0;i<m;i++)s+=a[i];
  if(s>n)
  {
  	printf("-1\n");
  }
  else
  {
  	printf("%d\n",n-s);
  }
}


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

#include <iostream>
int main (void)
{
int a[10010];
int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=0;i<m;i++)scanf("%d",&a[i]);
  int s=0;
  for(int i=0;i<m;i++)s+=a[i];
  if(s>n)
  {
  	printf("-1\n");
  }
  else
  {
  	printf("%d\n",n-s);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    5 | int main(){
      |         ^~
a.cc:5:9: note: remove parentheses to default-initialize a variable
    5 | int main(){
      |         ^~
      |         --
a.cc:5:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:5:11: error: a function-definition is not allowed here before '{' token
    5 | int main(){
      |           ^
a.cc:19:2: error: expected '}' at end of input
   19 | }
      |  ^
a.cc:3:1: note: to match this '{'
    3 | {
      | ^
Language: C

#include <stdio.h>
int main (void)
{
int a[10010];
int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=0;i<m;i++)scanf("%d",&a[i]);
  int s=0;
  for(int i=0;i<m;i++)s+=a[i];
  if(s>n)
  {
  	printf("-1\n");
  }
  else
  {
  	printf("%d\n",n-s);
  }
}


Compiler output:
main.c: In function 'main':
main.c:19:1: error: expected declaration or statement at end of input
   19 | }
      | ^
Language: C

#include <iostream>
int main (void)
{
int a[10010];
int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=0;i<m;i++)scanf("%d",&a[i]);
  int s=0;
  for(int i=0;i<m;i++)s+=a[i];
  if(s>n)
  {
  	printf("-1\n");
  }
  else
  {
  	printf("%d\n",n-s);
  }
}


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

#include <iostream>
int main (void)
{
int a[10010];
int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=0;i<m;i++)scanf("%d",&a[i]);
  int s=0;
  for(int i=0;i<m;i++)s+=a[i];
  if(s>n){
  	printf("-1\n");
  }else{
  	printf("%d\n",n-s);
}
}

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

#include <iostream>
int main (void)
{
int a[10010];
int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=0;i<m;i++)scanf("%d",&a[i]);
  int s=0;
  for(int i=0;i<m;i++)s+=a[i];
  if(s>n){
  	printf("-1\n");
  }else{
  	printf("%d\n",n-s);
}
}

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

#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N,M;cin>>N>>M;
  vector<int> vec(M);
  for(int i=0;i<M;i++){
    cin>>vec[i];
  }
  
  int sum=0;
  fot(int i=0;i<N;i++){
    sum+=vec[i];
  }
  
  if(sum<=N){
    cout<<N-sum<<endl;
  }
  else{
    cout<<"-1"<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: expected primary-expression before 'int'
   14 |   fot(int i=0;i<N;i++){
      |       ^~~
a.cc:14:15: error: 'i' was not declared in this scope
   14 |   fot(int i=0;i<N;i++){
      |               ^
Language: C++

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

int main(){
  int a,b,wa=0,i;
  cin>>a>>b;
  int n[b];
  for(i=0;i<b;i++){
    cin>>n[i];
    wa+=a[i];
  }
  a-=wa;
  if(a<0){
    cout<<-1;
  }else{
    cout<<a;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: invalid types 'int[int]' for array subscript
   10 |     wa+=a[i];
      |          ^
Language: C++

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



int main(){
  int N,M;
  cin>>N>>M;
  
  int sum=0;
  for(int i=0;i<M;i++){
    cin>>S;
    sum+=S;
  }
  cout<<N-sum<<endl;
}

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

#include <iostream>
using namespace std;

int main()
{
     int n,m,a,days=0;
     cin>>n>>m;
     
     for(int i=1;i<=m;i++)
     {
         cin>>a;
         days+=a;
     }
     if(n-days<0)
       cout<<"-1"<<endl
       else
     cout<<n-days<<endl;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: expected ';' before 'else'
   15 |        cout<<"-1"<<endl
      |                        ^
      |                        ;
   16 |        else
      |        ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N,M,Ai,Am,D,k;
    cin>>N;
    cin>>arr[M];
    cin>>Ai;
    cin>>Am;
    for(i=0;i<n;i++)
    {
     D=(arr[0]+arr[i]);
         i++;
    }
    if(N>D)
    {
        k=N-D;
        cout<<k;
    }
    else if (N<D)
    {
        cout<<"-1";
    }
    else
    {
        cout<<0;
    }
     return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'arr' was not declared in this scope
    7 |     cin>>arr[M];
      |          ^~~
a.cc:10:9: error: 'i' was not declared in this scope
   10 |     for(i=0;i<n;i++)
      |         ^
a.cc:10:15: error: 'n' was not declared in this scope
   10 |     for(i=0;i<n;i++)
      |               ^
Language: C++

int main(){
    int N, M;
    std::cin >> N >> M;
    int A[M];
    int cost = 0;
    for(auto &a: A) {std::cin >> a; cost += a;}
    std::cout << (N < cost ? -1 : N-cost) << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:10: error: 'cin' is not a member of 'std'
    3 |     std::cin >> N >> M;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main(){
a.cc:6:27: error: 'cin' is not a member of 'std'
    6 |     for(auto &a: A) {std::cin >> a; cost += a;}
      |                           ^~~
a.cc:6:27: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:10: error: 'cout' is not a member of 'std'
    7 |     std::cout << (N < cost ? -1 : N-cost) << "\n";
      |          ^~~~
a.cc:7:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C

#include<stdio.h>
int main(void){
  int N;
  int M;
  int nissuu[10000];
  int i;
  int nokori;
  int wa=0;
  scanf("%d",&N);
  scanf("%d",&M);
  for(i=0;i<M;i++){
    scanf("%d",&nissuu[i]);
    wa=wa+nissuu[i];
  }
  nokori=N-wa;
  if(wa>=0){
  printf("%d",nokori);
  }
  else{
    printf("-1");
  }

Compiler output:
main.c: In function 'main':
main.c:21:3: error: expected declaration or statement at end of input
   21 |   }
      |   ^
Language: C++

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

int main(){
  long long N, M;
  cin >> N >> M;
  
  long long res = 0;
  for (long mi = 0; mi < M; mi++){
    long long tmp;
    cin >> tmp;
    res += tmp;
  }
  
  if (res > N){
    cout << -1 << endl;
  } else {
    cout << N - res << ednl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:24: error: 'ednl' was not declared in this scope
   18 |     cout << N - res << ednl;
      |                        ^~~~
Language: C

#include <stdio.h>

int main(void){

	int N=0,M=0,sum=0,i=0,day=0;
	  
	scanf("%d",&N);
  	scanf("%d",&M);
  	
  	int A[i];
  	for(i=0;i<M;i++){
   		scanf("%d",&A[i]);
    	sum=sum+A[i];
    }
  	
  	day=sum-N;
  	if(day<0){
    	printf("-1");
    }else if(day)>=0){
    	printf("%d",sum);
    }
  
  	return 0;
  
}


Compiler output:
main.c: In function 'main':
main.c:19:18: error: expected expression before '>=' token
   19 |     }else if(day)>=0){
      |                  ^~
main.c:19:21: error: expected statement before ')' token
   19 |     }else if(day)>=0){
      |                     ^
Language: C

#include<stdio.h>
 
int main()
{
  int N,M,i,a;
 
  scanf("%d",&N);
  scanf("%d",&M);
  
  for(i=0;i<M;i++){
    scanf("%d", &a);
    n-=a;
  }
  
  if(N>0)
    printf("%d",N);
  else
    printf("-1");
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:5: error: 'n' undeclared (first use in this function)
   12 |     n-=a;
      |     ^
main.c:12:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<sdio.h>
int main(void){
  int n,m,i,max=0;
  int num[10000];
  
  scanf("%d",&n);
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&num[i]);
    max+=num[i];
  }
  if(n>=max){
    printf("%d",n-max);
  }
  else{
    printf("%d",-1);
  }
  return 0;
}


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

#include <stdio.h>

int main(void)
{
  int i, N, M;
  scanf("%d", &N);
  scanf("%d", &M);
  
  int A[M];
  int L = 0;
  for(i=1; i<=M; i++){
    scanf("%d", &A[M]);
    L = L + A[M];
  }
  if(L > N)
    return -1;
  else
    retutn 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:5: error: 'retutn' undeclared (first use in this function)
   18 |     retutn 0;
      |     ^~~~~~
main.c:18:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:11: error: expected ';' before numeric constant
   18 |     retutn 0;
      |           ^~
      |           ;
Language: C

#include<sdio.h>
int main(void){
  long n;
  long m;
  long i;
  long max=0;
  long num[10000];
  
  scanf("%ld",&n);
  scanf("%ld",&m);
  for(i=0;i<m;i++){
    scanf("%ld",&num[i]);
    max+=num[i];
  }
  if(n-max>=0){
    printf("%ld",n-max);
  }
  else{
    printf("%ld",-1);
  }
  return 0;
}


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

#include <stdio.h>

int main(void){

	int N=0,M=0,sam=0,i=0;
	  
	scanf("%d",&N);
  	scanf("%d",&M);
  	
  	int A[M]=0;
  	while(M<=0){
    	scanf("%d",&A[i]);
    	i=i+1;
    	M=M-1;
    	sam=sam+A[i];
    }
  
  	if(sam<0){
    printf("-1");
    }else if(sam>=0){
    printf("%d",&sam);
    }
  
  	return 0;
  
}


Compiler output:
main.c: In function 'main':
main.c:10:18: error: variable-sized object may not be initialized except with an empty initializer
   10 |         int A[M]=0;
      |                  ^
Language: C

#include<sdio.h>
int main(void){
  int n;
  int m;
  int i;
  int max=0;
  int num[10000];
  
  scanf("%d",&n);
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&num[i]);
    max+=num[i];
  }
  if(n-max>=0){
    printf("%d",n-max);
  }
  else{
    printf("%d",-1);
  }
  return 0;
}

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

#include<stdio.h>

int main(void)
{
  int N, M;
  int i,j,s;
  
  scanf("%d %d", &N,&M);
  
  int a[M-1]=0;
  for(i=0;i<M;i++) {
    scanf("%d", a[i]);
    s=s+a[i];
  }
 if(s>=N)
   printf("%d",s-N);
 else
   printf("-1");
  
 return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:10:14: error: variable-sized object may not be initialized except with an empty initializer
   10 |   int a[M-1]=0;
      |              ^
Language: C

#include <stdio.h>

int main(void)
{
  int i, N, M;
  do{
    scanf("%d", &N);
  }while(1<=N && N<=1000000);
  
  do{
    scanf("%d", &M);
  }while(1<=N && N<=10000);
  
  int A[M];
  int L = 0;
  for(i=1; i<=M; i++){
    scanf("%d", &A[M]);
    L = L + A[M];
  }
  if(L > N)
    return -1;
  else
    retutn 0;
}
   

Compiler output:
main.c: In function 'main':
main.c:23:5: error: 'retutn' undeclared (first use in this function)
   23 |     retutn 0;
      |     ^~~~~~
main.c:23:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:11: error: expected ';' before numeric constant
   23 |     retutn 0;
      |           ^~
      |           ;
Language: C

#include <stdio.h>

int mian(void){
  
  int n, m, i, sum=0;
  int a[1000];
  
  scanf("%d %d", &n, &m);
  
  for(i = 0; i < m; i++){
    scanf("%d", &a[i]);
    sum += a[i];
  }
  
  if(sum > n){
    printf("-1");
  }else{
    printf("%d", n-sum);
  }
  
  return 0;

}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
int main(void){

  int n,m,i,sum=0,judge;
  int a[];
  
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++){
    scanf("%d",&a[i]);
   	sum+=a[i];
  }
  
  judge=sum-n;
  
  if(judge<0)
    printf("-1");
  else
    printf("%d", judge);
  
  return 0;
  
  


}

Compiler output:
main.c: In function 'main':
main.c:5:7: error: array size missing in 'a'
    5 |   int a[];
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m; cin >> n >> m;
  int count=0;
  for(int i=0; i<m; i++){
    int data; cin >> data;
    count += data;
  }
  if(data>n) cout << -1 << endl;
  else cout << n-data << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>'
   11 |   if(data>n) cout << -1 << endl;
      |      ~~~~^~
a.cc:12:17: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator-'
   12 |   else cout << n-data << endl;
      |                ~^~~~~
Language: Java

package codetestpak;

import java.util.Scanner;

public class Codetestclass {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		
		int no = 0;
		int scan = 0;
		while(no>=m) {
			scan = scanner.nextInt();
			m = m - scan;
			no++;
		}
		if(m<-1) {
			m = -1;
		}
	}
}



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

#include<stdio.h>

int main(void) {
    unsigned int n;
    unsigned int m;
    unsigned int a[10000];
    unsigned int i,ans;
    scanf_s("%d %d", &n, &m);

    for (i = 0; i < m; i++) {
        scanf_s("%d", &a[i]);
    }

    ans = 0;

    for (int i = 0; i < m; i++) {
        ans = ans + a[i];
    }
    
    if (n < ans) {
        printf("-1\n");
    }
    else {
        printf("%d",n-ans);
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:5: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    8 |     scanf_s("%d %d", &n, &m);
      |     ^~~~~~~
      |     scanf
Language: C++

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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> a();
  rep(i,m){
    cin >> a.at(i);
  }
  int sum = 0;

  rep(i,m) {
    sum += i;
  }
  
  if (sum > n) {
  cout << -1;
  }
  else {
  cout << n - sum;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    8 |   vector<int> a();
      |                ^~
a.cc:8:16: note: remove parentheses to default-initialize a variable
    8 |   vector<int> a();
      |                ^~
      |                --
a.cc:10:14: error: request for member 'at' in 'a', which is of non-class type 'std::vector<int>()'
   10 |     cin >> a.at(i);
      |              ^~
Language: C++

#include<bits/stdc++.h>
// Useful constants
#define INF  (int)1e9
#define EPS   1e-9
#define MOD 1000000007ll
#define PI 3.14159
// for input-output
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
// iteration macros: have advantage of auto-casting and not recomputing arguments
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
// input macro
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
//output macro
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
// shortcut for data type
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define uset unordered_set
#define umap unordered_map
//--namespace
using namespace std;
//--useful function
ll gcd(ll a, ll b){ll temp;while (b > 0){temp = a%b;a = b;b = temp;} return a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
// --clock funtion
clock_t time_p=clock();
void TimeTaken()
{
    time_p=clock()-time_p;
    cerr<<"Completion time : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
// --solve function
void solve() {

}
//--main function
int main(){
	int n,s,sum=0;
	cin>>n;
	REP(i,0,n-1){
		cin>>s
		sum+=s;
	}
	if(n-sum<0)cout<<-1;
	else cout<<n-sum;
	return 0;

//   TimeTaken();
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:23: error: expected ';' before 'sum'
   68 |                 cin>>s
      |                       ^
      |                       ;
   69 |                 sum+=s;
      |                 ~~~
Language: C++

#include<iostream>
using namespace std;

int main()
{
    int N, M, ans;
    cin >> N >> M;
    ans = N
    for(int i=1; i<=M; i++){
        int A;  cin >> A;
        ans = ans - N;
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: expected ';' before 'for'
    8 |     ans = N
      |            ^
      |            ;
    9 |     for(int i=1; i<=M; i++){
      |     ~~~     
a.cc:9:18: error: 'i' was not declared in this scope
    9 |     for(int i=1; i<=M; i++){
      |                  ^
Language: C++

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

int main() {
    // freopen("number.in", "r", stdin);
    // freopen("number.out", "w", stdout);
    int sum = 0;
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        sum += x;
    }
    cout << ()(sum > m) ? -1 : (m - sum)) << endl; 
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: expected primary-expression before ')' token
   15 |     cout << ()(sum > m) ? -1 : (m - sum)) << endl;
      |              ^
Language: C++

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

int main() {
    // freopen("number.in", "r", stdin);
    // freopen("number.out", "w", stdout);
    int sum = 0;
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        sum += x;
    }
    cout << (sum > m) ? -1 : m - sum << endl; 
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:38: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   15 |     cout << (sum > m) ? -1 : m - sum << endl;
      |                              ~~~~~~~~^~~~~~~
Language: C

#include<stdio.h>
int main(){
  long long int N,M
  scanf("%lld %lld",&N,&M);
  long long int sum;
  int s;
  int arr[100000];
  for(int i=0; i<M;i++){
    scanf("%d",&arr[i]);
  }
  for(int i=0;i<M;i++){
    sum=sum+arr[i];
  }
  s=N-sum;
  if(s<0)
    printf("-1\n");
  else
    printf("%d\n",s);
}

Compiler output:
main.c: In function 'main':
main.c:4:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'scanf'
    4 |   scanf("%lld %lld",&N,&M);
      |   ^~~~~
main.c:8:18: error: 'M' undeclared (first use in this function)
    8 |   for(int i=0; i<M;i++){
      |                  ^
main.c:8:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main()
{
  int n=0,m=0;
  int len=0;
  int a[1000000];
  
  scanf("%d %d",&n &m);
  for(int i=0; i<m; i++)
  {
    scanf("%d",&a[i]);
  };
  
  for(int i=0;i<m;i++)
  {
   len =+ a[i];
  };
  
  if(n<len)
  {
  printf("-1");
  }else{
  printf("%d",len-n);
  };
  return 0;
};
        


Compiler output:
main.c: In function 'main':
main.c:9:20: error: invalid operands to binary & (have 'int *' and 'int')
    9 |   scanf("%d %d",&n &m);
      |                 ~~ ^
      |                 |
      |                 int *
Language: C

#include <stdio.h>

int main()
{
  int n=0,m=0;
  int len=0;
  int a[m];
  
  scanf("%d %d", &n,&m);
  for(int i=0; i<m; i++)
  {
    scanf("%d",&a[m]);
  };
  
  for(int i=0;i<m;i++)
  {
   len+=a[i];
  };
  
  if(m<len)
{
  printf("-1");
}
        

Compiler output:
main.c: In function 'main':
main.c:23:1: error: expected declaration or statement at end of input
   23 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main ()
{
  int N,M;
  cin>>N>>M;
  for(int =0;i<M;i++)
  {
    int A;
    cin>>A;
    N-=A;
  }
  if(N>=0)
  {
    cout<<N<<endl;
  }
  else
  {
    cout<<-1<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: expected unqualified-id before '=' token
    9 |   for(int =0;i<M;i++)
      |           ^
a.cc:9:10: error: expected ';' before '=' token
    9 |   for(int =0;i<M;i++)
      |          ^~
      |          ;
a.cc:9:11: error: expected primary-expression before '=' token
    9 |   for(int =0;i<M;i++)
      |           ^
a.cc:9:14: error: 'i' was not declared in this scope
    9 |   for(int =0;i<M;i++)
      |              ^
a.cc:9:17: error: expected ')' before ';' token
    9 |   for(int =0;i<M;i++)
      |      ~          ^
      |                 )
a.cc:9:18: error: 'i' was not declared in this scope
    9 |   for(int =0;i<M;i++)
      |                  ^
Language: C

#include <stdio.h>

int CountFreeDays()
{
	int vacationDays, assignments, daysRequired = 0;

	while (1)
	{
		//printf("Enter the vacation days and assigments...\n");
		scanf("%d %d", &vacationDays, &assignments);
		if (vacationDays < 1000000 && vacationDays > 0 && assignments < 1000 && assignments > 0)
		{
			for (int i = 0; i < assignments; i++)
			{
				int oneAssignment;
				scanf("%d", &oneAssignment);
				if (oneAssignment < 1000 && oneAssignment > 1)
				{
					daysRequired += oneAssignment;
				}
				else
				{
					printf_s("Wrong Input \n");
					return -1;
				}
			}
			break;
		}
		else
		{
			printf_s("Wrong input \n");
		}
	}
	return vacationDays - daysRequired;
}

int main(int argc, const char* argv[])
{

	int freeDays = CountFreeDays();

	if (freeDays < 0)
	{
		printf_s("-1 \n");
	}
	else
	{
		printf_s("You will have %d free days \n", freeDays);
	}

	return 0;
}

Compiler output:
main.c: In function 'CountFreeDays':
main.c:23:41: error: implicit declaration of function 'printf_s'; did you mean 'printf'? [-Wimplicit-function-declaration]
   23 |                                         printf_s("Wrong Input \n");
      |                                         ^~~~~~~~
      |                                         printf
Language: C++

#include <bits/stdc++>
#include <string>
using namespace std;
int main(){
  string s;
  int n;
  int m;
  cin>>n>>m;
  for(i=0;i=m;i++){
    cin>>s;
    count s +=;
  }
  if(count s<n){
    cout<<-1<<endl;
  }
  else{
    cout<<count s<<endl;
  }
  return 0;
}

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

#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
#include <string>
using namespace std;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int mod = 1000000000 + 7;

int main(){
    //std::stack<int> stack;
    int n, m;
    cin >> n >> m;
    int sum = 0;
    int ans;
    for(int i = 0; i < m; i++){
        cin >> a;
        sum += a;
    }
    if(sum > n){
        ans = -1;
    }else{
        ans = n - sum;
    }
    cout << ans << endl;
    return 0;
}





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

#include <iostream>
using namespace std;

int main(void)
{
  int summer_vacation_days, homework_num;
  
  cin >> summer_vacation_days >> homework_num;
  
  int homework_day;
  int total_homework_day = 0;
  for(int i = 0; i < homework_num; i++)
  {
    cin >> homework_day;
    total_homework_day += homework_day;
  }
  
  if (total_homework_day > summer_vation_days)
  {
    //宿題を終わらせることができません
    cout << -1 << endl;
  }
  else
  {
    //夏休みに遊べる日数
    cout << (summer_vation_days - total_homework_day) << endl;
  }
 
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:28: error: 'summer_vation_days' was not declared in this scope; did you mean 'summer_vacation_days'?
   18 |   if (total_homework_day > summer_vation_days)
      |                            ^~~~~~~~~~~~~~~~~~
      |                            summer_vacation_days
Language: C++

int main(void){
    int n, m;
    std::cin >> n >> m;
    for(int i = 0; i < m; ++i){
        int tmp;
        std::cin >> tmp;
        n -= tmp;
        if(n < 0){
            std::cout << -1 << std::endl;
            return 0;
        }
    }
    std::cout << n << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:10: error: 'cin' is not a member of 'std'
    3 |     std::cin >> n >> m;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main(void){
a.cc:6:14: error: 'cin' is not a member of 'std'
    6 |         std::cin >> tmp;
      |              ^~~
a.cc:6:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:9:18: error: 'cout' is not a member of 'std'
    9 |             std::cout << -1 << std::endl;
      |                  ^~~~
a.cc:9:18: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:9:37: error: 'endl' is not a member of 'std'
    9 |             std::cout << -1 << std::endl;
      |                                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | int main(void){
a.cc:13:10: error: 'cout' is not a member of 'std'
   13 |     std::cout << n << std::endl;
      |          ^~~~
a.cc:13:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:28: error: 'endl' is not a member of 'std'
   13 |     std::cout << n << std::endl;
      |                            ^~~~
a.cc:13:28: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

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

int main(){

  long int n,m;
  cin>>n>>m;

   long int a[m];

  for(int i=0;i<m;i++)
    cin>>a[i];

    for(int i=0;i<n;i++){
        sum += a[i];
   }

    if(sum <= m)
   cout<<m-sum<<endl;
   else if(sum > m)
    cout<<"-1"<<endl;

 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'sum' was not declared in this scope
   15 |         sum += a[i];
      |         ^~~
a.cc:18:8: error: 'sum' was not declared in this scope
   18 |     if(sum <= m)
      |        ^~~
Language: Java

import java.util.Scanner;

class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int M = sc.nextInt();
   int[] A =new int[M];;
   int sum=0
   
   for(int i=0;i<M;i++){
      A[i] = sc.nextInt();
      sum=sum+A[i];
   }

   if(sum<N){
     System.out.println(N-sum);
   }
   else{
     System.out.println(-1);
   }
 
 }
}

Compiler output:
Main.java:9: error: ';' expected
   int sum=0
            ^
1 error
Language: C++

#include <iostream>
using namespace std;

int main(){
  int a,b,c,d;
  cin>>a>>b;
  c=0
  for(int i=0;i<b;i++){
    cin>>d;
    c+=d;
  }
  if(a-c<0)cout<<-1;
  else cout<<a-c;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:6: error: expected ';' before 'for'
    7 |   c=0
      |      ^
      |      ;
    8 |   for(int i=0;i<b;i++){
      |   ~~~ 
a.cc:8:15: error: 'i' was not declared in this scope
    8 |   for(int i=0;i<b;i++){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespce std;
int main() {
  int N, M;
  cin >> N >> M;
  int ans = 0;
  int Ai;
  for (int i = 0; i < M; ++i) {
    cin >> Ai;
    ans += Ai;
  }
  ans = N - ans;
  ans = max(-1, ans);
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namespce'
    2 | using namespce std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin >> N >> M;
      |   ^~~
      |   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:13:9: error: 'max' was not declared in this scope; did you mean 'std::max'?
   13 |   ans = max(-1, ans);
      |         ^~~
      |         std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:14:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 |   cout << ans << 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:14:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   14 |   cout << ans << 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<iostream>
#include<algorithm>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int a;
  int ans = 0;

  for (int i = 0; i < m; i++) {
    cin >> a[i];
    ans += a[i];
  };
  
  if (ans > n){
    cout << -1 << endl;
    return 0;
  } else {
    cout << ans << endl;
    return 0;
  }
};

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: invalid types 'int[int]' for array subscript
   12 |     cin >> a[i];
      |             ^
a.cc:13:13: error: invalid types 'int[int]' for array subscript
   13 |     ans += a[i];
      |             ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int a[10010];
int main() {
  int n, m;
  scanf("%d%d",&n,&m);

  for (int i = 0; i < m; i++)scanf("%d", &a[i]);
  int ans = 0;
  for (int i = 0; i < m; i++)ans+=a[i];
  if (ans>n){
    printf("-1\n")
  }else{
    printf("%d\n", n-ans);
  }
};

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before '}' token
   13 |     printf("-1\n")
      |                   ^
      |                   ;
   14 |   }else{
      |   ~
Language: C++

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

int main() {
  int n, m, a;
  cin >> n, m, a;
  int ans = 0;
  int i;

  for (i = 0; i <= m; i++) {
    ans += a[i];
  };

  if (n-ans < 0) {
    cout << -1 << endl;
  };


  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: invalid types 'int[int]' for array subscript
   12 |     ans += a[i];
      |             ^
Language: C++

#include<cstdio>

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int A;
  for (int i = 0; i < M; i++) {
    scanf("%d", &A);
    n = n - A;
  }
  if (n >= 0) {printf("%d", n);}
  else {printf("%d", -1);}
  return 0;
}

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

#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
int n,m;
  int a[10010];
  cin>>n>>m;
  for(int i=0;i<m;i++)cin>>a[i];
int s=0;
  for(int i=0;i<m;i++)s+=a[i];
if(n<s)cout<<-1<<endl;;
  else printf("%d\n",n-s);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'else' without a previous 'if'
   13 |   else printf("%d\n",n-s);
      |   ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
int n,m;
  int a[10010];
  cin>>n>>m;
  for(int i=0;i<m;i++)cin>>a[i];
int s=0;
  for(int i=0;i<m;i++)s+=a[i];
if(n<s)cout<<-1<<endl;;
  else cout<<n-s<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'else' without a previous 'if'
   12 |   else cout<<n-s<<endl;
      |   ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
int n,m;
  int a[10010];
  cin>>n>>m;
  for(int i=0;i<m;i++)cin>>a[i];
int sum=0;
  for(int i=0;i<m;i++)sum+=a[i];
if(n<sum)cout<<-1<<endl;;
  else cout<<n-sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'else' without a previous 'if'
   12 |   else cout<<n-sum<<endl;
      |   ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
int n,m;
  int a[];
  for(int i=0;i<m;i++)cin>>a[i];
int sum=0;
  for(int i=0;i<m;i++)sum+=a[i];
if(n<sum)cout<<-1;
  else cout<<n-sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: storage size of 'a' isn't known
    6 |   int a[];
      |       ^
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 M = sc.nextInt();
      	int[] A=new int[M];
        int sum=0;
      	for(int i=0;i<M;i++){
        	A[i]=sc.nextInt();
        }
        for(i=0;i<M;i++){
        	sum=sum+A[i];
        }
      if(sum>N){
      	System.out.println(-1);
      }
      else{
        System.out.println(N-sum);
      }
		
		
	}
}

Compiler output:
Main.java:13: error: cannot find symbol
        for(i=0;i<M;i++){
            ^
  symbol:   variable i
  location: class Main
Main.java:13: error: cannot find symbol
        for(i=0;i<M;i++){
                ^
  symbol:   variable i
  location: class Main
Main.java:13: error: cannot find symbol
        for(i=0;i<M;i++){
                    ^
  symbol:   variable i
  location: class Main
Main.java:14: error: cannot find symbol
        	sum=sum+A[i];
        	          ^
  symbol:   variable i
  location: class Main
4 errors