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

#include <algorithm>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

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

  vector<int> A(N);

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

  int sum = accumulate(A.begin(), A.end(), 0);

  int rest = n - sum;
  
  cout << ((rest > 0) ? rest : -1) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: 'n' was not declared in this scope
   25 |   int rest = n - sum;
      |              ^
Language: C

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

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

const long long INF = 1LL << 60;

typedef long long 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;
}

int main(){
    int n,m;
    cin >> n >> m;
    //vector<int> a;
    int cnt = 0;
    int tmp ;
    rep(i,m){
        cin >> tmp;
        cnt += tmp;
    }
    cout << max(n - cnt,-1) << endl;
    return 0;
}


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

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

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

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

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

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

#include <vector>
#include<istream>
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin>>N;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<istream>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:12:8: error: no match for 'operator+=' (operand types are 'int' and 'std::vector<int>')
   12 |     ans+=A[i];
      |     ~~~^~~~~~
a.cc:15:5: error: 'cout' was not declared in this scope
   15 |     cout<<N-ans<<endl;
      |     ^~~~
a.cc:15:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout<<"-1"<<endl;
      |     ^~~~
a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C

#include <bits/stdc++.h>
#define PI 3.14159265358979323846
using namespace std;
typedef long long ll;
typedef long double ld;
const double EPS = 1e-9;
const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
// int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; // 4 Direction
// int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Direction
// int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; // Knight Direction
// int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; // Hexagonal Direction
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
  int n,m;
	cin>>n>>m;
	vector<int> in;
	int input;
	int sum = 0;
	for(int i=0;i<m;i++){
		cin>>input;
		sum+=input;
	}
	if(n<sum)	cout<<"-1"<<endl;
	else	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 ;
  int A[] ;
  cin >> N >> M ;
  cin >> A[] ;
  if ( N > M && N > A[i] ) {
    cout << N - M << endl;
  }
  else
    cout << -1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: storage size of 'A' isn't known
    6 |   int A[] ;
      |       ^
a.cc:8:12: error: expected primary-expression before ']' token
    8 |   cin >> A[] ;
      |            ^
a.cc:9:23: error: 'i' was not declared in this scope
    9 |   if ( N > M && N > A[i] ) {
      |                       ^
Language: C

#include<bits/stdc++.h>
using namespace std;
int main() { 
	int n,m;
	cin>>n>>m;
	while (m--) {
		int t;
		cin>>t;
		n-=t;
	}
	cout<<n;
	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>
using namespace std;
{
  int n,m;
  cin>>n>>m;
  int sum=0;
  for(int i=0;i<m;i++)
  {
    int x;
    cin>>x;
    sum +=x;
  }
  if(n>=sum)
      cout<<(n-sum)<<endl;
  else
      cout<<"-1"<<endl;
  return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '{' token
    3 | {
      | ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: expected ')' before ';' token
    7 |   while (i = 0; i < M) {
      |         ~     ^
      |               )
a.cc:7:22: error: expected ';' before ')' token
    7 |   while (i = 0; i < M) {
      |                      ^
      |                      ;
Language: C

//
// Created by yamunaku on 2020/04/19.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    int n, m;
    cin >> n >> m;
    int t=0;
    rep(i, m){
        int x;
        cin >> x;
        t += x;
    }
    if(t > n)cout << -1 << endl;
    else cout << n - t << endl;
    return 0;
}

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

import numpy as np
N,M = map(int,input().split())
A =list(map(int, input().split()))
Asum = sum(A)
if Asum > N:
  print(-1)
else:
  print(N - Asum)
 

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import numpy as np
      | ^~~~~~
main.c:1:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'as'
    1 | import numpy as np
      |              ^~
main.c:1:14: error: unknown type name 'as'
Language: C

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,sum=0;
    cin>>n>>m;
    int a[m];
    for(int i=0;i<m;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(n-sum>=0)
        cout<<n-sum<<endl;
    else
        cout<<-1<<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: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Qb3
{
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0;
		ST = new StringTokenizer(BR.readLine());
		for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken());
		System.out.println((homeworkDays <= N) ? N - homeworkDays : -1);
	}
}


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

#include<iostream>
#include <algorithm>
#include <queue>

#define fr(i,y) for(int i=0;i<y;i++)

using namespace std;
long long int s;
	int main() {
		long long  n, m,a[10000];
		cin >> n >> m;
		fr(i, m)
		{
			cin >> a[i];
		}
		fr(i, m) {

			s += a[i];
			
		}
		if (s <= n)
				return cout << n - s , 0;
		cout << -1;
	}


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

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

int main() {
  int N, M,A;
  cin >> N >> M;

  A = 0;
  
  for (int i = 0; i < M; i++) {
    int t;
    cin >> t;
    
    A += t;
  }
  
  if (N - A >= 0) cout << N - A << 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 <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;

ull n, m, a[10005], s = 0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m;
    for (ull i = 1; i <= m; i++)
    {
        cin >> a[i];
        s += a[i];
    }
    if (s > a[i]) cout << -1;
    else cout << a[i] - s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:15: error: 'i' was not declared in this scope
   19 |     if (s > a[i]) cout << -1;
      |               ^
Language: C

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

int main() {
  int m,n,i=1,a;
  cin>>n>>m;
  while(i<=m){
  cin>>a;
    
   n-=a; 
  i++;
  }
  
  if(n>=0)
  cout<<n<<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>

using namespace std;

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

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

#include <iostream>
using namespace std;
int main (){

int n,x,a;
long long sum=0;
cin>>x>>n;
for(int i=1;i<=n;i++){
    cin>>a;
  sum+=a;}
  if(sum<=x)
    cout<<x-sum;
  else
    cout<<"-1";}


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

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

signed main(){
 int N,M;
 cin>>N>>M;
 vector<int> A(M);
 rep(i,M)cin>>A[i];
 int Asum=0;
 rep(i,M)Asum+=A[i];
 if(N-Asum>=0)cout<<N-Asum<<endl;
 else cout<<-1<<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++

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<long>a(n);
  for(int i=0; i<n; i++)cin >> a[i];
  cout << max(-1, n-accumulate(a.begin(), a.end(), 0L)) << 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 int)'
   12 |   cout << max(-1, n-accumulate(a.begin(), a.end(), 0L)) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/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 int')
   12 |   cout << max(-1, n-accumulate(a.begin(), a.end(), 0L)) << 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,
                 from a.cc:4:
/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-accumulate(a.begin(), a.end(), 0L)) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: Java

import java.util.Scanner;
public class Dreamoon{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int num = input.nextInt();
		int n  = input.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		}
		System.out.println(num - sum);
		
	}
}

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

#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;

ull n, m, a[10005], s = 0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m;
    for (ll i = 1; i <= m; i++)
    {
        cin >> a[i];
        s += a[i];
    }
    if (s > a[i]) cout << -1;
    else cout << a[i] - s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: 'll' was not declared in this scope; did you mean 'ull'?
   14 |     for (ll i = 1; i <= m; i++)
      |          ^~
      |          ull
a.cc:14:20: error: 'i' was not declared in this scope
   14 |     for (ll i = 1; i <= m; i++)
      |                    ^
a.cc:19:15: error: 'i' was not declared in this scope
   19 |     if (s > a[i]) cout << -1;
      |               ^
Language: C++

#include <bits/stdc++.h>
#define PI 3.14159265358979323846
using namespace std;
typedef long long ll;
typedef long double ld;
const double EPS = 1e-9;
const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
// int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; // 4 Direction
// int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Direction
// int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; // Knight Direction
// int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; // Hexagonal Direction
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
  int n,m;
	cin>>n>>m;
	vector<int> in;
	int input;
	int sum = 0;
	for(int i=0;i<m;i++){
		cin>>input;
		sum+=input;
	}
	if(n<sum)	cout<<"-1"<<endl;
	else	cout<<n-sum<<endl;

	return 0;

}
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
using namespace std;
typedef long long ll;
typedef long double ld;
const double EPS = 1e-9;
const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
// int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; // 4 Direction
// int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Direction
// int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; // Knight Direction
// int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; // Hexagonal Direction
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
  int n,m;
	cin>>n>>m;
	vector<int> in;
	int input;
	int sum = 0;
	for(int i=0;i<m;i++){
		cin>>input;
		sum+=input;
	}
	if(n<sum)	cout<<"-1"<<endl;
	else	cout<<n-sum<<endl;

	return 0;

}


Compiler output:
a.cc:36:14: error: redefinition of 'const double EPS'
   36 | const double EPS = 1e-9;
      |              ^~~
a.cc:6:14: note: 'const double EPS' previously defined here
    6 | const double EPS = 1e-9;
      |              ^~~
a.cc:37:11: error: redefinition of 'const int N'
   37 | const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
      |           ^
a.cc:7:11: note: 'const int N' previously defined here
    7 | const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
      |           ^
a.cc:37:22: error: redefinition of 'const int M'
   37 | const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
      |                      ^
a.cc:7:22: note: 'const int M' previously defined here
    7 | const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
      |                      ^
a.cc:37:33: error: redefinition of 'const int OO'
   37 | const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
      |                                 ^~
a.cc:7:33: note: 'const int OO' previously defined here
    7 | const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
      |                                 ^~
a.cc:42:5: error: redefinition of 'int main()'
   42 | int main(){
      |     ^~~~
a.cc:12:5: note: 'int main()' previously defined here
   12 | int main(){
      |     ^~~~
Language: C

N,M = (int(x) for x in input().split())
array = list(map(int, input().strip().split()))
if(N>=sum(array)):
    print(N-sum(array))
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:12: error: expected ')' before 'x'
    1 | N,M = (int(x) for x in input().split())
      |            ^
      |            )
main.c:1:14: error: expected ')' before 'for'
    1 | N,M = (int(x) for x in input().split())
      |       ~      ^~~~
      |              )
main.c:2:1: error: expected ',' or ';' before 'array'
    2 | array = list(map(int, input().strip().split()))
      | ^~~~~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: expected ';' before ')' token
    7 |   for (i = 0; i < M) {
      |                    ^
      |                    ;
a.cc:11:8: error: expected ';' before '}' token
   11 |     i++
      |        ^
      |        ;
   12 |   }
      |   ~
Language: C++

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

int main() {
  int n;
  int m;
  cin >>n;
  cin >>m;
  vector<int> a(m);
  for(int i=0;i<m;i++){
    cin >> a.at(i);
  }
  int ans = 0;
  for(int j=0;j<m;j++){
    ans +=a.at(i);
  }
  if(ans>=m){
    cout<<m-ans<<endl;
  }else{
    cout<<'-1'<<endl;
  }

}

Compiler output:
a.cc:20:11: warning: multi-character character constant [-Wmultichar]
   20 |     cout<<'-1'<<endl;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:15:16: error: 'i' was not declared in this scope
   15 |     ans +=a.at(i);
      |                ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0;
		ST = new StringTokenizer(BR.readLine());
		for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken());
		System.out.println((homeworkDays <= N) N - homeworkDays : -1);
	}
}


Compiler output:
Main.java:14: error: ')' or ',' expected
		System.out.println((homeworkDays <= N) N - homeworkDays : -1);
		                                      ^
Main.java:14: error: not a statement
		System.out.println((homeworkDays <= N) N - homeworkDays : -1);
		                                         ^
Main.java:14: error: ';' expected
		System.out.println((homeworkDays <= N) N - homeworkDays : -1);
		                                                       ^
3 errors
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: expected ';' before ')' token
    7 |   for (i = 0; i < M) {
      |                    ^
      |                    ;
a.cc:11:8: error: expected ';' before '}' token
   11 |     i++
      |        ^
      |        ;
   12 |   }
      |   ~
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 1e6 + 7;
const int Inf = 1 << 30;
const LL INF = 1LL << 60;
int n, m;
int a[maxx];

int main() {
	cin >> n >> m;
	LL sum = 0;
	for(int i = 1; i <= m; i++) {
		cin >> a[i];
		sum += (LL)a[i];
	}
	LL ans = max(0LL, (LL)n - sum);
	cout << ans << 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 <iostream>
using namespace std;
int main(void){
        int n,m,work=0;
    cin >> n>> m;
    for(int i=0;i<m; i++){
        int a;
        cin >> a;
        work+=a;
    }
    int ans = n-work;
    if(ans<0){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
    
}


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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n,r;
	cin>>n>>r;
	ll arr[r],sum=0;
	for(int i=0;i<r;i++){
		cin>>arr[i];
		sum += arr[i];
	}
	if(sum>n) cout<<"-1";
	else cout<<(n-sum);
	return 0;
}

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

#include <iostream>
using namespace std;
using ll = long long;
int main() {
    ll n, m;
    ll kadai[m];
    cin >> n >> m;
    ll prop = 0;
    for (ll i = 0; i < m; i++)
    {
        cin >> kadai[i];
        prop += kadai[i];
    }
    if(prop > n){
        cout << -1 << endl;
    }else{
        cout << n - prop << endl;
    }
}

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

#include<bits/stdc++.h>

using namespace std;

int main(void)
{
  int n,m;
  int inp;
  cin>>n>>m;

  for(int i=0;i<m;i++)
  {
    cin>>inp;
    n-=inp;
  }

  if(n>=0)
  {
    cout<<n<<endl;
  }
  else
  {
    cout<<-1<<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

#include <iostream>
using namespace std;
int main (){cin.tie(0);
cin.sync_with_stdio(0);

int n,x,a;
long long sum=0;
cin>>x>>n;
for(int i=1;i<=n;i++){
    cin>>a;
  sum+=a;}
  if(sum<=x)
    cout<<x-sum;
  else
    cout<<"-1";}


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

typedef long long ll;
ll n, m, a[100001];

void rf()
{
    ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);
    cin >> n >> m;
}

void xuli()
{
    ll t = 0;
    for (ll i = 1; i <= m; i++)
    {
        cin >> a[i]; t += a[i];
    }
    ll re = n - t;
    if (re < 0)
    {
        cout << "-1"; return;
    }
    cout << re;
}

int main()
{
    rf(); xuli();
}

Compiler output:
a.cc: In function 'void rf()':
a.cc:6:5: error: 'ios_base' has not been declared
    6 |     ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);
      |     ^~~~~~~~
a.cc:6:35: error: 'cin' was not declared in this scope
    6 |     ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);
      |                                   ^~~
a.cc:6:47: error: 'cout' was not declared in this scope
    6 |     ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);
      |                                               ^~~~
a.cc: In function 'void xuli()':
a.cc:15:9: error: 'cin' was not declared in this scope
   15 |         cin >> a[i]; t += a[i];
      |         ^~~
a.cc:20:9: error: 'cout' was not declared in this scope
   20 |         cout << "-1"; return;
      |         ^~~~
a.cc:22:5: error: 'cout' was not declared in this scope
   22 |     cout << re;
      |     ^~~~
Language: C

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

int main()
{
  int n, m;
  cin >> n >> m;
  int a[m];
  int total = 0;
  rep(i, m){
    cin >> a[i];
    total += a[i];
  }
  if(total > n) cout << -1 << endl;
  else cout << n - total << 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;
	for (int i=1; i<=m; i++) {
		int t;
		cin>>t;
		n-=t;
	}
	cout<<n;
	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>
using namespace std;
#define rep(i, N)  for (int (i) = 0; (i) < (N); (i)++)

int main(){

    int N, M;
    cin >> N >> M;
    int A_sum = 0;
    rep (i, M){
        int temp = 0;
        cin >> temp;
        A_sum += temp;
    }
    int ans = N-A_sum;
    if (0 <= ans) cout << ans << endl;
    else cout << -1 << 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()
{
  long int n, m;
  cin>>n>>m;
  long int arr[m];
  for(int i = 0; i < m; i++)
  {
    cin>>arr[i];
  	sum += arr[i];
  }
  if(sum <= n)
  {
    cout<<n-sum<<"\n";
  }
  else
  {
     cout<<"-1"<<"\n";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'sum' was not declared in this scope
   12 |         sum += arr[i];
      |         ^~~
a.cc:14:6: error: 'sum' was not declared in this scope
   14 |   if(sum <= n)
      |      ^~~
Language: C

#include <cstdio>
using namespace std;

int main(int argc, char** argv)
{
	int n, m;
	scanf("%d%d", &n, &m);
	for(int i=0; i<m; i++)
	{
		int x;
		scanf("%d", &x);
		if((n -= x) < 0)
		{
			puts("-1");
			return 0;
		}
	}
	printf("%d\n", n);
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    long long n ,m;
    cin >> n>>m;
    int s = 0;
    while(m--)
    {
        int a;
        cin >> a;
        s += a;

    }
    cout << n - s;
}

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;
  vector<int> homework(M);
  int kei=0;

  cin >> N;
  cin >> M;

  for(int i = 0;i < M;i++){
    cin >> homework.at(i);
    kei += homework.at(i);
  }
  if(N >= kei){
    cout << N-kei << endl;
  }else{
    cout << "-1" << endl;
  }
}


Compiler output:
a.cc: In function 'int Main()':
a.cc:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
   21 | }
      | ^
/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, sum = 0, a;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> a;
        sum += a;
    }
    printf("%d\n", (sum > n)? -1: n-sum);
}


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 = map(int, input().split())
A = list(map(int, input().split()))
AA = 0
for i in range(M):
    AA = AA+A[i]
if N-(AA) >= 0:
    print(N-AA)
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()))
      | ^
Language: C

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m;
    cin >> n >> m;
    vector<ll> v(m);
    ll sum = 0;
    for(int i = 0; i < m; i++){
        cin >> v[i];
        sum += v[i];
    }
   // cout << sum << endl;
    if(sum <= n){
        cout << n - sum << endl;
    }
    else{
        cout << "-1" << 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

//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N, M;
	cin >> N >> M;

	rep(i, M) {
		int a;
		cin >> a;
		N -= a;
	}

	if (N < 0) co(-1);
	else co(N);


	Would you please return 0;
}

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

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

int main() {

  int N , M ,tot;
  cin >> N;
  cin >> M;
  vector<int> vec(N);

  
  for(int i=0; i<M; i++){
    cin >> vec.at(i);
    tot+=vec.at(i);
  }

  if(N-tot>0){
    cout << N-tot << endl;
  }

  
  if(N-tot<=0){
    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

N, M = map(int, input().split())
A = list(map(int, input().split()))

A_sum = sum(A)
if A_sum > N:
    print(-1)
else:
    print(N - A_sum)



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:4: error: type defaults to 'int' in declaration of 'M' [-Wimplicit-int]
    1 | N, M = map(int, input().split())
      |    ^
main.c:1:8: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | N, M = map(int, input().split())
      |        ^~~
main.c:1:12: 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()))
      | ^
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);
    N -= A.at(i);
  }
  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 <stdio.h>

int main(void)
{
  int n, m; // nは夏休みの日数、mは宿題の個数
  int a[]; // 宿題の所要時間
  int total; // 合計時間
  
  scanf("%d %d\n", &n, &m);
  for(int i = 0; i < m; i++) {
    scanf("%d ", a[i]);
    total += a[i];
  }
  printf("\n");
  
  if(total > n) {
    printf("-1\n");
    
    return -1;
  }
  
  printf("%d", n - total);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:7: error: array size missing in 'a'
    6 |   int a[]; // 宿題の所要時間
      |       ^
Language: C++

#include <iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'x' was not declared in this scope
   17 |         cout << x << endl;
      |                 ^
Language: C

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cmath>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main(){
  int N,M;
  vector<int> homework(M);
  int kei=0;

  cin >> N;
  cin >> M;

  for(int i = 0;i < M;i++){
    cin >> homework.at(i);
    kei += homework.at(i);
  }
  if(N >= kei){
    cout << N-kei << endl;
  }else{
    cout << "-1" << endl;
  }
}


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

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

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

  if(N<0)cout<<-1<<endl;
  else cout<<N-S<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: 'S' was not declared in this scope
   14 |   else cout<<N-S<<endl;
      |                ^
Language: C

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

int main(void)
{
    ll n,m;
    cin >> n >> m;

    vector<int> a(m);

    rep(i,m){
        cin >> a.at(i);
        n -= a.at(i);
    }

    if(n<0)n=-1;

    cout << n << endl;

    return 0;
}


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

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

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> vec(M);
  for (int i = 0; i < M; i++) {
    cin >> vec.at(i);
  }
  int S = accumulate(vec.begin(), vec.end(), 0);
  if(N - S >= 0){
    cout << N - S << 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 <bits/stdc++.h>
using namespace std;
int main(){
    int N, M, sum = 0;
    vector<int> A;
    
  cin >> N >> M;
    rep(i, M){
        A.push_back(0);
        cin >> A[i];
        sum += A[i];
    }
    
    if(N-sum >= 0){
    cout << N - sum;
    }else{
        cout << -1;
    }
   }

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     rep(i, M){
      |         ^
a.cc:8:5: error: 'rep' was not declared in this scope
    8 |     rep(i, M){
      |     ^~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: invalid types 'int[int]' for array subscript
    8 |     cin>>A[i];
      |           ^
a.cc:10:11: error: invalid types 'int[int]' for array subscript
   10 |     ans+=A[i];
      |           ^
a.cc:12:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |   if(ans<=N){
      |      ^~~
      |      abs
Language: C

#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    long long n ,m;
    cin >> n>>m;
    int s = 0;
    while(m--)
    {
        int a;
        cin >> a;
        s += a;

    }
    cout << n - s;
}

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

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


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

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


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

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  int i,N,M,sum,all;
  long ans;
  bool can;
  int A[100];
  can=false;
  //  string S,A;
  
  cin>>N>>M;
  for(i=0;i<M;i++){
    cin>>A[i];
  }

  ans=0;
  sum=N;
  
  for(i=0;i<M;i++){
    sum-=A[i];
    if(sum<0){
      cout<<"-1"<<endl;
      return 0;
    }

  }
  cout<<sum<<endl;
  
  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
int n,m,a[12345],b;
int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a[i];
        b+=a[i];
    }
    b=n-b;
    if(b<0)cout<<-1<<endl;
    else cout<<b<<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>
#include <stdlib.h>
int main(void){
  int days;
  int num;
  int sum;
  int day;
  
  scanf("%d %d",&days,&num);
  sum = 0;
  for(int i = 0; i < num; i++){
    scanf("%d",&day);
    sum += day;
  if(days - sum > 0){
    printf("%d\n",(days - sum));
  }else{
    printf("-1");
  }
  return 0;
  }

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

#include <iostream>
using namespace std;

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

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

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

	if (n > c) {
		cout << n - c << endl;
	}
	else {
		cout << -1 << endl;
	}

	cin.get();
    cin.get();
    return 0;
}

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

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

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

}

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() {
 cin.tie(0);
 ios::sync_with_stdio(false);
 int n;
 int m;
 int work = 0;
 cin >> n >> m;
 vector<int> vec(m);
 for (int i = 0; i < m; ++i){
	 cin >> vec[i];
	 work += vec[i];
 }
 if (n < work){
	 cout << -1
 }
 else{
	 cout << n - work;
 }
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: expected ';' before '}' token
   17 |          cout << -1
      |                    ^
      |                    ;
   18 |  }
      |  ~
Language: C

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

int main() {
  int n, m;
  cin >> n >> m;
  int total = 0;
  for(int i = 0; i < m; i++) {
    int a;
    cin >> a;
    total = total + a;
  }
  cout << n - total << endl;
}


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

#include <algorithm>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  int m;
  cin >> m;

  vector<int> A(m);

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

  int sum = accumulate(A.begin(), A.end(), 0);
  
  cout << (n - sum) << endl;
  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
int main (){cin.tie(0);
cin.sync_with_stdio(0);

int n,x,a;
long long sum=0;
cin>>x>>n;
for(int i=1;i<=n;i++){
    cin>>a;
  sum+=a;}
  if(sum<=x)
    cout<<x-sum;
  else
    cout<<"-1";}


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<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

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


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

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

typedef long long ll;
typedef int i;
typedef string s;
typedef double d;

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (abs(a*b)/gcd(a,b))
#define sqr(a) (a*a)

#define tt int t; cin>>t; while(t--)
#define lo(i, a, b) for(int i=a; i<b; i++)
#define rlo(i, a) for(int i=a; i>0; i--)
#define be(a) a.begin(),a.end()
#define sz(x) x.size()
#define nl cout<<"\n";
#define sp cout<<" ";

#define op() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

int main()
{
    op();
    i n,m,a,sum=0;
    cin>>n>>m;
    while(m--)
    {
       cin>>a;
       sum+=a;
    }
    if(n>=sum)
        cout<<n-sum;
    else
        cout<<-1;
    nl;
    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.