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
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(i, a, n) for (int i = a; i < n; i++) #define ps(x) cout << x << " " #define pn(x) cout << x << "\n" #define sz(a) int((a).size()) #define pb push_back typedef vector<int> vi; typedef pair<int, int> pairs; int main() { ll n, k, x; cin >...
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(i, a, n) for (int i = a; i < n; i++) #define ps(x) cout << x << " " #define pn(x) cout << x << "\n" #define sz(a) int((a).size()) #define pb push_back typedef vector<int> vi; typedef pair<int, int> pairs; int main() { ll n, k, x; cin >...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
122
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> A(m); for (auto &i : A) { cin >> i; } int i = 0; while (i < A.size()) { n = n - A[i++]; } if (n < 0) { cout << "-1" << endl; } cout << n; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> A(m); for (auto &i : A) { cin >> i; } int i = 0; while (i < A.size()) { n = n - A[i++]; } if (n < 0) { cout << "-1" << endl; } else { cout << n; } return 0; }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
96
n, m = map(int, input().split()) A = list(map(int, input().split())) homework = sum(A) print(n - m if n - m >= 0 else -1)
n, m = map(int, input().split()) A = list(map(int, input().split())) homework = sum(A) print(n - homework if n - homework >= 0 else -1)
[["-", 0, 652, 3, 4, 0, 41, 0, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 41, 0, 657, 12, 22], ["-", 3, 4, 0, 41, 0, 666, 0, 657, 12, 22], ["+", 3, 4, 0, 41, 0, 666, 0, 657, 12, 22]]
5
54
n, m = (int(i) for i in input().split()) a = [int(i) for i in input().split()] total = sum(a) ans = n - total if ans < 0: ans == -1 print(ans)
n, m = (int(i) for i in input().split()) a = [int(i) for i in input().split()] total = sum(a) ans = n - total if ans < 0: ans = -1 print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 666, 667, 60], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32]]
5
62
#include <stdio.h> int main() { int time = 0, NumTask = 0; scanf("%d %d", &time, &NumTask); int temp = 0; for (int i = 0; i < NumTask; i++) { scanf("%d", &temp); time -= temp; } if (time) printf("%d", time); else printf("-1"); }
#include <stdio.h> int main() { int time = 0, NumTask = 0; scanf("%d %d", &time, &NumTask); int temp = 0; for (int i = 0; i < NumTask; i++) { scanf("%d", &temp); time -= temp; } if (time >= 0) printf("%d", time); else printf("-1"); }
[["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
86
n,m=map(int,input().split()) a=list(map(int,input().split())) if n-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))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
59
#include <iostream> using namespace std; int main() { int n, m, t, s; cin >> n >> m; s = 0; for (int i = 0; i < m; i++) { cin >> t; s += t; } int r = n - s; cout << (r > 0 ? r : -1) << endl; return 0; }
#include <iostream> using namespace std; int main() { int n, m, t, s; cin >> n >> m; s = 0; for (int i = 0; i < m; i++) { cin >> t; s += t; } int r = n - s; cout << (r >= 0 ? r : -1) << endl; return 0; }
[["-", 31, 16, 12, 23, 0, 41, 15, 16, 17, 47], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 20]]
1
79
n, m = map(int, input().split()) a_list = list(map(int, input().split())) all_done_days = sum(a_list) if all_done_days < n: print(n - all_done_days) else: print(-1)
n, m = map(int, input().split()) a_list = list(map(int, input().split())) all_done_days = sum(a_list) if all_done_days <= n: print(n - all_done_days) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
57
N, M = int(input().split()) A = list(map(int, input().split())) S = sum(A) ans = -1 if N >= S: ans = N-S print (ans)
N, M = list(map(int, input().split())) A = list(map(int, input().split())) S = sum(A) ans = -1 if N >= S: ans = N-S print (ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
55
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define REP(i, a, n) for (int i = a; i < n; ++i) #define REPR(i, a, n) for (int i = a; i > n; --i) #define RUP(a, b) (((a) + (b)-1) / (b)) #define ALL(v) (v).begin(), (v).end() #define pb push_back #define mp make_pair #define mt mak...
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define REP(i, a, n) for (int i = a; i < n; ++i) #define REPR(i, a, n) for (int i = a; i > n; --i) #define RUP(a, b) (((a) + (b)-1) / (b)) #define ALL(v) (v).begin(), (v).end() #define pb push_back #define mp make_pair #define mt mak...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
988
#include <stdio.h> int main(void) { // Your code here! int n, m, i, a[1000]; scanf("%d%d", &n, &m); for (i = 1; i <= m; i++) { scanf("%d", &a[i]); n = n - a[i]; } if (n >= 0) printf("%d\n", n); else printf("-1\n"); return 0; }
#include <stdio.h> int main(void) { // Your code here! int n, m, i, a[1000000]; scanf("%d%d", &n, &m); for (i = 1; i <= m; i++) { scanf("%d", &a[i]); n = n - a[i]; } if (n >= 0) printf("%d\n", n); else printf("-1\n"); return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
100
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef set<int> si; typedef set<ii> sii; typedef vi::iterator itt; typedef si::iterator jtt; #define fori(i, x) for (itt i = x.begin(); i != x.end(); i++) #define forj(j, x) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef set<int> si; typedef set<ii> sii; typedef vi::iterator itt; typedef si::iterator jtt; #define fori(i, x) for (itt i = x.begin(); i != x.end(); i++) #define forj(j, x) f...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
186
#include <bits/stdc++.h> using namespace std; typedef long long LL; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() int main() { int n, m; cin >> n >> m; int sum = 0; int t; rep(i, m) { cin >> t; sum += t; } cout << max(0, n - sum) << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long LL; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() int main() { int n, m; cin >> n >> m; int sum = 0; int t; rep(i, m) { cin >> t; sum += t; } cout << max(-1, n - sum) << endl; }
[["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
79
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0; int N, M; cin >> N, M; for (int i = 0; i < M; i++) { int days = 0; cin >> days; ans += days; } if (ans <= N) cout << N - ans; else cout << -1; }
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0; int N, M; cin >> N; cin >> M; for (int i = 0; i < M; i++) { int days = 0; cin >> days; ans += days; } if (ans <= N) cout << N - ans; else cout << -1; }
[["-", 0, 14, 8, 9, 0, 1, 0, 34, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
74
n,m=map(int,input().split()) a=[int(b) for b in input()] def func(n,a): if n< sum(a):return "-1" else: return n-sum(a) print(func(n,a))
n,m=map(int,input().split()) a=[int(b) for b in input().split()] def func(n,a): if n< sum(a):return "-1" else: return n-sum(a) print(func(n,a))
[["+", 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
68
n,m = map(int,input()) a = [int(x) for x in input().split()] s = sum(a) if n < s: print("-1") else: print(n-s)
n,m = map(int,input().split()) a = [int(x) for x in input().split()] s = sum(a) if n < s: print("-1") else: print(n-s)
[["+", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
55
#include <algorithm> #include <bitset> #include <cassert> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vect...
#include <algorithm> #include <bitset> #include <cassert> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vect...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
134
n,m = map(int, input().strip().sprit(' ')) homework = list(map(int, input().strip().sprit(' '))) day = n - sum(homework) if day >= 0: print(day) else: print(-1)
n,m = map(int, input().strip().split(" ")) homework = list(map(int, input().strip().split(" "))) day = n - sum(homework) if day >= 0: print(day) else: print(-1)
[["-", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+"...
5
71
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { int n, m; cin >> n >> m; int sum = 0; for (int i = 0; i < n; i++) { int var; cin >> var; sum += var; } if (sum > n) { cout << "-1"; } else { cout << (n - sum); } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { int n, m; cin >> n >> m; int sum = 0; for (int i = 0; i < m; i++) { int var; cin >> var; sum += var; } if (sum > n) { cout << "-1"; } else { cout << (n - sum); } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
89
N, M = map(int, input().split()) A = input().split() travail = 0 for i in range(0, len(A)): A[i] = int(A[i]) travail += A[i] if N - travail > 0: print(N - travail) else: print(-1)
N, M = map(int, input().split()) A = input().split() travail = 0 for i in range(0, len(A)): A[i] = int(A[i]) travail += A[i] if N - travail >= 0: print(N - travail) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
79
/** * B - Homework * https://atcoder.jp/contests/abc163/tasks/abc163_b */ #include <bits/stdc++.h> using namespace std; int main() { // 高橋君の夏休みは N 日間です。 // 夏休みの宿題が M 個出されており int N, M; cin >> N >> M; // i 番目の宿題をやるには Ai 日間かかります。 int A; for (int i = 0; i < M; i++) { // 宿題にA日かかるため、夏休みの余剰日数がA日減る c...
/** * B - Homework * https://atcoder.jp/contests/abc163/tasks/abc163_b */ #include <bits/stdc++.h> using namespace std; int main() { // 高橋君の夏休みは N 日間です。 // 夏休みの宿題が M 個出されており int N, M; cin >> N >> M; // i 番目の宿題をやるには Ai 日間かかります。 int A; for (int i = 0; i < M; i++) { // 宿題にA日かかるため、夏休みの遊べる日数がA日減る ...
[["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 104], ["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 16, 31, 16, 12, 103, 0, 42, 0, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
83
#include <bits/stdc++.h> using namespace std; typedef long long ll; int M; ll N, S; int main() { // freopen("a.in", "r", stdin); // freopen("a.out", "w", stdout); ll a; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> a; S += a; } N -= S; if (S < 0) cout << "-1\n"; else cout << ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int M; ll N, S; int main() { // freopen("a.in", "r", stdin); // freopen("a.out", "w", stdout); ll a; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> a; S += a; } N -= S; if (N < 0) cout << "-1\n"; else cout << ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
89
#include <bits/stdc++.h> using namespace std; int main() { int yasumi, shukudai; int count = 0; cin >> yasumi >> shukudai; vector<int> nissuu(shukudai); for (int i = 0; i < shukudai; i++) { cin >> nissuu.at(i); } for (int i = 0; i < shukudai; i++) { count += nissuu.at(i); } if ((yasumi - co...
#include <bits/stdc++.h> using namespace std; int main() { int yasumi, shukudai; int count = 0; cin >> yasumi >> shukudai; vector<int> nissuu(shukudai); for (int i = 0; i < shukudai; i++) { cin >> nissuu.at(i); } for (int i = 0; i < shukudai; i++) { count += nissuu.at(i); } if ((yasumi - co...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
116
n, m = map(int, input().split()) works = list(map(int, input().split())) print(works) plays = n - sum(works) print(plays if plays >= 0 else -1)
n, m = map(int, input().split()) works = list(map(int, input().split())) plays = n - sum(works) print(plays if plays >= 0 else -1)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
56
#include <iostream> using namespace std; int main() { long long res = 0; int m, n, ai; cin >> m >> n; int i = 0; while (i++ < n) { cin >> ai; res += ai; } cout << ((m > res) ? (m - res) : -1) << endl; }
#include <iostream> using namespace std; int main() { long long res = 0; int m, n, ai; cin >> m >> n; int i = 0; while (i++ < n) { cin >> ai; res += ai; } cout << ((m >= res) ? (m - res) : -1) << endl; }
[["-", 12, 23, 0, 41, 15, 23, 0, 16, 17, 47], ["+", 12, 23, 0, 41, 15, 23, 0, 16, 17, 20]]
1
73
// inputに入力データ全体が入る function Main(input) { input = input.split("\n"); //夏休みの日数 let tmpSummerWeek = input[0].split(" "); let summerWeek = parseInt(tmpSummerWeek[0], 10); //宿題のかかる日数を文字列で受け取る let syukudaiArray = input[1].split(" "); var syukudai; syukudaiArray.forEach(function(value) { syukudai += parse...
// inputに入力データ全体が入る function Main(input) { input = input.split("\n"); //夏休みの日数 let tmpSummerWeek = input[0].split(" "); let summerWeek = parseInt(tmpSummerWeek[0], 10); //宿題のかかる日数を文字列で受け取る let syukudaiArray = input[1].split(" "); let syukudai = 0; syukudaiArray.forEach(function(value) { syukudai += p...
[["-", 0, 493, 0, 435, 8, 556, 0, 198, 0, 217], ["+", 0, 493, 0, 435, 8, 556, 0, 570, 571, 243], ["+", 0, 435, 8, 556, 0, 570, 0, 200, 0, 32], ["+", 0, 435, 8, 556, 0, 570, 0, 200, 51, 555], ["+", 0, 1, 0, 564, 12, 2, 3, 3, 0, 21], ["+", 0, 1, 0, 564, 12, 2, 3, 3, 0, 555]]
2
135
N, M=map(int,input.split()) a=list(map(int,input.split())) if N-sum(a)>=0: print(N-sum(a)) else: print(-1)
N, M=map(int,input().split()) a=list(map(int,input().split())) if N-sum(a)>=0: print(N-sum(a)) 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()) day = sum(map(int, input().split())) (print(N - day) if (N - day) > 0 else print(-1))
N, M = map(int, input().split()) day = sum(map(int, input().split())) (print(N - day) if (N - day) >= 0 else print(-1))
[["-", 0, 1, 0, 23, 0, 41, 0, 666, 667, 47], ["+", 0, 1, 0, 23, 0, 41, 0, 666, 667, 20]]
5
55
#include <bits/stdc++.h> using namespace std; int main() { int n, m, sum = 0, a; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a; sum += a; } if (sum > n) { cout << -1 << endl; } else { cout << n - sum << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { long n, m, sum = 0, a; cin >> n >> m; for (long i = 0; i < m; i++) { cin >> a; sum += a; } if (sum > n) { cout << -1 << endl; } else { cout << (n - sum) << endl; } }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 0, 1, 0, 16, 31, 1...
1
78
yasumi = 0 syukudai = 1 nissu = list(map(int,input().split())) syukudaiNissu = list(map(int,input().split())) if sum(syukudaiNissu) > nissu[yasumi]: print()-1 print(nissu[yasumi] - sum(syukudaiNissu))
yasumi = 0 syukudai = 1 nissu = list(map(int,input().split())) syukudaiNissu = list(map(int,input().split())) if sum(syukudaiNissu) > nissu[yasumi]: print(-1) exit() print(nissu[yasumi] - sum(syukudaiNissu))
[["-", 0, 1, 0, 657, 31, 652, 3, 4, 0, 25], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24]]
5
68
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for (i = s; i < g; i++) using namespace std; using ll = long long; const int inf = 10...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for (i = s; i < g; i++) using namespace std; using ll = long long; const int inf = 10...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]]
1
140
'use strict'; function main(input) { const a = input.trim().split("\n")[0].split(" ")[0]; const b = input.trim().split("\n")[1].split(" ").map(x => Number(x)); let sum; for (let i = 0; i < b.length; i++) { sum += b[i]; } if (a < sum) { console.log(-1); } else { console.log(a - sum); } } m...
'use strict'; function main(input) { const a = input.trim().split('\n')[0].split(' ')[0]; const b = input.trim().split('\n')[1].split(' ').map(x => Number(x)); let sum = 0; for (let i = 0; i < b.length; i++) { sum += b[i]; } if (a < sum) { console.log(-1); } else { console.log(a - sum); } ...
[["-", 500, 69, 500, 2, 3, 3, 0, 557, 0, 62], ["+", 500, 69, 500, 2, 3, 3, 0, 557, 0, 104], ["-", 51, 69, 500, 2, 3, 3, 0, 557, 0, 62], ["+", 51, 69, 500, 2, 3, 3, 0, 557, 0, 104], ["-", 63, 558, 500, 2, 3, 3, 0, 557, 0, 62], ["+", 63, 558, 500, 2, 3, 3, 0, 557, 0, 104], ["+", 0, 435, 8, 556, 0, 570, 0, 200, 0, 32], ["...
2
153
from math import * from copy import * from string import * # alpha = ascii_lowercase from random import * from sys import stdin from sys import maxsize from operator import * # d = sorted(d.items(), key=itemgetter(1)) from itertools import * from collections import Counter # d = dict(Counter(l)) import math def...
from math import * from copy import * from string import * # alpha = ascii_lowercase from random import * from sys import stdin from sys import maxsize from operator import * # d = sorted(d.items(), key=itemgetter(1)) from itertools import * from collections import Counter # d = dict(Counter(l)) import math def...
[["-", 64, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 64, 196, 0, 57, 15, 23, 0, 666, 667, 47]]
5
703
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int K = 0; for (int i = 0; i < M; i++) { int J; cin >> J; K += J; } if (N - K > 0) { cout << N - K << endl; } else { cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int K = 0; for (int i = 0; i < M; i++) { int J; cin >> J; K += J; } if (N - K >= 0) { cout << N - K << 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
82
#include <stdio.h> int main(void) { int n, m, i, res, a; int sum = 0; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a); sum += a; } res = n - sum; if (res > 0) printf("%d", res); else printf("%d", -1); return 0; }
#include <stdio.h> int main(void) { int n, m, i, res, a; int sum = 0; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a); sum += a; } res = n - sum; if (res >= 0) printf("%d", res); else printf("%d", -1); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20]]
0
101
n, m = map(int, input().split()) a = list(map(int, input().split())) p = sum(a) if n>p: print(n-p) else: print(-1)
n, m = map(int, input().split()) a = list(map(int, input().split())) p = sum(a) if n>=p: print(n-p) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
57
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> bool chmin(T &a, const U &b) { return (a > b ? a = b, true : false); } template <typename T, typename U> bool chmax(T &a, const U &b) { return (a < b ? a = b, true : false); } const long long INF = 1000000000; typedef long long ll; #...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> bool chmin(T &a, const U &b) { return (a > b ? a = b, true : false); } template <typename T, typename U> bool chmax(T &a, const U &b) { return (a < b ? a = b, true : false); } const long long INF = 1000000000; typedef long long ll; #...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
202
n, m = map(int, input().split()) a = list(map(int, input().split())) total = sum(a) if total <= n: print(total) else: print(-1)
n, m = map(int, input().split()) a = list(map(int, input().split())) total = sum(a) if total <= n: print(n - total) else: print(-1)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
55
N, M = map(int, input().split()) A = [int(i) for i in input().split()] B = sum(A) if M <= B: print(N-B) else: print('-1')
N, M = map(int, input().split()) A = [int(i) for i in input().split()] B = sum(A) if N >= B: print(N-B) else: print('-1')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
59
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> v; for (int i = 0; i < m; i++) { int input; cin >> input; v.push_back(input); } int result = n - accumulate(v.begin(), v.end(), 0); if (result > 0) cout << result; else cout << "-1"; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> v; for (int i = 0; i < m; i++) { int input; cin >> input; v.push_back(input); } int result = n - accumulate(v.begin(), v.end(), 0); if (result >= 0) cout << result; else cout << "-1";...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
98
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const long long INF = 9999999999999999; using ll = long long; int main() { int N, M; cin >> N >> M; for (int i = 0; i < M; i++) { int k; cin >> k; N -= k; } if (N > 0) { cout << N << endl; } else { cout << "-...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const long long INF = 9999999999999999; using ll = long long; int main() { int N, M; cin >> N >> M; for (int i = 0; i < M; i++) { int k; cin >> k; N -= k; } if (N >= 0) { cout << N << endl; } else { cout << "...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
98
#include <bits/stdc++.h> typedef long long int ll; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) \ for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i) #define rep(...) _overload3(__VA_ARGS__, r...
#include <bits/stdc++.h> typedef long long int ll; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) \ for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i) #define rep(...) _overload3(__VA_ARGS__, r...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
122
n, m = map(int, input().split()) a = [int(i) for i in input().split()] x = n - sum(a) print(x) if x else print(-1)
n, m = map(int, input().split()) a = [int(i) for i in input().split()] x = n - sum(a) print(x) if x>=0 else print(-1)
[["+", 0, 656, 0, 1, 0, 41, 0, 666, 667, 20], ["+", 0, 656, 0, 1, 0, 41, 0, 666, 0, 612]]
5
54
#include <bits/stdc++.h> using namespace std; #define NewNode (ListNode *)malloc(sizeof(ListNode)) #define Mem(a, b) memset(a, b, sizeof(a)) const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; const double EPS = 1e-10; const unsigned long long mod = 998244353; const double II = 3.1415926535; typedef long long ll; typede...
#include <bits/stdc++.h> using namespace std; #define NewNode (ListNode *)malloc(sizeof(ListNode)) #define Mem(a, b) memset(a, b, sizeof(a)) const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; const double EPS = 1e-10; const unsigned long long mod = 998244353; const double II = 3.1415926535; typedef long long ll; typede...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
153
#include <stdio.h> #include <stdlib.h> int main(void) { int N, M; int *p; scanf("%d %d", &N, &M); p = calloc(M, sizeof(int)); int i; for (i = 1; i <= N; i++) { scanf("%d", &p[i]); N -= p[i]; } if (N < 0) printf("-1"); else printf("%d", N); return 0; }
#include <stdio.h> #include <stdlib.h> int main(void) { int N, M; int *p; scanf("%d %d", &N, &M); p = calloc(M + 1, sizeof(int)); int i; for (i = 1; i <= M; i++) { scanf("%d", &p[i]); N -= p[i]; } if (N < 0) printf("-1"); else printf("%d", N); return 0; }
[["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
0
109
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m, a; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a; n -= a; } if (n <= 0) { cout << -1 << endl; } else { cout << n << endl; } }
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m, a; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a; n -= a; } if (n < 0) { cout << -1 << endl; } else { cout << n << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
91
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll t, n; cin >> t >> n; vector<ll> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } long sum = accumulate(v.begin(), v.end(), 0); cout << sum; if (sum <= t) { cout << t - sum; } else { cout << -1; } retur...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll t, n; cin >> t >> n; vector<ll> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } long sum = accumulate(v.begin(), v.end(), 0); if (sum <= t) { cout << t - sum; } else { cout << -1; } return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
106
n,_m = gets.strip.split.map(&:to_i) as= gets.strip.split.map(&:to_i) sum = 0 as.each do |i| sum += i end if sum >= 0 then puts n - sum else puts '-1' end
n,m = gets.strip.split.map(&:to_i) as= gets.strip.split.map(&:to_i) sum = 0 as.each do |i| sum += i end if (n - sum) >= 0 then puts n - sum else puts '-1' end
[["-", 36, 36, 0, 493, 0, 662, 31, 761, 0, 22], ["+", 36, 36, 0, 493, 0, 662, 31, 761, 0, 22], ["+", 0, 493, 0, 121, 15, 738, 31, 739, 0, 24], ["+", 0, 121, 15, 738, 31, 739, 0, 738, 31, 22], ["+", 0, 121, 15, 738, 31, 739, 0, 738, 17, 33], ["+", 0, 493, 0, 121, 15, 738, 31, 739, 0, 25]]
4
57
import numpy as np N, M = input().split() A=[int(x) for x in input().split()] if np.sum(A) < int(N): print(int(N)-np.sum(A)) else: print(-1)
import numpy as np N, M = input().split() A=[int(x) for x in input().split()] if np.sum(A) <= int(N): print(int(N)-np.sum(A)) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
67
#include <stdio.h> int main() { int n; //日数 int m; //宿題数 int a[10000]; //必要日数 int total = 0; //合計日数 int play = 0; //遊べる日数 scanf("%d&d", &n, &m); for (int i = 0; i < m; i++) { scanf("%d", &a[i]); } for (int j = 0; j < m; j++) { total += a[j]; } play = n - total; if (pla...
#include <stdio.h> int main() { int n; //日数 int m; //宿題数 int a[10000]; //必要日数 int total = 0; //合計日数 int play = 0; //遊べる日数 scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) { scanf("%d", &a[i]); } for (int j = 0; j < m; j++) { total += a[j]; } play = n - total; if (pl...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
134
n,m= map(int,input().split()) a=list(map(int, intput().split())) sum=0 for _ in range(len(a)): sum+=a[i] if sum>n: print("-1") else: print(n-sum)
n,m= map(int,input().split()) a=list(map(int, input().split())) sum=0 for i in range(len(a)): sum+=a[i] if sum>n: print("-1") else: print(n-sum)
[["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22]]
5
72
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define dl double long const int INF = 0x3fffffff; const ll MOD = 1000000007; const ll MODD = 998244353; #define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--) #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++) #d...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define dl double long const int INF = 0x3fffffff; const ll MOD = 1000000007; const ll MODD = 998244353; #define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--) #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++) #d...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
187
#include <iostream> using namespace std; int main() { int N, M, input, sum = 0; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> input; sum += input; } if (input > N) { cout << -1 << endl; } else { cout << N - sum << endl; } return 0; }
#include <iostream> using namespace std; int main() { int N, M, input, sum = 0; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> input; sum += input; } if (N - sum < 0) { cout << -1 << endl; } else { cout << N - sum << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
81
N,M = map(int,input().split(" ")) A = [int(e) for e in input().split(" ")] if N - sum(A) <= 0: print(-1) else: print(N - sum(A))
N,M = map(int,input().split(" ")) A = [int(e) for e in input().split(" ")] if N - sum(A) < 0: print(-1) else: print(N - sum(A))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
66
#先にAの合計値を出してもよい N, M = map(int, input().split()) A = list(map(int, input().split())) suma = sum(A) if N-suma>=0: print(N) else: print(-1)
#先にAの合計値を出してもよい N, M = map(int, input().split()) A = list(map(int, input().split())) suma = sum(A) if N-suma>=0: print(N-suma) else: print(-1)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
58
n = input().split(" ") a = input().split(" ") n[0] = int(n[0]) sum_HomeworkDays = 0 for i in a: sum_HomeworkDays += int(i) if n[0]-sum_HomeworkDays > 0: print(n[0]-sum_HomeworkDays) else: print("-1")
n = input().split(" ") a = input().split(" ") n[0] = int(n[0]) sum_HomeworkDays = 0 for i in a: sum_HomeworkDays += int(i) if n[0]-sum_HomeworkDays >= 0: print(n[0]-sum_HomeworkDays) else: print("-1")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
77
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int ara[1000]; for (int i = 1; i <= m; i++) { cin >> ara[i]; } int sum = 0; for (int i = 1; i <= m; i++) { sum = sum + ara[i]; } if (n >= sum) cout << n - sum << endl; else cout << "-1" << endl; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int ara[10000]; for (int i = 1; i <= m; i++) { cin >> ara[i]; } int sum = 0; for (int i = 1; i <= m; i++) { sum = sum + ara[i]; } if (n >= sum) cout << n - sum << endl; else cout << "-1" << endl; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
108
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout) using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout) using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
133
#include <iostream> #include <vector> using namespace std; #define rep(i, a, n) for (int i = a; i < (n); ++i) typedef long long ll; int main() { ll n, m; cin >> n >> m; ll SumOfWorkDays = 0; vector<int> a(m); rep(i, 0, m) { cin >> a[i]; SumOfWorkDays += a[i]; } if (n <= SumOfWorkDays) { p...
#include <iostream> #include <vector> using namespace std; #define rep(i, a, n) for (int i = a; i < (n); ++i) typedef long long ll; int main() { int n, m; cin >> n >> m; ll SumOfWorkDays = 0; vector<int> a(m); rep(i, 0, m) { cin >> a[i]; SumOfWorkDays += a[i]; } if (n >= SumOfWorkDays) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
110
// nani? #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update #define pi acos(-1); #define fs first #define sc second #define pb push_back #define mp make_pai...
// nani? #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update #define pi acos(-1); #define fs first #define sc second #define pb push_back #define mp make_pai...
[["+", 64, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
317
#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; } cout << max(-1, 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; } cout << max(-1, n); }
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22]]
1
59
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int sum = 0; for (int i = 0; i < n; i++) { int t; cin >> t; sum += t; } if (sum > n) cout << "-1"; else cout << n - sum; return 0; }
#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 t; cin >> t; sum += t; } if (sum > n) cout << "-1"; else cout << n - sum; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 57, 75, 76, 0, 1, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13]]
1
77
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long N; int M; cin >> N >> M; vector<unsigned long long> A(M); unsigned long long sum = 0; for (int i = 0; i < M; ++i) { cin >> A[i]; sum += A[i]; } if (N - sum > 0) { cout << N - sum; } else { cout << "-1"; } ...
#include <bits/stdc++.h> using namespace std; int main() { long long N; int M; cin >> N >> M; vector<long long> A(M); long long sum = 0; for (int i = 0; i < M; ++i) { cin >> A[i]; sum += A[i]; } if (N - sum >= 0) { cout << N - sum; } else { cout << -1; } }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["-", 39, 344, 3, 347, 0, 77, 39, 86, 0, 87], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 62]]
1
99
#include <bits/stdc++.h> using namespace std; int main() { long long N; int M; cin >> N >> M; vector<unsigned long long> A(M); long long sum = 0; for (int i = 0; i < M; ++i) { cin >> A[i]; sum += A[i]; } if (N - sum > 0) { cout << N - sum << endl; } else { cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { long long N; int M; cin >> N >> M; vector<unsigned long long> A(M); long long sum = 0; for (int i = 0; i < M; ++i) { cin >> A[i]; sum += A[i]; } if (N - sum >= 0) { cout << N - sum << endl; } else { cout << -1 << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
99
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { unsigned long long N; int M; cin >> N >> M; vector<unsigned long long> A(M); unsigned long long sum = 0; for (int i = 0; i < M; ++i) { cin >> A[i]; sum += A[i]; } if (N - sum > 0) { cout << N - sum; } else { ...
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { long long N; int M; cin >> N >> M; vector<long long> A(M); long long sum = 0; for (int i = 0; i < M; ++i) { cin >> A[i]; sum += A[i]; } if (N - sum >= 0) { cout << N - sum; } else { cout << "-1"; } }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["-", 39, 344, 3, 347, 0, 77, 39, 86, 0, 87], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
101
#include <iostream> using namespace std; int main(void) { // Your code here! int N, M; int A; cin >> N >> M; for (int i = 0; i << M; i++) { cin >> A; N = N - A; } if (N > 0) { cout << N; } else { cout << "-1"; } return 0; }
#include <iostream> using namespace std; int main(void) { // Your code here! int N, M; int A; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A; N = N - A; } if (N >= 0) { cout << N; } else { cout << "-1"; } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
78
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf("%d%d", &n, &m); int res = 0; for (int i = 0; i < m; i++) { int x; scanf("%d", &x); res += x; } if (res >= n) printf("%d", res); else puts("-1"); }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf("%d%d", &n, &m); int res = 0; for (int i = 0; i < m; i++) { int x; scanf("%d", &x); res += x; } if (res <= n) printf("%d", n - res); else puts("-1"); }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 33]]
1
91
N, M = map(int, input().split()) A = list(map(int, input().split())) print(N-sum(A) if N-sum(A)>0 else -1)
N, M = map(int, input().split()) A = list(map(int, input().split())) print(N-sum(A) if N-sum(A)>=0 else -1)
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 47], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 20]]
5
54
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long sum = 0, a; for (int i = 0; i < m; i++) { cin >> a; sum += a; } if (n - sum > 0) cout << n - sum << "\n"; else puts("-1"); }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long sum = 0, a; for (int i = 0; i < m; i++) { cin >> a; sum += a; } if (n - sum >= 0) cout << n - sum << "\n"; else puts("-1"); }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
81
#include <stdio.h> int main(void) { int n, m, sum = 0, i, x; scanf("%d%d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &x); sum += x; } if (n >= x) printf("%d", n - sum); else printf("-1"); return 0; }
#include <stdio.h> int main(void) { int n, m, sum = 0, i, x; scanf("%d%d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &x); sum += x; } if (n >= sum) printf("%d", n - sum); else printf("-1"); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22]]
0
92
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <numeric> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() int main() { int n, m; cin >> n >> m; vector<int> A(m); rep(i, n) cin >> A.at(i); int ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <numeric> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() int main() { int n, m; cin >> n >> m; vector<int> A(m); rep(i, m) cin >> A.at(i); int ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
117
n, m = map(int, input().split()) a = list(map(int, input().split())) ans = -1 t = n-sum(a) if t > 0: print(t) else: print(ans)
n, m = map(int, input().split()) a = list(map(int, input().split())) ans = -1 t = n-sum(a) if t >= 0: print(t) else: print(ans)
[["-", 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> //#include <ext/pb_ds/detail/standard_policies.hpp> const double pi = acos(-1.0); // memset ( a , 0 , n * sizeof(ll) ) ; using namespace std; // using namespace __gnu_pbds; #define endl '\n' #define sl(n) scanf("%lld", &n) #define mp make_pair #define pb push_back #define ppb pop_back #define ...
#include <bits/stdc++.h> //#include <ext/pb_ds/detail/standard_policies.hpp> const double pi = acos(-1.0); // memset ( a , 0 , n * sizeof(ll) ) ; using namespace std; // using namespace __gnu_pbds; #define endl '\n' #define sl(n) scanf("%lld", &n) #define mp make_pair #define pb push_back #define ppb pop_back #define ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
823
#include <iostream> #define ll long long using namespace std; int main() { ll n, m, sum; cin >> m >> n; sum = 0; for (int i = 0; i < n; i++) { ll x; cin >> x; sum += x; } if (sum > m) cout << -1 << endl; else cout << sum - m << endl; }
#include <iostream> #define ll long long using namespace std; int main() { ll n, m, sum; cin >> m >> n; sum = 0; for (int i = 0; i < n; i++) { ll x; cin >> x; sum += x; } if (sum > m) cout << -1 << endl; else cout << m - sum << endl; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
80
n, m = map(int, input().split()) l = sum(map(int, input().split())) print(n-s if s <= n else -1)
n, m = map(int, input().split()) s = sum(map(int, input().split())) print(n-s if s <= n else -1)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]]
5
46
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A[i]; } int ans = N - accumulate(A.begin(), A.end(), 0); cout << (ans > 0 ? ans : -1) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A[i]; } int ans = N - accumulate(A.begin(), A.end(), 0); cout << (ans >= 0 ? ans : -1) << endl; return 0; }
[["-", 31, 16, 12, 23, 0, 41, 15, 16, 17, 47], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 20]]
1
94
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, ans = 0; cin >> n, m; for (int i = 0; i < m; i++) { cin >> a; ans += a; } if (ans <= n) n -= ans; else n = -1; cout << n << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, ans = 0; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a; ans += a; } if (ans <= n) n -= ans; else n = -1; cout << n << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 34, 0, 21], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
77
//#include <fsociety> #include <algorithm> #include <cmath> #include <deque> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vector>...
//#include <fsociety> #include <algorithm> #include <cmath> #include <deque> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vector>...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
136
#include <bits/stdc++.h> /* #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctype.h> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> */ typedef struct llnode { int x; struct llnode *next;...
#include <bits/stdc++.h> /* #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctype.h> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> */ typedef struct llnode { int x; struct llnode *next;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
396
// inlclude前用define #define _USE_MATH_DEFINES // include #include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <type_traits> #include <vector> //#include<deque> #include <iomanip> #include <limits> #include <map> #include <set> #include <tuple> using namespace std; /...
// inlclude前用define #define _USE_MATH_DEFINES // include #include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <type_traits> #include <vector> //#include<deque> #include <iomanip> #include <limits> #include <map> #include <set> #include <tuple> using namespace std; /...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
157
N,M = map(int,input().split()) A = list(map(int,input().split())) ans = N - sum(A) if sum(A) < N: print(-1) else: print(ans)
N,M = map(int,input().split()) A = list(map(int,input().split())) ans = N - sum(A) if sum(A) > N: print(-1) else: print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
60
#include <bits/stdc++.h> using namespace std; #define REPEAT(i, N) for (int i = 0; i < (N); i++) int main() { int N, M; long long sum = 0; cin >> N >> M; REPEAT(i, N) { int _in; cin >> _in; sum += _in; } if (N < sum) { cout << -1 << endl; } else { cout << N - sum << endl; } ...
#include <bits/stdc++.h> using namespace std; #define REPEAT(i, N) for (int i = 0; i < (N); i++) int main() { int N, M; long long sum = 0; cin >> N >> M; REPEAT(i, M) { int _in; cin >> _in; sum += _in; } if (N < sum) { cout << -1 << endl; } else { cout << N - sum << endl; } ...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
84
#include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits.h> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #incl...
[["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22]]
1
170
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define sd(n) scanf("%d", &n) #define sdd(n, m) scanf("%d%d", &n, &m) #define sddd(n,...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define sd(n) scanf("%d", &n) #define sdd(n, m) scanf("%d%d", &n, &m) #define sddd(n,...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
604
A,B=map(int,input().split()) Lis=list(map(int,input().split())) if A>sum(Lis): print(A-sum(Lis)) else: print(-1)
A,B=map(int,input().split()) Lis=list(map(int,input().split())) if A>=sum(Lis): print(A-sum(Lis)) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
57
#include <iostream> #include <vector> using namespace std; int main(void) { int n, m; cin >> n >> m; vector<int> a(m); int sum = 0; for (int i = 0; i < m; i++) { cin >> a[i]; sum += a[i]; } int ans = min(-1, n - sum); cout << ans << endl; }
#include <iostream> #include <vector> using namespace std; int main(void) { int n, m; cin >> n >> m; vector<int> a(m); int sum = 0; for (int i = 0; i < m; i++) { cin >> a[i]; sum += a[i]; } int ans = max(-1, n - sum); cout << ans << endl; }
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
88
#include <algorithm> #include <climits> #include <cstdio> #include <iostream> #include <map> #include <unordered_map> #include <vector> using namespace std; using ll = long long; int main() { int n, m, sum = 0, t; cin >> n >> m; for (int i = 0; i < m; i++) { scanf("%d", &t); sum += t; } cout << (sum <...
#include <algorithm> #include <climits> #include <cstdio> #include <iostream> #include <map> #include <unordered_map> #include <vector> using namespace std; using ll = long long; int main() { int n, m, sum = 0, t; cin >> n >> m; for (int i = 0; i < m; i++) { scanf("%d", &t); sum += t; } cout << (sum <...
[["-", 0, 1, 0, 16, 12, 23, 0, 41, 75, 13], ["+", 0, 1, 0, 16, 12, 23, 0, 41, 75, 13]]
1
94
N,M = map(int,input().split(sep=" ")) A = list(map(int,input().split(sep=" "))) a_Sum = sum(A) if N-a_Sum > 0: print(N-a_Sum) else: print(-1)
N,M = map(int,input().split(sep=" ")) A = list(map(int,input().split(sep=" "))) a_Sum = sum(A) if N-a_Sum >= 0: print(N-a_Sum) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
69
t=list(map(int,input().split())) s=list(map(int,input().split())) temp = 0 for i in s: temp += i # print(temp) if(t[0]-temp>=0): print(s[0]-temp) else: print(-1)
t=list(map(int,input().split())) s=list(map(int,input().split())) temp = 0 for i in s: temp += i # print(temp) if(t[0]-temp>=0): print(t[0]-temp) else: print(-1)
[["-", 0, 652, 3, 4, 0, 657, 31, 206, 51, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 206, 51, 22]]
5
74
n,m = map(int,input().split()) li=list(map(int,input().split())) g=n-sum(li) if g>=0: return g else: return -1
n,m = map(int,input().split()) li=list(map(int,input().split())) g=n-sum(li) if g>=0: print(g) else: print(-1)
[["-", 0, 656, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 57, 75, 76, 8, 196, 0, 37, 0, 38], ["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196...
5
53
/* *****fireice**** */ #include <bits/stdc++.h> #define ll long long int #define ld long double #define vi vector<int> #define vc vector<char> #define vl vector<ll> #define vii vector<pair<int, int>> #define vll vector<pair<ll, ll>> #define pii pair<int, int> #define pb push_back #define eb emplace_back #define el '\...
/* *****fireice**** */ #include <bits/stdc++.h> #define ll long long int #define ld long double #define vi vector<int> #define vc vector<char> #define vl vector<ll> #define vii vector<pair<int, int>> #define vll vector<pair<ll, ll>> #define pii pair<int, int> #define pb push_back #define eb emplace_back #define el '\...
[["+", 8, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
891
n,m=map(int,input().split()) a=list(map(int,input().split())) print(n-sum(a))
n,m=map(int,input().split()) a=list(map(int,input().split())) print(max(-1,n-sum(a)))
[["+", 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], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25]]
5
42
#include <bits/stdc++.h> using namespace std; int main() { int N, M, sum; cin >> N >> M; sum = 0; vector<int> vec(M); for (int i = 0; i < M; i++) { cin >> vec.at(i); sum += vec.at(i); } if (N > sum) { cout << N - sum << endl; } else { cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N, M, sum; cin >> N >> M; sum = 0; vector<int> vec(M); for (int i = 0; i < M; i++) { cin >> vec.at(i); sum += vec.at(i); } 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
97
n,m=map(int(input().split())) print(max(-1,n-sum(list(map(int,input().split())))))
n,m=map(int,input().split()) print(max(-1,n-sum(list(map(int,input().split())))))
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
46
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long cnt = 0; for (int i = 0; i < m; i++) { int tmp; cin >> tmp; cnt += tmp; } if (n > cnt) cout << n - cnt; else cout << -1; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long cnt = 0; for (int i = 0; i < m; i++) { int tmp; cin >> tmp; cnt += tmp; } if (n >= cnt) cout << n - cnt; else cout << -1; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
73
#include <bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << ": " << x << endl int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<int> a(m); for (int &p : a) cin >> p; int s = accumulate(a.begin(), a.end(), 0); if (n - s > 0) cout << n - s << ...
#include <bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << ": " << x << endl int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<int> a(m); for (int &p : a) cin >> p; int s = accumulate(a.begin(), a.end(), 0); if (n - s >= 0) cout << n - s <<...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
113
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int N, M; int running_sum = 0; cin >> N >> M; while (M > 0) { int days; cin >> days; running_sum += days; M--; } if (N > running_sum) { cout << -1 << endl; } else { cout << N - running_sum << endl; ...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int N, M; int running_sum = 0; cin >> N >> M; while (M > 0) { int days; cin >> days; running_sum += days; M--; } if (N < running_sum) { cout << -1 << endl; } else { cout << N - running_sum << endl; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
81
d, n = map(int, input().split()) a = map(int, input().split()) remaining = d - sum(a) print(d if d >= 0 else -1)
d, n = map(int, input().split()) a = map(int, input().split()) remaining = d - sum(a) print(remaining if remaining >= 0 else -1)
[["-", 0, 1, 0, 652, 3, 4, 0, 41, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 41, 0, 22], ["-", 0, 652, 3, 4, 0, 41, 0, 666, 0, 22], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 0, 22]]
5
49
#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int totaldays = 0; int val; for (int i = 0; i < m; i++) { cin >> val; totaldays += val; } cout << (totaldays >= n ? -1 : n - totaldays); }
#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int totaldays = 0; int val; for (int i = 0; i < m; i++) { cin >> val; totaldays += val; } cout << (totaldays > n ? -1 : (n - totaldays)); }
[["-", 0, 16, 12, 23, 0, 41, 15, 16, 17, 20], ["+", 0, 16, 12, 23, 0, 41, 15, 16, 17, 47], ["+", 0, 16, 12, 23, 0, 41, 75, 23, 0, 24], ["+", 0, 16, 12, 23, 0, 41, 75, 23, 0, 25]]
1
69
#include <bits/stdc++.h> using namespace std; typedef long long ll; const long long MOD = 1000000007; long long modpow(long long a, long long n, long long m) { long long ans = 1; while (n) { if (n & 1) { ans = (ans * a) % m; } a = (a * a) % m; n >>= 1; } return ans; } long long combi(lon...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const long long MOD = 1000000007; long long modpow(long long a, long long n, long long m) { long long ans = 1; while (n) { if (n & 1) { ans = (ans * a) % m; } a = (a * a) % m; n >>= 1; } return ans; } long long combi(lon...
[["-", 31, 16, 12, 23, 0, 41, 15, 16, 17, 47], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 20]]
1
910