semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n, m,d=0,s=0,i,j,k,x;
	scanf("%d",&n);
	for(k=1;k<=n;k++)
	{
       
      int *p;
	  p=(int*)malloc(sizeof(int)*m);
       s=0;
	    x=0; 
	  d=0;
      scanf("%d",&m);
	   for(i=0;i<m;i++)
	   {
		scanf("%d",&p[i]);
	   }
	   
    	for(j=0;j<m;)
		{
		  p[j]+=3*(j+1);
		  if((p[j]>60)&&(p[j]<63))
		  {
			s=p[j]-3*(j+1);
			d=1;
		break;
		  }
		 if((p[j]>63)||(p[j]==63))
		 {
			s=60-3*j;
			d=1;
			break;
		 }
		 if((p[j]<60)||(p[j]==60))
			 j++;
		}
    	if(d==0)
		{
	 	  x=60-(3*m);
		  printf("%d\n",x);
	
		}
	   if(d==1)
	   {
		x=s;
		printf("%d\n",x);
		
	   }
	}
	return 0;
}
int main()
{
	int n,cishu,i,j,k,time1,time2;
	int sum=0;
	int a[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		sum=0;
		scanf("%d",&cishu);
		if(cishu==0)
			sum=60;
		if(cishu!=0)
        {
           for(j=0;j<cishu;j++)
			   scanf("%d",&a[j]);
           for(k=1;k<=cishu;k++)
		   {
              time1=a[k-1]+3*(k-1);
		      time2=a[k-1]+3*k;
		      if(time1>=60)
			      sum=60-3*(k-1);
		      if(time1<60&&time2>=60)
			      sum=a[k-1];
			  if(sum!=0)
				  break;
		   }
	        	if(sum==0)
			   sum=60-3*cishu;
		}
		printf("%d\n",sum);
    }
	return 0;
}
int main()
{
	int n, mis[100], sum[100][20], i, e, time, t;
	scanf("%d", &n);
    for(i=0;i<n;i++){
		scanf("%d", &mis[i]);
		for(e=0;e<mis[i];e++){
			scanf("%d", &sum[i][e]);
		}
	}
    for(i=0;i<n;i++){
		for(e=0;e<mis[i];e++){
            time=sum[i][e]+3*e;
			if(time<=60&&time>=57){
				t=sum[i][e];
				printf("%d\n", t);
				break;
			}
		    if(time>60){ 
			   t=60-3*e;
	           printf("%d\n", t);
			   break;
			}
		}
		if(time<57){
			t=60-3*mis[i];
			printf("%d\n", t);
		}
	}
	return 0;
}
int main(){
    int n,m[100],t[100],a;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
            t[i]=60;
            scanf("%d",&m[i]);
            for(int j=0;j<m[i];j++){
                    scanf("%d",&a);
                    if(t[i]-a-3>=0)
                    t[i]-=3;
                    if(t[i]-a>=0&&t[i]-a<3)
                    t[i]=a;
                    }
            }
    for(int i=0;i<n-1;i++){
            printf("%d\n",t[i]);
            }
    printf("%d",t[n-1]);
    return 0;
}
int main(){
	int n,m,i,j,p,t,q;
	scanf("%d",&n);
	int sz[200],sz1[10000];
	for(i=0;i<n;i++){
		scanf("%d",&m);
		if(m==0){
			sz1[i]=60;
		}else{
		    for(j=0;j<m;j++){
			    scanf("%d",&sz[j]);
			}
			p=sz[m-1]+(m-1)*3;
			t=sz[m-2]+(m-2)*3;
			q=sz[m-3]+(m-3)*3;
			if(p<=57){
				sz1[i]=60-3*m;
			}else if(p<=60&&p>57){
				sz1[i]=sz[m-1];
			}else if(p>60){
				if(t<=57){
					sz1[i]=60-3*(m-1);
				}else if(t<=60&&t>57){
					sz1[i]=sz[m-2];
				}else if(t>60){
					if(q<=57){
						sz1[i]=60-3*(m-2);
					}else if(q<=60&&q>57){
						sz1[i]=sz[m-3];
					}
				}
			}
		    '\n';
		}
	}
	for(i=0;i<n-1;i++){
		printf("%d\n",sz1[i]);
	}
	printf("%d",sz1[n-1]);
	return 0;
}
void main()
{
	int n,i,j,k,a[100],sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		sum=0;
		scanf("%d",&k);
		for(j=1;j<=k;j++)
		scanf("%d",&a[j]);
		for(j=1;j<=k;j++)
		{
			sum=a[j]+3*(j-1); 
			if(sum>=60)
			{
				printf("%d\n",60-(j-1)*3);
			    break;
			}
			else if(sum==57||sum==58||sum==59)
			{
				printf("%d\n",a[j]);
		        break;
			}
		}
		if(sum<57) printf("%d\n",60-3*k);
}}
//????

 


int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int failure,times[21],time,number;            //????????????????????
		cin>>failure;
		if(failure==0)                                     
			number=60;
		else
		{
		    for(int j=0;j<failure;j++)
				cin>>times[j];
		    for(int j=0;j<failure&&times[j]+3*j<60;j++)      //??times[j]+3*j<60??????????
		        { 
					if(times[j]+3*(j+1)<60)                  //times[j]+3*(j+1)<60,??????????????
			           number=times[j]+60-(times[j]+3*(j+1));	
					else number=times[j];
		         }
		}
		 cout<<number<<endl;
	 }

	return 0;
}
int main()
{
	int n ,i, j, p, q;
	double k[100][10];
	double t, e;
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%lf", &k[i][0]);
        for(j = 1; j <= k[i][0]; j++){
		     scanf("%lf", &k[i][j]);
        }
	}
     for(p = 0; p < n; p++){
		 for(q = 1; q <= k[p][0]; q++){
			 t = 0;
			 t += (k[p][q] + 3 * q);
			 if(t == 61 || t == 62 || t == 63){
				
				 printf("%g\n", k[p][q]);
				 break;
			 }
			 else if(t >= 64){
				 e = 63 - q * 3;
				 printf("%g\n", e);
				 break;
			 }
		 }
		 if(t <= 60){
			printf("%g\n",(60 - 3 * k[p][0]));	
		}
	 }
	return 0;
}
int main()
{
	int n,i,a[100],b[100],sum,j,m;
	scanf("%d",&n);
    for(j=0;j<n;j++)
	{
		scanf("%d",&m);
		a[0]=0;
        if(m==0)
		{
            sum=60;
		}
		else
		{
	        for(i=1;i<=m;i++)
			{
		        scanf("%d",&a[i]);
		        b[i]=3*i+a[i];
			}
			for(i=1;i<=m;i++)
			{
				if(b[m]<60)
				{
					sum=a[m]+60-b[m];
				}
				else
				{
		            if(b[i]>60)
					{
					    sum=a[i-1]+60-b[i-1];
				        if(i<=m&&60-sum>a[i]-a[i-1])
						{
							sum=a[i];
							break;
						}
				        else 
						{
					        break;
						}
					}
                    else if(b[i]==60)
					{
						sum=60;
					}

				    else
					{
					    continue;
					}
				}
			}
		}
	printf("%d\n",sum);
	}
	return 0;
}
int main(){
	int a,b,c,d[1000][60],f,g;
	scanf("%d",&a);
	for(b=0;b<a;b++){
		scanf("%d",&d[b][0]);
		for(c=0;c<d[b][0];c++){
			scanf("%d",&d[b][c+1]);
		}
	}
	for(b=0;b<a;b++){
			if(d[b][0]==0){
				printf("60\n");
			}
			else {
				f=d[b][0];
				if(f==1){
					if(d[b][f]>57){
						printf("%d\n",d[b][f]);
					}
					else{
						printf("57\n");
					}
				}
				else{
					for(c=1;c<=d[b][0];c++){
					g=d[b][c]+3*c;
					if(g>60){
						if(g>62){
							printf("%d\n",60-3*(c-1));
						}
						else{
							printf("%d\n",d[b][c]);
						}
						break;
					}
					if(c==d[b][0]&&g<=60){
						printf("%d\n",60-3*c);
					}
					}
				}
			}
	}
	return 0;
}
int a[1001];
int main()
{
	int n,i,s,m,j,p=0,s1,k;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>m;
	    if(m==0)cout<<60<<endl;
	    else
	    {
			for(j=1;j<=101;j++)a[j]=0;
			for(j=1;j<=m;j++)
			cin>>a[j];
			for(j=1;j<=m;j++)
			if(a[j]+3*(j-1)>60)break;
			j--;
			s=a[j]+3*(j-1);
			s1=s+3;
			if(s1<=60)
			p=60-s1;
			else
			p=0;
			cout<<p+a[j]<<endl;
		}
	}
	return 0;
}
int main()
{
	int t,j,ans,n,m,i;
	int stop[61] = {0};
	cin >> n;
	while (n > 0)
	{	n--;
		cin >> m;
		if (m == 0) 
			cout << 60 << endl;
		else
		{	for (i = 0; i < m; i++)
				cin >> stop[i];
			t = 1; ans = 0; j = 0;
			while (t <= 60)
			{	if (j == m) 
				{	ans = ans + 61 - t;
					break;
				}
				if (ans != stop[j])
					ans++;
				else
				{
					t += 2;
					j++;
				}
				t++;
			}
			cout << ans << endl;
		}
	}
	cin >> i;
	return 0;
}
int main()
{
	int a,b,c,d,e,f,g,h[50];
	scanf("%d",&a);
	for(b=0;b<a;b++)
	{
		scanf("%d",&c);
		if(c==0)
		{
			printf("60\n");
			continue;
		}
		else 
		{
			e=0;
			f=60;
			for(d=1;d<=c;d++)
			{
				scanf(" %d",&h[d]);
			}
			for(d=1;d<=c;d++)
			{
				e=e+h[d];
				if(e>=60) break;
				e=e+3;
				if(e>=60)
				{
					f=f-3+e-60;
					break;
				}
				f=f-3;
				e=e-h[d];
				if(d==c)
				{
					f=60-3*c;
					break;
				}
			}
			printf("%d\n",f);
		}
	}
}
int main()
{
	int n,m,i,j,k,t;
	int p[50];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&m);
		if(m==0){ 
			k=60;
		    printf("%d\n",k);
		}
	    else if(m!=0){
			for(j=0;j<m;j++){
				scanf("%d",&p[j]);
			}
			for(j=0;j<m;j++){
				t=3*j+p[j];
				if(t>=60){
					k=p[j];
			        printf("%d\n",p[j]);
		 	        break;
				}
				else if(t<60 ){
					if(j==(m-1)){
						k=60-3*m;
						printf("%d\n",k);
					}
					else if(j!=(m-1)){
						if(p[j+1]+3*(j+2)>60){
							if((60-3*(j+1))>=p[j+1]){
						       k=p[j+1];	
			                   printf("%d\n",k);
							 break;  
							}
			                else if((60-3*(j+1))<p[j+1]){
				               k=60-3*(j+1);
                               printf("%d\n",k);
							   break;
							}
						}
					}
				}
			}
		}
	}
	return 0;
}
//#include <fstream>

int n;
int a[61],b,q[61];
int main()
{
   // ifstream cin("in.txt");
    int i,j,k,t,sum,c;
    cin>>n;
    for(i=0;i<n;++i)
    {
                    t=60;
                    k=0;
                    c=0;
                    sum=0;
                    memset(a,0,sizeof(a));
                    cin>>b;
                    for(j=0;j<b;++j) {cin>>a[j]; q[j]=a[j];}
                    if(b==0) cout<<60<<endl;
                    else
                    {
                        if(a[0]>=60)
                        {
                                    cout<<60<<endl;
                                    continue;
                        }
                        for(j=0;j<b;++j)
                        {
                                        a[j]+=j*3;
                                        //cout<<a[j]<<endl;
                        }
                        for(j=0;j<b;++j)
                        {
                                        if(a[j]>=60)
                                        {
                                                   sum=a[j-1]-((j-1)*3);
                                                   t-=a[j-1];
                                                   c=1;
                                                   break;
                                        }
                        }
                        if(c)
                        {
                             if(t>3) sum+=t-3;
                        }
                        else
                        {
                            sum=q[b-1];
                            t-=a[b-1];
                            if(t>3) sum+=t-3;
                        }
                        cout<<sum<<endl;
                    }
                        /*
                        while(t>a[k])
                        {
                                     if(k==b) break;
                                     t-=a[k];
                                     k++;
                                     sum+=a[k-1];
                                     cout<<sum<<endl;
                                     t-=3;
                                     cout<<t<<endl;
                        }
                        if(k==b) sum+=t;
                        else
                        {
                            t-=3;
                            cout<<sum<<endl;
                            if(t>0) sum+=t;
                        }
                        cout<<sum<<endl;
                        */
    }
 //   cin>>b;
    return 0;
}
int main()
{
	int n;
	cin>>n;
	for(int s=1;s<=n;s++)
	{
		int m=0;
		cin>>m;
		int a[100]={0};
		int sum=60;
		int totaltime=0;
		for(int i=1;i<=m;i++)
		{
			cin>>a[i];
		if(totaltime+a[i]-a[i-1]<60&&a[i]<60)
		{
			totaltime+=a[i]-a[i-1]+3;
			sum-=3;
			if(totaltime==61)
				sum+=1;
			if(totaltime==62)
				sum+=2;
		}
		}
		cout<<sum<<endl;
	}
return 0;
}
int main()
{
int n,a,i,j,k,tiaohuai,b[20],count=0;
 scanf("%d",&n);
 for(a=0;a<n;a++)
 {
	 scanf("%d",&tiaohuai);
	 if(tiaohuai==0)
	 { printf("60\n");
	     continue;
	 }
	 for(i=0,k=0;i<tiaohuai;i++,k++)
	 {
		 scanf("%d",&b[i]);
	 }
for(i=0,k=0;i<tiaohuai;i++,k++)
{
		 count=b[i]+3*i;
	     if(count>60)
		 {
			 j=60-3*i;
			 printf("%d\n",j);
			 break;
		 }
		 count=count+3;
		 if(count>60)
		 {
			 printf("%d\n",b[i]);
			 break;
		 }
	 }
		 if(count<60)
		 {
			 printf("%d\n",60-tiaohuai*3);
		 }
     
 }
 return 0;      
}
int main()
{
	int n, i, j;
	int A[100], B[100], C[100]; 
	scanf("%d", &n);
	for(i=0;i<n;i++)
	{
		scanf("%d", &A[i]);
		for(j=0;j<A[i];j++)
		{
			scanf("%d", &B[j]);
		}
	    for(j=0;j<A[i];j++)
		{
		    if(B[j]+3*(j+1)>63)
			{
				break;
			}
			
            else
				C[i]=60-3*A[i];
		}
           if(B[j-1]+3*j>=60)
			   C[i]=B[j-1];
		   else
			   C[i]=60-3*j;
	}
	for(i=0;i<n;i++)
	{
		printf("%d\n", C[i]);
	}
	return 0;
}
//????
//1000062701
//???

int main()
{
	int n;
	cin >> n;
	int a[20] = {0};               //????
	int m, i, j, k;
	int sum = 0;
	for( i = 0; i < n; i++ )
	{
		cin >> m;
		if( m == 0 )               //?????60
			cout << 60 << endl;
		else
		{
		   for( j = 0; j < m; j++ )
		    {
			   cin >> a[j];
	      	}  
		  for( k = m - 1; k >= 0; k-- )
		  {
			  if( ( a[k] + 3 * k ) <= 60 )
			  {
				  if( ( a[k] + 3 * ( k + 1 ) ) > 60 )
				  {
					  sum = a[k];
					  break;                            //??????????
				  }
				  else
				  {
				     sum = 60 - 3 * ( k + 1 );
			         break;
				  }
			  }
		  }

		cout << sum << endl;
		}
	}
	return 0;
}
int main() 
{ 
int n,i,k,m,a[100],temp=0;
int flag=0; 
scanf("%d",&n); 
for(i=0;i<n;i++) 
{ flag=0;
scanf("%d",&m); 
if(m==0) temp=60; 
for(k=1;k<=m;k++) 
{ 
scanf("%d",&a[k]); 

if(flag==0 && a[k]+3*k>=63) 
{ 
temp=60-3*(k-1); 

flag=1;
} 


if(flag==0 && (60<a[k]+3*k) && (a[k]+3*k<63)) 
{ 
temp = a[k]; 

flag=1 ;
} 

if(flag==0 && a[k]+3*k<=60) 
{ 
temp=60-3*m; 

} 
} 

printf("%d\n",temp); 
} 
return 0; 
}
int main()
{
	int sz[1000];
	int t,i,n,m,a;
	scanf("%d",&n);
	for(a=1;a<=n;a++){
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("%d",&sz[i]);
		}
		if(m==0) t=60;
		else{
		for(i=0;i<m;i++){
			if(sz[i]+3*i>60){
				t=60-3*i;
				break;
			}
			if((sz[i]+3*i<=60)&&(sz[i]+3*i>=57)){
				t=sz[i];
				break;
			}
			if((sz[i]+3*i<60)&&(i==m-1)){
				t=60-3*(i+1);
			    break;
			}
		}
		}
		printf("%d\n",t);
	}
	return 0;
}
int main()
{
	int n,m,t=0,num,i,j,k=0,p=1,q=1;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&m);
		p=1;
		k=0;
		for(j=0;j<m;j++)
		{
			scanf("%d",&num);
			k++;
			t=num+3*k;
			if(t>=60&&t-3<=60&&p==1){printf("%d\n",num);p=0;}
			if(t-3>=60&&p==1){printf("%d\n",60-(k-1)*3);p=0;}
		}
		if(t-3<=60&&p==1){printf("%d\n",60-3*k);p=0;}
	}
	return 0;
}
void pro()
{
	int i,a[21]={0},n;
	scanf("%d",&n);
	for(i=1;i<n+1;i++)
		scanf("%d",&a[i]);
	if(a[n]+3*n<60)
		printf("%d\n",60-3*n);
	else if(a[n]+3*n<64)
		printf("%d\n",a[n]);
	else
		for(i=1;i<n+1;i++)
			if(a[i]+3*i>64)
			{
				printf("%d\n",63-3*i);
				break;
			}
			else if(a[i]+3*i>59)
			{
				printf("%d\n",a[i]);
				break;
			}

}
void main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		pro();
}
int main() {
	int n;
	cin >> n;
	while(n --) {
		int m, input[100];
		int total = 0, sum = 60;
		cin >> m;
		input[0] = 0;
		for(int i = 1; i <= m; i ++) {
			cin >> input[i];
			if(total + input[i] - input[i - 1] < 60 && input[i] < 60) {
				total += input[i] - input[i - 1] + 3;
				sum -= 3;
				if(total == 61)
					sum += 1;
				if(total == 62)
					sum += 2;
			}
		}
		cout << sum << endl;
	}
	return 0;
}
int main()
{
    int n,i,t,m,g,hh;
    int a[60];
    scanf("%d",&n);
    for(i=0;i<n;i++){
    	scanf("%d",&m);
    	for(t=0;t<m;t++){
    		scanf("%d",&a[t]);
    	}
    	if(m==0) printf("60\n");
    	else if(m==1){
    		if(a[0]>=60) g=60;
    		else if(a[0]<=57) g=57;
    		else g=a[0];
    		printf("%d\n",g);
    		}
    	else{
    	for(t=0;t<m;t++){
    		if(a[t]+3*t<=60)
    		hh=t;
    	}
    	if(a[hh]+3*hh<=57) g=57-3*hh;
    	else g=a[hh];
    	printf("%d\n",g);
    	}
    }
    return 0;
    }
int main()
{
	int n,i,m[20],j,x[20][20];
	int sum[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d\n",&m[i]);
		if(m[i]>0)
		{
			for(j=0;j<m[i];j++)
			{
				scanf("%d",&x[i][j]);
			}
		}
	}
	for(i=0;i<n;i++)
	{
		if(m[i]==0){sum[i]=60;}
		else{
			if(x[i][m[i]-1]+3*m[i]<60){sum[i]=60-3*m[i];}
			else{
				for(j=0;j<m[i];j++)
				{
					if(x[i][j]+3*j>60){sum[i]=60-3*j;
					break;}
					if(x[i][j]+3*j<=60&&x[i][j]+3*j+3>=60)
					{sum[i]=x[i][j];
					break;}
				}
			}
		}
		printf("%d\n",sum[i]);
	}
	return 0;
}
int main()
{
	int i,j,n,m,a[60],s;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&m);
		for(j=0;j<m;j++)
		{
			scanf("%d",&a[j]);
		}
		s=a[j-1];
		for(j=m-1;j>=0;j--)
		{
			if(s+3*(j+1)>63)
			{
				s=a[j-1];
			}
			else
			{
				break;
			}
		}
		if(s+3*(j+1)>=60)
		{
			printf("%d\n",s);
		}
		else
		{
			printf("%d\n",60-3*(j+1));
		}
	}
	return 0;
}
/*
 * 1049.cpp
 *
 *  Created on: 2011-12-21
 *      Author: wuch
 */

int main(){
	int n,i,j,num,a[21],ans;
	cin>>n;
	for (i=0;i<n;i++){
		cin>>num;
		if (num==0) cout<<60<<endl; //????60?
		else{
			for (j=1;j<=num;j++) cin>>a[j];
			for (j=1;j<=num;j++) a[j]=a[j]+(j-1)*3; //?a????????????????
			ans=60;
			for (j=1;j<=num;j++)
				if (a[j]<=57) ans=ans-3;  //????57??????3?
				else if (a[j]<60) ans=ans-(60-a[j]); //58,59?????????????
			cout<<ans<<endl;
		}
	}
	return 0;
}
//============================================================================
// Name        : ex5.13.cpp
// Author      : Zhang Yu
// Version     :
// Copyright   : Your copyright notice
// Description : ????
//============================================================================


int main() {
	int n;
	cin >>n;
	for (int j=1;j<=n;++j)
	{
		int breaktime;//???????
		cin >>breaktime;
		if (breaktime==0)//???????
			cout <<"60"<<endl;
		else//?????
		{
			int a[breaktime];
			for (int i=0;i<=breaktime-1;++i)
				cin >>a[i];//????????????
			int sum=0;//?????????
			int k=0;//?????????
			for (int i=1;i<=60;++i)//??????
			{
				if (a[k]==i)//??????????
				{
					++sum;
					++k;
					i=i+3;
					for (int p=k;p<=breaktime-1;++p)
						a[p]+=3;
				}
				else//????????
					++sum;
			}
			cout <<sum<<endl;
		}

	}

	return 0;
}
int main()
{
	int n,i,j,m,z,y=0;
	int x[100];
	int *pint;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&m);
		if(m==0)
		{
			x[i]=60;
			y=1;
			continue;
		}
		pint=(int*)malloc(sizeof(int)*m);
		for(j=0;j<m;j++)
		scanf("%d",&pint[j]);
		for(j=0;j<m;j++)
		{
		z=pint[j]+(j+1)*3;
		if(z<=60)x[i]=pint[j]+60-z;
			else 
			{
				if(z>60 && z<63)
				x[i]=pint[j];
				else break;
			}
		}
	}
		for(i=0;i<n;i++)
		printf("%d\n",x[i]);
		if(!(n==1 && y==1))
	      free(pint);
         return 0;
}
/**
* @file 1000012800_1.cpp
* @author ??
* @date 2010-11-24
* @description
* ??????:??
*/

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i ++)
	{
		int time = 0, count = 0, counter[21], num,flag = 1;
		cin >> num;
		for (int j = 0; j < num; j ++)
			cin >> counter[j];
		for (int j = 0; j < num; j ++)
		{
			time = counter[j] + 3 * (j + 1); 
			if (time - 3 >= 60)
			{
				count = counter[j] - (time -63);
				flag = 0;
				break;
			}
			else if(time >= 60)
			{
				count = counter[j];
				flag = 0;
				break;
			}
			else
				count = counter[j];
		}
		if(flag)
			count += 60 - time;
		cout << count << endl;
	}





	return 0;
}
int main()
{
	int n,sum,t;
	int m[20];
	int a[20][20];
	int i,j,k;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&m[i]);
		for(j=0;j<m[i];j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	for(i=0;i<n;i++)
	{
		sum=0;
		t=0;
		for(j=0;j<m[i];j++)
		{
			if(j==0)
			{
				if(t+a[i][j]-sum<=60)
				{
					t=t+a[i][j]-sum;
					sum=a[i][j];
				}
				else if(t+a[i][j]-sum>60)
				{
					sum=60;
					t=60;
					break;
				}
			}
			else
			{
				if(t+3+a[i][j]-sum<=60)
				{
					t=t+3+a[i][j]-sum;
					sum=a[i][j];
				}
				else if(t+3<=60&&t+3+a[i][j]-sum>60)
				{
					sum=sum+60-(t+3);
					t=60;
					break;
				}
				else if(t+3>60)
				{
					t=60;
					break;
				}
			}
		}
		if(j==0)
		{
			sum=60;
		}
		else if(t+3<60)
		{
			sum=sum+60-(t+3);
		}
		printf("%d\n",sum);
	}
	return 0;
}
int main()
{
	int n,i,j;
	scanf("%d",&n);
	int time[50],a[50][100];
	for(i=0;i<n;i++)
	{
		
		scanf("%d",&time[i]);
		for(j=0;j<time[i];j++)
			scanf("%d",&a[i][j]);

	}
	for(i=0;i<n;i++)
	{
		if(time[i]==0)
			printf("60");
		else if(a[i][time[i]-1]<=60-3*time[i])
			printf("%d",60-3*time[i]);
		else 
			for(j=0;j<time[i];j++)
			{
				if(a[i][j]<60-(j+1)*3&&a[i][j+1]>60-(j+2)*3)
				{
					if(60-(j+1)*3>=a[i][j+1])
						printf("%d",a[i][j+1]);
					else
						printf("%d",60-(j+1)*3);
				}
			}
			printf("\n");
	}
	return 0;
}
int main() {
	int n, i, j;
	cin >> n;

	for (i = 0; i < n; i++) {
		int tiaoHuai;
		cin >> tiaoHuai;

		if (tiaoHuai == 0) {
			cout << 60 << endl;
			continue;
		}

		int leiJi[tiaoHuai];
		for (j = 0; j < tiaoHuai; j++) {
			cin >> leiJi[j];
		}

		for (j = 0; j < tiaoHuai; j++) {
			if (leiJi[j] + 3 * (j + 1) > 60) {
				if (leiJi[j] + 3 * j <= 60) {
					cout << leiJi[j] << endl;
					break;
				} else {
					cout << 60 - 3 * j << endl;
					break;
				}
			}
		}

		if (j == tiaoHuai) {
			cout << 60 - 3 * tiaoHuai << endl;
		}
	}
	return 0;
}
int main()
{
    int m,n,i,j,t,sum,cas;
    int times[10];
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&m);
        cas=0;
        for(j=0;j<m;j++){
             scanf("%d",&times[j]);                 
        }
        for(j=0;j<m;j++){
             sum=times[j]+3*j;
             if(sum>60){
                  t=60-3*j;
                  cas=1;
                  break;           
             }
             else{
                  if(sum+3>60){
                         t=times[j];
                         cas=2;
                         break;             
                  }     
             }                 
        }
        if(cas==0)
        t=60-3*m;
        printf("%d\n",t);                     
    }
    return 0;
}
int main()
{
	int n,time,times,a[20];
	int sum,i,x,lost;
	cin>>n;
	for (int k=0;k<n;k++)
	{
		time=0;
		sum=0;
		x=0;
		lost=0;
		i=0;
	    cin>>times;
		if (times==0) cout<<60<<endl;
		else
		{
			for (i=0;i<times;i++)
				{
				cin>>a[i];
				lost=lost+3;
			    time=lost+a[i];
				if (time>=60)
				  {
					if(time>=63) cout<<a[i]+60-time+3<<endl;
					else cout<<a[i]<<endl;
					x=1;
					if (i<times-1)
						for (int j=i+1;j<times;j++)
							cin>>a[j];
				    break;
				  }
			    }
			if (x==0)
				cout<<a[times-1]+60-time<<endl;
		}
	}
	return 0;
}
//****************************************************** 
/* ? ? ?   ?????
/* ? ?      ????                           
/* ? ? ? ??2010 ? 11  ?  29  ?     
/* ? ? ? ??????????????????????
/* ? ?      ?1000012752        
*******************************************************/ 
int main()                                  
{
    int n,i,j;
	int t;
	int a[60] = {0};												//?????????????
	cin >> n;
	for(i=1 ; i<=n ; i++)
	{
		cin >> t;
		for(j=0 ; j<t ; j++)
			cin >> a[j];

		if(a[t-1] + 3*t <= 60)										//?????????????????
             cout << 60 - 3*t << endl;								//????????????-????
 
		else
		{
			for(j=0 ; j<t ; j++)									//????????????????????????
			{
				if(a[j] + 3*(j+1) >= 60 && a[j] + 3*(j+1) <= 63)	//???????????
				{
					cout << a[j] << endl;							//??????????????
					break;
				}
				if(a[j] + 3*(j+1) > 63)								//??????????
				{
					cout << 60 - 3*j << endl;						//??????-?????????????j
					break;
				}
			}
		}
	}
                  
    return 0;
}
int main()
{
    int n,m,i,j,k,sum,time;//counter
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        j=m;
        k=0;
        while(j>0)
        {
            cin>>k;
            j--;
            if((k+(m-j)*3)>60)
            break;
        }
        if((k+(m-j)*3)<=60)
        cout<<60-(m-j)*3<<endl;
        else
        {
            if(k+m*3-j*3-60>3)
            cout<<60-(m-j)*3+3<<endl;
            else
            cout<<k<<endl;
        }
        for(;j>0;j--)
        cin>>k;
    }    return 0;
}
int main()
{
	int n, m, i, j, k, b, c;
	int a[60] = {0};
	cin >> n;
	for(i = 1; i <= n; i ++)
	{
		cin >> m;
		b = 60 - 3 * m;
		for( j = 1; j <= m; j ++)
		{
			cin >> a[j];
		}
		if(a[m] <= b)
			cout << b << endl;
		else
		{
			for(k = 1; k <= m; k ++)
			{
				c = 60 - 3 * k;
				if(a[k] <= c && a[k + 1] >= c)
				{
					cout << c << endl;
				}
				else if(a[k] <= c && a[k + 1] <= c && a[k + 1] >= c - 3)
				{
					cout << a[k + 1] << endl;
					break;
				}
			}
		}
	}
	return 0;
}
int main (){
int n,m,i,j,k,s;
scanf("%d",&n);
int a[1000];
s=0;
for(k=0;k<n;k++)
{
for(i=0;i<1000;i++)
 {
 a[i]=1;
 }
 scanf("%d",&m);
 for(i=0;i<m;i++)
 {
 scanf("%d",&j);
 a[j+3*i]=0;
 a[j+1+3*i]=0;
 a[j+2+3*i]=0;
 }

for(i=0;i<60;i++)
{
s+=a[i];
}printf("%d\n",s);
s=0;
}return 0;
}