Skip to main content

A helper for contests in Python 3

Project description

FastSnake

Python Package Pypi License Platforms Python Version

Tired of having to copy-paste your library code into every solution you write? FastSnake is a command-line tool that allows you to easily create, expand, run and test Python solutions for competitive programming problems.

This project provides useful CLI tools for competitive programming, such as algorithms and data structures, and tools for Codeforces. But you will have to write your own code and library for the problems you want to solve.

Installing FastSnake:

$ pip install FastSnake

Basic Usage:

Starting a contest from Codeforces...

$ fastsnake codeforces -sc <contest_id>

Note: The contest ID can be found at contest URL https://codeforces.com/contest/<id>

Once you have written your solution, test it.

$ fastsnake test <problem>

You can also create your own generator, at test_generators folder, to bruteforce your solution.

$ fastsnake test <problem> -g <n_tests>

Algorithms and Structures

FastSnake provides some algorithms and structures that can be injected to your final solution. See the sample below:

Python Solution:

from fastsnake.algorithms.min_coins import *

coins = []

for x in input().split():
    coins.append(int(x))

value = int(input())

result = min_coins(coins, value)
print(result)

Use the argument --list <algorithms | structures> to see all algorithms and structures provided by FastSnake.

Injecting the algorithm to the final solution...

$ fastsnake compile main.py

Check out the code of the generated Python module.

Testing and Compiling:

You may test and compile your solution using the command below:

$ fastsnake test <problem> -c

If the solution was accepted at all test cases, it will be compiled.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastsnake-1.4.2.tar.gz (15.9 kB view hashes)

Uploaded Source

Built Distribution

fastsnake-1.4.2-py3-none-any.whl (16.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page