MOTU001 - Editorial

Problem Link : CodeChef: Practical coding for everyone

Here is the code:

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007

int main()
{
    ll test;
    cin >> test;
    while (test--)
    {
        ll a, b, c;
        cin >> a >> b >> c;
        ll k = (c - b) / a;
        cout << a * k + b << endl;
    }
    return 0;
}