What the OP was seeing is probably a special class in a high school for gifted students. Since winning national and international student competition is kind of a big deal in Vietnam, most major cities and provinces have such a school, but it's not easy to apply to them. All schools require applicants to take some tough and competitive entrance test that may have math problems harder than those in SAT or even GRE. As a result, the students who get in are usually the best of their ages, and they will be trained rigorously and restlessly for three years with the sole goal of winning a major programming contest such as IOI. That means they are the exception, not the norm. Most high school and even university students in the country can't tell what a loop is, let alone solving algorithmic problems.