Source Code
#include <iostream>
using namespace std;
int a[100000] = { 0 };
int rem(int x, int y) {
    int r = (x + y) % y;
    if (r == 0) {
        return x;
    }
    else {
        return x + y - r;
    }
}
int main()
{
    int t;
    int idx = 0;
    cin >> t;
    for (int i = 0;i < t;i++) {
        int x, y;
        cin >> x >> y;

        int k = rem(x, y);
        a[i] = k;
        
    }
    for (int i = 0;i < t;i++) {
        cout << a[i] << endl;
    }
}
Copy
AZOZ with an O (EZ Version) hadeelYasir
GNU G++17
242 ms
2.2 MB
Accepted