semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
 int Nxiaopengyou, Mtiaohuai, *Leijicishu;
 int i,j;
 int cishu,shijian;
 scanf("%d",&Nxiaopengyou);
 for(i=0;i<Nxiaopengyou;i++)
 {
  scanf("%d",&Mtiaohuai);
  if(Mtiaohuai==0)
    cishu=60;
  else
  {
    Leijicishu=(int *)malloc(Mtiaohuai);
    for(j=0;j<Mtiaohuai;j++)
      scanf("%d",&Leijicishu[j]);
    shijian=60;
    cishu=60;
    for(j=0;j<Mtiaohuai;j++)
    {
      shijian=shijian-Leijicishu[j]-3;
      if(j>0)
        shijian+=Leijicishu[j-1];
      if(shijian>0)
        cishu-=3;
      else
       {
         if(Leijicishu[j]<cishu)
           cishu=Leijicishu[j];
         break;
       }
    }
    free(Leijicishu);
  }
  printf("%d\n",cishu);
 }
 return 0;
}
int main( int argc, char* argv[] ){
  int n;
  int miss,misspointer;
  int second = 0, time = 0;

  scanf( "%d", &n );
  for ( int i = 0; i < n; i++ ) {
      scanf( "%d", &miss );
      if ( miss == 0 ){
         printf( "60\n");
         continue;
      }
      int j = 0;
      do{
        scanf( "%d", &misspointer );
        if ( (second < 60)&&(misspointer < 60) ){
          second = misspointer + time * 3;
		 // printf("%d\n", second);
          if ( (second + 2) < 60 ){
            time ++;
          }
        }
        j++;
      }while( j < miss );
	  if ( (second < 60)&&((second + 2)>60) ){
		  second -= time * 3;
	  }
	  else{
		second = 60 - time * 3;
	  }
      printf( "%d\n", second );
	  second = 0;
	  time = 0;
	//  printf("************************\n");
  }
  return 0;
}
/*
 * file    homework 9_6
 * author  ??
 * date    2010-11-24
 * description
           ?????????????????
*/



int main()
{
	int n, m, s, i;
	int a[15];
	cin >> n;
	while(n --)
	{
		cin >> m;
		if (m == 0)
		{   cout << 60 << endl;   continue;  }
		for (i = 0; i < m; i ++)
			cin >> a[i];
		for (i = 0; i < m; i ++)
		{
			if (a[i] + i * 3 >= 60)
			{  s = 60 - i * 3;   break;  }
			if (a[i] + i * 3 + 3 >= 60)
			{  s = a[i];  break;  }
		}
		if (i == m)
			s = 60 - m * 3;
		cout << s << endl;
	}
	return 0;
}
int main()
{
	int time[100][60];
	int d[20];
	int i,m,j,b;
	int sum;
	

	int data[100][60];
	
	scanf("%d",&m);
	for(i=0;i<m;i++){
	
	     scanf("%d",&d[i]);
		 if(d[i]!=0){
         for(j=0;j<d[i];j++){
			scanf("%d",&data[i][j]);
		    
		 }
		 }
		 else continue;
		
		 
	}


	for(i=0;i<m;i++){
        	for(j=0;j<1000;j++){
			 time[i][j]=1;
		 }
		if(d[i]!=0){
		b=0;
		for(j=0;j<d[i];j++){
		
			time[i][b+data[i][j]]=0;
			time[i][b+data[i][j]+1]=0;
			time[i][b+data[i][j]+2]=0;
			b=b+3;
		}
        sum=0;
		for(j=0;j<60;j++){
			sum+=time[i][j];
			
		}
		printf("%d\n",sum);
		}
		else
			printf("60\n");

	}
	
	
		
	
	return 0;
}
int main()
{
	int n, a[100], b[100][20], i, j, flag = 0;
	cin >> n;
	for(i = 0; i < n; i++)
	{
		cin >> a[i];
		for(j = 0; j < a[i]; j++)
			cin >> b[i][j];
	}
	for(i = 0; i < n; i++)
	{
		for(j = 0; j < a[i]; j++)
		{
			if((b[i][j] + j * 3 + 3) >= 60)
			{
				if((b[i][j] + j * 3) < 60)
					cout << b[i][j] << endl;
				else
					cout << 60 - j * 3 << endl;
				flag = 1;
				break;
			}
		}
		if(flag == 0)
		{
			cout << 60 - j * 3 << endl;
		}
		flag = 0;
	}
	return 0;
}
int num (int m, int a[])
{
	int i, time = 0, count = 0;
	for(i = 0; ;i++)
	{
		if(m == 0)
			return 60;
		else
		{
			time = time + a[i];
			if(time < 60)
			{
				time = time + 3;
				count++;
				if(time < 60)
				{
					if(count < m)
					{
						time = time - a[i];
					}
					else
						return a[i] + 60 - time;

				}
				else
					return a[i];

			}
			else
				return (a[i] - (time - 60));
		}
	}

}
int main()
{
	int n, i, m, j;
	int a[15] = {0};
	cin >> n;
	for(i = 1; i <= n; i++)
	{
		memset(a, 0, sizeof(a));
		cin >> m;
		for(j = 0; j < m; j++)
			cin >> a[j];
		cout << num (m, a) << endl;
		
	}

	return 0;

}
int jilu[100];

int main()
{

    memset(jilu,0,sizeof jilu);
    int total,i;
    cin>>total;

    for(i=1;i<=total;i++)
    {
        int a[20];
        memset(a,0,sizeof a);
        int n,j;
        cin>>n;
        if(n==0) jilu[i]=60;
        else
        {
            for(j=1;j<=n;j++) cin>>a[j];
            if(a[1]>=60) jilu[i]=60;
            else
            {
                int time;
                for(j=1;j<=n;j++)
                {
                    time=a[j]+3*j;
                    if(a[j]<60&&a[j]+3*j>60)
                    {
                        jilu[i]=a[j];
                        break;
                    }
                    else if(time<60&&(a[j+1]+3*j>60)) break;
                }
                if(j<=n)
                {
                    if((60-time>a[j+1]-a[j])&&a[j+1]>0) jilu[i]=a[j+1];
                    else if(a[j]<60&&a[j]+3*j>60);
                    else jilu[i]=60-3*j;
                }
                else jilu[i]=63-3*j;

            }

        }


    }
    for(i=1;i<=total;i++) cout<<jilu[i]<<endl;


    return 0;
}
int main()
{
	int k,n,i,j,*p,total,r;
	scanf("%d",&k);
	for(i=0;i<k;i++)
	{
		scanf("%d",&n);
		p=(int*)malloc(sizeof(int)*n);
		for(j=0;j<n;j++)
		{
			scanf("%d",&p[j]);
		}
		if((p[n-1]+n*3)<=60)
		{
			total=60-n*3;
		}
		else
		{
			for(r=1;r<n;r++)
			{
				if((p[n-r]+3*(n-r))<=60)
				{
				   total=p[n-r];
				   break;
				}
			    else if((p[n-r-1]+(n-r)*3)<=60)
				{
				   total=60-(n-r)*3;
				   break;
				}
			}
			    
		}
		printf("%d\n",total);
		free(p);
	}
	return 0;
}
int main(){
	int a,i;
	scanf("%d",&a);
	for(i=1;i<=a;i++){
		int m[20],b,c,d,e;
		scanf("%d",&b);
		if(b==0){
			printf("60\n");
		}
		else{
                  for(c=0;c<b;c++){
			         scanf("%d",m+c);
                                   }
                  if(m[b-1]+3*b<=60){
					  printf("%d\n",60-3*b);
				                    }
				  else{
					  if(m[b-1]+3*(b-1)>=57&&m[b-1]+3*(b-1)<=60){
						  printf("%d\n",m[b-1]);
					  }
					  else{
						  d=1;
      
                  while(d<=b){
					  if(m[d-1]+3*(d-1)>60){
						  if(m[d-2]+3*(d-2)<=57){
						  printf("%d\n",63-3*d);break;
					  }
					  else{
						  printf("%d\n",m[d-2]);break;
					  }
				  }
					  d++;
				  }
					  }
				  }
		}
	}
}
int main()
{
   int n;
   cin>>n;
   for(int i=0;i<n;i++)
    {
      int k;
      cin>>k;
      if(k==0) cout<<60<<endl;
      else 
       {
         int a[k];
         for(int j=0;j<k;j++)  
           cin>>a[j];
         for(int j=0;j<k;j++)
          {
             if(a[j]+3*(j+1)<=60)
               {
                if(j==k-1) cout<<60-3*k<<endl;
                else
                continue;
               }
             else
                if(a[j]+3*(j+1)<=63)
                  {
                   cout<<a[j]<<endl;
                   break;
                  }
             else
                {
                 cout<<60-3*j<<endl;
                 break;
                }
          }
       }
    }
 

 return 0;
 }
int main(){
	int n, i, j, k, w, cs[100][100], r;
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%d", &w);
		for(j=0;j<w;j++){
			scanf("%d", &cs[i][j]);
		}
		if(cs[i][j-1]+3*w<=60)
			r=60-3*w;
		else if(cs[i][j-1]+3*w>60&&cs[i][j-2]+3*w<=60){
			if(cs[i][j-1]+3*w-60>3)
				r=60-3*(w-1);
			else
				r=cs[i][j-1];}			
		else if(cs[i][j-01]+3*w>60&&cs[i][j-2]+3*(w-1)>60){
			if(cs[i][j-2]+(w-2)*3<60)
				r=cs[i][j-2];
			else
				r=60-(w-2)*3;}
		printf("%d\n", r);
	}
	return 0;
}
int main()
{
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
    int m,j;
	scanf("%d",&m);
	 int *a=(int*)malloc(sizeof(int*)*m);
	for(j=0;j<m;j++)
    {
	  scanf("%d",&a[j]); 				
    }
    if(m==0)
    {
	  printf("60\n"); 		
    }
    else if(m==1)
    {
	  if(a[0]<=57)
	  {
	    printf("57\n");				
	  }
	  else
	  {
	  	printf("%d\n",a[0]);   
      } 	 
    }
    else if(m>1)
    {
      for(j=0;j<m-1;j++)
      {
	    if((a[m-1]+3*m)<=60)
	    {
		  int e=60-3*m;
		  printf("%d\n",e); 
		  break;				  
	    }
	    if((a[m-1]+3*m)>60)
		{
	      if((a[j]+3*(j+1))<=60&&(a[j+1]+3*(j+2))>60)
		  {
		    if((a[j+1]+3*(j+1))>60)
		    {
		      int e=60-3*(j+1);
			  printf("%d\n",e); 						 
		    }
		    else
		    {
		      printf("%d\n",a[j+1]); 	  
	        } 										   
	      }
	    } 				
      }
    }
    free(a); 				  
  }
  return 0;	   
}
main()
{
      int m,n,i,j,k,l,sum,t;
       scanf("%d",&m);
       for (i=1;i<=m;i++)
       {
           scanf("%d",&n); 
           sum=60;t=0;          
       for (j=1;j<=n;j++)
       {
           scanf("%d",&l);
           if (sum>l)
           { 
           if (sum-l<3) sum=l;
            else sum=sum-3;
           }
           }   
       printf("%d\n",sum);
       }
    
       }
int main()
{
int Nchildren, Mstop, * Total;
int i,j;
int x,time;

scanf("%d",&Nchildren);

for(i=0;i<Nchildren;i++)
{
scanf("%d",&Mstop);

if(Mstop==0) 
    x=60;
else
{
    Total=(int *)malloc(Mstop); 
    for(j=0;j<Mstop;j++)
      scanf("%d",&Total[j]); 
    time=60; 
    x=60;   
    for(j=0;j<Mstop;j++)
    {
      time=time-Total[j]-3; 
      if(j>0)
        time=time+Total[j-1];         
      if(time>0)                             
        x=x-3;
      else                        
       {
         if(Total[j]<x) 
           x=Total[j];
         break;                          
       }
    }

    free(Total);
}
printf("%d\n",x); 
}
return 0;
}
int main()
{
  int n,i,a[100],j,k;
  scanf("%d",&n);
  int times[100][20]={0};
  for(i=0;i<n;i++)
  {
  	scanf("\n%d",&a[i]);
  	for(j=0;j<a[i];j++)
  	{
  		scanf("%d",&times[i][j]);
  	}
  }
  for(i=0;i<n;i++)
  {
  	if(a[i]==0)
  	{printf("\n%d",60);}
  	else 
  	{
  		for(j=0;j<a[i];j++)
  	    {
  	    	int b,c,d;
  	    	b=times[i][j]+3*(j+1);
  	    	if(b>=63)
  	    	{
  	    		c=60-(times[i][j-1]+3*j);
  	    		d=times[i][j-1]+c;
  	    		printf("\n%d",d);
                           break;
  	    	}
  	    	else if(b>=60){printf("\n%d",times[i][j]);break;}
  	    }
  	    if((times[i][a[i]-1]+3*a[i])<60)
  	    {
  	    	k=60-a[i]*3;
  	        printf("\n%d",k);
  	    }
  	 }
  }
  return 0;
}
main()
{int n,i;
 cin>>n;
 for(i=0;i<n;i++)
 {int h,j,a[100];
  cin>>h;
  if(h==0)
  {cout<<"60"<<endl;
   continue;
  }
  for(j=0;j<h;j++)
	 cin>>a[j];
  int flag=0;
  for(j=0;j<h;j++)
  {if(a[j]+3*j+3>=60)
  {flag=1;
   if(a[j]+3*j+3>63)
	   cout<<60-3*j<<endl;
   else
	   cout<<a[j]<<endl;
   break;
  }
  }
  if(flag==0)
	  cout<<60-3*h<<endl;
 }
 return 0;
}
int main(){
    int n,over,j,i,m,zongshu,jieshu,a,k;
	int leiji[60];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&m);
		if(m==0){zongshu=60;}	
		if(m!=0){
			for(j=0;j<m;j++){
				scanf("%d",&leiji[j]);
			}
			over=leiji[m-1]+3*(m-1);
			if(over<=60){
				if(over<=57){
					zongshu=60-3*m;
				}else{
					zongshu=over-3*(m-1);
				}
			}
			if(over>60){
				jieshu=leiji[m-2]+3*(m-2);
				if(jieshu<60){
				  if(jieshu<=57){
					zongshu=60-3*(m-1);
				}else{
					zongshu=jieshu-3*(m-2); 
				}
				}else{
                    zongshu=60-3*(m-2);
				}
			}
		}
	   printf("%d\n",zongshu);
	}
return 0;
}
int main()
{
    int a[100]={0},t,n,i,j,ans;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
      scanf("%d",&t);
      for(j=0;j<t;j++)
      {
      scanf("%d",&a[j]);
       }  
       if(t==0)
        {printf("60\n");continue;}
       else if(a[t-3]+3*(t-2)<60&&a[t-2]+3*(t-2)>60)
       { 
              ans=60-3*(t-2);
              printf("%d\n",ans);  continue; } 
        else if(a[t-2]+3*(t-1)>60)
       { 
              ans=a[t-2];
              printf("%d\n",ans);  continue; }
        else if(a[t-1]+3*(t-1)<=60&&a[t-1]+3*t>=60)
       { printf("%d\n",a[t-1]);
         continue; }      
            
       else if(a[t-1]+3*(t-1)<60)
       { printf("%d\n",60-3*t);
         continue; }
         
              else if(a[t-1]+3*(t-1)>60)
       { printf("%d\n",60-3*(t-1));
        continue; }               
       else if(a[t-1]+3*(t-2)>60)
       { 
            ans=60-3*(t-2);
            printf("%d\n",ans);
         continue; }           
       
        
         
                    }
     return 0;
    
    
    }
//============================================================================
// Name        : 13.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================


int main() {
	int n;
	cin>>n;
	int x[10],m,a[200];
	for(int i=0;i<n;i++)
	{
		cin>>m;
		for(int i=0;i<m;i++)
			cin>>x[i];
		x[m]=60;//?????60?
		memset(a,0,400);
		int num=-3,sum=0;
		for(int i=0;i<=m;i++)
			for(num+=3;sum<x[i];sum++,num++)//????????????1
				a[num]=1;
		int sum2=0;for(int i=0;i<60;i++)//????
			sum2+=a[i];
		cout<<sum2<<endl;
	}
	return 0;
}
void main()
{
	int g,time,n,a[100],m,i;

scanf("%d",&n);

while(n--)
{
	scanf("%d",&m);
	g=0;
	time=0;

	memset(a,0,sizeof(a));
	
	for(i=0;i<m;i++)
		scanf("%d",&a[i]);
	
	i=0;

	if(m==0) printf("60\n");
	else 
	{
		for(i=0;i<m;i++)
	{
        time=a[i]+3*i;
		g=a[i];
		if(time<=60 && time>=57 ) 
		{
			printf("%d\n",g);break;
		}
		if(time>60) 
		{
			printf("%d\n",g-(time-60));break;
		}
	
	}

    if(time<57) printf("%d\n",g+(60-time)-3);
	}


	
}

	
}
int main()
{
    int n,i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
         int breaktime,j;                 //????
         scanf("%d",&breaktime) ;
         int n[breaktime],k=0,l=0;        //l??? 
         if(breaktime==0)
             printf("60\n");
         else
         {
             for(j=1;j<=breaktime;j++)
             {
                   scanf("%d",&n[j]);
                   if(3*j+n[j]<=60)
                       k=k+1;
                   else if(3*j+n[j]>=63)
                       k=k;
                   else if(3*j+n[j]==61)
                   {
                        k=k+1;
                        l=1;
                   }
                   else if(3*j+n[j]==62) 
                   {
                        k=k+1;
                        l=2;
                   }
             }
             int total;
             total=60-3*k+l; 
             printf("%d\n",total);
         }
    }
    return 0;
}
int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	int i,j;
	for(i=0;i<n;i++)
	{
		int m,time=60;
		scanf("%d",&m);
		for(j=0;j<m;j++)
		{
			int a;
			scanf("%d",&a);
			if(a<(time-3))
			{
			    time -= 3;
			}
			else if(a==(time-3))
			{
				time = a+1;
			}
			else if(a>(time-3)&&a<=time)
			{
				time=a;
			}
		}
			printf("%d\n",time);
	}
	return 0;
}
int main()
{
	int n, i, j, l, k, m;
	int A[1000][10];
	int B[200];
	scanf("%d", &n);
	for(i=1;i<=n;i++)
	{
		scanf("%d", &m);
		for(j=1;j<=m;j++)
		{
            scanf("%d", &A[i][j]); 
		}
		if(A[i][m]+3*m<60)
		{
			B[i]=60-3*m;
		}
		else
		{
			for(k=1;k<=m;k++)
			{
				if(A[i][k]+3*k>=60&&A[i][k]+3*k<=63)
				{
					B[i]=A[i][k];
				}
				else if(A[i][k-1]+3*k-3<60&&A[i][k]+3*k>=60)
				{
					B[i]=60-k*3+3;
				}
			}
		}
	}
	for(l=1;l<=n;l++)
	{
		printf("%d\n", B[l]);
	}
	return 0;
}
int main()
{
	int n,i,j,m,g,t,a[20],k;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&m);
		if(m==0)
			printf("60\n");
		else
		{
			g=0;
			t=0;
			for(j=0;j<m;j++)
			{
				scanf("%d",&a[j]);
			}
			for(j=0;j<m;j++)
			{
				if(j==0)
				{
					for(k=0;k<a[j];k++)
					{
						t++;
						if(t<60)
							g++;
					}
				}
				else
				{
					for(k=0;k<(a[j]-a[j-1]);k++)
					{
						t++;
						if(t<=60)
							g++;
					}
				}
				t+=3;
				if(t>=60)
						break;
			}
			while(t<60)
			{
				g++;
				t++;
			}
			printf("%d\n",g);
		}
	}
			

	return 0;
}
int main()
{
	int n,i,j,sum=0,a[100][20],num[100];
	cin>>n;
	for(i=0;i<n;i++)
	{
		num[i]=0;
		cin>>a[i][0];
	    for(j=1;j<=a[i][0];j++)
			cin>>a[i][j];
        if(a[i][0]==0) num[i]=60;
		else
			for(j=1;j<=a[i][0];j++)
			{
				sum=a[i][j]+3*j;
		    	if(sum>60) 
				{
					if(a[i][j]+3*(j-1)<60)
					  num[i]=a[i][j];
				    else 
				 	  num[i]=60-3*(j-1);
			    	break;
				}
			}
		if(num[i]==0) 
			num[i]=60-3*a[i][0];
		else num[i]=num[i];
	}
	for(i=0;i<n;i++)
		cout<<num[i]<<endl;
   return 0;	
}
int main(){
    int n,i,m,j;
    cin>>n;
    int s[n],b[n];
    for(i=1;i<=n;i++){
       cin>>m;
       int a[i][m];
       for(j=0,s[i]=60,b[i]=0;j<m;j++){
                        cin>>a[i][j];
       b[i]=a[i][j]+3*j+3;
       if(b[i]<=60){s[i]-=3;}
       else if(b[i]>=63){s[i]=s[i];}
       else{s[i]=a[i][j];}}
       printf("%d\n",s[i]);
       }
       
       return 0;
       }
void main(){
	int n,m;
	int a[60],sum;
	int i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&m);
		for(j=0;j<m;j++){
			scanf("%d",&a[j]);
		}
		sum=0;
		if(m==0)//???????60
			sum=60;
		for(j=0;j<m;j++){
			if(a[j]+3*j>=60){//?????????????60s???60?????????????ok?1????
				sum=60-3*j;
				break;
			}
			else if(a[j]+3*(j+1)>=60){//??????(??a[j])???????60s??????????3s????????a[j]?2????
				sum=a[j];
				break;
			}
		}
		if(j==m)//
			sum=60-3*m;
		printf("%d\n", sum);
	}
}
//????????1???????60s??2???3s???60s?
int main(){
	int sz[100][100],n,tiaohuai[100],sum[100]={0},i,k,j;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&tiaohuai[i]);
		if(tiaohuai[i]==0){
			continue;
		}
		for(k=0;k<tiaohuai[i];k++){
			scanf("%d",&sz[i][k]);
		}
	}
	for(i=0;i<n;i++){
		if(tiaohuai[i]==0){
			sum[i]=60;
			continue;
		}
		for(k=0;k<tiaohuai[i];k++){
			j=sz[i][k]+3*k;
			if(j>60){
				if(sz[i][k-1]+3*k>=60){
					sum[i]=sz[i][k-1];
					break;
				}else{
					sum[i]=60-3*k;
					break;
				}
			}
		}
		if(sum[i]==0){
			if(j+3<=60){
				sum[i]=60-tiaohuai[i]*3;
			}else{
				sum[i]=sz[i][k-1];
			}
		}
	}
	for(i=0;i<n;i++){
		printf("%d\n",sum[i]);
	}
	return 0;
}
int main()
{
	int n,a,b[30],c;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		if(a==0)
			c=60;
		else
		{
			for(int j=0;j<a;j++)
			{
				cin>>b[j];
				if(b[j]+3*j<58)
				{
					c=60-3*a;
				}else if(b[j]+3*j>57&&b[j]+3*j<61)
				{
					c=b[j];
				
				}else if(b[j]+3*j>60&&b[j-1]+3*j-3<58)
				{
					c=60-3*j;
				
				}
			}
		}
		cout<<c<<endl;
	}
	return 0;
}
void main()
{
  int k,i,j,n,m,t,c[20],l;
  scanf("%d",&n);
  for(i=1;i<=n;i++)
  {
     scanf("%d",&m);
	 if(m==0)  
	 {
		 printf("60\n");
		 continue;
	 }
	 t=0;
	 for(j=1;j<=m;j++)
	 {
	    scanf("%d",&k);
		if(k+3*(j-1)>=60)
		{
		  for(l=j+1;l<=m;l++)
			  scanf("%d",&c[l]);
		  break;
		}
		if(k+3*j>60)
		{
		  for(l=j+1;l<=m;l++)
			  scanf("%d",&c[l]);
		  t=60-(k+3*(j-1));
		  break;
		}
	 }
	 printf("%d\n",60-3*(j-1)-t);
  }
}
int main()
{
	int n,i,j,m,a[100][100],b[100];
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%d",&m);
		if(m>0)
		{
		    for(j=0;j<=m-1;j++)
			{
				scanf("%d",&a[i][j]);
			}
			if(60-3*m>=a[i][m-1]+3)
			{
				b[i]=60-3*m;
			}
			if(60-3*m>=a[i][m-1]&&60-3*m<a[i][m-1]+3)
			{
				b[i]=a[i][m-1];
			}
			if(60-3*m<a[i][m-1])
			{
				for(j=m-1;j>=0;j--)
				{
					if(60-3*(j+1)>=a[i][j]+3)
					{
				        b[i]=60-3*(j+1);
						break;
					}
			        if(60-3*j>=a[i][j]&&60-3*j<a[i][j]+3)
					{
				        b[i]=a[i][j];
						break;
					}
				}
			}
		}
		if(m==0)
			b[i]=60;
	}
	for(i=0;i<=n-1;i++)
		printf("%d\n",b[i]);
	return 0;
}
int main()
{
	int a,b,c,d,t,i,j,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a);
		c=0;t=0;
		for(j=0;j<a;j++)
		{
			scanf("%d",&b);
			t=b+3*j;
			if(t<=60)
				c=b;
			else
			{
				t=c+3*j-3;
				break;
			}
		}
		for(j++;j<a;j++)
		{
			scanf("%d",&d);
		}
			if(t<57)
				c+=57-t;
			if(a==0)
				c+=3;
		printf("%d\n",c);
	}
	return 0;
}
int main()
{
	int i,j,n,m,t[100],k[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&m);
		if(m==0)
		{
			t[i]=60;
		}
		else
		{
			for(j=1;j<=m;j++)
			{
			   scanf("%d",&k[j]);
			}
		    for(j=1;j<=m;j++)
			{
			   if(k[j]+j*3>=63)
			   {
				   t[i]=63-j*3;
				   break;
			   }
			   else if(k[j]+j*3>=60)
			   {
				   t[i]=k[j];
				   break;
			   }
			   else
			   {
				   t[i]=60-3*m;
			   }
			}
		}
	}
	for(i=0;i<n;i++)
	{
		if(i>0)
			printf("\n");
		printf("%d",t[i]);
	}
	return 0;
}
int main(){
	int n;
	int result;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		if(a==0){
			result=60;
		}else{
			int cishu[60];
		    for(int b=0;b<a;b++){
			    scanf("%d",&cishu[b]);
			}
			for(int c=0;c<a;c++){
				if(cishu[c]+3*c+3<=60){
					result=57-3*c;
				}else if(cishu[c]+3*c<60&&cishu[c]+3*c+3>60){
                    result=cishu[c];
					break;
				}
			}
		}
	printf("%d\n",result);	
	}
	return 0;
}
int main()
{
	int n;
	cin >> n;
	int i = 0, j = 0;
	int tiaohuai = 0;
	int tiao[200];
	memset(tiao, 0, sizeof(tiao));
	int pro = 0;
	int count = 0;
	for (i = 1; i <= n; i++)
	{
		cin >> tiaohuai;
		for (j = 0; j <= tiaohuai - 1; j++)
		{
			cin >> pro;
			tiao[pro + 3 * j + 1] = 1;
		}
		count = 0;
		for (j = 1; j <= 60;)
		{
			if (tiao[j] == 0)
			{
				j++;
				count++;
			}
			else 
				j += 3;
		}
		cout << count << endl;
		memset(tiao, 0, sizeof(tiao));
	}
	return 0;
}
int main() { 
	int t,n,m,k,c;
	cin >> t;
	while(t--) {
		cin >> n;
		c = 0;
		while(n--) {
			cin >> k;
			if(c + k < 60)
				if(c + k + 3 < 60)
					c += 3;
				else c = 60-k;
		}
		cout << 60 - c << endl << endl;
	}
	return 0; 
}
int main ()
{
	int n,m,i,j,a[100][100]={0},b[100]={0};
	int T;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>m;
		for(j=1;j<=m;j++)
			cin>>a[i][j];
	}
	for(i=1;i<=n;i++)
	{
		T=0;
		j=1;
		while(a[i][j]!=0)
			{
				if((a[i][j]-a[i][j-1]+T)<=60)
		if((a[i][j]-a[i][j-1]+T+3)<=60)
		{
			T=T+a[i][j]-a[i][j-1]+3;
			j++;
		}
		else break;
			else break;
		}
		if(a[i][j]!=0&&(a[i][j]-a[i][j-1]+T)<=60) b[i]=a[i][j];
		else b[i]=a[i][j-1]+60-T;
	}
	for(i=1;i<=n;i++)
		cout<<b[i]<<endl;
	return 0;
}
int main(){
    int n,m,i,xpy,stop;
    int js[21];
    scanf("%d",&n);
    int *a=(int *)malloc(sizeof(int)*(n+1));
    for(xpy=1;xpy<=n;xpy++){
		scanf("%d",&m);
		for(i=1;i<=m;i++){
			scanf("%d",&js[i]);
			}
		stop=0;
		for(i=1;i<=m;i++){
			if(js[i]+i*3<=60){
				stop+=3;
				}
			else if(js[i]+(i-1)*3<=60){
				stop+=60-js[i]-(i-1)*3;
				}
			else
			break;
			}
		a[xpy]=60-stop;
		}
	for(i=1;i<=n;i++){
	    printf("%d\n",a[i]);
	    }
	scanf("%d\n",&i);
	return 0;
	}
int main()
{
int n,m,i,j,a[1000],time=0,s=0,temp;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
 scanf("%d",&m);
 for(j=0;j<=100;j++) a[j]=0;
 for(j=1;j<=m;j++)
 {
  scanf("%d",&temp);
  a[temp]=1;
 }          
 for(j=1;j<=100;j++)
 {
  time++;s++;
  if(a[j]==1) time+=3;
  if(time>=60) break;
 }
 printf("%d\n",s);
 s=0;time=0;
}
scanf("%d",&n);
return 0;
}
//**********************************************************************************************
//??????????                                                                         *
//????:10.21                                                                               *    
//???:wayne???????????????????????????????????????? *
//**********************************************************************************************
int main()
{
	int n,a[1000][61],i,j,b[1000];            //?b[]???????????
	cin>>n;                                   //??n????????
	cout<<endl;
	for (i=1;i<=n;i++)
	{
	    cin>>b[i];           
		if (b[i]==0)                          //??????????????
			cout<<60<<endl;
		else
		{
	    for (j=1;j<=b[i];j++)  cin>>a[i][j];  //???????????
	    cout<<endl;
	    for (j=b[i];j>=1;j--)                 //??????????
			if (a[i][j]+j*3<=60)  
			{cout<<60-j*3<<endl;break;}       //?????????????? 
			else if ((a[i][j]+(j-1)*3)<=60)   
			{cout<<a[i][j]<<endl;break;}      //??????????????????????
		}
	}
	return 0;
}
/*-----------------------------------------*\
|? ? ?   ?????  		            |
|? ?      ????	                    |
|? ? ? ??2010 ? 11 ? 25 ?		    |
|? ?      ?1000012758		            |
\*-----------------------------------------*/ 
int main()
{
	int NumberOfChildren, Time, Jump[20], NumberOfJump, SumOfTime, i, j;
	//???????
	cin >> NumberOfChildren;
	for (i = 0; i < NumberOfChildren; i++)
	{
		//???????
		cin >> Time;
		memset(Jump, 0, sizeof(Jump));
		//?????????????
		for (j = 1; j <= Time; j++)
			cin >> Jump[j];
		//?????????
		for (j--; ; j--)
		{
			//?????
			SumOfTime = 3 * j + Jump[j];
			//??60?
			if (SumOfTime <= 60)
			{
				cout << (Jump[j] + 60 - SumOfTime) << endl;
				break;
			}
			//?????????57-60?
			else if (SumOfTime <= 63)
			{
				cout << Jump[j] << endl;
				break;
			}
		}
	}
	return 0;
}