| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1282075 | lukasuliashvili | Festival (IOI25_festival) | C++20 | 0 ms | 0 KiB | 
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int N;
    long long S;
    cin >> N >> S;
    vector<long long> prices(N);
    for (int i = 0; i < N; ++i) {
        int t;
        cin >> t >> prices[i];
    }
    sort(prices.begin(), prices.end());
    int count = 0;
    for (int i = 0; i < N; ++i) {
        if (S >= prices[i]) {
            S -= prices[i];
            ++count;
        } else {
            break;
        }
    }
    cout << count << endl;
    return 0;
}
