Cant find why this code was giving NZEC

Link for the problem: (Contest Page | CodeChef)

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class COVAXIN {
static class FastReader {
BufferedReader br;
StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(
                new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }
}

public static void main(String[] args) {
    FastReader rd = new FastReader();

    int tc = rd.nextInt();
    long x = rd.nextLong(), a = rd.nextLong(), b = rd.nextLong(), c = rd.nextLong(), d = rd.nextLong();
    long p = rd.nextLong(), q = rd.nextLong(), r = rd.nextLong(), s = rd.nextLong(), t = rd.nextLong(), m = rd.nextLong();

    for (int j = 0; j < tc; j++) {
        long ans = 0, temp = 0, covaxin, covishield;
        int y = 0, z = 0;

        while (temp <= x) {
            covaxin = a + y * b;
            covishield = c + z * d;

            if (covaxin < covishield) {
                if (ans + covaxin <= x) {
                    ans += covaxin;
                    y++;
                }
            } else {
                if (ans + covishield <= x) {
                    ans += covishield;
                    z++;
                }
            }
            temp += ans;
        }
        System.out.println(y + z);

        a = (a + (y + z) * t) % m + p;
        b = (b + (y + z) * t) % m + q;
        c = (c + (y + z) * t) % m + r;
        d = (d + (y + z) * t) % m + s;
    }
}

}

Me neither - can you link to your submission?

Kandarp Kotadia’s submission of Covaxin vs Covishield | CodeChef

None of the three submissions match the code you’ve posted here: the closest is Solution: 50910035 | CodeChef, but that’s a WA, not an NZEC.

Are you trying to “Run” without Providing “Custom Input”?

That’s because I tried changing my code and way of approach may times, in order to submit my output successfully but that didn’t happen.

No I don’t run my code on codechef’s online IDE I use intellij IDEA, I directly submit my code if it provides me the desired output.