Code is not running -PREFNUM

LINK OF PROBLEM

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


main()
{
    ll t, x, y, k, p, f, j,m;

    cin >> t;

    for (int i = 0; i <= t; i++) 
    {  
    

        cin >> x >> y;

        k = x;
        p = 10;
        f = 1;
        
        if (x % y == 0)
        {
            cout << x;
        }
        else 
        {
            
            while (f == 1) 
            {
                k = x * p;
                if (k % y == 0) 
                {
                    if (k > 1000000000000000000)
                    {
                        cout << (-1);
                    }
                    else 
                    {
                        cout << k;
                        f = 0;
                    }
                }
                j = k % y;
                m = y - j;
                if (m < p) 
                {
                    if (f == 1) 
                    {
                        if (k + m > 1000000000000000000) 
                        {
                            cout << -1;
                        }
                        else
                        {
                            cout << k + m;
                            f = 0;
                        }
                    }
                }
                p = p * 10;

            }
        }
 
    }
}