buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> #include <iterator> #include <set> using namespace std; // using namespace __gnu_pbds; #define f first #define s second #define pb push_back #define all(x) x.begin(), x.end() #define ll long long int #define vi vector<int> #define vii vector<pair<int, int>> #define pii pair<int, int> #define...
#include <bits/stdc++.h> #include <iterator> #include <set> using namespace std; // using namespace __gnu_pbds; #define f first #define s second #define pb push_back #define all(x) x.begin(), x.end() #define ll long long int #define vi vector<int> #define vii vector<pair<int, int>> #define pii pair<int, int> #define...
[["-", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
521
#include "bits/stdc++.h" using namespace std; typedef long long int ll; typedef pair<ll, ll> pi; typedef pair<pair<ll, ll>, ll> pii; vector<ll> vec; vector<vector<ll>> vec2; ll MOD = 1000000007; ll INF = 1145141919454519; ll G[1919][1919]; ll tmp[1919][1919]; ll op[1919][1919]; ll H, W; int main() { ll H, W; cin ...
#include "bits/stdc++.h" using namespace std; typedef long long int ll; typedef pair<ll, ll> pi; typedef pair<pair<ll, ll>, ll> pii; vector<ll> vec; vector<vector<ll>> vec2; ll MOD = 1000000007; ll INF = 1145141919454519; ll G[1919][1919]; ll tmp[1919][1919]; ll op[1919][1919]; ll H, W; int main() { ll H, W; cin ...
[["-", 0, 16, 31, 16, 12, 69, 28, 69, 28, 22], ["+", 0, 16, 31, 16, 12, 69, 28, 69, 28, 22]]
1
588
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) int main() { ll H, W; cin >> H >> W; vector<string> s(H); rep(i, 0, H) cin >> s[i]; vector<vector<ll>> dp(H, vector<ll>(W, 1e9)); dp[0][0] = 0; if (s[0][0] =...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) int main() { ll H, W; cin >> H >> W; vector<string> s(H); rep(i, 0, H) cin >> s[i]; vector<vector<ll>> dp(H, vector<ll>(W, 1e9)); dp[0][0] = 0; if (s[0][0] =...
[["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
454
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repl(i, n) for (ll i = 0; i < (ll)(n); i++) #define repr(i, n) for (int i = n; i >= 0; i--) #define reprl(i, n) for (ll i = n; i >= ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repl(i, n) for (ll i = 0; i < (ll)(n); i++) #define repr(i, n) for (int i = n; i >= 0; i--) #define reprl(i, n) for (ll i = n; i >= ...
[["+", 0, 30, 0, 14, 8, 9, 0, 171, 0, 172], ["+", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 171, 0, 168]]
1
487
#include <bits/stdc++.h> using namespace std; int main() { int H, W; cin >> H >> W; vector<string> s(H); for (int i = 0; i < H; ++i) cin >> s[i]; int dp[110][110]; dp[0][0] = 0; if (s[0][0] == '#') dp[0][0]++; for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { if (i > 0 || j ...
#include <bits/stdc++.h> using namespace std; int main() { int H, W; cin >> H >> W; vector<string> s(H); for (int i = 0; i < H; ++i) cin >> s[i]; int dp[110][110]; dp[0][0] = 0; if (s[0][0] == '#') dp[0][0]++; for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { if (i > 0 || j ...
[["-", 0, 16, 31, 23, 0, 16, 12, 103, 0, 125], ["+", 0, 16, 31, 23, 0, 16, 12, 103, 0, 125], ["-", 0, 16, 12, 23, 0, 16, 12, 103, 0, 125], ["+", 0, 16, 12, 23, 0, 16, 12, 103, 0, 125]]
1
299
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 100 + 10; int f[maxn][maxn]; char s[maxn][maxn]; int main() { int h, w; scanf("%d%d", &h, &w); for (int i = 1; i <= h; i++) scanf("%s", s[i] + 1); memset(f, 0x3f, sizeof(f)); f[1][1] = (s[1][1] == '#'); for (int i = ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 100 + 10; int f[maxn][maxn]; char s[maxn][maxn]; int main() { int h, w; scanf("%d%d", &h, &w); for (int i = 1; i <= h; i++) scanf("%s", s[i] + 1); memset(f, 0x3f, sizeof(f)); f[1][1] = (s[1][1] == '#'); for (int i = ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
300
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); ++i) #define INF (1LL << 50) #define MOD 1000000007 int main() { int H, W; cin >> H >> W; vector<string> S(H); rep(i, H) cin >> S[i]; vector<vector<int>> dp(H, vector<int>(W)); for (int i = 0; i <...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); ++i) #define INF (1LL << 50) #define MOD 1000000007 int main() { int H, W; cin >> H >> W; vector<string> S(H); rep(i, H) cin >> S[i]; vector<vector<int>> dp(H, vector<int>(W)); for (int i = 0; i <...
[["-", 15, 339, 51, 16, 31, 69, 28, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 28, 69, 28, 22]]
1
428
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() c...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() c...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
433
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> using namespace std; #define REP(i, p, n) for (ll i = p; i < ll(n...
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> using namespace std; #define REP(i, p, n) for (ll i = p; i < ll(n...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
372
import sys def MI(): return map(int, sys.stdin.readline().split()) H,W = MI() s = [list(input()) for _ in range(H)] dp = [[0 for _ in range(W)] for _ in range(H)] if s[0][0]=='#': dp[0][0] = 1 for i in range(W-1): if s[0][i+1]=='#' and s[0][i]=='.': dp[0][i+1] = dp[0][i] + 1 else: dp[0][i+1] = dp[0][i] for i...
import sys def MI(): return map(int, sys.stdin.readline().split()) H,W = MI() s = [list(input()) for _ in range(H)] dp = [[0 for _ in range(W)] for _ in range(H)] if s[0][0]=='#': dp[0][0] = 1 for i in range(W-1): if s[0][i+1]=='#' and s[0][i]=='.': dp[0][i+1] = dp[0][i] + 1 else: dp[0][i+1] = dp[0][i] for i...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 3, 4, 0, 206, 51, 206, 206, 657, 31, 22], ["+", 3, 4, 0, 206, 51, 206, 206, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 31, 22]]
5
377
def ans_dp(H,W,M): dp = [[0 for i in range(H)] for j in range(W)] flag = [[0 for i in range(H)] for j in range(W)] if M[0][0] == "#": dp[0][0] = 1 flag[0][0] = 1 else: dp[0][0] == 0 for i in range(1,W): if M[0][i] == "#": flag[0][i] = 1 if flag...
def ans_dp(H,W,M): dp = [[0 for i in range(W)] for j in range(H)] flag = [[0 for i in range(W)] for j in range(H)] if M[0][0] == "#": dp[0][0] = 1 flag[0][0] = 1 else: dp[0][0] == 0 for i in range(1,W): if M[0][i] == "#": flag[0][i] = 1 if flag...
[["-", 8, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 8, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["-", 0, 37, 0, 206, 51, 206, 206, 657, 31, 22], ["+", 0, 37, 0, 206, 51, 206, 206, 657, 31, 22], ["-", 8, 196, 0, 37, 0, 206, 206, 657, ...
5
513
#include <algorithm> #include <cstdio> #include <cstring> using namespace std; const int maxn = 105; int n, m, F[maxn][maxn]; char mp[maxn][maxn]; bool to[maxn][maxn]; inline int read() { int ret = 0; bool f = 0; char ch = getchar(); while (ch > '9' || ch < '0') f ^= ch == '-', ch = getchar(); while (ch <...
#include <algorithm> #include <cstdio> #include <cstring> using namespace std; const int maxn = 105; int n, m, F[maxn][maxn]; char mp[maxn][maxn]; bool to[maxn][maxn]; inline int read() { int ret = 0; bool f = 0; char ch = getchar(); while (ch > '9' || ch < '0') f ^= ch == '-', ch = getchar(); while (ch <...
[["+", 3, 4, 0, 69, 341, 342, 0, 16, 17, 72], ["+", 3, 4, 0, 69, 341, 342, 0, 16, 12, 13]]
1
472
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; using namespace __gnu_pbds; void debug_out() { cer...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; using namespace __gnu_pbds; void debug_out() { cer...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22]]
1
848
/// wa ^3^ #pragma GCC optimize("O3") #include <bits/stdc++.h> #define x first #define y second #define pb push_back #define sz(x) (int)x.size() using namespace std; using ll = long long; using pii = pair<int, int>; const int MOD = 1e9 + 7; const int INF32 = 1e9 + 1e2; void stndrtn() { #ifdef accepted freopen(...
/// wa ^3^ #pragma GCC optimize("O3") #include <bits/stdc++.h> #define x first #define y second #define pb push_back #define sz(x) (int)x.size() using namespace std; using ll = long long; using pii = pair<int, int>; const int MOD = 1e9 + 7; const int INF32 = 1e9 + 1e2; void stndrtn() { #ifdef accepted freopen(...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
546
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define pb push_back #define mp make_pair #define f(i, a, n) for (int i = a; i < (int)n; i++) #define rf(i, n, a) for (int i = n; i >= a; i--) #define F first #define S second #define all(c) (c).begin(), (c).end() #define sz(v) (i...
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define pb push_back #define mp make_pair #define f(i, a, n) for (int i = a; i < (int)n; i++) #define rf(i, n, a) for (int i = n; i >= a; i--) #define F first #define S second #define all(c) (c).begin(), (c).end() #define sz(v) (i...
[["-", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22]]
1
584
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; int main() { int H, W; cin >> H >> W; vector<string> s(H); for (int i = ...
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; int main() { int H, W; cin >> H >> W; vector<string> s(H); for (int i = ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
349
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define vi vector<ll> #define vvi vector<vi> #define BITLE(n) (1LL << ((ll)n)) #define SHIFT_LEFT(n) (1LL << ((ll)n)) #define SUBS(s, f, t) (...
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define vi vector<ll> #define vvi vector<vi> #define BITLE(n) (1LL << ((ll)n)) #define SHIFT_LEFT(n) (1LL << ((ll)n)) #define SUBS(s, f, t) (...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
752
#include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << "=" << h << "\n"; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != ',') cerr << *sdbg++; cerr << "=" << h << ","; _dbg(sdbg + 1, a...); } te...
#include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << "=" << h << "\n"; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != ',') cerr << *sdbg++; cerr << "=" << h << ","; _dbg(sdbg + 1, a...); } te...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
706
#include <bits/stdc++.h> #define LL long long #define mp make_pair #define pb push_back #define VI vector<int> #define pii pair<int, int> using namespace std; char A[110][110]; int n, m; int dp[110][110]; int main() { scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) scanf("%s", A[i]); for (int i = 0; i < ...
#include <bits/stdc++.h> #define LL long long #define mp make_pair #define pb push_back #define VI vector<int> #define pii pair<int, int> using namespace std; char A[110][110]; int n, m; int dp[110][110]; int main() { scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) scanf("%s", A[i]); for (int i = 0; i < ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
292
#include <algorithm> #include <cmath> #include <cstdint> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <utility> #includ...
#include <algorithm> #include <cmath> #include <cstdint> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <utility> #includ...
[["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
854
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define FORS(i, a, b, c) for (int i = a; i < b; i += c) #define FORN(i, a, b) for (int i = a; i <= b; i++) #define FORD(i, a, b) for (int i = a - 1; i >= b; i--) #define FORE(i, b) for (auto &i : b) #define REP(i, b) FOR(i, ...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define FORS(i, a, b, c) for (int i = a; i < b; i += c) #define FORN(i, a, b) for (int i = a; i <= b; i++) #define FORD(i, a, b) for (int i = a - 1; i >= b; i--) #define FORE(i, b) for (auto &i : b) #define REP(i, b) FOR(i, ...
[["-", 12, 69, 28, 69, 341, 342, 0, 16, 31, 22], ["+", 12, 69, 28, 69, 341, 342, 0, 16, 31, 22], ["-", 31, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 31, 22]]
1
551
/* Aa^~ kokoro ga pyonpyon suru n jaa^~ // ZZZXXkXkkkZ!``` ``` ``` ``` ``` ``` ``` ``` ``` ``` ``` ```?Wfpppbpbbpbbpbbbkbkk // ppbbbpbbpVr`` `` ` ` ` ` ```` `` ` ` `` ` ` ` ` ` ` ` ` ` dppbbkkkkkkkkkkqkqkk // HkqqqqqkkWr`` ` ` ``` ``` `?G, ` ` ``.JC!```` ` ` `` `` ````(Wpbkkkkkkkkqkkkkkqk // mmmmmqqqqpr` `` `` ```````...
/* Aa^~ kokoro ga pyonpyon suru n jaa^~ // ZZZXXkXkkkZ!``` ``` ``` ``` ``` ``` ``` ``` ``` ``` ``` ```?Wfpppbpbbpbbpbbbkbkk // ppbbbpbbpVr`` `` ` ` ` ` ```` `` ` ` `` ` ` ` ` ` ` ` ` ` dppbbkkkkkkkkkkqkqkk // HkqqqqqkkWr`` ` ` ``` ``` `?G, ` ` ``.JC!```` ` ` `` `` ````(Wpbkkkkkkkkqkkkkkqk // mmmmmqqqqpr` `` `` ```````...
[["-", 15, 339, 51, 16, 31, 16, 12, 103, 0, 125], ["+", 15, 339, 51, 16, 31, 16, 12, 103, 0, 125], ["-", 15, 339, 51, 16, 12, 16, 12, 103, 0, 125], ["+", 15, 339, 51, 16, 12, 16, 12, 103, 0, 125]]
1
830
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; #define int long long #define endl "\n" constexpr long long INF = (long long)1e18; constexpr long long MOD = 1'000'000'007; struct fast_io { fas...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; #define int long long #define endl "\n" constexpr long long INF = (long long)1e18; constexpr long long MOD = 1'000'000'007; struct fast_io { fas...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
643
#include <algorithm> #include <cstdio> using namespace std; typedef pair<int, int> ii; int main() { int r, c; scanf("%d %d", &r, &c); char grid[r][c]; for (int i = 0; i < r; ++i) { for (int j = 0; j < c; ++j) scanf(" %c", &grid[i][j]); } int sp[r][c]; sp[0][0] = (grid[0][0] == '#'); for (int i...
#include <algorithm> #include <cstdio> using namespace std; typedef pair<int, int> ii; int main() { int r, c; scanf("%d %d", &r, &c); char grid[r][c]; for (int i = 0; i < r; ++i) { for (int j = 0; j < c; ++j) scanf(" %c", &grid[i][j]); } int sp[r][c]; sp[0][0] = (grid[0][0] == '#'); for (int i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
432
#include <bits/stdc++.h> using namespace std; const int N = 105; char c[N][N]; int dis[N][N]; vector<pair<pair<int, int>, int>> vec[N][N]; deque<pair<int, int>> q; int main() { ios ::sync_with_stdio(false); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >...
#include <bits/stdc++.h> using namespace std; const int N = 105; char c[N][N]; int dis[N][N]; vector<pair<pair<int, int>, int>> vec[N][N]; deque<pair<int, int>> q; int main() { ios ::sync_with_stdio(false); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
434
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int H, W; cin >> H >> W; vector<string> fld(H); vector<vector<int>> cost(H); for (int i = 0; i < H; i++) { string s; cin >> s; fld[i] = s; } cost[0] = vector<int>(W); cost[0][0] = 0; ...
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int H, W; cin >> H >> W; vector<string> fld(H); vector<vector<int>> cost(H); for (int i = 0; i < H; i++) { string s; cin >> s; fld[i] = s; } cost[0] = vector<int>(W); cost[0][0] = 0; ...
[["+", 15, 23, 0, 16, 12, 91, 28, 23, 0, 24], ["+", 15, 23, 0, 16, 12, 91, 28, 23, 0, 25]]
1
454
#include <bits/stdc++.h> #define Rint register int #define MP make_pair #define fi first #define se second #define PB push_back using namespace std; typedef long long LL; typedef pair<int, int> pii; // 注意必要时改类型 typedef vector<int> vi; template <typename T> inline void read(T &x) { int ch = getchar(); x = 0; bool ...
#include <bits/stdc++.h> #define Rint register int #define MP make_pair #define fi first #define se second #define PB push_back using namespace std; typedef long long LL; typedef pair<int, int> pii; // 注意必要时改类型 typedef vector<int> vi; template <typename T> inline void read(T &x) { int ch = getchar(); x = 0; bool ...
[["-", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22]]
1
623
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <cstdio> #include <deque> #include <float.h> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <...
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <cstdio> #include <deque> #include <float.h> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 160], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
1,216
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int h, w; cin >> h >> w; vector<string> s(h); rep(i, h) cin >> s[i]; vector<vector<int>> ans(h, vector<int>(w, 100000)); if (s[0][0] == '.') ans[0][0] = 0; else ans[0][...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int h, w; cin >> h >> w; vector<string> s(h); rep(i, h) cin >> s[i]; vector<vector<int>> ans(h, vector<int>(w, 100000)); if (s[0][0] == '.') ans[0][0] = 0; else ans[0][...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
437
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { int h, w; cin >> h >> w; vector<string> s(h); for (int i = 0; i < h; i++) { cin >> s[i]; } vector<vector<int>> dp(h, vector<int>(h, 1e5)); if (s[0][0] == '#') dp[0][0] = 1; else dp[0][0] = 0; for (int i = 0; i...
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { int h, w; cin >> h >> w; vector<string> s(h); for (int i = 0; i < h; i++) { cin >> s[i]; } vector<vector<int>> dp(h, vector<int>(w, 1e5)); if (s[0][0] == '#') dp[0][0] = 1; else dp[0][0] = 0; for (int i = 0; i...
[["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22]]
1
380
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define _GLIBCXX_DEBUG int main() { int h, w; cin >> h >> w; char s[h + 1][w + 1]; rep(i, h) { rep(j, w) { cin >> s[i + 1][j + 1]; } } vector<vector<int>> dp(h + 1, vect...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define _GLIBCXX_DEBUG int main() { int h, w; cin >> h >> w; char s[h + 1][w + 1]; rep(i, h) { rep(j, w) { cin >> s[i + 1][j + 1]; } } vector<vector<int>> dp(h + 1, vect...
[["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79]]
1
350
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define ms(s, n) memset(s, n, sizeof(s)) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORd(i, a, b) for (int i = (a)-1; i >= (b); --i) #define FO...
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define ms(s, n) memset(s, n, sizeof(s)) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORd(i, a, b) for (int i = (a)-1; i >= (b); --i) #define FO...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
1,083
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; --i) #define fi first #define se second using namespace std; using lint = long long; using uint = unsigned int; using ulint = unsigned long long; using ldouble = long double; using pii = pair<int, int>;...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; --i) #define fi first #define se second using namespace std; using lint = long long; using uint = unsigned int; using ulint = unsigned long long; using ldouble = long double; using pii = pair<int, int>;...
[["+", 12, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]]
1
657
#include <bits/stdc++.h> using namespace std; #define rep(i, s, n) for (int i = (int)s; i < (int)n; i++) #define ll long long #define pb push_back #define eb emplace_back #define All(x) x.begin(), x.end() #define Range(x, i, j) x.begin() + i, x.begin() + j #define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.beg...
#include <bits/stdc++.h> using namespace std; #define rep(i, s, n) for (int i = (int)s; i < (int)n; i++) #define ll long long #define pb push_back #define eb emplace_back #define All(x) x.begin(), x.end() #define Range(x, i, j) x.begin() + i, x.begin() + j #define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.beg...
[["-", 15, 339, 51, 16, 31, 16, 12, 103, 0, 125], ["+", 15, 339, 51, 16, 31, 16, 12, 103, 0, 125], ["-", 15, 339, 51, 16, 12, 16, 12, 103, 0, 125], ["+", 15, 339, 51, 16, 12, 16, 12, 103, 0, 125]]
1
685
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; const int N = 110; int dp[N][N]; bool mat[N][N]; int main() { ios::sync_with_stdio(0), cin.tie(0); int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { string s; cin >> s; for (int j = 0; j < m; j++...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; const int N = 110; int dp[N][N]; bool mat[N][N]; int main() { ios::sync_with_stdio(0), cin.tie(0); int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { string s; cin >> s; for (int j = 0; j < m; j++...
[["-", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22]]
1
304
// I SELL YOU...! #include <algorithm> #include <chrono> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; using ll = long long; using P = pair<ll, ll>; void init_io() { cin.tie(0); ios::sync_with_stdio(false); cout <...
// I SELL YOU...! #include <algorithm> #include <chrono> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; using ll = long long; using P = pair<ll, ll>; void init_io() { cin.tie(0); ios::sync_with_stdio(false); cout <...
[["-", 0, 57, 15, 339, 51, 16, 31, 91, 17, 111], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 111]]
1
430
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> using namespace std; template <typename T> struct edge { int src, to; T cost; edge(int to, T cost) : src(-1), to(to), cost(cost) {} ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> using namespace std; template <typename T> struct edge { int src, to; T cost; edge(int to, T cost) : src(-1), to(to), cost(cost) {} ...
[["-", 28, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["+", 28, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["-", 12, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 12, 22]]
1
763
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; int dp[105][105][2]; ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; int dp[105][105][2]; ...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
593
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define INF 10000000 int H, W; int M[100][100]; int dp[100][100]; bool check(int r, int c) { return r >= 0 && r < H && c >= 0 && c < W; } int ans(int BL, int WH) { for (int r = 0; r < H; r++) { fo...
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define INF 10000000 int H, W; int M[100][100]; int dp[100][100]; bool check(int r, int c) { return r >= 0 && r < H && c >= 0 && c < W; } int ans(int BL, int WH) { for (int r = 0; r < H; r++) { fo...
[["-", 51, 41, 15, 23, 0, 16, 31, 16, 12, 22], ["+", 51, 41, 15, 23, 0, 16, 31, 16, 12, 22], ["-", 51, 41, 15, 23, 0, 16, 12, 16, 12, 22], ["+", 51, 41, 15, 23, 0, 16, 12, 16, 12, 22]]
1
468
#include <bits/stdc++.h> using namespace std; #define FOR(i, x, y) for (int i = (x); i < (y); ++i) #define REP(i, x, y) for (int i = (x); i <= (y); ++i) #define MP make_pair #define PB push_back #define PH push #define fst first #define snd second typedef long long ll; typedef unsigned long long ull; typedef double d...
#include <bits/stdc++.h> using namespace std; #define FOR(i, x, y) for (int i = (x); i < (y); ++i) #define REP(i, x, y) for (int i = (x); i <= (y); ++i) #define MP make_pair #define PB push_back #define PH push #define fst first #define snd second typedef long long ll; typedef unsigned long long ull; typedef double d...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
467
//#pragma GCC optimize ("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define pb push_back #define F first #define S second #define ins insert #define mp ma...
//#pragma GCC optimize ("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define pb push_back #define F first #define S second #define ins insert #define mp ma...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
971
#include <bits/stdc++.h> #include <stdlib.h> #include <sys/time.h> #include <unistd.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<P, ll> T; long long int INF = 1e18; const ll fact_table = 800008; double Pi = 3.1415926535897932384626; priority_queue<ll> pql; priority_queue<P> pqp...
#include <bits/stdc++.h> #include <stdlib.h> #include <sys/time.h> #include <unistd.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<P, ll> T; long long int INF = 1e18; const ll fact_table = 800008; double Pi = 3.1415926535897932384626; priority_queue<ll> pql; priority_queue<P> pqp...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22]]
1
1,086
// Created Time:2020年03月21日 星期六 20时03分11秒 #include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define N 102 using namespace std; int n, m, ans; int f[N][N]; char mp[N][N]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) scanf("%s", mp[i] + 1); memset(f, 127, sizeo...
// Created Time:2020年03月21日 星期六 20时03分11秒 #include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define N 102 using namespace std; int n, m, ans; int f[N][N]; char mp[N][N]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) scanf("%s", mp[i] + 1); memset(f, 127, sizeo...
[["-", 15, 339, 51, 16, 31, 69, 28, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 28, 69, 28, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72]]
1
378
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { x = 0; int f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = getchar(); x *= f; ret...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { x = 0; int f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = getchar(); x *= f; ret...
[["-", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22]]
1
729
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") typedef vector<int> vi; typedef long long lint; typedef unsigned int uint; typedef pair<int, int> pii; typedef pair<lint, lint> pll; typedef unsigned long long ulint; #define endl '\n' #define fst first #define sed second #define pb push_back #...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") typedef vector<int> vi; typedef long long lint; typedef unsigned int uint; typedef pair<int, int> pii; typedef pair<lint, lint> pll; typedef unsigned long long ulint; #define endl '\n' #define fst first #define sed second #define pb push_back #...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
327
#include <bits/stdc++.h> using namespace std; #define mod 998244353 #define MOD 1000000007 #define inf 0x3f3f3f3f #define linf 0x3f3f3f3f3f3f3f3fll typedef long long ll; typedef pair<int, int> pii; typedef unsigned long long ull; const int maxn = 1e6 + 10; int cn[maxn]; int n; char s[maxn]; bool check2() { for (int i...
#include <bits/stdc++.h> using namespace std; #define mod 998244353 #define MOD 1000000007 #define inf 0x3f3f3f3f #define linf 0x3f3f3f3f3f3f3f3fll typedef long long ll; typedef pair<int, int> pii; typedef unsigned long long ull; const int maxn = 1e6 + 10; int cn[maxn]; int n; char s[maxn]; bool check2() { for (int i...
[["+", 12, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 16, 31, 23, 0, 16, 31, 23, 0, 25]]
1
267
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef pair<ll, ll> pl; typedef queue<ll> ql; typedef set<ll> sl; typedef vector<ll> vl; #define rep(i, n) for (ll i = 0; i < ll(n); i++) #define rep2(i, n) for (ll i = 1; i <= ll(n); i++) //#define rep(i, k, n) for(ll i = ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef pair<ll, ll> pl; typedef queue<ll> ql; typedef set<ll> sl; typedef vector<ll> vl; #define rep(i, n) for (ll i = 0; i < ll(n); i++) #define rep2(i, n) for (ll i = 1; i <= ll(n); i++) //#define rep(i, k, n) for(ll i = ...
[["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
435
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include ...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include ...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
534
#include <bits/stdc++.h> #define FASTIO using namespace std; using ll = long long; using Vi = vector<int>; using Vl = vector<ll>; using Pii = pair<int, int>; using Pll = pair<ll, ll>; constexpr int I_INF = numeric_limits<int>::max(); constexpr ll L_INF = numeric_limits<ll>::max(); //=================================...
#include <bits/stdc++.h> #define FASTIO using namespace std; using ll = long long; using Vi = vector<int>; using Vl = vector<ll>; using Pii = pair<int, int>; using Pll = pair<ll, ll>; constexpr int I_INF = numeric_limits<int>::max(); constexpr ll L_INF = numeric_limits<ll>::max(); //=================================...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
351
#include <iostream> using namespace std; int N; char S[1000005]; int A[1000005]; void Read() { cin >> N; cin.get(); cin.getline(S + 1, 1000005); for (int i = 1; i <= N; i++) A[i] = S[i] - '0'; } inline int mod(int x) { return x > 0 ? x : -x; } void firstStep() { for (int i = 1; i < N; i++) { A[i] = m...
#include <iostream> using namespace std; int N; char S[1000005]; int A[1000005]; void Read() { cin >> N; cin.get(); cin.getline(S + 1, 1000005); for (int i = 1; i <= N; i++) A[i] = S[i] - '0'; } inline int mod(int x) { return x > 0 ? x : -x; } void firstStep() { for (int i = 1; i < N; i++) { A[i] = m...
[["-", 8, 9, 0, 37, 0, 23, 0, 16, 17, 79], ["+", 8, 9, 0, 37, 0, 23, 0, 16, 17, 60]]
1
416
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; int n, m, f[110][110]; char mp[110][110]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) scanf("%s", mp[i] + 1); for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) f[i][j] = INF; f[1][1] = (mp[1][1] == '#')...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; int n, m, f[110][110]; char mp[110][110]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) scanf("%s", mp[i] + 1); for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) f[i][j] = INF; f[1][1] = (mp[1][1] == '#')...
[["-", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22]]
1
319
#ifdef DEBUG #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> using namespace std; typedef long double ld; #ifdef DEBUG #define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) #else #define eprintf(...) ; #endif #define sz(x) ((int)(x).size()) #define TASK "text" const int inf = (int)1.01e9; const...
#ifdef DEBUG #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> using namespace std; typedef long double ld; #ifdef DEBUG #define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) #else #define eprintf(...) ; #endif #define sz(x) ((int)(x).size()) #define TASK "text" const int inf = (int)1.01e9; const...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
582
#include "bits/stdc++.h" #include <random> #define REP(i, n) for (ll i = 0; i < ll(n); ++i) #define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i) #define FOR(i, m, n) for (ll i = m; i < ll(n); ++i) #define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i) #define ALL(v) (v).begin(), (v).end() #define UNIQUE(v) v.e...
#include "bits/stdc++.h" #include <random> #define REP(i, n) for (ll i = 0; i < ll(n); ++i) #define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i) #define FOR(i, m, n) for (ll i = m; i < ll(n); ++i) #define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i) #define ALL(v) (v).begin(), (v).end() #define UNIQUE(v) v.e...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
542
#include <bits/stdc++.h> #define FOR(i, n) for (int i = 0; i < (int)(n); ++i) #define pb push_back #define debug(x) std::cout << #x << ": " << x << '\n'; typedef long long ll; const int N = 210, mod = 998244353; int dp[N][N][2]; char a[N][N]; signed main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int ...
#include <bits/stdc++.h> #define FOR(i, n) for (int i = 0; i < (int)(n); ++i) #define pb push_back #define debug(x) std::cout << #x << ": " << x << '\n'; typedef long long ll; const int N = 210, mod = 998244353; int dp[N][N][2]; char a[N][N]; signed main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int ...
[["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
376
#include <bits/stdc++.h> using namespace std; #define ucin ios::sync_with_stdio(0), cin.tie(0) #define fs first #define sc second #define pb push_back #define mp make_pair typedef pair<int, int> pii; typedef double db; typedef long long ll; typedef long double ldb; typedef unsigned long long ull; const int N = 110 + ...
#include <bits/stdc++.h> using namespace std; #define ucin ios::sync_with_stdio(0), cin.tie(0) #define fs first #define sc second #define pb push_back #define mp make_pair typedef pair<int, int> pii; typedef double db; typedef long long ll; typedef long double ldb; typedef unsigned long long ull; const int N = 110 + ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
472
#include <bits/stdc++.h> #include <stdio.h> using namespace std; template <class T, size_t... I> void print_tuple(ostream &s, T const &a, index_sequence<I...>) { using swallow = int[]; (void)swallow{0, (void(s << (I == 0 ? "" : ", ") << get<I>(a)), 0)...}; } template <class T> ostream &print_collection(ostream...
#include <bits/stdc++.h> #include <stdio.h> using namespace std; template <class T, size_t... I> void print_tuple(ostream &s, T const &a, index_sequence<I...>) { using swallow = int[]; (void)swallow{0, (void(s << (I == 0 ? "" : ", ") << get<I>(a)), 0)...}; } template <class T> ostream &print_collection(ostream...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
1,831
#include <algorithm> #include <bits/stdc++.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int INF = 1e9; int main() { int n; cin >> n; vector<int> a(n); bool flag1 = false; rep(i, n) { char ch; ...
#include <algorithm> #include <bits/stdc++.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int INF = 1e9; int main() { int n; cin >> n; vector<int> a(n); bool flag1 = false; rep(i, n) { char ch; ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 48], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25]]
1
274
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < int(n); i++) using namespace std; using ll = long long; const int INF = (1 << 30) - 1; const long long LINF = (1LL << 62) - 1; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < int(n); i++) using namespace std; using ll = long long; const int INF = (1 << 30) - 1; const long long LINF = (1LL << 62) - 1; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 90]]
1
497
import sys import math import heapq mod=10**9+7 inf=float("inf") from math import sqrt, ceil from collections import deque, Counter, defaultdict, OrderedDict #すべてのkeyが用意されてる defaultdict(int)で初期化 #順序を保ったdict input=lambda: sys.stdin.readline().strip() sys.setrecursionlimit(11451419) from decimal import ROUND_HALF_UP,Deci...
import sys import math import heapq mod=10**9+7 inf=float("inf") from math import sqrt, ceil from collections import deque, Counter, defaultdict, OrderedDict #すべてのkeyが用意されてる defaultdict(int)で初期化 #順序を保ったdict input=lambda: sys.stdin.readline().strip() sys.setrecursionlimit(11451419) from decimal import ROUND_HALF_UP,Deci...
[["-", 12, 658, 8, 657, 31, 23, 0, 657, 17, 33], ["-", 12, 658, 8, 657, 31, 23, 0, 657, 12, 612], ["+", 12, 658, 8, 657, 31, 23, 0, 657, 17, 676], ["+", 12, 658, 8, 657, 31, 23, 0, 657, 12, 612]]
5
342
//#include<bits\stdc++.h> #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include ...
//#include<bits\stdc++.h> #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include ...
[["-", 0, 11, 12, 16, 12, 23, 0, 41, 64, 13], ["-", 0, 11, 12, 16, 12, 23, 0, 41, 0, 102], ["+", 0, 11, 12, 16, 12, 23, 0, 41, 0, 102], ["+", 0, 11, 12, 16, 12, 23, 0, 41, 75, 13]]
1
500
#include <bits/stdc++.h> using namespace std; template <class T> inline bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> inline bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; string S; ...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> inline bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; string S; ...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 48]]
1
293
#include <bits/stdc++.h> #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define repb(i, n) for (ll i = (n)-1; i >= 0; i--) #define rep(i, n) repd(i, 0, n) using namespace std; using ll = long long; using ul = unsigned long long; ll mod = 1000000007; bool is_nCk_odd(ll n, ll k) { return (n & k) == k; } int ma...
#include <bits/stdc++.h> #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define repb(i, n) for (ll i = (n)-1; i >= 0; i--) #define rep(i, n) repd(i, 0, n) using namespace std; using ll = long long; using ul = unsigned long long; ll mod = 1000000007; bool is_nCk_odd(ll n, ll k) { return (n & k) == k; } int ma...
[["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
292
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <vector> using...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <vector> using...
[["-", 15, 339, 51, 16, 31, 16, 12, 103, 0, 125], ["+", 15, 339, 51, 16, 31, 16, 12, 103, 0, 125]]
1
455
#include <iostream> #include <vector> using namespace std; int solve(vector<int> &v) { int n = v.size(); int ans = 0; for (int i = 0; i < n; i++) { if (((n - 1) | i) == n - 1) { ans ^= v[i]; } } return ans; } int main() { ios::sync_with_stdio(false); int n; cin >> n; int flag = 0;...
#include <iostream> #include <vector> using namespace std; int solve(vector<int> &v) { int n = v.size(); int ans = 0; for (int i = 0; i < n; i++) { if (((n - 1) | i) == n - 1) { ans ^= v[i]; } } return ans; } int main() { ios::sync_with_stdio(false); int n; cin >> n; int flag = 0;...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 48], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
236
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
[["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125]]
1
641
#include <bits/stdc++.h> #define itn int #define all(x) (x).begin(), (x).end() #define make_unique(x) \ sort(all((x))); \ (x).resize(unique(all((x))) - (x).begin()) using namespace std; inline int...
#include <bits/stdc++.h> #define itn int #define all(x) (x).begin(), (x).end() #define make_unique(x) \ sort(all((x))); \ (x).resize(unique(all((x))) - (x).begin()) using namespace std; inline int...
[["-", 12, 16, 31, 2, 3, 4, 0, 103, 0, 125], ["+", 12, 16, 31, 2, 3, 4, 0, 103, 0, 125]]
1
238
#include <bits/stdc++.h> using namespace std; #define Fi first #define Se second typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define all(x) (x).begin(), (x).end() #define pb push_back #define szz(x) (int)(x).size() #define rep(i, n) for (int i = 0; i < (n); i++) typedef tuple<int, int, ...
#include <bits/stdc++.h> using namespace std; #define Fi first #define Se second typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define all(x) (x).begin(), (x).end() #define pb push_back #define szz(x) (int)(x).size() #define rep(i, n) for (int i = 0; i < (n); i++) typedef tuple<int, int, ...
[["+", 12, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
447
// #pragma GCC optimize("Ofast") // #pragma GCC // target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") // #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FAST ...
// #pragma GCC optimize("Ofast") // #pragma GCC // target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") // #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FAST ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
1,790
#include <bits/stdc++.h> using namespace std; #define int long long #define ii pair<int, int> #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcount #define ll long long #define mp make_pair #define f first #define s second #define Time (double)clock() / CLOCKS_PER_SEC const int N = 1e6 ...
#include <bits/stdc++.h> using namespace std; #define int long long #define ii pair<int, int> #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcount #define ll long long #define mp make_pair #define f first #define s second #define Time (double)clock() / CLOCKS_PER_SEC const int N = 1e6 ...
[["-", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
442
#include <bits/stdc++.h> using namespace std; #define int long long const int MOD = 1000000007; int bit(int a) { int res = 0; while (a > 0) { res++; a >>= 1; } return res; } int C(int a, int b) { int k = a + b; if (k == 0) return 1; int B = ((int)1 << (bit(k) - 1)); if (a < B && b < B) { ...
#include <bits/stdc++.h> using namespace std; #define int long long const int MOD = 1000000007; int bit(int a) { int res = 0; while (a > 0) { res++; a >>= 1; } return res; } int C(int a, int b) { int k = a + b; if (k == 0) return 1; int B = ((int)1 << (bit(k) - 1)); if (a < B && b < B) { ...
[["-", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
349
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int N; cin >> N; string S; cin >> S; vector<int> A(N); for (int i = 0; i < N; ++i) A[i] = S[i] - '0'; { vector<int> B; for (int i = 0; i + 1 < N; ++i) { B.emplace_back(abs(A[i] - A[i + 1])); ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int N; cin >> N; string S; cin >> S; vector<int> A(N); for (int i = 0; i < N; ++i) A[i] = S[i] - '0'; { vector<int> B; for (int i = 0; i + 1 < N; ++i) { B.emplace_back(abs(A[i] - A[i + 1])); ...
[["-", 0, 11, 12, 23, 0, 16, 12, 103, 0, 104], ["-", 0, 7, 8, 1, 0, 11, 12, 16, 17, 152], ["-", 0, 7, 8, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 17, 85], ["+", 0, 7, 8, 1, 0, 11, 12, 16, 12, 13]]
1
337
// B - 123 Triangle #include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; string s; cin >> n >> s; vector<int> a(n); for (int i = 0; i < n; i++) a[i] = s[i] - '1'; vector<int> c(n); for (int i = 1; i < c.size(); i++) c[i] = __builtin_ctz(i) + c[i - 1]; int ans...
// B - 123 Triangle #include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; string s; cin >> n >> s; vector<int> a(n); for (int i = 0; i < n; i++) a[i] = s[i] - '1'; vector<int> c(n); for (int i = 1; i < c.size(); i++) c[i] = __builtin_ctz(i) + c[i - 1]; int ans...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["-", 0, 7, 15, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 7, 15, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 7, 15, 16, 12, 69, 341, 342, 0, 73], ["+", 0, 7, 15, 16, 12, 2, 63, 118, 17, 131], ["+", 0, 7, 15, 16, 12, 2, 63, 118, 119, 120], ["...
1
341
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define f first #define s second #define ll long long #define int ll #define forn(i, a, b) for (int i = (a); i <= (b); ++i) #define forev(i, b, a) for (int i = (b); i >= (a); --i) #define VAR(v, i) __typeof(i) v = (i) #define forit(i, c) for (VAR(i, (c...
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define f first #define s second #define ll long long #define int ll #define forn(i, a, b) for (int i = (a); i <= (b); ++i) #define forev(i, b, a) for (int i = (b); i >= (a); --i) #define VAR(v, i) __typeof(i) v = (i) #define forit(i, c) for (VAR(i, (c...
[["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["-", 31, 69, 28, 2, 3, 4, 0, 16, 17, 33], ["-", 31, 69, 28, 2, 3, 4, 0, 16, 12, 13]]
1
363
N = int(input()) a = list(map(int,list(input()))) a = list(map(lambda x:x-1,a)) x = 0 num_mod = [0]*N for i in range(1,N): tmp = 0 while i%2==0: i//=2 tmp+=1 num_mod[i] = num_mod[i-1]+tmp for i,n in enumerate(a): if n%2==0: continue else: if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]): ...
N = int(input()) a = list(map(int,list(input()))) a = list(map(lambda x:x-1,a)) x = 0 num_mod = [0]*N for i in range(1,N): tmp = 0 t = i while t%2==0: t//=2 tmp+=1 num_mod[i] = num_mod[i-1]+tmp for i,n in enumerate(a): if n%2==0: continue else: if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i])...
[["-", 0, 656, 0, 7, 8, 196, 0, 52, 0, 89], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 7, 8, 196, 0, 52, 0, 89], ["+", 8, 196, 0, 52, 15, 666, 0, 657, 31, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22]]
5
236
#include <bits/stdc++.h> #define DEBUG if (0) #define lli long long int #define ldouble long double using namespace std; const int maxN = 1e6 + 2; int n; char a[maxN]; int main() { while (scanf("%d", &n) != EOF) { scanf(" %s", a); DEBUG { int x[n][n]; for (int j = 0; j < n; j++) { printf...
#include <bits/stdc++.h> #define DEBUG if (0) #define lli long long int #define ldouble long double using namespace std; const int maxN = 1e6 + 2; int n; char a[maxN]; int main() { while (scanf("%d", &n) != EOF) { scanf(" %s", a); DEBUG { int x[n][n]; for (int j = 0; j < n; j++) { printf...
[["-", 0, 7, 8, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 57, 64, 1, 0, 11, 17, 130]]
1
486
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++) #define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define bra(first, second) '(' << fi...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++) #define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) RFOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define bra(first, second) '(' << fi...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
454
#include <bits/stdc++.h> using namespace std; #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <vector> typedef long long ll; typedef vector<ll> vll; typedef pair<ll, ll> pairll; #define sll(x) scanf("%lld", &x); #define READ freopen("in.txt", "r", std...
#include <bits/stdc++.h> using namespace std; #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <vector> typedef long long ll; typedef vector<ll> vll; typedef pair<ll, ll> pairll; #define sll(x) scanf("%lld", &x); #define READ freopen("in.txt", "r", std...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
563
package main import ( "bufio" "os" "strconv" "strings" "fmt" ) var reader = bufio.NewReaderSize(os.Stdin, 1000000) var writer = bufio.NewWriter(os.Stdout) func NextLine() string { buffer := make([]byte, 0) for true { line, isPrefix, err := reader.ReadLine() if err != nil { panic(err) } buffer...
package main import ( "bufio" "os" "strconv" "strings" "fmt" ) var reader = bufio.NewReaderSize(os.Stdin, 1000000) var writer = bufio.NewWriter(os.Stdout) func NextLine() string { buffer := make([]byte, 0) for true { line, isPrefix, err := reader.ReadLine() if err != nil { panic(err) } buffer...
[["-", 0, 57, 64, 196, 0, 37, 0, 432, 0, 433], ["+", 0, 57, 64, 196, 0, 37, 0, 432, 0, 433], ["-", 0, 435, 8, 196, 0, 37, 0, 432, 0, 433], ["+", 0, 435, 8, 196, 0, 37, 0, 432, 0, 433]]
7
869
#include <algorithm> // minmax, sort, swap #include <bitset> #include <cassert> #include <cmath> #include <cstdio> // printf, scanf #include <deque> // deque #include <functional> // function<void(int)> #include <iomanip> // cout<<setprecision(n) #include <iostream> // cin, cout, cerr #include <map> ...
#include <algorithm> // minmax, sort, swap #include <bitset> #include <cassert> #include <cmath> #include <cstdio> // printf, scanf #include <deque> // deque #include <functional> // function<void(int)> #include <iomanip> // cout<<setprecision(n) #include <iostream> // cin, cout, cerr #include <map> ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 51, 16, 12, 16, 12, 23, 0, 16, 17, 139], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 17, 67], ["-", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 12, 13]]
1
256
#include "bits/stdc++.h" using namespace std; #define REP(k, m, n) for (int(k) = (m); (k) < (n); (k)++) #define rep(i, n) REP((i), 0, (n)) using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using tp3 = tuple<int, int, int>; using Mat = vector<vector<ll>>; constexpr int INF = 1 << 28; constexpr ...
#include "bits/stdc++.h" using namespace std; #define REP(k, m, n) for (int(k) = (m); (k) < (n); (k)++) #define rep(i, n) REP((i), 0, (n)) using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using tp3 = tuple<int, int, int>; using Mat = vector<vector<ll>>; constexpr int INF = 1 << 28; constexpr ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 48], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
754
#include <bits/stdc++.h> using namespace std; typedef long long int LL; #define st first #define nd second #define PLL pair<LL, LL> #define PII pair<int, int> const int N = 1e6 + 7; const int MX = 1e9 + 7; const LL INF = 1LL * MX * MX; int n; char in[N]; int to_solve[N]; int get_2(int x) { int ans = 0; while ...
#include <bits/stdc++.h> using namespace std; typedef long long int LL; #define st first #define nd second #define PLL pair<LL, LL> #define PII pair<int, int> const int N = 1e6 + 7; const int MX = 1e9 + 7; const LL INF = 1LL * MX * MX; int n; char in[N]; int to_solve[N]; int get_2(int x) { int ans = 0; while ...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
327
from itertools import product K = int(input()) ans = [] for l in range(10): for s in range(1, 10): for pattern in product([-1, 0, 1], repeat=l): X = [s] for p in pattern: if not (0 <= X[-1] + p <= 9): break X.append(X[-1] + p) ...
from itertools import product K = int(input()) ans = [] for l in range(10): for s in range(1, 10): for pattern in product([-1, 0, 1], repeat=l): X = [s] for p in pattern: if not (0 <= X[-1] + p <= 9): break X.append(X[-1] + p) ...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
125
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double lb; int mod = 1e9 + 7; const int N = 2e5 + 100; queue<long long> q; int main() { int k; cin >> k; for (int i = 1; i <= 9; i++) q.push(i); for (int i = 1; i < k; i++) { ll a = q.front(); ll si = a % 10; q.po...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double lb; int mod = 1e9 + 7; const int N = 2e5 + 100; queue<ll> q; int main() { int k; cin >> k; for (int i = 1; i <= 9; i++) q.push(i); for (int i = 1; i < k; i++) { ll a = q.front(); ll si = a % 10; q.pop(); ...
[["-", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
222
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = 1e3 + 5; ll dp[220][110]; ll sum[220]; void print(ll step, ll rest, ll dig) { if (step == 0) return; cout << dig; if (dig == 9) { if (rest <= dp[step - 1][dig - 1]) { print(step - 1, rest, dig - 1); } rest -=...
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = 1e3 + 5; ll dp[220][110]; ll sum[220]; void print(ll step, ll rest, ll dig) { if (step == 0) return; cout << dig; if (dig == 9) { if (rest <= dp[step - 1][dig - 1]) { print(step - 1, rest, dig - 1); return; ...
[["+", 64, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 64, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
573
#include <bits/stdc++.h> #define rp(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; int main() { ll k; cin >> k; queue<ll> number; for (int i = 1; i <= 9; i++) { number.push(i); } if (k == 1) { cout << 1 << endl; return 0; } rp(i, k - 1) { int x = number.fro...
#include <bits/stdc++.h> #define rp(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; int main() { ll k; cin >> k; queue<ll> number; for (int i = 1; i <= 9; i++) { number.push(i); } if (k == 1) { cout << 1 << endl; return 0; } rp(i, k - 1) { ll x = number.fron...
[["-", 0, 14, 8, 9, 0, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 9, 0, 43, 39, 78]]
1
228
#!/usr/bin/env python3 k = int(input()) a = [] for i in range(1, 10): a.append(i) while True: if k <= len(a): print(a[k - 1]) exit() k -= len(a) old = [] a, old = old, a for x in old: for i in range(-1, 2): d = x % 10 + i if d < 0 and d > 9: ...
#!/usr/bin/env python3 k = int(input()) a = [] for i in range(1, 10): a.append(i) while True: if k <= len(a): print(a[k - 1]) exit() k -= len(a) old = [] a, old = old, a for x in old: for i in range(-1, 2): d = x % 10 + i if d < 0 or d > 9: ...
[["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 7, 8, 196, 0, 57, 15, 679, 17, 354]]
5
115
import math import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: map(int, stdin.readline().split()) nl = lambda: list(map(int, stdin.readline().split())) mod = 10**9 + 7 sys.setrecursionlimit(1000010) K = ni() if K <=9: print(K) u = [] dp...
import math import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: map(int, stdin.readline().split()) nl = lambda: list(map(int, stdin.readline().split())) mod = 10**9 + 7 sys.setrecursionlimit(1000010) K = ni() if K <=9: print(K) exit(0...
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
507
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; int main() { int k; cin >> k; vector<ll> a; for (int i = 1; i <= 9; i++) a.push_back(i); while (1) { if (k <= a.size()) { cout << a[k - 1]; return 0; } k -= a.size()...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; int main() { int k; cin >> k; vector<ll> a; for (int i = 1; i <= 9; i++) a.push_back(i); while (1) { if (k <= a.size()) { cout << a[k - 1]; return 0; } k -= a.size()...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
168
k = int(input()) d = deque(list(range(1, 10))) c = 0 v = 0 while c < k: v = d.popleft() c += 1 if v % 10 == 9: d.append(v * 10 + 8) d.append(v * 10 + 9) elif v % 10 == 0: d.append(v * 10) d.append(v * 10 + 1) else: t = v % 10 d.append(v * 10 + t - 1) ...
from collections import deque k = int(input()) d = deque(list(range(1, 10))) c = 0 v = 0 while c < k: v = d.popleft() c += 1 if v % 10 == 9: d.append(v * 10 + 8) d.append(v * 10 + 9) elif v % 10 == 0: d.append(v * 10) d.append(v * 10 + 1) else: t = v % 10 ...
[["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
140
#include <bits/stdc++.h> using namespace std; typedef long long ll; int cnt = 0, num, len, k; ll ans; void dfs(int x, ll i) { if (len == x) { cnt++; if (cnt == k) { ans = i; } i /= 10; return; } int u = i % 10; for (ll j = u - 1; j <= u + 1; j++) { if (j < 0 || j > 9) continu...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int cnt = 0, num, len, k; ll ans; void dfs(int x, ll i) { if (len == x) { cnt++; if (cnt == k) { ans = i; } i /= 10; return; } int u = i % 10; for (ll j = u - 1; j <= u + 1; j++) { if (j < 0 || j > 9) continu...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
184
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; #include <algorithm> int main() { int k; cin >> k; queue<int> q; rep(i, 9) q.push(i + 1); while (--k) { int tmp = q.front(); if (tmp % 10 == 0) { q.push(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; #include <algorithm> int main() { int k; cin >> k; queue<ll> q; rep(i, 9) q.push(i + 1); while (--k) { ll tmp = q.front(); if (tmp % 10 == 0) { q.push(tm...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78], ["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95]]
1
216
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<ll, ll>; int main() { int K; cin >> K; vector<ll> a; for (int i = 1; i < 10; i++) { a.push_back(i); } while (1) { if (K <= a.size()) { cout << a[K - 1] << endl; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<ll, ll>; int main() { int K; cin >> K; vector<ll> a; for (int i = 1; i < 10; i++) { a.push_back(i); } while (1) { if (K <= a.size()) { cout << a[K - 1] << endl; ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
190
package main import ( "fmt" ) func main() { var k int fmt.Scan(&k) fmt.Println(task(k)) } func task(k int) int64 { var p int64 slice := []int64{1,2,3,4,5,6,7,8,9} for i:=0; i < k-1; i++ { p = slice[i] if p%10 != 1 { slice = append(slice, 10*p + p%10 -1) } slice = append(slice, 10*...
package main import ( "fmt" ) func main() { var k int fmt.Scan(&k) fmt.Println(task(k)) } func task(k int) int { var p int slice := []int{1,2,3,4,5,6,7,8,9} for i:=0; i < k; i++ { p = slice[i] if p%10 != 0 { slice = append(slice, 10*p + p%10 -1) } slice = append(slice, 10*p + p%10...
[["-", 36, 36, 36, 36, 0, 434, 0, 435, 469, 78], ["+", 36, 36, 36, 36, 0, 434, 0, 435, 469, 78], ["-", 0, 435, 8, 196, 0, 440, 0, 441, 39, 78], ["+", 0, 435, 8, 196, 0, 440, 0, 441, 39, 78], ["-", 0, 431, 12, 432, 0, 451, 39, 467, 468, 78], ["+", 0, 431, 12, 432, 0, 451, 39, 467, 468, 78], ["-", 0, 7, 0, 430, 15, 16, 1...
7
172
#include <bits/stdc++.h> std::queue<long long int> co; std::queue<long long int> co2; bool flag = false; int main(void) { int k; int cnt = 9; std::cin >> k; for (int i = 1; i < 10; i++) { // std::cout << i << std::endl; co.push(i); } int keta = 10; long long int ans; if (k < 10) { for (in...
#include <bits/stdc++.h> std::queue<long long int> co; std::queue<long long int> co2; bool flag = false; int main(void) { int k; int cnt = 9; std::cin >> k; for (int i = 1; i < 10; i++) { // std::cout << i << std::endl; co.push(i); } int keta = 10; long long int ans; if (k < 10) { for (in...
[["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
289
# 2020/04/04 # AtCoder Beginner Contest 161 - D runsu = list() def makerunrun(s): if int(s) > 3234566667: return 0 runsu.append(int(s)) lketa = int(s[len(s)-1]) if lketa > 0: wks = s + str(lketa - 1) makerunrun(wks) wks = s + str(lketa) makerunrun(wks) i...
# 2020/04/04 # AtCoder Beginner Contest 161 - D runsu = list() def makerunrun(s): if int(s) > 3234566667: return 0 runsu.append(int(s)) lketa = int(s[len(s)-1]) if lketa > 0: wks = s + str(lketa - 1) makerunrun(wks) wks = s + str(lketa) makerunrun(wks) i...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612]]
5
138
#include <algorithm> #include <cassert> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <stdlib.h> #include <string> #include <vector> typedef long long int ll; using namespace std; int main() { ll i, N, count = 0; queue<int> A; int b; ...
#include <algorithm> #include <cassert> #include <functional> #include <iomanip> #include <iostream> #include <math.h> #include <numeric> #include <queue> #include <stdlib.h> #include <string> #include <vector> typedef long long int ll; using namespace std; int main() { ll i, N, count = 0; queue<ll> A; ll b; c...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
185
import collections k=int(input()) if k<=9: print(k) else: k-=9 l =list(range(9,0,-1)) print(l) q = collections.deque(l) counter=0 while counter<k: x=q.pop() xrem=x%10 if xrem!=0: q.appendleft(10*x+xrem-1) counter+=1 if counter>=k: ...
import collections k=int(input()) if k<=9: print(k) else: k-=9 l =list(range(9,0,-1)) #print(l) q = collections.deque(l) counter=0 while counter<k: x=q.pop() xrem=x%10 if xrem!=0: q.appendleft(10*x+xrem-1) counter+=1 if counter>=k: ...
[["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
142
from collections import deque K = int(input()) - 1 todo = deque(range(1, 10)) ans = [] counter = 0 while counter <= K: seed = todo.pop(0) ans.append(seed) counter += 1 last_dig = int(str(seed)[-1]) for i in range(max(0, last_dig-1), min(10, last_dig+2)): todo.append(int(str(seed) + str(i))) ...
from collections import deque K = int(input()) - 1 todo = deque(range(1, 10)) ans = [] counter = 0 while counter <= K: seed = todo.popleft() ans.append(seed) counter += 1 last_dig = int(str(seed)[-1]) for i in range(max(0, last_dig-1), min(10, last_dig+2)): todo.append(int(str(seed) + str(i)...
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612]]
5
116
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = a; i < b; i++) #define repA(i, a, b) for (ll i = a; i <= b; i++) #define repD(i, b, a) for (int i = b; i >= a; i--) #define fill(a) memset(a, 0, sizeof(a)) #define f first #define s second typedef l...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = a; i < b; i++) #define repA(i, a, b) for (ll i = a; i <= b; i++) #define repD(i, b, a) for (int i = b; i >= a; i--) #define fill(a) memset(a, 0, sizeof(a)) #define f first #define s second typedef l...
[["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
296
k=int(input()) from collections import deque q = deque(range(1, 10)) for i in range(k-1): d = q.popleft() if d % 10 != 0: q.append(10 * d + d % 10 - 1) q.append(10*d) if d % 10 != 9: q.append(10 * d + d % 10 +1) print(q.popleft())
k=int(input()) from collections import deque q = deque(range(1,10)) for i in range(k-1): d = q.popleft() #10 if d % 10 != 0: q.append(10 * d + d % 10 - 1) #11 q.append(10 * d + d % 10) #12 if d % 10 != 9: q.append(10 * d + d % 10 + 1) print(q.popleft())
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 17, 109], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 12, 612]]
5
98