By task description, B is an integer (0 ≤ B ≤ 10^9). So "int x", not "long long x".
But it shouldn't be enough. Please estimate (or just type from local run) sizeof(duy) and sizeof(m). Then read task memory restriction. Assume that even "empty main()" program spends about 100 Kb (see successful runs of "1000 A+B" problem for your compiler).
In this case duy can hold not only one x, but bucket - ~30 values for example. More, 30 bits are required to save B. So it's possible to save 32 values into "int x" array.