LeetCode 1320: Minimum Distance to Type a Word Using Two Fingers I
Ensure you match the given API
Using size_t for sizes is a good thing to do, however the LeetCode problem specifies the API, and you should not change it. minimumDistance() should return int.
Use static constexpr for compile-time constants
Use static constexpr instead of const for the constants. This allows the compiler to make more optimizations, and they can then also be used in other places where a compile-time constant is required, for example:
Use a std::array
Since dp has a compile-time constant size, you can make it a std::array:
std::array&lt;int, ALPHABET_LEN&gt; dp;

Avoid using small types unnecessarily
Here you have a problem where you know the maximum distance between two letters is 25. I see you have decided to make coordinates() return an unsigned short. I would not do this. While it might seem more optimal, it is not: on many 32-bit and 64-bit platforms, 16-bit integers are often less efficient than 32-bit integers, since they are smaller than the natural register size, and thus the compiler might need to add instructions to ensure all but the lower 16 bits are zeroed. There might also be a penalty because it has to convert it back to a regular int when adding it the result to  total_distance.
The right time to use shorts or even chars to hold integer values is when you have large arrays of them, since then it might reduce memory usage and memory bandwidth.
Proper naming
The function coordinates(), contrary to what the name implies, does not return coordinates. Instead, it returns a distance. So name it distance().
I would also not name the arguments left and right, but just a and b. Left and right sounds confusing here since you might think it gets the character under the left and right fingers as inputs.
Also, what does dp stand for? It seems like this vector holds the maximum distance traveled given a starting position. Try to find a more descriptive name for it. If there is no good one, then at least add a comment explaining what dp is.
The names second and third are slightly misleading for index &gt; 0. Maybe it would be better to name them from and to.
Use WIDTH consistently
You still use one literal 6 in coordinates().