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
#include <bits/stdc++.h>
using namespace std;

constexpr int nax = 300;

int n, tab[nax], bat[nax];

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

    cin >> n;

    for (int i = 0; i < n; ++i)
        cin >> tab[i];

    for (int i = 0; i < n; ++i)
        bat[i] = tab[i] - (i - 1 >= 0? tab[i - 1] : 0);

    for (int i = 0; i < n; ++i) {
        int64_t su = 0;
        for (int j = i; j < n; ++j) {
            su += bat[j];
            if (su > tab[j - i + 1 - 1]) {
                return cout << "NIE" << '\n', 0;
            }
        }
    }

    cout << "TAK" << '\n';
    cout << n << '\n';
    for (int i = 0; i < n; ++i) {
        cout << bat[i] << ' ';
    }
    cout << '\n';
}