-
Notifications
You must be signed in to change notification settings - Fork 16
/
eldiego.tex
462 lines (421 loc) · 15.7 KB
/
eldiego.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
% LaTeXar con :
% pdflatex eldiego.tex
%"The PDF file may contain up to 25 pages of reference material, single-sided, letter or A4 size, with text and illustrations readable by a person with correctable eyesight without magnification from a distance of 1/2 meter."
\input{preamble.tex}
\begin{document}
\def\title{Caloventor en Dos - Universidad Nacional de Rosario}
\centering{\includegraphics[width=3.5cm]{fotodiego}}
\tableofcontents\newpage
\section{algorithm}%%%%%%%%%%%%%%%%%%ALGORITHM%%%%%%%%%%%%%%%%%%
\input{algorithm.tex}
\section{Estructuras}%%%%%%%%%%%%%%%%%%ESTRUCTURAS%%%%%%%%%%%%%%%%%%
\subsection{RMQ (static)}
Dado un arreglo y una operacion asociativa \emph{idempotente}, get(i, j) opera sobre el rango [i, j). Restriccion: LVL $\ge$ ceil(logn); Usar [ ] para llenar arreglo y luego build().
\cppfile{estructuras/rmq.static.cpp}
\subsection{RMQ (dynamic)}
\cppfile{estructuras/rmq.dynamic.cpp}
\subsection{RMQ (lazy)}
\cppfile{estructuras/rmq.lazy.cpp}
\subsection{RMQ (persistente)}
\cppfile[23-53]{estructuras/rmq.persistent.cpp}
\subsection{Fenwick Tree}
\cppfile{estructuras/fenwick.cpp}
\subsection{Union Find}
\cppfile{grafos/union.find.cpp}
\subsection{Disjoint Intervals}
\cppfile{estructuras/disjoint.intervals.cpp}
\subsection{RMQ (2D)}
\cppfile{estructuras/rmq.2d.cpp}
\subsection{Big Int}
\cppfile{estructuras/bigint.cpp}
\subsection{HashTables}
\cppfile[16-30]{hash.cpp}
\subsection{Modnum}
\cppfile{estructuras/mnum.cpp}
\subsection{Treap para set}
\cppfile[16-89]{estructuras/treap.cpp}
\subsection{Treap para arreglo}
\cppfile[17-87]{estructuras/treaparr.cpp}
\subsection{Convex Hull Trick}
\cppfile[18-55]{estructuras/convexhull.trick.cpp}
\subsection{Convex Hull Trick (Dynamic)}
\cppfile[17-56]{estructuras/convexhull.trick.dyn.cpp}
\subsection{Gain-Cost Set}
\cppfile[20-43]{estructuras/gain-cost.set.cpp}
\subsection{Set con busq binaria}
\cppfile[17-26]{estructuras/order.tree.cpp}
\section{Algos}%%%%%%%%%%%%%%%%%%ALGORITMOS%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Longest Increasing Subsecuence}
\cppfile[14-42]{algos/lis.cpp}
\subsection{Alpha-Beta prunning}
\cppfile{algos/alphabeta.cpp}
\subsection{Mo's algorithm}
\cppfile{algos/mosalgorithm.cpp}
\section{Strings}%%%%%%%%%%%%%%%%%%STRINGS%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Manacher}
\cppfile[18-37]{string/manacher.cpp}
\subsection{KMP}
\cppfile[21-43]{string/kmp.cpp}
\subsection{Trie}
\cppfile{string/trie.cpp}
%\subsection{Suffix Array (corto, nlog2n)}
%\cppfile[12-26]{string/suffix.array.short.cpp}
\subsection{Suffix Array (largo, nlogn)}
\cppfile[-34]{string/suffix.array.cpp}
\subsection{String Matching With Suffix Array}
\cppfile[37-58]{string/suffix.array.cpp}
\subsection{LCP (Longest Common Prefix)}
\cppfile[60-75]{string/suffix.array.cpp}
\subsection{Corasick}
\cppfile[16-55]{string/corasick.cpp}
\subsection{Suffix Automaton}
\cppfile[16-61]{string/suffix.automaton.cpp}
\subsection{Z Function}
\cppfile[17-30]{string/zfunction.cpp}
\section{Geometria}%%%%%%%%%%%%%%%%%%GEOMETRIA%%%%%%%%%%%%%%%%%%%%%%
\subsection{Punto}
\cppfile[2-33]{geometria/pto.cpp}
\subsection{Orden radial de puntos}
\cppfile{geometria/orden.radial.cpp}
\subsection{Line}
\cppfile{geometria/line.cpp}
\subsection{Segment}
\cppfile{geometria/segm.cpp}
\subsection{Rectangle}
\cppfile{geometria/rect.cpp}
\subsection{Polygon Area}
\cppfile{geometria/area.cpp}
\subsection{Circle}
\cppfile{geometria/circle.cpp}
\subsection{Point in Poly}
\cppfile{geometria/point.in.poly.cpp}
\subsection{Point in Convex Poly log(n)}
\cppfile{geometria/point.in.convex.poly.cpp}
\subsection{Convex Check CHECK}
\cppfile{geometria/convex.check.cpp}
\subsection{Convex Hull}
\cppfile{geometria/convex.hull.cpp}
\subsection{Cut Polygon}
\cppfile{geometria/cut.polygon.cpp}
\subsection{Bresenham}
\cppfile{geometria/bresenham.cpp}
\subsection{Rotate Matrix}
\cppfile{geometria/rotate.cpp}
\subsection{Interseccion de Circulos en n3log(n)}
\cppfile{geometria/int.circs.cpp}
\section{Math}%%%%%%%%%%%%%%%%%%MATH%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Identidades}
{
$\sum_{i=0}^n\binom{n}{i}=2^n$
$\sum_{i=0}^n i\binom{n}{i}=n*2^{n-1}$
$\sum_{i=m}^n i = \frac{n(n+1)}{2} - \frac{m(m-1)}{2} = \frac{(n+1-m)(n+m)}{2}$
$\sum_{i=0}^n i = \sum_{i=1}^n i = \frac{n(n+1)}{2}$
$\sum_{i=0}^n i^2 = \frac{n(n+1)(2n+1)}{6} = \frac{n^3}{3} + \frac{n^2}{2} + \frac{n}{6}$
$\sum_{i=0}^n i(i-1) = \frac{8}{6}(\frac{n}{2})(\frac{n}{2}+1)(n+1)$ (doubles) $\rightarrow$ Sino ver caso impar y par
$\sum_{i=0}^n i^3 = \left(\frac{n(n+1)}{2}\right)^2 = \frac{n^4}{4} + \frac{n^3}{2} + \frac{n^2}{4} = \left[\sum_{i=1}^n i\right]^2$
$\sum_{i=0}^n i^4 = \frac{n(n+1)(2n+1)(3n^2+3n-1)}{30} = \frac{n^5}{5} + \frac{n^4}{2} + \frac{n^3}{3} - \frac{n}{30}$
$\sum_{i=0}^n i^p = \frac{(n+1)^{p+1}}{p+1} + \sum_{k=1}^p\frac{B_k}{p-k+1}{p\choose k}(n+1)^{p-k+1}$
$r=e-v+k+1$
Teorema de Pick: (Area, puntos interiores y puntos en el borde)
$A=I+\frac{B}{2}-1$
}%
\subsection{Ec. Caracteristica}
$a_0T(n)+a_1T(n-1)+...+a_kT(n-k)=0$
$p(x)=a_0 x^k + a_1 x^{k-1} + ... + a_k$
Sean $r_1,r_2,...,r_q$ las raíces distintas, de mult. $m_1, m_2, ..., m_q$
$T(n)=\sum_{i=1}^q{\sum_{j=0}^{m_i - 1}c_{ij} n^j r_i^n}$
Las constantes $c_{ij}$ se determinan por los casos base.
\subsection{Combinatorio}
\cppfile{math/combinatorio.cpp}
\subsection{Exp. de Numeros Mod.}
\cppfile[2]{math/exp.mod.cpp}
\subsection{Exp. de Matrices y Fibonacci en log(n)}
\cppfile{math/exp.mat.cpp}
\subsection{Matrices y determinante $O(n^3)$}
\cppfile[17-77]{math/determinante.cpp}
\subsection{Teorema Chino del Resto}
$$y=\sum_{j=1}^n (x_j*(\prod_{i=1, i\neq j}^n m_i)_{m_j}^{-1}*\prod_{i=1, i\neq j}^n m_i)$$
\subsection{Criba}
\cppfile[19-39]{math/criba.cpp}
\subsection{Funciones de primos}
Sea $n=\prod{p_i^{k_i}}$, fact(n) genera un map donde a cada $p_i$ le asocia su $k_i$
\cppfile[33-125]{math/func.primos.cpp}
\subsection{Phollard's Rho (rolando)}
\cppfile[16-84]{math/phollards.rho.cpp}
\subsection{GCD}
\begin{code}
tipo gcd(tipo a, tipo b){return a?gcd(b %a, a):b;}
\end{code}
\subsection{Extended Euclid}
\cppfile{math/extended.euclid.cpp}
\subsection{LCM}
\begin{code}
tipo lcm(tipo a, tipo b){return a / gcd(a,b) * b;}
\end{code}
\subsection{Inversos}
\cppfile[7-16]{math/inversos.cpp}
\subsection{Simpson}
\cppfile{math/simpson.cpp}
\subsection{Fraction}
\cppfile{math/frac.cpp}
\subsection{Polinomio}
\cppfile[22-91]{math/polinomio.cpp}
\subsection{Ec. Lineales}
\cppfile[29-62]{math/eclineales.cpp}
\subsection{FFT}
\cppfile[16-81]{math/fft.cpp}
\subsection{Tablas y cotas (Primos, Divisores, Factoriales, etc)}
%\subsubsection{
\paragraph{Factoriales} \ \\
\begin{tabular}{l|l}
0! = 1 & 11! = 39.916.800 \\
1! = 1 & 12! = 479.001.600 ($\in \mathtt{int}$)\\
2! = 2 & 13! = 6.227.020.800 \\
3! = 6 & 14! = 87.178.291.200 \\
4! = 24 & 15! = 1.307.674.368.000 \\
5! = 120 & 16! = 20.922.789.888.000 \\
6! = 720 & 17! = 355.687.428.096.000 \\
7! = 5.040 & 18! = 6.402.373.705.728.000 \\
8! = 40.320 & 19! = 121.645.100.408.832.000 \\
9! = 362.880 & 20! = 2.432.902.008.176.640.000 ($\in \mathtt{tint}$) \\
10! = 3.628.800 & 21! = 51.090.942.171.709.400.000
\end{tabular}
max signed tint = 9.223.372.036.854.775.807 \\
max unsigned tint = 18.446.744.073.709.551.615
%\subsubsection{
\paragraph{Primos} \ \\
2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 71
73 79 83 89 97 101 103 107 109 113
127 131 137 139 149 151 157 163 167 173
179 181 191 193 197 199 211 223 227 229
233 239 241 251 257 263 269 271 277 281
283 293 307 311 313 317 331 337 347 349
353 359 367 373 379 383 389 397 401 409
419 421 431 433 439 443 449 457 461 463
467 479 487 491 499 503 509 521 523 541
547 557 563 569 571 577 587 593 599 601
607 613 617 619 631 641 643 647 653 659
661 673 677 683 691 701 709 719 727 733
739 743 751 757 761 769 773 787 797 809
811 821 823 827 829 839 853 857 859 863
877 881 883 887 907 911 919 929 937 941
947 953 967 971 977 983 991 997 1009 1013
1019 1021 1031 1033 1039 1049 1051 1061 1063 1069
1087 1091 1093 1097 1103 1109 1117 1123 1129 1151
1153 1163 1171 1181 1187 1193 1201 1213 1217 1223
1229 1231 1237 1249 1259 1277 1279 1283 1289 1291
1297 1301 1303 1307 1319 1321 1327 1361 1367 1373
1381 1399 1409 1423 1427 1429 1433 1439 1447 1451
1453 1459 1471 1481 1483 1487 1489 1493 1499 1511
1523 1531 1543 1549 1553 1559 1567 1571 1579 1583
1597 1601 1607 1609 1613 1619 1621 1627 1637 1657
1663 1667 1669 1693 1697 1699 1709 1721 1723 1733
1741 1747 1753 1759 1777 1783 1787 1789 1801 1811
1823 1831 1847 1861 1867 1871 1873 1877 1879 1889
1901 1907 1913 1931 1933 1949 1951 1973 1979 1987
1993 1997 1999 2003 2011 2017 2027 2029 2039 2053
2063 2069 2081
%2083 2087 2089 2099 2111 2113 2129
%2131 2137 2141 2143 2153 2161 2179 2203 2207 2213
%2221 2237 2239 2243 2251 2267 2269 2273 2281 2287
%2293 2297 2309 2311 2333 2339 2341 2347 2351 2357
%2371 2377 2381 2383 2389 2393 2399 2411 2417 2423
%2437 2441 2447 2459 2467 2473 2477 2503 2521 2531
%2539 2543 2549 2551 2557 2579 2591 2593 2609 2617
%2621 2633 2647 2657 2659 2663 2671 2677 2683 2687
%2689 2693 2699 2707 2711 2713 2719 2729 2731 2741
%2749 2753 2767 2777 2789 2791 2797 2801 2803 2819
%2833 2837 2843 2851 2857 2861 2879 2887 2897 2903
%2909 2917 2927 2939 2953 2957 2963 2969 2971 2999
%3001 3011 3019 3023 3037 3041 3049 3061 3067 3079
%3083 3089 3109 3119 3121 3137 3163 3167 3169 3181
%3187 3191 3203 3209 3217 3221 3229 3251 3253 3257
%3259 3271 3299 3301 3307 3313 3319 3323 3329 3331
%3343 3347 3359 3361 3371 3373 3389 3391 3407 3413
%3433 3449 3457 3461 3463 3467 3469 3491 3499 3511
%3517 3527 3529 3533 3539 3541 3547 3557 3559 3571\\
\paragraph{Primos cercanos a $10^n$}\ \\
9941 9949 9967 9973 10007 10009 10037 10039 10061 10067 10069 10079\\
99961 99971 99989 99991 100003 100019 100043 100049 100057 100069\\
999959 999961 999979 999983 1000003 1000033 1000037 1000039\\
9999943 9999971 9999973 9999991 10000019 10000079 10000103 10000121\\
99999941 99999959 99999971 99999989 100000007 100000037 100000039 100000049\\
999999893 999999929 999999937 1000000007 1000000009 1000000021 1000000033
\paragraph{Cantidad de primos menores que $10^n$}\ \\
$\pi(10^1)$ = 4 ;
$\pi(10^2)$ = 25 ;
$\pi(10^3)$ = 168 ;
$\pi(10^4)$ = 1229 ;
$\pi(10^5)$ = 9592 \\
$\pi(10^6)$ = 78.498 ;
$\pi(10^7)$ = 664.579 ;
$\pi(10^8)$ = 5.761.455 ;
$\pi(10^9)$ = 50.847.534 \\
$\pi(10^{10})$ = 455.052,511 ;
$\pi(10^{11})$ = 4.118.054.813 ;
$\pi(10^{12})$ = 37.607.912.018% ;
%
% Fuente: http://primes.utm.edu/howmany.shtml#table
%
%
%\subsubsection{Divisores}
\paragraph{Divisores} \ \\
Cantidad de divisores ($\sigma_0$) para \emph{algunos} $n / \neg\exists n'<n, \sigma_0(n') \geqslant \sigma_0(n)$ \\
$\sigma_0(60)$ = 12 ; $\sigma_0(120)$ = 16 ; $\sigma_0(180)$ = 18 ; $\sigma_0(240)$ = 20 ; $\sigma_0(360)$ = 24 \\
$\sigma_0(720)$ = 30 ; $\sigma_0(840)$ = 32 ; $\sigma_0(1260)$ = 36 ; $\sigma_0(1680)$ = 40 ; $\sigma_0(10080)$ = 72 \\ $\sigma_0(15120)$ = 80 ; $\sigma_0(50400)$ = 108 ; $\sigma_0(83160)$ = 128 ; $\sigma_0(110880)$ = 144 \\
$\sigma_0(498960)$ = 200 ; $\sigma_0(554400)$ = 216 ; $\sigma_0(1081080)$ = 256 ; $\sigma_0(1441440)$ = 288 $\sigma_0(4324320)$ = 384 ; $\sigma_0(8648640)$ = 448
%
Suma de divisores ($\sigma_1$) para \emph{algunos} $n / \neg\exists n'<n, \sigma_1(n') \geqslant \sigma_1(n)$ \\
$\sigma_1(96)$ = 252 ; $\sigma_1(108)$ = 280 ; $\sigma_1(120)$ = 360 ; $\sigma_1(144)$ = 403 ; $\sigma_1(168)$ = 480 \\
$\sigma_1(960)$ = 3048 ; $\sigma_1(1008)$ = 3224 ; $\sigma_1(1080)$ = 3600 ; $\sigma_1(1200)$ = 3844 \\
$\sigma_1(4620)$ = 16128 ; $\sigma_1(4680)$ = 16380 ; $\sigma_1(5040)$ = 19344 ; $\sigma_1(5760)$ = 19890 \\
$\sigma_1(8820)$ = 31122 ; $\sigma_1(9240)$ = 34560 ; $\sigma_1(10080)$ = 39312 ; $\sigma_1(10920)$ = 40320 \\
$\sigma_1(32760)$ = 131040 ; $\sigma_1(35280)$ = 137826 ; $\sigma_1(36960)$ = 145152 ; $\sigma_1(37800)$ = 148800 \\
$\sigma_1(60480)$ = 243840 ; $\sigma_1(64680)$ = 246240 ; $\sigma_1(65520)$ = 270816 ; $\sigma_1(70560)$ = 280098 \\
$\sigma_1(95760)$ = 386880 ; $\sigma_1(98280)$ = 403200 ; $\sigma_1(100800)$ = 409448 \\
$\sigma_1(491400)$ = 2083200 ; $\sigma_1(498960)$ = 2160576 ; $\sigma_1(514080)$ = 2177280 \\
$\sigma_1(982800)$ = 4305280 ; $\sigma_1(997920)$ = 4390848 ; $\sigma_1(1048320)$ = 4464096 \\
$\sigma_1(4979520)$ = 22189440 ; $\sigma_1(4989600)$ = 22686048 ; $\sigma_1(5045040)$ = 23154768 \\
$\sigma_1(9896040)$ = 44323200 ; $\sigma_1(9959040)$ = 44553600 ; $\sigma_1(9979200)$ = 45732192
%
%
\section{Grafos}%%%%%%%%%%%%%%%%%%GRAFOS%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Dijkstra}
\cppfile{grafos/dijkstra.cpp}
\subsection{Bellman-Ford}
\cppfile{grafos/bellman.ford.cpp}
\subsection{Floyd-Warshall}
\cppfile{grafos/floyd.warshall.cpp}
\subsection{Kruskal}
\cppfile[27-41]{grafos/kruskal.cpp}
\subsection{Prim}
\cppfile[23-40]{grafos/prim.cpp}
\subsection{2-SAT + Tarjan SCC}
\cppfile{grafos/2sat.cpp}
\subsection{Articulation Points}
\cppfile{grafos/articulaciones.cpp}
\subsection{Comp. Biconexas y Puentes}
\cppfile[28-76]{grafos/biconexas.bridge.cpp}
\subsection{LCA + Climb}
\cppfile{grafos/lca.climb.cpp}
\subsection{Heavy Light Decomposition}
\cppfile[21-56]{grafos/heavylight.cpp}
\subsection{Centroid Decomposition}
\cppfile[17-36]{grafos/centroid.cpp}
\subsection{Euler Cycle}
\cppfile{grafos/euler.cpp}
\subsection{Diametro árbol}
\cppfile[17-48]{grafos/diametro.cpp}
\subsection{Chu-liu}
\cppfile{grafos/chuliu.cpp}
\subsection{Hungarian}
\cppfile[5-59]{grafos/hungarian.cpp}
\subsection{Dynamic Conectivity}
\cppfile[17-78]{grafos/dynamic.conectivity.cpp}
\section{Network Flow}%%%%%%%%%%%%%%%%%%FLOW%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Dinic}
\cppfile[10-76]{flow/dinic.cpp}
\subsection{Konig}
\cppfile[98-122]{flow/konig.cpp}
\subsection{Edmonds Karp's}
\cppfile{flow/edmonds.karps.cpp}
\subsection{Push-Relabel O(N3)}
\cppfile{flow/push.relabel.cpp}
\subsection{Min-cost Max-flow}
\cppfile[16-66]{flow/min.cost.max.flow.cpp}
\section{Template}%%%%%%%%%%%%%%%%%%TEMPLATE%%%%%%%%%%%%%%%%
\cppfile{template.cpp}
\section{Ayudamemoria}%%%%%%%%%%%%%%%%%%AYUDAMEMORIA%%%%%%%%%%%%%%%%
\subsection*{Cant. decimales}
\begin{code}
#include <iomanip>
cout << setprecision(2) << fixed;
\end{code}
\subsection*{Rellenar con espacios(para justificar)}
\begin{code}
#include <iomanip>
cout << setfill(' ') << setw(3) << 2 << endl;
\end{code}
\subsection*{Leer hasta fin de linea}
\begin{code}
#include <sstream>
//hacer cin.ignore() antes de getline()
while(getline(cin, line)){
istringstream is(line);
while(is >> X)
cout << X << " ";
cout << endl;
}
\end{code}
\subsection*{Aleatorios}
\begin{code}
#define RAND(a, b) (rand()%(b-a+1)+a)
srand(time(NULL));
\end{code}
\subsection*{Doubles Comp.}
\begin{code}
const double EPS = 1e-9;
x == y <=> fabs(x-y) < EPS
x > y <=> x > y + EPS
x >= y <=> x > y - EPS
\end{code}
\subsection*{Limites}
\begin{code}
#include <limits>
numeric_limits<T>
::max()
::min()
::epsilon()
\end{code}
\subsection*{Muahaha}
\begin{code}
#include <signal.h>
void divzero(int p){
while(true);}
void segm(int p){
exit(0);}
//in main
signal(SIGFPE, divzero);
signal(SIGSEGV, segm);
\end{code}
\subsection*{Mejorar velocidad}
\begin{code}
ios::sync_with_stdio(false);
\end{code}
\subsection*{Mejorar velocidad 2}
\begin{code}
//Solo para enteros positivos
inline void Scanf(int& a){
char c = 0;
while(c<33) c = getc(stdin);
a = 0;
while(c>33) a = a*10 + c - '0', c = getc(stdin);
}
\end{code}
\subsection*{Expandir pila}
\begin{code}
#include <sys/resource.h>
rlimit rl;
getrlimit(RLIMIT_STACK, &rl);
rl.rlim_cur=1024L*1024L*256L;//256mb
setrlimit(RLIMIT_STACK, &rl);
\end{code}
\subsection*{C++11}
\begin{code}
g++ --std=c++1
\end{code}
\subsection*{Leer del teclado}
\begin{code}
freopen("/dev/tty", "a", stdin);
\end{code}
\subsection*{Iterar subconjunto}
\begin{code}
for(int sbm=bm; sbm; sbm=(sbm-1)&bm)
\end{code}
\subsection*{File setup}
\begin{code}
//tambien se pueden usar comas: {a, x, m, l}
touch {a..l}.in; tee {a..l}.cpp < template.cpp
\end{code}
\end{document}