\begin{thebibliography}{9} \bibitem{aho83} A. V. Aho, J. E. Hopcroft and J. Ullman. \emph{Data Structures and Algorithms}, Addison-Wesley, 1983. \bibitem{ahu91} R. K. Ahuja and J. B. Orlin. Distance directed augmenting path algorithms for maximum flow and parametric maximum flow problems. \emph{Naval Research Logistics}, 38(3):413--430, 1991. \bibitem{and79} A. M. Andrew. Another efficient algorithm for convex hulls in two dimensions. \emph{Information Processing Letters}, 9(5):216--219, 1979. \bibitem{asp79} B. Aspvall, M. F. Plass and R. E. Tarjan. A linear-time algorithm for testing the truth of certain quantified boolean formulas. \emph{Information Processing Letters}, 8(3):121--123, 1979. \bibitem{bel58} R. Bellman. On a routing problem. \emph{Quarterly of Applied Mathematics}, 16(1):87--90, 1958. \bibitem{bec07} M. Beck, E. Pine, W. Tarrat and K. Y. Jensen. New integer representations as the sum of three cubes. \emph{Mathematics of Computation}, 76(259):1683--1690, 2007. \bibitem{ben00} M. A. Bender and M. Farach-Colton. The LCA problem revisited. In \emph{Latin American Symposium on Theoretical Informatics}, 88--94, 2000. \bibitem{ben86} J. Bentley. \emph{Programming Pearls}. Addison-Wesley, 1999 (2nd edition). \bibitem{ben80} J. Bentley and D. Wood. An optimal worst case algorithm for reporting intersections of rectangles. \emph{IEEE Transactions on Computers}, C-29(7):571--577, 1980. \bibitem{bou01} C. L. Bouton. Nim, a game with a complete mathematical theory. \emph{Annals of Mathematics}, 3(1/4):35--39, 1901. % \bibitem{bur97} % W. Burnside. % \emph{Theory of Groups of Finite Order}, % Cambridge University Press, 1897. \bibitem{coci} Croatian Open Competition in Informatics, \url{http://hsin.hr/coci/} \bibitem{cod15} Codeforces: On ''Mo's algorithm'', \url{http://codeforces.com/blog/entry/20032} \bibitem{cor09} T. H. Cormen, C. E. Leiserson, R. L. Rivest and C. Stein. \emph{Introduction to Algorithms}, MIT Press, 2009 (3rd edition). \bibitem{dij59} E. W. Dijkstra. A note on two problems in connexion with graphs. \emph{Numerische Mathematik}, 1(1):269--271, 1959. \bibitem{dik12} K. Diks et al. \emph{Looking for a Challenge? The Ultimate Problem Set from the University of Warsaw Programming Competitions}, University of Warsaw, 2012. % \bibitem{dil50} % R. P. Dilworth. % A decomposition theorem for partially ordered sets. % \emph{Annals of Mathematics}, 51(1):161--166, 1950. % \bibitem{dir52} % G. A. Dirac. % Some theorems on abstract graphs. % \emph{Proceedings of the London Mathematical Society}, 3(1):69--81, 1952. \bibitem{dim15} M. Dima and R. Ceterchi. Efficient range minimum queries using binary indexed trees. \emph{Olympiad in Informatics}, 9(1):39--44, 2015. \bibitem{edm65} J. Edmonds. Paths, trees, and flowers. \emph{Canadian Journal of Mathematics}, 17(3):449--467, 1965. \bibitem{edm72} J. Edmonds and R. M. Karp. Theoretical improvements in algorithmic efficiency for network flow problems. \emph{Journal of the ACM}, 19(2):248--264, 1972. \bibitem{eve75} S. Even, A. Itai and A. Shamir. On the complexity of time table and multi-commodity flow problems. \emph{16th Annual Symposium on Foundations of Computer Science}, 184--193, 1975. \bibitem{fan94} D. Fanding. A faster algorithm for shortest-path -- SPFA. \emph{Journal of Southwest Jiaotong University}, 2, 1994. \bibitem{fen94} P. M. Fenwick. A new data structure for cumulative frequency tables. \emph{Software: Practice and Experience}, 24(3):327--336, 1994. \bibitem{fis06} J. Fischer and V. Heun. Theoretical and practical improvements on the RMQ-problem, with applications to LCA and LCE. In \emph{Annual Symposium on Combinatorial Pattern Matching}, 36--48, 2006. \bibitem{flo62} R. W. Floyd Algorithm 97: shortest path. \emph{Communications of the ACM}, 5(6):345, 1962. \bibitem{for56a} L. R. Ford. Network flow theory. RAND Corporation, Santa Monica, California, 1956. \bibitem{for56} L. R. Ford and D. R. Fulkerson. Maximal flow through a network. \emph{Canadian Journal of Mathematics}, 8(3):399--404, 1956. \bibitem{fre77} R. Freivalds. Probabilistic machines can use less running time. In \emph{IFIP congress}, 839--842, 1977. \bibitem{gal14} F. Le Gall. Powers of tensors and fast matrix multiplication. In \emph{Proceedings of the 39th International Symposium on Symbolic and Algebraic Computation}, 296--303, 2014. \bibitem{gar79} M. R. Garey and D. S. Johnson. \emph{Computers and Intractability: A Guide to the Theory of NP-Completeness}, W. H. Freeman and Company, 1979. \bibitem{goo17} Google Code Jam Statistics (2017), \url{https://www.go-hero.net/jam/17} \bibitem{gro14} A. Grønlund and S. Pettie. Threesomes, degenerates, and love triangles. In \emph{Proceedings of the 55th Annual Symposium on Foundations of Computer Science}, 621--630, 2014. \bibitem{gru39} P. M. Grundy. Mathematics and games. \emph{Eureka}, 2(5):6--8, 1939. \bibitem{gus97} D. Gusfield. \emph{Algorithms on Strings, Trees and Sequences: Computer Science and Computational Biology}, Cambridge University Press, 1997. % \bibitem{hal35} % P. Hall. % On representatives of subsets. % \emph{Journal London Mathematical Society} 10(1):26--30, 1935. \bibitem{hal13} S. Halim and F. Halim. \emph{Competitive Programming 3: The New Lower Bound of Programming Contests}, 2013. \bibitem{hel62} M. Held and R. M. Karp. A dynamic programming approach to sequencing problems. \emph{Journal of the Society for Industrial and Applied Mathematics}, 10(1):196--210, 1962. \bibitem{hie73} C. Hierholzer and C. Wiener. Über die Möglichkeit, einen Linienzug ohne Wiederholung und ohne Unterbrechung zu umfahren. \emph{Mathematische Annalen}, 6(1), 30--32, 1873. \bibitem{hoa61a} C. A. R. Hoare. Algorithm 64: Quicksort. \emph{Communications of the ACM}, 4(7):321, 1961. \bibitem{hoa61b} C. A. R. Hoare. Algorithm 65: Find. \emph{Communications of the ACM}, 4(7):321--322, 1961. \bibitem{hop71} J. E. Hopcroft and J. D. Ullman. A linear list merging algorithm. Technical report, Cornell University, 1971. \bibitem{hor74} E. Horowitz and S. Sahni. Computing partitions with applications to the knapsack problem. \emph{Journal of the ACM}, 21(2):277--292, 1974. \bibitem{huf52} D. A. Huffman. A method for the construction of minimum-redundancy codes. \emph{Proceedings of the IRE}, 40(9):1098--1101, 1952. \bibitem{iois} The International Olympiad in Informatics Syllabus, \url{https://people.ksp.sk/~misof/ioi-syllabus/} \bibitem{kar87} R. M. Karp and M. O. Rabin. Efficient randomized pattern-matching algorithms. \emph{IBM Journal of Research and Development}, 31(2):249--260, 1987. \bibitem{kas61} P. W. Kasteleyn. The statistics of dimers on a lattice: I. The number of dimer arrangements on a quadratic lattice. \emph{Physica}, 27(12):1209--1225, 1961. \bibitem{ken06} C. Kent, G. M. Landau and M. Ziv-Ukelson. On the complexity of sparse exon assembly. \emph{Journal of Computational Biology}, 13(5):1013--1027, 2006. \bibitem{kle05} J. Kleinberg and É. Tardos. \emph{Algorithm Design}, Pearson, 2005. \bibitem{knu982} D. E. Knuth. \emph{The Art of Computer Programming. Volume 2: Seminumerical Algorithms}, Addison–Wesley, 1998 (3rd edition). \bibitem{knu983} D. E. Knuth. \emph{The Art of Computer Programming. Volume 3: Sorting and Searching}, Addison–Wesley, 1998 (2nd edition). % \bibitem{kon31} % D. Kőnig. % Gráfok és mátrixok. % \emph{Matematikai és Fizikai Lapok}, 38(1):116--119, 1931. \bibitem{kru56} J. B. Kruskal. On the shortest spanning subtree of a graph and the traveling salesman problem. \emph{Proceedings of the American Mathematical Society}, 7(1):48--50, 1956. \bibitem{lev66} V. I. Levenshtein. Binary codes capable of correcting deletions, insertions, and reversals. \emph{Soviet physics doklady}, 10(8):707--710, 1966. \bibitem{mai84} M. G. Main and R. J. Lorentz. An $O(n \log n)$ algorithm for finding all repetitions in a string. \emph{Journal of Algorithms}, 5(3):422--432, 1984. \bibitem{main} Młodzieżowa Akademia Informatyczna (MAIN), \texttt{http://main.edu.pl/} % \bibitem{ore60} % Ø. Ore. % Note on Hamilton circuits. % \emph{The American Mathematical Monthly}, 67(1):55, 1960. \bibitem{pac13} J. Pachocki and J. Radoszewski. Where to use and how not to use polynomial string hashing. \emph{Olympiads in Informatics}, 7(1):90--100, 2013. \bibitem{par97} I. Parberry. An efficient algorithm for the Knight's tour problem. \emph{Discrete Applied Mathematics}, 73(3):251--260, 1997. % \bibitem{pic99} % G. Pick. % Geometrisches zur Zahlenlehre. % \emph{Sitzungsberichte des deutschen naturwissenschaftlich-medicinischen Vereines % für Böhmen "Lotos" in Prag. (Neue Folge)}, 19:311--319, 1899. \bibitem{pea05} D. Pearson. A polynomial-time algorithm for the change-making problem. \emph{Operations Research Letters}, 33(3):231--234, 2005. \bibitem{pri57} R. C. Prim. Shortest connection networks and some generalizations. \emph{Bell System Technical Journal}, 36(6):1389--1401, 1957. % \bibitem{pru18} % H. Prüfer. % Neuer Beweis eines Satzes über Permutationen. % \emph{Arch. Math. Phys}, 27:742--744, 1918. \bibitem{q27} 27-Queens Puzzle: Massively Parallel Enumeration and Solution Counting. \url{https://github.com/preusser/q27} \bibitem{sha75} M. I. Shamos and D. Hoey. Closest-point problems. In \emph{Proceedings of the 16th Annual Symposium on Foundations of Computer Science}, 151--162, 1975. \bibitem{sha81} M. Sharir. A strong-connectivity algorithm and its applications in data flow analysis. \emph{Computers \& Mathematics with Applications}, 7(1):67--72, 1981. \bibitem{ski08} S. S. Skiena. \emph{The Algorithm Design Manual}, Springer, 2008 (2nd edition). \bibitem{ski03} S. S. Skiena and M. A. Revilla. \emph{Programming Challenges: The Programming Contest Training Manual}, Springer, 2003. \bibitem{spr35} R. Sprague. Über mathematische Kampfspiele. \emph{Tohoku Mathematical Journal}, 41:438--444, 1935. \bibitem{sta06} P. Stańczyk. \emph{Algorytmika praktyczna w konkursach Informatycznych}, MSc thesis, University of Warsaw, 2006. \bibitem{str69} V. Strassen. Gaussian elimination is not optimal. \emph{Numerische Mathematik}, 13(4):354--356, 1969. \bibitem{tar75} R. E. Tarjan. Efficiency of a good but not linear set union algorithm. \emph{Journal of the ACM}, 22(2):215--225, 1975. \bibitem{tar79} R. E. Tarjan. Applications of path compression on balanced trees. \emph{Journal of the ACM}, 26(4):690--715, 1979. \bibitem{tar84} R. E. Tarjan and U. Vishkin. Finding biconnected componemts and computing tree functions in logarithmic parallel time. In \emph{Proceedings of the 25th Annual Symposium on Foundations of Computer Science}, 12--20, 1984. \bibitem{tem61} H. N. V. Temperley and M. E. Fisher. Dimer problem in statistical mechanics -- an exact result. \emph{Philosophical Magazine}, 6(68):1061--1063, 1961. \bibitem{usaco} USA Computing Olympiad, \url{http://www.usaco.org/} \bibitem{war23} H. C. von Warnsdorf. \emph{Des Rösselsprunges einfachste und allgemeinste Lösung}. Schmalkalden, 1823. \bibitem{war62} S. Warshall. A theorem on boolean matrices. \emph{Journal of the ACM}, 9(1):11--12, 1962. % \bibitem{zec72} % E. Zeckendorf. % Représentation des nombres naturels par une somme de nombres de Fibonacci ou de nombres de Lucas. % \emph{Bull. Soc. Roy. Sci. Liege}, 41:179--182, 1972. \end{thebibliography}