My issue
the code i have written is showing correct results in other compilers but in codechef it is giving me negative values
My code
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner read=new Scanner(System.in);
int t=read.nextInt();
while(t>0)
{
int n = read.nextInt();
int s = read.nextInt();
if(n==s)
{
System.out.println(n);
}
else if(s==1)
{
System.out.println(s);
}
else
{
System.out.println(n-(s-n));
}
t--;
}
}
}
Learning course: Level up from 1* to 2*
Problem Link: The Two Dishes Practice Problem in Level up from 1* to 2* - CodeChef