Skip to content

simonsejse/competitive-programming

Repository files navigation

🌟 Competitive Programming Repository

Table of Contents

πŸ”— Kattis Profile

Visit my Kattis profile

  • Repository Purpose: This repository contains solutions to competitive programming problems, primarily from Kattis.
  • Language Used: C++ and Python (could add this to CI/CD later)
  • Auto-updated Statistics:

Total problems solved: 102

Note that the table below is auto-generated. There might be slight inaccuracies.

Problem Name Problem ID Difficulty Languages
addingtrouble.cpp addingtrouble 1.3 cpp
airfaregrants.cpp airfaregrants 1.2 cpp
aleidibio.cpp aleidibio 1.1 cpp
ameriskur.py ameriskur 1.3 py
autori.cpp autori 1.2 cpp
avoidingtheabyss.cpp avoidingtheabyss 2.7 cpp
bela.cpp bela 1.4 cpp
bergmal.cpp bergmal 1.2 cpp
bestagjofin.cpp bestagjofin 1.2 - 1.3 cpp
bijele.cpp bijele 1.3 cpp
bitteeinbit.cpp bitteeinbit 1.3 cpp
bladra2.cpp bladra2 1.2 cpp
blandadbest.cpp blandadbest 1.2 cpp
callforproblems.cpp callforproblems 1.3 cpp
carrots.cpp carrots 1.3 cpp
chanukah.cpp chanukah 1.3 cpp
coffeecupcombo.cpp coffeecupcombo 1.5 cpp
cold.cpp cold 1.3 cpp
composedrhythms.cpp composedrhythms 1.4 cpp
convertingromans.cpp convertingromans 3.8 cpp
cosmicpathoptimization.cpp cosmicpathoptimization 1.3 cpp
countthevowels.cpp countthevowels 1.3 cpp
dagatal.cpp dagatal 1.3 cpp
decimaldeletion.cpp decimaldeletion 1.3 cpp
detaileddifferences.cpp detaileddifferences 1.4 cpp
dfyrirdreki.cpp dfyrirdreki 1.3 - 1.4 cpp
dicecup.py dicecup 1.4 py
diehard.cpp diehard 3.1 cpp
digitswap.cpp digitswap 1.2 cpp
dragafra.cpp dragafra 1.1 cpp
echoechoecho.cpp echoechoecho 1.2 cpp
ekkidaudi.cpp ekkidaudi 1.4 cpp
everywhere.cpp everywhere 1.4 cpp
fifa.cpp fifa 1.1 cpp
fimmtudagstilbod.cpp fimmtudagstilbod 1.2 - 1.4 cpp
findingana.cpp findingana 1.2 cpp
fjoldibokstafa.cpp fjoldibokstafa 1.1 - 1.4 cpp
flatbokuveisla.cpp flatbokuveisla 1.2 cpp
flytibaka.cpp flytibaka 1.4 cpp
fyi.cpp fyi 1.3 cpp
greetings2.cpp greetings2 1.3 cpp
heroesofvelmar.cpp heroesofvelmar 2.1 cpp
hipphipp.cpp hipphipp 1.1 cpp
hipphipphurra.cpp hipphipphurra 1.2 cpp
hissingmicrophone.cpp hissingmicrophone 1.3 cpp
hradgreining.cpp hradgreining 1.1 - 1.2 cpp
infinitecash.py infinitecash 7.0 py
isithalloween.cpp isithalloween 1.3 cpp
isyavowel.cpp isyavowel 1.3 cpp
jackolanternjuxtaposition.cpp jackolanternjuxtaposition 1.2 cpp
jumbojavelin.cpp jumbojavelin 1.3 cpp
keysphonewallet.cpp keysphonewallet 1.3 cpp
kikiboba.cpp kikiboba 1.1 - 1.3 cpp
kinahvisl.cpp kinahvisl 1.2 - 1.4 cpp
knightpacking.cpp knightpacking 1.3 cpp
knittingpattern.cpp knittingpattern 3.0 cpp
kvedja.cpp kvedja 1.1 cpp
lastfactorialdigit.cpp lastfactorialdigit 1.3 cpp
leggjasaman.cpp leggjasaman 1.2 cpp
leynithjonusta.cpp leynithjonusta 1.1 - 1.3 cpp
lubbilaerir.cpp lubbilaerir 1.1 cpp
meddelande.cpp meddelande 1.3 - 1.4 cpp
metronome.cpp metronome 1.1 cpp
millifaersla.cpp millifaersla 1.2 cpp
modulo.cpp modulo 1.4 cpp
monopol.cpp monopol 1.3 - 1.4 cpp
nastyhacks.cpp nastyhacks 1.3 cpp
nsum.cpp nsum 1.2 cpp
oddecho.cpp oddecho 1.3 cpp
oddities.cpp oddities 1.3 cpp
ovissa.cpp ovissa 1.1 cpp
palindromes-custom-bitwise-op.cpp palindromes-custom-bitwise-op N/A cpp
qaly.cpp qaly 1.3 cpp
quadrant.cpp quadrant 1.2 cpp
r2.cpp r2 1.3 cpp
reduplikation.cpp reduplikation 1.1 cpp
reversebinary.cpp reversebinary 1.4 cpp
scrollingsign.cpp scrollingsign 3.0 cpp
shandy.cpp shandy 1.3 cpp
shortcuttowhat.cpp shortcuttowhat 1.2 cpp
simonsays.cpp simonsays 1.4 cpp
skak.cpp skak 1.3 cpp
skener.cpp skener 1.4 cpp
sorttwonumbers.cpp sorttwonumbers 1.3 cpp
sottkvi.cpp sottkvi 1.4 cpp
spritt.cpp spritt 1.3 cpp
storafmaeli.cpp storafmaeli 1.1 - 1.2 cpp
takkar.cpp takkar 1.1 - 1.2 cpp
takkfyrirmig.cpp takkfyrirmig 1.2 cpp
tarifa.cpp tarifa 1.3 cpp
tilhamingju.cpp tilhamingju 1.0 cpp
tilhamingju.py tilhamingju 1.0 py
timeloop.cpp timeloop 1.3 cpp
tolvunarfraedingartelja.cpp tolvunarfraedingartelja 1.1 cpp
triarea.cpp triarea 1.3 cpp
twostones.cpp twostones 1.2 cpp
twosum.cpp twosum 1.2 cpp
umferd.cpp umferd 1.2 - 1.3 cpp
vedurheidar.cpp vedurheidar 1.3 cpp
vidsnuningur.cpp vidsnuningur 1.2 cpp
whichisgreater.cpp whichisgreater 1.2 cpp
whichnumberkindisit2.cpp whichnumberkindisit2 1.3 cpp

πŸ“‚ Directory Structure

  • .github/workflows/: Contains automation scripts for CI/CD.
  • README.md: Contains project description and auto-generated stats.

πŸ”§ Setup: Auto Submit and Move

To automate Kattis submissions and organize accepted files:

πŸ› οΈ Steps

  1. Install Prerequisites:

    • Python: Download Python
    • Kattis CLI: Kattis CLI
    • Python Packages: pip install requests beautifulsoup4
    • Ensure you have a valid .kattisrc file in your home directory with your credentials. You can get it from here.
  2. Add submit_and_move.py:

  3. Configure VSCode Task: Add this to .vscode/tasks.json:

    {
      "version": "2.0.0",
      "tasks": [
        {
          "label": "Submit to Kattis",
          "type": "shell",
          "command": "python",
          "args": ["${workspaceFolder}/scripts/submit_and_move.py", "${file}"],
          "presentation": {
            "echo": true,
            "reveal": "always",
            "focus": true,
            "panel": "shared",
            "showReuseMessage": false,
            "clear": false,
            "close": true
          },
          "problemMatcher": []
        }
      ]
    }
  4. Setup Keybinding: Add to keybindings.json:

    [
      {
        "key": "numpad0",
        "command": "workbench.action.tasks.runTask",
        "args": "Submit to Kattis",
        "when": "editorTextFocus"
      }
    ]
  5. Create solutions Folder: Manually create the folder or the script will create it automatically.

  6. Submit Solution:

    • Keep unfinished solutions in the root directory. Open the solution file (e.g., kattisexercise.cpp), press numpad0, and it will automatically upload the solution to Kattis. If accepted, the script moves the file to the solutions folder.

πŸ“š Resources

πŸ”§ Setup: Auto-Create Problem Set

Automate the creation of problem sets using Competitive Companion. You can add it as a Google Chrome extension from the Chrome Web Store here.

πŸ”§ Setup: Folding for Template Files

  1. Install the Extension:
    Download the Auto Region Folder extension.

  2. Configure Settings:
    Add this to your settings.json to enable import folding by default:

    "editor.foldingImportsByDefault": true

    Now the template.cpp file will automatically fold the imports and core library definitions for a cleaner view.

πŸ”§ Setup: Auto CPH Judge with Competitive Companion

  1. Install Competitive Companion extension for Google Chrome.

  2. Configure settings.json:

    "cph.general.defaultLanguage": "cpp",
    "cph.general.defaultLanguageTemplateFileLocation": "C:\\Users\\simon\\dev\\GitHub\\competetive-programming\\templates\\template.cpp"
  3. Usage: Automatically fetch problems and use your custom C++ template.