« first day (3563 days earlier)      last day (1375 days later) » 

4:41 AM
Some of the robots people brought to our last A.I. robots meetup. A giant 6 legged spider like robot and a small humanoid.
Such safe robots, none of those above were mine of course.
 
5:04 AM
My little flimsy robot claw car has scared a little boy (who is neither little or very young, but that's not point) when the wheels went at high speed and vibrated violently. I was grateful that he offered to hold it. The dude was like 'your robot is dangerous!' Obviously he has not witnessed the rotating killer blades on my out of control drone before.
 
5:26 AM
Hi
Finally got enough points to chat here :D
@TelKitty Pretty cool :)
I'm slowly learning C++ and I feel like it speaks to me
 
6:28 AM
@eyeseaevan Great, I hope you are more fortunate than me, C++ will only speak to me when it wants to tell me about my compilation or runtime errors.
 
 
2 hours later…
8:50 AM
Youtube is fine? I have just watched entire 3 seasons of Dark (cut down version) on it.
That show is awesome.
 
 
2 hours later…
user1804599
10:48 AM
Yummy, pan-fried bacon.
 
Are these two syntax same int a[n] and int *a=new int[n]?
 
user1804599
No.
 
user1804599
new int[n] creates an array of n integers on the heap.
 
user1804599
int a[n]; creates an array of n integers with automatic storage duration.
 
user1804599
And n has to be an integral constant expression in the latter case.
 
user1804599
10:54 AM
If n is unknown at compile-time then you should write std::vector<int> a(n);.
 
i am solving a problem in codeforces and after submitting i get memory limit exceed, the question is here codeforces.com/problemset/problem/1307/A.
 
user1804599
Ok.
 
in my solution i am having error in following line

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll n,a,b,x;
cin>>n;
while(n--){
cin>>a>>b;
x=1;
ll v[a];<----- this line causing memory leak and i can't understand why?
for(auto &&x:v)cin>>x;
if(a==1)cout<<v[0]<<endl;
else{
while(b>=0){
if(v[x]>0){
if(b-x>=0)b-=x;
else break;
v[x]--;
v[0]++;
}
x++;
if(b==0)break;
}
cout<<v[0]<<endl;
}
}
return 0;
}
 
user1804599
That’s not valid C++.
 
user1804599
C++ doesn’t have variable-length arrays.
 
user1804599
11:05 AM
It is an extension offered by GCC that allocates an array of n elements on the stack.
 
no it works, somehow compiler do allocate memory but not releasing it, when i put this line out of while loop program works :(
 
user1804599
You are probably running out of stack space because n is too large.
 
user1804599
Write std::vector<ll> v(a); instead.
 
user1804599
And add #include <vector>.
 
i know, i am just curious as what happening? i will continue my search, thanks for the help
 
user1804599
11:06 AM
std::vector will allocate an array on the heap, and deallocate it when it goes out of scope.
 
11:18 AM
ll || ... I was almost confused ...
 
user1804599
11:28 AM
Lol flags are still a thing apparently.
 
user1804599
And they still show out-of-context messages.
 
12:39 PM
@KanishkTanwar at least make your code readable/sane: coliru.stacked-crooked.com/a/eca353e78b7ab694
Minimal working version coliru.stacked-crooked.com/a/e69dbc9ba778bcd6, still probably bug-ridden but I have no clue what it's doing :)
@rightfold actually, that's in that stupid bits thingy. It's a common trait of "competitive brew"
 
1:04 PM
@KanishkTanwar Still without any understanding but just using static analysis to reduce repetition and branchiness: coliru.stacked-crooked.com/a/06e8eb33e5bcb86f. 10 lines shorter, but more whitespace, readable names, readable loops with clear end conditions etc. Single point of answer etc. (oh and input validation)
This is standard code review: like a dentist hygiene check.
 
1:16 PM
Nerding out a little
 
user1804599
Just realized you don’t need to add oil to the pan when cooking bacon.
 
user1804599
Because bacon is already very fatty.
 
Only just baked your first bacon?
 
user1804599
I did it before but always used oil and then dried it on a paper towel after.
 
2:12 PM
Weird :)
 
 
2 hours later…
4:32 PM
Trivia: 2987773 is a prime number — sehe 14 secs ago
@StackedCrooked Nothing burgers being served?
Unless they meant the BTC scam hack, but that had nothing to do with YT
@StackedCrooked Also, you officially watch too much YT. If it were television, you'd be risking presidency
 
4:57 PM
@sehe, thanks for the valuable input, i am actually impressed by your way of code, i will make sure i will like code like you, but i am still stuck in that problem -_-" which is memory limit exceed, if you have any clue drop it please :D
 
5:18 PM
@KanishkTanwar I dunno. I still don't have a clue what the code should do. In general you likely either can think of a solution that doesn't store anything, or only part of the input sequence.
At a quick glance I can see that start_index only ever decreases and the loop exits when cursor goes beyond that. So, you can probably cut off anything beyond start_index for starters
 
Eli
Hi everyone!
I have a little c++ problem and I posted question on stackoverflow.
someone commented that I ought to also ask in on codereview.stackexchange.
But my question is fully detailed on stackoverflow. Would it be ok if I just asked a question on codereview with a link to my stackoverflow question? or should I copy paste it? (it's quite long...)
 
 
6 hours later…
11:02 PM
What up people?
 
user1804599
11:34 PM
I feel sick.
 
user1804599
I don’t know why.
 
user1804599
I didn’t eat anything bad.
 
Maybe the chromium in the solder finally caught up with ya?
 
user1804599
There’s no chromium in my solder.
 
user1804599
It’s tin, copper, and silver.
 
11:44 PM
I sneezed for a whole day 2 days ago, thought I might have cold/flu/virus. It turned out that I was just allergic to a wool jumper that I had not worn for a year or two.
Once out of that jumper, I stopped sneezing.
 
Fortunate :)
Remember coding in Notepad. Wonder if that experience is helpful for developers..
 
I've only heard about that from CppCast, it seemed like some juvenile stuff from the 1990s
I remember trying to learn C++ when I was 11 using DJGPP and a book called C++ for Dummies which, I would realize much later, didn't discuss RAII - ostensibly because that anitpattern would encourage many small allocations and OOPy object graphs with many indirections.
 

« first day (3563 days earlier)      last day (1375 days later) »