Update rank.cpp