akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

void YesNo(bool x) {
    cout << (x ? "Yes" : "No") << endl;
}

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x - a) < abs(x - b))cout << "A" << endl;
    else cout << "B" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,i,j,k,flag;
    string s;
    while(~scanf("%d",&n))
    {
        flag = 1;
        cin >> s;
        if(n%2)cout<<"No"<<endl;
        else
        {
            for(i=0,j=n/2;i<n/2;i++,j++)
            {
                if(s[i]!=s[j]) flag = 0;
            }
            if(flag)cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main()
{
   int n , sum ;
   cin >> n ;

   for (int x =1 ; x<= n ; x++)
   {
       for (int y =1 ; y<=n ; y++)
       {
           if ( x %2 != 0 && y %2 ==0)
           sum ++ ;
           else if ( x % 2 ==0 && y %2 !=0)
            sum ++ ;

       }
   }
    cout << sum/2 ;
    return 0;
}


Measured memory_bytes: 3584
#include<iostream>
using namespace std;

int main(){
  int N;
  cin >> N;

  string S;
  cin >> S;

  int ans = 0;
  for(int i = 0; i + 3 <= N; i++){
    if(S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C'){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>

using namespace std; 

#define pb push_back
#define fi first
#define se second
#define all(vec) vec.begin(),vec.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,a,b) for(int i=a;i>=b;i--)
#define fp(i,a,b,p) for(int i=a;i<b;i+=p)
#define SZ(x) (int)x.size()

typedef  vector<string> vs;
typedef  vector<int> vi;
typedef  vector<long long> vl;	


int main(){
	
	int d,n;
	
	cin >> d >> n; 
	
	if(n==100) n++;
	
	
	if(d==0){
		cout << n << endl;
	}else if(d==1){		
		cout << n * 100 << endl;
	}else{
		cout << n * 10000 << endl; 
	}
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 998244353;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
const long long int pl=1000000;

string S,T;
long long int res=0;
int main(){

    cout << fixed << setprecision(18);
    cin>>S>>T;
    for(long long int i = 0; i < S.size(); i++){
        if(S[i]!=T[i]){
            res++;
        }
    }
    cout<<res<<endl;
}



Measured memory_bytes: 3868
#include <stdio.h>
#include <string.h>
int main(){
  char s[20],a[20]={};
  int c=0;
  scanf("%s",s);
  for(int i=0;i<strlen(s);i++){
    if(s[i]=='0'){
      a[c]='0';
      c++;
    }
    else if(s[i]=='1'){
      a[c]='1';
      c++;
    }
    else if(c>0){
      c--;
      a[c]='\n';
    }
  }
  printf("%s",a);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>
#include <utility>
typedef long long ll;
using namespace std;

ll min(ll a, ll b) {
  return a < b ? a : b;
}

ll max(ll a, ll b) {
  return a > b ? a : b;
}

int main(void) {
  ll i, j, k, n, d, sn = 1, now = 1, ans = 0;
  scanf("%lld%lld", &n, &d);
  pair< ll, ll > sx[n], sy[n];
  ll b[n];
  for(i = 0; i < n; ++i) {
    scanf("%lld%lld%lld", &sx[i].second, &sy[i].second, &b[i]);
    sy[i].first = sx[i].first = b[i];
  }
  sort(sx, sx + n), sort(sy, sy + n), sort(b, b + n);
  while(sn < n) sn *= 2;
  ll xmin[sn * 2], xmax[sn * 2], ymin[sn * 2], ymax[sn * 2], las[sn * 2];
  for(i = 1; i < sn * 2; ++i) {
    if(i >= now * 2) now *= 2;
    las[i] = sn / now * (i - now + 1) - 1;
  }
  for(i = 0; i < sn; ++i) {
    if(i < n) xmin[i + sn] = sx[i].second, xmax[i + sn] = sx[i].second, ymin[i + sn] = sy[i].second, ymax[i + sn] = sy[i].second;
    else xmin[i + sn] = ymin[i + sn] = 1e9, xmax[i + sn] = ymax[i + sn] = -1;
    if(i % 2) {
      now = (i + sn) / 2;
      while(now) {
        xmin[now] = min(xmin[now * 2], xmin[now * 2 + 1]);
        xmax[now] = max(xmax[now * 2], xmax[now * 2 + 1]);
        ymin[now] = min(ymin[now * 2], ymin[now * 2 + 1]);
        ymax[now] = max(ymax[now * 2], ymax[now * 2 + 1]);
        now /= 2;
      }
    }
  }
  for(i = 0; i < n; ++i) {
    ll l = lower_bound(b, b + n, b[i] + d + 1) - b - 1;
    ll nxmi, nxma, nymi, nyma;
    nxmi = nymi = 1e9, nxma = nyma = -1;
    now = i + sn;
    while(1) {
      while(!(now % 2)) now /= 2;
      while(las[now] > l) now *= 2;
      if(nxmi > xmin[now]) nxmi = xmin[now];
      if(nxma < xmax[now]) nxma = xmax[now];
      if(nymi > ymin[now]) nymi = ymin[now];
      if(nyma < ymax[now]) nyma = ymax[now];
      if(las[now] == l) break;
      now++;
    }
    if(nxma - nxmi >= 0 && nyma - nymi >= 0 && ans < (nxma - nxmi) * (nyma - nymi)) ans = (nxma - nxmi) * (nyma - nymi);
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 31080
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n;
    cin >> n;
    ll ans = (ll)n*(n-1)*(n-2)/6;
    vector<int> l(n);
    for (int i = 0;i < n;++i) cin >> l[i];
    sort(l.begin(),l.end());
    for (int i = 0;i < n-1;++i) for (int j = i+1;j < n;++j) {
        ans -= l.end()-lower_bound(l.begin(),l.end(),l[i]+l[j]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)


void solve(long long N, std::vector<std::string> S){
    ll ans = 0;
    REP(B, N){
        vector<string> T;
        REP(i, N){
            T.push_back(
                S.at(i).substr(N - B, B) +
                S.at(i).substr(0, N - B)
            );
        }
        ll ok_flg = true;
        for(ll i = 0; i < N && ok_flg; ++i){
            for(ll j = i + 1; j < N && ok_flg; ++j){
                if(T.at(i).at(j) != T.at(j).at(i)){
                    ok_flg = false;
                }
            }
        }
        ans += ok_flg;
    }
    cout << N * ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
    }
    solve(N, std::move(S));
    return 0;
}


Measured memory_bytes: 656
def resolve():
    import sys
    import os
    input = sys.stdin.readline
    
    S = input().rstrip(os.linesep)
    pre = S[:2]
    suf = S[2:]

    def can_MM(string):
        if int(string) <= 12 and int(string) >= 1: # MM or YY
            return True
        else:
            return False

    pre_mm = can_MM(pre)
    suf_mm = can_MM(suf)

    if pre_mm:
        if suf_mm:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if suf_mm:
            print("YYMM")
        else:
            print("NA")
    

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 3064
#include <iostream>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <map>
#include <cstring>
#include <vector>
using namespace std;

typedef long long int ll;
ll S[100001];
ll T[50001];
int n,q;

int bin_search(ll *X,ll a,int s,int e){

  if(e-s==1){
    if(X[s]==a) return 1;
    else return 0;
  }

  int mid = (s+e)/2;
  if(a<X[mid]) bin_search(X, a, s, mid);
  else bin_search(X, a, mid, e);
		 
  


}

int main(){

  cin>>n;
  for(int i=0;i<n;i++) cin>>S[i];
  cin>>q;
  for(int i=0;i<q;i++) cin>>T[i];

  int cnt = 0;
  for(int i=0;i<q;i++){
    cnt += bin_search(S,T[i],0,n);
  }
  cout<<cnt<<endl;
  
 
  return 0;
}

Measured memory_bytes: 4220
#include <bits/stdc++.h>

#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;
int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);

   int N;
   cin>>N;
   vector<int>A(N);
   for(int i=0;i<N;i++)cin>>A[i];
   for(int i=0;i<N;i++)A[i] = A[i]%2;
   int a=0,b=0;
   for(int i=0;i<N;i++){
      if(A[i])a++;
      else b++;
   }
   if(a==0){
      if(b%2)cout<<"NO";
      else cout<<"YES";
   }
   else if(b == 0){
      if(a%2)cout<<"NO";
      else cout<<"YES";
   }
   else{
      if(a%2)cout<<"NO";
      else cout<<"YES";
   }
   return 0;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;

void Swap(int *x, int *y) {
	int z;
	z = *x;
	*x = *y;
	*y = z;
}
int main()
{
	int x, y;
	cin >> x >> y;
	if (y > x)
		Swap(&x, &y);

	while (x%y != 0) {
		x = x%y;
		Swap(&x, &y);
	}
	cout << y << endl;
}

Measured memory_bytes: 1160
def count(list):
    dict = {}
    for i in range(len(list)):
        dict[list[i]] = dict.get(list[i], 0) + 1
    return dict

n = int(input())
a = list(map(int,input().split()))
dic = count(a)
ans = 0

for i, x in dic.items():
    differ = x - i
    if differ>0:
        ans += differ
    elif differ<0:
        ans += x

print(ans)

Measured memory_bytes: 21852
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
using namespace std;


int res=0;

int saiki(int ball[],int ttB,int ttC,int res){
	if(res==10)return res;
	if(ball[res]>ttB){
		return saiki(ball,ball[res],ttC,res+1);
	}
	if(ball[res]>ttC){
		return saiki(ball,ttB,ball[res],res+1);
	}
	return res;
}

int main(void){
	int a,b;
	int ball[11];
	int ttB=0,ttC=0;
	int n;
	scanf("%d",&n);
	for(a=0;a<n;a++){
		for(b=0;b<10;b++){
			ball[b]=0;
		}
		ttB=0;
		ttC=0;
		res=0;
		for(b=0;b<10;b++){
			scanf("%d",&ball[b]);
		}
		res=max(res,saiki(ball,ttB,ttC,res));
		if(res==10)printf("YES\n");else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>

using namespace std;

using int64 = long long;

int main() {
  int X;
  cin >> X;
  int ret = 1;
  for(int b = 2; b <= 1000; b++) {
    int base = b * b;
    while(base * b <= X) {
      base *= b;
    }
    if(base <= X) ret = max(ret, base);
  }
  cout << ret << endl;
}






Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main()

{

    int N, C0 = 0, C1 = 0, C2 = 0, C3 = 0;

    cin >> N;
    string arr[N];
    for (int i = 0; i < N; i++)

    {

        cin >> arr[i];


        if (arr[i] == "AC")

            C0++;

        else if (arr[i] == "WA")

            C1++;

        else if (arr[i] == "TLE")

            C2++;

        else if (arr[i] == "RE")

            C3++;}



    cout << "AC x " << C0 << endl << "WA x " << C1 << endl << "TLE x " << C2 << endl << "RE x " << C3 << endl;

}


Measured memory_bytes: 6604
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define N  200005
int t, n,a[N];
ull sum;
bool check;
void input(){
    cin>>n;
    FOR(i,1,n) cin>>a[i];
}
void process(){
    int point=2;
    int x=1;
    sum=0;
    while (point<=n){
        if (a[point]<a[x]){
           // x=point-1;
            sum+=a[x]-a[point];
            ++point;
        }
        else {
            x=point;
            ++point;
        }
    }
    cout<<sum;
}
int main(){
    _io;

    input();
    process();
}


Measured memory_bytes: 4420
#include<bits/stdc++.h>

using namespace std;

int main(){
  int a, b;
  cin >> a >> b;
  int n = 0;
  int m = 0;
  for(int i = 0; i < a; i++){
    n *= 10;
    n += b;
  }
  for(int j = 0; j < b; j++){
    m *= 10;
    m += a;
  }
  
  if(a > b) cout << n << endl;
  else cout << m << endl;
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

sign = 0
c = 0
for i in range(1,len(A)):
    dif = A[i] - A[i-1]
    if dif * sign < 0:
        c += 1
        sign = 0
        continue
    if dif != 0:
        sign = dif
print(c+1)


Measured memory_bytes: 15020
# include <bits/stdc++.h>
typedef long long lint;
using namespace std;

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

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


int main() {
  lint n,k; cin >> n >> k;
  vector<lint> a(n); for(int i=0;i<n;i++) { cin >> a[i]; }

  for(lint i=0;i+k<n;i++) {
    if(a[i+k] > a[i]) { cout << "Yes" << endl; }
    else { cout << "No" << endl; }
  }

  return 0;
}


Measured memory_bytes: 4836
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var sc *bufio.Scanner

const BufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

type bc struct {
	num   int
	value int
}

type bcs []bc

func (b bcs) Len() int { return len(b) }
func (b bcs) Less(i, j int) bool {
	if b[i].num != b[j].num {
		return b[i].num < b[j].num
	}
	return b[i].value > b[j].value
}
func (b bcs) Swap(i, j int) { b[i], b[j] = b[j], b[i] }

// An IntHeap is a min-heap of ints.
type IntHeap []int

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	a := make([]bc, n)

	for i := range a {
		a[i].num = nextInt()
		a[i].value = nextInt()
	}
	sort.Sort(bcs(a))
	//debugf("%v\n", a)
	idx := 0
	ans := 0

	h := &IntHeap{}
	heap.Init(h)

	//debugf("%v\n", a)
	for i := 0; i < m; i++ {
		for idx < n && a[idx].num <= i+1 {
			heap.Push(h, a[idx].value)
			idx++
		}
		if h.Len() > 0 {
			n := heap.Pop(h)
			ans += n.(int)
		}
		//debugf("end i: %d, ans: %d, %v\n", i, ans, b.String())
	}

	_, _ = fmt.Fprintf(writer, "%d", ans)
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 7168
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let mut buffer = read::<String>();
  let mut cnt = 0;

  for i in buffer.chars() {
    if i == '1' {
      cnt += 1;
    }
  }

  println!("{}", cnt);
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int K;
	int k[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	cin >> K;
	ce(k[K-1])

    return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        LinkedList<Character> s = new LinkedList<>();
        for (char chara : in.readLine().toCharArray()) {
            s.add(chara);
        }
        boolean reversed = false;
        for (int q = Integer.parseInt(in.readLine()); q > 0; q--) {
            StringTokenizer tokenizer = new StringTokenizer(in.readLine());
            if (tokenizer.nextToken().equals("1")) {
                reversed = !reversed;
            } else {
                int f = Integer.parseInt(tokenizer.nextToken());
                if (reversed) {
                    f = 3 - f;
                }
                char chara = tokenizer.nextToken().charAt(0);
                if (f == 1) {
                    s.addFirst(chara);
                } else {
                    s.addLast(chara);
                }
            }
        }
        StringBuilder builder = new StringBuilder();
        for (char chara : s) {
            builder.append(chara);
        }
        if (reversed) {
            builder.reverse();
        }
        System.out.println(builder);
    }
}


Measured memory_bytes: 61784
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e15;
typedef pair<ll,mp> mmp;// time , cost , now

int main(){
 ll n,m,s;
 cin>>n>>m>>s;
 

 vector<vector<mmp> > g(n);
 for(ll i=0;i<m;i++){
  ll u,v,a,b;
  cin>>u>>v>>a>>b;
  u--,v--;
  g[u].push_back( mmp( b, mp(a,v) ) );
  g[v].push_back( mmp( b, mp(a,u) ) );
 }

 vector<ll> c(n),d(n);
 for(ll i=0;i<n;i++){
  cin>>c[i]>>d[i];
 }
   //cout<<"OK"<<endl;
 ll M = (n+1)*50;
 s = min( s , M );
 vector<vector<ll> > dp( n , vector<ll>( M + 1 ,inf) );
 priority_queue<mmp,vector<mmp>,greater<mmp> > q;
 q.push( mmp( 0ll , mp( s , 0ll ) ) );
 dp[0][s] = 0;
 vector<ll> coin(n,0);

 while( !q.empty() ){
  mmp now = q.top();
  q.pop();
  ll nn = now.second.second;
  ll time = now.first;
  ll cost = now.second.first;
  //if( dp[nn][cost] != inf ) continue;
  //while( cost <= M ){
   do {
   for(ll i=0;i<g[nn].size();i++){
    ll next = g[nn][i].second.second;
    ll nec = min( M , cost - g[nn][i].second.first);
    ll ntime = time + g[nn][i].first;
    if( nec < 0 ) continue;
    if( dp[next][nec] <= ntime ) continue;
    //if( coin[next] > nec ) continue;
    dp[next][nec] = ntime;
    coin[next] = max( coin[i] , nec );
    q.push( mmp( ntime , mp( nec , next) ) );
   }
   cost+=c[nn];
   time+=d[nn];
  }while( cost <= M );
 // cout<<"OK"<<endl;
 }

 for(ll i=1;i<n;i++){
  ll ans = inf;
  for(ll j=0;j<M;j++) ans = min( ans , dp[i][j]);
  cout<<ans<<endl;
 }


    return 0;
}


Measured memory_bytes: 53388
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READAR(A,5);
    FORI(i,0,5)
    {
        if(A[i]==0)
        {
            cout<<i+1<<endl;
            break;
        }
    }

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3792
def main():
    N, M = (int(i) for i in input().split())
    G = [[] for _ in range(N)]
    edges = []
    for i in range(M):
        a, b = (int(i)-1 for i in input().split())
        G[a].append(b)
        G[b].append(a)
        edges.append((a, b))

    def dfs(v, e):
        todo = []
        seen[v] = True
        todo.append(v)
        while todo:
            u = todo[-1]
            for next_v in G[u]:
                if seen[next_v]:
                    continue
                if (next_v, u) == e or (u, next_v) == e:
                    continue  # 使用禁止
                seen[next_v] = True
                todo.append(next_v)
                break
            else:
                todo.pop()
    ans = 0
    for e in edges:
        seen = [False] * N
        dfs(0, e)
        if not(all(seen)):
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39792
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  if(n<105){
    cout << 0 << endl;
  }else if(n<135){
    cout << 1 << endl;
  }else if(n<165){
    cout << 2 << endl;
  }else if(n<189){
    cout << 3 << endl;
  }else if(n<195){
    cout << 4 << endl;
  }else{
    cout << 5 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  if (K<A) cout << K << endl;
  else if (K<=A+B) cout << A << endl;
  else cout << A-(K-A-B) << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int h1, m1, s1, h2, m2, s2;

int main(){
	REP(i, 3){
		cin >> h1 >> m1 >> s1 >> h2 >> m2 >> s2;
		int t = (h2 * 3600 + m2 * 60 + s2) - (h1 * 3600 + m1 * 60 + s1);
		cout << t / 3600 << " " << t % 3600 / 60 << " " << t % 60 << endl;
	}
}

Measured memory_bytes: 1160
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

template <typename T> void output(T, int);
int gcd(int a, int b);

int main() {
    // source
    int n;
    cin >> n;
    string s[n];
    rep(i, n) { cin >> s[i]; }
    int count = 0, countAB = 0, countA = 0, countB = 0;
    int flag_count = 0;
    rep(i, n) {
        rep(j, s[i].size() - 1) {
            if (s[i][j] == 'A' && s[i][j + 1] == 'B') {
                count++;
            }
        }

        if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A') {
            countAB++;
        } else if (s[i][0] == 'B') {
            countB++;
        } else if (s[i][s[i].size() - 1] == 'A') {
            countA++;
        }
    }

    if (countAB >= 2) {
        count += countAB - 1;
        countAB = 1;
    }

    if (countAB == 1) {
        if (countA > 0 | countB > 0) {
            count++;
        }
    }
    count += min(countA, countB);
    cout << count << endl;
    return 0;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}


Measured memory_bytes: 768
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N,M = map(int,readline().split())
k = 2**N
dp = [[INF]*k for i in range(M+1)]
dp[0][0] = 0

for i in range(M):
    a,b = map(int,readline().split())
    c = list(map(int,readline().split()))
    d = sum(2**(ci-1) for ci in c)
    for j in range(k):
        dp[i+1][j] = min(dp[i][j],dp[i+1][j])
        dp[i+1][j|d] = min(dp[i][j|d],dp[i][j]+a,dp[i+1][j|d])

print(dp[M][2**N-1] if dp[M][2**N-1] != INF else -1)




Measured memory_bytes: 76012
#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	s = input()
	ans = chr(ord(s) + 1)
	print(ans)
	


if __name__ == '__main__':
	main()

Measured memory_bytes: 38384
from itertools import *
from math import *

N = int(input())
x = []
y = []
for _ in range(N):
    xi, yi = list(map(int, input().split()))
    x.append(xi)
    y.append(yi)

total_cost = 0
count = 0
for perm in permutations(range(N)):
    count += 1

    for i in range(len(perm) - 1):
        pi, pj = perm[i], perm[i + 1]
        dij = sqrt((x[pi] - x[pj]) ** 2 + (y[pi] - y[pj]) ** 2)
        total_cost += dij
    # print(perm)

print("{:.10f}".format(total_cost / count))

Measured memory_bytes: 40556
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F(i,n) for (int i = 0; i < n; ++i)
#define F1(i,n) for (int i = 1; i <= n; ++i)
#define rof(i, n) for (int i = ((n) - 1); i >= 0; i--)
typedef long long ll;
using namespace std;
vector<int>ivec;
vector<long long>lvec;
vector< pair<int, int> > pvec;
set< int, greater<int> >gset;
set<int, less<int> >lset;
set< int, greater<int> > ::iterator s;
void setprint()
 {
     set<int>so;
     set<int> :: iterator s;
     for(s=so.begin();s!=so.end();s++)
        cout<<*s<<" ";
 }

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    /*
    {
       Md: Saroar Zahan Sojib
       Green University of Bangladesh
       https://web.facebook.com/sojib.bdb
    }
   */

  int n;
  cin>>n;
  vector<int>vec;
  int reminder;
  while(n!=0)
  {
      reminder=n%10;
      n=n/10;
      vec.push_back(reminder);
  }
  int count=0;
  for(auto x:vec)
  {
      if(x==7)
      {
          count++;
      }
  }
  if(count==0)cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;

}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<int> sum(n + 1);
    reps(i, n){
        cin >> sum[i];
        sum[i] += sum[i - 1];
    }

    int ans = IINF;
    REP(i, 1, n){
        ans = min(ans, abs(sum[n] - sum[i] - sum[i] + sum[0]));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;
int n;
long long a[1000006];
long long rs = 0;
int main() {
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        scanf("%lld", &a[i]);
        if (a[i] - a[i - 1] > 1) {
            puts("-1");
            return 0;
        }
    }
    if (a[1]) {
        puts("-1");
        return 0;
    }
    for (int i = n; i >= 1; --i) {
        if (a[i] == a[i + 1] - 1) continue;
        rs += a[i];
    }
    printf("%lld", rs);
    return 0;
}


Measured memory_bytes: 1792
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 100005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)

using namespace std;

inline void inp( int &n ) { 
	n=0;    int ch=getcx();int sign=1;   
	while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getcx();} 
	while(  ch >= '0' && ch <= '9' )    
	n = (n<<3)+(n<<1) + ch-'0', ch=getcx();
	n=n*sign;
}

inline void inp1( LL &n ) { 
	n=0;    LL ch=getcx();LL sign=1;   
	while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getcx();} 
	while(  ch >= '0' && ch <= '9' )    
	n = (n<<3)+(n<<1) + ch-'0', ch=getcx();
	n=n*sign;
}

void solve() {
	
	int n, m;
	cin>>n>>m;
	int a[n], sum = 0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		sum+=a[i];
	}
	
	int ans = 0;
	for(int i=0;i<n;i++) {
		if(a[i] >= (sum * 1.0) / (4*m)) ans++;
	}
	if(ans >= m) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

int main() {
	int t = 1;
	
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 3628
S = input()
S=S.replace("BC", "D")

ca = 0

T = []

tt = ""
for i in range(len(S)):
    if S[i] == 'A':
        tt += S[i]

    elif S[i] == 'B' or S[i] == 'C':
        # clear
        if tt != "":
            T.append(tt)
            tt = ""
    
    elif S[i] == 'D':
        tt += S[i]

if tt != "":
    T.append(tt)
    tt = ""

# solve
ans = 0
for seq in T:
    ca = 0
    for c in seq:
        if c == 'A':
            ca += 1
        else:
            ans += ca

print(ans)
            

Measured memory_bytes: 10828
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  int k;
  cin >> k;
  if (k % 2 == 0 or k % 5 == 0) {
    cout << -1;
    return 0;
  }
  if (k % 7 == 0) k /= 7;
  int p = 1;
  int m = 0;
  int cnt = 0;
  do {
    m += p;
    m %= k;
    p *= 10;
    p %= k;
    ++cnt;
  } while (m);
  cout << cnt;

  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

bool ok;
vector<int> ans;
vector<int> a;

void rec(int sum, vector<int> cnt, vector<int>& v) {
  
  if(sum == 0) {
    ans = v;
    ok = true;
    return;
  }
  
  for(int i=1; i<=13; i++) {
    if(cnt[i] && sum % i == 0) {
      v.push_back(i);
      cnt[i] --;
      rec(sum-i, cnt, v);
      if(ok) return;
      cnt[i] ++;
      v.pop_back();
    }
  }
  
}

int main() {
  int n;
  
  while(cin >> n && n) {
    vector<int> a(n);
    vector<int> cnt(14, 0);
    int sum = 0;
    for(int i=0; i<n; i++) {
      cin >> a[i];
      cnt[a[i]] ++;
      sum += a[i];
    }
    
    vector<int> v;
    ok = false; rec(sum, cnt, v);
    
    if(ok) {
      reverse(ans.begin(), ans.end());
      int const N = ans.size();
      for(int i=0; i<N; i++) {
	if(i) cout << " " << ans[i];
	else cout << ans[i];
      }
      cout << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

template<int SZ> struct DSU {
    int par[SZ], sz[SZ], co[SZ];
    DSU() {
        F0R(i,SZ) par[i] = i, sz[i] = 1;
    }
    
    int get(int x) { // path compression
    	if (par[x] != x) par[x] = get(par[x]);
    	return par[x];
    }
    
    bool unite(int x, int y) { // union-by-rank
    	x = get(x), y = get(y);
    	if (x == y) return 0;
    	if (sz[x] < sz[y]) swap(x,y);
    	sz[x] += sz[y], par[y] = x;
    	return 1;
    }
};

DSU<MX> D;
int N,M,A[MX],use[MX];
int need,cur;
ll ans = 0;

void accept(int x) {
    cur ++, D.co[D.get(x)] ++;
    use[x] = 1, ans += A[x];
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> M;
    F0R(i,N) cin >> A[i];
    F0R(i,M) {
        int a,b; cin >> a >> b;
        D.unite(a,b);
    }
    if (M == N-1) {
        cout << 0;
        exit(0);
    }
    need = N-1-M, cur = 0;
    vi x; F0R(i,N) x.pb(i);
    sort(all(x),[](int a, int b) { return A[a] < A[b]; });
    F0R(i,N) if (!D.co[D.get(x[i])]) accept(x[i]);
    F0R(i,N) if (cur < 2*need && !use[x[i]] && D.co[D.get(x[i])] < need) accept(x[i]);
    if (cur != 2*need) {
        // cout << cur << "\n";
        cout << "Impossible";
        exit(0);
    }
    cout << ans;
    /*for (int i: x) cout << i << " ";
    cout << "\n";*/
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 2680
N=int(input())
a=list(map(int,input().split()))

gray=[]
brown=[]
green=[]
light_blue=[]
blue=[]
yellow=[]
orange=[]
red=[]
free=[]

count=0

for i in a:
    if 0<i<400:
        gray.append(i)
    elif 400<=i<800:
        brown.append(i)
    elif 800<=i<1200:
        green.append(i)
    elif 1200<=i<1600:
        light_blue.append(i)
    elif 1600<=i<2000:
        blue.append(i)
    elif 2000<=i<2400:
        yellow.append(i)
    elif 2400<=i<2800:
        orange.append(i)
    elif 2800<=i<3200:
        red.append(i)
    else:
        free.append(i)

if len(gray)>=1:
    count+=1
if len(brown)>=1:
    count+=1
if len(green)>=1:
    count+=1
if len(light_blue)>=1:
    count+=1
if len(blue)>=1:
    count+=1
if len(yellow)>=1:
    count+=1
if len(orange)>=1:
    count+=1
if len(red)>=1:
    count+=1

if count>0:
    print(count,count+len(free))
else:
    print(min(1,len(free)),len(free))

Measured memory_bytes: 3064
a, b, c=map(int, raw_input().split())
if a<=b:
	if b<=c:
		print a,b,c
	elif a<=c:
		print a,c,b
	else:
		print c,a,b
else:
	if a<=c:
		print b,a,c
	elif b<=c:
		print b,c,a
	else:
		print c,b,a

Measured memory_bytes: 4200
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"

struct stone {
	int x;
	int y;
	int slip;
};
struct Edge {
	int to;
	int time;
};
struct aa {
	int now;
	int time;
};
class Compare {
public:
	//aa?????????????????¶
	bool operator()(const aa&l, const aa&r) {
		return l.time> r.time;
	}
};
int main() {
	while (1) {
		int N, M; cin >> N >> M;
		if (!N)break;
		vector<stone>stos;
		for (int i = 0; i < N; ++i) {
			int k; cin >> k;
			for (int j = 0; j < k; ++j) {
				int x, s; cin >> x >> s;
				x--;
				stos.push_back(stone{ x,i+1,s });
			}
		}
		vector<vector<Edge>>es(stos.size()*(M+1) + 2);
		for (int i = 0; i < stos.size(); ++i) {
			for (int j = 0; j <stos.size(); ++j) {
				if (i == j)continue;
				for (int m = 0; m <= M; ++m) {
					stone si = stos[i];
					int iid = i*(M + 1) + m;
					stone sj = stos[j];
					int jid = j*(M + 1) + m;
					if (si.y + 1 == sj.y) {
						es[iid].push_back(Edge{ jid,abs(si.x - sj.x)*(si.slip + sj.slip) });
					}
					else if (si.y + 2 == sj.y&&m!=M) {
						es[iid].push_back(Edge{ int(jid+1),abs(si.x - sj.x)*(si.slip + sj.slip) });
					}
				}
			}
		}
		const int start = stos.size()*(M + 1);
		const int goal = start + 1;
		for (int i = 0; i < stos.size(); ++i) {
			stone s(stos[i]);
			for (int m = 0; m < M; ++m) {
				const int nid = i*(M+1)+ m;
				es[nid].push_back(Edge{ nid+ 1,0 });
				if (s.y == 2) {
					es[start].push_back(Edge{ int(nid+ 1), 0});
				}
				if (s.y == N - 1) {
					es[nid].push_back(Edge{ goal,0 });
				}
			}
			for (int m = 0; m <= M; ++m) {
				const int nid = i*(M + 1) + m;
				if (s.y == 1) {
					es[start].push_back(Edge{ nid, 0 });
				}
				if (s.y == N) {
					es[nid].push_back(Edge{ goal,0 });
				}
			}
			
		}
		priority_queue < aa, vector<aa>, Compare > que;
		que.push(aa{ start,0 });
		vector<long long int>memo(es.size(), 1e18);
		memo[start] = 0;
		int ans = -1;
		while (!que.empty()) {
			aa atop(que.top());
			que.pop();
			if (atop.now == goal) {
				ans = atop.time;
				break;
			}
			for (auto e : es[atop.now]) {
				const int nexttime = atop.time + e.time;
				if (memo[e.to] > nexttime) {
					memo[e.to] = nexttime;
					que.push(aa{ e.to,nexttime });
				}
			}
		}
		cout << ans << endl;
	
	}
	
	return 0;
}

Measured memory_bytes: 38468
D, G = map(int, input().split())

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

p = []
c = []
for _ in range(D):
	p_tmp, c_tmp = map(int,input().split())
	p.append(p_tmp)
	c.append(c_tmp)
t = [(i+1)*100*p[i] + c[i] for i in range(D)]

ans = float("inf")

for i in range(2**D):
	flg = list(map(int, Base_10_to_n(i,2).rjust(D,"0")))
	tmp_score = sum([t[j] for j in range(D) if flg[j] == 1])
	cnt = sum([p[j] for j in range(D) if flg[j] == 1])

	if tmp_score < G:

		rst_max_q = max([j for j in range(D) if flg[j] == 0])

		rst_q_num = 0
		while rst_q_num < p[rst_max_q]:
			tmp_score += 100*(rst_max_q+1)
			rst_q_num += 1
			cnt += 1
			if tmp_score >= G:
				break

		if tmp_score < G:
			continue

	ans = min(ans, cnt)


print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;

int main(){
  int h,w,i,j,ans;
  cin >> h >> w;
  string s;
  for(i=0; i<h*w; i++){
    cin >> s;
    if(s=="snuke"){
      ans=i;
    }
  }
  i=ans%w; j=ans/w+1;
  char c='A'+i;
  cout << c << j;
}

Measured memory_bytes: 256
#https://atcoder.jp/contests/abc103/tasks/abc103_d
from collections import deque
N, M = map(int, input().split())
a = [0]*M
b = [0]*M
lis = []
for i in range(M):
    a[i], b[i] = map(int, input().split())
    lis.append([a[i], b[i]])

lis = sorted(lis, key=lambda x:x[1])
lis = deque(lis)

start, end = lis.popleft()
cnt = 1

while lis:
    x, y = lis.popleft()
    if x<end:
        continue
    else:
        start = x
        end = y
        cnt += 1

print(cnt)


Measured memory_bytes: 66136
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>h(n);
    REP(i,n)cin>>h[i];
    vector<ll>dp(n,1e9);dp[0]=0;
    REP(i,n)
        REP(j,k)
            if(i+j+1<n)dp[i+j+1]=min(dp[i+j+1],dp[i]+abs(h[i+j+1]-h[i]));
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1536
def examA():
    S = SI()
    if S[2]==S[3] and S[4]==S[5]:
        print("Yes")
    else:
        print("No")
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examA()

"""

"""

Measured memory_bytes: 5232
#include <iostream>

int main(){
   int N;
   std::cin >> N;
   int a[N];
   for(int i=0; i<N; ++i)
      std::cin >> a[i];

   int count4 = 0;
   int count2 = 0;
   for(int i=0; i<N; ++i){
      if(a[i]%4==0) count4++;
      else if(a[i]%2==0) count2++;
   }
   int others = N - count4 - count2;
   if(count4<others){
      if(count4==others-1 && count2==0) std::cout << "Yes" << std::endl;
      else std::cout << "No" << std::endl;
   }else std::cout << "Yes" << std::endl;

   return 0;

}


Measured memory_bytes: 640
N = int(input())
A = list(map(int,input().split()))

max_n = A[0]
ans = 0
for i in range(N):
    tmp = max_n - A[i]
    if tmp > 0:
        ans += tmp
    if max_n < A[i]:
        max_n = A[i]
print(ans)
    


Measured memory_bytes: 32296