Problem: https://www.codechef.com/PBK22020/problems/ITGUY22

# DIFFICULTY:

EASY.

# PROBLEM:

Chef made two laddus with sweetness X and Y respectively. Cheffina comes and sees the chef created two laddus with different sweetness (might be same). Cheffina has the magical power to make the sweetness of laddus equal. Cheffina requires 1 unit of power to increase the sweetness of laddu by its original value i.e. 1 unit to convert Z to 2Z and 2 unit to convert Z to 3Z and so on… How many units of power does cheffina want to make the sweetness equal?

# Program:

```
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin>>t;
while(t--){
ll n,m;
cin>>n>>m;
ll gcd=__gcd(n,m);
ll ans=(n+m)/gcd;
cout<<ans-2<<endl;
}
return 0;
}
```