Friends pairing problem

#include
using namespace std;
int friends(int n)
{
int dp[n + 1];

for (int i = 0; i <= n; i++) 
{ 
    if (i <= 2) 
    dp[i] = i; 
    else
    dp[i] = dp[i - 1] + (i - 1) * dp[i - 2]; 
} 

return dp[n]; 

}
int main()
{
int t,n;
cin>>t;
while(t–)
{

	cin>>n;
	cout<<friends(n)<<endl;
}

}
question is https://hack.codingblocks.com/contests/c/512/1092
whats a error

Hey Chinmay, there is just a small mistake in your code

  1. change the return type of friends function from int to long long int
  2. make the dp array of data type long long int instead of int dp[n + 1];