There are $101$ not necessarily different weights, each of which weighs an integer number of grams from $1$ g to $2020$ g. It is known that at any division of these weights into two heaps, the total weight of at least one of the piles is no more than $2020$. What is the largest number of grams can weigh all $101$ weights? (Bogdan Rublev)