1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <cstdio>
#include <vector>
using namespace std;


int main() {
  int n;
	scanf("%d",&n);
	vector<int> t(n+1);
	for (int i = 1; i <= n; i++)
		scanf("%d", &t[i]);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j + j <= i; j++)
			if (t[i] > t[j] + t[i-j]) {
			  puts("NIE");
				return 0;
			}
	printf("TAK\n%d\n%d",n, t[1]);
	for (int i = 2; i <= n; i++)
		printf(" %d", t[i] - t[i-1]);
	printf("\n");
	return 0;
}