Problem MARBLES

#include <bits/stdc++.h>

using namespace std;

long long int calc(long long int n,long long int r)
{
long long int ans=1,i;
for(i=1;i<=r;i++)
{
ans=ans*(n-(r-i));
ans=ans/i;
}
return(ans);
}
int main()
{
long long int n;
cin>>n;
while(n–)
{
long long int a,b;
cin>>a>>b;
cout<<calc(a-1,b-1)<<"\n";
}
return 0;
}
check my code why it is giving 4 testcases wrong

@harry_potter123 here answer can exceed 64 bit limit hence you cannot use long long int here,
there comes a bigint() to store int greater than 64 bit.
Take a look at its implementation here https://github.com/robinrst/HackerBlocks/blob/master/MARBLES.cpp

and here i have updated your code using this https://ide.codingblocks.com/s/220147