1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int a,n,k,sum,first;
    cin >> n;
    vector<int> arr,arr1;
    for(int i = 0;i < n;i++)
    {
        cin >> a;
        arr.push_back(a);
    }
    k = n;
    first = arr[0];
    sum = arr[0];
    arr1.push_back(arr[0]);
    for(int i = 1;i < n;i++)
    {
        if(first >= arr[i] - sum)
        {
            arr1.push_back(arr[i] - sum);
            sum += arr1[i];
        }
        else
        {
            cout << "NIE";
            return 0;
        }
    }
    cout << "TAK" << "\n";
    cout << k << "\n";
    for(int i = 0;i < k;i++)
        cout << arr1[i] << " ";
    return 0;
}