A tool to quickly create codeforces contest directories with templates.

Overview

Codeforces Template Tool

I created this tool to help me quickly set up codeforces contests/singular problems with templates.

Tested for windows, should work on linux or any other operating system.

Installation

Clone the repository with git.

git clone [email protected]:com/AnotherTwinkle/cftool.git

Now, navigate to the cftool directory with and install it with pip-

cd cftool
pip install .

Note that Python 3.8 was used to test this script. This should run on 3.4+.

Usage

After installation, the tool should be available anywhere on your CLI. The script has 4 commands you can use.

Creating Singular Files

To create a singular file, use this command-

cftool problem [filename] [?template]

where template is optional. Note that the file name must end with an appropriate language file extension.

For example-

cftool problem 843A.py fastio

The script infers the language from the filename and searches for the template file in the directory templates/{lang}/ directory. Then, it creates a file called [filename]in the current working directory and pastes the template code for you to use.

If the template language directory or the template file doesn't exist, [filename] will be empty on creation.

If you don't provide the template argument, the script will use the default template in the language directory.

Creating a directory for a singular problem

If you'd like to be organized and have invidiual directories for each solution you write, you can use the problemdir command.

cftool problemdir [name] [language] [?template] [?--notes]

Note how you need to explicitly state the language. More precisely, you are telling the script to look for the [language] directory in templates/.

cftool problemdir 433A cpp fastio --notes

This will create a directory called 433A and intialize a file called sol.cpp with the fastio template for C++ in there.

template is still optional. The --notes flag, if provided, will create a file called notes.txt in the directory.

Creating a contest directory

This is peharps the only reason I wrote this script.

cftool contest [name] [language] [problemcount] [?template] [?--notes]

This commands creates a codeforces contest directory. The command syntax is almost simillar to problemdir with the added problemcount argument.

cftool contest 768DivA cpp 6 fastio --notes

This creates a directory called 768DivA and, following codeforces naming scheme, puts 6 files named A, B, C, D, E, F (from A to the problemcount-th letter of the alphabet) respectively. problemcount cannot exceed 26.

The directory name can have multiple words, in that case you put quotes around the name.

cftool contest "696 Div B" py 5 default --notes

This command also supports exclusion of the template argument and --notes flag.

Creating a contest directory with problem directories

This command has the same syntax as contest, but instead of creating files, it creates a directory for each problem, each having a file called sol.

cftool contestwpdir "593 Div 3" cpp 8 fastio --notes

Note: The command name is shorthand for contest with problem directory, this should help you remember the name.

Adding your own templates

If you have a better, or a personal template you'd like to use, you can do so.

First, create a new directory in the templates/ directory of the script. The name of this directory must be the file extension your language uses. i.e py, cpp, js etc. There already are some premade directories.

Next, create a file called default in the directory with your language extension (i.e default.cpp or default.py). This is template used by the script when the template argument is not provided. You can leave this file empty if you want.

Now to add a template, create a file with the desired name (The language extension must be included with filename)

Once you are done, you need to reinstall the script. Navigate to the directory with the setup.py file and run-

pip install .

If all went well you should be able to access the template now, i.e-

cftool problem test.java myshinyjavatemplate

Executable?

I plan making a the script a binary executable in the future, so you don't need python installed to run it.

Contributing

It'd be greatly appreciated if you PR useful templates to the project. If you use the script, consider starring it so more people can find it.

Owner
I like programming, exploring and you.
This is an implementation of PEP 557, Data Classes.

This is an implementation of PEP 557, Data Classes. It is a backport for Python 3.6. Because dataclasses will be included in Python 3.7, any discussio

Eric V. Smith 561 Dec 06, 2022
Bring A Trailer(BAT) is a popular online auction website for enthusiast cars. This traverse auction results and saves them as CSV

BaT Data Grabber Bring A Trailer(BAT) is a popular online auction website for enthusiast cars. This traverse auction results and saves them as CSV Bri

Elliot Weil 2 Oct 31, 2021
From "fixed RAnDom CRashes" to "[FIX] Fixed random crashes."

Clean Commit From fixed RAnDom CRashes to [FIX] Fixed random crashes. Clean commit helps you by auto-formating your commits to make your repos better

Mathias 3 Dec 26, 2021
A shim for the typeshed changes in mypy 0.900

types-all A shim for the typeshed changes in mypy 0.900 installation pip install types-all why --install-types is annoying, this installs all the thin

Anthony Sottile 28 Oct 20, 2022
This is a python package to get wards, districts,cities and provinces in Zimbabwe

Zim-Places Features This is a python package that allows you to search for cities, provinces, and districts in Zimbabwe.Zimbabwe is split into eight p

RONALD KANYEPI 2 Mar 01, 2022
A corona information module

A corona information module

Fayas Noushad 3 Nov 28, 2021
Object-data mapper and advanced query manager for non relational databases

Object data mapper and advanced query manager for non relational databases. The data is owned by different, configurable back-end databases and it is

Luca Sbardella 121 Aug 11, 2022
Coinloggr - A learning resource and social platform for the coin collecting community

Coinloggr A learning resource and social platform for the coin collecting commun

John Galiszewski 1 Jan 10, 2022
Combines power of torch, numerical methods to conquer and solve ALL {O,P}DEs

torch_DE_solver Combines power of torch, numerical methods and math overall to conquer and solve ALL {O,P}DEs There are three examples to provide a li

Natural Systems Simulation Lab 28 Dec 12, 2022
[arXiv 2020] Video Representation Learning with Visual Tempo Consistency

Video Representation Learning with Visual Tempo Consistency [Paper] [Project Page] News Full codebae is coming soon Pretained Models For now, we provi

DeciForce: Crossroads of Machine Perception and Autonomy 24 Nov 23, 2022
A tool to nowcast quarterly data with monthly indicators: US consumption example

MIDAS_Nowcaster A tool to nowcast quarterly data with monthly indicators: US consumption example Pulls data directly from FRED from a list of codes -

Gene Kindberg-Hanlon 3 Oct 06, 2022
Allow you to create you own custom decentralize job management system.

ants Allow you to create you own custom decentralize job management system. Install $ git clone https://github.com/hvuhsg/ants.git Run monitor exampl

1 Feb 15, 2022
A reproduction repo for a Scheduling bug in AirFlow 2.2.3

A reproduction repo for a Scheduling bug in AirFlow 2.2.3

Ilya Strelnikov 1 Feb 09, 2022
Statistics Calculator module for all types of Stats calculations.

Statistics-Calculator This Calculator user the formulas and methods to find the statistical values listed. Statistics Calculator module for all types

2 May 29, 2022
Pre-commit hook for upgrading type hints

This is a pre-commit hook configured to automatically upgrade your type hints to the new native types implemented in PEP 585.

snok 54 Nov 14, 2022
Ice Skating Simulator for Winter and Christmas [yay]

Ice Skating Simulator for Winter and Christmas [yay]

1 Aug 21, 2022
北大选课网2021年春季验证码识别

北大选课网验证码识别 2021 年春季学期 Powered by Elector Quartet (@Rabbit, @xmcp, @SpiritedAwayCN, @gzz) 数据集描述 最初的数据集为 5130 张人工标记的验证码,之后利用早期训练好的模型在选课网上进行自动验证 (自举),又收集

Rabbit 27 Sep 17, 2022
Statically typed BNF with semantic actions; A frontend of frontend frameworks; Use your grammar everywhere.

Statically typed BNF with semantic actions; A frontend of frontend frameworks; Use your grammar everywhere.

Taine Zhao 56 Dec 14, 2022
The Open edX platform, the software that powers edX!

This is the core repository of the Open edX software. It includes the LMS (student-facing, delivering courseware), and Studio (course authoring) compo

edX 6.2k Jan 01, 2023
This repository provides a set of easy to understand and tested Python samples for using Acronis Cyber Platform API.

Base Acronis Cyber Platform API operations with Python !!! info Copyright © 2019-2021 Acronis International GmbH. This is distributed under MIT licens

Acronis International GmbH 3 Aug 11, 2022