In this repository, you'll see my solutions for programming/security challenges/contest sites. Here you can find my solutions for:
- Beecrowd
- Codeforces
- CSES Problem Set
- Facebook Hacker Cup
- GeeksForGeeks
- Google Code Jam
- OverTheWire
- Project Euler
- Rosalind
- SPOJ-br
- SPOJ
- UVA
make install-git-hook
make run FOLDER=solutions/beecrowd/1000 ENVIRONMENTS='py'
make lint ENVIRONMENTS='py'
make testENVIRONMENTS is a space-separated list of file extensions matching the
Docker images in .docker/ (for example: py, cpp, clj).
When omitted, tasks that support it run for all supported languages.
The following tasks are available in the Makefile:
make add-missing FOLDER=path/to/add-missing [ENVIRONMENTS='language extensions'] # add missing language solutions
make check-tags # verify if all tag files have content describing the type of the problem
make check-wrongs # verify if WRONG files have content explaining which solution is failing and why
make clean # remove files created by the run task
make count-solutions # show numbers of solutions in different languages per problem folder
make get-easiest-problems # list all complete beecrowd problems sorted by the sum of number of lines (requires install-git-hook)
make get-easiest-problems WIP=true # same as above, but limited to uncommitted beecrowd problems
make install-git-hook # install the post-commit hook used to keep get-easiest-problems cache up to date
make lint [ENVIRONMENTS='language extensions'] # check lint for all solutions if no ENVIRONMENTS is passed
make lint-fix [ENVIRONMENTS='language extensions'] # format all code if no ENVIRONMENTS is passed
make new-problem FOLDER=path/to/new-problem ENVIRONMENTS='language extensions' # create solution scaffold
make run [FOLDER=path/to/run] [ENVIRONMENTS='language extensions'] # run solutions
make test # run the test suite using clitest
make wrong # show all solutions that are not complete yet
Some of these tasks run scripts on the scripts folder and Docker containers from the .docker folder. These tasks require Docker; Docker Compose is only needed when running SQL solutions.
If you are starting your repo to store your solutions for programming competitions from scratch, you can use the same structure I have used. You'll need to copy the following folders and files:
.clang-format.clj-kondo/.clojure/.docker/.editorconfig.flake8.github.gitignore.isort.cfg.shellcheckrcMakefilescripts/tests/tsconfig.json
The scripts/CI assume a few things:
- You use a folder for each problem;
- Each problem folder has a
README.mdfile. CI scripts use this file to search for problems; - Problem folders may have an
in.txtfile. That file holds the input test for that problem. Some problems don't have input; - Each problem folder has an
out.txtfile. That file holds expected output to test (using diff) output generated by your program; - All scripts ignore solutions whose folder holds a file named
WRONG. You can create this flag file for solutions that aren't completed yet.
Below, you can see an example of a problem folder structure:
$ tree solutions/beecrowd/
solutions/beecrowd/
├── 1000
│ ├── 1000.c # C
│ ├── 1000.clj # Clojure
│ ├── 1000.cpp # C++
│ ├── 1000.cs # C#
│ ├── 1000.dart # Dart
│ ├── 1000.exs # Elixir
│ ├── 1000.go # Go
│ ├── 1000.hs # Haskell
│ ├── 1000.java # Java
│ ├── 1000.jl # Julia
│ ├── 1000.js # JavaScript
│ ├── 1000.kt # Kotlin
│ ├── 1000.lua # Lua
│ ├── 1000.ml # OCaml
│ ├── 1000.pas # Pascal
│ ├── 1000.php # PHP
│ ├── 1000.py # Python
│ ├── 1000.r # R
│ ├── 1000.rb # Ruby
│ ├── 1000.rs # Rust
│ ├── 1000.scala # Scala
│ ├── 1000.sql # SQL
│ ├── 1000.ts # TypeScript
│ ├── imgs
│ │ └── UOJ_1000.png
│ ├── out.txt
│ ├── README.md
│ └── tags.txt
...