#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;
#define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i)
#define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i)
#define nl "\n"
#define all(x) (x).begin(), (x).end()
#define sc second
#define fr first
#define pb push_back
void solve()
{
ll n, m;
cin >> n >> m;
ll a[n];
ll mx = (ll) 1e6 + 5;
FOR(i, 0, n) {
cin >> a[i];
}
ll lines[mx] = {};
ll sum[mx] = {};
FOR(i, 1, n) {
++lines[min(a[i - 1], a[i]) + 1];
--lines[max(a[i - 1], a[i])];
}
sum[0] = lines[0];
FOR(i, 1, mx) {
sum[i] = sum[i - 1] + lines[i];
}
FOR(i, 0, m) {
ll x, h;
cin >> x >> h;
cout << sum[h] << nl;
}
}
signed main()
{
ios_base::sync_with_stdio(false);S
cin.tie(NULL);
ll t = 1;
// cin >> t;
while (t--)
{
solve();
}
}
Compilation message
game.cpp: In function 'int main()':
game.cpp:50:38: error: 'S' was not declared in this scope
50 | ios_base::sync_with_stdio(false);S
| ^