Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>CP Templates Pro - Competitive Programming Snippets & Template VaultNew to Visual Studio Code? Get it now.
CP Templates Pro - Competitive Programming Snippets & Template Vault

CP Templates Pro - Competitive Programming Snippets & Template Vault

kalpesh mahajan

|
2 installs
| (0) | Free
Fast boilerplate templates, custom template vault, and customizable keyboard shortcuts for Competitive Programming (C++, Python, Java, Rust).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CP Templates Pro 🚀

Fast boilerplate templates, custom template vault, and instant keyboard shortcuts for Competitive Programming (Codeforces, LeetCode, CodeChef, AtCoder, CSES).

Are you tired of copy-pasting your competitive programming boilerplates, setting up fast I/O, writing ios_base::sync_with_stdio(false), and typing while(t--) in every contest?

CP Templates Pro solves this once and for all. With one keyboard shortcut, insert your favorite competitive programming template, switch between algorithms (DSU, Segment Tree, PBDS), or create and manage your own custom templates directly inside VS Code!


✨ Features

  • ⚡ Instant Boilerplate Insertion: Insert clean, high-performance CP templates in 1 keypress.
  • ⌨️ Customizable Shortcuts:
    • Ctrl+Alt+T (Cmd+Alt+T on macOS): Browse & select templates from a searchable menu.
    • Ctrl+Alt+I (Cmd+Alt+I on macOS): Quick-insert your default template instantly without any menus!
    • Ctrl+Alt+N (Cmd+Alt+N on macOS): Create a new custom template from the selected code or file.
    • Ctrl+Alt+M (Cmd+Alt+M on macOS): Manage, edit, or delete your custom templates.
  • 🎨 Multiple Built-in Templates:
    • C++ Multi-Test (Standard): Fast I/O (cin.tie(nullptr)), int t; while(t--).
    • C++ Single-Test (Standard): For problems without multiple test cases.
    • C++ Advanced CP Boilerplate: Fast I/O, PBDS (ordered_set), typedefs (ll, vll, all()), ModInt, and debug macros.
    • C++ Disjoint Set Union (DSU / Kruskal): Path compression & union-by-rank.
    • C++ Segment Tree: Point update and range query.
    • Python 3 Fast I/O: sys.stdin.readline and increased recursion limit.
    • Java FastScanner: High-speed BufferedReader and PrintWriter.
    • Rust Fast I/O: Standard buffered reader and writer boilerplate.
  • 💾 Custom Template Vault:
    • Save any snippet or entire file as your personal template.
    • Seamlessly edit, duplicate, copy, or delete custom templates.
    • Export & Import templates as JSON to back them up or share them with friends.
  • 🧭 Visual Sidebar Explorer:
    • Browse your template library directly in the VS Code sidebar.
    • 1-click preview or insertion into the editor.
  • 🏷️ Dynamic Variables & Smart Cursor:
    • Automatically substitutes ${author}, ${date}, ${time}, ${filename}, and ${problem_name}.
    • Automatically places your cursor at ${cursor} inside the // code here block!

🚀 Quick Start

  1. Open or create any code file in VS Code (e.g. solution.cpp).
  2. Press Ctrl+Alt+I (Mac: Cmd+Alt+I) to instantly insert your default fast I/O multi-test template:
    #include <bits/stdc++.h>
    using namespace std;
    
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
        cout.tie(nullptr);
        int t;
        cin >> t;
        while (t--)
        {
            // code here
        }
        return 0;
    }
    
  3. Or press Ctrl+Alt+T (Mac: Cmd+Alt+T) to choose from the list of templates.

🛠️ How to Create Your Own Custom Template

  1. Write your favorite boilerplate or select code in any file.
  2. Press Ctrl+Alt+N (or open Command Palette Ctrl+Shift+P and type CP: Create New Custom Template).
  3. Select whether to use selected code, the entire file, or start blank.
  4. Give your template a name and choose the language.
  5. Your template is now permanently saved! You can insert it anytime via Ctrl+Alt+T or set it as your default template.

⌨️ Customizing Keyboard Shortcuts

You can easily change the shortcut keys to whatever you prefer:

  1. In VS Code, press Ctrl+K Ctrl+S (Mac: Cmd+K Cmd+S) to open Keyboard Shortcuts.
  2. Type Competitive Programming in the search bar.
  3. Right-click any command (e.g. CP: Quick Insert Default Template) and click Change Keybinding.
  4. Press your desired keys (e.g., F9, Ctrl+Shift+T, etc.) and press Enter!

⚙️ Extension Settings

This extension contributes the following settings (settings.json):

Setting Default Description
cpTemplates.authorName "" Your username/handle to replace ${author} in templates.
cpTemplates.defaultTemplateId "cpp-multi-test" The ID of the template inserted when pressing Ctrl+Alt+I.
cpTemplates.insertionMode "smart" Insertion behavior: "smart" (replaces whole file if blank, else inserts at cursor), "replaceWholeFile", or "insertAtCursor".

📦 Exporting & Importing Templates

Want to sync your templates across computers or share them with teammates?

  • Run CP: Export Custom Templates to JSON from the Command Palette to save your templates to a .json file.
  • Run CP: Import Custom Templates from JSON on any other computer to restore them!

📄 License

MIT License. Free and open source for all competitive programmers!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft