输入 :n,s
输出:满足条件的方案数、
#include <iostream>
#include <algorithm>
using namespace std;
const int MAX_N = 1e6+10;
long long n,s;
long long num[MAX_N];
int main(){
cin >> n >> s;
for(long long i = 0;i<n;i++){
scanf("%lld",&num[i]);
}
sort(num,num+n);
int cnt = 0;
for(int i=0;i<n;i++){
int another = s - num[i];
int l=i,r=n;
while(l<r){
int mid =(l+r) / 2;
if(num[mid] == another){
//cout << another << endl;
cnt++;
//break;
}
if(num[mid] < another){
l = mid + 1;
}else{
r = mid;
}
}
}
cout << cnt;
return 0;
}