C++ environments & compiler args: Is there any predefined macro on LeetCode for ONLINE_JUDGE??

Hello, I'm new to LeetCode.

I get uesd to write codes like following:

#include <bits/extc++.h>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

class Solution
{
public:
    // ...
}

#ifdef nevikw39
int main()
{
    Solution sln;
	// cout << sln. ...
    return 0;
}
#endif

(nevikw39 is defined on my computer) so that I can compile and run the solution on my computer and submit to LeetCode without any modification.

Nevertheless, it's inconvenient when I share my codes to others. Hence, I'm wondering if there are some predefined macros on LeetCode like ONLINE_JUDGE on UVa, AtCoder and Codeforces.

In addition, I find that although LeetCode is using clang, we can use <bits/extc++.h> and GNU's PBDS or other extension. But to include <bits/extc++.h> directly would result in error saying __builtin_sprintf not found, and after defining __builtin_sprintf to sprintf everything works properly.

Comments (1)