Help me in solving GYMDAY problem

My issue

fsf

My code

#include <bits/stdc++.h>

#define ll long long
#define mod 1000000007
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        double discount, membership_cost, budget;
        cin >> discount >> membership_cost >> budget;

        double x = membership_cost;
        int sessions = 0;
        double possibility = (x -= x * ((discount * budget) / 100));
        x = membership_cost;

        while (membership_cost > budget) {
            if (possibility > 0) {
                sessions = -1;
                break;
            }
            sessions++;
            budget--;
            double k =x-(x * (discount*0.01));
            if (k <= budget) {
                break;
            }
            else {
                discount += discount;
            }
        }
        cout << sessions << endl;
    }
    return 0;
}

Problem Link: International Gym Day Practice Coding Problem

import java.util.Scanner;

 class codechef {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        for (int i = 0; i < T; i++) {
            int d = scanner.nextInt();
            float x = scanner.nextInt();
            float y = scanner.nextInt();
            int sessions = 0;
            if(x<=y){
                System.out.println(0);
            }
            else{
                float X=x;
                while(y>0){
                    sessions++;
                    y-=1;
                    float diff=x* (d*sessions)/100;
                    X= x- diff ;
                    if(X<=y){
                        System.out.println(sessions);
                        break;
                    }
                }
                if(y<=0 && y<X){
                    System.out.println(-1);
                }
                
            }
            
        }
    }
}

Problem Link: International Gym Day Practice Coding Problem
[/quote]

After so many wrong attempts,I finally solved it.Check the code once.Just by multiplying the discount % and x and find the difference in original x.If it is less than the y.```