Snake and ladder problem

#include <bits/stdc++.h>
#include
#include
#include
#include <unordered_map>
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

using namespace std;

template
class graph{

unordered_map<T,list<T>>adjlist;

public:

void addEdge(T u, T v, bool bidr = true ){

	adjlist[u].push_back(v);

      if(bidr){

      	adjlist[v].push_back(u);
      }

}

void display(){

for(auto node:adjlist){

     auto u = node.first ;
     cout<<u<<"->";
     for(T val:node.second ){
     	cout<<val<<" ";
     } 
     cout<<endl;

}

cout<<"******************"<<endl;

}

int bfsshortestpath(T src,T end){

queueq;
unordered_map<T,int>dist;

for(auto node:adjlist){

T val = node.first;
dist[val] = INT_MAX;

}

dist[src] = 0;
q.push(src);

while(!q.empty()){

T node = q.front();
q.pop();

for(T neighbor : adjlist[node]){

	if(dist[neighbor] == INT_MAX){

		dist[neighbor] = 1+dist[node];
		q.push(neighbor);
	}
}

}

return dist[end];
}

};

int main(){

int t;
cin>>t;
graphg;

while(t–){

   int n,l,s;
   cin>>n>>l>>s;

int board[n] = {0};

   while(l--){

    int u,v;
    cin>>u>>v;
    board[u] = v;

   }

while(s--){

    int u,v;
    cin>>u>>v;
    board[u] = -v;    
   }

for(int i =0;i<=n-1;i++){

for(int dice = 1;dice<=6;dice++){
    int u = i;
    int v = i+dice+board[i+dice];

    g.addEdge(u,v,false);
}

}

cout<<g.bfsshortestpath(0,n)<<endl;
}

return 0;

}

My code for the problem , can anyone please help me and know what is the error , my testcase is not passing.

Please save your code on ide.codingblocks.com and then share its link.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.