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 int ll; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() int main() { int n, m, ans; cin >> n >> m; ans = n; rep(i, m) { int tmp; cin >> tmp; ans -= tmp; } if (n < 0) { cout << -1 << endl; } els...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() int main() { int n, m, ans; cin >> n >> m; ans = n; rep(i, m) { int tmp; cin >> tmp; ans -= tmp; } if (ans < 0) { cout << -1 << endl; } e...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
91
#include <bits/stdc++.h> #define int long long #define mod 1000000007 #define trace(x) cerr << #x << ": " << x << " " << endl #define tarce(x) cerr << #x << ": " << x << " " << endl #define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl #define trace3(x, y, z) ...
#include <bits/stdc++.h> #define int long long #define mod 1000000007 #define trace(x) cerr << #x << ": " << x << " " << endl #define tarce(x) cerr << #x << ": " << x << " " << endl #define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl #define trace3(x, y, z) ...
[["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 13]]
1
221
n, m = map(int, input().split()) a = [int(i) for i in input().split()] ans = n - sum(a) if n >= 0: print(ans) else: print(-1)
n, m = map(int, input().split()) a = [int(i) for i in input().split()] ans = n - sum(a) if ans >= 0: print(ans) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
58
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; #define fori(x) for (int i = 0; i < x; ++i) #define forj(x) for (int j = 0; j < x; ++j) int main() { int n, m; cin >> n >> m; fori(m) { int hoge; cin >> hoge; n -= ...
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; #define fori(x) for (int i = 0; i < x; ++i) #define forj(x) for (int j = 0; j < x; ++j) int main() { int n, m; cin >> n >> m; fori(m) { int hoge; cin >> hoge; n -= ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
84
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repbtw(i, a, b) for (int i = a; i <= (int)(b); i++) #define all(v) v.begin(), v.end() #define pr(x) cout << x << endl int main() { int n, m; cin >> n, m; int sum = 0; rep(i, m) { int a; cin >> a; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repbtw(i, a, b) for (int i = a; i <= (int)(b); i++) #define all(v) v.begin(), v.end() #define pr(x) cout << x << endl int main() { int n, m; cin >> n >> m; int sum = 0; rep(i, m) { int a; cin >> a...
[["-", 0, 14, 8, 9, 0, 1, 0, 34, 0, 21], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
103
#include <iostream> using namespace std; int main() { int N, M; int A[10000]; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A[i]; } for (int j = 0; j < N; j++) { N -= A[j]; } if (N >= 0) { cout << N; } else { cout << -1; } return 0; }
#include <iostream> using namespace std; int main() { int N, M; int A[10000]; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A[i]; } for (int j = 0; j < M; j++) { N -= A[j]; } if (N >= 0) { cout << N; } else { cout << -1; } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
97
def b163(n, m, al): return n - sum(al) if n - sum(al) < 0 else "-1" def main(): n , m = map(int, input().split()) al = list(map(int, input().split())) print(b163(n, m, al)) if __name__ == '__main__': main()
def b163(n, m, al): return n - sum(al) if n - sum(al) >= 0 else "-1" def main(): n , m = map(int, input().split()) al = list(map(int, input().split())) print(b163(n, m, al)) if __name__ == '__main__': main()
[["-", 8, 196, 0, 37, 0, 41, 0, 666, 667, 18], ["+", 8, 196, 0, 37, 0, 41, 0, 666, 667, 20]]
5
89
#include <algorithm> #include <iostream> #include <math.h> #include <string.h> using namespace std; int main() { int N, M, A[10000], SUM = 0; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A[i]; SUM += A[i]; } if (SUM < 0) cout << -1 << endl; else cout << N - SUM << endl; return 0; ...
#include <algorithm> #include <iostream> #include <math.h> #include <string.h> using namespace std; int main() { int N, M, A[10000], SUM = 0; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A[i]; SUM += A[i]; } if (N - SUM < 0) cout << -1 << endl; else cout << N - SUM << endl; return...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33]]
1
92
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vl; typedef vector<string> vs; typedef vector<char> vc; typedef queue<ll> ql; typedef deque<ll> dql; typedef priority_queue<ll, vl /*, greater<ll>*/> pql; //降順(/*昇順*/) typedef set<ll> sl; #define rep(i, n)...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vl; typedef vector<string> vs; typedef vector<char> vc; typedef queue<ll> ql; typedef deque<ll> dql; typedef priority_queue<ll, vl /*, greater<ll>*/> pql; //降順(/*昇順*/) typedef set<ll> sl; #define rep(i, n)...
[["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22]]
1
278
N, M = map(int, input().split()) print(max(N - sum([int(x) for x in input.split()]), -1))
N, M = map(int, input().split()) print(max(N - sum([int(x) for x in input().split()]), -1))
[["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25]]
5
44
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m, s = 0, i; cin >> m >> n; while (n--) { cin >> i; s += i; } if (s < m) cout << m - s; else cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m, s = 0, i; cin >> m >> n; while (n--) { cin >> i; s += i; } if (s <= m) cout << m - s; 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
85
n,m = map(int,input().split()) ls = list(map(int,input().split())) if sum(ls) < n: print(n-sum(ls)) else: print("-1")
n,m = map(int,input().split()) ls = list(map(int,input().split())) if sum(ls) <= n: print(n-sum(ls)) 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 <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define INF = numeric_limits<long long>::max(); int main() { int n, m; cin >> n >> m; vector<int> a(m); for (auto &e : a) cin >> e; if (n > accumulate(a.begin(), a.end(), 0)) { cout << n - accumulate(a.begin...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define INF = numeric_limits<long long>::max(); int main() { int n, m; cin >> n >> m; vector<int> a(m); for (auto &e : a) cin >> e; if (n >= accumulate(a.begin(), a.end(), 0)) { cout << n - accumulate(a.begi...
[["-", 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, 31, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
110
N,b=map(int,input().split()) a_list=list(map(int,input().split())) s=0 for a in a_list: s+=a if N-s <0: ans=0 else: ans=N-s print(ans)
N,b=map(int,input().split()) a_list=list(map(int,input().split())) s=0 for a in a_list: s+=a if N-s <0: ans=-1 else: ans=N-s 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
65
#include <bits/stdc++.h> #define REP(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define REPV(iter, v) \ for (auto(iter) = (v).begin(); (iter) != (v).end(); ++(iter)) #define ALL(v) (v).begin(), (v).end() #define MOD 1000000007 using namespace std; typedef lon...
#include <bits/stdc++.h> #define REP(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define REPV(iter, v) \ for (auto(iter) = (v).begin(); (iter) != (v).end(); ++(iter)) #define ALL(v) (v).begin(), (v).end() #define MOD 1000000007 using namespace std; typedef lon...
[["-", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22]]
1
121
#include <bits/stdc++.h> using namespace std; typedef long long lli; #define mod 1000000007 #define mod2 998244353 #define fori(n) for (int i = 0; i < n; i++) #define forj(n) for (int j = 0; j < n; j++) #define pb push_back #define mp make_pair #define F first #define S second #define fast ios::sync_with_stdio(0), cin....
#include <bits/stdc++.h> using namespace std; typedef long long lli; #define mod 1000000007 #define mod2 998244353 #define fori(n) for (int i = 0; i < n; i++) #define forj(n) for (int j = 0; j < n; j++) #define pb push_back #define mp make_pair #define F first #define S second #define fast ios::sync_with_stdio(0), cin....
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
356
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back //#define gcd __gcd //#define lcm(a, b) ((a) * (b) / gcd((a), b)) #define all(x) x.begin(), x.end() #define rep(i, x, n) for (ll...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back //#define gcd __gcd //#define lcm(a, b) ((a) * (b) / gcd((a), b)) #define all(x) x.begin(), x.end() #define rep(i, x, n) for (ll...
[["-", 0, 1, 0, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 13]]
1
191
#define rep(i, n) for (ll i = 0; i < n; i++) #include "bits/stdc++.h" using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, m; cin >> n >> m; int ans = n; rep(i, m) { int a; cin >> a; ans -= a; } if (ans >= 0) cout << ans << endl; else cout << ans <<...
#define rep(i, n) for (ll i = 0; i < n; i++) #include "bits/stdc++.h" using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, m; cin >> n >> m; int ans = n; rep(i, m) { int a; cin >> a; ans -= a; } if (ans >= 0) cout << ans << endl; else cout << -1 << ...
[["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 13]]
1
95
n,m = map(int,input().split()) a = list(map(int,input().split())) print(n-sum(a) if n>sum(a) else -1)
n,m = map(int,input().split()) a = list(map(int,input().split())) print(n-sum(a) if n>=sum(a) else -1)
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 47], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 20]]
5
52
#include <bits/stdc++.h> using namespace std; #define ll long long void testcase() {} int main() { int n, m; cin >> n >> m; vector<int> time; for (int i = 0; i < m; i++) { int cur; cin >> cur; time.push_back(cur); } for (int i = 0; i < m; i++) { n -= time[i]; } if (n < 0) cout << "...
#include <bits/stdc++.h> using namespace std; #define ll long long void testcase() {} int main() { int n, m; cin >> n >> m; vector<int> time; for (int i = 0; i < m; i++) { int cur; cin >> cur; time.push_back(cur); } for (int i = 0; i < m; i++) { n -= time[i]; } if (n < 0) cout << "...
[["+", 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
110
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int s = 0; for (int i = 0; i < n; i++) { int x; cin >> x; s += x; } int rem = n - s; if (rem < 0) cout << -1; else cout << rem; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int s = 0; for (int i = 0; i < m; i++) { int x; cin >> x; s += x; } int rem = n - s; if (rem < 0) cout << -1; else cout << rem; return 0; }
[["-", 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 <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> using namespace std; typedef long long ll; const int MAXN = 1e5 + 10; int main() { ll n, m; scanf("%lld %lld", &n, &m); ll sum = 0; for (ll i = 1; i <= m; i++) { ll val; scanf("%lld", &val); sum += val; } ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> using namespace std; typedef long long ll; const int MAXN = 1e5 + 10; int main() { ll n, m; scanf("%lld %lld", &n, &m); ll sum = 0; for (ll i = 1; i <= m; i++) { ll val; scanf("%lld", &val); sum += val; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
119
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; #define pb push_back #define mp make_pair #define f0(i,...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; #define pb push_back #define mp make_pair #define f0(i,...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
231
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, n) for (ll i = (s); i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() int main() { cin.tie(0); ios::sync_with_stdio(false); string s; ll n, m; cin >> n >> m; ll sum = 0; vector<ll> a...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, n) for (ll i = (s); i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() int main() { cin.tie(0); ios::sync_with_stdio(false); string s; ll n, m; cin >> n >> m; ll sum = 0; vector<ll> a...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
132
n, m = map(int, input().split()) a = list(map(int, input().split())) b = sum(a) print(n-b if n>b else -1)
n, m = map(int, input().split()) a = list(map(int, input().split())) b = sum(a) print(n-b if n>=b else -1)
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 47], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 20]]
5
52
#include <bits/stdc++.h> using namespace std; int main() { int n, m, sum = 0; cin >> n >> m; vector<int> a(m); for (int i = 0; i < m; i++) { cin >> a[i]; sum += a[i]; } int ans = n - sum; if (sum < 0) sum = -1; cout << sum; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m, sum = 0; cin >> n >> m; vector<int> a(m); for (int i = 0; i < m; i++) { cin >> a[i]; sum += a[i]; } int ans = n - sum; if (ans < 0) ans = -1; cout << ans; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
87
a,b=map(int,input().split) c=input().split() l=[] for i in c: l.append(int(i)) if sum(l)>a: print(-1,end="") else: print(a-sum(l),end="")
a,b=map(int,input().split()) c=input().split() l=[] for i in c: l.append(int(i)) if sum(l)>a: print(-1,end="") else: print(a-sum(l),end="")
[["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
75
def main(N, M, A): memo = N - sum(A) if memo >= 0: return memo else: return memo if __name__ == '__main__': N, M = list(map(int, input().split())) A = list(map(int, input().split())) # N = 314 # M = 15 # A = list(map(int, "9 26 5 35 8 9 79 3 23 8 46 2 6 43 3".split())) ...
def main(N, M, A): memo = N - sum(A) if memo >= 0: return memo else: return -1 if __name__ == '__main__': N, M = list(map(int, input().split())) A = list(map(int, input().split())) # N = 314 # M = 15 # A = list(map(int, "9 26 5 35 8 9 79 3 23 8 46 2 6 43 3".split())) ...
[["-", 0, 57, 75, 76, 8, 196, 0, 37, 0, 22], ["+", 75, 76, 8, 196, 0, 37, 0, 664, 17, 33], ["+", 75, 76, 8, 196, 0, 37, 0, 664, 28, 612]]
5
87
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <math.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(m); int ans = 0; for (int i = 0; i < m; i++) { cin >> a.at(i); ans +=...
#include <algorithm> #include <cmath> #include <iostream> #include <stdio.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <math.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(m); int ans = 0; for (int i = 0; i < m; i++) { cin >> a.at(i); ans +=...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
112
n,m=(int(i) for i in input().split()) l=[int(i) for i in input().split()] if(sum(l)>=m): print(n-sum(l)) else: print(-1)
n,m=(int(i) for i in input().split()) l=[int(i) for i in input().split()] if(sum(l)<=n): print(n-sum(l)) else: print(-1)
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 20], ["-", 0, 656, 0, 57, 15, 23, 0, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 19], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 0, 22]]
5
64
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n, m; int sum = 0; int aa; int a[1005]; scanf("%d %d", &n, &m); for (int i = 0; i < m; i++) { scanf("%d", &a[i]); } for (int i = 0; i < m; i++) { sum = sum + a[i]; } aa = n - sum; if (aa >...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n, m; int sum = 0; int aa; int a[100005]; scanf("%d %d", &n, &m); for (int i = 0; i < m; i++) { scanf("%d", &a[i]); } for (int i = 0; i < m; i++) { sum = sum + a[i]; } aa = n - sum; if (aa...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
136
#include <stdio.h> #include <stdlib.h> int main() { unsigned long N, M, i; unsigned long A; scanf("%ld %ld", &N, &M); for (i = 0; i < M; i++) { scanf("%ld", &A); N = N - A; if (N < 0) { printf("-1"); return 0; } } printf("%ld", N); return 0; }
#include <stdio.h> #include <stdlib.h> int main() { long N, M, i; long A; scanf("%ld %ld", &N, &M); for (i = 0; i < M; i++) { scanf("%ld", &A); N = N - A; if (N < 0) { printf("-1"); return 0; } } printf("%ld", N); return 0; }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87]]
1
96
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n, m, a[10000]; int i; long long int sum = 0; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); sum += a[i]; } if (sum < n) { printf("%lld", sum - n); } else { printf("...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n, m, a[10000]; int i; long long int sum = 0; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); sum += a[i]; } if (sum <= n) { printf("%lld", n - sum); } else { printf(...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["-", 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]]
0
115
#include <bits/stdc++.h> int main() { int n, nAss; scanf("%d %d", &n, &nAss); int sum = 0; for (int i = 0; i < nAss; i++) { int t; scanf("%d", &t); sum += t; } if (sum > n) { printf("0"); } else { printf("%d", n - sum); } return 0; }
#include <bits/stdc++.h> int main() { int n, nAss; scanf("%d %d", &n, &nAss); int sum = 0; for (int i = 0; i < nAss; i++) { int t; scanf("%d", &t); sum += t; } if (sum > n) { printf("-1"); } else { printf("%d", n - sum); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
96
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int sum = 0; for (int i = 1; i <= m; i++) { int x; cin >> x; sum += x; } 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; for (int i = 1; i <= m; i++) { int x; cin >> x; sum += x; } 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
78
n, m = map(int, input().split()) a = map(int, input().split()) check = n - sum(list(a)) if check > 0: print(check) else: print(-1)
n, m = map(int, input().split()) a = map(int, input().split()) check = n - sum(list(a)) if check >= 0: print(check) 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 <algorithm> #include <iostream> using namespace std; long long n, m, a[100005]; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i]; m = m - a[i]; } if (m >= 0) cout << m; else cout << "-1"; }
#include <algorithm> #include <iostream> using namespace std; long long n, m, a[100005]; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i]; n = n - a[i]; } if (n >= 0) cout << n; else cout << "-1"; }
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 64, ...
1
80
N, M = [int(s) for s in input().split()] A = [int(s) for s in input().split()] days = N - sum(A) days = -1 if days < 0 else -1 print(days)
N, M = [int(s) for s in input().split()] A = [int(s) for s in input().split()] days = N - sum(A) days = '-1' if days < 0 else days print(days)
[["-", 0, 1, 0, 662, 12, 41, 0, 664, 17, 33], ["-", 0, 1, 0, 662, 12, 41, 0, 664, 28, 612], ["+", 0, 1, 0, 662, 12, 41, 0, 557, 0, 654], ["+", 0, 1, 0, 662, 12, 41, 0, 557, 0, 6], ["+", 0, 1, 0, 662, 12, 41, 0, 557, 0, 655], ["+", 0, 656, 0, 1, 0, 662, 12, 41, 0, 22]]
5
61
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(x) (x).begin(), (x).end() #define SIZE(x) ((int)(x).size()) #define MAX(x) *max_element(ALL(x)) #define INF 1000000000000 // 10^12 #define MOD 10000007 // 10^9+7 #define root sqrt using namespace std; using vi = vector<int>; using...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(x) (x).begin(), (x).end() #define SIZE(x) ((int)(x).size()) #define MAX(x) *max_element(ALL(x)) #define INF 1000000000000 // 10^12 #define MOD 10000007 // 10^9+7 #define root sqrt using namespace std; using vi = vector<int>; using...
[["-", 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, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33]]
1
264
#include <bits/stdc++.h> using namespace std; int ans, sum, n, m, a[10000]; int main() { cin >> n >> m; for (int i = 0; i < m; ++i) { cin >> a[i]; sum += a[i]; } if (n - m < 0) { cout << -1 << endl; return 0; } cout << n - sum << endl; }
#include <bits/stdc++.h> using namespace std; int ans, sum, n, m, a[10000]; int main() { cin >> n >> m; for (int i = 0; i < m; ++i) { cin >> a[i]; sum += a[i]; } if (n - sum < 0) { cout << -1 << endl; return 0; } cout << n - sum << endl; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
89
#include <iostream> using namespace std; #define ll long long int #define FIO \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie...
#include <iostream> using namespace std; #define ll long long int #define FIO \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
140
#include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (ll i = 0; i < (n); ++i) int main() { int n, m; cin >> n >> m; ll sum = 0; rep(i, m) { ll num; cin >> num; sum += num; } if (n - s...
#include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (ll i = 0; i < (n); ++i) int main() { int n, m; cin >> n >> m; ll sum = 0; rep(i, m) { ll num; cin >> num; sum += num; } if (n - s...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
103
N, M = map(int, input().split()) A = [int(a) for a in input().split()] asum = sum(A) if N > asum: print(N - asum) else: print(-1)
N, M = map(int, input().split()) A = [int(a) for a in input().split()] asum = sum(A) if N >= asum: print(N - asum) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
58
// #include <bits/stdc++.h> #include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> typedef long long ll; typedef unsigned long long ull; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i...
// #include <bits/stdc++.h> #include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> typedef long long ll; typedef unsigned long long ull; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22]]
1
350
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { int n, m; cin >> n >> m; vector<int> a(m); for (int i = 0; i < m; ++i) cin >> a[i]; int total = accumulat...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { int n, m; cin >> n >> m; vector<int> a(m); for (int i = 0; i < m; ++i) cin >> a[i]; int total = accumulat...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
156
n,m=map(int,input()) a=list(map(int,input().split())) b=sum(a) print(max(-1,n-b))
n,m=map(int,input().split()) a=list(map(int,input().split())) b=sum(a) print(max(-1,n-b))
[["+", 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
47
N, M = map(int, input().split()) A = list(map(int, input().split())) ans = N - sum(A) print(ans)
N, M = map(int, input().split()) A = list(map(int, input().split())) ans = max(N - sum(A), -1) print(ans)
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 662, 12, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 664, 28, 612]]
5
45
#include <bits/stdc++.h> #define endl '\n' #define ll long long #define double long double using namespace std; ll sum, x, n, m; int main() { // freopen("input.txt", "r", stdin); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> x; sum += x...
#include <bits/stdc++.h> #define endl '\n' #define ll long long #define double long double using namespace std; ll sum, x, n, m; int main() { // freopen("input.txt", "r", stdin); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> x; sum += x...
[["+", 0, 57, 75, 76, 0, 1, 0, 16, 31, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 16, 17, 151]]
1
100
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n, m; cin >> n >> m; ll sum = 0; for (int i = 0; i < m; i++) { ll x; cin >> x; sum += x; } if (sum < n) { cout << n - sum << endl; } e...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n, m; cin >> n >> m; ll sum = 0; for (int i = 0; i < m; i++) { ll x; cin >> x; sum += x; } if (sum <= n) { cout << n - sum << endl; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
107
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.b...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.b...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
648
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n; cin >> n; int m; cin >> m; rep(i, m) { int y; cin >> y; n -= y; } if (n < 0) cout << -1 << endl; else cout << m << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n; cin >> n; int m; cin >> m; rep(i, m) { int y; cin >> y; n -= y; // cout << n << endl; } if (n < 0) cout << -1 << endl; else cout << n << endl; }
[["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22]]
1
72
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef unsigned long long int ull; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define N 100010 #define M 200010 #define A 110 #define endl "\n" #define mod 1000000007 int main() { ios_base::sync_with_stdio...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef unsigned long long int ull; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define N 100010 #define M 200010 #define A 110 #define endl "\n" #define mod 1000000007 int main() { ios_base::sync_with_stdio...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
164
//#pragma GCC optimize("O3") //#pragma comment(linker, "/STACK:1024000000,1024000000") #include <bits/stdc++.h> using namespace std; function<void(void)> ____ = []() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); }; using LL = int_fast64_t; LL n, m; int main() { ____(); cin >> n >> m; LL sum =...
//#pragma GCC optimize("O3") //#pragma comment(linker, "/STACK:1024000000,1024000000") #include <bits/stdc++.h> using namespace std; function<void(void)> ____ = []() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); }; using LL = int_fast64_t; LL n, m; int main() { ____(); cin >> n >> m; LL 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, 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
127
n, m=map(int, input().split()) a = list(map(int, input().split())) ans = n - sum(a) if 0 < ans: print(ans) else: print('-1')
n, m=map(int, input().split()) a = list(map(int, input().split())) ans = n - sum(a) if 0 <= ans: print(ans) 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
N, M = map(int,input().split()) A = list(map(int,input().split())) print(min(-1,(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, 1, 0, 652, 3, 4, 0, 652, 63, 22]]
5
50
n, m = map(int, input().split()) a = sum(list(map(int, input().split()))) if n > a: print(n-a) else: print(-1)
n, m = map(int, input().split()) a = sum(list(map(int, input().split()))) if n >= a: print(n-a) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
54
N, M = map(int, input().split()) A = list(map(int, input().split())) if N - sum(set(A)) >= 0: print(N - sum(set(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, 657, 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, 25], ["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 24]]
5
65
n, m = map(int, input().split()) a = list(map(int, input().split())) if n > sum(a): print(n-sum(a)) else: print('-1')
n, m = map(int, input().split()) a = list(map(int, input().split())) if n >= sum(a): print(n-sum(a)) else: print('-1')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
58
N, M = map(int, input().split()) A = list(map(int, input().split())) print(N - sum(A) if N - sum(A) > 0 else 0)
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], ["-", 0, 1, 0, 652, 3, 4, 0, 41, 0, 612], ["+", 0, 652, 3, 4, 0, 41, 0, 664, 17, 33], ["+", 0, 652, 3, 4, 0, 41, 0, 664, 28, 612]]
5
53
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")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
60
/** If comrades that you trust gather around you, hope can take physical form and become visible. That’s what I believe. */ #include <bits/stdc++.h> using namespace std; /** (▀̿Ĺ̯▀̿ ̿) (ง ͠° ͟ل͜ ͡°)ง */ const int N = 1e4 + 7; int a[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int tt = clock(); ...
/** If comrades that you trust gather around you, hope can take physical form and become visible. That’s what I believe. */ #include <bits/stdc++.h> using namespace std; /** (▀̿Ĺ̯▀̿ ̿) (ง ͠° ͟ل͜ ͡°)ง */ const int N = 1e4 + 7; int a[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int tt = clock(); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
153
import sys import re 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, ascii_upp...
import sys import re 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, ascii_upp...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612]]
5
228
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n, m; cin >> n >> m; for (int i = 0; i < m; i++) { ll tp; cin >> tp; n = n - tp; } if (n <= 0) cout << -1 << endl; else cout << n << endl; }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n, m; cin >> n >> m; for (int i = 0; i < m; i++) { ll tp; cin >> tp; n = n - tp; } 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
74
#!/usr/bin/env python3 N, M = map(int, input().split()) A = list(map(int, input().split())) print(N - sum(A))
#!/usr/bin/env python3 N, M = map(int, input().split()) A = list(map(int, input().split())) print(max(N - sum(A), -1))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612]]
5
43
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int temp; cin >> temp; n -= temp; } cout << n << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int temp; cin >> temp; n -= temp; } cout << max(n, -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
56
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; // using P = pair<int,int>; // pow(x,n) // cout << fixed << setprecision(桁数); // string = to_string(数値) // int = stoi(文字列) //(int)(char-'0') // string = itoa(int) int main() { /*int n; cin >> n; cout...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; // using P = pair<int,int>; // pow(x,n) // cout << fixed << setprecision(桁数); // string = to_string(数値) // int = stoi(文字列) //(int)(char-'0') // string = itoa(int) int main() { /*int n; cin >> n; cout...
[["-", 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], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 13]]
1
98
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define int long long using namespace std; typedef long double ld; typedef pair<int, int> pa; typedef long long ll; const int mod = 998244353, N = 1e5; const ld pi = 3.1415926535; signed main(...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define int long long using namespace std; typedef long double ld; typedef pair<int, int> pa; typedef long long ll; const int mod = 998244353, N = 1e5; const ld pi = 3.1415926535; signed main(...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 75, 76, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 75, 76, 0, 1, 0, 16, 12, 16, 31, 22]]
1
154
/*{{{*/ #include <bits/stdc++.h> #define SZ(X) ((int)(X).size()) #define ALL(X) (X).begin(), (X).end() #define REP(I, N) for (int I = 0; I < (N); ++I) #define REPP(I, A, B) for (int I = (A); I < (B); ++I) #define FOR(I, A, B) for (int I = (A); I <= (B); ++I) #define FORS(I, S) for (int I = 0; S[I]; ++I) #define RS(X) s...
/*{{{*/ #include <bits/stdc++.h> #define SZ(X) ((int)(X).size()) #define ALL(X) (X).begin(), (X).end() #define REP(I, N) for (int I = 0; I < (N); ++I) #define REPP(I, A, B) for (int I = (A); I < (B); ++I) #define FOR(I, A, B) for (int I = (A); I <= (B); ++I) #define FORS(I, S) for (int I = 0; S[I]; ++I) #define RS(X) s...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13]]
1
713
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int m, n; cin >> m >> n; for (int i = 0; i < n; ++i) { int x; cin >> x; m -= x; } cout << min(m, (int)-1); }
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int m, n; cin >> m >> n; for (int i = 0; i < n; ++i) { int x; cin >> x; m -= x; } cout << max(m, (int)-1); }
[["-", 8, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 2, 63, 22]]
1
79
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> typedef long long ll; #define all(x) (x).begin(), (x).end() // sortなどの引数を省略 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define max3(x, y, z) max(x, max(y, z)) #i...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> typedef long long ll; #define all(x) (x).begin(), (x).end() // sortなどの引数を省略 #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define max3(x, y, z) max(x, max(y, z)) #i...
[["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]]
1
164
s = input().split(" ") N = int(s[0]) M = s[1] s = input().split(" ") A = [] sum = 0 for w in s: A.append(int(w)) sum += int(w) if sum >= N: print(N - sum) else: print(-1)
s = input().split(" ") N = int(s[0]) M = s[1] s = input().split(" ") A = [] sum = 0 for w in s: A.append(int(w)) sum += int(w) if sum <= N: print(N - sum) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
84
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < int(n); i++) using namespac...
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < int(n); i++) using namespac...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
239
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m; cin >> n >> m; int s = 0, a; rep(i, n) { cin >> a; s += a; } cout << max(-1, n - s); }
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m; cin >> n >> m; int s = 0, a; rep(i, m) { cin >> a; s += a; } cout << max(-1, n - s); }
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
71
n,m=gets.split.map(&:to_i) a=gets.split.map(&:to_i) puts n-a.sum>0 ? n-a.sum : -1
n,m=gets.split.map(&:to_i) a=gets.split.map(&:to_i) puts n-a.sum>=0 ? n-a.sum : -1
[["-", 0, 652, 3, 4, 0, 754, 15, 738, 17, 47], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 17, 20]]
4
41
def main(): N, M = map(int, input().split()) A = list(map(int, input().split())) if N - sum(A) > 0: return N - sum(A) else: return -1 print(main()) #if main(): # print('Yes') #else: # print('No')
def main(): N, M = map(int, input().split()) A = list(map(int, input().split())) if N - sum(A) >= 0: return N - sum(A) else: return -1 print(main()) #if main(): # print('Yes') #else: # print('No')
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20]]
5
70
LI = lambda: list(map(int,input().split())) MI = lambda: map(int,input().split()) yes = lambda: print("YES") no = lambda: print("NO") I = lambda: list(input()) J = lambda x: "".join(x) II = lambda: int(input()) SI = lambda: input() #---khan17---template n,m = MI() a = LI() c = n-sum(a) print(c if c>0 else -1)
LI = lambda: list(map(int,input().split())) MI = lambda: map(int,input().split()) yes = lambda: print("YES") no = lambda: print("NO") I = lambda: list(input()) J = lambda x: "".join(x) II = lambda: int(input()) SI = lambda: input() #---khan17---template n,m = MI() a = LI() c = n-sum(a) print(c if c>=0 else -1)
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 47], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 20]]
5
126
//#pragma GCC target("avx2") //#pragma GCC optimize("O3") //# include <x86intrin.h> #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tre...
//#pragma GCC target("avx2") //#pragma GCC optimize("O3") //# include <x86intrin.h> #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tre...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
356
n,m = map(int, input().split()) an = list(map(int, input().split())) sum_a = sum(an) if an - sum_a < 0: print(-1) else: print(an-sum_a)
n,m = map(int, input().split()) an = list(map(int, input().split())) sum_a = sum(an) if n - sum_a < 0: print(-1) else: print(n-sum_a)
[["-", 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
59
/* g++ code.cpp ./a.out */ #include <bits/stdc++.h> #define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++) #define invrep(i, n) for (int64_t i = n - 1; i >= 0; i--) #define _GLIBCXX_DEBUG using namespace std; int main() { int64_t n, m; cin >> n >> m; vector<int64_t> a(m); rep(i, m) { cin >> a[i]; } if...
/* g++ code.cpp ./a.out */ #include <bits/stdc++.h> #define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++) #define invrep(i, n) for (int64_t i = n - 1; i >= 0; i--) #define _GLIBCXX_DEBUG using namespace std; int main() { int64_t n, m; cin >> n >> m; vector<int64_t> a(m); rep(i, m) { cin >> a[i]; } if...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
121
n, m = gets.split(' ').map(&:to_i) a = gets.split(' ').map(&:to_i) if a.sum < n puts n - a.sum else puts -1 end
n, m = gets.split(' ').map(&:to_i) a = gets.split(' ').map(&:to_i) if a.sum <= n puts n - a.sum else puts -1 end
[["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 18], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 19]]
4
51
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define ll long long int...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define ll long long int...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
154
INT = lambda: int(input()) INTM = lambda: map(int,input().split()) STRM = lambda: map(str,input().split()) STR = lambda: str(input()) LIST = lambda: list(map(int,input().split())) LISTS = lambda: list(map(str,input().split())) def do(): n,m=INTM() a=LIST() print(n-sum(a)) if __name__ == '__main__': do()
INT = lambda: int(input()) INTM = lambda: map(int,input().split()) STRM = lambda: map(str,input().split()) STR = lambda: str(input()) LIST = lambda: list(map(int,input().split())) LISTS = lambda: list(map(str,input().split())) def do(): n,m=INTM() a=LIST() print(max(n-sum(a),-1)) if __name__ == '__main__': ...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612]]
5
126
/* Created by vasu090 on 19 Apr, 2020 */ #include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; #define rep(i, a, b) for (auto(i) = a; i < b; i++) #define list(i, N) for (auto(i) = 0; i < N; i++) typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> pi; #defi...
/* Created by vasu090 on 19 Apr, 2020 */ #include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; #define rep(i, a, b) for (auto(i) = a; i < b; i++) #define list(i, N) for (auto(i) = 0; i < N; i++) typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> pi; #defi...
[["-", 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
209
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template <class T> constexp...
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template <class T> constexp...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 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
163
n,m=map(int,input().split()) a=list(map(int,input().split())) r=sum(a) if r<0: print(-1) else: print(n-r)
n,m=map(int,input().split()) a=list(map(int,input().split())) r=sum(a) if n-r<0: print(-1) else: print(n-r)
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33]]
5
57
#include <bits/stdc++.h> #define ll long long #define loop(n) for (ll i = 0; i < n; i++) #define sort(a) sort(a.begin(), a.end()) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); ll n, m; cin >> n >> m; ll x, sum = 0; loop(m) { cin >> x; sum += x; } if (x > n) return ...
#include <bits/stdc++.h> #define ll long long #define loop(n) for (ll i = 0; i < n; i++) #define sort(a) sort(a.begin(), a.end()) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); ll n, m; cin >> n >> m; ll x, sum = 0; loop(m) { cin >> x; sum += x; } if (sum > n) retur...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
103
n,m = map(int,input().split()) a = list(map(int,input().split())) if (sum(a) < n): print(n-sum(a)) else: print(-1)
n,m = map(int,input().split()) a = list(map(int,input().split())) if (sum(a) <= n): print(n-sum(a)) else: print(-1)
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 18], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 19]]
5
59
n,m=map(int,input().split()) a=list(map(int,input().split())) s=0 for i in a: s+=i if s>a: print(-1) else: print(a-s)
n,m=map(int,input().split()) a=list(map(int,input().split())) s=0 for i in a: s+=i if s>n: print(-1) else: print(n-s)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
62
n,m = list(map(int,input().split())) A = list(map(int,input().split())) for a in A: n -= a print(max(0,n))
n,m = list(map(int,input().split())) A = list(map(int,input().split())) for a in A: n -= a print(max(-1,n))
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612]]
5
53
N = int(input()) A = list(map(int, input().split())) assert len(A) == N - 1 count = [0 for i in range(len(A))] for a in A: count[a] += 1 for n in range(N): print(count[n])
N = int(input()) A = list(map(int, input().split())) assert len(A) == N - 1 count = [0 for i in range(N)] for a in A: count[a-1] += 1 for n in range(N): print(count[n])
[["-", 0, 659, 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, 25], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
75
#include <iostream> int main() { int N; std::cin >> N; int *array01 = (int *)malloc(sizeof(int) * N); for (int i = 0; i < N; i++) { array01[i] = 0; } for (int i = 0; i < N; i++) { int temp; std::cin >> temp; array01[temp - 1]++; } for (int i = 0; i < N; i++) { std::cout << array0...
#include <iostream> int main() { int N; std::cin >> N; int *array01 = (int *)malloc(sizeof(int) * N); for (int i = 0; i < N; i++) { array01[i] = 0; } for (int i = 1; i < N; i++) { int temp; std::cin >> temp; array01[temp - 1]++; } for (int i = 0; i < N; i++) { std::cout << array0...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
123
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n - 1; i++) { cin >> a.at(i); } vector<int> b(n); for (int i = 0; i < n - 1; i++) { b.at(a.at(i))++; } for (int i = 0; i < n; i++) { cout << a.at(i) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n - 1; i++) { cin >> a.at(i); } vector<int> b(n); for (int i = 0; i < n - 1; i++) { b.at(a.at(i) - 1)++; } for (int i = 0; i < n; i++) { cout << b.at(i) << endl; } }
[["+", 0, 27, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 27, 28, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 16, 31, 16, 12, 2, 63, 118, 28, 22], ["+", 0, 16, 31, 16, 12, 2, 63, 118, 28, 22]]
1
122
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> arr(n); for (int i = 0; i < n; i++) { int t; cin >> t; arr[t - 1]++; } for (int i : arr) cout << i << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> arr(n); for (int i = 0; i < n - 1; i++) { int t; cin >> t; arr[t - 1]++; } for (int i : arr) cout << i << "\n"; }
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
74
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout....
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout....
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
133
N = int(input()) A = list(map(int, input())) result = [0] * N for a in A: result[a-1] += 1 for i in range(N): print(result[i])
N = int(input()) A = list(map(int, input().split())) result = [0] * N for a in A: result[a-1] += 1 for i in range(N): print(result[i])
[["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
56
n=int(input()) w=list(map(int,input().split())) a=[0]*(n) for i in range(n-1): a[w[i]-1]+=1 for j in range(n): print(a)
n=int(input()) w=list(map(int,input().split())) a=[0]*(n) for i in range(n-1): a[w[i]-1]+=1 for j in range(n): print(a[j])
[["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]]
5
67
n,m = map(int,input().split()) ls = list(map(int,input().split())) for a in range(ls): n -= a print(max(-1,n))
n,m = map(int,input().split()) ls = list(map(int,input().split())) for a in ls: n -= a print(max(-1,n))
[["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25]]
5
54
def main(): n,m=map(int,input().split()) a=list(map(int,input().split())) s=sum(a) ans=n-s if n-s>0 else -1 print(ans) if __name__ == '__main__': main()
def main(): n,m=map(int,input().split()) a=list(map(int,input().split())) s=sum(a) ans=n-s if n-s>=0 else -1 print(ans) if __name__ == '__main__': main()
[["-", 0, 1, 0, 662, 12, 41, 0, 666, 667, 47], ["+", 0, 1, 0, 662, 12, 41, 0, 666, 667, 20]]
5
72
#pragma region Macros #include <bits/stdc++.h> using namespace std; //#include <boost/multiprecision/cpp_int.hpp> // using multiInt = boost::multiprecision::cpp_int; using ll = long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; template <typename Q_ty...
#pragma region Macros #include <bits/stdc++.h> using namespace std; //#include <boost/multiprecision/cpp_int.hpp> // using multiInt = boost::multiprecision::cpp_int; using ll = long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; template <typename Q_ty...
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 12, 22], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 22]]
1
365
n,m=map(int,input().split()) l=list(map(int,input().split())) ans=n for i in l: ans-=i if ans<=0: ans=-1 break print(ans)
n,m=map(int,input().split()) l=list(map(int,input().split())) ans=n for i in l: ans-=i if ans<0: ans=-1 break print(ans)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
58