I want to invite you to share your template code which you're using for Codeforces contests using Carbon(free and open-sourse) project. Mine (First but not Best!):
Hope you guys take care in this time of corona-related hardship!
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
I want to invite you to share your template code which you're using for Codeforces contests using Carbon(free and open-sourse) project. Mine (First but not Best!):
Hope you guys take care in this time of corona-related hardship!
Name |
---|
here is an ugly looking Template. ;)
LOL
Not a macro guy so mine's prob shorter than most. The stuff at the top is just debugging template.
Not shorter than this. ;) Btw carbon looks very nice Tameshk, and I love the name.
Thankx for letting us know about Carbon. It's AMAZING ;)
Unsurprisingly, the length of the template has (from the examples so far) been inversely correlated with CF rating :^)
Not true for this guy : Egor. Look at the code lengh XD
I have no template at all (or, strictly speaking, here is my submission template:
). I do use inliner though
Can you please share your library on GitHub or something ? Egor
Here you go
I'd appreciate any suggestions
Sure. Thank you!
Hey Egor! Thanks for sharing your library with us. I have a doubt. This link does not include code inliner.(Or Is it?)
If not, Can you please give a link to it? Thanks in advance.
Google "JHelper"
I'll count this as a win for my predictive model :)
Waiting for your analysis! This is going to be interesting
Do you use patched JHelper? Noticed you have removed the in/out params but didn't notice any new code in your fork
Yep, I think I just forgot to push
Don't worry I get it.
your statement spectacularly fails for Savior-of-Cross and his beauty
(yes I know that Savior-of-Cross doesn't use this in contest)
You really can't consider that a template. It's an algorithm library. For example, you can't compile that as is (variable names are reused, etc.). I use KACTL (https://github.com/kth-competitive-programming/kactl), which also has a ton of lines of code total, but doesn't have a very long template.
Hitting on 1000 lines and I'm not a newbie (yet). Behold the outliers :)
[Here is a simple one.]()
Here's mine :) Different sections are imported when needed (not by default).
P.S. Your project is really awesome ^_^
Thanks for comment. It's not mine, but it's really awesome ^_^
Here's the JAVA code template I use:
)
Well just those common macros nothing fancy(as expected from a noob xD ()
was curious about how you wrote
cubefreak777
?? like is there a script or something or you did it manually?Yeah, I used figlet for writing this you can install it on Linux or just use this online figlet generator it has lots of other fonts here as well
I don't have a proper template :) Probably, because I'm too lazy. For people with big templates: please, consider hiding them in spoilers, it would make the thread much more readable.
This is what I call big brain
Can someone tell me how to use that clock to check execution time,its not working.
Maybe you're not compiling with the correct preprocessor directive? Your code snippet seems to require
LOCAL_RELEASE
to be defined.You can call both power1 and power2 power; the difference in header will overload the function signature and the version called will just depend on whether you pass in the mod argument. Also, it probably won't matter because ll overflow is rare, but you may want to rewrite the lcm argument as (x/gcd(x,y))*y to prevent x*y from overflowing.
Thanks for the suggestions!
here is mine, it's so simple btw carbon looks very nice, great work Tameshk
Hi. I see you are using c++17 on cf. I'd like to tell you about one funny thing. Your template has lcm function which is defined for long longs, but c++17 has it's own function with the same name, so it replaces yours with the std one. Why does it matter? Std function's return type is the same as argument type, so if you run
You will see 1808348672( overflow ), because args are of type int. It's very tricky, isn't it? Here's how you can fix it:
add
#define lcm(x, y) lcm((ll)(x), (ll)(y))
instead of implementing your own lcm functionadd
#define lcm randomlongstringwhichyouwillneveruseasanameorsomethinglikethat
after including libraries, this way your function will be usedp. s. talking about lcm I suggest that shahil_005 throws that weird-ass lcm function out of his template there are so many things wrong with it
UPD: soumitri2001 you have fucked up lcm function as well(but for a different reason. Change
(long) (a*b/gcd(a,b))
to(long) ((long)a*b/gcd(a,b))
. Thea*b
part gives you overflowThank you very much! I didn't notice that.
I would just do
where the function ggcd has the gcd function.
I don't know how to use macro
right, you don't know :p
Here's mine:
Usually, I start from scratch, or copy-paste from my last code
I don't have any macros
how do you save it?I pressed the "Image" button but nothing happens:(
Whats the point in posting screenshots of sourcecode?
1000 lines of code just make it stucked... UPD:Just like this code
how do you save it?I pressed the "Image" button but nothing happens:(
This is mine, I saw Geothermal use it in his Div. 3 unofficial editorial and thought it was good and that I wouldn't have to change it for a long period of time, and so far it's served me really well. Though I made a few edits of my own. Pastebin link because I just can't get carbon to upload the template
Here's mine template, ugly but fun. ;D
You can avoid to use macro
CONFIG
:This lambda will be called before main. Example
Oh, Pretty neat.
Are you sure that "std::cout" will be initialized before "ready"?
Seems to be UB.
It is not UB with C++11 and later.
Thanks for sharing this elegant lambda expression.
The followng is a slight update that uses auto as the return type of the expression.
Update
C++:
Rust:
Ok so I was preparing to post but I really didn't want to drown everybody's codes with my monster, gotta share the spotlight. See any of my submissions 78664902 to understand :p
Nobody asked for your whole library. He just asked for your template. ;)
This is my template. I put it before every code even if it's int n; cin>>n; cout<<n<<endl; :D
xD.
Creating images instead of pasting code with CF formatting. Heavier page to load, and nobody can't copy-paste something useful from here, nice.
You don't learn from copy-paste! You should make your own template without taking exactly the same template from random red guys!
People can anyway go to submissions of that red coder, and open any code.
Yes errichto, I copied yours. Thank you for that brilliant suggestion.
Short, efficient, unique.
I use snippet shortcuts to insert algorithms and implementations when needed.
Should be
typedef long unsigned long lul;
XD
I'll give you that honor
I don't use it during contests, because I don't have time to complete it yet, but I published mine on my blog : Input/Output.
I also have a tool that includes functions that I need at compile-time on my github : C-Tool
Here's my submission template :)
Short and simple, loaded and ready for multiple test-cases and focus only on the solve function.
Too much templates !!! I will have long long time to learn all of this. Thank you everyone <3
My UltiSnips snippet for vim
It failed to accommodate the whole code, so a huge part of this picture is just black.
These are just another Level TEMPLATES.
Why does every body using dark theme? :)
it's mine :)
I want this theme for my compiler...anyone knows either online or offline compiler which contain this theme .
I guess you can install themes on your editor since those themes are not created by the author.
My template is
Standard I think. Not using
I feel like it is too slow when running on test cases...
Here you g----->o
Small and simple
The main thing is
#define int long long
. WA from overflow too many timesWhy do u have both #define int long long and typedef long long ll.
Sometimes you've gotta optimize real hard =)
Some of the code from my alg. repo still uses ll. I should probably change that sometime
Debugger that you might like, since it can be used without writing a single line of code in your final submission file.
(See sample_program in the link given above.)
I try to keep it as simple as possible, and not exaggerated.