Demand Supply Equilibruim // SIr what is wrong in my code. Please can you help me

#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t–){
int m1,c1,m2,c2; int res=0;
cin>>m1>>c1>>m2>>c2;
int y=(c1-(m1/m2)*c2)/(1-m1/m2);
int x=(c1-c2)/(m2-m1);
if(x>=0 && y>=0 && m1!=m2){

   res   =  floor(y+0.5);
      cout<<res<<endl;
        
    }else{
        cout<<"-1"<<endl;}
     
}
return 0;

}

// Question Link
https://hack.codingblocks.com/app/practice/3/159/problem