Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>CP Input TXTNew to Visual Studio Code? Get it now.
CP Input TXT

CP Input TXT

Al Kayes Rifat

|
5 installs
| (0) | Free
Instantly save Competitive Companion sample testcase inputs into input.txt
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CP Input TXT

CP Input TXT

Saves sample test cases from Competitive Companion directly into input.txt.

How It Works

  1. Make sure you have the Competitive Companion browser extension installed.
  2. Open your code file or folder in VS Code.
  3. Click the Competitive Companion button on any problem page (Codeforces, AtCoder, CSES, LeetCode, etc.).
  4. The test case inputs are automatically written to input.txt next to your active file.

Features

  • Saves where you work: Writes input.txt in the folder of your currently active file (or workspace root).
  • Run code with Ctrl+Enter: Press Ctrl+Enter (Cmd+Enter on macOS) to instantly compile and run your code with input fed directly from input.txt in the terminal.
  • Terminal Colors & ANSI Styling: Highlights --- INPUT --- in Bold Cyan, --- EXPECTED OUTPUT --- in Deep Blue, and --- YOUR OUTPUT --- in Bold Green.
  • Automated Verdict & Diffing: Automatically matches your output with output.txt (ignoring trailing whitespace) and displays ✔ [Verdict: ACCEPTED] in green or ✗ [Verdict: WRONG ANSWER] in red with the exact mismatched line!
  • Execution Time Measurement: Measures and prints program execution duration in milliseconds along with exit code status.
  • Multi-language support: Built-in support for C++, C, Python, Java, Rust, Go, JavaScript, TypeScript, and Kotlin, with customizable commands.
  • Flexible format: Combine all sample test cases or save only the first test case.
  • Automatic expected output: Saves sample outputs into output.txt by default.
  • Status bar & menu: Click the status bar item to run code, toggle the listener, open/clear input.txt or output.txt.

Running Code from input.txt

When working on a problem, press Ctrl+Enter (Cmd+Enter on macOS) inside your code file (or while editing input.txt / output.txt):

  1. Automatically saves any unsaved changes in your solution, input.txt, and output.txt.
  2. Compiles (if necessary) and runs the code in a dedicated terminal (CP Input TXT).
  3. Formats the terminal output with clear ANSI sections, timing, and automated verdict:
    
    --- INPUT ---
    4 6
    10 1
    -------------
    
    --- EXPECTED OUTPUT ---
    2
    9
    -----------------------
    
    --- YOUR OUTPUT ---
    2
    9
    -------------------
    
    ✔ [Verdict: ACCEPTED] (Finished in 3.4ms)
    
    If the output differs:
    ✗ [Verdict: WRONG ANSWER] (Finished in 3.2ms)
    Line 2 mismatched:
      Expected:    9
      Your output: 10
    

Supported Placeholders in Commands

You can customize run commands for any language in settings using these placeholders:

  • ${file}: Full path to the active code file
  • ${fileBasename}: File name with extension (e.g. solution.cpp)
  • ${fileBasenameNoExtension}: File name without extension (e.g. solution)
  • ${fileDirname}: Directory containing the file
  • ${fileExtname}: File extension (e.g. .cpp)
  • ${inputFile}: Full path to the input file
  • ${inputFileName}: Name of the input file (e.g. input.txt)
  • ${outputFile}: Full path to the expected output file
  • ${outputFileName}: Name of the expected output file (e.g. output.txt)

Settings

Setting Default Description
cpInputTxt.runOnCtrlEnter true Run code with input.txt in the terminal when pressing Ctrl+Enter
cpInputTxt.showInputAndExpectedOutput true Display --- INPUT --- and --- EXPECTED OUTPUT --- sections before code output in the terminal
cpInputTxt.checkVerdict true Compare code output against expected output, report verdict (ACCEPTED / WRONG ANSWER / RUNTIME ERROR), highlight mismatches, and measure execution time
cpInputTxt.saveExpectedOutput true Save sample testcase outputs to output.txt
cpInputTxt.runCommands (built-in defaults) Custom compile and run command templates per language ID (cpp, python, java, etc.)
cpInputTxt.customRunCommand "" Global custom command override for all languages
cpInputTxt.saveBeforeRun true Automatically save files before running
cpInputTxt.clearTerminalBeforeRun false Clear the terminal before executing run commands
cpInputTxt.port 10045 Port to receive data from Competitive Companion
cpInputTxt.fileName input.txt Target file name for inputs
cpInputTxt.saveLocation activeFolder Where to save (activeFolder or workspaceRoot)
cpInputTxt.testCaseFormat all Save all test cases (all) or first only (first)
cpInputTxt.openOnSave false Automatically open input.txt after receiving test cases
cpInputTxt.outputFileName output.txt Target file name for expected outputs

License

This project is licensed under the MIT License.

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