input: Write a python function to solve the 0/1 knapsack problem.
  assert knapsack(5, [(2,3), (3,4), (4,5), (5,6), (6,7)]) == [3, [(3, 4)]]
  assert knapsack(7, [(2,3), (3,4), (4,5), (5,6), (6,7)]) == [6, [(3, 4), (2, 3)]]
  assert knapsack(10, [(1,1), (4,3), (5,4), (7,5)]) == [9, [(4, 3), (5, 4)]]
output: def knapsack(max_weight, items):
      n = len(items)
      dp = [[0 for _ in range(max_weight + 1)] for _ in range(n + 1)]
      
      for i in range(1, n + 1):
          for w in range(1, max_weight + 1):
              weight, value = items[i - 1]
              if weight <= w:
                  dp[i][w] = max(dp[i - 1][w], dp[i - 1][w - weight] + value)
              else:
                  dp[i][w] = dp[i - 1][w]
      
      res_value = dp[n][max_weight]
      
      w = max_weight
      selected_items = []
      for i in range(n, 0, -1):
          if dp[i][w] != dp[i - 1][w]:
              weight, value = items[i - 1]
              selected_items.append((weight, value))
              w -= weight
      
      selected_items.reverse()
      return [res_value, selected_items]