semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int n,a[1001],b[1001];
void sifta(int i,int num)
{
	int j=i*2,tmp=a[i];
	while(j<=num)
	{
		if(j<num && a[j]<a[j+1])	j++;
		if(tmp<a[j]){a[i]=a[j];i=j;j=j*2;}
		else break;
	}
	a[i]=tmp;
}
void siftb(int i,int num)
{
	int j=i*2,tmp=b[i];
	while(j<=num)
	{
		if(j<num && b[j]<b[j+1])	j++;
		if(tmp<b[j]){b[i]=b[j];i=j;j=j*2;}
		else break;
	}
	b[i]=tmp;
}
void hsa()
{
	int i,tmp;
	for(i=n/2;i>0;i--)sifta(i,n);
	for(i=n;i>0;i--){
		tmp=a[i];a[i]=a[1];a[1]=tmp;
		sifta(1,i-1);
	}
	//for(i=1;i<=n;i++)	printf("%d ",a[i]);
}
void hsb()
{
	int i,tmp;
	for(i=n/2;i>0;i--)siftb(i,n);
	for(i=n;i>0;i--){
		tmp=b[i];b[i]=b[1];b[1]=tmp;
		siftb(1,i-1);
	}
	//for(i=1;i<=n;i++)	printf("%d ",b[i]);
}
int main()
{
	int i;
	while(1)
	{
		scanf("%d",&n);
		if(n==0)break;
		for(i=1;i<=n;i++)scanf("%d",&b[i]);	//tianji
		for(i=1;i<=n;i++)scanf("%d",&a[i]);	//qiwang
		hsa();
		hsb();//find the minest one >= it 
		
		int tot=0,j=0,t=0,visited[1001]={0};
		
		int ha=1,ta=n,hb=1,tb=n;
		while(ha<=ta)
		{
			if(a[ha]<b[hb]){
				tot+=200;ha++;hb++;
			}
			else if(a[ta]<b[tb]){
				tot+=200;ta--;tb--;
			}
			else{
				if(a[ta]>b[hb])
					tot-=200;	//lose
				//draw
				ta--;hb++;				
			}
		}
		/*
		for(i=1;i<=n;i++){
			//j++;if(j>n){t--;break;}
			t=i;
			while(b[j]<a[i] && j<n)j++;			
			if(b[j]>a[i])	
			{
				tot+=200;visited[j]=1;j++;
				printf("%d wins %d\n",b[j],a[i]);
			}
			else if(b[j]<a[i]) {tot-=200;visited[j]=1;break;}
			else {visited[j]=1;break;}
		}
		j=1;
		for(i=t+1;i<=n;i++){
			while(j<=n && (visited[j] || a[i]>b[j]))j++;
			if(a[i]!=b[j]){tot-=200;break;}
			else {visited[j]=1;j++;t++;if(j>n)break;}
		}
		*/
		printf("%d\n",tot);
	}
	//getchar();getchar();
	return 0;
}
void paixu(int a[],int n)
{
     int i,j,b;
     for(i=0;i<n-1;i++)
     {
          for(j=0;j<n-i-1;j++)
          {
              if (a[j]>a[j+1])
              {
                  b=a[j];
                  a[j]=a[j+1];
                  a[j+1]=b;            
              }
          }
     }
}
main()
{
   
    for(;;)
    {
     int n;
    scanf("%d",&n);       
    if (n==0) break;
      int *tian=(int *)malloc(n*sizeof(int));
      int *qi=(int *)malloc(n*sizeof(int));
      for(int i=0;i<n;i++)
      {
              scanf("%d",tian+i);
      }
      for(int i=0;i<n;i++)
      {
              scanf("%d",qi+i);
      }
      paixu(tian,n);
      paixu(qi,n);
     
     
      int t=0,q=0,qmax=n-1,tmax=n-1,win=0;
      for(;n>=1;n--)
      {
              if(*(tian+t)>*(qi+q))
              {
                   win++;
                   t++;
                   q++;
              }
              else if(*(tian+t)==*(qi+q))
              {
                   if(*(tian+tmax)>*(qi+qmax))
                   {
                       win++;
                       tmax--;
                       qmax--;
                   }
                   else if(*(tian+tmax)<=*(qi+qmax))
                   {
                       if(*(tian+t)<*(qi+qmax)) win--;
                       qmax--;
                       t++;
                   }
                  
                   
              }
              else if(*(tian+t)<*(qi+q))
              {
                  win--;
                  t++;
                  qmax--;
              }
      } 
      printf("%d\n",win*200); 
    }  
    
}
int Comp(const void *p1, const void *p2)
{
	return *((int *)p1) > *((int *)p2) ? -1:1;
}


int main()
{
	int tian[2000],qi[2000];
	int n;
	int count;
	int a_first,a_end,b_first,b_end;
	while(cin>>n)
	{
		if(n == 0) break;
		for(int i = 0 ; i < n; i++)
		{
			cin>>tian[i];
		}
		for(int i = 0; i < n; i++)
		{
			cin>>qi[i];
		}
	
		qsort(tian,n,sizeof(int),Comp);
		qsort(qi,n,sizeof(int),Comp);
		count = 0;
		a_first = 0;
		a_end = n - 1;
		b_first = 0;
		b_end = n - 1;
		while(a_first <= a_end)
		{
			//cout<<a_first<<" "<<a_end<<" "<<b_first<<" "<<b_end<<endl;
			//cout<<tian[a_first]<<" "<<qi[b_first]<<endl;
			if(tian[a_first] > qi[b_first])
			{
				count++;
				a_first++;
				b_first++;
			}
			else if(tian[a_end] > qi[b_end])
			{
				count++;
				a_end--;
				b_end--;
			}
			else if(tian[a_first] == qi[b_first])
			{
				if(tian[a_end] > qi[b_first])
				{
					count++;
					a_end--;
					b_first++;
				}
				else if(tian[a_end] == qi[b_first])
				{
					a_end--;
					b_first++;
				}
				else if(tian[a_end] < qi[b_first])
				{
					count--;
					a_end--;
					b_first++;
				}
			}
			else
			{
				if(tian[a_end] > qi[b_first])
				{
					count++;
					a_end--;
					b_first++;
				}
				else if(tian[a_end] == qi[b_first])
				{
					a_end--;
					b_first++;
				}
				else if(tian[a_end] < qi[b_first])
				{
					count--;
					a_end--;
					b_first++;
				}
			}
		}
		cout<<count*200<<endl;
	}
	return 0;
}
main()
{
      int i,j,t,n,m,sum,head,taila,tailb,max=1000;
      int a[max],b[max];
      scanf("%d",&n);
      while(n!=0)
      {
          for (i=0;i<=n-1;i++)
          {
              scanf("%d",&a[i]);
          }
          for (i=0;i<=n-1;i++)
          {
              scanf("%d",&b[i]);
          }
          for (j=0;j<n-1;j++)
          {
              for (i=0;i<n-1-j;i++)
              {
                  if (a[i]<a[i+1])
                  {
                      t=a[i];
                      a[i]=a[i+1];
                      a[i+1]=t;
                  }
              }
          }
          for (j=0;j<n-1;j++)
          {
              for (i=0;i<n-1-j;i++)
              {
                  if (b[i]<b[i+1])
                  {
                      t=b[i];
                      b[i]=b[i+1];
                      b[i+1]=t;
                  }
              }
          }
          sum=0;
          head=0;
          taila=n-1;
          tailb=n-1;
          for(i=0;i<n;i++)
          {
              if(a[head]>b[i])
              {
                  head++;
                  sum+=200;
              }
              else if(a[head]<b[i])
              {
                  taila--;
                  sum-=200;
              }
              else if(a[head]==b[i])
              {
                  for(j=taila,m=tailb;j>=head;j--,m--)
                  {
                      if(a[j]>b[m])
                      {
                          sum+=200;
                          taila--;
                          tailb--;
                      }
                      else
                      {
                          if(a[j]<b[i]) sum-=200;
                          taila=--j;
                          tailb=m;
                          break;               
                      }
                  }
              }
              if(head>taila) break;
          }
          printf("%d\n",sum);
          scanf("%d",&n);
      }
      getchar();
      getchar();
}
int x(int n,int a[ ],int b[ ])
{
  int num=0,num1=0,i=n-1,j=n-1;
  int m=0,k=0,z,shen=n;
  while(shen>1)
  {
                  if(a[i]>b[j])
                  {
                               num++;
                               i--;
                               j--;
                               shen--;
                               continue;
                  }
                  if(a[m]>b[k])
                  {
                               num++;
                               m++;
                               k++;
                               shen--;
                  }
                  else
                  {
                                if(a[m]<b[j])
                                num1++;
                                
                                m++;
                                j--;
                                shen--;
                  }
                  
  }
  if(a[m]>b[k])  num++;
  if(a[m]<b[k])  num1++;
  z=num-num1;
  return z;
}

  

int main()
{
    int m=0,i,win,n,d;
    int l,j,t;
    int a[1000], b[1000];
    while(m==0)
    {
               scanf("%d",&n);
               if(n==0) break;
               else
               {
                   for(i=0;i<n;i++)
                   scanf("%d",&a[i]);
                   for(i=0;i<n;i++)
                   scanf("%d",&b[i]);
                   
                   
               }
               
               for(j=0;j<n-1;j++)
               { 
                 for(l=0;l<n-j-1;l++)
                     if(a[l]>a[l+1])
                     {
                                    t=a[l];
                                    a[l]=a[l+1];
                                    a[l+1]=t;
                     }
                 }
               for(j=0;j<n-1;j++)
               {
                 for(l=0;l<n-j-1;l++)
                     if(b[l]>b[l+1])
                     {
                                    t=b[l];
                                    b[l]=b[l+1];
                                    b[l+1]=t;
                     }
               }
               
               d = x(n,a,b);
               win=d*200;
               printf("%d\n",win);
    }
}
int main()
{
    int a[1000],b[1000];
    int i,j,k,n,m,t;
    for(i=0;i<100;i++)
     {
          scanf("%d\n",&n);
          if(n==0)
           break;
          else
          {
              for(j=0;j<n;j++)
              scanf("%d",&a[j]);
              for(j=0;j<n;j++)
              scanf("%d",&b[j]);
              for(j=0;j<n;j++)     
               for(k=0;k<n-j-1;k++)
                 if(a[k]<a[k+1])
                 {
                     t=a[k];
                     a[k]=a[k+1];
                     a[k+1]=t;
                     }
               for(j=0;j<n;j++)     
               for(k=0;k<n-j-1;k++)
                 if(b[k]<b[k+1])
                 {
                     t=b[k];
                     b[k]=b[k+1];
                     b[k+1]=t;
                     }
                     
              m=0;
              for(j=n-1;j>=0;j--)
              {
                  if(a[j]>b[j])
                    m++;
                  else               
                    {
                    if(a[0]>b[0])
                     {
                        m++;
                       for(k=0;k<j;k++)
                        {
                         a[k]=a[k+1];
                        b[k]=b[k+1];
                       }
                     }
                      else
                     if(a[j]<=b[j])
                        {
                         if(a[j]!=b[0])          
                        {
                         m--;
                         for(k=0;k<j;k++)
                         b[k]=b[k+1];
                         }
                         
                    }
                     }
              }
              printf("%d\n",m*200);   
                     }
                     }
                    getchar();
                    getchar();
                    }
// #include <conio.h>
int tian[1004];
int qi[1004];
int cmp(const void *c1,const void *c2)
{
	return *(int *)c2-*(int *)c1;
}
int main()
{
	int n;	
	while(true)
	{
		scanf("%d",&n);
		if(n<=0)
			break;
		for(int i = 0;i<n;i++)
			scanf("%d",&tian[i]);
		for(int i = 0;i<n;i++)
			scanf("%d",&qi[i]);
		qsort(tian,n,sizeof(int),cmp);
		qsort(qi,n,sizeof(int),cmp);
		int ts = 0,te = n-1,qs = 0,qe = n-1;
		int nMoney = 0;
		while(ts<=te)
		{
			if(tian[ts]>qi[qs])
			{
				ts++;
				qs++;
				nMoney+=200;
			}
			else if(tian[ts]<qi[qs])
			{				
				nMoney-=200;				
				qs++;
				te--;				
			}
			else
			{
				if(tian[te]>qi[qe])
				{
					nMoney+=200;
					te--;
					qe--;
				}
				else if(tian[te]<qi[qe])
				{
					nMoney-=200;
					te--;
					qs++;
				}
				else
				{
					if(tian[te]>qi[qs])
					{
						nMoney+=200;
						te--;
						qs++;
					}
					else
					{
						if(tian[te]<qi[qs])
							nMoney-=200;
						te--;
						qs++;
					}
				}
			}
		}
		printf("%d\n",nMoney);
	}
// 	getch();
	return 0;
}
int duma(int n,int a1[1000],int a2[1000]);
int main()
{
    int n=1,a1[1000],a2[1000];
    for(;n!=0;) 
    {
        scanf("%d",&n);
        if(n!=0)
		{
                for(int i=0;i<n;i++)
				{scanf("%d",&a1[i]);}
                for(int i=0;i<n;i++) 
				{scanf("%d",&a2[i]);}

                for(int i=0;i<n;i++)                       //??????
                {
                         for(int j=0;j<n-i-1;j++)
                         {
                             if(a1[j]<a1[j+1])
                             {
                                     int temp;
                                         temp=a1[j];
                                      a1[j]=a1[j+1];
                                     a1[j+1]=temp;
                             }
                         }
                 }
                for(int i=0;i<n;i++)                         //??????
                {
                         for(int j=0;j<n-i-1;j++)
                         {
                             if(a2[j]<a2[j+1])
                             {
                                     int temp;
                                         temp=a2[j];
                                      a2[j]=a2[j+1];
                                     a2[j+1]=temp;
                             }
                         }
                 }
				//if(k==1)
               // printf("%d",duma(n,a1,a2));
			//	else
                printf("%d\n",duma(n,a1,a2));
        } 
    }
    return 0; 
} 

int duma(int n,int a1[1000],int a2[1000])
{
    int a=0,i=0; 
    for(i=n;i!=1;i--) 
    {
           if(a1[0]>a2[0])               //?????????????????
           {
               a+=200;
               for(int k=0;k<i-1;k++) 
               {
                       a1[k]=a1[k+1];
                       a2[k]=a2[k+1];
               }
           }
           else
           { 
              if (a1[0]<a2[0])              //?????????????????
              {
                     a-=200;
                 for(int k=0;k<i-1;k++) 
                 {
                       a2[k]=a2[k+1];
                 } 
              } 
              else
              {
                  if(a1[i-1]>a2[i-1])           //?????????????????
                  {
                         a+=200;
                  }
                  else                            //?????????????????
                  {
					  if(a1[i-1]<a2[0])
                         a-=200;
					  else
						  a=a;
                         for(int k=0;k<i-1;k++)     
                         {
                              a2[k]=a2[k+1];
                         }

                  } 
               }
              } 
          
    }
    if (a1[0]<a2[0])                 //????????
    {
        a-=200; 
    }
    else 
    {
         if (a1[0]>a2[0])
         {
               a+=200; 
         }
         else
         a=a; 
    }
    return a;
}
void sort(int a[],int n); //sort from quick to slow

int main(){
	int i,j,n;
	int tquick,tslow,qquick,qslow;
	int tj[1000],qw[1000];
	int win,lose;
	
	while(1){
		scanf("%d",&n);
		if(n==0)
			break;
		for(i=0;i<n;i++)
			scanf("%d",&tj[i]);
		for(i=0;i<n;i++)
			scanf("%d",&qw[i]);
		win=0;
		tquick=qquick=0;
		tslow=qslow=n-1;
		sort(tj,n);
		sort(qw,n);
		while(n--){
			if(tj[tslow]>qw[qslow])
			{
				tslow--;
				qslow--;
				win++;
			}
			else if(tj[tslow]<qw[qslow])
			{
				qquick++;
				tslow--;
				win--;
			}
			else if(tj[tquick]>qw[qquick])
			{
				qquick++;
				tquick++;
				win++;
			}
			else if(tj[tquick]<qw[qquick])
			{
				tslow--;
				qquick++;
				win--;
			}
			else if(tj[tquick]==qw[qquick])
			{
				if(tj[tslow]<qw[qquick])
				{
					win--;
				}
				tslow--;
				qquick++;
			}
		}
		printf("%d\n",200*win);
	}
	return 0;
}

void sort(int a[],int n){
	int i,j;
	int tmp,max;
	
	for(i=0;i<n-1;i++){
		max=i;
		for(j=i+1;j<n;j++){
			if(a[j]>a[max])
				max=j;
		}
		tmp=a[i];
		a[i]=a[max];
		a[max]=tmp;
	}
}
int tj[M], qw[M];
int n;

int cmp(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main()
{
    int i, b,e, bb, ee, sum;
    while (scanf("%d", &n)!=EOF && n!=0) {
	for (i=0; i<n; i++)
	    scanf("%d", &tj[i]);
	for (i=0; i<n; i++)
	    scanf("%d", &qw[i]);
	qsort(tj, n, sizeof(int), cmp);
	qsort(qw, n, sizeof(int), cmp);
	b=bb=0; e=ee=n-1;
	sum = 0;
	while (b <= e) {
	    if (tj[e] > qw[ee])
		++sum, --e, --ee;
	    else if (tj[e] < qw[ee])
		--sum, ++b, --ee;
	    else if (tj[b] > qw[bb])
		++sum, ++b, ++bb;
	    else if (tj[b] < qw[bb])
		--sum, ++b, --ee;
	    else {
		if (tj[b] < qw[ee])
		    --sum, ++b, --ee;
		else ++b, --ee;
	    }
	}
	printf("%d\n", sum*200);
    }
    return 0;
}
main ()
{
     int a,b,c,d,e,m,n,i,j,k,l;
     for (k=0;k<100;k++)
     {
     scanf("%d",&n);
     if (n!=0)
     {
     int f[1000];
     int g[1000];
     for (i=0;i<1000;i++)
     {
         f[i]=0;
         g[i]=0;
     }
     for (i=0;i<n;i++)
     {
         scanf("%d",&f[i]);
     }
     for (i=0;i<n;i++)
     {
         scanf("%d",&g[i]);
     }
     for (i=0;i<n;i++)
     {
         for(j=i+1;j<n;j++)
         {
                           if (f[i]>f[j])
                           {
                                         a=f[i];
                                         f[i]=f[j];
                                         f[j]=a;
                           }
                           if (g[i]>g[j])
                           {
                                         b=g[i];
                                         g[i]=g[j];
                                         g[j]=b;
                           }
         }
     }
     c=0;
     d=n-1;
     e=0;
     m=n-1;
     for (i=0;i<n;i++)
     {
         if (f[i]==g[c])
         {
                       for(l=m;l>i;l--)
                       {
                                       if (f[l]<g[d])
                                       {
                                                        e=e-200;
                                                        d=d-1;
                                                        break;
                                       }
                                       else if (f[l]==g[d])
                                       {
                                            if(f[i]<g[d])
                                            e=e-200;
                                            d=d-1;
                                            break;
                                       }
                                       else 
                                       {
                                            e=e+200;
                                            d=d-1;
                                            m=m-1;
                                       }
                       }
                       if (l==i)
                       c++;
         }
         else if (f[i]>g[c])
         {
                       c++;
                       e=e+200;
         }
         else if (f[i]<g[c])
         {
                       d=d-1;
                       e=e-200;
         }              
         if (c>d)              
         break;
     }
     printf("%d\n",e);
     }
     else if (n==0)
     break;
     }
     getchar ();
     getchar ();
}
int comp(const void *p, const void *q)
{
    return (*(int *)q - *(int *)p);
}
int main()
{
 int n[50],tianji[50][1000],qiwang[50][1000],result[50],i,j,ii,jj,max,max0,nmax,cmax,cnmax;
 int tb,tm,qb,qm;
 i=0;
 while(1)
 {scanf("%d",&n[i]);
 if (n[i]==0) break;
 for (j=0;j<n[i];j++)
    scanf("%d",&tianji[i][j]);

 for (j=0;j<n[i];j++)
    scanf("%d",&qiwang[i][j]);
  qsort(tianji[i], n[i], sizeof(int), comp);
  qsort(qiwang[i], n[i], sizeof(int), comp);
  i++;
 }

 for (ii=0;ii<i;ii++)
{   result[ii]=0;
    tb=0;
    tm=n[ii]-1;
    qm=n[ii]-1;
    qb=0;
    for (j=n[ii]-1;j>=tb;j--)
    {

        if(tianji[ii][j]>qiwang[ii][qm])
          {
          tm--;
          qm--;
          result[ii]=result[ii]+200;

          }
          else if (tianji[ii][j]<qiwang[ii][qm])
             {tm--;
             qb++;
             result[ii]=result[ii]-200;;
             }
             else if (tianji[ii][j]==qiwang[ii][qm])
             {
                while(tianji[ii][tb]>qiwang[ii][qb])
                   {tb++;
                   qb++;
                   result[ii]=result[ii]+200;
                   }
                  if(tianji[ii][tb]<qiwang[ii][qb])
                      {tm--;
                      qb++;
                      result[ii]=result[ii]-200;
                      }
                  else if(tianji[ii][tb]==qiwang[ii][qb]&&j>tb)
                      {
                       if(tianji[ii][j]<qiwang[ii][qb])
                       result[ii]=result[ii]-200;
                        qb++;tm--;
                       }

                      }
        }
      printf("%d\n",result[ii]);
    }
return 0;
}
int comp(const void *a, const void *b)
{
	return *(int *)b - *(int *)a; 
}
int main()
{
	int n,i,t[1001],q[1001];
	while(cin >> n)
	{
		if(n == 0)
			break;
		for(i = 0;i < n;i ++)
			cin >> t[i];
		for(i = 0;i < n;i ++)
			cin >> q[i];
		qsort(t, n, sizeof(int), comp);
		qsort(q, n, sizeof(int), comp);
		int tl = 0,ql = 0;
		int tr = n - 1,qr = n - 1;
		int result = 0;
		while(tl <= tr)
		{
			if(t[tl] > q[ql])
			{
				result += 200;
				tl ++;
				ql ++;
			}
			else if(t[tr] > q[qr])
			{
				result += 200;
				tr --;
				qr --;
			}
			else
			{		
				if(t[tr] > q[ql])
					result += 200;
				else if(t[tr] < q[ql])
					result -= 200;
				tr --;
				ql ++;
			}
		}
		cout << result << endl;
	}
}
void sort(int *array,int max){
	for(int i=0;i<max-1;i++){
		for(int j=i+1;j<max;j++){
			if(*(array+i)<*(array+j)){
				int temp=*(array+i);
				*(array+i)=*(array+j);
				*(array+j)=temp;
			}
		}
	}
}

int main(){
	int n;
	scanf("%d",&n);
	while(n){
		int tianji[n],qiwang[n];
		for(int i=0;i<n;i++){
			scanf("%d",&tianji[i]);
		}
		for(int i=0;i<n;i++){
			scanf("%d",&qiwang[i]);
		}
		sort(tianji,n);
		sort(qiwang,n);
		
		int tfirst=0,qfirst=0;
		int tlast=n-1,qlast=n-1;
		int j=0;
		int win=0;
		int lose=0;
		
		while(j<n){
			if(tianji[tfirst]>qiwang[qfirst]){
				win++;
				tfirst++;
				qfirst++;
			}
			else if(tianji[tfirst]<qiwang[qfirst]){
				lose++;
				tlast--;
				qfirst++;
			}
			else{
				if(tianji[tlast]>qiwang[qlast]){
					win++;
					tlast--;
					qlast--;
				}
				else{
					if(tianji[tlast]<qiwang[qfirst])lose++;
					tlast--;
					qfirst++;
				}
			}
			j++;
		}
		
		printf("%d\n",win*200-lose*200);
		
		scanf("%d",&n);
	}
}
int main()
{   
	int n,i,j,s,sub=0,sum[1000]={0};
	int tfast,tslow,wfast,wslow;  
	int t[1000],w[1000];
	int k=0;
  while(scanf("%d",&n)&&(n!=0))
  {     
	  for(i=0;i<n;i++)
		  scanf("%d",&t[i]);
	  for(i=0;i<n;i++)
		  scanf("%d",&w[i]);
   	for(i=0;i<n-1;i++)
 		for(j=i+1;j<n;j++)
            if(t[i]<t[j])
			{s=t[j];t[j]=t[i];t[i]=s;}
 	for(i=0;i<n-1;i++)
 		for(j=i+1;j<n;j++)
            if(w[i]<w[j])
			{s=w[j];w[j]=w[i];w[i]=s;}
     tfast=0;tslow=n-1;
     wfast=0;wslow=n-1;    
    for(i=0;i<n;i++)       
	{
	    if(t[tfast]==w[wfast])    
		{
		   if(t[tslow]>w[wslow]){sub++;tslow--;wslow--;}
		   else if(t[tslow]<w[wslow]){sub--;tslow--;wfast++;}
           else if(t[tslow]==w[wslow])
		   {
			   if(t[tslow]<w[wfast]){sub--;tslow--;wfast++;}
               else if(t[tslow]==w[wfast]){break;}
		   }
		}
        else if(t[tfast]>w[wfast])
        		{sub++;tfast++;wfast++;}
		else {sub--;tslow--;wfast++;} 
	}
   sum[k++]=sub*200;
   sub=0;
  }
  for (i=0;i<k;i++) printf("%d\n",sum[i]);
  
}