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
#include <bits/stdc++.h>
#define PB push_back
using namespace std;
vector<int> vec;
int n;
const long long int NEG_INF = -1e13;
int main() {
	ios_base::sync_with_stdio(0);
	cin>>n;
	vec = vector<int>(n);
	for(int i = 0; i < n; ++i) {
		cin>>vec[i];
	}
	bool is_good = true;
	vector<int> partial_ans;
	partial_ans.PB(vec[0]);
	
	for(int j = 1; j < n; ++j) {
		int number_to_add = vec[j] - vec[j-1];
		for(int i = 0; i < j; ++i) {
			if(vec[j-1-i] < vec[j-1] - vec[i] + number_to_add) {
				//cout<<j<<"\n";
				is_good = false;
			}
		}
		partial_ans.PB(number_to_add);
	}
	if(is_good == false) {
		cout<<"NIE\n";
		return 0;
	}
	cout<<"TAK\n";
	cout<<n<<"\n";
	for(int j = 0; j < n; ++j) {
		cout<<partial_ans[j]<<" ";
	}
	cout<<"\n";
	return 0;
}