buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
N, K = map(int, input().split()) mod = 10**9 + 7 nums = [] p_cnt = 0 for i in list(map(int, input().split())): if i >= 0: nums.append((i, True)) p_cnt += 1 else: nums.append((-i, False)) nums.sort() if p_cnt == 0 and K%2!=0: ans = 1 for k in range(K): ans *= -nums[k][0] ...
N, K = map(int, input().split()) mod = 10**9 + 7 nums = [] p_cnt = 0 for i in list(map(int, input().split())): if i >= 0: nums.append((i, True)) p_cnt += 1 else: nums.append((-i, False)) nums.sort() if p_cnt == 0 and K%2!=0: ans = 1 for k in range(K): ans *= -nums[k][0] ...
[["-", 64, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
5
421
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 10, mod = 1e9 + 7; ll n, k, a[N], ans, flag; int main() { cin >> n >> k; for (ll i = 0; i < n; i++) { scanf("%lld", &a[i]); } sort(a, a + n, greater<ll>()); ll l = 0, r = n - 1; ans = 1; if (k % 2) ans = a[l]...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 10, mod = 1e9 + 7; ll n, k, a[N], ans, flag; int main() { cin >> n >> k; for (ll i = 0; i < n; i++) { scanf("%lld", &a[i]); } sort(a, a + n, greater<ll>()); ll l = 0, r = n - 1; ans = 1; flag = 1; //注意如果开始k是偶数,fl...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
239
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #inclu...
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #inclu...
[["-", 0, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
1,056
#include <algorithm> #include <bitset> #include <complex> #include <cstdint> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits.h> #include <limits> #include <list> #include <map> #include <math.h> #include <queue> #include <regex> #include <set> #include <stack> #include ...
#include <algorithm> #include <bitset> #include <complex> #include <cstdint> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits.h> #include <limits> #include <list> #include <map> #include <math.h> #include <queue> #include <regex> #include <set> #include <stack> #include ...
[["-", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
1,561
#include <algorithm> #include <cmath> #include <ctime> #include <iostream> #include <map> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) //#include <bits/stdc++.h> using namespace std; const long int INF = 1000000007; int main() {...
#include <algorithm> #include <cmath> #include <ctime> #include <iostream> #include <map> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) //#include <bits/stdc++.h> using namespace std; const long int INF = 1000000007; int main() {...
[["+", 0, 57, 64, 9, 0, 57, 75, 76, 0, 95], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
937
#include <algorithm> #include <iostream> #include <vector> using namespace std; const int MOD = 1000000007; int main(void) { int N, K, Abuf; vector<int> Aplus; vector<int> Aminus; int numAzero = 0; cin >> N >> K; for (int i = 0; i < N; i++) { cin >> Abuf; if (Abuf >= 0) Aplus.push_back(Abuf)...
#include <algorithm> #include <iostream> #include <vector> using namespace std; const int MOD = 1000000007; int main(void) { int N, K, Abuf; vector<int> Aplus; vector<int> Aminus; int numAzero = 0; cin >> N >> K; for (int i = 0; i < N; i++) { cin >> Abuf; if (Abuf >= 0) Aplus.push_back(Abuf)...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
590
n,k = map(int, input().split()) a =list(map(int, input().split())) ans =1 if n == k: for i in a: ans *= i if abs(ans) >10**9+7: ans = ans%(10**9+7) elif all(i <= 0 for i in a) and k%2 ==1: a.sort(reverse = True) for i in range(k): ans *= a[i] if abs(ans) > 10 ** 9 +...
n,k = map(int, input().split()) a =list(map(int, input().split())) ans =1 if n == k: for i in a: ans *= i if abs(ans) >10**9+7: ans = ans%(10**9+7) elif all(i <= 0 for i in a) and k%2 ==1: a.sort(reverse = True) for i in range(k): ans *= a[i] if abs(ans) > 10 ** 9 +...
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18]]
5
379
#include <bits/stdc++.h> using namespace std; using ll = long long; using VI = vector<int>; using VL = vector<ll>; using VS = vector<string>; using VB = vector<bool>; using VVI = vector<VI>; using VVL = vector<VL>; using PII = std::pair<int, int>; using VPII = std::vector<std::pair<int, int>>; using PLL = std::pair<ll...
#include <bits/stdc++.h> using namespace std; using ll = long long; using VI = vector<int>; using VL = vector<ll>; using VS = vector<string>; using VB = vector<bool>; using VVI = vector<VI>; using VVL = vector<VL>; using PII = std::pair<int, int>; using VPII = std::vector<std::pair<int, int>>; using PLL = std::pair<ll...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
1,865
#include <bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back #define mod 1000000007 #define mod1 1000000009 #define hell 998244353 #define inf 1000000000000000000LL #define pi 3.14159265358979323 #define N 1000005 using namespace std; ll n, k, sum, q, res, m, val, ans; ll x, y; ll...
#include <bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back #define mod 1000000007 #define mod1 1000000009 #define hell 998244353 #define inf 1000000000000000000LL #define pi 3.14159265358979323 #define N 1000005 using namespace std; ll n, k, sum, q, res, m, val, ans; ll x, y; ll...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
721
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int sz = 2e5 + 5, mod = 1e9 + 7; ll ans = 1; inline void gun(ll x) { ans = ans * x % mod; } int main() { int n, k; cin >> n >> k; bool zer = 0; vector<ll> pos, neg; for (int i = 0; i < n; i++) { ll x; scanf("%lld", &x); i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int sz = 2e5 + 5, mod = 1e9 + 7; ll ans = 1; inline void gun(ll x) { ans = ans * x % mod; } int main() { int n, k; cin >> n >> k; bool zer = 0; vector<ll> pos, neg; for (int i = 0; i < n; i++) { ll x; scanf("%lld", &x); i...
[["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 57, 75, 76, 0, 1, 0, 35]]
1
501
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
[["+", 0, 7, 10, 11, 12, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 7, 10, 11, 12, 16, 17, 33]]
1
795
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repr(i, n) for (int i = (n); i >= 0; --i) #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define FORR(i, m, n) for (int i = (m); i >= (n); --i) #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef long long ll; t...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repr(i, n) for (int i = (n); i >= 0; --i) #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define FORR(i, m, n) for (int i = (m); i >= (n); --i) #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef long long ll; t...
[["-", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13]]
1
982
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict import collections, heapq, itertools, bisect import math, fractions from functools import reduce, lru_cache import sys, copy def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI1(): return [int(x) - 1 for x in sys...
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict import collections, heapq, itertools, bisect import math, fractions from functools import reduce, lru_cache import sys, copy def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI1(): return [int(x) - 1 for x in sys...
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 0, 612]]
5
1,066
#include <bits/stdc++.h> #define rep(i, n) for (long long i = 0; i < (n); ++i) #define orep(i, n) for (long long i = 1; i <= (n); ++i) // one rep #define drep(i, n) for (long long i = (n)-1; i >= 0; --i) // down rep #define srep(i, s, t) for (long long i = (s); i < (t); ++i) // set rep #define rng(x) (x).begin(),...
#include <bits/stdc++.h> #define rep(i, n) for (long long i = 0; i < (n); ++i) #define orep(i, n) for (long long i = 1; i <= (n); ++i) // one rep #define drep(i, n) for (long long i = (n)-1; i >= 0; --i) // down rep #define srep(i, s, t) for (long long i = (s); i < (t); ++i) // set rep #define rng(x) (x).begin(),...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16,...
1
1,228
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include ...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include ...
[["+", 0, 9, 0, 43, 49, 50, 51, 91, 17, 33]]
1
1,300
// #pragma GCC optimize("Ofast,unroll-loops") // #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define dd double #define ld long double #define sl(n) scanf("%lld", &n) #define si(n) scanf("%d", &n) #define sd(n) scanf("%lf", &n) #d...
// #pragma GCC optimize("Ofast,unroll-loops") // #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define dd double #define ld long double #define sl(n) scanf("%lld", &n) #define si(n) scanf("%d", &n) #define sd(n) scanf("%lf", &n) #d...
[["-", 51, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33]]
1
449
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define all(x) (x).begin(), (x).end() #define uniq(x) (x).erase(unique(all(x)), (x).end()) #define bit(n) (1LL << (n)) #define cdiv(a, b) (((a)...
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define all(x) (x).begin(), (x).end() #define uniq(x) (x).erase(unique(all(x)), (x).end()) #define bit(n) (1LL << (n)) #define cdiv(a, b) (((a)...
[["+", 31, 16, 12, 16, 31, 16, 31, 91, 17, 33]]
1
1,818
#include <algorithm> #include <cmath> #include <iostream> #include <vector> const uint64_t mod = 1'000'000'007; int main() { uint32_t N = 0, K = 0; std::cin >> N >> K; std::vector<uint64_t> plus, minus; for (size_t i = 0; i < N; i++) { int64_t a = 0; std::cin >> a; if (a >= 0) plus.push_back...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> const uint64_t mod = 1'000'000'007; int main() { uint32_t N = 0, K = 0; std::cin >> N >> K; std::vector<uint64_t> plus, minus; for (size_t i = 0; i < N; i++) { int64_t a = 0; std::cin >> a; if (a >= 0) plus.push_back...
[["-", 0, 57, 15, 339, 51, 16, 31, 91, 17, 111]]
1
557
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n, m; ll k; cin >> n >> m >> k; vector<ll> a(n + 1), b(m + 1); for (int i = 1; i <= n; i++) { int ai; cin >> ai; a[i] = a[i - 1] + ai; } for (int i = 1; i <= m; i++) { int bi; cin >> bi; b[i] = b[...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n, m; ll k; cin >> n >> m >> k; vector<ll> a(n + 1), b(m + 1); for (int i = 1; i <= n; i++) { int ai; cin >> ai; a[i] = a[i - 1] + ai; } for (int i = 1; i <= m; i++) { int bi; cin >> bi; b[i] = b[...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
241
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define repr(i, n) for (int i = n - 1; i >= 0; i--) #define repr1(i, n) for (int i = n; i >= 1; i--) #define all(v) v.begin(), v.end() using ll = long long; using pii = pair<int, i...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define repr(i, n) for (int i = n - 1; i >= 0; i--) #define repr1(i, n) for (int i = n; i >= 1; i--) #define all(v) v.begin(), v.end() using ll = long long; using pii = pair<int, i...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
378
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1000000007 using namespace std; int main() { long n, m, k; cin >> n >> m >> k; long a[n], b[m]; rep(i, n) cin >> a[i]; rep(i, m) cin >> b[i]; long suma = 0, sumb = 0; long ka = 0, kb = 0; long ai = 0; rep(i, n) { i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1000000007 using namespace std; int main() { long n, m, k; cin >> n >> m >> k; long a[n], b[m]; rep(i, n) cin >> a[i]; rep(i, m) cin >> b[i]; long suma = 0, sumb = 0; long ka = 0, kb = 0; long ai = 0; rep(i, n) { i...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 75, 76, 0, 93, 0, 35]]
1
261
import bisect from itertools import accumulate N , M , K = map(int , input().split()) a = list(map(int , input().split())) b = list(map(int , input().split())) a = list(accumulate(a)) b = list(accumulate(b)) a.insert(0,0) ans = 0 for i in range(N + 1): if a[i] > K: break ans = max(ans , bisect.bisect_...
import bisect from itertools import accumulate N , M , K = map(int , input().split()) a = list(map(int , input().split())) b = list(map(int , input().split())) a = list(accumulate(a)) b = list(accumulate(b)) a.insert(0,0) ans = 0 for i in range(N + 1): if a[i] > K: break ans = max(ans , i + bisect.bis...
[["+", 0, 662, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 72]]
5
130
N,M,K=map(int,input().split()) A =list(map(int,input().split())) B =list(map(int,input().split())) Sum = 0 Al = [0] Bl = [0] for i in range(N): Sum += A[i] Al.append(Sum) Sum = 0 for j in range(M): Sum += B[i] Bl.append(Sum) ans, j = 0, M for i in range(N+1): if Al[i] > K: break while Bl...
N,M,K=map(int,input().split()) A =list(map(int,input().split())) B =list(map(int,input().split())) Sum = 0 Al = [0] Bl = [0] for i in range(N): Sum += A[i] Al.append(Sum) Sum = 0 for j in range(M): Sum += B[j] Bl.append(Sum) ans, j = 0, M for i in range(N+1): if Al[i] > K: break while Bl...
[["-", 8, 196, 0, 1, 0, 677, 12, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 206, 22]]
5
164
#include <bits/stdc++.h> using namespace std; using P = pair<int, int>; using ll = long long; int main() { ll n, m, k, x, y; cin >> n >> m >> k; vector<ll> a(n + 1, 0), b(m + 1, 0); for (int i = 1; i < n + 1; i++) { cin >> x; a[i] = a[i - 1] + x; } for (int i = 1; i < m + 1; i++) { cin >> y; ...
#include <bits/stdc++.h> using namespace std; using P = pair<int, int>; using ll = long long; int main() { ll n, m, k, x, y; cin >> n >> m >> k; vector<ll> a(n + 1), b(m + 1); for (int i = 1; i < n + 1; i++) { cin >> x; a[i] = a[i - 1] + x; } for (int i = 1; i < m + 1; i++) { cin >> y; b[i]...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
223
#include <algorithm> #include <iostream> #include <vector> //------------------------3------------------------- #define rep(i, l, r) for (ll i = l; i < r; i++) using namespace std; typedef long long ll; int main() { ll n, m, k; std::cin >> n >> m >> k; ll a[200001], b[200001]; // std::vector<long long> a(n+1...
#include <algorithm> #include <iostream> #include <vector> //------------------------3------------------------- #define rep(i, l, r) for (ll i = l; i < r; i++) using namespace std; typedef long long ll; int main() { ll n, m, k; std::cin >> n >> m >> k; ll a[200001], b[200001]; // std::vector<long long> a(n+1...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
223
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n,m,k = map(int, readline().split()) a = list(map(int, readline().split())) b = list(map(int, readline().split())) sa = [0]*(n+1) sb = [0]*(m+1) for i in range(n): sa[i+1] = sa[i]+a[i] for i in ran...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n,m,k = map(int, readline().split()) a = list(map(int, readline().split())) b = list(map(int, readline().split())) sa = [0]*(n+1) sb = [0]*(m+1) for i in range(n): sa[i+1] = sa[i]+a[i] for i in ran...
[["-", 8, 196, 0, 52, 15, 679, 31, 666, 0, 22], ["-", 8, 196, 0, 52, 15, 679, 31, 666, 667, 47], ["-", 8, 196, 0, 52, 15, 679, 31, 666, 0, 612], ["-", 0, 7, 8, 196, 0, 52, 15, 679, 17, 355], ["-", 8, 196, 0, 52, 15, 679, 12, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 0, 22]]
5
210
#include <bits/stdc++.h> #include <iostream> using namespace std; #define mod 1000000000000000007 #define pi 3.1415926535897932384626433832795 #define ll long long #define pb push_back #define pii pair<int, int> #define vecsort(v) sort(v.begin(), v.end()) #define lcm(x, y) (x / __gcd(x, y)) * y #define forn(i, n) for ...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define mod 1000000000000000007 #define pi 3.1415926535897932384626433832795 #define ll long long #define pb push_back #define pii pair<int, int> #define vecsort(v) sort(v.begin(), v.end()) #define lcm(x, y) (x / __gcd(x, y)) * y #define forn(i, n) for ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
348
def strToList(str,offset=0): res = []; for el in str.split(" "): if el!='': res.append(int(el)+offset) return res [N,M,K] = strToList(input()) A = strToList(input()) B = strToList(input()) current_time = 0 current_value = 0 iA = 0 iB = 0 while iA<N: if current_time+A[iA]<=K: ...
def strToList(str,offset=0): res = []; for el in str.split(" "): if el!='': res.append(int(el)+offset) return res [N,M,K] = strToList(input()) A = strToList(input()) B = strToList(input()) current_time = 0 current_value = 0 iA = 0 iB = 0 while iA<N: if current_time+A[iA]<=K: ...
[["-", 0, 656, 0, 52, 15, 679, 31, 666, 667, 20], ["-", 0, 656, 0, 52, 15, 679, 31, 666, 0, 612], ["+", 0, 656, 0, 52, 15, 679, 31, 666, 667, 47], ["+", 0, 52, 15, 679, 31, 666, 0, 664, 17, 33], ["+", 0, 52, 15, 679, 31, 666, 0, 664, 28, 612]]
5
181
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; typedef long long ll; const int N = 200005; int a[N], b[N], suma[N], sumb[N]; int main() { int n, m, k, ans = 0; cin >> n >> m >> k; suma[0] = sumb[0] = 0; for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); ...
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; typedef long long ll; const int N = 200005; ll a[N], b[N], suma[N], sumb[N]; int main() { ll n, m, k, ans = 0; cin >> n >> m >> k; suma[0] = sumb[0] = 0; for (int i = 1; i <= n; ++i) { scanf("%lld", &a[i]); ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, ...
1
296
#include <bits/stdc++.h> using namespace std; int a[200005], b[200005]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; } for (int i = 1; i <= m; i++) { cin >> b[i]; b[i] += b[i - 1]; } int ans = 0; int j = m; for (int i = 0; ...
#include <bits/stdc++.h> using namespace std; long long a[200005], b[200005]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; } for (int i = 1; i <= m; i++) { cin >> b[i]; b[i] += b[i - 1]; } int ans = 0; int j = m; for (int i...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96]]
1
181
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <math.h> #include <string> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i < (n); i++) int main() { long long int n, m, k, a, b; cin >> n >> m >> k; vector<long long int> aa(n + 1)...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <math.h> #include <string> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep1(i, n) for (int i = 1; i < (n); i++) int main() { long long int n, m, k, a, b; cin >> n >> m >> k; vector<long long int> aa(n + 1)...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
198
#include "math.h" #include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; #define ll long long int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> m >> ...
#include "math.h" #include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; #define ll long long int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> m >>...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
243
#include <cmath> #include <deque> #include <iostream> #include <string> #include <vector> using namespace std; #define FOR(i, start, end) for (ll i = (start); i < (end); i++) #define rep(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() #define ctoi(c) c - '0' #define tos(s) to_string(s) typedef long long ll;...
#include <cmath> #include <deque> #include <iostream> #include <string> #include <vector> using namespace std; #define FOR(i, start, end) for (ll i = (start); i < (end); i++) #define rep(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() #define ctoi(c) c - '0' #define tos(s) to_string(s) typedef long long ll;...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
239
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); long k = sc.nextLong(); long[] sa = new long[n + 1]; long[] sb = new long[m + 1]; for (int i = 1; i <= n; i++) { sa[i] = ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); long k = sc.nextLong(); long[] sa = new long[n + 1]; long[] sb = new long[m + 1]; for (int i = 1; i <= n; i++) { sa[i] = ...
[["+", 64, 196, 0, 503, 49, 200, 51, 16, 17, 72], ["+", 64, 196, 0, 503, 49, 200, 51, 16, 12, 499]]
3
282
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N, M; ll K; cin >> N >> M >> K; ll A[N + 1]{}, B[M + 1]{}; ll t = 0; for (int i = 0; i < N; i++) { cin >> A[i + 1]; } for (int i = 0; i < M; i++) { cin >> B[i + 1]; } int id_a = 0; for (int i = 0; i <= N; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N, M; ll K; cin >> N >> M >> K; ll A[N + 1]{}, B[M + 1]{}; ll t = 0; for (int i = 0; i < N; i++) { cin >> A[i + 1]; } for (int i = 0; i < M; i++) { cin >> B[i + 1]; } int id_a = 0; for (int i = 0; i <= N; ...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 35], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
243
#ifdef _MSC_VER #include "stdc++.h" #endif #ifdef __GNUC__ #include <bits/stdc++.h> #endif using namespace std; using ll = long long; // vector using vi = vector<int>; using vii = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; // constant const double EPS = 1e-10; #define REP(i, n) for (ll i = 0; i <...
#ifdef _MSC_VER #include "stdc++.h" #endif #ifdef __GNUC__ #include <bits/stdc++.h> #endif using namespace std; using ll = long long; // vector using vi = vector<int>; using vii = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; // constant const double EPS = 1e-10; #define REP(i, n) for (ll i = 0; i <...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33]]
1
446
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, k; cin >> n >> m >> k; long long a[n], b[m]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; long long a1[n + 1], b1[m + 1]; a1[0] = 0; b1[0] = 0; for (int i = 1; i <= n; i++) a1...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, k; cin >> n >> m >> k; long long a[n], b[m]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; long long a1[n + 1], b1[m + 1]; a1[0] = 0; b1[0] = 0; for (int i = 1; i <= n; i++) a1...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
247
import sys N, M, K = [int(s) for s in sys.stdin.readline().split()] n = 0 A = [0] for s in sys.stdin.readline().split(): n = n + int(s) A.append(n) n = 0 B = [0] for s in sys.stdin.readline().split(): n = n + int(s) B.append(n) ans = 0 for i in range(N + 1): if A[i] > K: break for j i...
import sys N, M, K = [int(s) for s in sys.stdin.readline().split()] n = 0 A = [0] for s in sys.stdin.readline().split(): n = n + int(s) A.append(n) n = 0 B = [0] for s in sys.stdin.readline().split(): n = n + int(s) B.append(n) ans = 0 for i in range(N + 1): if A[i] > K: break for j i...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
164
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
1,311
#include <bits/stdc++.h> using namespace std; long long n, m, k, a[200005], b[200005]; int main() { cin >> n >> m >> k; int ans = 0; cin >> a[1]; for (int i = 2; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; } cin >> b[1]; for (int i = 2; i <= m; i++) { cin >> b[i]; b[i] += b[i - 1]; } ...
#include <bits/stdc++.h> using namespace std; long long n, m, k, a[200005], b[200005]; int main() { cin >> n >> m >> k; int ans = 0; cin >> a[1]; for (int i = 2; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; } cin >> b[1]; for (int i = 2; i <= m; i++) { cin >> b[i]; b[i] += b[i - 1]; } ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 52, 8, 9, 0, 46]]
1
198
N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) totalA = [0] totalB = [0] sumA = 0 for i in range(N): sumA += A[0] totalA.append(sumA) sumB = 0 for i in range(M): sumB += B[0] totalB.append(sumB) iB = M countMax = 0 for iA in range(N+1): if...
N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) totalA = [0] totalB = [0] sumA = 0 for i in range(N): sumA += A[i] totalA.append(sumA) sumB = 0 for i in range(M): sumB += B[i] totalB.append(sumB) iB = M countMax = 0 for iA in range(N+1): if...
[["-", 8, 196, 0, 1, 0, 677, 12, 206, 206, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 206, 22]]
5
165
#include <algorithm> #include <chrono> #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility>...
#include <algorithm> #include <chrono> #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility>...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 15, 339, 51, 16, 31, 16, 12, 69, 28, 22], ["+", 15, 339...
1
301
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define printInt(a) printf("%d\n", a) #define printll(a) printf("%lld\n", a) #define printYes() printf("Yes\n") #define printNo() printf("No\n") #define scanll(a) scanf("%lld", &a) #define scanInt(a) scanf("%d", &a) #define scan2Int(a, b) scanf("%...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define printInt(a) printf("%d\n", a) #define printll(a) printf("%lld\n", a) #define printYes() printf("Yes\n") #define printNo() printf("No\n") #define scanll(a) scanf("%lld", &a) #define scanInt(a) scanf("%d", &a) #define scan2Int(a, b) scanf("%...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 51, 22], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25]]
1
276
#include <bits/stdc++.h> #define INF 2147483640 using namespace std; unsigned long long a[200005], b[200005]; int main() { // freopen("out.txt","w",stdout); int n, m, k, ans = 0; cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] = a[i] + a[i - 1]; } for (int i = 1; i <= m; i++) { ...
#include <bits/stdc++.h> #define INF 2147483640 using namespace std; long long a[200005], b[200005]; int main() { // freopen("out.txt","w",stdout); int n, m, k, ans = 0; cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] = a[i] + a[i - 1]; } for (int i = 1; i <= m; i++) { cin >...
[["-", 36, 36, 0, 30, 0, 43, 39, 86, 0, 87], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
200
#include <bits/stdc++.h> #include <cstdio> #include <iomanip> #include <iostream> #include <sstream> #include <algorithm> #include <deque> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <cmath> #include <cstdlib> #include <cstring> using namespace std; int main() { int ...
#include <bits/stdc++.h> #include <cstdio> #include <iomanip> #include <iostream> #include <sstream> #include <algorithm> #include <deque> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <cmath> #include <cstdlib> #include <cstring> using namespace std; int main() { int ...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
295
N, M, K = map(int, input().split()) A_temp = [int(i) for i in input().split()] B_temp = [int(i) for i in input().split()] A, B = [0]*(N+1), [0]*(M+1) for i in range(1, N): A[i] = A[i-1] + A_temp[i-1] for j in range(1, M): B[j] = B[j-1] + B_temp[j-1] ans = 0 for a in range(N+1): if A[a] > K: ...
N, M, K = map(int, input().split()) A_temp = [int(i) for i in input().split()] B_temp = [int(i) for i in input().split()] A, B = [0]*(N+1), [0]*(M+1) for i in range(1, N+1): A[i] = A[i-1] + A_temp[i-1] for j in range(1, M+1): B[j] = B[j-1] + B_temp[j-1] ans = 0 for a in range(N+1): if A[a] > K: ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
199
import itertools numOfA,numOfB,target = map(int, input().split()) timetoreadA = list(map(int,input().split())) timetoreadB = list(map(int,input().split())) timetoreadAacc = list(itertools.accumulate(timetoreadA)) booknumonlyA = 0 totaltime = 0 for time in timetoreadAacc: if target < time: break booknumonlyA += ...
import itertools numOfA,numOfB,target = map(int, input().split()) timetoreadA = list(map(int,input().split())) timetoreadB = list(map(int,input().split())) timetoreadAacc = list(itertools.accumulate(timetoreadA)) booknumonlyA = 0 totaltime = 0 for time in timetoreadAacc: if target < time: break booknumonlyA += ...
[["-", 0, 662, 12, 657, 12, 206, 206, 657, 17, 33], ["-", 0, 662, 12, 657, 12, 206, 206, 657, 12, 612]]
5
180
import sys readline = sys.stdin.readline N,M,K = map(int,readline().split()) A = [0] + list(map(int,readline().split())) B = [0] + list(map(int,readline().split())) for i in range(1, len(A)): A[i] += A[i - 1] for i in range(1, len(B)): B[i] += B[i - 1] import bisect ans = 0 for i in range(len(A)): rest = ...
import sys readline = sys.stdin.readline N,M,K = map(int,readline().split()) A = [0] + list(map(int,readline().split())) B = [0] + list(map(int,readline().split())) for i in range(1, len(A)): A[i] += A[i - 1] for i in range(1, len(B)): B[i] += B[i - 1] import bisect ans = 0 for i in range(len(A)): rest = ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
5
185
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; long long int a[n]; long long int b[m]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < m; i++) { cin >> b[i]; } vector<long long int> prea(n + 1, 0); vector<long long int> preb(m ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; long long int a[n]; long long int b[m]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < m; i++) { cin >> b[i]; } vector<long long int> prea(n + 1, 0); vector<long long int> preb(m ...
[["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]]
1
281
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair #define pb push_back #define F first #define S second #define sz(v) (ll((v).size())) #define forn(i, n) for (ll i = 0; i < (n); i++) #define forr(i, n) for (ll i = (n)-1; i >= 0; i--) #define forv(i, v) forn(i, sz(v)) #define fors(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair #define pb push_back #define F first #define S second #define sz(v) (ll((v).size())) #define forn(i, n) for (ll i = 0; i < (n); i++) #define forr(i, n) for (ll i = (n)-1; i >= 0; i--) #define forv(i, v) forn(i, sz(v)) #define fors(...
[["-", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22]]
1
289
// AnkitCode99 here.... // every ups and downs matter! #include <bits/stdc++.h> #define endl "\n" #define Ryuga \ ios_base::sync_with_stdio(0); \ cin.tie(nullptr); ...
// AnkitCode99 here.... // every ups and downs matter! #include <bits/stdc++.h> #define endl "\n" #define Ryuga \ ios_base::sync_with_stdio(0); \ cin.tie(nullptr); ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47]]
1
312
#include <bits/stdc++.h> using namespace std; #define ld double #define ll long long #define pb emplace_back #define mk make_pair #define mod 1000000007 #define ff first #define ss second #define sz(x) (int)x.size() #define FIO \ ios_base::sync_with_s...
#include <bits/stdc++.h> using namespace std; #define ld double #define ll long long #define pb emplace_back #define mk make_pair #define mod 1000000007 #define ff first #define ss second #define sz(x) (int)x.size() #define FIO \ ios_base::sync_with_s...
[["-", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22]]
1
358
n,m,k=map(int,input().split()) a=[0]+list(map(int,input().split())) b=[0]+list(map(int,input().split())) for i in range(1,n+1): a[i]=a[i]+a[i-1] for i in range(1,m+1): b[i]=b[i]+b[i-1] j=m-1 ans=0 for i in range(n): if j<0: break while a[i]+b[j]>k and j>=0: j-=1 ans=max(i+j,ans) print(ans)
n,m,k=map(int,input().split()) a=[0]+list(map(int,input().split())) b=[0]+list(map(int,input().split())) for i in range(1,n+1): a[i]=a[i]+a[i-1] for i in range(1,m+1): b[i]=b[i]+b[i-1] j=m ans=0 for i in range(n+1): if j<0: break while a[i]+b[j]>k and j>=0: j-=1 ans=max(i+j,ans) print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
172
n,m,k=map(int,input().split()) a=[int(i) for i in input().split()] b=[int(i) for i in input().split()] ans=chk=w=0 for i in range(n): if k>=a[i]: chk+=1 k-=a[i] w=i ans=max(ans,chk) else: break for i in range(m): if k<b[i]: while w>=0: if k>=b[i]:...
n,m,k=map(int,input().split()) a=[int(i) for i in input().split()] b=[int(i) for i in input().split()] ans=chk=0 w=-1 for i in range(n): if k>=a[i]: chk+=1 k-=a[i] w=i ans=max(ans,chk) else: break for i in range(m): if k<b[i]: while w>=0: if k>=b[...
[["+", 0, 656, 0, 1, 0, 662, 12, 662, 12, 612], ["-", 0, 1, 0, 662, 12, 662, 12, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612]]
5
174
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { long long N, M, K, ans = 0; int j; cin >> N >> M >> K; vector<int> A(N + 5), B(M + 5); A[0] = 0; B[0] = 0; for (int i = 0; i < N; i++) { cin >> A[i + 1]; } for (int i = 0; i < M; i++) { cin >> B[i + ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { long long N, M, K, ans = 0; int j; cin >> N >> M >> K; vector<long long> A(N + 5), B(M + 5); A[0] = 0; B[0] = 0; for (int i = 0; i < N; i++) { cin >> A[i + 1]; } for (int i = 0; i < M; i++) { cin >> ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["+", 0, 52, 15, 339, 51, 16, 31, 23, 0, 24], ["+", 0, 52, 15, 339, 51, 16, 31, 23, 0, 25]]
1
258
import sys input = sys.stdin.readline n,m,k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) if a[0] > k: res = 0 for i in range(m): if b[i] <= k: k -= b[i] res += 1 else: break print(res) else: cnt = 0...
import sys input = sys.stdin.readline n,m,k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) if a[0] > k: res = 0 for i in range(m): if b[i] <= k: k -= b[i] res += 1 else: break print(res) else: cnt = 0...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
260
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = 10010...
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = 10010...
[["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22]]
1
445
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define fst first #define snd second using namespace std; typedef long long ll; typedef pair<int, int> pii; const int INF = 1e9 + 10; const int MOD = 1000000007; ll A[200005]; ll B[200005]; int main() { ios_base::sync_with_stdio(false); cin.tie(...
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define fst first #define snd second using namespace std; typedef long long ll; typedef pair<int, int> pii; const int INF = 1e9 + 10; const int MOD = 1000000007; ll A[200005]; ll B[200005]; int main() { ios_base::sync_with_stdio(false); cin.tie(...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
236
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; long long int x; long long int a[n + 1], b[n + 1]; a[0] = b[0] = 0; for (int i = 1; i <= n; i++) { cin >> x; a[i] = a[i - 1] + x; } for (int i = 1; i <= m; i++) { cin >> x; b[i] = b[i - 1] + x; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; long long int x; long long int a[n + 1], b[m + 1]; a[0] = b[0] = 0; for (int i = 1; i <= n; i++) { cin >> x; a[i] = a[i - 1] + x; } for (int i = 1; i <= m; i++) { cin >> x; b[i] = b[i - 1] + x; ...
[["-", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22]]
1
212
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i) ll N, M, K; void func() { cin >> N >> M >> K; ll ans = 0, tmp; ll a[N + 1] = {}, b[M + 1] = {}; rep(i, 1, N + 1) { cin >> tmp; a[i] = a[i - 1] + tmp; } rep(i, 1, M ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i) ll N, M, K; void func() { cin >> N >> M >> K; ll ans = 0, tmp; ll a[N + 1] = {}, b[M + 1] = {}; rep(i, 1, N + 1) { cin >> tmp; a[i] = a[i - 1] + tmp; } rep(i, 1, M ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
216
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define SCANF(i) \ int i; ...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define SCANF(i) \ int i; ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
441
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back template <class T> inline...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back template <class T> inline...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 9, 0, 57, 64, 116, 0, 117], ["+", 8, 9, 0, 9, 0, 57, 64, 93, 0, 94]]
1
387
#include <bits/stdc++.h> #define INF 2000000000 #define MOD 1000000007 #define EPS (1e-10) using namespace std; int main(int argc, char *argv[]) { long N, M; cin >> N >> M; long K; cin >> K; vector<long> A(N + 1, 0); for (int i = 1; i <= N; i++) { int a; cin >> a; A[i] = A[i - 1] + a; } ...
#include <bits/stdc++.h> #define INF 2000000000 #define MOD 1000000007 #define EPS (1e-10) using namespace std; int main(int argc, char *argv[]) { long N, M; cin >> N >> M; long K; cin >> K; vector<long> A(N + 1, 0); for (int i = 1; i <= N; i++) { int a; cin >> a; A[i] = A[i - 1] + a; } ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 31, 13]]
1
229
n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) s_a = [0] s_b = [0] for i in range(n): s_a.append(s_a[i] + a[i]) for i in range(m): s_b.append(s_b[i] + b[i]) ans = 0 ok = m for i in range(n+1): for j in range(ok+1)[::-1]: if s_a[i] + s_b[...
n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) s_a = [0] s_b = [0] for i in range(n): s_a.append(s_a[i] + a[i]) for i in range(m): s_b.append(s_b[i] + b[i]) ans = 0 tmp = m for i in range(n+1): for j in range(tmp+1)[::-1]: if s_a[i] + s_...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 12, 206, 51, 652, 3, 4, 0, 657, 31, 22], ["+", 12, 206, 51, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 8...
5
171
import sys def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] de...
import sys def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] de...
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73]]
5
372
n,m,k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) asum = [0]*(n+1) bsum = [0]*(m+1) for i in range(n): asum[i+1] = a[i] + asum[i] for j in range(m): bsum[i+1] = b[j] + bsum[j] j = m res = 0 for i in range(n+1): if asum[i] > k: break while asum[i] + bsum[j] > k...
n,m,k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) asum = [0]*(n+1) bsum = [0]*(m+1) for i in range(n): asum[i+1] = a[i] + asum[i] for j in range(m): bsum[j+1] = b[j] + bsum[j] j = m res = 0 for i in range(n+1): if asum[i] > k: break while asum[i] + bsum[j] > k...
[["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22]]
5
177
n,m,k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) sum_a = [0] sum_b = [0] for i in range(n): sum_a.append(sum_a[i] + a[i]) for j in range(m): sum_b.append(sum_b[j] + b[j]) temp = 0 j = m ans = 0 for i in range(n+1): if sum_a[i] > k: temp = i...
n,m,k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) sum_a = [0] sum_b = [0] for i in range(n): sum_a.append(sum_a[i] + a[i]) for j in range(m): sum_b.append(sum_b[j] + b[j]) temp = 0 j = m ans = 0 for i in range(n+1): if sum_a[i] > k: temp = i...
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
182
A,B,K=map(int,input().split()) List_A = list(map(int, input().split())) List_B = list(map(int, input().split())) SumListA=[] SumListA.append(0) SumListB=[] SumListB.append(0) res =0 a=0 for i in range(A): SumListA.append(SumListA[i]+List_A[i]) for i in range(B): SumListB.append(SumListB[i]+List_B[i]) j=B for i in ...
A,B,K=map(int,input().split()) List_A = list(map(int, input().split())) List_B = list(map(int, input().split())) SumListA=[] SumListA.append(0) SumListB=[] SumListB.append(0) res =0 a=0 for i in range(A): SumListA.append(SumListA[i]+List_A[i]) for i in range(B): SumListB.append(SumListB[i]+List_B[i]) j=B for i in ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
173
import sys readline = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 #mod = 998244353 INF = 10**18 eps = 10**-7 n,m,k = map(int,readline().split()) a = list(map(int,readline().split())) b = list(map(int,readline().split())) csuma = [0] csumb = [0] for ai in a: csuma.append(csuma[-1]+ai) for bi in b...
import sys readline = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 #mod = 998244353 INF = 10**18 eps = 10**-7 n,m,k = map(int,readline().split()) a = list(map(int,readline().split())) b = list(map(int,readline().split())) csuma = [0] csumb = [0] for ai in a: csuma.append(csuma[-1]+ai) for bi in b...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
207
#include <algorithm> #include <iostream> #include <vector> using namespace std; int n, m, k; int main() { cin >> n >> m >> k; vector<int> a(n + 1, 0); vector<int> b(m + 1, 0); int sum = 0; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 1; i <= m; ++i) { cin >> b[i]; sum += b[i]; ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int n, m, k; int main() { cin >> n >> m >> k; vector<int> a(n + 1, 0); vector<int> b(m + 1, 0); long long sum = 0; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 1; i <= m; ++i) { cin >> b[i]; sum += ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
191
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) index_a = -1 index_b = 0 num_books = 0 now_times = 0 for a in A : if now_times + a <= K : num_books += 1 now_times += a index_a += 1 temp_books = num_books temp_times = now_times while i...
N, M, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) index_a = -1 index_b = 0 num_books = 0 now_times = 0 for a in A : if now_times + a <= K : num_books += 1 now_times += a index_a += 1 else : break temp_books = num_books temp_times = n...
[["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 75, 76, 8, 196, 0, 93, 0, 94]]
5
154
// ABC 173 C Tsundoku #include <bits/stdc++.h> using namespace std; typedef long long ll; int solve(int N, int M, int K, int A[], int B[]) { ll total_cost = 0; for (int i = 0; i < M; i++) { total_cost += B[i]; } int ans = 0; int j = M; for (int i = 0; i < N; i++) { while (j > 0 && total_cost > K) ...
// ABC 173 C Tsundoku #include <bits/stdc++.h> using namespace std; typedef long long ll; int solve(int N, int M, int K, int A[], int B[]) { ll total_cost = 0; for (int i = 0; i < M; i++) { total_cost += B[i]; } int ans = 0; int j = M; for (int i = 0; i < N + 1; i++) { while (j > 0 && total_cost >...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
248
#include <bits/stdc++.h> using namespace std; #define pi acos(-1) #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(); \ cout.tie(...
#include <bits/stdc++.h> using namespace std; #define pi acos(-1) #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(); \ cout.tie(...
[["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13]]
1
331
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { new Main().solve(); pw.close(); } /** * ASCII * 0 48 * A 65 * a 97 */ static PrintWriter pw = new Pr...
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { new Main().solve(); pw.close(); } /** * ASCII * 0 48 * A 65 * a 97 */ static PrintWriter pw = new Pr...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 20]]
3
2,463
import sys import math import itertools import collections import heapq import re import numpy as np from functools import reduce rr = lambda: sys.stdin.readline().rstrip() rs = lambda: sys.stdin.readline().split() ri = lambda: int(sys.stdin.readline()) rm = lambda: map(int, sys.stdin.readline().split()) rl = lambda: ...
import sys import math import itertools import collections import heapq import re import numpy as np from functools import reduce rr = lambda: sys.stdin.readline().rstrip() rs = lambda: sys.stdin.readline().split() ri = lambda: int(sys.stdin.readline()) rm = lambda: map(int, sys.stdin.readline().split()) rl = lambda: ...
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22]]
5
307
import sys sys.setrecursionlimit(10 ** 9) # input = sys.stdin.readline #### def int1(x): return int(x) - 1 def II(): return int(input()) def MI(): return map(int, input().split()) def MI1(): return map(int1, input().split()) def LI(): return list(map(int, input().split())) def LI1(): return list(map(int1, input().sp...
import sys sys.setrecursionlimit(10 ** 9) # input = sys.stdin.readline #### def int1(x): return int(x) - 1 def II(): return int(input()) def MI(): return map(int, input().split()) def MI1(): return map(int1, input().split()) def LI(): return list(map(int, input().split())) def LI1(): return list(map(int1, input().sp...
[["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
414
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define repa(i, a, n) for (int i = (a); i < (n); i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) #define rrepa(i, a, n) for (int i = n - 1; i >= (a); i--) #define all(a) (a).begin(), (a).end() #define MOD 1000000007...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define repa(i, a, n) for (int i = (a); i < (n); i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) #define rrepa(i, a, n) for (int i = n - 1; i >= (a); i--) #define all(a) (a).begin(), (a).end() #define MOD 1000000007...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
301
#include <iostream> using namespace std; typedef long long ll; int main() { int N, M; ll K; ll a[200005] = {0}, b[200005] = {0}; cin >> N >> M >> K; for (int i = 1; i <= N; i++) { ll A; cin >> A; if (i == 1) { a[i] = A; } else { a[i] = a[i - 1] + A; } } for (int i = 1; ...
#include <iostream> using namespace std; typedef long long ll; int main() { int N, M; ll K; ll a[200005] = {0}, b[200005] = {0}; cin >> N >> M >> K; for (int i = 1; i <= N; i++) { ll A; cin >> A; if (i == 1) { a[i] = A; } else { a[i] = a[i - 1] + A; } } for (int i = 1; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
240
n,m,k=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) a=[0];b=[0];ans=0;j=m for i in range(n): a.append(a[i]+A[i]) for i in range(m): b.append(b[i]+B[i]) for i in range(n+1): if a[i]>k: break while b[j]<k-a[i]: j-=1 ans=max(ans,i+j) print(ans)
n,m,k=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) a=[0];b=[0];ans=0;j=m for i in range(n): a.append(a[i]+A[i]) for i in range(m): b.append(b[i]+B[i]) for i in range(n+1): if a[i]>k: break while b[j]>k-a[i]: j-=1 ans=max(ans,i+j) print(an...
[["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 47]]
5
164
n, m, x = map(int, input().split(' ')) a = list(map(int, input().split(' '))) b = list(map(int, input().split(' '))) A = [0] B = [0] for i in range(len(a)): A.append(A[-1] + a[i]) for i in range(len(b)): B.append(B[-1] + b[i]) y = len(B) - 1 ans = 0 for i in range(len(A)): while A[i] + B[y] > x: y -= 1 if y ==...
n, m, x = map(int, input().split(' ')) a = list(map(int, input().split(' '))) b = list(map(int, input().split(' '))) A = [0] B = [0] for i in range(len(a)): A.append(A[-1] + a[i]) for i in range(len(b)): B.append(B[-1] + b[i]) y = len(B) - 1 ans = 0 for i in range(len(A)): while A[i] + B[y] > x: y -= 1 if y ==...
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22]]
5
191
#include <algorithm> #include <iostream> using namespace std; typedef long long int ll; int main() { ll n = 0, m = 0, k = 0; cin >> n >> m >> k; ll a[n + 1] = {0}, b[m + 1] = {0}; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 1; i <= m; ++i) { cin >> b[i]; b[i] += b[i - 1]; } ...
#include <algorithm> #include <iostream> using namespace std; typedef long long int ll; int main() { ll n = 0, m = 0, k = 0; cin >> n >> m >> k; ll a[n + 1] = {0}, b[m + 1] = {0}; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 1; i <= m; ++i) { cin >> b[i]; b[i] += b[i - 1]; } ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
207
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long int ll; typedef long double ld; #define mp make_pair #define v vector #define inp_push(no, v) \ ll no; \ ci...
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long int ll; typedef long double ld; #define mp make_pair #define v vector #define inp_push(no, v) \ ll no; \ ci...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
645
#include <bits/stdc++.h> using namespace std; long long a[200005], b[200005], n, m, k, x, j, sol; int main() { cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> x; a[i] += a[i - 1] + x; } for (int i = 1; i <= m; i++) { cin >> x; b[i] += b[i - 1] + x; } j = m; for (int i = 1; i <...
#include <bits/stdc++.h> using namespace std; long long a[200005], b[200005], n, m, k, x, j, sol; int main() { cin >> n >> m >> k; for (int i = 1; i <= n; i++) { cin >> x; a[i] += a[i - 1] + x; } for (int i = 1; i <= m; i++) { cin >> x; b[i] += b[i - 1] + x; } j = m; for (int i = 0; i <...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47]]
1
182
#include <algorithm> #include <bits/stdc++.h> #include <unordered_set> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int N, M, K; cin >> N >> M >> K; vector<int> a(N + 1); vector<int> b(M + 1); for (int i = 1; i <= N; i++) { cin >> a[i]...
#include <algorithm> #include <bits/stdc++.h> #include <unordered_set> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll N, M, K; cin >> N >> M >> K; vector<ll> a(N + 1); vector<ll> b(M + 1); for (int i = 1; i <= N; i++) { cin >> a[i]; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]]
1
222
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <vector> #define ll long long using namespace std; int a[200050]; int b[200050]; int ans; int main() { int n, m, k, t; cin >> n...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <vector> #define ll long long using namespace std; ll a[200050]; ll b[200050]; int ans; int main() { int n, m, k, t; cin >> n >...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78]]
1
205
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cerr << endl << "DEBUG: (" << (#x) << " = " << x << ")" << endl; #define debugArray(v) \ for (auto i : v) ...
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cerr << endl << "DEBUG: (" << (#x) << " = " << x << ")" << endl; #define debugArray(v) \ for (auto i : v) ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
261
#include <algorithm> #include <iostream> #include <string> using namespace std; const int maxn = 2e5 + 10; long long a[maxn], b[maxn]; int main() { int n, m, ans = 0; long long k; cin >> n >> m >> k; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i++) cin >> b[i]; for (int i = 1...
#include <algorithm> #include <iostream> #include <string> using namespace std; const int maxn = 2e5 + 10; long long a[maxn], b[maxn]; int main() { int n, m, ans = 0; long long k; cin >> n >> m >> k; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i++) cin >> b[i]; for (int i = 1...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
220
from collections import deque import numpy as np n,m,k = map(int,input().split()) A = deque(map(int,input().split())) B = deque(map(int,input().split())) a=[0] b = [0] for i in range(n): a.append(a[i-1]+A[i]) for i in range(m): b.append(b[i-1]+B[i]) x,j = 0,m for i in range(n+1): if a[i]>k: break ...
from collections import deque import numpy as np n,m,k = map(int,input().split()) A = deque(map(int,input().split())) B = deque(map(int,input().split())) a=[0] b = [0] for i in range(n): a.append(a[i]+A[i]) for i in range(m): b.append(b[i]+B[i]) x,j = 0,m for i in range(n+1): if a[i]>k: break ...
[["-", 3, 4, 0, 657, 31, 206, 206, 657, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 657, 12, 612]]
5
174
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define all(x) (x).begin(), (x).end() #define Sort(x) sort((x).begin(), (x).end()) #define Reverse(x) reverse((x).begin(), (x).end()) #define rep(i, n) for (int i = 0; i < (int)(n); i...
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define all(x) (x).begin(), (x).end() #define Sort(x) sort((x).begin(), (x).end()) #define Reverse(x) reverse((x).begin(), (x).end()) #define rep(i, n) for (int i = 0; i < (int)(n); i...
[["+", 31, 69, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 69, 28, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
538
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) from itertools import accumulate N, M, K = mapint() As = list(accumulate(list(mapint()))) Bs = list(accumulate(list(mapint()))) from bisect import bisect_right ans = 0 for i, a in en...
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) from itertools import accumulate N, M, K = mapint() As = [0]+list(accumulate(list(mapint()))) Bs = list(accumulate(list(mapint()))) from bisect import bisect_right ans = 0 for i, a i...
[["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 70], ["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 73], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
135
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define vi vector<int> #define vl vector<ll> #define vvi vector<vector<int>...
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define vi vector<int> #define vl vector<ll> #define vvi vector<vector<int>...
[["-", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["-", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22]]
1
301
# -*- coding: utf-8 -*- a = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) N = a[0] M = a[1] K = a[2] count = 0 #読んだ冊数を記録 count_time = 0 #読んだ時間を記録 a = [0] b = [0] for i in range(N): a.append(a[i]+A[i]) for i in range(M): b.append(b[i]+B[i]) ans, j = 0...
# -*- coding: utf-8 -*- a = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) N = a[0] M = a[1] K = a[2] count = 0 #読んだ冊数を記録 count_time = 0 #読んだ時間を記録 a = [0] b = [0] for i in range(N): a.append(a[i]+A[i]) for i in range(M): b.append(b[i]+B[i]) ans, j = 0...
[["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 47]]
5
188
import numpy as np n, m, k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) cum_a = np.r_[0,np.cumsum(a)] # cum_b = np.r_[0, np.cumsum(b)] # cum_a = np.cumsum(a) cum_b = np.cumsum(b) # high = m # low = 0 # totaltime = 0 ans = 0 for i in range(n + 1): # # totaltime = c...
import numpy as np n, m, k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) cum_a = np.r_[0,np.cumsum(a)] # cum_b = np.r_[0, np.cumsum(b)] # cum_a = np.cumsum(a) cum_b = np.cumsum(b) # high = m # low = 0 # totaltime = 0 ans = 0 for i in range(n + 1): # # totaltime = c...
[["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 662, 12, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 653, 0, 32], ["+", 12, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["+", 12, 652, 3, 4, 0, 653, 51, 557, 0, 6], ["+", 12, 652, 3, 4, 0, 653, 51, 557, 0, 655]]
5
152
#c n,m,k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = [0] d = 0 for i in range(n): d += a[i] c.append(d) e = [0] f = 0 for i in range(m): f += b[i] e.append(f) ans = 0 j = q-1 for i in range(n): if c[i] > k: break else: ...
n,m,k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = [0] d = 0 for i in range(n): d += a[i] c.append(d) e = [0] f = 0 for i in range(m): f += b[i] e.append(f) ans = 0 j = m for i in range(n+1): if c[i] > k: break else: ...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
166
#include <iostream> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; int a[n], b[m]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; long long t = 0; for (int i = 0; i < m; i++) t += b[i]; int j = m; int ans = 0; for (int i = 0; i < n +...
#include <iostream> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; int a[n], b[m]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> b[i]; long long t = 0; for (int i = 0; i < m; i++) t += b[i]; int j = m; int ans = 0; for (int i = 0; i < n +...
[["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 47]]
1
200
import sys #DEBUG = True DEBUG = False if DEBUG: f=open("202006_5th/C_input.txt") else: f=sys.stdin #---- M,N,K=map(int,f.readline().split()) ans=0 __=N M_shelf=list(map(int,f.readline().split())) N_shelf=list(map(int,f.readline().split())) M_partial=[] N_partial=[] M_partial.append(0) N_partial.append(0) #----...
import sys #DEBUG = True DEBUG = False if DEBUG: f=open("202006_5th/C_input.txt") else: f=sys.stdin #---- M,N,K=map(int,f.readline().split()) ans=0 __=N M_shelf=list(map(int,f.readline().split())) N_shelf=list(map(int,f.readline().split())) M_partial=[] N_partial=[] M_partial.append(0) N_partial.append(0) #----...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
210
#include <bits/stdc++.h> using namespace std; long long aPrefixSum[200005], bPrefixSum[200005]; long long N, M, K; int main() { scanf("%lld%lld%lld", &N, &M, &K); for (long long i = 1; i <= N; i++) { long long Ai; scanf("%lld", &Ai); aPrefixSum[i] = aPrefixSum[i - 1] + (long long)(Ai); } for (l...
#include <bits/stdc++.h> using namespace std; long long aPrefixSum[200005], bPrefixSum[200005]; long long N, M, K; int main() { scanf("%lld%lld%lld", &N, &M, &K); for (long long i = 1; i <= N; i++) { long long Ai; scanf("%lld", &Ai); aPrefixSum[i] = aPrefixSum[i - 1] + (long long)(Ai); } for (l...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
247
from itertools import accumulate import bisect n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) x = 0 a1 = [0] + list(accumulate(a)) b1 = list(accumulate(b)) for i in range(1, n + 1): ren = k - a1[i] if ren < 0: break j = bisect.bisect_right(b1, ren...
from itertools import accumulate import bisect n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) x = 0 a1 = [0] + list(accumulate(a)) b1 = list(accumulate(b)) for i in range(n + 1): ren = k - a1[i] if ren < 0: break j = bisect.bisect_right(b1, ren) ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
133
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } #define all(x) (x).beg...
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } #define all(x) (x).beg...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
362
let input = "3 8 730\n60 90 120\n80 150 80 150 11 11 11 11 11"; function main(input) { input = input.trim(); let N = parseInt(input.split("\n")[0].split(" ")[0]); let M = parseInt(input.split("\n")[0].split(" ")[1]); let K = parseInt(input.split("\n")[0].split(" ")[2]); let nBooks = input.split("\n")[1].spl...
let input = "3 8 730\n60 90 120\n80 150 80 150 11 11 11 11 11"; function main(input) { input = input.trim(); let N = parseInt(input.split("\n")[0].split(" ")[0]); let M = parseInt(input.split("\n")[0].split(" ")[1]); let K = parseInt(input.split("\n")[0].split(" ")[2]); let nBooks = input.split("\n")[1].spl...
[["-", 8, 556, 0, 7, 15, 1, 0, 16, 12, 555], ["+", 0, 7, 15, 1, 0, 16, 12, 91, 17, 33], ["+", 0, 7, 15, 1, 0, 16, 12, 91, 28, 555]]
2
427