Best IDE for Competitive Programming?

For Java, I use Sublime Text 3.
Sometimes I prefer Notepad + CMD, Eclipse IDE too.

2 Likes

This is a simple and clean setup which may work for almost everybody. I personally never felt a need to set up too complex/visually appealing environments for CP because it doesn’t make any difference most of the time (specially when you are at beginner or even intermediate levels).

I use normal text editor (gedit) along with terminal. To paste the scripts, I use gedit snippets.

Super fancy setup is not that much important. However, how you use keyboard shortcuts is really important and can make a whole lot of difference.

1 Like

u can even make alias for ./a.out < input.txt as aout or something else

Yeah, that’s the beauty of CLI

I’m kind of a newbie to competitive programming. Could you please explain what function do these code snippets perform?

I use the Chrome extension which on clicking directly creates a new file in VS Code… You need to download the extension competitive programming helper in VS code…The sample test cases are also downloaded automatically`. This blog has detailed explanation

3 Likes

Anything with

#define

is called a Macro.

Macros speed up your code writing, just a little. It’s noticeably useful for speed solving the easier problems.

The code snippet

freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);

is used to accept input and write output to a file, as you can see on the right hand side.

3 Likes

I am also very curious to know about the combination of terminal and text file :grin:

2 Likes

code snippets help us to add certain set codes by just a small code or word.
For ex -: if i set for(llu i = 0; i < n; ++i){} as fr,then whenever I will press fr and tab then this statement gets copied in my code.

we can also set multiple line snippet .
like the starting template with all our required pre processors

Here a link to code snippets you can use in your cp-environment github

Can anyone told me which is the best online IDE for python 3?

I use Intellij for java and CLion for c++.
See. I’m a jetbrains fanboy.

2 Likes

I use VS Code.That’s it.

Yeah , I also use Codeblocks.

Function name is :fire: :fire: :fire: :fire:

2 Likes

you can install jupyter notebook / jupyter lab, or you can use vs code with the python and competitive programming plugins installed :slight_smile:

1 Like

ya , i also use this it really nice jdoodle c++

None IDE is best, Depends on our use!

for python-
vs code
-very easy to setup ( 2mins)
-same window run terminal

The better way is to use the following line in code.

#ifndef ONLINE_JUDGE
    clock();
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif

Eg. Following template I use no matter which ide u are using

#include<iostream>
using namespace std;
int32_t main(){
#ifdef _MSC_VER
    _CRT_SECURE_NO_WARNINGS
#endif
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
#pragma warning(suppress: 4101) srand(time(nullptr));
    cout << setprecision(20) << fixed;
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t=0; cin>>t;
    while(t--) {
    }
    return 0;
}
./a.out <input.txt

Taking input from file is working but how to write in output.txt file?? I tried the following but it is showing some garbage value.

/a.out <input.txt >output.txt
1 Like