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 <algorithm> #include <cstdio> #include <iostream> using namespace std; int sum1[200005], sum2[200005]; int n, m, k, ans; int main() { scanf("%d%d%d", &n, &m, &k); int x; for (int i = 1; i <= n; i++) scanf("%d", &x), sum1[i] = sum1[i - 1] + x; for (int i = 1; i <= m; i++) scanf("%d", &x), sum...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; long long sum1[200005], sum2[200005]; int n, m, k, ans; int main() { scanf("%d%d%d", &n, &m, &k); int x; for (int i = 1; i <= n; i++) scanf("%d", &x), sum1[i] = sum1[i - 1] + x; for (int i = 1; i <= m; i++) scanf("%d", &x...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96]]
1
204
n_book_a, n_book_b, limit_time = map(int, input().split(" ")) read_time_a = [int(i) for i in input().split(" ")] read_time_b = [int(i) for i in input().split(" ")] read_sum_time_a = [0] # 1冊も読まないパターン for i in range(n_book_a): read_sum_time_a.append(read_sum_time_a[i] + read_time_a[i]) read_sum_time_b = [0] ...
n_book_a, n_book_b, limit_time = map(int, input().split(" ")) read_time_a = [int(i) for i in input().split(" ")] read_time_b = [int(i) for i in input().split(" ")] read_sum_time_a = [0] # 1冊も読まないパターン for i in range(n_book_a): read_sum_time_a.append(read_sum_time_a[i] + read_time_a[i]) read_sum_time_b = [0] ...
[["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]]
5
173
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <string> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; long long int a[n + 1]; for (int i = 0; i < n; i++) { cin >> a[i]; } long long int b[m + 1]; for (int i = 0; i < m; i++)...
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <string> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; long long int a[n + 1]; for (int i = 0; i < n; i++) { cin >> a[i]; } long long int b[m + 1]; for (int i = 0; i < m; i++)...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 31, 22]]
1
227
n,m,k=map(int,input().split(" ")) a=[-9] b=list(a) a.extend(map(int,input().split(" "))) b.extend(map(int,input().split(" "))) t=0 i=1 while i<=n : # print("a[{}]={}".format(i,a[i])) if t+a[i]>k : break t+=a[i] # print("t=",t) i+=1 i-=1 # print("i=",i) j=1 while j<=m : if t+b[j]>k : ...
n,m,k=map(int,input().split(" ")) a=[-9] b=list(a) a.extend(map(int,input().split(" "))) b.extend(map(int,input().split(" "))) t=0 i=1 while i<=n : # print("a[{}]={}".format(i,a[i])) if t+a[i]>k : break t+=a[i] # print("t=",t) i+=1 i-=1 # print("i=",i) j=1 while j<=m : if t+b[j]>k : ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
211
N, M, K = input().split() A = input().split() B = input().split() ta = 0 cnta = 0 while cnta < int(N) and ta + int(A[cnta]) <= int(K): ta += int(A[cnta]) cnta+=1 tb = 0 cntb = 0 while cntb < int(M) and ta + tb + int(B[cntb]) <= int(K): tb += int(B[cntb]) cntb += 1 ans = cnta + cntb while cnta >= ...
N, M, K = input().split() A = input().split() B = input().split() ta = 0 cnta = 0 while cnta < int(N) and ta + int(A[cnta]) <= int(K): ta += int(A[cnta]) cnta+=1 tb = 0 cntb = 0 while cntb < int(M) and ta + tb + int(B[cntb]) <= int(K): tb += int(B[cntb]) cntb += 1 ans = cnta + cntb while cnta - 1...
[["+", 0, 656, 0, 52, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 52, 15, 666, 0, 657, 12, 612], ["+", 12, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["+", 12, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
188
n,m,k=input().split() a=input().split() b=input().split() ta=0 cnta=0 while int(cnta)<int(n) and ta+int(a[cnta])<=int(k) : ta= ta+ int(a[cnta]) cnta=cnta+1 tb=0 cntb=0 while cntb<int(m) and ta+tb+int(b[cntb])<=int(k): tb = tb+ int(b[cntb]) cntb=cntb+1 ans=cnta+cntb while cnta<=0: ta=ta-int(a[cnta]...
n,m,k=input().split() a=input().split() b=input().split() ta=0 cnta=0 while int(cnta)<int(n) and ta+int(a[cnta])<=int(k) : ta= ta+ int(a[cnta]) cnta=cnta+1 tb=0 cntb=0 while cntb<int(m) and ta+tb+int(b[cntb])<=int(k): tb = tb+ int(b[cntb]) cntb=cntb+1 ans=cnta+cntb while cnta-1>=0: ta=ta-int(a[cnt...
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 19], ["+", 0, 656, 0, 52, 15, 666, 0, 657, 17, 33], ["+", 0, 656, 0, 52, 15, 666, 0, 657, 12, 612], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 20], ["+", 12, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["+", 12, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
207
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 9; int n, m; int a[maxn], b[maxn], k; void _solve() { scanf("%d%d%d", &n, &m, &k); int i, j; for (i = 1; i <= n; ++i) scanf("%d", a + i); for (i = 1; i <= m; ++i) scanf("%d", b + i); int t = 0; for (i = 1; i <= n; ++i) { if ...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 9; int n, m; int a[maxn], b[maxn], k; void _solve() { scanf("%d%d%d", &n, &m, &k); int i, j; for (i = 1; i <= n; ++i) scanf("%d", a + i); for (i = 1; i <= m; ++i) scanf("%d", b + i); int t = 0; for (i = 1; i <= n; ++i) { if ...
[["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13]]
1
282
import bisect def main(): N, M, K = map(int, input().split()) A = [int(v) for v in input().split()] B = [int(v) for v in input().split()] ruisekiA = [0 for _ in range(N+1)] ruisekiB = [0 for _ in range(M+1)] for i in range(N): ruisekiA[i + 1] = ruisekiA[i] + A[i] for i in range(M):...
import bisect def main(): N, M, K = map(int, input().split()) A = [int(v) for v in input().split()] B = [int(v) for v in input().split()] ruisekiA = [0 for _ in range(N+1)] ruisekiB = [0 for _ in range(M+1)] for i in range(N): ruisekiA[i + 1] = ruisekiA[i] + A[i] for i in range(M):...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["-", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
220
#include <bits/stdc++.h> using namespace std; #define intt long long #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); int n, m; intt k; int main() { FAST; cin >> n >> m >> k; vector...
#include <bits/stdc++.h> using namespace std; #define intt long long #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); int n, m; intt k; int main() { FAST; cin >> n >> m >> k; vector...
[["-", 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, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["+", 0, 7, 8, 9, 0, 57, 64, 93, 0, 94]]
1
294
from itertools import zip_longest, count, accumulate from bisect import bisect, bisect_left def LIST(): return list(map(int, input().split())) n, m, k = map(int, input().split()) a = [0] + list(accumulate(LIST())) b = list(accumulate(LIST())) num = 0 for i, a in enumerate(a): time_rest = k - a if time_...
from itertools import zip_longest, count, accumulate from bisect import bisect, bisect_left def LIST(): return list(map(int, input().split())) n, m, k = map(int, input().split()) a = [0] + list(accumulate(LIST())) b = list(accumulate(LIST())) num = 0 for i, a in enumerate(a): time_rest = k - a if t...
[["-", 12, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 657, 12, 652, 63, 22]]
5
122
#include <bits/stdc++.h> typedef long long ll; #define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (n); ++i) #define AA(i) cout << i << endl; #define AS(i) cout << i << " "; const int INF = 1001001001; const double PI = 3.14159; using namespace std; int main() { ...
#include <bits/stdc++.h> typedef long long ll; #define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (n); ++i) #define AA(i) cout << i << endl; #define AS(i) cout << i << " "; const int INF = 1001001001; const double PI = 3.14159; using namespace std; int main() { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
223
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <s...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <s...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40]]
1
423
#include <algorithm> #include <array> #include <deque> #include <functional> #include <iostream> #include <math.h> #include <numeric> #include <vector> #define ll long long int #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, n) using namespace std...
#include <algorithm> #include <array> #include <deque> #include <functional> #include <iostream> #include <math.h> #include <numeric> #include <vector> #define ll long long int #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, n) using namespace std...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
1
241
/* g++ -std=c++14 -o2 -Wall ABC.cpp -o .\ABC.out .\ABC.out */ #include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[200010]; ll b[200010]; int main() { int n, m, k; cin >> n >> m >> k; int c; for (int i = 0; i < n; ++i) { cin >> c; a[i + 1] = a[i] + c; } for (int i = 0; i < m;...
/* g++ -std=c++14 -o2 -Wall ABC.cpp -o .\ABC.out .\ABC.out */ #include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[200010]; ll b[200010]; int main() { int n, m, k; cin >> n >> m >> k; int c; for (int i = 0; i < n; ++i) { cin >> c; a[i + 1] = a[i] + c; } for (int i = 0; i < m;...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
210
#include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #include <iter...
#include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #include <iter...
[["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 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
282
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> ii; struct fastio { fastio() { ios::sync_with_stdio(false); cout << setprecision(10) << fixed; cin.tie(0); } }; fastio _fast_io; int n, m, k; const int N = 2e5 + 5; int a[N], b[N]; int ai, bi, cnt; int ma...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> ii; struct fastio { fastio() { ios::sync_with_stdio(false); cout << setprecision(10) << fixed; cin.tie(0); } }; fastio _fast_io; int n, m, k; const int N = 2e5 + 5; int a[N], b[N]; int ai, bi, cnt; int ma...
[["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
282
#include <iostream> #include <stdio.h> #define INT long long int using namespace std; INT A[200100], B[200100]; INT n, m, k, i, ans, j; int main() { cin >> n >> m >> k; for (i = 1; i <= n; i++) { cin >> A[i]; A[i] = A[i] + A[i - 1]; } for (i = 1; i <= m; i++) { cin >> B[i]; B[i] = B[i] + B[i - ...
#include <iostream> #include <stdio.h> #define INT long long int using namespace std; INT A[200100], B[200100]; INT n, m, k, i, ans, j; int main() { cin >> n >> m >> k; for (i = 1; i <= n; i++) { cin >> A[i]; A[i] = A[i] + A[i - 1]; } for (i = 1; i <= m; i++) { cin >> B[i]; B[i] = B[i] + B[i - ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
211
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> //#include<bits/stdc++.h> #define ll long long int #define ull unsigned long long int #define I(a) scanf("%d", &a) #define I2(a, b) scanf("%d%d", &a, &b) #defi...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> //#include<bits/stdc++.h> #define ll long long int #define ull unsigned long long int #define I(a) scanf("%d", &a) #define I2(a, b) scanf("%d%d", &a, &b) #defi...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
865
#include <bits/stdc++.h> using namespace std; int n, m, k, x, ans, ansa, ansb, ja, jb; long long a[200010], b[200010], bj[200010]; void dfs(int i, int j, int num) { // printf("aa"); // if(i > n || j > m) return; // if(bj[num][t]) return; // bj[num][t] = 1; if (num <= ans) return; if (a[i] + b[j] <= k) {...
#include <bits/stdc++.h> using namespace std; int n, m, k, x, ans, ansa, ansb, ja, jb; long long a[200010], b[200010], bj[200010]; void dfs(int i, int j, int num) { // printf("aa"); // if(i > n || j > m) return; // if(bj[num][t]) return; // bj[num][t] = 1; if (num <= ans) return; if (a[i] + b[j] <= k) {...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
325
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef unsigned long long int ulli; typedef long double ld; const lli INF = 1e9 + 100; const lli INF64 = (1LL << 61) + 100; const lli MOD = 1e9 + 7; const lli MH1 = 1599614977, MH2 = 2034417103, MH3 = 1090250123, MH4 = 2024491871; const...
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef unsigned long long int ulli; typedef long double ld; const lli INF = 1e9 + 100; const lli INF64 = (1LL << 61) + 100; const lli MOD = 1e9 + 7; const lli MH1 = 1599614977, MH2 = 2034417103, MH3 = 1090250123, MH4 = 2024491871; const...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
537
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <unordered_map> #include <utility> #include <vector> template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return fa...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <unordered_map> #include <utility> #include <vector> template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return fa...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
356
// Bismillahhir Rahminir Rohim #include <bits/stdc++.h> #define dbug printf("I am here\n"); #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define vs v.size() #define ss s.size() #define be v...
// Bismillahhir Rahminir Rohim #include <bits/stdc++.h> #define dbug printf("I am here\n"); #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define vs v.size() #define ss s.size() #define be v...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
231
/// Bismillahir Rahmanir Rahim // Author: Tanvir Hussain // ICE,NSTU #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; const long long MOD = 1000000007; #define SET(x) memset(x, 0, sizeof(x)) #define SET2d(x, m, n) me...
/// Bismillahir Rahmanir Rahim // Author: Tanvir Hussain // ICE,NSTU #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; const long long MOD = 1000000007; #define SET(x) memset(x, 0, sizeof(x)) #define SET2d(x, m, n) me...
[["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
761
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; int main() { int n, m, c; c = 0; ll k; cin >> n >> m >> k; vector<ll> a(n + 1); vector<ll> b(m + 1); rep(i, n) { cin >> a[i + 1]; } rep(i, m) { cin >> b[i + 1]; } vector<ll> A(n + 1); ve...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; int main() { int n, m, c; c = 0; ll k; cin >> n >> m >> k; vector<ll> a(n + 1); vector<ll> b(m + 1); rep(i, n) { cin >> a[i + 1]; } rep(i, m) { cin >> b[i + 1]; } vector<ll> A(n + 1); ve...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
304
#include <iostream> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; int a[n + 1], b[m + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i++) cin >> b[i]; long long pa[n + 1]; long long pb[m + 1]; pa[0] = 0; pb[0] = 0; for (int i = 1; i <= n; i++) ...
#include <iostream> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; int a[n + 1], b[m + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= m; i++) cin >> b[i]; long long pa[n + 1]; long long pb[m + 1]; pa[0] = 0; pb[0] = 0; for (int i = 1; i <= n; i++) ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
250
#!/usr/bin/env python import os import operator from collections import defaultdict import sys from io import BytesIO, IOBase import bisect # def power(x, p): # res = 1 # while p: # if p & 1: # res = res * x % 1000000007 # x = x * x % 1000000007 # p >>= 1 # return res; ...
#!/usr/bin/env python import os import operator from collections import defaultdict import sys from io import BytesIO, IOBase import bisect # def power(x, p): # res = 1 # while p: # if p & 1: # res = res * x % 1000000007 # x = x * x % 1000000007 # p >>= 1 # return res; ...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]]
5
692
import java.io.*; import java.util.*; // public class Main { static StringTokenizer st; static BufferedReader br; static PrintWriter out; public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); // why ? because pick small is not always ri...
import java.io.*; import java.util.*; // public class Main { static StringTokenizer st; static BufferedReader br; static PrintWriter out; public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); // why ? because pick small is not always ri...
[["-", 0, 57, 64, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 57, 64, 196, 0, 7, 15, 16, 12, 499]]
3
655
#include <bits/stdc++.h> using namespace std; 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; } #define rep(i, cc, n) for (int i = cc; i < n; ++i) #defi...
#include <bits/stdc++.h> using namespace std; 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; } #define rep(i, cc, n) for (int i = cc; i < n; ++i) #defi...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
438
/*------------------------------------ ........Bismillahir Rahmanir Rahim.... ..........created by Abdul Aziz....... ------------------------------------*/ #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <unordered_m...
/*------------------------------------ ........Bismillahir Rahmanir Rahim.... ..........created by Abdul Aziz....... ------------------------------------*/ #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <unordered_m...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 7, 8, 9, 0, 52, 0, 89]]
1
270
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef int ll; typedef unsigned long long ull; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<ll> vll; typedef vector<pll> vpll; typedef ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef int ll; typedef unsigned long long ull; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<ll> vll; typedef vector<pll> vpll; typedef ...
[["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22]]
1
537
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { int m, n; cin >> m >> n; ll k; cin >> k; vector<ll> v, v1; ll s = 0, s1 = 0; v.push_back(0); for (int i = 0; i < m; ++i) { ll a; cin >> a; s += a; v.push_back(s); } v1.push_back(0); for (int i = 0...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { int m, n; cin >> m >> n; ll k; cin >> k; vector<ll> v, v1; ll s = 0, s1 = 0; v.push_back(0); for (int i = 0; i < m; ++i) { ll a; cin >> a; s += a; v.push_back(s); } v1.push_back(0); for (int i = 0...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
261
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P;...
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P;...
[["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 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], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 9, 0, 43, 49, 50, 51, 13]]
1
936
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long unsigned int ...
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long unsigned int ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
312
#include <bits/stdc++.h> using namespace std; #define pb push_back #define FOR(i, a, n) for (int i = a; i < n; i++) #define mp make_pair #define RFOR(i, a, n) for (int i = n; i > a; i--) #define pii pair<long long int, long long int> #define ub upper_bound #define lb lower_bound #define MOD 1000000007 typedef long long...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define FOR(i, a, n) for (int i = a; i < n; i++) #define mp make_pair #define RFOR(i, a, n) for (int i = n; i > a; i--) #define pii pair<long long int, long long int> #define ub upper_bound #define lb lower_bound #define MOD 1000000007 typedef long long...
[["-", 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, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
376
#include <iostream> typedef long long ll; using namespace std; // ll sumArray(ll a[], int n) // { // ll sum = 0; // for (int i = 0; i < n; i++) // { // sum += a[i]; // } // return sum; // } int main() { int N, M, K; int ans = 0; int ans_tmp; cin >> N >> M >> K; ll A[N]; ll B[M]; ll A_acc[N + 1...
#include <iostream> typedef long long ll; using namespace std; // ll sumArray(ll a[], int n) // { // ll sum = 0; // for (int i = 0; i < n; i++) // { // sum += a[i]; // } // return sum; // } int main() { int N, M, K; int ans = 0; int ans_tmp; cin >> N >> M >> K; ll A[N]; ll B[M]; ll A_acc[N + 1...
[["+", 12, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22]]
1
285
#include <math.h> #include <stdio.h> typedef long long int ll; int main() { ll m, n, k, max, lcount, rcount, x; scanf("%lld %lld %lld", &n, &m, &k); ll stack1[n], stack2[m], prev = 0; for (int i = 0; i < n; i++) { scanf("%lld", &x); stack1[i] = prev + x; prev = stack1[i]; } prev = 0; for (int ...
#include <math.h> #include <stdio.h> typedef long long int ll; int main() { ll m, n, k, max, lcount, rcount, x; scanf("%lld %lld %lld", &n, &m, &k); ll stack1[n], stack2[m], prev = 0; for (int i = 0; i < n; i++) { scanf("%lld", &x); stack1[i] = prev + x; prev = stack1[i]; } prev = 0; for (int ...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 47], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 20]]
0
330
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; const int MAX = 200000; int main() { int N, M, K; long long A[MAX], B[MAX]; cin >> N >> M >> ...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; const int MAX = 200000; int main() { int N, M, K; long long A[MAX], B[MAX]; cin >> N >> M >> ...
[["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
254
import bisect N,M,K=map(int,inp().split()) list_a=list(map(int,inp().split())) list_b=list(map(int,inp().split())) totaltame_a=[0] for a in list_a: temp_a=totaltame_a[-1]+a if temp_a>K: break else: totaltame_a.append(temp_a) totaltime_b=[0] for b in list_b: totaltime_b.append(totalt...
import bisect N,M,K=map(int,input().split()) list_a=list(map(int,input().split())) list_b=list(map(int,input().split())) totaltame_a=[0] for a in list_a: temp_a=totaltame_a[-1]+a if temp_a>K: break else: totaltame_a.append(temp_a) totaltime_b=[0] for b in list_b: totaltime_b.append(...
[["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22]]
5
162
# abc172_c.py ''' 尺取り法、二分探索、両方良問なので両方で解けるようにする。 ''' N, M ,K= map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) ans = 0 cnt = [] b_idx = M-1 # A を1冊ずつ増やす→B の読める場所を後ろにずらしていくイメージで実装する # 両方累積和で管理して、計算を減らす(Bは特に後ろにずらすと再計算が必要) b_cum = [] cum = 0 for b in B: cum += b b_cum....
# abc172_c.py ''' 尺取り法、二分探索、両方良問なので両方で解けるようにする。 ''' N, M ,K= map(int,input().split()) A = [0] + list(map(int,input().split())) B = list(map(int,input().split())) ans = 0 cnt = [] b_idx = M-1 # A を1冊ずつ増やす→B の読める場所を後ろにずらしていくイメージで実装する # 両方累積和で管理して、計算を減らす(Bは特に後ろにずらすと再計算が必要) b_cum = [] cum = 0 for b in B: cum += b ...
[["+", 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, 662, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
146
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define REP(i, N) for (int i = 0; i < N; i++) #define REP1(i, N) for (int i = 1; i < N; i++) #define RREP(i, N) for (int i = N - 1; i >= 0; --i) #define ANS(a) cout << a << endl #define SORT(V) sort(V.begin(), V.end())...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define REP(i, N) for (int i = 0; i < N; i++) #define REP1(i, N) for (int i = 1; i < N; i++) #define RREP(i, N) for (int i = N - 1; i >= 0; --i) #define ANS(a) cout << a << endl #define SORT(V) sort(V.begin(), V.end())...
[["+", 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
302
import bisect n,m,k = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_cum = [0] B_cum = [0] for i in range(n): A_cum.append(A_cum[i]+A[i]) for i in range(m): B_cum.append(B_cum[i]+B[i]) ans = 0 for i in range(n+1): rest = k-A_cum[i] if rest<=0: ...
import bisect n,m,k = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_cum = [0] B_cum = [0] for i in range(n): A_cum.append(A_cum[i]+A[i]) for i in range(m): B_cum.append(B_cum[i]+B[i]) ans = 0 for i in range(n+1): rest = k-A_cum[i] if rest<0: con...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 3, 4, 0, 657, 31, 652, 63, 319, 319, 22], ["+", 0, 657, 31, 657, 31, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612]]
5
156
import bisect n,m,k = map(int,input().split()) a = [0]+list(map(int,input().split())) b = list(map(int,input().split())) for i in range(1,n+1): a[i] += a[i-1] for j in range(1,m): b[j] += b[j-1] ans = 0 for i in range(n+1): x = k-a[i] ptr = bisect.bisect_right(b,x) ans = max(ans,ptr+i) print(ans)
import bisect n,m,k = map(int,input().split()) a = [0]+list(map(int,input().split())) b = list(map(int,input().split())) for i in range(1,n+1): a[i] += a[i-1] for j in range(1,m): b[j] += b[j-1] ans = 0 for i in range(n+1): x = k-a[i] if x < 0: break ptr = bisect.bisect_right(b,x) ans = max(ans,ptr+i) p...
[["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
147
def INT(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) N, M, K = MI() A = [0] + LI() B = [0] + LI() for i in range(1, N + 1): A[i] += A[i - 1] for i in range(1, M + 1): B[i] += B[i - 1] if B[i] <= K: ans = i a...
def INT(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) N, M, K = MI() A = [0] + LI() B = [0] + LI() for i in range(1, N + 1): A[i] += A[i - 1] for i in range(1, M + 1): B[i] += B[i - 1] if B[i] <= K: ans = i a...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
231
#include <bits/stdc++.h> using namespace std; using int32 = int_fast32_t; using int64 = int_fast64_t; #define INF (int32)1e9 #define INF_LL (int64)1e18 #define REP(i, n) for (int64 i = 0; i < (n); i++) #define RANGE(i, a, b) for (int64 i = a; i < b; i++) int main() { int32 n, m, k; cin >> n >> m >> k; int64 a[n...
#include <bits/stdc++.h> using namespace std; using int32 = int_fast32_t; using int64 = int_fast64_t; #define INF (int32)1e9 #define INF_LL (int64)1e18 #define REP(i, n) for (int64 i = 0; i < (n); i++) #define RANGE(i, a, b) for (int64 i = a; i < b; i++) int main() { int32 n, m, k; cin >> n >> m >> k; int64 a[n...
[["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22]]
1
239
n,m,k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) for i in range(n): if i == 0: continue else: a[i] += a[i-1] for i in range(m): if i == 0: continue else: b[i] += b[i - 1] a = [0]+a b = [0]+b i = 0 j = m ans = 0 wh...
n,m,k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) for i in range(n): if i == 0: continue else: a[i] += a[i-1] for i in range(m): if i == 0: continue else: b[i] += b[i - 1] a = [0]+a b = [0]+b i = 0 j = m ans = 0 wh...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32]]
5
190
#include <bits/stdc++.h> #define ll long long int #define uu first #define vv second #define pii pair<int, int> #define pll pair<ll, ll> #define INF 1e9 #define fastRead \ ios_base::sync_with_stdio(0); \ cin...
#include <bits/stdc++.h> #define ll long long int #define uu first #define vv second #define pii pair<int, int> #define pll pair<ll, ll> #define INF 1e9 #define fastRead \ ios_base::sync_with_stdio(0); \ cin...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
241
<?php [$N, $M, $K] = ints(); $A = ints(); $B = ints(); $A = array_reverse($A); $C = array_merge($A,$B); $sum = 0; $j = 0; $max = -1; foreach($C as $i => $c){ $sum += $c; while($sum > $K){ $sum -= $C[$j] ?? 0; $j++; } if($i >= count($A) && $j <= count($A)){ chmax($max, $i-$j); } } echo $max+1; func...
<?php [$N, $M, $K] = ints(); $A = ints(); $B = ints(); $A = array_reverse($A); $C = array_merge($A,$B); $sum = 0; $j = 0; $max = -1; foreach($C as $i => $c){ $sum += $c; while($sum > $K){ $sum -= $C[$j] ?? 0; $j++; } if($i >= count($A)-1 && $j <= count($A)){ chmax($max, $i-$j); } } echo $max+1; fu...
[["+", 15, 23, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 15, 23, 0, 16, 31, 16, 12, 16, 12, 612]]
6
1,394
#include <bits/stdc++.h> using namespace std; #define fastio \ cin.tie(NULL); \ cout.tie(NULL); \ ios_base::sync_with_stdio(0...
#include <bits/stdc++.h> using namespace std; #define fastio \ cin.tie(NULL); \ cout.tie(NULL); \ ios_base::sync_with_stdio(0...
[["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 18]]
1
380
#include <bits/stdc++.h> #define ll long long int ll N, M, K, A[200100], B[200100], i, st, ans; using namespace std; int main() { cin >> N >> M >> K; for (i = 1; i <= N; i++) { cin >> st; A[i] = A[i - 1] + st; } for (i = 1; i <= M; i++) { cin >> st; B[i] = B[i - 1] + st; } for (i = 1; i <= N...
#include <bits/stdc++.h> #define ll long long int ll N, M, K, A[200100], B[200100], i, st, ans; using namespace std; int main() { cin >> N >> M >> K; for (i = 1; i <= N; i++) { cin >> st; A[i] = A[i - 1] + st; } for (i = 1; i <= M; i++) { cin >> st; B[i] = B[i - 1] + st; } for (i = 0; i <= N...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
179
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mod = 1e9 + 0LL; ll MOD = 1e18 + 0LL; ll md = 1000000007; const double PI = acos(-1); typedef vector<int> vi; typedef pair<int, int> pii; #define sz(v) ((int)((v).size())) #define all(v) ((v).begin()), ((v).end()) #define pb push_back #define f...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mod = 1e9 + 0LL; ll MOD = 1e18 + 0LL; ll md = 1000000007; const double PI = acos(-1); typedef vector<int> vi; typedef pair<int, int> pii; #define sz(v) ((int)((v).size())) #define all(v) ((v).begin()), ((v).end()) #define pb push_back #define f...
[["+", 0, 43, 49, 50, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 12, 13]]
1
833
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { int N, M, K; cin >> N >> M >> K; vector<int> adesk(N + 1); vector<int> bdesk(M + 1); ll sumb = 0; ll suma = 0; int ans = 0; rep(i, N) { cin >> adesk.at(i + 1); } rep(...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { int N, M; ll K; cin >> N >> M >> K; vector<int> adesk(N + 1); vector<ll> bdesk(M + 1); ll sumb = 0; ll suma = 0; int ans = 0; rep(i, N) { cin >> adesk.at(i + 1); } ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 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], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
228
# coding:utf-8 import itertools n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 j = m aa = [0] + list(itertools.accumulate(a)) bb = [0] + list(itertools.accumulate(b)) #print(aa) #print(bb) # しゃくとり法 / Aの山だけ読みつつ、そこにBからいくつ取り出すかで考える for i, a_item in en...
# coding:utf-8 import itertools n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) ans = 0 j = m aa = [0] + list(itertools.accumulate(a)) bb = [0] + list(itertools.accumulate(b)) # print(aa) # print(bb) # しゃくとり法 / Aの山だけ読みつつ、そこにBからいくつ取り出すかで考える for i, a_item in ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 52, 15, 666, 0, 657, 12, 206, 51, 22], ["+", 0, 52, 15, 666, 0, 657, 12, 206, 51, 22]]
5
137
#include <bits/stdc++.h> #define ps push_back #define LL long long using namespace std; const int maxn = 2e5 + 5; int a[maxn], b[maxn]; LL prea[maxn], preb[maxn]; int main() { int N, M, K; cin >> N >> M >> K; for (int i = 0; i < N; i++) { cin >> a[i]; if (i) prea[i] = prea[i - 1] + a[i]; else ...
#include <bits/stdc++.h> #define ps push_back #define LL long long using namespace std; const int maxn = 2e5 + 5; int a[maxn], b[maxn]; LL prea[maxn], preb[maxn]; int main() { LL N, M, K; cin >> N >> M >> K; for (int i = 0; i < N; i++) { cin >> a[i]; if (i) prea[i] = prea[i - 1] + a[i]; else ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 3...
1
358
#include <bits/stdc++.h> using namespace std; #define int long long #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define pb push_back #define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define Test \ int T; ...
#include <bits/stdc++.h> using namespace std; #define int long long #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define pb push_back #define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define Test \ int T; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
562
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, m, k, a[200005], b[200005], asum[200005], bsum[200005], j, ans = 0; int main() { cin >> n >> m >> k; j = m; for (ll i = 1; i <= n; i++) { cin >> a[i]; asum[i] = a[i] + asum[i - 1]; } for (ll i = 1; i <= m; i++) { cin >> b[i];...
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, m, k, a[200005], b[200005], asum[200005], bsum[200005], j, ans = 0; int main() { cin >> n >> m >> k; j = m; for (ll i = 1; i <= n; i++) { cin >> a[i]; asum[i] = a[i] + asum[i - 1]; } for (ll i = 1; i <= m; i++) { cin >> b[i];...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
202
// C - Tsundoku // Hiia #include <stdio.h> #include <stdlib.h> //rannsuu, zettaichi(absolute) #include <time.h> // srand((unsigned int) time(0)); #include <math.h> //koudona keisann #include <string.h> //hairetsu #define max(p, q) ((p) > (q) ? (p) : (q)) #define min(p, q) ((p) < (q) ? (p) : (q)) #define N 998244353 ...
// C - Tsundoku // Hiia #include <stdio.h> #include <stdlib.h> //rannsuu, zettaichi(absolute) #include <time.h> // srand((unsigned int) time(0)); #include <math.h> //koudona keisann #include <string.h> //hairetsu #define max(p, q) ((p) > (q) ? (p) : (q)) #define min(p, q) ((p) < (q) ? (p) : (q)) #define N 998244353 ...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
0
636
N, M, K = gets.split(" ").map(&:to_i) a = gets.split(" ").map(&:to_i) b = gets.split(" ").map(&:to_i) aa = [0] bb = [0] N.times do |i| aa << a[i] + aa.last end M.times do |i| bb << b[i] + bb.last end ans, j = 0, M N.times do |i| break if aa[i] > K while bb[j] > K - aa[i] j -= 1 end ans...
N, M, K = gets.split(" ").map(&:to_i) a = gets.split(" ").map(&:to_i) b = gets.split(" ").map(&:to_i) aa = [0] bb = [0] N.times do |i| aa << a[i] + aa.last end M.times do |i| bb << b[i] + bb.last end ans, j = 0, M (N + 1).times do |i| break if aa[i] > K while bb[j] > K - aa[i] j -= 1 end ...
[["+", 36, 36, 0, 493, 0, 652, 486, 739, 0, 24], ["+", 0, 493, 0, 652, 486, 739, 0, 738, 17, 72], ["+", 0, 493, 0, 652, 486, 739, 0, 738, 12, 612], ["+", 36, 36, 0, 493, 0, 652, 486, 739, 0, 25]]
4
150
#include <bits/stdc++.h> typedef long long LL; typedef unsigned long long LONG; const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; const int MAXINT = 2147483647; const int mod = 1000000007; const long long MAXLONG = 9223372036854775807; const LL INT32 = (LL(MAXINT) + 1) * 2; using namespace std; typedef pair<int, int>...
#include <bits/stdc++.h> typedef long long LL; typedef unsigned long long LONG; const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; const int MAXINT = 2147483647; const int mod = 1000000007; const long long MAXLONG = 9223372036854775807; const LL INT32 = (LL(MAXINT) + 1) * 2; using namespace std; typedef pair<int, int>...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
493
from itertools import accumulate from bisect import * N, M, K = [int(n) for n in input().split()] A = [0]+[x for x in accumulate([int(n) for n in input().split()])] B = [0]+[x for x in accumulate([int(n) for n in input().split()])] ans = 0 a = bisect_left(A, K) for i in range(a): b = bisect_left(B, K-A[i]) ans = m...
from itertools import accumulate from bisect import * N, M, K = [int(n) for n in input().split()] A = [0]+[x for x in accumulate([int(n) for n in input().split()])] B = [0]+[x for x in accumulate([int(n) for n in input().split()])] #print(A) #print(B) ans = 0 a = bisect_right(A, K) #print(a) for i in range(a): b = b...
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
138
#include <bits/stdc++.h> using namespace std; void input(int &N, int &M, int &K, vector<int> &deskA, vector<int> &deskB) { int a, b; cin >> N >> M >> K; deskA.resize(N + 1, 0); deskB.resize(M + 1, 0); for (int i = 1; i <= N; i++) { cin >> a; deskA[i] = deskA[i - 1] + a; } for (int i = 1; i <= M;...
#include <bits/stdc++.h> using namespace std; void input(int &N, int &M, int &K, vector<int> &deskA, vector<int> &deskB) { int a, b; cin >> N >> M >> K; deskA.resize(N + 1, 0); deskB.resize(M + 1, 0); for (int i = 1; i <= N; i++) { cin >> a; deskA[i] = deskA[i - 1] + a; } for (int i = 1; i <= M;...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
338
#include <algorithm> #include <iostream> #include <queue> #define For(i, x, y) for (int i = (x); i <= (y); i++) using namespace std; typedef long long ll; const int maxn = 2e5 + 10; ll a[maxn], b[maxn]; ll pre1[maxn], pre2[maxn]; int main() { int n, m, k, x, pos; int ans = 0; cin >> n >> m >> k; For(i, 1, n) ci...
#include <algorithm> #include <iostream> #include <queue> #define For(i, x, y) for (int i = (x); i <= (y); i++) using namespace std; typedef long long ll; const int maxn = 2e5 + 10; ll a[maxn], b[maxn]; ll pre1[maxn], pre2[maxn]; int main() { int n, m, k, x, pos; int ans = 0; cin >> n >> m >> k; For(i, 1, n) ci...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
258
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): a[i] = a[i-1] + a[i] for i in range(1, M): b[i] = b[i-1] + b[i] cnt = 0 b_idx = M for i in range(N+1): if a[i] > K: break for j in range(b_idx, -1, -1):...
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-1] + a[i] for i in range(1, M+1): b[i] = b[i-1] + b[i] cnt = 0 b_idx = M for i in range(N+1): if a[i] > K: break for j in range(b_idx, -1, ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
182
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) #define FOR(i, m, n) for (int i = m; i < n; i++) typedef pair<int, int> P; typedef long long ll; const int INF = 1001001001; const int MOD = 1000000007; const double PI = acos(-1); int main() { int N, M, K; cin >> N >>...
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) #define FOR(i, m, n) for (int i = m; i < n; i++) typedef pair<int, int> P; typedef long long ll; const int INF = 1001001001; const int MOD = 1000000007; const double PI = acos(-1); int main() { int N, M, K; cin >> N >>...
[["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 355], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
240
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<pairs, null_type, greater<pairs>, rb_tree_tag, \ ...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<pairs, null_type, greater<pairs>, rb_tree_tag, \ ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 11, 12, 2, 3, 4, 0, 23, 0, 24], ["-", 0, 11, 12, 2, 3, 4, 0, 23, 0, 25]]
1
310
from sys import stdin,stdout import bisect as bs n,m,s=map(int, stdin.readline().split()) dn=list(map(int, stdin.readline().split())) dm=list(map(int, stdin.readline().split())) pre=[dm[0]];s1=0 for v in dm[1:]: pre+=[dm[-1]+v] m=bs.bisect_right(pre,s) for i in range(n): s1+=dn[i] if s-s1>0:m=max(m,i+1+bs.b...
from sys import stdin,stdout import bisect as bs n,m,s=map(int, stdin.readline().split()) dn=list(map(int, stdin.readline().split())) dm=list(map(int, stdin.readline().split())) pre=[dm[0]];s1=0 for v in dm[1:]: pre+=[pre[-1]+v] m=bs.bisect_right(pre,s) for i in range(n): s1+=dn[i] if s-s1>=0:m=max(m,i+1+bs...
[["-", 0, 677, 12, 634, 0, 657, 31, 206, 51, 22], ["+", 0, 677, 12, 634, 0, 657, 31, 206, 51, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
156
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 10; int n, m, k; int main() { scanf("%d%d%d", &n, &m, &k); vector<ll> a(n + 1, 0); vector<ll> b(n + 1, 0); for (int i = 1, x; i <= n; ++i) scanf("%d", &x), a[i] = a[i - 1] + x; for (int i = 1, x; i <= m; ++i) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 10; int n, m, k; int main() { scanf("%d%d%d", &n, &m, &k); vector<ll> a(n + 1, 0); vector<ll> b(m + 1, 0); for (int i = 1, x; i <= n; ++i) scanf("%d", &x), a[i] = a[i - 1] + x; for (int i = 1, x; i <= m; ++i) ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
234
#include <bits/stdc++.h> #include <cstring> #include <limits> using namespace std; #define ll long long int #define lli long long int #define fw(i, s, e) for (ll i = s; i < e; ++i) #define fe(i, s, e) for (ll i = s; i <= e; ++i) #define fb(i, e, s) for (ll i = e; i >= s; --i) #define L(T) ...
#include <bits/stdc++.h> #include <cstring> #include <limits> using namespace std; #define ll long long int #define lli long long int #define fw(i, s, e) for (ll i = s; i < e; ++i) #define fe(i, s, e) for (ll i = s; i <= e; ++i) #define fb(i, e, s) for (ll i = e; i >= s; --i) #define L(T) ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 9, 0, 43, 49, 50, 51, 13]]
1
302
// Apparat : drobucs, aleonov, vit_72 #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> //#pragma warning(disable : 4996) //#pragma GCC optimize("O3") using namespa...
// Apparat : drobucs, aleonov, vit_72 #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> //#pragma warning(disable : 4996) //#pragma GCC optimize("O3") using namespa...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 51, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9,...
1
340
import java.io.*; import java.util.*; public class Main { public static void main(String[] main) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); PrintWriter out = new PrintWriter(System.out); int n = ...
import java.io.*; import java.util.*; public class Main { public static void main(String[] main) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); PrintWriter out = new PrintWriter(System.out); int n = ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["+", 0, 195, 8, 196, 0, 1, 0, 27, 0, 22], ["+", 0, 195, 8, 196, 0, 1, 0, 27, 0, 68], ["+", 8, 498, 0, 195, 8, 196, 0, 1, 0, 35]]
3
331
N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_sum = [0] for i in range(N): A_sum.append(A_sum[i] + A[i]) B_sum = [0] for i in range(N): B_sum.append(B_sum[i] + B[i]) B_sum.append(10**10) res = 0 for i in range(len(A_sum)): low = 0 high = ...
N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_sum = [0] for i in range(N): A_sum.append(A_sum[i] + A[i]) B_sum = [0] for i in range(M): B_sum.append(B_sum[i] + B[i]) B_sum.append(10**10) res = 0 for i in range(len(A_sum)): low = 0 high = ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
201
import bisect N,M,K= map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) dpA = [0]*(N+1) dpB = [0]*(M+1) for i in range(1,N+1): dpA[i] = dpA[i-1] + A[i-1] for i in range(1,M+1): dpB[i] = dpB[i-1] + B[i-1] ans = 0 for i in range(1,N+1): if dpA[i] > K: ...
import bisect N,M,K= map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) dpA = [0]*(N+1) dpB = [0]*(M+1) for i in range(1,N+1): dpA[i] = dpA[i-1] + A[i-1] for i in range(1,M+1): dpB[i] = dpB[i-1] + B[i-1] ans = 0 for i in range(N+1): if dpA[i] > K: c...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
191
n,m,k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) A = [0] B = [0] for i in range(n): A.append(A[i]+a[i]) for j in range(m): B.append(B[j]+b[j]) #print(A,B) maxij = 0 l = m for i in range(n+1): for j in range(m): # print(i,l,A[i],B[l],k) if(l == 0): bre...
n,m,k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) A = [0] B = [0] for i in range(n): A.append(A[i]+a[i]) for j in range(m): B.append(B[j]+b[j]) #print(A,B) maxij = 0 l = m for i in range(n+1): for j in range(m): # print(i,l,A[i],B[l],k) if(l == -1): br...
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 612], ["+", 0, 57, 15, 23, 0, 666, 0, 664, 17, 33], ["+", 0, 57, 15, 23, 0, 666, 0, 664, 28, 612]]
5
178
"""everything has a cost!""" from math import * import random, functools, collections, sys __author__ = 'p7x' # sys.stdin = open('in.txt', 'r') # sys.stdout = open('out.txt', 'w') # sys.stderr = open('err.txt', 'w') if __name__ == '__main__': n,m,k = map(int, input().split()) a = list(map(int, input().spl...
"""everything has a cost!""" from math import * import random, functools, collections, sys __author__ = 'p7x' # sys.stdin = open('in.txt', 'r') # sys.stdout = open('out.txt', 'w') # sys.stderr = open('err.txt', 'w') if __name__ == '__main__': n,m,k = map(int, input().split()) a = list(map(int, input().spl...
[["-", 12, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 31, 22]]
5
240
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, k; cin >> n; cin >> m; cin >> k; vector<int> a(n + 1, 0), b(m + 1, 0); for (int i = 1; i <= n; i++) { long long int l; cin >> l; a[i] = a[i - 1] + l; } for (int j = 1; j <= m; j++) { long long int l; cin >...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, k; cin >> n; cin >> m; cin >> k; vector<long long int> a(n + 1, 0), b(m + 1, 0); for (int i = 1; i <= n; i++) { long long int l; cin >> l; a[i] = a[i - 1] + l; } for (int j = 1; j <= m; j++) { long long int l;...
[["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
211
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1'000'000'007; const ld PI = acos(-1); const ld EPS = 0.0000000001; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1'000'000'007; const ld PI = acos(-1); const ld EPS = 0.0000000001; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
304
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back ll fastpower(int x, int y) { ll res = 1; while (y > 0) { if (y & 1) res = res * x; y = y >> 1; x = x * x; } return res; } void solve() { int n, m, k; cin >> n >> m >> k; vector<ll> a(n + 1); vect...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back ll fastpower(int x, int y) { ll res = 1; while (y > 0) { if (y & 1) res = res * x; y = y >> 1; x = x * x; } return res; } void solve() { int n, m, k; cin >> n >> m >> k; vector<ll> a(n + 1); vect...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
291
from sys import stdin, stdout, setrecursionlimit from collections import deque, defaultdict, Counter import math rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: map(int, stdin.readline().split()) rlf = lambda: map(float, stdin.readline().split()) INF, NINF = float('inf'), float('-in...
from sys import stdin, stdout, setrecursionlimit from collections import deque, defaultdict, Counter import math rl = lambda: stdin.readline() rll = lambda: stdin.readline().split() rli = lambda: map(int, stdin.readline().split()) rlf = lambda: map(float, stdin.readline().split()) INF, NINF = float('inf'), float('-in...
[["-", 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]]
5
259
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> typedef long long int ll; #define FOR(i, a, b) for (int i = (a); i ...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> typedef long long int ll; #define FOR(i, a, b) for (int i = (a); i ...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
417
#include <bits/stdc++.h> using namespace std; long long a[222222], b[222222]; int main() { long long n, m, k; cin >> n >> m >> k; a[0] = b[0] = 0; for (long long i = 1; i <= n; i++) { long long tmp; cin >> tmp; a[i] = a[i - 1] + tmp; } for (long long i = 1; i <= m; i++) { long long tmp; ...
#include <bits/stdc++.h> using namespace std; long long a[222222], b[222222]; int main() { long long n, m, k; cin >> n >> m >> k; a[0] = b[0] = 0; for (long long i = 1; i <= n; i++) { long long tmp; cin >> tmp; a[i] = a[i - 1] + tmp; } for (long long i = 1; i <= m; i++) { long long tmp; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
207
def bins(a, x): l = -1 h = len(a) while (h-l) > 1: m = (l+h)//2 if x >= a[m]: l = m else: h = m return l n, m, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) pa, pb = [0] * (n+1), [0] * (m+1) for...
def bins(a, x): l = -1 h = len(a) while (h-l) > 1: m = (l+h)//2 if x >= a[m]: l = m else: h = m return l n, m, k = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) pa, pb = [0] * (n+1), [0] * (m+1) for...
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 15, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102]]
5
236
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define eb emplace_back #define mt make_tuple #define all(x) (x).begin(), (x).end() #define MOD 1000000007 typedef long long ll; typedef pair<int, int> ii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typede...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define eb emplace_back #define mt make_tuple #define all(x) (x).begin(), (x).end() #define MOD 1000000007 typedef long long ll; typedef pair<int, int> ii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typede...
[["-", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22]]
1
311
n,m,k = map(int,input().split()) a_list = list(map(int,input().split())) b_list = list(map(int,input().split())) from itertools import accumulate import bisect sum_a_list = list(accumulate([0] + a_list)) sum_b_list = list(accumulate([0] + b_list)) ans = 0 b_idx = 0 for a_idx in range(n+1): if sum_a_list[a_idx] >...
n,m,k = map(int,input().split()) a_list = list(map(int,input().split())) b_list = list(map(int,input().split())) from itertools import accumulate import bisect sum_a_list = list(accumulate([0] + a_list)) sum_b_list = list(accumulate([0] + b_list)) ans = 0 b_idx = 0 for a_idx in range(n+1): if sum_a_list[a_idx] >...
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
141
n,m,k = map(int,input().split()) a_list = list(map(int,input().split())) b_list = list(map(int,input().split())) from itertools import accumulate import bisect sum_a_list = list(accumulate([0] + a_list)) sum_b_list = list(accumulate([0] + b_list)) ans = 0 b_idx = 0 for a_idx in range(n+1): if sum_a_list[a_idx] >...
n,m,k = map(int,input().split()) a_list = list(map(int,input().split())) b_list = list(map(int,input().split())) from itertools import accumulate import bisect sum_a_list = list(accumulate([0] + a_list)) sum_b_list = list(accumulate([0] + b_list)) ans = 0 b_idx = 0 for a_idx in range(n+1): if sum_a_list[a_idx] >...
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22]]
5
143
//#include <ext/pb_ds/assoc_container.hpp> #include <bits/stdc++.h> using namespace std; // using namespace __gnu_pbds; // template <class c, class cmp = less<c> > using ordered_set = tree<c, // null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>; #define IOS ...
//#include <ext/pb_ds/assoc_container.hpp> #include <bits/stdc++.h> using namespace std; // using namespace __gnu_pbds; // template <class c, class cmp = less<c> > using ordered_set = tree<c, // null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>; #define IOS ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22]]
1
571
#include <bits/stdc++.h> using namespace std; #define REP(i, m, n) for (int i = m; i < n; i++) #define rep(i, n) REP(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define dup(x, y) (((x) + (y)-1) / (y)) #define PI 3.14159265359 typedef long long LL; const LL MOD = 1e9 + 7; cons...
#include <bits/stdc++.h> using namespace std; #define REP(i, m, n) for (int i = m; i < n; i++) #define rep(i, n) REP(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define dup(x, y) (((x) + (y)-1) / (y)) #define PI 3.14159265359 typedef long long LL; const LL MOD = 1e9 + 7; cons...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]]
1
1,163
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <math.h> using namespace __gnu_pbds; using namespace std::chrono; using namespace std; #define ordered_set \ tree<int, null_type,...
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <math.h> using namespace __gnu_pbds; using namespace std::chrono; using namespace std; #define ordered_set \ tree<int, null_type,...
[["+", 8, 9, 0, 9, 0, 57, 75, 76, 0, 95]]
1
386
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using ll = long long; using P = pair<ll, ll>; int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); l...
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using ll = long long; using P = pair<ll, ll>; int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); l...
[["-", 64, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 64, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13]]
1
230
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int a[N], b[N]; int main() { int n, m, k; scanf("%d%d%d", &n, &m, &k); int ans = 0, num = 0, w = 0, l, r; for (int i = 0; i < n; i++) scanf("%d", a + i); for (int i = 0; i < m; i++) scanf("%d", b + i); for (r = 0; r < n && w + a[r]...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int a[N], b[N]; int main() { int n, m, k; scanf("%d%d%d", &n, &m, &k); int ans = 0, num = 0, w = 0, l, r; for (int i = 0; i < n; i++) scanf("%d", a + i); for (int i = 0; i < m; i++) scanf("%d", b + i); for (r = 0; r < n && w + a[r]...
[["-", 0, 7, 8, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 7, 8, 1, 0, 11, 12, 69, 28, 22], ["-", 0, 52, 8, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 52, 8, 1, 0, 11, 12, 69, 28, 22]]
1
255
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m; int k; cin >> n >> m >> k; ll a[n + 1], b[m + 1]; a[0] = 0; b[0] = 0; 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...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m, k; cin >> n >> m >> k; ll a[n + 1], b[m + 1]; a[0] = 0; b[0] = 0; 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]; }...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 51, 16, 12, 16, 12, 69, 341, 342, 0, 22], ["+", 51, 16, 12, 16, 12, 69, 341, 342, 0, 22]]
1
216
n, m, k = gets.split.map(&:to_i) a = gets.split.map(&:to_i) b = gets.split.map(&:to_i) aa = [0] bb = [0] a.size.times{|i| aa << a[i] + aa.last } b.size.times{|i| bb << b[i] + bb.last } i = 0 j = b.size while i < aa.size && j >= 0 if aa[i] + bb[j] <= k mx = i+j if mx < i+j i += 1 else j -= 1 end end ...
n, m, k = gets.split.map(&:to_i) a = gets.split.map(&:to_i) b = gets.split.map(&:to_i) aa = [0] bb = [0] a.size.times{|i| aa << a[i] + aa.last } b.size.times{|i| bb << b[i] + bb.last } i = 0 j = b.size mx = 0 while i < aa.size && j >= 0 if aa[i] + bb[j] <= k mx = i+j if mx < i+j i += 1 else j -= 1 e...
[["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612]]
4
139
n,m,k = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) a = [0]*(n+1) b = [0]*(m+1) for i in range(n): a[i+1] = a[i] + A[i] for i in range(m): b[i+1] = b[i] + B[i] ans = 0 best = m for i in range(n+1): if k < a[i]: break for j in range(best,-1,-1...
n,m,k = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) a = [0]*(n+1) b = [0]*(m+1) for i in range(n): a[i+1] = a[i] + A[i] for i in range(m): b[i+1] = b[i] + B[i] ans = 0 best = m for i in range(n+1): if k < a[i]: break for j in range(best,-1,-1...
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 7, 8, 196, 0, 57, 15, 681, 0, 372], ["-", 0, 7, 8, 196, 0, 57, 15, 681, 28, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
197
#include <algorithm> #include <assert.h> #include <cmath> #include <cstdio> #include <iostream> #include <string.h> using namespace std; #define endl '\n' #define int long long #define pb push_back #define mp make_pair #define SZ(x) ((int)(x).size()) #define all(x) x.begin(), x.end() #define mem0(s) memset(s, 0, sizeof...
#include <algorithm> #include <assert.h> #include <cmath> #include <cstdio> #include <iostream> #include <string.h> using namespace std; #define endl '\n' #define int long long #define pb push_back #define mp make_pair #define SZ(x) ((int)(x).size()) #define all(x) x.begin(), x.end() #define mem0(s) memset(s, 0, sizeof...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
448
#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 a[N + 1], b[M]; a[0] = 0; b[0] = B[0]; for (int i = 0; i < N; i++) { ...
#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 a[N + 1], b[M]; a[0] = 0; b[0] = B[0]; for (int i = 0; i < N; i++) { ...
[["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22]]
1
256
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5 + 50; ll n, m, k; ll a[maxn], b[maxn]; int main() { scanf("%lld%lld%lld", &n, &m, &k); memset(a, 0, sizeof a); memset(b, 0, sizeof b); for (int i = 1; i <= n; ++i) { scanf("%lld", &a[i]); a[i] += a[i - 1]; } for...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5 + 50; ll n, m, k; ll a[maxn], b[maxn]; int main() { scanf("%lld%lld%lld", &n, &m, &k); memset(a, 0, sizeof a); memset(b, 0, sizeof b); for (int i = 1; i <= n; ++i) { scanf("%lld", &a[i]); a[i] += a[i - 1]; } for...
[["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
293
#include <iostream> #include <vector> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; vector<long long> a(n + 1), b(n + 1); for (int i = 1; i < n + 1; ++i) { int x; cin >> x; a[i] = x + a[i - 1]; } for (int i = 1; i < m + 1; ++i) { int x; cin >> x; b[i] = x + b[i -...
#include <iostream> #include <vector> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; vector<long long> a(n + 1), b(m + 1); for (int i = 1; i < n + 1; ++i) { int x; cin >> x; a[i] = x + a[i - 1]; } for (int i = 1; i < m + 1; ++i) { int x; cin >> x; b[i] = x + b[i -...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["+", 0, 7, 8, 9, 0, 57, 64, 93, 0, 94]]
1
202
#include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll int64_t using namespace std; // memory exceed /* int main() { int64_t n,m,k; cin >> n>>m>>k; vector<unsigned int> A(n+5); vector<unsigned int> B(m+5); rep...
#include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll int64_t using namespace std; // memory exceed /* int main() { int64_t n,m,k; cin >> n>>m>>k; vector<unsigned int> A(n+5); vector<unsigned int> B(m+5); rep...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98]]
1
214
#include <algorithm> #include <iostream> #include <stdlib.h> #include <string> #define ll long long using namespace std; const int N = 2e6 + 5; long long a[N], b[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll m, n, k; ll ans = 0; cin >> n >> m >> k; for (int i = 1; i < n; +...
#include <algorithm> #include <iostream> #include <stdlib.h> #include <string> #define ll long long using namespace std; const int N = 2e6 + 5; long long a[N], b[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll m, n, k; ll ans = 0; cin >> n >> m >> k; for (int i = 1; i <= n; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
211
#include <iostream> using namespace std; int main() { int m, n, k; cin >> m >> n >> k; int arra[m]; int arrb[n]; for (int i = 0; i < m; i++) { cin >> arra[i]; } for (int i = 0; i < n; i++) { cin >> arrb[i]; } for (int i = 1; i < m; i++) { arra[i] += arra[i - 1]; } /*for (int i=1; i<n;...
#include <iostream> using namespace std; int main() { int m, n, k; cin >> m >> n >> k; long long arra[m]; int arrb[n]; for (int i = 0; i < m; i++) { cin >> arra[i]; } for (int i = 0; i < n; i++) { cin >> arrb[i]; } for (int i = 1; i < m; i++) { arra[i] += arra[i - 1]; } /*for (int i=1...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
246
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long ll; const int N = 2e5 + 4; int n, m; ll K; ll a[N], b[N]; inline int read() { int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; typedef long long ll; const int N = 2e5 + 4; int n, m; ll K; ll a[N], b[N]; inline int read() { int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
334
#include <bits/stdc++.h> using namespace std; typedef long lint; typedef long long llint; typedef pair<int, int> pint; typedef pair<long long, long long> pllint; // static const int MAX = 1e6; // static const int NIL = -1; // static const llint INF = 1<<21; // static const llint MOD = 1e9 + 7; bool compPair(const pi...
#include <bits/stdc++.h> using namespace std; typedef long lint; typedef long long llint; typedef pair<int, int> pint; typedef pair<long long, long long> pllint; // static const int MAX = 1e6; // static const int NIL = -1; // static const llint INF = 1<<21; // static const llint MOD = 1e9 + 7; bool compPair(const pi...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 57, 64, 9, 0, 57, 64, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
338