Sunday, June 21, 2026

Subline Text for Competitive Programming

Step 1: Install MinGW 

Step 2: Add to the environment variable 

Step 2: 

  • Open Sublime Text editor and then go to Tools > Build System > New Build System.
  • Paste the following code in the file and save it.
  • Name the file “CP.sublime-build“ and save it to this location- C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\User
{
    "cmd": ["g++.exe", "-std=c++17", "${file}",
            "-o", "${file_base_name}.exe",
            "&&", "${file_base_name}.exe<inputf.in>outputf.out"],
    "shell":true,
    "working_dir":"$file_path",
    "selector":"source.cpp"
}

3. Create three new files as shown below and make sure all of them are in the same folder.

  • file.cpp: The file for writing the code.
  • inputf.in: The file where we will be giving the input.
  • outputf.out: The file where the output will be displayed.
Step - 4: 
  • Select View > Layout > Columns : 3. This will create three columns in the workspace. Move the three files into three columns.
  • Select View > Groups > Max Columns : 2.
  • Select the build system we just created from Tools > Build System > CP.
Step 5: Build using Ctr + B

You can create separate build system for any other programming language in the same way- I.E- Python 

{ "cmd": ["python", "-u", "$file", "<", "inputf.in", ">", "outputf.out"], "shell": true, "working_dir": "$file_path", "selector": "source.python" }

Save as Python.sublime-build to the same location and select build system as Python. Goto Tools-> BuildSystem->Python



No comments:

Post a Comment