Why WA error Coming as i do not think there should be an erro

#include <stdio.h>

int main(){

int test,a,b,p,q;
scanf("%d",&test);

for(int i=0;i<test;i++){

    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&p);
    scanf("%d",&q);

if(a==p && b==q){

    printf("YES\n");
     continue;

}

if(p%a==0 && q%b==0){

        if((p/a)-(q/b)==1 || (q/b)-(p/a)==1){
           printf("YES\n");
           continue;
           }


           printf("NO\n");
}else{
printf("NO\n");
       }

}

return 0;
}

for this program

4
1 2 1 2
1 2 3 2
4 3 4 6
3 5 9 25
``` this is input 

YES
NO
YES
NO


https://www.codechef.com/LTIME101C/problems/ALTER


which i have then what is the problem ?

The problem is if((p/a)-(q/b)==1 || (q/b)-(p/a)==1), because there are cases where the difference of p/a and q/b can be 0. But you’re only checking for the case where it is equal to 1.

Here’s my C++ solution:

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin >> t;
	while (t--) {
	    int A, B, P, Q;
	    cin >> A >> B >> P >> Q;
	    int alice, bob;
	    if (P%A == 0) {
	        alice = P / A;
	    }
	    else {
	        cout << "NO" << "\n";
	        continue;
	    }
	    if (Q%B == 0) {
	        bob = Q / B;
	    }
	    else {
	        cout << "NO" << "\n";
	        continue;
	    }
	    if (abs(alice - bob) > 1) {
	        cout << "NO" << "\n";
	    }
	    else {
	        cout << "YES" << "\n";
	    }
	}
	return 0;
}