Language: C++

#include <iostream>
using namespace std;
#define LL long long

#include <algorithm>
#include <vector>
void _150() {
    LL n;
    cin >> n;

    // int p[8];
    // int q[8];
    int temp;
    vector<int> p, q;
    vector<int> perm_base;
    for (int i = 0; i < n; ++i) {
        cin >> temp;
        p.push_back(temp);
        perm_base.push_back(i + 1);
    }
    for (int i = 0; i < n; ++i) {
        cin >> temp;
        q.push_back(temp);
    }

    LL a, b, index;
    a = -1;
    b = -1;
    index = 0;
    do {
        if (perm_base == p) {
            a = index;
        }

        if (perm_base == q) {
            b = index;
        }

        if (a != -1 && b != -1) {
            break;
        }

        index++;
    } while (next_permutation(perm_base.begin(), perm_base.end()));

    cout << abs(a - b) << endl;
}

#include <string>
void _151() {
    int n, m;
    cin >> n >> m;
    int p[100000] = {0};
    int correct[100000] = {0};
    int penalty_counts[100000] = {0};
    string temp;
    int correct_count = 0;
    for (int i = 0; i < m; ++i) {
        cin >> p[i] >> temp;
        if (temp == "AC") {
            if (correct[p[i] - 1] != 1) {
                correct_count++;
                correct[p[i] - 1] = 1;
            }
        } else {
            if (correct[p[i] - 1] != 1) {
                penalty_counts[p[i] - 1]++;
            }
        }
    }
    int penalty_count = 0;
    for (int i = 0; i < n; ++i) {
        if (correct[i] == 1) {
            penalty_count += penalty_counts[i];
        }
    }
    cout << correct_count << " " << penalty_count << endl;
}

// #include <math.h>
void _152() { 
    int n;
    cin >> n;
    int temp;
    vector<int> p;
    for (int i = 0; i < n; ++i) {
        cin >> temp;
        p.push_back(temp);
    }
    // for (int i = 0; i < p.size(); ++i)
    //     cout << p[i];
    // cout << endl;

    int count_ = 0;
    vector<int> q(p.size());
    vector<int>::iterator itr;
    for (int i = 1; i < n; i++) {
        q.clear();
        // cout << "ls" << endl;
        copy(p.begin(), p.begin() + i, q.begin());
        // cout << "copy" << endl;
        sort(q.begin(), q.begin() + i);
        // cout << "sort" << endl;
        if (q[0] >= p[i]) {
            count_++;
            // cout << p[i] << " " << i << " " << q[0] << " " << q[1] << endl;
            // cout << "increment" << endl;
        }
        // cout << "le" << endl;
    }
    cout << count_ + 1 << endl;


    // cout << count_ << endl;
}

void _152_() { 
    int n;
    cin >> n;
    int temp;
    vector<int> p;
    int min_val = INT_MAX;
    int count = 0;
    for (int i = 0; i < n; ++i) {
        cin >> temp;
        if (min_val >= temp) {
            min_val = temp;
            count++;
        }
    }
    cout << count << endl;
}

int main()
{
    _152_();
    return 0;
}



Compiler output:
a.cc: In function 'void _152_()':
a.cc:122:19: error: 'INT_MAX' was not declared in this scope
  122 |     int min_val = INT_MAX;
      |                   ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <vector>
  +++ |+#include <climits>
    7 | void _150() {