Algorithm Design Problem Challenge, Arrays of different length and computing the lead_time of jobs

I need some help in getting the average lead_time for the remaining jobs. Let’s suppose a1,a2,a3…..,an is the starting time of the jobs in ascending order, and b1,b2,b3,…..,bn are the ending times of the jobs in random order. Let’s suppose files (containing jobs) are transferred from one desk1 to desk2 and some of the jobs will complete before the transfer time and a lead_time will be established for the remaining jobs that were started at desk1. t1,t2,t3….,tm (ascending order) are the file transfer time from desk1 to desk2. Suppose tm>an and the file never visits the already visited desk.

My approach to solve this problem is as follows, I have checked if the job is ongoing at transfer time by taking the difference of job completion time and transfer time:

double start_time() = {a1, a2, a3,....,an}; // (ascending order)
double end_time() = {b1, b2, b3,....,bn}; // (random order) (jobs can be or random duration)
double transfer_time() = {t1,t2,t3,....,tm}; // (ascending order)
float lead_time = 0;
jobs_desk2 = 0; 
for (int i = 0; i<m; i++){ 
                  if(t(i) > a(i) && b(i) > t(i) && t(i) != 0){
                                                lead_time += b(i) - t(i);
                                                jobs_desk2++;
                   }
                   }
lead_time = lead_time/jobs_desk2;
cout<<"Average Lead Time: "<<lead_time;