semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int a[1000],b[1000]={0},r[1000]={0},i,j,k=0,max=0;
	char c[1003]={'\0'},d[1000]={'\0'};
	for(i=0;i<2000;i++)
	{
		scanf("%d%c",&a[i],&c[i]);
         if(c[i]!=',')
		 {  i=i+1;
			 break;
		 }
	}
	 for(j=0;j<i;j++)
	 {
       scanf("%d",&b[j]);
	   scanf("%c",&d[j]);
       
	 }
      printf("%d ",i);
     for(j=0;j<1000;j++)
	 {
		 for(k=0;k<i;k++)
		 {
		 if(j>=a[k]&&j<b[k])
		  r[j]=r[j]+1;	 
		 }
	 }
     for(j=0;j<1000;j++)
	 {
	   if(r[j]>max)
		   max=r[j];
	 }
	 printf("%d",max);
	
	return 0;
}
int main()
{
	int num1[1000]={0},num2[1000]={0};
	int i=1,j=1,k;
	cin>>num1[0];
	while(cin.get()==',')
	{
		cin>>num1[i];
		i++;
	}
	cin>>num2[0];
	while(cin.get()==',')
	{
		cin>>num2[j];
		j++;
	}
	cout<<i<<" ";
	int num[1000]={0};int temp=0;
	for(k=0;k<1000;k++)
	{
		for(j=0;j<i;j++)
			if(num1[j]<=k&&k<num2[j])
				num[k]++;
		if(num[k]>temp)
			temp=num[k];
	}
	cout<<temp;
	return 0;
}
int main()
{
	int a[1001],b[1001],i,j,min=10000,max=0,len,d[1000]={0},t=0;
	char c[1000];
	for(i=1;i<=1000;i++)
	{
		scanf("%d%c",&a[i],&c[i]);
		if(c[i]=='\n')
			break;
	}
	for(i=1;i<=1000;i++)
	{
		scanf("%d%c",&b[i],&c[i]);
		if(c[i]=='\n')
			break;
	}
	len=i;
	printf("%d ",len);
	for(i=1;i<=len;i++)
	{
		if(a[i]<=min)
			min=a[i];
		if(b[i]>=max)
			max=b[i];
	}
	for(i=min;i<=max;i++)
		for(j=1;j<=len;j++)
			if(i>=a[j]&&i<b[j])
				d[i]++;
	for(i=min;i<=max;i++)
		if(d[i]>=t)
			t=d[i];
	printf("%d",t);
	return 0;
}
int main()
{
	int i=0,t=0,n[10000]={0},m,j,a[1000],b[1000],min,max;
	
   char c;
   do{
       scanf("%d",&a[i]);
	   i++;
       t++; 
   }while((c=getchar())!='\n');
   i=0;
   do{
       scanf("%d",&b[i]);
	   i++;
   }while((c=getchar())!='\n');
   min=a[0];
   for(i=0;i<t;i++)
	   if(a[i]<min) min=a[i];
   max=b[0];
   for(i=0;i<t;i++)
        if(b[i]>max)  max=b[i];

	for(i=min;i<max;i++)
       for(j=0;j<t;j++)
	   {
	       if((i+0.1)>a[j]&&(i+0.1)<b[j]) n[i]++;
	   
	   }
            m=n[min];
	   for(i=min;i<max;i++)
		   if(n[i]>m) m=n[i];

		printf("%d %d",t,m);
		return 0;
    
}
int n;

int x[10010],y[10010];
char a[100010],b[100010];

int tonum(char *s, int a,int b){
    int ans = 0;
    for(int i=a;i<=b;i++)
        ans = ans * 10 + (s[i] - '0');
    return ans;
}
int main(){
    //n = 1;
    while(scanf("%s %s",a,b) != EOF){
        n = 0;
        
        int len = strlen(a);
        int pre = 0;
        for(int i=0;i<=len;i++)
            if(i == len || a[i] == ',')
                x[++n] = tonum(a,pre,i-1),pre = i + 1;
        
        len = strlen(b);
        pre = 0;
        n = 0;
        for(int i=0;i<=len;i++)
            if(i == len || b[i] == ',')
                y[++n] = tonum(b,pre,i-1),pre = i + 1;
        
        int ans = 0;
        for(int i=0;i<=1000;i++){
            int ccount = 0;
            for(int j=1;j<=n;j++)
                if(x[j] <= i && y[j] > i)
                    ccount ++;
            ans = max(ans ,ccount);
        }
        
        printf("%d %d\n",n,ans);
    }
    return 0;
}
int main()
{
	int a[1000],b[1000],p=0,max=0,i,j,ren,k;
	char c;
	i=0;
	while(i<1002)
	{
		scanf("%d",&a[i]);
		scanf("%c",&c);
		if(c=='\n')
		{
			ren=i+1;
			break;
		}
		i++;
	}
	i=0;
	while(i<ren-1)
	{
		scanf("%d%c",&b[i],&c);
		i++;
	}
	scanf("%d",&b[ren-1]);
	for(i=0,j=1;j<1000;i++,j++)
	{
		for(k=0;k<ren;k++)
		{
			if(a[k]<=i&&b[k]>=j)
			{
				p++;
			}
		}
		if(p>max)
		{
			max=p;
		}
		p=0;
	}
	printf("%d %d",ren,max);
	return 0;
}
int main()
{
    int time, cnt = 0;
    int delta[1001] = {0};

    while (1)
    {
        cin >> time;
        delta[time]++;
        cnt++;
        if (cin.get() != ',')
            break;
    }

    int i;
    char comma;
    for (i=0; i<cnt; i++)
    {
        cin >> time >> comma;
        delta[time]--;
    }

    int curprecent = 0, max = 0;
    for (i=0; i<1001; ++i)
    {
        curprecent += delta[i];
        if (curprecent > max)
            max = curprecent;
    }

    cout << cnt << ' ' << max << endl;
    return 0;
}
main()
{
	int i,t,n,num,max=0;
	int in[1000],out[1000];
	char a;
	for(i=0;;i++)
	{
		scanf("%d",&in[i]);
		scanf("%c",&a);
		if(a=='\n') break;
	}
	for(i=0;;i++)
	{
		scanf("%d",&out[i]);
		scanf("%c",&a);
		if(a=='\n') break;
	}
	n=i+1;
	printf("%d ",n);
	for(t=0;t<1000;t++)
	{
		num=0;
		for(i=0;i<n;i++)
			if(t>=in[i]&&t<out[i]) num++;
		if(num>max) max=num;
	}
	printf("%d\n",max);
}
//********************************
//*????????   **
//*?????? 1300012957 **
//*???2013.11.05  **
//********************************
int main ( )
{
	int s = 0,i = 0,j,k;
	int n;
	char ch ;
	int a[1001],b[1001];
	do
	{
		cin >> a[i] ;              //??????????
		i++;
	}while( cin.get() == ',' );
	
	i=0;
	
	do
	{
		cin >> b[i] ;              //??????????

		i++;
	}while( cin.get() == ',' );
	                               //i??????
	int t = 0;
	for( j = 0;j <= 1000;j++ )
	{
		t = max(t,s);              //t??????????????
		                           //t???????????????????????????????????
		s = 0;                     //???????s?0????
		for( k = 1;k <= i;k++ )
		{
			if( (a[k-1] <= j) && (j < b[k-1]) )
				s++;               //???????????????
		}
	}
	
	cout << i << " " << t << endl; //?????????????????????	
	
	return 0;
}
int main()
{
	int start1[10000],end1[10000];
	int i=0,renshu=0,max=0,flag=0,flag1=0,j=0;
	int num[100000];
	char start[200000],end[200000];
	memset(num,0,sizeof(num));
	memset(start1,0,sizeof(start1));
	memset(start,0,sizeof(start));
	memset(end,0,sizeof(end));
	memset(end1,0,sizeof(end1));
	cin.getline(start,200000,'\n');
	cin.getline(end,200000,'\n');
	for(i=0;i<200000;i++)
	{
		if(start[i]==0)
		{
			renshu++;
			flag=flag1;
			flag1=i-1;
			if(renshu==1)
			{
				for(j=flag1;j>=0;j--)
					start1[renshu]=start1[renshu]+(start[j]-'0')*pow((double)10,(double)(flag1-j));
			}
			else
			{
				for(j=flag1;j>flag+1;j--)
					start1[renshu]=start1[renshu]+(start[j]-'0')*pow((double)10,(double)(flag1-j));
			}
			break;
		}
		if(start[i]!=0)
		{
			if(start[i]==',')
			{
				renshu++;
				flag=flag1;
				flag1=i-1;
				if(renshu==1)
				{
					for(j=flag1;j>=0;j--)
						start1[renshu]=start1[renshu]+(start[j]-'0')*pow((double)10,(double)(flag1-j));
				}
				else
				{
					for(j=flag1;j>flag+1;j--)
						start1[renshu]=start1[renshu]+(start[j]-'0')*pow((double)10,(double)(flag1-j));
				}
			}
		}
	}
	flag=0;
	flag1=0;
	renshu=0;
	for(i=0;i<200000;i++)
	{
		if(end[i]==0)
		{
			renshu++;
			flag=flag1;
			flag1=i-1;
			if(renshu==1)
			{
				for(j=flag1;j>=0;j--)
					end1[renshu]=end1[renshu]+(end[j]-'0')*pow((double)10,(double)(flag1-j));
			}
			else
			{
				for(j=flag1;j>flag+1;j--)
					end1[renshu]=end1[renshu]+(end[j]-'0')*pow((double)10,(double)(flag1-j));
			}
			break;
		}
		if(end[i]!=0)
		{
			if(end[i]==',')
			{
				renshu++;
				flag=flag1;
				flag1=i-1;
				if(renshu==1)
				{
					for(j=flag1;j>=0;j--)
						end1[renshu]=end1[renshu]+(end[j]-'0')*pow((double)10,(double)(flag1-j));
				}
				else
				{
					for(j=flag1;j>flag+1;j--)
						end1[renshu]=end1[renshu]+(end[j]-'0')*pow((double)10,(double)(flag1-j));
				}
			}
		}
	}
	for(i=1;i<=renshu;i++)
	{
		for(j=start1[i];j<end1[i];j++)
			num[j]++;
	}
	for(i=0;i<1000;i++)
	{
		if(num[i]>max)
			max=num[i];
	}
	cout<<renshu<<" "<<max<<endl;
	return 0;
}
int main()
{
	int t1[1000],t2[1000],num=0,mint1,maxt2=0;
	char c;
	scanf("%d%c",&t1[num],&c);
	mint1=t1[num];
	while (c!='\n')
	{
		num++;
		scanf("%d%c",&t1[num],&c);
		if(t1[num]<mint1)
			mint1=t1[num];
	}
	int i;
	scanf("%d",&t2[0]);
	maxt2=t2[0];
	for(i=1;i<=num;i++)
	{
		scanf(",%d",&t2[i]);
		if(t2[i]>maxt2)
			maxt2=t2[i];

	}
	scanf("%d",t2[num]);
	printf("%d ",num+1);
	int t,maxnum=0,n;
	for(t=mint1;t<maxt2;t++)
	{
		n=0;
		for(i=0;i<=num;i++)
		{
			if(t>=t1[i]&&t<t2[i])
			{
				n++;
			}
		}
		if(n>maxnum)maxnum=n;
	}
	printf("%d",maxnum);
}
int main()
{
	int flag[1000];
	for (int i=0;i<1000;i++)
		flag[i]=0;
	int x,n=1;
	cin>>x;flag[x]++;
	while (getchar()==',')
	{
		cin>>x;
		n++;
		flag[x]++;
	}                              //????????
	cin>>x;flag[x]--;
	while (getchar()==',')
	{
		cin>>x;
		flag[x]--;
	}                              //????????
	int max=0,now=0;
	for (int i=0;i<1000;i++)
	{
		now+=flag[i];
		if (max<now) max=now;
	}                              //??????
	cout<<n<<' '<<max;
	return 0;
}
/*
 * 1000012795-?????.cpp
 *   ?????
 *  Created on: 2010-12-19
 *      Author: ??
 */
int main()//?????
{
	int len1,len2,i,j=0,k=0,l=0,m=0,num=1,max=0;
	int cishu[1000000]={0};//?????????????????
	double a[100000]={0};//??str1?????????
	double b[100000]={0};//??str2?????????
	char  str1[100000];
	char  str2[100000];
	gets(str1);
	gets(str2);
	len1=strlen(str1),len2=strlen(str2);
    for(i=0;i<len1;i++)//?str1???double???
    {
    	char c[1000][1000];
    	if(str1[i]==',')
    	{
    		a[k++]=atof(c[j]);
    		j++;
    		l=0;
    	}
    	if(str1[i]!=',')
    	{
    		c[j][l]=str1[i];
    		l++;
    	}
    	if(i==len1-1)
    		a[k]=atof(c[j]);
    }
    j=0,l=0;
    for(i=0;i<len2;i++)//?str2???double???
    {
    	char d[1000][1000];
        if(str2[i]!=',')
        {
        	d[j][l]=str2[i];
        	l++;
        }
        if(str2[i]==',')
        {
        	b[m++]=atof(d[j]);
        	j++;
        	l=0;
        }
        if(i==len2-1)
           b[m]=atof(d[j]);
     }
    for(i=0;i<=k;i++)//?????????????????cishu?
    	for(l=a[i];l<b[i];l++)
    	{
    		cishu[l]++;
    		num++;
    	}
    for(m=0;m<num+5;m++)//???????????
    	if(cishu[m]>max)
    		max=cishu[m];
    cout<<k+1<<" "<<max<<endl;
    return 0;//????
}
int f(char r[],int x[])
{
	int n,i,j,e=0;
	n=strlen(r);
	for(i=0;i<n;i++)
	{
		int k=r[i]-48;
		for(j=1;j<4;j++)
		{
			if(r[i+j]!=','&&r[i+j]!='\0')
				k=k*10+r[i+j]-48;
			else
				break;
		}
		i=i+j;
		x[e]=k;
		e=e+1;
	}
	return e;
}
void main()
{
	int i,j,n,m,q=1,x[1001],y[1001],a,b,s[1000]={0};
	char r[4000],c[4000];
	scanf("%s%s",r,c);
	n=strlen(r);
	m=strlen(c);
	for(i=0;i<n;i++)
	{
		if(r[i]==',')
			q=q+1;
	}
	a=f(r,x);
	b=f(c,y);
	int max=y[0];
	for(i=1;i<b;i++)
	{
		if(y[i]>max)
			max=y[i];
	}
	for(i=0;i<max;i++)
	{
		for(j=0;j<a;j++)
		{
			if(i+0.5>x[j]&&i+0.5<y[j])
				s[i]=s[i]+1;
		}
	}
	int max1=s[0];
	for(i=1;i<max;i++)
	{
		if(s[i]>max1)
			max1=s[i];
	}
	printf("%d %d",q,max1);
}
// *****************************************************************************
//*?????????.cpp
//*??;1300012725
//*?????2013.11
//*??????????
//******************************************************************************


int main()
{
	int x[2000], y[2000], t[2000]={0}, i=1, max, j, k;     //????t[2000]??????????max???????i?????j,k??????

	cin >> x[1];
	while( cin.get() != '\n' )                         //??????
	{
		i++;
		cin >> x[i];
	}
	cin >> y[1];
	i = 1;
	while( cin.get() != '\n' )                        //??????
	{
		i++;
		cin >> y[i];
	}
	for( j = 1; j <= i; j++ )
	{
		for( k = x[j]; k < y[j]; k++ )
		{
			t[k]++;                             //??????????????????????1
		}
	}
	max = t[0];
	for( int q = 1; q < 1000; q++ )
	{
		if( t[q] > max )
			max = t[q];                        // ?max???????
	}
	cout << i << ' ' << max << endl;          // ?????????

	return 0;
}
//********************************
//*????????   **
//*?????? 1300012934 **
//*???2013.10.31  **
//********************************


int main()
{  
	int x[1000], y[1000], t[1000] = {0}, n, number, tmax;
	char douhao;

	n = 1;
	cin >> x[0];
	while ((douhao = cin.get()) != '\n')
	{
		cin >> x[n];
		n++;
	}
	cin >> y[0];
	for (int i=1; i <= n - 1; i++)
	{
		cin >> douhao >> y[i];
	}
	for (int i=0; i <= n - 1; i++)
	{
		for (int j=x[i]; j < y[i]; j++)
		{
			t[j]++;
		}
	}
	number = 0;
	tmax = 0;
	for (int i=0; i <= n - 1; i++)
	{
		if (tmax < y[i])
			tmax = y[i];
	}
	for (int i=0; i <= tmax; i++)
	{
		if (number < t[i])
			number = t[i];
	}
	cout << n << " " << number;


	return 0;

}
main()
{
//	FILE *fp1,*fp2;
	int per[1000][2];
	char c;
	int value,temp;
	int i,j,k,m,n;
	int max=0;
//	fp1=fopen("input.txt","r");
//	fp2=fopen("output.txt","w");
scanf("%d",&n);
//	fscanf(fp1,"%d",&n);
//	c=fgetc(fp1);
c=getchar();
	for(i=0;i<n;++i)
	{
		value=0;
c=getchar()-'0';
//		c=fgetc(fp1)-'0';
		while((c>=0)&&(c<=9))
		{
			value=value*10+c;
c=getchar()-'0';

//			c=fgetc(fp1)-'0';
		}
		per[i][0]=value;
	}
	for(i=0;i<n;++i)
	{
		value=0;
c=getchar()-'0';

//		c=fgetc(fp1)-'0';
		while((c>=0)&&(c<=9))
		{
			value=value*10+c;
c=getchar()-'0';

//			c=fgetc(fp1)-'0';
		}
		per[i][1]=value;
	}
	for(i=0;i<n-1;++i)
		for(j=0;j<n-i-1;++j)
			if(per[j][0]>per[j+1][0])
			{
				temp=per[j][0];
				per[j][0]=per[j+1][0];
				per[j+1][0]=temp;
				temp=per[j][1];
				per[j][1]=per[j+1][1];
				per[j+1][1]=temp;
			}
//	for(i=0;i<n;++i)
//		fprintf(fp2,"%d,",per[i][0]);
//	fputc('\n',fp2);
//	for(i=0;i<n;++i)
//		fprintf(fp2,"%d,",per[i][1]);
//	fputc('\n',fp2);

	for(i=0;i<n;++i)
	{
		temp=2000;
		k=0;
		for(j=0;j<n-i;++j)
			if(per[j][1]<temp)
			{
				k=j;
				temp=per[j][1];
			}
			m=n-i-1;
		for(j=n-i-1;j>0;--j)
			if(per[j][0]>=temp)
				m=j;
		if(max<m)
			max=m;
		for(j=k;j<n-i-1;++j)
		{
			per[j][0]=per[j+1][0];
			per[j][1]=per[j+1][1];
		}
	}
printf("%d\n",max);
//	fprintf(fp2,"%d",max);
//	fclose(fp1);
//	fclose(fp2);
}
int main()
{
	int i,j,ctr=0,a[1100]={0},b,x[1100]={0},max=0;
	while(1)
	{
		cin>>a[++ctr];
		if(cin.peek()=='\n')
			break;
		cin.get();
	}
	cin.get();
	for(i=1;i<=ctr;i++)
	{
		cin>>b;
		for(j=a[i];j<b;j++)
			x[j]++;
		if(!cin.eof())
			cin.get();
	}
	for(i=1;i<1050;i++)
		max=(x[i]>max)?x[i]:max;
	cout<<ctr<<" "<<max<<endl;
	return 0;
}
int main()
{
	int x[1000],y[1000],i=1,j,k,num[1000]={0},max=0;
	cin>>x[0];
	while(cin.peek()!='\n'){
		cin.get();
		cin>>x[i++];
	}
	for(j=0;j<i;j++){
		cin.get();
		cin>>y[j];
	}
	for(k=0;k<1000;k++)
	     for(j=0;j<i;j++)
		 {
			 if(k>=x[j]&&k<y[j])
				 num[k]++;
		 }
	for(j=0;j<1000;j++)
	    if(num[j]>max)max=num[j];
	cout<<i<<" "<<max;
     return 0;
}
int main()
{
	char str1[100000],str2[100000];
	int i,j=0,num=0,count=0,max=0,x[1000],y[1000],len;
	memset(str1,0,sizeof(str1));
	memset(str2,0,sizeof(str2));
	memset(x,0,sizeof(x));
	memset(y,0,sizeof(y));
	cin>>str1>>str2;
	for(i=0;i<strlen(str1);i++)//?str1???????x?
	{
		if(str1[i]!=',')
		{
			num=num*10+str1[i]-'0';
			if(i==strlen(str1)-1)x[j]=num;
			continue;
		}
		if(str1[i]==',')
			x[j++]=num;
		num=0;
	}
	num=0;j=0;
	for(i=0;i<strlen(str2);i++)//?str2???????y?
	{
		if(str2[i]!=',')
		{
			num=num*10+str2[i]-'0';
			if(i==strlen(str2)-1)y[j]=num;
			continue;
		}
		if(str2[i]==',')
			y[j++]=num;
		num=0;
	}
	len=j+1;//??????
	for(i=0;i<1000;i++)
	{
		for(j=0;j<len;j++)
		{
			if(x[j]==i)
				count++;
			if(y[j]==i)
				count--;
		}
		if(count>max)
			max=count;
	}
	cout<<len<<' '<<max<<endl;
	return 0;
}
int main()
{
    int x[1000],y[1000],a[1000]={0};
	int n=0,i=0,j,max=0;
	char c;
	do{
		scanf("%d%c",&x[n++],&c);
	}while(c!='\n');
	do{
		scanf("%d%c",&y[i++],&c);
	}while(c!='\n');
	for(i=0;i<1000;i++){
		for(j=0;j<n;j++){
			if(x[j]<=i&&y[j]>i){
				a[i]++;
			}
		}
	}
	for(i=0;i<1000;i++)
		if(a[i]>max)
			max=a[i];
	printf("%d %d",n,max);
	return 0;
}
//********************************
//*????????  **
//*?????? 1300012946 **
//*???2013.10.31  **
//********************************
int main()
{
	int x[1001]={0},y[1001]={0},a[1001]={0},j,i,k,most=0;
	char ch;
	for (i=0 ;  ; i++)
	{
		cin>>x[i];
		ch=cin.get();
		if (ch!=',')
			break;
	}
	for (i=0 ;  ; i++)
	{
		cin>>y[i];
		ch=cin.get();
		if (ch!=',')
			break;
	}
	for (j=0 ; j<=i ; j++)
	{
		for (k=x[j] ; k<y[j] ; k++)
		a[k]++;
	}
	for (j=0 ; j<1000; j++)
		most=most>a[j]?most:a[j];
	cout<<i+1<<" "<<most;
	return 0;
}
int main()
{
	int i,j,n,arrive[1000],leave[1000],time[2000]={0};
	cin>>n;
	for(i=0;i<n;i++) 
	{
		cin>>arrive[i];
	}
	for(i=0;i<n;i++)
	{
		cin>>leave[i];
	}
	for(i=0;i<n;i++)
	{
		for(j=arrive[i];j<leave[i];j++)
			time[j]++;
	}
	int max=0;
	for(i=0;i<2000;i++)
	{
		if(max<time[i]) max=time[i];
	}
	cout<<max<<endl;
	return 0;
}
int main()
{
    int in[1005], out[1005], num = 0, count[1005] = {0}, max = 0;
    char f;
    while (1)
    {
        cin >> in[num++];
        if (cin.get() == '\n') break;
    }
    for (int i = 0; i < num; i++)
    {
        scanf("%d", &out[i]);
        cin.get();
        for (int j = in[i]; j < out[i]; j++)
            count[j]++;
    }
    for (int i = 0; i < 1001; i++)
        if (max < count[i]) max = count[i];
    cout << num << " " << max << endl;
    return 0;
}
void main()
{
	int a,b,c=0,d=0,e=0,f,g,h,i,j,r[2][10000],t[1001]={0};
	char s1[20000],s2[20000];
	scanf("%s",&s1);a=strlen(s1);
	scanf("%s",&s2);j=strlen(s2);
	r[0][0]=r[1][0]=0;
	for(b=0;b<=a;b++)
	{
		if(s1[b]==','||s1[b]=='\0')
		{c++;d=0;r[0][c]=0;}
		else
		{r[0][c]=r[0][c]*10+s1[b]-'0';}
	}
	for(b=0;b<=j;b++)
	{
		if(s2[b]==','||s2[b]=='\0')
		{e++;d=0;r[1][e]=0;}
		else
		{r[1][e]=r[1][e]*10+s2[b]-'0';}
	}
	for(f=0;f<e;f++)
	{
		for(g=r[0][f];g<r[1][f];g++)
		{	t[g]++;}
	}
	h=0;
	for(i=0;i<1000;i++)
	{if(h<t[i])h=t[i];}
	printf("%d %d",e,h);
}
int main()
{
	int x[1001],y[1001];
	int i,j,n,s=0,max=0;
	char c;
	for(i=0;;i++)
	{
		scanf("%d",&x[i]);
		if((c=getchar())=='\n')
			break;
	}
	for(i=0;;i++)
	{
		scanf("%d",&y[i]);
		if((c=getchar())=='\n')
		{
			n=(i+1);
			break;
		}
	}
	for(j=0;j<=1000;j++)
	{
		for(i=0;i<=(n-1);i++)
		{
			if((x[i]<=j)&&(y[i]>j))
				s++;
		}
		if(s>max)
			max=s;
			s=0;
	}
	printf("%d %d\n",n,max);
	return 0;
}
int main() 
{ 
char x1[10000]={'\0'},y1[10000]={'\0'}; // ????? ????num?k????? 

int num = 0, i, j, k = 0, max = 1, flag[1000] = {0}; 
int x[1000] = {0}, y[1000] = {0}; 
gets(x1); 
gets(y1); 
char *px = x1, *py = y1; 
while(*px != '\0') 
{ 
x[num] = atof(px); 
num++; 
px++; 
while(*px != ',' && *px != '\0') // ????x1???????x1????????????????????????????????????????? 
px++; 
px++; 
} 
while(*py != '\0' ) 
{ 
y[k] = atof(py); 
k++; 
py++; 
while(*py != ','&& *py != '\0') 
py++; 
py++; 
} 

for(i = 0; i < num; i++) 
{ 
for(j = x[i]; j < y[i]; j++) 
{ 
flag[j]++; 
} 
} 
for(i = 0; i < 1000; i++) 
{ 
if(flag[i] > max) max = flag[i]; 
} 
cout << num << " " << max << endl; 
return 0; 
}
//********************************
//*????????
//*??? ?? 1300012814  **
//*???2013.10,30  **
//********************************
int main()
{
     int a[1000], b[1000], num = 1, rs = 0;
     char c;

	 cin >> a[0];
	 c = cin.get();
	 while (c == ',')
	 {
	 cin >> a[num];
		 num++;
		 c = cin.get();
	 }
	 cin >> b[0];
	 c = cin.get();
	 int i = 1;
	 while (c == ',')
	 {
	 cin >> b[i];
		 i++;
		 c = cin.get();
	 }
	 for (int i = 0;i < 1000;i++)
	 {
		 int n = 0;
	 for (int j = 0; j < num; j++)
	 {
		 if(a[j] <= i && b[j] > i)
			 n++;
	 }
	 if (n > rs) rs = n;
	 }
	 cout << num << " " << rs <<endl;

	 return 0;
}
int main()
{
	int a[1000],b[1000],m[1000]={0},i=1,j=1,l,max;
	char c;
	scanf("%d",&a[0]);
	while((c=getchar())==',')
		scanf("%d",&a[i++]);
	scanf("%d",&b[0]);
	while((c=getchar())==',')
		scanf("%d",&b[j++]);
	l=i-1;
	for(i=0;i<1000;i++)
		for(j=0;j<=l;j++)
		{
			if(i>=a[j]&&i<b[j])
				m[i]++;
		}
	max=m[0];
	for(i=0;i<1000;i++)
	{
		if(m[i]>max) max=m[i];
	}

	printf("%d %d\n",l+1,max);
	return 0;
}
int main()
{
	char c;
	int x[1010]={0}, y[1010]={0}, i, n, high[3000]={0}, a,b, j, big;//??????
	n=1;
	i=2;
	cin >> a;
	x[1] = a;
	while ((c=cin.get())==',')//??????
	{	
		cin >> a;//??????
		x[i]=a;//??
	    i++;
		n++;
	}
	cin>>y[1];
	for (i=2;i<=n;i++)//??????????
	{
		cin>>c;
	    cin>>y[i]; 
	}
	for (i=1;i<=n;i++)//???????????????????
		for (j=x[i];j<y[i];j++)
		   high[j]++;
	       big = high[1];
		for (j=1;j<=3000;j++)//?????
           if (high[j]>big)
			   big = high[j];
		   cout << n << ' ' << big;//??
}
/*
 * zhaopinhuirenshu.cpp
 *
 *  Created on: 2011-12-22
 *      Author: Administrator
 */
int main()
{
	int a[1000],b[1000],time[1000]={0};
	int i=0,k=0,j,max=0;
	do
	{
		cin>>a[i];
		i++;
	}
	while((getchar())!='\n');
	do
	{
		cin>>b[k];
		k++;
	}
	while((getchar())!='\n');
	for (int p=0;p<i;p++)
	{
		for (j=a[p];j<b[p];j++)
		{
			time[j]++;
		}
	}
	for (int p=0;p<1000;p++)
		if (time[p] > max)
		{
			max=time[p];
		}
	cout<<i<<" "<<max<<endl;
	return 0;
}
int main()
{
	char c;
	int i=0,jj,j[2000],ch[2000],t[2000],max=0;
	for(jj=0;jj<2000;jj++){j[jj]=0;ch[jj]=0;t[jj]=0;}
	while(1)
	{
		c=getchar();
		if(c=='\n'){i++;break;}
		else if(c>='0'&&c<='9')j[i]=j[i]*10+c-'0';
		else i++;
	}
	i=0;
	while(1)
	{
		c=getchar();
		if(c=='\n'){i++;break;}
		else if(c>='0'&&c<='9')ch[i]=ch[i]*10+c-'0';
		else i++;
	}
	printf("%d ",i);
	for(i--;i>=0;i--)
	{
		for(jj=j[i];jj<ch[i];jj++)t[jj]++;
	}
	for(i=0;i<2000;i++)if(t[i]>max)max=t[i];
	printf("%d",max);
	return 0;
}
int main()
{
	int a[1000];
	int b[1000];
	int mark[1000];
	char c;
	int i=0;
	int j=0;
	int num;
	int max;
	int k;
	scanf("%d",&a[i]);
	while (c=getchar()==',')
		{
		i=i+1;
		scanf("%d",&a[i]);
		}
	scanf("%d",&b[j]);
	while (c=getchar()==',')
	{
		j=j+1;
		scanf("%d",&b[j]);
	}
	num=j+1;
	for(k=0;k<1000;k++)
	{
		for(i=0;i<num;i++)
		{
			if(k>=a[i]&&k<b[i])
				mark[k]=mark[k]+1;
		}
	}
	max=mark[0];
	for(k=0;k<1000;k++)
	{
		if(mark[k]>max)
			max=mark[k];
	}
	printf("%d %d",num,max);
	return 0;
}
int main()
{
     int i,j,n,m,temp,arrive[1600],leave[1600],times[1001]={0};
     char c;
     c=getchar();
     while(c!=EOF)
     {
       n=0;
       while(c!='\n')
       {
         m=c-'0';
         temp=0;
         while((m<=9)&&(m>=0))
         {
           temp=temp*10+m;
           c=getchar();
           m=c-'0';
          }
          arrive[n]=temp;
          n++;
          if(c==',')
	  c=getchar();
		  
         }
	c=getchar();
       n=0;
       while(c!='\n')
       {
         m=c-'0';
         temp=0;
         while((m<=9)&&(m>=0))
         {
           temp=temp*10+m;
           c=getchar();
           m=c-'0';
          }
          leave[n]=temp;
          n++;
          if(c==',')
	   c=getchar();
         }
         for(i=0;i<1000;++i)
           times[i]=0;
	for(i=0;i<n;i++)
	{
		for(j=arrive[i];j<leave[i];j++)
			times[j]++;
	}
	int max=0;
	for(i=0;i<1000;i++)
	{
		if(max<times[i]) max=times[i];
	}
	printf("%d %d\n",n,max);
         while(c=='\n')
	  c=getchar();
		 
      }
}
int main()
{
    int start[1001],end[1001],sum[10001]={0},i,j,k,max1,max2;
    char c;
    for(i=0;c!='\n';i++)
        scanf("%d%c",&start[i],&c);
    for(c='p',i=0;c!='\n';i++)
        scanf("%d%c",&end[i],&c);
    for(k=0;k<i;k++)
    {
        for(j=start[k];j<end[k];j++)
        {
            sum[j]++;
        }
    }
    for(k=0,max1=end[0];k<i;k++)
    {
        if(end[k]>max1)
        max1=end[k];
    }
    for(k=0,max2=sum[0];k<max1;k++)
    {
        if(max2<sum[k])
        max2=sum[k];
    }
    printf("%d %d",i,max2);
    return 0;
}
int main()
{
	int a[10000];
	int b[10000];
	int x;
	int min, max;
	
	cin >> a[0];
	
	x = 1;
	
	while(cin.get() != '\n')
	{
		cin >> a[x];
		x ++;
	}
	
	cin >> b[0];
	
	x = 1;
	
	while(cin.get() != '\n')
	{
		cin >> b[x];
		x ++;
	}
	
	min = 100000;
	max = 0;
	
	for(int i = 0; i <= x; i++)
	{
		if(a[i] < min)
		min = a[i];
		
		if(b[i] > max)
		max = b[i];
	}
	
	int maxcount = 0;
	
	for(int i = min; i <= max; i ++)
	{
		int count = 0;
		
		for(int j = 0; j <= x; j ++)
		{
			if(a[j] <= i && i < b[j])
			{
				count ++;
			}
			
			else
			continue;
			
			if(count > maxcount)
			maxcount = count;
			
		}
	}
	
	cout << x << " " << maxcount;
	
	return 0;
}
//********************************************
//*3ìDò?o&#213;D&#198;&#184;&#187;áè&#203;êy                          *
//*D&#213;&#195;&#251;?oo&#206;&#212;&#198;&#198;e                              *
//*&#209;§o&#197;?o1300012888                          *
//*è&#213;&#198;ú?o2013.11.5                           *
//********************************************

int main()
{
	int a[1001], b[1001], t[1000], n, i, tmax;

	tmax = INT_MIN;
	i = 1;
	while(1)
	{
		cin >> a[i];
		i ++;
		if(cin.get() == '\n')
			break;
	}
	n = i - 1;
	for(i = 1;i <= n;i ++)
	{
		cin >> b[i];
		cin.get();
	}
	for(i = 0;i <= 999;i ++)
		t[i] = 0;
	for(i = 1;i <= n;i ++)
	{
		for(;a[i] <= b[i] - 1;a[i] ++)
			t[a[i]] ++;
	}
	for(i = 0;i <= 999;i ++)
	{
		if(t[i] > tmax)
			tmax = t[i];
	}
	cout << n << " " << tmax << endl;

	return 0;
}