Please help me know what’s wrong with my code?

As I was participating in today’s contest START100, my solution again got rejected due to incompletion of sub task, when again, correct outputs were there. I am not able to understand how to know the subtask in contest problems.
My solution:
https://www.codechef.com/viewsolution/1020480416

When i debugged the code (as per a new feature):
It showed:
Solution Failed on following Input
1
4
Your Output

2 1.0 1.0

But isn’t the output correct here, as per the problem?

@jade764
plzz refer the following solution for better understanding for the logic.

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    cout<<1<<" "<<1<<" "<<n-2<<endl;
	}
	return 0;
}

@jade764
the correct solution for this is
include
using namespace std;

int main() {
// your code goes here
int t; cin>>t;
while(t–){
int n; cin>>n;
cout << n-2 << 1 << " " << 1 << " " <<endl;
}
return 0;
}

Explanation:-

  1. int T; cin >> T;
    : This line of code reads an integer Tfrom the standard input.T` represents the number of test cases.
  2. while (T–)
    {: This is a while loop that iterates for each test case. The T-- decrement operator decreases the value of T by 1 in each iteration, and the loop continues until T becomes zero.
  3. int N; cin >> N;
    : Inside the loop, this line of code reads an integer Nfrom the standard input.N` represents the total number of chocolates for the current test case.
  4. N - 2; : It calculates the number of chocolates by subtracting 2 from the total number of chocolates N . This is done to ensure that every it has at least one chocolate, as required by the problem statement.

Ok, thank you so much for your response.

Ok, thank you…

There are some logical issue with your code, try below code to fix the issue.

N = int(input())

for _ in range(N):
    a = int(input())
    if a % 2 == 0:
        if (a - 2) // 2 % 2 != 0:
            print(2, (a - 2) // 2, (a - 2) // 2)
        else:
            print(4, (a - 4) // 2, (a - 4) // 2)
    else:
        print(3, (a - 3) // 2, (a - 3) // 2)

Thanks