akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func partition(a []int, left, right int) int {
	pivot := a[right]               // pivotは配列aの右端
	i := left - 1                   // iはleftの一個左から開始
	for j := left; j < right; j++ { // leftからrightまでaをスキャンする
		if a[j] <= pivot { // 現在見ている要素は右端の値と同じか小さい
			i++                     // iを一つ進める
			a[i], a[j] = a[j], a[i] // a[i]とa[j]を交換する
		}
	}
	a[i+1], a[right] = a[right], a[i+1]
	return i + 1
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	p := partition(a, 0, len(a)-1)
	for i := 0; i < len(a); i++ {
		if i > 0 {
			fmt.Print(" ")
		}
		if p == i {
			fmt.Printf("[%d]", a[i])
		} else {
			fmt.Printf("%d", a[i])
		}
	}
	fmt.Println()
}



Measured memory_bytes: 5860
#include <stdio.h>
void Print_a_Rectangle(unsigned int H, unsigned int W)
{
    unsigned short i,j;
    for(i=1;i<=H;i++){
        for(j=1;j<=W;j++){
            if((i==1)||(i==H)||(j==1)||(j==W))
            {
                printf("#");
            }
            else
            {
                printf(".");
            }
        }
        printf("\n");
    }
}

int main()
{
    unsigned int H,W;
    while(1)
    {
        scanf("%d %d",&H,&W);
        if((H==0)&&(W==0))
        {
            break;
        }
        else
        {
            Print_a_Rectangle(H,W);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2036
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define REP(i,e) for (int i = 0; i != int(e); i++)
#define FORIT(i, A) for (auto i : A)
#define ISEQ(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << endl
#define SZ(x) ((int)(x).size())

int main(int argc, char const *argv[])
{
	int h;
	int max[3] = {0, 0, 0};
	while(scanf("%d", &h) != EOF)
	{
		if (max[0] < h)
		{
			max[2] = max[1];
			max[1] = max[0];
			max[0] = h;
		}
		else if (max[1] < h)
		{
			max[2] = max[1];
			max[1] = h;
		}
		else if (max[2] < h)
		{
			max[2] = h;
		}
	}
	printf("%d\n%d\n%d\n", max[0], max[1], max[2]);
	return 0;
}

Measured memory_bytes: 3196
MOD = 10**9+7
#nCrは以下のやつ全てを使ってください
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
 
gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
 
def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

def nPr(n,r):
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

N = int(input())
if N == 1:
    print(0)
else:
    ALL = pow(10,N,MOD)
    p0 = pow(9,N,MOD)
    in0 = ALL - pow(9,N,MOD)
    in9 = ALL - pow(9,N,MOD)
    p09 = pow(8,N,MOD)
    in09 = ALL - p09
    print((in0+in9-in09)%MOD)

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

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

int n, l[100], t;

void solve() {
  rep(i,n) cin>>l[i];
  cin>>t;
  
  int lb = 0, ub = n-1, res = 0;
  while (ub >= lb) {
    int mid = (ub+lb)/2;
    if (l[mid] == t) {res++; break;}
    if (l[mid] < t) {
      lb = mid + 1;
    }
    else  if (l[mid] > t) {
      if (mid != 0) ub = mid - 1;
    }
    res++;
  }

  cout<<res<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
  ll n, k;
  cin >> n >> k;
  if(n<=k){
    cout << 0 << endl;
    return 0;
  }
  vector<ll> h(n);
  rep(i,n) cin >> h[i];
  sort(h.begin(), h.end(), greater<ll>());
  rep(i,k) h[i] = 0;
  ll sum = 0;
  rep(i,n) sum += h[i];
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1<<17;// = 131072
const ll INF = (1e9)+10;

/*dat???????????????N?????????*/

class RMQ{
public:
  ll n,dat[2*N-1];

  //?????????
  RMQ(){
    n=N;
    for(int i=0;i<2*n-1;i++) dat[i]=INF;
  }
  
  //k???????????????a????????´
  void update(int k,ll a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }
  
  //[a,b)???????°????????±??????? query(a,b,0,0,n)
  ll query(int a,int b,int k=0,int l=0,int r=N){
    if(r<=a||b<=l)return INF;
    if(a<=l&&r<=b)return dat[k];

    ll vl=query(a,b,k*2+1,l,(l+r)/2);
    ll vr=query(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }
};


ll n,A[N];
vector<int>Idx;
ll L[N],R[N];


void calc(ll arr[]){
  RMQ rmq;
  for(int i=0;i<n;i++){
    int idx = lower_bound(Idx.begin(),Idx.end(),A[i]) - Idx.begin();
    ll val = -rmq.query(0,idx); //A[i]???????°???????????????§?????§???index?????????
    if(val == -INF) val = -1;

    arr[i] = i - val - 1;
    rmq.update(idx,-i);
  }
}

int main(){
  cin>>n;
  Idx.resize(n);
  for(int i=0;i<n;i++)cin>>A[i],Idx[i] = A[i];
  sort(Idx.begin(),Idx.end());
  Idx.erase(unique(Idx.begin(),Idx.end()),Idx.end());
  
  calc(L);
  reverse(A,A+n);
  calc(R);
  reverse(A,A+n);

  ll ans=0;
  for(int i=0;i<n;i++){
    ll w = L[i]+R[n-1-i]+1;
    ans = max(ans,w*A[i]);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 7540
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define pb(x) push_back(x)
#define fi first
#define se second
const int inf = 1e9+7;
const int INF = 1e18+7;
int mod = 1e9+7;

signed main(){
	string str;
	cin >> str;
	int n = str.size();
	rep(i,n){
		if(str[i] == ',')cout << " ";
		else cout << str[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : Hello5.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
long long a,b,k;
cin>>a>>b>>k;

if (k<=a)
	{cout<<a-k<<" "<<b<<endl;}
else if (k<=a+b)
	{cout<<0<<" "<<b-(k-a)<<endl;}
else
	{cout<<0<<" "<<0<<endl;}
	 return 0;
}





Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B_fix
# CreatedDate:  2020-05-31 21:22:32 +0900
# LastModified: 2020-05-31 21:25:40 +0900
#


import os
import sys
#import numpy as np
#import pandas as pd


def main():
    n = int(input())
    A = list(map(int,input().split()))
    if 0 in A:
        print(0)
        return 
    sum = 1
    for a_ in A:
        sum*=a_
        if sum > 10**18:
            print(-1)
            return
    print(sum)    

if __name__ == "__main__":
    main()


Measured memory_bytes: 21668
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}
 
fn main() {
  let s: String = read();

  let ans = if s.find("AC") != None { "Yes" } else { "No" };

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


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

using namespace std;

int main(){
    int X, Y;

    cin >> X >> Y;
    if( Y>= 2*X && Y<= 4*X  && !(Y % 2)){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}

Measured memory_bytes: 3552
from itertools import *
n,m,q = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(q)]
A = [i for i in range(1, m+1)]
ans = 0
for l in combinations_with_replacement(A, n):
  l = list(l)
  tmp = 0
  for a,b,c,d in lst:
      if l[b-1] - l[a-1] == c:
          tmp += d
  ans = max(ans, tmp)
print(ans)

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

typedef pair< long long, long long > P;
 
bool sort_cost( const P &l, const P &r )
{
	if( (__int128)l.second * r.first != (__int128)r.second * l.first ) {
		return (__int128)l.second * r.first > (__int128)r.second * l.first;
	}
	else {
		return l.second > r.second;
	}
}

long long greedy( const vector<P>& vec, const int i, long long W )
{
  long long ans = 0;
	for ( int k = i; k < vec.size() && W > 0; k++ ) {
		long long v = vec[k].second;
		long long w = vec[k].first;
		if (w <= W) {
			ans += v;
			W -= w;
		}
	}
	return ans;
}

double ubound( const vector<P>& vec, const int i, long long W )
{
	double remain_w = W;
	double ans = 0;
	for( int k = i; k < vec.size(); k++ ) {
		double v = vec[k].second;
		double w = vec[k].first;
		if( w >= remain_w ) {
			ans += v * remain_w / w;
			break;
		}
		ans += v;
		remain_w -= w;
	}
	return ans;
}
 
long long ans;
void dfs( const vector<P>& vec, const int i, const long long W, const long long total )
{
	if ( i >= vec.size() ) {
		return;
	}

	long long gans = greedy( vec, i, W );
	ans = max( ans, total + gans );

	double ub = ubound( vec, i, W );
	if( total + ub <= ans ) {
		return;
	}

	long long v = vec[i].second;
	long long w = vec[i].first;

	dfs( vec, i + 1, W, total );

	if ( W >= w ) {
		dfs( vec, i + 1, W - w, total + v );
	}
}

int main()
{
	int N;
	long long W;
	cin >> N >> W;
	vector<P> vec;
	for( int i = 0; i < N; i++ ) {
		long long v, w, m;
		cin >> v >> w >> m;
		long long k = 1;
		while( m > 0 ) {
			long long mul = min( k, m );
			k *= 2;
			m -= mul;
			vec.push_back( make_pair( w * mul, v * mul ) );
		}
	}

	sort( vec.begin(), vec.end(), sort_cost );

	dfs( vec, 0, W, 0 );

	cout << ans << endl;
 
	return 0;
}




Measured memory_bytes: 3288
N,M,C = map(int, input().split())
B = list(map(int, input().split()))
count=0
for i in range(N):
    A=list(map(int,input().split()))
    p=C
    for j in range(M): p+=A[j]*B[j]
    if p>0:count+=1
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e9+10;
const ll mod = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define print(x) cerr << #x << " is " << x << endl;
//#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 

const ll MOD = 1000000007;
#define MAX ll(2e5 + 1)
//long long fac[MAX], finv[MAX], inv[MAX];
ll inv[MAX];
// inv ���܂Ƃ߂ċ��߂�
void init_mod_inverse_all() {
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        //if (i < 100)fprintf(stderr, "%d, %d, %d\n", i, inv[i], inv[i] * i %mod);
    }
}

// O(log n)
ll mod_pow(ll x, ll n){
    ll res = 1LL;
    while (n > 0) {
        
        if (n & 1LL) res = res * x % MOD;
        x = x * x % MOD;
        n >>= 1LL;
    }
    return res;
}
#if 0
// �e�[�u�������O����
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
#endif
// �񍀌W���v�Z
ll COM(ll n, ll k){
    ll ans = 1;
    for (int i = 1; i <= k; i++){
        (ans *= (n - i + 1)) %= MOD;
        (ans *= inv[i]) %= MOD;
    }
    return ans;
}

int main() {
    // �O����
    
    ll N, A, B;
    cin >> N >> A >> B;
    init_mod_inverse_all();
    // �v�Z��
    ll ans = mod_pow(2LL, N);
    (ans += mod - 1) %= mod;
    (ans += mod - COM(N, A)) %= mod;
    (ans += mod - COM(N, B)) %= mod;
    cout << ans;
    //cout << mod_pow(2LL, N) - 1 - COM(N, A) - COM(N, B);
}


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

string f(string str, int l, int r) { // [l, r)
	string c = str.substr(0, l) + str.substr(r, str.size() - r);
	return c;
}

int main() {
	string str;
	cin >> str;

	string result = "NO";
	for (int i=0; i<str.size(); i++) for (int j=i; j<str.size(); j++) {
		if (f(str, i, j) == "keyence") {
			result = "YES";
		}
	}

	cout << result << endl;
	return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    ll ans=0;
    for (int i=1;i<=N;++i){
        if (i%3==0||i%5==0) continue;
        ans+=i;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3652
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;
typedef tuple<LL, LL, LL> P;

LL solve() {
  int N; cin >> N;

  LL ans = 0;
  map<int, vector<LL>> ml, mr;
  for (int i = 0; i < N; ++i) {
    LL K, L, R; cin >> K >> L >> R;
    if (L >= R) {
      ans += R;
      ml[K].push_back(L - R);
    } else {
      ans += L;
      mr[K].push_back(R - L);
    }
  }

  priority_queue<LL, vector<LL>, greater<LL>> quel, quer;
  for (int i = 1; i <= N; ++i) {
    for (LL v : ml[i]) {
      quel.push(v);
    }
    while (quel.size() > i) quel.pop();

    for (LL v : mr[N - i]) {
      quer.push(v);
    }
    while (quer.size() > i) quer.pop();
  }

  while (!quel.empty()) {
    ans += quel.top(); quel.pop();
  }
  while (!quer.empty()) {
    ans += quer.top(); quer.pop();
  }

  return ans;
}

int main() {
  int T; cin >> T;
  for (int i = 0; i < T; ++i) {
    cout << solve() << endl;
  }
}


Measured memory_bytes: 40840
import fractions
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

a,b = map(int,input().split())
c = fractions.gcd(a,b)
lis = make_divisors(c)
cnt=0
for i in lis:
    if(is_prime(i)):
        cnt+=1
print(cnt+1)

Measured memory_bytes: 5304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main() {
    ll N,D;
    cin>>N>>D;
    ll r=2*D+1;
    cout<<(N+r-1)/r<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
const int MOD=1e9+7;
using pii=std::pair<int,int>;
using namespace std;

int n, c2, c4, x;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> x;
        if(x % 4 == 0)
            c4++;
        else if(x % 2 == 0)
            c2++;
    }
    if(2 * c4 + 1 >= n || c2 + 2 * c4 >= n)
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
char s[20];
int a,l;
int main()
{
	while((s[l]=getchar())!=-1&&s[l]!='\n')
		if(s[l]!=' ') l++;
	sscanf(s,"%d",&a);
	if(sqrt(a)==(int)sqrt(a))
		puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 128
s=input()
n=0
ans=0
A=[0]*2019
A[0]=1
for i in range(len(s)):
  n=(n+int(s[-1-i])*pow(10,i,2019))%2019
  #print(i,n)
  A[n]+=1
for i in A:
  ans+=i*(i-1)//2
print(ans)

Measured memory_bytes: 9296
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int64_t n,a,b;
  cin >> n>>a>>b;
  
  int64_t sum=a+b;
  int64_t syou=n/sum;
  int64_t amari=n%sum;
  if(amari<=a) cout << a*syou+amari<<endl;
  else cout << a*(syou+1) <<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;
int main()
{
   
   
    int n;
    cin >> n;

    vector<int>p(n);
    int f[9000] = {};
    for (int i = 0; i < n; i++) {
        cin >> p[i];
       
    }
  
    sort(p.begin(), p.end());

 

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int a = p[i] + p[j];
            int x = lower_bound(p.begin(), p.end(), a) - p.begin();
            int y = j + 1;
           
            ans += (x-y);

            
        }
    }
    cout << ans << endl;
    

    return 0;

}


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

using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class T> ostream& operator<<(ostream &os, set<T> S){os << "{ "; for(auto s:S) os<<s<<" "; return os<<"}";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {os << "{ "; for(auto m:M) os<<"("<<m.first<<":"<<m.second<<") "; return os<<"}";}
#ifdef np
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>void __f(const char *name, Arg1 &&arg1) { cout<<name<<" : "<<arg1<<endl;}
template<typename Arg1, typename ... Args>void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma=strchr(names+1,','); cout.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif


int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
	
	string s ; cin>> s;
	int n = sz(s);
	int cnt =0;
	rep(i,0,n){if(s[i]!=s[n-i-1]) cnt++;}
    cout<<cnt/2<<endl;
    

#ifdef np
    cerr <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif  
 return 0; 
 }


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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int N;
    std::cin >> N;

    string S1, S2;
    std::cin >> S1 >> S2;

    ll ans = S1[0] == S2[0] ? 3 : 6;
    for(int i = S1[0] == S2[0] ? 1 : 2; i < N; i++) {
        if(S1[i] == S2[i]) {
            if(S1[i - 1] == S2[i - 1]) {
                ans *= 2;
            }
            else {
                ans *= 1;
            }
        }
        else {
            if(S1[i - 1] == S2[i - 1]) {
                ans *= 2;
            }
            else {
                ans *= 3;
            }
            i++;
        }
        ans %= MOD;
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
 
using namespace std;
 
using   ll=long long;
using   ld=long double;
 
#define fast           ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl           "\n"
#define int            long long 
#define pb             push_back
#define mp             make_pair
#define vll            vector<ll>
#define ff              first
#define ss              second
#define pll            pair<ll,ll>
#define ALL(v)         v.begin(),v.end()
#define ALLR(v)        v.rbegin(),v.rend()
#define pii            3.14159265358979323
 
void solve()
{
    char c;
    
    cin>>c;
    
    cout<<(char)(c+1);
}
 
 
signed main()
{
 
    fast;
 
    ll t;
    
    t=1;
    
    //cin>>t;
    
    while(t--)
    {
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
#define int long long
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

const ll MOD = 1e9+7;
const int MAX = 1001001;
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i % MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i) % MOD;
        finv[i]=finv[i-1]*inv[i] % MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    COMinit();
    int n; cin >> n;
    vector<int> res(n+1,-1);
    int x=0,y=0;
    rep(i,n+1){
        int a; cin >> a;
        a--;
        if(res[a]!=-1){
            x=res[a];
            y=n-i;
        }
        res[a]=i;
    }
    for(int i=1;i<=n+1;i++){
        ll res=COM(n+1,i);
        if(x+y>=i-1) res-=COM(x+y,i-1);
        res=(res+MOD)%MOD;
        cout << res <<  endl;
    }
}


Measured memory_bytes: 25472
import java.util.*;
 
public class Main {
 
	static Main instance = new Main();
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        long[] a = new long[N];
        long[] b = new long[N];
        long[] c = new long[M];
        long[] d = new long[M];
        
        for(int i = 0; i < N; i++){
          a[i] = sc.nextLong();
          b[i] = sc.nextLong();
        }
      
        for(int i = 0; i < M; i++){
          c[i] = sc.nextLong();
          d[i] = sc.nextLong();
        }
        
        for(int i = 0; i < N; i++){
          long ans = 0;
          long min = Long.MAX_VALUE;
          for(int j = 0; j < M; j++){
            long manhattan = Math.abs(a[i]-c[j])+Math.abs(b[i]-d[j]);
              if(manhattan < min){
                min = manhattan;
                ans = j;
              }
          }
          
          System.out.println(ans+1);
        }
         
	}
}

Measured memory_bytes: 35976
#include <stdio.h>

int main(void)
{
    long long x, y, z, N;
    long long tmp, count[10000];

    scanf("%lld",&N);

    for(int i=0; i<N; i++) count[i] = 0;

    // z >= y >= x　とする
    
    for(z=1; z<100; z++){
        for(y=1; y<=z; y++){
            for(x=1; x<=y; x++){

                tmp = x*x+y*y+z*z+x*y+y*z+z*x;

                if(tmp <= N) {
                    if(x==y && y==z){
                        count[tmp-1]++;
                    } else if(x==y || y==z || z==x){
                        count[tmp-1]+=3;
                    } else {
                        count[tmp-1]+=6;
                    }
                }

            }
        }
    }

    for(int i=0; i<N; i++) {
        printf("%lld\n",count[i]);
    }

    return 0;
}

Measured memory_bytes: 1732
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N, K; cin >> N >> K;
	vector<int>A(N + 1); rep(i, 1, N + 1) { cin >> A[i]; }

	map<int, vector<int>>mp;
	mp[0].eb(0);
	rep(i, 1, N + 1) {
		A[i] += A[i - 1];
		A[i] %= K;
		mp[(i - A[i] + K) % K].eb(i);
	}
	dump(A);
	dump(mp);
	int ans = 0;
	for (auto p : mp) {
		auto& v = p.second;
		int l = 0;
		rep(i, 0, v.size()) {
			while(v[i] - v[l] >= K) {
				l++;
			}
			ans += i - l;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;

const int inf = 1e8;

template <typename T>
void chmin(T &t, const T &val) { t = min(t, val); }

VV<int> wa_sha_ru(const VV<P> &edges) {
    int N = edges.size();
    VV<int> dist(N, V<int>(N, inf));
    for(int i = 0; i < N; i++) dist[i][i] = 0;
    for(int i = 0; i < N; i++) for(P p : edges[i]) {
        int j, d;
        tie(j, d) = p;
        dist[i][j] = min(dist[i][j], d);
    }

    for(int k = 0; k < N; k++) for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) chmin(dist[i][j], dist[i][k] + dist[k][j]);

    return move(dist);
}

V<int> calc_cost(const V<int> &Q, const V<int> &R) {
    V<int> ret(20010);
    int q_idx = 0;
    for(int i = 1; i < ret.size(); i++) {
        if(Q[q_idx] < i) q_idx++;
        ret[i] = ret[i - 1] + R[q_idx];
    }

    return move(ret);
}

bool solve() {
    int N, M, C, S, G;
    cin >> N >> M >> C >> S >> G;

    if(!(N + M + C + S + G)) return false;
    
    S--;
    G--;

    VV<P> c_edges[20];
    for(int i = 0; i < 20; i++) c_edges[i].resize(N);

    for(int i = 0; i < M; i++) {
        int x, y, d, c;
        cin >> x >> y >> d >> c;
        x--;
        y--;
        c--;
        c_edges[c][x].emplace_back(y, d);
        c_edges[c][y].emplace_back(x, d);
    }

    int PC[20];
    for(int i = 0; i < C; i++) cin >> PC[i];

    VV<int> mat(N, V<int>(N, inf));
    for(int c = 0; c < C; c++) {
        V<int> Q(PC[c] - 1), R(PC[c]);
        for(int &e : Q) cin >> e;
        for(int &e : R) cin >> e;
        Q.push_back(inf);
        
        auto dist = wa_sha_ru(c_edges[c]);
        auto cost = calc_cost(Q, R);
        for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) {
            if(cost.size() <= dist[i][j]) continue;
            chmin(mat[i][j], cost[dist[i][j]]);
        }
    }

    for(int k = 0; k < N; k++) for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) chmin(mat[i][j], mat[i][k] + mat[k][j]);
    int ans = (mat[S][G] >= inf ? -1 : mat[S][G]);
    cout << ans << endl;

    return true;
}

int main() {
    while(solve());
    return 0;
}



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

vector<int> arr;
int n,k;

bool check(int d){
	vector<int> v;

	int sm = 0;
	for(int i = 0; i < (int)arr.size(); i++){
		int r = arr[i]%d;
		if(r!=0) v.push_back(r);
		sm+=r;
	}

	if(v.size() == 0) return true;
	if(sm%d!=0) return false;
	sort(v.begin(),v.end());
	deque<int> dq;
	for(int i: v) dq.push_back(i);
	int res = k;
	while(dq.size()){
		if(dq.size() == 1) return false;
		int s = dq.front();
		int q = dq.back();
		int mn = min(s,d-q);
		dq.front() -= mn;
		if(dq.front() == 0) dq.pop_front();
		dq.back()+=mn;
		if(dq.back() == d) dq.pop_back();
		res-=mn;
		if(res<0) return false;
	}
	return true;
}

int main(){
	cin>>n>>k;
	
	int res = 1;
	int sm = 0;
	for(int i = 0; i < n; i++){
		int x;cin>>x;
		sm+=x;
		arr.push_back(x);
	}

	for(int i = 1; i*i<=sm; i++){
		if(check(i)) res = max(res,i);
		if(check(sm/i)) res = max(res,sm/i);
	}
	cout<<res;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <deque>
#include <string>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <map>
#include <unordered_map>
#include <bitset>

#define _crt_secure_no_warnings
#define FREEELO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define INF 0x3F3F3F3F
#define MAX 200001
#define MOD 1000000007
#define ALPHABET 128
#define loop(i, n) for (int i = 1; i <= (n); i++)
#define loop0(i, n) for (int i = 0; i < (n); i++)
#define sz(x) (int)x.size()
#define all(v) v.begin(), v.end()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll, ll> llll;
typedef pair<int, int> ii;
typedef unordered_map<int, int> umii;
typedef unordered_map<ll, ll> umll;

ll dp[MAX], arr[MAX];
int main(){
    int n; cin >> n;
    loop(i, n) {
        cin >> arr[i];
        dp[i] = dp[i - 1] + arr[i];
    }
    ll res = 0;
    loop(i, n){
        res = (res + (arr[i] * ((dp[n] - dp[i]) % MOD)) % MOD) % MOD;
    }
    cout << res << endl;
}

Measured memory_bytes: 6280
//abc061_c.cpp
//Sun Jun  3 11:55:37 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	long long n;
	long long k;
	cin >> n >> k;

	long long a[100000];
	for (int i=0;i<100000;i++){
		a[i] = 0LL;
	}

	for (int i=0;i<n;i++){
		long long atemp,btemp;
		cin >> atemp >> btemp;
		a[atemp] = a[atemp]+btemp;
	}

	long long ans;
	long long i;
	for (i=0;i<100000;i++){
		k = k-a[i];
		if (k <= 0LL){
			ans = i;
			break;
		}
	}

	cout << i << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void){
  cout << std::fixed << std::setprecision(16);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int64_t n;
  cin>>n;
  int64_t limit=std::pow(n,0.5)+1;
  int64_t result=INT64_MAX/2;
  for(int64_t i=1;i<=limit;i++){
    if(n%i==0){
      int64_t x=i;
      int64_t y=n/i;
      result=std::min(result,x+y-2);
    }
  }
  result=std::min(result,n-1);
  cout<<result<<endl;



  return 0;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline

_a, _b = map(int, input().split())


def gcd(a, b):
    while b:
        a, b = b, a % b

    return a


def get_divisor(a):
    dvlist = []
    for i in range(1, int(a ** 0.5) + 1):
        if a % i == 0:
            dvlist.append(i)
            if i != a // i:
                dvlist.append(a // i)

    return sorted(dvlist)


def chker(a, b):
    a, b = min(a, b), max(a, b)
    mindiv = get_divisor(a)
    shdvlist = [item for item in mindiv if b % item == 0]
    if len(shdvlist) < 3:
        print(len(shdvlist))
        return

    slist, shdvlist = [shdvlist[1]], shdvlist[1:]
    for item1 in shdvlist:
        flg = 0
        for item2 in slist:
            if item1 % item2 == 0:
                flg = 1
                break

        if flg == 0:
            slist.append(item1)

    print(len(slist) + 1)


chker(_a, _b)


Measured memory_bytes: 3372
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		//文字数取得
		int S1 = S.length();
		//S1番目から１文字取り出す。
		String T1 = T.substring(S1-0);
		//Ｔで入力さえた値が、Ｓ+１文字と等しいか
		if(T.equals(S+T1)) {
					System.out.println("Yes");
		}else {
					System.out.println("No");
				}
		sc.close();
		 }
		}

Measured memory_bytes: 39316
#include<functional>
#include<algorithm>
#include<iterator>
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;
long long f[555][66][555];
int a[11],la[66];
long long dp(int n,int m)
{
	f[0][0][a[n]]=1;
	for(int i=0;i<1<<n;++i)
	{
		la[i]=0;
		for(int j=n;j--;)
			if(i&1<<j)la[i]=a[j];
	}
	for(int i=0;i<m;++i)
		for(int j=0;j<1<<n;++j)
			for(int k=0;k<1<<n;++k)if(!(j&k))
				for(int l=0;l<m;++l)if(la[k]-1>=0||l-1>=0)
					f[i+1][j|k][max(la[k]-1,l-1)]+=f[i][j][l];
	long long res=0;
	for(int i=0;i<m;++i)res+=f[m][(1<<n)-1][i];
	return res;
}
long long y[11];
int main()
{
	int n,c;
	int l[11];
	scanf("%d%d",&n,&c);
	for(int i=0;i<n;++i)scanf("%d",&l[i]);
	sort(l,l+n);
	for(int r=1;r<=n;++r)
	{
		for(int i=0;i<n;++i)a[i]=l[i]*r;
		memset(f,0,sizeof(f));
		y[r]=dp(n-1,c*r);
	}
	for(int i=n;i;--i)
	{
		for(int j=1;j<i;++j)
			y[j]=y[j+1]-y[j];
	}
	long long fa=1;
	for(int i=1;i<n;++i)fa=fa*i*c;
	printf("%.1000000lf\n",1.0*y[1]/fa);
	return 0;
}

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define eps 1e-9

const int MOD = 1e9+7;

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

ll POWER[65];
ll power(ll a, ll b) {ll ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
ll inv(ll x) {return power(x,MOD-2);}

void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}
const int MAXN = 205;

int ar[MAXN];
ll f(ll a, ll b) {
	if(a==b) return a;
	ll v = b/a;
	if(b%a==0) v--;	
	return 2LL*v*a+f(min(a,b-v*a),max(a,b-v*a));
}
int main() {
//	freopen("TASK.in","r",stdin);	
//	freopen("TASK.out","w",stdout);
	precompute();
	ll n,x;
	cin>>n>>x;
	cout<<n+f(min(x,n-x),max(x,n-x))<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int N,M,X;
  cin >> N >> M >> X;
  int C[N],A[N][M];
  for(int i=0;i<N;i++){
    cin >> C[i];
    for(int j=0;j<M;j++) cin >> A[i][j];
  }
  
  int NN = 1 << N;
  int MinT = 1000000000;
  
  for(int i=0;i<NN;i++){
    int B[M];
    int Total = 0;
    bool ok = true;
    for(int j=0;j<M;j++){
      B[j]=0;
      for(int k=0;k<N;k++){
        if(i & (1<<k)){
          B[j] += A[k][j];
          Total += C[k];
        }
      }
    }
    for(int j=0;j<M;j++) if(X>B[j]) ok = false;
    Total /= M;
    if(ok) MinT = min(Total,MinT);
  }
  if(MinT == 1000000000) cout << -1 << endl;
  else cout << MinT << endl;
  
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int a, int b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
 
int main() {
  int a, b;
  cin >> a >> b;
  
  if (a < b)
    swap(a,b);
  
  cout << (long)a / (long)gcd(a, b) * (long)b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる
	int x,y,cost;
};
int dp[3001][3001]={};

int main() {

	string s,t;
	cin>>s>>t;

	int ss=s.size(),ts=t.size();

	for(int i=1; i<ss+1; i++){
		for(int j=1; j<ts+1; j++){
			dp[j][i]=dp[j][i-1];
			dp[j][i]=max(dp[j][i],dp[j-1][i]);
			if(s[i-1]==t[j-1])dp[j][i]=max(dp[j][i],dp[j-1][i-1]+1);
		}
	}
	string ans="";
	while(ss>0&&ts>0){
		if(dp[ts][ss]==dp[ts-1][ss])ts--;
		else if(dp[ts][ss]==dp[ts][ss-1])ss--;
		else{
			ans=s[ss-1]+ans;
			ts--;
			ss--;
		}
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 35456
n = int(input())
arr = list(map(int, input().split()))
cnt = 0

for i in range(1, n):
  ai = arr[i]
  ai_ = arr[i-1]
  if ai >= ai_:
    pass
  else:
    cnt += ai_ - ai
    arr[i] = ai_
    
print(cnt)

Measured memory_bytes: 32160
#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;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define ASSERT(expr...) assert((expr))

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
using ll = long long;

constexpr i64 INF = 1010000000000000017LL;

constexpr i64 MOD = 1000000007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

ll mod_pow(ll x, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        return mod_pow(x * x % MOD, n / 2) % MOD;
    } else {
        return x * mod_pow(x, (n - 1)) % MOD;
    }
}

ll mod_pow_r(ll x, ll n) {
    if (x == 0) return 0;
    if (n == 0) return 1;

    ll ret = 1;
    while (n) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n /= 2;
    }
    return ret;
}

ll factorial(ll n) {
    ll ret = 1;
    REP(i, n) {
        ret *= (i + 1);
        ret %= MOD;
    }
    return ret;
}

ll combination(ll n, ll r) {
    if (n < 0 || n < r || r < 0) return 0;
    ll fn = factorial(n);
    ll fr = factorial(r);
    ll fn_r = factorial(n-r);

    ll d = (mod_pow(fr, MOD - 2) * mod_pow(fn_r, MOD - 2)) % MOD;
    ll u = fn % MOD;
    return u * d % MOD;
}

void solve() {
    int a, b; cin >> a >> b;
    if (a == 1) {
        if (b == 2) cout << 3;
        else if (b == 3) cout << 2;
    } else if (a == 2) {
        if (b == 1) cout << 3;
        else if (b == 3) cout << 1;
    } else if (a == 3) {
        if (b == 1) cout << 2;
        else if (b == 2) cout << 1;
    }
}

signed main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>

typedef long long ll;

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

int main()
{
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  std::ios::sync_with_stdio(false);

  ll X;
  std::cin >> X;

  ll ans = 0LL;
  ll money = 100;
  for (ll i = 0; i < 100000; i++) {
    if (money >= X) {ans = i; break;}
    money *= 1.01;
  }

  print(ans);
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k, s, t;
    cin >> n >> k >> s >> t;
    vector<int> a;
    for (int i = 0; i < n; i++) {
        int b;
        cin >> b;
        if ((b & s) == s && (b | t) == t) {
            a.emplace_back(b);
        }
    }
    if ((t & s) != s) {
        cout << 0 << '\n';
        return 0;
    }
    debug(a);
    ll ans = 0;
    n = a.size();
    vector<vector<ll>> C(n + 1, vector<ll>(n + 1));
    for (int i = 0; i <= n; i++) {
        C[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
        }
    }
    vector<ll> w(n + 1);
    for (int i = 0; i <= n; i++) {
        for (int j = 1; j <= min(k, i); j++) {
            w[i] += C[i][j];
        }
    }
    for (int i = 0; i < (1 << 18); i++) {
        if ((s & i) != s || (t | i) != t) {
            continue;
        }
        ll sgn = 1;
        if (__builtin_popcount(i) % 2 == 1) {
            sgn = -1;
        }
        vector<int> b(n);
        for (int j = 0; j < n; j++) {
            b[j] = a[j] & i;
        }
        sort(b.begin(), b.end());
        int j = 0;
        while (j < n) {
            int l = j;
            while (l + 1 < n && b[l] == b[l + 1]) {
                l++;
            }
            ans += sgn * w[l - j + 1];
            j = l + 1;
        } /*
        for (int j = 0; j < n; j++) {
            int l = j;
            if (j + 1 < n && b[j] == b[j + 1]) {
                j++;
            }
            ans += sgn * w[j - l + 1];
        }*/
    }
    cout << abs(ans) << '\n';
    return 0;
}


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

int main(){
  long k;  cin >> k;
  if(k%2==0 || k%5==0){
    cout << "-1" << endl;
    return 0;
  }
  
  long sevens = 7, ans = 1;
  while(sevens % k){
    sevens = (sevens * 10 + 7) % k;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int INF = 10000000000;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    for (auto& x : h) {
        cin >> x;
    }
    vector<int> dp(N, INF);
    dp[0] = 0;
    for (int i = 1; i < N; ++i) {
        for (int j = 1; j < min(K+1, i+1); ++j) {
            dp[i] = min(dp[i], dp[i-j] + abs(h[i-j] - h[i]));
        }
    }
    cout << dp[N - 1] << endl;

    return 0;
}

Measured memory_bytes: 1152
//#define LOCAL
#include<iostream>
#include<cstdio>
#include<algorithm>
const int maxn = 100000;
using namespace std;

int Partition(int *A,int p,int r)
{
	int i = p - 1;
	int x = A[r];
	for(int j = p;j < r;j++){
		if(A[j] <= x){
			i++;
			swap(A[i],A[j]);
		}
	}
	//A[i+1] = x;
	swap(A[i+1],A[r]);
	return i+1;
}
int main()
{
	//#ifdef LOCAL
	//freopen("partition.txt","r",stdin);
	//#endif
	int num;
	int A[maxn];
	cin >> num;
	for(int i = 0;i < num;i++){
		scanf("%d",&A[i]);
	}
	int part = Partition(A,0,num - 1);
	for(int i = 0;i < num;i++){
		if(i > 0){
			printf(" ");
		}
		if(i == part){
			printf("[%d]",A[i]);
			continue;
		}
		printf("%d",A[i]);
	}
	printf("\n");
	return 0;
 } 


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,j,A[500005],t;
string s;  
int main() {
           cin>>s;
           for(long long i=0;i<s.size();i++) {
                      if(s[i]=='A') a=1;
                      else b=1;
           }
           if(a==1 && b==1) cout<<"Yes";
           else cout<<"No";
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);

        System.out.println(Math.abs(a[n-1]-a[0]));
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>

int main(){
	int N;
	std::vector<int> hen;	
	int cnt=0;
	std::cin>>N;
	for(int i=0;i<N;++i){
		int temp;
		std::cin>>temp;
		hen.push_back(temp);
		cnt += temp;
	}
	int max = *std::max_element(hen.begin(),hen.end());
	if(max < cnt - max){
		std::cout<<"Yes"<<std::endl;
	}else{
		std::cout<<"No"<<std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int w,a,b;
    scanf("%d %d %d",&w,&a,&b);
  if(a+w<b){
  	 printf("%d",b-(a+w));
  }
  else if(a+w>=b&&a<=b){
    printf("%d",0);
  }
  else{
  	printf("%d",a-(b+w));
  }
  return 0;
}

Measured memory_bytes: 128