Source Code
// •︿• \\
/\\    //\
 /\\  //\
  /\\//\
  
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <unordered_set>
#include <utility>
#include <math.h>
#include <string>
#include <cstring>
#include <cassert>
using namespace std;
 
const double PI = acos(-1);
const int N=1e5 + 10;
const int M=998244353 ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define oo 1000000007

string str_add(string a, int b){
    reverse(all(a));
    string result = "";
    for(int j = 0; j < (int)a.size(); ++j){
        int aa = a[j] - '0';
        int bb = b % 10;
        int c = aa + bb;
        b /= 10;
        b += (c/10);
        result += ((c%10) + '0');
    }
    reverse(all(result));
    return result;
}

int str_mod(string a, int b){
    int x = 0;
    for (int i = 0; i < (int)a.size(); ++i)
    {
        x *= 10;
        x += a[i] - '0';
        x %= b;
    }
    return x;
}

void solve(bool flag){
    string x;
    int y;
    cin>>x>>y;
    int m = str_mod(x,y);
    if(m == 0){
        cout << x << endl;
        return;
    }
    m = y - m;
    x = str_add(x,m);
    cout << x << endl;

}

int main(){
    int t=1;
    scanf("%d",&t);
    int tt = t;

    while(t--){
        // printf("case #%d: ",tt-t );
        bool flag = false;
        solve(flag);
    }

    return 0;
}
Copy
AZOZ with an O (Needs a Carry) Saq
GNU G++17
315 ms
11.1 MB
Wrong Answer