No Test cases is running

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int n = sc.nextInt();
int m = sc.nextInt();
while(t-- != 0){
int[] arr = new int[n];

	for(int i = 0; i< n ; i++){
		arr[i] = sc.nextInt();

	}
	System.out.println(binarySearch(arr,  n,  m));
	}
	

}
public static int binarySearch(int[] arr, int n, int m){
	int ans =0;
	int lo= 0;
	int hi =0;
	int no_pages= 0;
	for(int i = 0; i < n; i++){
		no_pages += arr[i];
		lo = Math.max(lo, arr[i]);

	}
	hi = no_pages;
	

	while(lo <= hi){
	int	mid = (hi+ lo)/2;
		if(isvalid(arr,  n, m, mid)){
			ans = mid;
			hi = mid -1;


		}
		else{
			lo = mid + 1;
		}
	}
	return ans;

}

public static boolean isvalid(int[] arr, int n, int k, int mid){
	int noofpages = 0;
	int students = 1;
	for(int i = 0; i< n; i++){
	if(noofpages + arr[i] > mid){
		students++;
		noofpages = arr[i];
		if(students > k){
			return false;
		}

	}
	else{
		noofpages+= arr[i];
	}
	}
	return true;



}

}