Why ZUBTRCNT shows wrong answer with the low time complexity solution ?

#include
using namespace std;
int main()
{ int t,l,k,p;cin>>t;
for(int i=1;i<=t;i++)
{ cin>>l>>k;
p=0.5*(l-k+1)*(l-k+2);
cout<<"Case “<<i<<”: "<<p<<endl; }
return 0;
}

 code link: https://www.codechef.com/viewsolution/21681282

In your submission, you’re not taking account of the possiblity of k>l. For these cases you will produce a wrong answer.

Generally you should either link your code or use the 101/010 button to mark the code in your question so that it is readable.

Thanks…

//