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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<iostream>
#include<vector>

using namespace std;


int main()
{
    int t;
    cin >> t;
    
    vector<long long> nums;
    vector<long long> conditions;
    
    long long sum = 0;
    
    for(int i=0; i<t; i++){
        long long con;
        cin >> con;
        
        conditions.push_back(con);
        
        nums.push_back(con - sum);
        
        sum = con;

    }
    
    vector<long long> pref;
    pref.push_back(0);
    
    for(int i=0; i<t; i++){
        pref.push_back(pref.back() + nums[i]);   
    }
    
    
    bool f = true;
    for(int i=0; i<t; i++){
        for(int j=0; j<t-i; j++){
            if( pref[j+1+i] - pref[j] > conditions[i]){
                f = false;
            }
        } 
    }
    
    if(f){
        cout << "TAK\n" << t << "\n";
        for(int i=0; i<t; i++){
            cout << nums[i] << " ";
        }
    }else{
        cout << "NIE";
    }
}