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(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
2067 ms
1.1 MB
Time Limit Exceeded