Once again, it's a big world. Lots of countries. Even within countries, often lots of different laws--the U.S. for example, where laws vary from state to state.
In international waters, any size boat
, no problem. As soon as you get into the territorial waters of any country, though, then you have to follow their laws. So that means about 200 different answers to this question (many more, actually, given the differences between states, departments, districts, parishes, and other sub-entities within a lot of countries).
I will leave it as an exercise for the OP to look up all of those different answers.