My IDE is showing proper output but codechef is not even showing the output

/* package codechef; // don’t place package name! */

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{

public static int totalCost(){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int X = sc.nextInt();

    int perimeter = (2 * M) + (2 * N);
    int totalCostOfWire = perimeter * X;
    return totalCostOfWire;
}

public static void main (String[] args) throws java.lang.Exception
{
    // your code goes here
    try{
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        for(int i = 0; i < T; i++){
            System.out.println(totalCost());
        }
    }
    catch(Exception e){
        return;
    }
}

}

You should not use multiple scanner streams in Java according to this answer.

Here is a working code

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{

public static int totalCost(Scanner sc){
    // Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int X = sc.nextInt();

    int perimeter = (2 * M) + (2 * N);
    int totalCostOfWire = perimeter * X;
    return totalCostOfWire;
}

public static void main (String[] args)
{
    try{
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        for(int i = 0; i < T; i++){
            System.out.println(totalCost(sc));
        }
    }
    catch(Exception e){
        return;
    }
}

}