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
change_count
int64
0
100
#include <string> int n, a; std::string s; main() { scanf("%d", &n); for (; n--; scanf("%d", &a), s += a + 48) ; for (; ~s.find(std::to_string(n++));) ; printf("%d\n", --n); }
#include <string> int n, a; std::string s; main() { scanf("%d", &n); for (; n--; scanf("%d", &a), s += a + 48) ; for (; ~s.find(std::to_string(++n));) ; printf("%d\n", n); }
[["-", 3, 4, 0, 2, 3, 4, 0, 27, 28, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 27, 28, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 27, 17, 68]]
1
80
16
#include <iostream> #include <string> using namespace std; string S; int n, a; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a; S += to_string(a); } for (int i = 1; i < 100000; i++) { string target = to_string(i); int x = (int)(S.size()) - (int)(target.size()); for (int i = 0;...
#include <iostream> #include <string> using namespace std; string S; int n, a; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a; S += to_string(a); } for (int i = 0; i < 100000; i++) { string target = to_string(i); int x = (int)(S.size()) - (int)(target.size()); for (int i = 0;...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
154
2
#include <bits/stdc++.h> using namespace std; int main() { int n, a[1000], ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i]) ans = 100000000; } bool f = 1; int i = 0; while (f) { int k = 1, idx = n - 1; f = 0; for (int j = n - 1; j >= 0; j--) { if (a[j...
#include <bits/stdc++.h> using namespace std; int main() { int n, a[1000], ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (!a[i]) ans = 100000000; } bool f = 1; int i = 0; while (f) { int k = 1, idx = n - 1; f = 0; for (int j = n - 1; j >= 0; j--) { if (a[...
[["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
184
1
#include <bits/stdc++.h> using namespace std; int main() { int n, a[1000], f[1000] = {}; cin >> n; for (int i = 0; i < n; i++) cin >> a[i], f[a[i]] = 1; for (int i = 0; i < n - 1; i++) f[a[i] * 10 + a[i + 1]] = 1; for (int i = 0; i < n - 2; i++) f[a[i] * 100 + a[i + 1] * 10 + a[i]] = 1; for (in...
#include <bits/stdc++.h> using namespace std; int main() { int n, a[1000], f[1000000] = {}; cin >> n; for (int i = 0; i < n; i++) cin >> a[i], f[a[i]] = 1; for (int i = 0; i < n - 1; i++) f[a[i] * 10 + a[i + 1]] = 1; for (int i = 0; i < n - 2; i++) f[a[i] * 100 + a[i + 1] * 10 + a[i + 2]] = 1; ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
176
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using std::cin; using std::cout; using std::endl; using std::fixed; us...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using std::cin; using std::cout; using std::endl; using std::fixed; us...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
412
2
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define FOR(I, A, B) for (in...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define FOR(I, A, B) for (in...
[["-", 8, 9, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 160]]
1
263
2
// aoj-VolumeICPCOOC2015-B / 2015-11-30 #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; typ...
// aoj-VolumeICPCOOC2015-B / 2015-11-30 #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; typ...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
800
6
#include <bits/stdc++.h> #define N 10005 using namespace std; int main() { int n, r[N]; cin >> n; for (int i = 0; i < n; i++) cin >> r[i]; double x[N], ans = 0; x[0] = r[0]; for (int i = 1; i < n; i++) { double maxx = 0; for (int j = 0; j < i; j++) { int A = r[i] + r[j]; int B = r[i...
#include <bits/stdc++.h> #define N 10005 using namespace std; int main() { int n, r[N]; cin >> n; for (int i = 0; i < n; i++) cin >> r[i]; double x[N], ans = r[0] * 2; x[0] = r[0]; for (int i = 1; i < n; i++) { double maxx = 0; for (int j = 0; j < i; j++) { int A = r[i] + r[j]; int ...
[["+", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["+", 49, 50, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 49, 50, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 48], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
201
5
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define all(c) c.begin(), c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x, y) x = min(x, y) #define chmax(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define all(c) c.begin(), c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x, y) x = min(x, y) #define chmax(...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
394
3
#include <bits/stdc++.h> using namespace std; int N, M, A[3]; bool graph[50][50]; bool v[101][50][50]; void Calculation() { cin >> N >> M; for (int i = 0; i < 3; i++) { cin >> A[i]; } sort(begin(A), end(A)); while (M--) { int U, V; cin >> U >> V; --U, --V; graph[V][U] = v[0][V][U] = tr...
#include <bits/stdc++.h> using namespace std; int N, M, A[3]; bool graph[50][50]; bool v[101][50][50]; void Calculation() { cin >> N >> M; for (int i = 0; i < 3; i++) { cin >> A[i]; } sort(begin(A), end(A)); while (M--) { int U, V; cin >> U >> V; --U, --V; graph[V][U] = v[0][V][U] = tr...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 12, 13]]
1
455
4
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; int N, M; string S; int A[11]; vector<int> D; int calc(char num) { int n = (int)(num - '0'); n *= 2; return n / 10 + n % 10; } int calc(int num) { int n = num; n *= 2; retur...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; int N, M; string S; int A[11]; vector<int> D; int calc(char num) { int n = (int)(num - '0'); n *= 2; return n / 10 + n % 10; } int calc(int num) { int n = num; n *= 2; retur...
[["-", 15, 23, 0, 16, 31, 23, 0, 16, 31, 22], ["-", 15, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
372
4
#include <stdio.h> char str[131072]; int c[10]; int dp[8][10]; int main() { int a; scanf("%d%s", &a, str); int b; int s; scanf("%d", &b); for (int i = 0; i < b; i++) { scanf("%d", &s); c[s] = 1; // scanf("%d",c+i); } int d = 0; int e = 0; int v = 0; for (int i = 0; i < a; i++) { if...
#include <stdio.h> char str[131072]; int c[10]; int dp[8][10]; int main() { int a; scanf("%d%s", &a, str); int b; int s; scanf("%d", &b); for (int i = 0; i < b; i++) { scanf("%d", &s); c[s] = 1; // scanf("%d",c+i); } int d = 0; int e = 0; int v = 0; for (int i = 0; i < a; i++) { if...
[["-", 51, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 12, 22]]
1
394
2
#include <iostream> #include <string> using namespace std; #define N 100000 int q2n[10] = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9}; int main() { int n, a[10], m, dp[N + 1][10]; string s; cin >> n >> s; cin >> m; for (int j = 0; j < 10; ++j) dp[0][j] = 0; for (int i = 0; i < m; ++i) cin >> a[i]; dp[0][0] ...
#include <iostream> #include <string> using namespace std; #define N 100000 int q2n[10] = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9}; int main() { int n, a[10], m, dp[N + 1][10]; string s; cin >> n >> s; cin >> m; for (int j = 0; j < 10; ++j) dp[0][j] = 0; for (int i = 0; i < m; ++i) cin >> a[i]; dp[0][0] ...
[["+", 0, 16, 12, 74, 51, 23, 0, 16, 17, 33], ["+", 12, 74, 51, 23, 0, 16, 12, 103, 0, 104], ["+", 12, 74, 51, 23, 0, 16, 12, 103, 0, 125]]
1
460
4
n = gets.to_i s = gets.chomp gets candidates = gets.split.map(&:to_i) dp = [1] + [0] * 9 (0..s.size-1).each do |i| new_dp = [0] * 10 (s[i] == ?* ? candidates : [s[i].to_i]).each do |c| if (s.size - i).even? c = (c * 2).to_s.split("").map(&:to_i).inject(:+) end (0..9).each do ...
n = gets.to_i s = gets.chomp gets candidates = gets.split.map(&:to_i) dp = [1] + [0] * 9 (0..s.size-1).each do |i| new_dp = [0] * 10 (s[i] == ?* ? candidates : [s[i].to_i]).each do |c| if (s.size - i).even? c = (c * 2).to_s.split("").map(&:to_i).inject(:+) end (0..9).each do ...
[["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22]]
4
155
1
#include <algorithm> #include <cmath> #include <iostream> using namespace std; typedef long long int lli; lli pascal[1010][1010]; const int MOD = 100000007; int main() { pascal[0][0] = 1; for (int i = 1; i < 1010; i++) { pascal[i][0] = pascal[i][i] = 1; for (int j = 1; j < i; j++) pascal[i][j] = (pa...
#include <algorithm> #include <cmath> #include <iostream> using namespace std; typedef long long int lli; lli pascal[1010][1010]; const int MOD = 100000007; int main() { pascal[0][0] = 1; for (int i = 1; i < 1010; i++) { pascal[i][0] = pascal[i][i] = 1; for (int j = 1; j < i; j++) pascal[i][j] = (pa...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 12, 16, 31, 2, 3, 4, 0, 16, 31, 22], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 31, 22], ["-", 12, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 12, 22]]
1
263
10
#include <algorithm> #include <stdio.h> #define mod 1000000007 using namespace std; int r, c, a1, a2, b1, b2, f1, f2, dp[1001][1001]; int main() { scanf("%d%d%d%d%d%d", &r, &c, &a1, &a2, &b1, &b2); if (a1 > b1) swap(a1, b1); if (a2 > b2) swap(a2, b2); f1 = ((b1 - a1) * 2 == r ? 2 : 1); f2 = ((b2 - a2)...
#include <algorithm> #include <stdio.h> #define mod 100000007 using namespace std; int r, c, a1, a2, b1, b2, f1, f2, dp[1001][1001]; int main() { scanf("%d%d%d%d%d%d", &r, &c, &a1, &a2, &b1, &b2); if (a1 > b1) swap(a1, b1); if (a2 > b2) swap(a2, b2); f1 = ((b1 - a1) * 2 == r ? 2 : 1); f2 = ((b2 - a2) ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
326
2
#include <iostream> using namespace std; int a, b, c, d, e, f; int dp[4000][4000]; int main() { dp[0][0] = 1; for (int i = 0; i < 4000; i++) { for (int j = 0; j < 4000; j++) { if (i == 0 || j == 0) dp[i][j] = 1; else { dp[i][j] = dp[i - 1][j] + dp[i][j - 1]; } dp[i][j] %=...
#include <iostream> using namespace std; int a, b, c, d, e, f; int dp[4000][4000]; int main() { dp[0][0] = 1; for (int i = 0; i < 4000; i++) { for (int j = 0; j < 4000; j++) { if (i == 0 || j == 0) dp[i][j] = 1; else { dp[i][j] = dp[i - 1][j] + dp[i][j - 1]; } dp[i][j] %=...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
312
4
#include <algorithm> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <queue> #define dprintf(s, ...) printf("%s:%d" s, __func__, __LINE__, __VA_ARGS__) using namespace std; typedef pair<int, int> P; typedef long long int ll; int r, c, a1, a2, b1, b2; int mod = 100000007; int extgc...
#include <algorithm> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <queue> #define dprintf(s, ...) printf("%s:%d" s, __func__, __LINE__, __VA_ARGS__) using namespace std; typedef pair<int, int> P; typedef long long int ll; int r, c, a1, a2, b1, b2; int mod = 100000007; int extgc...
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 12, 22]]
1
430
6
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; const ll M = 100000007; ll extgcd(ll a, ll b, ll &x, ll &y) { ll d = a; if (b != 0) { d = extgcd(b, a % b, y, x); y -= (a / b) * x; } else { x = 1; y = 0; } return d; } ll mod_inver...
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; const ll M = 100000007; ll extgcd(ll a, ll b, ll &x, ll &y) { ll d = a; if (b != 0) { d = extgcd(b, a % b, y, x); y -= (a / b) * x; } else { x = 1; y = 0; } return d; } ll mod_inver...
[["-", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 31, 16, 31, 16, 31, 16, 31, 16, 17, 152], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 17, 152], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22]]
1
448
4
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #incl...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["-", 0, 57, 64, 1, 0, 11, 31, 23, 0, 22], ["+", 64, 1, 0, 11, 31, 23, 0, 42, 0, 13]]
1
548
6
#include <iostream> using namespace std; int getLCM(int s, int t) { int tmp; if (s < t) { tmp = t; t = s; s = tmp; } while (s % t != 0) { tmp = s % t; s = t; t = tmp; } return t; } int main(int argc, char *argv[]) { int r, c, a1, a2, b1, b2; cin >> r >> c >> a1 >> a2 >> b1 >>...
#include <iostream> using namespace std; int getLCM(int s, int t) { int tmp; if (s < t) { tmp = t; t = s; s = tmp; } while (s % t != 0) { tmp = s % t; s = t; t = tmp; } return t; } int main(int argc, char *argv[]) { int r, c, a1, a2, b1, b2; cin >> r >> c >> a1 >> a2 >> b1 >>...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 48], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
535
2
#include <cmath> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) const int MOD = 100000007; long long nck[1111][1111]; int main() { rep(i, 1111) nck[i][0] = 1; rep(i, 1110) rep(j, 1110) { nck[i + 1][j + 1] = (nck[i][j] + nck[i][j + 1]) % MOD; } int r, c, a1, ...
#include <cmath> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) const int MOD = 100000007; long long nck[1111][1111]; int main() { rep(i, 1111) nck[i][0] = 1; rep(i, 1110) rep(j, 1110) { nck[i + 1][j + 1] = (nck[i][j] + nck[i][j + 1]) % MOD; } int r, c, a1, ...
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22]]
1
234
2
r, c, a1, a2, b1, b2 = gets.split.map(&:to_i) m = [(a1-b1).abs, a1+r-b1, b1+r-a1].min n = [(a2-b2).abs, a2+c-b2, b2+c-a2].min x = (1..m+n).inject(:*) / (1..m).inject(:*) / (1..n).inject(:*) x *= 2 if (a1-b1).abs * 2 == r x *= 2 if (a2-b2).abs * 2 == c p x % 100000007
r, c, a1, a2, b1, b2 = gets.split.map(&:to_i) m = [(a1-b1).abs, a1+r-b1, b1+r-a1].min n = [(a2-b2).abs, a2+c-b2, b2+c-a2].min x = (1..m+n).inject(1, :*) / (1..m).inject(1, :*) / (1..n).inject(1, :*) x *= 2 if (a1-b1).abs * 2 == r x *= 2 if (a2-b2).abs * 2 == c p x % 100000007
[["+", 12, 738, 31, 738, 31, 652, 3, 4, 0, 612], ["+", 12, 738, 31, 738, 31, 652, 3, 4, 0, 21], ["+", 12, 738, 31, 738, 12, 652, 3, 4, 0, 612], ["+", 12, 738, 31, 738, 12, 652, 3, 4, 0, 21], ["+", 0, 662, 12, 738, 12, 652, 3, 4, 0, 612], ["+", 0, 662, 12, 738, 12, 652, 3, 4, 0, 21]]
4
141
6
import math def comb (x,y): return factorial(x)//factorial(x-y)//factorial(y) w,h,ax,ay,bx,by=map(int,input().split()) dx=min(w-abs(ax-bx),abs(ax-bx)) dy=min(h-abs(ay-by),abs(ay-by)) ans=1 if dx*2==w:ans*=2 if dy*2==h:ans*=2 ans*=comb(dx+dy,dx) print(ans%100000007)
from math import factorial def comb (x,y): return factorial(x)//factorial(x-y)//factorial(y) w,h,ax,ay,bx,by=map(int,input().split()) dx=min(w-abs(ax-bx),abs(ax-bx)) dy=min(h-abs(ay-by),abs(ay-by)) ans=1 if dx*2==w:ans*=2 if dy*2==h:ans*=2 ans*=comb(dx+dy,dx) print(ans%100000007)
[["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
130
4
from math import factorial def comb (x,y): return factorial(x)//factorial(x-y)//factorial(y) w,h,ax,ay,bx,by=map(int,input().split()) dx=abs(ax-bx) dx=min(dx,w-dx) dy=abs(ay-by) dy=min(dy,h-dy) an=1 if dx*2==w:an*=2 if dy*2==h:an*=2 an*=comb(dx+dy,dx) print(an%int(1E9+7))
from math import factorial def comb (x,y): return factorial(x)//factorial(x-y)//factorial(y) w,h,ax,ay,bx,by=map(int,input().split()) dx=abs(ax-bx) dx=min(dx,w-dx) dy=abs(ay-by) dy=min(dy,h-dy) an=1 if dx*2==w:an*=2 if dy*2==h:an*=2 an*=comb(dx+dy,dx) print(an%int(1E8+7))
[["-", 0, 657, 12, 652, 3, 4, 0, 657, 31, 531], ["+", 0, 657, 12, 652, 3, 4, 0, 657, 31, 531]]
5
133
2
int Z(int *a, int *b) { return *a - *b; } a[999], i; main(n, j) { for (scanf("%d", &n); i < n; i++) scanf("%d", a + i); qsort(a, n, 4, Z); long long r = 1; for (i = 0; i < n && (j = a[i] - i / 4) > 0; i++) r += j; i = !printf("%lld\n", r); }
int Z(int *a, int *b) { return *b - *a; } a[999], i; main(n, j) { for (scanf("%d", &n); i < n; i++) scanf("%d", a + i); qsort(a, n, 4, Z); long long r = 1; for (i = 0; i < n && (j = a[i] - i / 4) > 0; i++) r += j; i = !printf("%lld\n", r); }
[["-", 8, 9, 0, 37, 0, 16, 31, 66, 28, 22], ["+", 8, 9, 0, 37, 0, 16, 31, 66, 28, 22], ["-", 8, 9, 0, 37, 0, 16, 12, 66, 28, 22], ["+", 8, 9, 0, 37, 0, 16, 12, 66, 28, 22]]
0
128
4
#include <algorithm> #include <iostream> using namespace std; int n, a, c[126]; long long s; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a; s += a; for (int i = 1; i <= 125 && a <= i; i++) c[i]++; } for (int i = 1; i <= 125; i++) s -= max(c[i] - i * 4, 0); cout << s - 1 <...
#include <algorithm> #include <iostream> using namespace std; int n, a, c[126]; long long s; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a; s += a; for (int i = 1; i <= 125 && i <= a; i++) c[i]++; } for (int i = 1; i <= 125; i++) s -= max(c[i] - i * 4, 0); cout << s + 1 <...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14,...
1
118
9
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <set> #include <string.h> #include <string> #include <unordered_map> #include <vector> #define int long long using namespace std; signed main() { int ans = 0; int a; cin >> a; vector<int> V; for (int b = 0; b < a; b++) { ...
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <set> #include <string.h> #include <string> #include <unordered_map> #include <vector> #define int long long using namespace std; signed main() { int ans = 0; int a; cin >> a; vector<int> V; for (int b = 0; b < a; b++) { ...
[["+", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33]]
1
140
1
#include <algorithm> #include <cstdio> using namespace std; int main() { int s[551], minus = 0, n; long long int res = 1; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", s + i); sort(s, s + n); for (int i = n - 1; i >= 0; i--, minus++) { res += s[i] - minus / 4; } printf("%lld\n", res)...
#include <algorithm> #include <cstdio> using namespace std; int main() { int s[551], minus = 0, n; long long int res = 1; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", s + i); sort(s, s + n); for (int i = n - 1; i >= 0; i--, minus++) { res += max(0, s[i] - minus / 4); } printf("%lld\...
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
122
5
n, *hs = $<.read.split($/).map(&:to_i) hs.sort!.reverse! count = 0 unfilled_dist = 0 capacity = 1 hs.each_with_index {|h, i| break if h < unfilled_dist count += h + 1 - unfilled_dist capacity -= 1 if capacity == 0 unfilled_dist += 1 capacity = 4 * unfilled_dist - i - 1 end }
n, *hs = $<.read.split($/).map(&:to_i) hs.sort!.reverse! count = 0 unfilled_dist = 0 capacity = 1 hs.each_with_index {|h, i| break if h < unfilled_dist count += h + 1 - unfilled_dist capacity -= 1 if capacity == 0 unfilled_dist += 1 capacity = 4 * unfilled_dist - i - 1 end } ...
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
75
2
a=($<.map &:to_i).sort.reverse p (1...a.size).inject(1){|s,i|s+[a[i]-(i-1)/4,0].max}
gets a=($<.map &:to_i).sort.reverse p (0...a.size).inject(1){|s,i|s+[a[i]-i/4,0].max}
[["+", 36, 36, 36, 36, 36, 36, 0, 493, 0, 22], ["-", 3, 4, 0, 652, 486, 739, 0, 475, 756, 612], ["+", 3, 4, 0, 652, 486, 739, 0, 475, 756, 612], ["-", 486, 516, 0, 738, 12, 738, 31, 739, 0, 24], ["-", 0, 738, 12, 738, 31, 739, 0, 738, 17, 33], ["-", 0, 738, 12, 738, 31, 739, 0, 738, 12, 612], ["-", 486, 516, 0, 738, 12...
4
53
7
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> #define REP(i, a, b) for (int i = int(a); i < int(b); i++) #ifdef _DEBUG_ #define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl #else #define dump(val...
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> #define REP(i, a, b) for (int i = int(a); i < int(b); i++) #ifdef _DEBUG_ #define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl #else #define dump(val...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
1,076
10
#include <algorithm> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1LL << 61 #define pb push_back #define mp make_pai...
#include <algorithm> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1LL << 61 #define pb push_back #define mp make_pai...
[["-", 12, 2, 3, 4, 0, 16, 31, 69, 28, 22], ["-", 3, 4, 0, 16, 31, 69, 341, 342, 0, 70], ["-", 3, 4, 0, 16, 31, 69, 341, 342, 0, 73]]
1
1,078
3
#include <iostream> #include <queue> #include <array> #include <map> using namespace std; const int kLose = -1; const int kBack = -2; const double kDice = 1.0 / 6.0; void Solve(double prob[102][101], int board[101], int goal, int T) { prob[0][0] = 1.0; for (int t = 0; t < T; t++) { for (int i = 0; i < goal...
#include <iostream> #include <queue> #include <array> #include <map> using namespace std; const int kLose = -1; const int kBack = -2; const double kDice = 1.0 / 6.0; void Solve(double prob[102][101], int board[101], int goal, int T) { prob[0][0] = 1.0; for (int t = 0; t < T; t++) { for (int i = 0; i < goal...
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
416
4
#include "bits/stdc++.h" using namespace std; //#define int int64_t #define CHOOSE(a) CHOOSE2 a #define CHOOSE2(a0, a1, a2, a3, x, ...) x #define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal) #define REP2(i, s, n) REP1(i, s, < signed(n), ++) #define REP3(i, n) REP2(i, 0, n) #define rep(...) CHOOSE((...
#include "bits/stdc++.h" using namespace std; //#define int int64_t #define CHOOSE(a) CHOOSE2 a #define CHOOSE2(a0, a1, a2, a3, x, ...) x #define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal) #define REP2(i, s, n) REP1(i, s, < signed(n), ++) #define REP3(i, n) REP2(i, 0, n) #define rep(...) CHOOSE((...
[["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
460
4
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> P; typedef pair<ll, P> P1; #define fr first #define ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef double ld; typedef pair<short, short> P; typedef pair<ll, P> P1; #define fr first #define s...
[["-", 36, 36, 0, 30, 0, 134, 39, 86, 0, 96], ["-", 0, 134, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 133], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 133], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40]]
1
1,863
9
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return ...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return ...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 2, 3, 4, 0, 23, 0, 24], ["+", 31, 16, 12, 2, 3, 4, 0, 23, 0, 25]]
1
347
5
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
205
5
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (n); i++) #define INF ((long long)1e18) #define MOD ((int)1e9 + 7) #define endl "\n" #define yn(f) ((f) ? "Yes" : "No") #de...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (n); i++) #define INF ((long long)1e18) #define MOD ((int)1e9 + 7) #define endl "\n" #define yn(f) ((f) ? "Yes" : "No") #de...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
389
3
#include <algorithm> #include <cassert> #include <cinttypes> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef int64_t ll; t...
#include <algorithm> #include <cassert> #include <cinttypes> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef int64_t ll; t...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
306
4
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); } template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; using D = double; const D PI = acos(D(-1)), E...
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); } template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; using D = double; const D PI = acos(D(-1)), E...
[["-", 12, 2, 3, 4, 0, 16, 12, 69, 28, 22], ["+", 12, 2, 3, 4, 0, 16, 12, 69, 28, 22], ["-", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22]]
1
2,738
4
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < N; i++) #define pb push_back typedef long long ll; typedef pair<ll, int> ll_i; struct edge { int v, w; }; const ll INF = LLONG_MAX / 3; const int MOD = 1e9 + 114514; pair<vector<ll>, vector<int>> dijkstra(int N, vector<vector<edge>...
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < N; i++) #define pb push_back typedef long long ll; typedef pair<ll, int> ll_i; struct edge { int v, w; }; const ll INF = LLONG_MAX / 3; const int MOD = 1e9 + 114514; pair<vector<ll>, vector<int>> dijkstra(int N, vector<vector<edge>...
[["-", 12, 16, 31, 16, 31, 16, 12, 69, 28, 22], ["+", 12, 16, 31, 16, 31, 16, 12, 69, 28, 22]]
1
645
2
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; const int mod = 1000000021; const long long inf = 1LL << 61; struct edge { int to, cost, id; }; struct edge2 { int to, id; }; struct state { int pos; long long cost; }; bool operator<(const state &s1,...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; const int mod = 1000000021; const long long inf = 1LL << 61; struct edge { int to, cost, id; }; struct edge2 { int to, id; }; struct state { int pos; long long cost; }; bool operator<(const state &s1,...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,837
4
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; using ll = long long; int main() { string s1, s2; double d1, d2; double l1, l2; cin >> s1 >> d1 >> l1; cin >> s2 >> d2 >> l2; if (s1 == "CD") { d1 += 60.0; } if (s2 == "CD") { d2 += 60.0; } if (...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; using ll = long long; int main() { string s1, s2; double d1, d2; double l1, l2; cin >> s1 >> d1 >> l1; cin >> s2 >> d2 >> l2; if (s1 == "CD") { d1 += 60.0; } if (s2 == "CD") { d2 += 60.0; } if (...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
1
516
2
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; const double DTR = (2 * acos(-1)) / 360; double myfmod(double x, double y) { return y - (int)(x / y) * y; } enum ans { ABC, ACD, ADB, BCD, }; in...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; const double DTR = (2 * acos(-1)) / 360; double myfmod(double x, double y) { return x - (int)(x / y) * y; } enum ans { ABC, ACD, ADB, BCD, }; in...
[["-", 0, 14, 8, 9, 0, 37, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 31, 22]]
1
400
2
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int n, l, r, imos[100007], ans1, ans2, sum; vector<P> v; vector<int> v1, v2; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> l >> r; v.push_back(P(l, r)); v1.push_back(l); v2.push_back(r); imos[l]++; im...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int n, l, r, imos[100007], ans1, ans2, sum; vector<P> v; vector<int> v1, v2; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> l >> r; v.push_back(P(l, r)); v1.push_back(l); v2.push_back(r); imos[l]++; im...
[["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22]]
1
282
2
#include <bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define HUGE_NUM 99999999999999999 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; #define NUM 500000 int N; int bean[100005]; vector<int> V[NUM]; void init(int first_N) { while (N ...
#include <bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define HUGE_NUM 99999999999999999 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; #define NUM 500000 int N; int bean[100005]; vector<int> V[NUM]; void init(int first_N) { while (N ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
731
4
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); input = ''; var n = input.trim() - 0; var ans = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; var i = 0; while (true) { i++; var cnt = 0; for (var j = i; j >= 1; j--) { if (i % j == 0) cnt++; } if (ans[cnt - 1] == 0) { ans[cnt - 1] = i; ...
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var n = input.trim() - 0; var ans = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; var i = 0; while (true) { i++; var cnt = 0; for (var j = i; j >= 1; j--) { if (i % j == 0) cnt++; } if (ans[cnt - 1] == 0) { ans[cnt - 1] = i; if (!ans.in...
[["-", 36, 36, 0, 493, 0, 1, 0, 11, 31, 22], ["-", 36, 36, 0, 493, 0, 1, 0, 11, 0, 32], ["-", 0, 493, 0, 1, 0, 11, 12, 557, 0, 104], ["-", 36, 36, 36, 36, 0, 493, 0, 1, 0, 35]]
2
158
5
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int res = 0; for (int i = 0; !res && i <= 12 * 12; i++) { int c = 0; for (int j = 1; j <= i; j++) { if (i % j == 0) { c++; } } if (c == N) res = i; } cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int res = 0; for (int i = 1; !res && i <= 1 << 12; i++) { int c = 0; for (int j = 1; j <= i; j++) { if (i % j == 0) { c++; } } if (c == N) res = i; } cout << res << endl; return 0; }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 15, 16, 12, 16, 12, 16, 31, 13], ["-", 0, 7, 15, 16, 12, 16, 12, 16, 17, 48], ["+", 0, 7, 15, 16, 12, 16, 12, 16, 31, 13], ["+", 0, 7, 15, 16, 12, 16, 12, 16, 17, 151]]
1
98
6
#include <bits/stdc++.h> #define REP(x, y, z) for (int x = y; x <= z; x++) #define FORD(x, y, z) for (int x = y; x >= z; x--) #define MSET(x, y) memset(x, y, sizeof(x)) #define FOR(x, y) for (__typeof(y.begin()) x = y.begin(); x != y.end(); x++) #define F first #define S second #define MP make_pair #define PB push_back...
#include <bits/stdc++.h> #define REP(x, y, z) for (int x = y; x <= z; x++) #define FORD(x, y, z) for (int x = y; x >= z; x--) #define MSET(x, y) memset(x, y, sizeof(x)) #define FOR(x, y) for (__typeof(y.begin()) x = y.begin(); x != y.end(); x++) #define F first #define S second #define MP make_pair #define PB push_back...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
191
2
#include <algorithm> #include <complex> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i = int(m); i < int(n); i++) #define ...
#include <algorithm> #include <complex> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i = int(m); i < int(n); i++) #define ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13], ["-", 0, 100, 0, 1, 0, 11, 12, 16, 17, 48], ["-", 0, 100, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 100, 0, 1, 0, 11, 12, 13]]
1
337
6
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <time.h> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FFOR(i, a, b) for (int i = (a); i <= (b); i++) #define REP(i, ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <time.h> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FFOR(i, a, b) for (int i = (a); i <= (b); i++) #define REP(i, ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
244
2
#include <iostream> using namespace std; int main() { int a; cin >> a; if (a == 1) cout << "1" << endl; else if (a == 2) cout << "2" << endl; else if (a == 3) cout << "4" << endl; else if (a == 4) cout << "6" << endl; else if (a == 5) cout << "12" << endl; else if (a == 6) cout <...
#include <iostream> using namespace std; int main() { int a; cin >> a; if (a == 1) cout << "1" << endl; else if (a == 2) cout << "2" << endl; else if (a == 3) cout << "4" << endl; else if (a == 4) cout << "6" << endl; else if (a == 5) cout << "16" << endl; else if (a == 6) cout <...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
198
6
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int count = 0; for (int n = 1; n < 10000; n++) { for (int i = 1; i < 1000; i++) { if (n % i == 0) count++; } if (N == count) { cout << n << endl; return 0; } count = 0; } return 0; }...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int count = 0; for (int n = 1; n < 10000; n++) { for (int i = 1; i < 10000; i++) { if (n % i == 0) count++; } if (N == count) { cout << n << endl; return 0; } count = 0; } return 0; ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
91
2
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i = 0; cin >> n; while (1) { m = 0; i++; for (int j = 1; j < 13; j++) { if (i % j == 0) { m++; } } if (m == n) { cout << i << endl; break; } } }
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i = 0; cin >> n; while (1) { m = 0; i++; for (int j = 1; j < 100000; j++) { if (i % j == 0) { m++; } } if (m == n) { cout << i << endl; break; } } }
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
1
83
2
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; if (N == 1) cout << 1 << endl; else if (N == 2) cout << 2 << endl; else if (N == 3) cout << 4 << endl; else if (N == 4) cout << 6 << endl; else if (N == 5) cout << 16 << endl; else if (N == 6) cout << 1...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; if (N == 1) cout << 1 << endl; else if (N == 2) cout << 2 << endl; else if (N == 3) cout << 4 << endl; else if (N == 4) cout << 6 << endl; else if (N == 5) cout << 16 << endl; else if (N == 6) cout << 1...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13]]
1
174
2
require "prime" def num(x) Prime.prime_division(x).inject(1) { |s, x| s * (x[1] + 1) } end n = gets.to_i puts (1..1000).find { |x| num(x) == n }
require "prime" def num(x) Prime.prime_division(x).inject(1) { |s, x| s * (x[1] + 1) } end n = gets.to_i puts (1..10000).find { |x| num(x) == n }
[["-", 3, 4, 0, 652, 486, 739, 0, 475, 444, 612], ["+", 3, 4, 0, 652, 486, 739, 0, 475, 444, 612]]
4
62
2
h = { 1 => 1, 2 => 2, 3 => 2 ** 2, 4 => 2 * 3, 5 => 2 ** 4, 6 => 2 ** 2 * 3, 7 => 2 ** 6, 8 => 2 ** 3 * 3, 9 => 2 ** 2 * 3 ** 2, 10 => 2 ** 4 ** 3, 11 => 2 ** 10, 12 => 2 ** 2 * 3 * 5, } p h[gets.to_i]
h = { 1 => 1, 2 => 2, 3 => 2 ** 2, 4 => 2 * 3, 5 => 2 ** 4, 6 => 2 ** 2 * 3, 7 => 2 ** 6, 8 => 2 ** 3 * 3, 9 => 2 ** 2 * 3 ** 2, 10 => 2 ** 4 * 3, 11 => 2 ** 10, 12 => 2 ** 2 * 3 * 5, } p h[gets.to_i]
[["-", 12, 767, 0, 569, 51, 738, 12, 738, 17, 578], ["+", 0, 662, 12, 767, 0, 569, 51, 738, 17, 48]]
4
93
2
def solve(n): for i in range(1,100): cnt=0 for j in range(1,100): if i%j==0: cnt+=1 if cnt==n: return(i) while True: try: n=int(input()) print(solve(n)) except EOFError:break
def solve(n): for i in range(1,10000): cnt=0 for j in range(1,i+1): if i%j==0: cnt+=1 if cnt==n: return(i) while True: try: n=int(input()) print(solve(n)) except EOFError: break
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
72
6
print([0,1,2,4,6,16,12,64,30,36,48,1024,60][int(input())])
print([0,1,2,4,6,16,12,64,24,36,48,1024,60][int(input())])
[["-", 0, 652, 3, 4, 0, 206, 51, 634, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 51, 634, 0, 612]]
5
38
2
#include <iostream> using namespace std; #define rep(i, a) for (int i = 0; i < a; i++) int main(void) { int M[10][3]; int n, a, d, m, k; cin >> n >> a >> d >> m; rep(i, m) { rep(j, 3) cin >> M[i][j]; } cin >> k; for (int i = m - 1; i >= 0; i--) { // rep(j,3)cout<<M[i][j]<<" "; // cout<<endl; if...
#include <iostream> using namespace std; #define rep(i, a) for (int i = 0; i < a; i++) int main(void) { int M[10][3]; int n, a, d, m, k; cin >> n >> a >> d >> m; rep(i, m) { rep(j, 3) cin >> M[i][j]; } cin >> k; for (int i = m - 1; i >= 0; i--) { // rep(j,3)cout<<M[i][j]<<" "; // cout<<endl; if...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
204
2
#include <bits/stdc++.h> using namespace std; int N, a, d, M; int F(int x) { return (a + (x - 1) * d); } int main() { cin >> N; cin >> a >> d; cin >> M; // ????????°???????????¬??? an = a + (n - 1)d map<int, int> foo; for (int i = 0; i < M; i++) { int x, y, z; cin >> x >> y >> z; map<int, in...
#include <bits/stdc++.h> using namespace std; int N, a, d, M; int F(int x) { return (a + (x - 1) * d); } int main() { cin >> N; cin >> a >> d; cin >> M; // ????????°???????????¬??? an = a + (n - 1)d map<int, int> foo; for (int i = 0; i < M; i++) { int x, y, z; cin >> x >> y >> z; map<int, in...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
268
2
#include <bits/stdc++.h> #define int long long using namespace std; string s, str; int p, ans, flag; char c[8] = {'0', '1', '+', '-', '*', '(', ')', '='}; char memo[400]; bool isalph(char ch) { return (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')); } int bnf(); int bnf3() { if (s[p] == ')') flag = ...
#include <bits/stdc++.h> #define int long long using namespace std; string s, str; int p, ans, flag; char c[8] = {'0', '1', '+', '-', '*', '(', ')', '='}; char memo[400]; bool isalph(char ch) { return (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')); } int bnf(); int bnf3() { if (s[p] == ')') flag = ...
[["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 25]]
1
1,427
5
#include <bits/stdc++.h> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; typedef pair<LL, LL> PLL; #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define EB emplace_ba...
#include <bits/stdc++.h> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; typedef pair<LL, LL> PLL; #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define EB emplace_ba...
[["-", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13], ["-", 51, 16, 12, 23, 0, 16, 12, 16, 17, 47], ["+", 51, 16, 12, 23, 0, 16, 12, 16, 17, 79]]
1
369
4
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n; cin >> n; int x[n]; for (int i = 0; i < n; i++) scanf("%lld", x + i); set<int> s, u; for (int i = 0; i < n; i++) { if (s.count(0)) { cout << "No" << endl; continue; } int k = x[i], c = 0; ...
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n; cin >> n; int x[n]; for (int i = 0; i < n; i++) scanf("%lld", x + i); set<int> s, u; for (int i = 0; i < n; i++) { if (s.count(0)) { cout << "No" << endl; continue; } int k = x[i], c = 0; ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
332
2
#include <bits/stdc++.h> using namespace std; const int maxn = 5 * 1e5 + 12345; int num[maxn]; set<int> s; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &num[i]); int max_dep = 1; for (int i = 1; i <= n; i++) { if (s.count(0) >= 1) { printf("No\n"); continue...
#include <bits/stdc++.h> using namespace std; const int maxn = 5 * 1e5 + 12345; int num[maxn]; set<int> s; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &num[i]); int max_dep = 1; for (int i = 1; i <= n; i++) { if (s.count(0) >= 1) { printf("No\n"); continue...
[["-", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
252
5
c=p=0;b=[0]*1000000 for _ in range(int(input())): x=int(input()) if (c==x and p!=x) or b[0]==1 or c>x:print('NO');continue print('YES') if x>=1000000:continue p+=1;b[x]+=1 while b[x]>1:p-=1;b[x]-=2;b[x-1]+=1;x-=1 while b[c+1]==1 and c<999999:c+=1
c=p=0;b=[0]*1000000 for _ in range(int(input())): x=int(input()) if (c==x and p!=x) or b[0]==1 or c>x:print('No');continue print('Yes') if x>=1000000:continue p+=1;b[x]+=1 while b[x]>1:p-=1;b[x]-=2;b[x-1]+=1;x-=1 while b[c+1]==1 and c<999999:c+=1
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
134
4
import java.util.Scanner; public class Main { static final int MAX_L = 100; void run() { Scanner scan = new Scanner(System.in); int l = scan.nextInt(); int k = scan.nextInt(); long[] dp = new long[MAX_L + 1]; dp[0] = dp[1] = 1; for (int i = 2; i < l; i++) { long num = i - k - 1 < 0 ? ...
import java.util.Scanner; public class Main { static final int MAX_L = 100; void run() { Scanner scan = new Scanner(System.in); int l = scan.nextInt(); int k = scan.nextInt(); long[] dp = new long[MAX_L + 1]; dp[0] = dp[1] = 1; for (int i = 2; i < l; i++) { long num = i - k - 1 < 0 ? ...
[["-", 12, 16, 12, 23, 0, 510, 15, 16, 17, 47], ["+", 12, 16, 12, 23, 0, 510, 15, 16, 17, 20]]
3
193
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> #include <vector> using namespace std; const int maxN = 110; #define FORU(i, l, r) for (int i = l; i <= r; ++i) #define FORD(i, r, l) for (int i = r; i >= l; --i) #define REPU(i, r) for (i...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> #include <vector> using namespace std; const int maxN = 110; #define FORU(i, l, r) for (int i = l; i <= r; ++i) #define FORD(i, r, l) for (int i = r; i >= l; --i) #define REPU(i, r) for (i...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40]]
1
193
5
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; int l, k; unsigned long long int n = 0; unsigned long long int permutation(int n, int s, int t); int main() { scanf("%d %d", &l, ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; int l, k; unsigned long long int n = 0; unsigned long long int permutation(int n, int s, int t); int main() { scanf("%d %d", &l, ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 37, 0, 74, 51, 23, 0, 16, 12, 13], ["+", 0, 37, 0, 74, 51, 23, 0, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
438
7
#include <iostream> using namespace std; int main(void) { int l, k; cin >> l; cin >> k; long long int b[l + 1]; long long int w[l + 1]; // b[i] : ちょうど高さが i で黒いチョコが一番上のものの場合の数 // w[i] : ちょうど高さが i で白いチョコが一番上のものの場合の数 b[1] = 1; w[1] = 0; if (k < l) { for (int i = 2; i <= k; i++) { b[i]...
#include <iostream> using namespace std; int main(void) { int l, k; cin >> l; cin >> k; long long int b[l + 1]; long long int w[l + 1]; b[1] = 1; w[1] = 0; if (k <= l) { for (int i = 2; i <= k; i++) { b[i] = w[i - 1]; w[i] = b[i - 1]; } b[k] += 1; for (int i = k + 1;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
245
2
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef pair<int, int> P; int x[16], y[16]; vector<P> v; int m; int Max = 0; bool used[16]; void dfs() { if (v.size() == m / 2) { int cnt = 0; rep(i, v.size()) for (int j = i + 1; j < v.size(); j++) { int a =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef pair<int, int> P; int x[16], y[16]; vector<P> v; int m; int Max = 0; bool used[16]; void dfs() { if (v.size() == m / 2) { int cnt = 0; rep(i, v.size()) for (int j = i + 1; j < v.size(); j++) { int a =...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
454
2
#include <iostream> #include <queue> #include <vector> using namespace std; #define MAX_N 100 int x[MAX_N][MAX_N]; int Q, n; int y[MAX_N][MAX_N]; int z[MAX_N][MAX_N]; void Rotate(int a, int b, int c, int d) { for (int i = 0; i < MAX_N; i++) { for (int j = 0; j < MAX_N; j++) { y[i][j] = 0; z[i][j] =...
#include <iostream> #include <queue> #include <vector> using namespace std; #define MAX_N 100 int x[MAX_N][MAX_N]; int Q, n; int y[MAX_N][MAX_N]; int z[MAX_N][MAX_N]; void Rotate(int a, int b, int c, int d) { for (int i = 0; i < MAX_N; i++) { for (int j = 0; j < MAX_N; j++) { y[i][j] = 0; z[i][j] =...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
1,777
2
#include <stdio.h> #pragma warning(disable : 4996) int n, q, a[16][16], b[16][16], com, r, c, s, z; void rec(int r_, int c_) { a[r_][c_] ^= 1; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (i * j == 0 && i + j && 0 <= r_ + i && r_ + i < n && 0 <= c_ + j && c_ + j < n && a[r_...
#include <stdio.h> #pragma warning(disable : 4996) int n, q, a[16][16], b[16][16], com, r, c, s, z; void rec(int r_, int c_) { a[r_][c_] ^= 1; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (i * j == 0 && i + j && 0 <= r_ + i && r_ + i < n && 0 <= c_ + j && c_ + j < n && a[r_...
[["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 22]]
1
708
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int(i) = 0; (i) < (int)(n); ++(i)) #define each(itr, c) \ for (__typeof(c.begin()) itr = c.begin(); itr != c.end(); ++itr) #define all(x) (x).begin(), (x).end() #define...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int(i) = 0; (i) < (int)(n); ++(i)) #define each(itr, c) \ for (__typeof(c.begin()) itr = c.begin(); itr != c.end(); ++itr) #define all(x) (x).begin(), (x).end() #define...
[["-", 341, 342, 0, 16, 31, 16, 31, 16, 31, 22], ["+", 341, 342, 0, 16, 31, 16, 31, 16, 31, 22]]
1
890
2
#include <iostream> #include <string> using namespace std; char C[63] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; int convert(int p, string S) { int power[20]; power[0] = 0; for (int i = 1; i <= S.size(); i++) power[i] = power[i - 1] * p; int cnt = 0; for (int i = 0; i < S.size(); ...
#include <iostream> #include <string> using namespace std; char C[63] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; int convert(int p, string S) { int power[20]; power[0] = 1; for (int i = 1; i <= S.size(); i++) power[i] = power[i - 1] * p; int cnt = 0; for (int i = 0; i < S.size(); ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
234
2
#include <bits/stdc++.h> using namespace std; long long po(long long p, long long n) { long long res = 1; for (int i = 0; i < n; i++) { res *= p; } return res; } int main() { long long n; cin >> n; vector<long long> a(n); for (int ii = 0; ii < n; ii++) { int p; cin >> p; string m; ...
#include <bits/stdc++.h> using namespace std; long long po(long long p, long long n) { long long res = 1; for (int i = 0; i < n; i++) { res *= p; } return res; } int main() { long long n; cin >> n; vector<long long> a(n); for (int ii = 0; ii < n; ii++) { int p; cin >> p; string m; ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
374
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll N, Q, x, y, z; P s, t; char str[20]; P a[300005]; ll b[300005]; ll C; P find(ll x) { if (a[x].first == -1) return P(x, 0); P res = find(a[x].first); res.second += a[x].second; return a[x] = res; } void init() ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll N, Q, x, y, z; P s, t; char str[20]; P a[300005]; ll b[300005]; ll C; P find(ll x) { if (a[x].first == -1) return P(x, 0); P res = find(a[x].first); res.second += a[x].second; return a[x] = res; } void init() ...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
499
2
#include <cmath> #include <complex> #include <iostream> #include <vector> using namespace std; typedef complex<double> P; typedef pair<P, double> C; #define X real() #define Y imag() const double pi = acos(-1), EPS = (1e-10); double dot(P a, P b) { return a.X * b.X + a.Y * b.Y; } vector<P> cpcc(C a, C b) { //円と円の交...
#include <cmath> #include <complex> #include <iostream> #include <vector> using namespace std; typedef complex<double> P; typedef pair<P, double> C; #define X real() #define Y imag() const double pi = acos(-1), EPS = (1e-7); double dot(P a, P b) { return a.X * b.X + a.Y * b.Y; } vector<P> cpcc(C a, C b) { //円と円の交点...
[["-", 0, 30, 0, 43, 49, 50, 51, 23, 0, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 23, 0, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72]]
1
1,211
4
#include <iostream> using namespace std; int main() { int m, nmax, nmin, n, a; while (1) { n = 0; cin >> m >> nmin >> nmax; if (m == 0 && nmax == 0 && nmin == 0) break; int *p = new int[m]; for (int i = 0; i < m; i++) { cin >> p[i]; } for (int j = nmin; j < nmax; j++) { ...
#include <iostream> using namespace std; int main() { int m, nmax, nmin, n, a; while (1) { n = 0; cin >> m >> nmin >> nmax; if (m == 0 && nmax == 0 && nmin == 0) break; int *p = new int[m]; for (int i = 0; i < m; i++) { cin >> p[i]; } for (int j = nmin; j <= nmax; j++) { ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
156
2
#include <bits/stdc++.h> using namespace std; int main() { int m, nmin, nmax; while (cin >> m >> nmin >> nmax) { if (m == 0) return 0; int mx = 0, ans = 0, a[m + 5]; for (int i = 1; i <= m; i++) cin >> a[i]; for (int i = nmin; i <= nmax; i++) { if (a[i] - a[i + 1] >= mx) mx...
#include <bits/stdc++.h> using namespace std; int main() { int m, nmin, nmax; while (cin >> m >> nmin >> nmax) { if (m == 0) return 0; int mx = 0, ans = 0, a[m + 5]; for (int i = 1; i <= m; i++) cin >> a[i]; for (int i = nmin; i <= nmax; i++) { if (a[i] - a[i + 1] >= mx) mx...
[["+", 64, 1, 0, 34, 31, 11, 12, 2, 63, 22], ["+", 0, 34, 31, 11, 12, 2, 3, 4, 0, 24], ["-", 12, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 34, 31, 11, 12, 2, 3, 4, 0, 25]]
1
133
5
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int m, min, max, su, gap, temp; vector<int> p; while (1) { cin >> m >> min >> max; if (m == 0 && min == 0 && max == 0) break; for (int i = 0; i < m; i++) { int P; cin >> P; p.push_ba...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int m, min, max, su, gap, temp; vector<int> p; while (1) { cin >> m >> min >> max; if (m == 0 && min == 0 && max == 0) break; for (int i = 0; i < m; i++) { int P; cin >> P; p.push_ba...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
180
2
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); while (1) { int m, nmin, nmax; cin >> m >> nmin >> nmax; if (m == 0) break; vector<int> p(m); for (int i = 0; i < m; i++) cin >> p[i]; int ans = 0, point = 0; for (...
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); while (1) { int m, nmin, nmax; cin >> m >> nmin >> nmax; if (m == 0) break; vector<int> p(m); for (int i = 0; i < m; i++) cin >> p[i]; int ans = 0, point = 0; for (...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
147
2
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "../dump.hpp" #else #define dump(...) #endif #define rep(i, n) for (ll i = 0, i##_cond = (n); i < i##_cond; ++i) #define FOR(i, a, b) for (ll i = (a), i##_cond = (b); i < i##_cond; ++i) #define ROF(i, a, b) for (ll i = (a)-1, i##_cond = (b); i >= i##...
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "../dump.hpp" #else #define dump(...) #endif #define rep(i, n) for (ll i = 0, i##_cond = (n); i < i##_cond; ++i) #define FOR(i, a, b) for (ll i = (a), i##_cond = (b); i < i##_cond; ++i) #define ROF(i, a, b) for (ll i = (a)-1, i##_cond = (b); i >= i##...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
267
2
#!usr/bin/env python #-*- coding: utf-8 -*- while True: (m, nmin, nmax) = list(map(int, input().split())) if m == 0: break scores = [] for i in range(m): scores.append(int(input())) submax = 0 for i in range(nmin, nmax): subtmp = scores[i-1] - scores[i] if ...
#!usr/bin/env python #-*- coding: utf-8 -*- while True: (m, nmin, nmax) = list(map(int, input().split())) if m == 0: break scores = [] for i in range(m): scores.append(int(input())) submax = 0 for i in range(nmin, nmax+1): subtmp = scores[i-1] - scores[i] i...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
98
2
while 1: m,nn,nx= map(int,input().split()) if m==0: break s=[int(input()) for _ in range(m)] v=k=0 for i in range(nn-1,nx): t=s[i]-s[i+1] if v<t: k,v=i+1,t print(k)
while 1: m,nn,nx= map(int,input().split()) if m==0: break s=[int(input()) for _ in range(m)] v=k=0 for i in range(nn-1,nx): t=s[i]-s[i+1] if v<=t: k,v=i+1,t print(k)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
92
2
da = list(map(int,input().split())) k = [] while sum(da) != 0: for i in range(da[0]): k.append(int(input())) for i in range(da[0]): k[da[0] - 1 -i] = k[da[0] - 1 -i] - k[da[0]-2 -i] pp = k[da[1]:da[2]+1] print(pp) qq = min(pp) for i in range(len(pp)): if pp[i] == qq: jj = i print(da[1]+jj) da = li...
da = list(map(int,input().split())) k = [] while sum(da) != 0: for i in range(da[0]): k.append(int(input())) for i in range(da[0]): k[da[0] - 1 -i] = k[da[0] - 1 -i] - k[da[0]-2 -i] pp = k[da[1]:da[2]+1] qq = min(pp) for i in range(len(pp)): if pp[i] == qq: jj = i print(da[1]+jj) da = list(map(int,...
[["-", 0, 52, 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
175
4
import java.util.Scanner; public class Main { static int[] num; static int set; public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (true) { set = scan.nextInt(); if (set == 0) break; String gomi = scan.nextLine(); String[] data = new Stri...
import java.util.Scanner; public class Main { static int[] num; static int set; public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (true) { set = scan.nextInt(); if (set == 0) break; String gomi = scan.nextLine(); String[] data = new Stri...
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
3
290
6
import java.util.Scanner; public class Main { static final int[] HAIKU = {5, 7, 5, 7, 7}; void run() { Scanner scan = new Scanner(System.in); while (true) { int n = scan.nextInt(); if (n == 0) break; int[] w = new int[n]; for (int i = 0; i < n; i++) w[i] = scan.next...
import java.util.Scanner; public class Main { static final int[] HAIKU = {5, 7, 5, 7, 7}; void run() { Scanner scan = new Scanner(System.in); while (true) { int n = scan.nextInt(); if (n == 0) break; int[] w = new int[n]; for (int i = 0; i < n; i++) w[i] = scan.next...
[["+", 75, 196, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 75, 196, 0, 1, 0, 11, 12, 16, 12, 499]]
3
252
2
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int N; int L, i; int j, k; int a = 0; char c[40][100]; int length; int flag; int A[100]; for (;;) { scanf("%d\n", &N); if (N == 0) break; for (j = 0; j < 40; j++) { for (k = 0; k < 100; k++) c...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int N; int L, i; int j, k; int a = 0; char c[40][100]; int length; int flag; int A[100]; for (;;) { scanf("%d\n", &N); if (N == 0) break; for (j = 0; j < 40; j++) { for (k = 0; k < 100; k++) c...
[["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 7, 8, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 7, 8, 1, 0, 2, 3, 4, 0, 22]]
0
436
4
#include <stdio.h> #include <string.h> int NextInt() { int d; scanf("%d", &d); return d; } int main() { int i, j, n; int t, u; char s[11]; int a[41]; int c; int b[5] = {5, 7, 5, 7, 7}; int ok; int ans; while (1) { n = NextInt(); if (n == 0) { break; } for (i = 0; i < n; ...
#include <stdio.h> #include <string.h> int NextInt() { int d; scanf("%d", &d); return d; } int main() { int i, j, n; int t, u; char s[11]; int a[41]; int c; int b[5] = {5, 7, 5, 7, 7}; int ans; while (1) { n = NextInt(); if (n == 0) { break; } for (i = 0; i < n; i++) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72]]
0
273
5
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n) { if (n == 0) { break; } vector<int> data(n); string s; for (int i = 0; i < n; i++) { cin >> s; data[i] = s.size(); } for (int i = 0; i < n; i++) { ...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n) { if (n == 0) { break; } vector<int> data(n); string s; for (int i = 0; i < n; i++) { cin >> s; data[i] = s.size(); } /*for (int i = 0; i < n; i++) { ...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
403
2
#include <iostream> #include <string> using namespace std; int w[42]; // 1-origin int n; static const int secToNum[6] = {0, 5, 7, 5, 7, 7}; bool solve(int x) { int sum; for (int sec = 1; sec <= 5; sec++) { sum = 0; while (sum < secToNum[sec]) { sum += w[x]; x++; } if (sum > secToNum[se...
#include <iostream> #include <string> using namespace std; int w[42]; // 1-origin int n; static const int secToNum[6] = {0, 5, 7, 5, 7, 7}; bool solve(int x) { int sum; for (int sec = 1; sec <= 5; sec++) { sum = 0; while (sum < secToNum[sec]) { sum += w[x]; x++; } if (sum > secToNum[se...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
203
2
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) const double PI = 3.1415926535897932384626433832795028841971; const int INF = 100000000; const double EPS = 1e-10; const int MOD = 1000000007; using namespace std; typedef long long ll; typedef pair<int, int> P; int n; string str[40]; void solve()...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) const double PI = 3.1415926535897932384626433832795028841971; const int INF = 100000000; const double EPS = 1e-10; const int MOD = 1000000007; using namespace std; typedef long long ll; typedef pair<int, int> P; int n; string str[40]; void solve()...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
220
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; ++i) #define FOR(i, a, b) for (int i = a; i...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; ++i) #define FOR(i, a, b) for (int i = a; i...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
267
4
#include <iostream> using namespace std; int main() { int a[] = {5, 7, 5, 7, 7}, n, i, j, c, k; while (cin >> n, n) { string s[n]; for (i = 0; i < n; i++) cin >> s[i]; for (i = 0; i < n; i++) { c = k = 0; for (j = i; j < n; j++) { c += s[j].size(); if (c == a[k]) { ...
#include <iostream> using namespace std; int main() { int a[] = {5, 7, 5, 7, 7}, n, i, j, c, k; while (cin >> n, n) { string s[n]; for (i = 0; i < n; i++) cin >> s[i]; for (i = 0; i < n; i++) { c = k = 0; for (j = i; j < n; j++) { c += s[j].size(); if (c == a[k]) { ...
[["+", 64, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
161
2
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #in...
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #in...
[["-", 0, 7, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 7, 8, 9, 0, 43, 49, 80, 81, 13]]
1
318
2
#include <bits/stdc++.h> using namespace std; int main() { int step, flag = 0, n, l, x; while (1) { cin >> n; if (n == 0) { break; } string w[n]; for (int i = 0; i < n; i++) { cin >> w[i]; } for (int i = 0; i < n; i++) { l = 0; step = 1; flag = 0; x =...
#include <bits/stdc++.h> using namespace std; int main() { int step, flag = 0, n, l, x; while (1) { cin >> n; if (n == 0) { break; } string w[n]; for (int i = 0; i < n; i++) { cin >> w[i]; } for (int i = 0; i < n; i++) { l = 0; step = 1; flag = 0; x =...
[["-", 0, 100, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 100, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
331
12
// // main.cpp // Short Phrase // // Created by x15071xx on 2017/06/18. // Copyright ?? 2017??´ AIT. All rights reserved. // #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main(int argc, const char *argv[]) { while (1) { int n, i, j; vector<string> st...
// // main.cpp // Short Phrase // // Created by x15071xx on 2017/06/18. // Copyright ?? 2017??´ AIT. All rights reserved. // #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main(int argc, const char *argv[]) { while (1) { int n, i, j; vector<string> st...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13]]
1
289
2
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <numeric> #include <vector> using namespace std; using ll = long long; int main() { constexpr int len[5] = {5, 7, 5, 7, 7}; while (true) { int n; cin >> n; if (n == 0) { break; } vector<int> l(n); f...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <numeric> #include <vector> using namespace std; using ll = long long; int main() { constexpr int len[5] = {5, 7, 5, 7, 7}; while (true) { int n; cin >> n; if (n == 0) { break; } vector<int> l(n); f...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
223
2