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

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N, M, X, Y;
  X = 0;
  cin >> N >> M;
  vector<int> vec(M);
  for (i = 0; i < M; i++) {
    cin >> A.at(i);
  }
  for (i = 0; i < M; i++) {
    X += A.at(i);
  }
  Y = N - X;
  cout << Y << 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:10:12: error: 'A' was not declared in this scope
   10 |     cin >> A.at(i);
      |            ^
a.cc:12:8: error: 'i' was not declared in this scope
   12 |   for (i = 0; i < M; i++) {
      |        ^
a.cc:13:10: error: 'A' was not declared in this scope
   13 |     X += A.at(i);
      |          ^
Language: C++

#include <bits/stdc++,h>
using namespace std;
int main()
{
  int N, M, X, Y;
  X = 0;
  cin >> N >> M;
  vector<int> vec(M);
  for (i = 0; i < M; i++) {
    cin >> A.at(i);
  }
  for (i = 0; i < M; i++) {
    X += A.at(i);
  }
  Y = N - X;
  cout << Y << 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 <bits/stdc++.h>
using namespace std;
 
int main() {
  int d ,s , a ,c ;
  
  cin >> d , s, a, c ;
  
  int answer = d - a - c;
  if (answer <= 0){
    cout << -1  <<endl;
  }
  else{
   cout << answer << endl;
  }

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


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

int main (){
	
	int n, m, sum, x, a;
	sum =0;

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

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

#include <bits/stdc++.h>

int n, m, a;

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

    for (int i = 0 ; i < m; i++) {
        cin >> a;
        n -= a;
    }
    cout << ((n < 0) ? -1 : n) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |     cin >> n >> m;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 |     cout << ((n < 0) ? -1 : n) << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:12:35: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   12 |     cout << ((n < 0) ? -1 : n) << endl;
      |                                   ^~~~
      |                                   std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

int n, m, a;

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

    for (int i = 0 ; i < m; i++) {
        cin >> a;
        n -= a;
    }
    cout << (n < 0) ? -1 : n << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |     cin >> n >> m;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 |     cout << (n < 0) ? -1 : n << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:12:33: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   12 |     cout << (n < 0) ? -1 : n << endl;
      |                                 ^~~~
      |                                 std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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

    return 0;
}

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

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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}
const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;



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

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

	int sum=0;
	for(int i=0; i<m; i++){
		int tmp;cin>>tmp;
		sum +=tmp;
	}

	if(n >=m){
		writeln(n-sum);
	}else {
		writeln(-1);
	}
}




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<stdio.h>
int main()
{
    long int a,b;
    long int sum=0;
    long int i;
    scanf("%ld %ld",&a,&b);
    long int str[10005];
        scanf("%ld",&str[i]);
    for(i=0;i<b;i++)
    {

        sum+=str[i];


    }
    if(sum>b)
    {
        printf("-1");
    }
    else
    {


            printf("%ld",a-sum);



    }

    return 0;
}
#include<stdio.h>
int main()
{
    long int a,b;
    long int sum=0;
    long int i;
    scanf("%ld %ld",&a,&b);
    long int str[10005];
        scanf("%ld",&str[i]);
    for(i=0;i<b;i++)
    {

        sum+=str[i];


    }
    if(sum>b)
    {
        printf("-1");
    }
    else
    {


            printf("%ld",a-sum);



    }

    return 0;
}


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

#include<stdio.h>
int main()
{
    long long int a,b;
    long long int sum=0;
    scanf("%lld %lld",&a,&b);
    long long int str[10005];
        scanf("%lld",&str[i]);
    for(int i=0;i<b;i++)
    {
        
        sum+=str[i];


    }
    if(sum>b)
    {
        printf("-1");
    }
    else
    {


            printf("%lld",b-sum);



    }

    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:27: error: 'i' undeclared (first use in this function)
    8 |         scanf("%lld",&str[i]);
      |                           ^
main.c:8:27: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
 
using namespace std;
 
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-12;
const double PI = acos(-1.0);

int main() {
    int n,m;
    cin >> n >> m;
    ll sum = 0;
    for(int i = 0; i < m; i++){
        int a;
        cin >> a;
        sum += a;
    }
    cout << max(-1ll,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;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
long long int big[60][2] = {};

int main() {
	long long int n, m;
	cin >> n >> m;
	long long int sum = 0;
	for (int i = 0; i < m; i++) {
		long long int a;
		cin >> a;
		sum = sum + a;
	}
	cout << max(long long int (-1), n - sum);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:106:21: error: expected primary-expression before 'long'
  106 |         cout << max(long long int (-1), n - sum);
      |                     ^~~~
Language: C

#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> arr(m, 0);
    for(auto& val: arr)
        cin >> val;
    int acc = accumulate(arr.begin(), arr.end(), 0);
    if (acc > n)
        cout << -1 << endl;
    else
        cout << n - acc << 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<stdio.h>
int main(void)
{
  int n,m,i,res;
  int sum = 0;
   
  scanf("%d %d",&n,&m);
  
  if(i=0;i<m;i++){
    scanf("%d",&a);
    sum+=a;
  }
  
  res=n-sum;
  
  if(res>0)
  printf("%d",res);
  
  else
    printf("%d",-1);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:9: error: expected ')' before ';' token
    9 |   if(i=0;i<m;i++){
      |     ~   ^
      |         )
main.c:10:17: error: 'a' undeclared (first use in this function)
   10 |     scanf("%d",&a);
      |                 ^
main.c:10:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
#define pi 3.1415926
int main(void)
{
    int n, m,sum=0;
    cin >> n >> m;
    while(m--){
        int q;
        cin >> q;
        sum += q;
    }
    if(q>n)
        cout << -1 << endl;
    else
        cout << n - q << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: 'q' was not declared in this scope
   15 |     if(q>n)
      |        ^
Language: C++

//Lannisters Don't Act Like Fools

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

using namespace std;

int main() {
	// your code goes here
	int n,m;
  scanf("%d%d,&n,&m);
        int a[m],i,sum=0;
        for(i=0;i<m;i++)
        {
          scanf("%d",&a[i]);
          sum+=a[i];
        }
        if(sum>n)
        printf("-1\n");
        else
        {
          printf("%d\n",n-sum);
        }
        
	return 0;
}


Compiler output:
a.cc:13:9: warning: missing terminating " character
   13 |   scanf("%d%d,&n,&m);
      |         ^
a.cc:13:9: error: missing terminating " character
   13 |   scanf("%d%d,&n,&m);
      |         ^~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:14:9: error: expected primary-expression before 'int'
   14 |         int a[m],i,sum=0;
      |         ^~~
a.cc:14:18: error: 'i' was not declared in this scope
   14 |         int a[m],i,sum=0;
      |                  ^
a.cc:14:20: error: 'sum' was not declared in this scope
   14 |         int a[m],i,sum=0;
      |                    ^~~
a.cc:17:23: error: 'a' was not declared in this scope
   17 |           scanf("%d",&a[i]);
      |                       ^
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int day;
    int N = s.nextInt();
    int M = s.nextInt();
    int[] A = new int[M];
    for(int i = 0; i < M; i++) {
      A[i] = s.nextInt();
      day = M - A[i];
    }

    if(day >= 0){
      System.out.println(day);
    }else {
      System.out.println(-1);
    }

    
  }
}

Compiler output:
Main.java:14: error: variable day might not have been initialized
    if(day >= 0){
       ^
1 error
Language: C

#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(int argc, const char *argv[]) {
  int N, M;
  long res;
  cin >> N >> M;
  vector<int> A(M);

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

  res = N - accumulate(A.begin(), A.end(), 0);
  if(N < 0){
    cout << "-1" << endl;
  }else{
    cout << res << 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>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int N, M;
  cin >> N >> M;
  long sum = 0;
  rep(i, M)
  {
    int a;
    cin >> a;
    sum += a;
  }
  if(sum > N){
    cout << -1 << endl;
    return 0;
  }
  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



def solve():
    N, M = map(int, input().split())
    A = [int(i) for i in input().split()]
    print(max(N - sum(A), -1))


if __name__ == '__main__':
    solve()


Compiler output:
main.c:3:1: error: unknown type name 'def'
    3 | def solve():
      | ^~~
main.c: In function 'solve':
main.c:3:12: error: expected declaration specifiers before ':' token
    3 | def solve():
      |            ^
main.c:9:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
    9 | if __name__ == '__main__':
      |                ^~~~~~~~~~
Language: C

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

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

    vector<int> v;

    for(int i=0; i<m; i++){
        int input;
        cin>>input;
        v.push_back(input);
    }

    int result = n-accumulate(v.begin(), v.end(), 0);

    if(result>0)
        cout<<result;
    else
        cout<<"-1";
}


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 main() {
      		unsigned long long N;
      int M;
      cin >> N >> M;
      long long A;
      unsigned long long sum = 0;
      for (int i= 0;i<M;++i){
        cin >> A;
        sum += A;
      }
      if(N - sum => 0){
        cout << N - sum;
      }else{ 
        cout << "-1";
       }
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: expected primary-expression before '>' token
   14 |       if(N - sum => 0){
      |                   ^
Language: C

//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n, m;
vector<ll> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>m;
    ll sum=0;
    for (int i = 0; i < m; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
        sum+=temp;
    }
    if(n-sum>=0)
    cout << n-sum<< "\n";
    else
    cout<<-1<<"\n";
}


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

#include<stdio.h>
#define MAX 1000000
int main(){
  float  N,M,A[i];
  scanf("%f\n",&N);
  scanf("%f\n",&M);
  for(i=1,i<M+1,i++);{
    scanf("%f\n",&A[i]);
  }
  for(i=1,i<M+1,i++);{
    homeworktime=A[i]+;
  }
  answer=N-homeworktime;
  printf("/d\n",answer);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:16: error: 'i' undeclared (first use in this function)
    4 |   float  N,M,A[i];
      |                ^
main.c:4:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:20: error: expected ';' before ')' token
    7 |   for(i=1,i<M+1,i++);{
      |                    ^
      |                    ;
main.c:7:20: error: expected expression before ')' token
main.c:10:20: error: expected ';' before ')' token
   10 |   for(i=1,i<M+1,i++);{
      |                    ^
      |                    ;
main.c:10:20: error: expected expression before ')' token
main.c:11:5: error: 'homeworktime' undeclared (first use in this function)
   11 |     homeworktime=A[i]+;
      |     ^~~~~~~~~~~~
main.c:11:23: error: expected expression before ';' token
   11 |     homeworktime=A[i]+;
      |                       ^
main.c:13:3: error: 'answer' undeclared (first use in this function)
   13 |   answer=N-homeworktime;
      |   ^~~~~~
Language: C

#include<stdio.h>
#define MAX 1000000
int main(){
  float  N,M,A[i];
  scanf("%f\n",&N);
  scanf("%f\n",&M);
  for(i=1,i<M+1,i++){
    scanf("%f\n",&A[i]);
  }
  for(i=1,i<M+1,i++){
    homeworktime=A[i]+;
  }
  answer=N-homeworktime;
  printf("/d\n",answer);
  
  return 0
}
  

Compiler output:
main.c: In function 'main':
main.c:4:16: error: 'i' undeclared (first use in this function)
    4 |   float  N,M,A[i];
      |                ^
main.c:4:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:20: error: expected ';' before ')' token
    7 |   for(i=1,i<M+1,i++){
      |                    ^
      |                    ;
main.c:7:20: error: expected expression before ')' token
main.c:10:20: error: expected ';' before ')' token
   10 |   for(i=1,i<M+1,i++){
      |                    ^
      |                    ;
main.c:10:20: error: expected expression before ')' token
main.c:11:5: error: 'homeworktime' undeclared (first use in this function)
   11 |     homeworktime=A[i]+;
      |     ^~~~~~~~~~~~
main.c:11:23: error: expected expression before ';' token
   11 |     homeworktime=A[i]+;
      |                       ^
main.c:13:3: error: 'answer' undeclared (first use in this function)
   13 |   answer=N-homeworktime;
      |   ^~~~~~
main.c:16:11: error: expected ';' before '}' token
   16 |   return 0
      |           ^
      |           ;
   17 | }
      | ~
Language: C

#include<stdio.h>
#define HOMEWORK[1000000]
int main(){
  int N,M,A[i];
  scanf("%d\n",&N);
  scanf("%d\n",&M);
  for(i=1,i<M+1,i++){
    homeworktime=A[i];
  }
  answer=N-homeworktime;
  printf("/d\n",answer);
  
  return 0
}
  
  

Compiler output:
main.c:2:9: warning: ISO C99 requires whitespace after the macro name
    2 | #define HOMEWORK[1000000]
      |         ^~~~~~~~
main.c: In function 'main':
main.c:4:13: error: 'i' undeclared (first use in this function)
    4 |   int N,M,A[i];
      |             ^
main.c:4:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:20: error: expected ';' before ')' token
    7 |   for(i=1,i<M+1,i++){
      |                    ^
      |                    ;
main.c:7:20: error: expected expression before ')' token
main.c:8:5: error: 'homeworktime' undeclared (first use in this function)
    8 |     homeworktime=A[i];
      |     ^~~~~~~~~~~~
main.c:10:3: error: 'answer' undeclared (first use in this function)
   10 |   answer=N-homeworktime;
      |   ^~~~~~
main.c:13:11: error: expected ';' before '}' token
   13 |   return 0
      |           ^
      |           ;
   14 | }
      | ~
Language: C++

#include <iostream>
 
using namespace std;
 
int main()
{
  int N;
  int M;
  int A;
  int b;
  cin >> N >> M;
  while(M>0)
  {
    cin >> A;
    b=b+A;
  }
  if(N-B >= 0)
  cout <<N-B;
 else 
   cout <<"-1";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:8: error: 'B' was not declared in this scope
   17 |   if(N-B >= 0)
      |        ^
Language: C

#include <iostream>
 
using namespace std;
 
int main()
{
  int N;
  int M;
  int A;
  int b;
  cin >> N >> M;
  while(M>0)
  {
    cin >> A;
    b=b+A;
  }
  if(N-B >= 0)
  cout <<N-B;
 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 <stdio.h>
 
int main(){
  int days, num;
  //scanf("%d %d ", &days, &num);
  int left = days;
  int memo;
  for(int i=0; i<num; i++){
    //scanf("%d ", &memo);
    left -= memo;
    
  }
  if(left < 0){
    printf("-1\n");
  }else{
    printf("%d\n", left);
  
  return 0;
}

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

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define ALLG(v) v.begin(), v.end() ,greater<int>()
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll GCD(ll x, ll y) { return y ? GCD(y, x % y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }
ll GetDigit(ll num) {
	ll digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}

using namespace std;
int main() {
	ll n,m;
	cin >> n >> m;

	ll total = 0;
	for (int i = 0; i < m; i++)
	{
		ll temp = 0;
		cin >> temp;
		total += temp;
	}

	ll ans =  n - total;

	if (ans < 0) {
		ans = -1;
	}
	


	

	cout <<  ans << 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 days, num;
  scanf("%d %d ", &days, &num);
  int left = days;
  int memo;
  for(int i=0; i<num; i++){
    scanf("%d ", &memo);
    left -= memo;
    
  }
  if(left < 0){
    printf("-1\n");
  }else{
    printf("%d\n", left);
  
  return 0;
}

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

#include <stdio.h>

int main(){
  int days, num;
  scanf("%d%d", &days, &num);
  int left = days;
  int memo;
  for(int i=0; i<num; i++){
    scanf("%d ", &memo);
    left -= memo;
    
  }
  if(left < 0){
    printf("-1\n");
  }else{
    printf("%d\n", left);
  
  return 0;
}

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

#include <iostream>

using namespace std;

int main()
{
  int N;
  int M;
  int A;
  int b;
  cin >> N >> M;
  while(M>0)
  {
    cin >> A;
    b=b+A;
  }
  if(N-B >= 0)
  cout <<N-B;
 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
using namespace std;

int main()
{
  int N;
  int M;
  int A;
  int b;
  cin >> N >> M;
  while(M>0)
  {
    cin >> A;
    b=b+A;
  }
  if(N-B >= 0)
  cout <<N-B;
 else 
   cout <<"-1";
}

Compiler output:
main.c:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include
      |         ^
main.c:2:1: error: unknown type name 'using'
    2 | using namespace std;
      | ^~~~~
main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    2 | using namespace std;
      |                 ^~~
main.c: In function 'main':
main.c:10:3: error: 'cin' undeclared (first use in this function)
   10 |   cin >> N >> M;
      |   ^~~
main.c:10:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:8: error: 'B' undeclared (first use in this function)
   16 |   if(N-B >= 0)
      |        ^
main.c:17:3: error: 'cout' undeclared (first use in this function)
   17 |   cout <<N-B;
      |   ^~~~
Language: C

#include <iostream>
using namespace std;

int main()
{
  int N;
  int M;
  int A;
  int b;
  cin >> N >> M;
  while(M>0)
  {
    cin >> A;
    b=b+A;
  }
  if(N-B >= 0)
  cout <<N-B;
 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<stdio.h>
#include<stdlib.h>
int main(void){
  int N,M;
  int p;
  scanf("%d %d",&N,&M);
  p=calloc(M,sizeof(int));
  int i;
  for(i=1; i<=N; i++){
   	scanf("%d",&p[i]);
    N-=p[i];
  }
  if(N<0)
    printf("-1");
  else
    printf("%d",N);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:4: error: assignment to 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
    7 |   p=calloc(M,sizeof(int));
      |    ^
main.c:10:22: error: subscripted value is neither array nor pointer nor vector
   10 |         scanf("%d",&p[i]);
      |                      ^
main.c:11:9: error: subscripted value is neither array nor pointer nor vector
   11 |     N-=p[i];
      |         ^
Language: C

#include<stdio.h>

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

Compiler output:
main.c: In function 'main':
main.c:7:5: error: implicit declaration of function 'calloc' [-Wimplicit-function-declaration]
    7 |   p=calloc(M,sizeof(int));
      |     ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'calloc'
    1 | #include<stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:7:5: warning: incompatible implicit declaration of built-in function 'calloc' [-Wbuiltin-declaration-mismatch]
    7 |   p=calloc(M,sizeof(int));
      |     ^~~~~~
main.c:7:5: note: include '<stdlib.h>' or provide a declaration of 'calloc'
main.c:7:4: error: assignment to 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
    7 |   p=calloc(M,sizeof(int));
      |    ^
main.c:9:21: error: expected ';' before ')' token
    9 |   for(i=1; i<=N, i++){
      |                     ^
      |                     ;
main.c:10:22: error: subscripted value is neither array nor pointer nor vector
   10 |         scanf("%d",&p[i]);
      |                      ^
main.c:11:9: error: subscripted value is neither array nor pointer nor vector
   11 |     N-=p[i];
      |         ^
Language: C++

#include <iostream>

using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:9:25: error: expected ';' before ')' token
    9 |     for(int i=1;i<=m,i++){
      |                         ^
      |                         ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	long t,n;
  	cin >> t >> n;
  	vector<long> v(n);
  	while(n--){cin >> v[i];}
  	long sum = accumulate(v.begin(),v.end(),0);
  	if(sum>=t) cout<<sum-t;
  else cout<<-1;
 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:29: error: 'i' was not declared in this scope
    7 |         while(n--){cin >> v[i];}
      |                             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	ll t,n;
  	cin >> t >> n;
  	vector<ll> v(n);
  	while(n--){cin >> v[i];}
  	long sum = accumulate(v.begin(),v.end(),0);
  	if(sum>=t) cout<<sum-t;
  else cout<<-1;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'll' was not declared in this scope
    4 |         ll t,n;
      |         ^~
a.cc:5:16: error: 't' was not declared in this scope; did you mean 'tm'?
    5 |         cin >> t >> n;
      |                ^
      |                tm
a.cc:5:21: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |         cin >> t >> n;
      |                     ^
      |                     yn
a.cc:6:18: error: template argument 2 is invalid
    6 |         vector<ll> v(n);
      |                  ^
a.cc:7:29: error: 'i' was not declared in this scope
    7 |         while(n--){cin >> v[i];}
      |                             ^
a.cc:8:33: error: request for member 'begin' in 'v', which is of non-class type 'int'
    8 |         long sum = accumulate(v.begin(),v.end(),0);
      |                                 ^~~~~
a.cc:8:43: error: request for member 'end' in 'v', which is of non-class type 'int'
    8 |         long sum = accumulate(v.begin(),v.end(),0);
      |                                           ^~~
Language: Java

import java.util.Scanner;

public class  summerwork {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		
		for(int i = 1; i <= m; i++) {
			int am = scanner.nextInt();
			
			n -= scanner.nextInt();
		}
		
		if(n >= 0) {
		System.out.print(n);
		}
		else {
			System.out.print(-1);
		}
	}
}

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

import java.util.Scanner;

public class  summerwork {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = new java.util.Scanner(System.in).nextInt();
		int m = new java.util.Scanner(System.in).nextInt();
		//int a = 0; //= new java.util.Scanner(System.in).nextInt();
		
		for(int i = 0; i <= m; i ++) {
			int a = new java.util.Scanner(System.in).nextInt();
			
			int sum = n - a;
		
			if(n > 0) {
			System.out.println(sum);
			}
			else if(n < 0) {
				System.out.println(-1);
			}
		}
	}
}

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

#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;++i)
#define END(x) (*(x.end()-1))

using namespace std;
typedef long long ll;
typedef vector<vector<int>> Graph;

template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a*b/gcd(a,b);
}


template<typename T>
bool same(T x_b,T x_e,T y_b,T y_e){
    for(auto i = x_b, j = y_b; i != x_e && j != y_e;++i,++j){
        if(*i!=*j){
            return false;
        }
    }
    return true;
}

using Graph=vector<vector<int>>;//グラフ型
void dfs(const Graph &G,int v/*根*/,vector<bool> &seen){
    seen[v]=true;  //vを訪問済にする
    for(auto next_v:G[v]){ //訪問済にしたvとつながっている場所を順番に探す
        if(seen[next_v]) continue; //もし探索済みならスルー
        dfs(G,next_v,seen); //再帰的に探索
    }
}
 
void bfs(const Graph &G,queue<int> &que/*発見したが訪問はしていない*/,vector<int> &dist/*開始地点からの距離*/){
    while(!que.empty()){
        int v=que.front();//queのうち先頭のものからスタート
        que.pop();//先頭を削除
 
        for(int nv :G[v]){//vとつながっている点を列挙
            if(dist[nv]!=-1) continue;//発見済(=距離が格納されている)であればスルー
            dist[nv]=dist[v]+1;//vとつながっている点に距離の情報を追加
            que.push(nv);//vとつながっている点を発見済にする
        }
    }
}


int main(void){
    int n,m;
    ll a,ans=0;
    cin>>n>>m;
    rep(i,m){
        cin>>a;
        ans+=a;
    }
    if(ans>n)cout<<-1;
    else cout<<n-ans;
}
/*

*/


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 = list(map(int,input().split()))
l = list(map(int,input().split()))
ans = n - sum(l)
if ans < -1:
    print(-1)
else:
    print(ans)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n,m = list(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 = list(map(int,input().split()))
      |   ^
main.c:1:7: error: implicit declaration of function 'list' [-Wimplicit-function-declaration]
    1 | n,m = list(map(int,input().split()))
      |       ^~~~
main.c:1:12: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | n,m = list(map(int,input().split()))
      |            ^~~
main.c:1:16: error: expected expression before 'int'
    1 | n,m = list(map(int,input().split()))
      |                ^~~
main.c:2:1: error: expected ',' or ';' before 'l'
    2 | l = list(map(int,input().split()))
      | ^
Language: Java

import java.lang.Math;
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner v = new Scanner(System.in);
    	int n = v.nextInt();
      	while(n<1 || n > Math.pow(10,6)){
        	n = v.nextInt();
        }
      	int m = v.nextInt();
      	while(m<1 || m > Math.pow(10,4)){
        	m = v.nextInt();
        }
      	int a;
      	for(int i = 0;i<m;i++){
          while (a < 1 || a > Math.pow(10,4)){
      		a = v.nextInt();
          }
          	n -= a;
      	}
      	if(n >= 0){
        	System.out.println(n);
        }else{
        	System.out.println(-1);
        }
      	
    }
}

Compiler output:
Main.java:16: error: variable a might not have been initialized
          while (a < 1 || a > Math.pow(10,4)){
                 ^
1 error
Language: Java

import java.util.*;

 // Compiler version JDK 11.0.2

 public static class Dcoder
 {
   public static void main(String args[])
   { 
    Scanner sc= new Scanner(System.in);
    long n = sc.nextLong();
    int m = sc.nextInt();
    int a[]= new int[m];
    long sum =0;
    for(int i =0;i<m;i ++)
    {
      a[i]= sc.nextInt();
      sum= sum + a[i];
      
    }
    if(n>sum)
    System.out.println(n-sum);
    else
    System.out.println("-1");
    
   }
 }

Compiler output:
Main.java:5: error: class Dcoder is public, should be declared in a file named Dcoder.java
 public static class Dcoder
               ^
1 error
Language: Java

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

Compiler output:
Main.java:13: error: not a statement
        System.out.println "-1";
                  ^
Main.java:13: error: ';' expected
        System.out.println "-1";
                          ^
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define dl double long
const int INF=0x3fffffff;
const ll MOD=1000000007;
const ll MODD=998244353;
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }

int main()
{
  ll N, M;
  cin >> N >> M;
  rep(i, 0) {ll hw; cin >> hw; N -= hw;}
  cout << max(-1, N) << "\n";
}


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

#include<bits/stdc++.h>
#define ll long long
const int N=1000005;
using namespace std;
int n,m,a[N],ans;
int main(){
	cin>>m>>n;
	for(int i=1;i<=n;i++)
	    cin>>a[i],ans+=a[i];
	if(ans<=m) cout<<m-ans;
	else cout<<-1;
    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<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;


int n,m,a;
int main()
{
    cin>>n>>m;
    for (int i=1; i<=m; ++i)
    {
        cin>>a;
        n-=a;
    }
    if (n>=0) cout<<n<<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>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define rof(i,a,b) for(int (i)=(a);(i) > (b); --(i))
#define pb push_back
#define pr pair<int,int>
#define mp make_pair
#define ll long long int
const int mod=1e9+7;
int main(){
  int n,m;
  cin>>n>>m;
  int a[m];
  int sum=0;
  for(int i=0;i<m;i++){cin>>a[i];sum+=a[i];}
  if(sum<=n)cout<<n-sum<<endl;
  else cout<<"-1"<<endl
}

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

#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N;
	int M;
	cin >> N >> M;
	vector<int> A(N);
	int day = 0;
	int ans = 0;
	for(int i = 0;i<M;i++){
		std::cin >> A[i];
		day += A[i];
	}
	
	int N_day = 0;
	
	if(N-day>=0){
		N_day = N;
		ans = N_day - day;
	    std::cout << ans <<  std::endl;
	}else{
		std::cout << "-1" <<  std::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>
#include <string>
#include <numeric>
#include <vector>
#include <cmath>
#include <map>
#include <ctype.h>
using namespace std;

int main() {
    int n, m; cin >> n >> m;
    int arr[n];
    int sum = 0;
    for(int x=0; x<m; x++) {
        int num; cin >> num;
        arr[x] = num;
    }

    for(int x=0; x<m; x++){
        sum+=arr[x];
    }

    if(sum > n){
        cout << -1 << endl;

    }else{
        cout << n-sum << 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 <iostream>
#include <bits/stdc++.h>
#include <string>
#include <numeric>
#include <vector>
#include <cmath>
#include <map>
#include <ctype.h>
using namespace std;

int main() {
    int n, m; cin >> n >> m;
    int arr[n];
    int sum = 0;
    for(int x=0; x<m; x++) {
        int num; cin >> num;
        arr[x] = num;
    }

    for(int x=0; x<m; x++){
        sum+=arr[x];
    }



    if(sum > n){
        cout << -1 << endl;

    }else{
        cout << n-sum << endl;
    }



}



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

#include <iostream>
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <numeric>
#include <vector>
#include <cmath>
#include <map>
#include <ctype.h>
using namespace std;

int main() {
    int n, m; cin >> n >> m;
    int arr[n];
    int sum = 0;
    for(int x=0; x<m; x++) {
        int num; cin >> num;
        arr[x] = num;
    }

    for(int x=0; x<m; x++){
        sum+=arr[x];
    }



    if(sum > n){
        cout << -1 << endl;

    }else{
        cout << n-sum << 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() {
  int N, M,A;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> A;
    if(N - A < 0){
      cout << -1 << endl;
      break;
    }
    N -= A;
  }
  if(N >= 0){
    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() {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> A;
    if(N - A < 0){
      cout << -1 << endl;
      break;
    }
    N -= A;
  }
  if(N >= 0){
    cout << N << endl;
  }

}


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

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

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	int n, m, _s = 0;
	cin >> n >> m;
	int e;
	while (cin >> e) _s += e;
	cout << max(-1, n-_s) << ende;
  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;

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	ll n, m, _s = 0;
	cin >> n >> m;
	ll e;
	while (cin >> e) _s += e;
	cout << max((ll)(-1), n-_s) << ende;
  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.