Note: The problem looks similar to this one and was indeed closed as a duplicate, but in that question the formatting in the preview is also wrong; here the preview is displayed correctly, but after publish it is wrong, so there seems to be a difference between the Markdown JavaScript for preview and for display.
This question here - let's see if I can reproduce here too:
1.
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
{
ans+=mp[A[i]+B[j]]; // did this because, if A[i]+B[j] doesn't exist, mp[A[i]+B[j]]=0.
}
- for(int i=0;i<n;i++) for(int j=0;j<n;j++) { auto it=mp.find(A[i]+B[j]); if(it!=mp.end()) ans+=mp[A[i]+B[j]]; }
This looks fine in preview or if you edit, but the second code block doesn't get formatted on display.