@gaurav19063
The problem is with your array declaration. You are trying a mix of static and dynamic allocation and achieving neither.
Either declare it statically by providing a fixed constant integer values
bool dp[100][100] = {0}
or declare it dynamically using pointer , or simply use a vector.
vector<vector> dp(l, vector(l,0));
In the method that you have used, you pass l as a value for static allocation. This creates problem since value of l is not known at compile time but the allocation is done at compile time only. So compiler can pick any random value for l and allocate according to that.