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
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define cat(x) cerr << #x << " = " << x << endl
#define IOS cin.tie(0); ios_base::sync_with_stdio(0)
 
using ll = long long;
using namespace std;
 
const int N = 1024;
 
int n;
ll a[N], b[N], c[N];

ll sum(int l, int r) {
	return c[r] - c[l - 1];
}
 
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", a + i);
		b[i] = a[i] - sum(1, i - 1);
		c[i] = c[i - 1] + b[i];
		for (int len = 1; len <= i; ++len)
			if (sum(i - len + 1, i) > a[len])
				return !printf("NIE\n"), 0;
	}
	printf("TAK\n%d\n", n);
	for (int i = 1; i <= n; ++i)
		printf("%lld ", b[i]);
	return 0;
}