#include "bubblesort2.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
vll countScans(vll a,vll x,vll v){
ll n=a.size(),q=x.size();
if(n>8000)return a;
vll fans;
ll ans=0;
rep(i,n)rep(j,i)if(a[j]>a[i])ans++;
rep(k,q){
ll id=x[k];
for(int i=0;i<id;i++){
if(a[i]>a[id])ans--;
if(a[i]>v[k])ans++;
}
for(int i=id+1;i<n;i++){
if(a[i]<a[id])ans--;
if(a[i]<v[k])ans++;
}
fans.push_back(ans);
}
return fans;
}
/*int main(){
ll n,q;
cin>>n>>q;
vll a(n),x(q),v(q);
rep(i,n)cin>>a[i];
rep(i,q)cin>>x[i]>>v[i];
vll res=countScans(a,x,v);
for(auto t:res)cout<<t<<endl;
}*/
Compilation message
/tmp/ccwjFJMo.o: In function `main':
grader.cpp:(.text.startup+0x12b): undefined reference to `countScans(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status