Competitive programming serves as a powerful metaphor for life, where participants experience intense emotions like joy, heartbreak, and self-doubt while learning to construct mental models, persist through failures, and continuously improve through reflection and humility. The process of solving algorithmic problems requires being fully present, managing strong emotions, and learning from both successes and failures—skills that directly translate to personal growth and resilience in life.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Restarting | Comp Prog Reaching 2000 Rating | Part-150 | STREAM
Added:And I'm live. That is pretty cool.
Today, 16th of July, 2026.
And yep, Thursday. Today's Thursday.
Tomorrow will be Friday, which would be the last day for the week, which uh feels very good. And also ODC is coming out tomorrow. So, yep, special day. And yep. And so, I'm restarting competitive programming. Why? because the playlist the title of the video says that I have to reach 2,000 and I have not reached 2,000. So I want to reach 2,000 by the end of this year like for real this time. It is July right now. So I'll see how we can reach 2,000 by the end of this year and it would be pretty cool.
So right now the rating is 1325 and I have not been solving any problems for a long time. Yep, it has been a long time.
So yeah, the strategy would be first of all um before becoming better at competitive programming, I have to get back into the mode of solving problems like fast in the competitive programming way. So what I will be doing is I was following this thing CP31 till now. So I would just resolve few problems starting from 1300 rated and yeah we will just continue and one more thing would be CCS and we'll see when we can solve CCS problems. I've been solving a few ones and yeah let's see how it goes. So problem number one and I have already solved all these problems but just to get into the phase of competitive programming we will be resolving them this one and our timer stopwatch and is everything set Everything is set up.
Uh we can start the timer.
Individual pairs. Polyarp has two favorite integers X and Y. They can be equal and he has found an array A of N.
Polycarp consider a pair of indices I J.
Okay. Where J is literally bigger than I. Beautiful. If the sum is divisible by x and the difference is divisible by y. For example, x and y are five and two. Okay. Here five and two. Then the only beautiful pairs are 1a 5. 1 and five. The sum is 10. And the difference difference difference difference 1 - 9 - 8 - 8 is divided by okay difference and four and six four and the last one 6 is 10 and the difference is minus by find number find the number of beautiful pairs in this and the time complexity number of n. Okay, we cannot do n². We cannot do n² like what makes sense. We have to do something else here remainder.
Yes, I guess.
Okay, first of uh we can just uh okay for a pair of indices to be beautiful two conditions have to be fulfilled. We can first of all find all the beautiful pairs all the pair of indices which fulfill this condition and amongst them we can find something find the list of indices which fulfill this condition. So we would be like taking end of those two lists of integers. And for figuring out this we can take we can convert this thing into by replacing each element with the remainder of the number with x.
And so this would be converted into 1 2 2 4 4 1.
Yeah.
And something to do with the remainder and this will be 2 + 4 would be 6.
1 + 4 would be five. Yep.
Yes.
Okay. And X and Y.
Wait. And podium is on. Uh, turn off podium.
Pool.
Okay. and to X and Y is N view and for reference X take an X. Okay, we have this and we need to make this into two different X and Y power Y. We have remainder remainder.
They have to be literally the same thing x size and value is zero and we can declare them uh together. Y M size M and likely declare everything that X M 0 Y cool and we can use the transform function XM equals transform. Yes. And this takes I think a few things.
Input iterator output iterator. Unity operator makes sense.
Input speed on begin and begin.
and the function uh x or to a reference to some value let's say i and return I remainder that works. Do you have to I hope that will work. We'll see.
And the same thing with Y.
Let's print and see if it is even working.
Okay. And it seems to be working.
Yo, hello.
Cool.
And it is okay.
Vector of pairs of integers response.
Okay. initialize this.
Now, I think instead of making a vector, we can make a map.
Yep, that makes sense.
uh we can make a map and at the and end where the key would be remainder and the value would be how many times we have seen that remainder that makes sense for both them that but we would lose the information about uh which pair we are at currently.
Hello. What is the deadline to reach 2,000? Um, this year hopefully this year by the end of this year I want to reach 2,000 and now I don't even have you could say the desperation of not having a job. So I can focus on this thing. So which is pretty cool.
We do need number but we also need to know which indices we are currently at.
And also let me send the link here. Let me in.
That's what I said to her. But uh where?
Let's Okay. Yes. Cool. C full. Like of course this is open to anyone. Let's reach 2,000 together.
Uh yes, there is a group in four courses.
It is me and two other people here. teams I can add you also here candidate master and whoever whoever amongst us reaches to the first wins yep that is the competition you can also add you I don't know your name user what is your name uh send your uh username and I'll add Yes, we We will use a map.
We will use that map. Yep. Uh instead of a vector, we will use a map. We'll be using a map where the key is an integer and the value is a vector of integers and same is one. Cool. And no transform.
We cannot use any transform.
And you can do this right here for int x or in i in a x dot insert.
How do we insert in this? Uh uh the key would be like I forgot.
Yes. Oh, first uh this how we do it. Uh do the index. Okay, we need the index of what I and X Y remainder Y dot push back the current index makes sense then we will start it for auto ID in extreme let's Or we could destructure this remainder and delete.
Yep.
And we need to do something like it from left to right.
of it would be x - m and opposite list exists.
Okay. And then for end I N opposite.
Okay.
Okay.
And if I is smaller than J, this is the first condition.
I have to be smaller than J.
And we don't need this second and I and Z are indices. So a i remainder with y has to be equal to a j remainder with y.
If these two conditions are true then we can say test dot back or place back also works and the answer got yo dot push back empty.
I forgot what and also what is your username in code for uh I will add you to this list you have to just output the sign of this which means we don't even have Yep.
Hopefully this works and it does not nest up here. And in the second last case, second last is this. We said three. Uh we said seven but the answer is three.
2 and three. We said seven, but the answer is three. And did we say seven?
I suppose the same indices are getting dragged multiple times, but here. Okay. Okay. And the actual answer is seven. We out P and five P five 0 3 and five H 0 0 is this correct? If you add these two 30 is divisible by two and if we take the difference 0 is also divisible by 3. That is and then is 3 and 8.
Okay.
3 and 8 8 is this 15 which is also true.
Okay. But there are seven such things.
And the last one is 5 and 8. 5 and 8. 15 and 15. And we are not getting anything else.
Both the numbers have to be even. This and this sum is even and the difference is 8.
8 is not divisible by three.
12 and 24 is also not divisible by three. 8 and two. 8 and two. This would work. We are not counting this. This is correct. Yep. This is a beautiful pair.
But we are not counting this somehow.
So this is your generic username. I guess your username.
Yo, let's go.
Right. I sent you an invite. Can accept.
And I was sending the link that didn't reach. Yes, you cannot send the link here somehow. I don't know why.
Okay, we uh the algorithm that we have written here is not counting a pair like this 8, 2. Why? Because when we subtract from 2 8 we get - 6 which is negative.
Remainder remainder remainder remainder of this with two when it is zero both makes sense makes since we need to have a separate condition for zero.
Yep. Um if or if not equals zero makes And it works and I guess you can submit work. How much time? 21 minutes is very long for 13 problem but fine.
And what do we have to put problem name 31 C++ 23 let's see by the Okay. Uh he was planning to give all contest or just uh one application.
There is a contest. Uh I'm not planning to give a contest right now. I will be giving in some time and by you guys I suppose you mean the people in the group and we do not coordinate on anything. We just have a group and yeah we can do whatever we want. We just have to reach 2,000 without cheating of course.
We do not practice together or anything.
Yep.
NQ. They need some DevOps engineer. Thank you. I guess I can stop this if this is correct. That is while it is in Q, we can move on to the next problem because I want to solve like more than five problems in a day. So, let's move on to the next one.
Okay. This one like this. We don't we should not even have a timer because you will be doing multiple problems. Time does not matter. H this one is still Q A and you're given an array A of n inteious and Q queries. Each query is represented by two integers L and R. Okay, they can be equal to each other. Our task is to find for each query two indices I and J or determine that they do not exist such that I is between L and R. J is also between L and R.
Okay. And the numbers are not equal to each other. In other words, for each query, you need to find a pair of different elements among the given range or prove that such a pair does not exist.
Okay.
Okay, query problem. So we need to have some pre-calculation on the data that we get so that we are able to answer output the queries easily.
Okay. There can be a lot of queries makes sense.
Okay. And the output output has to be the in indices or minus one - 1 in case if nothing if there is no answer. Nope.
No, I'm not given today's contest. Uh I'm not even able to solve these 1300 rated problems very quickly.
So no, but I will just start giving it in some time. Okay, I just started and I'm around 800 related. I solved around 40 uh 1,000 related problems. Still cannot solve one day related in contest.
Sherlock for your Yeah. Uh we do not cheat. I mean you just give it some time and side by side you can start reading some theory. Where is this book? CP and book.
You can refer to this for theory.
No You can read some theory from this book.
It has some stuff uh data structures you would be needing in C++. Greedy algorithm, standard programming, emotion. And the problem that we are doing here right now here this one this also I guess is from a chapter yeah probably the theory for that yep range queries some one of these theories is going to be used there. Yeah pretty cool.
We need to do some pre-processing on this play tool in N. And what are we getting?
Just n a n okay for ref x and then q and q okay q - l and are declare them here or above here does not matter. It does matter. We will be redeclaring it redeclaring them every time if we put them here. So it fine that they here there. And now we have to write our logic find out.
We have to do some pre-processing on the sector A so that we can quickly output something here.
I think we can have a set or two sets something like obsidian.
uh we will have our initial array a which will have multiple elements and what we'll do is uh this array would be something like this uh a range would have the same same elements both of these are one and then we have a random two here then a bunch of threes then a single one a two. So we can divide this uh original array into sections where the or subarrays where all the elements in the sub array are same like here 1 1 2 3 and that and then we can have two maps or two sets ordered set and one set would have the starting index of all of these subarrays.
And one would have the ending index of all of these of all of these subarrays.
And when we get an L and an R, we need to find a starting index that is equal to or smaller than L.
In this case 0 1 2 3 4 5 6. If we get an L that is equal to 1 that is equal to 1. Yep. And an R that is equal to let's say five. Then we are interested in this starting index in zero. Makes sense.
Uh okay. So for L in the starting index map we would be looking for indices which are equal to L or smaller than L.
And for R we are looking for Yep. Uh for indices which are equal to or greater than L that would be the upper limit which can also be equal to R. Yep. uh that would mean the lower limit function in yeah lower limit function in C++ and for calculating this we can take index is lower limit of L minus one iterator to the lower limit minus one set of integers starting N and ED for end and then our pre-processing for L= Z R = Z while R is smaller than N and L= R while R smaller than N and A L= A R. This is a very cool way of finding out subsets.
pool and you can say st dot insert l and st dot in or ending edg dot inert rs.
Yes, that does put letters and for cases.
Yo, hello.
What kind of what kind of hand do you give her for?
Uh, let's do competitive programming.
Uh yep for elements for subsets you could say sub arrays which only have a single element h for them the starting and the ending index would be same and would we be able to figure out what we have to output the index I will output the index for l= 1 and r = 5 you will get the starting index 0 and ending index 5. And how do we figure out?
Yep. Uh we will also find what is the next starting index after this L that is greater than strictly greater than L.
Strictly greater than L. Yep. Strictly greater than L. Um which would come out to be two. And for R what is the most previous or I think we it would just work with this.
Yeah.
This auto dot= dot lower bound L - 1 L of Okay, you good.
- makes sense or would be ed with R.
makes sense and auto next let's say would be dot upper bound L we have Yep.
I think we don't even need this.
Yep, we don't need this. And we don't need this. We can say go to this point and go to this point.
Yep.
and also L - and R - because these two are one based index.
Uh what is your CF endle? It is walrus I think. Yes. Wireless 137 and SPT it's greater than or equal to ED Then C L - L + R.
That makes sense.
Let's see how minus one.
H. Let's see. Uh, would this work? Would this work? Would this work? Lower limit RD.
Wait. I messed up. Yep.
Next. End. Let's see. And next start.
And if the next next is greater than equal to next start then we are okay with the next end.
shape. No Uh I made this too complicated. Uh can just say bend next equals we don't even need the ending indices.
Nope, we don't even need this ED map.
We can just here say SD dot upper bound on L. Get the upper bound on L.
And if next is smaller than or equal to R then we are okay RV yes we are next smaller than or equal to R then we are okay otherwise we are not cool that makes sense yes if we are not somehow expected And we got this is what will be this time to check for minus1's. Yep. -1 -1. Yep. We are getting minus one whenever we change.
This is correct. We can submit.
And this one is still in Q. Uh something is wrong with find different ones.
Submit. And why is it asking for problem number every time?
Yes. Technoblade literally never dies.
Uh yes, I'm from Greenland. Of course, like you can tell. That should be obvious. Please reply. Har.
Hello. Hello. How are you? Yes.
Everything going cool.
Uh what is the problem number? 19270.
Who 19270? And it said you have made me self-conscious.
All good. That is cool.
Let's see if this is correct or not. And code forces is taking quite a bit of time and we need results right now. So let's switch from code forces to CSS.
We'll be doing problems here. All good.
Um that is very good. I hope you are doing like amazing.
Yes. Yes. And you are doing go. You're fine. All right. Great work. Thank you. Why are you making coordinated uh DOS attacks here?
Let's do this problem. Chessboard and queens.
Only 20,000 28,000 people ever in history have been able to solve this.
Let's see.
We can break it. Uh your task is to place eight queens on a chess board so that no two queens are attacking each other. As an additional challenge, each square is either free or reserved and you can only place queens on the free squares. However, the reserved squares do not prevent queens from attacking each other. How many possibilities are there to place the queens now? Okay.
Okay. We can This is like basic competitive pro not competitive programming dynamic programming problem.
We can do this with recursion. Uh yes, we will have to figure out. I have not solved something like this in some time.
No s backtracking. Yep, we have to use backtracking here. We will try and put queens wherever we can and we will backtrack from there. We are putting a queen at the wrong place.
Cool. That makes sense. That makes sense.
Just have to take this as input and decode this past here and start here and go. Great work. Thank you.
And you were uh sending some cool messages in WhatsApp two nights ago. You deleted them later.
If we uh Okay.
Okay. We'll take this as input. Podium.
We have to turn off strings or a vector of string.
for zero I par string initialize pin t and that's all push Uh now we have to decode this into a vector of vector of boolean.
Yes, vector of vector boolean or we could use this. No, it is fine.
We need two grids. Um, one would be used to see if we can place uh if we can place a queen at a certain block whether there are like these whether the current block is free reserved or not. And also we need another grid where we would be putting till queens. And yeah, we can call this as in like reserve and size is zero. What do we need? We need a vector of pool and size here eight.
And initially false and we don't even have to give the type here because C++ has a thing called td class template automatic detection class template automatic section or something where c uh depending on what we have given here inside the constructor C++ compiler is able to figure out what should be the uh types given to the template of this data type class template or argument prediction data.
Now for in auto s or n s we we also need = 0 + j = 0 is smaller than 8 + and F S I J equal equ= then S I J = 2 or I guess there could be a better way of writing this. So s I equals S I J in that is more concise and makes sense.
Okay. Now we have to start backtracking.
We'll go layer by layer. I follow say somewhere that N= 8 with N++.
Okay, we are on layer one. And also we need another thing to judge whether we can whether two queens are able to attack each other or not.
And there are only three ways a queen can attack another queen. Either they are on the same row or they are on the same column or they are in the same diagonal. And for two to be in the same diagonal there and uh diagonals there are two diagonals like this and like this.
I did read something about figuring out if two things are on the same diagonal.
There's a way to judge.
Okay.
work. Keep going.
Okay. Why? You should not have given the money here and you have to give not 100 rupees but 150 rupees for the paratha.
But uh also uh since you have given the money here, you two will keep like 40 or 50% of this. But thank you bro. This is my first super chat. That is cool.
Watermelon. Of course I remember Kilima.
you yo that's that is crazy some crazy question he was asking are the only one who is in the position of a senate no there are other people also and hello you are a new person how super dirty how was super dirty super dirty is still going on uh it has only been 2 months and yeah it was cool like at least for me it is cool are you still there in super dirty or what I went for Janet I am living in Guro now.
Yep.
Why is it auto translating?
Yes. Uh pizza is better. Pizza is better. But sometimes paratha is also better.
I'm solving CP competitive program.
Uh we uh I gave the one the recent one on Sunday and was able to two problems to first ones and said Kabiva you also have to give me 50 more rupees give them in super chat like here it would be cool instead of giving you yes a direct GP you are bro it has been long Wrong time.
Only code.
It is showing 8 p.m. on your PC. Yes, it is 8:00 p.m. It is night outside.
Okay. Sh. Uh, yes, it is uh the night months going on in Greenland. I'm currently living in Greenland. So, like yeah, for 6 months we have night here.
So, it is those 6 months going on right now. We do not have sunlight for 6 months.
And also, yes, uh I might also be using VPN. I don't know what is my lead to rating premium. Hope I could buy it.
Uh I guess that is very bad. 10 million contest rate 1400. That is I think good.
Okay. Uh yes, we have to figure out how to quickly figure out without traversing the grid that two queens are in the same diagon. So we have something like this.
It's a chessboard uh eight. Okay. And there is also cool way uh when you want to divide something in in like into n parts and that n is a a power of two.
Divide them like this.
I think I'm doing the right thing.
Now there should be eight pieces. 1 2 3 5 6 7 8. Yep. That is good. Nice little trick. Divide from the middle. Then divide these two halves from the middle.
And now divide these four halves from the middle.
Perfectly straight lines.
Uh, yep. So if a queen is at this index and another one is at this, we can see that these are not in the on the same diagonal because there was also pen feature somewhere. Laser pointer. Yes, laser pointer. And this just goes away in a bit. This is very cool. Uh we could either be at this queen and we can start traversing in one diagonal and see that there is no queen and then on the next diagonal next and the other one. But this is very inefficient. So there are other methods to judge whether they are on the same diagonal or not.
See one of them is we take the sum of the of both the indices the row and the column. So for this it would be five and for this one it would be two and it is something like if they are not same then these two are not on the same diagonal something like that.
Okay. And and the difference here is one.
Let's uh for each cell, let's write down two things. One would be the sum of the index of row and the index of column and the other would be index of row minus column. So for this it is the sum is four. And the difference is not the difference but yeah the difference this minus this is zero. And for this sum is 5 difference is -1 6 - 2 so on and here the sum is 3 + 2 5 and difference 3 - 2 1 and here 6 7 and the difference here would be 4 - 2 2 and here 5 - 2 3 6 7 8 7 8 Cool. Makes sense. And 3 - 3 0.
And as you might be able to see 1 4 - 3 1. Yep. As you might be able to see even now that sum here is five and here also it is five and these two are on the same diagonal. So whatever cell is on this diagonal will have the sum of its index equal to five. Why?
Because whenever we move on this diagonal one of the number decreases like the number of row decreases and the index of the row decreases and but the index of the column increases or if you are moving in the opposite direction then uh the index of row increases and the index of column decreases. So yeah vice versa. Therefore the sum always would be equal to five. So if two cells have the same sum then they are on the same diagonal in this direction but if they have the same difference then they are on the same diagonal in the opposite direction and the same logic of one of the index being increased by one and the other being decreased by one applies here. Boom.
Uh, I got a job like literal job, not an internship.
Yep. Points. Okay. X and Y difference.
Same number. Same. Yeah. Same. The difference or and the sum both.
Okay. Sharaja, big fan. Uh how can I block?
Let's see.
And Kabi is also college student how well are you being paid if you don't mind sharing and what is your role? My role is as software developer uh engineer ST1 and uh pay I won't tell you the pay but I'm happy with the pay whatever it is.
Yeah, since this is my first jobs and I'm getting experience. So, yep, I'm happy. And I'm also still in college.
So, that job.
Yep.
Wait, but uh this logic would be valid if we already are storing stuff.
We could either keep a set And whenever we add a new queen on the board, we would add the sum of the indices to that set.
We would have to keep two sets because yes, we would have to keep two sets or or or something else. Yes. Yes. Um NP handbook they give a trick in some chapter I think in complete search or something in one of these chapters they say that we can the minimum sum is going to be zero and the maximum is going to be 7 + 7 which is 14.
We if we have a queen in one of the diagonals then we would just uh we would have a vector of boolean values whose size would be there would be from 0 to 14. There would be 15 elements in total. And whenever we put a queen, you take the sum and make that specific index in the vector equal to one.
15 elements. All of them equal false initially.
And you put uh you can write here like 15 values and response.
This would be the positive one. uh some D some diagonal di and difference and for difference we have to do something else because in case of sum we can just take the sum and use that as the index but here we have to do some kind of translation the minimum sum would be in this case minus 7. So we could just add seven to all the differences.
That would make sense.
Cool. And we need something else also.
column there are eight columns false.
Cool.
We are going row by row. Okay. And and this is like very basic stuff.
Okay. Fine.
We will only compare previous queens.
Yep. But for that we would have to go through all the previous queens. Even though there are at max going to be only seven queens but still we can make it better.
Yo Roy uh what text tag are you using in your website? uh and LMS straight uh just basic NodeJS Express server react for the front end.
Yo, okay. Uh come to my flat PG. I'll get food for you. Even though you do not live here, I secretly smuggle food for Kabir here.
any app for your limit. Well, I know there's no app there's only website limus zenithchool.ai and some secret credentials that only I have and also for also has access to those secret credentials.
and I uh yep will be backtracking backtracking = 0 15 already have uh So uh can we put a queen at I J? We can put a queen at I J.
If there is nothing in the I place nothing in J.
said this has to be recursive not like this. Uh what would the function look like?
Backtracking this take the current column where you want to place the green.
Right.
And It should also have access to the We are updating the global one. We will how to write backtracking algorithm.
Okay.
Uh this is cool. Uh if we just keep trying we will get better. No problem.
Trans.
Okay. Backtracking. Uh what we will do is we will move row by row calmly.
We will be moving row by row.
Okay. On this row, we'll put a queen here. And cool. Then we will put a queen. Then we will after putting a queen here. We can call the function with the like index of this next row.
And it will try to put a queen here. And if it can then pull uh if it can put a queen there, then it will call the function recursively for the next row and next next till we call.
If we are able to put a queen at a certain place in the last column, then that means we have a valid solution.
Then we will increase the response by one, the answer by one. And cool.
So this will just catch you can write iteratively without recursion. That would be good.
That would be better.
have make this thing recursive and see and I = 0 smaller than 88 create five.
Okay.
Okay. Can we put a this is at this current place? Uh that would be they are not sharing the same row. We know that are they sharing the same column? Uh column. Okay. would be if only uh diagonal one. Okay.
Or we can just give them here directly.
Column bracket I nothing is there.
Nothing at this column and nothing in diagonal S when we sum these two things C + I and nothing difference of C - I + 7 that is Okay. Then we can put something here. Now if = the last row then answer increment the answer pass and else if that is not the case uh then put a queen there should mean l i equals true put a queen there and diagonal R + I = 2 and D R - R + set= to put yes that mean we are putting a there and call this thing with R + 1 and then Let me make sense. Makes sense.
It makes sense. Uh you buy this fall back.
Hopefully this works somehow. Let's see.
It does not out of bounds error.
Okay. Was it built already? Uh so what we have is we have hired a different service which is making the LMS right now and they will go away after the end of this month and then it will be on to us to add new features and to maintain the whole thing. And also I have some TA stuff. I am TA for maths which is pretty cool. So I'm brushing up my math skills building a app. It is so painful. My website is so it's quite enjoyable and build compared to that. Okay. You are building a app for Android or for where are we going with ago? I didn't even know this. I went to full stack Python.
Okay, that is pretty cool. Kilwa, bro, you are literally killing it. Literally Kuwa.
uh like how uh people making full stack in just one week. I mean building and knowing how to build are two things. You can wipe a whole thing.
I wipe coded a extension using cloud given to me by my company.
I have claw access whole here. Uh yep. I have not used anything in the last 5 hours.
I know used this to make a extension but I don't know how to write a extension. So yeah I was able to build it but I don't know how to build it. I would not be able to build it myself. So I cannot say that I build that thing if that makes sense.
Where is this one? Yes.
Okay. Uh out of bounds error. We are getting out of bounds error somehow.
Probably because of this. Yep. Probably because of this. Because how how can we declare vectors beforehand? That does not make sense.
Yep. We are not even able to call this function once.
Makes sense.
Is it because we are getting out of bounds here more than n taking? Okay.
Let's string to S.
We do see this.
Did you see this? Uh, so we are getting out of bounds here. I and J I and J.
Okay, we are getting out of bounds because of rest. So yeah, we have to redeclare rest later here.
Press sign of this works. And you have to do the same for column I suppose.
of volume and we have to remove this definition from here.
Okay, is on.
Assign 15. Everything is false initially.
Dign 15. Everything is false initially.
What was the last one?
sign 84 makes sense.
Okay, hopefully it works now and it does not.
We are getting out of bounds here. I and J. Why are we getting out of bounds here?
Okay, because this has to be my right. Uh 92 is wrong.
92 is wrong.
two is wrong. That is correct. Did you join Algo Zenith SST? Algo Zenith. No, Zenith School of AI. I am at Zenith School of AI. You have paid version of cloud or something from college site.
No, it is from my company Zenith School of AI. That helps a lot. Free version hallucinates. Yes, I I also have access to Fable.
Yes. Pretty cool. That is pretty good.
Something is wrong. It is counting more things than it should be. And this is a very like basic backtracking problem.
This is the example that people give when introducing when they are introducing backtracking.
Okay, makes sense. We cannot just make these things equal to false.
That might be the error. We cannot just make these things false. We have to revert them to whatever their original values are. Makes sense.
Original or column original and diagonal S original and diagonal D original and then uh here diagonal column O original is uh always equal to false.
Yep, we don't need it. We know that it was equal to false. But here diagonal S will become diagonal S bracket R + R and diagonal D horiz.
And later this will become equal to false and this whatever the original value was diagonal x original and diagonal d I guess that was the error.
That was not the error.
Yes, we are not checking whether we can put the thing there or not. We are not even like we are never using rest.
Let's put uh and press I bracket J I come here and this is false restriction is Cool.
And now it is still like 92.
Nothing is in this column. Nothing in this diagonal. Nothing here.
Next. The problem has to do with rest.
Is this ever evaluating to true? Yes, it should be.
is not evaluating to prove there was because of this.
Oh, cool. Uh there was the error was here. Instead of writing zero, we had J here which does not even make sense because how are we giving J its initial value?
So yeah, I guess it was just taking some random value.
Now it is correct. Now we can submit.
So how much how do you make changes in your website and do you use mobile extreme or I don't know what mobile extreme is but uh I have the version running locally and I tell cloud whatever I need to do it makes the changes and if they are working fine locally then I push to production was there some work on which you got stuck or took a lot of time while working in your company if you can share no there's not a lot of work right now because students will start coming from August and right now we have given the contract for working on LMS to some other company other service- based company. So we are not majorly working on LMS. As a developer right now I'm just finding bugs in the LMS and I tell the workable people which bugs they have to fix but they are not fixing the bugs. They are like just adding new features. They are not listening to me.
They are not even listening to the co-founders doing some crazy stuff of their own.
We submit and see if this works. This board and queens CS yes and queen C++ 23 and hopefully this works.
Okay, cool. Cool. That is cool. Uh, accept it. Agree. I was not expecting it but also on code forces. How are how is our submissions?
How are our submissions?
Time limit exceeded on test case 12 and the other one is still in Q.
Oh, that is cool.
So you are free for now. You are your main job will be to teach maths. Not teach I will be TA. the teacher, the instructor would be teaching maths and if someone some kid asks me some question then I would just answer is like very chilling I don't have to do anything literally anything I'm getting money for free and I would become like their best TA and I can ask for raise in my salary that that is like my peak plan no one knows about this plan only I know and also yeah uh bin toki So we were able to do that. Wrong answer on test one is crazy. Wrong answer test one.
How did we get the wrong answer on test one on test case? Like literally one the first on the first query we messed up.
Ai and AJ. Or did we output? We output one and five.
Okay, which makes sense. One and five in the first one. Cool. It makes sense.
Cool. Yep. Yep. Makes sense. Makes sense. We have to put something else. We have to put something here.
Yeah, the logic is correct. Uh, yep. We just have to change what we are outputting next. I guess you can just output next. That would make more sense.
Can you output next? Next is uh greater than L. Yeah, we can put next expected three and Yep. One and two.
Next one.
One and two. Still we are taking one and why are we getting one and two? What is next equal?
We should be uping one and see if we and wrong because next is not the index. It is literally the element H.
No, it is the index. It is the index. Is the index? Yes. Next is the index.
Should be working 1 and three. Cool. 1 3 uh problem 297.
We can finally select companies watching this stream and stop share. No. Uh I hope no they are not watching. This guy was watching. He's also working there as an intern and now he's in gym. So yes, he was the only source to tell them but now he's like gone.
Thank you. And this will take a lot of time. in that meantime.
And yeah, uh the browser that I'm using, this is Zen browser, which is very cool.
I can have work spaces here. One workspace for work, one for live stream, one for music, one for surfing, just random on Google and one for YouTube.
Let's solve uh next problem in CSS.
While this one is getting checked, this is like very bad uh code forces.
It's falling down.
They need DevOps engineers.
Should we try this one? Only 7,000 people have been able to solve this one.
I guess we should some challenge play chess.
Okay. Okay. We can play chess. We can play chess. That would be cool. Let's play one game of chess.com.
I guess I would have to log in.
Yep.
Google check one.
Please send me your username. I will send you a game request or something.
I guess we are friends.
Yep.
Okay. Send me a challenge. Send me a challenge. Or will this Challenge 1 minute bullet.
Do you have the challenge?
Okay. Waiting.
This is still in Q. This will be the next problem.
See, I just for warm up. It is your turn.
Then we can play a big one.
Yeah.
Okay. Okay. Now we'll play a longer game. My bad.
Send me a request for a a longer game.
Then we play the game. I want to start playing some music but uh copyright.
Why is this auto translating?
Uh, I thought I will use this I Why is I translating to this 5 minutes? Okay, let's go for real. For real this time.
Wait. There's someone at my door.
Uh, I would have to wait. Uh, accept my draw. There's someone at my door. Wait a minute. We'll start again in a sec.
Accept the draw.
Let me mute.
probably.
Cool. And I'm back. It was my friend. He was asking for something.
Let's just uh do a rematch. Resend the request.
Okay.
you did a rated uh I mean you would be the one losing.
Wait, wait, why am I this rating lower?
I guess it is because this is for 5 minutes.
We can play if you are okay. Yes, I am okay. We can play. Hello I might superior e4.
Okay.
Okay, see I messed up. I was not able to convert. Oh, it was good. It was good.
Can you use cloud for code three in your terminal or anything any other thing? If you are using the model locally using uh using LM studios or Olama then you can use cloud for free but you would not exactly be using claude but my bad I do not remember my for that you need codeex or fable I guess codex is another application like cloud code f is model like these are two different things you can use anti-gravity. It comes with you can use anti-gravity cursor or some IDE.
Uh they give some like free plan at the start. You can use them and then make another account and use it free plan and then make another Gmail account and use its free plan. It works like that. I don't have GitHub copilot if that's fine. You can use free plan. Nothing is free. Uh it is free product. Okay. Some philosophical stuff there. Uh should I use anthropic?
I mean that is up to you. If if they differ from you in philosophical terms, if you're not a capitalist, then I guess you should not use it.
Wait, what? Nice. I I did mess up.
Uh this video. Uh yes, I messed up. I messed up and not your typical fat guy.
How are you?
What is your rating in chess? My rating is bad. Uh 400. I do not play chess much. I only play chess with Kilwa. He's the only person that I play chess with.
I am like 21 right now.
And only one viewer and all of them. Hello Prisma. How are you?
Cool. That was good. and see wrong answer two waiting for diagnostics. It is not even giving diagnostics in the first one. We messed up in the first one. How?
In this there were six queries and we messed up in one and two. One and two answers should be 1 and two. 1 and two should be the output. What is the output that we did? Okay. Output was 1 and two which is correct.
Test case two. Okay. Uh test case two. First query uh this one first query answer is -1 minus one.
Okay, that makes sense. This is a H case I did not consider.
Yep. Yep. Yep. Output should be minus one in all of these.
Like literally all of these output should be minus one. My bad.
Upper bone.
Okay.
next.
So we can toggle next= dot and in that case just like output this index equals -1 not = to this then index equals 4 next.
Whatever the value is here instead of next uh place next with ID PB network here it does over here even though it says wrong answer but it's fine. There is only going to be one test case which will we will have a array of size five. All of them are equal to one query 1 answer is 1 0 which is wrong.
Okay. So this should not be or n would also work.
Yeah, n would also work but okay let's play at the limits. n would work and we don't have to go to n + one. N + one would work for sure but also compile one test case five= 5 1 and 4 - 1 - 1 that should work h really what I'm doing good once Kakashi once Now yes bro is like mutating updating and I also use Kakashi on YouTube there's also Kakashi in Discord server everything is very confusing who is Kakashi who is who is who is by the way a series I'm still like confused and this will has gone in Q let's problem this Only 7,000 people have been able to solve this. We'll do this while this one is getting checked.
Okay, let's see. This one is a difficult one.
Consider a two-player game where each player has n cards numbered from 1 to n.
On each turn, both players place one of their cards on the table. The player who plays the the higher card gets one point. If the player if the cards are equal, neither player gets a point. The game continues until all the cards have been played.
You given the mass, the number of cards n and the players scores at the end. For the game A, your task is to give an example of how the cards would have been played out.
H number of cards and the players scores. The first line contains the number of test cases. The second line with then there are two lines each with three integers N A and B.
Okay. For the first one it was possible there are four cards. First player score one. The second one output. What do we have output for each test case output?
Yes. If there is a game with a given output otherwise no.
The answer is this. Print an example of one possible game. Print two lines representing the order in which the players placed their cards. You can give any valid example. Okay. So in the first round first we need to give one point to player one and another point to player two. Okay.
Wait. This seems very easy.
Why is this? No.
The number of cards. Okay. Okay. Okay.
The number of cards. The number of cards is the limit. We can only have two cards here.
So when we want this player to have a score of zero, we cannot.
Okay. Here we have four cards.
That also does not make sense. Uh, one card is of one one two three four. We have three two threes here.
Okay. 1 2 3 4 1 2 3 4 It makes sense.
Okay. Cool. Both of them have cards numbered from 1 to n and depending on how they plays, we have to get to this four.
First of all uh we need six this plus this this score of player A plus the score of player B cannot be greater than four.
Yep. That is one thing that is one thing. So how do we think about this?
Player A has a bunch of cards. 1 2 3 B 4 dot till end. Player B also has cards.
1 2 3 4 dot n cards.
And each card we could say represents a single point. And we have to divide 1 2 n points into three sections a bit.
A section would go to player A that would be player A's score. A section would go to player B that would be player B's score and the remaining would be draw. It would be the like you could say turns in which both the player used the same cards.
H and these can be anything does not matter and okay let's say this is a and this is this number is b small a say and small b okay can a be equal to n it cannot B.
Can all the points go to player A? No, they cannot be. If both of them have two cards, let's say A has two cards, one and two. B also has two cards, one and two.
Let's say the first we have to give one point to player A. Player A, let's say, played two and player B sent one. Then player A's card in this case had a higher value than player B.
So one point went to player A. But on the second turn, player A only has this card one. And player B has two. So this point cannot go to player A. And this condition is something we will face no matter how many cards they have. If both of them have cards from one till n random number, we can always give n minus one points to one player. But the last point or one point has to go to the other player. Player A could always use a card number whose value is exact exactly one greater than the value of player B's card. So one when player B is using one, player A could use two and so on so on N minus one when N but at the end player A would be left with one and player B would be left with a card whose value is N which is greater than one. So that point would go to player B. H okay that is some condition. Let's check these conditions individually.
CSV. we are in the wrong folder.
PS in I checked on Python. My bad.
What do we have? We have int n x and y.
Okay. A few tricks. Podium shift. Turn off.
Okay. Uh, yep. We need a fix here. n is smaller than x + y.
We know with a new line and return if n= = x or n= y then also no line.
Now I guess in all other cases we do have a chance. No, we this would not cover this case.
This after this I new n would be n - x you're subtracting n would be n x + y. x + y is the number of rounds where there is actual score given to some player and we are removing from this the turns in which both the players used the same cards the cards with same values.
And then here we checking with Nice that makes sense. Now we are also covering this case.
Yep.
0 0 is possible. 0 0 is possible. Both of them are zero.
this or this and x is not equal to zero or y is not at least one of them is or like non thanks. How is competitive programming going on? I think this uh job happened.
Hey, you also have a job now. That is cool.
Okay. What it is is a loop dark or true detective time is a flat circle.
Okay. After checking these two, uh I guess we should be okay.
And I guess we should be okay now.
And I equals Z. And yep, we'll run x times after we have c+ with space.
And before this, you have to say and also return say yes return line and then wait. Uh this format has to be different. This format has to be different.
So we will have two vectors.
No, we can do this without vectors.
It would be complicated to do this without vectors. We will we will have vectors. Player A is N value zero and a vector for player B side N everything is J = Z. Okay, these are the points that go to player A I equals or we could even use push back.
It does not matter. We could just use push back.
This was fine.
C + one and B uh for in i= z. The same thing for y.
Okay. Now the turns are table. Okay. And now for the remainder of things that were equal 0 I is smaller than 10 - 10 I ++ = V I= C + that makes sense I suppose random Sorry.
Yeah. Z out. A I is or line depending on I wrong answer is fine three that is messed up it is because instead of I we have to use here.
Or we could just use push bank.
Push back.
What's that on?
B.
I hope that works.
That also does not equal Z. Okay.
Wait. Yo, water.
Wait. How long have you been here? Yo, hello. Long time. Very Yeah, very long time. No. See, how's the time inex school? It was very good. It was very good. But then they changed the campus.
The thing that you see right now in videos, this is not the campus right now. This place is not where we are living right now and and super dirty people are living right now. Right now the campus is different. Wait this is AI generated admissions open training engineers.
Yeah they have changed the campus to some place else. Something else I guess I should not tell where exactly but yeah some place else.
Okay. What is wrong?= equal to one.
East should this should be saying no whenever there is no answer. Yep. It is saying no whenever there is no other but it is messing up.
How is it messing up a swap two and one and then here?
Okay. Makes sense. Makes sense. of C.
Whenever we are using C + 1 here that is we should take minimum or C + 1 or not.
If C + 1= N + 1.
If that is the case then use one otherwise use.
or we take remainder.
Yeah, we take remainder of this one with N and then add one to wrong.
Uh for state + 1= 10 + 1 uh then use one otherwise use this basic one still Wait, why is water sad?
Uh, I come after a long time and I get ignored. So, no, you are not getting ignored. I'm seeing you. Uh, eat, sleep, work, repeat. Yep. It is a loop. Uh, internship. Uh, yes. Uh, I will do whatever I can. There is actually I can maybe refer you at the place that I'm working at. If you are comfortable, you can we can discuss. uh just message me on discord and we can take it from there. I also know your real name. It starts with C charit, right?
And I hope I'm right about your real name. Yeah, message me on Discord and we'll see.
There is a opening in my company. I think I might be able to refer you there. Maybe something is wrong.
I'll be right back. I have to go to washroom.
And I'm back bro. Uh like what are you what are required for our company like what tech stack you're working on a stack application join as an intern. We do not need interns right now. We already have one intern. He's working with Figma. He was here.
He was here a while ago. This guy work he made a super chat. He made 40.
He did a super chat of 40. I told him to do a super chat for 50.
Like I will take 10 rupees later. Uh I would like to work on go. Uh what do you mean you would like to work on go? You have to work on whatever they tell you to work on.
It's not like whatever you like.
You won't be working on go here. You'll be working with TypeScript.
And I don't think I should show you the code. Yeah. Should not show you the code, but it is incript.
Okay. Uh what is wrong with this?
Everything literally seems okay. Uh let's print these after every insert.
Makes sense. Okay.
Out of bounds also makes sense.
How Wrong answer is why.
Okay.
N + 1 In that case we don't otherwise use the so for Start with two.
Okay. Uh, one is fine. Start with one.
Cover up. Cover up.
Move one.
Instead of taking uh one for both we can say current v= this by Current A+ current B.
Okay. Initially this was okay.
Yo Usman broing like a bro. uh I'm just learning from you and I want to tell to the rest of the people who are here that Usman is from Nigeria and he's a very good friend and he's a contributor to the rust compiler to get and like multiple other things is uh he's learning mojo language by contributing to Mojo compiler I have been doing it for 6 months and then I stopped doing it for the next 6 months and now I I'm planning to do it again. Right. I've been doing CP for one year.
Okay. Uh one goes there and A and B.
Okay. The problem right now is this.
Player A has some cards. Let's say player A has four cards. One, B four. Player B also like has same cards. One, two, B and four. And our task is A to give one point to player one and one point to player two.
Yeah, two rounds would be such in which they use the same uh the same value of card.
So how can we do this?
So one point needs to go to player one.
So at least in one round player one has to use a card which has a higher value than player B. So we can say player one.
We can in the current approach what we are doing is we are having we have a variable uh depicted by C which is initially equal to one and we run a loop for the number of times that is the score of player one which in this case is one and we put like C as the card that player B used and C + 1 as the card that player A used and we increment C's value by one. So we get two here and our loop ends because we had to just give one point to player A. Now we run a loop uh this many times uh the number of times that is the score of player B. And now we have to do the reverse. We have to give C + 1 to B and C to A.
Now uh out of these cards A has used this. It cannot use this. B has used this. Cannot use this. And now we have to use a card.
B has to use a card which it has not used and has a higher value than a card than A. This A should choose this card here because we can run a loop.
with this and we won't have to worry about whether this is something that A has used or not. We can start from start using from here we can update C's value to whatever its current value is plus one. So it would become three and we can run a loop this many times which is in this case one. So here B would A would use C as the current value which is three and B would use C + 1 which would be four. Cool. So this is gone from A and this gone from B. And now we have to run a loop where we would be using the remaining number. But this is wrong.
They don't have the same cards. So this is not possible as a solution and I guess the checks which we have put forward will catch this.
No they won't sh uh no the checks won't catch this. Everything is cool. Bro uh don't you have a job where you have to be working? I guess it is night but shade your company is USB so they work in night I don't know but yep uh we will continue and do this problem tomorrow this one is still in cube four forces has to fix itself wait it was accepted cool that is good yeah we will work on this tomorrow and yeah for now it would be this should be Okay. Because uh they will stop serving food after 10:00. So I have to go eat now. Ignoring chat. No.
And do you think uh there are good opportunities for go development? Yes.
Usman here got has work in Go.
Yes, a bit of work is in Go. But yeah, there are Go opportunities. You can learn Go, get better at Go. It would be cool. But also don't just be good at Go.
It would be good if you are also good in Typescript.
It might be difficult to find a pure go job.
But yeah, uh you can there are good go jobs there out there as I am working. Yes, as I have been working for past 2 weeks, 2 3 weeks.
Yes, my opinion is yes, you can get good at go and you will get a job. Excite.
Yeah.
And that would be it for today.
That would be it for today. And thank you for being here. We solved a few problems in code forces and CACs.
And that was good. Thank you for being here. And we will meet again
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23