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
40
41
42
43
44
45
46
47
48
49
50
#include <cstdint>
#include <iostream>
#include <vector>

int main() {
  int N = 0;
  std::cin >> N;

  //
  std::vector<int64_t> data(300);
  for (int i = 0; i < N; ++i) {
    std::cin >> data[i];
  }

  //
  std::vector<int64_t> v(300);
  int64_t sum = 0;

  {
    v[0] = data[0];
    sum = data[0];
  }

  for (int i = 1; i < N; ++i) {
    v[i] = data[i] - sum;
    sum += v[i];

    int64_t sum2 = 0;
    int64_t counter = 0;
    for (int j = i; j >= 0; --j) {
      sum2 += v[j];
      counter++;

      if (sum2 > data[counter - 1]) {
        std::cout << "NIE" << std::endl;
        return 0;
      }
    }
  }

  //
  std::cout << "TAK" << std::endl;
  std::cout << N << std::endl;

  for (int i = 0; i < N; ++i) {
    std::cout << v[i] << " ";
  }

  return 0;
}