Pre-firearm:
Melee: I like the spear, but the sword is better overall. A skilled spearman could make life difficult for a swordsman, but they both usually carry shields. Once the swordsman pushes inside the spearman's range, it's over.
Ranged: The recurve longbow. Insane accurate range and you didn't need to be very strong to wield it, unlike the longbow.
Post-firearm:
Melee: Russian AK-47/74 standard issue bayonet. Some of the best modern combat steel I've ever seen.
Ranged: That's not an easy one to answer. It depends on your caliber and platform. Most of the time the AK-47 wins, simply because of it's larger caliber and the fact that the weapon shoots in any condition - drowned in sand even. It has paralleled functional durability; you still need to clean it eventually, however. Its biggest problem is its effective accuracy.