Aside from that, scanf is one of the functions that also exist in C++ (in the header cstdio instead of stdio.h), but you should use iostreams instead (introduction at the link fire posted).
PS: I know you used iostreams earlier... is it just that you wanted to know what scanf does or what?
%ld means long decimal integer, which is a longint in C++ (in C too by the way). It's the scanning format scanf uses to retrieve input, and you don't need that in c++ cause you got iostreams.
Use iostream if you want your exe to be 450kb bigger :) (and even if do NOT USE it, by simple inclusion of <iostream> header the executable size grow that much).