Getting TLE for Nuttela path unit

'''
//https://www.codechef.com/LRNDSA08/problems/ENOC1
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll visited[100100]={0};
ll depth[100100]={0};
ll A[100100];
vector<vector<ll>> adj(100100);
ll N,D;
vector<vector<ll>> par(100100,vector<ll>(50)); //initialize to -1;
vector<vector<ll>> dp(100100,vector<ll>(50));

void ingraph(int N,int M){
    for(ll i=0;i<M;i++){
        ll u,v;
        cin>>u>>v;
        adj[u-1].push_back(v-1);
        adj[v-1].push_back(u-1);
    }
}

void dfs(ll v){
    visited[v]=1;
    for(ll d=1;d<=D;d++){
        ll parent = par[v][d-1];
        if(parent!=-1){
            if(par[parent][d-1]!=-1){
                par[v][d] = par[parent][d-1];
                dp[v][d] = dp[parent][d-1]^dp[v][d-1]; 
            }
        }
    }
    for(auto u : adj[v]){
        if(!visited[u]){
            depth[u] = depth[v]+1;
            par[u][0] = v;
            dp[u][0] = A[u];
            dfs(u);
        }
    }
}

ll lca(ll u,ll v){
    ll result =0;
    if(depth[u]>depth[v]){
        ll temp = u;
        u=v;
        v=temp;
    }
    for(ll d=D;d>=0;d--){
        if(depth[v]-pow(2,d) >= depth[u]){
            result  = result^dp[v][d];
            v=par[v][d];
        }
    }
    
    if(u==v){
        result = result^A[u];
        return result;
    }
    // return result;
    for(ll d=D;d>=0;d--){
        if(par[u][d]!=par[v][d]){
            result=result^dp[u][d];
            result=result^dp[v][d];
            u=par[u][d];
            v=par[v][d];
        }
    }
    // return result;
    return result^A[par[u][0]]^A[u]^A[v];
}



int main() {
    // your code goes here
    ll T;
    cin>>T;
    while(T--){
        ll Q;
        cin>>N>>Q;
        D=ceil(log2(N));
        for(ll i=0;i<N;i++){
            adj[i].clear();
            visited[i] = 0;
            for(ll d=0;d<=D;d++){
                par[i][d]=-1;
                dp[i][d] =0;
            }
        }
        for(ll i=0;i<N;i++){
            cin>>A[i];
        }
        ingraph(N,N-1);
        depth[0]=0;
        dfs(0);
        while(Q--){
            ll a,b;
            cin>>a>>b;
            cout<<lca(a-1,b-1)<<"\n";
        }
    }
    return 0;
}`Preformatted text`
'''

can anyone help…why am i getting TLE?

https://www.codechef.com/LRNDSA08/problems/ENOC1 here is the problem link

i got it

nice