Unable to identify error

problem code : LIFTME
SOLUTION:
#include<bits/stdc++.h>

using namespace std;

int main()
{
int t;
cin>>t;
while(t–)
{
long long int n,q,a,lastrnumber=0,sum=0;
cin>>n>>q;

    for(long long int i=0; i<q*2; i++)
    {
        cin>>a;
        sum=sum+abs(lastrnumber-a);
       lastrnumber=a;
    }
    cout<<sum;

}
return 0;

}

is it t- or t-- in your code?

you have written the correct logic but forgot to write endl after printing the answer for each testcase
i.e cout<<sum<<endl; or cout<<sum<<"\n";

1 Like