#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
    char text[1000],fi[600],t[500];
    int i,j,n,c=0;
    scanf("%s",&text);
    n=strlen(text);
    while(i<n){
        j=0;
        while (text[i]=='W'){
            i+=2;
            j=1;

        }
        if (j==0){
            fi[c]=text[i];
        }
        else
            fi[c]=' ';
        c++;
        i++;
    }
    while (fi[0]==' '){
        for (i=0;i<n-1;i++)
            fi[i]=fi[i+1];
        n--;
    }
    t=fi;
    for (i=0;i<n;i++)
        printf("%c",t[i]);

    return (EXIT_SUCCESS);
}


#include<iostream>
#include<string>
using namespace std;
int main(){
    string a;
	int i;
    cin>>a;
    for(int i=0;i<a.length();i++){
      if(i<a.length()-2){
		if(a.substr(i,3)=="WUB"){
			cout<<" ";
		    i=i+2;
		}
		else cout<<a[i];
      }
      else cout<<a[i];
	}
	cout<<endl;
	return 0;
}


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

int main()
{
    char s[201];
    int i,n;
    printf("donner l chine ");
    scanf("%s",s);
    n=strlen(s);
    for (i=0 ; i<=n ; i++){
            if (s[i]=='W' && s[i+1]=='U' && s[i+2]=='B'){
                  s[i]=' ';
                  s[i+1]=' ';
                  s[i+2]=' ';}
    }
    printf("%s",s);
    return 0;


#include<stdio.h>
int main()
{
char a[200],b[200];
int gets(a);
int strlen(a);
int i,j=0,k=0;
int len=strlen(a);
for(i=0;i<len;i++){
if(a[i]==’W’ && a[i+1]==’U’ && a[i+2]==’B’){
i+=2;
k=1;
}
else{
if(k==1 && j>0){
b[j]=’ ‘;
j++;
}
b[j]=a[i];
k=2;
j++;
}
}
b[j]=’\0’;
puts(b);
return 0;
}


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

#define N 100

int main()
{
    __int64 n, k, ans = 0, sum = 0;
    long i;
    scanf("%I64d%I64d", &n, &k);
    if ((k + 2) * (k-1) / 2 - k + 2 < n){
        puts("-1");
        return 0;
    }
    for (i=k; i>1; i--){
        ans++;
        sum += i;
        if (sum>=n){
            printf("%I64d", ans);
            return 0;
        }
    }
    return 0;
}


#include <stdio.h>

typedef unsigned long long int LL;
LL highval(LL k, int digits) {
    LL sum = 0;
    for (int i = 0; i < digits; i++) {
        sum += k-i;
    }
    return sum-digits+1;
}
//LL lowval(LL k, int digits) {
LL lowval(int digits) {
    LL sum = 0;
    for (int i = 0; i < digits; i++) {
        sum += i+2;
    }
    return sum-digits+1;
}

LL cal(LL val, LL k) {
    int lo=0, hi=k; //val = [2..k]
    while (hi-lo > 1) {
    //printf("SHIT\n");
    //printf("%d %d\n", lo, hi);
        int mid = (hi+lo)/2;
        LL u = highval(k, mid);
        if (val > u)
            lo = mid;
        else
            hi = mid;
    }
    return (val >= lowval(hi) && val <= highval(k, hi)) ? hi : -1;
}

int main() {
    LL n, k;
    scanf("%llu %llu", &n, &k);
    printf("%llu\n", cal(n, k));
    return 0;
}


#include<stdio.h>
#include<iostream>
using namespace std;
_int64 sum(_int64 t);
_int64 n,k;
int main()
{
	while(scanf("%I64d %I64d",&n,&k)!=EOF)
	{
		_int64 left=0,right=k-1;
		int flag=0;
		if(sum(k)<n){printf("-1\n");continue;}
		else
		{
			while(right-left!=1)
			{
				_int64 mid=(left+right)/2;
				_int64 term=sum(mid);
				if(term>n)
					right=mid;
				else if(term<n)
					left=mid;
				else {printf("%I64d\n",mid);flag=1;break;}
			}
			if(flag==0)
			{
			if(sum(left)==n)printf("%I64d\n",left);
			else printf("%I64d\n",right);
			}
		}
	}
	return 0;
}

_int64 sum(_int64 t)
{
	_int64 i,sum=1;
	for(i=k-1;i>=k-t;i--)
		sum+=i;
	return sum;
}


#include<stdio.h>

int main(){
    long long n, k, s, l, r, m;
    scanf("%I64d%I64d", &n, &k);
    --n, --k;
    s = k * (k + 1) / 2;
    if (n > s)puts("-1");
    else {
        for (l = 0, r = k ; l < r - 1 ;){
            m = (l + r) / 2;
            if (m * (m + 1) / 2 == s - n){
               l = m;
               break;
            }
            else if (m * (m + 1) / 2 < s - n)l = m;
            else r = m;
        }
        printf("%I64d\n", k - l);
    }
    scanf(" ");
    return 0;
}


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

int main()
{
    long long int i,a,b,j,y,x,m,cur=0,n,t,c1,c2,n1,n2,m1,m2,te,tem,temp;

    long long int sum=0,max=0,ans=0,tl=1,k,w=0,on=0,z=0,wh=0;

        scanf("%lld",&n);
       a=n/1234567;
       b=n/12345;
        for(i=0;i<=a;i++)
            for(j=0;j<=b;j++)
                if((n-(i*1234567+j*12345)%1234==0)
                    w=1;
        if(w)
            printf("YES\n");
        else
            printf("NO\n");

    return 0;
}


#include <stdio.h>
int main()
{
	int n,i,jsum,flag=0;
	scanf("%d",&n);
    for(i=0;i<1000;i++)
    	for(j=0;j<1000;j++)
    		{
    			long long int sum = n - 1234567*i - 123456*j;
    			if(sum % 1234 == 0)
    				{
    					flag = 1;
    				}
       		}

    if(flag == 0)
        printf("NO\n");
    else
        printf("YES\n");
    return 0;
}


#include <stdio.h>
int main()
{
	int ch=0;
    long long int a=1234567;
    long long int b=123456;
    long long int c=1234;
    long long int i,j;
    for(i=0;i<=1000;i++)
        for(j=0;j<=10000;j++)
        {
            long long int temp=n-a*i-b*j;
            if(temp%1234==0 && temp>=0)
            {
                ch=1;
            }
        }
    if(ch) printf("YES\n");
    else printf("NO\n");
    return 0;
}


#include <stdio.h>
#include <string.h>
/*int count( long long int S[], int m, long long int n )
{
    if (n == 0)
        return 1;
    if (n < 0)
        return 0;
    if (m <=0 && n >= 1)
        return 0;
    return count( S, m - 1, n ) + count( S, m, n-S[m-1] );
}*?
/*int count( int S[], int m, int n )
{
    int i, j, x, y;
    int table[n+1][m];
    for (i=0; i<m; i++)
        table[0][i] = 1;
    for (i = 1; i < n+1; i++)
    {
        for (j = 0; j < m; j++)
        {
            x = (i-S[j] >= 0)? table[i - S[j]][j]: 0;
            y = (j >= 1)? table[i][j-1]: 0;
            table[i][j] = x + y;
        }
    }
    return table[n][m-1];
}*/
/*int count( int S[], int m, int n )
{
    int table[n+1];
    memset(table, 0, sizeof(table));
    table[0] = 1;
    for(int i=0; i<m; i++)
        for(int j=S[i]; j<=n; j++)
            table[j] += table[j-S[i]];
    return table[n];
}*/
int main()
{
	int n,i,j,k;
	scanf("%d",&n);
	int arr[] = {1234567,123456,1234};
    int m = 3;
    for(i=0;i<10;i++)
    	for(j=0;j<10;j++)
    		for(k=0;k<10;k++)
    		{
    			sum = 1234567*i + 123456*j + 1234*k;
    			if(sum == n)
    				{
    					printf("YES\n");
    					return 0;
    				}
       		}
    /*if(count(arr,m,n) == 0)
    	printf("NO\n");
    else
    	printf("YES\n");
    return 0;*/
}


#include <stdio.h>
const int a=1234567;
const int b=123456;
const int c=1234;
int main()
{
	int n;
	scanf("%i",&n);
	for(i=0;i<(n/a+1);i++)
		for(j=0;j<(n/b+1);j++){
			k=n-a*i-b*j;
			if(!(k%1234||k<0))
				puts("YES");
				return 0;
		}
	puts("NO");
	return 0;
}


#include<stdio.h>
int pow(int a,int b)
{
    long long x=1;
    for(int i=1;i<=b;i++)
        x*=a;
    return x;

}
int n,m,s,t;
int main()
{
    scanf("%d",&n);
    scanf("%d",&m);

    for(int i=0;i<30;i++)
        for(int j=0;j<25;j++){
            t=pow(2,i)*pow(3,j
            if(t>=n && t<=m) s++;
            if(t>m) break;
        }
    printf("%d",s);

}


#include<stdio.h>
#include<math.h>
int MAXN=1e5+10;
int a[MAXN];
int main()
{
	long long i,j,k,l,r,m,n,ll,rr,lll,rrr,ans;

	scanf("%I64d%I64d",&m,&n);
	m--;
	ans=0;
	l=m;
	r=n;
	ll=log2(l)+1;
	rr=log2(r)+1;
	ll=1<<(ll-1);
	rr=1<<(rr-1);
	lll=0;
	while (ll>0)
	{
		lll+=log2(m)/log2(3)+1;
		ll>>=1;
	}
	rrr=0;
	while (rr>0)
	{
		rrr+=log2(n/rr)/log2(3)+1;
		rr>>=1;
	}
	ans=rrr-lll;
	printf("%I64d",ans);

	return 0;
}


#include <stdio.h>

#include<math.h>

int main(){

	int l, r;
	scanf("%d %d", &l, &r);
	int count = 0;
	for (int i = 0; i <= 30; i++){
		for (int j = 0; j <= 30; j++){
			ll ans = (ll)pow(2, i)*(ll)pow(3, j);
			if (ans >= l&&ans <= r)
				count++;
		}
	}
	printf("%d\n", count);

//	return (0);

}


#include<iostream>
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>

using namespace std;

typedef long long LL;

set<LL>s;
vector<LL>v;

void settable()
{
	s.insert(1);
	set<LL>::iterator iter=s.begin();
	int count=1;
	LL temp=*iter;
	while(temp<=2e9){//�˴�Ҫ��������
		LL t=*iter;
		s.insert(t*2);
		s.insert(t*3);
		temp=t*3;
		iter++;
	}
	iter=s.begin();
	while(iter!=s.end()){
		v.push_back(*iter++);
	}
/*	for(int i=0;i<10;i++){
		printf("%d ",v[i]);
	}
	printf("\n");*/
}

int main()
{
	settable();
	int l,r;
	scanf("%d%d",&l,&r);
	int num=upper_bound(v.begin(),v.end(),r)-lower_bound(v.begin(),v.end(),l);
	printf("%d\n",num);
	return 0;
}


#include<stdio.h>

using namespace std;

typedef long long int ll;

const double pi = 3.1415926535897932384626433832795;
const double eps = 1e-10;
const int inf = 1e9;
const int mod = 1e9 + 7;

int lg(ll x,ll y)
{
    int an =0;
    while(x >= y)
    {
        x/=y;
        an++;
    }
    return an;
}

int f(int k)
{
    int ans = 0,i;
    for(i = 0;(ll)(1LL<<i) <= k;i++)
    {
        ans+= lg((ll)k/(1LL<<i),3LL) +1;
    }
    return ans;
}

int main()
{

    int l,r;
    scanf("%d %d",&l,&r);
    printf("%d\n",f(r)-f(l-1));
    return 0;
}


                  #include<stdio.h>
#include<string.h>
int main()
{
    int a,b,c,i,j,q;
    char bu[199];
    int bi[199];
    scanf("%d%d",&a,&b)

        getchar();
        memset(bi,0,sizeof(bi));
        scanf("%s",bu);
        for(i=0;i<a;i++)
        {
            if(bu[i]=='1')
            {
                if(i<b)
                {
                    for(q=0;q<i;q++)
                    {
                        if(bu[q]=='1')
                        {
                        bi[i]=bi[q]+1;
                        break;
                        }
                    }
                }
                if(i>=b)
                {
                    for(q=i-b;q<i;q++)
                    {
                         if(bu[q]=='1')
                        {
                        bi[i]=bi[q]+1;
                        break;
                        }
                    }
                }
            }
        }

         if(bi[a-1])
         printf("%d\n",bi[a-1]);
         else
         printf("-1\n");

}


#include <stdio.h>
int f(char a[],int x,int jici,int n,int d);
int main(){
	int n,d;
	int char s[101];
	scanf("%d%d",&n,&d);
	scanf("%s",s);
	printf("%d",f(s,1,0,n,d));
	return 0;
}
int f(char a[],int x,int jici,int n,int d){
	if(x==n)return jici;

	int i;
	if(a[x-1]=='1')
	for(i=n;i>=1;i--){
		if(a[i-1]=='1'&&(i-x<=d)f(a,x+i-x,jici+1,n,d);

	}
	return jici;
}


#include<stdio.h>
using namespace std;

char array[101];
int arr[101];

int main()
{
	int n,d;
	scanf("%d%d",&n,&d);//cin>> n>>d;
	int i,j;
	for(i = 0 ; i < n ; i++)
		scanf("%s",array);
	for(i=0;i<n;i++)
		if(array[i]=='0')
			arr[i]=0;
		else
			arr[i]=1;

	int count=0;
	for(i=0;i<=n-1;)
	{
		count++;;
		for(j = 1; j <= d && (i + j) < n ;j++)
		{
			if(arr[i+j]==1)
				max = i+j;
		}
		if(max==i)
			break;
		else
			i = max;
	}
	if(i!=n-1)
		printf("%d\n",count);//cout<<count<<endl;
	else
		printf("-1\n");//cout<<"-1"<<endl
}


include<stdio.h>

int main()
{
	int n,m,i=0,j,x,y,len,num=0,d;
	char s[102],ch;
	scanf("%d%d",&n,&d);
	getchar();
	gets(s);
   for(j=i+d;j>=i;j--)
   {
   	if(j>=n-1)
   	{num++;break;}
   	else if(s[j]=='1'&&j!=i)
   	{
	   	i=j;
	   	j=i+d+1;
	   	num++;
	   }
	   else if(j==i)
	   {
   		printf("-1");
   		break;
   	}
   }
   if(j!=i)
   printf("%d",num);

}


#include <stdio.h>
#include <stdlib.h>
long long int max(long long int a ,long long int b)
{
    return a>b?a:b;
}
int main()
{
    int n,i;
    long long int ans=1s;
    scanf("%d",&n);
    if(n==1)
        ans=1;
    else if(n==2)
        ans=2;
    else if (n==3)
        ans=6;
    else if(n%2==0)
        {
            for(i=1;i<=50 ;i++)
            {
                if(n%(n-i)==0)
                    continue;
                ans=max(ans,n*(n-1)*(n-i));
            }
        }
    else
        ans=(n)*(n-1)*(n-2);
    printf("%lld",ans);
    return 0;
}


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

int main()
{
    int n;
    long long int ans;
    scanf("%d",&n);
    if(n=<2)
        ans=n;
    else if (n==3)
        ans=6;
    else if(n%2==0)
        ans=(n-1)*(n-2)*(n-3);
    else if(n%3==0)
        ans=(n)*(n-1)*(n-2);
    else
        asn=(n)*(n-1)*(n-3);
    printf("%lld",ans);
    return 0;
}


#include<stdio.h>
long long int hcf(long long int i,long long int j){
    long long int k=1,l;
    while(k!=0){
        l=j;k=i%j;i=j;j=k;
    }
    return l;
}
long long int max(long long int i,long long int j){
    if(i>j) return i;
    return j;
}
int main(){
    long long int n,i,j,k,l;
    scanf("%I64d",&n);
    if(n<=2){
        printf("%I64d",n);
    }
    else if(n%2==1){
        l=n*(n-1)*(n-2);
        printf("%I64d",l);
    }
    else{
        i=n*(n-1);l=n-2;k=l/2;
        //printf("%lld\t",i);printf("%lld\n",l);
        while(l>(n-2)/2){
            j=hcf(i,l);
            //printf("%lld\n",j);
            if(j==1){
                k=l;break;
            }
            l--;
        }
        l=k*i;
        j=(n-1)*(n-2)*(n-3);
        l=max(l,j);
        printf("%I64d",l);
    }
    return 0;


#include<stdio.h>
int gcd(int a , int b);
int main(void)
{
int i=1,n,a,b,x,y;

scanf("%d",&n);
a=n;
b=(n-1>0)?n-1:1;
x=(n-1>0)?n-1:1;
y=(n-2>0)?n-2:1;
if(!(n-1)) b=1;
for(i=n-2;i>0;i--)
{
if(gcd(a,i)==1&&gcd(b,i)==1)
break;
}
for(int j=n-3;j>0;j--)
{
if(gcd(x,i)==1&&gcd(y,j))
break;
}
j=(j>0)?j:1;
i=(i>0)?i:1;
long long int ans;
if(i>j)
ans=a*b*i;
else
ans=x*y*j
printf("%lld",ans);
return 0;
}
int gcd(int a , int b)
{
long long int r = (a%b==0)?b:gcd(b,a%b);
return r;
}


main()
{
    int h, m, s, a, b, max, count=0;
    scanf("%d%d%d%d%d", &h, &m, &s, &a, &b);
    max=b;
    if(a>max)
    {
        max=a;
    }
    if (h>=a && h<b)
        {
            count=count+1;
        }
        if (m/5>=a && m/5<b)
        {
            count=count+1;
        }
        if (s/5>=a && s/5<b)
        {
            count=count+1;
        }
        if (count==3 || count==0)
        {
            printf("\nYES\n\n");
        }
        else
        {
            printf ("\nNO\n\n");
        }
    }
    system("pause");
    return 0;


main()
{
    int h, m, s, a, b, max, start, finish count=0;
    scanf("%d%d%d%d%d", &h, &m, &s, &a, &b);
    max=b;
    start=a;
    finish=b;
    if(a>b)
    {
        a=finish;
        b=start;
    }
    if(h>=1 && h<=12 && m>=0 && m<=59 && s>=0 && s<=59 && a!=b)
    {
        if (h>=a && h<b)
        {
            count=count+1;
        }
        if (m/5>=a && m/5<b)
        {
            count=count+1;
        }
        if (s/5>=a && s/5<b)
        {
            count=count+1;
        }
        if (count==3 || count==0)
        {
            printf("\nYES\n\n");
        }
        else
        {
            printf ("\nNO\n\n");
        }
    }
    return 0;
}


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

int main()
{
    int h,m,s,a,b,temp;
    float m1,s1;
    //printf("Give the five integers (h,m,s,a,b)\n");
    scanf("%d %d %d %d %d",&h,&m,&s,&a,&b);
    m1=m/5.0;
    s1=s/5.0;
    if (a>b)
        {temp=a;
         a=b;
         b=temp;}
    if ((a>=m1 && a>=s1 && a>=h) || ((a=<m1 && a=<s1 && a=<h) && (b>=m1 && b>=s1 && b>=h)))
        printf("YES\n");
    else printf("NO\n");
    return 0;
}


#include <stdio.h>
#include <string.h>
int zero(int n){
    int tab[5]={0,1,2,2,1,0};
    return tab[tab%6];
}
int one(int n){
    int tab[5]={1,0,0,1,2,2};
    return tab[tab%6];
}
int two(int n){
    int tab[5]={2,2,1,0,0,1};
    return tab[tab%6];
}

int main()
{
	int n,x;
	scanf("%d %d",&n,&x);
    if(zero(n)==x) printf("0");
    if(one(n)==x) printf("1");
    if(two(n)==x) printf("2");

}


#include <stdio.h>
#include <stdlib.h>
int zero(int n){
    int tab[5]={0,1,2,2,1,0};
    return tab[tab%6];
}
int one(int n){
    int tab[5]={1,0,0,1,2,2};
    return tab[tab%6];
}
int two(int n){
    int tab[5]={2,2,1,0,0,1};
    return tab[tab%6];
}

int main()
{
	int n,x;
	scanf("%d %d",&n,&x);
    if(zero(n)==x) printf("0");
    if(one(n)==x) printf("1");
    if(two(n)==x) printf("2");

}


#include<stdio.h>
int main()
{
  long long int n;
  int x,f,temp1,temp2,a,b,c;
  scanf("%lld%d",&n,&f);
if(f==0)
  {
      a=1;
      b=0;
      c=0;
  }
else if(f==1)
  {
      a=0;
      b=1;
      c=0;
  }
else
  {
      a=0;
      b=0;
      c=1;
  }
   if(n%2==0)
     x=n%6;
   else
     x=6-(n%6);
    switch()
    {
    case(1)
        temp1=b;
        b=c;
        c=temp1;
        break;

    case(2)
        temp1=b;
        b=c;
        c=temp1;
        a=temp2;
        a=c;
        c=temp2;
        break;
    case(3)
        temp1=a;
        a=c;
        c=temp1;
        break;
    case(4)
        temp1=b;
        b=a;
        a=temp1;
        temp2=c;
        c=a;
        a=temp2;
        break;
    case(5)
        temp1=a;
        a=b;
        b=temp1;
        break;
    case(6)
             ;
        break;
    default
             ;

    }
    if(a==1)
    printf("0");
    else if(b==1)
    printf("1");
    else if(c==1)
    printf("2");
  return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="测试" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/测试" 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/测试" 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>

int main()
{
    unsigned int n;
    char c;
    scanf("%d%c",&n,&c);
    char string[1024];
    int numbers[100];
    gets(string);
    char * cp;
    int i=0;
    cp=strtok(string," ");
    while (cp != NULL)
    {
        sscanf(cp,"%d",&numbers[i]);
        i++;
        cp = strtok(NULL," ");
    }
    int phase=0;
    for (i=0;i<n;i++)
    {
        if(n==i+1) break;
        if(phase==0)
        {
            if(numbers[i]<number[i+1]) phase=1;
            else if(numbers[i]==number[i+1]) phase=2;
        }
        if (phase==1)
        {
            if(numbers[i]<number[i+1]) phase=1;
            else if(numbers[i]==number[i+1]) phase=2;
        }
        if (phase==2)
        {
            if(numbers[i]==number[i+1]) phase=2;
            else if(numbers[i]>number[i+1]) phase=3;
        }
        if (phase==3)
        {
            if(numbers[i]>number[i+1]) phase=3;
            else phase=4;

        }
        if (phase==4) break;
    }

    if(phase==2 || phase==3)
    {
        printf("yes");
    }
    else
    {
        printf("no");
    }

}


#include <stdio.h>

int main()
{
    unsigned int n;
    char c;
    scanf("%d%c",&n,&c);
    char string[1024];
    int numbers[100];
    gets(string);
    char * cp;
    int i=0;
    cp=strtok (string," ");
    while (cp != NULL)
    {
        sscanf(cp,"%d",&numbers[i]);
        i++;
        cp = strtok (NULL, " ");
    }
    int phase=0;
    for (i=0;i<n;i++)
    {
        if(n==i+1) break;
        if(phase==0)
        {
            if(numbers[i]<number[i+1]) phase=1;
            else if(numbers[i]==number[i+1]) phase=2;
        }
        if (phase==1)
        {
            if(numbers[i]<number[i+1]) phase=1;
            else if(numbers[i]==number[i+1]) phase=2;
        }
        if (phase==2)
        {
            if(numbers[i]==number[i+1]) phase=2;
            else if(numbers[i]>number[i+1]) phase=3;
        }
        if (phase==3)
        {
            if(numbers[i]>number[i+1]) phase=3;
            else phase=4;

        }
        if (phase==4) break;
    }

    if(phase==2 || phase==3)
    {
        printf("yes");
    }
    else
    {
        printf("no");
    }

}


#include <stdio.h>

int main(int argc, char **argv)
{
	int k,,p,n,i;
	scanf("%d",&n);
	int ar[n];
	p=n-1;
	for(i=0;i<n;i++)
	{
		scanf("%d",&ar[i]);
	}
	k=0;
	while(ar[k]<ar[k+1] && k<n)
		k++;
	while(ar[k]==ar[k+1] && k<p)
		k++;
	while(ar[p]<ar[p-1] && p>0)
		p--;
	if(k>=p)
		printf("YES");
	else
		printf("NO");
	return 0;
}


#include <stdio.h>
int main()
{
  int n, i, p=1;
  scanf("%d", &n);
  int a[n];
  for (i=0; i<n; i++)
    scanf("%d", &a[i]);
  while(a[p]>a[p-1])
  {
      p++;
  }
  while(a[p]== a[p-1])
  {
      p++;
  }
  while(a[p]<a[p-1])
  {
      p++
  }
  if (p<=n-1)
    printf("NO");
  else
    printf("YES");
 return 0 ;
}


#include<stdio.h>
int main()
int x;
scanf("%d",&x);
while(x>=10 && x<=999)
{
if(x%2==0)
{
printf("0");
}
if(x%2==1)
{
printf("1");
}
break;
}
return 0;
}


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


include<stdio.h>
int main()
{
    int a;
    printf("Enter the number :");
    scanf("%d",&a);

  if(a%2==0)
    printf("0");
  if(a%2!=0)
     printf("1");

  return 0;
}


#inlcude<stdio.h>
int main()
{
int i,j,x,y,a,b,sum,n;
while(scanf("%d",&n)==1)
{
for(j=1;j<=n;j++)
{
scanf ("%d%d",%a,%b);
sum=0;
if(a%2==0)
a=a+1;
if(b%2==0)
b=b-1;
for(i=a;i<=b;i=i+2)
sum=sum+i;
prinft("case %d: %d\n",j,sum);
}
}
return 0;
}


#include<stdio.h>

int main()
{
    int n,m,mx,mn;
    int i,j,k,l,data[200],c1=0;

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

    for(i=0;i<m;i++){
            scanf("%d",&data[i]);
    }

    if(n<=2){
        for(i=0;i<m;i++){
            if(data[i] == mn || data[i] == mx){
                c1 = 1;
            }
            else{
                c1 = 0;
                break;
            }
        }
        if(c1==1){
            printf("Correct\n");
        }
        else{
            printf("Incorrect\n");
        }
    }

    else{
        for(i=0;i<m;i++){
            if(data[i] >= mn && data[i] <= mx){
                c1 = 1;
            }
            else{
                c1 = 0;
                break;
            }
        }
        if(c1==1){
            printf("Correct\n");
        }
        else{
            printf("Incorrect\n");
        }
    }
    return 0;
}


#include <stdio.h>

int main()
{
    int n, m, m1, m2, c1 = 0, c2 = 0, i;

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

    for (i = 0; i < m; i++) {
        int x;

        scanf("%d", &x);

        if (x == m1) c1 = 1;
        if (x == m2) c2 = 1;
    }

    if (n - m >= 2 - c1 - c2) {
        puts("Correct");
    } else {
        puts("Incorrect");
    }

    return 0;
}


#include<stdio.h>
int main()
{
    int n,m,min,max,a[200],flag,i,flagmin=0,flagmax=0;
    scanf("%d %d %d %d",&n,&m,&min,&max);
    flag=2;
    for(i=0;i<m;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]==min)
        flag--;
        else if(a[i]==max)
        flag--;
        else if(a[i]<min&&flagmin==0)
        {
            flag++;
            flagmin=1;
        }
        else if(a[i]>max&&flagmax==0)
        {
            flag++;
            flagmax=1;
        }
    }
    if(flag<0)
    flag=0;
    if(flag>2)
    flag=2;
    if(flag==0||(n-m)>=flag)
    printf("Correct");
    else
    printf("Incorrect");
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define N 110
int a[N];
int main(){
   int n,m,min,max;
   while(~scanf("%d%d%d%d",&n,&m,&min,&max)){
   	  int i=0,min1=101,max1=-1;
   	  for(i;i<m;i++){
   		scanf("%d",&a[i]);
   		if(a[i]<min1)
   		min1=a[i];
   		if(a[i]>max1)
   		max1=a[i];
	   }
	   int t=-1;
	   int x=n-m;
	   if(x>=2)
	   printf("Correct\n");
	   else if(max1>max||min1<min)
	   printf("Incorrect\n");
	   else if(x==0)
	   {
	   	for(i=0;i<m;i++){
	   		if(a[i]==max)
	   		t++;
	   		if(a[i]==min)
	   		t++;
	   		if(t==1){
	   				printf("Correct\n");break;
			   }

	   	}
	   	if(t!=1)
	   	printf("Incorrect\n");
	   }
	   else if(x==1){
	   	for(i=0;i<m;i++){
	   		if(a[i]==max){

	   			if(min<=min1){
	   				t++;printf("Correct\n");break;
				   }

			   }

	   		else if(a[i]==min){

	   			if(max>=max1){
	   				t++;	printf("Correct\n");break;
				   }

			   }

	   }
	   if(t==-1)
	   	printf("Incorrect\n");
   }

}
}


#include<stdio.h>
int main(){
int n,m,min1,max1,i,arr[105],flag1=-1,flag2=-1,h=-1,y=-1;
scanf("%d%d%d%d",&n,&m,&min1,&max1);
for(i=0;i<m;i++){
    scanf("%d",&arr[i]);
     if(arr[i]==min1)
        flag1=1;
     if(arr[i]<min1)
            h=1;
     if(arr[i]==max1)
        flag2=1;
     if(arr[i]>max1)
        y=1;
       }

  if(n-m==1&&(flag1==1||flag2==1))
        printf("Correct\n");

  else if(n-m>1&&(h=1||y=1))
        printf("Incorrect");

  else if(n-m==1&&(flag1!=1||flag2!=1))
            printf("Incorrect\n");

return 0;
}


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

long long int NOD(long long int n1, long long int n2)
{
  long long int div;
  if (n1 == n2)  return n1;
  long long int d = n1 - n2;
  if (d < 0) {
    d = -d;  div = NOD(n1, d);
  } else
    div = NOD(n2, d);
  return div;
}

long long int NOK(long long int n1, long long int n2)
{
  return n1*n2 / NOD(n1, n2);
}

int main()
{
  long long int x, y, a, b, res = 0;
  scanf ("%I64d %I64d %I64d %I64d", &x, &y, &a, &b);
  n = NOK(x, y);
  while (a % n != 0) a++;
  while (b % n != 0) b--;
  res = (b - a) / n + 1;
  printf("%I64d", res);
  return 0;
}


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

int main(){
long long  x,y,a,b,count=0;
scanf("%I64d",&x);
scanf("%I64d",&y);
scanf("%I64d",&a);
scanf("%I64d",&b);
for(long long  i = a ; i <= b ; i++)
{
      //  printf("i %d\n",i);
   if( (i%x == 0) && (i%y == 0) )
      {
            //printf("1");
            count = count + 1;
      }
}
printf("%I64d",count);
}


#include <stdio.h>

int gcd(int x, int y) {
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

int solve(int x, int y, int max) {
    long long lcm = 1LL * x * y;
    lcm = lcm / gcd(x, y);
    return max / lcm;
}

int main() {
    int x, y, a, a;
    scanf("%d%d%d%d", &x, &y, &a, &a);
    printf("%d", solve(x, y, b) - solve(x, y, a - 1));
    return 0;
}


#include <stdio.h>

int main(void){
    int i, x, y, a, b, c=0, mcm;
    scanf("%d %d %d %d", &x, &y, &a, &b);
    for(mcm=x; mcm<=b; i++){
        if(mcm%x == 0 && mcm%y == 0){
            break;
        }
    }

    for(i=a; i<=b, i++){
        if(i%mcm == 0)
            break;
    }

    for(; i<=b; i+mcm)
        c++;

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


#include<stdio.h>
#define M 1500000
int main()
{
    //freopen("in.txt","r",stdin);
    int i,j,n;
    bool p[M]={0};
    for(i=2;i<=M;i++)
    {
        if(p[i]==0)
        {
             for(j=i+i;j<=M;j=i+j)
               p[j]=1;
        }
    }
    scanf("%d",&n);
    printf("2");
    for(i=3,j=1;j<n;i++)
        if(p[i]==0)
        {
            printf(" %d",i);
            j++;
        }
    printf("\n");
    return 0;
}


#include "stdio.h"
#include "stdlib.h"
void main()
{
    int numCard, numPerson, i, sum = 0, sumForPerson, cardIdx1, cardIdx2;
    int a[100];
    int coupleIdx = 0, start = 0, tmp;

  //  printf("\n Nhap n:");
    scanf("%d", &numCard);

    if (numCard < 2 || numCard > 100 || (numCard%2) != 0)
    {
        return;
    }

    for (i = 0; i < numCard; i++)
    {
      //  printf("\n Nhap a[%d]:", i);
        scanf("%d", &a[i]);

        if (a[i] < 1 || a[i] > 100)
        {
            return;
        }
    }

    for (i = 0; i < numCard; i++)
    {
        sum += a[i];
       // printf("\n sum: %d", sum);
    }

    numPerson = numCard>>1;

    if (sum % numPerson != 0)
    {
        return;
    }
    sumForPerson = sum/numPerson;

  //  printf("\n numPerson: %d", numPerson);

    while(coupleIdx < numPerson)
    {
       // printf("\n start: %d...", start);
        if (a[start] == -1)
        {
            start++;
        }

        for (i = start + 1; i < numCard; i++)
        {
            if (a[i] != -1 && a[start] != -1 &&(a[start] + a[i]) == sumForPerson)

                if (a[start] > a[i])
                {
                    printf("\n %d %d", i+1, start+1);
                }
                else
                {
                    printf("\n %d %d", start+1, i+1);
                }

                a[i] = -1;
                start++;
                coupleIdx++;
               // printf("\n Start: %d, couple: %d", start, coupleIdx);

                break;
            }
        }
    }

 return;
}


#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
void main()
{ int n,i,j;n=scanf("%d",&n);int s=0;
  int arr[100];
 for(i=0;i<n;i++)
 { scanf("%d",&arr[i]);s=s+arr[i];
 }
 int a=(sum*2)/n;
 for(i=0;i<n;i++)
 {
   for(j=i;j<n;j++)
     { if(((arr[i]+arr[j])==a)&&(arr[i]>=0)&&(arr[i]>=0))
       {printf("%d   %d",i,j);
         arr[i]=-1;arr[j]=-1;break;
	 }}
 }getch();
	 }


#include<stdio.h>
#include<string.h>
int main()
{
    int s[111],i,j,sum,ave,n;
    bool vis[111];
    while(scanf("%d",&n)!=EOF)
    {
        sum=0;
        memset(vis,false,sizeof(vis));
        for(i=1;i<=n;i++)
        {
            scanf("%d",&s[i]);
            sum+=s[i];
        }
        ave=sum/n*2;

        for(i=1;i<=n;i++)
        {
            if(vis[i]==false)
            {
                for(j=i+1;j<=n;j++)
                    if(s[i]+s[j]==ave&&vis[j]==false)
                {
                    printf("%d %d\n",i,j);
                    vis[j]=true;
                    vis[i]=true;
                    break;
                }
            }
        }
    }
    return 0;
}


#include <stdio.h>

long long int power(int base,int exponent)
{
    int i;
    long long int res=1;
    for(i=0;i<exponent;i++)
        res*=base;
    return res;
}

int sum(long long int n)
{
    int ans = 0;
    while(n>0){
        ans += n%10;
        n/=10;
    }
    return ans;
}

void function(int a,int b,int c)
{
    int i,count=0,s;
    long long int res;
    int arr[100]={0};
    for(i=1;i<=72;i++){
        res = power(i,a);
        res *=b;
        res += c;
        if((res<=0)||(res>1000000000))
            continue;
        s = sum(res);
        if(s==i){
            arr[count] = (int)res;
            count +=1;
        }
    }
    printf("%d\n",count);
    for(i=0;i<count;i++)
        printf("%d ",arr[i]);
    printf("\n");
}

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


#include<stdio.h>

long long int cons=1000000000;

long long int power(long long int a, long long int b)
{
    long long int i,t=1;
	for(i=0;i<b;i++)
	{
		t*=a;
	}
	return t;
}

long long int dsum(long long int a)
{
	long long int i=0;
	while(a>0)
	{
		i+=a%10;
		a/=10;
	}
	return i;
}

int main() {
	long long int a,b,c,n,i,j=0,t=0,arr[100],k=0;
	scanf("%lld %lld %lld",&a,&b,&c);
	for(i=1;i<=72;i++)
	{
		t=(b*power(i,a))+c;
        //printf("%lld %lld %lld\n",i,a,power(i,a));
		if((t<=cons)&&(t>=0))
		{
			if(dsum(t)==i)
			{
				arr[k]=t;
				j++;
				k++;
			}
		}
	}
	printf("%lld\n",j);
	for(i=0;i<k;i++)
	{
		printf("%lld ",arr[i]);
	}
	printf("\n");
	return 0;
}


#include<stdio.h>
long long int arr[1000250];
int main()
{
    long long int n,a,b,c,s,num,p,p1,i,d,sum=0,flag=0,k,ctr=0;
    scanf("%I64d%I64d%I64d",&a,&b,&c);
    for(s=1;s<=82;s++)
    {
        num=1;
        for(i=1;i<=a;i++)
        {
        num=num*s;
        }
        p=b*num+c;
        //printf("%d \n",p);
        p1=p;
        sum=0;
        while(p1>0)
        {
            d=p1%10;
            sum+=d;
            p1=p1/10;

        }
        if(sum==s){flag=1;arr[ctr++]=p;
            //printf("%I64d ",p);

    }}
printf("%d\n",ctr);
for(k=0;k<ctr;k++)
    printf("%d ",arr[k]);
//if(!flag)
  //  printf("0");
    return 0;

}


#include <stdio.h>

typedef __int64 LL_t;

LL_t Pow(LL_t i, LL_t n)
{
    LL_t ret = 1;
    while(n--)
    {
        ret *= i;
    }
    return ret;
}

LL_t Fun(LL_t Num)
{
    LL_t ret = 0;
    while(Num)
    {
        ret += Num%10;
        Num /= 10;
    }
    return ret;
}

int main()
{
    LL_t A, B, C, i, Cnt;
    LL_t Data[100];
    scanf("%I64d %I64d %I64d", &A, &B, &C);
    for(Cnt=0, i=1; i<82; ++i)
    {
        if(Fun(Pow(i, A)*B+C) == i)
        {
            Data[Cnt++] = Pow(i, A)*B+C;
        }
    }
    printf("%I64d\n", Cnt);
    for(i=0; i<Cnt; ++i)
    {
        printf("%I64d ", Data[i]);
    }
    return 0;
}


/*interface*/
#include<stdio.h>
#include<math.h>
/*interface implementation*/
long long power(long long x,int a) {
    int i;
    long long prod=1;
    for(i=0; i<a; i++) {
        prod*=x;
    }
    return prod;
}
int s(int n) {
    int sum=0;
    while(n>0) {
        sum+=(n%10);
        n=n/10;
    }
    return sum;
}
/*client*/
int main() {
    //因为x是1到10^9之间的整数，
    //所以s(x)的最小值是1，最大值是9*8
    long long a,b,c;
    scanf("%Ld%Ld%Ld",&a,&b,&c);
    int rn=0;
    int record[9*8+1];
    long long sx;
    for(sx=1; sx<=9*8; sx++) {
        //取消对pow的使用！
        long long x=b*power(sx,a)+c;
        if(x<1000000000) {
            if(s(x)==sx) {
                //if(fabs(s(x)-sx)<0.0000001) {
                //printf("s(%Ld)=%Ld=%d\n",x,sx,s(x));
                //这里不记录10^9以上的，我的判断是对的！
                record[rn]=x;
                rn++;
            }
        }
    }
}
printf("%d\n",rn);
int i;
for(i=0; i<rn; i++) {
    printf(" %d",record[i]);
}
printf("\n");
//printf("%Ld\n",(long long)(9998*50*50*50*50*50+9998));
return 0;
}


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

typedef struct p{
	int x, y;
}ponto;

// retorna o angulo no vértice "a"
float isRightAngle(ponto a, ponto b, ponto c){
	if( (a.x == b.x && a.y == b.y) ||
		(p1.x == c.x && p1.y == c.y) ||
		(b.x == c.x && b.y == c.y) ){
		return 0;
	}

	int del_x1 = (b.x - a.x),
		del_x2 = (c.x - a.x),
		del_y1 = (b.y - a.y),
		del_y2 = (c.y - a.y);

	return (del_x1*del_x2 + del_y1*del_y2) == 0;
}

// triangulo, t, é um vetor de pontos
int check(ponto *t){
	if(isRightAngle(t[0], t[1], t[2]) ||
		isRightAngle(t[1], t[0], t[2]) ||
		isRightAngle(t[2], t[1], t[0]))
		return 0;

	int i;
	ponto triangulos[12]; // contém as 4 configurações possívels para o triangulo em cada ponto
	// circula os inteiros vizinhos, começando à esquerda, sentido antihorário
	for (i = 0; i < 3; i++){
		triangulos[4*i] = t[i]; triangulos[4*i].x -=1;
		triangulos[4*i+1] = t[i]; triangulos[4*i+1].y -=1;
		triangulos[4*i+2] = t[i]; triangulos[4*i+2].x +=1;
		triangulos[4*i+3] = t[i]; triangulos[4*i+3].y +=1;
	}

	for(i=0; i<4; i++){
		if(isRightAngle(triangulos[i], t[1], t[2]) ||
			isRightAngle(t[1], triangulos[i], t[2]) ||
			isRightAngle(t[2], t[1], triangulos[i]))
			return 1;
		if(isRightAngle(t[0], triangulos[i+4], t[2]) ||
			isRightAngle(triangulos[i+4], t[0], t[2]) ||
			isRightAngle(t[2], triangulos[i+4], t[0]) )
			return 1;
		if(isRightAngle(t[0], t[1], triangulos[i+8]) ||
			isRightAngle(t[1], t[0], triangulos[i+8]) ||
			isRightAngle(triangulos[i+8], t[1], t[0]) )
			return 1;
	}

	return -1;

}

void main(){
	ponto p[3], origem;
	scanf("%d %d %d %d %d %d", &p[0].x, &p[0].y, &p[1].x, &p[1].y, &p[2].x, &p[2].y);
	if( (p[0].x == p[1].x && p[0].y == p[1].y) ||
		(p[0].x == p[2].x && p[0].y == p[2].y) ||
		(p[1].x == p[2].x && p[1].y == p[2].y) ){
		printf("NEITHER\n");
		return;
	}

	switch(check(p)){
		case 0:
			printf("RIGHT\n");
		break;
		case 1:
			printf("ALMOST\n");
		break;
		case -1:
			printf("NEITHER\n");
		break;
		default:
			printf("NEITHER!\n");
	}
}


#include <stdio.h>

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


#include <stdio.h>
#include <conio.h>
int buocnhay(int a, int b,int n);
int main(){
    int d=0,a=0,b=0,n=0,i=0;
	int c[10000];
	scanf("%d",&n);
	    a=1;
	    b=1;
	    c[b]=-2;
	for (a=1;a<n;a++){
		b=buocnhay(a,b,n);
		c[b]=-2;
	}
	for (i=1;i<=n;i++)
		if (c[i]!=-2) d=123;
		if (d!=123) printf("YES");
		else printf("NO");
}
}
int buocnhay(int a,int b,int n)
{
	if (a+b<=n) return a+b;
	if (a+b>n) return a+b-n;
}


#include <stdio.h>

int main()  {
    int n;
    scanf("%d", &n);
    printf("%s", n&(n-1) : "YES" ? "NO");
    return 0;
}


#include<stdio.h>
  int main(){
	  int i,j,n;

	  scanf("%d"&n);

	  n&(n - 1) ? printf("N0") : printf("YES");

	  return 0;
  }


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cmath>

#define MIN(a,b) (a)<(b)?(a):(b)
#define MAX(a,b) (a)>(b)?(a):(b)

using namespace std;

typedef long long lolo;
typedef pair<int, int> pii;

const int maxn = 100005;
const int inf = 0x3f3f3f3f;

int main() {
    char s[110];
    scanf("%s",s);
    int len=strlen(s);
    int cnt=0,l[2]={0,0};
    bool use=true,oc[2]={false,false};
    if(len==1) {
        printf("0\n");
        return 0;
    }
    if(len==2&&s[0]==s[1]) {
        printf("1\n");
        return 0;
    }
    for(int i=0;i<len;i++) {
        if(s[i]=='V') {
            if(i+1<len&&s[i+1]=='K')
                cnt++;
            l[0]++;
            l[1]=0;
            oc[0]=true;
            if(l[0]>2) {
                cnt+=use;
                use=false;
            }
        } else {
            l[1]++;
            l[0]=0;
            if(l[1]>2) {
                cnt+=use;
                use=false;
            }
        }
    }
    printf("%d\n",cnt);
    return 0;
}


#include <stdio.h>
#define N 1000
int a,b,c,d,n,m,turn=0,x,y,pAnt=-1;
char mat[N][N];

int esPosible(int iActual,int jActual,int p){
	if(p==0){
		x=-1;y=0;
	}
	else if(p==3){
		x=0;y=-1;
	}
	else if(p==1){
		x=0;y=+1;
	}
	else if(p==2){
		x=+1;y=0;
	}
	if((iActual+x>=0&&jActual+y>=0&&iActual+x<n&&jActual+y<m)&&(mat[iActual+x][jActual+y]=='.')&&turn<=2) return 1;
	else return 0;

}

int back(int iActual,int jActual){
	int p,r,s,i,j,aux;
	if(mat[c][d-1]=='V') return 1;
	if(mat[c][d+1]=='V') return 1;
	if(mat[c-1][d]=='V') return 1;
	if(mat[c+1][d]=='V') return 1;
	for(p=0;p<4;p++){
		if(esPosible(iActual,jActual,p)){
			r=x;s=y;
			if((p+pAnt)%2==1&&pAnt!=-1){
				turn++;
			}
			aux=pAnt;
			pAnt=p;
			mat[iActual+r][jActual+s]='V';
			for(i=0;i<n;i++){
				for(j=0;j<m;j++){
					printf("%c",mat[i][j] );

				}
				printf("\n");
			}
			if((iActual+1==c||iActual-1==c)&&(jActual+1==d||jActual-1==d)) return 1;
			if(back(iActual+r,jActual+s)) return 1;
			else {
				mat[iActual+r][jActual+s]='.';
				if((pAnt+aux)%2==1&&aux!=-1){
				turn--;
			}
			}
		}
	}
	return 0;
}


#include <stdio.h>

int main(void) {

	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d", 3*a - b > 0 : 0);
}


#include <cstdio>

int main()
{
    int n, k;
    scanf("%d%d", &n, &k);
    printf("%d\n", k <= n * 3 ? n * 3 - k : 0);
    return 0;
}


#include<stdio.h>
inline int scanInt() {
       register int d,retVar=0;
       while((d=getchar())<'0');
       do {
           retVar = (retVar<<3) + (retVar<<1) + d - '0';
       } while((d=getchar())>='0');
       return retVar;
}
int main()
{
         int n,k,a;
         n=scanInt();
         k=scanInt();
         a=k-2*n;
         if(a<n)
         printf("%d\n",(n-a));
         else
         printf("0\n");
         return 0;
}


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


ll find_min(int n, int l){

	ll x = n-l + 1;
	ll ans = x ;
	ll base = 2;
	for(ll i = x ; i < n ; i++){
		ans += base;
		base *= 2;
	}
	return ans;
}

ll find_max(int n, int r){

	ll ans = 0;
	ll base = 1;
	for(ll i = 1 ; i <= n ; i++){
		ans += base;
		if(i < r)
			base *= 2;

	}

	return ans;
}

int main()
{
	int n , l , r;
	scanf("%d%d%d",&n,&l,&r);

	ll mn = find_min(n,l);
	ll mx = find_max(n,r);

	printf("%lld %lld\n",mn,mx);
    return 0;
}


#include <iostream>
#include<stdio.h>
#include<stack>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<queue>
using namespace std;
typedef long long ll;
const ll INF=0x3f3f3f3f;
ll k,kmax,kmin,t,m,i,j,l,n,x,y,z;
char a[100000+5],b[100000+5],o[2000];
int main()
{
    scanf("%lld%lld%lld",&x,&y,&z);
    ll sum=0;
    t=0;
    ll g=1;
    ll j=1;
    for(i=1;; i*=2)
    {
        sum+=i;
        if(j==y)
            break;
        j++;
    }
    sum+=x-y;
    ll min1,max2;
    min1=sum;
    sum=0;
    j=1;
    for(i=1;; i*=2)
    {
        sum+=i;
        if(j==z)
            break;
        j++;
    }
    sum+=(x-z)*i;
    max2=sum;
    printf("%lld %lld\n",min1,max2);
}


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

int main()
{
    int n,l,r;
    scanf("%d %d %d",&n,&l,&r);
    //int max[1000],min[1000];
    int p=1,ndiff=1;
    int mins=0,maxs=0;
    for(int i=0;i<n;i++)
    {
        mins+= p;
        if(ndiff<l)
        {
            p*=2;
            ndiff++;
        }
        else if(ndiff==l)
            p=1;
    }
    ndiff=1;p=1;
    for(int i=0;i<n;i++)
    {
        maxs+=p;
        if(ndiff<r)
        {
            p*=2;
            ndiff++;
        }
    }
    printf("%d %d\n",mins,maxs);
    return 0;
}
~
~


#include<stdio.h>
int main()
{
    int n,l,r,i,j,sum=0,sub;
    scanf("%d%d%d",&n,&l,&r);
    int ara[n];
    for(i=1;i<=l-1;i++){
        sum+=2;
    }
    sub=n-l+1;
    int min=sum+(sub);
    sum=0;
    sub=0;
    j=1;
    for(i=1;i<=r;i++){
        sum=sum+j;
        j=j*2;
    }
    sub=(n-r)*(j/2);
    int max=sum+sub;
    printf("%d %d\n",min,max);
}


#include <stdio.h>
#include <math.h>
int main()
{
    long long  n,l,r,min=0,max=1,dif=1,x=0;
    scanf("%lld %lld %lld",&n,&l,&r);
   y:{ dif=1;
        for(;x<n-1;x++)
    {
        if(dif<=r){
            max+=pow(2,dif);
            dif++;
        }
        else
        if(dif==1)max+=2;
        goto y;
    }
   }
    dif=1;
    for(x=0;x<n;x++)
    {
        if(dif<l){
            min+=pow(2,dif);
            dif++;
        }
        else
        min+=1;
    }
    printf("%d %d",min,max);
}


#include<stdio.h>
int main(){
int n,i,t;
int f=-1;
scanf("%d%d",&n,&t);
if(t==10){if(n==1){printf("-1");}
else{for(i=0;i<n;i++){printf("1");}
printf("0");}
else{for(i=0;i<n;i++){printf("%d",t);}}
}


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


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


#include <iostream>
using namespace std;

int main()
{
    int n,t,j;
    cin>>n>>t;

    if(t>=2 && t<=9){
        while(1){
            for(j=1;j<=n;j++){
            cout<<t;
            }
            return 0;
        }
    }
    else if (t==10){
        if(n==1){
            cout<<-1;
        }
        else{
            for(j=1;j<=n-1;j++){
                    t=t*10;
                cout<<t;
                return 0;
            }
        }
    }
    else{
        cout<<-1;
    }
}


include<stdio.h>
int main()
{
    int n,a,b,c,sum=0,min;
    scanf("%d\n%d\n%d\n%d\n",&n,&a,&b,&c);
    min=a;
    if(b<a)
    min=b;
    if(c<min)
    min=c;
    if(min==c)
    {
        if(a<b)
        sum=a+c*(n-1);
        else
        sum=b+c*(n-1);
    }
    if(min==a||min==b)
    {
        sum=a*(n-1)
    }
    if(n==1)
    printf("0");
    printf("%d",sum);
    return 0;
}


#include<stdio.h>
int main()
{
    int n,a,b,c,sum=0,min;
    scanf("%d\n%d\n%d\n%d\n",&n,&a,&b,&c);
    min=a;
    if(b<a)
    min=b;
    if(c<min)
    min=c;
    if(min==c)
    {
        if(a<b)
        sum=a+c*(n-2);
        else
        sum=b+c*(n-2);
    }
    if(min==a)
    {
        sum=a*(n-1);
    }
    if(min==b)
    sum=b@(n-1);
    else if(n==1)
    printf("0");
    printf("%d",sum);
    return 0;
}


#include<stdio.h>
int main()
{
    int n,a,b,c,sum=0,min,found=0;
    scanf("%d\n%d\n%d\n%d\n",&n,&a,&b,&c);
    min=a;
    if(b<a)
    min=b;
    if(c<min)
    min=c;

    else if(min==c)
    {
        if(n==1)
        {sum=0;
        break;}
        if(a<b)
        sum=a+c*(n-2);
        else
        sum=b+c*(n-2);
    }
    else if(min==a)
    {
        sum=a*(n-1);
    }
    else if(min==b)
    sum=b*(n-1);

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


#include<stdio.h>
int main()
{
    int n,a,b,c,sum=0,min;
    scanf("%d\n%d\n%d\n%d\n",&n,&a,&b,&c);
    min=a;
    if(b<a)
    min=b;
    if(c<min)
    min=c;
    if(min==c)
    {
        if(a<b)
        sum=a+c*(n-2);
        else
        sum=b+c*(n-2);
    }
    if(min==a||min==b)
    {
        sum=a*(n-1)
    }
    if(n==1)
    printf("0");
    printf("%d",sum);
    return 0;
}


#include<stdio.h>
void main()
{
    int n, m;
    scanf("%d", &n);
    scanf("%d", &m);

    n = n % 2 == 1 : n - 1;

    if(m<(n/2))
    {
        printf("%d",m);
        return;
    }

    int left = n - m;

    printf("%d",m);
}


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

 int n,m,e,h;
     scanf("%d%d",&n,&m);
     e=n-m;
     h=m;
     if (m==0||m==1)
     {
         printf("1");

     }
     else if (m==n)
     {

         printf("0");
     }
     else if (n!=0&&m>=n/2)
     {
          printf("%d",e);
     }
    else
    {
         printf("%d",h);
    }

    return 0;


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


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


#include<stdio.h>
#define N 15
int sum=0;
int counter=0;
int n,r,l,x;
int c[N];
int b[N];
void sort(int *a, int n) {
  int i,j;
  for(i=0;i<n-1;i++) {
    int k=i;
    for(j=i+1;j<n;j++) {
      if(a[j]<a[k]) {
        k=j;
      }
    ｝
    //there we only swap min with a[i];
    int tmp=a[k];
    a[k]=a[i];
    a[i]=tmp;
  ｝
｝
void dfs(int start,int deep) {
  int i;
  if(deep==0) {
    for(i=0;i<n-1;i++) {
      b[0]=c[i];
      sum+=c[i];
      dfs(i,deep+1);
      b[0]=0;
      sum-=c[i];
    }
  } else {
    for(i=start+1;i<n;i++) {
      b[deep]=c[i];
      sum+=c[i];
      //if sum is exceed, then next element we don't need.
      if(sum<=l) {
        //if x and r don't satisfy, add next element will satisfy, when all condition is satisfy, we will count once.
        if(b[deep]-b[0]>=x && sum>=r){counter++;
        ｝
        dfs(i,deep+1);
        b[deep]=0;
        sum-=c[i];
      }
    }
  }

int main() {
  scanf("%d%d%d%d",&n,&l,&r,&x);
  int i;
  for(i=0;i<n;i++) {
    scanf("%d",&c[i]);
  }
  sort(c,n);
  dfs(0,0);
  printf("%d",counter);

  return 0;
}


#include<stdio.h>
#define N 15
int sum=0;
int counter=0;
int n,r,l,x;
int c[N];
int b[N];
void dfs(int start,int deep) {
  int i;
  if(deep==0) {
    for(i=0;i<n-1;i++) {
      b[0]=c[i];
      sum+=c[i];
      dfs(i,deep+1);
      b[0]=0;
      sum-=c[i];
    }
  } else {
    for(i=start+1;i<n;i++) {
      b[deep]=c[i];
      sum+=c[i];
      //if sum is exceed, then next element we don't need.
      if(sum<=l) {
        //if x and r don't satisfy, add next element will satisfy, when all condition is satisfy, we will count once.
        if(b[deep]-b[0]>=x && sum>=r) {
          counter++;
        ｝
        dfs(i,deep+1);
        b[deep]=0;
        sum-=c[i];
      }
    }
  }

int main() {
  scanf("%d%d%d%d",&n,&l,&r,&x);
  int i;
  for(i=0;i<n;i++) {
    scanf("%d",&c[i]);
  }
  sort(c,n);
  dfs(0,0);
  printf("%d",counter);

  return 0;
}


#include<stdio.h>
#define N 15
int counter=0;
int n,r,l,x;
int c[N];
int b[N];
int nb=0;
void sort(int *a, int size) {
    int i,j;
    for(i=0; i<size-1; i++) {
        int k=i;
        for(j=i+1; j<size; j++) {
            if(a[j]<a[k]) {
                k=j;
            }
        }
        //there we only swap min with a[i];
        int tmp=a[k];
        a[k]=a[i];
        a[i]=tmp;
    }
}
void (int set,int select,int total,int choose) {
  if(select==choose) {
        int sum=0;
        int j;
        for(j=0; j<choose; j++) {
            sum+=b[j];
        }
        if((sum<=r) && (b[choose-1]-b[0]>=x) && (sum>=l)) {
            counter++;
        }
    } else {
        int i;
        for(i=set; i<total; i++) {
            b[select]=c[i];
            comb(set+1,select+1,total,choose);
        }
    }
}

int main() {
    scanf("%d%d%d%d",&n,&l,&r,&x);
    int i;
    for(i=0; i<n; i++) {
        scanf("%d",&c[i]);
    }
    sort(c,n);
    for(i=2;i<=n;i++) {
      comb(0,0,n,i);
    }
    printf("%d\n",counter);

    return 0;
}


#include<stdio.h>
#define N 15
int counter=0;
int n,r,l,x;
int c[N];
int b[N];
int nb=0;
void print(int *a, int size) {
    int i;
    for(i=0; i<size; i++) {
        printf(" %d",a[i]);
    }
    printf("\n");
}
void sort(int *a, int size) {
    int i,j;
    for(i=0; i<size-1; i++) {
        int k=i;
        for(j=i+1; j<size; j++) {
            if(a[j]<a[k]) {
                k=j;
            }
        }
        //there we only swap min with a[i];
        int tmp=a[k];
        a[k]=a[i];
        a[i]=tmp;
    }
}
void (int set,int select,int total) {
  if(select==total
        int sum=0;
        int j;
        for(j=0; j<nb; j++) {
            sum+=b[j];
        }
    /*
    printf("sum = %d\n",sum);
        printf("r=%d, sum=%d, l=%d\n",r,sum,l);
        printf("max=%d, x=%d, min=%d\n",b[nb-1],x,b[0]);
    */
        if((sum<=r) && (b[nb-1]-b[0]>=x) && (sum>=l)) {
            counter++;
        /*printf("counter = %d\n",counter);
            print(b,nb);
        */
        }
    }
    if(deep==n) return;
    else {
        int i;
        for(i=start+1; i<n; i++) {
            b[nb]=c[i];
            nb++;
            dfs2(i,deep+1);
            nb--;
        }
    }
}

int main() {
    scanf("%d%d%d%d",&n,&l,&r,&x);
    int i;
    for(i=0; i<n; i++) {
        scanf("%d",&c[i]);
    }
    sort(c,n);
    for(i=2;i<=n;i++) {
      comb(0,0,i);
    }
    printf("%d\n",counter);

    return 0;
}


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

   long long int n,k,t,d=0,f=0,i,m=0;
   scanf("%lld %lld %lld",&n,&k,&t);
   if(k>=t){
    printf("%lld",t);
   }
   else if(n<=t&&t<n+k){
        printf("%lld",n+k-t);

   }

   else if(k<=t{

    if(t<=n){
        printf("%lld",k);
    }

   }
   return 0;

}


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


#include<iostream>
using namespace std;
int main(){
	long int n, k, t;
	cin>>n>>k>>t;
	if(t<=k){
		cout<<t<<endl;
	}
	if(t>k && t<=n){
		cout<<k<<endl;
	}
	if(t>n){
		cout<<k-(t-n)<<endl;
	}
	return 0;
}


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


#include <stdio.h>

int main(){
  int i, n,k,t;
  scanf("%d %d %d", &n, &k, &t);
  if(t<k){
    printf("%d\n", t);
  }else if(t>k && t<=n){
    printf("%d\n", k);
  }else{
    printf("%d\n", k-(t-n));
  }
  return 0;
}


#include <stdio.h>

int rev(int a)
{
    int r,sum=0;
    while(a>0){
        r=a%10;
        a/=10;
        sum=sum*10+r;
    }
    return sum;
}

int main()
{
   int a1,a2;

   scanf("%d %d",&a1,&a2);
   //printf("%d",rev(1234));
   printf("%d",a1+revl(a2));
    return 0;
}


int func(int a, int b)
{
	int result;
	int b1 = 0;
	while(b>0)
	{
	   b1 = b1*10 + b%10;
	   b /= 10;
	}
	result = a + b1;
	return result;
}


int main(int a, b)
{
    int result;
    int b1 = 0;
    while(b>0)
    {
       b1 = b1*10 + b%10;
       b /= 10;
    }
    result = a + b1;
    return result;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
	int m,a;
	char n[10];
	scanf("%d %s",m,n);//reverse n
	strrev(n);
	a=m+itoa(n);
	printf("%d\n",a);
	return 0;
}


#include <stdio.h>
int main(){
  long long a,b;
  scanf("%lld %lld",&a,&b);
  long long c=0;
  while(b){
    c*=10;
    c+=(b%10);
    b/=10;
  }
  printf("%lld\n",a+c);
}


/*
 * P4.c
 *
 *  Created on: Feb 1, 2017
 *      Author: mar2h
 */

void p4(void){
	int n;
	scanf("%d",&n);
	switch (n){
	case 0 :
		printf("I'm too stupid to solve this problem");
		break;
	case 1:
		printf("1 0 0");
		break;
	case 2:
		printf("1 1 0");
		break;
	}
	int arr[n];
	arr[0]=0;
	arr[1]=1;
	int i;

	for(i=2;1;i++){
		arr[i]=arr[i-1]+arr[i-2];
		if(arr[i] == n){
			printf("%d %d %d",arr[i-1],arr[i-3],arr[i-4]);
			return;
		}
	}
}
int main(void){
    p4();
    return 0;
}
}


#include<stdio.h>

void main(){
     double k0,k1,k2,k3,k4,a;
     scan("%f",&a);
     if(a==0 || a==1 || a==2)
     {
             printf("I'm too stupid to solve this problem");
             }
     else
     {
     for(k2=1,k3=2;k4!=a;)
     {
        k0=k1;
        k1=k2;
        k2 = k3;
        k3=k4;
        k4=k2+k1;
      }

     printf("%.0f %.0f %.0f",k0,k1,k3);
     }
     }


#include<stdio.h>
#include<stdlib.h>
int i,x,*arr,memo[3];
int choose(int sum,int  z)
{
    int d;
    if(z==3&&sum==x) return 1;
    if(z>2&&sum!=x) return 0;
    for(int j=0;j<i;j++)
    {
        memo[z]=arr[j];
        d=choose(sum+arr[j],z+1);
        if(d==1)return 1;
    }
    return 0;
}
int main()
{
   // create series
   int j,d;
   scanf("%d",&x);
  arr= (int *) malloc (sizeof(int)*x);
   arr[0]=1;
   arr[1]=1;
   i=1;
   while(arr[i]<x)
   {

        i++;
         arr[i]=arr[i-1]+arr[i-2];

   }
   d=choose(0,0);
   if(d==1)
    printf("%d %d %d",memo[0],memo[1],memo[2]);
   else
    printf("I'm too stupid to solve this problem");
       return 0;
}


#include <stdio.h>

int min3 (int a,int b,int c){
    int min =a;
    if (b<min) min=b;
    if (c<min) min=c;
    return min;
}
int min2 (int a.int b){
    if (a>b) return b;
    else return a;
}
int main(){
     int k2, k3, k5, k6 ;
     do {
        scanf("%d%d%d%d",&k2,&k3,&k5,&k6);
    } while ( k2<0 || c2>5*1e6 || k3<0 || c3>5*1e6 || k6<0 || k6>5*1e6 || k5<0 || k5>5*1e6);
    int so256 = min (k2,k5,k6);
    k2 -= so256;
    if (k2<0) k2=0;
    int so32 = min(k2,k3);
    int tong = so256 *256 + so32 *32;
    pritnf("%d",tong);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
     int t2,t3,t5,t6;
     int s[10];
     int a[10];
     int sum = 0;
     int k = 0;
     scanf("%d%d%d%d",&t2,&t3,&t5,&t6);
        s[0] = t2;
        s[1] = t5;
        s[2] = t6;
        sort(s,s+3);
        sum = s[0]*256;
        k = t2 -s[0];
        if(k > 0){
            a[0] = k;
            a[1] = t3;
            sort(a,a+2);
            sum += a[0]*32;
            }
            printf("%d",sum);
       return 0;
}


//CodeForces Problem Set 734B

#include<stdio.h>

int min(int num1, int num2);

int main()
{
	int k2, k3, k5, k6;
	scanf("%d %d %d %d", &k2, &k3, &k5, &k6);
	int no256, no32, ans = 0;
	no256 = min(min(k5, k6,), k2);
	k2 -= no256;
	no32 = min(k2, k3);
	ans = 32*no32 + 256*no256;
	printf("%d", ans);
	return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
	long long float x,y;
	scanf("%llf",&x);
	scanf("%llf",&y);
	long long double result1= pow(x,y);
	long long double result2= pow(y,x);
	if(result1>result2)
		printf(">");
	else if(result1<result2)
		printf("<");
	else
		printf("=");
}


#include<stdio.h>
#include<math.h>
int main()
{
    long x,y;
    scanf("%d",&x);
    scanf("%d",&y);
        float logx = y*(log10(x));
    float logy = x*(log10(y));
    float diff = logx-logy;
    if(x == y)
        printf("=")l
    if(diff > 0)
        printf(">");
    else
        printf("<");
    return 0;
}


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

int main()
{
    int x,y;
    scanf("%d%d",&x,&y);
    if(x*log(y)>y*log(x))
    {
        printf(">");
        break;
    }
    else
    (x*log(y)<y*log(x)?printf("<"):printf("="));
    return 0;
}


#include <stdio.h>

int main() {
	long int x,y;
	scanf("%ld %ld",&x,&y);
	if(x==y)
	    printf("=");
	else if((x==2)&&(y==3))
	    printf("<");
	else if((x==3)&&(y==2))
	    printf(">");
	else if(((x==2)&&(y==4))||((x==4)&&(y==2)))
	    printf("=");
	else if(x==1)
	    printf("<");
	else if(y==1)
	    printf(">")
	else if(x<y)
	    printf(">");
	else
	    printf("<");
	return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    long x,y;
    scanf("%d",&x);
    scanf("%d",&y);
    float logx = ylog(x);
    float logy = xlog(y);
    if(logx>logy)
        printf(">");
    else if(logx<logy)
        printf("<");
    else
        printf("=");
    return 0;
}


include <stdio.h>
int main()
{
	int t;
	scanf("%d",&t);
	while(t--) {
	    int n;
	    scanf("%d",&n);
		if(a[i]>=12||a[i]==3||a[i]==6||a[i]==7||a[i]==9||a[i]==10)
		    printf("YES\n");
		else
		printf("NO\n");
	}
	return 0;
}


#include<stdio.h>
int chunk(int x){
          if(x%a == 0 || x%b == 0 )
            return 1;
          if(x>7)
            return chunk(x-7);
          else
            return 0;
}

int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        int x;
        scanf("%d",&x);
        int c = chunk(x);
        if(c)
         printf("YES\n");
        else
         printf("NO\n");

    }
}


#include<stdio.h>
int main(){
    int n,i;
    scanf("%d",&n);
    for(int j = 1;j <= n;j++){
        scanf("%d",&i);
        for(int k = 1;k <= i;k++){
            for(int l = 1;l <= i;l++){
                 if(i%3 == 0||i%7 == 0||i == 7k+3l){
                     printf("YES\n");
                 }
            }
        }
        else
        printf("NO\n");
    }
    return 0;
}


include<stdio.h>
int main()
{
	int t;
	scanf("%d",&t);
	while(t--) {
	    int n;
	    scanf("%d",&n);
		if(n == 1||n == 2 || n == 4 || n == 5 || n == 8)
		    printf("NO\n");
		else
		printf("YES\n");
	}
	return 0;
}


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

int main() {
    int T scanf("%d\n", &T);
    for(int ti = 0, tn = T ; ti < tn ; ++ti) {
        int X; scanf("%d\n", &X); bool found = false;
        for(int i = 0 ; 7*i <= X && !found ; ++i)
             found = ((X - 7*i) % 3 == 0);
        printf("%s\n", found ? "YES" : "NO");
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(){
	int n,k,a,b,i,j,t;
 	unsigned long long sum=0;
	scanf("%d%d%d%d",&n,&k,&a,&b);
	while(n>1){
		if(n%k==0){
			if((n-n/k)*a>b){
				sum+=b;
			}
			else{
				sum+=a*(n-n/k);
			}
			n/=k;
		}
		else{
			if(n/k){
				sum+=a*(n%k);
				n-=n%k;
			}
			else{
				sum+=a*(n-1);
				n=1;
			}
		}
	}
	printf("%I64d",sum);
	return 0;
}


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

#define CONTINUE 0

int main(void)
{
	long long n, k, A, B;
	long long cost = 0;

#if CONTINUE
	while (1)
	{
#endif
		scanf("%I64d", &n);
		scanf("%I64d", &k);
		scanf("%I64d", &A);
		scanf("%I64d", &B);
		cost = 0;

		if (k > 1)
		{
			while (n > 1)

			{
				if ((n > k) && (n % k))
				{
					cost = cost + A * (n % k);
					n = n - n % k;
				}
				if (n >= k)
				{
					if (B <= A * (n - n / k))
					{
						cost += B;
						n /= k;
					}
					else
					{
						cost += A * (n - n / k));
						n /= k;
					}
				}
				else
				{
					cost += A * (n - 1);
					n = 1;
				}
			}
		}
		else
		{
			cost = A * (n - 1);
		}
		printf("%I64d\n", cost);
#if CONTINUE
	}
#endif
	return 0;
}


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

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

int main()
{
    int n,d;
    scanf("%d %d",&n,&d);
    int countold=0;
    int *arr=malloc(sizeof(int )*n);
    for(int k=0;k<n;k++)
        scanf("%d",&arr[k]);
    qsort(arr, n, sizeof(int), cmpfunc);
    for(int i=0;i<n-1;i++)
    {
        int count=0;
        for(int j=i+1;j<n;j++)
        {
            if(abs(arr[j]-arr[i])<=d)
            {
                count++;

            }
            else {

                break;
            }

            if(count>countold)
                countold=count;
    }
    printf("%d",countold);
  return 0;
}
*/
int main()
{
    long long n,k,cost=0,a,b;
    scanf("%I64d",&n);
    scanf("%I64d",&k);
    scanf("%I64d",&a);
    scanf("%I64d",&b);

    if(k>n)
        printf("%I64d",a*(n-1));
        printf("%I64d",n%k);
    else if(n/k<2 && n/k>1)
        printf("%I64d",a*(n-k)+b);
    else if(b>a*(n-1))
        printf("%I64d",a*(n-1));
        else if(n==1)
            printf("0");
        else
        if(n==2 )
        {
            if(k==2 &&b<a){
                    n=n/2;
                printf("%I64d",b);
            }
        else{
                printf("%I64d",a);
                n=n/2;
        }
        }
    else
        {
    while(n!=1)
    {
        if(n==2)
        {
            if(k==2 && b<a)
            {
            n=n/2;
            printf("%I64d",cost+b);
            }
                else {
                        n=n/2;
                printf("%I64d",cost+a);
                }
        }
        else
        {
        if((n%k)!=0)
        {
            n--;
            cost=cost+a;
        }
        else
        {
            n=n/k;
            cost=cost+b;
        }
    }
    }
 }
 return 0;
}


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

int main()
{
    long long n,k,cost=0,a,b;
    scanf("%I64d",&n);
    scanf("%I64d",&k);
    scanf("%I64d",&a);
    scanf("%I64d",&b);

    if(k>n)
        printf("%I64d",a*(n-1));
        printf("%I64d",n%k);
    else if(n/k<2 && n/k>1)
        printf("%I64d",a*(n-k)+b);
    else if(b>a*(n-1))
        printf("%I64d",a*(n-1));
        else if(n==1)
            printf("0");
        else
        if(n==2 )
        {
            if(k==2 &&b<a){
                    n=n/2;
                printf("%I64d",b);
            }
        else{
                printf("%I64d",a);
                n=n/2;
        }
        }
    else
        {
    while(n!=1)
    {
        if(n==2)
        {
            if(k==2 && b<a)
            {
            n=n/2;
            printf("%I64d",cost+b);
            }
                else {
                        n=n/2;
                printf("%I64d",cost+a);
                }
        }
        else
        {
        if((n%k)!=0)
        {
            n--;
            cost=cost+a;
        }
        else
        {
            n=n/k;
            cost=cost+b;
        }
    }
    }
 }
 return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="Our Tanya is crying out loud" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/Our Tanya is crying out loud" 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/Our Tanya is crying out loud" 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>
int main(){
char s[100],length;
 scanf("%s",s);
 length = strlen(s);
   for(int i=0;i<length;i+=2){
   for(int j=0;j<length-i-2;j+=2){
            if(s[j]>s[j+2]){
                swap(s[j],s[j+2]);
            }
        }
   }
   printf("%s",s);
   return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 int main()
 {char ch[101];
 char out[101];
 out=NULL;
 scanf("%s",ch);
 while(strchr(ch,'3'))
 {
    while(strchr(ch,'2'))
    {
        while(strchr(ch,'1'))
        {
         strcat(out,"+1");
         strncpy(strchr(ch,'1'),"+",1);
}
     strcat(out,"+2");
     strncpy(strchr(ch,'2'),"+",1);
 }
  strcat(out,"+3");
  strncpy(strchr(ch,'3'),"+",1);
}
 printf("%s",out+1);
 return 0;
 }


int main()
{
    int i;

    char string [100];

    gets(string);

    for(i=0;i<=100;i=i+2)

    { if(string[i]<=string[i+2])

      {string[i]=string[i];}

      else
      {string[i]=string[i+2]}
    }

    printf("%s",string);

}


#include<stdio.h>
int main()
{
 char str[100],a;
 scanf("%s",str);
 int i=0,j;
 while(str[i]!=0)
 {
 while(str[j]!=0)
 {
  j=i+2;
  if(str[j]<str[i])
  {
   c=str[i];
   str[i]=str[j];
   str[j]=a;
 }
 j=j+2;
 }
 i=i+2;
}
i=i-1;
str[i]='\0';
printf("%s",str);
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    char s[100];
    cin>>s;
    int i,j,d,t;
    d=strlen(s);
    for(i=0;i<=d-3;i+=2)
    {
        for(j=i+2;j<=d-1;j+=2)
        {
            if(s[i]>s[j]&&s[i]!='+'&&s[j]!='+')
            {
                t=s[i];
                s[i]=s[j];
                s[j]=t;
            }
        }
    }
    cout<<s;
}


#include <stdio.h>
#define MAXN 1519999999
char ciur[MAXN];
int n;

void ciurul(){

    int i, j;
    for(i = 0;i < n; ++i)
        ciur[i] = 0;

    for(i = 2;i <= n; ++i){
        if(ciur[i] == 0)
            for(j = 2;i * j <= n; ++j)
                ciur[i * j] = 1;
    }
}

int main(){

    int i, total = 1, m;
    scanf("%d",&n);
    ciurul();
    m = n;
    while(m > 1){
        if(ciur[n] == 0){
            m = m - n;
            n = m;
            ++total;}
        else
            --n;
    }
    printf("%d",total);

}


#include<cstdio>
#include<cmath>
using namespace std;
bool is_prime(long long n)
{
    if(n==2||n==3)return 1;
    for(long long i=2;i<=sqrt(n);++i)
    {
        if(n%i==0)
            return 0;
    }
    return 1;
}
int main()
{
    long long x;
    scanf("%Ld",&x);
    if(x<=1)
    {
        printf("1\n");
        return 0;
    }
    if(is_prime(x))printf("1\n");
    else
    {
        if(x%2==0)printf("2\n");
        else
        {
            if(is_prime(x-2))printf("2\n");
            else
            printf("3\n");
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
bool isprime(int n) {
    if(n < 2)
        return false;
    for(int i = 2; i * i <= n; i++)
        if(n % i == 0)
            return false;
    return true;
}
int main() {
    int n;
    cin >> n;
    if(isprime(n))
        cout << 1 << endl;
    else
        if(n % 2 == 0)
            cout << 2 << endl;
        else
            if(isprime(n - 2))
                cout << 2 << endl;
            else
                cout << 3 << endl;
    return 0;
}


#include<stdio.h>
int n;
bool prime();
bool p[2000000010];
int main(){
    int i,j,t;
    scanf("%d",&n);
    t=2000000010;
    p[0]=p[1]=false;
    for(i=2;i<t;i++){
        p[i]=true;
    }
    for(i=2;i*i<t;i++){
        if(p[i]){
            for(j=i*i;j<=t;j+=i){
                p[j]=false;
            }
        }
    }
    j=1;
    while(!prime()){
        j++;
    }
    printf("%d",j);
    return 0;
}
bool prime(){
    int i;
    if(p[n]){
        return true;
    }
    for(i=n-2;!p[i];i--);
    n=i;
    return false;
}


#include<stdio.h>
#include<math.h>
int isPrime(unsigned long num)
{

    unsigned long limit;
    limit = sqrt(num);
    for(div = 3 ; div <= limit ; div++)
        if(num % div == 0)
           break;
    if(div > limit)  return 1;
    else return 0;

}
int main()
{
    unsigned long num ;
    scanf("%lu" , &num);
    if(num == 2)
        printf("1");
    else if( num % 2 == 0 )
      printf("2");
    else if( isPrime(num) == 1)
      printf("1");
    else if( isPrime(num -2 ) == 1)
     printf("2");
    else
     printf("3");

    return 0;
}


#include <stdio>
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    int max=a>b?a:b;
    int ans=6-max+1;
    if(ans%2==0) printf("%d/3"ans/2);
    else if(ans==3) printf("1/2");
    else if(ans==6) printf("1/1");
    else printf("%d/6",ans);
    return 0;
}


#include<stdio.h>
int main() {
	int y,w;
	scanf("%d%d",&y&w);

	if(y>w) max=y;
	else max=w;

	if(6-max+1==1) printf("1/6\n");
	else if(6-max+1==2) printf("1/3\n");
	else if(6-max+1==3) printf("1/2\n");
	else if(6-max+1==4) printf("2/3\n");
	else if(6-max+1==5) printf("5/6\n");
	else if(6-max+1==6) printf("1/1\n");

	return 0;
}


using namespace std;

int main()
{
    int yako,wako,result;
    cin>>yako>>wako;
    if(yako == 6 || wako == 6){
        cout<<"1/6";
    }
    else if(yako == 1 && wako == 1){
        cout<<"1";
    }
    else if(yako > wako){
         result = 6 - (yako - 1);
         if(result % 2 == 0 && result>= 2){
            result = result /2;
            cout<<result<<"/3"<<endl;
         }
         else if (result % 3 == 0 && result >=3){
            result = result / 3;
            cout<<result<<"/2"<<endl;
         }
         else{
            cout<<result<<"/6"<<endl;
         }

    }else if (wako >= yako){
          result = 6 - (wako - 1);
     if(result % 2 == 0 && result>= 2){
            result = result /2;
            cout<<result<<"/3"<<endl;
         }
         else if (result % 3 == 0 && result >=3){
            result = result / 3;
            cout<<result<<"/2"<<endl;
         }
         else{
            cout<<result<<"/6"<<endl;
         }

    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int yako,wako,result;
    cin>>yako>>wako;
    if(yako == 6 || wako == 6){
        cout<<"1/6";
    }
    else if(yako == 1 && wako == 1){
        cout<<"1";
    }
    else if(yako > wako){
         result = 6 - (yako - 1);
         if(result % 2 == 0 && result>= 2){
            result = result /2;
            cout<<result<<"/3"<<endl;
         }
         else if (result % 3 == 0 && result >=3){
            result = result / 3;
            cout<<result<<"/2"<<endl;
         }
         else{
            cout<<result<<"/6"<<endl;
         }

    }else if (wako >= yako){
          result = 6 - (wako - 1);
     if(result % 2 == 0 && result>= 2){
            result = result /2;
            cout<<result<<"/3"<<endl;
         }
         else if (result % 3 == 0 && result >=3){
            result = result / 3;
            cout<<result<<"/2"<<endl;
         }
         else{
            cout<<result<<"/6"<<endl;
         }

    }
    return 0;
}


/*
 * code1.c
 *
 * Copyright 2019  <examuser@11CPU0119L>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 5ytu1 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 *
 *
 */

#include <stdio.h>

int main(int argc, char **argv)
{
	int y,b,r,total=0,least;
	scanf("%d%d%d",&y,&b,&r);
	least=9999;
	if(least>y)
	{
		least=y;
	}
	if(least>b)
	{
		least=b;
	}
	if(least>r)
	{
		least=r;
	}

	if(least==y)
	{
		if((y==b && y==r) || (y==r && b>r))
		{
			total=(r*3)-3;
			printf("%d",total);

		}
		else if(y==b && b<r)
		{
			total=(b*3);
			)
			printf("%d",total);

		}
		else if(b>r)
		{
			total=(r*3)-3;
			printf("%d",total);
		}
		else {
			total=(y*3)+3;
			printf("%d",total);

		}
	}

	if(least==b && least!=y)
	{
		if(r>b)
		{
			total=(b*3);
			printf("%d",total);

		}
		else{
				total=(r*3)-3;
				printf("%d",total);

			}
	}
	if(least==r && least!=y)
	{
		total=(r*3)-3;
		printf("%d",total);
	}
	return 0;
}


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

int main()
{
    int p,q,r;
    scanf("%d %d %d",&p,&q,&r);
    int c = min(p,min(q,r));
    printf("%d\n",c+(c-1)+(c+1));

    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{  int y,b,r,s;
   scanf("%d",&y);
   scanf("%d",&b);
   scanf("%d",&r);
   y++;
   r--;
   s=3*min(int y,int b,int r);
   printf("%d",&s);
   return 0;
}


#include<stdio.h>
int main()
{
int r,y,b;
scanf("%d",r);
scanf("%d",b);
scanf("%d",y);
if (b>=r&&y>=b)
{
b=r-1;
y=b-1;
printf("%d",r+b+y);
}
else if(b<r&&b<y)
{
    r=b+1;
    y=b-1;
}
else
{
    b=y+1;
    r=b+1;
}

}
return 0;
}


#include<stdio.h>
int min(int a,int b) {
    if(a<b)
    return a;
    else
    return b;
}
int main() {
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int r = min(b+1,c);
    int r1 = min(a-2,r);
    printf("%d",min(r,r1)*3)-3);
    return 0;
}


erview
Problem
Status
Rank (18:00:00)
0 Comments
SettingFavoriteClone
Previous12345…NextFilterReset
Username

Prob
	Result
	Time
(ms)	Mem
(MB)	Lang
	Submit Time
tasfikrahman007
C
Accepted
15	0.1
C++
5 days ago
94abrar
C
Accepted
15
C++
5 days ago

All Copyright Reserved ©2010-2017 Xu Han
Server Time: 2017-10-05 00:02:44 BST

#10868326 | 94abrar's solution for [CodeForces-864B] [Problem C]
Status
Accepted
Time
15ms
Length
578
Lang
GNU G++ 5.1.0
Submitted
2017-09-29 15:03:04
Shared

RemoteRunId
30824205
Select Code
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
	int n,i,j,k,l,flag=1;
	scanf("%d",&n);
	char x[n+1],y[n+1];
	int c[n];
    getchar();
	gets (x);
	for (i=0;i<n;i++) c[i]=0;
	j=0;
	k=0;
	for (i=0;i<n;i++){
		if (x[i]>='a' && x[i]<='z') {
			flag=1;
			y[k]=x[i];
			for (l=0;l<k;l++){
				if (y[l]==x[i]) flag=0;
			}
			if (flag==1){
				c[j]++;
			//	printf("%c ",y[k]);
			}
			k++;
		}
		else if (x[i]>='A' && x[i]<='Z') {
			j++;
			c[j]=0;
			k=0;
		}
	}
	int max=0;
	for (i=0;i<n;i++){
		if (max<c[i]) max=c[i];
	}
	printf("%d",max);
	return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
int n,m,a[1000],max,sum,o;
char str[1000];
while(scanf("%d",&n)!=EOF)
{
getchar();
gets(str);
    max=0,sum=0;
    for(i=0;i<n;i++)
	{
        if(str[i]>='A'&&str[i]<='Z')
		{
			memset(a,0,sizeof(a));
            sum=(sum>max)?sum:max;
            max=0;
        }
		else
            if(a[str[i]]==0)
			{
                a[str[i]]=1;
                max++;
            }
    }
    sum=(sum>max)?sum:max;
    printf("%d\n",sum);
}
return 0;
}


#include<iostream>
#include<string.h>
#define max(a,b) a>b?a:b;
#define min(a,b) (a>b?b:a)
int main()
{
   int T;
   while(scanf("%d",&T)!=EOF)
   {
   	while(T--)
   	{
   		int n,sum,k,w[110],v[110],dp[110][35],a[35],b[35];
   		memset(dp,0,sizeof(dp));
   		memset(a,0,sizeof(a));
   		memset(b,0,sizeof(b));
   		scanf("%d %d %d",&n,&sum,&k);
   		for(int i=0;i<n;i++)
   			scanf("%d",&v[i]);
   		for(int i=0;i<n;i++)
   			scanf("%d",&w[i]);
   		for(int i=0;i<n;i++)
   		{
   			for(int j=sum;j>=w[i];j--)
   			{
   				for(int z=1;z<=k;z++)
				{
					a[z]=dp[j][z];
					b[z]=dp[j-w[i]][z]+v[i];
				}
				for(int x=1,y=1,z=1;z<=k&&(x<=k||y<=k);)
				{
					if(a[x]>b[y])
					{
		            	dp[j][k]=a[x];
		                x++;
		            }
		            else
					{
		                dp[j][k]=b[y];
		                y++;
		            }
		            if(dp[j][k] != dp[j][k-1])
		            	k++;
				}
			}
		}
		printf("%d\n",dp[sum][k]);
	}
   }
    return 0;
}


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

#define max(a ,b)	(a > b ? a : b)
#define min(a ,b)	(a < b ? a : b)
#define MAX 200001
/*
int a[101];
int main() {
	int n ,i ,x ,y;
	scanf("%d" ,&n);
	for(i = 0;i<n;i++){
		scanf("%d" ,&x);
		a[x]++;
	}
	int total = 0;
	for(i = 1;i<=100;i++)	if(a[i])	total++;
	if(total == 2){
		int first = 0 ,second = 0;
		for(i = 1; i<=100;i++){
			if(a[i]){
				if(first){	second = a[i];	y = i;	}
				else{ first = a[i];	x = i;	}
			}
		}
		if(first == second){	printf("YES\n%d %d" ,x ,y);	}
		else printf("NO\n");
	}else printf("NO\n");
	return 0;
}
*/
/*char s[201];
int c[26];
int main() {
	int n ,i ,j;
	scanf("%d" ,&n);
	scanf(" %s" ,s);
	int ans = 0 ,x = 0;
	i = 0;
	while(i < n) {
		if(islower(s[i])){
			if(!c[s[i]-'a']){
				x++;
				c[s[i] - 'a'] = 1;
			}
		}else{
			ans = max(ans ,x);
			x = 0;
			memset(c ,0 ,sizeof(c));
		}
		i++;
	}
	ans = max(ans ,x);
	printf("%d" ,ans);
	return 0;
}*/
/*
int main(){
	int a ,b ,f ,k ,i;
	scanf("%d%d%d%d" ,&a ,&b ,&f ,&k);
	if(b < f || b < 2*(a - f) || b < 2*f)	printf("-1");
	else{
		int ans = 0 ,rem = b;
		for(i = 0 ; i < k ; i++){
			if(i == k-1){
				if(rem < a)	ans++;
			}else{
				if(i % 2 == 0){
					if(rem < f){
						printf("-1");	return 0;
					}
					if(rem >= 2*a - f)	rem -= a;
					else ans++ ,rem = b - (a - f);
				}else {
					if(rem < a - f){
						printf("-1");	return 0;
					}
					if(rem >= a + f)	rem -= a;
					else	ans++ ,rem = b - f;
				}
			}
			printf("%d " ,rem);
		}
		printf("\n%d" ,ans);
	}
	return 0;
}
*/
/*
int a[MAX] ,p[MAX] ,c[MAX];
int main() {
	int n ,i;
	scanf("%d" ,&n);
	memset(p ,-1 ,sizeof(p));
	for(i = 1 ; i <= n ; i++){
		scanf("%d" ,a+i);
		if(p[a[i]] == -1)	p[a[i]] = i;
		c[a[i]]++;
	}
	int ans = 0 , r = 0;
	for(i = 1;i<=n;i++){
		if(c[i] == 0){
			r++;
			while(r <= n && c[i] == 0) {
				if(c[a[r]] > 1){
					if(p[a[r]] == r &&  a[r] < i){
						r++;
						continue;
					}
					ans++;
					a[r] = i;
					c[i] = 1;
					c[a[r]]--;
					r--;
				}
				r++;
			}
		}
	}
	printf("%d\n" ,ans);
	for(i = 1; i <=n;i++)	printf("%d " ,a[i]);
	return 0;
}
*/


#include<stdio.h>
#include<string.h>
int main()
{
int n,m,a[1000]={0},max,sum;
char str[1000];
while(scanf("%d",&n)!=EOF)
{
getchar();
gets(str);
    max=0; sum=0;
    for(int i=0;i<n;i++)
	{
        if(str[i]>='A'&&str[i]<='Z')
		{
			memset(a,0,sizeof(int a));
            sum=(sum>max)?sum:max;
            max=0;
        }
		else
            if(a[str[i]]==0)
			{
                a[str[i]]=1;
                max++;
            }
    }
    sum=(sum>max)?sum:max;
    printf("%d\n",sum);
}
return 0;
}


#include <stdio.h>

int ans;
bool zero;

int main()
{
    unsigned int n;
    int k;

    scanf("%u%d", &n, &k);

    for (int i = 0; i < k; i++, n/=10)
    {
        if (n == 0)
        {
            if (zero == 1)
            {
                printf("%d", i-1);
            }
            else
            {
                printf("%d", i);
            }
            return 0;
        }
        if (n%10 != 0)
        {
            ans++;
            k++;
        }
        else
        {
            zero = 1;
        }
    }

    printf("%d", ans);

    return 0;
}


#include <stdio.h>
int a[2000000005];
int main(){
	int k,ans = 0,cnt = 0;
	long long n;
	scanf("%I64d%d",&n,&k);
	int n1 = n;
	int i = 0,judge = 0;
	while(n1 >= 10){
		a[++i] = n1 % 10;
		n1 = (n1 - a[i]) / 10;
		if(a[i] == 0)	judge = 1;
	}
	a[++i] = n1;
	if(i < k){
		if(judge == 1){
//			printf("judge = 1\n");
			printf("%d\n",i-1);
		}
		else{
//			printf("judge = 0\n");
			printf("%d\n",i);
		}
	}else{
		for(int j = 1;j <= i;j++){
			if(a[j] == 0)	cnt++;
			else	ans++;
			if(cnt >= k)	break;
		}
		printf("%d\n",ans);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
int huynya (int chislo, int stepen)
{
    int t=chislo;
    int digits=0;
    int deleted=0;
    int zeros=0;
    do  {
        digits++;
        t/=10;
    }while(t);
   // printf("%d",digits);
    if (stepen=>digits)
     return digits-1;
     else {
        while(zeros<stepen) {
            if (chislo % 10==0)
                zeros++;
            else
                deleted++;
             chislo/=10;
        }
    }
    return deleted;
}
int main()
{
    int number; int stepen;
    scanf("%d",&number);
    scanf("%d",&stepen);
    printf("%d",huynya(number,stepen));
    return 0;
}


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

void main(){
    int k;
    char s[2000001];

    scanf("%s %d", &s, &k);

    int size = strlen(s) - 1;
    int i, count = 0;

    for(i = size; i >= 0; i--){
       if(k == 0){
            printf("%d", count);
            return;
       }
       if(s[i] == '0'){
            k--;
       }else {
            count++;
       }
    }
    printf("%d", size);
    return;
}


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

int cmp(const void *a, const void *b)
{
	return *(int *)a - *(int *)b;
}
int min(int a,int b)
{
	if(a>b)
		return b;
	return a;
}
int swap(int *a,int *b)
{
	int t=*a;
	*a=*b;
	*b=t;
}

int main()
{
	int i,n,j,k;
	scanf("%d",&n);
	int a[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int b[24],count=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&b[i]);
		if(b[i]==29)
			count++;
		if(b[i]==28)
			b[i]=29;
	}
	if(count>=2)
	{
		printf("No\n");
		return 0;
	}
	int val;
	for(i=0;i<12;i++)
	{

		if(a[i]==b[0])
		{
			val=1,k=0;
			for(j=i;j<12 && k<=n;j++)
			{
				if(a[j]==b[k])
				{
					k++;
					if(j==11)
						j = -1;
					if(k==n)
						break;
					continue;
				}
				else
				{
					val=0;
					break;
				}
			}
		}
		if(val==1)
			break;
	}
	if(val==1)
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,i,x,sum=0;

    cin>>n;

    x = (n*2-1);

    for(i=x-2;i>=1;i=i-2)
    {
        sum+=i;
    }

    x = x + (sum*2);

    cout << x <<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    cout>>((n*n)+((n-1)*(n-1)));
}


#include<stdio.h>
int main()
{
	int n,s=1;
	scanf("%d",&n);
	int i=1;
	while (i<n)
	{
		s=s+(4*i);
	}
	if (n=1)
		printf("%d",1);
	printf("%d",s)
}


#include<stdio.h>
int main()
{
    long long n,s=1,cur=1,j;
    scanf("%lld",&n);
    for(i=2,j=1;i<=n;i++,j++)
    {
        cur=cur+4*j;
    }
    if(n!=0)
    {
       printf("%lld",cur);
    }
    else
    {
    printf("%lld",s);
    }
    return 0;
}


#include<stdio.h>
int main()
{
    int n,sum=1;
    scanf("%d",&n);
    if(n==1)
        printf("1");
    else
    {
        for(i=1;i<n;i++)
        {
            sum = sum+(4*i);
        }
        printf("%d",sum);
    }

}


#include<stdio.h>
#include<string.h>
#include<limits.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
int arr[250]={31,29,31,30,31,30,31,31,30,31,30,31};
int is_leap(int year){
  if ( year%400 == 0)
    return 1;
  else if ( year%100 == 0)
   return 0;
  else if ( year%4 == 0 )
    return 1;
  else
   return 0;
  return 0;

}
int main(){
int leap,a,b,c,d,e,f,g; int year;
scanf("%d",&year);

leap=is_leap(year);
int i; int week=1;

for(i=year+1;;i++){
	week=is_leap(i)?week=(week+2)%7:week=(week+1)%7;

	if(is_leap(i)==leap && week==1){
		printf("%d",i);
		return 0;
	}

}

}


int y;

void read(void) {
	scanf("%d", &y);
}

bool leap(int y) {
	return y % 400 == 0 || (y % 4 == 0 && y % 100 != 0);
}

int solve(void) {
	bool is_leap = leap(y);
	int d = 0;
	do {
		d++;
		if (leap(y)) d++;
		y++;
		d %= 7;
	} while (d || leap(y) != is_leap);
    return y;
}

int main(void) {
    read();
    printf("%d", solve());
    return 0;
}


#include<stdio.h>

bool namnhuan(long y)
{
	if((((y%4)==0)&&((y%100)!=0))||((y%400)==0)) return true;
	return false;
}

main()
{
	long y,day=0;
	scanf("%ld",&y);
	bool nam=namnhuan(y);
	do
	{
		if(namnhuan(y))
		{
			day+=2;
		}
		else day+=1;
		y+=1;
	} while(day%7!=0 || namnhuan(y)!=nam);
	printf("%ld",y);
}


int y;

void read(void) {
	scanf("%d", &y);
}

bool leap(int y) {
	return y % 400 == 0 || (y % 4 == 0 && y % 100 != 0);
}

int solve(void) {
	bool is_leap = leap(y);
	int d = 0;
	do {
		d++;
		if (leap(y)) d++;
		y++;
		d %= 7;
	} while (d || leap(y) != is_leap);
    return y;
}

int main(void) {
    read();
    printf("%d", solve());
    return 0;
}
}


#include<stdio.h>
int leap(int n)
{
          if(n%4==0)
          return 1;
          else if(n%100==0)
          return 0;
          else in(n%400==0)
          return 1;
          else
          return 0;
}
int main()
{
          int a,b,c,s,t,u,m,n,year;
          scanf("%d",&n);
          a=n-1;
          b=n-2;
          c=n+1;
          m=leap(a);
          s=leap(b);
          t=leap(c);
          u=leap(n);
          if(m==1)
          year=n+6;
          else if(s==1)
          year=n+17;
          else if(t==1)
          year=n+22;
          else if(u==1)
          year=n+28;
          printf("%d",year);
          return 0;
}


#include <stdio.h>
#include <string.h>
int main()
{
    char s[10000],k[10000];
    scanf("%s", s);scanf("%s", k);
    int a=strlen(k),t=strlen(s)-1;
    int b=0,q=0,i;
    while(s[q]!='|')q++;
    if(a+q == t-q){printf("%s%s",k,s);return 0;}
    else if(q == t+a-q){printf("%s%s", s,k);return 0;}
    int c = t-q-q;
    if(c<0) c*=-1;
    if(a>c && (a-c)%2==0){
            if(t-q>q){
                      for(i=0;i<c+(a-c)/2;i++)printf("%c", k[i]);
                      printf("%s", s);
                      for(i=c + (a-c)/2;i<a;i++)printf("%c", k[i]);
                      }
            else{
                 for(i=0;i<(a-c)/2;i++)printf("%c", k[i]);
                 printf("%s", s);
                 for(i=(a-c)/2;i<a;i++)printf("%c", k[i]);
                }
    return 0;
    }


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="1" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/1" 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/1" 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 />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


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

char ch[1010];
char chh[1010];
int abs(int a){return a>0?a:-a;}
int main()
{
    int flag,i,sum1,sum2,j,len;
    char c;

    while(~scanf("%s",&ch))
    {
        len = strlen(ch);
        sum1 = sum2 = 0;
        for(i = 0;i < len;i ++)
        {
            if(ch[i] == '|')break;
            sum1 += 1;
        }
        for(i+=1;i < len;i ++)
        {
            sum2 += 1;
        }
        scanf("%s",chh);
        len = strlen(chh);
        if((len-abs(sum1 - sum2))%2==0)
        {
            if(sum1 > sum2)
            {
                for(i = 0;i < (len-abs(sum1-sum2))/2;i ++)
                    printf("%c",chh[i]);
                for(i = 0;i < sum1;i ++)printf("%c",ch[i]);
                printf("|");
                for(i = (len-abs(sum1-sum2))/2;i < len;i ++)
                    printf("%c",chh[i]);
                for(i = 0;i < sum2;i ++)
                    printf("%c",ch[i+sum1+1]);
            }
            else
            {
                for(i = 0;i < len-(len-abs(sum1-sum2))/2;i ++)
                    printf("%c",chh[i]);
                for(i = 0;i < sum1;i ++)printf("%c",ch[i]);
                printf("|");
                for(i = len-(len-abs(sum1-sum2))/2;i < len;i ++)
                    printf("%c",chh[i]);
                for(i = 0;i < sum2;i ++)
                    printf("%c",ch[i+sum1+1]);
            }
            puts("");
        }
        else puts("Impossible");
        memset(ch,0,sizeof(ch));
        memset(chh,0,sizeof(chh);
    }

    return 0;
}


#include<stdio.h>
#include<string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 110
char f1[N],f2[N];
int main()
{
    //freopen("in.txt","r",stdin);
    int i,j,k;
    while(scanf("%s %s",f1,f2)!=EOF){
        int len1=0,len2=0,len=strlen(f1),lenlen=strlen(f2);
        for(i=0;i<len;i++)
            if(f1[i]=='|') break;
        int t=i;
        len1=t; len2=len-t-1;
        int cha=len1-len2;
        if(cha<0) cha=-1*cha;
        if((lenlen-cha)>=0 && (lenlen-cha)%2==0 ){
            k=(lenlen-cha)/2;
            if(len1>=len2){
                for(i=0;i<len1;i++) printf("%c",f1[i]);
                for(i=0;i<k;i++) printf("%c",f2[i]); j=k;
                for(i=len1;i<len;i++) printf("%c",f1[i]);
                for(i=k;i<lenlen;i++) printf("%c",f2[i]);
                printf("\n");
            }else{
                for(i=0;i<len1;i++) printf("%c",f1[i]);
                for(i=0;i<k+cha;i++) printf("%c",f2[i]); j=k;
                for(i=len1;i<len;i++) printf("%c",f1[i]);
                for(i=k+cha;i<lenlen;i++) printf("%c",f2[i]);
                printf("\n");
            }
        }
        else printf("Impossible");
    }

    return 0;
}


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

int main(){
    char L[100];
    char R[100];
    char U[100];

    for(int = 0; i < 100; i++){
        L[i] = NULL;
        R[i] = NULL;
        U[i] = NULL;
    }

    scanf("%[^|]%", L);
    getchar();
    scanf("%s", R);
    scanf("%s", U);
    int l = 0, r = 0, u = 0, diff, diff1;
    l = strlen(L);
    r = strlen(R);
    u = strlen(U);

    if(u == 0){
        strcpy(U, R);
        r = 0;
        u = strlen(U);
    }
    diff1 = abs(l - r);
    diff = u - abs(l - r);
   // printf("%d %d %d", l, r, u);

    if(diff % 2  != 0 || diff < 0){
        printf("Impossible");
        return 0;
    }

   for(int i = 0; i < abs(l - r); i++){
        if(l < r)
            L[l + i] = U[i];
        else
            R[r + i] = U[i];
   }
    //printf("%s\n%s\n%s\n%d %d %d\n", L, R, U, l, r, u);

    if(l < r)
        l = l + diff1;
    else
        r = r + diff1;

    int i, j, k;
    for(i =diff1, j = l, k = r; i < u; i++){
        if(i % 2 == 0){
           L[j] = U[i];
           j++;
        }
        else{
            R[k] = U[i];
                k++;
            }
    }

    L[j] = '\0';
    R[k] = '\0';

    printf("%s|%s", L, R);
}


#include <stdio.h>
char a[10];
bool flag=true;
int main()
{
    int i,j;
    for(i=0;i<8;i++)
    {
        scanf("%s",a);
        for(j=0;j<7;j++)
            if(a[j]==a[j+1])
                flag=false;
    }
    puts(flag?"YES":"NO");
}


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

int main(){
    bool find=true;
    int count=0;
    char str[8][8];
    while(count<8){
        scanf("%s", str[count]);
        count++;
    }
    for(int i=0; i<8; i++)
    {
        for(int j=0; j<7; j++)
            if(str[i][j]==str[i][j+1])
            {
                printf("NO\n");
                return 0;
            }
    }

    printf("YES\n");

    return 0;
}


#include<stdio.h>
int main(){
    short i = 0,j = 0,k = 0;
    char a,b,c;
    for(i=0;i<8;i++){
        for(j=0;j<4;j++)
           if(getchar()==getchar()) k=1;
        getchar();
    }
    if(k==0) printf("YES\n");
    else printf("NO\n");
    return 0;


#include <bits/stdc++.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>

#define PI 3.141592653589793
#define max(a,b) (a < b) ? (b) : (a)
#define min(a,b) (a > b) ? (b) : (a)
#define FOR(i,a,b) for(i = a ; i <= b ; i++)
#define ROF(i,a,b) for(i = a ; i >= b ; i--)
#define RAD(x) ((x)*PI)/180
#define y1 y_1
#define ll long long
#define endl printf("\n")
#define MAX 100005

	char a[10][10] = {"WBWBWBWB","BWBWBWBW","BWBWBWBW","BWBWBWBW","WBWBWBWB","WBWBWBWB","BWBWBWBW","WBWBWBWB"}, b[10][10];

int main () {

	return 0;
}


#include <stdio.h>
char a[10];
bool flag=true;
int main()
{
    int i,j;
    for(i=0;i<8;i++)
    {
        scanf("%s",a);
        for(j=0;j<7;j++)
            if(a[j]==a[j+1])
                flag=false;
    }
    puts(flag?"YES":"NO");
    return 0;
}


#include <sdtdio.h>

int main()
{
    int n, i;
    unsigned int res = 1;

    scanf("%d", &n);
    if (n & 1 || !n) {
        printf("0\n");
        return 0;
    }
    n >>= 1;
    for (i = 0; i < n; i++) {
        res *= 2;
    }
    printf("%d\n", res);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	cin>>n;
	if (n%2==0)
	{
		cout<< pow(2,n/2);
	}
	else
	{
		cout<<0;
	}
}


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

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


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

int main(){
    int n;
    scanf("%d",&n);
    (n%2==0)?printf("%d",pow(2,n/2):printf("0");
    return 0;
}


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


#include<stdio.h>

int man(){
	int x  ;
	int ctr = 0 ;
	int n;
	scanf("%d" , &n);
	int arr[4];
	arr[0] = -1;
	for(int i = 1 ; i< 4 ; i++){
		scanf("%d" , &x);
		arr[i] = x ;
	}

	int num = n ;
	while(1){
		if(arr[num] !=0){
			ctr++ ;
		}
		else{
			break ;
		}
		num = arr[num] ;
	}
	// printf("%d\n" , ctr);
	if(ctr ==2){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}

}

int main(){
	int t ;
	scanf("%d" , &t);
	for(int i = 0 ; i<t ; i++){
	man()
}
}


#include<stdio.h>
int main(){
    int k;
    scanf("%d",&k);
    while(k--){
        int n;
        scanf("%d",&n);
        int arr[3];
        for(int i=0;i<3;i++){
            scanf("%d",&arr[i]);
        }
        int count=0;
        int tem=arr[n-1];
        while(tem!=0){
            tem=arr[n-1];
            count=count+1;
        }
        if (count==2){
            printf("YES")
        }
        else{
            printf("NO")
        }
    }
}


#include<stdio.h>
int main(){
    int n,k;
    // int sum=0;
    int arr[9];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int p;
        scanf("%d",&p);
        for (int j=0;j<3;j++){
            scanf("%d",&k);
            int arr[j]=k;
        }
        if(arr[p-1]==0){
            printf("NO");
        } else if(arr[arr[p-1]]>0&&arr[arr[arr[p-1]]]>0){
            printf("YES");
        }
    }
    return 0;
}


#include <stdio.h>

int main()
{
    int t;
    scanf("%d", &t);
    for (int i = 0; i < t; i++)
    {
        int x, abc[3];
        scanf("%d", &x);
        scanf("%d %d %d", &abc[0], &abc[1], &abc[2]);

        int key1 = abc[x];
        if (abc[key1] != 0)
        {
            print("YES");
        }
        else
        {
            print("NO");
        }
    }
}


#include<stdio.h>
int main()
{
int x,i,min=0,cur=0,temp=1;
scanf("%d",&x);
if(x>0)
{
    while(cur!=x)
{
    if(cur+temp<=x)
{  cur+=temp; }
else
{  cur-=temp; }
++temp;
++min;
}
else
{
    while(cur!=x)
{
if(cur-temp>=x)
{cur-=temp;}
else
{cur+=temp;}
++temp;
++min;
}
}
printf("%d",min);
return 0;
}
}


#include<bits/stdc++.h>
int main()
{
    int tp,x,ans;
    while(~scanf("%d",&x))
    {
        x=x<0?-x:x,ans=ceil((-1+sqrt(1+8.0*x))/2),tp=ans*(ans+1)/2-x;
        while(tp&1) ans++,tp+=ans;
        printf("%d\n",ans);
    }
    return 0;
}


#include<stdio.h>
int main()
{
int x,i,min=0,cur=0,temp=1;
scanf("%d",&x);
if(x>=0)
{
while(cur!=x)
{
if(cur+temp<=x)
  cur+=temp;
else
  cur-=temp;
++temp;
++min;
}
else
while(cur!=x)
{
if(cur-temp>=x) cur-=temp;
else cur+=temp;
++temp;
++min;
}
printf("%d",min);
}
else
 printf("%d",x);
return 0;
}


#include <cstdio>

int main(){

    long n; scanf("%ld\n", &n);
    if(n < 0){n = -n;}
    long sum(0), ans(0), p(1);
    for(p = 1; sum < n; sum += p, p++, ans++);
    long diff = sum - n;
    if(n == 0){puts("0");}
    else if(diff % 2 == 0){printf("%ld\n", ans);}
    else if((diff + p) % 2 == 0){printf("%ld\n", ans + 1);}
    else{printf("%ld\n", ans + 2);}

    return 0;
}


#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
        n=-n;
    }
    int count=0,jump=1,position=0;
    while(1){
        if(position==n)
        break;
        else if(position+jump>n)
        {break;}
        else{
            count++;
            position+=jump;
            jump++;
        }
    }
    if(n%2==0){
    if(position%2==0){
        if(jump%2==0)
        count+=1;
        else
        count+=2;
    }
    else
    {
        if(jump%2==0)
        count+=2;
        else
        count+=1;
    }
    }
    else
    {
        if(position%2!0){
        if(jump%2==0)
        count+=1;
        else
        count+=2;
    }
    else
    {
        if(jump%2==0)
        count+=2;
        else
        count+=1;
    }
    }
    printf("%d",count);
}


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


#include<stdio.h>
#include<conio.h>
main()
{
int n,i,j;
char a[55];
scanf("%d",&n);
printf("\n");
scanf("%s",a);
printf("%c",a[0]);
i=0;
j=0;
while(a[j]!='\0')
{j=j+i;
printf("%c",a[j]);
i=i+1;
}


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


#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int n,k[100005],i,j,a,b;
	scanf("%d",&n);
        for(i=0;i<n;i++)
	scanf("%d",&k[i]);
	if(n<=2)
		printf("0");
	else
	{
	sort(k,k+n);
	b=k[n-2]-k[0];
	printf("%d",b);
	}
	return 0;
}


#include<cstdio>
using namespace std;
int main()
{
    int n,sum=0;
    char a[60];
    scanf("%d\n",&n);
    scanf("%s",a);
	for(int i=1;i<=n;i++)
	{
		sum=sum+i;
		printf("%c",a[sum-1]);
	}
    return 0;
}


#include<stdio.h>
int main()
{
    int n,k,t=0;
    t=n;
    scanf("%d %d",&n,&k);
    for(i=k;i>0;i--)
    {
        r=t%10;
        if(r!=0)
            t=t-1;
        else if(r==0)
            t=t/10;
        n=n/10;
        n=t;
    }
    printf("%d",t);
    return=0;
}


#include<stdio.h>
int main()
{
    int n,k,r;
    for(i=0;i<k;i++)
    {
        r=n%10;
        if(r==0)
        n=n/10;
        else
        n=n-1
    }
    printf("%d",n);
    return 0;
}


#include<stdio.h>
void main()
{
    int n,k,i=0;
    clrscr();
    printf("n&f");
    scanf("%d%d",&n,&k);
    while(i<k)
    { if (n%10!=0){n=n-1;}
    else if (n%10==0){n=n/10;}
    printf("the no is %d ",n);
    i++;
    }
    getch();
}


#include<stdio.h>
int main()
{
    int a,k;
    int temp1;
    scanf("%d %d",&a,&k);
    while(k!=0)
    {
        temp1=a%10;
        if(tmep>=1)
        {
            temp1-=1;
            a=a/10+temp1;
        }
        else
        {
            a=a/10;
        }
        k--;
    }
    return 0;
}


#include<stdio.h>
using namespace std;
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	while(b!=0)
	{
		b--;
		if(a%10!=0) a--;
		else a/=10;
	}
	printf("%d",a);
	return 0;
}