stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)



int main(){

	int weight;

	int n,v,w,c=0;

	int dp[1001][1001];

	while(scanf("%d\n",&weight) && weight){

		c++;

		rep(i,1001)rep(j,1001)dp[i][j]=0;

		

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

		for(int k=1;k<=n;k++){

			scanf("%d,%d\n",&v,&w);

			for(int i=0;i<=w;i++){

				dp[k][i] = dp[k-1][i];

			}

			for(int i=w;i<=weight;i++){

				dp[k][i] = max(dp[k-1][i],dp[k-1][i-w]+v);

			}

		}

		/*for(int k=0;k<=n;k++){

			for(int i=0;i<=weight;i++)

				printf("%4d",dp[k][i]);

			puts("");

		}*/

		printf("Case %d:\n",c);

		printf("%d\n",dp[n][weight]);

		for(int i=0;i<=weight;i++){

			if(dp[n][i]==dp[n][weight]){

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

				break;

			}

		}

	}

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



bool cmp(const pair<int,int> &a,const pair<int,int> &b){

	if( a.first != b.first ) return a.first < b.first;

	else return a.second > b.second;

}

int main(){

	int n,W;

	int t = 1;

	while( cin >> W >> n && W ){

		vector< pair<int,int> > cur;

		cur.push_back({0,0});

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

			int w,c;

			scanf("%d,%d",&c,&w);

			for(int j = 0 , t = cur.size() ; j < t ; j++ )

				cur.push_back(pair<int,int>(cur[j].first+w,cur[j].second+c));

			sort(cur.begin(),cur.end(),cmp);

			int maxi = -1;

			vector< pair<int,int> > nex;

			for(int j = 0 ; j < cur.size() ; j++){

				if( maxi >= cur[j].second ) continue;



				if( cur[j].first <= W ) nex.push_back(cur[j]);

				maxi = cur[j].second;

			}cur = nex;

		}

		int ans = 0, ans2 ;

		for(int i = 0 ; i < cur.size() ; i++){

			if( cur[i].first <= W ){

				ans = cur[i].second;

				ans2 = cur[i].first;

			}

		}



		cout << "Case " << t++ << ":" << endl;

		cout << ans << endl;

		cout << ans2 << endl;

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

#define INF (1<<21)

int dp[1001][1001];

pair<int,int> solve(vector<int> value , vector<int> weight , int W , int N){

	for(int i=0;i<1001;i++)

		for(int j=0;j<1001;j++)

			dp[i][j] = 0;

	for(int num=1;num<=N;num++){

		for(int w=0;w <= W;w++){

			dp[num][w] = max( dp[num][w] , dp[num-1][w]);

			if(w >= weight[num])dp[num][w] = max( dp[num][w] , dp[num-1][w-weight[num]] + value[num]);

		}

	}	

	int ans1 = *max_element(dp[N],dp[N]+W+1);

	int ans2 = find(dp[N],dp[N]+W+1,ans1)-dp[N];

	return make_pair(ans1,ans2);

}



int main(){

	int n,w,CaseNum=0;

	while(cin >> w && w){

		cout << "Case " << ++CaseNum << ":" << endl;

		cin >> n;

		vector<int> value(1+n) , weight(1+n);

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

			scanf("%d,%d\n",&value[i],&weight[i]);

		}

		pair<int,int> ans = solve(value,weight,w,n);

		cout << ans.first << endl << ans.second << endl;

	}

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



bool cmp(const pair<int,int> &a,const pair<int,int> &b){

	if( a.first != b.first ) return a.first < b.first;

	else return a.second > b.second;

}

int main(){

	int n,W;

	int t = 1;

	while( cin >> W >> n && W ){

		vector< pair<int,int> > cur;

		cur.push_back({0,0});

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

			int w,c;

			scanf("%d,%d",&c,&w);

			for(int j = 0 , t = cur.size() ; j < t ; j++ )

				cur.push_back(pair<int,int>(cur[j].first+w,cur[j].second+c));

			sort(cur.begin(),cur.end(),cmp);

			int maxi = -1;

			vector< pair<int,int> > nex;

			for(int j = 0 ; j < cur.size() ; j++){

				if( maxi >= cur[j].second ) continue;



				if( cur[j].first <= W ) nex.push_back(cur[j]);

				maxi = cur[j].second;

			}cur = nex;

		}

		int ans = 0, ans2 ;

		for(int i = 0 ; i < cur.size() ; i++){

			if( cur[i].first <= W ){

				ans = cur[i].second;

				ans2 = cur[i].first;

			}

		}



		cout << "Case " << t++ << ":" << endl;

		cout << ans << endl;

		cout << ans2 << endl;

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<algorithm>

using namespace std;

int main(){

  for(int c=1,w; cin>>w,w; c++){

    int n,tr[1001][2] = {0};

    cin >>n;

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

      scanf("%d,%d",&tr[i][0],&tr[i][1]);

    }

    int dp[1001][1001] = {0};

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

      for(int j=0; j<=w; j++){

	if(j>=tr[i][1]){dp[j][i] = max(dp[j][i-1],dp[j-tr[i][1]][i-1]+tr[i][0]);}

	else{dp[j][i] = dp[j][i-1];}

      }

    }

    int pr = dp[w][n], val;

    for(int j=0; j<=w; j++){

      if(pr == dp[j][n]){val = j;break;}

    }

    cout <<"Case "<<c<<":"<<endl;

    cout <<pr<<endl<<val<<endl;

  }

  return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<cstdio>

#include<algorithm>

using namespace std;

int main(){

  int w,n,tre[1001][2],dp[1001][1001] = {0},x;

  for(int c = 1; cin >>w,w; c++){

    cin >>n;

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

      scanf("%d,%d",&tre[i][0],&tre[i][1]);

    }

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

      for(int j=1; j<=w; j++){

	dp[i][j] = dp[i-1][j];

	if(j>=tre[i][1]){dp[i][j] = max(dp[i][j],dp[i-1][j-tre[i][1]]+tre[i][0]);}

      }

    }

    for(int j=0; j<=w; j++){

      if(dp[n][j] == dp[n][w]){x = j;break;}

    }

    cout <<"Case "<<c<<":"<<endl<<dp[n][w]<<endl<<x<<endl;

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cmath>

using namespace std;

int main()

{

    double n,d,x,i,s=0,a,b;

    cin>>n>>d;

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

    {

        cin>>a>>b;

        x=sqrt((a*a)+(b*b));

        if(x<=d)

            s++;

    }

    cout<<s<<endl;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int a, b, i, p, q, count = 0;

    scanf("%lld%lld", &a, &b);

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

        scanf("%lld%lld", &p, &q);

        if ((double)(sqrt(pow(p,2)+pow(q,2))) <= b) count ++;

    }

    printf("%lld\n", count);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstring>

#include <string.h>

using namespace std;



int main()

{

    string S;

    cin>>S;

    if(S[2]==S[3]&&S[4]==S[5])

        cout<<"Yes"<<endl;

    else

        cout<<"No"<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	char S[10];

	scanf("%s",S);

	if(S[2]==S[3] && S[4]==S[5]){

		printf("Yes");

	}

	else {

		printf("No");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main()

{

    string s;

    cin>>s;

    if (s[2]==s[3]&&s[4]==s[5])

        cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	char S[10];

	scanf("%s",S);

	if(S[2]==S[3] && S[4]==S[5]){

		printf("Yes");

	}

	else {

		printf("No");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



int main(){

    string s;

    cin >> s;

    if(s[2]==s[3] && s[4]==s[5])cout << "Yes";

    else cout << "No";

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	char S[10];

	scanf("%s",S);

	if(S[2]==S[3] && S[4]==S[5]){

		printf("Yes");

	}

	else {

		printf("No");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

#define elif else if

typedef long long ll;

typedef unsigned long long ull;

#define DEBUG(x) cout << (x) << endl

#define TGET(a, b) get<b>(a)



int is_prime(ll n)

{

    double n_sqrt;

    if (n == 2 || n == 3)

    {

        return 1;

    }

    if (n <= 1 || n % 6 != 1 && n % 6 != 5)

    {

        return 0;

    }

    n_sqrt = double(sqrt((double)n));

    for (int i = 5; i <= n_sqrt; i += 6)

    {

        if (n % i == 0 | n % (i + 2) == 0)

        {

            return 0;

        }

    }

    return 1;

}



int main()

{

    string a;

    cin >> a;

    if(a[2]==a[3]&&a[4]==a[5])

    {

        puts("Yes");

    }

    else

    {

        puts("No");

    }

    

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	char S[10];

	scanf("%s",S);

	if(S[2]==S[3] && S[4]==S[5]){

		printf("Yes");

	}

	else {

		printf("No");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

char s[10];

int main()

{

	scanf("%s",s);

	if (s[2]==s[3]&&s[4]==s[5]) printf("Yes");else

	printf("No");

} 

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	char S[10];

	scanf("%s",S);

	if(S[2]==S[3] && S[4]==S[5]){

		printf("Yes");

	}

	else {

		printf("No");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <stdio.h>

#include <math.h>

#include <iostream>

using namespace std;

int main()

{   int n,t,j=0;

      char c[6];

      for(int i=0;i<6;i++)cin>>c[i];

      

            if(c[2]==c[3]&& c[4]==c[5])cout<<"Yes";

            else cout<<"No";

 

   return 0;



}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	char S[10];

	scanf("%s",S);

	if(S[2]==S[3] && S[4]==S[5]){

		printf("Yes");

	}

	else {

		printf("No");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <string.h>

using namespace std;



int main()

{

	

	char s[10];

	scanf("%s", s);

	

	if(s[2] == s[3] && s[4] == s[5]) cout << "Yes";

	else cout << "No";

	

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	char S[10];

	scanf("%s",S);

	if(S[2]==S[3] && S[4]==S[5]){

		printf("Yes");

	}

	else {

		printf("No");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    char a[6];

    cin>>a;



    if(a[4]==a[5]&&a[2]==a[3]){

        cout<<"Yes"<<endl;

    }

    else{cout<<"No"<<endl;}

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	char S[10];

	scanf("%s",S);

	if(S[2]==S[3] && S[4]==S[5]){

		printf("Yes");

	}

	else {

		printf("No");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

main()

{

string S;

cin >> S;

if(S[2] == S[3] && S[4] == S[5])

    {

cout << "Yes" << endl;

    }

else

    {

cout << "No" << endl;

    }

return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	char S[10];

	scanf("%s",S);

	if(S[2]==S[3] && S[4]==S[5]){

		printf("Yes");

	}

	else {

		printf("No");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <iostream>

using namespace  std;

const int N=1E5+5;



int main() {

string s;

cin>>s;

if(s[2]==s[3] && s[4]==s[5])

{

    cout<<"Yes";

}

else cout<<"No";

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;







int main()

{

string x;

cin>>x;

if(x[2]==x[3] && x[4]==x[5])

{

    cout<<"Yes";

}

else

{

    cout<<"No";

}

		return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

string s;

int main(){

	ios::sync_with_stdio(0);

	cin.tie(0);

	cin>>s;

	if(s[2]==s[3]&&s[4]==s[5]){

		cout<<"Yes";

	}else{

		cout<<"No";

	}

	return 0;

} 

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    char s[10];

    scanf("%s",s);

    if(s[2]==s[3]&&s[4]==s[5])

        cout<<"Yes";

    else

        cout<<"No";

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

typedef long long int lld;

#define sq(x) x*x

#define fr(i,m,n) for(i=m;i<n;i++)

#define vec vector<int>

#define sint set<int>

#define qint queue<int>

#define mip map<int,int>

#define pint priority_queue<int>

#define pb push_back

#define pp pop_back()

#define ft first

#define sd second

#define full(v) v.begin(),v.end()



int main()

{

    int i,j,k,a,b,c,x,y,z,n,m,t;

    string s,u,v;

    cin>>s;

    if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main() {

    

    string a ;

    cin >> a;

    if( a[2]==a[3] && a[4]==a[5]){

        cout << "Yes";}

        else{

            cout << "No";

        }

    

    

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<ctime>

#include<vector>

#include<map>

#include<queue>

#include<set>

#include<cstdlib>

#include<ctime>

#include<random>

#define ll long long

using namespace std;



char s[10];



int main(){

    scanf("%s",s+1);

    if (s[3]==s[4]&&s[5]==s[6]) puts("Yes");

    else puts("No");

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
# include <iostream>

# include <cstdio>



using namespace std;



int main(void)

{

    char a[100];

    scanf("%s",a);

    if (a[2]==a[3]&&a[4]==a[5]) printf("Yes\n");

    else printf("No\n");



    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

	string s;

	cin>>s;

	if(s[2]==s[3] && s[4]==s[5])

	{

		cout<<"Yes"<<endl;

	}

	else  cout<<"No"<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef unsigned long long ull; 

typedef long double ld;

const ll mod = 1e9 + 7;

const double PI = acos(-1.0);

const double eps = 1e-10;

const ll inf = 1e18;

const int maxn = 200005;

inline ll read() { ll s = 0, w = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') w = -1; for (; isdigit(ch); ch = getchar())    s = (s << 1) + (s << 3) + (ch ^ 48); return s * w; }

inline void write(ll x) { if (!x) { putchar('0'); return; } char F[40]; ll tmp = x > 0 ? x : -x; if (x < 0)putchar('-');    int cnt = 0;    while (tmp > 0) { F[cnt++] = tmp % 10 + '0';        tmp /= 10; }    while (cnt > 0)putchar(F[--cnt]); }

inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll qpow(ll a, ll b) { ll ans = 1;    while (b) { if (b & 1)    ans *= a;        b >>= 1;        a *= a; }    return ans; }    ll qpow(ll a, ll b, ll mod) { ll ans = 1; while (b) { if (b & 1)(ans *= a) %= mod; b >>= 1; (a *= a) %= mod; }return ans % mod; }

inline int lowbit(int x) { return x & (-x); }



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

{

	string s;

	cin >> s;

	if (s[2] == s[3] && s[4] == s[5])

	{

		cout << "Yes";

	}

	else

		cout << "No";

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <stdio.h>

#include <iostream>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <map> 

#include <stack>

#include <sstream>

#include <set>

#pragma GCC optimize(2)



//#define int long long

#define mm(i,v) memset(i,v,sizeof i);

#define mp(a, b) make_pair(a, b)

#define pi acos(-1)

#define fi first

#define se second

//你冷静一点，确认思路再敲！！！ 



using namespace std;

typedef long long ll;

typedef pair<int, int > PII;

priority_queue< PII, vector<PII>, greater<PII> > que;

stringstream ssin; //  ssin << string   while ( ssin >> int)



const int N = 1e5 + 5, M = 2e5 + 5, mod = 1e9 + 9, INF = 0x3f3f3f3f;

char s[N];

int k;



inline int read(){

    char c=getchar();int x=0,f=1;

    while(c<'0'||c>'9'){if(c=='-')f=-1; c=getchar();}

    while(c>='0'&&c<='9'){x=x*10+c-'0'; c=getchar();}

    return x*f;

}



int main()

{

    scanf("%s", s + 1);

    if (s[3] == s[4] && s[5] == s[6]) puts("Yes");

    else puts("No");

    // system("pause");

    return 0;

}

/*

niuniu

1

abca

2

abcabc

2

*/

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){



string s;



cin>>s;



int m=0;



if(s[2]==s[3]){

m++;

}

if(s[4]==s[5]){

m++;

}



if(m==2){

cout<<"Yes"<<endl;

}else{

cout<<"No"<<endl;



}



return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	

	char s[10];

	

	scanf("%s",s);

	

	(s[2] == s[3] && s[4] == s[5]) ? puts("Yes") : puts("No");

		



return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define endl "\n"

#define PI acos(-1)

#define BMW_GTR ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)



typedef long long ll;

using namespace std;



//ll const n = 50005;



int main()

{

    BMW_GTR;



    string s;

    cin >> s;



    if(s[2] == s[3] && s[4] == s[5])cout << "Yes";

    else cout << "No";



    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	char S[7];

	scanf ("%s", &S);

	

	((S[2] == S[3]) && (S[4] == S[5])) ? puts ("Yes") : puts ("No");

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;



int main()

{

    ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);



    string s;



    cin >> s;



    if(s[2] == s[3] && s[4] == s[5])

    {

        cout << "Yes";

    }



    else

    {

        cout << "No";

    }







}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	char S[7];

	scanf ("%s", &S);

	

	((S[2] == S[3]) && (S[4] == S[5])) ? puts ("Yes") : puts ("No");

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long

#define nl "\n"

#define pi acos(-1)

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define pcase printf("Case %d:\n",ca)

int ca=1;

using namespace std;



int main(){

fast;

    string a;

    cin>>a;

    if(a[2]==a[3]&&a[4]==a[5]){

        cout<<"Yes"<<nl;

    }else{

         cout<<"No"<<nl;



    }

    return 0;

    }


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	char S[7];

	scanf ("%s", &S);

	

	((S[2] == S[3]) && (S[4] == S[5])) ? puts ("Yes") : puts ("No");

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):


#include<bits/stdc++.h>





using namespace std;



typedef long long ll;



#define pi 2*acos(0.0)

#define eps 1e-9

const int N = 10000000;

bool isprime[N+1];



void sieve()

{

    memset(isprime,true,sizeof(isprime));

    isprime[0]=isprime[1]=false;



    for(ll i=2; i*i<=N; i++)

    {

        if(isprime[i])

        {

            for(ll j=i*i; j<=N; j+=i)

            {

                isprime[j]=false;

            }

        }

    }

}





int main(void)

{

    //ios_base::sync_with_stdio(false);

    //cin.tie(0);

    //cout.tie(0);





    string s;

    cin>>s;

    if(s[2]==s[3] && s[4]==s[5])

    {

        cout<<"Yes\n";

    }

    else

    {

        cout<<"No\n";

    }







}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	char S[7];

	scanf ("%s", &S);

	

	((S[2] == S[3]) && (S[4] == S[5])) ? puts ("Yes") : puts ("No");

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std ;

typedef long long ll;

#define cf ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)

#define fox(i,j,n) for( i=j;i<n;i++)

#define srtar(a,n) sort(a,a+n)

#define srtvec(v) sort(v.begin(),v.end())

#define fauto(x,t) for(auto x: t)

#define mem(n,x) memset(n, x, sizeof(n))

const double pi=acos(-1);



int main()

{

    int t, i ;

    string s;

    cin >> s;

    if(s[3]==s[2] && s[4]==s[5])

        cout << "Yes";

    else

        cout << "No";

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	char S[7];

	scanf ("%s", &S);

	

	((S[2] == S[3]) && (S[4] == S[5])) ? puts ("Yes") : puts ("No");

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



void solve(){

	string str;

	cin >> str;

	if(str[2] == str[3] && str[4] == str[5]){

		cout << "Yes" << "\n";

	}

	else{

		cout << "No" << "\n";

	}

}



int main(){

	ios_base::sync_with_stdio(false);

	cin.tie(NULL);

	solve();	

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	char S[7];

	scanf ("%s", &S);

	

	((S[2] == S[3]) && (S[4] == S[5])) ? puts ("Yes") : puts ("No");

	

	return 0;

}

// Fastest known solution for this problem: