#include <iostream>
#include <vector>
#include <algorithm>

struct Student {
    std::string name;
    int score;
};

int main() {
    std::vector<Student> students = {
        {"Alice", 85},
        {"Bob", 90},
        {"Charlie", 85},
        {"David", 78},
        {"Eva", 90}
    };

    // 使用 std::stable_sort() 函数对学生结构体向量进行稳定排序，按分数升序排列
    std::stable_sort(students.begin(), students.end(), [](const Student& a, const Student& b) {
        return a.score < b.score;
    });

    // 输出排序后的学生信息
    std::cout << "Sorted students by score: " << std::endl;
    for (const auto& student : students) {
        std::cout << student.name << ": " << student.score << std::endl;
    }

    return 0;
}
