#include<bits/stdc++.h>
using namespace std;
int main(){
	int s1(0),s2(0);
	char st1[101],st2[101];
	scanf("%s%s",st1,st2);
	strlwr(st1);strlwr(st2);
	if(strcmp(st1,st2)<0)printf("-1");else printf("%d",strcmp(st1,st2)?1:0);
}


#include<stdio.h>
int main()
{
	int c,x-0,y=00,e=0;
	char str[100],str2[100];
	scanf("%s", &x);
	scanf("%s", &y);
	for (c = 0; str[c] != 0 && str2[c] != 0; c++){
		if (str[c] - str2[c]>0 )x++;
		else if (str[c] - str2[c]<0)y++;
		else e++;
	}
	if (e = c - 1) printf("0");
	else if (y>x) printf("-1");
	else printf("1");
	return(0);
}


#include<stdio.h>
#include<string.h>
int main()
{
    char a[200],b[200];
   // gets(a);
    //gets(b);
    strlwr(a);
    strlwr(b);
    //if(strcmp(a,b)<0)
    printf("-1");
    else if(strcmp(a,b)>0)
    printf("1");
    else printf("0");

return 0;
}


#include <stdio.h>

int main() {
	char a[101],b[101];
	int i,temp=0;
	for(i=0;i<strlen(a);i++)
	{
	    scanf("%f",&a[i]);
	    scanf("%f",&[i]);
	}
	for(i=0;i<strlen(a);i++)
	{
	    if(a[i]>b[i])
	    {
	        temp=1;
	        break;
	    }
	    else if(a[i]<b[i])
	    {
	        temp=-1;
	        break;
	    }
	}
	if(temp==1)
	printf("1");
	else if(temp==-1)
	printf("-1");
	else printf("0;")
	return 0;
}


#include <stdio.h>
int main() {
    int arr[10001]={0};
    long int a = 0, n,m, temp1;
    scanf("%ld", &n);
    scanf("%ld",&m);
    arr[10000] = 1;
    if(n>m)
    n=m;
    for (long int i = 2; i <= n; i++) {
      a = 0;
      for (long int j = 10000; j >= 0; j--) {
        a = a + arr[j] * i;
        arr[j] = a % 10;
        a = a / 10;
      }
    }
    for (long int k = 0; k <= 10000; k++) {
      if (arr[k] != 0) {
        temp = k;
        break;
      }
    }
    for (long int k1 = temp; k1 <= 10000; k1++)
      printf("%d", arr[k1]);
    printf("\n");
    return 0;
  }


    #include<stdio.h>
    int main()
    {
      int i,num,j,g=1,num1;

      scanf("%d %d",&num,&num1);

      int f=1;

      for(i=1; i<=num;i++)
          f=f*i;
          for(j=1; j<=num1;j++)
          g=g*j;

    if(f<g){
        printf("%d",f);
    }
    else{
        printf("%d",g);
    }
      return 0;


#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
int main()
{
    long long n,k;
    vector<long long> ans;
    cin>>n>>k;
    for(long long i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
            ans.push_back(i);
        if(n%i==0 && i*i!=n)
            ans.push_back(n/i);
    }
    if(ans.size()>=k)
        cout<<ans[k]<<endl;
    else
        cout<<"-1"<<endl;
    return 0;
}
/*2017-03-05 20:40:40.494*/


#include<stdio.h>
#include<math.h>

main(){
long long n=4,k=4,c=0,i,arr[1000000];

arr[0]=-1;

scanf("%I64d %I64d",&n,&k);

	if (n<k){ printf("-1"); return 0;}
//divide n by sthg
	for(i=1;i<=sqrt(n);i++){
		if (n%i==0) ++c;
		if (c==k){
		printf("%I64d",i);
		return 0;
		}
		arr[c]=n/i;
//	printf("arr[%I64d]=%I64d\n",c,arr[c]);
	}

//	printf("i=%I64d\n",i);

	if(2*c<k) printf("-1");

	else{

	 if ( i==sqrt(n)) printf("%I64d",arr[2*c-k],c);
	 else printf("%I64d",arr[2*c-k-1],c);
	}


#include<stdio.h>
#include<stdlib.h>

const int N = 100005;

long long v[N];

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

int main(){
	long long n, k, i, count = 0;
	scanf("%lld %lld",&n,&k);
	for(i = 1; i*i<=n; i++){
		if(n%i == 0){
			v[count] = i;
			count++;
			if(n/i != i){
				v[count] = n/i;
				count++;
			}
		}
	}
	qsort(v,count,sizeof (long long),f);
	if(k > count) puts("-1");
	else printf("%lld\n",v[k-1]);

	return 0;
}


#include <stdio.h>
#include <math.h>

void f(long long n, long long k)
{
	for(long long i=1; i<=sqrt(n); ++i)
	{
		if(n%i==0)
			--k;
		if(k==0)
		{
			printf("%I64d", i);
			return;
		}
	}
	for(long long i=sqrt(n)+1; i>0; --i)
	{
		if(n%i==0)
			--k;
		if(k==0)
		{
			printf("%I64d", n/i);
			return;
		}
	}
		printf("-1");
	}
}

int main()
{
	long long n, k;
	scanf("%I64d%I64d", &n, &k);
	f(n, k);
}


#include<stdio.h>
#include<stdlib.h>

const int N = 100005;

long long v[N];

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

int main(){
	long long n, k, i, count = 0;
	scanf("%I64d %I64d",&n,&k);
	for(i = 1; i*i<=n; i++){
		if(n%i == 0){
			v[count] = i;
			count++;
			if(n/i != i){
				v[count] = n/i;
				count++;
			}
		}
	}
	qsort(v,count,sizeof (long long),f);
	if(k > count) puts("-1");
	else printf("%lld\n",v[k-1]);
	return 0;
}


#include<stdio.h>
#include<conio.h>
main()
{
     int a,b,diff;
     scanf("%d %d",&a,&b);
     diff=a-b;
     if(diff==1||diff==0||diff=-1)
     printf("yes");
     else
     printf("no");
}


#include<stdio.h>
int main ()
{
  int a,b;
  scanf("%d%d",&a,&b);
  if(a==b||a==(b-1))
  printf("yes");
  elseif(a==b==0||a>=101||b>=101)
  printf("no");
  return 0;
}


#include<stdio.h>
#include<conio.h>
main()
{
     int a,b,diff;
     scanf("%d %d",&a,&b);
     diff=a-b;
     if(a==0&&b==0)
     printf("no");
     else if(diff==1||diff==0||diff=-1)
     printf("yes");
     else
     printf("no");
}


#include<stdio.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
if(a==0 && b==0)
	{printf("NO");
else if(a-b==1)
	{printf("YES");}
else if(a-b==-1)
	{printf("YES");}
else if(a!=0 && b!=0 && a-b==0)
	{printf("YES");}
else
	{printf("NO");}
return 0;
}


#include<stdio.h
int main()
    { int a,b;
    scanf("%d %d",&a,&b);
    if(a==b)
    {printf("YES");
 if(a==b+1 || b==a+1
{ printf("YES");}
if(a==b+2 || b==a+2)
{ printf("NO");}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    long long s=n;
    while(n>=m)
    {
        s+=n/m;
        n=n/m+n%m;
    }
    cout<<s<<endl;
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
int main(){
	int n, m, i, j;
	while(~scanf("%d%d", &n, &m)!=EOF){
		i = m*n/(m-1);
		j=i-1;
		if(j-n = j/n)
			i = j
		printf("%d\n", i);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
//
int n,m,daysCnt=0,i,NewSocs,remindDays;
scanf("%i%i",&n,&m);

  daysCnt=n;
  NewSocs=n/m;
  remindDays=n%m;
  daysCnt= daysCnt+NewSocs;

  while (NewSocs%n!=0)
 {
      NewSocs=(remindDays+NewSocs)/m;
      remindDays=(remindDays+NewSocs)%m;
      daysCnt= daysCnt+NewSocs;
 }

  printf("%i",daysCnt);("%i",daysCnt);


#include<stdio.h>
int main ()
{
    int m,n,a, b, x,i;

    scanf("%d %d",&n, &m);
    x=n;
    for (i=1; ;)
    {
    	a=n/m;
    	b=a+(n%m);
    	n=b;
    	x=x+a;
    	if (b<m)
    	{break;}
    }
    printf("%d", x);

        return 0;


#include<stdio.h>

int main()
{
    int n, m, div, mod;
    sf("%d%d", &n, &m);
    int sum = a;
    while(a>=b)
    {
        div = (a/b);
        sum = sum + div;
        mod = (a%b);
        a= (div+mod);
    }
    pf("%d", sum);
}


#include <stdio.h>
#include <math.h>
int main() {
  int n, i, a, b, r, c, d, j;
  scanf("%d %d %d", &n, &a, &b);
  r=log2(n);
  c=n/2;
  d=c;
  i=1;
  j=n;
  d=n;
  while(i<log2(j)){
    if(a<=c && b<=c){
      r=r-1;
      c=(n-c)/2;
      n=n/2;
    }
    else if(a>c && b>c){
      r=r-1;
      c=n-((n-c)/2);
      if(a<=c && b<=c){
        n=4*c-n;
      }
      else{
        continue;
      }
    }
    else{
      break;
    }
    i=i+1;
  }

  if(r==log2(j)){
    printf("Final!");
  }
  else{
    printf("%d", r);
  }
  return 0;
  }


#include <stdio.h>
#include <stdlib.h>

int main()
{
  int n , a ,b;
  int diva = 0;
  int divb = 0;
  int totalmatches=0;
  int counter=1;

  scanf("%d %d %d" , &n , &a , &b);
  if( ((b > n/2) || (a > n/2)) && ( (b <= n/2) || (a <= n/2))  )
  {
    printf("Final!");
    return 0;
  }
  int temp=n;
  while(temp!=1)
    {
      temp = temp/2;
      totalmatches++;
    }
    totalmatches--;
    if(a%2!=0)
      a = (a+1);
    if(b%2!=0)
      b = (b+1);
    while(1)
    {
    if(a > n/2)
    {
      n=n/2;
      a=a-n;
      b=b-n;
    }
    else
      n=n/2;
    if( ((b > n/2) || (a > n/2)) && ( (b <= n/2) || (a <= n/2))  )
    {
      printf("%d" , totalmatches);
      return 0;
    }
    totalmatches--;
  }

  return 0;
}


#include<stdio.h>
#include<math.h>
int main(){
int  n,o=0,x,y,v,cnt=0,f=0,a,p=1;

scanf("%d%d%d",&n,&x,&y);
while(p<=n){
p=p*2;f++;
}
if(y>x){a=x;x=y;y=a;}
while(cnt!=f-1){
    v=(n+o)/2;
    if((x>v && y<=v)){
        break;
    }
    if(x<=v){
        n=n/2;
    }else if(y>v){
        o=n/2;
    }
    cnt++;
}
if(cnt==0){
    printf("Final!");
}else{
printf("%d",f-cnt-1);
}


#include<stdio.h>
#include<stdlib.h>
#define MAX 100005
/*
void swap(int *a,int *b){
	int t = *a;	*a = *b;	*b = t;
}

int main(){
	int a ,b;
	scanf("%d %d" ,&a ,&b);
	if(a > b)	swap(&a ,&b);
	if((b - a) % 2 == 0)	{
		int x = (b - a) / 2;
		printf("%I64d" ,1LL*x * (x + 1));
	}else {
		int x = (b - a) / 2;
		int y = x + 1;
		printf("%I64d" ,1LL * x * (x + 1) / 2 + 1LL * y * (y + 1) / 2);
	}
	return 0;
}*/

int a[257];
void printArray(int a[],int n){
	for(int i = 1 ; i <= n ; i++)	printf("%d " ,a[i]);	printf("\n");
}
int main(){
	int n ,A ,B;
	scanf("%d %d %d" ,&n ,&A ,&B);
	for(int i = 1 ; i <= n ; i++)	a[i] = i;
	int p = n ,r = 0 ,j = 1;
	int f = 0;
	if(A > B)	swap(&A ,&B);
	while(p > 1){
		printArray(a ,n);
		r++;	j = 1;
		for(int i = 1 ; i <= n ; i+=2){
			if(a[i] == A && a[i + 1] == B){
				f = 1;
				break;
			}else{
				if(a[i] == A || a[i + 1] == A)	a[j++] = A;
				else if(a[i] == B || a[i + 1] == B)	a[j++] = B;
				else a[j++] = a[i];
			}
		}
		if(f)	break;
		p /= 2;	n/=2;

	}
	if(p == 2)	puts("Final");
	else printf("%d" ,r);
	return 0;
}


#include <stdio.h>
int main()
{
	long long int n,a,b;
	scanf("%lld %lld %lld",&n,&a,&b);
	if(a>b)
	{
		long long int swap=a;
		a=b;
		b=swap;
	}
	long long int round=1;
	while(n>2)
	{
		if(b==a+1)
		{
			printf("%lld\n",round);
			return 0;
		}
		a=(a+1)/2;
		b=(b+1)/2;
		++round;
		n/=2;
	}
	printf("Final!\n");
	return 0;
}


#include<stdio.h>

int main()
{
    long long int x,y,c;

    scanf("%lld %lld",&x,&y);
    c=y-1;
    if(y==0 || C==0 || (x-c)<0) printf("No\n");
    else{

    if((x-c)%2==0)  printf("Yes\n");

    else  printf("No\n");
    }

    return 0;
}


#include<stdio.h>

using namespace std;

int main(void) {
	int x, y;
	scanf("%d%d", &x,&y);
	(x - y + 1) % 2 == 0 ? printf("YES") : printf("NO");
	return 0;
}


#include<stdio.h>
#include<math.h>
void f(int*,int*);
bool g(int,int);
main()
{
	int x,y;
	do{
		scanf("%d %d",&x,&y);
	}while (x<0 && x>(int)pow(10,9) && y<0 && y>(int)pow(10,9));
	if (g(x,y)) printf("Yes");
	else printf("No");

}

void f(int* x,int* y){
	*x=*x+1;
	*y=*y+1;
}

bool g(int x,int y){
	int i,j,x0=0,y0=1;
	for (i=1;i<y;i++) f(&x0,&y0);
    if(x0==x && y0==y) return true;
    else{
    for (j=x0;j<=x/2+1;j++){
		   x0+=2;
		   if (x0==x) return true;
		}
       }
    return false;
}


#include<stdio.h>
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    if(n==0 || k==0 || k-1>x){
        printf("No\n");
    }
    else if((k-1)%2==0){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


#include<stdio.h>
int main()
{
int x,y;
while(~scanf("%d %d",&x,&y))
{
    if(y==1&&x>0||y==0)
        printf("No\n");
    else
    {
    int t=y-1;
    if((x-t)%2==0&&x-t>=0)
    {
        printf("Yes\n");
    }
    else
        printf("No\n");
    }
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    int maxi=-1;
    while(n--)
    {
        int temp;
        scanf("%d",&temp);

        if(k%temp==0 && temp>maxi)
        {
            maxi=temp;
        }
    }

    printf("%d\n",k/maxi);

    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{ int n,m,i,b[100],x,p=0;
    scanf("%d",&n);
    scanf("%d",&m);
    for(i=0;i<n;i++)
    {
        scanf("%d",&b[i]);
    }
    for(i=0;i<n;i++)
    {
        if(m%b[i]==0)
        {
            s=b[i];
        }
    }
    p=m/s;
    printf("%d",p);
}


#include<stdio.h>
#include <stdlib.h>
int main() {
    int n, k;
    int* bucket;
    int i, input;
    int choose=0;
    scanf_s("%d %d", &n, &k);
    bucket = (int*)malloc(sizeof(int) * n);
    for (i = 0; i < n; i++) {
        scanf_s("%d", &input);
        bucket[i] = input;
    }
    for (i = 0; i < n; i++) {
        if (k % bucket[i]==0) {
            if (bucket[i] > choose) {
                choose = bucket[i];
            }
        }
    }
    printf("%d", k / choose);
    free(bucket);
    return 0;
}


#include<stdio.h>
main()
{
	int a, b, c, d,m,n,o,p,i,j,k,l, first[10][10], second[10][10], multiply[10][10], sum=0;
	printf("please enter the row and column number of First matrix: \n");
	scanf_s("%d %d", &m, &n);
	printf("please enter value First matrix: \n");

	for (i = 0; i < m; i++)
	{
		for (j = 0; j < n; j++)
		{
			scanf_s("%d",&first[i][j]);
		}
	}
	XXX: printf("please enter the row and column number of Second matrix: \n");
	scanf_s("%d %d", &o, &p);
	if (n != o)
	{
		printf("does not follow the matrix rules of 1st matrics column equal to 2nd metrics row\n");
		goto XXX;

	}
	else
	{
		printf("please enter value Second matrix: \n");

		for (k = 0; k < o; k++)
		{
			for (l = 0; l < p; l++)
			{
				scanf_s("%d",&second[k][l]);
			}
		}
	}
	for (a = 0; a < m; a++)
	{
		for (b = 0; b < p; b++)
		{
			for (c = 0; c < n; c++)
			{
				sum = sum + first[a][c] * second[c][b];
			}
			multiply[a][b] = sum;
			sum = 0;
		}
	}
	printf("The result matrix is: \n");

	for (a = 0; a < m; a++)
	{
		for (b = 0; b < p; b++)
		{
			printf("%d\t", multiply[a][b]);
		}
		printf("\n");
	}

}


#includ<stdio.h>

void main()
{
    int max=1;
    int x,y;
    int tab[100]

    scanf("%d"&x);
    scanf("%d"&y);
    for(int i=0;i<x;i++)
    {
        scanf("%d"&tab[i]);
        if(tab[i]%y==0&&tab[i]>max)
            max=tab[i];

    }
    printf("%d"y/x);

}


#include <stdio.h>
char board[8][8];
int rows,columns;
int main{
    rows=0;
    columns=0;
    int i=-1,j=-1;
    for(;++i<8;scanf("%s", board[i]));
    for(i=-1;++i<8;){
        int a=1;
        for(j=-1;++j<8;)  if(board[i][j] == 'W')a=0;
        if(a) rows++;
    }
    for(i=-1;++i<8;){
        int a=1;
        for(j=-1;++j<8;)  if(board[j][i] == 'W')a=0;
        if(a) columns++;
    }
    printf("%d", (columns>rows?columns:rows)<8?columns+rows:8);
    return 0;
}


#include<stdio.h>
int main()
{
    int r=8,c=8,count=0,i,j;
    char a[100];
    for(int i=0;i<r;i++)
    {
        for(int j=0;j<c;j++)
        {
            scanf("%c",a[i][j]);
        }
    }
    for(int j=0;j<c;j++)
    {
        i=0;
        if(a[i][j]=='B')
        count++;
    }
    if(count<8)
    {
        for(int i=1;i<r;i++)
        {
            j=0;
            if(a[i][j]=='B')
            count++;
        }
        printf("%d",count);
    }
    else
    printf("8");
    return 0;
}


#include <stdio.h>
#include <stdbool.h>

bool board[8][8];
bool newBoard[8][8];

int main() {
    char buf[9];
    for(int i = 0; i < 8; i++) {
        scanf("%s", buf);
        for(int j = 0; j < 8; j++) {
            if(buf[j] == 'B')
                board[i][j] = true;
        }
    }

    int total = 0;
    for(int i = 0; i < 8; i++) {
        int cnt = 0;
        for(int j = 0; j < 8; j++) {
            if(boar[i][j]) {
                cnt++;

            }
        }
        if(cnt == 8) {
            total++;
            for(int k = 0; k < 8; k++) {
                newBoard[i][k] = true;
            }

        }
    }
    for(int j = 0; j < 8; j++) {
        for(int i = 0; i < 8; i++) {
            if(board[i][j] != newBoard[i][j]) {
                total++;
                break;
            }
        }
    }
    printf("%d", total);
    return 0;
}


#include <stdio.h>
char board[8][8];
int rows,columns;
int main{
    rows=0;
    columns=0;
    int i=0,j=0;
    for(i=0;i<8;scanf("%s", board[i]), i++);

    return 0;
}


#include <stdio.h>
_int64 a[120];
main()
{
	_int64 n,m,i,last;
	scanf("%I64d%I64d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%I64d",&a[i]);
	for(i=1,last=0;i<=n;i++)
	{
		if(a[i]>m)
		{
			last=i;
		}
	}
	if(last==0)
		last=n;
	printf("%I64d\n",last);
}


#include <stdio.h>
int main (void)
{
	int n, m, max, temp, last;
	scanf("%d %d", &n, &m);
	for(int i = 0; i < n; i ++)
	{
		scanf("%d", &temp);
		temp = temp / m + (temp % m != 0 ? 1 : 0);
		if(temp >= max){
			max = temp;
			last = i;
		}
	}
	printf("%d", last + 1);
	return 0;
}


#include<stdio.h>
int main()
{
    int n,m,loc=0,i,x;
    scanf("%d%d",&n,&m);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]>max)
            max=a[i];
    }
    x=max/m+1;
    while(x--)
    {
        for(i=0;i<n;i++)
            if(a[i]>0)
            {
                a[i]-=m;
                loc=i;
            }
    }
    printf("%d",loc+1);
    return 0;
}


#include<stdio.h>
int main(){
	int n,m,child,a,i,max;
	scanf("%d %d",&n,&m);
	int arr[n];
	child=n;
	for(i=0;i<n;i++)
	{
		scanf("%d",&arr[i]);
		a=arr[i]/m;
		if(ma>max)
		{
			max=a;
			child=i+1;
		}
	}
	printf("%d",child);
}


A. Jzzhu and Children
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least ai candies.

Jzzhu asks children to line up. Initially, the i-th child stands at the i-th place of the line. Then Jzzhu start distribution of the candies. He follows the algorithm:

Give m candies to the first child of the line.
If this child still haven't got enough candies, then the child goes to the end of the line, else the child go home.
Repeat the first two steps while the line is not empty.
Consider all the children in the order they go home. Jzzhu wants to know, which child will be the last in this order?

Input
The first line contains two integers n, m (1 ≤ n ≤ 100; 1 ≤ m ≤ 100). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100).

Output
Output a single integer, representing the number of the last child.

Examples
inputCopy
5 2
1 3 1 4 2
outputCopy
4
inputCopy
6 4
1 1 2 2 3 3
outputCopy
6
Note
Let's consider the first sample.

Firstly child 1 gets 2 candies and go home. Then child 2 gets 2 candies and go to the end of the line. Currently the line looks like [3, 4, 5, 2] (indices of the children in order of the line). Then child 3 gets 2 candies and go home, and then child 4 gets 2 candies and goes to the end of the line. Currently the line looks like [5, 2, 4]. Then child 5 gets 2 candies and goes home. Then child 2 gets two candies and goes home, and finally child 4 gets 2 candies and goes home.

Child 4 is the last one who goes home.


#include <stdio.h>
#include <math.h>
long int main()
{
  long   long int a,b;
     scanf("%I64d\n",&a);
     scanf("%I64d",&b);
long     long int c=a+b;
    long long int i,j,k=0,l,p,q,t,mod;
     i=a,p=0,t=0,j=b,l=0,q=0;
     while(i>0)
     {
          mod=i%10;
          if(mod!=0)
          {
            p+=mod*pow(10,t);
            t++;
          }
          i/=10;
     }

     while(j>0)
     {
          mod=j%10;
          if(mod!=0)
          {
               q+=mod*pow(10,l);
               l++;
          }
          j/=10;
     }
   long  long int u=c,m;
    long long int w=0;
     while(u>0)
     {
          mod=u%10;
          if(mod!=0)
          {
               w+=mod*pow(10,k);
               k++;
          }
          u/=10;
     }
     m=p+q;
     if(w==m
     printf("YES");
     else
     printf("NO");
     return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

unsigned long long int A(unsigned long long int a)
{
	unsigned long long b, c;

	b = 0;
	c = 0;
	while (a) {
		if (a % 10)
			b = a % 10 * pow(10, c++) + b;
		a /= 10;
	}

	return b;
}

int main()
{
	unsigned long long a, b;

	cin >> a >> b;
	if (A(a + b) == A(a) + A(b))
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


#include<stdio.h>
#include<string.h>
int main() {
  /*two integers read into a char array!*/
  char a[10];
  char b[10];
  scanf("%s",a);
  scanf("%s",b);
  int na=strlen(a);
  int nb=strlen(b);
  int i,j,k;
  for(k=0;k<na;k++) {
    a[k]=a[k]-'0';
  }

  for(k=0;k<nb;k++) {
    b[k]=b[k]-'0';
  }
    int find_zero=0;
  for(i=0;i<na;i++) {
    if(a[i]==0) {find_zero=1; break;}
  }
  /*one piece code do one thing.*/
  for(i=0;i<nb;i++) {
    if(b[i]==0) {find_zero=1;break;}
  }
  int more10=0;
  /*保证i比j大*/
  if(na>nb) {
    i=na-1;
    j=nb-1;
  } else {
    i=nb-1;
    j=na-1;
  }

  while(1) {
    /*没有进位就可以保证相同，这是在有零的情况下成立*/
    if(a[i]+b[j]>=10){
      more10=1;
      if(j==0) { last_more10=1; break; }
      else a[i-1]+=(a[i]+b[j])/10;
    }
    i--;
    j--;
  }

    if(find_zero) {
      if(more10) printf("NO\n");
      else printf("YES\n");
    }else {
      if(last_more10) {
        printf("NO\n");
      } else printf("YES\n");
  }
  return 0;
}


#include <stdio.h>
#include <math.h>
int main()
{
  long   long int a,b;
     scanf("%I64d\n",&a);
     scanf("%I64d",&b);
long     long int c=a+b;
    long long int i,j,k=0,l,p,q,t,mod;
     i=a,p=0,t=0,j=b,l=0,q=0;
     while(i>0)
     {
          mod=i%10;
          if(mod!=0)
          {
            p+=mod*pow(10,t);
            t++;
          }
          i/=10;
     }

     while(j>0)
     {
          mod=j%10;
          if(mod!=0)
          {
               q+=mod*pow(10,l);
               l++;
          }
          j/=10;
     }
   long  long int u=c;
    long long int w=0,u;
     while(u>0)
     {
          mod=u%10;
          if(mod!=0)
          {
               w+=mod*pow(10,k);
               k++;
          }
          u/=10;
     }
     if(w==(p+q))
     printf("YES");
     else
     printf("NO");
}


include<stdio.h>
#include<string.h>
int main()
{
    int n,i;
    scanf("%d",&n);
    int sum=0;
    int c=0;
    char str[101];
    scanf("%s",&str);
    for(i=0;i<n;i++)
    {
        if(str[i]=='x')
        {
            c++;
            if(c>=3)
            {
                sum++;
            }
        }
        else
        {
            c=0;
            continue;
        }
    }
    printf("%d",sum);
}


#include<stdio.h>
int main()
{
	int tmp,l,co=0,d,co1=0;
	char ch;
	scanf("%d\n",&l);
	tmp=l;
	for(int i=0;i<l;i++)
	{
		scanf("%c",&ch);
		if(ch=='x&)
		{
			++co;
		}
		else
		{
			co=0;
		}
		if(co>=3)
		{
			co1++;;
		}

	}
	printf("%d",co1);
	return 0;
}


#include<stdio.h>
#include<iostream>
#include<stdlib.h>
int main()
{
int a,b,c1,c2;
scanf("%d%d",&a,&b);
int c,d,e,f,g,h;
c=d=e=f=g=h=0;
while(a!=0)
{
if(a%2==0)
{
c++;
a=a/2;
}
else if(a%3==0)
{
d++;
a=a/3;
}
else if(a%5==0)
{
e++;
a=a/5;
}
else
{
c1=a;
break;
}
}
while(b!=0)
{
if(b%2==0)
{
f++;
b=b/2;
}
else if(b%3==0)
{
g++;
b=b/3;
}
else if(b%5==0)
{
h++;
b=b/5;
}
else
{
c2=b;
break;
}
}
if(c1!=c2)
printf("-1\n");
else
{
int ans=abs(c-f)+abs(d-g)+abs(e-h);
printf("%d\n",ans);
}
return 0;
}


#include<stdio.h>
long long gcd(long long a,long long b)
{
	if(b==0)
	return a;
	else
	return gcd(b,a%b);
}
long long maxi(long long a,long long b)
{
	if(a>b)
	return  a;
	else
	return b;
}
int main()
{
	long long a,b,x,y,z,c1=0,c2=0;
	int f=0;
	scanf("%lld%lld",&a,&b);
	x=gcd(a,b);
	y=a/x;
	z=b/x;
	while(y!=1)
	{
		if(y%2!=0&&y%5!=0&&y%3!=0)
		{
			//printf("A %d\n",y);
			f=1;
			break;
		}
		if(y%2==0)
		{
			c1++;
			y=y/2;
		}
		if(y%3==0)
		{
			c1++;
			y=y/3;
		}
		if(y%5==0)
		{
			c1++;
			y=y/5;
		}
	}
	while(z!=1)
	{
		if(z%2!=0&&z%5!=0&&z%3!=0)
		{
			f=1;
			break;
		}
		if(z%2==0)
		{
			c1++;
			z=z/2;
		}
		if(z%3==0)
		{
			c1++;
			z=z/3;
		}
		if(z%5==0)
		{
			c1++;
			z=z/5;
		}
	}
	if(f==1)
	printf("-1\n");
	else
	printf("%lld\n",c1);
	retrun 0;
}


#include <stdio.h>
#include <conio.h>

long long int GCD(long long int p, long long int q)
{
    if (p%q == 0) return q;
    return GCD(q, p%q);
}

int main()
{
    long long int a, b, steps = 0, c, x=0;
    scanf_s("%lld %lld", &a, &b);

    if (a == b) { printf("0"); _getch(); return 0; }

    c = GCD(a, b);
    while (a != c){
        if (a % 2 == 0 && (a / 2) % c == 0) a /= 2;
        else if (a % 3 == 0 && (a / 3) % c == 0) a /= 3;
        else if (a % 5 == 0 && (a / 5) % c == 0) a /= 5;
        else { x=1; break; }
        steps++;
    }

    if (x) { printf("-1"); _getch(); return 0; }
    else {
        while (b != c){
            if (b % 2 == 0 && (b / 2) % c == 0) b /= 2;
            else if (b % 3 == 0 && (b / 3) % c == 0) b /= 3;
            else if (b % 5 == 0 && (b / 5) % c == 0) b /= 5;
            else { x = 1; break; }
            steps++;
        }
    }

    if (x) { printf("-1"); _getch(); return 0; }
    else printf("%lld", steps);
    _getch();
    return 0;
}


#include <stdio.h>
int gcd(int a, int b){
        while((a%=b)&&(b%=a));
        return a+b;
}
int main(){
        int a,b,tmp,cnt=0;
        scanf("%d%d",&a,&b);
        tmp=gcd(a,b);
        a/=tmp,b/=tmp;
        while(!(a%2))a/=2,cnt++;
        while(!(b%2))b/=2,cnt++;
        while(!(a%3))a/=3,cnt++;
        while(!(b%3))a/=3,cnt++;
        while(!(a%5))a/=5,cnt++;
        while(!(a%5))a/=5,cnt++;
        if(a+b>2)puts("-1");
        else printf("%d",cnt);

        return 0;
}


#include<stdio.h>
int main()
{
    int n,a,b,c;
    scanf("%d %d %d %d"&n,&a,&b,&c);
    int i=0,j=0,temp=0,flag=0;
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=n;j++)
        {
            if(i*a+j*b<=n)
            {
                if((n(i*a+j*b))%c==0)
                {
                    flag=i+j+(n-(i*a+j*b))/c;
                    if(flag>temp && flag!=0)
                    {
                        temp=flag;
                    }
                }
            }
        }
    }
    printf("%d",temp);
    return 0;
}


#include <stdio.h>

int main(void)
{
int n,a,b;
scanf("%d %d %d %d", &n, &a, &b, &c);
int x = n/a;
int y = n/b;
int k;
int max = 0;
int temp;
for (int i =0; i <= x; i++)
{
for (int j = 0; j <= y; j++)
{
k = (n -a*i - b*j) / c;
if (a*i + b*j + k*c == n && k >= 0)
{
temp = i + j +k;
if (temp > max)
{
max = temp;
}
}
}
printf("%d", max);
}


#include<stdio.h>
int main(){
    int n,a,b,c;
    scanf("%d %d %d %d,&n,&a,&b,&c");
    int i=0,j=0,temp=0,flag=0;
    for(i=0;i<=n;i++){
        for(j=0;j<=n;j++){
            if(i*a+j*b<=n){
                if((n-(i*a+j*b))%c==0){
                    flag = i+j+(n-(i*a+j*b))/c;
                    if(flag>temp&&flag!=0){
                        temp=flag;
                    }
                }
            }
        }
    }
    printf(%d,temp);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n, a, b, c;
    scanf("%d", &n);
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);

    // cout << a << b << c << std::endl;

    std::vector<int> pieces;
    pieces.resize(n + 1, 0);
    pieces[a] = 1;
    pieces[b] = 1;
    pieces[c] = 1;
    for (int i = 0; i <= n; i++)
    {
        // if (i < a && i < b && i < c) continue;

        if (i - a >= 0 && pieces[i - a] != 0)
            pieces[i] = std::max(pieces[i], pieces[i - a] + 1);
        if (i - b >= 0 && pieces[i - b] != 0)
            pieces[i] = std::max(pieces[i], pieces[i - b] + 1);
        if (i - c >= 0 && pieces[i - c] != 0)
            pieces[i] = std::max(pieces[i], pieces[i - c] + 1);

        for (int i = 0; i <= n; i++)
        {
            std::cout << pieces[i] << " ";
        }
        std::cout << std::endl;
    }
    // std::cout << pieces[n] << std::endl;
    printf("%d", pieces[n]);

    return 0;
}


#include <stdio.h>
//#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n, a, b, c;
    scanf("%d", &n);
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);

    // cout << a << b << c << std::endl;

    std::vector<int> pieces;
    pieces.resize(n + 1, 0);
    pieces[a] = 1;
    pieces[b] = 1;
    pieces[c] = 1;
    for (int i = 0; i <= n; i++)
    {
        // if (i < a && i < b && i < c) continue;

        if (i - a >= 0 && pieces[i - a] != 0)
            pieces[i] = std::max(pieces[i], pieces[i - a] + 1);
        if (i - b >= 0 && pieces[i - b] != 0)
            pieces[i] = std::max(pieces[i], pieces[i - b] + 1);
        if (i - c >= 0 && pieces[i - c] != 0)
            pieces[i] = std::max(pieces[i], pieces[i - c] + 1);

        /*
        for (int i = 0; i <= n; i++)
        {
            std::cout << pieces[i] << " ";
        }
        std::cout << std::endl;
        */
    }
    // std::cout << pieces[n] << std::endl;
    printf("%d", pieces[n]);

    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{

    char ch[3];
    gets(ch);

    if((ch[1]== '8')||(ch[1]=='1'))
    {
        if((ch[0] =='a')||(ch[0] =='h'))
        {
            printf("3");
        }
        else
        {
         printf("5");
        }

    }
    else if((ch[0] =='a')||(ch[0] =='h'))
    printf("5");
    else printf("8");

    }

    return 0;
}


#include <stdio.h>

int gcd(int m, int n)
{
    int r;
    while ((r = m % n) != 0)
    {
        m = n;
        n = r;
    }
    return n;
}

int main()
{
    int a, b, n;
    scanf("%d %d %d", &a, &b, &n);
    while (true)
    {
        n -= gcd(a, n);
        if (n == 0)
        {
            printf("0");
            break;
        }
        n -= gcd(b, n);
        if (n == 0)
        {
            printf("1");
            break;
        }
    }


 #include<stdlib.h>
 divisior(int a,int b)
 {
    int s,i;
    if(a>b) s=b;
    else s=a;
    for(i=s;i>=1;i--)
    {
        if(a%i==0&&b%i==0)
        {
            break;
        }
    }
    return i;
 }
main()
{
    int n,a,b,k=0,c=1,d=0;
    scanf("%d %d %d",&a,&b,&n);
    //for(;k==0;)
    //while(k==0)
    {
        if(n>divisior(a,n))
        {
            printf("%d",c);k=1;
        }
     //   else n-=divisior(a,n);
     //   if(n<divisior(b,n))
     //   {
     //       printf("%d",d);k=1;
     //   }
     //   else n-=divisior(b,n);

  //  }
}


/*  AUTHOR:AKASH JAIN
*   USERNAME:akash19jain
*   DATE:23/07/2019
*/
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define SC1(x)          scanf("%lld",&x)
#define SC2(x,y)        scanf("%lld%lld",&x,&y)
#define SC3(x,y,z)      scanf("%lld%lld%lld",&x,&y,&z)
#define PF1(x)          printf("%lld\n",x)
#define PF2(x,y)        printf("%lld %lld\n",x,y)
#define PF3(x,y,z)      printf("%lld %lld %lld\n",x,y,z)
#define REP(i,n)        for(long long i=0;i<(n);i++)
#define FOR(i,a,b)      for(long long i=(a);i<=(b);i++)
#define FORD(i,a,b)     for(long long i=(a);i>=(b);i--)
#define WHILE(n)		while(n--)
#define MEM(a, b)       memset(a, (b), sizeof(a))
#define ITOC(c)         ((char)(((int)'0')+c))
#define MID(s,e)        (s+(e-s)/2)
#define SZ(a)		    strlen(a)
#define MOD             1000000007
#define MAX             10000000005
#define MIN             -10000000005
#define PI              3.1415926535897932384626433832795
#define TEST(x)         printf("The value of \"%s\" is: %d\n",#x,x)
const int INF = 1<<29;
typedef long long ll;
typedef unsigned long long ull;
#define FILEIO(name) \  freopen(name".in", "r", stdin); \   freopen(name".out", "w", stdout);
int cmp(const void * a,const void * b);
long long maxv(long long a,long long b);
long long minv(long long a,long long b);
long long gcd(long long u,long long v);

int main()
{
    ll t=1,i=0;
    //SC1(t);
    while(t--)
    {
        ll a,b,n;
        SC3(a,b,n);
        ll c=0,z=0;
        while(n>0)
        {
            c++;
            if (c%2==1)
                z=gcd(a,n);
            else
                z=gcd(b,n);
            n=n-z;
        }
        ll q=1;

        if (c%2==0)
            PF1(q)
        else
            printf("0\n");

    }
}

//qsort(arr,n,sizeof(arr[0]),cmp);
int cmp (const void * a, const void * b)
{
    if( *(ll*)a - *(ll*)b < 0 ) return -1;
    if( *(ll*)a - *(ll*)b > 0 ) return 1;
        return 0;
}
long long maxv(long long a,long long b)
{
    if(a>b) return a;
        return b;
}
long long minv(long long a,long long b)
{
    if(a<b) return a;
        return b;
}
long long gcd(long long u,long long v)
{
    if (v == 0) return u;
       return gcd(v, u%v);
}


#include <stdio.h>
int gcd(int a,int n)
{int i,gcd;
	for(i=1;i<=a;i++)
	{
		if(a%i==0 && n%i==0)
		gcd=i;
	}
	return gcd;
}
int main()
{
	int i,a,b,n,win=-1;
	scanf("%d %d %d",&a,&b,&n);
	for(i=0;;i++)
	{
		if(i=0 && n<a )
		{
			win=0;
			break;
		}
		if(i=0 && n<b)
		{
			win=1
			break;
		}
		if(n<a)
	{
	        win=1;
			break;
	}
		n-=gcd(a,n);
		if(n<b)
		{
			win=0;
			break;
		}
		n-=gcd(b,n);

	}
	printf("%d",win);
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int count[50];

int minimum(int a, int b)
{
    if (a<b)
    {
        return a;
    }

    else
    {
        return b;
    }
}

int main()
{
    char *s;
    int n;
    scanf("%d", &n);

    s = (char *)malloc(sizeof(char)*n);
    scanf("%s", s);

    ///int count[50];
    ///count[0] = 0;

    int i, j, k;

    for (i=0, k=0; i<=(n-4); i++)
    {
            count[k] += minimum(abs(s[i]-65), abs(91 - s[i]));
            count[k] += minimum(abs(s[i+1]-67), abs(93 - s[i+1]));
            count[k] += minimum(abs(s[i+2]-84), abs(-58 + s[i+2]));
            count[k] += minimum(abs(s[i+3]-71), abs(97 - s[i+3]));
            k++;
            ///count[k] = 0;
    }

    int temp = count[0];

    for (i=0; i<k; i++)
    {
        temp = minimum(temp, count[i]);
    }

    printf("%d\n", temp);

    free(s);
}


  #include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,k,s=0,i;
    int tab[100];
    scanf("%d %d" ,&n ,&k);

    for(i=0;i<n;i++)
    scanf("%d",&tab[i]);

     for(i=0;i<n;i++){
            if(tab[i]<=k)
            s++;
            else break;

    }

     for(i=n-1;i<=0;i--){
        if(tab[i]<=k)
       s++;
       else break;
     }

printf("%d",s);


#include<stdio.h>
int main(){
    int i,n,x,p,q,sum=0;
    scanf("%d",&n);
    int a[n];
        for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        }
        for(i=0;i<n;i++){
            if(a[i]>x){
                      break;
                      }
             else{
             p=p+1;
             }
             }
             for(int j=n-1;j>=0;j--){
                 if(a[i]>x){
                 break;
                 }
                 }
                 else{
                 q=q+1;
                 }
                 sum=p+q;
                 if(p==n){
                 printf("c");
                 }
                 else{
                 printf("sum");
                 }
}


#include <stdio.h>

int main()
{
   int n,k,g,f=0;
   scanf("%d %d",&n,&k);
   int a[n];
   for (i=0;i<n;i++)
      scanf("%d",&a[i]);
   for (int i=0;i<=n;i++)
     {
		if (a[i]<=k)
		   f++;
		else
	       break;
	 }
   for (g=n-1;g>i;g--)
	{
		if (a[g]<=k)
		   f++;
	    else
	       break;
	}
	printf("%d",f);

	return 0;

}


{
    long long int b,count = 0,i;
    scanf("%lld",&b);
    if(b==1)
    {
        printf("1");
    }
    else
    {
        for(i=1;i*i<b;i++)
        {
            if(b%i==0)
            count+=2;
        }
        if(i*i==b)
        {
            count++;
        }
        printf("%lld",count);

    }
}


#include <stdio.h>
#include <math.h>
long long printDivisors(int n)
{
    long long flag=0;
    for (int i=1; i<=sqrt(n); i++)
    {
        if (n%i == 0)
        {
            flag++;
            if (n/i == i)

            else
                flag++;
        }
    }
    return flag;
}

int main()
{
    int b;
    scanf("%d",&b);
    printf("%d",printDivisors(b));
    return 0;
}


#include<stdio.h>

int main(){
  long long int b;
  scanf("lld",&b);
  long long int count;
  for(i=1;i<=b;i++){
    if(b%i==0){
      count++;
    }

  }
  printf("lld",count);
}


#include<stdio.h>
#include<math.h>
int main(){
	double a,b;
	scanf("%lf",&b);
	if(b==1){
		printf("1\n");
		return 0;
	}
	for (int i=2;i<=b;i++){
		if(b%i==0){
			printf("%g\n",(log(b)/log(i))+1);
			return 0;
		}
	}
}


{
    long long int b,count = 0,i;
    scanf("%lld",&b);
    if(b==1)
    {
        printf("1");
    }
    else
    {
        for(i=1;i*i<b;i++)
        {
            if(b%i==0)
            count+=2;
        }
        if(i*i==b)
        {
            count++;
        }
        printf("%lld",count);

    }
    return 0;
}


#include <stdio.h>
int main()
{ int n;
scanf ("%d",&n);
 if (n % 2 == 0)
    printf ("%d",n div 2);
 else
    printf ("%d",((n-1) div 2) -n);
    return 0;
}


#include<stdio.h>
int main()
{
   long long int i,n,sum=0;
   while(scanf("%lld",&n)==1){
    if(n%2==0){
        printf("%lld\n",n/2);
    }
    else
        printf("%lld\n",-1*(((n+1)/2));
   }
return 0;
}


int main()
{
    unsigned int n, fn,

    int i;

    fn = 0;

    scanf(" %u", &n);

    for(i = 0; i < n; i++)
    {
        if(n % 2 == 0)
        {
            fn = n/2;
        }
        else
        {
            fn = (-(n + 1))/2;
        }
    }
    printf("%u\n", fn);

    return 0;
}


#include <stdio.h>
#include <iostream>

using namespace std;

int main(){

	long long n;
	cin >> n;
	long long i;
	long long sum=0;

	for(i=1; i<=n; i++){

		if((i%2)==0)
			sum+=i;
		else
			sum-=i;

	}

	cout << sum;

	return 0;
}


#include<stdio.h>
#include<string.h>
#define N 102
int main() {
    char s[N];
    scanf("%s",s);
    int kr=0,kb=0,ky=0,kg=0;
    int n=strlen(s);
    int i;
    //1111
    //rbyg
    int count[N];
    int position[N];
    while(1){
        int find=0;
        for(i=0;i<n-3;i++){
            count['R']=0; count['B']=0; count['Y']=0; count['G']=0; count['!']=0;
            count[s[i]]++; count[s[i+1]]++; count[s[i+2]]++; count[s[i+3]]++;
            position[s[i]]=i; position[s[i+1]]=i+1; position[s[i+2]]=i+2; position[s[i+3]]=i+3;
            if(count['!']>0)find=1;
            if(count['!']==1){
                if(count['R']==0){ s[position['!']]='R';kr++; }
                if(count['B']==0){ s[position['!']]='B';kb++; }
                if(count['Y']==0){ s[position['!']]='Y';ky++; }
                if(count['G']==0){ s[position['!']]='G';kg++; }
            }
        }
        if(!find)break;
    }
    printf("%d %d %d %d\n",kr,kb,ky,kg);
    return 0;
}


#include<stdio.h>
int main()
{
    int a,b,c,d;
    scanf("%d %d",&a,&b);
    if(a>b)
    printf("%d %d",b,c);}
    else
    {

        printf("%d %d",a,c);
    }

}


#include <stdio.h>
int main()
{
    int a,b,temp;
    scanf("%d %d",&a,&b);
    if(a>b)
    {
        temp=a;
        a = b;
        b = temp;
    }
    b = (b-a)/2;
    printf("%d %d",a,b);


#include<stdio.h>
int main()
{       int a,b,t,k,w;
        scanf("%d %d",&a,&b);
                if(a<b)
                        {
                                t=a;
                                a=b;
                                b=t;
                        }
                k=a-b;
                printf("%d ",b);
                if( k == 1)
                        printf("0");
                else
                        printf("%d",w=k/2);
return 0;
}
~


        #include <stdio.h>
        int main()
        {
            int a,b,i,diff_k=0,same_k=0;
            scanf("%d %d",&a,&b);
            if(b<=a)
            {
                for(i=1;i<=b;i++)
                {
                    diff_k++;
                }

                for(i=1;i<=a-diff;i++)
                {
                    if(i==2*i)
                    same_k++;
                }
            printf("%d %d",diff_k,same_k);
            }
            else if(a<b)
            {
                for(i=1;i<=a;i++)
                {
                    diff_k++;
                }
                for(i=1;i<=b-diff;i++)
                {
                    if(i==2*i)
                    same_k++;
                }
         printf("%d %d",diff_k,same_k);
            }
            return 0;
        }


#include <stdio.h>

long int SRoot(long int num)
{
    long int i;

    if(num == 1)
        return 1;
    else
    {
        i = 1;
        do{
            i++;
        }while(i * i < num);

        return i;
    }
}

int main()
{
    long int n, i, D[300]={0}, max, x, j, A[150], y, k, d;

    scanf("%ld", &n);
    for(i=0;i<n;i++)
        scanf("%ld", &D[i]);

    //Determine the maximum divisor from the array D[]
    max = D[0];
    for(i=1;i<n;i++)
        if(D[i] > max)
            max = D[i];

    x = max;

    //Determine all of the divisors of "x"
    j = 0;
    for(i=1;i<=x;i++)
        if(x % i == 0)
        {
            A[j] = i;
            j++;
        }

    //Multiply the divisors from D[] that are not present in A[];
    //thus we can get "y"
    y = 1;
    for(i=0;i<n;i++)
    {
        for(k=0;k<j;k++)
        {
            if(A[k] == D[i])
            {
                d = 1;
                break;
            }
            else
                d = 0;
        }

        if(d == 0)
            y *= D[i];
    }

    y = SRoot(long int y);

    printf("%ld %ld", x, y);

    return 0;
}


#include <stdio.h>

long int SRoot(long int num)
{
    long int i;

    if(num == 1)
        return 1;
    else
    {
        i = 1;
        do{
            i++;
        }while(i * i < num);

        return i;
    }
}

int main()
{

    scanf("%ld", &n);
    for(i=0;i<n;i++)
        scanf("%ld", &D[i]);

    //Determine the maximum divisor from the array D[]
    max = D[0];
    for(i=1;i<n;i++)
        if(D[i] > max)
            max = D[i];

    x = max;

    //Determine all of the divisors of "x"
    j = 0;
    for(i=1;i<=x;i++)
        if(x % i == 0)
        {
            A[j] = i;
            j++;
        }

    //Multiply the divisors from D[] that are not present in A[];
    //thus we can get "y"
    y = 1;
    for(i=0;i<n;i++)
    {
        for(k=0;k<j;k++)
        {
            if(A[k] == D[i])
            {
                x = 1;
                break;
            }
            else
                x = 0;
        }

        if(x == 0)
            y *= D[i];
    }

    y = SRoot(long int y);

    printf("%ld %ld", x, y);

    return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
	int n;
	scanf("%d",&n);
	int N[128]={0};
	int M[128]={0};
	for(int i=0;i<n;i++){
		scanf("%d",&N[i]);
	}
	for(int i=0;i<n;i++){
		M[i]=N[i];
	}
	int x,y,tmp=0;
	for(int i=0;i<n;i++){
		if(N[i]>tmp){
			tmp=N[i];
		}
	}
	x=tmp;
	for(int i=0;i<n;i++){
		if(x%N[i]==0){
			bool flag=false;
			for(int j=0;j<i;j++)
				if(M[j]==N[i]){
					flag=1;
				}

			if(flag);
			else
				N[i]=0;
		}
	}

	tmp=0;
	for(int i=0;i<n;i++){
		if(N[i]>tmp){
			tmp=N[i];
		}
	}
	y=tmp;

	printf("%d %d",x,y);
}


#include<stdio.h>
int main()
{
    int n,t,k,d;
    scanf("%d%d%d%d",&n,&t,&k,&d);
    if( (d+t)<(n+k-1)/k*t)
    print("YES");
    else
    printf("NO");
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windef.h>
int max(int n1,int n2) {
    if (n1 > n2)
        return n1;
    else
        return n2;
}
int main()
{

    int n,t,k,d;
    scanf("%d%d%d%d",&n,&t,&k,&d);
    double count1=0,count2=d;
    int x=(n+k-1)/k;
    for (int i = 0; i <x ; ++i) {
        if(count1<=count2)
            count1+=t;
        else
            count2+=t;

    }

   if(max(count1,count2)<x*t)
       printf("YES");
   else
       printf("NO");

}


#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int i, j, k;
	int n, m, t, d;
	int sum1=0;
	int sum2=0;
	scanf("%d %d %d %d", &n, &t, &k, &d);
	int l = n;
	while (l > 0)
	{
		sum1 += t;
		l -= k;
	}
	l = n;
	while (l > 0)
	{
		sum2++;
		if (sum2%t == 0)
		{
			l -= k;
		}
		if (sum2 - d > 0 && (sum2 - d) % t == 0)
		{
			l -= k;
		}
	}
	if (sum1 > sum2)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    int n,t,k,d;

    scanf("%d%d%d%d", &n,&t,&j,&d);

    int req = (n * t)/k;

    if (t + d < req )
        printf("YES\n");
    else
     printf("NO\n");
    return 0;
}


#include<stdio.h>
int main()
{
    int n,k,t,d,T1,T2;
    scanf("%d %d %d %d",&n ,&t ,&k ,&d);
    T1= (n/k*t+(n%k!=0));
    T2=d+(n/2k)*t;
    if(T1>T2)
    printf("YES");
    else
    printf("NO");
    return 0;
}


include<stdio.h>
int main()
{int n;
scanf("%d",&n);
 n=n-10;
 switch(n)
 {
 case 1:
 printf("4\n")
 break;
 case 2:
 printf("4\n")
 break;
 case 3
 printf("4\n")
 break;
 case 4
 printf("4\n")
 break;
 case 5
 printf("4\n")
 break;
 case 6
 printf("4\n")
 break;
 case 7
 printf("4\n")
 break;
 case 8
 printf("4\n")
 break;
 case 9
 printf("4\n")
 break;
 case 10
 printf("15\n")
 break;
 case 11
 printf("4\n")
 break;
 default:
 printf("0\n")
}
return 0;
}


#include<stdio.h>
int main()

{
    int x,n;
    scanf("%d",&n);
    x=n-10;
    if(x==0||x>=12)
    printf("0");
    if(x=10);
    printf("15");
    else
    printf("4");
    return 0;
}


#include<iostream>
using namespace std;
int main() {
	int n;
	while (cin >> n) {
		if (n <= 10) {
			cout << 0 << endl;
		} else if (n == 11) {
			cout << 8 << endl;
		} else if (n < 20) {
			cout << 4 << endl;
		} else if (n == 20) {
			cout << 15 << endl;
		} else {
			cout << 0 << endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int t,n,i,j,k;
    cin>>n;
    if(n<11||n>21)
        cout<<"0";
    else if(n>10&&n<19)
        cout<<"4";
    else if(n==20)
        cout<<"15";
    else if(n==21)
        cout<<"4";
}


/*
Author:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%   LALIT KUNDU      %%%%%%%%
%%%%%%%%   IIIT HYDERABAD   %%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<malloc.h>
#define lld long long int
#define llu long long unsigned int
int compare(const void * a, const void * b){return *(lld *)a-*(lld *)b;}
long long int readint() {long long int n=0,count=0,counti=0; char c;while(1){c=getchar_unlocked();if(c=='-')count=1;else if((c==' '||c=='\n'||c==EOF) && counti==1)break;else if(c>='0' && c<='9'){counti=1;n=(n<<3)+(n<<1)+c-'0';}}if(count==0)return n;else return -n;}
#define min(a,b)(a>b?b:a)
#define max(a,b)(a<b?b:a)
#define sort(arr,n) qsort(arr,n,sizeof(arr[0]),compare)
#define sd(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define su(n) scanf("%llu",&n)
#define rep(i,start,end) for(i=start; i<end; i++)
#define pdn(n) printf("%d\n",n)
#define pln(n) printf("%lld\n",n)
#define pun(n) printf("%llu\n",n)
#define pd(n) printf("%d",n)
#define pl(n) printf("%lld",n)
#define pu(n) printf("%llu",n)
#define pn printf("\n")
#define ps printf(" ")
int main()
{
    int n;
    sd(n);
    n-=10;
    if(n<=0)
        pdn(0);
    if(n==1)
        pdn(4);
    else if(n<10 && n>=2)
        pdn(4);
    else if(n==10)
        pdn(15);
    else if(n>10)
    {
        if(n!=11)
        pdn(0);
        else pdn(4);
    }
    return 0;
}


#include<bits/stdc++.h>
int main(void)
{
	long long int num = 0;
	scanf("%I64d",&num);
	long long int ans = 0;
	while(num/10!=0)
	{
		ans+=(10-num%10);
		num/=10;
		num+=1;
		while(num%10==0)
		{
			num/=10;
		}
	}
	ans+=9;
	printf("%I64d",ans);
}


#include <stdio.h>

int main(void)
{
	int N, i;
	int flag = 0;
	int A[1000000000] = { 0 };
	int count = 1;
	int index = 0;
	scanf("%d", &N);
	while(1)
	{
		A[index] = N;
		index++; count++;
		N += 1;
		if(N % 10 == 0)
		{
			while(N % 10 == 0)
				N /= 10;
		}
		A[index] = N;
		if(flag)
		{
			for(i = 0; i < index; i++)
			{
				if(A[i] == N)
				{
					printf("%d", count - 1);
					return 0;
				}
			}
		}
		flag = 1;
	}
}


#include<stdio.h>
int vis[15];
int main()
{
    int n;
    scanf("%d", &n);
    if(n < 10 && n > 0)
    {
        printf("9\n");
        return 0;
    }
    int count = 0;
    while(true)
    {
            n++;
        while(n % 10 == 0)
        {
            n /= 10;
        }
        if(n <= 10 && n > 0)
        {
            if(vis[n] == 1)
                break;
            else
                vis[n] = 1;
        }
        count++;
    }
    printf("%d\n", count+1);
    return 0;
}


number=input()
length=len(number)

sum=0
x=length-1
first=True
if length%2==1:
    a=number[x]
    b=number[x-1]
    x-=2
    sum=sum+(10-int(a)+9)
    while x>0:
        a=number[x]
        b=number[x-1]
        x-=2
        sum=sum+(10-int(b))
    sum=sum+(10-int(number[0]))
else:
    a=number[x]
    b=number[x-1]
    x-=2
    sum=sum+(10-int(a)+9)
    while x>0:
        a=number[x]
        b=number[x-1]
        x-=2
        sum=sum+(10-int(b))

print (sum)


#include <bits/stdc++.h>
using namespace std;
int main(){
    char b[1000];
    scanf("%s",b);
    int l=strlen(b);
    set <int> s;
    int f;
    for(int i=0;i<l/2;i++){
        if(b[i]==b[k-1-i]){
            f=1;
        }
        else{
            printf("%d",l);
            return 0;
        }

    }
    for(int i=0;i<l;i++){
        s.insert(b[i]);
    }
  if(s.size()==1){
        cout<<0;
    }
    else{
        if(f==1){
            cout<<l-1;
        }
    }

    return 0;
}


#include<stdio.h>
#include<string.h>
char s[100];
int pal(int l){
	int t=l;
	for(int i=0;i<t;i++){
	if(s[i] != s[l-1]){
		return 1;}
		l--;}
	return 0;
}
int check(){
	int l = strlen(s),flag=0;
	flag = pal(l);
	if(flag==0){
		for(int i=0;i<strlen(s);i++){
		flag=pal(l);
		if(flag == 0){
			l--; }
		else{
			printf("%d\n",l);
			return 0;} } }
	else{
		printf("%d\n",l); }
	if(l==0){
		printf("0\n");}
	return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
    char s[50];
    int i=0,l,c=0,c1=0;
    scanf("%s",s);
    l=strlen(s);
    for(i=0;i<l/2;i++)
    {
        if(s[0]==s[i])
            c1++;
    }
    switch(c1)
    {case l:
        {printf("0");
        break;}
    }
    for(i=0;i<l/2;i++)
    {
        if(s[i]==s[l-i-1]);
        else
            c++;
    }
    if(c==0)
        printf("%d",l-1);
    else
        printf("%d",l);
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
char s[50];
scanf("%s",&s);
int n,flag=0,flag1=0;
n=strlen(s);
for(i=0;i<(l/2);i++)
{
	if(s[i]!=s[n-i-1])
	{
		flag=1;
	}
	else if(s[0]!=s[i+1])
	{
		flag1=1;
	}
	else
	{
		flag=0;
	}
}
if(flag==1)
	printf("%d",n);
else if(flag1==1)
	printf("%d",(n-1));
else
	printf("0");
}


#include<stdio.h>
#include<string.h>

using namespace std;

int main()
{
    char s[51],x[51];
    int z=0,p=1;
    gets(s);
    strcpy(x,s);
    int l=strlen(s);
    strrev(x);
    if(strcmp(x,s)!=0)
    {
        printf("%d\n",l);
        z=1;
    }
    else
    {
        while(1)
        {
            int i;
            for(i=0;i<l-p;i++)
            {
                s[i]=s[i+1];
            }
            s[i]='\0';
            strcpy(x,s);
            strrev(x);
            if(strcmp(s,x)!=0)
            {
                printf("%d\n",l-p);
                z=1;
                break;
            }
            else if(strlen(s)==1)
            {
                printf("0\n");
                z=1;
                break;
            }
            p++;
        }
    }
    return 0;
}


#include <stdlib.h>
#include <stdio.h>

int main(void) {

    int c;
    ptrdiff_t n;

    register ptrdiff_t i = 0;
    register int c0 = 0;

    while ((c = getchar()) && c != 10)
        n = n * 10 + c - 48;

    char* s = malloc(n * sizeof(char));

    while (i < n) {
        if (c == 48)
            c0 += 1;
        s[i++] = getchar();
    }

    if (n - c0 != c0) {
        putchar(50);
        putchar(10);
        putchar(*s);
        putchar(32);
        for (i = 1; i < n; i += 1) {
            putchar(*(s + i));
        }
    } else {
        putchar(49);
        putchar(10);
        for (i = 0; i < n; i += 1) {
            putchar(*(s + i));
        }
    }

    return 0;
}


#include<iostream>
#include<string>
using namespace std;
string s;
int compare(string a)
{
	int o=0,z=0;
	for(int i=0;i<a.size();i++){
		if(a[i]=='0'){
			z++;
		}
		if(a[i]=='1'){
			o++;
		}
	}
	if(o==z)return 0;
	else return 1;
}
int main()
{
	int n;
	scanf("%d",&n);
	cin>>s;
	if(compare(s)==1){
		cout<<1<<endl;
		cout<<s<<endl;
	}
	else{
		string a,b;
		for(int i=1;i<s.size();i++){
			a=s.substr(0,i);
			b=s.substr(i,s.size()-i);
			if(compare(a)==1&&compare(b)==1&&a!=b){
				break;
			}
		}
		cout<<2<<endl;
		cout<<a<<" "<<b<<endl;
	}
}


#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
/*kneau reeves*/
int main() {
	int n,s1=0,s2=0,i;
	char ch[100];
	char sh[100];
    scanf("%d",&n);
    scanf("%s",ch);
	for (i=0;i<n;i++) {
		if (ch[i]='0')
		    s1+=1;
		else
		    s2+=1;
	}
	if (s1==s2)
	{

	  sh[1] = ch[n-1];
	  ch[n-1]='\0';
	  printf ("2\n%s",ch);
	  printf ("%c",sh);
}
    else
        printf("1\n%s",ch);
	return 0;


#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    int zero=0,one=1;
    int i=0;
    char string[n];
    while(i<n){
        scanf("%c",&string[i]);
        if(string[i]-'0'==0)
            zero++;
        else
            one++
    }
    if(zero!=one)
    {
        printf("1\n");
        printf("%s",string);
    }
    else if((n/2)%2==0)
    {
        printf("2\n");
        printf("%c ",string[0]);
        int i=1;
        while(i<n)
        {
            printf("%c",string[i]);
            i=i+1;
        }
    }
    else if((n/2)%2==1)
    {
        int i=0;
        while(i<=n/2)
        {
              printf("%c",string[i]);
              i=i+1;
        }
        printf(" ");
        while(i<=n)
        {
              printf("%c",string[i]);
              i=i+1;
        }
    }
return 0;
}


int main()
{
    int n,m,i,zero,one;

    scanf("%d",&n);

    char ch[200];
    char ch1[200];

   printf("donner une chaine binaire :\n");
   scanf ("%s",ch);

    one=0;
    zero=0;
    for (i=0;i<n;i++){
       if (ch[i]=='0')
         one+=1;
        else  if (ch[i]=='1')
          zero+=1;
    }
    if (zero == one )
    {
        ch1 = ch[n-1];
        ch[n-1]='\0';
        printf ("2\n%s" , s);
        printf("%c",q);
    }
    else
    printf("1\n%s" ,s)
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<math.h>
using namespace std;
long long d(long long n)
{
    long long ans=0;
    for(int i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            if(i==sqrt(n))
                ans++;
            else
                ans+=2;
        }
    }
    return ans;
}
int main()
{
    long long  a,b,c;
    scanf("%lld%lld%lld",&a,&b,&c);
    long long sum=0;
    for(int i=1;i<=a;i++)
    {
       for(int j=1;j<=b;j++)
        {
            for(int k=1;k<=c;k++)
            {
             sum+=d(i*j*k);
             sum%=1073741824;

            }

        }
    }
    printf("%lld\n",sum);
}


#include<bits/stdc++.h>

using namespace std;

typedef long int ld;
typedef long long int lld;
typedef float f;
typedef double lf;
typedef unsigned int u;
typedef unsigned long int lu;
typedef unsigned long long int llu;
typedef char C;

#define sf scanf
#define pf printf
#define PI acos(-1.0)
#define sq(x) (x)*(x)
#define FOR(i,x,cases) for(i=x;i<cases;i++)
#define FORC(i,x,cases) for(i=x;i<=cases;i++)
#define FORin(i,cases,x) for(i=cases;i>=x;i--)
#define nn printf("\n")
#define chk printf("chek\n")
#define chk1 printf("chek1\n")
#define size 1000000
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

/******   start your code   *******/
int divisor[size+1];
void total_divisor()
{
    int i,j;
    for(i=1;i<=size;i++)
        for(j=i;j<=size;j+=i)
         divisor[j]++;
}
int main()
{
    total_divisor();
    int num1,num2,num3,i,j,k,count,total,store;
    while(sf("%d%d%d",&num1,&num2,&num3)==3)
    {
        count=0;
        for(i=1; i<=num1; i++)
            for(j=1; j<=num2; j++)
                for(k=1; k<=num3; k++)
                {
                    //total=i*j*k;
                    count+=divisor[i*j*k];
                    //pf("%d %d %d count = %d\n",i,j,k,store);
                }
        pf("%d\n",count);
    }
    return 0;
}


#include <stdio.h>
#include <math.h>
#define max 1000000
int ar[1000000];

int main()
{
    divison ();
    int i,j,k;
    int a,b,c,sum,d;
  for(i=1;i<=max;i++)
    {
     for(j=i;j<=max;j+=i)
     {
       ar[j++];
       }
      }
     }
    while(scanf("%d%d%d",&a,&b,&c)==3)
    {
     sum=0;
     for(i=1;i<=a;i++)
     {
      for(j=1;j<=b;j++)
      {
       for(k=1;k<=c;k++)
       {
        d=i*j*k;
        sum+=ar[d];
       }
      }
     }
     printf("%d\n",sum%1073741824);
    }
    return 0;
}


a, b, c = map(int, raw_input().split())
d = {}
ans = 0
d[1] = 1
for ai in xrange(1, a + 1):
    for bi in xrange(1, b + 1):
        for ci in xrange(1, c + 1):
            i = ai * bi * ci
            if i not in d:
                sqi = i ** 0.5
                d[i] = sum(2 if j != sqi else 1 for j in xrange(2, int(sqi) + 1) if i % j == 0) + 2
            ans += d[i]
print ans % 1073741824


#include <stdio.h>
#include <stdlib.h>
#pragma warning(disable:4996)

int* nums;
int** index;

bool checkSubMatrix(int start, int end);

int main()
{
	int num;

	scanf("%d", &num);

	nums = (int*)malloc(sizeof(int)*num);

	for (int i = 0; i < num; i++)
		scanf(" %d", &nums[i]);

////////////////////////////////////////////////////

	if (num == 1)
	{
		printf("NO\n");
		return 0;
	}
	else
	{

		index = (int**)malloc(sizeof(int*)*num);
		for (int i = 0; i < num; i++)
			index[i] = (int*)malloc(sizeof(int) * 2);

		for (int i = 2; i <= num; i++)
		{
			/* Initialization */
			for (int j = 0; j < i; j++)
			{
				index[j][0] = j;
				index[j][1] = j;
			}

			index[i - 1][1] = num - 1;

			/* Verification */
			while (index[0][1] != num - 2)
			{
				int subOK;
				for (int j = 0; j < i; j++)
				{
					subOK =	checkSubMatrix(index[j][0], index[j][1]);
					if (!subOK)
						break;
				}

				if (subOK)
				{
					printf("YES\n");
					printf("%d\n", i);
					for (int k = 0; k < i; k++)
						printf("%d %d\n", index[k][0] + 1, index[k][1] + 1);
					return 0;
				}

				for (int j = i - 1; j >= 0; j--)
				{
					if (index[j][0] == index[j][1])
						continue;
					else
					{
						index[j][0]++;
						break;
					}
				}
			}

		}
	}

	printf("NO\n");
	return 0;
}

bool checkSubMatrix(int start, int end)
{
	int sum = 0;
	for (int i = start; i <= end; i++)
	{
		sum += nums[i];
	}

	if (sum == 0)
		return false;
	else
		return true;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="yash" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/yash" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/yash" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
		</Compiler>
		<Unit filename="main.c">
			<Option compilerVar="CC" />
		</Unit>
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include "stack.h"
#define MAX_STACK	100

typedef enum { false, true } bool;
typedef int Data;

typedef struct {
	Data items[MAX_STACK];
	int top;
} Stack;

// Make stack empty.
void InitStack(Stack *pstack);

// Check whether stack is full.
bool IsFull(Stack *pstack);

// check whether stack is empty
bool IsEmpty(Stack *pstack);

// Read the item at the top.
Data Peek(Stack *pstack);

// Insert an item at the top.
void Push(Stack *pstack, Data item);

// Remove the item at the top.
void Pop(Stack *pstack);

int main() {
	Stack stack, result;
	int size, tmp, prev, cnt = 0;
	scanf("%d", &size);
	int *arr = (int *)malloc(sizeof(int) * size);
	for (int i = 0; i < size; i++)
		scanf("%d", &arr[i]);

	if (size == 1 && arr[0] == 0) {
		printf("NO\n");
		free(arr);
		return 0;
	}

	InitStack(&stack);
	InitStack(&result);

	for (int i = 1; i <= size; i++) {
		if (arr[i] != 0) {
		Push(&stack, i);
		cnt++;
		}
	}
	for (int i = 0; i < cnt; i++) {
		tmp = Peek(&stack);
		Push(&result, tmp);
		Pop(&stack);
	}

	printf("YES\n");
	for (int i = 0; i < cnt; i++) {
		tmp = Peek(&result);
		if (i == 0)
			printf("1  %d\n", tmp);
		else if (i != cnt - 1)
			printf("%d  %d\n", prev + 1, tmp);
		else
			printf("%d  %d\n", prev + 1, size);
		prev = tmp;
		Pop(&result);
	}

	free(arr);
	return 0;
}

/************test***********
11
1 0 0 1 1 1 0 0 0 1 0

yes
1 3
4 4
5 5
6 9
10 11
****************************/


#include <stdio.h>
#include <string.h>
char s1[101] = {0},s2[101] = {0},vir[101] = {0},ans[101][101][101] = {0},ansans[101] = {0},maxans = 0;
int f[101][101] = {0},len1,len2,lenv;
int cmp(char *sa,char *sb)
{
    int i,cnt = 0;
    for(i=0;sa[i]&&sb[i];i++) if(sa[i] == sb[i]) cnt++;
    return cnt;
}
int work(char c)
{
    short swi = 0;
    int i,j;
    for(i=1;i<=len1;i++)
    {
        for(j=1;j<=len2;j++)
        {
            if(s1[i-1] == s2[j-1])
            {
                if(s1[i-1]!=c&&s2[j-1]!=c) if(!swi)
                {
                    swi = 1;
                    continue;
                }
                f[i][j] = f[i-1][j-1] + 1;
                memcpy(ans[i][j],ans[i-1][j-1],sizeof(ans[i][j]));
                ans[i][j][f[i][j]-1] = s1[i-1];
                if(cmp(ans[i][j],vir) != lenv) continue;
            }
            if(f[i-1][j]>f[i][j-1])
            {
                memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));
                f[i][j] = f[i-1][j];
            }
            else if(f[i-1][j]<f[i][j-1])
            {
                memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));
                f[i][j] = f[i][j-1];
            }
            else
            {
                if(cmp(ans[i-1][j],vir)>cmp(ans[i][j-1],vir))
                {
                    memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));
                    f[i][j] = f[i][j-1];
                }
                else
                {
                    memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));
                    f[i][j] = f[i-1][j];
                }
            }
        }
    }
    if(f[len1][len2]>maxans)
    {
        memcpy(ansans,ans[len1][len2],sizeof(ansans));
        maxans = f[len1][len2];
    }
}
int main()
{
    int i;
    scanf("%s%s%s",s1,s2,vir);
    len1 = strlen(s1);
    len2 = strlen(s2);
    lenv = strlen(vir);
    work('a');
    for(i=0;i<lenv;i++) work(vir[i]);
    if(maxans) printf("%s",ansans);
    else printf("0");
    return 0;
}


#include <stdio.h>
#include <string.h>
char s1[101] = {0},s2[101] = {0},vir[101] = {0},ans[101][101][101] = {0},ansans[101] = {0},maxans = 0;
int f[101][101] = {0},len1,len2,lenv;
int cmp(char *sa,char *sb)
{
    int i,j,cnt = 0;
    for(i=0;sa[i];i++)
    {
        if(sa[i] == sb[0])
        {
            for(j=0;sb[j];j++)
            {
                if(sa[i+j] == sb[j]) cnt++;
            }
        }
    }
    return cnt;
}
int work(char c)
{
    short swi = 0;
    int i,j;
    for(i=1;i<=len1;i++)
    {
        for(j=1;j<=len2;j++)
        {
            if(s1[i-1] == s2[j-1]&&s1[i-1] != c&&s2[j-1] != c)
            {
                f[i][j] = f[i-1][j-1] + 1;
                memcpy(ans[i][j],ans[i-1][j-1],sizeof(ans[i][j]));
                ans[i][j][f[i][j]-1] = s1[i-1];
                if(cmp(ans[i][j],vir) != lenv) continue;
            }
            if(f[i-1][j]>f[i][j-1])
            {
                memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));
                f[i][j] = f[i-1][j];
            }
            else if(f[i-1][j]<f[i][j-1])
            {
                memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));
                f[i][j] = f[i][j-1];
            }
            else
            {
                if(cmp(ans[i-1][j],vir)>cmp(ans[i][j-1],vir))
                {
                    memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));
                    f[i][j] = f[i][j-1];
                }
                else
                {
                    memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));
                    f[i][j] = f[i-1][j];
                }
            }
        }
    }
    if(f[len1][len2]>maxans)
    {
        memcpy(ansans,ans[len1][len2],sizeof(ansans));
        maxans = f[len1][len2];
    }
}
int main()
{
    int i;
    scanf("%s%s%s",s1,s2,vir);
    len1 = strlen(s1);
    len2 = strlen(s2);
    lenv = strlen(vir);
    work('a');
    for(i=0;i<lenv;i++) work(vir[i]);
    if(maxans) printf("%s",ansans);
    else printf("0");
    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    int x,count=0,i;
    long long int x;
    scanf("%lld",&x);
    for(i=1;i<100;i++)
    {
        if(pow(2,i)>x)
        {
            i--;x=x-pow(2,i);count++;break;
        }
    }
    for(i=i;i>=0;i--)
    {
        if(pow(2,i)<x)
        {
            x=x-pow(2,i);
            count++;
        }
        if(x==1)
        {
            count++;break;
        }
    }
printf("%lld",count);
return 0;
}


#include<stdio.h>
int main(){
     int n,a=0;
    scanf("%d",&n);
    while(n>0){
        if(n%2==1){
            x++;
            n--;
        }
        else{
            n/=2;
        }
    }
    printf("%d",a);
    return 0;
}


#include <stdio.h>

int main()
{
    int x, count, i;
    scanf("%d", &x);
    while(x!=0){
        if(x%2==1){
            count++;
            x--;
            x=/2;
        } else {
            x=/2;
        }
    }
    fprintf(stdout, "%d", count);
    fclose(stdout);
    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    int x,res=0,m;
    int ans=0;
    int po,closest_pow_oftwo,res;
    scanf("%d",&x);
    if((x^(x-1))==0)      // we check whether a given number is exactly a power of 2 or not by checking whether the XOR of num and num-1 =0  or not
    {
        printf("1");
    }
    else
    {
        while(x > 0) {
            m = 1;
            while(2*m <= n)
                m *= 2;
            res++;
            x =x-m;
        }
        printf("%d",res);
    }

    return 0;
}


#include<iostream>
#include<algorithm>
#include<string.h>
#include<stack>
#include<string>
#include<stdio.h>
using namespace std;

typedef long long LL;
const int SIZE=20;
const LL MOD=1000000007;

int main()
{
	int x,y;
	scanf("%d%d",&x,&y);
		int n;
		cin>>n;
		int a[10];
		a[1]=( (y-x)%MOD + MOD )%MOD;
		a[2]=( (-x)%MOD + MOD )%MOD;
		a[3]=( (-y)%MOD + MOD )%MOD;
		a[4]=((-y+x)%MOD + MOD )%MOD;
		a[5]=( (x)%MOD + MOD )%MOD;
		a[0]=( (y)%MOD + MOD )%MOD;
		printf("%d\n",a[(n-2)%6]);

	return 0;
}


 copy
#include <stdio.h>
long long m=1000000007;
int main(void) {
	// your code goes here
	long long n,x,y,h,t,c;
	scanf("%lld %lld %lld", &x,&y,&n);
	t=y-x;

	if(n%3==0)
	{ c=n/3;
	   if(c%2==0)
	   h=-t;
	   else
	   h=t;}

	if(n%3==1)
	{ c=n/3;
	   if(c%2==0)
	   h=x;
	   else
	   h=-x;}
	   if(n%3==2)
	{ c=n/3;
	   if(c%2==0)
	   h=y;
	   else
	   h=-y;}
	   if(h<0)
	printf("%lld", m-((-1*h)%m));
	else
	printf("%lld", h%m);
	return 0;
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

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

/*int cmp1(const void *a ,const void * b)
{
 return (*(double *)a>*(double * )b?1:-1);
}*/
/*int gcd(int a,int b)
{
    return b ? gcd(b,a%b) : a;
}*/
long long a[200000008] = {0};
int main()
{
    long long n,i;
    scanf("%I64d %I64d",&a[1],&a[2]);
    scanf("%I64d",&n);
    for(i = 3; i <= n; i++)
    {
        a[i] = a[i-1] - a[i-2];
    }
    printf("%I64d",a[n] % 1000000007 > 0 ? a[n] % 1000000007:a[n] + 1000000007);
    return 0;
}


#include<stdio.h>
int main()
{
 int n,x,p;

 if(n%2==0)
 x=(n+1);
 printf("%d",x);
 else
 p=(n+1)/2;
 printf("%d",p);
}


main()
{long long int i,k,;scanf("%I64d",&i);
k=i+1;if (k%2==0) printf("I64%d",k/2);else printf("%I64d",k);
}


#include <stdio.h>

int main()
{
    int n, x;
    scanf("%d", %n);
    if (n%2 == 0)
    {
        x = n+1;
        printf("%d", x);
    }
    else
    {
        x = (n+1)/2;
        printf("%d", x);
    }
    return 0;
}


#include<stdio.h>
long long main()
{
  long long n;
  scanf("%lld",&n);
  if(n==0)
  {
  printf("%lld",n)
  }
  else
  {
  if((n+1)%2==0)
  {
   printf("%lld",(n+1)/2);
  }
  else
  {
  printf("%lld",n+1);
  }
  };
  return 0;
  }


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int verif(char *ch,char *mdp)
{ char cha[3]; int i,a=0;
    for(i=0;i<strlen(ch)-1;i++)
    {strncpy(cha,ch+i,2);
     cha[2]='\0';

     if(strcmp(cha,mdp)==0) a=1;
    }
     return a;
}
int main()
{
int n,i,j;

scanf("%s",mdp);
scanf("%d",&n);
char t[n][3]; char mdp[3]; char *ch;

for(i=0;i<n;i++)
{
    scanf("%s",t[i]); }

int test=0;
for(i=0;i<n;i++)
{

strcpy(ch,t[i]);

for(j=0;j<n;j++)
{   strcpy(ch,t[i]);
    strcat(ch,t[j]);

if(verif(ch,mdp)==1) test=1;
}

}
if (test==1)
printf("YES");
else printf("NO");
return 0;
}


ㅚ#include <stdio.h>

char passwd[4], str[4];
int main(){
  scanf("%s", passwd);

  int T, num=0, chk=0;
  scanf("%d", &T);
  while (T--) {
    scanf("%s", str);
    if (str[0]==passwd[0] && str[1] == passwd[1])
      chk=4;
    else if (str[1]==passwd[0] && str[0]==passwd[1])
      chk=4;
    else if (str[0]==passwd[1]){
      if (chk<4){
        if (chk==1) chk=4;
        else chk=2;
      }
    }
    else if (str[1]==passwd[0]){
      if( chk<4) {
        if (chk==2) chk=4;
        else chk=1;
      }
    }
  }

  if (chk==4) printf("YES\n");
  else printf("NO\n");

}


#include <stdio.h>
#include <string.h>

int main()
{

	int n;
	char input[3];
	char parola[3];

	scanf("%s", input);
	scanf("%d", &n);

	//char parole[n][3];
	int prima=0, seconda=0;

	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s", parola);
		if(strcmp(input, parola)==0)
		{
			printf("YES");
			return 0;
		}

		if(input[1]==parole[i][0])
		{
			seconda=1;
		}

		if(input[0]==parole[i][1])
		{
			prima=1;
		}

		if(prima==1 && seconda==1)
		{
			printf("YES");
			return 0;
		}

	}

	printf("NO");

}


#include<stdio.h>
int main()
{
	bool x=false,y=false;
	int i,n,flag=0;
	char a[10],b[10];
	scanf("%s%d",&a,&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",&b);
		if(b[1]==a[1]&&b[0]==a[0])
		{
			printf("YES");
			return 0;
		}
		if(b[0]==a[1])x=true;
		if(b[1]==a[0])y=true;
		if(x&&y)
		{
			printf("YES");
			return 0;
		}
	}
	printf("NO");
    return 0;
}


#include<stdio.h>
using namespace std;
int main()
{
	bool x=false,y=false;
	int i,n,flag=0;
	char a[10],b[10];
	cin>>a>>n;
	for(i=1;i<=n;i++)
	{
		cin>>b;
		if(b[1]==a[1]&&b[0]==a[0])
		{
			cout<<"YES";
			return 0;
		}
		if(b[0]==a[1])x=true;
		if(b[1]==a[0])y=true;
		if(x&&y)
		{
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
    return 0;
}


#include <stdio.h>
#include <malloc.h>

int main()
{
	int amount;
	scanf( "%d", &amount );

	int result;

	if( amount <= 0 )
		result = 0;
	int d;
	else
	{
		int *array;
		array = ( int * )malloc( amount * sizeof( int ) );

		int i = 0;
		for( ; i < amount; i++ )
		{
			scanf( "%d", &array[ i ] );
		}

		i = 0;

		for( ; i < amount; i++ )
		{
			if( array[ i ] == 1 )
				break;
		}

		if( i == amount )
			result = 0;

		else
		{
			result = 1;
			int variants = 1;
			for( ; i < amount; i++ )
			{
				if( array[ i ] == 0 )
					++variants;
				else
				{
					result *= variants;
					variants = 1;
				}
			}
		}
		free( array );
	}

	printf( "%d\n", result );

	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main (int argc, char* argv[])
{

    int s=1;
    int m=0;
    int x;
    int i,j,a;
    int* memoire = NULL;
    scanf("%d",&x);
    memoire = xmalloc(x*sizeof(int));
    for (a=0,i=0;i<x;i++)
    { scanf("%d",&memoire[i]);
        if(memoire[i]==1)
        {
            a=1;break;
        }
    }
    if(a==1)
    {
        for(j=i+1;j<x;j++)
    {
        scanf("%d",&memoire[j]);
        m=m+1;
        if (memoire[j]==1)
            {
                s=s*m;
                m=0;

            }
    }
    free(memoire);
    }
    else s=0;
    printf("%d",s);
     return(0);

}


#include<stdio.h>

int main()
{
    int n,l=-1,r=0,z=0;
    scanf("%d",&n);
    ll ar[n],cnt[n],scnt=0;
    for(int i=0;i<n;i++)
    scanf("%lld",&ar[i]);
    for(int i=0;i<n;i++)
    {
    if(ar[i]==1)
    {
    l=i;
    break;
    }
    }
    for(int i=n-1;i>l;i--)
    {
    if(ar[i]==1)
    {
    r=i;
    break;
    }
    }
    if(l==-1)
    printf("0");
    else
    {
    if(r==0)
    printf("1");
    else
    {
    for(int i=l+1;i<=r;i++)
    {
    if(ar[i]==1)
    {
    cnt[z++]=scnt+1;
    scnt=0;
    }
    else
    scnt++;
    }

    ll mv=1;
    for(int i=0;i<z;i++)
    mv*=cnt[i];
    printf("%lld",mv);
    }
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main (int argc, char* argv[])
{

    int s=1;
    int m=0;
    int x;
    int i;
    int* memoire = NULL;
    scanf("%d",&x);
    memoire = malloc(x*sizeof(int));
    for (i=0;i<x;i++)
    {
        scanf("%d,&memoire[i]")
        m=m+1;
        if (memoire[i]==1)
            {
                s=s*m;
                m=0;

            }
    }
    printf("%d",s);
    free(memoire);
     return(s);

}


#include <stdio.h>
#include <stdlib.h>
#include<string.h>

int main (int argc, char* argv[])
{
    int s=1;
    int m=0;
    int i;
    for (i=2;i<argc-1;i++)
    {m=m+1;
    if (strchr(argv[i],'1')>=O)
    {s=s*m;
    m=0;}
    }printf("%d",s);
     return(0);
     }


#include <cstdio>

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    if (n != 0 || m == 0)
    {
        printf("%d %d\n", (m > n ? m : n), (m != 0 ? n + m - 1 : n));
    }
    else
    {
        printf("Impossible\n");
    }
    return 0;
}


#include<stdio.h>
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    if(n){
        printf("%d %d",n+(0>m-n?0:m-n),n+((0>m-1?0:m-1));
    }else{
        printf("Impossible");
    }
    return 0;
}


#include<stdio.h>
int main()
{
	int n,m,max,min;
	scanf("%d %d",&n,&m);
	if(n==0 && m!=0)
	printf("Impossible");
	else
	{
		if(n>=m)
		min=n;
		else
		min=m;
		if(m==0)
		max=n;
		else
		max=n+m-1;
		printf("%d %d",mn,max);
	}
	return 0;
}


#include<stdio.h>

int main()
{
int n,m;
 scanf("%d%d",&n,&m);
    if(n==0)
     printf("Impossible");
     else
 { if(n>=m)
   {if(m==0)
     printf("%d %d",n,n)
   else
    printf("%d %d",n,n+m-1);}
  else
    printf("%d %d",m,n+m-1);
    }

     return 0;
     }


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int
main (int argc, char *argv[])
{

  int n, m;
  int min, max;

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

  if (n == 0)
    {
      if (m > 0)
	printf ("Impossible");
      else
	print ("0 0");
    }
  else
    {
      if (n >= m)
	min = n;
      else
	min = m;
      if (m > 0)
	max = n + m - 1;
      else
	max = n;
      printf ("%d %d", min, max);
    }
  return 0;
}


#include<stdio.h>
int main()
{
    int n,i,c=0,d,k;
    scanf("%d",&n);
    char s[n];
      scanf("%s",s);
        d=n/11;

        for(i=0; i<n; i++)
        {

            if(s[i]=='8')
                c++;
        }

        if(c!=0 && d>c){
            printf("%d\n",c);
        }
        else if(c>=d && c!=0)
            printf("%d\n",d);
        else
        printf("0\n");


#include<stdio.h>
int x,z,i;std::char[100] y;main(){printf("%d %s",x,y);for(i=0;i<x;i++)if(y[i]=='8')z++;if(x/11<z)printf("%d",x/11);else printf("%d",z);}


#include<stdio.h>
#include<string.h>

int main()
{
    int i,n,k,count=0;

    char s[1000];

    scanf("%d",&n);

    scanf("%s",s);
    if(n<11)
    {
        printf("0\n");
    }

    for(i=0;i<=n;i++)
    {
        if(s[i]=='8')
        count++;
    }
    k=n/11;

    if(count/k>1)
    {
        printf("%d\n",k);
    }
    else
        printf("%d\n",count);

}


#include <stdio.h>
int main()
{
    int flag=0,p,empty[0];
    char n,i,j;
    scanf("%d",&n);
    gets(empty);
    char a[n];
    gets(a);
    p=strlen(a);

    for(i=0,j=n-1;i<n,j>0;i++,j--)
    {
        if(a[i] == '8' || a[j] == '8')
        flag=1;
        break;
    }
    if(flag == 1 && a[0]== a[i] || a[0]==a[j])
        {
            printf("%d",p/11);
        }
    else
        printf("0");
return 0;
}


#include<stdio.h>
int main(){
    int n,
    scanf("%d",&n);
    if(n==4 && n==7){
        printf("Yes\n");
        else
        printf("No\n");
    }
}


#include<stdio.h>
#include<stdlub.h>
int main(){
	long long n;
	scanf("%lld",&n);
	while(n){
		s=n%10;
		n /=10;
		if(s==4 || s==7)	c++;
	}
	while(c){
		p=c%10;
		c /=10;
		if(p!=4 && p!=7) 	c2++;
		if(c2>0){
			printf("NO");
			break;
		}
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
int main(void)
{
long long int k;
int i,n,count=0,j;
j=(int)malloc(sizeof(k));
long long char lucky[10000];
scanf("%s",lucky);
n=strlen(lucky);
for(i=0;i<n;i++)
{
if (lucky[i]=='4'||lucky[i]=='7') count++;

}
if (count==4||count==7)
printf("yes\n");
else printf("no\n");

return 0 ;
}


#include <stdio.h>
#include <string.h>
int main()
{
	char num[19];
	scanf("%s",&num);
	int len=strlen(num),i,count=0;
	for(i=0 ; i<len ; i++){
		if(num[i]=='7'||num[i]=='4') count++ ;
	}
	else if(count='4' || count=='7') printf("YES\n");
	else printf("NO\n");
	return 0;
}


#include<stdio.h>
#include<string.h>
int main (){
    int p,q,i,n;
    int c=0;
    for(i=1;i<n;i++){
        scanf("%d%d",&d,&q);
        if((q-p)>=2)
        c++
    }
    printf("%d",c);
}
return 0;


include<stdio.h>
int main()
{
	int n,d,h;
	scanf("%d%d",&n,&d);
	h=8-d;
	switch (n)
	{
		case 1:case 3:case 5:case 7: case 8:case 10:case 12: if (
			(31-h)%7==0)
			{
				printf ("%d",(31-h)/7+1);
			}
			else printf ("%d",(31-h)/7+2);
			;break;weekday of the first date of this month (
			case 2: if ((28-h)%7==0)
			{
				printf ("%d",(28-h)/7+1);
			}
			else printf ("%d",(28-h)/7+2);
			break;
			case 4:case 6:case 11: if ((30-h)%7==0)
			{
				printf ("%d",(30-h)/7+1);
			}
			else printf ("%d",(30-h)/7+2);
			break;
}
return 0;
}


#include<stdio.h>
int main()
{
	int n,d,h;
	scanf("%d%d",&n,&d);
	h=8-d;
	switch (n)
	{
		case 1:case 3:case 5:case 7: case 8:case 10:case 12: if (
			(31-h)%7==0)
			{
				printf ("%d",(31-h)/7+1);
			}
			else printf ("%d",(31-h)/7+2);
			;break;weekday of the first date of this month (
			case 2: if ((29-h)%7==0)
			{
				printf ("%d",(29-h)/7+1);
			}
			else printf ("%d",(29-h)/7+2);
			break;
			case 4:case 6:case 11: if ((30-h)%7==0)
			{
				printf ("%d",(30-h)/7+1);
			}
			else printf ("%d",(30-h)/7+2);
			break;
}
return 0;
}


#include<stdio.h>
int main()
{

    int m,d;
    scanf("%d%d",m,d);
    int mday=0;
    switch(d)
    {
        case 1:mday=31;break;
        case 2:mday=28;break;
        case 3:mday=31;break;
        case 4:mday=30;break;
        case 5:mday=31;break;
        case 6:mday=30;break;
        case 7:mday=31;break;
        case 8:mday=31;break;
        case 9:mday=30;break;
        case 10:mday=31;break;
        case 11:mday=30;break;
        case 12:mday=31;break;
    }
    prinf("%d",(d-1)+mday%7==0? (d-1)+mday/7:((d-1)+mday/7)+1);
    return 0;
}


#include<stdio.h>
struct year {
	int days;
};
int main(void)
{
	struct year month[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
	int m, d,t,out;

	scanf_s("%d%d", &m, &d);
	t = month[m].days-(7 - d + 1);
	if (t % 7 == 0)
		printf("%d", t / 7 + 1);
	else
		printf("%d", t / 7 + 2);

	return 0;
}


#include<stdio.h>
int main()
{
 int n,x;
 scanf("%d",&n);
 x=25
 printf("%d",x);
}


#include<stdio.h>
#include<math.h>
int main()
{
    char aj[100];
    long long int x,y,b;
    scanf("%lld",&x);
    if(x==1)
      t=5
    else
   {
   y=pow(5,x);
    t=y+1
}
sprintf(aj,"%d",t);
b=strlen(aj);
printf("%c%c",aj[b-2],aj[b-1]);

}


#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
long long int n,k,k1,k2;
scanf("%lld",&n);
k=pow(5,n);
if(k<=25)
    printf("%lld\n",(k+1);
else
{
    k1=k%10;
    k=k/10;
    k2=k%10;
    k=(k2*10)+k1;
    printf("%lld\n",(k+1);
}
    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    int n,s;
    scanf("%d",&n);
    s = pow(5,n);
    printf("%d",s);
    return o;
}


#include<stdio.h>
#include<string.h>
    int main()
{
   int i,j=0,n;
   char s[50];
   scanf("%d",&n);
   scanf("%s",&s)
    for(i=0;i<n-1;i++)
    {
        if(s[i]==s[i+1])
        {
            j++;
        }
    }
    printf("%d",j);
    return 0;
}


#include <string.h>
int main() {
    char katar[50];
    int sayac=0,i;
    gets(katar);
    while(strstr(katar,"RR") || strstr(katar,"GG") || strstr(katar,"BB")) {
        sayac++;
        katar+=1;
    }
    printf("%d",sayac);
}


#include <stdio.h>
void main()
{
    int n,count=0;
    scanf("%d",&n);
    char s[];
    scanf("%s",&s);
    for(int i=0;i<n;i++)
    {
        if(s[i]==s[i+1])
            count+=1;
    }
    printf("%d",count);
}


#include<stdio.h>
int main(){
    int t,c=0,i;
    char a[50];
    scanf("%d",&t);
    scanf("%s",a);
    for(i=0;i<t-1;i++){
        if(a[i]==a[i+1])
        c++;
    }
    printf("%d\n",c)
    return 0;
}


#include<stdio.h>
#include<string.h>
int main() {
  int n,i;
   scanf("&d\n",&n);
   char s[n];
   for(i=0;i<n;i++)
   {
       scanf("%s",s[i++])
   }
int len =strlen(s);
  int ans = 0;
  for (i = 0; i < len-1; i++) {
    if (s[i] == s[i+1]) ans++;
  }
  printf("\n%d",ans);
    return 0;
}


#include<stdio.h>
int main()
{
    int d,sumTime,minTime=0,maxTime=0;
    scanf("%d %d",&d,&sumTime);
    int a[d],b[d];
    for(int i=0;i<d;i++)
    {
        scanf("%d %d",&a[i],&b[i]);
        minTime+=a[i];
        maxTime+=b[i];
    }
    if(sumTime<=maxTime && sumTime=>minTime)
    {
        printf("YES\n");
    }
    else
        printf("NO\n");

    return 0;
}


#include<stdio.h>
int main()
{
    int d,sum,min[30],max[30],avail[30],allot[30],i,summ=0;
    scanf("%d %d",&d,&sum);
    int toallot=sum,alloted=0;
    for(i=0;i<d;i++)
    scanf("%d %d",&min[i],&max[i]);
    for(i=0;i<d;i++)
    summ+=max[i];
if(summ<sum)
printf("NO");
else if (summ==sum)
{
for(i=0;i<d;i++)
allot[i]=max[i];
printf("YES\n");
for(i=0;i<d;i++)
printf("%d ",allot[i]);
}
else
{
for(i=0;i<d;i++){
allot[i]=min[i];
alloted+=min[i];
toallot-=min[i];
}
i=0;
while(toallot!=0)
{
if(toallot+min[i]-max[i]>=0)
{
allot[i]=max[i];
alloted=alloted-min[i]+max[i];
toallot=toallot+min[i]-max[i];
}
else
{
allot[i]+=toallot;
}
i++;
}
printf("YES\n");
for(i=0;i<d;i++)
printf("%d ",allot[i]);
}


#include<stdlib.h>
#include<stdio.h>

int main(int argc, char const *argv[])
{
    int d;
    int a=0;
    int sumtime ;
    scanf("%d %d",&d&sumtime);
    int outln2[d];
    int maxtime[d];
    int mintime[d];
    int verdict = 1;
    for(int i = 0;i<d;i++)
    {

        scanf("%d %d ",&mintime[i],&maxtime[i]);

        a += maxtime[i];

    }
    if (a<sumtime)
        {
            verdict = 0;
        }
    if (verdict ==0)
    printf("NO");

    else
    {
        int c = sumtime%d;
        int b = sumtime/d;
        for(int i = 0;i<d;i++)
        {
            outln2[i] = b;
            while (c!=0)
            {
                if (outln2[i]<<maxtime[i])
            {
                outln2[i]+=(maxtime[i]-outln2[i]);
                c-=(maxtime[i]-outln2[i]);
            }
            }
        }

        printf("YES\n");
        for(int i = 0;i<d;i++)
        {
           printf("%d ",outln2[i]);
        }

    }

    return 0;
}


#include <stdio.h>
main()
{
	fflush(stdout);
	int d,sumtime;
	scanf("%d %d",&d,&sumtime);
	int mintime[d],int maxtime[d];
	for(int i=0;i<d;i++)
		scanf("%d %d",&mintime[i],&maxtime[i]);
	int minsum=0,maxsum=0;
	for(int i=0;i<d;i++)
	{
		minsum+=mintime[i];
		maxsum+=maxtime[i];
	}
	if(sumtime<minsum || sumtime>maxsum)
	{
		printf("NO\n");
		fflush(stdout);
	}
	else
	{
		int hours[d];
		for(int i=0;i<d;i++)
		{
			hours[i]=mintime[i];
			sumtime=sumtime-mintime[i];
		}
		while(sumtime>0)
		{
			if(sumtime>=(maxtime[i]-mintime[i]))
			{
				hours[i]+=maxtime[i]-mintime[i];
				sumtime=sumtime-(maxtime[i]-mintime[i]);
			}
			else
			{
				hours[i]+=sumtime;
				sumtime=0;
			}
		}
		for(int i=0;i<d;i++)
			printf("%d ",hours[i]);
		fflush(stdout);

	}
}


#include <stdio.h>
#define SIZE 30

int main ()
{
    int d, sum, min [SIZE], max [SIZE], a [SIZE], count = 0, flag;
    scanf ("%d %d", &d, &sum);
    for (int i = 0 ; i < d; i ++)
    {
        scanf ("%d %d", &min [i], &max [i]);
        a [i] = min [i]
        count += min [i];
    }
    if (count > sum)
        printf ("NO");
    else
    {
        flag = 0;
        for (int i = 0; i < d; i ++)
        {
            if (count - min [i] + max [i] >= sum)
            {
                flag = 1;
                a [i] += sum - count;
                break;
            }
            else
            {
                a [i] = max [i];
                count += max [i] - min [i];
            }
        }
        if (flag)
        {
            for (int i = 0; i < d; i ++)
                printf ("%d ", &a [i]);
        }
    }
}


#include<bits/stdc++.h>
int cmpfun(const void*a,const void*b)
{
	return(*(int*)a-*(int*)b);
}
int main()
{
	int i,j,k,l,m,z=0,w=0,n;int x[10000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&x[i]);
	}
	qsort(a,n,sizeof(int),cmpfun);
	k=a[0];
	x[0]=x[n-1];
	x[n-1]=k;
	for(i=0;i<n;i++)
	{
		printf("%d ",x[i]);
	}
	return 0;
}


#include<stdio.h>
cmpfun(const void*a,const void*b)
{
	return(*(int*)a-*(int*)b);
}
int main()
{
	int i,j,k,l,m,z=0,w=0,n;int x[10000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&x[i]);
	}
	qsort(a,n,sizeof(int),cmpfun);
	k=a[0];
	x[0]=x[n-1];
	x[n-1]=k;
	for(i=0;i<n;i++)
	{
		printf("%d ",x[i]);
	}
	return 0;
}


#include<bits/stdc++.h>
cmpfun(const void*a,const void*b)
{
	return(*(int*)a-*(int*)b);
}
int main()
{
	int i,j,k,l,m,z=0,w=0,n;int a[10000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	qsort(a,n,sizeof(int),cmpfun);
	k=a[0];
	a[0]=a[n-1];
	a[n-1]=k;
	for(i=0;i<n;i++)
	{
		printf("%d ",a[i]);
	}
	return 0;
}


#include<stdio.h>

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

int main()
{
	int n;
	scanf("%d",&n);
	int a[n],i,j;
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	qsort(a,n,sizeof(int),compare);
	j=a[n-1];
	a[n-1]=a[0];
	a[0]=j;
	for(i=0;i<n;i++)
	{
		printF("%d\n",a[i]);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

#define MAX_TESTS 100

int num[MAX_TESTS];
int numTests;
int min = 0;
int max = 0;
int minIndex = 0;
int maxIndex = 0;

void swap(int i, int j){
	if(i == j){
		return;
	}
	num[i] = num[i] ^ num[j];
	num[j] = num[i] ^ num[j];
	num[i] = num[i] ^ num[j];
}

int compare(const void* x, const void* y){
	return *((int*)x) - *((int*)y);
}

int main(void){
	fscanf(stdin,"%d",&numTests);
	fscanf(stdin,"%d",num);
	min = max = num[0];

	for(int i = 1; i < numTests; i++){
		fscanf(stdin,"%d",num + i);
		if(min > num[i]){
			min = num[i];
			minIndex = i;
		}else if(max < num[i]){
			max = num[i];
			maxIndex = i;
		}
	}

	swap(0, maxIndex);
	swap(numTests - 1, minIndex);

	qsort(num + 1, numTests - 2, sizeof(int), &compare);

	for(int i = 0; i < numTests - 1; i++){
		fprintf(stdout,"%d ",num[i]);
	}
	fprintf(stdout,"%d\n",num[numTests - 1]);
return 0;
}


#include <stdio.h>
int main(int argc, char const *argv[])
{
	int a;
	scanf("%d",&a);
	for (int i = 2; i < d; ++i)
	{
		if(a%i == 0){
			printf("%d",i );

		}
	}
	return 0;
}


#include<stdio.h>
int main(){
    int num, i;
    scanf("%d", &num);3
    for(i = 2;i < num;i++){
        if(num % i == 0){
            printf("%d%d\n", i, num/i);
            break;
        }
    }
    return 0;
}


#include <stdio.h>
void main()
{
    int n;
    scanf ("%d",&n);
    for (int i=2;i<=n;i++)
    {
        if (n%i==0)
        {
            printf("%d%d",i,n/i);
            break;
        }
    }
}


#include <stdio.h>

int main(void)
{
    int x, i = 2;

    scanf("%d", &x);

    while(1) if(!(x%i++)) printf("%d%d\n", i-1, x/(i-1));

    return 0;
}


#include<stdio.h>
int main()
{
long long int a,b;
scanf("%lld",&a);
b=(n*(n+1))/2;
if(b%2==0)
{
printf("1");
}
else
{
printf("0");
}
return 0;


#include<stdio.h>
    int sum (int k)
    {
           int sum=0;
           sum=(k*(k+1))/2;
                     if(sum%2==0)
                    {
                       return 0;
                   else
                       return 1;
}

                 int main()
                int k,n;
                 scanf("%d",&k);
                 n=sum(k);
                 printf("%d",n);
                  return 0;

}


include <stdio.h> int main(){  int i, j, k; long int n; scanf("%ld", &n); long int sum = 0; sum = n*(n+1)/2; if(sum%2 == 1) printf("1"); if(sum%2 == 0) printf("0"); return 0; }


#include <stdio.h>
int main(){
int i, j, k;
long int n;
scanf("%ld", &n);
long float sum = 0; sum = n*(n+1)/2;
if(sum%2 == 1) printf("1");
if(sum%2 == 0) printf("0");
return 0; }


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    cin >> n;
    for (int i = 20; i >= 0; i--)
    {
        if (n & (1 << i)) cout << i + 1 << " ";
    }
    return 0;
}


#include<iostream>
using namespace std;
typedef long long ll;
ll x[100005];
int main()
{
	ll top = -1, n;
	cin >> n;
	while (n--)
	{
		x[++top] = 1;
		while (top >= 0 && x[top - 1])
		{
			++x[top - 1];
			top--;
		}
	}
	cout << x[1];
	return 0;
}


#include<stdio.h>
int main(){
    int za, cvp = 1, x = 0;
    scanf("%d",&za);
    while(n){
        cvp = 1;
        x = 0;
        while(cvp<=za){cvp*=2;x++;}cvp/=2;x--;

        printf("%d ",x+1);
        n-=cvp;
    }
}


#include<stdio.h>
#include<String.h>
#define inf 0xffffffffff
int a[inf];
int n;
void work(){
	int i;
	int x=n;
	int count=0;
	int m=1;
	while(x){
		if(x%2){count++;a[m]=1;}
		x/=2;
		m++;
	}
	for(i=m;i>0;i--){
		if(count>1&&a[i]){printf("%d ",i);count--;}
		else if(a[i]){printf("%d\n",i);break;}
	}
	return ;
}
int main(){
	while(~scanf("%d",&n)){
		memset(a,0,sizeof(a));
		work();
	}
}


#include<iostream.h>
#include<math.h>
//using namespace std;
long highestPO2(long n)
{
    for(int i=0;1==1;i++)
    {
        if(pow(2,i+1)>n)
        {
            return i;
        }
    }
    return -1;
}
int main()
{
    long n;
    cin>>n;
    while(n)
    {
        int t = highestPO2(n);
        cout<<t+1<<" ";

        n-=pow(2,t);

    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int l,i,cnt=0,a[100],j=0,grp=0,n;
    char s[105];
    scanf("%d",&n);
    scanf("%s",s);
    for(i=0; i<n; i++)
    {
        if(s[i]=='B')
        {
            cnt++;
        }
        else
        {
            if(cnt>0)
            {
                a[j]=cnt;
                j++;
                grp++;
            }
            cnt=0;
        }
    }
    if(cnt>0)
    {
        grp++;
        a[j]=cnt;
    }
    else
        j--;
    printf("%d\n",grp);
    if(j>=0)
    {
        for(i=0; i<j; i++)
        {
            printf("%d ",a[i]);
        }
        printf("%d\n",a[j]);
    }

    return 0;
}


#include <stdio.h>
#include <string.h>

char dizi[100];
int counter=0;

int main(){
	scanf("%s",dizi);
	for(int i=0;i<strlen(dizi)+1;i++){
		if(dizi[i]=='\0')
			break;
		if(dizi[i]=='B'){
			if(dizi[i+1]=='W' xor dizi[i+1]=='\0' )
			counter++;
		}
	}

	printf("%d",counter);
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
int cur=0;
int data[100]={0};
int count;
void add(int num){
	data[cur]=num;
	cur++;
}
int main(){
	int n;
	scanf("%d",&n);
	char str[105]={'W','W'};
	scanf("%s",str+2);
	str[n+2]='W';
	str[n+3]='W';
	char prech='W',ch;
	bool in=false;
	for(int i=1;i<n+5;i++){
		ch=str[i];
		if (ch=='W'){
			if(prech=='B'){
				in=false;
				add(count);
				count=0;
			}
		}else{
			if(prech=='W'){
				in=true;
			}
			count++;
		}
		prech=ch;
	}
	printf("%d\n",cur);
	if(cur){
	for (int j=0;j<cur;j++){
		printf("%d ",data[j]);
	}}
	return 0;
}


#include<stdio.h>
int main(){
char s[4][5];
int i,j;
for(i=0;i<4;i++) {
scanf("%s",s[i]);
｝

int find=0;
  for(i=0;i<3 && !find;i++) {
    for(j=0;j<3 && !find;j++) {
int dot=0;
int pound=0;
      if(s[i][j]=='.') dot++;
      else pound++;
   if(s[i+1][j]=='.') dot++;
      else pound++;
   if(s[i][j+1]=='.') dot++;
      else pound++;
   if(s[i+1][j+1]=='.') dot++;
      else pound++;
if(dot>2 || pound>2) {
find=1;
    }
  }
if(find)printf("YES\n");
else printf("NO\n");
return 0;
}


#include<stdio.h>
int main (） ｛
  char s[4][5];
  int i,j;
  for(i=0;i<4;i++){
    scanf("%s",s[i]);
  ｝
  int find=0;
  for(i=0;i<3 && !find;i++) {
    for(j=0;j<3 && !find;j++) {
      int dot=0;
      int pound=0;
      if(s[i][j]=='.') dot++;
      else pound++;
      if(s[i＋1][j]=='.') dot++;
      else pound++;
      if(s[i][j+1]=='.') dot++;
      else pound++;
      if(s[i+1][j+1]=='.') dot++:

      else pound++;
      if(dot>2 || pound>2) find=1;
      }
      }
      if(find)printf("YES\n");
      else printf("NO\n");
      return 0;
      }


#include<stdio.h>
int main() {
  char s[4][5];
  int i,j;
  for(i=0;i<4;i++) {
    scanf("%s",s[i]);
  }
  int find=0;
  for(i=0;i<3 && !find; i++) {
    for(j=0;j<3 && !find; j++) {
      int dot=0;
      int pound=0;
      if(s[i][j]=='.') dot++;
      else pound++;
      if(s[i+1][j]=='.') dot++;
      else pound++;
      if(s[i][j+1]=='.') dot++;
      else pound++;
      if(s[i+1][j+1]=='.') dot++;
      else pound++;
      if(dot>2 || pound>2) find=1;
  }
  if(find) printf("YES\n");
  else printf("NO\n");

  return 0;
}


#include<stdio.h>
int main() {
    long long int n,m,k;
    scanf("%lld %lld",&n,&m);
    k=n-m;
    if(m==1)
        printf("%lld\n",m+1);
    else if
        printf("%lld\n",m-1);
    else{
        if(k>m-1)
            printf("%lld\n",m+1);
        else
            printf("%lld\n",m-1);
    }
return 0;
}


/*  In THe name of ALLAH
   == Muhammad Tanvir == */

#include <cstdio>

int main(){
    int n, m;
    scanf("%d%d",&n,&m);
    if(n !=1){
        printf("%d",(m-1 >= n-m ? m-1 : m+1));
    }
    else
        printf("1");
    return 0;
}


/*  In THe name of ALLAH
   == Muhammad Tanvir == */

#include <cstdio>

int main(){
    int n, m;
    scanf("%d%d",&n,&m);
    if(n != 1){
        printf("%d",(m-1 >= n-m ? m-1 : m+1));
    }
    else
        printf("1");
    return 0;
}


#include <stdio.h>
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
  if(n==1)
  	printf("1\n");
  else if(m - 1 < n - m)
  	printf(%d,(m+1));
  else
  	printf(%d,(m-1));
	return 0;
}


#include<stdio.h>
int main()
{
	float n,t,m;
	int a,temp,temp2;
	temp=n;
	temp2=m;
	scanf("%f %d",&n,&m);
	t=(n/2);
	if(n==1)
		a=1;
	else
	{
	if(m%2==0)
	{
		if(m<=t)
			a=m+1;
		else
			a=m-1;
	}
	else
	{
		if(temp==((n/2)+1))
			a=m-1;
		else
		{
			if(m<=t)
				a=m+1;
			else
				a=m-1;
		}
	}
	}
	printf("%d\n",a);
}


#include <stdio.h>

int check(int a, int b, int c)
{
	int ok1 = 1; int ok2 = 1; int ok3 = 1;
	if (a + b > c)
		ok1 = 1;
	if (b + c > a)
		ok2 = 1;
	if (a + c > b)
		ok3 = 1;

	return (ok1 && ok2) && ok3f;
}

int check_deg(int a, int b, int c)
{
	if (a + b == c)
		return 1;
	if (b + c == a)
		return 1;
	if (a + c == b)
		return 1;

	return 0;
}

int main(void)
{
	int a; int b; int c; int d;
	scanf("%d%d%d%d", &a, &b, &c, &d);

	if (check(a, b, c) || check(a, b, d) || check(b, c, d)) {
		printf("TRIANGLE\n");
	} else if (check_deg(a, b, c) || check_deg(a, b, d) || check_deg(b, c, d)) {
		printf("SEGMENT\n");
	} else {
		printf("IMPOSSIBLE\n");
	}

	return 0;
}


#inculde <stdio.h>
int main()
{
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    if(a+b>c||a+c>b||b+c>a||a+b>d||a+d>b||b+d>a||a+c>d||a+d>c||c+d>a||b+c>d||b+d>c||c+d>b) printf("TRIANGLE");
    else if(a+b=c
}


#include<cstdio>
#include<algorithm>//a

int main(){
    int in[4];
    for(int i=0;i<4;i++){
        scanf("%d",in+i);
    }

    sort(in,in+4);

    if(in[0]+in[1]>in[2]||in[1]+in[2]>in[3]) printf("TRIANGLE\n");
    else if(in[0]+in[1]==in[2]||in[1]+in[2]==in[3]) printf("SEGMENT\n");
    else printf("IMPOSSIBLE\n");

    return 0;
}


#inculde <stdio.h>
int main()
{
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    if(a+b>c||a+c>b||b+c>a||a+b>d||a+d>b||b+d>a||a+c>d||a+d>c||c+d>a||b+c>d||b+d>c||c+d>b) printf("TRIANGLE");
    else if(a+b=c||a+c=b||b+c=a||a+b=d||a+d=b||b+d=a||a+c=d||a+d=c||c+d=a||b+c=d||b+d=c||c+d=b) printf("SEGMENT");
    else printf("IMPOSSIBLE");

    return 0;
}


include <stdio.h>

int main()
{
	int n;
	scanf("%d",&n);
	int c[n],count[n];

	for (int i = 0; i < n; ++i)
	{   count[i]=1;
		scanf("%d",&c[i]);
	}
	for (int i = 0; i < n; ++i)
	{
		for (int j = i+1; j < n; ++j)
		{
	 	if(c[i]==c[j])
         {
         	count[i]++;
         }
     }

	}

	int max=count[0];
	for (int i = 0; i < n; ++i)
	{
	   if(count[i]>max)
		{max=count[i];}
	}
	printf("%d\n",max);
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i, j, nbrCoins, count_same_value = 1, value_already_present = 0;
    scanf("%d", &nbrCoins);

    int *coin_value = (int *)malloc(nbrCoins * sizeof(int));

    for (i = 0; i < nbrCoins; i++)
    {
        scanf("%d", &(*(coin_value + i)));

        value_already_present = 0
        for (j = 0; j < i; j++)
        {
            if (*(coin_value + i) == *(coin_value + j))
            {
                value_already_present++;
            }
        }

        if (value_already_present > 0)
        {
            count_same_value += value_already_present
        }
    }

    printf("%d\n", count_same_value);

    free(coin_value);
    return 0;
}
// End of main


#include<stdio.h>
#include<string.h>
int main()
{
    int n,t;
    scanf("%d",&n);
    int a[100];
    for(int i=0;i<n;i++)
    {
        scanf("%d",&t);
        a[t]=a[t]+1;
        if(a[t]>m)
            m=a[t];
    }
    printf("%d\n",m);
}


#include<stdio.h>
int main(){
    int n=0;
    scanf("%d",&size);
    int arr[size];
    for(int i=0;i<size;i++){
        scanf("%d",&arr[i]);
    }
    int*freq=(int*)calloc(100,sizeof(int));
    for(int i=0;i<size;i++){
        freq[arr[i]-1]++;
    }
    int max=0;
    for(int i=0;i<100;i++){
        if(freq[i]>=max){
            max=freq[i];
        }
    }
    printf("%d",max);
    return 0;
}


#include<stdio.h>
#define PROB "a"
using namespace std;
int dau[105]={0};
int maxx=0;
int n;

void Nhap()
{
    int tmp;
    scanf("%d",&n);
    for(int i=0; i<n; i++) {
        scanf("%d",&tmp);
        dau[tmp]++;
        if(dau[tmp]>maxx) maxx=dau[tmp];
    }
    printf("%d",maxx);
}

int main()
{
    //init();
   Nhap();
}