code: def _generate_wilcoxon_exact_table(N):
      """
      Generate counts of the Wilcoxon ranksum statistic r_plus (sum of
      ranks of positive differences). For fixed n, simulate all possible states
      {0, 1}**n and compute the sum of the ranks over the indices that are equal
      to one (positive differences).
      Return a dictionary that maps n=3,...N to the corresponding list of counts
      """
      res_dict = {}
      for n in range(1, N + 1):
          res = []
          ranks = np.arange(n) + 1
          M = n * (n + 1) / 2
          for x in itertools.product((0, 1), repeat=n):
              # note that by symmetry, given a state x, we can directly compute
              # the positive ranksum of the inverted state (i.e. ~x or 1 - x),
              # therefore, it is enough to consider sequences starting with a one
              if x[0] == 1:
                  rank_sum = np.sum(x * ranks)
                  res.append(rank_sum)
                  res.append(M - rank_sum)
          _, cnt = np.unique(res, return_counts=True)
          res_dict[n] = list(cnt)
      return res_dict
  
label_desc: Use image node_id 1 for calling a global function with example usage: _generate_wilcoxon_exact_table(N) and returns: res_dict