### ecnerwala's blog

By ecnerwala, history, 2 years ago,

Hi everyone!

code_warrior recently asked "How is ecnerwala?" I'm here to answer that question and others you may have! I'll check this regularly for the next couple of days and try to respond when I get a chance. Ask me anything!

To code_warrior: I'm doing good. Quarantine is still ongoing, so I'm spending most of my time at home with my family, coding both for work and for fun. How about you?

EDIT: There have been a lot of repeat questions, and I've tried to answer each question at least once. I've given a bunch of general advice about practicing and training, and I don't think I can say too much about how you specifically should practice, so I might not answer all of those questions. In general, practice things that you see in contest that are medium or hard but not impossible for you.

UPDATE: Thank you guys for all your questions! I think I'm done answering questions for now, hope to compete with you guys more!

UPDATE 2: I finally followed through and posted a bunch of screencasts to my YouTube channel, check them out if you're interested! I'll look into a way to post the code/key-captures, and I hope to publish some with commentary soon!

• +777

 » 2 years ago, # |   +60 How tall is ecnerwala?
•  » » 2 years ago, # ^ |   +210 I swear I'm pretty much 6ft (1.83m).
•  » » » 2 years ago, # ^ |   -232 Everybody asks How is ecnerwala ? Nobody asks How is alawerence ... S E DL Y F
•  » » » » 2 years ago, # ^ |   -30 how to become lgm in 3 months?
•  » » » » » 2 years ago, # ^ |   +14 If someone could have achieved it in 3 months then it would not have been called "Legendary". P.S I am none to tell you(I am a fkin newbie) this but I think these people must be very passionate about CC.
•  » » » » 2 years ago, # ^ |   +3 Because he doesn't mess up the spelling of his own handle
•  » » » » » 23 months ago, # ^ |   0 ROAST!!!!
 » 2 years ago, # |   -678 Do you know who is "BINOD"?
•  » » 2 years ago, # ^ |   +129 Nope
•  » » 2 years ago, # ^ | ← Rev. 2 →   -218 lets make the above comment the most disliked one on codeforces
•  » » 2 years ago, # ^ |   -32 Binod ......Dislike me
 » 2 years ago, # |   +43 What is your favourite editor??
•  » » 2 years ago, # ^ |   +122 I love vim too. JetBrains IDEs are a runner up.
•  » » » 2 years ago, # ^ |   +3 What plugins do you use/recommend for competitive programming? Would it be too much to ask if you could share your .vimrc?
•  » » » » 2 years ago, # ^ |   +15 You can find my vimrc here: https://github.com/ecnerwala/dotfiles/tree/master/vimThe most important for competitive programming is just YouCompleteMe.You can also find my Makefile at https://gist.github.com/ecnerwala/a3c6332ac626bc448165.
•  » » » » » 2 years ago, # ^ | ← Rev. 2 →   +1 How did you handle vim in the ICPC World Finals? AFAIK, they don't let you download any plugin script. Did you write your .vimrc by hand at the beginning of the contest? Or did you just use plain old plugin-less vim?Oh and congrats on your second place today!
•  » » » » » » 2 years ago, # ^ |   +9 I typed up this vimrchttps://github.com/ecnerwala/icpc-book/blob/master/content/contest/vimrc
•  » » » » » » » 2 years ago, # ^ |   0 wow ! Thanks for sharing ecnerwala !
 » 2 years ago, # |   -13 Hey, the question hasn't been answered yet, so I'm asking it again.How are you, Andrew?
•  » » 2 years ago, # ^ |   +52 I'm doing good, how about you?
•  » » » 2 years ago, # ^ |   -9 Not so good, but I'm glad to hear you are doing well.
•  » » » 2 years ago, # ^ |   -67 Hello Sir, it's nice to be able to chat with you. Regarding the Code Jam Finals, I would like to know that don't u feel sad after losing to Tourist? Especially after working so hard for so many years? I ask this because I get disheartened too easily by failures. I also face a dilemma like how much time I should spend behind thinking about a problem..Next Question is, what should be my strategy to prepare as a team for ICPC?
•  » » » » 2 years ago, # ^ |   0 I would like to know from the community as to why this simple post has been downvoted so many times.Neither have I tried to insult anyone,nor am i asking anything irrelevant.Then why unncessarily are you downvoting me?I would really like to know the reason so that in future I keep certain things in kind before commenting here at Codeforces
•  » » » » » 2 years ago, # ^ |   0 The only fault of yours is that you are a newbie. People are fkin ratist here. come btches downvote this.
•  » » » » » » 2 years ago, # ^ |   -6 Thanks for your concern. I shall keep this in mind
•  » » » » » 2 years ago, # ^ | ← Rev. 2 →   +18 Your first question is a rather sensitive, and a bit personal question.Well your second question can be answered with some searches on the internet. It's also a part of the strategy a team uses for the competitions. If you still want to ask such things, create a blog."Ratism" has nothing to do here.
•  » » » » 2 years ago, # ^ |   +3 I personally down-voted you for this line  See it... I would like to know that don't u feel sad after losing to Tourist?
 » 2 years ago, # |   +66 My ex-wife sent me the bill for the dog tax. I say hey this is your dog. She says, well, it's a breakup dog. What should I do?
•  » » 2 years ago, # ^ |   +197 pet the dog ofc
•  » » 2 years ago, # ^ |   +1 Did your rating problems begin because of your wife, dog, or both?
•  » » » 2 years ago, # ^ |   0 Yes
•  » » » » 2 years ago, # ^ |   0 it should not be
•  » » » 2 years ago, # ^ |   0 Seems my rating goes up again :)
•  » » » » 2 years ago, # ^ |   -24 why the fuck didn't you help me?
•  » » » » » 2 years ago, # ^ |   0 How could I have helped you? With what?
 » 2 years ago, # |   +17 what kind of "work" do you do?
•  » » 2 years ago, # ^ |   +145 I work at a startup called Impira in SF on database-like systems to extract and query information from assets (like scanned documents) using machine learning. I'm mostly working on the low-level data storage layer to store data and make it efficient to query.
•  » » » 2 years ago, # ^ |   +17 Why did you choose to work in a startup particularly? Given that you have excellent engineering background and exceptional programming skills .
•  » » » » 2 years ago, # ^ |   +24 Startups are usually where the most exciting work happens. They need to master the market in some new vertical and that takes hardcore programming/engineering skills. Though this may vary from startup to startup.
•  » » » 23 months ago, # ^ |   0 Do you have enough time working in parallel while studying at MIT?
 » 2 years ago, # |   +119 What's your next big goal?
•  » » 2 years ago, # ^ |   +134 One goal I have is to start streaming or screencasting more competitive programming content. I'll be posting some screencasts (probably AGC047 and CF R663 Div2) to YouTube shortly, and make sure to follow me at https://twitch.tv/ecnerwala to see when I go live!
 » 2 years ago, # |   +21 What is your training routine to get better?
•  » » 2 years ago, # ^ |   +45 Recently, I haven't had much of a strict training routine; I mostly do programming problems when I feel like it (which admittedly is pretty often). I do try to upsolve most of the problems from all the contests I do, but even then I skip annoying/"uninteresting" problems.In high school, I did a lot of POI (Polish) problems.
•  » » » 2 years ago, # ^ |   +23 what did you do when you were stuck in some POI problem and tried enough (as there's no editorial) and what should the others do now ( considering the resources available today if any )?
•  » » » » 2 years ago, # ^ |   +3 there are editorials in polish with reference solutions
•  » » » » » 2 years ago, # ^ |   0 By no editorial I meant english editorial actually
 » 2 years ago, # |   +7 What does "ecnerwala" mean? And how do you pronounce it?
•  » » 2 years ago, # ^ |   0 Well I can answer this : D it's the reverse of his last name
•  » » 2 years ago, # ^ |   +22 It's the reverse of my middle name (my full name is Andrew Lawrence He). I pronounce it like "eck" (hard-k) — "nerwhal" (rhymes with narwhal) — "ah".
•  » » » 2 years ago, # ^ |   +11 Omg, I just realized that I was reading your handle as "echerwala" all this time.
•  » » » » 2 years ago, # ^ |   +8 Omg, I just realized that I was reading his handle as "encerwala" all this time.
•  » » » » » 21 month(s) ago, # ^ |   0 anybody who read it like e-c-ner-wala ?
•  » » » 2 years ago, # ^ |   +15 /ɪkˈnɝːwələ/
 » 2 years ago, # |   +14 How do you solve https://codeforces.com/contest/1375/problem/F?
•  » » 2 years ago, # ^ |   +25 I wish I knew. def p(x):print(x,flush=True);a[int(input())-1]+=x a=[*map(int,input().split())];print('First');p(10**9);p(max(a)*3-sum(a));p(max(a)-min(a)>>1) 
•  » » » 19 months ago, # ^ |   -11 I am begginer. What should i do?
 » 2 years ago, # |   -25 Time for some cliche questionsHow to improve? What difficulty level problem should I solve to reach purple ?
•  » » 2 years ago, # ^ |   +63 I think most of improving is practicing implementing and building familiarity with concepts. It's hard to say what difficulty level problem. I think to practice implementing, try to implement something that complicated enough that you'll make bugs, and then try to build muscle memory or other techniques to avoid those bugs. To learn concepts, probably try to solve problems that take you between 20 minutes and a few hours to solve.Also, reaching purple may not be the right goal; you'll probably want to set a short-term goals that are more incremental.
 » 2 years ago, # | ← Rev. 4 →   -43 you are a legendary coder ....i think you get many offer from Google/Facebook or many big tech company's share some interesting idea about that ....
•  » » 2 years ago, # ^ |   +9 I don't have too much to say about that; there are a lot of resources online if you want to learn about these things. I will say that competitive programming problems are pretty similar to the programming problems I've seen in interviews, so it's definitely a helpful bit of experience to have.
 » 2 years ago, # |   +5 Q1. can ecnerwala defeat tourist in google code jam finals ? Q2. is ecnerwala belongs to china or any background history with china ?
•  » » 2 years ago, # ^ |   +100 Still unknown. I can beat him in Distributed CodeJam Finals though! My parents grew up in China, but I was born and raised in the US.
 » 2 years ago, # |   -9 where do you live Legendary Grandmaster?
•  » » 2 years ago, # ^ |   +22 I live in California, USA.
 » 2 years ago, # |   +15 What do your cp practicing sessions look like? How do you work on problems (stuff like thinking for >30 mins, reading editorial afterwards, then implementing stuff)? Especially your practicing sessions at times when you were mostly active.
•  » » 2 years ago, # ^ |   +46 Yeah that's pretty much right. I'll think for a while, especially if I feel like I'm still making progress. At some point, if I'm stuck or I no longer want to work on the problem (or at the end of the contest), I'll read the editorial or discuss the problem. I think it's important to go back and make sure you actually understand the structures of the solution and how they do and don't generalize. (How things don't generalize is a great way to understand what underlying structure is being relied upon.)Then I usually try to implement it unless it's particularly uninteresting and annoying.
 » 2 years ago, # |   +6 Which things you like and dislike most in your professional life?
•  » » 2 years ago, # ^ |   +3 I really like being able to learn things from coworkers with experience in different areas than me. One thing that's a lot harder than competitive programming is that the codebases are larger and have to support a lot more collaboration, via things like good design patterns and good testing.
•  » » » 2 years ago, # ^ |   0 Oh Nice! Thanks for response
 » 2 years ago, # |   -21 huge number of easy questions or few number of hard questions? Which is better for practice? And do you think solving math problems and normal puzzles help in any way?
•  » » 2 years ago, # ^ |   +3 Probably a mix of many medium questions and some hard questions. I started off doing math olympiads, and I think they helped both understanding concepts and improving problem solving.
 » 2 years ago, # |   +11 how old are you, from when you started coding?
•  » » 2 years ago, # ^ |   +12 I'm 22, I started programming around age 14.
 » 2 years ago, # |   +37 Do you eat pineapple on pizza?
•  » » 2 years ago, # ^ |   +36 It's not my favorite topping or anything, but it's tasty, sure.
•  » » » 2 years ago, # ^ |   +39 Can we trust someone who likes pineapple on pizza?
•  » » » » 2 years ago, # ^ |   +9 Yes!
•  » » » » 23 months ago, # ^ |   0 Where did the "taboo" of pineapple on pizza come from?
 » 2 years ago, # |   0 How to be a legend like you?
•  » » 2 years ago, # ^ |   +37 Some mix of practice and talent.
•  » » » 2 years ago, # ^ |   +4 Speaking of talent, I know IQ isn't a very reliable measure. But still, do you know what your IQ is?
•  » » » » 2 years ago, # ^ |   +84 Probably > 10 and < 1000
•  » » » » » 23 months ago, # ^ |   +3 Bold statement
 » 2 years ago, # |   -34 I love you....Do you love me?
•  » » 2 years ago, # ^ |   +53 This is Codeforces, not tinder!
•  » » » 2 years ago, # ^ |   +41 You meant grindr, right?
 » 2 years ago, # |   +70 Favorite moment in a programming contest?
•  » » 2 years ago, # ^ |   +93 My favorite moment was probably solving towns at IOI 2015 in the last 15 minutes of the contest. That problem is so nice, and clutching it out felt so great.
 » 2 years ago, # |   0 What is your favorite programming competition?
•  » » 2 years ago, # ^ |   +24 I've started to really enjoy team-based ICPC rounds, it's great to be carried by teammates, and I have some fun implementing some of the more technical problems. It's always great to travel to onsite competitions and meet other contestants. IOI and CodeJam tend to have some very interesting math-y problems. One of those is probably my favorite.
•  » » » 2 years ago, # ^ |   0 what is his youtube channel could you please put the link
 » 2 years ago, # |   +52 Apart from Competitive Programming , what are your areas of interest(hobbies)?
•  » » 2 years ago, # ^ |   +12 Recently, I've just been playing some video games like Celeste and doing some puzzle hunts.
•  » » » 2 years ago, # ^ |   +23 Celeste is awesome!
•  » » » 2 years ago, # ^ |   0 are you getting the golden berry of farewell?
 » 2 years ago, # |   0 Likelihood of me featuring in a Lockout dual vs tourist?
•  » » 2 years ago, # ^ |   +4 Ask him and find out!
 » 2 years ago, # |   +2 Do you have girlfriend if not any ex ?And whats your age btw ?
•  » » 2 years ago, # ^ |   +10 I don't have an SO right now.I'm 22.
 » 2 years ago, # |   +68 Do you find software engineering to be interesting in general? Asking because the thinking involved is very different from algorithmic thinking.
•  » » 2 years ago, # ^ |   0 For sure. I actually really like the parts of competitive programming that are more like software engineering, like designing good interfaces and abstractions. I think that's one of the things that makes me pretty good at technical problems.
 » 2 years ago, # | ← Rev. 2 →   0 hi
 » 2 years ago, # |   +28 How do you prepare your team for ACM ICPC?
•  » » 2 years ago, # ^ |   +3 For ICPC 2019, we did several contest each week and spent a good amoout of our own time upsolving problems too.
 » 2 years ago, # |   +7 According to you what is your biggest achievement so far?
•  » » 2 years ago, # ^ |   +4 It's probably winning Distributed Codejam, or 2nd place at ICPC.
 » 2 years ago, # |   0 Any lockout planned for the near future? Have you watched Errichto's recent lockout? If you hold a lockout in the near future could you incorprate the problem explaining like Errichto did in his lockout?
•  » » 2 years ago, # ^ |   0 I'll probably try to do some lockout soon, but no guarantees for now. I haven't actually watched Errichto's stream, but that does sound like a good idea; I'll check it out when I get some free time.
 » 2 years ago, # |   0 You seem to be extremely proficient in C++. How long have you been using C++ and what are you favorite programming languages ?
•  » » 2 years ago, # ^ |   0 I've been using C++ since 2013. My favorite programming languages are probably C/C++, Go, Python, and maybe Rust (I haven't actually used Rust much though). I think Typescript is pretty cool, but I haven't used it much (also npm scares me).
 » 2 years ago, # |   +35 Do u have girlfriend?
•  » » 2 years ago, # ^ |   +5 Nope
 » 2 years ago, # |   +2 Can anyone become an LGM?
•  » » 2 years ago, # ^ |   -8 This is a very good question... Why are there so many down votes?
•  » » » 2 years ago, # ^ |   0 There are 30 slots, and 30000 ppl trying. I think most ppl know the answer.
•  » » » » 2 years ago, # ^ |   +31 I think ratatouille said it best: "Not everyone can become a great artist... but a great artist can come from anywhere." -Anton Ego
•  » » » » » 2 years ago, # ^ |   0 Not everyone can become a great artist...Doesn't that quote prove my point? The second part is true but doesn't detract from the first statement.
•  » » » » » » 2 years ago, # ^ |   +5 Ya, I was agreeing with you.
 » 2 years ago, # | ← Rev. 2 →   0 Q1. What is your thought process when you are not able to do good in contest?Q2. What is the best way to learn new topic and practice and from where?
•  » » 2 years ago, # ^ |   +6 I think you just have to keep pushing to do better; it's good to reflect a little on what changes you could make to do better in the future and then just move on to the next contest. Depends on the topic, probably just read about it and make sure to practice on problems.
•  » » » 2 years ago, # ^ |   0 Thanks for reply;
 » 2 years ago, # |   +107 Do you like monkeys?
•  » » 2 years ago, # ^ |   +57 i like you.
•  » » 2 years ago, # ^ |   +50 6/10
•  » » 2 years ago, # ^ |   -62 I think once you go back to MIT you will pay for it my dear friend... because ecnerwala knows all professor of MIT so the will give you less marks in semester exams..
 » 2 years ago, # |   0 Did you practice on some other site before starting off with codeforces? Also if you don't know a particular concept where do you read stuff about it ?
•  » » 2 years ago, # ^ |   0 I started off mostly with Codeforces and USACO training (both the training pages and past USACO problems).To read about concepts, it depends on the concept; sometimes there are good resources on blogs like CF, other times you just have to read papers (which sucks). Asking peers for help is also good.
 » 2 years ago, # |   +8 How to I tackle the frustration in competitive programming .Thanks in advance.
 » 2 years ago, # |   +75 milk first or cereal first?
•  » » 2 years ago, # ^ |   +81 wtf cereal first for sure
•  » » 2 years ago, # ^ |   +11 cereal bowl first
 » 2 years ago, # |   +5 which university in {USA / California} is best for {computer science/computer engineering} ?
•  » » 2 years ago, # ^ |   -32 Google is your friend.
•  » » » 2 years ago, # ^ |   +17 i googled it before but i want to know his opinion. if you want to reply, reply with your main account and dont spam cf.
•  » » 2 years ago, # ^ |   0 https://www.usnews.com/best-graduate-schools/top-science-schools/computer-science-rankingsBut seriously, all the top schools are good enough that you'll find good experience/opportunities at any of them, so don't take the rankings too seriously. You should probably care more about culture/your peers at those schools.
 » 2 years ago, # |   +48 Did you have the opportunity to stay in academia, and if so what made you want to go into industry?
•  » » 2 years ago, # ^ |   +8 I really like building things, and there's a lot more opportunity to do that in industry.
 » 2 years ago, # |   +8 How soon after reading the problem would you recommend seeing the editorial ?
•  » » 2 years ago, # ^ |   +8 Probably after you've stopped making progress, and at least 10-20 mins.
 » 2 years ago, # |   +55 It was at this moment he knew, HE FUCKED UP!
 » 2 years ago, # |   0 What did you study in Uni? Did you do any research?
•  » » 2 years ago, # ^ |   +32 I studied CS at MIT, I did a little research but not much.
 » 2 years ago, # | ← Rev. 2 →   +3 have you ever thought of giving up cp or took a long break?out of frustration or maybe your contest performance was disappointing to you at some point or for any other reason.
•  » » 2 years ago, # ^ |   0 I've taken a couple breaks (see ~2017), mostly because I lost interest or had other things to do.
 » 2 years ago, # |   +19 Who killed Kennedy?
•  » » 21 month(s) ago, # ^ |   0 A mystery for more than 50 years...
 » 2 years ago, # |   -53 How popular do you think you are compared to tourist and Errichto?
 » 2 years ago, # | ← Rev. 7 →   -59 .
 » 2 years ago, # | ← Rev. 2 →   +44 Few of my questions: Do you workout? Do you watch animes? Tea or coffee?
•  » » 2 years ago, # ^ |   +18 I don't really workout, though I keep saying I should :( Not really, I've watched parts of a couple but I wouldn't call myself a big anime person. Tea, but I can't really take the caffeine from either.
 » 2 years ago, # |   -8 Would you tell us your programming experience from beginner to advanced and how to improve ourself
 » 2 years ago, # |   +5 What one thing you would like to achieve regarding competitive programming?
•  » » 2 years ago, # ^ |   +21 I want to win an onsite round.
 » 2 years ago, # |   -40 I generally am stuck on problems related to divide and conquer.Do you know any good resources to study divide and conquer algorithms from?
 » 2 years ago, # |   +1 How do you manage time for both job and CP?
•  » » 2 years ago, # ^ |   0 I have enough time for both; I don't spend all that much time on CP.
 » 2 years ago, # |   -6 What is your industrial skill . I mean , what you are, a Teacher ,a webdev ,software engineer, ML/AI engineer, etc. ??
•  » » 2 years ago, # ^ |   0 I'm a backend engineer.
•  » » » 2 years ago, # ^ |   0 Do you like and use machine learning in your work?
 » 2 years ago, # | ← Rev. 3 →   +3 Where you see yourself after 5 years from now ?
 » 2 years ago, # |   0 what do you love and hate the most about life?
 » 2 years ago, # |   0 What are you doing for entertainment (without coding ) like tv/movie/song ??
•  » » 2 years ago, # ^ |   0 I've started watching some more TV, mostly police procedurals like Person of Interest, White Collar, etc.
 » 2 years ago, # |   0 When next will we see a round organised by you ??
 » 2 years ago, # |   +1 Why should we hire you for this job?
•  » » 2 years ago, # ^ |   +121 Yes
 » 2 years ago, # |   0 Do u love pizza??
 » 2 years ago, # |   +1 Do u also struggled initially to solve Div2d,div2E??
•  » » 2 years ago, # ^ |   -29 LGMs dont struggle with div2 Ds
•  » » » 2 years ago, # ^ |   +3 read my question carefully,i have written "initially".
•  » » » » 2 years ago, # ^ |   -53 They dont struggle (ever).Its trivial for them from the beginning
•  » » 2 years ago, # ^ |   +13 Yeah for sure, I mean there was a time when I didn't know BFS.
 » 2 years ago, # |   0 How can I be a Legendary Grandmaster like you ? How do I learn new things ? Where to start ?Which would be better for me, Codeforces or UVA ?How do you do, now?How old are you?Thanks.
 » 2 years ago, # |   +4 Do you play any video games?
•  » » 2 years ago, # ^ |   +6 Some, I've been playing Celeste, some Super Smash Bros. Melee, and I've recently tried playing Dead Cells.
 » 2 years ago, # |   -8 How to Solve This https://cses.fi/problemset/task/1729
•  » » 2 years ago, # ^ |   +8 Let's Say we currently have $i$ stones, then $\forall\; p_k \in P$, if $i-p$ was a losing state, then $i$ is a winning state.For Example if $i = 0$ then, $p$ is a winning state since $0$ is a losing state. Hence the following recurrence holds, Spoiler $dp[i] \;|= \;!dp[i-p] \;\forall \; p \in P,\; i-p \geq 0$
 » 2 years ago, # |   +1 What competitive programming site do you love the most? Is it codeforces or something else?
•  » » 2 years ago, # ^ |   0 Probably CF or AtCoder.
 » 2 years ago, # |   +14 With whom do you enjoy solving in a team more scott_wu or ksun48 if you were to choose only one ?
•  » » 2 years ago, # ^ |   +15 I like all my teammates equally.
 » 2 years ago, # |   +1 What does it take to get 5.0 GPA in BS Math and computer science at MIT ( because you scored 5.0 )
 » 2 years ago, # |   +5 I feel like, I'm stuck in cp in one point, can you suggest me, how can i reach cf 1900+? or what should i follow?
 » 2 years ago, # |   -18 ecnerwala i used to use vectors but because of some serious tle problems i stopped. And it’s really hard to use arrays instead of them. How do you use vectors and handle tle cases?
•  » » 2 years ago, # ^ |   -8 It happens rarely that you go into TLE issues with vector. Maybe you don't know how to use them properly.
•  » » » 2 years ago, # ^ |   0 Actually it was rarely but in really serious cases. Once in code jam problem and once in a usaco problem. I was afraid of it happening in the contests so I stopped it. Also It has happened in one of tourist streams which made him the runner up instead of the winner...
•  » » 2 years ago, # ^ |   +9 Don't use .push_back()if you know the size of the array or at least .reserve() some memory at first. Other differences are minor.
•  » » 2 years ago, # ^ |   +3 Yeah, vectors shouldn't have much problems unless you allocate/deallocate them frequently. I try to always reserve(sz) to avoid log(n) resizes, and also try to preallocate large vectors outside loops.
 » 2 years ago, # |   +5 My girlfriend left me. I called her. After an hour of argument, she agreed to come back only if I become an expert in a month. I am confused and sad. Bitch took my earphones too.
•  » » 2 years ago, # ^ |   -21 Maybe i can help you with that? what do you think?
•  » » 2 years ago, # ^ | ← Rev. 2 →   +117 Can you please share her details in dm if she doesnt mind? I know someone who can become expert in a month if mike increases frequency of div1s. Don't forget to take person's explicit consent before sharing his/her details.
•  » » » 2 years ago, # ^ |   +57 Do you mean fall to expert from purple+?
•  » » » 2 years ago, # ^ |   +15 Hum Indians jitna bhi tarraki karle, dil se hamesha harami rahenge XD
•  » » 2 years ago, # ^ |   0 Is she already a Candidate master or Master? LOL
•  » » 2 years ago, # ^ |   0 If her intention is to help you grow, work your ass off. Else text her 'blue?' when you're red.
•  » » 2 years ago, # ^ |   0 I hope not all girls are like that, if so, then I am never getting a girlfriend.
•  » » » 2 years ago, # ^ |   0 You won't get one. so don't worry.
 » 2 years ago, # |   -55 Why is ecnerwala?
 » 2 years ago, # |   0 what the hell?
 » 2 years ago, # |   +19 Is coronavirus a hoax made up by flat earthers?
•  » » 2 years ago, # ^ |   +38 No. Stay safe and healthy!
 » 2 years ago, # |   0 What are frogs?
 » 2 years ago, # |   +24 How hard did you work to maintain your perfect 5.0 GPA? Also, considering you didn't pursue academia, why did you go through so much effort to maintain a perfect GPA?
•  » » 2 years ago, # ^ |   +12 I didn't maintain a perfect GPA. I did well in classes because I chose classes that were interesting and I wanted to learn from.
•  » » » 2 years ago, # ^ |   +3 Wow, amazing! I envy such passion!I can't help but think of classes as a chore :(
 » 2 years ago, # |   0 What brought CP to you?
•  » » 2 years ago, # ^ |   +5 I got into it because there was a lot of overlap with the math olympiad community (looking at you guys scott_wu and stevenkplus).
 » 2 years ago, # |   +3 How transferrable is CP to real programming? Do you use a lot of skills that you learned in CP during work?
•  » » 2 years ago, # ^ |   +5 Yeah I think there's a decent amount transferred, particularly about writing clean/testable/bugfree code.
 » 2 years ago, # |   0 When you were at the beginning stage of learning CP, how did you spend time for different topics (DP, graph, math...) and what were your ways to maximize the productivity in the decided time spent?
•  » » 2 years ago, # ^ |   0 I didn't really split my time by topic too much after learning the basics in each.
 » 2 years ago, # |   -50 Bro, I want to ask u about a coding question which was recently asked by D.E.shaw company as part of recruitment in india. I don't remember the exact question but i will tell u the outline. which was : In the question there is a girl and she had to cross a series of land mines ,she cannot step on consecutive land mines but she can skip any number of land mines ,if she steps on a land mine then she loses a certain score. For each land mine there is certain integer denoting the score she loses on stepping that landmine.if she steps on more than one land mines then she loses score which is the sum of those corresponding integers .inputs are: n-number of land mines array of n integers denotes scores which she loses on corresponding land mine we need to output a single integer which is the minimum score she will lose example: 5 8 1 4 6 9 ans: 1+6=7I am so confused on seeing the question then I did it by summing up of odd indexed and even indexed numbers and printed the minimum of them but using this approach I am able to pass only 4 testcases out of 13please help me in solving this and also if there are any similar questions please let me knowThank you.
 » 2 years ago, # |   +170 What happened between 2016 and 2018?
•  » » 2 years ago, # ^ |   +56 Life
•  » » 2 years ago, # ^ |   +315 2017, duh
•  » » 2 years ago, # ^ |   +14 Yeah, I took a bit of a hiatus to do other things; CF rounds conflicted with classes, and there were other things I wanted to do.
 » 2 years ago, # |   0 your favourite sport other than competitive programming
•  » » 2 years ago, # ^ |   0 I played a bit of Ultimate in college. I don't watch sports much, but if I had to choose, it would be basketball or hockey.
 » 2 years ago, # |   0 Your are a legendary grand-master. You spent a lot of time in cp. Do you think that you sould have been spent slightly less time in cp and do "something else" ? If so what is that "something else"?
•  » » 2 years ago, # ^ |   +3 I do CP mostly as a hobby now, so I don't really regret spending too much time on it. If there are other things I want to do, I do those other things as well.
 » 2 years ago, # |   0 What job do you do ? At what age have you started coding?
 » 2 years ago, # |   +3 are you a coffee person? or tea?
 » 2 years ago, # |   +8 Did you/do you do competitive math too? I vaguely recall seeing you in some of Evan Chen's streams.
•  » » 2 years ago, # ^ |   0
•  » » 2 years ago, # ^ |   0
•  » » 2 years ago, # ^ |   +13 Yeah, I started off doing math competitions, and I first met a lot of OI people through math competitions. I've definitely been in a few of Evan Chen's streams, you should check him out if you like math olympiads; he's a god.
 » 2 years ago, # |   0 is working keep any effect on cp??
 » 2 years ago, # |   0 do you have an Android or IOS smartphone ? which OS do you have in your computer ?
•  » » 2 years ago, # ^ |   +19 I have an Android phone (LG G7) and I run linux.
 » 2 years ago, # |   -8 Any suggestions for a beginner/pupil like me for CP.Thanks In Advance
 » 2 years ago, # |   0 What do you do when you get bore with problem-solving? How do you refresh your mind!
 » 2 years ago, # |   0 What was your usual routine at MIT? How did you manage your time between competitive programming and college work?
•  » » 2 years ago, # ^ |   +8 My usual routine at MIT was pretty standard; go to classes, do homework, socialize, etc.I didn't really split my time between cp and college; see the break I took in 2017.
 » 2 years ago, # |   0 What is the point of doing cp professionally?
•  » » 2 years ago, # ^ |   +32 I don't do it professionally, it's mostly a hobby for me.I think if people do go pro, it would mostly just like any other esport.
 » 2 years ago, # |   0 Wish me good luck for my first appearance of Div 1 contest.
 » 2 years ago, # |   0 How did you start competitive programming? Do you have any tips for beginners?
 » 2 years ago, # |   0 Practice strategy for beginners?
 » 2 years ago, # |   0 You're just 22. Are you the youngest Legendary Grandmaster?
•  » » 2 years ago, # ^ |   -25 Benq is
•  » » » 2 years ago, # ^ |   +3 As far as i can remember it is djq_cpp ,he is less than 15
•  » » » » 2 years ago, # ^ |   -11 But he asked Legendary
•  » » » » » 2 years ago, # ^ |   0 His maximum is Legendary
•  » » » » » » 2 years ago, # ^ |   -34 but not now.
•  » » » » 2 years ago, # ^ |   0 omg! how old was he when he started competitive programming ?
•  » » 2 years ago, # ^ |   +5 Definitely not; I'm pretty sure there are/were LGM's in high school.
 » 2 years ago, # |   0 What does ecnerwala mean? How many girlfrineds? Other hobbies except CP? If ecnerwala didn't choose to be a competitive programmer, what would he have done? Atcoder vs Codeforces? How to improve? I am practicing but my rating decreases.
 » 2 years ago, # |   0 how did you think of the idea of putting your name in reverse? it looks so cool!
 » 2 years ago, # |   0 What is your favorite show?
•  » » 2 years ago, # ^ |   +10 I really like the first few seasons of White Collar.
 » 2 years ago, # |   +5 It seems like you really love lambda expressions, any particular reason why?
•  » » 2 years ago, # ^ |   +21 I just hate globals. Also, you can define lambdas near where you use them so that the control flow is still obvious.
•  » » » 2 years ago, # ^ |   0 Is the Y combinator+lambda as efficient as an explicit recursive function?
•  » » » » 2 years ago, # ^ |   +3 I think it's essentially just as good, though I haven't done any benchmarking. The assembly does get inlined the way you want.
•  » » » » » 23 months ago, # ^ |   0 I learnt using lambda functions from your submissions, and this is how I decreased the runtime for the first problem I solved using it:529ms : 90710626451ms : 90711407the dfs() needed a vacant priority_queue for every test case and I didn't know any better way!!!
 » 2 years ago, # |   0 From Where do you learn new algorithms?
•  » » 2 years ago, # ^ |   0 Other people mostly, sometimes papers or blog posts.
 » 2 years ago, # |   -29 who is binod man??
•  » » 2 years ago, # ^ |   0 Some cringe shit.....ignore
 » 2 years ago, # |   0 What do you usually do when you are free ? Or you are always busy ? :D
 » 2 years ago, # | ← Rev. 2 →   0 Challenge: Solve your next contest problems in python only
•  » » 2 years ago, # ^ |   0 Naw, I don't want to deal with fast-Python-io and stuff.
 » 2 years ago, # |   +29 Why you don't have an avatar on Codeforces?Also: if you could only solve problems from one of these platforms: Codeforces, Atcoder, or Topcoder, then which one would you choose and why?
•  » » 2 years ago, # ^ |   +7 Too lazy to set one, I guess I'm not photogenic enough.I'd probably choose CF, mostly for volume.
•  » » » 2 years ago, # ^ |   0 Do you have a mirror then?
•  » » » » 2 years ago, # ^ |   +38 ecnerwala proceeding to set a mirror as his avatar
 » 2 years ago, # |   0 How were u introduced to CP and what year :).
 » 2 years ago, # |   0 Please advice on how to practice CP.
 » 2 years ago, # | ← Rev. 2 →   0 i am a first year B.Tech student . Just wanted to ask how to become good on codeforces
 » 2 years ago, # |   0 Are you ecnerwala?...it's ask me anything after all.
•  » » 2 years ago, # ^ |   +56 You can ask, but I don't have to answer.
•  » » » 2 years ago, # ^ |   +138
 » 2 years ago, # |   +15 Is ecnerwala interested in starting a startup?
•  » » 2 years ago, # ^ |   0 Potentially in the future!
 » 2 years ago, # |   +6 Are birds real?
•  » » 2 years ago, # ^ |   -10 How can birds be real if eyes aren't real?
•  » » » 2 years ago, # ^ |   +16 I think people didn't get this one.
 » 2 years ago, # |   0 Can you be my mentor for competitive programming?
 » 2 years ago, # |   0 How to be able to think CP questions in free time(like pooping or bathing). I don't have enough time for practicing. This semester's like hell. Not even a single hour to study. Sme tips on how to manage time for CP?
•  » » 2 years ago, # ^ |   0 It definitely sucks to be super busy, there's not really any CP-specific time-management tricks I have. You just have to prioritize and make sure you're efficient with your time.
 » 2 years ago, # |   0 (1) is it better to build observation skill (by solving tons of constructive algo tagged problem ) first then go for complex algorithm or Simultaneously practice ? (2) currently my practice is only cf based due to good editorial or should i practice from different different oj ? (3) im not participating contest for last 3 months due to rating oriented , my goal is to solve as much as quality problems . is it good approach ?
 » 2 years ago, # |   0 How do you feel having to get up in the morning at 730 and giving a contest? Does it get you all set for the day?
•  » » 2 years ago, # ^ |   0 7:30 is pretty early, so it kinda sucks (could be worse though: AtCoder is at 5am). I don't know if it really sets me up for the rest of the day; it's a lot of mental energy to compete.
 » 2 years ago, # |   0 i want to be a good programmer like u,, how can i do it??
 » 2 years ago, # |   +6 Have you thought of becoming one of the best when you were just starting?
 » 2 years ago, # |   0 Do you think knowing algorithmic theory is important for CP, i.e proof of correctness of some of the famous algorithms...etc. Also, where did you learn C++, you look really skilled with the language.
 » 2 years ago, # |   0 How do you deal with procrastination?
 » 2 years ago, # |   0 Do you have any advice on getting good at competitive programming quickly?Also do you have any advice on what I should if I cannot solve a problem other than reading the editorial? (because just reading the solution feels kind of useless ad you don't really seem to be learning anything that you can apply on other problems)
 » 2 years ago, # |   0 How 2 nutella?
 » 2 years ago, # |   0 What problem paradigm (e.g. graph, dp) are you strongest/weakest in?
•  » » 2 years ago, # ^ |   +31 I'm pretty strong in some mathier areas like counting or NT, as well as generally pretty good at implementation. I think I'm weakest at heuristics/constructions.
 » 2 years ago, # |   +17 As a Californian, is there any particular reason that you chose MIT over Stanford?
•  » » 2 years ago, # ^ |   +3 In general, I think it's good to go somewhere further away for college, otherwise you're really always in the same little bubble. I like the culture at MIT a lot.
 » 2 years ago, # |   0 ecnerwala have you ever participated in IMO?
•  » » 2 years ago, # ^ |   +8 No, I came close though.
 » 2 years ago, # |   +16 Are we in a simulation?
•  » » 2 years ago, # ^ |   0 Probably not.
 » 2 years ago, # |   0 How did you choose to study CS at uni? Did you have any other interests in other subjects? If so, what made you choose CS?
•  » » 2 years ago, # ^ |   +3 I had already done a lot of CS in high school, so I knew I was interested for sure. I also was interested in math or physics, but ultimately I liked CS too much.
 » 2 years ago, # |   -20 I was stuck in Round 664 Div2-C for more than half an hour. People say if you are stuck for more than half an hour, you shouldn't try more and just wait for the editorial. So, I gave up. Later when only 15 mins were left, the idea struck my mind. And I couldn't implement within those 15 mins. But after the contest, I submitted and it was correct. So, how should I decide whether I should give up or not?
•  » » 2 years ago, # ^ |   +11 You should never give up on a problem during a contest; that advice is for upsolving/practice, where you could potentially keep working indefinitely if you so chose.On the other hand, it can be good in contest to take a break or think about a different problem, so you can come back with a different mindset/different ideas.
•  » » » 2 years ago, # ^ |   +25 It's perfectly fine to switch to the next problem (even without the intention to getting back to the previous one during a contest).
 » 2 years ago, # |   0 Did you solve problems from UVa online judge?There are very good problems and a vast number of hard problems but the problem is there are no editorials(idea, proof, etc.) for the problems. Codes of other participants don't help to properly understand most of the time.Definitely it's true that many people somehow solved many problems from UVa in spite of this difficulty, I don't know how they did it. If anyone knows how they did it then reply, please.What do you think ecnerwala, what should we do when we stuck for some problems in UVa?
•  » » 2 years ago, # ^ |   +10 No, I've never solved on UVa.Solving problems without editorials is definitely a tricky thing to do. I would recommend talking to peers about the problem, and if you still can't find a solution, it probably is actually slightly too hard for now; just set it aside and come back in a few months/years when you know more and then take another stab at it. Having problems open in the back of your mind could lead to you discovering something!
 » 2 years ago, # |   0 hi as you can see i'm a newbie i can most times solve problems a and b in a div 2 contest's but i never get near solving question c because i still haven't studied any important algorithm'swhat are some recommended sources for lists of important algo's and good practice questions for each of them?ps: for math i'm mainly focused on improving my combinatorics I'll b happy if any one could recommend any other critical math subject for CP
 » 2 years ago, # |   -24 Trump or Biden?
•  » » 2 years ago, # ^ |   +42 Kanye West
•  » » 2 years ago, # ^ |   -8 Narendra Modi
•  » » » 2 years ago, # ^ |   -11 BINOD
 » 2 years ago, # |   +11 Your favorite video game?
•  » » 2 years ago, # ^ |   +10 Maybe Bastion, Exapunks, or The Binding of Isaac.
 » 2 years ago, # |   +16 Hi, Do you believe in God?
 » 2 years ago, # |   0 Hey have you ever got mentally exhausted with a problem in a contest? like "I don't want to think anymore" kinda stuff
•  » <