prob_desc_output_spec
string
fix_code_uid
string
apr_id
string
prob_desc_sample_outputs
string
prob_desc_input_spec
string
similarity_score
float32
prob_desc_sample_inputs
string
bug_source_code
string
tags
sequence
fix_ops_cnt
int32
insert_cnt
int32
fix_exec_outcome
string
bug_exec_outcome
string
potential_dominant_fix_op
string
prob_desc_memory_limit
string
file_name
string
equal_cnt
int32
prob_desc_time_limit
string
bug_code_uid
string
lang_cluster
string
prob_desc_input_from
string
src_uid
string
prob_desc_created_at
string
replace_cnt
int32
delete_cnt
int32
fix_source_code
string
prob_desc_notes
string
prob_desc_output_to
string
lang
string
difficulty
int32
prob_desc_description
string
hidden_unit_tests
string
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"d3fc1990b5c3a7c546e22e74999aee26"
"f1c739adf377e206a9df7728506d9ff8"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.253799
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include<bits/stdc++.h> using namespace std; char s[200005],t[200005]; int s1[200005],t1[200005]; int n; int main() { cin>>n; cin>>s+1>>t+1; for(int i=1; i<=n; i++) s1[n+1-i]=s[i]-'a'+1,t1[n+1-i]=t[i]-'a'+1; for(int i=1; i<=n; i++) s1[i]+=t1[i]; for(int i=1; i<=n; i++) { if(s1[i]>=26) { s1[i]%=26; s1[i+1]+=1; } } if(s1[n+1]) s1[n]+=26; for(int i=1; i<=n; i++) { if(!s1[i]) { s1[i+1]--; s1[i]=26; } if(s1[i]&1) s1[i-1]+=26; } for(int i=1; i<=n; i++) { s1[i]/=2; if(s1[i]==0) s1[i]=26,s1[i+1]--; } for(int i=n; i>=1; i--) printf("%c",'a'-1+s1[i]); return 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
10
1
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
11
"2 seconds"
"3ada4bdfc286db6136608bed716a3c43"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
8
1
"#include<bits/stdc++.h> using namespace std; int k; int q[200005],w[200005]; char s[200005],t[200005]; int main(){ cin>>k>>s>>t; for(int i=0;i<k;i++) q[k-1-i]=s[i]-'a',w[k-1-i]=t[i]-'a'; for(int i=0;i<k;i++) { q[i]+=w[i]; if(q[i]>=26) { q[i+1]+=1; q[i]%=26; } } if(q[k]) q[k-1]+=26; for(int i=k-1;i>=0;i--) { if(q[i]&1) { q[i-1]+=26; } q[i]/=2; printf("%c",'a'+q[i]); } return 0; } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"c83d9a97b5663f8f46badecff5aeb399"
"e5dbd4a5699706e3f7ebe4907fb4a343"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.698303
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> #include <chrono> using namespace std::chrono; using namespace std; #define f0r(a, b) for (a = 0; a < b; a++) #define f1r(a, b, c) for (a = b; a < c; a++) #define ms(arr, v) memset(arr, v, sizeof(arr)) #define pb push_back #define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define mp make_pair #define f first #define s second typedef long long ll; typedef double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll i, j; ll n, q, Q, T, m, k, r, x, y, z, g; string a, b; unsigned char ans[200001]; int main() { io; cin >> n >> a >> b; ms(ans, 0); for (int i = n-1; i >= 0; i--) { if (i == n-1) { if (a[i] > b[i]) { int diff = b[i] - a[i]; int x = a[i] + 26 + diff/2; while (x > 'z') x -= 26; ans[i] = x; } else { int diff = b[i] - a[i]; int x = a[i] + diff/2; ans[i] = x; } continue; } if (a[i] < b[i]) { int diff = b[i] - a[i]; ans[i] = a[i] + floor(diff/2.0); if (diff % 2 == 1) { ans[i+1] += 13; while (ans[i+1] > 'z') ans[i+1] -= 26; } } else if (a[i] == b[i]) { if (a[i+1] <= b[i+1]) ans[i] = a[i]; else { ans[i] = a[i] + 13; while (ans[i] > 'z') ans[i] -= 26; } } else { int diff = b[i] - a[i]; ans[i] = a[i] + 26 + floor(diff/2.0); while (ans[i] > 'z') ans[i] -= 26; if (diff % 2 != 0) { ans[i+1] += 13; while (ans[i+1] > 'z') ans[i+1] -= 26; } } } f0r(i, n) cout << ans[i]; cout << endl; // cout << "FLUSH PLEASE" << endl; }"
[ "number theory", "bitmasks", "math", "strings" ]
26
11
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
27
"2 seconds"
"7cedee4f5dcb5829d3c09a7942019b47"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
13
2
"#include <bits/stdc++.h> #include <chrono> using namespace std::chrono; using namespace std; #define f0r(a, b) for (a = 0; a < b; a++) #define f1r(a, b, c) for (a = b; a < c; a++) #define ms(arr, v) memset(arr, v, sizeof(arr)) #define pb push_back #define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define mp make_pair #define f first #define s second typedef long long ll; typedef double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll i, j; ll n, q, Q, T, m, k, r, x, y, z, g; string a, b; unsigned char ans[200001]; int main() { io; cin >> n >> a >> b; ms(ans, 0); for (int i = n-1; i >= 0; i--) { // f0r(j, n) cout << (char)(ans[j] < 10 ? ans[j] + '0' : ans[j]); cout << endl; if (i == n-1) { if (a[i] > b[i]) { int diff = a[i] - b[i]; int x = b[i] + (diff>>1); while (x > 'z') { x -= 26; ans[i-1]++; } ans[i] = x; } else { int diff = b[i] - a[i]; int x = a[i] + (diff>>1); ans[i] = x; } continue; } if (a[i] < b[i]) { int diff = b[i] - a[i]; ans[i] += a[i] + (diff>>1); if (diff % 2 != 0) { ans[i+1] += 13; while (ans[i+1] > 'z') { ans[i+1] -= 26; ans[i]++; } } while (ans[i] > 'z') { ans[i] -= 26; ans[i-1]++; } } else if (a[i] == b[i]) { ans[i] = a[i]; } else { int diff = a[i] - b[i]; ans[i] += b[i] + (diff>>1); if (diff % 2 != 0) { ans[i+1] += 13; while (ans[i+1] > 'z') { ans[i+1] -= 26; ans[i]++; } } while (ans[i] > 'z') { ans[i] -= 26; ans[i-1]++; } } } f0r(i, n) cout << ans[i]; cout << endl; // cout << "FLUSH PLEASE" << endl; }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"d231fb92a66f46b4a0285dc179912ea3"
"67f9017dd5ea914b4448353003d621c9"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.505876
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n; cin >> n; string a, b; cin >> a >> b; vector<ll> y(n), z(n), c(n+1, 0); for(int i = 0; i < n; i++){ y[i] = a[i]-'a'+1; z[i] = b[i]-'a'+1; } for(int i = n-1; i >= 0; i--){ c[n-1 - i] += (y[i] + z[i]); if(c[n-1 - i] > 26){ c[n-1 - i] %= 26; c[n-i] += 1; } } reverse(c.begin(),c.end()); //for(auto x: c) cout << x << endl; for(int i = 0; i < c.size(); i++){ if(c[i]&1){ c[i] -= 1; c[i] /= 2; c[i+1] += 26; }else{ c[i] /= 2; } } int i = 0; if(c[0] == 0) i = 1; //for(auto x: c) cout << x << endl; for(int j = i; j < c.size(); j++){ if(c[j] == 0){ c[j-1] -= 1; c[j] += 26; j-= 2; } } for(int j = i; i < c.size(); i++){ cout << char(c[i] + 96); } } "
[ "number theory", "bitmasks", "math", "strings" ]
23
5
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
23
"2 seconds"
"4156ec7b5942d7103fe8162337dcc3e9"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
13
5
"#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n; cin >> n; string a, b; cin >> a >> b; vector<ll> y(n+1, 0), z(n+1, 0), c(n+1, 0); for(int i = 0; i < n; i++){ y[i+1] = a[i]-'a'; z[i+1] = b[i]-'a'; } //for(auto x: y) cout << x << endl; //for(auto x: z) cout << x << endl; for(int i = n; i >= 0; i--){ c[i] += (y[i] + z[i]); if(i){ c[i-1] += c[i]/26; c[i] %= 26; } } //for(auto x: c) cout << x << endl; for(int i = 0; i <= n; i++){ int rem = c[i]%2; c[i]/=2; if(i+1 <= n){ c[i+1] += rem*26; } } for(int i = 1; i <= n; i++){ cout << char(c[i] + 'a'); } } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"d231fb92a66f46b4a0285dc179912ea3"
"67f9017dd5ea914b4448353003d621c9"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.215464
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> using namespace std; typedef long long ll; void borrow(int i, vector<ll> &c){ if(i == 0){ return; } c[i] += 26; c[i-1] -= 1; if((i-1) == 0) borrow(i-1, c); } int main(){ ll n; cin >> n; string a, b; cin >> a >> b; vector<ll> y(n+1), z(n+1), c(n+1, 0); for(int i = 0; i < n; i++){ y[i+1] = a[i]-'a'+1; z[i+1] = b[i]-'a'+1; } //for(auto x: y) cout << x << endl; //for(auto x: z) cout << x << endl; for(int i = 0; i < n; i++){ c[i+1] += (y[i+1] + z[i+1]); if(c[i+1] > 26){ c[i+1] %= 26; c[i] += 1; } } //for(auto x: c) cout << x << endl; for(int i = 0; i <= n; i++){ if(c[i] & 1){ c[i] -= 1; c[i+1] += 26; c[i] /= 2; } else{ c[i]/=2; if(c[i+1] > 26){ c[i+1] %= 26; c[i+1] -= 26; c[i] += 1; } } } for(int i = 1; i <= n; i++){ if(c[i] == 0) borrow(i, c); } for(int i = 1; i <= n; i++){ cout << char(c[i] + 96); } } "
[ "number theory", "bitmasks", "math", "strings" ]
15
3
"PASSED"
"RUNTIME_ERROR"
"replace"
"256 megabytes"
"train_000.jsonl"
15
"2 seconds"
"c629a101a3fc087f018f53f572d47de9"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
9
3
"#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n; cin >> n; string a, b; cin >> a >> b; vector<ll> y(n+1, 0), z(n+1, 0), c(n+1, 0); for(int i = 0; i < n; i++){ y[i+1] = a[i]-'a'; z[i+1] = b[i]-'a'; } //for(auto x: y) cout << x << endl; //for(auto x: z) cout << x << endl; for(int i = n; i >= 0; i--){ c[i] += (y[i] + z[i]); if(i){ c[i-1] += c[i]/26; c[i] %= 26; } } //for(auto x: c) cout << x << endl; for(int i = 0; i <= n; i++){ int rem = c[i]%2; c[i]/=2; if(i+1 <= n){ c[i+1] += rem*26; } } for(int i = 1; i <= n; i++){ cout << char(c[i] + 'a'); } } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"7b0b4b2aa9fa969a6fa9b26e0fd0ecd7"
"a98224d140ae55b0c5cb366c0e639caf"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.936355
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef pair<pll,pll> ppll; typedef long double ld; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fst first #define snd second #define ins insert #define pb push_back const int N = 5e5 + 5; const int MOD = 1e9 + 7; int dist[N]; bool add[N]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); string l,r; int k; cin >> k; cin >> l >> r; string ans; int add = 0; for(int i = 0;i < k; ++i){ int ll = l[i] - 'a',rr = r[i] - 'a'; int c = (ll + rr) >> 1; c += add; if(c >= 26)c-=26,ans.back()++; if((ll + rr) % 2)add = 13;else add = 0; ans.pb(c); } for(auto &it : ans){ it %= 26; it += 'a'; } cout << ans; return 0; } /** 12 lylfekzszgqx oewrpuflwlir nbqykcppkvzu */ "
[ "number theory", "bitmasks", "math", "strings" ]
6
1
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
7
"2 seconds"
"66bed18b006353e8da81ace4be8dc4c5"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
4
1
"#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef pair<pll,pll> ppll; typedef long double ld; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fst first #define snd second #define ins insert #define pb push_back const int N = 5e5 + 5; const int MOD = 1e9 + 7; int dist[N]; bool add[N]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); string l,r; int k; cin >> k; cin >> l >> r; string ans; int add = 0; for(int i = 0;i < k; ++i){ int ll = l[i] - 'a',rr = r[i] - 'a'; int c = (ll + rr) >> 1; c += add; ans.pb(c); int cx = i; while (ans[cx] >= 26) { ans[cx] -= 26; ans[cx - 1] += 1; cx--; } if((ll + rr) % 2)add = 13;else add = 0; } for(auto &it : ans){ it %= 26; it += 'a'; } cout << ans; return 0; } /** 12 lylfekzszgqx oewrpuflwlir nbqykcppkvzu */ "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"7b0b4b2aa9fa969a6fa9b26e0fd0ecd7"
"a98224d140ae55b0c5cb366c0e639caf"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.616364
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef pair<pll,pll> ppll; typedef long double ld; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fst first #define snd second #define ins insert #define pb push_back const int N = 5e5 + 5; const int MOD = 1e9 + 7; int dist[N]; bool add[N]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); string l,r; int k; cin >> k; cin >> l >> r; l = '0' + l; r = '0' + r; for(int i = 1;i <= k; ++i){ if(l[i] > r[i]){ dist[i] = (dist[i - 1] - 1) * 26 + (r[i] + 26 - l[i]); }else{ dist[i] = dist[i - 1] * 26 + (r[i] - l[i]); } dist[i] %= 52; } string ans; for(int i = k;i >= 1; --i){ if(dist[i] < 0)exit(1); int c = (l[i] + (dist[i] / 2) % 26) - 'a'; c %= 26; c += 'a'; if(c < l[i])dist[i - 1]++; ans.pb(c); } reverse(all(ans)); cout << ans; return 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
18
3
"PASSED"
"RUNTIME_ERROR"
"replace"
"256 megabytes"
"train_000.jsonl"
18
"2 seconds"
"3749098e8b45ebc6e12dceefa689ce6d"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
13
2
"#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef pair<pll,pll> ppll; typedef long double ld; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fst first #define snd second #define ins insert #define pb push_back const int N = 5e5 + 5; const int MOD = 1e9 + 7; int dist[N]; bool add[N]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); string l,r; int k; cin >> k; cin >> l >> r; string ans; int add = 0; for(int i = 0;i < k; ++i){ int ll = l[i] - 'a',rr = r[i] - 'a'; int c = (ll + rr) >> 1; c += add; ans.pb(c); int cx = i; while (ans[cx] >= 26) { ans[cx] -= 26; ans[cx - 1] += 1; cx--; } if((ll + rr) % 2)add = 13;else add = 0; } for(auto &it : ans){ it %= 26; it += 'a'; } cout << ans; return 0; } /** 12 lylfekzszgqx oewrpuflwlir nbqykcppkvzu */ "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"711010ca34f992c7f804a00c6af3dcac"
"a98224d140ae55b0c5cb366c0e639caf"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.620128
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef pair<pll,pll> ppll; typedef long double ld; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fst first #define snd second #define ins insert #define pb push_back const int N = 5e5 + 5; const int MOD = 1e9 + 7; int dist[N]; bool add[N]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); string l,r; int k; cin >> k; cin >> l >> r; l = '0' + l; r = '0' + r; for(int i = 1;i <= k; ++i){ if(l[i] > r[i]){ dist[i] = ((dist[i - 1] + 51) % 52) * 26 + (r[i] + 26 - l[i]); }else{ dist[i] = dist[i - 1] * 26 + (r[i] - l[i]); } dist[i] %= 52; } string ans; for(int i = k;i >= 1; --i){ int c = (l[i] + (dist[i] / 2) % 26) - 'a'; if(c >= 26){ c-=26; dist[i - 1]++; } c += 'a'; ans.pb(c); } reverse(all(ans)); cout << ans; return 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
14
3
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
14
"2 seconds"
"b9705c5723dd49fa03806b67233c7798"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
9
2
"#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; typedef pair<pll,pll> ppll; typedef long double ld; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define fst first #define snd second #define ins insert #define pb push_back const int N = 5e5 + 5; const int MOD = 1e9 + 7; int dist[N]; bool add[N]; vector<int> sum; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); string l,r; int k; cin >> k; cin >> l >> r; int nx = 0; for(int i = k - 1;i >= 0; --i){ int ll = l[i] - 'a',rr = r[i] - 'a'; int sm = rr - ll - nx; if(sm < 0)nx = 1,sm += 26;else nx = 0; sum.pb(sm); } reverse(all(sum)); for(int i = k - 1;i >= 0; --i){ if(sum[i] % 2 == 1)sum[i + 1] += 13; sum[i] /= 2; } string ans; for(int i = k - 1;i >= 0; --i){ char c = sum[i] + l[i] - 'a'; if(c >= 26){ c-=26; sum[i - 1]++; } c += 'a'; ans.pb(c); } reverse(all(ans)); cout << ans; return 0; } ///70 3 "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"e729a2629cde7a0dd1ce4d49233911a6"
"b43b488196800fa465f30a01375063d8"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.458663
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize ("O3") using namespace std; #define ll long long #define ld long double #define rep(i, a, b) for(ll i = a; i < b; i++) #define vll vector<ll> #define vvll vector<vector<ll> > #define pll pair<ll, ll> #define endl "\n" #define pb push_back #define all(a) a.rbegin(), a.rend() #define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define debug if(1) ll n; ll getRazn(string s1, string s2) { vll cur(n, 0); cur[0] = s2[0] - s1[0] + 1; ll sum = cur[0]; rep(i, 1, n) { if(sum == 1) { cur[i] = s2[i] - s1[i] + 1; } else { cur[i] += 'z' - s1[i] + 1; cur[i] += s2[i] - 'a' + 1; cur[i] += 26 * (sum - 2); } sum = cur[i]; } return sum; } string ans = ""; void getString(ll cur) { cur--; while(cur) { ans += (char)((cur % 26) + 'a'); cur -= cur % 26; cur /= 26; } if(ans.size() != n) ans += "a"; reverse(ans.begin(), ans.end()); } int main() { //freopen("mountains.in", "r", stdin); //freopen("mountains.out", "w", stdout); //ios; cin >> n; string s1, s2; cin >> s1 >> s2; ll razn = getRazn(s1, s2); string s = ""; rep(i, 0, n) { s += "a"; } ll med = razn / 2 + getRazn(s, s1); getString(med); cout << ans << endl; return 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
16
1
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
17
"2 seconds"
"44709d79b4158ffca5662e77513a54b7"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
14
1
"#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize ("O3") using namespace std; #define ll long long #define ld long double #define rep(i, a, b) for(ll i = a; i < b; i++) #define vll vector<ll> #define vvll vector<vector<ll> > #define pll pair<ll, ll> #define endl "\n" #define pb push_back #define all(a) a.rbegin(), a.rend() #define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define debug if(1) int main() { //freopen("mountains.in", "r", stdin); //freopen("mountains.out", "w", stdout); //ios; ll n; cin >> n; string s1, s2; cin >> s1 >> s2; vll a1(n), a2(n); rep(i, 0, n) { a1[i] = s1[i] - 'a'; a2[i] = s2[i] - 'a'; } for(int i = n - 1; i >= 0; i--) { a1[i] += a2[i]; if(i) { a1[i - 1] += a1[i] / 26; a1[i] = a1[i] % 26; } } rep(i, 0, n) { ll rem = a1[i] % 2; a1[i] /= 2; if (i + 1 < n) { a1[i + 1] += rem * 26; } else { assert(rem == 0); } } rep(i, 0, n) { cout << char(a1[i] + 'a'); } return 0; } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"448b097aacd6d27094a8906011a7165c"
"603ae43b3dda98c252d93928409ea3c3"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.170886
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int maxn = 200000 + 10; char a[27] = { "abcdefghijklmnopqrstuvwxyz" }; int s1[maxn], s2[maxn],s3[maxn]; int main() { int n,i; cin >> n; getchar(); for ( i = 0; i < n; i++) { scanf("%c", &s1[i]); } getchar(); for ( i = 0; i < n; i++) { scanf("%c", &s2[i]); } for ( i = 0; i < n; i++) { int t = s2[i] - s1[i]; if (t < 0) { s3[i - 1]--; s2[i] += 26; t = s2[i] - s1[i]; } s3[i] = t; } for (i = 0; i < n; i++) { if (s3[i] % 2 == 0) { s3[i] /= 2; } else { s3[i] /= 2; s3[i + 1] += 26; } } for (i = 0; i < n; i++) { s1[i] += s3[i]; } for ( i = n - 1; i > 0; i--) { s1[i - 1] += (s1[i]-'a') / 26; s1[i] = (s1[i]-'a') % 26; } s1[0] = (s1[0] - 'a') % 26; for ( i = 0; i < n; i++) { cout << a[s1[i]]; } cout << endl; return 0; }"
[ "number theory", "bitmasks", "math", "strings" ]
21
4
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
22
"2 seconds"
"2affe84b1a9e3abb4333ab0876bb865a"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
16
1
"#include <iostream> #include<vector> #include<string> #include<cassert> using namespace std; vector<int> get(const string &s) { vector<int> res(s.size() + 1); for (int i = 0; i < int(s.size()); ++i) { res[i + 1] = s[i] - 'a'; } return res; } int main() { int k; string s, t; cin >> k >> s >> t; vector<int> a = get(s), b = get(t); for (int i = k; i >= 0; --i) { a[i] += b[i]; if (i) { a[i - 1] += a[i] / 26; a[i] %= 26; } } for (int i = 0; i <= k; ++i) { int rem = a[i] % 2; a[i] /= 2; if (i + 1 <= k) { a[i + 1] += rem * 26; } else { assert(rem == 0); } } for (int i = 1; i <= k; ++i) { cout << char('a' + a[i]); } cout << endl; return 0; }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"cc242d610b444393157ffadbc094cae6"
"603ae43b3dda98c252d93928409ea3c3"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.532574
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int maxn = 200000 + 10; char a[27] = { "abcdefghijklmnopqrstuvwxyz" }; int s1[maxn], s2[maxn],s3[maxn]; int main() { int n,i; cin >> n; getchar(); for ( i = 0; i < n; i++) { scanf("%c", &s1[i]); } getchar(); for ( i = 0; i < n; i++) { scanf("%c", &s2[i]); } for ( i = 0; i < n; i++) { int t = s2[i] - s1[i]; if (t < 0) { s3[i - 1]--; s2[i] += 26; t = s2[i] - s1[i]; } s3[i] = t; } for (i = 0; i < n-1; i++) { if (s3[i] % 2 == 0) { s3[i] /= 2; } else { s3[i] /= 2; s3[i + 1] += 26; } } for (i = 0; i < n; i++) { s1[i] += s3[i]; } for ( i = n - 1; i > 0; i--) { s1[i - 1] += (s1[i]-'a') / 26; s1[i] = (s1[i]-'a') % 26; } s1[0] = (s1[0] - 'a') % 26; for ( i = 0; i < n; i++) { cout << a[s1[i]]; } return 0; }"
[ "number theory", "bitmasks", "math", "strings" ]
12
0
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
12
"2 seconds"
"2c55ac5eaf7c44b2298b566e8043cd6b"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
10
2
"#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int maxn = 200000 + 10; char a[27] = { "abcdefghijklmnopqrstuvwxyz" }; int s1[maxn], s2[maxn],s3[maxn]; int main() { int n,i; cin >> n; getchar(); for ( i = 0; i < n; i++) { scanf("%c", &s1[i]); } getchar(); for ( i = 0; i < n; i++) { scanf("%c", &s2[i]); } for ( i = 0; i < n; i++) { s3[i] = s1[i]+s2[i]-97-97; } for (i = 0; i < n; i++) { if (s3[i] % 2 == 0) { s3[i] /= 2; } else { s3[i] /= 2; s3[i + 1] += 26; } } for (i = n - 1; i > 0; i--) { if (s3[i] >= 26) s3[i - 1] += s3[i] / 26; s3[i] %= 26; } for ( i = 0; i < n; i++) { cout << (char)(s3[i]+'a'); } return 0; }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"3bf2c08633fb9a716900321640335397"
"d80ab7651c422a6b668371d6bd30c6b7"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.476987
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <iostream> #include <string> #include <cmath> #include <vector> #include <algorithm> #include <set> #include <deque> #define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define lim 200001 #define ll long long #define endl "\n" using namespace std; void no() { cout << "Impossible" << endl; exit(0); } int main() { IOS; int n,i; cin >> n; vector<int> vec; string st1, st2,ans; ans = "qoztvz"; cin >> st1 >> st2; /*for (i = 0; i < n; i++) cout << int(st1[i])-96 << " "; cout << endl; for (i = 0; i < n; i++) cout << int(ans[i])-96 << " "; cout << endl; for (i = 0; i < n; i++) cout << int(st2[i])-96 << " "; cout << endl;*/ int q = 0; for (i = 0; i < n; i++) { cout << char((int(st1[i]) + int(st2[i])+q) / 2); if ((st1[i] + st2[i] + q) % 2 != 0) q = 26; else q = 0; } }"
[ "number theory", "bitmasks", "math", "strings" ]
8
3
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
8
"2 seconds"
"154de3ef49e68149d93fe4342f76558a"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
4
1
"#include <iostream> #include <string> #include <cmath> #include <vector> #include <algorithm> #include <set> #include <cassert> #define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define lim 200001 #define ll long long #define endl "\n" using namespace std; void no() { cout << "Impossible" << endl; exit(0); } int main() { IOS; int n, i, k; k = 97; cin >> n; vector<int> vec(n + 1); string st1, st2, ans; cin >> st1 >> st2; for (i = n; i >= 0; i--) { if (i) { vec[i] += int(st1[i - 1]) + int(st2[i - 1]) - k - k; vec[i - 1] += vec[i] / 26; vec[i] %= 26; } } //for (auto j : vec) cout << j << " "; for (i = 0; i <= n; i++) { int rem = vec[i] % 2; vec[i] /= 2; if ((i + 1) <= n) { vec[i + 1] += rem * 26; } else { assert(rem == 0); } } for (i = 1; i <= n; i++) { cout << char('a' + vec[i]); } }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"8266fdd3cf070781a51b667a310f75c9"
"da2c61c50849e3005838950f7e32c76c"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.49178
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <iostream> #include <cstdio> using namespace std; const int maxn = 200050; char a[maxn], b[maxn]; int c[maxn]; int ax[maxn], bx[maxn]; int n; int main() { scanf("%d", &n); scanf("%s", a); scanf("%s", b); for(int i = 0; i < n; i++) { ax[i] = int(a[i] - 'a'+1); bx[i] = int(b[i] - 'a'+1); c[i] = ax[i] + bx[i]; } for(int i = 0; i < n; i++) { if(c[i] % 2 == 1) { c[i] = (c[i]-1)/2; c[i+1] += 26; } else c[i] /= 2; } for(int i = 0; i < n; i++) cout << char(c[i]+'a'-1) << endl; return 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
22
1
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
22
"2 seconds"
"a0f387eaaae155e17aa1f7fa471afa6d"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
17
4
"#include<iostream> #include <cstdio> using namespace std; const int maxn=200005; int n; char a[maxn],b[maxn]; int ans[maxn]; int main() { int x,y; scanf("%d", &n); scanf("%s", a); scanf("%s", b); for(int i = n-1; i>=0; i--){ x = b[i] - 'a'; y = a[i] - 'a'; if(x - y < 0){ b[i-1]--; x += 26; } if((x-y)%2 == 0) ans[i] = (x-y)/2; else{ ans[i] = (x-y)/2; ans[i+1] += 13; } } for(int i = n-1; i >= 0; i--){ x = a[i] - 'a'; ans[i-1] += (x+ans[i])/26; ans[i] = (x+ans[i])%26; } for(int i = 0; i < n; i++) cout << char(ans[i]+'a'); cout << endl; return 0; } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"c7e6a4719da5a17dc4eff6e75c1b7ecd"
"af9030b7a1435f4b67c186b6ab68ad31"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.650767
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include<bits/stdc++.h> #define FOR(i,l,r) for(int (i)=l;(i)<=(r);(i)++) #define pb push_back #define fi first #define se second using namespace std; typedef long long ll; const int maxn=2e5+233; int k; string s,t; int a[maxn]; int main() { ios_base::sync_with_stdio(false); cin>>k; cin>>s; cin>>t; for(int i=k-1;i>=0;i--){ a[i]+=t[i]-s[i]; if(a[i]<0){ a[i-1]--; a[i]+=26; } } for(int i=0;i<k;i++){ if(a[i]&1)a[i+1]+=26; a[i]/=2; } for(int i=k-1;i>=0;i--){ s[i]+=a[i]; if(s[i]>'z'){ a[i-1]++; s[i]-=26; } } cout<<s<<endl; return 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
13
4
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
14
"2 seconds"
"c5e81dd23bb2364c23015add6f6f5373"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
8
1
"#include<bits/stdc++.h> #define FOR(i,l,r) for(int (i)=l;(i)<=(r);(i)++) #define pb push_back #define fi first #define se second using namespace std; typedef long long ll; const int maxn=2e5+233; int k; char s[maxn],t[maxn]; int a[maxn]; int main() { ios_base::sync_with_stdio(false); cin>>k; cin>>s+1; cin>>t+1; for(int i=1;i<=k;i++){ s[i]-='a'; t[i]-='a'; } for(int i=k;i>=1;i--){ a[i]+=t[i]+s[i]; if(a[i]>=26)a[i]-=26,a[i-1]++; } for(int i=0;i<=k;i++){ if(a[i]&1)a[i+1]+=26; a[i]/=2; } for(int i=1;i<=k;i++){ s[i]=a[i]+'a'; } cout<<s+1<<endl; return 0; } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"8905b77bf30ddfd7bc67d7b8d1d3d504"
"51cce5cd393434ddbbbdc9f2bfe037ab"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.853333
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include<bits/stdc++.h> using namespace std; int main(){ int k; cin>>k; string a,b; cin>>a>>b; vector<int>s; int w=0; for (int i=0;i<k;i++){ if ((a[i]+b[i])%2){ if (a[i+1]>b[i+1])s.push_back(((int)a[i]+b[i])/2+1+w),w=-13; else s.push_back(((int)a[i]+b[i])/2+w),w=+13; } else { s.push_back(((int)a[i]+b[i])/2+w); w=0; } int d=1; while (s[s.size()-d]<(int)'a'){ s[s.size()-d-1]--; s[s.size()-d]+=26; d++; } d=1; if (s[s.size()-d]>(int)'z'){ s[s.size()-d-1]++; s[s.size()-d]-=26; } } for (int i:s)cout<<char(i); cout<<endl; }"
[ "number theory", "bitmasks", "math", "strings" ]
3
2
"PASSED"
"WRONG_ANSWER"
"insert"
"256 megabytes"
"train_000.jsonl"
4
"2 seconds"
"7c1953ca50d4fbe9f350e65c6955b815"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
1
0
"#include<bits/stdc++.h> using namespace std; int main(){ int k; cin>>k; string a,b; cin>>a>>b; vector<int>s; int w=0; for (int i=0;i<k;i++){ if ((a[i]+b[i])%2){ if (a[i+1]>b[i+1])s.push_back(((int)a[i]+b[i])/2+1+w),w=-13; else s.push_back(((int)a[i]+b[i])/2+w),w=+13; } else { s.push_back(((int)a[i]+b[i])/2+w); w=0; } int d=1; while (s[s.size()-d]<(int)'a'){ s[s.size()-d-1]--; s[s.size()-d]+=26; d++; } d=1; while (s[s.size()-d]>(int)'z'){ s[s.size()-d-1]++; s[s.size()-d]-=26; d++; } } int d=1; while (s[s.size()-d]<(int)'a'){ s[s.size()-d-1]--; s[s.size()-d]+=26; d++; } d=1; while (s[s.size()-d]>(int)'z'){ s[s.size()-d-1]++; s[s.size()-d]-=26;d++; } for (int i:s)cout<<char(i); cout<<endl; }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"21dfad3ee8deb0d56c83cb6876db9bba"
"37da77aa6b8fb9c50689f73a082c328e"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.583102
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ll long long #define pb push_back #define sz(x) (int)(x).size() #define mp make_pair #define f first #define s second #define all(x) x.begin(), x.end() #define D(x) cerr << #x << " is " << (x) << "\n"; using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key() template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; } template<class T> ostream& operator<<(ostream& os, const vector<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;} template<class T> ostream& operator<<(ostream& os, const set<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} template<class T> ostream& operator<<(ostream& os, const multiset<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} template<class T1,class T2> ostream& operator<<(ostream& os, const map<T1,T2>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} int main() { int k; scanf("%i",&k); string a,b; cin >> a >> b; int start=0; while(a[start]==b[start]) start++; string sol=a.substr(0,start); a=a.substr(start,a.size()-start); b=b.substr(start,b.size()-start); k=a.size(); vector<int> koda(k+1),kodb(k+1); for(int i=1;i<k;i++) koda[i+1]+='z'-a[i]; for(int i=1;i<k;i++) kodb[i+1]+=b[i]-'a'; vector<int> ukupno(k+1); ukupno[1]+=b[0]-a[0]-1; for(int i=2;i<=k;i++) ukupno[i]=koda[i]+kodb[i]; int carry=2; for(int i=k;i>=0;i--) { int a=ukupno[i]+carry; carry=0; while(a>=26) { a-=26; carry++; } ukupno[i]=a; assert(a<26); } //cout << koda << kodb << ukupno; assert(ukupno[k]%2==1); ukupno[k]--; for(int i=0;i<=k;i++) { if(ukupno[i]%2==1) ukupno[i+1]+=26; ukupno[i]/=2; } //cout << ukupno; bool vece=true; for(int i=0;i<=k;i++) { if(ukupno[i]>koda[i]) vece=false; if(ukupno[i]<koda[i]) vece=true; if(ukupno[i]!=koda[i]) break; } if(vece) { for(int i=0;i<=k;i++) { if(koda[i]<ukupno[i]) { koda[i]+=26; koda[i-1]--; } koda[i]-=ukupno[i]; } int carry=0; for(int i=k;i>0;i--) { int aa=a[i-1]-'a'+koda[i]+carry; if(aa>=26) { carry=1; aa-=26; } else carry=0; koda[i]=aa; assert(aa<26); } for(int i=1;i<=k;i++) { sol+='a'+koda[i]; } cout << sol; } else { for(int i=0;i<=k;i++) { if(ukupno[i]<koda[i]) { ukupno[i]+=26; ukupno[i-1]--; } ukupno[i]-=koda[i]; } //cout << ukupno; string to_add; to_add+=a[0]; while(to_add.size()<a.size()) to_add+='z'; int carry=0; for(int i=k;i>0;i--) { int aa=to_add[i-1]-'a'+ukupno[i]+carry; if(aa>=26) { carry=1; aa-=26; } else carry=0; ukupno[i]=aa; assert(aa<26); } for(int i=1;i<=k;i++) sol+='a'+ukupno[i]; cout << sol; } return 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
10
1
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
10
"2 seconds"
"f1cfea5dd06a66c654d331f79b6051c8"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
5
4
"#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ll long long #define pb push_back #define sz(x) (int)(x).size() #define mp make_pair #define f first #define s second #define all(x) x.begin(), x.end() #define D(x) cerr << #x << " is " << (x) << "\n"; using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key() template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; } template<class T> ostream& operator<<(ostream& os, const vector<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;} template<class T> ostream& operator<<(ostream& os, const set<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} template<class T> ostream& operator<<(ostream& os, const multiset<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} template<class T1,class T2> ostream& operator<<(ostream& os, const map<T1,T2>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} int main() { int k; scanf("%i",&k); string a,b; cin >> a >> b; vector<int> ukupno(k+1); for(int i=1;i<=k;i++) ukupno[i]=a[i-1]+b[i-1]-2*'a'; int carry=0; for(int i=k;i>=0;i--) { int a=ukupno[i]+carry; carry=0; while(a>=26) { a-=26; carry++; } ukupno[i]=a; } assert(ukupno[k]%2==0); for(int i=0;i<=k;i++) { if(ukupno[i]%2==1) ukupno[i+1]+=26; ukupno[i]/=2; } string sol; for(int i=1;i<=k;i++) sol+=('a'+ukupno[i]); cout << sol; return 0; } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"21dfad3ee8deb0d56c83cb6876db9bba"
"37da77aa6b8fb9c50689f73a082c328e"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.996365
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ll long long #define pb push_back #define sz(x) (int)(x).size() #define mp make_pair #define f first #define s second #define all(x) x.begin(), x.end() #define D(x) cerr << #x << " is " << (x) << "\n"; using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key() template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; } template<class T> ostream& operator<<(ostream& os, const vector<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;} template<class T> ostream& operator<<(ostream& os, const set<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} template<class T> ostream& operator<<(ostream& os, const multiset<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} template<class T1,class T2> ostream& operator<<(ostream& os, const map<T1,T2>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} int main() { int k; scanf("%i",&k); string a,b; cin >> a >> b; vector<int> ukupno(k+1); for(int i=1;i<=k;i++) ukupno[i]=a[i-1]+b[i-1]-2*'a'; int carry=0; for(int i=k;i>=0;i--) { int a=ukupno[i]+carry; carry=0; while(a>=26) { a-=26; carry++; } ukupno[i]=a; } ukupno[k]++; for(int i=0;i<=k;i++) { if(ukupno[i]%2==1) ukupno[i+1]+=26; ukupno[i]/=2; } string sol; for(int i=1;i<=k;i++) sol+=('a'+ukupno[i]); cout << sol; return 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
2
1
"PASSED"
"RUNTIME_ERROR"
"replace"
"256 megabytes"
"train_000.jsonl"
3
"2 seconds"
"689c5b8452f63411553caf4a46e1823c"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
1
0
"#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ll long long #define pb push_back #define sz(x) (int)(x).size() #define mp make_pair #define f first #define s second #define all(x) x.begin(), x.end() #define D(x) cerr << #x << " is " << (x) << "\n"; using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key() template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; } template<class T> ostream& operator<<(ostream& os, const vector<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;} template<class T> ostream& operator<<(ostream& os, const set<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} template<class T> ostream& operator<<(ostream& os, const multiset<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} template<class T1,class T2> ostream& operator<<(ostream& os, const map<T1,T2>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;} int main() { int k; scanf("%i",&k); string a,b; cin >> a >> b; vector<int> ukupno(k+1); for(int i=1;i<=k;i++) ukupno[i]=a[i-1]+b[i-1]-2*'a'; int carry=0; for(int i=k;i>=0;i--) { int a=ukupno[i]+carry; carry=0; while(a>=26) { a-=26; carry++; } ukupno[i]=a; } assert(ukupno[k]%2==0); for(int i=0;i<=k;i++) { if(ukupno[i]%2==1) ukupno[i+1]+=26; ukupno[i]/=2; } string sol; for(int i=1;i<=k;i++) sol+=('a'+ukupno[i]); cout << sol; return 0; } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"948f62da1bf1cfea730e2bbed885cb06"
"b5aa3a1e31d48da5f699ff36ec6e7c95"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.189112
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> using namespace std; int main() { int k;cin>>k; string s,t; cin>>s>>t;int d=0; string ans=""; for(int i=0;i<k;i++) { d+=t[i]-s[i]; char cha=d/2+s[i];d%=2;ans+=cha; while(ans[i]<'a') { ans[i-1]--;ans[i]+=26; } while(ans[i]>'z') { ans[i-1]++;ans[i]-=26; } d*=26; } cout<<ans<<endl; }"
[ "number theory", "bitmasks", "math", "strings" ]
10
2
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
10
"2 seconds"
"7842c0129796244c7b5f19d6d91fd3c4"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
7
1
"#include <bits/stdc++.h> using namespace std; typedef long long ll; int len; const int N=2e5+50; char s1[N],s2[N]; int main() { scanf("%d",&len); scanf("%s%s",s1+1,s2+1); for(int i=1; i<=len; i++) { s1[i]-='a'; s2[i]-='a'; s1[i]+=s2[i]; } for(int i=len; i>=1; i--) { s1[i-1]+=s1[i]/26; s1[i]%=26; } for(int i=0; i<=len; i++) { if(s1[i]&1) s1[i+1]+=26; s1[i]/=2; } for(int i=0; i<=len; i++) { if(i==0&&!s1[i]) continue; printf("%c",s1[i]+'a'); } return 0; } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"88e1ed2d2079e6151c13e9a8cd43d634"
"a24c0acd34ec2263afeb9ab9748de51f"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.992382
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include<bits/stdc++.h> using namespace std; using ll = long long; #define all(x) (x).begin(), (x).end() int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); ll n; cin >> n; string a; string b; cin >> a >> b; ll last = 0; string ans; for (ll i = n - 1; i >= 0; i--) { ll sum = (a[i] - 'a') + (b[i] - 'a') + last; last = sum / 26; sum %= 26; ans.push_back('a' + sum); } if (last) { ans.push_back('a' + last); } reverse(all(ans)); string ans_2; last = 0; for (auto i = 0; i < n; i++) { ll digit = ans[i] - 'a' + last * 26; ll n_dig = digit / 2; last = digit % 2; ans_2.push_back('a' + n_dig); } if (last) ans_2.push_back('a' + 25); if (ans_2.size() == n) cout << ans_2; else for (auto i = 1; i < ans_2.size(); i++) cout << ans_2[i]; return 0; }"
[ "number theory", "bitmasks", "math", "strings" ]
3
2
"PASSED"
"WRONG_ANSWER"
"insert"
"256 megabytes"
"train_000.jsonl"
4
"2 seconds"
"8bff74617b0213789b2411a949365f38"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
1
0
"#include<bits/stdc++.h> using namespace std; using ll = long long; #define all(x) (x).begin(), (x).end() int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); ll n; cin >> n; string a; string b; cin >> a >> b; ll last = 0; string ans; for (ll i = n - 1; i >= 0; i--) { ll sum = (a[i] - 'a') + (b[i] - 'a') + last; last = sum / 26; sum %= 26; ans.push_back('a' + sum); } if (last) { ans.push_back('a' + last); } reverse(all(ans)); string ans_2; last = 0; for (auto i = 0; i < ans.size(); i++) { ll digit = ans[i] - 'a' + last * 26; ll n_dig = digit / 2; last = digit % 2; ans_2.push_back('a' + n_dig); } // if (last) // ans_2.push_back('a' + 25); if (ans_2.size() == n) cout << ans_2; else for (auto i = 1; i < ans_2.size(); i++) cout << ans_2[i]; return 0; }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"79149b1e1e0c0e2442eb695eb812b960"
"4f8164a3e5c15eb0fad8d93a4eed33df"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.944043
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> using namespace std; #define gg getchar();getchar(); typedef pair<int, int> ii; typedef unsigned long long ull; typedef unsigned int uint; typedef long long ll; vector<int> add(vector<int> a, vector<int> b) { int carry = 0; vector<int> ans; for(int i = 0; i < a.size(); i++) { ans.push_back((a[i] + b[i] + carry) % 26); if((a[i] + b[i] + carry) >= 26) carry = 1; else carry = 0; } if( carry == 1) ans.push_back(1); return ans; } vector<int> div(vector<int> a, int val) { vector<int> ans; int carry = 0; for(int i = a.size() -1; i >= 0; i--) { if((a[i] + carry) >= val) { ans.push_back((a[i] + carry) / val); } carry = ((a[i] + carry) % val) * 26; } return ans; } vector<int> toVec(string a) { vector<int> ans; for(int i = a.size() -1; i >= 0; i--) { ans.push_back(a[i] - 'a'); } return ans; } int main() { int n; scanf("%d", &n); string a, b; cin >> a >> b; vector<int> aV = toVec(a); vector<int> bV = toVec(b); vector<int> x = add(aV, bV); vector<int> y = div(x, 2); for(int i = 0; i < (n - y.size()); i++) printf("a"); for(int i = 0; i < y.size(); i++) { printf("%c", ((char)y[i]) + 'a'); } gg } "
[ "number theory", "bitmasks", "math", "strings" ]
6
1
"PASSED"
"WRONG_ANSWER"
"delete"
"256 megabytes"
"train_000.jsonl"
7
"2 seconds"
"fdad18c649876295b1ba4ce16ecc7597"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
1
4
"#include <bits/stdc++.h> using namespace std; #define gg getchar();getchar(); typedef pair<int, int> ii; typedef unsigned long long ull; typedef unsigned int uint; typedef long long ll; vector<int> add(vector<int> a, vector<int> b) { int carry = 0; vector<int> ans; for(int i = 0; i < a.size(); i++) { ans.push_back((a[i] + b[i] + carry) % 26); if((a[i] + b[i] + carry) >= 26) carry = 1; else carry = 0; } if( carry == 1) ans.push_back(1); return ans; } vector<int> div(vector<int> a, int val) { vector<int> ans; int carry = 0; for(int i = a.size() -1; i >= 0; i--) { ans.push_back((a[i] + carry) / val); carry = ((a[i] + carry) % val) * 26; } return ans; } vector<int> toVec(string a) { vector<int> ans; for(int i = a.size() -1; i >= 0; i--) { ans.push_back(a[i] - 'a'); } return ans; } int main() { int n; scanf("%d", &n); string a, b; cin >> a >> b; vector<int> aV = toVec(a); vector<int> bV = toVec(b); vector<int> x = add(aV, bV); vector<int> y = div(x, 2); for(int i = (y.size() == n ? 0 : 1); i < y.size(); i++) { printf("%c", ((char)y[i]) + 'a'); } gg } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"79149b1e1e0c0e2442eb695eb812b960"
"4f8164a3e5c15eb0fad8d93a4eed33df"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.962359
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> using namespace std; #define gg getchar();getchar(); typedef pair<int, int> ii; typedef unsigned long long ull; typedef unsigned int uint; typedef long long ll; vector<int> add(vector<int> a, vector<int> b) { int carry = 0; vector<int> ans; for(int i = 0; i < a.size(); i++) { ans.push_back((a[i] + b[i] + carry) % 26); if((a[i] + b[i] + carry) >= 26) carry = 1; else carry = 0; } if( carry == 1) ans.push_back(1); return ans; } vector<int> div(vector<int> a, int val) { vector<int> ans; int carry = 0; for(int i = a.size() -1; i >= 0; i--) { ans.push_back((a[i] + carry) / val); carry = ((a[i] + carry) % val) * 26; } return ans; } vector<int> toVec(string a) { vector<int> ans; for(int i = a.size() -1; i >= 0; i--) { ans.push_back(a[i] - 'a'); } return ans; } int main() { int n; scanf("%d", &n); string a, b; cin >> a >> b; vector<int> aV = toVec(a); vector<int> bV = toVec(b); vector<int> x = add(aV, bV); vector<int> y = div(x, 2); for(int i = 0; i < (n - y.size()); i++) printf("a"); for(int i = 0; i < y.size(); i++) { printf("%c", ((char)y[i]) + 'a'); } gg } "
[ "number theory", "bitmasks", "math", "strings" ]
4
1
"PASSED"
"TIME_LIMIT_EXCEEDED"
"delete"
"256 megabytes"
"train_000.jsonl"
5
"2 seconds"
"831db5770244be82dd5c44b3aefc002e"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
1
2
"#include <bits/stdc++.h> using namespace std; #define gg getchar();getchar(); typedef pair<int, int> ii; typedef unsigned long long ull; typedef unsigned int uint; typedef long long ll; vector<int> add(vector<int> a, vector<int> b) { int carry = 0; vector<int> ans; for(int i = 0; i < a.size(); i++) { ans.push_back((a[i] + b[i] + carry) % 26); if((a[i] + b[i] + carry) >= 26) carry = 1; else carry = 0; } if( carry == 1) ans.push_back(1); return ans; } vector<int> div(vector<int> a, int val) { vector<int> ans; int carry = 0; for(int i = a.size() -1; i >= 0; i--) { ans.push_back((a[i] + carry) / val); carry = ((a[i] + carry) % val) * 26; } return ans; } vector<int> toVec(string a) { vector<int> ans; for(int i = a.size() -1; i >= 0; i--) { ans.push_back(a[i] - 'a'); } return ans; } int main() { int n; scanf("%d", &n); string a, b; cin >> a >> b; vector<int> aV = toVec(a); vector<int> bV = toVec(b); vector<int> x = add(aV, bV); vector<int> y = div(x, 2); for(int i = (y.size() == n ? 0 : 1); i < y.size(); i++) { printf("%c", ((char)y[i]) + 'a'); } gg } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"4f792a72265f88d5fbfa8f64148a0837"
"c167f9ecbb75239f9fbf6deca008c8ee"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.369653
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100; string s, t, ans; int a[N]; int k; int dis(char a, char b) { if (a <= b) return b - a; return 26 + b - a; } int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> k >> s >> t; string tmp = s; for (int i = k - 1; i >= 0; i--) { a[i] = dis(tmp[i], t[i]); if (tmp[i] > t[i]) tmp[i - 1] = 'a' + ((tmp[i - 1] - 'a' + 1) % 26); } for (int i = 0; i < k; i++) { bool overF = int((s[i] - 'a') + a[i] / 2) >= 26; s[i] = char('a' + int(((s[i] - 'a') + a[i] / 2) % 26)); if (a[i] % 2) a[i + 1] += 26; if (overF) s[i - 1] = 'a' + ((s[i - 1] - 'a' + 1) % 26); } return cout << s, 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
15
4
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
16
"2 seconds"
"b7ffb9028bc0c532a6c3d3f53804d56e"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
9
2
"#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100; string s, t, ans; int a[N]; int k; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> k >> s >> t; string tmp = s; for (int i = k - 1; i >= 0; i--) { a[i] += (s[i] - 'a') + (t[i] - 'a'); if (i) { a[i - 1] += a[i] / 26; a[i] %= 26; } } for (int i = 0; i < k; i++) { ans += char('a' + a[i] / 2); if (a[i] % 2) a[i + 1] += 26; } return cout << ans, 0; } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"9bd5ec40fcc7e9720d26139bf94ee7bd"
"8ddd2944316b402d91b8fe03ad57cbf5"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.902128
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <utility> #include <string> #include <algorithm> #include <map> #include <vector> #include <climits> #include <numeric> #include<stdio.h> #include <queue> #include <iomanip> #include <float.h> #include <set> #include<functional> #include <stack> #include <time.h> #include <climits> #include <bitset> using namespace std; typedef pair<int, int>p; p mov[200005]; long long mod = 1e9 + 7; long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int k; cin >> k; string s, t; cin >> s >> t; int num[200005]; for (int i = 0; i < s.size(); i++) { num[i] = s[i]-'a' + t[i]-'a'; } for (int i = 0; i < s.size(); i++) { if (num[i] % 2)num[i + 1] += 26; num[i] /= 2; cout << (char)('a'+num[i]); } }"
[ "number theory", "bitmasks", "math", "strings" ]
6
2
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
6
"2 seconds"
"5d03aa35ddb9040e4faf260c8243b355"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
4
0
"#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <utility> #include <string> #include <algorithm> #include <map> #include <vector> #include <climits> #include <numeric> #include<stdio.h> #include <queue> #include <iomanip> #include <float.h> #include <set> #include<functional> #include <stack> #include <time.h> #include <climits> #include <bitset> using namespace std; typedef pair<int, int>p; p mov[200005]; long long mod = 1e9 + 7; long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int k; cin >> k; string s, t; cin >> s >> t; int num[200005]; for (int i = 0; i < s.size(); i++) { num[i] = s[i]-'a' + t[i]-'a'; } for (int i = 0; i < s.size(); i++) { if (num[i] % 2)num[i + 1] += 26; num[i] /= 2; num[i] += 'a'; } for (int i = s.size() - 1; i >= 0; i--) { while (num[i] > 'z') { num[i] -= 26; num[i - 1] += 1; } } for (int i = 0; i < k; i++) { cout << (char)num[i]; } }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"9bd5ec40fcc7e9720d26139bf94ee7bd"
"8ddd2944316b402d91b8fe03ad57cbf5"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.756842
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <utility> #include <string> #include <algorithm> #include <map> #include <vector> #include <climits> #include <numeric> #include<stdio.h> #include <queue> #include <iomanip> #include <float.h> #include <set> #include<functional> #include <stack> #include <time.h> #include <climits> #include <bitset> #include <boost/multiprecision/cpp_int.hpp> using namespace std; typedef pair<int, int>p; p mov[200005]; long long mod = 1e9 + 7; long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } signed main() { cin.tie(0); ios::sync_with_stdio(false); }"
[ "number theory", "bitmasks", "math", "strings" ]
3
1
"PASSED"
"COMPILATION_ERROR"
"replace"
"256 megabytes"
"train_000.jsonl"
3
"2 seconds"
"f9016c85949e3c8aff6371dc93a9f92b"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
1
1
"#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <utility> #include <string> #include <algorithm> #include <map> #include <vector> #include <climits> #include <numeric> #include<stdio.h> #include <queue> #include <iomanip> #include <float.h> #include <set> #include<functional> #include <stack> #include <time.h> #include <climits> #include <bitset> using namespace std; typedef pair<int, int>p; p mov[200005]; long long mod = 1e9 + 7; long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int k; cin >> k; string s, t; cin >> s >> t; int num[200005]; for (int i = 0; i < s.size(); i++) { num[i] = s[i]-'a' + t[i]-'a'; } for (int i = 0; i < s.size(); i++) { if (num[i] % 2)num[i + 1] += 26; num[i] /= 2; num[i] += 'a'; } for (int i = s.size() - 1; i >= 0; i--) { while (num[i] > 'z') { num[i] -= 26; num[i - 1] += 1; } } for (int i = 0; i < k; i++) { cout << (char)num[i]; } }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"faca77857017617aff8bd0c5959475d9"
"ebe4877f26d9ef706311ddfe39492a5f"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.696158
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <cstdio> #include <string> #include <algorithm> #include <iostream> using namespace std; int main() { int n; scanf("%d", &n); string s1, s2, s; cin >> s1 >> s2; reverse(s1.begin(), s1.end()); reverse(s2.begin(), s2.end()); char carry = 0; char soma = 0; for(int i = 0; i < n; i++) { soma = s1[i] - 97 + s2[i] - 97 + carry; s.push_back(soma % 26); //printf("c = %c\n", (soma % 26) + 97); carry = soma / 26; } if(carry > 0) s.push_back(carry % 26); char c; int i = 0; reverse(s.begin(), s.end()); //cout << s << "\n"; while(i < s.size()) { int v = s[i]; //printf("\nc %c\n", v+97); while(v < 2) { if(v == 0) printf("a"); if(i < (s.size() -1)) v = v*26 + s[++i]; else break; } if(i >= s.size() || v == 0) break; int d = v / 2; int r = v % 2; printf("%c", d + 97); //saida[l--] = d+97; i++; if(i < s.size()) s[i] += 26*r; } printf("\n"); return 0; } "
[ "number theory", "bitmasks", "math", "strings" ]
9
2
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
9
"2 seconds"
"c8de6fbe5c8091bb248eca0541754b81"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
6
1
"#include <cstdio> #include <string> #include <algorithm> #include <iostream> using namespace std; int main() { int n; scanf("%d", &n); string s1, s2, s; cin >> s1 >> s2; reverse(s1.begin(), s1.end()); reverse(s2.begin(), s2.end()); char carry = 0; char soma = 0; for(int i = 0; i < n; i++) { soma = s1[i] - 97 + s2[i] - 97 + carry; s.push_back(soma % 26); //printf("c = %c\n", (soma % 26) + 97); carry = soma / 26; } if(carry > 0) s.push_back(carry % 26); char c; int i = 0; reverse(s.begin(), s.end()); int r = 0; //cout << s << "\n"; char resp[n+5]; int j = 0; while(i < s.size()) { int v = s[i] + 26*r; int d = v / 2; r = v % 2; resp[j++] = d+97; i++; } resp[j] = 0; if(j > n) printf("%s\n", resp+1); else printf("%s\n", resp); return 0; }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"faca77857017617aff8bd0c5959475d9"
"ebe4877f26d9ef706311ddfe39492a5f"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"meadianstr.cpp"
[ "number theory", "bitmasks", "math", "strings" ]
1
0
"PASSED"
"COMPILATION_ERROR"
"replace"
"256 megabytes"
"train_000.jsonl"
0
"2 seconds"
"56b81f0190d72228ff53baa00487fdea"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
1
0
"#include <cstdio> #include <string> #include <algorithm> #include <iostream> using namespace std; int main() { int n; scanf("%d", &n); string s1, s2, s; cin >> s1 >> s2; reverse(s1.begin(), s1.end()); reverse(s2.begin(), s2.end()); char carry = 0; char soma = 0; for(int i = 0; i < n; i++) { soma = s1[i] - 97 + s2[i] - 97 + carry; s.push_back(soma % 26); //printf("c = %c\n", (soma % 26) + 97); carry = soma / 26; } if(carry > 0) s.push_back(carry % 26); char c; int i = 0; reverse(s.begin(), s.end()); int r = 0; //cout << s << "\n"; char resp[n+5]; int j = 0; while(i < s.size()) { int v = s[i] + 26*r; int d = v / 2; r = v % 2; resp[j++] = d+97; i++; } resp[j] = 0; if(j > n) printf("%s\n", resp+1); else printf("%s\n", resp); return 0; }"
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"Print one string consisting exactly of $$$k$$$ lowercase Latin letters β€” the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
"316154072d21a00e38e3abc3ea308f82"
"4c0ac06d9d4bccaaafb50e0f20012c4f"
"["bc", "alvuw", "qoztvz"]"
"The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) β€” the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowercase Latin letters. It is guaranteed that $$$s$$$ is lexicographically less than $$$t$$$. It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
0.996173
"["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]"
"#include <iostream> #include <string> #include <cstdio> using namespace std; int a1[200050]; int a2[200050]; int ans[200050]; int main() { int k; string s; cin>>k; cin>>s; for(int i = 0;i<k;i++) { a1[i] = s[i]-'a'; } cin>>s; for(int i = 0;i<k;i++) { a2[i] = s[i]-'a'; } int jin = 0; for(int i=k-1;i>=0;i--) { if(i!=0)ans[i] = (a1[i]+a2[i]+jin) % 26; else ans[i] = a1[i]+a2[i]+jin; jin = (a1[i]+a2[i]>=26? 1: 0); } jin = 0; s.clear(); for(int i=0;i<k;i++) { ans[i] += jin*26; if( ans[i]%2 == 1) { jin=1; ans[i]--; } else jin=0; ans[i] = ans[i] / 2; s += (ans[i]+'a'); } cout<<s<<endl; return 0; }"
[ "number theory", "bitmasks", "math", "strings" ]
3
3
"PASSED"
"WRONG_ANSWER"
"insert"
"256 megabytes"
"train_000.jsonl"
3
"2 seconds"
"d44800fdae4ee3271fb1175a4a93e69a"
"C++"
"standard input"
"5f4009d4065f5ad39e662095f8f5c068"
"1554041100"
0
0
"#include <iostream> #include <string> #include <cstdio> using namespace std; int a1[200050]; int a2[200050]; int ans[200050]; int main() { int k; string s; cin>>k; cin>>s; for(int i = 0;i<k;i++) { a1[i] = s[i]-'a'; } cin>>s; for(int i = 0;i<k;i++) { a2[i] = s[i]-'a'; } int jin = 0; for(int i=k-1;i>=0;i--) { if(i!=0) ans[i] = (a1[i]+a2[i]+jin) % 26; else ans[i] = a1[i]+a2[i]+jin; jin = (a1[i]+a2[i]+jin>=26? 1: 0); } jin = 0; s.clear(); for(int i=0;i<k;i++) { ans[i] += jin*26; if( ans[i]%2 == 1) { jin=1; ans[i]--; } else jin=0; ans[i] = ans[i] / 2; s += (ans[i]+'a'); } cout<<s<<endl; return 0; } "
null
"standard output"
"GNU C++17"
1,900
"You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (including $$$s$$$ and $$$t$$$) in lexicographical order. For example, for $$$k=2$$$, $$$s=$$$"az" and $$$t=$$$"bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].Your task is to print the median (the middle element) of this list. For the example above this will be "bc".It is guaranteed that there is an odd number of strings lexicographically not less than $$$s$$$ and not greater than $$$t$$$."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"9dca7ab34226a8da445c11435eb71312"
"466ddf6139ae91b36dc61147ab3b3f03"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.998088
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> #include<queue> #include<stack> #include<map> #include<set> #include<iostream> #define F first #define S second #define mp make_pair #define pb push_back #define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); typedef long long int ll; typedef long double ld; using namespace std; const int M=1e9+7; vector<string> v[6]; queue<string> s1; int main() { ll q;cin>>q; while(q--) { ll n;cin>>n; char a[2][n]; for(ll i=0;i<2;++i) { for(ll j=0;j<n;++j) { cin>>a[i][j]; } } ll j=0,f=0; while(j<n) { /*if(a[f][j]==1 || a[f][j]==2) { f=f; } else*/ if(a[f][j]!='2' && a[f][j]!='1') { if(a[(f+1)%2][j]==1 || a[(f+1)%2][j]==2 ) { f=0; break; } else f=(f+1)%2; } ++j; // cout<<f<<endl; } if(f==0) cout<<"NO"<<endl; else cout<<"YES"<<endl; } }"
[ "dp", "implementation" ]
4
4
"PASSED"
"WRONG_ANSWER"
"insert"
"256 megabytes"
"train_000.jsonl"
5
"2 seconds"
"903ab95d784f5b7f081f53f23275f5c6"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
0
0
"#include<bits/stdc++.h> #include<queue> #include<stack> #include<map> #include<set> #include<iostream> #define F first #define S second #define mp make_pair #define pb push_back #define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); typedef long long int ll; typedef long double ld; using namespace std; const int M=1e9+7; vector<string> v[6]; queue<string> s1; int main() { ll q;cin>>q; while(q--) { ll n;cin>>n; char a[2][n]; for(ll i=0;i<2;++i) { for(ll j=0;j<n;++j) { cin>>a[i][j]; } } ll j=0,f=0; while(j<n) { /*if(a[f][j]==1 || a[f][j]==2) { f=f; } else*/ if(a[f][j]!='2' && a[f][j]!='1') { if(a[(f+1)%2][j]=='1' || a[(f+1)%2][j]=='2' ) { f=0; break; } else f=(f+1)%2; } ++j; // cout<<f<<endl; } if(f==0) cout<<"NO"<<endl; else cout<<"YES"<<endl; } }"
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"9dca7ab34226a8da445c11435eb71312"
"466ddf6139ae91b36dc61147ab3b3f03"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.706993
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> #include<queue> #include<stack> #include<map> #include<set> #include<iostream> #define F first #define S second #define mp make_pair #define pb push_back #define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); typedef long long int ll; typedef long double ld; using namespace std; const int M=1e9+7; vector<string> v[6]; queue<string> s1; int main() { ll q;cin>>q; for(ll r=0;r<q;++r) { ll n;cin>>n; char a[2][n]; for(ll i=0;i<2;++i) { for(ll j=0;j<n;++j) { cin>>a[i][j]; } } ll j=0,f=0; ll b[2][n]={0}; b[0][0]=1; while(j<n) { if(a[f][j]=='1' || a[f][j]=='2') { if(j+1<n) b[f][j+1]=1; } else if(a[f][j]!='2' && a[f][j]!='1') { if(a[(f+1)%2][j]==1 || a[(f+1)%2][j]==2 ) { f=0; break; } else { f=(f+1)%2; b[f][j]=1; if(j!=n-1) b[f][j+1]=1; } } ++j; // cout<<f<<endl; } ll y=0; if(n>1) { if(b[0][1]==0) y=1; } if(f==0 || y) cout<<"NO"<<endl; else cout<<"YES"<<endl; }"
[ "dp", "implementation" ]
14
2
"PASSED"
"COMPILATION_ERROR"
"replace"
"256 megabytes"
"train_000.jsonl"
14
"2 seconds"
"d2352286b9d67721bcd629df70f3c82e"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
10
2
"#include<bits/stdc++.h> #include<queue> #include<stack> #include<map> #include<set> #include<iostream> #define F first #define S second #define mp make_pair #define pb push_back #define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); typedef long long int ll; typedef long double ld; using namespace std; const int M=1e9+7; vector<string> v[6]; queue<string> s1; int main() { ll q;cin>>q; while(q--) { ll n;cin>>n; char a[2][n]; for(ll i=0;i<2;++i) { for(ll j=0;j<n;++j) { cin>>a[i][j]; } } ll j=0,f=0; while(j<n) { /*if(a[f][j]==1 || a[f][j]==2) { f=f; } else*/ if(a[f][j]!='2' && a[f][j]!='1') { if(a[(f+1)%2][j]=='1' || a[(f+1)%2][j]=='2' ) { f=0; break; } else f=(f+1)%2; } ++j; // cout<<f<<endl; } if(f==0) cout<<"NO"<<endl; else cout<<"YES"<<endl; } }"
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"efb4d3b05626f8630b9d7e757d21afc7"
"92ec65796bd3cc1155dcb35ee61832d6"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.805439
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> using namespace std; typedef int ll; #define pb push_back #define pf push_front #define mp make_pair #define bns binary_search #define Lb lower_bound #define Ub upper_bound #define inf INT_MAX #define vll vector<ll> #define vvll vector<vll> #define vd vector<double> #define pii pair<ll,ll> #define ninf INT_MIN string r[2]; ll n; vvll vis(2,vll(200002,0)); void dfs(ll i,ll j,ll pvi,ll pvj){ int x; //cout<<i<<"-"<<j<<endl; if(j-1<n){ x=r[i][j-1]-'0'; } if(vis[i][j]==0){ vis[i][j]=1; } if((j>n)){ return; } if(x<3) { if(vis[i][j+1]==0) dfs(i,j+1,i,j); } else{ if(pvi==i){ if(vis[!i][j]==0) dfs(!i,j,i,j); } else if(pvj==j){ if(vis[i][j+1]==0) dfs(i,j+1,i,j); } } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll t; cin>>t; while(t--){ //ll n; vis=vvll(2,vll(200002,0)); cin>>n>>r[0]>>r[1]; ll i=0,j=0,pvi=0,pvj=0; string ans="YES"; while(j<n){ ll x=r[i][j]-'0'; if(x>=3){ i=!i; ll y=r[i][j]-'0'; if(y<3){ ans="NO";break; } } j++; } if(i!=1 || j!=n){ ans="NO"; } cout<<ans<<endl; } }"
[ "dp", "implementation" ]
2
1
"PASSED"
"TIME_LIMIT_EXCEEDED"
"delete"
"256 megabytes"
"train_000.jsonl"
3
"2 seconds"
"f2f87181acd37b6d2cb75349eed69ec1"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
0
1
"#include<bits/stdc++.h> using namespace std; typedef int ll; #define pb push_back #define pf push_front #define mp make_pair #define bns binary_search #define Lb lower_bound #define Ub upper_bound #define inf INT_MAX #define vll vector<ll> #define vvll vector<vll> #define vd vector<double> #define pii pair<ll,ll> #define ninf INT_MIN string r[2]; ll n; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll t; cin>>t; while(t--){ //ll n; //vis=vvll(2,vll(200002,0)); cin>>n>>r[0]>>r[1]; ll i=0,j=0,pvi=0,pvj=0; string ans="YES"; while(j<n){ ll x=r[i][j]-'0'; if(x>=3){ i=!i; ll y=r[i][j]-'0'; if(y<3){ ans="NO";break; } } j++; } if(i!=1 || j!=n){ ans="NO"; } cout<<ans<<endl; } }"
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"3fa24234aecf81d88dad084545994d41"
"ef12bc2be1f0178ccd78e9257f69a542"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.999024
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include <bits/stdc++.h> #define int long long #define pb push_back using namespace std; main() { int q; cin >> q; while(q--) { int n; cin >> n; char a[2][n]; char id[2][n]; for(int i = 0; i < 2; i++) { for(int j = 0; j < n; j++) { cin >> id[i][j]; if((id[i][j] - '0') >= 3) { a[i][j] = '3'; } else a[i][j] = '1'; } } if(n == 1) { if(a[0][0] == '3' && a[1][0] == '3') { cout << "YES" << endl; } else cout << "NO" << endl; continue; } int line = 0; bool ok = 0; for(int i = 0; i < n; i++) { if(a[0][i] == '3' && a[1][i] == '3') { line = 1 - line; } if(a[0][i] == '1' && a[1][i] == '3') { if(line == 0) { } else { ok = 1; } } if(a[0][i] == '3' && a[1][i] == '1') { if(line == 1) { } else { ok = 1; } } } if(ok) { cout << "NO" << endl; continue; } if(line == 0) { cout << "NO" << endl; } else cout << "YES"; } }"
[ "dp", "implementation" ]
1
1
"PASSED"
"WRONG_ANSWER"
"insert"
"256 megabytes"
"train_000.jsonl"
2
"2 seconds"
"f22f5fbdc35be8353052e328e659c9de"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
0
0
"#include <bits/stdc++.h> #define int long long #define pb push_back using namespace std; main() { int q; cin >> q; while(q--) { int n; cin >> n; char a[2][n]; char id[2][n]; for(int i = 0; i < 2; i++) { for(int j = 0; j < n; j++) { cin >> id[i][j]; if((id[i][j] - '0') >= 3) { a[i][j] = '3'; } else a[i][j] = '1'; } } if(n == 1) { if(a[0][0] == '3' && a[1][0] == '3') { cout << "YES" << endl; } else cout << "NO" << endl; continue; } int line = 0; bool ok = 0; for(int i = 0; i < n; i++) { if(a[0][i] == '3' && a[1][i] == '3') { line = 1 - line; } if(a[0][i] == '1' && a[1][i] == '3') { if(line == 0) { } else { ok = 1; } } if(a[0][i] == '3' && a[1][i] == '1') { if(line == 1) { } else { ok = 1; } } } if(ok) { cout << "NO" << endl; continue; } if(line == 0) { cout << "NO" << endl; } else cout << "YES\n"; } }"
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"39ea9b0897c22884351074dc93614a96"
"cef91ec626183626f89ed0f8bc9078e9"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.949873
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> #include<math.h> #define lld long long int #define mx 10000 using namespace std; int main() { lld t,n,a,b,i,f,cnt,cnt2; cin>>t; while(t--) { cin>>n; cin>>a; cin>>b; lld c[n],d[n]; i=n-1; f=0; cnt=0; cnt2=0; while(a) { c[i]=a%10; d[i]=b%10; a=a/10; b=b/10; i--; } for(i=0; i<n; i++) { if(i==n-1) { if((c[i]==3||c[i]==4||c[i]==5||c[i]==6)&&(d[i]==3||d[i]==4||d[i]==5||d[i]==6)) { if(cnt2%2==0) f=0; else f=1; } else { if(cnt2%2!=0&&(d[i]==1||d[i]==2)) f=0; else f=1; } } else { if(cnt2%2==0&&c[i]!=1&&c[i]!=2) { if(d[i]==3||d[i]==4||d[i]==5||d[i]==6) { f=0; cnt2++; } else { f=1; break; } } else if(cnt2%2!=0&&d[i]!=1&&d[i]!=2) { if(c[i]==3||c[i]==4||c[i]==5||c[i]==6) { f=0; cnt2++; } else { f=1; break; } } else { f=0; } } } if(f==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; } "
[ "dp", "implementation" ]
12
2
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
13
"2 seconds"
"cc110e0519639dbe60ed5991fa4f1991"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
10
0
"#include<bits/stdc++.h> #include<math.h> #define lld long long int #define mx 10000 using namespace std; int main() { lld t,n,i,f,cnt,cnt2; string c,d; cin>>t; while(t--) { cin>>n; cin>>c; cin>>d; i=n-1; f=0; cnt=0; cnt2=0; for(i=0;i<n;i++) { c[i]=c[i]-'0'; d[i]=d[i]-'0'; } for(i=0; i<n; i++) { if(i==n-1) { if((c[i]==3||c[i]==4||c[i]==5||c[i]==6)&&(d[i]==3||d[i]==4||d[i]==5||d[i]==6)) { if(cnt2%2==0) f=0; else f=1; } else { if(cnt2%2!=0&&(d[i]==1||d[i]==2)) f=0; else f=1; } } else { if(cnt2%2==0&&c[i]!=1&&c[i]!=2) { if(d[i]==3||d[i]==4||d[i]==5||d[i]==6) { f=0; cnt2++; } else { f=1; break; } } else if(cnt2%2!=0&&d[i]!=1&&d[i]!=2) { if(c[i]==3||c[i]==4||c[i]==5||c[i]==6) { f=0; cnt2++; } else { f=1; break; } } else { f=0; } } } if(f==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; } "
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"6bea6cac20e7b3d053d9cb8856b00f51"
"e6e55f5fae6af3023a986202f85ea7b0"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.848925
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef string st; #define f first #define s second #define pb push_back #define pf push_front #define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define MP make_pair #define mem(a , v) memset(a , v , sizeof(a)) #define all(v) ((v).begin()), ((v).end()) //freopen("input.txt" , "r" , stdin); //freopen("output.txt" , "w" , stdout); ll poww(ll x , ll y){ if(y == 0) return 1; ll s = poww(x , y / 2); s = (s * s); if(y % 2 == 1) s = (s*x); return s; } int grid[200001][2]; int main(){ FastIO; int q; cin>>q; while(q--){ int n; cin>>n; st st1,st2; cin>>st1>>st2; for(int i=0;i<n;++i){ if(st1[i]=='1'||st1[i]=='2')grid[i][0]=1; else grid[i][0]=2; if(st2[i]=='1'||st2[i]==2)grid[i][1]=1; else grid[i][1]=2; } int i=0,j=0; bool b=1; while(i<n){ if(grid[i][j]==1){ i++; } else if(grid[i][j]==2){ if(j==0){ if(grid[i][j+1]==2){ i++; j++; } else{ b=0; break; } } else if(j==1){ if(grid[i][j-1]==2){ i++; j--; } else{ b=0; break; } } } } if(b&&j==1){ cout<<"YES\n"; } else{ cout<<"NO\n"; } } return 0; } "
[ "dp", "implementation" ]
7
2
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
8
"2 seconds"
"5a935ad7e3aae69299836ecdf44a1b0c"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
3
2
"#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef string st; #define f first #define s second #define pb push_back #define pf push_front #define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define MP make_pair #define mem(a , v) memset(a , v , sizeof(a)) #define all(v) ((v).begin()), ((v).end()) //freopen("input.txt" , "r" , stdin); //freopen("output.txt" , "w" , stdout); ll poww(ll x , ll y){ if(y == 0) return 1; ll s = poww(x , y / 2); s = (s * s); if(y % 2 == 1) s = (s*x); return s; } int grid[200001][2]; int main(){ FastIO; int q; cin>>q; while(q--){ int n; cin>>n; st st1,st2; cin>>st1>>st2; for(int i=0;i<n;++i){ if(st1[i]=='1'||st1[i]=='2')grid[i][0]=1; else grid[i][0]=2; if(st2[i]=='1'||st2[i]=='2')grid[i][1]=1; else grid[i][1]=2; } int i=0,j=0; bool b=1; while(i<n){ if(grid[i][j]==1){ i++; } else if(grid[i][j]==2){ if(j){ if(grid[i][j-1]==2){ i++; j=!j; } else{ b=0; break; } } else { if(grid[i][j+1]==2){ i++; j=!j; } else{ b=0; break; } } } } if(b&&j){ cout<<"YES\n"; } else{ cout<<"NO\n"; } } return 0; } "
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"e23cbcd9c5888b0aa30939f39a119f6d"
"75b3e1ced9209abc311f5c0157eda0fe"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.995885
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e9 + 7; const int maxn=1e5+100; char ch[4][maxn]; int a[4][maxn]; int main() { int t; cin>>t; while(t--){ int n; cin>>n; cin>>ch[1]; cin>>ch[2]; for(int i=0;i<n;i++){ a[0][i]=ch[1][i]-'0'; a[1][i]=ch[2][i]-'0'; } int flag=1; int pos=0; for(int i=0;i<n;i++){ if(a[pos][i]<=2){ continue; } else{ if(a[(pos+1)%2][i]<=2){ flag=0; break; } else{ pos=(pos+1)%2; } } } if(flag==0){ cout<<"NO"<<"\n"; continue; } if(pos==0){ cout<<"NO"<<"\n"; } else{ cout<<"YES"<<"\n"; } } return 0; } "
[ "dp", "implementation" ]
2
1
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
3
"2 seconds"
"03d0d5590f166ac069951c9271d2dd5d"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
1
0
"#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e9 + 7; const int maxn=2e5+100; char ch[4][maxn]; int a[4][maxn]; int main() { int t; cin>>t; while(t--){ int n; cin>>n; cin>>ch[1]; cin>>ch[2]; for(int i=0;i<n;i++){ a[0][i]=ch[1][i]-'0'; a[1][i]=ch[2][i]-'0'; } int flag=1; int pos=0; for(int i=0;i<n;i++){ if(a[pos][i]<=2){ continue; } else{ if(a[(pos+1)%2][i]<=2){ flag=0; break; } else{ pos=(pos+1)%2; } } } if(flag==0){ cout<<"NO"<<"\n"; continue; } if(flag&&pos==0){ cout<<"NO"<<"\n"; } else{ cout<<"YES"<<"\n"; } } return 0; } "
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"a3a27271bf0c1918036e9996e3e01efc"
"b5fa7a1a9cbb6fc7b071f6c709f5048b"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.978446
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int count=0; int n; cin>>n; string s[2]; cin>>s[0]>>s[1]; int a[n][2]; for(int i=0;i<n;i++) { for(int j=0;j<2;j++) { if(s[j][i]=='1'||s[j][i]=='2') a[i][j]=0; else a[i][j]=1; } } int side=0; int i=0; for(i=0;i<n;){ if(a[i][side]==0) { i++; } else { if(a[i][side]==1&&a[i][!side]==1) { i++; side=!side; } else{ count=1; } } } if(count==1) { cout<<"NO"<<endl; } if(i==n&&side==1) { cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } } "
[ "dp", "implementation" ]
2
2
"PASSED"
"TIME_LIMIT_EXCEEDED"
"insert"
"256 megabytes"
"train_000.jsonl"
3
"2 seconds"
"c6ecf7cb786cf1c51352ab57fca381da"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
0
0
"#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int count=0; int n; cin>>n; string s[2]; cin>>s[0]>>s[1]; int a[n][2]; for(int i=0;i<n;i++) { for(int j=0;j<2;j++) { if(s[j][i]=='1'||s[j][i]=='2') a[i][j]=0; else a[i][j]=1; } } int side=0; int i=0; for(i=0;i<n;){ if(a[i][side]==0) { i++; } else { if(a[i][side]==1&&a[i][!side]==1) { i++; side=!side; } else{ i++; count=1; } } } if(count==1) { cout<<"NO"<<endl; continue; } if(i==n&&side==1) { cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } } "
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"a3a27271bf0c1918036e9996e3e01efc"
"b5fa7a1a9cbb6fc7b071f6c709f5048b"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.993131
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int count=0; int n; cin>>n; string s[2]; cin>>s[0]>>s[1]; int a[n][2]; for(int i=0;i<n;i++) { for(int j=0;j<2;j++) { if(s[j][i]=='1'||s[j][i]=='2') a[i][j]=0; else a[i][j]=1; } } int side=0; int i=0; for(i=0;i<n;){ if(a[i][side]==0) { i++; } else { if(a[i][side]==1&&a[i][!side]==1) { i++; side=!side; } else{ i++; count=1; } } } if(count==1) { cout<<"NO"<<endl; return 0; } if(i==n&&side==1) { cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } } "
[ "dp", "implementation" ]
2
0
"PASSED"
"WRONG_ANSWER"
"replace"
"256 megabytes"
"train_000.jsonl"
3
"2 seconds"
"784cb201125a350629c5f3dc19e72378"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
2
0
"#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int count=0; int n; cin>>n; string s[2]; cin>>s[0]>>s[1]; int a[n][2]; for(int i=0;i<n;i++) { for(int j=0;j<2;j++) { if(s[j][i]=='1'||s[j][i]=='2') a[i][j]=0; else a[i][j]=1; } } int side=0; int i=0; for(i=0;i<n;){ if(a[i][side]==0) { i++; } else { if(a[i][side]==1&&a[i][!side]==1) { i++; side=!side; } else{ i++; count=1; } } } if(count==1) { cout<<"NO"<<endl; continue; } if(i==n&&side==1) { cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } } "
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"7a420eef92e5c484b4bb4aa138bde373"
"ebce3391d5bb76ba1a8f8ae2023a041d"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.953722
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> #define N 200010 #define pb push_back using namespace std; int T,n,a[N],b[N],dp[N][2]; int main() { scanf("%d",&T); while(T--) { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%1d",&a[i]); for(int i=1;i<=n;i++) scanf("%1d",&b[i]); dp[0][0]=1; dp[0][1]=0; for(int i=1;i<=n;i++) { if(a[i]>2&&b[i]>2) { dp[i][0]=dp[i-1][1]; dp[i][1]=dp[i-1][0]; } if(a[i]<3&&b[i]<3) { dp[i][0]=dp[i-1][0]; dp[i][1]=dp[i-1][1]; } if(a[i]>2&&b[i]<3) { dp[i][0]=dp[i-1][0]; dp[i][1]=0; } if(a[i]<3&&b[i]>2) { dp[i][0]=0; dp[i][1]=dp[i-1][1]; } } printf("%s\n",dp[n][1]?"YES":"NO"); } }"
[ "dp", "implementation" ]
5
3
"PASSED"
"WRONG_ANSWER"
"insert"
"256 megabytes"
"train_000.jsonl"
6
"2 seconds"
"30386981d79bdf637525fdac1c6bc442"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
1
1
"#include<bits/stdc++.h> #define N 200010 #define pb push_back using namespace std; int T,n,a[N],b[N],dp[N][2]; int main() { scanf("%d",&T); while(T--) { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%1d",&a[i]); for(int i=1;i<=n;i++) scanf("%1d",&b[i]); dp[0][0]=1; dp[0][1]=0; for(int i=1;i<=n;i++) { if(a[i]>2&&b[i]>2) { dp[i][0]=dp[i-1][1]; dp[i][1]=dp[i-1][0]; } if(a[i]<3&&b[i]<3) { dp[i][0]=dp[i-1][0]; dp[i][1]=dp[i-1][1]; } if(a[i]<3&&b[i]>2) { dp[i][0]=dp[i-1][0]; dp[i][1]=0; } if(a[i]>2&&b[i]<3) { dp[i][0]=0; dp[i][1]=dp[i-1][1]; } //cout<<dp[i][0]<<"-"<<dp[i][1]<<endl; } printf("%s\n",dp[n][1]?"YES":"NO"); } }"
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""
"For the $$$i$$$-th query print the answer for it β€” "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$, and "NO" otherwise."
"aef082c6921aafa6788e88f888cacb62"
"ebce3391d5bb76ba1a8f8ae2023a041d"
"["YES\nYES\nYES\nNO\nYES\nNO"]"
"The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^4$$$) β€” the number of queries. Then $$$q$$$ queries follow. Each query consists of exactly three lines. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of $$$n$$$ digits from $$$1$$$ to $$$6$$$ without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes. It is guaranteed that the sum of $$$n$$$ over all queries does not exceed $$$2 \cdot 10^5$$$."
0.923577
"["6\n7\n2323216\n1615124\n1\n3\n4\n2\n13\n24\n2\n12\n34\n3\n536\n345\n2\n46\n54"]"
"#include<bits/stdc++.h> #define N 200010 using namespace std; int T,n,t,a[2][N],dp[N][2]; int main() { scanf("%d",&T); while(T--) { scanf("%d",&n); for(int i=0;i<=1;i++) for(int j=1;j<=n;j++) { scanf("%1d",&t); a[i][j]=t>2; } dp[0][0]=1; for(int j=1;j<=n;j++) for(int i=0;i<=1;i++) if(a[i][j]&&a[i^1][j]) dp[i][j]=dp[i^1][j-1]; else if(!a[i][j]) dp[i][j]=dp[i][j-1]; printf("%s\n",dp[n][1]?"YES":"NO"); } }"
[ "dp", "implementation" ]
5
2
"PASSED"
"WRONG_ANSWER"
"delete"
"256 megabytes"
"train_000.jsonl"
6
"2 seconds"
"e0706f012513cf0fbb121078062de4c7"
"C++"
"standard input"
"f34cff4302e047b1e3bfc2c79aa57be3"
"1569940500"
1
2
"#include<bits/stdc++.h> #define N 200010 using namespace std; int T,n,t,a[2][N],dp[N][2]; int main() { scanf("%d",&T); while(T--) { scanf("%d",&n); for(int i=0;i<=1;i++) for(int j=1;j<=n;j++) { scanf("%1d",&t); a[i][j]=t>2; } dp[0][0]=1,dp[1][0]=0; for(int j=1;j<=n;j++) for(int i=0;i<=1;i++) if(a[i][j]&&a[i^1][j])dp[i][j]=dp[i^1][j-1]; else if(!a[i][j])dp[i][j]=dp[i][j-1]; else dp[i][j]=0; printf("%s\n",dp[1][n]?"YES":"NO"); } }"
"NoteThe first query from the example is described in the problem statement."
"standard output"
"GNU C++17"
1,500
"You are given a system of pipes. It consists of two rows, each row consists of $$$n$$$ pipes. The top left pipe has the coordinates $$$(1, 1)$$$ and the bottom right β€” $$$(2, n)$$$.There are six types of pipes: two types of straight pipes and four types of curved pipes. Here are the examples of all six types: Types of pipes You can turn each of the given pipes $$$90$$$ degrees clockwise or counterclockwise arbitrary (possibly, zero) number of times (so the types $$$1$$$ and $$$2$$$ can become each other and types $$$3, 4, 5, 6$$$ can become each other).You want to turn some pipes in a way that the water flow can start at $$$(1, 0)$$$ (to the left of the top left pipe), move to the pipe at $$$(1, 1)$$$, flow somehow by connected pipes to the pipe at $$$(2, n)$$$ and flow right to $$$(2, n + 1)$$$.Pipes are connected if they are adjacent in the system and their ends are connected. Here are examples of connected pipes: Examples of connected pipes Let's describe the problem using some example: The first example input And its solution is below: The first example answer As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at $$$(1, 2)$$$ $$$90$$$ degrees clockwise, the pipe at $$$(2, 3)$$$ $$$90$$$ degrees, the pipe at $$$(1, 6)$$$ $$$90$$$ degrees, the pipe at $$$(1, 7)$$$ $$$180$$$ degrees and the pipe at $$$(2, 7)$$$ $$$180$$$ degrees. Then the flow of water can reach $$$(2, n + 1)$$$ from $$$(1, 0)$$$.You have to answer $$$q$$$ independent queries."
""

github

xCodeEval

xCodeEval: A Large Scale Multilingual Multitask Benchmark for Code Understanding, Generation, Translation and Retrieval

We introduce xCodeEval, the largest executable multilingual multitask benchmark to date consisting of 25 M document-level coding examples from about 7.5 K unique problems covering up to 17 programming languages with execution-level parallelism. It features a total of seven tasks involving code understanding, generation, translation and retrieval, and it employs an execution-based evaluation. We develop a test-case based multilingual code execution engine, ExecEval that supports all the programming languages in xCodeEval. We also propose a novel data splitting and a data selection schema for balancing data distributions over multiple attributes based on geometric mean and graph-theoretic principle.

This repository contains the sample code and data link for xCodeEval paper.

Data Download

Currently this repository supports huggingface load_dataset() api. Follow the following example to load dataset for individual examples.

import datasets

prog_synthesis_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "program_synthesis")
code_translation_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "code_translation")
tag_classification_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "tag_classification")
apr_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "apr")
pcode_compilation_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "code_compilation")
retrieval_code_code_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "retrieval_code_code")
retrieval_nl_code_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "retrieval_nl_code")
retrieval_corpus_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "retrieval_corpus")

Hf large data download tricks.

If you are facing long delay with data processing, add a ignore_verifications=True.

prog_synthesis_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "program_synthesis", ignore_verifications=True)

If you are facing long delay with data downloading, use huggingface streaming mode.

prog_synthesis_dataset = datasets.load_dataset("NTU-NLP-sg/xCodeEval", "program_synthesis", streaming=True)

Just Give me the raw data (😠)

Data can be also downloaded as a git LFS repo from huggingface.

xCodeEval_hf

You can download the full data using the following command.

GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/datasets/NTU-NLP-sg/xCodeEval
cd xCodeEval
git lfs pull

To download a specific part of the dataset,

GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/datasets/NTU-NLP-sg/xCodeEval
cd xCodeEval
git lfs pull --include "apr/test/*"

We propose 7 Tasks.

  1. Tag Classification
  2. Code Compilation
  3. Program Synthesis
  4. Code Translation
  5. Automatic Program Repair
  6. Code-Code Retrieval
  7. NL-Code Retrieval

Common Data for different tasks

If you are not using huggingface load_dataset() api, you may need to link some data with different tasks.

xCodeEval_fig_1

We have two data files that are required for multiple tasks.

  1. problem_descriptions.jsonl
  2. unittest_db.json

You can find these two files in the root directory of the main branch of huggingface dataset repository. To avoid data redundancy we didn't include these data with the relevant tasks, rather we add a unique id src_uid to retrieve these data.

Structure of problem_descriptions.jsonl

A sample,

{
    "description": "There are $$$n$$$ positive integers $$$a_1, a_2, \\dots, a_n$$$. For the one move you can choose any even value $$$c$$$ and divide by two all elements that equal $$$c$$$.For example, if $$$a=[6,8,12,6,3,12]$$$ and you choose $$$c=6$$$, and $$$a$$$ is transformed into $$$a=[3,8,12,3,3,12]$$$ after the move.You need to find the minimal number of moves for transforming $$$a$$$ to an array of only odd integers (each element shouldn't be divisible by $$$2$$$).",
    "input_from": "standard input",
    "output_to": "standard output",
    "time_limit": "3 seconds",
    "memory_limit": "256 megabytes",
    "input_spec": "The first line of the input contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) \u2014 the number of test cases in the input. Then $$$t$$$ test cases follow. The first line of a test case contains $$$n$$$ ($$$1 \\le n \\le 2\\cdot10^5$$$) \u2014 the number of integers in the sequence $$$a$$$. The second line contains positive integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 10^9$$$). The sum of $$$n$$$ for all test cases in the input doesn't exceed $$$2\\cdot10^5$$$.",
    "output_spec": "For $$$t$$$ test cases print the answers in the order of test cases in the input. The answer for the test case is the minimal number of moves needed to make all numbers in the test case odd (i.e. not divisible by $$$2$$$).",
    "notes": "NoteIn the first test case of the example, the optimal sequence of moves can be as follows:  before making moves $$$a=[40, 6, 40, 3, 20, 1]$$$;  choose $$$c=6$$$;  now $$$a=[40, 3, 40, 3, 20, 1]$$$;  choose $$$c=40$$$;  now $$$a=[20, 3, 20, 3, 20, 1]$$$;  choose $$$c=20$$$;  now $$$a=[10, 3, 10, 3, 10, 1]$$$;  choose $$$c=10$$$;  now $$$a=[5, 3, 5, 3, 5, 1]$$$ \u2014 all numbers are odd. Thus, all numbers became odd after $$$4$$$ moves. In $$$3$$$ or fewer moves, you cannot make them all odd.",
    "sample_inputs": [
        "4\n6\n40 6 40 3 20 1\n1\n1024\n4\n2 4 8 16\n3\n3 1 7"
    ],
    "sample_outputs": [
        "4\n10\n4\n0"
    ],
    "tags": [
        "number theory",
        "greedy"
    ],
    "src_uid": "afcd41492158e68095b01ff1e88c3dd4",
    "difficulty": 1200,
    "created_at": 1576321500
}

Key Definitions

  1. description: Problem description in textual format, math operations are written in latex.
  2. input_from: How the program should take the unit test.
  3. output_to: Where the program should output the result of the unit test.
  4. time_limit: Time limit to solve the problem.
  5. memory_limit: Memory limit to solve the problem.
  6. input_spec: How and in what order the input will be given to the program? It also includes the date range, types, and sizes.
  7. output_spec: How the outputs should be printed. Most of the time the unit test results are matched with an exact string match or floating point comparison with a precision boundary.
  8. sample_inputs: A sample input for the code that is expected to solve the problem described in description.
  9. sample_outputs: The expected output for the sample_input that is expected to solve the problem described in description.
  10. notes: Explanation of sample_inputs & sample_outputs.
  11. tags: The problem categories.
  12. src_uid: The unique id of the problem. This ID is referred to in the task data samples instead of putting all this information.
  13. difficulty: How difficult is it to solve the problem for a human (annotated by an expert human)?
  14. created_at: The Unix timestamp when the problem was released. Use datetime lib in Python to parse it to a human-readable format.

Structure of unittest_db.json

The structure of the json file,

unittest_db = {
    "db884d679d9cfb1dc4bc511f83beedda" : [
        {
            "input": "4\r\n3 2 3 2\r\n",
            "output": [
                "1"
            ],
        },
        {
            ...
        },
        ...
    ]
    "3bc096d8cd3418948d5be6bf297aa9b5":[
        ...
    ],
    ...
}

Key Definitions

  1. unittest_db.json dict keys i.e., db884d679d9cfb1dc4bc511f83beedda are the src_uid from problem_descriptions.jsonl.
  2. input: Input of the unit test.
  3. output: List of expected outputs for the unit test.

Citation

@misc{khan2023xcodeeval,
      title={xCodeEval: A Large Scale Multilingual Multitask Benchmark for Code Understanding, Generation, Translation and Retrieval}, 
      author={Mohammad Abdullah Matin Khan and M Saiful Bari and Xuan Long Do and Weishi Wang and Md Rizwan Parvez and Shafiq Joty},
      year={2023},
      eprint={2303.03004},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
Downloads last month
5,738
Edit dataset card
Evaluate models HF Leaderboard