buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
n,m=map(int,input().split()) a=list(map(int,input().split())) s=int(sum(a)) if (n-s)> 0: print(n-s) else: print(-1)
n,m=map(int,input().split()) a=list(map(int,input().split())) s=int(sum(a)) if (n-s)>= 0: print(n-s) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
64
N, M = map(int, input().split()) days = list(map(int, input().split())) hw_day = 0 for day in days: hw_day += day if N > hw_day: print(N - hw_day) else: print('-1')
N, M = map(int, input().split()) days = list(map(int, input().split())) hw_day = 0 for day in days: hw_day += day if N >= hw_day: print(N - hw_day) else: print('-1')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
63
def actual(n, m, a_list): a_sum = sum(a_list) if n >= a_sum: return n - a_sum return -1 N, M = map(int, input().split()) a_list = map(int, input().split()) print(actual(n, m, a_list))
def actual(n, m, a_list): a_sum = sum(a_list) if n >= a_sum: return n - a_sum return -1 n, m = map(int, input().split()) a_list = map(int, input().split()) print(actual(n, m, a_list))
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22]]
5
69
N,M = map(int,input().split()) lst = list(map(int,input().split())) plus = 0 for a in range(lst): plus += a if plus <= N: print(N-plus) else: print('-1')
N,M = map(int,input().split()) lst = list(map(int,input().split())) plus = 0 for a in lst: plus += a if plus <= N: print(N-plus) else: print('-1')
[["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25]]
5
66
#include <ctype.h> #include <stdio.h> #include <string.h> int main() { int N, M; scanf("%d %d", &N, &M); int a[10010] = {0}; int i; int sum = 0; for (i = 1; i < M + 1; i++) { scanf("%d", a[i]); sum += a[i]; } if (N >= sum) { printf("%d", N - sum); } else printf("-1"); return 0; }
#include <ctype.h> #include <stdio.h> #include <string.h> int main() { int N, M; scanf("%d %d", &N, &M); int a[10010] = {0}; int i; int sum = 0; for (i = 1; i < M + 1; i++) { scanf("%d", &a[i]); sum = sum + a[i]; } if (N >= sum) { printf("%d", N - sum); } else { printf("-1"); } ...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
0
114
#include <algorithm> #include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int input; int ans = 0; for (int i = 0; i < m; i++) { cin >> input; ans += input; }; if (n - ans > 0) { cout << -1 << endl; return 0; } else { cout << ans << endl; return 0; }...
#include <algorithm> #include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int input; int ans = 0; for (int i = 0; i < m; i++) { cin >> input; ans += input; }; if (n - ans < 0) { cout << -1 << endl; return 0; } else { cout << n - ans << endl; return 0;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
90
#include <bits/stdc++.h> using namespace std; #define int long long typedef vector<int> Vl; typedef pair<int, int> pii; typedef vector<pii> Vll; typedef vector<pair<int, pair<int, int>>> Vlll; #define S second #define F first #define mp make_pair #define ms(x, y) memset(x, y, sizeof(x)) #define pb push_back #define sl(...
#include <bits/stdc++.h> using namespace std; #define int long long typedef vector<int> Vl; typedef pair<int, int> pii; typedef vector<pii> Vll; typedef vector<pair<int, pair<int, int>>> Vlll; #define S second #define F first #define mp make_pair #define ms(x, y) memset(x, y, sizeof(x)) #define pb push_back #define sl(...
[["-", 0, 43, 49, 50, 51, 41, 15, 16, 17, 47], ["+", 0, 43, 49, 50, 51, 41, 15, 16, 17, 20]]
1
213
// Jai Bhole Ki #include <bits/stdc++.h> using namespace std; #define fast \ int fvariable = []() { \ std::ios::sync_with_stdio(false); \ cin.tie(NUL...
// Jai Bhole Ki #include <bits/stdc++.h> using namespace std; #define fast \ int fvariable = []() { \ std::ios::sync_with_stdio(false); \ cin.tie(NUL...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
144
n,m=map(int,input().split()) hoge=list(map(int,input().split())) if(sum(hoge)>=n): print(-1) else: print(n-sum(hoge))
n,m=map(int,input().split()) hoge=list(map(int,input().split())) if(sum(hoge)>n): print(-1) else: print(n-sum(hoge))
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 47]]
5
59
#include <bits/stdc++.h> using namespace std; int main() { int N, M, sum = 0; cin >> N >> M; for (int i = 0; i < M; i++) { int A; cin >> A; sum += A; } if (N > sum) cout << N - sum << endl; else cout << "-1" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, M, sum = 0; cin >> N >> M; for (int i = 0; i < M; i++) { int A; cin >> A; sum += A; } if (N >= sum) cout << N - sum << endl; else cout << "-1" << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
77
N,M = map(int, input().split()) A = list(map(int, input().split())) N -= sum(A) if N > 0: print(N) else: print(-1)
N,M = map(int, input().split()) A = list(map(int, input().split())) N -= sum(A) if N >= 0: print(N) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
55
/* lib.cpp */ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define overload4(_1, _2, _3, _4, name...
/* lib.cpp */ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #define overload4(_1, _2, _3, _4, name...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13]]
1
3,189
n, m = input().split() a = input().split() a = [int(i) for i in a] if int(n) >= sum(a): print(int(n)-sum(a)) else: print(0)
n, m = input().split() a = input().split() a = [int(i) for i in a] if int(n) >= sum(a): print(int(n)-sum(a)) else: print(-1)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
61
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cout, endl, cin...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cout, endl, cin...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
159
#include <bits/stdc++.h> using namespace std; #define ll long long #define PI 3.14159265359 int main() { ll n, m, hoge, sum = 0; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> hoge; sum += hoge; } hoge = n - sum; if (sum < 0) cout << -1 << endl; else cout << hoge << endl; return 0;...
#include <bits/stdc++.h> using namespace std; #define ll long long #define PI 3.14159265359 int main() { ll n, m, hoge, sum = 0; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> hoge; sum += hoge; } hoge = n - sum; if (hoge < 0) cout << -1 << endl; else cout << hoge << endl; return 0...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
87
#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; ...
#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; ...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
174
n,m=map(int,input().split()) for num in input().split(): n-=num print(n if n>=0 else -1)
n,m=map(int,input().split()) for num in input().split(): n-=int(num) print(n if n>=0 else -1)
[["+", 8, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25]]
5
41
import sys n, m = map(int, input().split()) cur = list(map(int, input().split())) if sum(cur) >= n: print(-1) else: print(n - sum(cur))
import sys n, m = map(int, input().split()) cur = list(map(int, input().split())) if sum(cur) > n: print(-1) else: print(n - sum(cur))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
59
n, m = map(int, input().split()) A = [int(x) for x in input().split()] if n-sum(A)>0: print(n-sum(A)) else: print("-1")
n, m = map(int, input().split()) A = [int(x) for x in input().split()] if n-sum(A)>=0: print(n-sum(A)) else: print("-1")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
61
N, M = map(int, input().split()) A = list(map(int, input().split())) s = 0 for n in A: s += n d = N - s if d > 0: print(d) else: print(-1)
N, M = map(int, input().split()) A = list(map(int, input().split())) s = 0 for n in A: s += n d = N - s if d >= 0: print(d) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
65
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> data(M); int a = 0; for (int i = 0; i < M; i++) { cin >> data.at(i); a += data.at(i); } if (a < N) { cout << N - a << endl; } else { cout << "-1" << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> data(M); int a = 0; for (int i = 0; i < M; i++) { cin >> data.at(i); a += data.at(i); } if (a <= N) { cout << N - a << endl; } else { cout << "-1" << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
98
b,c=gets.chomp.split(" ").map(&:to_i); Ar = gets.chomp.split(" ").map(&:to_i); a=c a= b-Ar.sum a=-1 if a<1 puts a
b,c=gets.chomp.split(" ").map(&:to_i); Ar = gets.chomp.split(" ").map(&:to_i); a=c a= b-Ar.sum a=-1 if a<0 puts a
[["-", 36, 36, 0, 493, 0, 751, 15, 738, 12, 612], ["+", 36, 36, 0, 493, 0, 751, 15, 738, 12, 612]]
4
60
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) #define VL vector<ll> #define VS vector<string> #define VB vector<bool> #define VP vector<pair<ll, ll>> #define VVL vector<vector<ll>> #define VVP vector<vector<pair<ll, ll>...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) #define VL vector<ll> #define VS vector<string> #define VB vector<bool> #define VP vector<pair<ll, ll>> #define VVL vector<vector<ll>> #define VVP vector<vector<pair<ll, ll>...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
115
#include <bits/stdc++.h> #include <math.h> using namespace std; int main() { long long N, M, Z, A, B, C, ans, a, b; cin >> N >> M; ans = 0; for (int i = 0; i < M; i++) { cin >> A; ans += A; } if (A > N) { cout << -1 << endl; return 0; } cout << N - ans << endl; }
#include <bits/stdc++.h> #include <math.h> using namespace std; int main() { long long N, M, Z, A, B, C, ans, a, b; cin >> N >> M; ans = 0; for (int i = 0; i < M; i++) { cin >> A; ans += A; } if (ans > N) { cout << -1 << endl; return 0; } cout << N - ans << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
93
#include <iostream> using namespace std; int main() { int n, m, i; int r, a = 0; cin >> n >> m; for (i = 0; i < m; i++) { cin >> r; a += r; } if (a >= n) cout << "-1" << endl; else cout << n - a << endl; return 0; }
#include <iostream> using namespace std; int main() { int n, m, i; int r, a = 0; cin >> n >> m; for (i = 0; i < m; i++) { cin >> r; a += r; } if (a > n) cout << "-1" << endl; else cout << n - a << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
81
a, b = map(int, input().split()) c = list(map(int, input().split())) d = sum(c) print(a-d if a >= 0 else "-1")
a, b = map(int, input().split()) c = list(map(int, input().split())) d = sum(c) e = a - d print(e if e >= 0 else "-1")
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 22], ["-", 0, 652, 3...
5
53
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_s...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_s...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
118
N, M = map(int, input().split()) A = [int(i) for i in input().split()] if sum(M) > N: print(-1) else: print(N-sum(A))
N, M = map(int, input().split()) A = [int(i) for i in input().split()] if sum(A) > N: print(-1) else: print(N-sum(A))
[["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22]]
5
58
n,m = map(int,input().split()) a_ = list(map(int,input().split())) sum = sum(s_) res = n - sum if(res < 0): print(-1) else: print(res)
n,m = map(int,input().split()) a_ = list(map(int,input().split())) sum = sum(a_) res = n - sum if(res < 0): print(-1) else: print(res)
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
62
#include <bits/stdc++.h> using namespace std; #define INF 1001001001 #define LINF 1001001001001001001 #define MOD 1000000007 #define MOD2 998244353 template <class T, class U> bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> bool chmin(T &a, const U ...
#include <bits/stdc++.h> using namespace std; #define INF 1001001001 #define LINF 1001001001001001001 #define MOD 1000000007 #define MOD2 998244353 template <class T, class U> bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> bool chmin(T &a, const U ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
371
#include <bits/stdc++.h> using namespace std; #define ld long double #define ll long long int #define endl '\n' #define check_time() \ cerr << "Time : " << 1000 * (ld)clock() / (ld)CLOCKS_PER_SEC << "ms\n"; #define fastio() ...
#include <bits/stdc++.h> using namespace std; #define ld long double #define ll long long int #define endl '\n' #define check_time() \ cerr << "Time : " << 1000 * (ld)clock() / (ld)CLOCKS_PER_SEC << "ms\n"; #define fastio() ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
123
NM = list(map(int, input().split())) N, M = NM[0],NM[1] a = list(map(int, input().split())) if sum(a)> N: print(-1) else: print(N - sum(A))
NM = list(map(int, input().split())) N, M = NM[0],NM[1] a = list(map(int, input().split())) if sum(a)> N: print(-1) else: print(N - sum(a))
[["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 22]]
5
71
#include <bits/stdc++.h> #define ll long long using namespace std; ll z, ans, o; ll mod = 1e9 + 7; ll N = 1e5 + 7; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { int u; cin >> u; ans += u; } if (ans > n) { cout << -1 << endl; } else { cout << n - ans <...
#include <bits/stdc++.h> #define ll long long using namespace std; ll z, ans, o; ll mod = 1e9 + 7; ll N = 1e5 + 7; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int u; cin >> u; ans += u; } if (ans > n) { cout << -1 << endl; } else { cout << n - ans <...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
99
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m; cin >> n >> m; vector<int> syukudai(m); int sum = 0; for (int i = 0; i < m; i++) { cin >> syukudai.at(i); sum += syukudai.at(i); } if (sum < n) { cout << -1 << endl; r...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m; cin >> n >> m; vector<int> syukudai(m); int sum = 0; for (int i = 0; i < m; i++) { cin >> syukudai.at(i); sum += syukudai.at(i); } if (sum > n) { cout << -1 << endl; r...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
104
N,M = map(int,input().split()) A = list(map(int,input().split())) ans = N-sum(A) if ans <= 0: print(-1) else: print(ans)
N,M = map(int,input().split()) A = list(map(int,input().split())) ans = N-sum(A) if ans < 0: print(-1) else: print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
57
#include <stdio.h> #include <stdlib.h> int main(void) { int i; int n, m; int *arr; int all = 0; if (scanf("%d %d", &n, &m) == 2) { arr = (int *)calloc(m, sizeof(int)); for (i = 0; i < m; i++) { scanf("%d", &arr[i]); } for (i = 0; i < m; i++) all += arr[i]; if (n > all) ...
#include <stdio.h> #include <stdlib.h> int main(void) { int i; int n, m; int *arr; int all = 0; if (scanf("%d %d", &n, &m) == 2) { arr = (int *)calloc(m, sizeof(int)); for (i = 0; i < m; i++) { scanf("%d", &arr[i]); } for (i = 0; i < m; i++) all += arr[i]; if (n >= all) ...
[["-", 64, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 23, 0, 16, 17, 20]]
0
146
a,b = map(int,input().split()) c =[int(i) for i in input().split()] su=sum(c) n = a-su if n>0: print(n) else: print(-1)
a,b = map(int,input().split()) c =[int(i) for i in input().split()] su=sum(c) n = a-su if n>=0: print(n) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
61
#include <bits/stdc++.h> using namespace std; int n, m, a[10005], days, ans; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i]; ans = ans + a[i]; } if (ans > n) cout << "-1"; else days = n - ans; cout << days; return 0; }
#include <bits/stdc++.h> using namespace std; int n, m, a[10005], days, ans; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i]; ans = ans + a[i]; } if (ans > n) cout << "-1"; else { days = n - ans; cout << days; } return 0; }
[["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
90
n,m=map(int,input().split()) list1=list(map(int,input().split())) ans=n-sum(list1) print(ans if ans>=0 else 0)
n,m=map(int,input().split()) list1=list(map(int,input().split())) ans=n-sum(list1) print(ans if ans>=0 else -1)
[["-", 0, 1, 0, 652, 3, 4, 0, 41, 0, 612], ["+", 0, 652, 3, 4, 0, 41, 0, 664, 17, 33], ["+", 0, 652, 3, 4, 0, 41, 0, 664, 28, 612]]
5
51
// int a = stoi(c); 文字列をintへ //小文字から大文字 // transform(a.begin(), a.end(), a.begin(), ::toupper); //途中の出力をそのまま残さない //数値計算 個数以外はdouble // map<キー,値> p は辞書。p[キー] = 値 // map 全探索 // auto begin = p.begin(), end = p.end(); // for (auto it = begin; it != end; it++) {} // mapのキー:it->first mapのバリュー:it->second //絶対値 abs() //入力は空白で切...
// int a = stoi(c); 文字列をintへ //小文字から大文字 // transform(a.begin(), a.end(), a.begin(), ::toupper); //途中の出力をそのまま残さない //数値計算 個数以外はdouble // map<キー,値> p は辞書。p[キー] = 値 // map 全探索 // auto begin = p.begin(), end = p.end(); // for (auto it = begin; it != end; it++) {} // mapのキー:it->first mapのバリュー:it->second //絶対値 abs() //入力は空白で切...
[["-", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22]]
1
549
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<vector<int>> homework(1, vector<int>(M)); int sum = 0, tmp; for (int i = 0; i < M; i++) { cin >> tmp; sum += tmp; } if (sum < N) { cout << N - sum << endl; } else { cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<vector<int>> homework(1, vector<int>(M)); int sum = 0, tmp; for (int i = 0; i < M; i++) { cin >> tmp; sum += tmp; } if (sum <= N) { cout << N - sum << endl; } else { cout << -1 << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
99
import math def main(): N, M = map(int, input().split()) A = sum(list(map(int, input().split()))) print(N - A) return 0 if __name__ == '__main__': main()
import math def main(): N, M = map(int, input().split()) A = sum(list(map(int, input().split()))) print(max(-1, N - A)) return 0 if __name__ == '__main__': main()
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
61
#include <bits/stdc++.h> using namespace std; #define ll long long int n, m, sum; int a[10005]; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i]; sum += a[i]; } if (sum >= n) cout << -1; else cout << n - sum; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long int n, m, sum; int a[10005]; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i]; sum += a[i]; } if (sum > n) cout << -1; else cout << n - sum; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
84
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define pb push_back #define INF 9223372036854775807 #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S se...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define pb push_back #define INF 9223372036854775807 #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S se...
[["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33]]
1
194
#include <bits/stdc++.h> #define ll long long #define pll pair<ll, ll> #define ull unsigned long long using namespace std; const int maxx = 1007; const ll mod1 = 1e7; const ll mod = 1e9 + 7; const ll base = 311; const ll base1 = 113; const ll maxn = 1e6 + 7; bool check; ll t, T, n, a[maxn], b[maxn], m1, m, tong, r, ans...
#include <bits/stdc++.h> #define ll long long #define pll pair<ll, ll> #define ull unsigned long long using namespace std; const int maxx = 1007; const ll mod1 = 1e7; const ll mod = 1e9 + 7; const ll base = 311; const ll base1 = 113; const ll maxn = 1e6 + 7; bool check; ll t, T, n, a[maxn], b[maxn], m1, m, tong, r, ans...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 0, 57, 75, 76, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 75, 76, 0...
1
467
#include <bits/stdc++.h> using namespace std; int main(void) { // input int n, m; cin >> n >> m; int tmp, sum = 0; for (int i = 0; i < m; i++) { cin >> tmp; sum += tmp; } // output if (n - sum > 0) cout << n - sum << endl; else cout << -1 << endl; }
#include <bits/stdc++.h> using namespace std; int main(void) { // input int n, m; cin >> n >> m; int tmp, sum = 0; for (int i = 0; i < m; i++) { cin >> tmp; sum += tmp; } // output if (n - sum >= 0) cout << n - sum << endl; else cout << -1 << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
80
#include <bits/stdc++.h> using namespace std; int main() { int N, M; int ans = 0; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A[i]; } for (int i = 0; i < M; i++) { ans -= A[i]; } if (N + ans > 0) { cout << N + ans << endl; } else { cout << -1 << endl; } }...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; int ans = 0; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A[i]; } for (int i = 0; i < M; i++) { ans -= A[i]; } if (N + ans >= 0) { cout << N + ans << endl; } else { cout << -1 << endl; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
110
#include <iomanip> #include <iostream> using namespace std; void Cont() { int32_t N, M; cin >> N; cin >> M; for (int32_t i = 0; i < M; i++) { int Ai; cin >> Ai; N -= Ai; if (N <= 0) { cout << "-1" << "\n"; return; } } cout << N << "\n"; } int main() { std::cin...
#include <iomanip> #include <iostream> using namespace std; void Cont() { int32_t N, M; cin >> N; cin >> M; for (int32_t i = 0; i < M; i++) { int Ai; cin >> Ai; N -= Ai; if (N < 0) { cout << "-1" << "\n"; return; } } cout << N << "\n"; } int main() { std::cin....
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
125
n, m = map(int, input().split()) li = input().split() b = 0 for a in li: b = b + a if n >= b: print(n-b) else: print("-1")
n, m = map(int, input().split()) li = input().split() b = 0 for a in li: b = b + int(a) if n >= b: print(n-b) else: print("-1")
[["+", 0, 1, 0, 662, 12, 657, 12, 652, 63, 22], ["+", 0, 662, 12, 657, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 657, 12, 652, 3, 4, 0, 25]]
5
57
N,M = map(int, input().split()) A_list = list(map(int, input.split())) avail = N - sum(A_list) if avail >= 0: print(avail) else: print(-1)
N,M = map(int, input().split()) A_list = list(map(int, input().split())) avail = N - sum(A_list) if avail >= 0: print(avail) else: print(-1)
[["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25]]
5
55
N, M = map(int, input().split()) A = list(map(int, input().split())) s = sum(A) if s > N: print(-1) else: print(N - s) print(-1)
N, M = map(int, input().split()) A = list(map(int, input().split())) s = sum(A) if s > N: print(-1) else: print(N - s)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
62
// By Mohit Gupta #include <bits/stdc++.h> using namespace std; #define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout, " ")) #define printintv(s, e) copy(s, e, ostream_iterator<int>(cout, " ")) #define forstl(i, v) for (auto &i : v) #define forn(i, e) for (int i = 0; i < e; i++) #define forsn(i, s, e) f...
// By Mohit Gupta #include <bits/stdc++.h> using namespace std; #define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout, " ")) #define printintv(s, e) copy(s, e, ostream_iterator<int>(cout, " ")) #define forstl(i, v) for (auto &i : v) #define forn(i, e) for (int i = 0; i < e; i++) #define forsn(i, s, e) f...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
254
#define _GLIBCXX_DEBUG #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++) { int A; cin >> A; sum += A; } if (N > sum) { cout << N - sum << endl; } else { cout << "-1" << endl; } }
#define _GLIBCXX_DEBUG #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++) { int A; cin >> A; sum += A; } if (N >= sum) { cout << N - sum << endl; } else { cout << "-1" << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
84
#include <cstdio> #include <iostream> #define For(i, x, y) for (register int i = (x); i <= (y); i++) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, cnt1 = 0, a; cin >> n >> m; For(i, 1, m) { cin >> a; cnt1 += a; } if (n - cnt1 > 0) cout << n - ...
#include <cstdio> #include <iostream> #define For(i, x, y) for (register int i = (x); i <= (y); i++) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, cnt1 = 0, a; cin >> n >> m; For(i, 1, m) { cin >> a; cnt1 += a; } if (n - cnt1 >= 0) cout << n -...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
107
#include <bits/stdc++.h> using namespace std; int main() { int n, m; int a; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a; n -= a; } cout << max(0, n) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; int a; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a; n -= a; } cout << max(-1, n) << endl; }
[["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
61
N, M = map(int, input().split()) a = list(map(int, input().split)) homework = sum(a) if homework > N: print("-1") else: print(N - homework)
N, M = map(int, input().split()) a = list(map(int, input().split())) homework = sum(a) if homework > N: print("-1") else: print(N - homework)
[["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
56
n,m = map(int,input().split()) a = list(map(int,input().split())) sum = 314 for i in a: sum -= i if sum < 0: print(-1) else: print(sum)
n,m = map(int,input().split()) a = list(map(int,input().split())) sum = n for i in a: sum -= i if sum < 0: print(-1) else: print(sum)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22]]
5
60
NM = [int(i) for i in input().split()] A = [int(i) for i in input().split()] N = NM[0] M = NM[1] if NM >= sum(A): print(NM-sum(A)) else: print(-1)
NM = [int(i) for i in input().split()] A = [int(i) for i in input().split()] N = NM[0] M = NM[1] if N >= sum(A): print(N-sum(A)) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
72
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define ll long l...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define ll long l...
[["-", 0, 16, 12, 23, 0, 41, 15, 16, 17, 47], ["+", 0, 16, 12, 23, 0, 41, 15, 16, 17, 20]]
1
111
N, M = map(int, input().sprit()) A = list(map(int, input().split())) a = sum(A) ans = N -a if ans >= 0: print(ans) else: print(-1)
N,M = map(int, input().split()) A = list(map(int, input().split())) a = sum(A) ans = N -a if ans >= 0: print(ans) else: print(-1)
[["-", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22]]
5
60
N, M = list(map(int, input().split())) A = list(map(int, input().split())) asoberuhi = N - sum(A) if asoberuhi < 0: print(asoberuhi) else: print(-1)
N, M = list(map(int, input().split())) A = list(map(int, input().split())) asoberuhi = N - sum(A) if asoberuhi >= 0: print(asoberuhi) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
60
#include <algorithm> #include <cmath> #include <deque> #include <forward_list> #include <fstream> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <utility> #include <vector> #define ...
#include <algorithm> #include <cmath> #include <deque> #include <forward_list> #include <fstream> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <utility> #include <vector> #define ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
136
n,m=[int(i)for i in input()] list=[int(i) for i in input().split()] a=n-sum(list) if a>=0: print(a) else: print('-1')
n,m=[int(i)for i in input().split()] list=[int(i) for i in input().split()] a=n-sum(list) if a>=0: print(a) else: print('-1')
[["+", 12, 658, 0, 659, 12, 652, 63, 319, 0, 131], ["+", 12, 658, 0, 659, 12, 652, 63, 319, 319, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 24], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 25]]
5
59
n, m = map(int, input().split()) A = list(map(int, input().split())) if sum(A) < 0: print("-1") else: print(n - sum(A))
n, m = map(int, input().split()) A = list(map(int, input().split())) if (n - sum(A)) < 0: print("-1") else: print(n - sum(A))
[["+", 0, 656, 0, 57, 15, 666, 0, 23, 0, 24], ["+", 0, 57, 15, 666, 0, 23, 0, 657, 31, 22], ["+", 0, 57, 15, 666, 0, 23, 0, 657, 17, 33], ["+", 0, 23, 0, 657, 12, 652, 3, 4, 0, 25]]
5
58
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { long int a, n, array[10001], sum = 0, i; cin >> a >> n; for (i = 0; i < n; i++) { cin >> array[i]; sum = sum + array[i]; } if (sum < a) { cout << a - sum << endl; } else { cout << "-1" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { long int a, n, array[10001], sum = 0, i; cin >> a >> n; for (i = 0; i < n; i++) { cin >> array[i]; sum = sum + array[i]; } if (sum <= a) { cout << a - sum << endl; } else { cout << "-1" << endl; } return 0; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
99
N, M = map(int, input().split()) A = sum(list(map(int, input().split()))) if A >= M: print(A-M) else: print(-1)
N, M = map(int, input().split()) A = sum(list(map(int, input().split()))) if N >= A: print(N-A) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
54
#include <bits/stdc++.h> using namespace std; int main() { int N, M, sum; cin >> N >> M; sum = N; vector<int> homework(M); for (int i = 0; i < M; i++) { cin >> homework.at(i); } for (int i = 0; i < M; i++) { if (sum > homework.at(i)) sum -= homework.at(i); else { sum = -1; ...
#include <bits/stdc++.h> using namespace std; int main() { int N, M, sum; cin >> N >> M; sum = N; vector<int> homework(M); for (int i = 0; i < M; i++) { cin >> homework.at(i); } for (int i = 0; i < M; i++) { if (sum >= homework.at(i)) sum -= homework.at(i); else { sum = -1; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
114
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> arr(m); for (int i = 0; i < m; i++) { cin >> arr[i]; } long long suma = 0; for (int i = 0; i < m; i++) { suma += arr[i]; } if (suma > n) cout << -1 << endl; else cout << suma << endl; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> arr(m); for (int i = 0; i < m; i++) { cin >> arr[i]; } long long suma = 0; for (int i = 0; i < m; i++) { suma += arr[i]; } if (suma > n) cout << -1 << endl; else cout << n - suma << endl...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
106
#include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define M_PI 3.14159265358979323846 int main() { int n, m, i, total = 0; int a[1001]; scanf("%d", &n); scanf("%d", &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); total += a[i]; } printf("%d\n...
#include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define M_PI 3.14159265358979323846 int main() { int n, m, i, total = 0; int a[10001]; scanf("%d", &n); scanf("%d", &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); total += a[i]; } printf("%d\...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 3, 4, 0, 41, 15, 23, 0, 16, 17, 47], ["+", 3, 4, 0, 41, 15, 23, 0, 16, 17, 20]]
0
120
package main import ( "fmt" ) func main() { var N, M int fmt.Scan(&N, &M) workDays := 0 var a int for i := 0; i < M; i++ { fmt.Scan(&a) workDays += a } if N-workDays > 0 { fmt.Println(N - workDays) } else { fmt.Println(-1) } }
package main import ( "fmt" ) func main() { var N, M int fmt.Scan(&N, &M) workDays := 0 var a int for i := 0; i < M; i++ { fmt.Scan(&a) workDays += a } if N-workDays >= 0 { fmt.Println(N - workDays) } else { fmt.Println(-1) } }
[["-", 0, 435, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 17, 20]]
7
98
#include <bits/stdc++.h> #include <unordered_map> using namespace std; #define endl '\n' #define ll long long #define int long long const int32_t INFint = 1e9; const ll INFll = 1e18; const ll INF = 1LL << 60; #define MOD 1000000007ll #define fast \ i...
#include <bits/stdc++.h> #include <unordered_map> using namespace std; #define endl '\n' #define ll long long #define int long long const int32_t INFint = 1e9; const ll INFll = 1e18; const ll INF = 1LL << 60; #define MOD 1000000007ll #define fast \ i...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
245
#include <iostream> using namespace std; int main() { int N, M; cin >> N; for (int i = 0; i < M; ++i) { int a; cin >> a; N -= a; } // end i cout << max(N, -1) << endl; }
#include <iostream> using namespace std; int main() { int N, M; cin >> N >> M; for (int i = 0; i < M; ++i) { int a; cin >> a; N -= a; } // end i cout << max(N, -1) << endl; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
60
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = a; i < b; ++i) #define ll long long #define M 100000007 #define fr first #define sc second #define endl "\n" #define vc vector #define pb push_back #define pii pair<ll, ll> #define psi pair<string, ll> #define fast ...
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = a; i < b; ++i) #define ll long long #define M 100000007 #define fr first #define sc second #define endl "\n" #define vc vector #define pb push_back #define pii pair<ll, ll> #define psi pair<string, ll> #define fast ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
215
n,m=(int(i) for i in input().split()) a=[int(i) for i in input().split()] s=sum(a) if n-a>=0: print(n-a) else: print(-1)
n,m=(int(i) for i in input().split()) a=[int(i) for i in input().split()] s=sum(a) if n-s>=0: print(n-s) else: print(-1)
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
64
n,m = map(int,input().split()) list1 = list(map(int,input().split())) if(n>sum(list1)): print(n-sum(list1)) else: print(-1)
n,m = map(int,input().split()) list1 = list(map(int,input().split())) if(n>=sum(list1)): print(n-sum(list1)) else: print(-1)
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 47], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 20]]
5
59
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, const char *argv[]) { int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) { int tmp; scanf("%d", &tmp); n -= tmp; } printf("%d", 0 < n ? n : -1); return 0; }
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, const char *argv[]) { int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) { int tmp; scanf("%d", &tmp); n -= tmp; } printf("%d", 0 <= n ? n : -1); return 0; }
[["-", 0, 2, 3, 4, 0, 41, 15, 16, 17, 18], ["+", 0, 2, 3, 4, 0, 41, 15, 16, 17, 19]]
0
92
<?php fscanf(STDIN, "%d %d", $n, $m); $str = ""; for($i = 0; $i < $m; $i++) { $str .= "%d"; } $homeworks = fscanf(STDIN, $str); $sumdays = $n - array_sum($homeworks); if($sumdays > 0) { echo $sumdays; } else { echo "-1"; } ?>
<?php fscanf(STDIN, "%d %d", $n, $m); $str = ""; for($i = 0; $i < $m; $i++) { $str .= "%d"; } $homeworks = fscanf(STDIN, $str); $sumdays = $n - array_sum($homeworks); if($sumdays >= 0) { echo $sumdays; } else { echo "-1"; } ?>
[["-", 0, 493, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 0, 493, 0, 57, 15, 23, 0, 16, 17, 20]]
6
93
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int t; cin >> t; m -= t; if (m < 0) { cout << -1; return 0; } } cout << m; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int t; cin >> t; n -= t; if (n < 0) { cout << -1; return 0; } } cout << n; }
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
69
#include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #define LINE_BUF_SIZE 1024 int main(void) { int i; int N, M; int sum = 0; int A[10000]; scanf("%d %d", &N, &M); for (i = 0; i < M; i++) { if (i == M) { scanf("%d", &A[i]); } scanf("%d ", &A[i]); sum += A[i...
#include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #define LINE_BUF_SIZE 1024 int main(void) { int i; int N, M; int sum = 0; int A[10000]; scanf("%d %d", &N, &M); for (i = 0; i < M; i++) { if (i == M) { scanf("%d", &A[i]); } scanf("%d ", &A[i]); sum += A[i...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
138
#include <stdio.h> int main(void) { int a[10010]; int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) scanf("%d", a[i]); int s = 0; for (int i = 0; i < m; i++) s += a[i]; if (s > n) printf("-1"); else printf("%d", n - s); return (0); }
#include <stdio.h> int main(void) { int a[10010]; int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) scanf("%d", &a[i]); int s = 0; for (int i = 0; i < m; i++) s += a[i]; if (s > n) printf("-1"); else printf("%d", n - s); return (0); }
[["+", 8, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
0
115
#include <cmath> #include <iostream> using namespace std; int main() { int n, m, x; cin >> n >> m; int sum = 0; for (int i = 0; i < m; i++) { cin >> x; sum += x; } if (n - sum > 0) cout << n - sum; else cout << "-1"; }
#include <cmath> #include <iostream> using namespace std; int main() { int n, m, x; cin >> n >> m; int sum = 0; for (int i = 0; i < m; i++) { cin >> x; sum += x; } if (n - sum >= 0) cout << n - sum; else cout << "-1"; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
77
#include <iostream> #include <numeric> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { ll n, m; cin >> n >> m; vector<ll> a(m); rep(i, m) { cin >> a[i]; } ll sum = accumulate(a.begin(), a.end(), 0); ll ans = n - sum; if (sum < 0) ...
#include <iostream> #include <numeric> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { ll n, m; cin >> n >> m; vector<ll> a(m); rep(i, m) { cin >> a[i]; } ll sum = accumulate(a.begin(), a.end(), 0); ll ans = n - sum; if (ans < 0) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
113
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define REP1(i, n) for (int i = 1; i <= (n); i++) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef vector<string> vs; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<vl...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define REP1(i, n) for (int i = 1; i <= (n); i++) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef vector<string> vs; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<vl...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
299
N,M = map(int,input().split()) A = list(map(int,input().split())) if sum(A) > N: print("-1") else: print(M - sum(A))
N,M = map(int,input().split()) A = list(map(int,input().split())) if sum(A) > N: print("-1") else: print(N - sum(A))
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
58
n,m = map(int, input().split()) a = list(map(int, input().split())) suma = sum(a) tmp = n - suma if tmp > 0: print(tmp) else: print(-1)
n,m = map(int, input().split()) a = list(map(int, input().split())) suma = sum(a) tmp = n - suma if tmp >= 0: print(tmp) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
60
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #define debug(var) cerr << (#var) << " = " << (var) << endl; #else #define debug(var) #endif void init() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void solve() { int n, m; scanf("%d%d", &n, &m); int ans = 0; for (int i = 0; i <...
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #define debug(var) cerr << (#var) << " = " << (var) << endl; #else #define debug(var) #endif void init() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void solve() { int n, m; scanf("%d%d", &n, &m); int ans = 0; for (int i = 0; i <...
[["-", 0, 2, 3, 4, 0, 41, 15, 16, 17, 47], ["+", 0, 2, 3, 4, 0, 41, 15, 16, 17, 20]]
1
161
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int a; cin >> a; n -= a; } if (n) cout << n; else cout << "-1"; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int a; cin >> a; n -= a; } if (n >= 0) cout << n; else cout << "-1"; }
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
65
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a[n]; cin >> n >> m; for (int i = 0; i < m; i++) cin >> a[i]; int s = 0; for (int i = 0; i < m; i++) s += a[i]; if (s > n) { cout << "-1" << endl; } else { cout << n - s << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a[10000]; cin >> n >> m; for (int i = 0; i < m; i++) cin >> a[i]; int s = 0; for (int i = 0; i < m; i++) s += a[i]; if (s > n) { cout << "-1" << endl; } else { cout << n - s << endl; } }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
102
import numpy as np N, M = map(int, input().split()) A_list = np.array(list(map(int, input().split()))) total = np.sum(A_list) free_day = max(N - M, -1) print(free_day)
import numpy as np N, M = map(int, input().split()) A_list = np.array(list(map(int, input().split()))) total = np.sum(A_list) free_day = max(N - total, -1) print(free_day)
[["-", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22]]
5
65
#include <bits/stdc++.h> using namespace std; main() { int N, M, s = 0; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A[i]; } for (int i = 0; i < M; i++) { s = s + A[i]; } if (s < N) { cout << N - s << endl; } else { cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; main() { int N, M, s = 0; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A[i]; } for (int i = 0; i < M; i++) { s = s + A[i]; } if (s <= N) { cout << N - s << endl; } else { cout << -1 << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
108
n, m = input().split() n = int(n) a = input().split() for i in range(len(a)): a[i] = int(a[i]) if n > sum(a): print(n-sum(a)) else: print("-1")
n, m = input().split() n = int(n) a = input().split() for i in range(len(a)): a[i] = int(a[i]) if n >= sum(a): print(n-sum(a)) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
74
#include <bits/stdc++.h> using namespace std; #define l long long int int main() { l x, n, ct = 0; cin >> x >> n; vector<l> ar(n, 0); for (auto &i : ar) { cin >> i; ct += i; } if (ct >= x) { cout << -1; } else cout << x - ct; return 0; }
#include <bits/stdc++.h> using namespace std; #define l long long int int main() { l x, n, ct = 0; cin >> x >> n; vector<l> ar(n, 0); for (auto &i : ar) { cin >> i; ct += i; } if (ct > x) { cout << -1; } else cout << x - ct; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
81
n, m = list(map(int, input().split())) print(max(n - sum(list(map(int, input().split()))), 0))
n, m = list(map(int, input().split())) print(max(n - sum(list(map(int, input().split()))), -1))
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612]]
5
47
#include <iostream> using namespace std; int main() { int N, M; int A[10010]; cin >> N >> M; for (int i = 0; i < M; i++) cin >> A[i]; int sum = 0; for (int i = 0; i < M; i++) sum += A[i]; if (sum > N) cout << "-1" << endl; else cout << N - M << endl; return 0; }
#include <iostream> using namespace std; int main() { int N, M; int A[10010]; cin >> N >> M; for (int i = 0; i < M; i++) cin >> A[i]; int sum = 0; for (int i = 0; i < M; i++) sum += A[i]; if (sum > N) cout << "-1" << endl; else cout << N - sum << endl; return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
102
N, M = map(int, input().split()) A = list(map(int, input().split())) ans = N - sum(A) if N > sum(A) else -1 print(ans)
N, M = map(int, input().split()) A = list(map(int, input().split())) ans = N - sum(A) if N >= sum(A) else -1 print(ans)
[["-", 0, 1, 0, 662, 12, 41, 0, 666, 667, 47], ["+", 0, 1, 0, 662, 12, 41, 0, 666, 667, 20]]
5
55
import math from sys import * inp=stdin.readline zip=zip def linp(x): return list(map(int,x.split())) def minp(x): return map(int,x.split()) n,m=minp(inp()) a=linp(inp()) an=sum(a)-n if an>=0: print(an) else: print("-1")
import math from sys import * inp=stdin.readline zip=zip def linp(x): return list(map(int,x.split())) def minp(x): return map(int,x.split()) n,m=minp(inp()) a=linp(inp()) an=n-sum(a) if an>=0: print(an) else: print("-1")
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
94
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int tmp; cin >> tmp; n -= tmp; } if (n > 1) cout << n; else cout << "-1"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int tmp; cin >> tmp; n -= tmp; } if (n >= 0) cout << n; else cout << "-1"; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
70
#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 < N; i++) { cin >> a.at(i); sum += a.at(i); } if (sum <= N) { cout << N - sum << endl; } else { cout << -1 << endl; } // ここにプログラムを追記 }
#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.at(i); sum += a.at(i); } if (sum <= N) { cout << N - sum << endl; } else { cout << -1 << endl; } // ここにプログラムを追記 }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
97
if __name__ == '__main__': x=list(map(int,input().split(" "))) y = list(map(int, input().split(" "))) num=0 for i in y: num+=i if x[0]<y: print(-1) else: print(x[0]-y)
if __name__ == '__main__': x=list(map(int,input().split(" "))) y = list(map(int, input().split(" "))) num=0 for i in y: num+=i if x[0]<num: print(-1) else: print(x[0]-num)
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
82
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; const int MOD = 1e9 + 7; int main() { ll n, m; cin >> n >> m; ll sum = 0; for (int i = 0; i < m; i++) { int a; cin >> a; sum += a; } cout << max(-1ll, sum - n) << endl; return 0; }
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; const int MOD = 1e9 + 7; int main() { ll 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; }
[["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 22]]
1
90