Skip to content

Templates for competitive programming and their Sublime Text tab-trigger

Notifications You must be signed in to change notification settings

utkarsh512/CP-Playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sublime-Text Snippets - Getting the most out of the repository

Copy the files inside sublime-snippets directory to C:\Users\{username}\AppData\Roaming\Sublime Text 3\Packages\User to enable tab triggers in Sublime-Text.

Tab triggers to be used

Number Theory

  • modular: Handling modular integers
  • matrix: Matrix with binary exponentiation utility
  • monoid: Storing floating points in p/q format
  • totient: Euler totient function (for given integer only)
  • totient_sieve: Computing totient function for 1, 2, ..., n
  • spf: Sieve of smallest prime factors
  • primes: Getting all the primes number within given upper bound

Data structures

  • dsu: Disjoint union-find data structure
  • pbds: Priority-based data structures
  • fenwick: Fenwick tree for prefix sums
  • sparse_table: Sparse table
  • Advanced Queues

    • min_queue: Get minimum in queue in constant time
    • max_queue: Get maximum in queue in constant time
  • Segment Tree

    • segtree: Segment tree (without lazy propagation)
    • lazy_segtree: Segment tree (with lazy propagation)
  • Sqrt Decomposition

    • mo1: Query structure for Mo's algorithm
    • mo2: For updating range to current query

String Algorithms

  • z_function: Computing Z-values
  • prefix_function: Computing prefix function
  • string_hash: Rabin-karp hashing
  • Trie

    • trie: Trie of strings
    • trie_bit: Trie of bits

Graph Theory

  • centroid: Centroid of each subtree in a tree
  • diameter: Diameter of a tree
  • scc: Kosaraju' algorithm for strongly connected components
  • digraph: Directed graphs with edges over a range (See this)
  • LCA

    • lca: Computing lca using rmq
    • lca_binarylift: Computing lca using binary lift
    • lca_seg: Computing lca using segment tree
  • Heavy-light decomposition

    • hld_point: HLD decomposition considering point updates
    • hld_range: HLD decomposition considering range updates

Geometry

  • point: 2d points
  • line_int: 2d straight lines
  • line_double: 2d straight lines
  • dynamic_hull: Finding optimal ax + b for given x using convex hull trick

Debugging

  • debug: Debugging utility (except __int128 integers and static arrays)
  • pr: Debugging utility for __int128 integers and static arrays

Other References for Competitive Programming

About

Templates for competitive programming and their Sublime Text tab-trigger

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages