const int MAXN = 10000+5;
int sg[MAXN];
int hash[MAXN];
void Get_sg()///模板
{
memset(sg, 0, sizeof(sg));
for(int i=1; i<MAXN; i++)
{
memset(hash, 0, sizeof(hash));
for(int j=1; j*2<i; j++)
{
hash[sg[j]^sg[i-j]] = 1;
}
int j;
for(j=0; j<MAXN; j++)
if(!hash[j])
break;
sg[i] = j;
}
}