shoya's blog

By shoya, history, 5 years ago, In English

Which IDE/Editor do you use and what do you like about it? How do you test for sample tests of the problem fast? Do you use terminal during contest? Also how do you debug your code during contest? Do you use IDE Debugger or debug manually?

  • Vote: I like it
  • +7
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it -9 Vote: I do not like it

Usually, I write my code on Sublime text (it has some interesting features), then run it on a local IDE (Code::Blocks for C++), or an online IDE(like C++ shell, but it's not really practical, since you can't copy/paste input from contest to IDE). I still use this method during contests that take place on other platforms.However, onn CodeForces, I use the Custom Test machine that is provided in the contest. Actually, it is pretty fine, and even if it's not as visually comfortable as Sublime Text, it is good, and, being an IDE, it avoids me some drawbacks of Sublime Text which is just an Editor. It's also pretty fast, compared to other online IDEs such as CodeChef's and AtCoder's (Based on personnal experience). Moral of the story, I advise using the Custom Test of CodeForces. If you don't like it, I advise downloading Sublime Text and/or an IDE to compile and run your code. I hoped my advice was helpful. Happy coding!

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Why don't you run you code on Sublime text only, I compile and test it on sublime itself.

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      How do you debug? Is there a way to use gdb on sublime?

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      Any idea for how to add user defined flag, i always use ifndef online_judge how to add ifdef myflag?

      • »
        »
        »
        »
        5 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        use -DMY_FLAG argument during compiling. This will enable you to use #ifdef MY_FLAG

        • »
          »
          »
          »
          »
          5 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I meant how to put the flag in builds in sublime text, i tried it didn't work out.

  • »
    »
    5 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I think the Custom Invocation will be slow due to server load during a contest.

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I used Custom Invocation regularly. At the beginning of a contest, you will have a hard time using Custom Invocation. I use Ideone when it is slow. After 20 — 30 mins you will have a faster Custom Invocation. In fact, recently Custom Invocation is decently fast from the very start of a contest.

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I use only SublimeText on Linux. Before switching I was on Code::Blocks and Windows. Major drawback on previous setup for me was: you couldn't compile/run another code before closing cmd. It isn't issue for me now (and compilation on linux is faster)

»
5 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Before : Windows + Code::Blocks + Hightail

Currently : Linux + Sublime text 3 + (Hightail || Sublime Input method as a comment)

»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I write code in Dev c++ and run it on hackerrank

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I use VIM with some modifications so that F5 is compile and run. That way I barely need to exit to type commands in the terminal (I can never remember them).

Also wrote a script to open vim and all the relevant input files so I don't have to do it myself.

For sample test I just paste it to a text file and run the program (you can use preprocessor stuff so that your code reads in input from some text file).

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Can you share your .vimrc please?

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      It is very messy.

      But I basically copied and paste stuff from wherever I can find.

      The thing I was talking about is on line 91:

      map <F5> :<C-U>!g++ -Wall -Wextra -Wshadow -fsanitize=undefined -DLOCAL -O -std=c++17 % -o %:r && ./%:r <CR>
      

      This should let you compile and run C++17 files in Vim if you do F5 (with the LOCAL tag, you can also make a version without -DLOCAL). I didn't write this code, netman has it on here.

      • »
        »
        »
        »
        5 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Thanks! :D I have been thinking of using vim lately. This will surely help!

  • »
    »
    5 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Did you switch from IDE to vim or you borned with vim? :(

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I was scared of Vim (before I was using Sublime Text). But I decided to switch and now it's feeling more natural.

      • »
        »
        »
        »
        5 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I don't like the fact that the cursor fills all of the word that we are in and also that we cannot move faster like I cannot go 30 lines fast ( Maybe there is fast method in vim)

        • »
          »
          »
          »
          »
          5 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Do you mean ctl-D and ctrl-U? Vim is very capable of doing anything you can think of (with the right setup), you just have to search for it.

          • »
            »
            »
            »
            »
            »
            5 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            sorry for a lot of questions bro.

            how did you install vim i do apt-get install vim but it says that it has independent packages and i also checked the file that I have the links to servers and changed them several times and I still cannot change it do you know why ( I have searched in google and tried all of the solutions on stack overflow)

»
5 years ago, # |
  Vote: I like it +21 Vote: I do not like it

sublime text and copy pasting test cases and manually writing compilation command to terminal

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    This also gives you a lot of flexibility, you can stop compilation, stop running the code, and even clean up leftover files when program terminates abruptly. Another benefit is, switching to output redirection(>) into files is really easy, which can help with checking large outputs.

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      Exactly! Redirect file input output from standard IO exe is also really easy and nice. Only downside is sometimes I end up copy pasting some code into the terminal instead of the test cases and suddenly like 50 junk files show up in the directory. (Actually I still haven’t found a satisfactory way to resolve this yet.)

»
5 years ago, # |
  Vote: I like it -14 Vote: I do not like it

Geeks for Geeks IDE...code and run online :)

»
5 years ago, # |
  Vote: I like it +16 Vote: I do not like it

personally i like codeforces IDE ,here i can copy sample test and run it there , which is comfortable and saves time .

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I use devc++ to write and compile my code.

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

For Java, you could go with IntelliJ Idea(or Eclipse). IntelliJ has many good features for development too. Infact, I personally find it's debugger very useful. Besides, you can get all the Jetbrains product for free on a Student ID.

»
5 years ago, # |
  Vote: I like it +18 Vote: I do not like it

I used to write code in Eclipse few years ago. I could install it for Windows and use it in World Finals. I'm not using Windows anymore neither Eclipse (it was total crap btw).

I started using vim, but it's not very easy, and for sure you will need several plugins and customization before feeling comfortable. Personally I found vimrc from misof very useful, and is the core of my current vimrc ( https://people.ksp.sk/~misof/programy/vimrc.html ). Note that I don't use vim for competitive programming anymore, but I use it for a lot of other things.

Then I start writing code on Sublime. Sublime is blazing fast and was all I needed in my slow computer to write code for competitive programming. It has very basic features, but if you feel comfortable writing code in your language, it is ok.

Finally I think vscode is my goto editor for competitive programming. It is very fast (not as fast as Sublime though) but has greater community and much more useful extensions and tooling.

I started to develop an extension for vscode to write code in competitive programming. You can install it from the marketplace. It is called acmX.

You can see a brief example of how to use it here: https://youtu.be/ouCU9xyW1i8

I created this Telegram group for the extension https://t.me/joinchat/FksZ0BSkGh7anvpFYisjMw.

»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Sublime text 3 and Ubuntu terminal with auto-complete disabled in Sublime because it just adds std:: to everything during auto complete. I use the following aliases for running code.

Aliases

Here 00.cpp is my skeleton/template code for contest which consists of only 3 lines.

Apart from that I use my personal compiled bits/stdc++.h so that my C++ code compiles in blink of an eye because compiling original bits/stdc++.h still takes few more milliseconds even if pre-compiled for which I wrote a script before.

»
5 years ago, # |
  Vote: I like it -6 Vote: I do not like it

I write code in the Submit Code tab and press submit to compile. The samples are tested automatically by the tester.

»
5 years ago, # |
  Vote: I like it +1 Vote: I do not like it

I use far manager. It doesn't have that much special features except you can boast about tourist using it

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I use ideone, obviously the most superior ide. ;)

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I use CLion on Mac.

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I'll recommend u SUBLIME TEXT 3 , its the fastest text editor, with some great features of Snippets and auto-completions.It has separate input and output file system .it has great interface with DARK mode.

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Since nobody mention cf-tool I do.

It is a great command line tool to download problems and whole contests with all testdata to the local system, compile/test/run and submit.

It perfectly fits to be used with vim as an editor.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

use cp-editor ultra-fast and easy to use. CP-editor

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    has it auto complete feature?

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      No, but I would recommend you to use it once maybe you will like it.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Can you plz tell how to enable the range based for loop in cp-editor or remove the std c++ 98 mode and get the new one

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I use sublime text combined with xalanq's very useful cf-tool. Sublime for editing code, cf-tool for debugging and running locally.

»
4 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

I created a plugin for this purpose. https://github.com/suraj-2306/cc_vim.git It opens up an input.txt and an output.txt along with the main .cpp file, in a split-screen config. By hitting F9, you can compile the code and execute it. The expected output is shown in the output.txt buffer while taking input from the input.txt buffer. It uses a custom makefile for compilation and execution of the code. It's pretty helpful if you're starting with cc in vim.ATB

»
4 years ago, # |
  Vote: I like it +15 Vote: I do not like it

I had to reinstall my setup recently so here's exactly how I have it:

install sublime

install some c++ compiler

change sublime compilation flags to use C++17 -O2 and some other compilation flags like -Wshadow

code with sublime, compile with ctrl+B, run on command line

So yeah, not much is needed.

»
4 years ago, # |
Rev. 5   Vote: I like it 0 Vote: I do not like it

CLion with JHelper.

--

Advantages: I have competitive companion, which parses the test input/output and sends it to JHelper. It's nice I don't have to copy paste the input and so on.

CLion has a bunch of useful stuff. It has a debugger, but I don't use it that much >.< ... it also has a bunch of other features I don't know how to use :P

--

I don't use terminal, although I used to use alacritty + vim.

»
4 years ago, # |
  Vote: I like it +4 Vote: I do not like it

VScode forever.

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Far manager