summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--datastructures/LCT.cpp10
-rw-r--r--datastructures/dynamicConvexHull.cpp2
-rw-r--r--datastructures/monotonicConvexHull.cpp2
-rw-r--r--datastructures/persistent.cpp2
-rw-r--r--datastructures/sparseTable.cpp38
-rw-r--r--datastructures/stlTree.cpp2
-rw-r--r--datastructures/treap.cpp4
-rw-r--r--datastructures/waveletTree.cpp2
-rw-r--r--geometry/antipodalPoints.cpp2
-rw-r--r--geometry/circle.cpp4
-rw-r--r--geometry/closestPair.cpp6
-rw-r--r--geometry/convexHull.cpp2
-rw-r--r--geometry/formulars3d.cpp4
-rw-r--r--geometry/linesAndSegments.cpp10
-rw-r--r--geometry/polygon.cpp2
-rw-r--r--geometry/segmentIntersection.cpp4
-rw-r--r--geometry/sortAround.cpp2
-rw-r--r--geometry/spheres.cpp8
-rw-r--r--geometry/triangle.cpp12
-rw-r--r--graph/TSP.cpp4
-rw-r--r--graph/bellmannFord.cpp4
-rw-r--r--graph/bitonicTSPsimple.cpp2
-rw-r--r--graph/blossom.cpp4
-rw-r--r--graph/connect.cpp2
-rw-r--r--graph/cycleCounting.cpp2
-rw-r--r--graph/dinicScaling.cpp4
-rw-r--r--graph/havelHakimi.cpp2
-rw-r--r--graph/hopcroftKarp.cpp2
-rw-r--r--graph/maxWeightBipartiteMatching.cpp2
-rw-r--r--graph/minCostMaxFlow.cpp2
-rw-r--r--graph/pushRelabel3.cpp4
-rw-r--r--java/bigInteger.java14
-rw-r--r--java/output.java4
-rw-r--r--math/bigint.cpp3
-rw-r--r--math/longestIncreasingSubsequence.cpp2
-rw-r--r--math/millerRabin.cpp2
-rw-r--r--math/piLehmer.cpp2
-rw-r--r--math/rho.cpp2
-rw-r--r--math/squfof.cpp8
-rw-r--r--other/bitOps.cpp2
-rw-r--r--string/ahoCorasick.cpp4
-rw-r--r--string/manacher.cpp2
-rw-r--r--string/rollingHash.cpp2
-rw-r--r--string/suffixArray.cpp4
-rw-r--r--string/suffixTree.cpp4
45 files changed, 103 insertions, 104 deletions
diff --git a/datastructures/LCT.cpp b/datastructures/LCT.cpp
index fe92c7f..aef45f7 100644
--- a/datastructures/LCT.cpp
+++ b/datastructures/LCT.cpp
@@ -42,7 +42,7 @@ struct LCT {
bool isRoot() {
return !parent || (parent->left != this &&
- parent->right != this);
+ parent->right != this);
}
void push() {
@@ -54,7 +54,7 @@ struct LCT {
}
nodeValue = joinValueDelta(nodeValue, delta);
subTreeValue = joinValueDelta(subTreeValue,
- _update(delta, size));
+ _update(delta, size));
if (left) left->delta = joinDeltas(left->delta, delta);
if (right) right->delta = joinDeltas(right->delta, delta);
delta = updateDefault;
@@ -69,12 +69,12 @@ struct LCT {
size = 1;
if (left) {
subTreeValue = _query(subTreeValue,
- left->getSubtreeValue());
+ left->getSubtreeValue());
size += left->size;
}
if (right) {
subTreeValue = _query(subTreeValue,
- right->getSubtreeValue());
+ right->getSubtreeValue());
size += right->size;
}}
};
@@ -112,7 +112,7 @@ struct LCT {
p->push();
x->push();
if (!p->isRoot()) rotate((x == p->left) ==
- (p == g->left) ? p : x);
+ (p == g->left) ? p : x);
rotate(x);
}
x->push();
diff --git a/datastructures/dynamicConvexHull.cpp b/datastructures/dynamicConvexHull.cpp
index d8a1a3b..5cdb12b 100644
--- a/datastructures/dynamicConvexHull.cpp
+++ b/datastructures/dynamicConvexHull.cpp
@@ -21,7 +21,7 @@ struct HullDynamic : public multiset<Line> {
auto x = prev(y);
if (z == end()) return y->m == x->m && y->b <= x->b;
return (x->b - y->b)*(z->m - y->m) >=
- (y->b - z->b)*(y->m - x->m);
+ (y->b - z->b)*(y->m - x->m);
}
// Variant 1: niklasb (2015)
diff --git a/datastructures/monotonicConvexHull.cpp b/datastructures/monotonicConvexHull.cpp
index 8035b17..7003855 100644
--- a/datastructures/monotonicConvexHull.cpp
+++ b/datastructures/monotonicConvexHull.cpp
@@ -4,7 +4,7 @@ vector<ll> ms, bs; int ptr = 0;
bool bad(int l1, int l2, int l3) {
return (bs[l3]-bs[l1])*(ms[l1]-ms[l2]) <
- (bs[l2]-bs[l1])*(ms[l1]-ms[l3]);
+ (bs[l2]-bs[l1])*(ms[l1]-ms[l3]);
}
void add(ll m, ll b) { // Laufzeit O(1) amortisiert
diff --git a/datastructures/persistent.cpp b/datastructures/persistent.cpp
index befecf7..1704ff2 100644
--- a/datastructures/persistent.cpp
+++ b/datastructures/persistent.cpp
@@ -8,7 +8,7 @@ struct persistent {
T get(int t) {
return prev(upper_bound(all(data),
- pair<int, T>(t+1, {})))->second;
+ pair<int, T>(t+1, {})))->second;
}
int set(T value) {
diff --git a/datastructures/sparseTable.cpp b/datastructures/sparseTable.cpp
index 3d11119..40057bd 100644
--- a/datastructures/sparseTable.cpp
+++ b/datastructures/sparseTable.cpp
@@ -1,24 +1,24 @@
struct SparseTable {
- vector<vector<int>> st;
- vector<ll> *a;
+ vector<vector<int>> st;
+ vector<ll> *a;
- bool better(int lidx, int ridx) {
- return a->at(lidx) <= a->at(ridx);
- }
+ bool better(int lidx, int ridx) {
+ return a->at(lidx) <= a->at(ridx);
+ }
- void init(vector<ll> *vec) {
- a = vec;
- st.assign(__lg(sz(*a)) + 1, vector<int>(sz(*a)));
- for (int i = 0; i < sz(*a); i++) st[0][i] = i;
- for (int j = 0; (2 << j) <= sz(*a); j++) {
- for (int i = 0; i + (2 << j) <= sz(*a); i++) {
- st[j + 1][i] = better(st[j][i] , st[j][i + (1 << j)])
- ? st[j][i] : st[j][i + (1 << j)];
- }}}
+ void init(vector<ll> *vec) {
+ a = vec;
+ st.assign(__lg(sz(*a)) + 1, vector<int>(sz(*a)));
+ for (int i = 0; i < sz(*a); i++) st[0][i] = i;
+ for (int j = 0; (2 << j) <= sz(*a); j++) {
+ for (int i = 0; i + (2 << j) <= sz(*a); i++) {
+ st[j + 1][i] = better(st[j][i] , st[j][i + (1 << j)])
+ ? st[j][i] : st[j][i + (1 << j)];
+ }}}
- int queryIdempotent(int l, int r) {
- int j = __lg(r - l); //31 - __builtin_clz(r - l);
- return better(st[j][l] , st[j][r - (1 << j)])
- ? st[j][l] : st[j][r - (1 << j)];
- }
+ int queryIdempotent(int l, int r) {
+ int j = __lg(r - l); //31 - builtin_clz(r - l);
+ return better(st[j][l] , st[j][r - (1 << j)])
+ ? st[j][l] : st[j][r - (1 << j)];
+ }
}; \ No newline at end of file
diff --git a/datastructures/stlTree.cpp b/datastructures/stlTree.cpp
index 29491c4..0fdc480 100644
--- a/datastructures/stlTree.cpp
+++ b/datastructures/stlTree.cpp
@@ -3,7 +3,7 @@
using namespace std; using namespace __gnu_pbds;
template<typename T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag,
- tree_order_statistics_node_update>;
+ tree_order_statistics_node_update>;
int main() {
Tree<int> X;
diff --git a/datastructures/treap.cpp b/datastructures/treap.cpp
index 6296392..eef56b4 100644
--- a/datastructures/treap.cpp
+++ b/datastructures/treap.cpp
@@ -1,7 +1,7 @@
struct node {
int key, prio, left, right, size;
node(int key, int prio) : key(key), prio(prio), left(-1),
- right(-1), size(1) {};
+ right(-1), size(1) {};
};
vector<node> treap;
@@ -13,7 +13,7 @@ int getSize(int root) {
void update(int root) {
if (root < 0) return;
treap[root].size = 1 + getSize(treap[root].left)
- + getSize(treap[root].right);
+ + getSize(treap[root].right);
}
pair<int, int> split(int root, int minKeyRight) {
diff --git a/datastructures/waveletTree.cpp b/datastructures/waveletTree.cpp
index feef2d4..8a0e10f 100644
--- a/datastructures/waveletTree.cpp
+++ b/datastructures/waveletTree.cpp
@@ -38,7 +38,7 @@ public:
if (l >= r || k <= lo) return 0;
if (hi <= k) return r - l;
return ln->countSmaller(b[l], b[r], k) +
- rn->countSmaller(l-b[l], r-b[r], k);
+ rn->countSmaller(l-b[l], r-b[r], k);
}
~WaveletTree(){
diff --git a/geometry/antipodalPoints.cpp b/geometry/antipodalPoints.cpp
index c1921cc..707cf84 100644
--- a/geometry/antipodalPoints.cpp
+++ b/geometry/antipodalPoints.cpp
@@ -6,7 +6,7 @@ vector<pair<int, int>> antipodalPoints(vector<pt>& h) {
while (true) {
result.push_back({i, j});
if (cross(h[(i + 1) % n] - h[i],
- h[(j + 1) % n] - h[j]) <= 0) break;
+ h[(j + 1) % n] - h[j]) <= 0) break;
j = (j + 1) % n;
}}
return result;
diff --git a/geometry/circle.cpp b/geometry/circle.cpp
index f49ea27..fd52a0b 100644
--- a/geometry/circle.cpp
+++ b/geometry/circle.cpp
@@ -1,7 +1,7 @@
// berechnet die Schnittpunkte von zwei kreisen
// (Kreise dürfen nicht gleich sein!)
vector<pt> circleIntersection(pt c1, double r1,
- pt c2, double r2) {
+ pt c2, double r2) {
double d = abs(c1 - c2);
if (d < abs(r1 - r2) || d > abs(r1 + r2)) return {};
double a = (r1 * r1 - r2 * r2 + d * d) / (2 * d);
@@ -15,7 +15,7 @@ vector<pt> circleIntersection(pt c1, double r1,
// berechnet die Schnittpunkte zwischen
// einem Kreis(Kugel) und einer Grade 2d und 3d
vector<pt> circleRayIntersection(pt center, double r,
- pt orig, pt dir) {
+ pt orig, pt dir) {
vector<pt> result;
double a = dot(dir, dir);
double b = 2 * dot(dir, orig - center);
diff --git a/geometry/closestPair.cpp b/geometry/closestPair.cpp
index 7462dc0..552eb0c 100644
--- a/geometry/closestPair.cpp
+++ b/geometry/closestPair.cpp
@@ -4,12 +4,12 @@ double squaredDist(pt a, pt b) {
bool compY(pt a, pt b) {
return (imag(a) == imag(b)) ? real(a) < real(b)
- : imag(a) < imag(b);
+ : imag(a) < imag(b);
}
bool compX(pt a, pt b) {
return (real(a) == real(b)) ? imag(a) < imag(b)
- : real(a) < real(b);
+ : real(a) < real(b);
}
double shortestDist(vector<pt>& pts) { // pts.size() > 1
@@ -21,7 +21,7 @@ double shortestDist(vector<pt>& pts) { // pts.size() > 1
while (right != pts.end()) {
if (left != right &&
- abs(real(*left - *right)) >= sqrtOpt) {
+ abs(real(*left - *right)) >= sqrtOpt) {
status.erase(*left);
left++;
} else {
diff --git a/geometry/convexHull.cpp b/geometry/convexHull.cpp
index 9245acc..b1de170 100644
--- a/geometry/convexHull.cpp
+++ b/geometry/convexHull.cpp
@@ -1,7 +1,7 @@
vector<pt> convexHull(vector<pt> pts){
sort(all(pts), [](const pt& a, const pt& b){
return real(a) == real(b) ? imag(a) < imag(b)
- : real(a) < real(b);
+ : real(a) < real(b);
});
pts.erase(unique(all(pts)), pts.end());
int k = 0;
diff --git a/geometry/formulars3d.cpp b/geometry/formulars3d.cpp
index f527d57..65aba4a 100644
--- a/geometry/formulars3d.cpp
+++ b/geometry/formulars3d.cpp
@@ -6,8 +6,8 @@ double dot(pt3 a, pt3 b) {return a|b;}
// Kreuzprodukt
pt3 operator*(pt3 a, pt3 b) {return {a.y*b.z - a.z*b.y,
- a.z*b.x - a.x*b.z,
- a.x*b.y - a.y*b.x};}
+ a.z*b.x - a.x*b.z,
+ a.x*b.y - a.y*b.x};}
pt3 cross(pt3 a, pt3 b) {return a*b;}
// Länge von a
diff --git a/geometry/linesAndSegments.cpp b/geometry/linesAndSegments.cpp
index 9ed39c4..3a8ac02 100644
--- a/geometry/linesAndSegments.cpp
+++ b/geometry/linesAndSegments.cpp
@@ -2,11 +2,11 @@
bool lineSegmentIntersection(pt a, pt b, pt c, pt d) {
if (orientation(a, b, c) == 0 && orientation(a, b, d) == 0)
return pointOnLineSegment(a,b,c) ||
- pointOnLineSegment(a,b,d) ||
- pointOnLineSegment(c,d,a) ||
- pointOnLineSegment(c,d,b);
+ pointOnLineSegment(a,b,d) ||
+ pointOnLineSegment(c,d,a) ||
+ pointOnLineSegment(c,d,b);
return orientation(a, b, c) * orientation(a, b, d) <= 0 &&
- orientation(c, d, a) * orientation(c, d, b) <= 0;
+ orientation(c, d, a) * orientation(c, d, b) <= 0;
}
// Berechnet die Schnittpunkte der Strecken p0-p1 und p2-p3.
@@ -18,7 +18,7 @@ vector<pt> lineSegmentIntersection(pt p0, pt p1, pt p2, pt p3) {
double c = cross(p1 - p0, p0 - p2);
if (a < 0) {a = -a; b = -b; c = -c;}
if (b < -EPS || a-b < -EPS ||
- c < -EPS || a-c < -EPS) return {};
+ c < -EPS || a-c < -EPS) return {};
if (a > EPS) return {p0 + b/a*(p1 - p0)};
vector<pt> result;
auto insertUnique = [&](pt p) {
diff --git a/geometry/polygon.cpp b/geometry/polygon.cpp
index 8acd591..ef70fb5 100644
--- a/geometry/polygon.cpp
+++ b/geometry/polygon.cpp
@@ -35,7 +35,7 @@ bool inside(pt p, const vector<pt>& hull) {
void rotateMin(vector<pt>& hull) {
auto mi = min_element(all(hull), [](const pt& a, const pt& b){
return real(a) == real(b) ? imag(a) < imag(b)
- : real(a) < real(b);
+ : real(a) < real(b);
});
rotate(hull.begin(), mi, hull.end());
}
diff --git a/geometry/segmentIntersection.cpp b/geometry/segmentIntersection.cpp
index c2961da..14b9586 100644
--- a/geometry/segmentIntersection.cpp
+++ b/geometry/segmentIntersection.cpp
@@ -4,7 +4,7 @@ struct seg {
bool operator<(const seg& o) const {
if (real(a) < real(o.a)) {
int s = orientation(a, b, o.a);
- return (s > 0 || (s == 0 && imag(a) < imag(o.a)));//
+ return (s > 0 || (s == 0 && imag(a) < imag(o.a)));
} else if (real(a) > real(o.a)) {
int s = orientation(o.a, o.b, a);
return (s < 0 || (s == 0 && imag(a) < imag(o.a)));
@@ -25,7 +25,7 @@ struct event {
bool lessPT(const pt& a, const pt& b) {
return real(a) != real(b) ? real(a) < real(b)
- : imag(a) < imag(b);
+ : imag(a) < imag(b);
}
bool intersect(const seg& a, const seg& b) {
diff --git a/geometry/sortAround.cpp b/geometry/sortAround.cpp
index a95d224..c5e4ebd 100644
--- a/geometry/sortAround.cpp
+++ b/geometry/sortAround.cpp
@@ -1,5 +1,5 @@
bool left(pt p) {return real(p) < 0 ||
- (real(p) == 0 && imag(p) < 0);}
+ (real(p) == 0 && imag(p) < 0);}
void sortAround(pt p, vector<pt>& ps) {
sort(all(ps), [&](const pt& a, const pt& b){
diff --git a/geometry/spheres.cpp b/geometry/spheres.cpp
index 0657ab8..01c54de 100644
--- a/geometry/spheres.cpp
+++ b/geometry/spheres.cpp
@@ -4,10 +4,10 @@ double gcDist(double pLat, double pLon,
pLat *= PI / 180; pLon *= PI / 180;
qLat *= PI / 180; qLon *= PI / 180;
return radius * acos(cos(pLat) * cos(pLon) *
- cos(qLat) * cos(qLon) +
- cos(pLat) * sin(pLon) *
- cos(qLat) * sin(qLon) +
- sin(pLat) * sin(qLat));
+ cos(qLat) * cos(qLon) +
+ cos(pLat) * sin(pLon) *
+ cos(qLat) * sin(qLon) +
+ sin(pLat) * sin(qLat));
}
// Great Cirlce Distance mit kartesischen Koordinaten.
diff --git a/geometry/triangle.cpp b/geometry/triangle.cpp
index fedc873..4dbd532 100644
--- a/geometry/triangle.cpp
+++ b/geometry/triangle.cpp
@@ -15,11 +15,11 @@ double area(double a, double b, double c) {
// Zentrum des Kreises durch alle Eckpunkte
pt outCenter(pt a, pt b, pt c) {
double d = 2.0 * (real(a) * imag(b-c) +
- real(b) * imag(c-a) +
- real(c) * imag(a-b));
+ real(b) * imag(c-a) +
+ real(c) * imag(a-b));
return (a*conj(a)*conj(b-c) +
- b*conj(b)*conj(c-a) +
- c*conj(c)*conj(a-b)) / d;
+ b*conj(b)*conj(c-a) +
+ c*conj(c)*conj(a-b)) / d;
}
// Zentrum des größten Kreises im Dreiecke
@@ -34,7 +34,7 @@ pt inCenter(pt a, pt b, pt c) {
// zweite Zeile testet Ähnlichkeit mit verschiedener Orientierung
bool similar (pt a1, pt b1, pt c1, pt a2, pt b2, pt c2) {
return ((b2-a2) * (c1-a1) == (b1-a1) * (c2-a2) ||
- (b2-a2) * (conj(c1)-conj(a1)) == (conj(b1)-conj(a1))
- * (c2-a2)
+ (b2-a2) * (conj(c1)-conj(a1)) == (conj(b1)-conj(a1))
+ * (c2-a2)
);
}
diff --git a/graph/TSP.cpp b/graph/TSP.cpp
index 0f72766..856107f 100644
--- a/graph/TSP.cpp
+++ b/graph/TSP.cpp
@@ -12,7 +12,7 @@ void TSP() {
for (int g = 0; g < n; g++) {
if (g != c && !((1 << g) & v)) {
if ((dp[g][(v | (1 << g))].dist + dist[c][g]) <
- dp[c][v].dist) {
+ dp[c][v].dist) {
dp[c][v].dist =
dp[g][(v | (1 << g))].dist + dist[c][g];
dp[c][v].to = g;
@@ -22,7 +22,7 @@ void TSP() {
vector<int> tour; tour.push_back(0); int v = 0;
while (tour.back() != 0 || sz(tour) == 1)
tour.push_back(dp[tour.back()]
- [(v |= (1 << tour.back()))].to);
+ [(v |= (1 << tour.back()))].to);
// Enthält Knoten 0 zweimal. An erster und letzter Position.
// return tour;
}
diff --git a/graph/bellmannFord.cpp b/graph/bellmannFord.cpp
index 21c7dbe..730cad2 100644
--- a/graph/bellmannFord.cpp
+++ b/graph/bellmannFord.cpp
@@ -5,14 +5,14 @@ void bellmannFord(int n, vector<edge> edges, int start) {
for (int i = 1; i < n; i++) {
for (edge& e : edges) {
if (dist[e.from] != INF &&
- dist[e.from] + e.cost < dist[e.to]) {
+ dist[e.from] + e.cost < dist[e.to]) {
dist[e.to] = dist[e.from] + e.cost;
parent[e.to] = e.from;
}}}
for (edge& e : edges) {
if (dist[e.from] != INF &&
- dist[e.from] + e.cost < dist[e.to]) {
+ dist[e.from] + e.cost < dist[e.to]) {
// Negativer Kreis gefunden.
}}
//return dist, parent;
diff --git a/graph/bitonicTSPsimple.cpp b/graph/bitonicTSPsimple.cpp
index ff605d9..4bd5ef3 100644
--- a/graph/bitonicTSPsimple.cpp
+++ b/graph/bitonicTSPsimple.cpp
@@ -12,7 +12,7 @@ double get(int p1, int p2) {
void bitonicTour() {
dp = vector<vector<double>>(sz(dist),
- vector<double>(sz(dist), -1));
+ vector<double>(sz(dist), -1));
get(0, 0);
// return dp[0][0]; // Länger der Tour
vector<int> lr = {0}, rl = {0};
diff --git a/graph/blossom.cpp b/graph/blossom.cpp
index cc19a2b..b3983ad 100644
--- a/graph/blossom.cpp
+++ b/graph/blossom.cpp
@@ -6,7 +6,7 @@ struct GM {
int head, tail;
GM(int n) : adjlist(n), pairs(n + 1, n), first(n + 1, n),
- que(n), label(n + 1, {-1, -1}) {}
+ que(n), label(n + 1, {-1, -1}) {}
void rematch(int v, int w) {
int t = pairs[v]; pairs[v] = w;
@@ -23,7 +23,7 @@ struct GM {
int findFirst(int u) {
return label[first[u]].first < 0 ? first[u]
- : first[u] = findFirst(first[u]);
+ : first[u] = findFirst(first[u]);
}
void relabel(int x, int y) {
diff --git a/graph/connect.cpp b/graph/connect.cpp
index 28a6f6c..b29e0e1 100644
--- a/graph/connect.cpp
+++ b/graph/connect.cpp
@@ -24,7 +24,7 @@ struct connect {
void eraseEdge(ll id) {
if (connected(edges[id].first, edges[id].second) &&
lct.query(&lct.nodes[edges[id].first],
- &lct.nodes[edges[id].second]) == id) {
+ &lct.nodes[edges[id].second]) == id) {
lct.cut(&lct.nodes[edges[id].first], &lct.nodes[id + n]);
lct.cut(&lct.nodes[edges[id].second], &lct.nodes[id + n]);
}}
diff --git a/graph/cycleCounting.cpp b/graph/cycleCounting.cpp
index 800f27e..b64b230 100644
--- a/graph/cycleCounting.cpp
+++ b/graph/cycleCounting.cpp
@@ -45,7 +45,7 @@ struct cylces {
if (cur[i]) {
cur[i] = false;
if (findSet(edges[i].first) ==
- findSet(edges[i].second)) break;
+ findSet(edges[i].second)) break;
unionSets(edges[i].first, edges[i].second);
}}
return cur.none();
diff --git a/graph/dinicScaling.cpp b/graph/dinicScaling.cpp
index 1b58d29..5dc06d6 100644
--- a/graph/dinicScaling.cpp
+++ b/graph/dinicScaling.cpp
@@ -26,7 +26,7 @@ bool bfs() {
for (int id : adjlist[cur]) {
int to = edges[id].to;
if (dist[to] < 0 &&
- edges[id ^ 1].c - edges[id ^ 1].f >= lim) {
+ edges[id ^ 1].c - edges[id ^ 1].f >= lim) {
dist[to] = dist[cur] - 1;
q.push(to);
}}}
@@ -40,7 +40,7 @@ bool dfs(int v, ll flow) {
for (; pt[v] < sz(adjlist[v]); pt[v]++) {
int id = adjlist[v][pt[v]], to = edges[id].to;
if (dist[to] == dist[v] + 1 &&
- edges[id].c - edges[id].f >= flow) {
+ edges[id].c - edges[id].f >= flow) {
if (dfs(to, flow)) {
edges[id].f += flow;
edges[id ^ 1].f -= flow;
diff --git a/graph/havelHakimi.cpp b/graph/havelHakimi.cpp
index 9fb9846..135c4b0 100644
--- a/graph/havelHakimi.cpp
+++ b/graph/havelHakimi.cpp
@@ -4,7 +4,7 @@ vector<vector<int>> havelHakimi(const vector<int>& deg) {
vector<vector<int>> adj;
while (!pq.empty()) {
auto v = pq.top(); pq.pop();
- if (sz(pq) < v.first) return {}; //ERROR
+ if (sz(pq) < v.first) return {}; //impossible
vector<pair<int, int>> todo;
for (int i = 0; i < v.first; i++) {
auto u = pq.top(); pq.pop();
diff --git a/graph/hopcroftKarp.cpp b/graph/hopcroftKarp.cpp
index 132b249..c205ccf 100644
--- a/graph/hopcroftKarp.cpp
+++ b/graph/hopcroftKarp.cpp
@@ -22,7 +22,7 @@ bool bfs(int n) {
bool dfs(int u) {
for (int v : adjlist[u]) {
if (pairs[v] < 0 ||
- (dist[pairs[v]] > dist[u] && dfs(pairs[v]))) {
+ (dist[pairs[v]] > dist[u] && dfs(pairs[v]))) {
pairs[v] = u; pairs[u] = v;
return true;
}}
diff --git a/graph/maxWeightBipartiteMatching.cpp b/graph/maxWeightBipartiteMatching.cpp
index e7e186e..5eda19b 100644
--- a/graph/maxWeightBipartiteMatching.cpp
+++ b/graph/maxWeightBipartiteMatching.cpp
@@ -55,5 +55,5 @@ double match(int l, int r) {
}}
// Wert des Matchings
return accumulate(all(lx), 0.0) +
- accumulate(all(ly), 0.0);
+ accumulate(all(ly), 0.0);
}
diff --git a/graph/minCostMaxFlow.cpp b/graph/minCostMaxFlow.cpp
index ee8aa10..46d444c 100644
--- a/graph/minCostMaxFlow.cpp
+++ b/graph/minCostMaxFlow.cpp
@@ -37,7 +37,7 @@ struct MinCostFlow {
for (int id : adjlist[cur]) {
int to = edges[id].to;
if (edges[id].f > 0 &&
- dist[to] > dist[cur] + edges[id].cost) {
+ dist[to] > dist[cur] + edges[id].cost) {
dist[to] = dist[cur] + edges[id].cost;
pref[to] = cur; con[to] = id;
if (!inqueue[to]) {
diff --git a/graph/pushRelabel3.cpp b/graph/pushRelabel3.cpp
index d4d2e67..bdbe0a5 100644
--- a/graph/pushRelabel3.cpp
+++ b/graph/pushRelabel3.cpp
@@ -17,7 +17,7 @@ void addEdge(int from, int to, ll c) {
void addFlow(int id, ll f) {
if (ec[edges[id].to] == 0 && f > 0)
- hs[H[edges[id].to]].push_back(edges[id].to);
+ hs[H[edges[id].to]].push_back(edges[id].to);
edges[id].f += f;
edges[id^1].f -= f;
ec[edges[id].to] += f;
@@ -45,7 +45,7 @@ ll maxFlow(int s, int t) {
for (int i = 0; i < sz(adjlist[u]); i++) {
int id = adjlist[u][i];
if (edges[id].c - edges[id].f > 0 &&
- H[u] > H[edges[id].to] + 1) {
+ H[u] > H[edges[id].to] + 1) {
H[u] = H[edges[id].to] + 1;
cur[u] = i;
}}
diff --git a/java/bigInteger.java b/java/bigInteger.java
index 28490bf..7aeb885 100644
--- a/java/bigInteger.java
+++ b/java/bigInteger.java
@@ -1,20 +1,20 @@
// Berechnet this +,*,/,- val.
BigInteger add(BigInteger val), multiply(BigInteger val),
- divide(BigInteger val), substract(BigInteger val)
-
-// Berechnet this^e.
-BigInteger pow(BigInteger e)
+ divide(BigInteger val), substract(BigInteger val)
// Bit-Operationen.
BigInteger and(BigInteger val), or(BigInteger val), xor(BigInteger val),
- not(), shiftLeft(int n), shiftRight(int n)
+ not(), shiftLeft(int n), shiftRight(int n)
// Berechnet den ggT von abs(this) und abs(val).
BigInteger gcd(BigInteger val)
+// Berechnet this^e.
+BigInteger pow(BigInteger e)
+
// Berechnet this mod m, this^-1 mod m, this^e mod m.
BigInteger mod(BigInteger m), modInverse(BigInteger m),
- modPow(BigInteger e, BigInteger m)
+ modPow(BigInteger e, BigInteger m)
// Berechnet die nächste Zahl, die größer und wahrscheinlich prim ist.
BigInteger nextProbablePrime()
@@ -22,4 +22,4 @@ BigInteger nextProbablePrime()
// Berechnet int/long/float/double-Wert.
// Ist die Zahl zu großen werden die niedrigsten Bits konvertiert.
int intValue(), long longValue(),
-float floatValue(), double doubleValue() \ No newline at end of file
+float floatValue(), double doubleValue()
diff --git a/java/output.java b/java/output.java
index a068d8d..9249807 100644
--- a/java/output.java
+++ b/java/output.java
@@ -1,7 +1,7 @@
//gepufferter nicht autoatischer flushender output
PrintWriter out = new PrintWriter(new BufferedWriter(
- new OutputStreamWriter(new FileOutputStream(
- FileDescriptor.out), StandardCharsets.UTF_8), 4096));
+ new OutputStreamWriter(new FileOutputStream(
+ FileDescriptor.out), StandardCharsets.UTF_8), 4096));
out.println("blub" + "a" + "b"); //zeile Ausgeben
out.println(String.format("%d %s", 5, "a")) // wie printf
out.close();//WICHTIG! \ No newline at end of file
diff --git a/math/bigint.cpp b/math/bigint.cpp
index 1753200..f8e3507 100644
--- a/math/bigint.cpp
+++ b/math/bigint.cpp
@@ -86,8 +86,7 @@ struct bigint {
ll s2 = r.a.size() <= b.a.size() - 1 ? 0 : r.a[b.a.size() - 1];
ll d = (base * s1 + s2) / b.a.back();
r -= b * d;
- while (r < 0)
- r += b, --d;
+ while (r < 0) r += b, --d;
q.a[i] = d;
}
q.sign = a1.sign * b1.sign;
diff --git a/math/longestIncreasingSubsequence.cpp b/math/longestIncreasingSubsequence.cpp
index 357ebcd..a4a8211 100644
--- a/math/longestIncreasingSubsequence.cpp
+++ b/math/longestIncreasingSubsequence.cpp
@@ -3,7 +3,7 @@ vector<int> lis(vector<int> &seq) {
vector<int> L(n), L_id(n), parents(n);
for (int i = 0; i < n; i++) {
int pos = upper_bound(L.begin(), L.begin() + lisLength,
- seq[i]) - L.begin();
+ seq[i]) - L.begin();
L[pos] = seq[i];
L_id[pos] = i;
parents[i] = pos ? L_id[pos - 1] : -1;
diff --git a/math/millerRabin.cpp b/math/millerRabin.cpp
index fc9385a..2ec608b 100644
--- a/math/millerRabin.cpp
+++ b/math/millerRabin.cpp
@@ -1,6 +1,6 @@
constexpr ll bases32[] = {2, 7, 61};
constexpr ll bases64[] = {2, 325, 9375, 28178, 450775,
- 9780504, 1795265022};
+ 9780504, 1795265022};
bool isPrime(ll n) {
if(n < 2 || n % 2 == 0) return n == 2;
diff --git a/math/piLehmer.cpp b/math/piLehmer.cpp
index 37eff6b..4d1780f 100644
--- a/math/piLehmer.cpp
+++ b/math/piLehmer.cpp
@@ -16,7 +16,7 @@ void init() {
memoB[i] = primes[i - 1] * memoB[i - 1];
for(ll j = 1; j <= cacheA; j++) {
memoA[j][i] = memoA[j][i - 1] - memoA[j /
- primes[i - 1]][i - 1];
+ primes[i - 1]][i - 1];
}}}
ll phi(ll n, ll k) {
diff --git a/math/rho.cpp b/math/rho.cpp
index bd30902..4579a01 100644
--- a/math/rho.cpp
+++ b/math/rho.cpp
@@ -1,7 +1,7 @@
ll rho(ll n) { // Findet Faktor < n, nicht unbedingt prim.
if (n % 2 == 0) return 2;
ll c = rand() % n, x = rand() % n, y = x, d = 1;
- // mulmod or int128
+ // mulmod or int128
auto f = [&](ll x){return ((x * x) % n + c) % n;};
while (d == 1) {
x = f(x); y = f(f(y));
diff --git a/math/squfof.cpp b/math/squfof.cpp
index 8a11a77..78bca73 100644
--- a/math/squfof.cpp
+++ b/math/squfof.cpp
@@ -1,10 +1,10 @@
using lll = __int128;
constexpr lll multipliers[] = {1, 3, 5, 7,
- 11, 3*5, 3*7, 3*11,
- 5*7, 5*11, 7*11,
- 3*5*7, 3*5*11, 3*7*11,
- 5*7*11, 3*5*7*11};
+ 11, 3*5, 3*7, 3*11,
+ 5*7, 5*11, 7*11,
+ 3*5*7, 3*5*11, 3*7*11,
+ 5*7*11, 3*5*7*11};
lll root(lll x) {
lll r = sqrtl(x);
diff --git a/other/bitOps.cpp b/other/bitOps.cpp
index 9666187..d1ace9a 100644
--- a/other/bitOps.cpp
+++ b/other/bitOps.cpp
@@ -1,7 +1,7 @@
// Iteriert über alle Teilmengen einer Bitmaske
// (außer der leeren Menge).
for (int subset = bitmask; subset > 0;
- subset = (subset - 1) & bitmask)
+ subset = (subset - 1) & bitmask)
// Zählt Anzahl der gesetzten Bits.
int numberOfSetBits(int i) {
diff --git a/string/ahoCorasick.cpp b/string/ahoCorasick.cpp
index bfde5b6..41bd788 100644
--- a/string/ahoCorasick.cpp
+++ b/string/ahoCorasick.cpp
@@ -5,7 +5,7 @@ struct AhoCorasick {
int suffix, exit, character, parent;
vector<int> nxt, patterns;
vert(int c, int p) : suffix(-1), exit(-1),
- character(c), nxt(ALPHABET_SIZE, -1), parent(p) {}
+ character(c), nxt(ALPHABET_SIZE, -1), parent(p) {}
};
vector<vert> aho;
@@ -29,7 +29,7 @@ struct AhoCorasick {
if (aho[v].suffix == -1) {
if (v == 0 || aho[v].parent == 0) aho[v].suffix = 0;
else aho[v].suffix = go(getSuffix(aho[v].parent),
- aho[v].character);
+ aho[v].character);
}
return aho[v].suffix;
}
diff --git a/string/manacher.cpp b/string/manacher.cpp
index a1cf2da..209896b 100644
--- a/string/manacher.cpp
+++ b/string/manacher.cpp
@@ -15,7 +15,7 @@ void manacher() {
int i2 = 2 * center - i;
longest[i] = (last > i) ? min(last - i, longest[i2]) : 0;
while (i + longest[i] + 1 < n && i - longest[i] - 1 >= 0 &&
- b[i + longest[i] + 1] == b[i - longest[i] - 1]) {
+ b[i + longest[i] + 1] == b[i - longest[i] - 1]) {
longest[i]++;
}
if (i + longest[i] > last) {
diff --git a/string/rollingHash.cpp b/string/rollingHash.cpp
index 2185207..da534a1 100644
--- a/string/rollingHash.cpp
+++ b/string/rollingHash.cpp
@@ -5,7 +5,7 @@ struct Hasher {
vector<ll> power = {1}, pref = {0};
ll m, q; char c;
Hasher(const string& s, ll m, ll q, char c) :
- m(m), q(q), c(c) {
+ m(m), q(q), c(c) {
for (char x : s) {
power.push_back(power.back() * q % m);
pref.push_back((pref.back() * q % m + (x - c)) % m);
diff --git a/string/suffixArray.cpp b/string/suffixArray.cpp
index 2650d72..3494a0b 100644
--- a/string/suffixArray.cpp
+++ b/string/suffixArray.cpp
@@ -6,12 +6,12 @@ struct SuffixArray {
SuffixArray(const string& s) : n(sz(s)) {
SA.resize(n); LCP.resize(n); L.resize(n);
- P.assign(ceil(log2(n)) + 1, vector<int>(n));
+ P.assign(__ln(n)*4-2, vector<int>(n));
for (int i = 0; i < n; i++) P[0][i] = s[i];
for (step = 1, count = 1; count < n; step++, count *= 2) {
for (int i = 0; i < n; i++)
L[i] = {{P[step-1][i],
- i+count < n ? P[step-1][i+count] : -1}, i};
+ i+count < n ? P[step-1][i+count] : -1}, i};
sort(all(L));
for (int i = 0; i < n; i++) {
P[step][L[i].second] =
diff --git a/string/suffixTree.cpp b/string/suffixTree.cpp
index f96992e..7af3ee6 100644
--- a/string/suffixTree.cpp
+++ b/string/suffixTree.cpp
@@ -64,7 +64,7 @@ struct SuffixTree {
break;
}
int split = newVert(tree[nxt].start,
- tree[nxt].start + curLen);
+ tree[nxt].start + curLen);
tree[curVert].next[s[curEdge]] = split;
int leaf = newVert(pos, sz(s));
tree[split].next[s[pos]] = leaf;
@@ -78,6 +78,6 @@ struct SuffixTree {
curEdge = pos - remainder + 1;
} else {
curVert = tree[curVert].suffix ? tree[curVert].suffix
- : root;
+ : root;
}}}
}; \ No newline at end of file