Can anyone point out for which corner test case it is giving WA.
CODE:
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
//for getting input from input.txt
freopen("input.txt", "r", stdin);
//for writing output to output.txt
freopen("output.txt", "w", stdout);
#endif
int TC;
cin >> TC;
while (TC --)
{
lli questionCnt, targetMarks;
lli plus3, zero, minus1;
bool flag = 1;
cin >> questionCnt >> targetMarks;
if (targetMarks == 0)
{
cout << "YES" << "\n";
plus3 = 0, zero = questionCnt, minus1 = 0;
}
else if (targetMarks % 3 == 0)
{
if ((targetMarks / 3) == questionCnt)
{
cout << "YES" << "\n";
plus3 = (targetMarks / 3), zero = 0, minus1 = 0;
}
else
{
cout << "YES" << "\n";
plus3 = (targetMarks / 3), zero = (questionCnt - plus3), minus1 = 0;
}
}
else
{
if (targetMarks < 3)
{
cout << "YES" << "\n";
plus3 = 1, minus1 = (3 - targetMarks), zero = (questionCnt - (plus3 + minus1));
}
else
{
plus3 = (abs((targetMarks / 3) + 1));
minus1 = (abs((plus3 * 3) - targetMarks));
zero = (abs(questionCnt - (plus3 + minus1)));
if ((plus3 + minus1 + zero) == questionCnt)
cout << "YES" << "\n";
else
{
flag = 0;
cout << "NO" << "\n";
}
}
}
if (flag != 0)
cout << plus3 << " " << minus1 << " " << zero << "\n";
}
return 0;
}