'''

```
int candy(vector<int>& ratings) {
int n = ratings.size();
if (0 == n) return 0;
vector<int> cnt(n, 1);
for (int i = 1; i < n; i++)
{
if (ratings[i] > ratings[i - 1])
{
cnt[i] = max(cnt[i], cnt[i - 1] + 1);
}
}
for (int i = n - 2; i >= 0; i--)
{
if (ratings[i] > ratings[i + 1])
{
cnt[i] = max(cnt[i], cnt[i + 1] + 1);
}
}
int ret = 0;
for (int x : cnt) ret += x;
return ret;
}
```

'''