#include <vector>

using namespace std;

#define min(x, y) ((x) <(y) ? (x) : (y))

class Solution {
 public:
  int minCostClimbingStairs(vector<int>& cost) {
    int f1 = 0, f2 = 0, tmp = 0;
    for (size_t i = 0; i < cost.size(); i++) {
      tmp = cost[i] + min(f1, f2);
      f2 = f1;
      f1 = tmp;
    }
    return min(f1, f2);
  }
};
