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; typedef long long ll; int main() { int N, M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) cin >> A[i]; sort(A.begin(), A.end()); ll sum = 0; for (int i = 0; i < M; i++) { sum += A[i]; } if (sum > N) { cout << -1 << endl; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N, M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) cin >> A[i]; sort(A.begin(), A.end()); ll sum = 0; for (int i = 0; i < M; i++) { sum += A[i]; } if (sum > N) { cout << -1 << endl; ...
[["+", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33]]
1
125
#include <iostream> using namespace std; int main() { int n; int m; int a[1000]; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a[i]; } int sum = 0; for (int i = 0; i < m; i++) { sum = sum + a[i]; } if (n - sum < 0) { cout << -1 << endl; } else { cout << n - sum << endl; ...
#include <iostream> using namespace std; int main() { int n; int m; int a[10000]; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a[i]; } int sum = 0; for (int i = 0; i < m; i++) { sum = sum + a[i]; } if (n - sum < 0) { cout << -1 << endl; } else { cout << n - sum << endl;...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
113
N,M=map(int,input().strip().split()) A=list(map(int,input().strip().split())) if sum(A)>41: print(-1) else: print(N-sum(A))
N,M=map(int,input().strip().split()) A=list(map(int,input().strip().split())) if sum(A)>N: print(-1) else: print(N-sum(A))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
65
#include <bits/stdc++.h> using namespace std; #define ll long long int #define fi first #define se second #define pb push_back #define MOD 1000000007 #define FOR(i, a, n) for (ll i = a; i <= n; i++) #define ROF(i, n, a) for (ll i = n; i >= a; i--) int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define fi first #define se second #define pb push_back #define MOD 1000000007 #define FOR(i, a, n) for (ll i = a; i <= n; i++) #define ROF(i, n, a) for (ll i = n; i >= a; i--) int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22]]
1
129
m, n = map(int, input().split()) l = [int(x) for x in input().split()] s = sum(l) if s > m: print(-1) print(m-s)
m, n = map(int, input().split()) l = [int(x) for x in input().split()] s = sum(l) if s > m: print(-1) else: print(m-s)
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
56
N, M = list(map(int, input().split(' '))) A = list(map(int, input().split(' '))) num = N - sum(A) if num >= 0: print(num) else: print(num)
N, M = list(map(int, input().split(' '))) A = list(map(int, input().split(' '))) num = N - sum(A) if num >= 0: print(num) else: print(-1)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
65
n,m= input().split() list = list(map(int,input().split())) sum = 0 for i in list: sum += i if sum>n: print("-1") else: print(n-sum)
n,m= map(int,input().split()) list = list(map(int,input().split())) sum = 0 for i in list: sum += i if sum>n: print("-1") else: print(n-sum)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
58
a = list(map(int,input().split())) b = list(map(int,input().split())) c = a[0]-sum(b) if c>0: print(c) else: print("-1")
a = list(map(int,input().split())) b = list(map(int,input().split())) c = a[0]-sum(b) if c>=0: print(c) else: print("-1")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
62
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <stdio.h> #include <string> #include <vector> #pragma warning(disable : 4996) #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main() { ll N, M; cin >> N >> M; vect...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <stdio.h> #include <string> #include <vector> #pragma warning(disable : 4996) #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; int main() { ll N, M; cin >> N >> M; vect...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20]]
1
129
#include <bits/stdc++.h> using namespace std; int main() { long int n, m; cin >> n >> m; vector<int> arr(m); long int sum = 0; for (int i = 0; i < m; i++) { cin >> arr[i]; sum += arr[i]; } if (sum < n) cout << -1 << "\n"; else cout << sum - n << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { long int n, m; cin >> n >> m; vector<long int> arr(m); long int sum = 0; for (int i = 0; i < m; i++) { cin >> arr[i]; sum += arr[i]; } if (sum > n) cout << -1 << "\n"; else cout << n - sum << "\n"; }
[["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 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
94
#include <bits/stdc++.h> #define pb push_back using namespace std; using ll = long long; constexpr int N = 200111; int n, t, m, x, sum; int main() { cin >> n >> m; for (int i = 0; i < m; ++i) { cin >> x; sum += x; } cout << n - sum << endl; }
#include <bits/stdc++.h> #define pb push_back using namespace std; using ll = long long; constexpr int N = 200111; int n, t, m, x, sum; int main() { cin >> n >> m; for (int i = 0; i < m; ++i) { cin >> x; sum += x; } cout << max(n - sum, -1) << endl; }
[["+", 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, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
76
#include <bits/stdc++.h> #define PI acos(-1) #define all(a) a.begin(), a.end() #define full(a, n) a, a + n #define ma(type, size) (type *)malloc(sizeof(type) * size) #define F first #define S second #define PB push_back #define PPB pop_back #define PF push_front #define PPF pop_front #define MP make_pair #define MT ma...
#include <bits/stdc++.h> #define PI acos(-1) #define all(a) a.begin(), a.end() #define full(a, n) a, a + n #define ma(type, size) (type *)malloc(sizeof(type) * size) #define F first #define S second #define PB push_back #define PPB pop_back #define PF push_front #define PPF pop_front #define MP make_pair #define MT ma...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
616
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(M); int days = 0; for (int i = 0; i < M; i++) { cin >> A.at(i); days = days + A.at(i); } if ((N - days) > 0) cout << N - days << endl; else cout << -1 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(M); int days = 0; for (int i = 0; i < M; i++) { cin >> A.at(i); days = days + A.at(i); } if ((N - days) >= 0) cout << N - days << 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
98
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++) int main() { int n, m; cin >> n >> m; vector<int> a(m); rep(i, m) cin >> a[i]; int suma = 0; rep(i, m) { suma += a[i]; } int ans = n - suma; if (ans < 0) ans == -1; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++) int main() { int n, m; cin >> n >> m; vector<int> a(m); rep(i, m) cin >> a[i]; int suma = 0; rep(i, m) { suma += a[i]; } int ans = n - suma; if (ans < 0) ans = -1; cout << ans << endl; }
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 17, 60], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32]]
1
97
n, m = map(int, input().split()) a = list(map(int, input().split())) b = sum(a) if b < n: print(n - b) else: print("-1")
n, m = map(int, input().split()) a = list(map(int, input().split())) b = sum(a) if b <= n: print(n - b) else: print("-1")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
58
#include <iostream> using namespace std; int main(void) { // Your code here! int N, M; int A; int sum = 0; scanf("%d %d", &N, &M); for (int i = 0; i < M; i++) { scanf("%d", &A); sum += A; } printf("%d\n", (sum < N) ? N - sum : -1); }
#include <iostream> using namespace std; int main(void) { // Your code here! int N, M; int A; int sum = 0; scanf("%d %d", &N, &M); for (int i = 0; i < M; i++) { scanf("%d", &A); sum += A; } printf("%d\n", (sum <= N) ? N - sum : -1); }
[["-", 3, 4, 0, 41, 15, 23, 0, 16, 17, 18], ["+", 3, 4, 0, 41, 15, 23, 0, 16, 17, 19]]
1
90
NM = list(map(int,input().split())) A = list(map(int,input().split())) sumA = sum(A) bj = -1 if sumA >= 0: print(NM[0]-sumA) else: print(bj)
NM = list(map(int,input().split())) A = list(map(int,input().split())) sumA = sum(A) bj = -1 if NM[0]-sumA >= 0: print(NM[0]-sumA) else: print(bj)
[["+", 0, 57, 15, 666, 0, 657, 31, 206, 51, 22], ["+", 0, 57, 15, 666, 0, 657, 31, 206, 0, 70], ["+", 0, 57, 15, 666, 0, 657, 31, 206, 206, 612], ["+", 0, 57, 15, 666, 0, 657, 31, 206, 0, 73], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33]]
5
64
#include <bits/stdc++.h> #include <sstream> #define ll long long int #include <stdlib.h> #include <vector> #define pi acos(-1) #define maxm 100005 #define pb push_back #define MOD 1e9 + 7 #define highest(x) numeric_limits<x>::max() #define lowest(x) numeric_limits<x>::min() /// s1.substr(1,3);///STARTING FROM INDEX 1, ...
#include <bits/stdc++.h> #include <sstream> #define ll long long int #include <stdlib.h> #include <vector> #define pi acos(-1) #define maxm 100005 #define pb push_back #define MOD 1e9 + 7 #define highest(x) numeric_limits<x>::max() #define lowest(x) numeric_limits<x>::min() /// s1.substr(1,3);///STARTING FROM INDEX 1, ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
1,004
#include <iostream> using namespace std; int main() { long N, M; cin >> N >> M; long A[10005]; for (long i = 0; i < M; i++) { cin >> A[i]; } long sum = 0; for (long i = 0; i < M; i++) { sum += A[i]; } if ((N - sum) > 0) cout << N - sum << endl; else cout << "-1" << endl; }
#include <iostream> using namespace std; int main() { long N, M; cin >> N >> M; long A[10005]; for (long i = 0; i < M; i++) { cin >> A[i]; } long sum = 0; for (long i = 0; i < M; 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
107
#include <bits/stdc++.h> using namespace std; int main() { int days, n; cin >> days >> n; int ans = 0; ; while (n--) { int a; cin >> a; ans += a; } if (days - ans > 0) cout << days - ans << endl; else cout << -1 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int days, n; cin >> days >> n; int ans = 0; ; while (n--) { int a; cin >> a; ans += a; } if (days - ans >= 0) cout << days - 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
70
#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]; N = N - a[i]; } if (N < 0) { cout << 0 << endl; } else { cout << N << endl; } }
#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]; N = N - a[i]; } if (N < 0) { cout << -1 << endl; } else { cout << N << endl; } }
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
87
//#include <sstream> //#include <fstream> //#include <deque> //#include <queue> //#include <stack> //#include <set> //#include <list> //#include <map> //#include <unordered_map> //#include <functional> //#include <utility> //#include <bitset> //#include <cstdlib> //#include <ctime> //#include <cstdio> #include <iostre...
//#include <sstream> //#include <fstream> //#include <deque> //#include <queue> //#include <stack> //#include <set> //#include <list> //#include <map> //#include <unordered_map> //#include <functional> //#include <utility> //#include <bitset> //#include <cstdlib> //#include <ctime> //#include <cstdio> #include <iostre...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
163
#include <bits/stdc++.h> #define rep(i, n) for (i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; #define MOD 1000000007 #define PI 3.14159265359 int main() { ll N, M, sum = 0, a, i, ans; cin >> N >> M; rep(i, M) { cin >> a; sum += a; } if (sum >= N) { ans...
#include <bits/stdc++.h> #define rep(i, n) for (i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, int> P; #define MOD 1000000007 #define PI 3.14159265359 int main() { ll N, M, sum = 0, a, i, ans; cin >> N >> M; rep(i, M) { cin >> a; sum += a; } if (sum > N) { ans ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
107
n,m = list(map(int, input().split())) hoge = list(map(int, input().split())) wa = sum(hoge) if wa >= n: print(-1) else: print(n - wa)
n,m = list(map(int, input().split())) hoge = list(map(int, input().split())) wa = sum(hoge) if wa > n: print(-1) else: print(n - wa)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
60
#include <iostream> using namespace std; int main() { int n, m, a; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a; n -= a; } if (a < 0) { cout << -1 << endl; } else { cout << n << endl; } return 0; }
#include <iostream> using namespace std; int main() { 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; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
75
n, m = input().split() days = list(map(int, input().split())) if n < sum(days): print("-1") else: print(int(n) - sum(days))
n, m = input().split() days = list(map(int, input().split())) if int(n) < sum(days): print("-1") else: print(int(n) - sum(days))
[["+", 0, 656, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
56
#include <math.h> #include <stdbool.h> #include <stdio.h> #include <string.h> int main() { int N, M; scanf("%d %d", &N, &M); int A[10010]; int total_a = 0; for (int i = 0; i < M; i++) { scanf("%d", A[i]); total_a += A[i]; } if (total_a > N) { printf("-1"); } else { printf("%d", N - to...
#include <math.h> #include <stdbool.h> #include <stdio.h> #include <string.h> int main() { int N, M; scanf("%d %d", &N, &M); int A[10010]; int total_a = 0; for (int i = 0; i < M; i++) { scanf("%d", &A[i]); total_a += A[i]; } if (total_a > N) { printf("-1"); } else { printf("%d", N - t...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
0
110
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define EPS (1e-10) #define REP(i...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define EPS (1e-10) #define REP(i...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
203
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define ll long long int #define endl "\n" #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NU...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define ll long long int #define endl "\n" #define FASTIO \ ios_base::sync_with_stdio(false); \ cin.tie(NU...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
105
#include <cmath> #include <cstdio> #include <iostream> using namespace std; #define PI 3.1415926535 int main() { int n, m; cin >> n >> m; int res = 0; while (m--) { int t; cin >> t; res += t; } if (res < n) cout << n - res; else cout << -1; return 0; }
#include <cmath> #include <cstdio> #include <iostream> using namespace std; #define PI 3.1415926535 int main() { int n, m; cin >> n >> m; int res = 0; while (m--) { int t; cin >> t; res += t; } if (res <= n) cout << n - res; else cout << -1; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
73
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> p_ll; typedef vector<pair<ll, ll>> vec_p; // vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i) #define REP(i, x) for (ll i = 0; i < (ll)(x); i++) #define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++) #define R...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> p_ll; typedef vector<pair<ll, ll>> vec_p; // vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i) #define REP(i, x) for (ll i = 0; i < (ll)(x); i++) #define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++) #define R...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
259
#include <stdio.h> int main(void) { int a, b; scanf("%d %d", &a, &b); while (b-- > 0) { int temp; scanf("%d", &temp); if (a - temp < 0) { printf("1\n"); return 0; } a -= temp; } printf("%d\n", a); return 0; }
#include <stdio.h> int main(void) { int a, b; scanf("%d %d", &a, &b); while (b-- > 0) { int temp; scanf("%d", &temp); if (a - temp < 0) { printf("-1\n"); return 0; } a -= temp; } printf("%d\n", a); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
87
#include <iostream> #include <stdlib.h> #include <string> using namespace std; int main() { int n, m, A[1000], ans; cin >> n >> m; ans = n; for (int i = 0; i < m; i++) { cin >> A[i]; ans = ans - A[i]; } if (ans < 0) ans = -1; cout << ans; return 0; }
#include <iostream> #include <stdlib.h> #include <string> using namespace std; int main() { int n, m, A[10000], ans; cin >> n >> m; ans = n; for (int i = 0; i < m; i++) { cin >> A[i]; ans = ans - A[i]; } if (ans < 0) ans = -1; cout << ans; return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
87
n,m = map(int,input().split(" ")) days = list(map(int, input().split(" "))) day = n - sum(days) if day > 0: print(day) else: print(-1)
n,m = map(int,input().split(" ")) days = list(map(int, input().split(" "))) day = n - sum(days) if day >= 0: print(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
# abc136 n,m = map(int,input().split()) days = list(map(int,input().split())) ans = n - sum(days) if ans < 0: ans = 0 print(ans)
# abc136 n,m = map(int,input().split()) days = list(map(int,input().split())) ans = n - sum(days) if ans < 0: ans = -1 print(ans)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 28, 612]]
5
54
#include <bits/stdc++.h> using namespace std; int main() { int sum, n; cin >> sum >> n; int temp; for (int i = 0; i < n; i++) { cin >> temp; sum -= temp; } if (sum < 0) sum = 0; cout << sum; }
#include <bits/stdc++.h> using namespace std; int main() { int sum, n; cin >> sum >> n; int temp; for (int i = 0; i < n; i++) { cin >> temp; sum -= temp; } if (sum < 0) sum = -1; cout << sum; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
64
#include <stdio.h> int main(void) { long long n, m, sum = 0; scanf("%lld %lld", &m, &n); for (int i = 1; i <= n; i++) { long long tmp; scanf("%lld", &tmp); sum += tmp; } if (m <= sum) printf("-1\n"); else printf("%lld\n", m - sum); }
#include <stdio.h> int main(void) { long long n, m, sum = 0; scanf("%lld %lld", &m, &n); for (int i = 1; i <= n; i++) { long long tmp; scanf("%lld", &tmp); sum += tmp; } if (m < sum) printf("-1\n"); else printf("%lld\n", m - sum); }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
93
N,M = map(int,input().split()) day_list = input().split() t = 0 for A in day_list: t += A if N - t < 0: print(-1) else: print(N - t)
N,M = map(int,input().split()) day_list = input().split() t = 0 for A in day_list: t += int(A) if N - t < 0: print(-1) else: print(N - t)
[["+", 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
56
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define YES puts("YES") #define Yes puts("Yes") #define NO puts("NO") #define No puts("No") #define ALL(v) (v).begin(), (v).end() int gcd(int a, int b) { return b ? gcd(b, a % b) : a...
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define YES puts("YES") #define Yes puts("Yes") #define NO puts("NO") #define No puts("No") #define ALL(v) (v).begin(), (v).end() int gcd(int a, int b) { return b ? gcd(b, a % b) : a...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
836
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, m, a, s; s = 0; cin >> n >> m; while (m--) { cin >> a; s = s + a; } if (s >= n) { cout << -1 << endl; } else { cout << n - s << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, m, a, s; s = 0; cin >> n >> m; while (m--) { cin >> a; s = s + a; } if (s > n) { cout << -1 << endl; } else { cout << n - s << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
91
#include <algorithm> #include <chrono> #include <cstdlib> #include <functional> #include <iostream> #include <numeric> #include <omp.h> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef unsigned long long ull; typedef long long ll; constexpr double PI ...
#include <algorithm> #include <chrono> #include <cstdlib> #include <functional> #include <iostream> #include <numeric> #include <omp.h> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef unsigned long long ull; typedef long long ll; constexpr double PI ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
123
#include <bits/stdc++.h> #include <map> #include <math.h> using namespace std; #define ll long long #define INF 99999999 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() int main() { int N, M, A; cin >> N >> M; rep(i, M) { cin >> A; N -= A; } if (N <= 0)...
#include <bits/stdc++.h> #include <map> #include <math.h> using namespace std; #define ll long long #define INF 99999999 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() int main() { int N, M, A; cin >> N >> M; rep(i, M) { cin >> A; N -= A; } if (N < 0) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
88
#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); } for (int i = 0; i < M; i++) { sum += A.at(i); } if (N > sum) { cout << N - sum << endl; } else { cout << "-1" << ...
#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); } for (int i = 0; i < M; i++) { sum += A.at(i); } if (N >= sum) { cout << N - sum << endl; } else { cout << "-1" <<...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
117
#include <bits/stdc++.h> using namespace std; class gfg { /* Function to get no of set bits in binary representation of passed binary no. */ public: unsigned int countSetBits(int n) { unsigned int count = 0; while (n) { n &= (n - 1); count++; } return count; } } g; vector<long long>...
#include <bits/stdc++.h> using namespace std; class gfg { /* Function to get no of set bits in binary representation of passed binary no. */ public: unsigned int countSetBits(int n) { unsigned int count = 0; while (n) { n &= (n - 1); count++; } return count; } } g; vector<long long>...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
1,695
'use strict'; const p = s => console.log(s); // inputに入力データ全体が入る function Main(input) { // 1行目がinput[0], 2行目がinput[1], …に入る input = input.split("\n"); let N = input[0].split(" ")[0]; let M = input[0].split(" ")[1]; let A = input[1].split(" "); let max, sum = 0; for (let i = 0; i < A.length; i++) { s...
'use strict'; const p = s => console.log(s); // inputに入力データ全体が入る function Main(input) { // 1行目がinput[0], 2行目がinput[1], …に入る input = input.split("\n"); let N = input[0].split(" ")[0]; let M = input[0].split(" ")[1]; let A = input[1].split(" "); let max, sum = 0; for (let i = 0; i < A.length; i++) { s...
[["-", 0, 435, 8, 556, 0, 1, 0, 2, 63, 22], ["-", 8, 556, 0, 1, 0, 2, 3, 3, 0, 24], ["-", 8, 556, 0, 1, 0, 2, 3, 3, 0, 22], ["-", 8, 556, 0, 1, 0, 2, 3, 3, 0, 25], ["-", 0, 493, 0, 435, 8, 556, 0, 1, 0, 35]]
2
181
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> // 追加1 #include <fstream> using namespace std; typedef long lon...
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> // 追加1 #include <fstream> using namespace std; typedef long lon...
[["-", 0, 14, 8, 9, 0, 1, 0, 34, 0, 21], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
168
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; using ld = long double; int main() { int n, m; cin >> n >> m; ll sum = 0; rep(i, m) { int k; cin >> k; sum += k; } if (sum >= n) cout << -1 << endl; else if (sum < n) ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; using ld = long double; int main() { int n, m; cin >> n >> m; ll sum = 0; rep(i, m) { int k; cin >> k; sum += k; } if (sum > n) cout << -1 << endl; else if (sum <= n) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19]]
1
101
#include <stdio.h> int main(void) { int N, M, A[10001], i, sum = 0, ans; scanf("%d %d", &N, &M); for (i = 0; i < M; i++) { scanf("%d", &A[i]); sum = A[i]; } ans = N - sum; if (ans < 0) printf("-1\n"); else printf("%d\n", ans); return 0; }
#include <stdio.h> int main(void) { int N, M, A[10001], i, sum = 0, ans; scanf("%d %d", &N, &M); for (i = 0; i < M; i++) { scanf("%d", &A[i]); sum += A[i]; } ans = N - sum; if (ans < 0) printf("-1\n"); else printf("%d\n", ans); return 0; }
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107]]
0
109
#include <algorithm> #include <iomanip> #include <iostream> #include <queue> #include <vector> using namespace std; int main() { int n, m, ans = 0, sum = 0; cin >> n >> m; vector<int> a(1000000000); for (int i = 0; i < m; i++) { cin >> a[i]; sum += a[i]; } if (n < sum) { ans = -1; } else { ...
#include <algorithm> #include <iomanip> #include <iostream> #include <queue> #include <vector> using namespace std; int main() { int n, m, ans = 0, sum = 0; cin >> n >> m; vector<int> a(10000000); for (int i = 0; i < m; i++) { cin >> a[i]; sum += a[i]; } if (n < sum) { ans = -1; } else { ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
108
#include <algorithm> #include <functional> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; const double PI = 3.14159265358979323846; int main() { int N, M, a = 0; vector<int> A; cin >> N >> M; A.resize(M); for (int i = 0; i < M; i++) { cin >> A[i]; } ...
#include <algorithm> #include <functional> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; const double PI = 3.14159265358979323846; int main() { int N, M, a = 0; vector<int> A; cin >> N >> M; A.resize(M); for (int i = 0; i < M; i++) { cin >> A[i]; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
129
#include <bits/stdc++.h> #include <numeric> using namespace std; int main() { int N, M, sum; cin >> N >> M; sum = 0; for (int i = 0; i < N; i++) { int a; cin >> a; sum = sum + a; } if (N - sum >= 0) { cout << N - sum; } else { cout << -1; } }
#include <bits/stdc++.h> #include <numeric> using namespace std; int main() { int N, M, sum; cin >> N >> M; sum = 0; for (int i = 0; i < M; i++) { int a = 0; cin >> a; sum = sum + a; } if ((N - sum) >= 0) { cout << N - sum; } else { cout << -1; } }
[["-", 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, 43, 49, 50, 0, 32], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 25]]
1
83
import numpy as np def solve(): return n - np.sum(a) n, m = [int(i) for i in input().split(" ")] a = [int(i) for i in input().split(" ")] print(solve())
import numpy as np def solve(): return max(n - np.sum(a), -1) n, m = [int(i) for i in input().split(" ")] a = [int(i) for i in input().split(" ")] print(solve())
[["+", 0, 14, 8, 196, 0, 37, 0, 652, 63, 22], ["+", 8, 196, 0, 37, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 37, 0, 652, 3, 4, 0, 21], ["+", 0, 37, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 37, 0, 652, 3, 4, 0, 664, 28, 612]]
5
68
/* * a.cpp * * Created on: 2019/06/08 * Author: MEIP-users */ #include <algorithm> #include <bits/stdc++.h> #include <cstring> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> using...
/* * a.cpp * * Created on: 2019/06/08 * Author: MEIP-users */ #include <algorithm> #include <bits/stdc++.h> #include <cstring> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> using...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
148
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) s = a.inject(:+) if s >= n puts -1 else puts n-s end
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) s = a.inject(:+) if s > n puts -1 else puts n-s end
[["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 20], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 47]]
4
45
#include "bits/stdc++.h" using namespace std; int main() { int N, M; long long COUNT = 0; cin >> N >> M; vector<long long> A(M); for (int i = 0; i < M; i++) cin >> A[i], COUNT += A[i]; if (COUNT < N) cout << N - COUNT << endl; else cout << -1 << endl; }
#include "bits/stdc++.h" using namespace std; int main() { int N, M; long long COUNT = 0; cin >> N >> M; vector<long long> A(M); for (int i = 0; i < M; i++) cin >> A[i], COUNT += A[i]; if (COUNT <= N) cout << N - COUNT << 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
90
#include <cstdio> using namespace std; int n, m, a, s; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < m; ++i) { scanf("%d", &a); s += a; } if (n < a) printf("-1\n"); else printf("%d\n", n - s); return 0; }
#include <cstdio> using namespace std; int n, m, a, s; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < m; ++i) { scanf("%d", &a); s += a; } if (n < s) printf("-1\n"); else printf("%d\n", n - s); return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
94
N,M=map(int,input().split()) A=list(map(int,input().split())) Ans=0 for i in A: Ans=Ans+i if N<=Ans: print(-1) else: print(N-Ans)
N,M=map(int,input().split()) A=list(map(int,input().split())) Ans=0 for i in A: Ans=Ans+i if N<Ans: print(-1) else: print(N-Ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
64
n,m = map(int,input().split()) a = list(map(int,input().split())) if sum(a) >= n: print(-1) else: print(n-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))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
57
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N, M; int count = 0; cin >> N >> M; rep(i, M) { int x; count += x; } if (N < count) cout << -1; else cout << N - count; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N, M; int count = 0; cin >> N >> M; rep(i, M) { int x; cin >> x; count += x; } if (N < count) cout << -1; else cout << N - count; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 14, 8, 9, 0, 1, 0, 35]]
1
68
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, M; cin >> N >> M; ll ans = N; ll a; rep(i, M) { cin >> a; ans -= a; } if (N < 0) { ans = -1; } cout << ans ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, M; cin >> N >> M; ll ans = N; ll a; rep(i, M) { cin >> a; ans -= a; } if (ans < 0) { ans = -1; } cout << an...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
97
import sys, re import math from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul # from copy import deepcopy from string import ascii_lowercase, ...
import sys, re import math from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul # from copy import deepcopy from string import ascii_lowercase, ...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
206
#include <bits/stdc++.h> using namespace std; signed main() { int n, m; cin >> n >> m; int sum = 0; for (int i = 0; i < n; ++i) { int x; cin >> x; sum += x; } if (sum > n) cout << "-1\n"; else cout << n - sum << '\n'; }
#include <bits/stdc++.h> using namespace std; signed main() { int n, m; cin >> n >> m; int sum = 0; for (int i = 0; i < m; ++i) { int x; cin >> x; sum += x; } if (sum > n) cout << "-1\n"; else cout << n - sum << '\n'; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
79
package main import "fmt" func main() { var n, m int fmt.Scan(&n, &m) var a, sum int for i := 0; i < m; i++ { fmt.Scan(&a) sum += a } if m-sum > 0 { fmt.Println(-1) return } fmt.Println(n - sum) }
package main import "fmt" func main() { var n, m int fmt.Scan(&n, &m) var a, sum int for i := 0; i < m; i++ { fmt.Scan(&a) sum += a } if n-sum < 0 { fmt.Println(-1) return } fmt.Println(n - sum) }
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 0, 435, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 17, 18]]
7
92
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ll n, m; cin >> n >> m; vector<ll> vec(m + 1, 0); ll sum = 0; for (ll i = 1; i <= m; i++) { cin >> vec[i]; sum += vec[i]; } ll ans = n - sum; if (ans < 0) { cout << -1 << endl; } else { cout << sum << ...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ll n, m; cin >> n >> m; vector<ll> vec(m + 1, 0); ll sum = 0; for (ll i = 1; i <= m; i++) { cin >> vec[i]; sum += vec[i]; } ll ans = n - sum; if (ans < 0) { cout << -1 << endl; } else { cout << ans << ...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
104
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int A[1100000]; int sum = 0; for (int i = 1; i <= M; i++) { int x; cin >> x; A[i] = x; sum += x; } if (N > sum) cout << -1 << endl; else cout << N - sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int A[1100000]; int sum = 0; for (int i = 1; i <= M; i++) { int x; cin >> x; A[i] = x; sum += x; } if (N < sum) cout << -1 << endl; else cout << N - sum << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
89
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define pb push_back #define mp make_pair #define ...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define pb push_back #define mp make_pair #define ...
[["-", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22]]
1
172
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { long long int nn, mm, tmp, sum = 0; scanf("%lld %lld", &nn, &mm); for (int ii = 0; ii < mm; ii++) { scanf("%lld", &tmp); sum += tmp; } printf("%lld\n", (sum < 0 ? (-1) : (nn - sum))); return 0; }
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { long long int nn, mm, tmp, sum = 0; scanf("%lld %lld", &nn, &mm); for (int ii = 0; ii < mm; ii++) { scanf("%lld", &tmp); sum += tmp; } printf("%lld\n", ((nn - sum) < 0 ? (-1) : (nn - sum))); return 0; }
[["+", 0, 23, 0, 41, 15, 16, 31, 23, 0, 24], ["+", 0, 41, 15, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 41, 15, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 23, 0, 41, 15, 16, 31, 23, 0, 25]]
0
97
#include <bits/stdc++.h> using namespace std; int main() { long long N, M, studyDay, studyTime; cin >> N >> M; studyDay = 0; for (int i = 0; i < M; i++) { cin >> studyTime; studyDay += studyTime; } if (N < studyTime) { cout << "-1" << endl; } else { cout << N - studyTime << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { long long N, M, studyDay, studyTime; cin >> N >> M; studyDay = 0; for (int i = 0; i < M; i++) { cin >> studyTime; studyDay += studyTime; } if (N < studyDay) { cout << "-1" << endl; } else { cout << N - studyDay << endl; } }
[["-", 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, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
83
N, M = map(int, input().split()) A = sum(map(int, input().split())) print(N - A) if N - A >= 0 else print(0)
N, M = map(int, input().split()) A = sum(map(int, input().split())) print(N - A) if N - A >= 0 else print(-1)
[["-", 0, 1, 0, 41, 0, 652, 3, 4, 0, 612], ["+", 0, 41, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 41, 0, 652, 3, 4, 0, 664, 28, 612]]
5
50
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define N (1000000000 + 7) #define M (998244353) #define INF 1e16 typedef long long ll; typedef pai...
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define N (1000000000 + 7) #define M (998244353) #define INF 1e16 typedef long long ll; typedef pai...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339...
1
129
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; int tot = 0; for (int i = 0; i < m; ++i) { int x; cin >> x; tot += x; } if (n > tot) { cout << n - tot << endl; } else { cout << -1 <...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; int tot = 0; for (int i = 0; i < m; ++i) { int x; cin >> x; tot += x; } if (n >= tot) { cout << n - tot << endl; } else { cout << -1 ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
102
import math import operator as op from functools import reduce def ncr(n, r): r = min(r, n-r) numer = reduce(op.mul, range(n, n-r, -1), 1) denom = reduce(op.mul, range(1, r+1), 1) return numer / denom """ int(input()) map(int,input().split()) list(map(int,input().split())) """ t...
import math import operator as op from functools import reduce def ncr(n, r): r = min(r, n-r) numer = reduce(op.mul, range(n, n-r, -1), 1) denom = reduce(op.mul, range(1, r+1), 1) return numer / denom """ int(input()) map(int,input().split()) list(map(int,input().split())) """ t...
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20]]
5
150
#include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define lli l...
#include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define lli l...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
288
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define se second #define fi first #define ll long long int #define INF INT_MAX #define mod #define chutiyaap \ ios_base::sync_with_stdio(false); \...
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define se second #define fi first #define ll long long int #define INF INT_MAX #define mod #define chutiyaap \ ios_base::sync_with_stdio(false); \...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33]]
1
98
def solution(): return 1 def main(): N , M = list(map(int , input().split())) assignments = list(map(int , input().split())) for a in assignments: N -= a if N < 0: N = 0 print(N) if __name__ == "__main__": main()
def solution(): return 1 def main(): N , M = list(map(int , input().split())) assignments = list(map(int , input().split())) for a in assignments: N -= a if N < -1: N = -1 print(N) if __name__ == "__main__": main()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 664, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 664, 28, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 28, 612]]
5
78
#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 (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 sum = 0; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A.at(i); sum += A.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
96
n,m = map(int(input().split())) a = list(map(int,input().split())) sum = sum(a) if n-sum >= 0: print(n-sum) else: print(-1)
n,m = map(int,input().split()) a = list(map(int,input().split())) sum = sum(a) if n-sum >= 0: print(n-sum) else: print(-1)
[["-", 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
60
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define sz(a) (int)a.size() #define de(a) cout << #a << " = " << a << endl #define dd(a)...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define sz(a) (int)a.size() #define de(a) cout << #a << " = " << a << endl #define dd(a)...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
187
tot , n = list( map ( int ,input().split())) a = list( map( int , input().split())) if tot >= a.sum(): print(tot -a.sum()) else: print(-1)
tot , n = list( map ( int ,input().split())) a = list( map( int , input().split())) if tot >= sum(a): print(tot -sum(a)) else: print(-1)
[["-", 0, 57, 15, 666, 0, 652, 63, 319, 500, 22], ["-", 0, 57, 15, 666, 0, 652, 63, 319, 0, 131], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["-", 3, 4, 0, 657, 12, 652, 63, 319, 500, 22], ["-", 3, 4, 0, 657, 12, 652, 63, 319, 0, 131], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 22]]
5
62
import sys import math input = sys.stdin.readline n, m = map(int, input().split()) A = [int(i) for i in input().split()] del A[m:len(A)] print(n - sum(A)) if sum(A) < n else print(-1)
import sys input = sys.stdin.readline n, m = map(int, input().split()) A = [int(i) for i in input().split()] del A[m:len(A)] print(n - sum(A)) if sum(A) <= n else print(-1)
[["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 0, 656, 0, 1, 0, 41, 0, 666, 667, 18], ["+", 0, 656, 0, 1, 0, 41, 0, 666, 667, 19]]
5
77
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
[["+", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 62]]
1
155
#include <algorithm> #include <bitset> #include <chrono> #include <cmath> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> #def...
#include <algorithm> #include <bitset> #include <chrono> #include <cmath> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> #def...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
206
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, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
60
#include <bits/stdc++.h> using namespace std; int A[10005]; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); long long n, m; cin >> n >> m; long long total = 0; for (int i = 0; i < n; ++i) { cin >> A[i]; total += A[i]; } total = n - total; if (total...
#include <bits/stdc++.h> using namespace std; int A[10005]; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); long long n, m; cin >> n >> m; long long total = 0; for (int i = 0; i < m; ++i) { cin >> A[i]; total += A[i]; } total = n - total; if (total...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
100
#include <iostream> int main() { long long int n, m; std::cin >> n >> m; long long int sum = 0; for (int i = 1; i <= m; ++i) { int a; std::cin >> a; sum += a; } if (n >= m) { std::cout << n - sum << std::endl; } else { std::cout << -1 << std::endl; } return 0; }
#include <iostream> int main() { long long int n, m; std::cin >> n >> m; long long int sum = 0; for (int i = 1; i <= m; ++i) { int a; std::cin >> a; sum += a; } if (n >= sum) { std::cout << n - sum << std::endl; } else { std::cout << -1 << std::endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
95
n,m = map(int, input().split()) l = list(map(int, input().split())) if(sum(l)<n): print(-1) else: print(n-sum(l))
n,m = map(int, input().split()) l = list(map(int, input().split())) if(sum(l)>n): print(-1) else: print(n-sum(l))
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 18], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 47]]
5
59
#include <bits/stdc++.h> #define MOD (long long)(1E9 + 7) #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; long long extgcd(long long a) { long long b = MOD; long long u = 1, v = 0, q; while (b > 0) { q = a / b; a -= q * b; swap(a, b); u -= q * v; swap(u, v); } u %= MOD...
#include <bits/stdc++.h> #define MOD (long long)(1E9 + 7) #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; long long extgcd(long long a) { long long b = MOD; long long u = 1, v = 0, q; while (b > 0) { q = a / b; a -= q * b; swap(a, b); u -= q * v; swap(u, v); } u %= MOD...
[["-", 31, 16, 12, 23, 0, 41, 15, 16, 17, 19], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 18]]
1
254
#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 << sum; else cout << n - sum; } /* #include <bits/stdc++.h> using namespace std; int main() { int r; cin >...
#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 << "-1"; else cout << n - sum; } /* #include <bits/stdc++.h> using namespace std; int main() { int r; cin ...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 62], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6]]
1
73
#include <bits/stdc++.h> #define reb(i, b, n) for (int i = (int)(b); i < (int)(n); i++) #define rep(i, n) reb(i, 0, n) #define rreb(i, b, n) for (int i = b - 1; i >= n; i--) #define rrep(i, n) reb(i, n, 0) #define each(it, v) \ for (__typeof((v).begin()) it ...
#include <bits/stdc++.h> #define reb(i, b, n) for (int i = (int)(b); i < (int)(n); i++) #define rep(i, n) reb(i, 0, n) #define rreb(i, b, n) for (int i = b - 1; i >= n; i--) #define rrep(i, n) reb(i, n, 0) #define each(it, v) \ for (__typeof((v).begin()) it ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
503
N,M=map(int,input().split()) A=list(map(int,input().split())) homework=0 for a in A: homework+=a if N>homework: print(N-homework) else: print(-1)
N,M=map(int,input().split()) A=list(map(int,input().split())) homework=0 for a in A: homework+=a if N>=homework: print(N-homework) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
62
N,M = 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))
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21]]
5
58
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); i++) #define all(n) begin(n), end(n) using ll = long long; using P = pair<int, int>; int main() { int n, m; cin >> n >> m; int sum = 0; rep(i, m) { int a; cin >> a; sum += a; } if (su...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (n); i++) #define all(n) begin(n), end(n) using ll = long long; using P = pair<int, int>; int main() { int n, m; cin >> n >> m; int sum = 0; rep(i, m) { int a; cin >> a; sum += a; } if (su...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13]]
1
103
import math def ii(): return int(input()) def mi(): return map(int, input().split()) def li(): return list(mi()) n,m = mi() a = li() if (sum(a) - n < 0): print("-1") else: print(n - sum(a))
import math def ii(): return int(input()) def mi(): return map(int, input().split()) def li(): return list(mi()) n,m = mi() a = li() if (n - sum(a) < 0): print("-1") else: print(n - sum(a))
[["+", 0, 57, 15, 23, 0, 666, 0, 657, 31, 22], ["+", 0, 57, 15, 23, 0, 666, 0, 657, 17, 33], ["-", 0, 57, 15, 23, 0, 666, 0, 657, 17, 33], ["-", 0, 57, 15, 23, 0, 666, 0, 657, 12, 22]]
5
85
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using namespace std; int main(void) { int M, N; ll sum = 0; cin >> N >> M; vector<int> A(M); rep(i, M) { cin >> A[i]; sum += A[i]; } ...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using namespace std; int main(void) { ll M, N; ll sum = 0; cin >> N >> M; vector<int> A(M); rep(i, M) { cin >> A[i]; sum += A[i]; } ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 31, 16, 12, 23, 0, 41, 15, 16, 17, 18], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 19]]
1
101
// In the name of god #include <bits/stdc++.h> #pragma GCC optimze("02") using ll = long long; using namespace std; const ll maxn = 1e5 + 5; ll n, m, sum, a; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n >> m; while (m--) { cin >> a; sum += a; } if (sum > n) { cout <<...
// In the name of god #include <bits/stdc++.h> #pragma GCC optimze("02") using ll = long long; using namespace std; const ll maxn = 1e5 + 5; ll n, m, sum, a; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n >> m; while (m--) { cin >> a; sum += a; } if (sum > n) { cout <<...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13]]
1
101
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> // Common file //#include <ext/pb_ds/tree_policy.hpp> // Including //tree_order_statistics_node_update using namespace std; // using namespace __gnu_pbds; // typedef tree< pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, // tree_order_sta...
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> // Common file //#include <ext/pb_ds/tree_policy.hpp> // Including //tree_order_statistics_node_update using namespace std; // using namespace __gnu_pbds; // typedef tree< pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, // tree_order_sta...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
184
import math S = list(map(int,input().split())) N = S[0] M = S[1] A = list(map(int,input().split())) ans = N-sum(A) if ans <= 0: ans = -1 print(ans)
import math S = list(map(int,input().split())) N = S[0] M = S[1] A = list(map(int,input().split())) ans = N-sum(A) if ans < 0: ans = -1 print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
69
n, m = map(int, input().split()) aa = list(map(int, input().split())) print(min(-1,n - sum(aa)))
n, m = map(int, input().split()) aa = list(map(int, input().split())) print(max(-1,n - sum(aa)))
[["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22]]
5
48
#include <algorithm> #include <climits> #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define lrep(i, n, m) for (int i = n; i < m; i++) typedef long long ll; const int MAX = INT_MAX; int main() { int n, m; cin >> n >> m; vector<int> ...
#include <algorithm> #include <climits> #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define lrep(i, n, m) for (int i = n; i < m; i++) typedef long long ll; const int MAX = INT_MAX; int main() { int n, m; cin >> n >> m; vector<int> ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
122
n,m = gets.split(" ").map(&:to_i) line = gets.split(" ").map(&:to_i) puts n - line.sum > 0 ? n - line.sum : -1
n,m = gets.split(" ").map(&:to_i) line = gets.split(" ").map(&:to_i) p n - line.sum >= 0 ? n - line.sum : -1
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 0, 652, 3, 4, 0, 754, 15, 738, 17, 47], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 17, 20]]
4
51