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; int main() { int a, b; cin >> a >> b; int c[10000]; for (int i = 1; i <= b; i++) { cin >> c[i]; } int sum = 0; for (int i = 1; i <= b; i++) { sum = sum + c[i]; } int k = a - sum; if (k > 0) cout << k << endl; else cout << "-1" << endl...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; int c[10000]; for (int i = 1; i <= b; i++) { cin >> c[i]; } int sum = 0; for (int i = 1; i <= b; i++) { sum = sum + c[i]; } int k = a - sum; if (k >= 0) cout << k << endl; else cout << "-1" << end...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
113
import java.io.*; import java.util.*; public class Main { static BufferedWriter bw; static BufferedReader br; static void solve() throws Exception { int nm[] = Arrays.stream(br.readLine().split(" ")) .mapToInt(Integer::parseInt) .toArray(); int A[] = Arrays.stream(br....
import java.io.*; import java.util.*; public class Main { static BufferedWriter bw; static BufferedReader br; static void solve() throws Exception { int nm[] = Arrays.stream(br.readLine().split(" ")) .mapToInt(Integer::parseInt) .toArray(); int A[] = Arrays.stream(br....
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47]]
3
222
#include <bits/stdc++.h> using namespace std; using ll = long long; #define pi acos(-1) #define fastIO_ \ ios_base::sync_with_stdio(false); \ cin.tie(nullptr); ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define pi acos(-1) #define fastIO_ \ ios_base::sync_with_stdio(false); \ cin.tie(nullptr); ...
[["-", 0, 2, 3, 4, 0, 41, 15, 16, 17, 19], ["+", 0, 2, 3, 4, 0, 41, 15, 16, 17, 18]]
1
89
#include <iostream> using namespace std; int main() { int n, m, sum = 0, a; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a; sum = sum + a; } if (sum >= n) cout << "-1" << endl; else { n = n - sum; cout << n << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n, m, sum = 0, a; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a; sum = sum + a; } if (sum > n) cout << "-1" << endl; else { n = n - sum; cout << n << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
87
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; int M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A.at(i); } int64_t res = 0; for (int i = 0; i < M; i++) { res += A.at(i); } int64_t res1; res1 = N - res; if (res1 < 0) res = -1; ...
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; int M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A.at(i); } int64_t res = 0; for (int i = 0; i < M; i++) { res += A.at(i); } int64_t res1; res1 = N - res; if (res1 < 0) res1 = -1; ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22]]
1
113
#include <stdio.h> int main() { int N, M; scanf("%d %d", &N, &M); int A[1000]; for (int i = 0; i < M; i++) { scanf("%d", &A[i]); // printf("%d", A[i]); } int sum = 0; for (int j = 0; j < M; j++) { sum += A[j]; } if (sum <= N) { printf("%d\n", N - sum); } else { printf("-1\n"); ...
#include <stdio.h> int main() { int N, M; scanf("%d %d", &N, &M); int A[10001]; for (int i = 0; i < M; i++) { scanf("%d", &A[i]); // printf("%d", A[i]); } int sum = 0; for (int j = 0; j < M; j++) { sum += A[j]; } if (sum <= N) { printf("%d\n", N - sum); } else { printf("-1\n"); ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
124
n, m = list(map(int, input().split())) a = list(map(int, input().split())) total = 0 for i in a: total += a if n < total: print(-1) else: print(n - total)
n, m = list(map(int, input().split())) a = list(map(int, input().split())) total = 0 for i in a: total += i if n < total: print(-1) else: print(n - total)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]]
5
65
n, m = map(int, input().split()) a = list(map(int,input().split())) if n > sum(a): print(-1) else: print(n - sum(a))
n, m = map(int, input().split()) a = list(map(int,input().split())) if n < sum(a): print(-1) else: print(n - sum(a))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18]]
5
57
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n; cin >> n; ll m; cin >> m; ll a[m] = {0}; ll ans = 0; for (int i = 0; i < m; i++) { cin >> a[i]; ans += a[i]; } if (n - ans > 0) cout << n - ans << endl; else { cout << -1 << endl; } }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n; cin >> n; ll m; cin >> m; ll a[m] = {0}; ll ans = 0; for (int i = 0; i < m; i++) { cin >> a[i]; ans += a[i]; } if (n - ans >= 0) cout << n - ans << endl; else { cout << -1 << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
99
#include <iostream> using namespace std; int main() { int N, M, S = 0; int A[10000]; int i, j; cin >> N >> M; for (i = 0; i <= M - 1; i++) { cin >> A[i]; } cout << '\n'; for (j = 0; j <= M - 1; j++) { S += A[i]; } if (N - S >= 0) cout << N - S << '\n'; else cout << -1 << '\n'; r...
#include <iostream> using namespace std; int main() { int N, M, S = 0; int A[10000]; int i, j; cin >> N >> M; for (i = 0; i <= M - 1; i++) { cin >> A[i]; } cout << '\n'; for (j = 0; j <= M - 1; j++) { S += A[j]; } if (N - S >= 0) cout << N - S << '\n'; else cout << -1 << '\n'; r...
[["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22]]
1
122
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define ll long long #define PI acos(-1.0) #define MAX 0x3fffffff using namespace std; int n, m, x; int main() { ios::syn...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define ll long long #define PI acos(-1.0) #define MAX 0x3fffffff using namespace std; int n, m, x; int main() { ios::syn...
[["-", 31, 16, 12, 23, 0, 41, 15, 16, 12, 22], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 12, 22], ["-", 31, 16, 12, 23, 0, 41, 64, 16, 12, 22], ["+", 31, 16, 12, 23, 0, 41, 64, 16, 12, 22]]
1
116
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
59
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF (INT_MAX / 4) #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define ALL(a) (a).begin(), (a).end() /* clang-format off */ #define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now(); #defin...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF (INT_MAX / 4) #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define ALL(a) (a).begin(), (a).end() /* clang-format off */ #define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now(); #defin...
[["-", 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
120
#include <bits/stdc++.h> using namespace std; int main(void) { int i, n, m, sum; sum = 0; cin >> n >> m; vector<int> a(m); for (i = 0; i < m; i++) { cin >> a.at(i); sum += a.at(i); } if (n - sum > 0) { cout << n - sum << endl; } else { cout << -1 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main(void) { int i, n, m, sum; sum = 0; cin >> n >> m; vector<int> a(m); for (i = 0; i < m; i++) { cin >> a.at(i); sum += a.at(i); } if (n >= sum) { cout << n - sum << endl; } else { cout << -1 << endl; } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
104
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
58
#include <stdio.h> int main() { long long int n, m; long long int no, sum = 0; scanf("%lld %lld", &n, &m); for (int i = 0; i < m; i++) { scanf("%lld", &no); sum += no; } if (sum >= n) { printf("%lld", n - sum); } else { printf("-1"); } }
#include <stdio.h> int main() { long long int n, m; long long int no, sum = 0; scanf("%lld %lld", &n, &m); for (int i = 0; i < m; i++) { scanf("%lld", &no); sum += no; } if (sum <= n) { printf("%lld", n - sum); } else { printf("-1"); } return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
0
96
#include <bits/stdc++.h> 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 << n << endl; else cout << -1 << endl; }
#include <bits/stdc++.h> 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 << n << 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], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
68
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll n, m; cin >> n >> m; ll sum = 0; for (ll i = 0; i < m; i++) { ll k; cin >> k; sum += k; } if (sum > n) cout << -1 << endl; else cout << sum - n << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll n, m; cin >> n >> m; ll sum = 0; for (ll i = 0; i < m; i++) { ll k; cin >> k; sum += k; } if (sum > n) cout << -1 << endl; else cout << n - sum << endl; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
82
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(m); int sum = 0; for (int i = 0; i < m; i++) { cin >> a.at(i); sum += a.at(i); } if (sum <= n) cout << n - sum << endl; else cout << '-1' << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(m); int sum = 0; for (int i = 0; i < m; i++) { cin >> a.at(i); sum += a.at(i); } if (sum <= n) cout << n - sum << endl; else cout << "-1" << endl; }
[["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 104], ["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 16, 31, 16, 12, 103, 0, 42, 0, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
95
#include <iostream> #include <stdio.h> using namespace std; using ll = long long; ll N2; int N; int M; int A; int main() { cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A; N = N - A; if (N - A <= 0) { cout << "-1"; return 0; } } cout << N; }
#include <iostream> #include <stdio.h> using namespace std; using ll = long long; ll N2; int N; int M; int A; int main() { cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A; N = N - A; if (N < 0) { cout << "-1"; return 0; } } cout << N; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
87
#include <iostream> using namespace std; int main() { int n, m, i, a, sum = 0; cin >> n >> m; for (i = 1; i <= m; i++) { cin >> a; sum += a; } if (a - sum >= 0) cout << a - sum; else cout << "-1"; return 0; }
#include <iostream> using namespace std; int main() { int n, m, i, a, sum = 0; cin >> n >> m; for (i = 1; i <= m; i++) { cin >> a; sum += a; } if (n - sum >= 0) cout << n - sum; else cout << "-1"; return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 64, 1, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 16, 12, 16, 31, 22]]
1
78
package main import ( "fmt" ) func main() { var N, M int fmt.Scanf("%d %d\n", &N, &M) var sum int = 0 for i := 0; i < M; i++ { var c int fmt.Scanf("%d", &c) sum += c } if sum >= N { fmt.Println(-1) return } fmt.Println(N - sum) }
package main import ( "fmt" ) func main() { var N, M int fmt.Scanf("%d %d\n", &N, &M) var sum int = 0 for i := 0; i < M; i++ { var c int fmt.Scanf("%d", &c) sum += c } if sum > N { fmt.Println(-1) return } fmt.Println(N - sum) }
[["-", 0, 435, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 17, 47]]
7
105
import sys input = sys.stdin.readline N, M = list(map(int, input().split())) A = list(map(int, input().split())) print(N- sum(A))
import sys input = sys.stdin.readline N, M = list(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
54
N,M=map(int,input().split) lis=list(map(int, input().split())) s=0 for i in lis: s+=i if N-s<0: print("-1") else: print(N-s)
N,M=map(int,input().split()) lis=list(map(int, input().split())) s=0 for i in lis: s+=i if N-s<0: print("-1") else: print(N-s)
[["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
63
n,m = list(map(int,input().split())) A = list(map(int,input().split())) a = n-sum(A) if a <= n: print(a) else: print(-1)
n,m = list(map(int,input().split())) A = list(map(int,input().split())) a = n-sum(A) if sum(A) <= n: print(a) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 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, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
60
#include <iostream> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); int n; int m; std::cin >> n >> m; int sum = 0; for (int i = 1; i <= m; i++) { int now; std::cin >> now; sum += now; } if (n - sum > 0) { std::cout << n - sum; } els...
#include <iostream> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); int n; int m; std::cin >> n >> m; int sum = 0; for (int i = 1; i <= m; i++) { int now; std::cin >> now; sum += now; } if (n - sum >= 0) { std::cout << n - sum; } el...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
113
#include <iostream> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A.at(i); } int sum = 0; int a = -1; for (int i = 0; i < M; i++) { sum += A.at(i); } if (N - sum > 0) { cout << N - sum << endl; } else...
#include <iostream> #include <vector> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A.at(i); } int sum = 0; int a = -1; for (int i = 0; i < M; i++) { sum += A.at(i); } if (N - sum >= 0) { cout << N - sum << endl; } els...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
121
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)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
57
N, M = [int(s) for s in input().split(' ')] A = [int(s) for s in input().split(' ')] task_days = sum(A) if N < task_days: return -1 else: return N - task_days
N, M = [int(s) for s in input().split(' ')] A = [int(s) for s in input().split(' ')] task_days = sum(A) if N < task_days: print(-1) else: print(N - task_days)
[["-", 0, 656, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 57, 75, 76, 8, 196, 0, 37, 0, 38], ["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196...
5
64
#include <bits/stdc++.h> using namespace std; int main() { int N, M; int sum = 0; cin >> N >> M; vector<int> a(M); for (int i = 0; i < M; i++) { cin >> a.at(i); sum += a.at(i); } if (sum < N) { cout << N - sum << endl; } else { cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { long long int N, M; long long int sum = 0; cin >> N >> M; vector<int> a(M); for (int i = 0; i < M; i++) { cin >> a.at(i); sum += a.at(i); } if (sum <= N) { cout << N - sum << endl; } else { cout << -1 << endl; } }
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
96
#include <bits/stdc++.h> // g++ -std=c++11 // g++ -std=c++1z using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; typedef vector<pair<int, int>> vp; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); std::ios::sync_with_stdio(fals...
#include <bits/stdc++.h> // g++ -std=c++11 // g++ -std=c++1z using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; typedef vector<pair<int, int>> vp; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); std::ios::sync_with_stdio(fals...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33]]
1
131
#!/usr/bin/env python3 N, M = map(int, input().split()) ans = sum(map(int, input().split())) if ans >= 0: print(N - ans) else: print(-1)
#!/usr/bin/env python3 N, M = map(int, input().split()) A = sum(map(int, input().split())) if N - A >= 0: print(N - A) else: print(-1)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22],...
5
52
#include <stdio.h> #define N 10000 int main() { int i, n, m; int a[N]; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); } for (i = 0; i < m; i++) { if (a[i] <= n) { n = n - a[i]; if (i == m - 1) { printf("%d", n); } } else { printf("-1"); ...
#include <stdio.h> #define N 10000 int main() { int i, n, m; int a[N]; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); } for (i = 0; i < m; i++) { if (a[i] <= n) { n = n - a[i]; if (i == m - 1) { printf("%d", n); } } else { printf("-1"); ...
[["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 35]]
0
129
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) void sort2array(double *a, long *b, long n) { for (int i = 0; i < n; i++) { b[i] = i; } sort(b, b + n, [a](long i, long j) -> bool { return a[i] < a[j]; }); } // bを何回足せばaを超えるか int wtover(int a, int b) { if (...
#include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) void sort2array(double *a, long *b, long n) { for (int i = 0; i < n; i++) { b[i] = i; } sort(b, b + n, [a](long i, long j) -> bool { return a[i] < a[j]; }); } // bを何回足せばaを超えるか int wtover(int a, int b) { if (...
[["-", 64, 1, 0, 16, 31, 16, 12, 103, 0, 104], ["-", 64, 1, 0, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 16, 31, 16, 12, 103, 0, 42, 0, 13], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13]]
1
339
#include <bits/stdc++.h> using namespace std; #define lli long long int #define pb push_back #define in insert #define pi pair<int, int> #define pd pair<double, int> #define pii pair<int, pi> #define mp make_pair #define fir first #define sec second #define MAXN 200001 #define mod 1000000000 signed main() { lli n, ...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define pb push_back #define in insert #define pi pair<int, int> #define pd pair<double, int> #define pii pair<int, pi> #define mp make_pair #define fir first #define sec second #define MAXN 200001 #define mod 1000000000 signed main() { lli n, ...
[["-", 0, 1, 0, 41, 15, 23, 0, 16, 17, 20], ["+", 0, 1, 0, 41, 15, 23, 0, 16, 17, 19]]
1
111
#include <bits/stdc++.h> using namespace std; #define ll unsigned long long int ll a, b, c, x, y, i, j, k, cnt, l; ll ar[200005]; int main() { ios_base::sync_with_stdio(false); ll test; cin >> test >> a; for (i = 1; i <= a; i++) cin >> b, test -= b; if (test >= 0) cout << test << endl; else cout...
#include <bits/stdc++.h> using namespace std; #define ll long long int ll a, b, c, x, y, i, j, k, cnt, l; ll ar[200005]; int main() { ios_base::sync_with_stdio(false); ll test; cin >> test >> a; for (i = 1; i <= a; i++) cin >> b, test -= b; if (test >= 0) cout << test << endl; else cout << -1 <<...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
101
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) ############ ---- Input Functions ---- ############ def in_int(): return (int(input())) def in_list(): return (list(map(int, input().split()))) def in_str(): s = input() return (list(s[:len(s) - 1])) def in_ints(): return (ma...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) ############ ---- Input Functions ---- ############ def in_int(): return (int(input())) def in_list(): return (list(map(int, input().split()))) def in_str(): s = input() return (list(s[:len(s) - 1])) def in_ints(): return (ma...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
144
#include <bits/stdc++.h> using namespace std; int n, m, temp, sum = 0; int main() { cin >> n >> m; for (int i = 0; i < m; i++) { cin >> temp; sum += temp; } if (sum > n) cout << "-1"; else cout << sum - n; }
#include <bits/stdc++.h> using namespace std; int n, m, temp, sum = 0; int main() { cin >> n >> m; for (int i = 0; i < m; i++) { cin >> temp; sum += temp; } if (sum > n) cout << "-1"; else cout << n - sum; }
[["-", 75, 76, 0, 1, 0, 16, 12, 16, 31, 22], ["-", 75, 76, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 75, 76, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 75, 76, 0, 1, 0, 16, 12, 16, 12, 22]]
1
72
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <math.h> #include <stdio.h> int main(void) { int n, m, a = 0, b; scanf("%d %d", &n, &m); for (int i = 0; i < m; i++) { scanf("%d", &b); a += b; b = 0; } if (n > a) { printf("%d", n - a); } else { printf("%d", -1); } ...
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <math.h> #include <stdio.h> int main(void) { int n, m, a = 0, b; scanf("%d %d", &n, &m); for (int i = 0; i < m; i++) { scanf("%d", &b); a += b; b = 0; } if (n >= a) { printf("%d", n - a); } else { printf("%d", -1); } ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20]]
0
107
#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define max 10000 // qsort(str, n, sizeof(int), up_comp); int up_comp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int down_comp(const void *a, const void *b) { return *(int *)b - *(int *)a; } int count...
#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define max 10000 // qsort(str, n, sizeof(int), up_comp); int up_comp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int down_comp(const void *a, const void *b) { return *(int *)b - *(int *)a; } int count...
[["+", 0, 57, 15, 23, 0, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 33]]
0
275
#define __USE_MINGW_ANSI_STDIO #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; typedef long long ll; typedef long long ull; typedef pair<int, int> ii; #define all(v) ((v).begin()), ((v).end()) #define sz(v) ((int)((v).size())) #define en...
#define __USE_MINGW_ANSI_STDIO #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; typedef long long ll; typedef long long ull; typedef pair<int, int> ii; #define all(v) ((v).begin()), ((v).end()) #define sz(v) ((int)((v).size())) #define en...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
282
// IlyM #include <bits/stdc++.h> #define pb push_back #define sp " " #define sl "\n" #define fi first #define se second #define mp make_pair #define sz(a) ((int)a.size()) #define all(a) a.begin(), a.end() #define rev(a) reverse(a.begin(), a.end()) using namespace std; typedef long long ll; typedef vector<int> vi; t...
// IlyM #include <bits/stdc++.h> #define pb push_back #define sp " " #define sl "\n" #define fi first #define se second #define mp make_pair #define sz(a) ((int)a.size()) #define all(a) a.begin(), a.end() #define rev(a) reverse(a.begin(), a.end()) using namespace std; typedef long long ll; typedef vector<int> vi; t...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
196
#include <bits/stdc++.h> using namespace std; int main() { int i, M, N, n = 0, l; cin >> M >> N; for (i = 0; i < N; i++) { cin >> l; n += l; } if (n > N) { cout << "-1" << endl; } else { cout << N - n << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int i, M, N, n = 0, l; cin >> N >> M; for (i = 0; i < M; i++) { cin >> l; n += l; } if (n > N) { cout << "-1" << endl; } else { cout << N - n << endl; } return 0; }
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
84
#include <iostream> using namespace std; int main() { int n, m, x, sum = 0; cin >> n >> m; while (m--) { cin >> x; sum += x; } if (sum <= n) cout << sum; else cout << "-1"; return 0; }
#include <iostream> using namespace std; int main() { int n, m, x, sum = 0; cin >> n >> m; while (m--) { cin >> x; sum += x; } if (sum <= n) cout << n - sum; else cout << "-1"; return 0; }
[["+", 0, 57, 64, 1, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 16, 12, 16, 17, 33]]
1
64
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
[["-", 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
337
#include <bits/stdc++.h> using namespace std; int main(void) { long long int n, m, a; cin >> n >> m; int flag = 0; for (long long int i = 0; i < m; i++) { cin >> a; n -= a; if (a < 0) { cout << -1 << endl; flag = 1; break; } } if (flag == 0) { cout << n << endl; } }
#include <bits/stdc++.h> using namespace std; int main(void) { long long int n, m, a; cin >> n >> m; int flag = 0; for (long long int i = 0; i < m; i++) { cin >> a; n -= a; if (n < 0) { cout << -1 << endl; flag = 1; break; } } if (flag == 0) { cout << n << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
93
#include <stdio.h> int main() { int a[210000], i, n, j, m, sum = 0; scanf("%d%d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); sum += a[i]; } if (sum > n) { printf("-1\n"); return 0; } printf("%d\n", m - sum); return 0; }
#include <stdio.h> int main() { int a[210000], i, n, j, m, sum = 0; scanf("%d%d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); sum += a[i]; } if (sum > n) { printf("-1\n"); return 0; } printf("%d\n", n - sum); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
0
108
#include <stdio.h> int main() { int n, b, s = 0, i, ar[1000]; scanf("%d %d", &n, &b); for (i = 0; i < b; i++) { scanf("%d", &ar[i]); s += ar[i]; } if (s > n) { printf("-1\n"); } else printf("%d\n", n - s); return 0; }
#include <stdio.h> int main() { int n, b, s = 0, i, ar[100000]; scanf("%d %d", &n, &b); for (i = 0; i < b; i++) { scanf("%d", &ar[i]); s += ar[i]; } if (s > n) { printf("-1\n"); } else { printf("%d\n", n - s); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
0
104
#include <stdio.h> int main() { int n, m, i, b, sum = 0, a[100]; scanf("%d%d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); sum += a[i]; } b = n - sum; if (b < 0) printf("-1"); else printf("%d", b); return 0; }
#include <stdio.h> int main() { int n, m, i, b, sum = 0, a[10001]; scanf("%d%d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a[i]); sum += a[i]; } b = n - sum; if (b < 0) printf("-1"); else printf("%d", b); return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
106
#include <iostream> using namespace std; int main() { int N, M; cin >> N >> M; int assinementTime = 0; for (int i = 0; i < M; i++) { int timeOfAssinement; cin >> timeOfAssinement; assinementTime += timeOfAssinement; } if (N >= assinementTime) { cout << N - assinementTime << endl; } els...
#include <iostream> using namespace std; int main() { int N, M; cin >> N >> M; int assinementTime = 0; for (int i = 0; i < M; i++) { int timeOfAssinement; cin >> timeOfAssinement; assinementTime += timeOfAssinement; } if (N >= assinementTime) { cout << N - assinementTime << endl; } else...
[["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 104], ["-", 0, 1, 0, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 16, 31, 16, 12, 103, 0, 42, 0, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
86
#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.at(i); } int sum = std::accumulate(A.begin(), A.end(), 0); 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; vector<int> A(M); for (int i = 0; i < M; i++) { cin >> A.at(i); } int sum = std::accumulate(A.begin(), A.end(), 0); 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
106
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { ll N, M; cin >> N >> M; ll Ai; ll sum = 0; for (int i = 0; i < M; i++) { cin >> Ai; N -= Ai; } if (M < 0) cout << "-1" << endl; else cout << N << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { ll N, M; cin >> N >> M; ll Ai; ll sum = 0; for (int i = 0; i < M; i++) { cin >> Ai; N -= Ai; } 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
90
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int m, n; cin >> m >> n; vector<int> a; int sum = 0; rep(i, n) { cin >> a.at(i); sum += a.at(i); } int ans = m - sum; if (ans >= 0) { cout << ans << endl; } else cout << ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int m, n; cin >> m >> n; vector<int> a(n); int sum = 0; rep(i, n) { cin >> a.at(i); sum += a.at(i); } int ans = m - sum; if (ans >= 0) { cout << ans << endl; } else cout ...
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
98
n,m = map(int,input().split()) A = list(map(int,input().split())) free = n - sum(A) if free < 0: print(0) else: print(free)
n,m = map(int,input().split()) A = list(map(int,input().split())) free = n - sum(A) if free < 0: print(-1) else: print(free)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
56
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define endl '\n'; #define FASTER \ ios_base::sync_with_stdio(false); \ cin.tie(NULL...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define endl '\n'; #define FASTER \ ios_base::sync_with_stdio(false); \ cin.tie(NULL...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
248
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { ll n, m; cin >> n >> m; vector<ll> a(m); ll s = 0; rep(i, m) { cin >> a.at(i); s += a.at(i); } if (s < n) cout << n - s << endl; else cout << -1 << endl; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { ll n, m; cin >> n >> m; vector<ll> a(m); ll s = 0; rep(i, m) { cin >> a.at(i); s += a.at(i); } if (s <= n) cout << n - s << endl; else cout << -1 << endl;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
97
#include <bits/stdc++.h> using namespace std; int main() { int m, n, s = 0; cin >> n >> m; vector<int> a(m); for (int i = 0; i < m; i++) { cin >> a[i]; s += a[i]; } if (s < n) cout << n - s; else cout << "-1"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int m, n, s = 0; cin >> n >> m; vector<int> a(m); for (int i = 0; i < m; i++) { cin >> a[i]; s += a[i]; } if (s <= n) cout << n - 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
88
if __name__ == "__main__": N, M = map(int, input().split()) A = list(map(int, input().split())) ret = -1 A_sum = sum(A) if not (A_sum < 0): ret = N - A_sum print(int(ret))
if __name__ == "__main__": N, M = map(int, input().split()) A = list(map(int, input().split())) ret = -1 A_sum = sum(A) if not N - A_sum < 0: ret = N - A_sum print(int(ret))
[["-", 64, 196, 0, 57, 15, 681, 28, 23, 0, 24], ["+", 0, 57, 15, 681, 28, 666, 0, 657, 31, 22], ["+", 0, 57, 15, 681, 28, 666, 0, 657, 17, 33], ["-", 64, 196, 0, 57, 15, 681, 28, 23, 0, 25]]
5
70
#include <bits/stdc++.h> #define nl '\n' #define F fisrt #define S second #define pb push_back #define mp make_pair #define REP(i, a, b) for (int i = a; i < b; i++) #define ForeachTC \ int t; ...
#include <bits/stdc++.h> #define nl '\n' #define F fisrt #define S second #define pb push_back #define mp make_pair #define REP(i, a, b) for (int i = a; i < b; i++) #define ForeachTC \ int t; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 13]]
1
198
/** * Dont raise your voice, improve your argument. * --Desmond Tutu */ #include <bits/stdc++.h> using namespace std; vector<string> vec_splitter(string s) { for (char &c : s) c = c == ',' ? ' ' : c; stringstream ss; ss << s; vector<string> res; for (string z; ss >> z; res.push_back(z)) ; retur...
/** * Dont raise your voice, improve your argument. * --Desmond Tutu */ #include <bits/stdc++.h> using namespace std; vector<string> vec_splitter(string s) { for (char &c : s) c = c == ',' ? ' ' : c; stringstream ss; ss << s; vector<string> res; for (string z; ss >> z; res.push_back(z)) ; retur...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
427
#pragma GCC optimize("Ofast", 3, "inline") #include <bits/stdc++.h> using namespace std; #define fir first #define sec second #define m_p make_pair #define y1 ygftgfgcdtfgxffgx #define y2 yfdsesgvtyghftfvv #define x1 xvyr6cf6fgcfgf676 #define x2 xcr6rfc5r66y6r6fr #define up_bound upper_bound #define low_bound lower_bou...
#pragma GCC optimize("Ofast", 3, "inline") #include <bits/stdc++.h> using namespace std; #define fir first #define sec second #define m_p make_pair #define y1 ygftgfgcdtfgxffgx #define y2 yfdsesgvtyghftfvv #define x1 xvyr6cf6fgcfgf676 #define x2 xcr6rfc5r66y6r6fr #define up_bound upper_bound #define low_bound lower_bou...
[["-", 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, 12, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 12, 16, 12, 22]]
1
229
#include <bits/stdc++.h> #include <iostream> using namespace std; #define lli long long int int main() { lli n, m; cin >> n >> m; lli sum = 0; vector<lli> vect; for (int i = 0; i < m; i++) { int temp; cin >> temp; vect.push_back(temp); } for (int i = 0; i < m; i++) { sum += vect[i]; } ...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define lli long long int int main() { lli n, m; cin >> n >> m; lli sum = 0; vector<lli> vect; for (int i = 0; i < m; i++) { int temp; cin >> temp; vect.push_back(temp); } for (int i = 0; i < m; i++) { sum += vect[i]; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 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
115
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here int n, m; cin >> n >> m; int a[10000]; for (int i = 1; i <= m; i++) { cin >> a[i]; } int sum = 0; for (int i = 1; i <= m; i++) { sum += a[i]; } if (sum > n) cout << '-1' << endl; else cout << n - sum...
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here int n, m; cin >> n >> m; int a[10000]; for (int i = 1; i <= m; i++) { cin >> a[i]; } int sum = 0; for (int i = 1; i <= m; i++) { sum += a[i]; } if (sum > n) cout << "-1"; else cout << n - sum << endl...
[["-", 64, 1, 0, 16, 31, 16, 12, 103, 0, 104], ["-", 64, 1, 0, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 16, 31, 16, 12, 103, 0, 42, 0, 13], ["-", 8, 9, 0, 57, 64, 1, 0, 16, 17, 151], ["-", 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
108
#include <iostream> #include <vector> 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]; M -= A[i]; } if (M < 0) cout << -1 << endl; else cout << M << endl; }
#include <iostream> #include <vector> 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 -= A[i]; } if (N < 0) cout << -1 << endl; else cout << N << endl; }
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22]]
1
83
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { long long m, n; cin >> m >> n; vector<int> a(n); long long sum = 0; rep(i, n) { cin >> a.at(i); sum += a.at(i); } long long ans = m - sum; if (ans < 0) { ans = 0; } cout <<...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { long long m, n; cin >> m >> n; vector<int> a(n); long long sum = 0; rep(i, n) { cin >> a.at(i); sum += a.at(i); } long long ans = m - sum; if (ans < 0) { ans = -1; } cout <...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
99
#include <bits/stdc++.h> using namespace std; #define lli long long int #define rep(i, n) \ ; \ for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) ...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define rep(i, n) \ ; \ for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22]]
1
102
n, m = map(int, input().split()) a = list(map(int, input().split())) study_sum = sum(a) tem_ans = n - study_sum print(tem_ans) if tem_ans > 0 else print(-1)
n, m = map(int, input().split()) a = list(map(int, input().split())) study_sum = sum(a) tem_ans = n - study_sum print(tem_ans) if tem_ans >= 0 else print(-1)
[["-", 0, 656, 0, 1, 0, 41, 0, 666, 667, 47], ["+", 0, 656, 0, 1, 0, 41, 0, 666, 667, 20]]
5
58
#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; while (m--) { int c; cin >> c; n -= c; } cout << n << endl; }
#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; while (m--) { int c; cin >> c; n -= c; } 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
47
#include <iostream> using namespace std; int main() { int a, b, c = 0, d; cin >> a >> b; for (int i = 0; i < b; i++) { cin >> d; c += d; } if (a - c <= 0) { cout << "-1" << endl; } else { cout << a - c << endl; } }
#include <iostream> using namespace std; int main() { int a, b, c = 0, d; cin >> a >> b; for (int i = 0; i < b; i++) { cin >> d; c += d; } if (a - c < 0) { cout << "-1" << endl; } else { cout << a - c << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
82
#include <array> #include <iostream> using namespace std; int main() { int n, m, sum = 0; array<int, 1000> working_day; cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> working_day[i]; sum += working_day[i]; } if (n >= sum) { cout << n - sum; } else { cout << -1; } return 0; }
#include <array> #include <iostream> using namespace std; int main() { int n, m, sum = 0; array<int, 10000> working_day; cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> working_day[i]; sum += working_day[i]; } if (n >= sum) { cout << n - sum; } else { cout << -1; } return 0; }
[["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13]]
1
91
def main(): N, M = map(int, input().split()) A = [int(i) for i in input().split()] total_A = sum(A) ans = N - total_A if ans > 0: print('{}'.format(ans)) else: print('{}'.format(-1)) if __name__ == '__main__': main()
def main(): N, M = map(int, input().split()) A = [int(i) for i in input().split()] total_A = sum(A) ans = N - total_A if ans >= 0: print('{}'.format(ans)) else: print('{}'.format(-1)) if __name__ == '__main__': main()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20]]
5
90
#include <stdio.h> int main(void) { int sv, hw, i, length, res, sum = 0; int a[10000]; scanf("%d%d", &sv, &hw); for (i = 0; i == hw; ++i) { scanf("%d", &a[i]); sum = sum + a[i]; } res = sv - sum; if (res < 0) { printf("-1"); } else { printf("%d", res); } return 0; }
#include <stdio.h> int main(void) { int sv, hw, i, length, res, sum = 0; int a[10000]; scanf("%d%d", &sv, &hw); for (i = 0; i < hw; ++i) { scanf("%d", &a[i]); sum = sum + a[i]; } res = sv - sum; if (res < 0) { printf("-1"); } else { printf("%d", res); } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 60], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
0
116
function main(input) { var inputs = input.split("\n"); var tmp = inputs[1].split(" "); const kikan = parseInt(inputs[0][0], 10); let amari = 0; let ptmp = tmp.map(function(tmpitem) { return parseInt(tmpitem, 10); }); ptmp.forEach(function(ikko) { amari = amari + ikko; }); const kekka = kikan - amari; if...
function main(input) { var inputs = input.split("\n"); var tmp = inputs[1].split(" "); const kikan = parseInt(inputs[0].split(" ")[0], 10); let amari = 0; let ptmp = tmp.map(function(tmpitem) { return parseInt(tmpitem, 10); }); ptmp.forEach(function(ikko) { amari = amari + ikko; }); const kekka = kikan - ...
[["+", 3, 3, 0, 69, 500, 2, 63, 558, 0, 131], ["+", 3, 3, 0, 69, 500, 2, 63, 558, 559, 560], ["+", 3, 3, 0, 69, 500, 2, 3, 3, 0, 24], ["+", 0, 69, 500, 2, 3, 3, 0, 557, 0, 62], ["+", 0, 69, 500, 2, 3, 3, 0, 557, 0, 491], ["+", 3, 3, 0, 69, 500, 2, 3, 3, 0, 25]]
2
150
n,m = map(int,input().split()) l = [int(i) for i in input().split()] if(n > sum(l)): print(n-sum(l)) else: print(-1)
n,m = map(int,input().split()) l = [int(i) for i in input().split()] if(n >= sum(l)): print(n-sum(l)) else: print(-1)
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 47], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 20]]
5
60
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, m, x; cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> x; n -= x; } if (x < 0) cout << "-1"; else cout << n; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, m, x; cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> x; n -= x; } if (n < 0) cout << "-1"; else cout << n; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
74
N, M = map(int, input().split()) A = input().split() A_int = [int(n) for n in A] rest = sum(A_int) if rest >= 0: print(rest) else: print(-1)
N, M = map(int, input().split()) A = input().split() A_int = [int(n) for n in A] rest = N - sum(A_int) if rest >= 0: print(rest) else: print(-1)
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33]]
5
59
n, m = map(int, input()) a = sum([int(i) for i in input().split()]) print(n-a if n-a>=0 else '-1')
n, m = map(int, input().split()) a = sum([int(i) for i in input().split()]) print(n-a if n-a>=0 else '-1')
[["+", 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
49
a, b = map(int, input().split()) c = list(map(int, input().split())) d = sum(c) if a - d >= 1: print(a - d) else: print("-1")
a, b = map(int, input().split()) c = list(map(int, input().split())) d = sum(c) if a - d >= 0: print(a - d) else: print("-1")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
60
N,M = map(int,input().split()) A = list(map(int, input().split())) S=0 for a in A: S+=a if N-S>0: print(N-S) else: print(-1)
N,M = map(int,input().split()) A = list(map(int, input().split())) S=0 for a in A: S+=a if N-S>=0: print(N-S) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
64
N, M = map(int, input().split()) day_cost = [int(i) for i in input().split()] holidays = N-sum(day_cost) if holidays > 0: print(holidays) else: print(-1)
N, M = map(int, input().split()) day_cost = [int(i) for i in input().split()] holidays = N-sum(day_cost) if holidays >= 0: print(holidays) 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
# -*- coding: utf-8 -*- import math # 整数の入力 n, m = map(int, input().split()) li = list(map(int, input().split())) # 計算 a = n-sum(li) if 0 <= n: print(a) else: print(-1)
# -*- coding: utf-8 -*- import math # 整数の入力 n, m = map(int, input().split()) li = list(map(int, input().split())) # 計算 a = n-sum(li) if 0 <= a: print(a) else: print(-1)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
62
a,b=map(int,input().split()) c=input().split() if sum(int(i) for i in c)>a: print(-1) else: print(a-sum(int(i)) for i in c)
N,M=map(int,input().split()) c=input().split() if sum(int(i) for i in c)>N: print(-1) else: print(N-sum(int(i) for i in c))
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["-", 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, 668, 8, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", ...
5
63
N,M=map(int,input().split()) lists0=list(map(int,input().split())) lists1=lists0[0:M-1] SUM=sum(lists1) X=N-SUM if X>=0:print(X) else:print("-1")
N,M=map(int,input().split()) lists0=list(map(int,input().split())) lists1=lists0[0:M-1] SUM=sum(lists0) X=N-SUM if X>=0:print(X) else:print(-1)
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
71
#include <cmath> #include <iostream> using namespace std; const int MAX_SIZE = 1e5 + 10; typedef long long ll; ll arr[MAX_SIZE]; int main() { ios::sync_with_stdio(false); long long n, m; cin >> n >> m; long long sum = 0; for (int i = 1; i <= m; i++) { long long t; cin >> t; sum += t; } if (s...
#include <cmath> #include <iostream> using namespace std; const int MAX_SIZE = 1e5 + 10; typedef long long ll; ll arr[MAX_SIZE]; int main() { ios::sync_with_stdio(false); long long n, m; cin >> n >> m; long long sum = 0; for (int i = 1; i <= m; i++) { long long t; cin >> t; sum += t; } if (s...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
106
#include <math.h> #include <stdio.h> int main(void) { int A, N, M, R; int i; int ans = 0; scanf("%d%d", &N, &M); for (i = 0; i < M; i++) { scanf("%d", &A); ans = ans + A; } if (N > ans) printf("%d", N - ans); else printf("-1"); return 0; }
#include <math.h> #include <stdio.h> int main(void) { int A, N, M, R; int i; int ans = 0; scanf("%d%d", &N, &M); for (i = 0; i < M; i++) { scanf("%d", &A); ans = ans + A; } if (N >= ans) printf("%d", N - ans); else printf("-1"); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20]]
0
100
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m; cin >> n >> m; int total_task = 0; rep(i, m) { int a; cin >> a; total_task += a; } if (n > total_task) { cout << n - total_task << endl; } else { cout << -1 << en...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m; cin >> n >> m; int total_task = 0; rep(i, m) { int a; cin >> a; total_task += a; } if (n >= total_task) { cout << n - total_task << endl; } else { cout << -1 << e...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
80
def q2(): N, M = (int(i) for i in input().split()) A = [int(i) for i in input().split()] sum_A = sum(A) if N > sum_A: ans = N - sum_A else: ans = 0 print(ans) if __name__ == '__main__': q2()
def q2(): N, M = (int(i) for i in input().split()) A = [int(i) for i in input().split()] sum_A = sum(A) if N >= sum_A: ans = N - sum_A else: ans = -1 print(ans) if __name__ == '__main__': q2()
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 664, 28, 612]]
5
78
#include <bits/stdc++.h> using namespace std; int main() { int M, N, l, i = 0, a[1000], j = 0; cin >> M >> N; while (cin >> l) { a[i] = l; i++; } while (j < N) { M = M - a[j]; j++; } if (M >= 0) { cout << M; } else { cout << -1; } }
#include <bits/stdc++.h> using namespace std; int main() { int M, N, l, i = 0, a[10000], j = 0; cin >> M >> N; while (cin >> l) { a[i] = l; i++; } while (j < N) { M = M - a[j]; j++; } if (M >= 0) { cout << M; } else { cout << -1; } }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
95
#include <stdio.h> int main() { int n, m, i, a; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a); n -= a; } if (n > 0) printf("%d\n", n); else printf("-1\n"); return 0; }
#include <stdio.h> int main() { int n, m, i, a; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &a); n -= a; } if (n >= 0) printf("%d\n", n); else printf("-1\n"); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20]]
0
87
#include <iostream> using namespace std; int main() { int N, M; int A[10001]; cin >> N; cin >> M; int d = 0; for (int i = 0; i < M; ++i) { cin >> A[i]; d += A[i]; } int c = -1; if (d <= N) c = d; cout << c << endl; }
#include <iostream> using namespace std; int main() { int N, M; int A[10010]; cin >> N; cin >> M; int d = 0; for (int i = 0; i < M; ++i) { cin >> A[i]; d += A[i]; } int c = -1; if (d <= N) c = N - d; cout << c << endl; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33]]
1
87
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> V; for (int i = 0; i < M; i++) { cin >> V.at(i); } int P = 0; for (int i = 0; i < M; i++) { P += V.at(i); } if (N - P >= 0) cout << N - P; else cout << "-1"; }
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> V(M); for (int i = 0; i < M; i++) { cin >> V.at(i); } int P = 0; for (int i = 0; i < M; i++) { P += V.at(i); } if (N - P >= 0) cout << N - P; else cout << "-1"; }
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
105
#include <stdio.h> int main(void) { int i, n, m, sum = 0; int number[100]; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &number[i]); sum += number[i]; } if (n >= sum) { printf("%d", n - sum); } else { printf("-1"); } return 0; }
#include <stdio.h> int main(void) { int i, n, m, sum = 0; int number[10000]; scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d", &number[i]); sum += number[i]; } if (n >= sum) { printf("%d", n - sum); } else { printf("-1"); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
106
#include <algorithm> #include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n, m; cin >> n >> m; vector<int> a(m); int d = 0; rep(i, m) { cin >> a.at(i); d += a.at(i); } if (n ...
#include <algorithm> #include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n, m; cin >> n >> m; vector<int> a(m); int d = 0; rep(i, m) { cin >> a.at(i); d += a.at(i); } if (n ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
115
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int sum; vector<int> syukudai_nissuu; for (int i = 0; i < M; i++) { cin >> syukudai_nissuu.at(i); } sum = accumulate(syukudai_nissuu.begin(), syukudai_nissuu.end(), 0); if (N - sum >= 0) { cout << N - sum << e...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; int sum; vector<int> syukudai_nissuu(M); for (int i = 0; i < M; i++) { cin >> syukudai_nissuu.at(i); } sum = accumulate(syukudai_nissuu.begin(), syukudai_nissuu.end(), 0); if (N - sum >= 0) { cout << N - sum <...
[["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
103
#include <iostream> #include <numeric> #include <vector> int main() { using namespace std; ios_base::sync_with_stdio(false); int N, M; cin >> N >> M; vector vec(M, 0); for (auto &v : vec) { cin >> v; } cout << N - std::accumulate(vec.begin(), vec.end(), 0); }
#include <iostream> #include <numeric> #include <vector> int main() { using namespace std; ios_base::sync_with_stdio(false); int N, M; cin >> N >> M; vector vec(M, 0); for (auto &v : vec) { cin >> v; } cout << max(-1, N - std::accumulate(vec.begin(), vec.end(), 0)); }
[["+", 8, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 25]]
1
79
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np def main(): N, M, *A = map(int, read().split()) ans = sum(A) if ans > N: ans == -1 else: ans = N - ans print(ans) return if __name__ == '__main...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np def main(): N, M, *A = map(int, read().split()) ans = sum(A) if ans > N: ans = -1 else: ans = N - ans print(ans) return if __name__ == '__main_...
[["-", 0, 57, 64, 196, 0, 1, 0, 666, 667, 60], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32]]
5
94
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, m; cin >> n >> m; vector<int> lam(m); long long lili = 0; rep(i, m) { cin >> lam.at(i); lili += lam.at(i); } if (lili >= n) cout << -1 << endl; else cout << n - lili << endl; }...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, m; cin >> n >> m; vector<int> lam(m); long long lili = 0; rep(i, m) { cin >> lam.at(i); lili += lam.at(i); } if (lili > n) cout << -1 << endl; else cout << n - lili << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
93
#include <bits/stdc++.h> using namespace std; int main() { // nが夏休みの日数 iが宿題の個数 int n, i = 0; cin >> n >> i; vector<int> kosuu(i); for (int j = 0; j < i; j++) { cin >> kosuu.at(j); } int m = 0; // cout<<m<<endl; for (int j = 0; j < i; j++) { m += kosuu.at(j); } // cout<<kosuu.at(0)<<endl; ...
#include <bits/stdc++.h> using namespace std; int main() { // nが夏休みの日数 iが宿題の個数 int n, i = 0; cin >> n >> i; vector<int> kosuu(i); for (int j = 0; j < i; j++) { cin >> kosuu.at(j); } int m = 0; // cout<<m<<endl; for (int j = 0; j < i; j++) { m += kosuu.at(j); } // cout<<kosuu.at(0)<<endl; ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33]]
1
119
#include <iostream> using namespace std; #define M_PI 3.14159265358979323846 int main() { int N, M, sum = 0; int A[100]; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A[i]; sum += A[i]; } if ((N - sum) > 0) cout << N - sum; else cout << "-1"; return 0; }
#include <iostream> using namespace std; #define M_PI 3.14159265358979323846 int main() { int N, M, sum = 0; int A[10000]; cin >> N >> M; for (int i = 0; i < M; i++) { cin >> A[i]; sum += A[i]; } if ((N - sum) >= 0) cout << N - sum; else cout << "-1"; return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
92
from sys import stdin N,M = stdin.readline().rstrip().split() a_list = stdin.readline().rstrip().split() N,M = int(N),int(M) for a in a_list: N-=int(a) if(N>=0): print(N) print('-1')
from sys import stdin N,M = stdin.readline().rstrip().split() a_list = stdin.readline().rstrip().split() N,M = int(N),int(M) for a in a_list: N-=int(a) if(N>=0): print(N) else: print('-1')
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
77