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
#include <iostream>
#include <vector>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<int>P(n+1);
    for(int i=1;i<=n;i++)
        cin >> P[i];
    
    bool failed=false;
    for(int len=1;len<n;len++)
        for(int i=1;i<=n-len+1;i++)
            if(P[i+len-1]-P[i-1]>P[len])
                failed=true;
    
    if(failed)
        cout << "NIE\n";
    else{
        cout << "TAK\n" << n;
        for(int i=1;i<=n;i++)
            cout << " " << P[i]-P[i-1];
        cout << "\n";
    }

    return 0;
}