Short C++ solution using incremental combinatorics
\nstring kthSmallestPath(vector<int>& D, int k) {\n    k--; // make 0-indexed\n    int n = D[0] + D[1];\n    string ans(n, \'H\');\n    for (int i = D[0]; i > 0
```\nstring kthSmallestPath(vector<int>& D, int k) {\n    k--; // make 0-indexed\n    int n = D[0] + D[1];\n    string ans(n, \'H\');\n    for (int i = D[0]; i > 0; i--) {\n        int a = i - 1, b = 0, c = 1;\n        while (k >= c) {\n            k -= c;\n            c = c * ++a / ++b;\n        }\n        ans[n - 1 - a] = \'V\';\n    }\n    return ans;\n}\n```
[]