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>
#define lld long long int
#define ff first
#define ss second
#define mp make_pair
#define pii pair<lld,lld>
#define pb push_back

using namespace std;
int m[400], n;
vector < int > odp;
int main()
{
	scanf("%d",&n);
	for(int i = 1;i<=n;++i)
	{
		scanf("%d",&m[i]);
		odp.pb(m[i]-m[i-1]);
		lld s = 0;
		for(int j = i-1;j>0;--j)
		{
			s+=odp[j];
			if(s>m[i-j])
			{
				puts("NIE");
				exit(0);
			}
		}
	}
	puts("TAK");
	printf("%d\n",odp.size());
	for(int i = 0;i<odp.size();++i)
	{
		printf("%d ",odp[i]);
	}	
}