https://ide.codingblocks.com/s/292222 . Also can you please check the logic too?
Code runs on my machine but not on online compiler
I tried submitting it on SPOJ without these lines. Still it shows Segmented sieve error
@girishgargcool you are not considering the edges, areas can be formed with the edges also. see this
https://ide.codingblocks.com/s/292232 . This is the initial code that I wrote considering both left and right edge cases. But still it gives me Segmentation Fault on SPOJ. Also in the video bhaiya considered only right edge case, why not left?
hi @girishgargcool The code where you have considered both edges seems correct to me, can you try first reserving some space in the vector and taking input for v[i] insted of doing a push_back operation? You can see the code that I have shared above uses the same logic exactly and it passed all the test cases.
@girishgargcool why are you reserving so much space? reserve only that much what is needed. now what will happen is that v.back() will give the element at index 10004.
@girishgargcool i think you totally missed the point here, whats the point of reserving space if you are doing push pack operation anyway? Take input as simply cin >> v1[i] >> v2[i];

I also changed the way to handle the corner cases in a single for loop only, this code is getting AC. (without making this change it kept giving segmentation fault, so you can try dry running for different cases to see why is that)
Thank you. Understood now
