semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int judge(char a[]);
int main()
{
    int n=0,i=0;
    char word[81];
    cin>>n;
    cin.get();
    for(i=0;i<n;i++)
    {
        cin.getline(word,81,'\n');
        cout<<judge(word)<<endl;
    }
    return 0;
}

int judge(char a[])
{
    int b=0,i=0;
    if(a[0]>64&&a[0]<91 || a[0]>96&&a[0]<123 || a[0]=='_') b=1;
    if(b==1)
      for(i=1;a[i]!='\0';i++)
       if(a[i]<48 || (a[i]>57&&a[i]<65) || (a[i]>90&&a[i]<97&&a[i]!=95) || (a[i]>122))
        b=0;
     return b;
}
void main(){
	int n;
	char s[81];
	int i,flag=0,j;
	scanf("%d",&n);
    getchar();
	for(i=0;i<n;i++){
		flag=0;  //???????,da?
		gets(s);
		j=0;
		if((s[j]=='_') || (s[j]>='a' && s[j]<='z') || (s[j]>='A' && s[j]<='Z')){    //????????
			j++;
                            flag=1;
			while(s[j]!='\0'){
				if((s[j]=='_')|| (s[j]>='a' && s[j]<='z') || (s[j]>='A' && s[j]<='Z') || (s[j]>='0' && s[j]<='9')){
					flag=1;
					j++;
				}
				else{
					flag=0;
					break;
				}
			}
		}
		else{
			flag=0;
		}
		if(flag)
			printf("1\n");
		else{
			printf("0\n");
		}
	}
}
void main()
{
	int n,i,flag=0,j;
	char b[80],a[80];
	scanf("%d",&n);
	gets(b);
	for(i=0;i<n;i++)
	{
		
		gets(a);
		if(a[0]=='_'||(a[0]<='z'&&a[0]>='a')||(a[0]<='Z'&&a[0]>='A'))
		{}
			else flag++;
			if(strlen(a)>1)
			{
		for(j=1;j<strlen(a);j++)
		{
			if(a[j]=='_'||(a[j]<='9'&&a[j]>='0')||(a[j]<='z'&&a[j]>='a')||(a[j]<='Z'&&a[j]>='A'))
			{}
			else flag++;
			
		}
			}
		if(flag==0)
			printf("1\n");
			else
			printf("0\n");
			flag=0;
	}
}
int main()
{
    long i,j,l,n,ok;
    long legal[300]={0};
    char inf[90];
    legal['_']=1;
    for(i='a';i<='z';i++)
	legal[i]=1;
    for(i='A';i<='Z';i++)
	legal[i]=1;
    for(i='0';i<='9';i++)
	legal[i]=1;
    scanf("%ld",&n);
    gets(inf);
    for(i=1;i<=n;i++){
	gets(inf);
	l=strlen(inf);
	ok=1;
	for(j=0;j<l;j++)
	    ok&=legal[inf[j]];
	if(inf[0]>='0' && inf[0]<='9')
	    ok=0;
	printf("%ld\n",ok);
    }
    return 0;
}
int main()
{
	int i,j,k,m,n;
	char a[100]={'\0'};
	char*p;
	scanf("%d",&n);
	for(j=0;j<=n;j++)
	{
		gets(a);
		if(j==0)
		{continue;}
		p=a;
		m=strlen(a);
		k=0;
		if(*p>='0'&&*p<='9')
		{
			printf("0\n");
		}else
		{
			for(i=0;i<m;i++)
			{
				if((*(p+i)>='0'&&*(p+i)<='9')||(*(p+i)>='a'&&*(p+i)<='z')||(*(p+i)>='A'&&*(p+i)<='Z')||(*(p+i)=='_'))
				{
					k++;
				}
			}
			if(k==m)
			{
				printf("1\n");
			}else
			{
				printf("0\n");
			}
		}
		
	}
	return 0;
}
int main()
{
 int n,i,counter,len,j;
 char c[81];
 cin>>n;
 cin.get();
 for(i=1;i<=n;i++)
 { 
   counter=0;
   cin.getline(c,81);
   len=strlen(c);
   if(len>1)
   {
	if(c[0]=='_'||(c[0]>64&&c[0]<91)||(c[0]>96&&c[0]<123))
    {
      for(j=1;c[j]!=0;j++)
	  {
	   if(c[j]=='_'||(c[j]>64&&c[j]<91)||(c[j]>96&&c[j]<123)||(c[j]>='0')&&(c[j]<='9'))
		   counter++;
      }
	  if(counter==len-1)
        cout<<"1"<<endl;
	  else
        cout<<"0"<<endl;
    }
	else
	    cout<<"0"<<endl;
   }
   else
   {
     if(c[0]=='_'||(c[0]>64&&c[0]<91)||(c[0]>96&&c[0]<123))
       cout<<"1"<<endl;
     else
	    cout<<"0"<<endl;
   }
	   
 }
 return 0;
}
void main()
{
	char str[100];
	int n,i,k;
	char *p;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		gets(str);
		k=1;
		p=str;
		if(((*p>=1&&*p<=64)||(*p>=91&&*p<=96)||(*p>=123))&&*p!='_')
			k=0;
		p++;
		while(*p!='\0')
		{
			if(((*p>=1&&*p<=47)||(*p>=58&&*p<=64)||(*p>=91&&*p<=96)||(*p>=123))&&*p!='_')
			{
				k=0;
				p++;
			}
			else p++;
		}
		printf("%d\n",k);
	}
}
main()
{
      int n;
      scanf("%d",&n);
      getchar();
      int i,j;
      char x[100];
      for(j=0;j<n;j++)
      {
                      gets(x);
                      if(x[0]=='_'||(x[0]>='A'&&x[0]<='z'))
                      {
                                                           if(x[1]=='\0')
                                                           {
                                                                printf("1\n");
                                                                continue;
                                                           }
                      }                      
                      else
                      {
                          printf("0\n");
                          continue;         
                      }
                      for(i=1;x[i]!='\0';i++)
                      { 
                                             if(x[i]=='_'||(x[i]>='A'&&x[i]<='z')||(x[i]>='0'&&x[i]<='9'))
                                                      continue; 
                                             else
                                             {
                                                      printf("0\n");
                                                      break; 
                                             }
                      }
                      if(x[i]=='\0')
                          printf("1\n"); 
      }
}
int main()
{
	int n , i , j , k;
	char  c[85],t;
	cin >> n;
	t = cin.get();
	for (i = 1; i <= n; i++)
	{
		cin.getline(c,85);
		j = strlen(c);
		if ( c[0] != '_' && c[0] != 'a' && c[0] != 'b' && c[0] != 'c' && c[0] != 'd' && c[0] != 'e' && 
			c[0] != 'f' && c[0] != 'g' && c[0] != 'h' && c[0] != 'i' && c[0] != 'j' && c[0] != 'k' && c[0] != 'l' && 
			c[0] != 'm' && c[0] != 'n' && c[0] != 'o' && c[0] != 'p' && c[0] != 'q' && c[0] != 'r' && c[0] != 's' && 
			c[0] != 't' && c[0] != 'u' && c[0] != 'v' && c[0] != 'w' && c[0] != 'x' && c[0] != 'y' && c[0] != 'z' && 
			c[0] != 'A' && c[0] != 'B' && c[0] != 'C' && c[0] != 'D' && c[0] != 'E' && c[0] != 'F' && c[0] != 'G' && 
			c[0] != 'H' && c[0] != 'I' && c[0] != 'J' && c[0] != 'K' && c[0] != 'L' && c[0] != 'M' && c[0] != 'N' &&
			c[0] != 'O' && c[0] != 'P' && c[0] != 'Q' && c[0] != 'R' && c[0] != 'S' && c[0] != 'T' && c[0] != 'U' && 
			c[0] != 'V' && c[0] != 'W' && c[0] != 'X' && c[0] != 'Y' && c[0] != 'Z' )
			cout << "0" << endl;
		else
		{
			for( k = 1; k < j; k++)
			{
				if(c[k] != '_' && c[k] != 'a' && c[k] != 'b' && c[k] != 'c' && c[k] != 'd' && c[k] != 'e' && 
			c[k] != 'f' && c[k] != 'g' && c[k] != 'h' && c[k] != 'i' && c[k] != 'j' && c[k] != 'k' && c[k] != 'l' && 
			c[k] != 'm' && c[k] != 'n' && c[k] != 'o' && c[k] != 'p' && c[k] != 'q' && c[k] != 'r' && c[k] != 's' && 
			c[k] != 't' && c[k] != 'u' && c[k] != 'v' && c[k] != 'w' && c[k] != 'x' && c[k] != 'y' && c[k] != 'z' && 
			c[k] != 'A' && c[k] != 'B' && c[k] != 'C' && c[k] != 'D' && c[k] != 'E' && c[k] != 'F' && c[k] != 'G' && 
			c[k] != 'H' && c[k] != 'I' && c[k] != 'J' && c[k] != 'K' && c[k] != 'L' && c[k] != 'M' && c[k] != 'N' &&
			c[k] != 'O' && c[k] != 'P' && c[k] != 'Q' && c[k] != 'R' && c[k] != 'S' && c[k] != 'T' && c[k] != 'U' && 
			c[k] != 'V' && c[k] != 'W' && c[k] != 'X' && c[k] != 'Y' && c[k] != 'Z' && c[k] != '0' && c[k] != '1' && 
			c[k] != '2' && c[k] != '3' && c[k] != '4' && c[k] != '5' && c[k] != '6' && c[k] != '7' && c[k] != '8' && 
			c[k] != '9' )
				{
					cout << "0" << endl;
					break;
				}
			}
			if (k == j)
				cout << "1" << endl;
		}
		}
         return 0;
}
int main() 
{
	int i,j,n,k;
	char c;
	scanf("%d",&n);
	char **p=(char **)malloc(n*sizeof(char *));
	*p=(char *)malloc(100*sizeof(char));
	gets(*p);
	for(i=0;i<n;i++)
	{
		*(p+i)=(char *)malloc(100*sizeof(char));
		gets(*(p+i));
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<strlen(*(p+i));j++)
		{
			k=1;
			c=*(*(p+i)+j);
			if(j==0)
				if((c<'a'||c>'z')&&(c<'A'||c>'Z')&&c!='_')
				{
					k=0;break;
				}
			if(j!=0)
				if((c<'a'||c>'z') && (c<'A'||c>'Z')&& c!='_' && (c<'0'||c>'9'))
				{
				k=0;break;
				}
		}
		printf("%d\n",k);
	}
	
	
	
	
	return 0;

}
int main()
{
	int a[100];
	int i=1;
	int b,r;
	
	scanf("%d",&b);
	char d[100];
	gets(d);
	do
	{
		char c[100];
		gets(c);
		r=strlen(c);
	    int t=0;
		int m=0;
		do
		{
			if(c[t]=='_')
			{t++;}
			else
			{
				if(c[t]>=65&&c[t]<=90)
				{t++;}
				else
				{
					if(c[t]>=97&&c[t]<=122)
					{t++;}
					else
					{
						if(c[t]>=48&&c[t]<=57)
						{t++;}
						else
						{t++;m=m+1;}
					}
				}	
			}	
		}while(t<=(r-1));
		if(m==0)
		{
			if(c[0]=='_')
			{a[i]=1;i++;}
			else
			{
				if(c[0]>=65&&c[0]<=90)
				{a[i]=1;i++;}
				else
				{
					if(c[0]>=97&&c[0]<=122)
					{a[i]=1;i++;}
					else
					{a[i]=0;i++;}
				}
			}
		}
		else
		{a[i]=0,i++;}
	}while(i<=b);
	int e=1;
	do
	{
		printf("%d\n",a[e]);
		e++;
	}while(e<=b);
	scanf("%d",&e);
	return 0;
}
int main(){
	int n;
	int j,k,l;
	cin>>n;cin.get();
	int i=0;
	for(i=0;i<n;i++){
		k=0;
		char a[100];
		cin.getline(a,100);
		l=strlen(a);
		if(!((a[0]=='_')||(a[0]<='z'&&a[0]>='a')||(a[0]<='Z'&&a[0]>='A'))){
			cout<<0<<endl;continue;
		}
		if(l==1&&((a[0]<='z'&&a[0]>='a')||(a[0]<='Z'&&a[0]>='A')||a[0]=='_')){
			cout<<1<<endl;continue;
		}
		for(j=1;j<l;j++){
			if(!((a[j]=='_')||(a[j]<='z'&&a[j]>='a')||(a[j]<='Z'&&a[j]>='A')||(a[j]>='0'&&a[j]<='9'))){
				cout<<0<<endl;break;}
			else {
				k++;
			}
		}
		if(k==l-1)
			cout<<1<<endl;
	}
}
void main()
{
	int i,n,len,count=0;
	char s[100];
	scanf("%d",&n);
	getchar();
	while(n--)
	{
		gets(s);
		len=strlen(s);
		if((s[0]>='a'&&s[0]<='z')||(s[0]>='A'&&s[0]<='Z')||s[0]=='_')
		{
			if(len==1)
				printf("1\n");
			else if(len>1)
			{
				for(i=1;i<len;i++)
				{
					if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z')||(s[i]=='_')||(s[i]>='0'&&s[i]<='9'))
					{
						count++;
					}
				}
				if(count==len-1)
					printf("1\n");
				else printf("0\n");
			}
		}
		else printf("0\n");
		count=0;
	}
}
int main()
{
	int f=0,b=0,n;                
	char a[81],*p;

	scanf("%d",&n);
    getchar();

	while(n>0)
	{
		gets(a);
		p=a;
		if( (*p=='_') || (*p>='a'&&*p<='z') || (*p>='A'&&*p<='Z') )
			b=1;
		else
			b=0;

		while(*p!='\0')
		{
			if( (*p=='_')|| (*p>='a'&&*p<='z') || (*p>='A'&&*p<='Z') || (*p>='0'&&*p<='9') )
				f=1;
			else
			{
				f=0;
				break;
			}

			p++;
		}

		if(f==1&&b==1)
			printf("1\n");
		else
			printf("0\n");
		
		n--;
	}
 return 0;
}
main()
{
 int n,i,a,j,b=1;
 char p[100],m[3];
 scanf("%d",&n);
 gets(m);
 for(i=1;i<=n;i++)
 {  
  gets(p);
  if((p[0]>='a'&&p[0]<='z')||(p[0]>='A'&&p[0]<='Z')||p[0]=='_')
    a=1;
  else
    a=0;
  for(j=1;p[j]!='\0';j++)
     if((p[j]>='a'&&p[j]<='z')||(p[j]>='A'&&p[j]<='Z')||p[j]=='_'||(p[j]>='0'&&p[j]<='9'))
       b=1;
     else
      {
       b=0;
       break;
      }
  printf("%d\n",a*b);
  b=1;
 }
}
main()
{
	int n,i,j,m,k=0;
	scanf("%d\n",&n);
	char **a;
	char *b[100];
	for(i=0;i<n;i++)
		b[i]=(char *)malloc(80*sizeof(char));
	a=b;
	for(i=0;i<n;i++)
	{
		gets(*(a+i));
		m=strlen(*(a+i));
		for(j=0;j<m;j++)
		{
			if(j==0&&((**(a+i)=='_')||(**(a+i)>='A'&&**(a+i)<='Z')||(**(a+i)>='a'&&**(a+i)<='z')))
				k++;
			if(j>0&&((*(*(a+i)+j)>='0'&&*(*(a+i)+j)<='9')||(*(*(a+i)+j)>='A'&&*(*(a+i)+j)<='Z')||(*(*(a+i)+j)>='a'&&*(*(a+i)+j)<='z')||(*(*(a+i)+j)=='_')))
				k++;
		}
		if(k==m) printf("1\n");
		else printf("0\n");
		k=0;
	}
}
int main()
{
	char str[81];
	int i, j, n, p;
	cin >> n;
	cin.get();
	for (i = 0; i < n; i++)
	{
		p = 1;
		cin.getline(str, 81);
		if ((str[0] == '_') || ((str[0] >= 'a') && (str[0] <= 'z')) || ((str[0] >= 'A') && (str[0] <= 'Z')))
		{
			for (j = 1; ; j++)
			{
				if (str[j] == '\0')
					break;
				else if ((str[j] == '_') || ((str[j] >= 'a') && (str[j] <= 'z')) || ((str[j] >= 'A') && (str[j] <= 'Z')) || ((str[j] >= '0') && (str[j] <= '9')))
						p = 1;
					else 
					{
						p = 0;
						break;
					}
			}
				cout << p << endl;
		}
		else 
			cout << '0' << endl;
	}
	return 0;
}
int p(char st1[ ])
{
	int i;
	if(st1[0]<65||(st1[0]>90&&st1[0]<95)||st1[0]==96||st1[0]>122)return 0;
	for(i=1;i<strlen(st1);i++)
		if(st1[i]<48||(st1[i]>57&&st1[i]<65)||(st1[i]>90&&st1[i]<95)||st1[i]==96||st1[i]>122)return 0;
	return 1;
}
int main()
{
	int i,n;
	char ch[100];
	cin>>n;
	cin.get();
	for(i=1;i<=n;i++)
	{
		cin.getline(ch,100,'\n');
		cout<<p(ch)<<endl;
	}
	return 0;
}
/*??,???????????????*/

main()
{
      char *k;int n;int num;int i; int pd; int j; 
      scanf("%d",&n);int *q;
      char *p[n]; 
      k=(char *)malloc(81*sizeof(char));gets(k);
      p[0]=k;
      for(i=1;i<n+1;i++)
      {
                    k=(char *)malloc(81*sizeof(char));
                    gets(k);
                    p[i]=(char *)malloc(81*sizeof(char));
                    p[i]=k; 
      }
      
      for(i=1;i<n+1;i++) 
      {
                    num=strlen(p[i]);
                    if(*p[i]=='_'||isalpha(*p[i]))                  
                    pd=1;
                    else
                    pd=0;
                    
                    p[i]++; 
                   
                    for(j=1;j<num;j++)
                    { 

                           if(isalnum(*p[i]))
                           {
                           p[i]++; 
                           }
                           else if(*p[i]=='_') 
                           p[i]++; 
                           else
                           {
                               pd=0;break;
                           }
                           
                     } 
      printf("%d\n",pd);              
      }
       
              
      }
int main()
{
    int t,i,j,p=0;
    char str[100];
    scanf("%d\n",&t);
    for(i=1;i<=t;i++)
    {
                    p=0;
                     gets(str);
                   {  for(j=0;str[j]!='\0';j++)
                     if(str[j]!='_'&&(str[j]<48||(str[j]>57&&str[j]<65)||(str[j]>90&&str[j]<97)||str[j]>122)) p=1;}
                     if(p==0&&((str[0]>64&&str[0]<91)||(str[0]>96&&str[0]<123)||str[0]=='_')) printf("1\n");
                     else printf("0\n");
                     }    
                  
                     return 0;
                     }
int main()
{
	int n,len,i,j,flag;
	char a[81];
	cin>>n;
	for (i=1;i<=n;i++)
	{
		if (i==1)
		cin.get();
		cin.getline(a,81);
		for (len=0;a[len]!='\0';len++);
		if (a[0]=='_'||(a[0]>='a'&&a[0]<='z')||(a[0]>='A'&&a[0]<='Z'))
			flag=1;
		else flag=0;
		for (j=1;j<=len-1;j++)
		{
			if (!((a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='Z')||(a[j]>='0'&&a[j]<='9')||a[j]=='_'))
				flag=0;
			if (a[j]==' ')
				flag=0;
		}
		cout<<flag<<endl;
	}
	return 0;
}
int judgeletter(char);
int judgeline(char);
int judgenum(char);
void emp(char *);

int main()
{
	int n,i,j,length;
	char s[81];
	scanf("%d",&n);
	gets(s);
	for(i=0 ; i<n ; i++){
		emp(s);
		gets(s);
		length = strlen(s);
		if( length == 1){
			printf("%d\n",( judgeletter(*s) || judgeline(*s) ) );
			continue;
		}else{
			if( ( judgeletter(*s) || judgeline(*s) ) == 0 ){
				printf("0\n");
				continue;
			}else{
				for(j=1 ; *(s+j) ; j++){
					if( ( judgeletter(*(s+j)) || judgeline(*(s+j)) || judgenum(*(s+j)) ) == 0 ){
						printf("0\n");
						break;
					}
				}
				if( j==length )
					printf("1\n");
			}
		}
	}
	
	return 0;
}

int judgeletter( char c)
{
	if( (c>='a' && c<='z') || (c>='A' && c<='Z') )
		return 1;
	else
		return 0;
}

int judgeline( char c )
{
	if( c == '_' )
		return 1;
	else
		return 0;
}

int judgenum( char c )
{
	if( c>='0' && c<='9' )
		return 1;
	else
		return 0;
}

void emp( char *s )
{
	int i;
	for(i=0 ; *(s+i) ; i++){
		*(s+i)='\0';
	}
}
int main()
{
    char ch[100][100] ;
    int m = 0 ;
    cin >> m ;
    cin.get() == '\n' ;
    int i = 0 ;
    for( i = 0 ; i <= m - 1 ; i ++ )
    {
        cin.get( ch[i] , 100 , '\n' ) ;
        cin.get() == '\n' ;
    }    
    for( i = 0 ; i <= m - 1 ; i ++ )
    {
         if( ch[i][0] == 95 || ( ch[i][0] >= 97 && ch[i][0] <= 122 ) || ( ch[i][0] >= 65 && ch[i][0] <= 90 ) )
         {
         int j = 0 ;
         int n = 0 ;
         n = strlen( ch[i] ) ;
         int counter = 0 ;
         for( j = 0 ; j <= n - 1 ; j ++ )
         {
              if( ch[i][j] == 95  || ( ch[i][j] >= 97 && ch[i][j] <= 122 ) || ( ch[i][j] >= 65 && ch[i][j] <= 90 ) || ( ch[i][j] >= 48 && ch[i][j] <= 57) )
              counter = counter + 0 ;
              else
              counter = counter + 1 ;
         }
              if( counter == 0 )
              cout << 1 << endl ;
              else
              cout << 0 << endl ;
         }
         else
         cout << 0 << endl ;
    }
return 0; 
}
// ??4.cpp : Defines the entry point for the console application.
//


int main()
{
	int n = 0;
	char num[81];
	int i = 0;
	int len = 0;
	int t = 0;
	int m = 0;
	int d[3] = {0};
	int e[80] = {0};
	int k[80] = {0};
	int f[80] = {0};

	cin >> n;
	cin.ignore();

	for( i = 1;i <= n;i++ )
	{
		cin.getline(num,81);

		d[1] = num[0] - 'a';
		d[2] = num[0] - 'A';
		len = strlen(num);

		if( num[0] == '_'
			|| ( d[1] >= 0 && d[1] <= 25)
			|| ( d[2] >= 0 && d[2] <= 25) )
		{
			len = strlen(num);

			if( len == 1 )
			{
				cout << 1 << endl;
				continue;
			}else

		  {
			for( t = 1;t <= len - 1;t++ )
			{
				e[t] = num[t] - 'a';
				k[t] = num[t] - 'A';
				f[t] = num[t] - '0';

			}


			for( t = 1;t <= len - 1;t++ )
			{
				if( ( e[t] >= 0 && e[t] <= 25 )
					|| ( k[t] >= 0 && k[t] <= 25 ) 
					|| (f[t] >= 0 && f[t] <= 9 ) 
					|| num[t] == '_')
					{
						m = 0;
					}
				else
				{
					m = 1;
					break;
				}

			}
		  }

		}

		else
		{
			cout << 0 << endl;
			continue;
		}
		

			if( m == 1 )
				cout << 0 << endl;
			else
				cout << 1 << endl;
		
	}


	return 0;
}
int num(char a[100])
{
	int times=0,i;
	for(i=0;a[i]!='\0';i++)
		times++;
	return (times);
}
int main()
{
	int n,i,yn[100],j,times[100];
	cin>>n;
	for(i=0;i<100;i++)
		yn[i]=0;
	char a[100][80];
	cin.get();
	for(i=0;i<n;i++)
    {
		cin.getline(a[i],100,'\n');
		times[i]=num(a[i]);
	}
	for(i=0;i<n;i++)
	{
		if(a[i][0]=='_'||(a[i][0]>=97&&a[i][0]<=122)||(a[i][0]>=65&&a[i][0]<=90))
		{
			for(j=1;j<times[i];j++)
				if(a[i][j]=='_'||(a[i][j]>=97&&a[i][j]<=122)||(a[i][j]>=65&&a[i][j]<=90)||(a[i][j]>=48&&a[i][j]<=57))
					yn[i]++;
			if(yn[i]==times[i]-1)
				yn[i]=1;
			else yn[i]=0;
		}
	}
	for(i=0;i<n;i++)
		cout<<yn[i]<<endl;
	return 0;
}
main()
{
      char s[900];
      int i,n,j;
      
      scanf("%d",&n);
      gets(s);
      for (i=0;i<n;i++)
      {
          gets(s);
          j=0;
          if ((s[j]=='_') || (s[j]>='a' && s[j]<='z') || (s[j]>='A' && s[j]<='Z'))
          {
              //if (strlen(s)>0)
              for (j=1;j<strlen(s);j++)
                  if ((s[j]=='_')||(s[j]>='a' && s[j]<='z')||(s[j]>='A' && s[j]<='Z')||(s[j]>='0' && s[j]<='9'))
                      continue;
                  else
                      break;
              if (j==strlen(s))
                  printf("1\n");
              else
                  printf("0\n");
          }
          else
              printf("0\n");
          
      }
      }
//***************
//*???????*
//*1000010538    *
//***************
int main()                             //???
{
	int n,i,k,j,p=0;                    //???????
	char str1[100];
	cin>>n;                              //??????????
	cin.get();                           //?????
	for(i=0;i<n;i++)
	{
		cin.getline(str1,100);             //?????
		k=strlen(str1);                   //????????
		if(str1[0]>='A'&&str1[0]<='Z'||str1[0]>='a'&&str1[0]<='z'||str1[0]=='_')          //????????????
		{
		    for(j=1;j<k;j++)
		   {
			   if(str1[j]>='A'&&str1[j]<='Z'||str1[j]>='a'&&str1[j]<='z'||str1[j]>='0'&&str1[j]<='9'||str1[j]=='_');        //??????????????????????
			   else   break;                      //??????????
			}  
			  if(j==k)  p=1;                    //?????????p??1
			   
			
		}
		cout<<p<<endl;                          //??p
		p=0;                                    //???p???0????????
	}
		return 0;
}                                              //?????
int f(char str[81])//?????????C++??? 
{ 
    int g=1;//g????? 
    if((str[0]<65)||(str[0]>122)||((str[0]>90)&&(str[0]<97)&&(str[0]!=95)))
    {
        g=0;
    }
    else
        for(int i=1;i<=80;i++) //?????????????? 
        {
            if(str[i]!='\0')//?????????????? 
            {  
                if(((str[i]>=65)&&(str[i]<=90))||((str[i]>=97)&&(str[i]<=122))||(str[i]==95)||((str[i]>=48)&&(str[i]<=57))) 
                g=g*1;
                else
                { 
                   g=0; 
                   break;
                }
             } 
        }
    return g; 
} 
int main()
{
    int n;
    char str[100][81];//????????? 
    int end[100];//???????? 
    cin>>n;
    cin.get(); 
    for(int i=0;i<n;i++) //????? 
    {
            cin.getline(str[i],81); 
    }
    for(int i=0;i<n;i++)//??????? 
    {
            end[i]=f(str[i]);
    }
    for(int i=0;i<n;i++)//???? 
    {
            cout<<end[i]<<endl; 
    }
    return 0; 
}
int main()
{
	int n;
	int i,j,k,counta=0,countc=0;
	scanf("%d",&n);
	char legal[81];
	getchar();

	for(i=0;i<n;i++)
	{
		gets(legal);
		k=strlen(legal);

		if(k==1)
		{
            countc=0;
			if((legal[0]>='A'&&legal[0]<='Z')||(legal[0]>='a'&&legal[0]<='z')||(legal[0]=='_'))
			{
				countc++;
			}
			if(countc==1)
			{
				printf("1\n");
			}
			else
			{
				printf("0\n");
			}
		}

		else
		{
			if((*(legal)>='A'&&*(legal)<='Z')||(*(legal)>='a'&&*(legal)<='z')||(*(legal)=='_'))
			{
                counta=0;
				for(j=1;j<k;j++)
				{
					if((*(legal+j)>='A'&&*(legal+j)<='Z')||(*(legal+j)>='a'&&*(legal+j)<='z')||
                    (*(legal+j)=='_')||(*(legal+j)>='0'&&*(legal+j)<='9'))
						counta++;
				}
				if (counta==k-1)
				{
					printf("1");
					printf("\n");
				}
				else
				{
					printf("0");
					printf("\n");
				}
			}
			else
			{
				printf("0");
				printf("\n");
			}
		}
	}
	return 0;
}
int isLegal(char *str)
{
    if (!isalpha(*str) && *str != '_') return 0;
    for (str++;*str;str++)
        if (!isalpha(*str) && !isdigit(*str) && *str != '_') return 0;
    return 1;
}
int main()
{
    char str[100];
    int n;
    scanf("%d", &n);
    gets(str);
    while (n--)
    {
          gets(str);
          printf("%d\n", isLegal(str));
    }
    return 0;
}
int main()
{int n,i,j,b;
char a[81];
scanf("%d\n",&n);
for(i=0;i<n;i++)
{gets(a);
 if((a[0]=='_')||((a[0]<='z')&&(a[0]>='a'))||((a[0]<='Z')&&(a[0]>='A'))) 
 b=1;
else b=0;
j=1;
while ((b!=0)&&(a[j]!='\0'))
{ if((a[j]=='_')||(a[j]<='z'&&a[j]>='a')||(a[j]<='Z'&&a[j]>='A')||(a[j]<=57&&a[j]>=48)) b=1; 
else b=0;
j++;
}
printf("%d\n",b);
}
return 0;
}
int main()
{
	int i,n,l,p,k;
	char ch[100];
	cin>>n;
	cin.get();
	for(k=1;k<=n;k++)
	{
		p=1;
		cin.getline(ch,100,'\n');
		l=strlen(ch);
		if(ch[0]=='_'||ch[0]>='a'&&ch[0]<='z'||ch[0]>='A'&&ch[0]<='Z')
		{
			for(i=1;i<=l-1;i++)
			{
				if(ch[i]<'0'||ch[i]>'9'&&ch[i]<'A'||ch[i]>'Z'&&ch[i]<'a'&&ch[i]!='_'||ch[i]>'z')
				{
					p=0;
				}
			}
		}
		else
		{
			p=0;
		}
		cout<<p<<endl;
	}
	
	return 0;
}
int main()
{
	int n,i,j;
	cin >> n;
	cin.get();
	char a[100][81];
	int flag[100]={0};
	for (i=0;i<n;i++)
	{
		cin.getline(a[i],100);
		int num=0;
		if (((a[i][0]<='z')&&(a[i][0]>='a'))||((a[i][0]<='Z')&&(a[i][0]>='A'))||(a[i][0]=='_'))
		{
			for (j=0;a[i][j]!='\0';j++)
				if (((a[i][j]<='z')&&(a[i][j]>='a'))||((a[i][j]<='Z')&&(a[i][j]>='A'))||((a[i][j]>='0')&&(a[i][j]<='9'))||(a[i][j]=='_'))
					num++;
			if (num==j)
				cout << "1" << endl;
			else cout << "0" << endl;
		}
		else cout << "0" << endl;
	}
	return 0;
}
main()
{
      int n,i,j,d=0;
      char a[100];
      scanf("%d",&n);getchar();
      for(i=0;i<n;i++)
      {
          gets(a);
          if(a[0]!='_'&&((a[0]<'a'&&a[0]>'Z')||a[0]>'z'||a[0]<'A'))
             {printf("0\n");continue;}
          for(j=0;a[j]!='\0';j++)
          if(a[j]=='_'||(a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='Z')||('0'<=a[j]&&a[j]<='9'))
             d=1;
          else {d=0;break;}
          printf("%d\n",d);
      }getchar();getchar();
      }
int isA(char a)
{
	if( (a>='0' && a<='9')|| (a>='a' && a<='z') || (a>='A' && a<='Z') ||a=='_')return 1;
	return 0;
}
int isStart(char a)
{
	if(  (a>='a' && a<='z') || (a>='A' && a<='Z') ||a=='_')return 1;
	return 0;
}
int main()
{
		int i=0, n = 0;
		scanf("%d\n",&n);
		char array[300][81] ;
		for(i = 0 ; i<n ; i++)
		{
			gets(array[i]);
		}
		for(i = 0 ; i<n ; i++)	
		{
			int len = strlen(array[i]);
			int j = 0;
			int flag = 1;
			if(isStart(array[i][0])==1){
				for(;j<len;j++)
				{
					if(isA(array[i][j])==0)flag=0;
				}
			}
			else flag= 0 ;
			if(flag==1)printf("1\n");
			else printf("0\n");
		}
		return 0;
}