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 <cmath> #include <cstdio> #include <iostream> #include <queue> #include <string> using namespace std; const int INF = 100000; #define rep(i, n) for (int i = 0; i < (n); i++) char map[100][100]; int r[11]; int h, w, d, n; bool flag[100][100]; int dist[100][100]; // 図面のマスク void f(int x, int y, int k) { in...
#include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <string> using namespace std; const int INF = 100000; #define rep(i, n) for (int i = 0; i < (n); i++) char map[100][100]; int r[11]; int h, w, d, n; bool flag[100][100]; int dist[100][100]; // 図面のマスク void f(int x, int y, int k) { in...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["-", 31, 16, 31, 16, 31, 16, 12, 16, 12, 22], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 22], ["-", 51, 16, 31, 16, 31, 16, 12, 16, 12, 22], ["+", 51, 16, 31, 16, 31, 16, 12, 16, 12, 22]]
1
910
6
#include <bits/stdc++.h> using namespace std; int dp[101][101]; int dp2[10001]; int dp3[101][101]; void Max(int &a, int b) { a = max(a, b); } int main() { int s, t, u, n, o, d, e[101], c[101], h[101], a[101]; cin >> s >> t >> u >> n >> o >> d; for (int i = 0; i < t; i++) cin >> e[i] >> c[i]; for (int i =...
#include <bits/stdc++.h> using namespace std; int dp[101][101]; int dp2[10001]; int dp3[101][101]; void Max(int &a, int b) { a = max(a, b); } int main() { int s, t, u, n, o, d, e[101], c[101], h[101], a[101]; cin >> s >> t >> u >> n >> o >> d; for (int i = 0; i < t; i++) cin >> e[i] >> c[i]; for (int i =...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
510
2
#ifndef _WIN32 #include <iostream> #endif // !_WIN32 #include <algorithm> #include <iomanip> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; #define FOR(i, bg, ed) for (int i = (bg); i < (ed); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() typedef ...
#ifndef _WIN32 #include <iostream> #endif // !_WIN32 #include <algorithm> #include <iomanip> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; #define FOR(i, bg, ed) for (int i = (bg); i < (ed); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() typedef ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
508
2
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; public class Main { static PrintWriter ...
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; public class Main { static PrintWriter ...
[["-", 64, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 64, 196, 0, 57, 15, 15, 0, 16, 12, 499]]
3
1,414
2
#include <bits/stdc++.h> using namespace std; int n, m, q; string s[1000], b[1000]; int get(unsigned long long x) { int res = 0; while (x > 1) { res++; x >>= 1; } return res; } void solve() { for (int i = 1; i < q; i++) { for (int j = 0; j < n; j++) { s[i][j] = '0' + (s[i - 1][j] != s[i][...
#include <bits/stdc++.h> using namespace std; int n, m, q; string s[1000], b[1000]; int get(unsigned long long x) { int res = 0; while (x > 1) { res++; x >>= 1; } return res; } void solve() { for (int i = 1; i < q; i++) { for (int j = 0; j < n; j++) { s[i][j] = '0' + (s[i - 1][j] != s[i][...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
414
1
#include <bits/stdc++.h> using namespace std; int main() { while (1) { char c, ans[1001]; int n, m, q, cnt = 0, f[37][1001], s[37] = {}, b[1001] = {}; cin >> n >> m >> q; if (n + m + q == 0) break; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) f[i][j] = 1; while...
#include <bits/stdc++.h> using namespace std; int main() { while (1) { char c, ans[1001]; int n, m, q, cnt = 0, f[37][1001], s[37] = {}, b[1001]; cin >> n >> m >> q; if (n + m + q == 0) break; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) f[i][j] = 1; while (cn...
[["-", 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, 46], ["-", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22]]
1
425
5
def count_dot(lis): c=0 for i in lis: if not(i=='.'): return c c+=1 def solve(N): a=[] dot =[] for i in range(N): a.append([char for char in input()]) dot.append(count_dot(a[i])) for i in range(N): for j in range(len(a[i])): if a[...
def count_dot(lis): c=0 for i in lis: if not(i=='.'): return c c+=1 def solve(N): a=[] dot =[] for i in range(N): a.append([char for char in input()]) dot.append(count_dot(a[i])) for i in range(N): for j in range(len(a[i])): if a[...
[["+", 0, 1, 0, 662, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 12, 612]]
5
249
2
#include <bits/stdc++.h> using namespace std; char next(char c, int n) { if (c == '?') return c; c += n % 26; if (c < 'A') c += 26; if (c > 'Z') c -= 26; return c; } string cip(const string &s, int &i); string str(const string &s, int &i); string let(const string &s, int &i); string cip(const s...
#include <bits/stdc++.h> using namespace std; char next(char c, int n) { if (c == '?') return c; c += n % 26; if (c < 'A') c += 26; if (c > 'Z') c -= 26; return c; } string cip(const string &s, int &i); string str(const string &s, int &i); string let(const string &s, int &i); string cip(const s...
[["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 98], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 79], ["+", 0, 7, 15, 16, 12, 16, 12, 5, 0, 62], ["+", 0, 7, 15, 16, 12, 16, 12, 5, 0, 6]]
1
395
6
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; const string lts = "ABCDEFGHIJKLMNOPQRSTUVWXYZ+-[]"; pair<string, int> parse(const string &, int); pair<string, int> letter(const string &s, int i) { if (i >= s.size()) throw "last"; if (s[i] == '+') { au...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; const string lts = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; pair<string, int> parse(const string &, int); pair<string, int> letter(const string &s, int i) { if (i >= s.size()) throw "last"; if (s[i] == '+') { auto r...
[["-", 0, 30, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 0, 30, 0, 43, 49, 50, 51, 5, 0, 6]]
1
630
2
#include <algorithm> #include <iostream> #include <string> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define pb push_back #define all(in) in.begin(), in.end() using namespace std; typedef long long ll; typedef int Def; typedef pair<Def, Def> pii; typedef vector<...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define pb push_back #define all(in) in.begin(), in.end() using namespace std; typedef long long ll; typedef int Def; typedef pair<Def, Def> pii; typedef vector<...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
372
4
#include <algorithm> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <string> #include <utility> using namespace std; char s[100]; int it; using namespace std; string Read() { string c; if (s[it] == '+') { it++; c = Read(); if (c[0] == 'Z') { c[0] ...
#include <algorithm> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <string> #include <utility> using namespace std; char s[100]; int it; using namespace std; string Read() { string c; if (s[it] == '+') { it++; c = Read(); if (c[0] == 'Z') { c[0] ...
[["+", 0, 52, 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, 44], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
380
7
#include <bits/stdc++.h> #define show(x) cerr << #x << " = " << (x) << endl using namespace std; string S; int pos; string Cipher(); int PM() { int ans = 0; for (; pos < S.size() and (S[pos] == '+' or S[pos] == '-'); pos++) { ans += (S[pos] == '+' ? 1 : -1); } return (26 + ans % 26) % 26; } string Letter() ...
#include <bits/stdc++.h> #define show(x) cerr << #x << " = " << (x) << endl using namespace std; string S; int pos; string Cipher(); int PM() { int ans = 0; for (; pos < S.size() and (S[pos] == '+' or S[pos] == '-'); pos++) { ans += (S[pos] == '+' ? 1 : -1); } return (26 + ans % 26) % 26; } string Letter() ...
[["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29]]
1
451
2
#include <bits/stdc++.h> using namespace std; struct edge { int to, c, t, r; }; struct state { int h, id, c; state(int h, int id, int c) : h(h), id(id), c(c) {} state() {} bool operator<(const state &st) const { return c > st.c; } }; int N, M, H, K; int S, T, P; vector<edge> G[111]; #define INF (1 << 29) in...
#include <bits/stdc++.h> using namespace std; struct edge { int to, c, t, r; }; struct state { int h, id, c; state(int h, int id, int c) : h(h), id(id), c(c) {} state() {} bool operator<(const state &st) const { return c > st.c; } }; int N, M, H, K; int S, T, P; vector<edge> G[111]; #define INF (1 << 29) in...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 12, 22]]
1
794
4
//================================= // Created on: 2018/07/04 16:12:54 //================================= #include <bits/stdc++.h> using namespace std; struct CostGraph { CostGraph(const int n) : V{n}, edge(n) {} void addEdge(const int from, const int to, const int cost, const int tim, const int lab...
//================================= // Created on: 2018/07/04 16:12:54 //================================= #include <bits/stdc++.h> using namespace std; struct CostGraph { CostGraph(const int n) : V{n}, edge(n) {} void addEdge(const int from, const int to, const int cost, const int tim, const int lab...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
969
2
#include <bits/stdc++.h> #define eps 0.000000001 using namespace std; typedef double ld; typedef pair<int, int> p; typedef pair<ld, p> P; int n; ld px[200], py[200], pz[200], vx[200], vy[200], vz[200], r[200], vr[200]; ld getlen(int a, int b, ld M) { ld ax = px[a] + vx[a] * M, ay = py[a] + vy[a] * M, az = pz[a] + v...
#include <bits/stdc++.h> #define eps 0.000000001 using namespace std; typedef double ld; typedef pair<int, int> p; typedef pair<ld, p> P; int n; ld px[200], py[200], pz[200], vx[200], vy[200], vz[200], r[200], vr[200]; ld getlen(int a, int b, ld M) { ld ax = px[a] + vx[a] * M, ay = py[a] + vy[a] * M, az = pz[a] + v...
[["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
638
2
#include <bits/stdc++.h> #define double long double using namespace std; const double INF = 3e3; const double EPS = 1e-11; // ????¬???? struct P3 { double x, y, z; double vx, vy, vz; double r, vr; P3(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {} P3 operator+(const P3 &a) const { return P3(x...
#include <bits/stdc++.h> #define double long double using namespace std; const double INF = 3e3; const double EPS = 1e-11; // ????¬???? struct P3 { double x, y, z; double vx, vy, vz; double r, vr; P3(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {} P3 operator+(const P3 &a) const { return P3(x...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
877
2
#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<int, 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 long double ld; typedef pair<int, int> P; typedef pair<int, P> P1; #define fr first #define...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
555
4
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define MAX_N 40 #define INF 9000000000000000000 #define MOD 1000000007 using namespace std; typedef long long ll; typedef pair<ll, double> P; ll n, m; ll dp[(1 << 20)]; P a[20]; vector<P> b; ll gcd(ll x, ll y) { while (y) { x %= y; swap...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define MAX_N 40 #define INF 9000000000000000000 #define MOD 1000000007 using namespace std; typedef long long ll; typedef pair<ll, double> P; ll n, m; ll dp[(1 << 20)]; P a[20]; vector<P> b; ll gcd(ll x, ll y) { while (y) { x %= y; swap...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 17, 85], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 9, 0, 43, 39, 40]]
1
593
5
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- typedef long long ll; typedef long dou...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- typedef long long ll; typedef long dou...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
441
2
#include <algorithm> #include <queue> #include <stdio.h> using namespace std; char str[60][60]; int key[11][60][60]; char in[60][60]; int bfs[1 << 10][60][60][2]; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; int main() { int a, b; scanf("%d%d", &b, &a); for (int i = 0; i < a; i++) scanf("%s", str[i]); ...
#include <algorithm> #include <queue> #include <stdio.h> using namespace std; char str[60][60]; int key[11][60][60]; char in[60][60]; int bfs[1 << 10][60][60][2]; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; int main() { int a, b; scanf("%d%d", &b, &a); for (int i = 0; i < a; i++) scanf("%s", str[i]); ...
[["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 7, 8, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 57, 64, 1, 0, 11, 17, 32], ["+", 8, 57, 64, 1, 0, 11, 12, 91, 17, 111], ["+", 8, 57, 64, 1, 0, 11, 12, 91, 28, 22], ["+", 8, 9, 0, 7, 8, 57, 64, 1, 0, 35]]
1
1,266
7
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-4, PI = acos(-1), INF = 1e9; inline bool eq(double a, double b) { return abs(b - a) < EPS; } struct Point { double x, y; Point(){}; Point(double x, double y) : x(x), y(y){}; Point operator+(const Point &b) const { return Point(x + b.x, y...
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-5, PI = acos(-1), INF = 1e9; inline bool eq(double a, double b) { return abs(b - a) < EPS; } struct Point { double x, y; Point(){}; Point(double x, double y) : x(x), y(y){}; Point operator+(const Point &b) const { return Point(x + b.x, y...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
2,128
2
#include <bits/stdc++.h> using namespace std; #define prev jfwekljfwekl typedef complex<double> P; typedef vector<P> G; const double EPS = 1e-5; namespace std { bool operator<(const P &a, const P &b) { if (abs(a - b) < EPS) return false; return fabs(real(a) - real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(...
#include <bits/stdc++.h> using namespace std; #define prev jfwekljfwekl typedef complex<double> P; typedef vector<P> G; const double EPS = 1e-9; namespace std { bool operator<(const P &a, const P &b) { if (abs(a - b) < EPS) return false; return fabs(real(a) - real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
1,445
2
#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(...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
500
2
#include <bits/stdc++.h> #define MOD 1000000007LL using namespace std; typedef long long ll; typedef pair<int, int> P; int r, c; string str[130]; int dp[2][1 << 17]; vector<int> pat[17]; int main(void) { scanf("%d%d", &r, &c); for (int i = 0; i < r; i++) { cin >> str[i]; } int now = 1, prev = 0; memset(...
#include <bits/stdc++.h> #define MOD 1000000007LL using namespace std; typedef long long ll; typedef pair<int, int> P; int r, c; string str[130]; int dp[2][1 << 17]; vector<int> pat[17]; int main(void) { scanf("%d%d", &r, &c); for (int i = 0; i < r; i++) { cin >> str[i]; } int now = 1, prev = 0; memset(...
[["-", 51, 16, 12, 23, 0, 16, 31, 16, 12, 13], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 12, 13]]
1
569
2
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; type...
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; type...
[["-", 64, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 64, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
582
2
#include <algorithm> #include <array> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <unordered_map> #include <unordered_set> #include <valarray> #include <vector> using namespace ...
#include <algorithm> #include <array> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <unordered_map> #include <unordered_set> #include <valarray> #include <vector> using namespace ...
[["-", 0, 1, 0, 2, 3, 4, 0, 103, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 103, 0, 44]]
1
2,495
2
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <numer...
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <numer...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
2,696
4
#include <bits/stdc++.h> using namespace std; using ll = long long; struct RURMS { static const ll INF = 1e17; struct t1 { ll left, right, all, sum, size; t1() : left(-INF), right(-INF), all(-INF), sum(0), size(0) {} t1(ll val) : left(val), right(val), all(val), sum(val), size(1) {} t1(ll l, ll r, ...
#include <bits/stdc++.h> using namespace std; using ll = long long; struct RURMS { static const ll INF = 1e17; struct t1 { ll left, right, all, sum, size; t1() : left(-INF), right(-INF), all(-INF), sum(0), size(0) {} t1(ll val) : left(val), right(val), all(val), sum(val), size(1) {} t1(ll l, ll r, ...
[["+", 0, 37, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 37, 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
2,139
4
#include <algorithm> #include <map> #include <stdio.h> #include <string> #include <vector> using namespace std; char str[20][20]; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; char pt[3][6] = {"^<v>", "|-|-", "++++"}; string men[6]; char in[20]; int td[6][6] = { {1, 2, 3, 4, 5, 6}, {2, 6, 3, 1, 5, 4}, {3, 2, ...
#include <algorithm> #include <map> #include <stdio.h> #include <string> #include <vector> using namespace std; char str[20][20]; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; char pt[3][6] = {"^<v>", "|-|-", "++++"}; string men[6]; char in[20]; int td[6][6] = { {1, 2, 3, 4, 5, 6}, {2, 6, 3, 1, 5, 4}, {3, 2, ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 31, 16, 12, 16, 31, 16, 12, 69, 28, 22], ["+", 31, 16, 12, 16, 31, 16, 12, 69, 28, 22], ["-", 51, 16, 12, 16, 31, 16, 12, 69, 28, 22], ["+", 51, 16, 12, 16, 31, 16, 12, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]...
1
1,458
10
import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import java.io.*; import java.lang.*; import java.math.*; import java.util.*; public class Main { Scanner sc = new Scanner(System.in); long INF = 1L << 60; double EPS = 1e-12; int n; long[] as, bs; ...
import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import java.io.*; import java.lang.*; import java.math.*; import java.util.*; public class Main { Scanner sc = new Scanner(System.in); long INF = 1L << 60; double EPS = 1e-12; int n; long[] as, bs; ...
[["-", 500, 492, 3, 4, 0, 16, 31, 504, 71, 499], ["+", 3, 4, 0, 16, 31, 504, 71, 16, 31, 22], ["+", 3, 4, 0, 16, 31, 504, 71, 16, 17, 33], ["+", 3, 4, 0, 16, 31, 504, 71, 16, 12, 499]]
3
1,365
4
#pragma comment(linker, "/STACK:204800000,204800000"); #include <algorithm> #include <cstdio> #include <vector> using namespace std; int n, sum, l[1000000], vis[1000000], S[4000000], stage[4000000], top; long long ans; vector<int> g[1000000]; int DFS(int v) { for (int i = 0; i < g[v].size(); i++) l[v] += DFS(g[v]...
#pragma comment(linker, "/STACK:204800000,204800000"); #include <algorithm> #include <cstdio> #include <vector> using namespace std; int n, sum, l[1000000], vis[1000000], S[4000000], stage[4000000], top; long long ans; vector<int> g[1000000]; int DFS(int v) { for (int i = 0; i < g[v].size(); i++) l[v] += DFS(g[v]...
[["-", 8, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
454
2
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; typedef long long ll; int len[1000001]; vector<int> child[1000001]; void bfs(int v, vector<int> &order) { queue<int> q; q.push(v); while (!q.empty()) { int v = q.front(); q.pop(); order.push_back(v); ...
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; typedef long long ll; ll len[1000001]; vector<int> child[1000001]; void bfs(int v, vector<int> &order) { queue<int> q; q.push(v); while (!q.empty()) { int v = q.front(); q.pop(); order.push_back(v); ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
393
6
#include "bits/stdc++.h" using namespace std; vector<vector<vector<int>>> dp; vector<string> split(const string &str, char delim) { vector<string> res; size_t current = 0, found; while ((found = str.find_first_of(delim, current)) != string::npos) { res.push_back(string(str, current, found - current)); cu...
#include "bits/stdc++.h" using namespace std; vector<vector<vector<int>>> dp; vector<string> split(const string &str, char delim) { vector<string> res; size_t current = 0, found; while ((found = str.find_first_of(delim, current)) != string::npos) { res.push_back(string(str, current, found - current)); cu...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25]]
1
1,720
5
#include <bits/stdc++.h> using namespace std; void reader(int *x) { int k = getchar_unlocked(); *x = k - '0'; while (1) { k = getchar_unlocked(); if (k < '0' || k > '9') break; *x = ((*x) << 1) + ((*x) << 3) + k - '0'; } } int N, M, x; int main() { scanf("%d%d", &N, &M); int ret = N; for...
#include <bits/stdc++.h> using namespace std; void reader(int *x) { int k = getchar_unlocked(); *x = k - '0'; while (1) { k = getchar_unlocked(); if (k < '0' || k > '9') break; *x = ((*x) << 1) + ((*x) << 3) + k - '0'; } } int N, M, x; int main() { scanf("%d%d\n", &N, &M); int ret = N; f...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
171
1
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; vector<int> primes; void hurui(const int amax) { static bool flag = false; if (flag) return; vector<int> sos; sos = vector<int>(amax +...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; vector<int> primes; void hurui(const int amax) { static bool flag = false; if (flag) return; vector<int> sos; sos = vector<int>(amax +...
[["-", 0, 338, 8, 9, 0, 1, 0, 11, 12, 146], ["+", 0, 338, 8, 9, 0, 1, 0, 11, 12, 147]]
1
422
2
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (i...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (i...
[["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125]]
1
295
2
def inv(bit,m) bs = bit.to_s(2) if bs.length < m bs = "0" * (m - bs.length) + bs end ret = "" bs.each_char do |c| ret << (c == "0" ? "1" : "0") end ret.to_i(2) end conv = ('0'..'9').to_a + ('A'..'Z').to_a loop do n, m, q = gets.split.map(&:to_i) break if n == 0 && m =...
def inv(bit,m) bs = bit.to_s(2) if bs.length < m bs = "0" * (m - bs.length) + bs end ret = "" bs.each_char do |c| ret << (c == "0" ? "1" : "0") end ret.to_i(2) end conv = ('0'..'9').to_a + ('A'..'Z').to_a loop do n, m, q = gets.split.map(&:to_i) break if n == 0 && m =...
[["-", 8, 736, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 8, 736, 0, 662, 12, 652, 3, 4, 0, 22]]
4
314
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define _cle(m, a) memset(m, a, sizeof(m)) #d...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define _cle(m, a) memset(m, a, sizeof(m)) #d...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13]]
1
427
6
#include <algorithm> #include <bitset> #include <fstream> #include <iostream> #include <list> #include <map> #include <math.h> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <ut...
#include <algorithm> #include <bitset> #include <fstream> #include <iostream> #include <list> #include <map> #include <math.h> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <ut...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
575
1
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define N 111111 int n, i, j; double pw, vw[N], pf[N], vf[N], th[N], l, r, m1, m2, ans, res; double calc(double x) { res = pw * x; for (j = 0; j < n; j++) res += max(0.0, (th[j] - vw[j] * x) * pf[j] / vf[j]); ans = min(ans, res); return res...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define N 111111 int n, i, j; double pw, vw[N], pf[N], vf[N], th[N], l, r, m1, m2, ans, res; double calc(double x) { res = pw * x; for (j = 0; j < n; j++) res += max(0.0, (th[j] - vw[j] * x) * pf[j] / vf[j]); ans = min(ans, res); return res...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
1
267
2
#include <bits/stdc++.h> using namespace std; int N; double pw, vw[100010], pf[100010], vf[100010], th[100010]; double f(double x) { double ret = pw * x; for (int i = 0; i < N; i++) { int v = vw[i] * x; if (v >= th[i]) continue; ret += pf[i] * (th[i] - v) / vf[i]; } return ret; } double te...
#include <bits/stdc++.h> using namespace std; int N; double pw, vw[100010], pf[100010], vf[100010], th[100010]; double f(double x) { double ret = pw * x; for (int i = 0; i < N; i++) { double v = vw[i] * x; if (v >= th[i]) continue; ret += pf[i] * (th[i] - v) / vf[i]; } return ret; } double...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40]]
1
280
2
#include <bits/stdc++.h> using namespace std; #define int long long typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define all(v) (v).begin(), (v).end() #define each(it, v) ...
#include <bits/stdc++.h> using namespace std; #define int long long typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define all(v) (v).begin(), (v).end() #define each(it, v) ...
[["-", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
1,280
2
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define RFOR(i, a, b) for (int i = (a); i >= (b); i--) #define RREP(i, n) RFOR(i, n, 0) #define MFOR(i, m) for ...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define RFOR(i, a, b) for (int i = (a); i >= (b); i--) #define RREP(i, n) RFOR(i, n, 0) #define MFOR(i, m) for ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22]]
1
758
6
#include <bits/stdc++.h> using namespace std; int main() { int N, W, H; int row[100002] = {}, col[100002] = {}; cin >> N >> W >> H; for (int i = 0; i < N; i++) { int x, y, w; cin >> x >> y >> w; ++row[max(0, x - w)]; ++col[max(0, y - w)]; --row[min(W, x + w)]; --col[min(H, y + w)]; } ...
#include <bits/stdc++.h> using namespace std; int main() { int N, W, H; int row[100001] = {}, col[100001] = {}; cin >> N >> W >> H; for (int i = 0; i < N; i++) { int x, y, w; cin >> x >> y >> w; ++row[max(0, x - w)]; ++col[max(0, y - w)]; --row[min(W, x + w)]; --col[min(H, y + w)]; } ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
226
8
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, j) REP((i), 0, (j)) #define REP(i, j, k) for (int i = (j); (i) < (k)...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i, j) REP((i), 0, (j)) #define REP(i, j, k) for (int i = (j); (i) < (k)...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
392
6
#include <bits/stdc++.h> using namespace std; #define MAX 100010 int main() { int N, W, H; int X[MAX], Y[MAX]; for (int i = 0; i < MAX; i++) { X[i] = Y[i] = 0; } cin >> N >> W >> H; for (int i = 0; i < N; i++) { int x, y, w; cin >> x >> y >> w; X[max(0, x - w)]++; Y[max(0, y - w)]++; ...
#include <bits/stdc++.h> using namespace std; #define MAX 100010 int main() { int N, W, H; int X[MAX], Y[MAX]; for (int i = 0; i < MAX; i++) { X[i] = Y[i] = 0; } cin >> N >> W >> H; for (int i = 0; i < N; i++) { int x, y, w; cin >> x >> y >> w; X[max(0, x - w)]++; Y[max(0, y - w)]++; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
314
4
#include <bits/stdc++.h> using namespace std; struct lan { int x; int y; int w; lan() {} ~lan() {} }; bool cmp_x(const lan &a, const lan &b) { return a.x < b.x; } bool cmp_y(const lan &a, const lan &b) { return a.y < b.y; } int main() { int N, W, H; lan p[100000]; scanf("%d%d%d", &N, &W, &H); for ...
#include <bits/stdc++.h> using namespace std; struct lan { int x; int y; int w; lan() {} ~lan() {} }; bool cmp_x(const lan &a, const lan &b) { return a.x < b.x; } bool cmp_y(const lan &a, const lan &b) { return a.y < b.y; } int main() { int N, W, H; lan p[100000]; scanf("%d%d%d", &N, &W, &H); for ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
480
4
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <v...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <v...
[["-", 0, 11, 31, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13]]
1
352
4
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Fast Division */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Fast Division */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 67], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 106]]
3
138
2
n; main() { scanf("%d", &n); n = !printf("%d\n", n > 2 ? 0 : n ^ 1); }
n; main() { scanf("%d", &n); n = !printf("%d\n", n > 2 ? 0 : n % 2 + 1); }
[["-", 28, 2, 3, 4, 0, 41, 75, 16, 17, 140], ["+", 3, 4, 0, 41, 75, 16, 31, 16, 17, 109], ["+", 3, 4, 0, 41, 75, 16, 31, 16, 12, 13], ["+", 28, 2, 3, 4, 0, 41, 75, 16, 17, 72]]
0
39
4
#include <bits/stdc++.h> using namespace std; int main() { int n; if (n == 0 || n == 2) puts("1"); else if (n == 1) puts("2"); else puts("0"); }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 0 || n == 2) puts("1"); else if (n == 1) puts("2"); else puts("0"); }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
54
4
#include <cstdio> #include <iostream> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; cout << (n == 0 || n == 2 ? 1 : (n == 1 ? 2 : 3)) << endl; return EXIT_SUCCESS; }
#include <cstdlib> #include <iostream> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; cout << (n == 0 || n == 2 ? 1 : (n == 1 ? 2 : 0)) << endl; return EXIT_SUCCESS; }
[["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 12, 23, 0, 41, 75, 23, 0, 41, 75, 13], ["+", 12, 23, 0, 41, 75, 23, 0, 41, 75, 13]]
1
64
4
#include <algorithm> #include <cstring> #include <iostream> #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++) using namespace std; typedef long long ll; int main() { int n; cin >> n; if (n == 0) { cout << 1 % 2 << endl; } ...
#include <algorithm> #include <cstring> #include <iostream> #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++) using namespace std; typedef long long ll; int main() { int n; cin >> n; if (n == 0) { cout << 1 % 2 << endl; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
115
2
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pint; typedef vector<int> vint; #define pb push_back #define mp make_pair #define rep(i, n) for (int i = 0; i < (n); i++) template <class T, class U> void chmin(T &t, U f) { if (t > f) t = f; } template <class T, class U> void chmax(T &t, U f) {...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pint; typedef vector<int> vint; #define pb push_back #define mp make_pair #define rep(i, n) for (int i = 0; i < (n); i++) template <class T, class U> void chmin(T &t, U f) { if (t > f) t = f; } template <class T, class U> void chmax(T &t, U f) {...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
167
2
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rrep2(i, a, b) for (int i = (b)-1; i >= (a); i--) #define al...
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define rrep2(i, a, b) for (int i = (b)-1; i >= (a); i--) #define al...
[["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13], ["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 13]]
1
160
4
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include...
[["-", 8, 9, 0, 100, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 100, 0, 1, 0, 11, 12, 13]]
1
107
2
#include <iostream> using namespace std; int main() { int n; cin >> n; if (n == 0 || n == 2) cout << 1 << endl; else if (n == 1) cout << 2 << endl; else cout << 1 << endl; return 0; }
#include <iostream> using namespace std; int main() { int n; cin >> n; if (n == 0 || n == 2) cout << 1 << endl; else if (n == 1) cout << 2 << endl; else cout << 0 << endl; return 0; }
[["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 13]]
1
58
2
// g++ -std=c++11 a.cpp #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #incl...
// g++ -std=c++11 a.cpp #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #incl...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
649
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; class Calc { string str; vector<char> p; string::iterator it; public: Calc(const string &str, vector<char> p) { this->str = str; this->p = p; it = this->str.begin(); } ll get_val(ll a, char op, ll b) { switch (op) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; class Calc { string str; vector<char> p; string::iterator it; public: Calc(const string &str, vector<char> p) { this->str = str; this->p = p; it = this->str.begin(); } ll get_val(ll a, char op, ll b) { switch (op) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
1,429
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; class Calc { private: string str; vector<char> p; string::iterator it; public: Calc(string str, vector<char> p) { this->str = str; this->p = p; it = this->str.begin(); } ll get_val(ll a, char op, ll b) { switch (op) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; class Calc { private: string str; vector<char> p; string::iterator it; public: Calc(string str, vector<char> p) { this->str = str; this->p = p; it = this->str.begin(); } ll get_val(ll a, char op, ll b) { switch (op) { ...
[["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 13]]
1
780
2
#include <bits/stdc++.h> using namespace std; #define int long long #define all(v) begin(v), end(v) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++) const int inf = 1LL << 55; const int mod = 1e9 + 7; string formula; int idx; map<char, int> mp; i...
#include <bits/stdc++.h> using namespace std; #define int long long #define all(v) begin(v), end(v) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++) const int inf = 1LL << 55; const int mod = 1e9 + 7; string formula; int idx; map<char, int> mp; i...
[["+", 0, 1, 0, 34, 31, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 34, 31, 11, 12, 16, 12, 13], ["+", 0, 34, 12, 34, 31, 11, 12, 16, 17, 72], ["+", 0, 34, 12, 34, 31, 11, 12, 16, 12, 13], ["+", 0, 34, 12, 34, 12, 11, 12, 16, 17, 72], ["+", 0, 34, 12, 34, 12, 11, 12, 16, 12, 13]]
1
378
6
#include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; map<char, int> mp; void calc(int &a, int b, char op) { if (op == '+') a += b; else if (op == '-') a -= b; else if (op == '*') a *= b; } int num(string &s, int &i) { int n = 0; while...
#include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; map<char, int> mp; void calc(int &a, int b, char op) { if (op == '+') a += b; else if (op == '-') a -= b; else if (op == '*') a *= b; } int num(string &s, int &i) { int n = 0; while...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
498
2
#include <bits/stdc++.h> using namespace std; #define int long long #define r(i, n) for (int i = 0; i < n; i++) int f, p; string s; map<char, int> m; int bns1(); int g_A() { int r = 0; if (s[p] == '(') { p++; r = bns1(); p++; } else { while (isdigit(s[p])) { r = r * 10 + (s[p] - '0'); ...
#include <bits/stdc++.h> using namespace std; #define int long long #define r(i, n) for (int i = 0; i < n; i++) int f, p; string s; map<char, int> m; int bns1(); int g_A() { int r = 0; if (s[p] == '(') { p++; r = bns1(); p++; } else { while (isdigit(s[p])) { r = r * 10 + (s[p] - '0'); ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
514
2
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stri...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stri...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
924
2
#include <iostream> using namespace std; int n, p[10][10], ans; void saiki(int sum, int x, int day, int I) { int f = 1; for (int i = I + 1; i < n; i++) for (int j = 1; (p[day - 1][i] / p[day][i]) && (x / (p[day - 1][i] * j)); j++) { f = 0; saiki(sum + p[day][i] * j, x - p[day - 1][i] * j, ...
#include <iostream> using namespace std; int n, p[10][10], ans; void saiki(int sum, int x, int day, int I) { int f = 1; for (int i = I + 1; i < n; i++) for (int j = 1; (p[day][i] / p[day - 1][i]) && (x / (p[day - 1][i] * j)); j++) { f = 0; saiki(sum + p[day][i] * j, x - p[day - 1][i] * j, ...
[["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["-", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 69, 28, 69, 341, 342, 0, 16, 12, 13]]
1
258
20
#include <iostream> using namespace std; int n, d, p[10][10], ans; void saiki(int sum, int x, int day, int I) { int f = 1; for (int i = I; i < n; i++) if (p[day][i] / p[day - 1][i] && x / p[day - 1][i]) { f = 0; saiki(sum + p[day][i], x - p[day - 1][i], day, i); } if (f) ans = max(ans, su...
#include <iostream> using namespace std; int n, d, p[10][10], ans; void saiki(int sum, int x, int day, int I) { int f = 1; for (int i = I; i < n; i++) if (p[day][i] / p[day - 1][i] && x / p[day - 1][i]) { f = 0; saiki(sum + p[day][i], x - p[day - 1][i], day, i); } if (f) ans = max(ans, su...
[["-", 0, 7, 8, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 7, 8, 1, 0, 2, 3, 4, 0, 13]]
1
229
2
#include <algorithm> #include <iostream> using namespace std; int main() { int i, j, k, n, d, x, maxx, p[11][11], curp, nextp; cin >> n >> d >> x; for (i = 0; i < d; i++) { for (j = 0; j < n; j++) { cin >> p[i][j]; } } for (i = 0; i < d - 1; i++) { int dp[100] = {}; for (j = 0; j < n;...
#include <algorithm> #include <iostream> using namespace std; int main() { int i, j, k, n, d, x, maxx, p[11][11], curp, nextp; cin >> n >> d >> x; for (i = 0; i < d; i++) { for (j = 0; j < n; j++) { cin >> p[i][j]; } } for (i = 0; i < d - 1; i++) { int dp[100000] = {}; for (j = 0; j <...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]]
1
267
2
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2607 // #include <bits/stdc++.h> using namespace std; int n, d, x; int p[10][10]; int dp[100001]; int s, s2; int main() { scanf("%d%d%d", &n, &d, &x); for (int i = 0; i < d; i++) for (int j = 0; j < n; j++) scanf("%d", &p[i][j]); int res = x; ...
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2607 // #include <bits/stdc++.h> using namespace std; int n, d, x; int p[10][10]; int dp[100001]; int s, s2; int main() { scanf("%d%d%d", &n, &d, &x); for (int i = 0; i < d; i++) for (int j = 0; j < n; j++) scanf("%d", &p[i][j]); int res = x; ...
[["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22]]
1
266
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ...
[["-", 51, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["+", 51, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22]]
1
408
4
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
[["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 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, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
576
7
#include <algorithm> #include <cstdint> #include <iostream> #include <utility> using namespace std; int N, D, X; int p[11][11]; int main() { cin >> N >> D >> X; for (int j = 0; j < D; ++j) { for (int k = 0; k < N; ++k) { cin >> p[j][k]; } } int ret = X; int memo[101010]; for (int j = 1; j ...
#include <algorithm> #include <cstdint> #include <iostream> #include <utility> using namespace std; int N, D, X; int p[11][11]; int main() { cin >> N >> D >> X; for (int j = 0; j < D; ++j) { for (int k = 0; k < N; ++k) { cin >> p[j][k]; } } int ret = X; int memo[101010]; for (int j = 1; j ...
[["-", 3, 4, 0, 69, 341, 342, 0, 16, 17, 33], ["-", 3, 4, 0, 69, 341, 342, 0, 16, 12, 13]]
1
244
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define CH(N, A, B) (A <= N && N < B) #define REP(i, a, b) for (int i = a; i < b; i++) #define RREP(i, a, b) for (int i = (b - 1); a <= i; i--) using namespa...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define CH(N, A, B) (A <= N && N < B) #define REP(i, a, b) for (int i = a; i < b; i++) #define RREP(i, a, b) for (int i = (b - 1); a <= i; i--) using namespa...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
254
4
#include <bits/stdc++.h> /* */ using namespace std; int main() { long long int N, D, X; cin >> N >> D >> X; vector<long long int> Pprev(N), Pnext(N); for (size_t i = 0; i < N; i++) { cin >> Pprev[i]; } for (size_t j = 1; j < D; j++) { long long int now = X; vector<long long int> nextprime(N);...
#include <bits/stdc++.h> /* */ using namespace std; int main() { long long int N, D, X; cin >> N >> D >> X; vector<long long int> Pprev(N), Pnext(N); for (size_t i = 0; i < N; i++) { cin >> Pprev[i]; } for (size_t j = 1; j < D; j++) { long long int now = X; vector<long long int> nextprime(N);...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
239
4
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; const int M = 1000000007; int main() { int n, d, x; cin >> n >> d >> x; vector<int> prev(n); for (int i = 0; i < n; ++i) { cin >> prev[i]; } for (int i = 0; i < d - 1; ++i) { vector<int> p(n); for (int j = 0; j < n; ++j) { ...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; const int M = 1000000007; int main() { int n, d, x; cin >> n >> d >> x; vector<int> prev(n); for (int i = 0; i < n; ++i) { cin >> prev[i]; } for (int i = 0; i < d - 1; ++i) { vector<int> p(n); for (int j = 0; j < n; ++j) { ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
251
4
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <tuple> #include <u...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <tuple> #include <u...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
380
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctype.h> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define mo...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctype.h> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define mo...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
327
2
#include <algorithm> #include <iostream> using namespace std; int dp[11][1 << 17]; int n, d, x, M = 1e5; int p[11][11]; main() { cin >> n >> d >> x; for (int i = 0; i < d; i++) for (int j = 0; j < n; j++) cin >> p[i][j]; for (int i = 0; i <= M; i++) dp[n - 1][i] = i; for (int i = d - 1; i--;) { ...
#include <algorithm> #include <iostream> using namespace std; int dp[11][1 << 17]; int n, d, x, M = 1e5; int p[11][11]; main() { cin >> n >> d >> x; for (int i = 0; i < d; i++) for (int j = 0; j < n; j++) cin >> p[i][j]; for (int i = 0; i <= M; i++) dp[d - 1][i] = i; for (int i = d - 1; i--;) { ...
[["-", 31, 69, 28, 69, 341, 342, 0, 16, 31, 22], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
260
6
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; int p[11][11]; int money[11]; int dp[100010]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, d, x; cin >> n >> d >> x; rep(i, 0, d) { rep(j, 0, n) { cin >> p[i][j]; } } rep(i, 0, d) money[i] ...
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; int p[11][11]; int money[11]; int dp[100010]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, d, x; cin >> n >> d >> x; rep(i, 0, d) { rep(j, 0, n) { cin >> p[i][j]; } } rep(i, 0, d) money[i] ...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
350
2
n,d,x = gets.split.map(&:to_i) if d <= 1 puts x else pa = gets.split.map(&:to_i) (d-1).times do pb = gets.split.map(&:to_i) dp = Array.new(10**5+1, 0) for i in 0...n for j in 0..x-pa[i] dp[j + pa[i]] = [dp[j + pa[i]], dp[j] + pb[i]].max end end y = x for i in...
n,d,x = gets.split.map(&:to_i) if d <= 1 puts x else pa = gets.split.map(&:to_i) (d-1).times do pb = gets.split.map(&:to_i) dp = Array.new(10**5+1, 0) for i in 0...n for j in 0..x-pa[i] dp[j + pa[i]] = [dp[j + pa[i]], dp[j] + pb[i]].max end end y = x for i in ...
[["+", 0, 652, 196, 737, 8, 736, 0, 662, 31, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 662, 0, 32], ["+", 0, 652, 196, 737, 8, 736, 0, 662, 12, 22]]
4
151
3
#include <iostream> #include <queue> #include <vector> using namespace std; using ll = long long; int main() { int N, M; cin >> N >> M; vector<bool> isReached(N, false), is(N, false); vector<int> count(N, 0), c(N, 0); vector<vector<int>> graph(N); queue<int> que; vector<int> dist(N), d(N); int s, t; ...
#include <iostream> #include <queue> #include <vector> using namespace std; using ll = long long; int main() { int N, M; cin >> N >> M; vector<bool> isReached(N, false), is(N, false); vector<ll> count(N, 0), c(N, 0); vector<vector<int>> graph(N); queue<int> que; vector<int> dist(N), d(N); int s, t; ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
530
10
#include <bits/stdc++.h> //#define int long long using namespace std; using LL = long long; using P = pair<int, int>; #define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i) #define REP(i, n) FOR(i, 0, n) #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() const int INF = (int)1e9; const LL INFL...
#include <bits/stdc++.h> //#define int long long using namespace std; using LL = long long; using P = pair<int, int>; #define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i) #define REP(i, n) FOR(i, 0, n) #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() const int INF = (int)1e9; const LL INFL...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
977
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct point { ll x, y; }; ll w, h, v, t, x, y, p, q; ll R, H, W; point o, O; point calc(ll X, ll Y) { ll dx = abs(X - O.x), dy = abs(Y - O.y); point res; if (dx % 2 == 0) res.x = p; else res.x = w - p; if (dy % 2 == 0) res...
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct point { ll x, y; }; ll w, h, v, t, x, y, p, q; ll R, H, W; point o, O; point calc(ll X, ll Y) { ll dx = abs(X - O.x), dy = abs(Y - O.y); point res; if (dx % 2 == 0) res.x = p; else res.x = w - p; if (dy % 2 == 0) res...
[["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]]
1
556
4
#include <cmath> #include <iostream> using namespace std; #define MAX_N 500 #define INF 10000000 long long H, W, V, T, X, Y, P, Q; int main() { cin >> W >> H >> V >> T >> X >> Y >> P >> Q; long long K = V * T; long long x[4] = {P, 2 * W - P, P, 2 * W - P}; long long y[4] = {Q, Q, 2 * H - Q, 2 * H - Q}; lon...
#include <cmath> #include <iostream> using namespace std; #define MAX_N 10000000 #define INF 10000000 long long H, W, V, T, X, Y, P, Q; int main() { cin >> W >> H >> V >> T >> X >> Y >> P >> Q; long long K = V * T; long long x[4] = {P, 2 * W - P, P, 2 * W - P}; long long y[4] = {Q, Q, 2 * H - Q, 2 * H - Q}; ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]]
1
328
5
#include <bits/stdc++.h> #define REP(i, a, n) for (ll i = ((ll)a); i < ((ll)n); i++) using namespace std; typedef long long ll; ll W, H, V, T, X, Y, P, Q; ll solve(ll p, ll q) { ll r = V * T; ll ret = 0; for (ll n = -2000000; n <= 2000000; n++) { ll x = 2 * n * W + p - X; if (-r <= x && x <= r) { ...
#include <bits/stdc++.h> #define REP(i, a, n) for (ll i = ((ll)a); i < ((ll)n); i++) using namespace std; typedef long long ll; ll W, H, V, T, X, Y, P, Q; ll solve(ll p, ll q) { ll r = V * T; ll ret = 0; for (ll n = -2000000; n <= 2000000; n++) { ll x = 2 * n * W + p - X; if (-r <= x && x <= r) { ...
[["+", 31, 23, 0, 41, 15, 16, 12, 91, 17, 33]]
1
386
1
#include <bits/stdc++.h> #define int long long #define r(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef double D; int mod = 1e18 + 7; D w, h, v, t, X, Y, x, y, r, w1, h1, w2, h2; D dx[2], dy[2]; D get_h(double a) { return r * r - a * a; } int UP(D h) { D ny = abs(y - Y); ...
#include <bits/stdc++.h> #define int long long #define r(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef double D; int mod = 1e18 + 7; D w, h, v, t, X, Y, x, y, r, w1, h1, w2, h2; D dx[2], dy[2]; D get_h(double a) { return r * r - a * a; } int UP(D h) { D ny = abs(y - Y); ...
[["-", 0, 34, 31, 11, 12, 16, 31, 69, 28, 22], ["+", 0, 34, 31, 11, 12, 16, 31, 69, 28, 22], ["+", 31, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 11, 12, 16, 12, 23, 0, 16, 12, 22]]
1
890
4
w, h, v, t, x, y, p ,q = gets.split.map(&:to_i) r2 = (v * t) ** 2 count = 0 [ [p,q], [p,2*h-q], [2*w-p,q], [2*w-p,2*h-q], ].each do |a, b| n = 0 loop do d = r2 - (b + 2 * h * n - y) ** 2 break if d < 0 s = sqrt(d) l = (x - a - s) / (2 * w) r = (x ...
include Math w, h, v, t, x, y, p ,q = gets.split.map(&:to_i) r2 = (v * t) ** 2 count = 0 [ [p,q], [p,2*h-q], [2*w-p,q], [2*w-p,2*h-q], ].each do |a, b| n = 0 loop do d = r2 - (b + 2 * h * n - y) ** 2 break if d < 0 s = sqrt(d) l = (x - a - s) / (2 * w) ...
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 743]]
4
246
2
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string> #include <utility> #include <vector> #define INF 100000 #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long int ll; const ...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string> #include <utility> #include <vector> #define INF 100000 #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long int ll; const l...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
418
6
#include <algorithm> #include <iostream> using namespace std; int N, W, H, x, y, w, s, t, imosx[100001], imosy[100001]; int main() { std::cin >> N >> W >> H; for (int i = 0; i < N; i++) { std::cin >> x >> y >> w; int lx = max(x - w, 0); int rx = min(x + w, W); int ly = max(y - w, 0); int ry...
#include <algorithm> #include <iostream> using namespace std; int N, W, H, x, y, w, s, t, imosx[100001], imosy[100001]; int main() { std::cin >> N >> W >> H; for (int i = 0; i < N; i++) { std::cin >> x >> y >> w; int lx = max(x - w, 0); int rx = min(x + w, W); int ly = max(y - w, 0); int ry...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 91, 28, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 28, 22]]
1
256
4
#include <bits/stdc++.h> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define All(X) X.begin(), X.end() #define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define pb push_back #define pii pair<int, int>...
#include <bits/stdc++.h> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define All(X) X.begin(), X.end() #define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define pb push_back #define pii pair<int, int>...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
352
4
#include <bits/stdc++.h> typedef long long LL; #define SORT(c) sort((c).begin(), (c).end()) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) using namespace std; int main(void) { int n, w, h; cin >> n >> w >> h; vector<int> x(n), y(n), a(n); REP(i, n) cin >> x[i] >> y[i] >> ...
#include <bits/stdc++.h> typedef long long LL; #define SORT(c) sort((c).begin(), (c).end()) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) using namespace std; int main(void) { int n, w, h; cin >> n >> w >> h; vector<int> x(n), y(n), a(n); REP(i, n) cin >> x[i] >> y[i] >> ...
[["-", 0, 27, 28, 69, 341, 342, 0, 2, 63, 22], ["+", 0, 27, 28, 69, 341, 342, 0, 2, 63, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
338
6
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int x[300005], y[300005]; int main() { int a, b, c; scanf("%d%d%d", &a, &b, &c); for (int d = 0; d < a; d++) { int e, f, g; scanf("%d%d%d", &e, &f, &g); x[max(0, e - g)]++; x[e + g]--; y[max(0, f - g)]++; y[f ...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int x[300005], y[300005]; int main() { int a, b, c; scanf("%d%d%d", &a, &b, &c); for (int d = 0; d < a; d++) { int e, f, g; scanf("%d%d%d", &e, &f, &g); x[max(0, e - g)]++; x[e + g]--; y[max(0, f - g)]++; y[f ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
242
4
#include <iostream> using namespace std; int main() { int N, W, H; cin >> N >> W >> H; int x[N], y[N], w[N]; for (int i = 0; i < N; i++) cin >> x[i] >> y[i] >> w[i]; int r[W + 1], s[H + 1]; for (int i = 0; i < W + 1; i++) r[i] = 0; for (int i = 0; i < H + 1; i++) s[i] = 0; for (int i = 0...
#include <iostream> using namespace std; int main() { int N, W, H; cin >> N >> W >> H; int x[N], y[N], w[N]; for (int i = 0; i < N; i++) cin >> x[i] >> y[i] >> w[i]; int r[W + 1], s[H + 1]; for (int i = 0; i < W + 1; i++) r[i] = 0; for (int i = 0; i < H + 1; i++) s[i] = 0; for (int i = 0...
[["-", 341, 342, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 341, 342, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
372
8
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
306
6
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; const int MOD = 1000000007; con...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; const int MOD = 1000000007; con...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
352
4
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vvi = vector<vi>; using vs = vector<string>; using msi = map<string, int>; using mii = map<int, int>; using pii = pair<int, int>; using vlai = valarray<int>; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) #define range(i, s...
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vvi = vector<vi>; using vs = vector<string>; using msi = map<string, int>; using mii = map<int, int>; using pii = pair<int, int>; using vlai = valarray<int>; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) #define range(i, s...
[["-", 31, 16, 12, 23, 0, 41, 15, 16, 17, 106], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 98]]
1
292
2
#include <cstring> #include <iostream> using namespace std; int n, w, h; int imosxadd[100003] = {0}; int imosxsub[100003] = {0}; int imosyadd[100003] = {0}; int imosysub[100003] = {0}; int main() { cin >> n >> w >> h; for (int i = 0; i < n; ++i) { int xi, yi, wi; cin >> xi >> yi >> wi; imosxadd[max...
#include <cstring> #include <iostream> using namespace std; int n, w, h; int imosxadd[100003] = {0}; int imosxsub[100003] = {0}; int imosyadd[100003] = {0}; int imosysub[100003] = {0}; int main() { cin >> n >> w >> h; for (int i = 0; i < n; ++i) { int xi, yi, wi; cin >> xi >> yi >> wi; imosxadd[max...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
308
4
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, W, H, x, y, w; cin >> N >> W >> H; vector<int> xvect(W + 2, 0), yvect(H + 2, 0); bool ans = true; for (int i = 0; i < N; i++) { cin >> x >> y >> w; xvect[max(x - w, 0)]++; xvect[min(x + w, W + 1)]...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, W, H, x, y, w; cin >> N >> W >> H; vector<int> xvect(W + 2, 0), yvect(H + 2, 0); bool ans = true; for (int i = 0; i < N; i++) { cin >> x >> y >> w; xvect[max(x - w, 0)]++; xvect[min(x + w, W + 1)]...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18]]
1
250
4
def read(): return list(map(int,input().split())) while 1: try: n,w,h=read() bases=[(0,0,0)]*n for i in range(n): bases[i]=read() except: break res1=True ls,rs=zip(*sorted([(x-w,x+w) for x,y,w in bases],key=lambda lr:lr[0])) x=0 for l,r in zip(ls,rs): res1&=l<=x x=max(x,r) ...
def read(): return list(map(int,input().split())) while 1: try: n,w,h=read() bases=[(0,0,0)]*n for i in range(n): bases[i]=read() except: break res1=True ls,rs=zip(*sorted([(x-w,x+w) for x,y,w in bases],key=lambda lr:lr[0])) x=0 for l,r in zip(ls,rs): res1&=l<=x x=max(x,r) ...
[["-", 0, 652, 3, 4, 0, 41, 0, 679, 17, 355], ["+", 0, 652, 3, 4, 0, 41, 0, 679, 17, 354]]
5
233
2
#include <bits/stdc++.h> using namespace std; #define rep(i, x, y) for (int i = (x); i < (y); ++i) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define dump(x) #endif typedef long long int ll; typedef pair<...
#include <bits/stdc++.h> using namespace std; #define rep(i, x, y) for (int i = (x); i < (y); ++i) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define dump(x) #endif typedef long long int ll; typedef pair<...
[["-", 0, 14, 8, 9, 0, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 9, 0, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 12, 22]]
1
842
5
#include <bits/stdc++.h> #define REP(i, n, N) for (int i = (n); i < (int)N; i++) #define p(s) cout << (s) << endl using namespace std; const int inf = 1e9; int tmp[100010]; int main() { int W, a[100010], ans = 0; cin >> W; REP(i, 0, W) cin >> a[i]; int t = 0; REP(i, 0, W) { if (a[i] == 0) t = inf;...
#include <bits/stdc++.h> #define REP(i, n, N) for (int i = (n); i < (int)N; i++) #define p(s) cout << (s) << endl using namespace std; const int inf = 1e9; int tmp[100010]; int main() { int W, a[100010], ans = 0; cin >> W; REP(i, 0, W) cin >> a[i]; int t = 0; REP(i, 0, W) { if (a[i] == 0) t = inf;...
[["+", 75, 76, 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, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
225
5