CPLib is the abbreviation of Competitive Programming Library.

Related tags

Miscellaneous cplib
Overview

CPLib

CPLib is the abbreviation of Competitive Programming Library. It aims to be a general template and optimization library for competitive programming.

The idea is similar to cLay, but I hope it to be easier to maintain, having less hard-coded rules, and C++ compatible. Also, I want to implement some optimizations, such as loop-blocking/unrolling, auto SIMD, etc. on the source code level.

Templates proposal

General templates are not implemented yet. I want to implement in cLay like formats (see https://codeforces.com/contest/1556/submission/127359517 for example).

I hope the templates can use global arrays (for example, the array in segment tree) instead of struct members. Also, I want to use global functions as callback functions (for example, the maintain function in segment tree). If we use std::function or function pointers, the running speed depends on how smart is the compiler.

To pass these arguments into the templates, I think pragmas is a good idea (see the modint part below for more information).

Implemented packages

Currently there are very few implemented packages.

math.modint

This package implements a typical modint template. It allows common operations, but it's more efficient.

It traversals each expression, computes the possible min/max of them, and finds a method which has mininum number of modulo.

See examples/modint/ for examples.

util.inline

This package can inline functions on source code level. Add #pragma cplib inline in front of your function, every call will be inline.

See examples/inline/ for examples.

util.minimize

This package tries to minimize the code. However, it only detects repeating segments, and replace them using macro definitions.

Usage

Download Clava at https://github.com/specs-feup/clava, and fill the path into src/config.py.

Install python packages from src/requirements.txt.

Then you can run python src/compile.py input.cpp -o output.cpp to "compile" files.

You need to add include to your IDE's include paths to make IDE happy.

To include a package, use #include "cplib/xxx/xxx.hpp" or #pragma cplib use xxx.xxx.

Others

If you have some ideas about the template proposals, or the project, please open issues.

This project is very immature, and needs a lot of time to develop, welcome for your contribute.

Clava runs very slow (~5s on my computer for a regular source code), if there is better replacement, please tell me!

You might also like...
Python Programming Bootcamp

python-bootcamp Python Programming Bootcamp Begin: 27th August 2021 End: 8th September 2021 Registration deadline: 22nd August 2021 Fees: No course or

100 Days of Python Programming

100 days of Python Following the initiative of my friend Helber Belmiro, who is almost done with his 100 days of Java, I have decided to start my 100

The Official interpreter for the Pix programming language.
The Official interpreter for the Pix programming language.

The official interpreter for the Pix programming language. Pix Pix is a programming language dedicated to readable syntax and usability Q) Is Pix the

A topology optimization framework written in Taichi programming language, which is embedded in Python.
A topology optimization framework written in Taichi programming language, which is embedded in Python.

Taichi TopOpt (Under Active Development) Intro A topology optimization framework written in Taichi programming language, which is embedded in Python.

PyGo custom language, New but similar language programming

New but similar language programming. Now we are capable to program in a very similar language to Python but at the same time get the efficiency of Go.

An esoteric programming language that supports concurrency, regex, and web requests.

The Hofstadter Esoteric Programming Language Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's La

🚀 emojimash 🚀 is a programming language with ALL THE EMOJI

🚀 emojimash 🚀 is a programming language with ALL THE EMOJI

Object-oriented programming exercise session held in Petnica.

OOP vežba ⚠️ The code in this repo is used for a OOP practice session held in Petnica. All instructions in the README file are written in Serbian. Ops

Nook is a simple, concatenative programming language written in Python.

Nook Nook is a simple, concatenative programming language written in Python. Status Nook is currently WIP. It lacks a lot of basic feature, and will n

Owner
null
Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls

guess-the-numbers Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls Number guessing game

Amir Hussein Sharifnezhad 5 Oct 9, 2021
Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls

password-generator Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls Password generator

Amir Hussein Sharifnezhad 3 Oct 9, 2021
This is a library to do functional programming in Python.

Fpylib This is a library to do functional programming in Python. Index Fpylib Index Features Intelligents Ranges with irange Lazyness to functions Com

Fabián Vega Alcota 4 Jul 17, 2022
Short, introductory guide for the Python programming language

100 Page Python Intro This book is a short, introductory guide for the Python programming language.

Sundeep Agarwal 185 Dec 26, 2022
《practical python programming》的中文翻译

欢迎光临 大约 25 年前,当我第一次学习 Python 时,发现 Python 竟然可以被高效地应用到各种混乱的工作项目上,我立即被震惊了。15 年前,我自己也将这种乐趣教授给别人。教学的结果就是本课程——一门实用的学习 Python的课程。

编程人 125 Dec 17, 2022
Source code for Learn Programming: Python

This repository contains the source code of the game engine behind Learn Programming: Python. The two key files are game.py (the main source of the ga

Niema Moshiri 25 Apr 24, 2022
Rick Astley Language is a rick roll oriented, dynamic, strong, esoteric programming language.

Rick Roll Language / Rick Astley Language A rick roll oriented, dynamic, strong, esoteric programming language. Prolegomenon The reasons that I made t

Rick Roll Programming Language 658 Jan 9, 2023
sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character.

ꦱꦮ sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character. sawa iku

Rony Lantip 307 Jan 7, 2023
The Zig programming language, packaged for PyPI

Zig PyPI distribution This repository contains the script used to repackage the releases of the Zig programming language as Python binary wheels. This

Zig Programming Language 100 Nov 4, 2022
Programming labs for 6.S060 (Foundations of Computer Security).

6.S060 Labs This git repository contains the code for the labs in 6.S060. In these labs, you will add a series of security features to a photo-sharing

MIT PDOS 10 Nov 2, 2022