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

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
      	int M = sc.nextInt();
      	int[] A=new int[M];
        int sum=0;
      	for(i=0;i<M;i++){
        	A[i]=sc.nextInt();
        }
        for(i=0;i<M;i++){
        	sum=sum+A[i];
        }
      if(sum>N){
      	System.out.println(-1);
      }
      else{
        System.out.println(N-sum);
      }
		
		
	}
}

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


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
      	int M = sc.nextInt();
      	int[] A=new int[M]
        int sum=0;
      	for(i=0;i<M;i++){
        	A[i]=sc.nextInt();
        }
        for(i=0;i<M;i++){
        	sum=sum+A[i];
        }
      if(sum>N){
      	System.out.println(-1);
      }
      else{
        System.out.println(N-sum);
      }
		
		
	}
}


Compiler output:
Main.java:9: error: ';' expected
      	int[] A=new int[M]
      	                  ^
1 error
Language: C++

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

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

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

k,n = map(int,input().split())
A = list(map(int,input().split()))


max_d = 0
max_index = 0
for i in range(n-1):
    if A[i+1] - A[i] > max_d:
        max_d = A[i+1]-A[i]
        max_index = i

if k-A[n-1]+A[0] > max_d:
    max_d = k-A[n-1]+A[0]
    max_index = n-1

min_distance = 0

if(max_index != n-1):
    min_distance = A[max_index]+k-A[max_index+1]
else:
    min_distance = A[n-1]-A[0]

print(min_distance)


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

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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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


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

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

Compiler output:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

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

  
}

Compiler output:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

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


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

#include<iostream>
using namespace std;


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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: expected primary-expression before '>' token
   12 |         if (a => n)puts("-1");
      |                ^
Language: C++

#include<iostream>
using namespace std;


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


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'a' was not declared in this scope
   12 |         if (a > n)puts("-1");
      |             ^
Language: C++

#include<iostream>
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |         if (ans > n)puts("-1");
      |             ^~~
      |             abs
Language: C++

#include<iostream>
#define PI 3.1415
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: 'i' was not declared in this scope
    7 |         for (i = 0;i < m;i++) {
      |              ^
a.cc:12:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |         if (ans > n)puts("-1");
      |             ^~~
      |             abs
Language: C++

#include<iostream>
#define PI 3.1415
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: 'i' was not declared in this scope
    7 |         for (i = 0;i < m;i++) {
      |              ^
a.cc:8:29: error: expected ';' before 'cin'
    8 |                 int r, ans;r
      |                             ^
      |                             ;
    9 |                         cin >> r;
      |                         ~~~  
a.cc:12:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |         if (ans > n)puts("-1");
      |             ^~~
      |             abs
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:5:10: error: 'hw' was not declared in this scope
    5 |   vector<hw> vec(M);
      |          ^~
a.cc:5:12: error: template argument 1 is invalid
    5 |   vector<hw> vec(M);
      |            ^
a.cc:5:12: error: template argument 2 is invalid
a.cc:8:16: error: request for member 'at' in 'vec', which is of non-class type 'int'
    8 |     cin >> vec.at(i);
      |                ^~
a.cc:9:16: error: request for member 'at' in 'vec', which is of non-class type 'int'
    9 |     sum += vec.at(i);
      |                ^~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:5:10: error: 'hw' was not declared in this scope
    5 |   vector<hw> vec(M);
      |          ^~
a.cc:5:12: error: template argument 1 is invalid
    5 |   vector<hw> vec(M);
      |            ^
a.cc:5:12: error: template argument 2 is invalid
Language: C++

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

// (補助関数)
// dataのi番目以降の要素の総和を計算する
int array_sum_from_i(vector<int> &data, int i) {
  // ベースケース
  if (i == data.size()) {
    return 0;  // 対象の要素がないので総和は0
  }
  // 再帰ステップ
  int s = array_sum_from_i(data, i + 1);  // i+1番目以降の要素の総和
  return data.at(i) + s;  // 「i番目以降の要素の総和」=「i番目の要素」+ s
}

// dataの全ての要素の総和を計算する
int array_sum(vector<int> &data) {
  return array_sum_from_i(data, 0);
}

int main() {
  int n,m; cin>> n>> m;
  vector<int>a(m)
    for(int c:a)cin >> a[c];
  if(array_sum(a)<=n)cout << n-array_sum(a) << endl;
  else cout << -1<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: expected ',' or ';' before 'for'
   24 |     for(int c:a)cin >> a[c];
      |     ^~~
Language: C

#include<stdio.h>
int Question163B(void) {
	int n, m, a[10001], num = 0;

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

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

#include<stdio.h>

int Question163B(void) {
	int insdate, inhome, inhdate[10001], num = 0;
	scanf("%d%d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) {
		scanf("%d", &inhdate[k]);
		num = num + inhdate[k];
	}
	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);
	return 0;
}

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

#include <stdio.h>
#include <stdlib.h>
#define _CRT_SECURE_NO_WARNINGS
#define __wur __attribute_warn_unused_default__
int Question163B(void) {
	int insdate = 0;
	int inhome = 0;
	int inhdate[10001];
	scanf("%d%d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) scanf("%d", &inhdate[k]);
	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];
	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);
	return 0;
}

Compiler output:
main.c:4:9: warning: "__wur" redefined
    4 | #define __wur __attribute_warn_unused_default__
      |         ^~~~~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:28,
                 from main.c:1:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:586:10: note: this is the location of the previous definition
  586 | # define __wur /* Ignore */
      |          ^~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#include <stdlib.h>
#define _CRT_SECURE_NO_WARNINGS
int Question163B(void) {
	int insdate = 0;
	int inhome = 0;
	int inhdate[10001];
	(void)scanf("%d%d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) (void)scanf("%d", &inhdate[k]);
	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];
	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);
	return 0;
}

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

#include <stdio.h>
#include <stdlib.h>
int Question163B(void) {
	int insdate = 0;
	int inhome = 0;
	int inhdate[10001];
	scanf("%d%d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) scanf("%d", &inhdate[k]);
	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];
	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);
	return 0;
}

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

#include<iostream>
using namespace std;
int main()
{
    long long n,m,sum=0;
    long long a;
    cin>>n>>m;
    while(m--)
    {
        cin>>a;
        sum+=a;
    }
    if(sum<=n)
    {
        cout<<n-sum<<endl;
    }
    else if(n<s)
    {
        cout<<"-1"<<endl;
    }
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, m, a;
  in2(n, m);
  a = 0;
  ll b;
  rep(i, m){
    in(b);
    a += b;
  }
  out(max(n - a, -1));
  memi;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:10: error: no matching function for call to 'max(ll, int)'
   26 |   out(max(n - a, -1));
      |       ~~~^~~~~~~~~~~
a.cc:14:24: note: in definition of macro 'out'
   14 | #define out(n) cout << 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:26:10: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   26 |   out(max(n - a, -1));
      |       ~~~^~~~~~~~~~~
a.cc:14:24: note: in definition of macro 'out'
   14 | #define out(n) cout << 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:26:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |   out(max(n - a, -1));
      |       ~~~^~~~~~~~~~~
a.cc:14:24: note: in definition of macro 'out'
   14 | #define out(n) cout << n
      |                        ^
Language: C++

#include <iostream>
using namespace std;

#define int long long

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

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int tot=0;
	int dummy;
	for(int i=0;i<m;i++){
		cin>>dummy;
		tot+=dummy;
	}
	cout<<n-tot<<endl;
	retrun 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'retrun' was not declared in this scope
   13 |         retrun 0;
      |         ^~~~~~
Language: C++

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

const ll maxs = 1e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){

}

void solve(){ 
    ll n,m;
    cin >> n >> m;
    ll a[m];
    ll sum=0;
    for(ll i=0;i<m;i++){
        cin >> a[i];
        sum += a[i];
    }
    ll ans = n - sum;
    ans = max(ans , -1);
    cout << ans;
}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    while(T--){  
        solve();
    }
    return 0;
}


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

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

const ll maxs = 1e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){

}

void solve(){ 
    ll n,m;
    cin >> n >> m;
    ll a[m];
    ll sum=0;
    for(ll i=0;i<m;i++){
        cin >> a[i];
        sum += a[i];
    }
    ll ans = n - sum;
    ans = max(ans , -1);
    cout << ans;
}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    while(T--){  
        solve();
    }
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int a,b,c[10005],d;
d=0;
cin>>a>>b;
for(int i=1;i<=b;i++)
{
	cin>>c[i];
	d=d+c[i];
}
if(a>d)
{
	cout<<a-d;
}
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>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  int i,sm=0;
  for(i=0;i<m;i++)
  {cin>>j;
   sm+=j;
}
  if(sm>n)
    cout<<-1;
  else
    cout<<n-sm;

}


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

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

#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define endl "\n" 
#define all(c) c.begin(),c.end()
#define present(c,element) (c.find(element)!=c.end())
#define cpresent(c,element) (find(c,element)!=c.end())
typedef vector<int> vi;
typedef vector<ll> vll;
ll mod=1e9+7;


int main()
{
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

//int test=1;
cin>>test;
while(test--)
{

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

	
}
return 0;
}









Compiler output:
a.cc: In function 'int main()':
a.cc:22:6: error: 'test' was not declared in this scope
   22 | cin>>test;
      |      ^~~~
a.cc:35:18: error: no matching function for call to 'max(int, long long int)'
   35 |         cout<<max(-1,n-sum);
      |               ~~~^~~~~~~~~~
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:35:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   35 |         cout<<max(-1,n-sum);
      |               ~~~^~~~~~~~~~
/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:35:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |         cout<<max(-1,n-sum);
      |               ~~~^~~~~~~~~~
Language: C++

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

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


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

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

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



Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: expected initializer before 'cin'
    6 |     cin>>N>>M;
      |     ^~~
a.cc:7:9: error: 'M' was not declared in this scope
    7 |   if(N>=M){
      |         ^
Language: C

#include <stdio.h>

int main(void)
{
    int m,n,a[m]i,s;

    scanf("%d%d",&n,&m);

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


Compiler output:
main.c: In function 'main':
main.c:5:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'i'
    5 |     int m,n,a[m]i,s;
      |                 ^
main.c:9:9: error: 'i' undeclared (first use in this function)
    9 |     for(i=0;i<m;i++)
      |         ^
main.c:9:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:25: error: 'a' undeclared (first use in this function)
   10 |             scanf("%d",&a[i]);
      |                         ^
main.c:11:5: error: 's' undeclared (first use in this function)
   11 |     s=0;
      |     ^
Language: C

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: expected ';' before '}' token
   10 |     cin>>A[i]
      |              ^
      |              ;
   11 |   }
      |   ~
Language: C

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

int main(){
  int N,M;
  int ans=0;
  cin>>N>>M;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin>>A[i]
  }
  for(int i=0;i<N;i++){
    ans-=A[i];
  }
  if(M+ans>0){
    cout<<M+ans<<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 <bits/stdc++.h>
using namespace std;
main()
{
	int N, M, input;
  	cin >> N >> M;
  	for(int i = 0, sum = 0; i < M; i++)
    {
      cin >> input;
      sum += input;
	}
  	if(sum > N)	cout << "-1\n";
  	else cout << N - sum << '\n';
} 	

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:12:12: error: 'sum' was not declared in this scope
   12 |         if(sum > N)     cout << "-1\n";
      |            ^~~
Language: C

#include <bits/stdc++.h>
using namespace std;
 
     int main() {
     int N,M,A,sum;
      cin>>N>>M;
      sum=0;
      while(cin>>A){
      sum+=A;}
      if(N>=sum){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

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

Compiler output:
main.c:1:14: 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,A,sum;
      cin>>N>>M;
      sum=0;
      while(cin>>A){
        sum+=A;}
      if(N>=sum){cout<<N-sum<<endl;}
      else{cout<<-1<<endl;}
      return 0;
    }

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

#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;

void ansYes(bool flag){
    if (flag) cout << "Yes" << endl; else  cout << "No" << endl;
}

void ansYES(bool flag){
    if (flag) cout << "YES" << endl; else  cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

int nanko(string s,Int n,Int i){
    Int length = min(n - i - 1,i);
    Int ans = 0;
    for (int k = i-length;k < i;k++){
        if (s.at(k) == 'R' && s.at(i +  (i - k) == 'B')) ans++;
    }
    return ans;
}


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

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

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

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

int main() {
	long n,m,ans=0;
  	cin >> n >> m;
  	vector<long> a(m);
  	for(long i = 0; i<m; i++){
      cin >> a[i];
      ans= ans+a[i];
    }
  	if(n<ans){
      cout << -1 << endl;
    }
  	cout << n-ans << 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++

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

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    1 | #inlcude<bits/stdc++.h>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:4:11: error: 'cin' was not declared in this scope
    4 |   int n,m;cin>>n>>m;
      |           ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inlcude<bits/stdc++.h>
a.cc:7:12: error: 'cout' was not declared in this scope
    7 |   if(sum>n)cout<<-1<<endl;
      |            ^~~~
a.cc:7:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:22: error: 'endl' was not declared in this scope
    7 |   if(sum>n)cout<<-1<<endl;
      |                      ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #inlcude<bits/stdc++.h>
a.cc:8:8: error: 'cout' was not declared in this scope
    8 |   else cout<< n-sum<<endl;
      |        ^~~~
a.cc:8:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:22: error: 'endl' was not declared in this scope
    8 |   else cout<< n-sum<<endl;
      |                      ^~~~
a.cc:8:22: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: Java

// 314 15
// 9 26 5 35 8 9 79 3 23 8 46 2 6 43 3
import java.util.*;
public class HelloWorld{

     public static void main(String []args){
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int t = sc.nextInt();
   int sum =0;
   while(t-->0){
       int b = sc.nextInt();
       sum+=b;
      
   }
  int r=0;
   if(a<sum){
       System.out.println(-1);
   }else
    r = a-sum;
     System.out.println(r);
     }
}

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

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

int main(){
	int n, m; cin >> n >> m;
  	vector<int> a(n); for(int i = 0; i < m; i++){cin >> a.at(i);}
  	
  	int d = n - accumulate(a.begin(),a.end(),0);
  	if(d >= 0){cout << d << endl;}
  	else(cout << -1 << endl;)
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:32: error: expected ')' before ';' token
   10 |         else(cout << -1 << endl;)
      |             ~                  ^
      |                                )
a.cc:10:33: error: expected primary-expression before ')' token
   10 |         else(cout << -1 << endl;)
      |                                 ^
Language: C

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

int main()
{
vector <int> v;
int n,a,i,c=0,l,as=0;
cin>>n>>a;
for(i=0;i<a;i++)
{
	cin>>l;
	v.push_back(l);
	c+=v[i];
}
if(c<=n)
{
  as=n-c;
  cout<<as;	
}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<iostream>
using namespace std;

int main(){
	int N, M, i;
	cin >> N >> M;
	int A[N];
	for(i=0; i<M; i++){
		cin >> A[i];
	}
	
	int sum=0;
	for(i=0; i<M; i++){
		sum += A[i];
	}
	
	int ans = N-sum;
	if(ans < 0)	ans = -1;
	
	cout << ans << 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 <iostream>
using namespace std;

int main(void)
{
	int N, M;
	int i, a;

	cin >> N >> M;

	for (i = 0;i < M;i++)
	{
		cin >> a;
		N -= a;
	}

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

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 Question163B(void) {
	int insdate = 0;
	int inhome = 0;
	int inhdate[10001] ={0};
	scanf("%d%d",&insdate,&inhome);
	for (int k = 0; k < inhome; k++) scanf("%d",&inhdate[k]);
	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];
	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);
	return 0;
}

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

#include <stdio.h>
#include<stdlib.h>
int Question163B(void) {
	int insdate;
	int inhome;
	int inhdate[10001];
	scanf("%d %d",&insdate,&inhome);
	for (int k = 0; k < inhome; k++) scanf("%d",&inhdate[k]);
	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];
	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);
	return 0;
}

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

#include <stdio.h>
int Question163B(void) {
	int insdate;
	int inhome;
	int inhdate[10001];
	scanf("%d%d",&insdate,&inhome);
	for (int k = 0; k < inhome; k++) scanf("%d",&inhdate[k]);
	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];
	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);
	return 0;
}

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

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int Question163B(void) {
	int insdate;
	int inhome;
	int inhdate[10001];
	scanf("%d %d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) scanf("%d", &inhdate[k]);
	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];
	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);
	return 0;
}

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

#include <iostream>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int a[m];
	int ans = n;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		ans -= a[i];
	}

	if (ans < 0) {
		ans = -1;
	}
	cout << ans << 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>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

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

    int ans = 0;
    for(int i = 0;i < M;i++) {
        int a;
        cin>>a;
        ans += a;
    }

    if(ans > N) {
        cout<<-1<<endl;
    } else {
        couut<<N-ans<<endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: 'couut' was not declared in this scope
   39 |         couut<<N-ans<<endl;
      |         ^~~~~
Language: C++

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

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

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

	return 0;
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:27: error: 'i' was not declared in this scope
   15 |                 sum=sum+A[i];
      |                           ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: 'm' was not declared in this scope
   13 |         for(int j=0;j<m;j++)
      |                       ^
a.cc:15:27: error: 'i' was not declared in this scope
   15 |                 sum=sum+A[i];
      |                           ^
Language: C++

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

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

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

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

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

int main(){
    ll n,m;
    cin >> n >> m;
    //vector<int> a(m);
    ll a=0;
    rep(i, m){
        ll tmp;
        cin >> tmp;
        a += tmp;
    }
    if(n<a) cout << -1 << endl;
    else cout << n-a << 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 <stdio.h>
int Question163B(void) {
	int insdate;
	int inhome;
	int inhdate[10001];
	int output ;

	scanf("%d %d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) scanf("%d", &inhdate[k]);

	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];

	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);

	return 0;
}

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

int Question163B(void) {
	int insdate;
	int inhome;
	int inhdate[10001];
	int output ;

	scanf("%d %d", &insdate, &inhome);
	for (int k = 0; k < inhome; k++) scanf("%d", &inhdate[k]);

	int num = 0;
	for (int i = 0; i < inhome; i++) num = num + inhdate[i];

	if (num > insdate) printf("%d\n", -1);
	else printf("%d\n", insdate - num);

	return 0;
}


Compiler output:
main.c: In function 'Question163B':
main.c:7:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    7 |         scanf("%d %d", &insdate, &inhome);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int Question163B(void) {
main.c:7:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    7 |         scanf("%d %d", &insdate, &inhome);
      |         ^~~~~
main.c:7:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:13:28: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   13 |         if (num > insdate) printf("%d\n", -1);
      |                            ^~~~~~
main.c:13:28: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:28: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:13:28: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:14: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   14 |         else printf("%d\n", insdate - num);
      |              ^~~~~~
main.c:14:14: note: include '<stdio.h>' or provide a declaration of 'printf'