#include<bits/stdc++.h>
using namespace std;
#define fas ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long
#define inf 1e18
#define ff first
#define ss second
#define pb push_back
int main() {
fas
ll t;
cin>>t;
while(t–)
{
vectorv(200,0);
ll l,a,b;
cin>>l;
while(l–)
{
cin>>a>>b;
v[a]=b-a;
}
ll s;
cin>>s;
while(s–)
{
cin>>a>>b;
v[a]=b-a;
}
vectorgr[105];
for(int i=1;i<=100;i++)
{
for(int j=0;j<=6;j++)
{
ll dice=i+j;
dice+=v[i+j];
if((i+j)<=100)
gr[i].pb(dice);
}
}
/for(auto x:gr)
{
cout<<x.first<<" “;
for(auto p:x)
cout<<p<<” “;
cout<<”\n";
}/
queueq;
q.push(1);
vectordis(101,INT_MAX);
dis[1]=0;
while(!q.empty())
{
ll node=q.front();
q.pop();
for(auto child:gr[node])
{
if(dis[child]==INT_MAX)
{
dis[child]=dis[node]+1;
q.push(child);
}
}
}
cout<<dis[100]<<"\n";
}
return 0;
}
why my code not working in codingblocks site while it passes all testcases in gfg