Add <algorithm> includes and use min/max to get them into global scope

Same as #370 but for the dependencies protobuf and md5wrapper.

Put this as a separate pull request because I'm not sure if you want patches to your dependencies