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

n,m = map(int,input().split())
a = list(map(int,input().split()))
hang_day = n - sum(a)
if hang_day >= 0 :
    print(hang_day)
else:
    print('-1')

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n,m = map(int,input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
    1 | n,m = map(int,input().split())
      |   ^
main.c:1:7: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | n,m = map(int,input().split())
      |       ^~~
main.c:1:11: error: expected expression before 'int'
    1 | n,m = map(int,input().split())
      |           ^~~
main.c:2:1: error: expected ',' or ';' before 'a'
    2 | a = list(map(int,input().split()))
      | ^
main.c:7:11: warning: multi-character character constant [-Wmultichar]
    7 |     print('-1')
      |           ^~~~
Language: C++

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

int main() {
  int N,M;
  cin >> N >> M;
  int sum = 0; 
  int x;
  for (int i = 0; i < M; i++) {
    cin >> x;
    sum += x;
  }
}

if(N >= sum){
    cout  << N - sum << endl;
  }
else if(N < sum){
    cout  << "-1" << endl;
  } 

}


Compiler output:
a.cc:15:1: error: expected unqualified-id before 'if'
   15 | if(N >= sum){
      | ^~
a.cc:18:1: error: expected unqualified-id before 'else'
   18 | else if(N < sum){
      | ^~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long int n;
  int m;
  scanf("%ld%d",&n,&m);
  int a[m],i;
  long int sum=0;
  for(i=0;i<m;++1)
  {
   scanf("%ld",&a[i]);
    sum+=a[i];
   
  }
  if(sum>n)
    printf("-1");
  else
    printf("%ld",n-sum);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: lvalue required as increment operand
   10 |   for(i=0;i<m;++1)
      |                 ^
Language: C

#include <stdio.h>

int N;
int M;
int i;
int A_i[M];
int sum;
int answer;

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

Compiler output:
main.c:6:5: error: variably modified 'A_i' at file scope
    6 | int A_i[M];
      |     ^~~
Language: C

#include <bits/stdc++.h>
#define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y))
#define abs(x) ((x) < 0 ? (-(x)) : (x))
#define rep(i,a,m) for((i) = (a) ; (i) < (m) ; ++(i))
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.end(),x.begin()
#define sz(x) ((int)x.size())
using namespace std;
/*
#ifdef JUDGE
#include <fstream>
std::ifstream cin("input.txt");
std::ofstream cout("output.txt");
#else
#include <iostream>
using std::cin;
using std::cout;
#endif
*/
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pi;
int a, b, c, i, j, k;
long long ans = 0LL;
long double eps = 1.0E-14;
long long MOD = 1000000007;
/*
bool comparator(const MyStruct& lhs, const MyStruct& rhs) {
   return lhs.key < rhs.key;
}
*/
int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t,T, n;
    long long sum = 0;
	cin >> n >> T;	
	for(t = 1; t <= T; ++ t){
        cin >> a;
        sum += a;
		
		//cerr << t << "/" << T << " = " << ((double)clock () / CLOCKS_PER_SEC) << " | " << (((double)clock () / t * T) / CLOCKS_PER_SEC) << endl;
	}
    if (sum > n) {
        cout << -1 << endl;
        return 0;
    } 
    cout << n - sum << endl;
	return 0;
}

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

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

int main() {
  int N,M;
  cin >> N >> M;
  int sum = 0; 
  int x;
  for (int i = 1; i < M; i++) {
    cin >> x;
    sum += x;
  }
}

if(N >= sum){
    cout  << N - sum << endl;
  }
else if(N < sum){
    cout  << "-1" << endl;
  } 

}


Compiler output:
a.cc:15:1: error: expected unqualified-id before 'if'
   15 | if(N >= sum){
      | ^~
a.cc:18:1: error: expected unqualified-id before 'else'
   18 | else if(N < sum){
      | ^~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin>>N;
  cin>>M;
  int j=0;
  int sum=0;
    while(j<M){
      cin>>i;
      j++;
      sum+=i;
    }
  if(N-sum>=0){
  cout<<N-sum<<endl;
  }
  cout<<-1<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin>>N;
  cin>>M;
  int j=0;
  int sum=0;
    while(i<M){
      cin>>i;
      j++;
      sum+=i;
    }
  if(N-sum>=0){
  cout<<N-sum<<endl;
  }
  cout<<-1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: 'i' was not declared in this scope
   10 |     while(i<M){
      |           ^
Language: C++

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

int main() {
  int N,M;
  cin >> N >> M;
  int count = 0;

  for (i = 0; i < M; i++) {
    count += i;
  }
  if (count > 0) {
    cout << "-1" << endl;
    break;
  }
  
  cout << i << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'i' was not declared in this scope
    9 |   for (i = 0; i < M; i++) {
      |        ^
a.cc:14:5: error: break statement not within loop or switch
   14 |     break;
      |     ^~~~~
a.cc:17:11: error: 'i' was not declared in this scope
   17 |   cout << i << endl;
      |           ^
Language: C

#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<29;

int main(){
  int N, M; cin >> N >> M;
  vector<int> a(M);
  rep(i, M) cin >> a[i];
  int tmp = accumulate(a.begin(), a.end(), 0);
  if (N - tmp >= 0) cout << N - tmp << endl;
  else cout << -1 << endl;
}


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



import java.util.Scanner;

public class B {
	
		public static void main(String[] args) {
			
		
			Scanner sc=new Scanner(System.in);
			int N=sc.nextInt();
			int M=sc.nextInt();
			for(int i=0;i<M;i++) {
				N-=sc.nextInt();
			}
			if(N>=0)	System.out.println(N);
			else	System.out.println("-1");
			
		}
	

}


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

#include <stdio.h>

int N;
int M;
int i;
int A[M];
int sum;
int answer;

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

Compiler output:
main.c:6:5: error: variably modified 'A' at file scope
    6 | int A[M];
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  
vector<int> vec(A);
for (int i = 0; i < M; i++) {
  cin >> vec.at(i);
}
  
  int sum = 0;
    
  for (int i = 0; i < M; i++) {
    sum += vec.at(i)
  }
  
  int B = N - sum;
  
  if (B < 0) {
  cout << -1 << endl;
  } else {
  cout << sum << endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 'A' was not declared in this scope
    8 | vector<int> vec(A);
      |                 ^
a.cc:16:21: error: expected ';' before '}' token
   16 |     sum += vec.at(i)
      |                     ^
      |                     ;
   17 |   }
      |   ~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: no matching function for call to 'max(int, long long int)'
   12 |     cout<<max(-1,n-x)<<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:12:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   12 |     cout<<max(-1,n-x)<<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:12:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   12 |     cout<<max(-1,n-x)<<endl;
      |           ~~~^~~~~~~~
Language: C

#include<stdio.h>
int main()
{
    long long int n,m,s=0;
    scanf("%lld%lld",&n,&m);
    lon long int a[m];
    for(int i=0;i<m;i++)
    {
        scanf("%lld",&a[i]);
        s=s+a[i];
    }
    printf("%d\n",n-s);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:6:5: error: 'lon' undeclared (first use in this function)
    6 |     lon long int a[m];
      |     ^~~
main.c:6:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:8: error: expected ';' before 'long'
    6 |     lon long int a[m];
      |        ^~~~~
      |        ;
main.c:9:23: error: 'a' undeclared (first use in this function)
    9 |         scanf("%lld",&a[i]);
      |                       ^
Language: C

/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}

void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}

#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif

const double PI = acos(-1);
typedef long long ll;
#define int ll
#define fori(n) for(int i=0; i<int(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;

void solve() {
    cini(n);
    cini(m);
    cinai(a,m);

    int ans=0;
    for(int i=0; i<m; i++) {
        ans+=a[i];
    }
    cout<<max(0LL, n-ans)<<endl;
}

signed main() {
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
}



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

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

int main(void)
{
  int n, m, s, o;
  int a[1000];
  
  scanf("%d %d\n", &n, &m);
  for(int k = 0; k < m; k++) {
    scanf("%d ", &a[k]);
  }
  
  for(int k = 0; k < m; k++) {
    s = s + a[k];
  }
  
  if(s > n) {
    printf("-1\n");
    return -1;
  }
  
  o = n - s;
  
  printf("%d", o);
  
  return 0;
}

Compiler output:
main.c:30:5: error: redefinition of 'main'
   30 | int main(void)
      |     ^~~~
main.c:3:5: note: previous definition of 'main' with type 'int(void)'
    3 | int main(void)
      |     ^~~~
Language: C++

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

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


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 <iostream>
using namespace std;
int mian()
{
  cout<<"-1";
  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 <bits/stdc++.h>
using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  int i=0;
  while(i<M){
    N-i
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: expected ';' at end of input
    9 |     N-i
      |        ^
      |        ;
a.cc:9:8: error: expected '}' at end of input
a.cc:8:13: note: to match this '{'
    8 |   while(i<M){
      |             ^
a.cc:9:8: error: expected '}' at end of input
    9 |     N-i
      |        ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C

#include <stdio.h>

int N;
int M;
int i;
int A_i[M];
int sum;
int answer;

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

Compiler output:
main.c:6:5: error: variably modified 'A_i' at file scope
    6 | int A_i[M];
      |     ^~~
Language: C

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

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


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

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;

int main() 
{
	long int n, m;
	cin >> n >> m;
	for (int i = 0; i < m;i++) 
	{
		int buf;
		cin >> buf;
		n -= buf;
		if (n <= 0)
			break;
	}

	if (n <= 0)
		cout << -1 << endl;
	else
		cout << n;
	return 0;
}



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

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <algorithm>
#include <set>
#include <queue>

using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("aa_input.txt", "r", stdin);
    int t=1;
    //cin>>t;
    while (t--)
    {
       int n, m;
       cin>>n>>m;
       int a;
       int ans = 0;
       for(int i=0; i<m; i++){
           
           cin>>a;
           ans += a;
       }
       if(a>n) cout<<-1<<endl;
       else cout<<n-ans<<endl;
    }
    
    
    return 0;
}
/*

riaadmorshed@gmail.com

*/

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

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

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

int main() {
  		unsigned long long N; 
  int M;
  cin >> N >> M;
  vector<unsigned long long> A;
  unsigned long long sum = 0;
  for (int i= 0;i<M;++i){
    cin >> A[i];
    sum += A[i];
  }
  if(N - sum > 0){
    cout << N - sum;
  }else{ 
    cout << "-1";
   }
}



Compiler output:
a.cc:23:5: error: redefinition of 'int main()'
   23 | int main() {
      |     ^~~~
a.cc:4:9: note: 'int main()' previously defined here
    4 |     int main() {
      |         ^~~~
Language: C

#include<iostream>
using namespace std;
int main()
{int m,n,s=0,k;
cin>>n>>m;
int a[m];
for(int i=0;i<m;i++)
cin>>a[i];
for(int j=0;j<m;j++)
s=s+a[j];
k=n-s;
if(k>0)
cout<<k<<endl;
else cout<<"-1";
return 0;}

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

#include<math.h>
#include<vector>
using namespace std;

int main() 
{
	long int n, m;
	cin >> n >> m;
	for (int i = 0; i < m;i++) 
	{
		int buf;
		cin >> buf;
		n -= buf;
		if (n <= 0)
			break;
	}

	if (n <= 0)
		cout << -1 << endl;
	else
		cout << n;
	return 0;
}



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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: expected ';' before ')' token
   13 |   for (i < M; i++){
      |                  ^
      |                  ;
a.cc:17:17: error: expected ';' before ')' token
   17 |   for(i < M; i++){
      |                 ^
      |                 ;
Language: C++

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

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

int main() {
  		unsigned long long N;
  int M;
  cin >> N >> M;
  vector<unsigned long long> A;
  unsigned long long sum = 0;
  for (int i= 0;i<M;++i){
    cin >> A[i];
    sum += A[i];
  }
  if(N - sum > 0){
    cout << N - sum;
  }else{ 
    cout << "-1";
   }
}



Compiler output:
a.cc:23:5: error: redefinition of 'int main()'
   23 | int main() {
      |     ^~~~
a.cc:4:9: note: 'int main()' previously defined here
    4 |     int main() {
      |         ^~~~
Language: C

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


Compiler output:
main.c: In function 'main':
main.c:9:14: error: passing argument 1 of 'atoi' makes pointer from integer without a cast [-Wint-conversion]
    9 |     p+=atoi(a[i]);
      |             ~^~~
      |              |
      |              char
In file included from main.c:2:
/usr/include/stdlib.h:105:30: note: expected 'const char *' but argument is of type 'char'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
main.c:11:6: error: 's' undeclared (first use in this function)
   11 |   if(s>n){
      |      ^
main.c:11:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: expected ';' before ')' token
   13 |   for (i<M;i++){
      |               ^
      |               ;
a.cc:17:14: error: expected ';' before ')' token
   17 |   for(i<M;i++){
      |              ^
      |              ;
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin>>N>>M;
  
  vector<int> A(M);
    
   for(int i=0; i < M; i++) {
      cin >> a.at(i);
   }
  
  int sum=0;
  for (int i = 0; i < M; i++) {
    sum += a.at(i);
  }
    
    if (a.at(i)>N) {
      cout<<-1<<endl;
  }
    if else(a.at(i)<=N) {
      cout<<N-a.at(i)<<endl;
    }
 }
}

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

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

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

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

n,m= [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
ans = n-sum(a)
if(0<=ans):
    print(ans)
else:
    print(-1)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n,m= [int(x) for x in input().split()]
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
    1 | n,m= [int(x) for x in input().split()]
      |   ^
main.c:1:6: error: expected expression before '[' token
    1 | n,m= [int(x) for x in input().split()]
      |      ^
main.c:2:1: error: expected ',' or ';' before 'a'
    2 | a = [int(x) for x in input().split()]
      | ^
Language: C

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

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

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

import java.util.Scanner;

public class contest_163_B {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		long N = scn.nextInt();
		int M = scn.nextInt();
		long ans = N;
		for(int i = 0;i<M;i++) {
			ans -= scn.nextInt();
		}
		scn.close();
		if(ans < 0) {
			System.out.println(-1);
		} else {
			System.out.println(ans);
		}

	}

}


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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin>>N>>M;
  
  vector<int> A(M);
    
   for(int i=0; i < M; i++){
      cin >> a.at(i);
   }
  
  int sum=0;
  for (int i = 0; i < M; i++) {
    sum += a.at(i);
  }
    
    if (a.at(i)>N) {
      cout<<-1<<endl;
  }
    if else(a.at(i)<=N) {
      cout<<N-a.at(i)<<endl;
    }
}
}

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

#include <stdio.h>

int N;
int M;
int A_[M];
int sum;
int answer;

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

Compiler output:
main.c:5:5: error: variably modified 'A_' at file scope
    5 | int A_[M];
      |     ^~
main.c: In function 'main':
main.c:11:5: error: 'i' undeclared (first use in this function)
   11 | for(i=0;i<M;i++){
      |     ^
main.c:11:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin>>N>>M;
  
  vector<int> A(M)
    
   for(int i=0; i < M; i++){
      cin >> a.at(i);
   }
  
  int sum=0;
  for (int i = 0; i < M; i++) {
    sum += a.at(i);
  }
    
    if (a.at(i)>N) {
      cout<<-1<<endl;
  }
    if else(a.at(i)<=N) {
      cout<<N-a.at(i)<<endl;
    }
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:4: error: expected ',' or ';' before 'for'
   10 |    for(int i=0; i < M; i++){
      |    ^~~
a.cc:10:17: error: 'i' was not declared in this scope
   10 |    for(int i=0; i < M; i++){
      |                 ^
a.cc:16:12: error: 'a' was not declared in this scope
   16 |     sum += a.at(i);
      |            ^
a.cc:19:9: error: 'a' was not declared in this scope
   19 |     if (a.at(i)>N) {
      |         ^
a.cc:22:8: error: expected '(' before 'else'
   22 |     if else(a.at(i)<=N) {
      |        ^~~~
      |        (
a.cc: At global scope:
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C

#include<stdio.h>
int main() {
	int N, M, i, AM=0;
	int A[10000];

	scanf_s("%d""%d", &N,&M);
	for (i = 0; i < M; i++) {
		scanf_s("%d", &A[i]);
	}
	for (i = 0; i < M; i++) {
		AM += A[i];
	}
    if(AM==0){
      printf("0");
    }
	if (AM > N) {
		printf("-1");
	}
	if (AM < N) {
		printf("%d", N - AM);
	}
	return 0;
}

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

#include <stdio.h>

int N;
int M;
int A_[M];
int sum;
int answer;

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

Compiler output:
main.c:5:5: error: variably modified 'A_' at file scope
    5 | int A_[M];
      |     ^~
main.c: In function 'main':
main.c:11:5: error: 'i' undeclared (first use in this function)
   11 | for(i=0;i<M;i++){
      |     ^
main.c:11:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
#include<vector>
#include <numeric>  
int arraySum(vector<int> &v)  
{ 
    int initial_sum  = 0;  
    return accumulate(v.begin(), v.end(), initial_sum); 
} 


int main()
{
  long long n,m,sum;
  vector<int> v;
  cin>>n>>m;
  for(int i=0;i<m;i++)
  {
   int x;
   cin>>x;
   v.push_back(x); 
  }
  sum=arraySum(v);
  if(sum<=n)
    cout<<(n-sum);
  else cout<<"-1";
   return 0;


}

Compiler output:
a.cc:4:14: error: 'vector' was not declared in this scope
    4 | int arraySum(vector<int> &v)
      |              ^~~~~~
a.cc:4:14: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:4:21: error: expected primary-expression before 'int'
    4 | int arraySum(vector<int> &v)
      |                     ^~~
a.cc: In function 'int main()':
a.cc:14:3: error: 'vector' was not declared in this scope
   14 |   vector<int> v;
      |   ^~~~~~
a.cc:14:3: note: suggested alternatives:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:14:10: error: expected primary-expression before 'int'
   14 |   vector<int> v;
      |          ^~~
a.cc:15:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   15 |   cin>>n>>m;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:20:4: error: 'v' was not declared in this scope
   20 |    v.push_back(x);
      |    ^
a.cc:22:16: error: 'v' was not declared in this scope
   22 |   sum=arraySum(v);
      |                ^
a.cc:22:17: error: 'arraySum' cannot be used as a function
   22 |   sum=arraySum(v);
      |                 ^
a.cc:24:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   24 |     cout<<(n-sum);
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:25:8: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   25 |   else cout<<"-1";
      |        ^~~~
      |        std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C

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

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

#include<bits/stdc++.h>
using namespace std;
int main(void){
  int N,M,i; 
  cin>>N>>M>>i;
  string a[i]; 
  cin>>a[i];
  cout<<N-M*i<<endl; 
  return 0;
}

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

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n,m;
    cin >> n >> m;
    rep(i,m){
        int a;
        cin >> a;
        n -= a;
    }

    ll ans = max(-1, n);
    cout << ans << endl;
    return 0;
}
 
 


Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: no matching function for call to 'max(int, ll&)'
   20 |     ll ans = max(-1, n);
      |              ~~~^~~~~~~
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:20:17: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   20 |     ll ans = max(-1, n);
      |              ~~~^~~~~~~
/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:20:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   20 |     ll ans = max(-1, n);
      |              ~~~^~~~~~~
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:8:12: error: expected ';' before '}' token
    8 |     s+=a[i]
      |            ^
      |            ;
    9 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M,i,;
  cin>>N;
  cin>>M;
  int sum=0;
    while(M=0){
      cin>>i;
      M--;
      sum+=i;
    }
  cout<<N-sum<<endl;
      
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: expected unqualified-id before ';' token
    5 |   int N,M,i,;
      |             ^
Language: C++

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

Compiler output:
a.cc:2:9: error: 'cin' does not name a type
    2 |         cin >> n >> m;
      |         ^~~
a.cc:3:23: error: size of array 'a' is not an integral constant-expression
    3 |         int s = 0 , a[m];
      |                       ^
a.cc:4:9: error: expected unqualified-id before 'for'
    4 |         for(int i=0;i<m;i++)
      |         ^~~
a.cc:4:21: error: 'i' does not name a type
    4 |         for(int i=0;i<m;i++)
      |                     ^
a.cc:4:25: error: 'i' does not name a type
    4 |         for(int i=0;i<m;i++)
      |                         ^
a.cc:9:9: error: expected unqualified-id before 'if'
    9 |         if(s > n)
      |         ^~
a.cc:11:9: error: expected unqualified-id before 'else'
   11 |         else
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N,M;
  cin>>N,M;
  
  vector<int> A(M);
  int sum=0;
    for(i=0;i<M;i++){
      cin>>A.at(i);
    sum += A.at(i);
    }
  if((N-sum)>0){
    cout << N-sum <<endl;
  }
  else {
    cout << "-1"<<endl;
  }
  
  
  return 0;
}

  
  

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

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String[] NM = (scn.nextLine()).split(" ");
        int N = Integer.valueOf(NM[0]);
        int M = Integer.valueOf(NM[1]);
        String[] Am = (scn.nextLine()).split(" ");
        int sum = 0;
        int result = 0;
        for(int i=0;i<M;i++){
            sum += Integer.valueOf(Am[i]);
        }
        if(sum <= N){
            result = N -sum;
        }else{
            result = -1;
        }
        System.out.println(result);

    }

Compiler output:
Main.java:21: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

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

int main() {
  // 100要素の配列で初期化
  long long int A,B,C;
  cin>>A>>B;
  vector<int> vec(B);

  // 100個の入力を受け取る
  for (int i = 0; i < B; i++) {
    cin >> vec.at(i);
  }
   // 合計点を出力
  for (int i = 0; i < N; i++) {
    cout << vec.at(i) = C<< endl;
  }
  if(A-C >= 0){
    cout << A-C endl;
  }
  if(A-C<0){
    cout << "-1" endl;
    }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: 'N' was not declared in this scope
   15 |   for (int i = 0; i < N; i++) {
      |                       ^
a.cc:16:26: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<<'
   16 |     cout << vec.at(i) = C<< endl;
      |                         ~^~~~~~~
a.cc:19:16: error: expected ';' before 'endl'
   19 |     cout << A-C endl;
      |                ^~~~~
      |                ;
a.cc:22:17: error: expected ';' before 'endl'
   22 |     cout << "-1" endl;
      |                 ^~~~~
      |                 ;
Language: C

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

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


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

#include <stdio.h>

int N;
int M;
int A[M];
int sum;
int answer;

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

Compiler output:
main.c:5:5: error: variably modified 'A' at file scope
    5 | int A[M];
      |     ^
main.c: In function 'main':
main.c:11:5: error: 'i' undeclared (first use in this function)
   11 | for(i=0;i<M;i++){
      |     ^
main.c:11:5: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.Scanner;
import java.lang.Math;
public class MyClass {
    public static void main(String args[]) {
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int m = scan.nextInt();
      int sum = 0;
      for(int i = 0; i < m; i++){
          sum += scan.nextInt();
          
      }
      if(n-sum < 0){
          System.out.println(-1);
      }else{
          System.out.println(n-sum);
      }
    }
}

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

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


int main(){

  long n,m,i;
  long total=0;
  cin>>n>>m;

  long a[i];
  for(i=0; i<m; i++){
    scanf("%ld",&a[i]);
    int total=total+a[i];
  }

  if(total>n){
    printf("-1\n");
  }else{
    printf("%ld\n",n-total);
  }

  return 0;
}

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

import java.util.Scanner;
public class Atcoder1
{
    void main()
    {
        Scanner sc=new Scanner (System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[] x=new int[m];
        for(int a=0;a<m;a++)
        {
            x[a]=sc.nextInt();
            n=n-x[a];
        }
        
        if (n<0)
        System.out.println("-1");
        if(n>=0)
        System.out.println(n);
    }
}

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

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

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

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

#include<stdio.h>

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


Compiler output:
main.c: In function 'main':
main.c:15:9: error: expected ';' before 'printf'
   15 |     N=-1
      |         ^
      |         ;
   16 |     printf("%d",N);
      |     ~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{int m,n,s=0,k;
cin>>n>>m;
int a[m];
for(int i=0;i<m;i++)
cin>>a[i];
for(int j=0;j<m;j++)
s=s+a[j];
k=n-s;
if(k>0)
cout<<k
else cout<<"-1";
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: expected ';' before 'else'
   13 | cout<<k
      |        ^
      |        ;
   14 | else cout<<"-1";
      | ~~~~
Language: C


// Problem : B - Homework
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll power(ll x,ll y,ll m){if(y==0)return 1;ll p=power(x,y/2,m)%m;p=(p*p)%m;return (y%2==0)?p:(x*p)%m;}
ll nCr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}
#define Test int t;cin>>t;while(t--)
#define endl '\n'
void solve()
{
	int n,m;
	cin >> n >> m;
	vector<int> v(m);
	for(int i=0;i<m;++i)
	{
		cin >> v[i];
		n-=v[i];
	}
	if(n<0)
	cout << -1 << endl;
	else
	cout << n << endl;
	
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//Test
	solve();
	return 0;
}


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

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

int main() {
  ll n, m;
  cin >> n >> m;
  vector<ll> a(m);
  rep(i, m) cin >> a[i];
  rep(i, m) {
    n -= a[i];
    if(n < 0 ){
      cout << "-1" << endl;
      return 0;
    }
  }
  cout << n << endl;
  return 0;
}

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

    public int main(int N,int M){
        N=42;
        M=2;
        int[] Ai = {5, 6};
        int Answer;
        for(int i=0; i<M; i++){
            N = N - Ai[i];
        }
        if(N < 0){
            N = -1;
        }
        return N;
    }

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
    public int main(int N,int M){
           ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: Java

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		long N = scn.nextInt();
		int M = scn.nextInt();
		long ans = N;
		for(int i = 0;i<M;i++) {
			ans -= scn.nextInt();
		}
		scn.close();
		if(ans <= 0) {
			System.out.println("-1");
		} else {
			System.out.println(ans);
		}

	}

}

Compiler output:
Main.java:4: error: cannot find symbol
		Scanner scn = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner scn = new Scanner(System.in);
		                  ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M,i,sum;
  cin>>N;
  cin>>M;
    while(M=0){
      cin>>i;
      M--;
      sum+=i
    }
  cout<<N-sum<<endl;
      
}
  

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 'Ai' was not declared in this scope; did you mean 'i'?
   13 |     S += Ai;
      |          ^~
      |          i
Language: C

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

}


Compiler output:
main.c: In function 'main':
main.c:4:14: error: expected ';' before 'int'
    4 |    long int n
      |              ^
      |              ;
    5 |    int m,i,sum=0;
      |    ~~~        
main.c:7:17: error: 'n' undeclared (first use in this function)
    7 |    scanf("%ld",&n);
      |                 ^
main.c:7:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

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

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