{"id":18023446,"url":"https://github.com/meooow25/haccepted","last_synced_at":"2025-03-26T23:31:06.639Z","repository":{"id":42173432,"uuid":"387835656","full_name":"meooow25/haccepted","owner":"meooow25","description":"Data structures and algorithms for competitive programming in Haskell","archived":false,"fork":false,"pushed_at":"2024-02-25T13:21:52.000Z","size":2245,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T17:23:31.285Z","etag":null,"topics":["algorithms","competitive-programming","data-structures","haskell"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meooow25.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-20T15:28:43.000Z","updated_at":"2024-12-23T08:24:24.000Z","dependencies_parsed_at":"2024-10-30T07:30:14.562Z","dependency_job_id":null,"html_url":"https://github.com/meooow25/haccepted","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meooow25%2Fhaccepted","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meooow25%2Fhaccepted/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meooow25%2Fhaccepted/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meooow25%2Fhaccepted/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meooow25","download_url":"https://codeload.github.com/meooow25/haccepted/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245753924,"owners_count":20666833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","competitive-programming","data-structures","haskell"],"created_at":"2024-10-30T07:09:31.059Z","updated_at":"2025-03-26T23:31:06.147Z","avatar_url":"https://github.com/meooow25.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# haccepted\n![Tests badge](https://github.com/meooow25/haccepted/actions/workflows/tests.yml/badge.svg)\n\u003ca href=\"/bench-out/bench-out.txt\"\u003e\u003cimg src=\"https://img.shields.io/badge/Benchmarks-here-green\" alt=\"Benchmarks badge\"\u003e\u003c/a\u003e\n\u003ca href=\"https://meooow25.github.io/haccepted/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Documentation-here-5e5184\" alt=\"Documentation badge\"\u003e\u003c/a\u003e\n\nData structures and algorithms for competitive programming in Haskell\n\n## About\nThis library contains data structures and algorithms primarily intended for use in\n[competitive programming](https://en.wikipedia.org/wiki/Competitive_programming). This means that,\nunlike a typical library, the source code in this library is meant to be looked at, copied, and\nmodified by anyone using it.\n\nIt is expected that the code in this library will be _correct_ and _fast_.\n* Property testing with [QuickCheck](https://hackage.haskell.org/package/QuickCheck) is used to\ncheck for correctness.\n* Benchmarking with [criterion](https://hackage.haskell.org/package/criterion) is used to ensure\ngood performance.\n\n**Disclaimer**: I'm new to Haskell. Feedback is welcome! :)\n\n### Haskell and competitive programming\n\u003cdetails\u003e\n\u003csummary\u003eExpand\u003c/summary\u003e\n\nCompetitive programming today is largely dominated by C++, followed by Python and Java, in spite of\nmany judges offering a large selection of languages to use. When I tried Haskell, I found it usually\nleads to short and neat solutions compared to typical imperative implementations. Other benefits of\nHaskell, like its ready-to-use abstractions and persistent-by-default data structures, are very nice\nto have.\n\nOf course, all this comes at a cost, the most important of which is speed. Simpler problems usually\npose no risk, but it is possible that, contrary to the title of this repo, complex algorithms when\nnot heavily optimized will be too slow to be accepted by an online judge.\n\nThat being said, I still find it enjoyable and worth the effort to solve problems using Haskell, and\nI hope you'll agree.\n\n\u003c/details\u003e\n\n### Functional style?\n\u003cdetails\u003e\n\u003csummary\u003eExpand\u003c/summary\u003e\n\nFunctional programming is fun, but sometimes mutable state is necessary for an efficient\nimplementation. Luckily, Haskell allows working with mutable state in the ST monad. So, I'm a little\nconflicted about the style that should be used in this library. Should the library as fast as\npossible but boring, using ST everywhere? Should it be as functional as possible, even at the cost\nof speed?  \nI feel the answer is somewhere in the middle, for now. So here are some loose rules I follow.\n- Functional style is preferred.\n- If functional style worsens the time complexity of an algorithm, ST is used.\n- Data structures are usually functional, making them persistent.\n- If an algorithm is simpler or a lot faster in the constant factor to implement in ST, ST is used.\n\n\u003c/details\u003e\n\n## Browsing\nAll source files are present in the [`src`](/src) directory. Each file has a header comment, usually\nwith four parts.\n1. An overview of the data structure or algorithm\n2. Sources that were referred to when implenting the data structure or algorithm\n3. Some notes about the implementation\n4. Descriptions and time complexities of the functions intended for external use\n\nWhen using as a black box, it suffices to only read 1 and 4.\n\nExample submissions are on the [Examples](https://github.com/meooow25/haccepted/wiki/Examples) page.  \nTests are found in the [`tests`](/tests) directory.  \nBenchmarks are in the [`bench`](/bench) directory. A benchmark summary file is at\n[`bench-out/bench-out.txt`](/bench-out/bench-out.txt).\n\n## Judges\nA non-exhaustive list of online judges that support Haskell submissions, with the available compiler\nversions at the time of writing.\n* CSES ([GHC 8.10.4](https://cses.fi/howto/))\n* Codeforces (GHC 8.10.1) \u003csub\u003e\u003csup\u003e(Not documented, the version is seen on the Submit page)\u003c/sup\u003e\u003c/sub\u003e\n* AtCoder ([GHC 8.8.3](https://atcoder.jp/contests/language-test-202001))\n* Kattis ([GHC 8.6.5](https://open.kattis.com/help/haskell))\n* Hackerrank ([GHC 8.6.5](https://support.hackerrank.com/hc/en-us/articles/1500002392722--Execution-Environment-and-Samples))\n* CodeChef ([GHC 8.0.1](https://www.codechef.com/wiki/list-compilers))\n* HackerEarth ([GHC 7.10.3](https://www.hackerearth.com/docs/wiki/developers/judge/))\n\nMost judges offer only the [Haskell Heirarchical Libraries](https://downloads.haskell.org/~ghc/latest/docs/html/libraries/),\nsome have additional libraries installed. See the respective links for details.\n\n## See also\nOther resources for competitive programming in Haskell\n- [Brent Yorgey's blog](https://byorgey.wordpress.com/)\n\n## License\nMIT. The license text need not be included for competitive programming.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeooow25%2Fhaccepted","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeooow25%2Fhaccepted","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeooow25%2Fhaccepted/lists"}