Source Code
// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
int a[100000] = { 0 };
int main()
{
    int t;
    int idx = 0;
    cin >> t;
    for (int i = 0;i < t;i++) {
        int x, y;
        cin >> x >> y;
        int k = x ;
        for (int i = 0;i < 100;i++) {
            if (k % y == 0) {
                a[idx] = k;
                idx++;
                break;
            }
            k++;
        }
    }
    for (int i = 0;i < idx;i++) {
        cout << a[i] << endl;
    }
}

Copy
AZOZ with an O (EZ Version) hadeelYasir
GNU G++17
67 ms
588 KB
Wrong Answer