input: Write a function to solve the knapsack problem and return the maximum value.
  assert knapsack([2, 3, 4, 5], [50, 60, 70, 80], 5) == 80
  assert knapsack([1, 2, 3], [10, 15, 40], 6) == 55
  assert knapsack([1, 2, 3], [10, 15, 40], 5) == 50
output: def knapsack(weights, values, capacity):
      n = len(weights)
      dp = [[0 for _ in range(capacity + 1)] for _ in range(n + 1)]
      
      for i in range(1, n + 1):
          for w in range(1, capacity + 1):
              if weights[i - 1] <= w:
                  dp[i][w] = max(dp[i - 1][w], dp[i - 1][w - weights[i - 1]] + values[i - 1])
              else:
                  dp[i][w] = dp[i - 1][w]
      
      return dp[n][capacity]