intmain(){ int n, m; cin >> n >> m; if (n == 0) {puts("Austin"); return0;} if (m == 1) {puts((n & 1) ? "Adrien" : "Austin"); return0;} puts("Adrien"); return0; }
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
inlineboolgetmin(int &a, int b){return a > b ? (a = b, true) : false;} inlineboolgetmax(int &a, int b){return a < b ? (a = b, true) : false;}
#define N 100007
bool tag[N]; // [tag[u] = true] : should be tested to be the first pink point
int sz[N], mxs[N];
vector<int> e[N];
int n, rt, tot, mn;
voidgetcentre(int u, int fa){ sz[u] = 1; mxs[u] = 0; for (auto v : e[u]) if (tag[v] && v != fa) {getcentre(v, u); sz[u] += sz[v]; mxs[u] = max(mxs[u], sz[v]);} mxs[u] = max(mxs[u], tot - sz[u]); mn = min(mn, mxs[u]); }
vector<int> subtree[N];
voidgetsz(int u, int fa, int top){ sz[u] = 1; mxs[u] = 0; subtree[top].push_back(u); for (auto v : e[u]) if (v != fa) {getsz(v, u, top); sz[u] += sz[v]; mxs[u] = max(mxs[u], sz[v]);} }
intmain(){ n = tot = rd(); for (int i = 1; i <= n; ++i) tag[i] = true; for (int i = 1; i < n; ++i) { int u = rd(), v = rd(); e[u].push_back(v); e[v].push_back(u); } int ans = 0; for (rt = 1; tag[rt]; ) { // find the centre mn = 1e9; getcentre(rt, rt); for (int u = 1; u <= n; ++u) if (tag[u] && mxs[u] == mn) {rt = u; break;} tag[rt] = false; --tot; // find the best brown point in the initial tree // i.e. find a subtree whose centre maximize |subtree| - mxs[centre] int res = n, pos = rt; for (auto u : e[rt]) { subtree[u].clear(); getsz(u, rt, u); int bst = u; for (auto v : subtree[u]) mxs[v] = max(mxs[v], sz[u] - sz[v]); for (auto v : subtree[u]) if (mxs[v] < mxs[bst]) bst = v; int cur = n - sz[u] + mxs[bst]; if (getmin(res, cur)) pos = u; } ans = max(ans, res); for (auto u : e[rt]) if (u != pos) for (auto v : subtree[u]) if (tag[v]) {tag[v] = false; --tot;} rt = pos; } printf("%d\n", ans); return0; }
structP { double x, y, z; P(){} P(double _x, double _y, double _z) {x = _x; y = _y; z = _z;} P operator + (const P &b) {return P(x + b.x, y + b.y, z + b.z);} P operator - (const P &b) {return P(x - b.x, y - b.y, z - b.z);} P operator * (double b) {return P(x * b, y * b, z * b);} P operator / (double b) {return P(x / b, y / b, z / b);} } a[200007], b[4], O;
voidball(){ P q[3]; double m[3][3], f[3], L[3], det; int i, j; O.x = O.y = O.z = R = 0; switch(cnt) { case1 : O = b[0]; break; case2 : O = (b[0] + b[1]) / 2; R = dis(O, b[0]); break; case3 : for (i = 0; i < 2; ++i) q[i] = b[i + 1] - b[0]; for (i = 0; i < 2; ++i) for (j = 0; j < 2; ++j) m[i][j] = dot(q[i], q[j]) * 2; for (i = 0; i < 2; ++i) f[i] = dot(q[i], q[i]); if (fabs(det = m[0][0] * m[1][1] - m[0][1] * m[1][0]) < eps) return; L[0] = (f[0] * m[1][1] - f[1] * m[0][1]) / det; L[1] = (f[1] * m[0][0] - f[0] * m[1][0]) / det; O = b[0] + q[0] * L[0] + q[1] * L[1]; R = dis(O, b[0]); break; case4 : for (i = 0; i < 3; ++i) q[i] = b[i + 1] - b[0 ], f[i] = dot(q[i], q[i]); for (i = 0; i < 3; ++i) for (j = 0; j < 3; ++j) m[i][j] = dot(q[i], q[j]) * 2; det = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0] + m[0][2] * m[2][1] * m[1][0] - m[0][2] * m[1][1] * m[2][0] - m[0][1] * m[1][0] * m[2][2] - m[0][0] * m[1][2] * m[2][1]; if (fabs(det) < eps) return; for (j = 0; j < 3; ++j) { for (i = 0; i < 3; ++i) m[i][j] = f[i]; L[j] = (m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0] + m[0][2] * m[2][1] * m[1][0] - m[0][2] * m[1][1] * m[2][0] - m[0][1] * m[1][0] * m[2][2] - m[0][0] * m[1][2] * m[2][1]) / det; for (i = 0; i < 3; ++i) m[i][j] = dot(q[i], q[j]) * 2; } O = b[0]; for (i = 0; i < 3; ++i) O = O + q[i] * L[i]; R = dis(O, b[0]); } }
voidminball(int n){ ball(); if (cnt < 4) for (int i = 0; i < n; ++i) if (dis(O, a[i]) - R > eps) { b[cnt++] = a[i]; minball(i); --cnt; if (i > 0) { P t = a[i]; memmove(&a[1], &a[0], sizeof(P) * i); a[0] = t; } } }
intmain(){ scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%lf%lf%lf", &a[i].x, &a[i].y, &a[i].z); random_shuffle(a, a + n); R = -1; for (i = 0; i < n; ++i) { if (dis(O, a[i]) - R > eps) cnt = 1, b[0] = a[i], minball(i); //printf("%.12lf %.12lf %.12lf %.12lf\n", O.x, O.y, O.z, R); } printf("%.12lf\n", sqrt(R)); return0; }
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
#define N 1000007
#define fr first #define sc second #define pci pair<char, int>
int na, nb;
pci a[N], b[N];
intmain(){ int n = rd(), k = rd(); if (k == 1) {puts("Yes"); return0;} for (int i = 1; i <= n; ++i) { char c = getchar(); while (!isdigit(c)) c = getchar(); if (na && a[na].fr == c) { ++a[na].sc; if (a[na].sc == k) --na; } else a[++na] = mp(c, 1); } for (int i = 1; i <= n; ++i) { char c = getchar(); while (!isdigit(c)) c = getchar(); if (nb && b[nb].fr == c) { ++b[nb].sc; if (b[nb].sc == k) --nb; } else b[++nb] = mp(c, 1); } if (na != nb) {puts("No"); return0;} for (int i = 1; i <= na; ++i) if (a[i] != b[i]) {puts("No"); return0;} puts("Yes"); return0; }
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
#define mod 1000000007 #define inv24 41666667
intmain(){ for (int t = rd(); t; --t) { int n = rd(); printf("%lld\n", 1ll * (n + 3) * (n + 2) % mod * (n + 1) % mod * n % mod * inv24 % mod); } return0; }
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
inlineboolgetmin(int &a, int b){return (a > b ? (a = b, true) : false);} inlineboolgetmax(int &a, int b){return (a < b ? (a = b, true) : false);}
// F is the type of flow template<constint V, constint E, classF, constFflowInf> structFlow {
int tot = 1, S, T, hd[V], cur[V], dis[V]; structedge{int to, nxt; F cap;} e[E << 1];
voidclear(){tot = 1; memset(hd, 0, sizeof(hd));}
voidadd(int u, int v, F w){ e[++tot].nxt = hd[u], hd[u] = tot, e[tot].to = v, e[tot].cap = w; e[++tot].nxt = hd[v], hd[v] = tot, e[tot].to = u, e[tot].cap = 0; }
inlineboolbfs(){ staticint q[V], qhd, qtl; memcpy(cur, hd, sizeof(hd)); memset(dis, -1, sizeof(dis)); q[qhd = qtl = 1] = S; dis[S] = 0; while (qhd <= qtl) { int u = q[qhd++]; for (int i = hd[u], v; i; i = e[i].nxt) if (dis[v = e[i].to] == -1 && e[i].cap != 0) { dis[v] = dis[u] + 1; q[++qtl] = v; } } return dis[T] != -1; }
F dfs(int u, F rem){ if (u == T) return rem; F flow = 0; for (int i = cur[u], v; i && rem; i = e[i].nxt) { cur[u] = i; v = e[i].to; F nw = min(rem, e[i].cap); if (nw != 0 && dis[v] == dis[u] + 1) { int ret = dfs(v, nw); flow += ret; rem -= ret; e[i].cap -= ret; e[i ^ 1].cap += ret; } } if (flow == 0) dis[u] = -1; return flow; }
F dinic(int source, int sink){ S = source; T = sink; F flow = 0; while (bfs()) flow += dfs(S, flowInf); return flow; } };
constexprint N = 1007; constexprint M = 100007; constexprint inf = 1e9;
Flow<N, M, int, inf> f;
intmain(){ int n = rd(), m = rd(), k = rd(); int S = 0, T = N - 1, P = N - 2; f.add(S, P, k); for (int i = 1; i <= m; ++i) f.add(i + n, T, 1); for (int i = 1; i <= n; ++i) { f.add(S, i, 1); f.add(P, i, 1); for (int j = rd(); j; --j) f.add(i, rd() + n, 1); } printf("%d\n", f.dinic(S, T)); return0; }