Sberbank interview question

hive query optimization question