Git Product home page Git Product logo

snippets's Introduction

What is this?

This is a collection of algorithms and data structures I use in programming contests.

The goal of every snippet is to be short, simple, performant, and easy to copy-paste into other programs whenever needed.

Note that the code is not necessarily pedantic nor easy to understand. Common good programming practices are intentionally violated. Global variables, misuse of namespaces, inconsistent variable names, weird hacks, etc. are all over the place, and that's OK.

What is included?

Strings:

Graphs:

Math:

Other:

How to use?

All snippets assume that you have the following predefined:

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long llint;

Just copy-paste any snippet in your code and follow instructions in comments.

Are these implementations correct?

Yes, they're very likely to be.

All snippets were tested in solutions to multiple programming problems, and used as a reference in two ACM-ICPC world finals.

Can I use these snippets in my code?

Yes, I don't mind.

Just make sure you understand the rules of competitions you participate in. Sometimes they require solutions to be fully written by yourself.

snippets's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.