线性基
void insert(int v){
per(i,lim,0)if((v>>i)&1){
if(a[i])v^=a[i];
else{
per(j,i-1,0)if((v>>j)&1)v^=a[j];
rep(j,i+1,lim)if((a[j]>>i)&1)a[j]^=v;
a[i]=v;
break;
}
}
}
高斯消元
bool gauss(){
rep(i,1,n){
int k=i;
rep(j,i+1,n)if(fabs(a[j][i])>fabs(a[k][i]))k=j;
if(fabs(a[k][i])<=eps)return 0;
if(k!=i)swap(a[k],a[i]);
double tmp=a[i][i];
rep(j,i,n+1)a[i][j]/=tmp;
rep(j,i+1,n){
tmp=a[j][i];
rep(k,i,n+1)a[j][k]-=a[i][k]*tmp;
}
}
ans[n]=a[n][n+1];
per(i,n-1,1){
ans[i]=a[i][n+1];
rep(j,i+1,n){
ans[i]-=a[i][j]*ans[j];
}
}return 1;
}