Why is my solution giving WA. Can anybody help?
my solution:-
#include<iostream>
#include<bits/stdc++.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include <numeric>
#define wl int t;cin>>t;while(t--)
#define ll long long
#define ul unsigned long
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
long int m= 100001;
inline long fs(long a,long b,long l)
{
return((abs(a-l)+abs(b-a)));
}
int main()
{
fast
wl
{
long n,q;
cin>>n>>q;
long e=0;
int fl=0;
for(int i=1;i<=q;i++)
{
long f,d;
cin>>f>>d;
fl=(fl+fs(f, d, e)%m);
e=d;
}
cout<<fl<<endl;
}
return 0;
}