Source Code
#include <iostream>
using namespace std;

int main() {
	int n;
	cin>>n;
	int ans[n];
		int x, y;
		int i=0;
		int j;
		bool first=true;
	while(i<n){
		if(first){
			cin>>x>>y;
			j=x;
			first=false;
		}
		if(y>x){
			cout<<y<<endl;
			i++;
			cin>>x>>y;
			j=x;
			continue;
		}
		if(j%y==0){
			cout<<j<<endl;
			i++;
			cin>>x>>y;
			
			j=x;
		}
		else{
			j++;
		}
	}

	
	return 0;
}
Copy
AZOZ with an O (EZ Version) samihamad
GNU G++17
2055 ms
1.2 MB
Time Limit Exceeded