akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize "O3"
#pragma GCC optimize "unroll-loops"
#pragma GCC target "sse,sse2,sse3,sse4,avx,abm,mmx,popcnt,tune=native"
#include<algorithm>
#include<cmath>
#include<cstdio>
typedef long double llf;
const int MN=1e5+4;
const llf INF=1e100,EPS=1e-12;
int N;
llf ans=INF;
struct pnt {
    llf x, y;
    llf ox,oy;
    char c;
}pnts[MN];
static inline void mov(pnt &p,llf dt) {
    switch(p.c) {
        case 'R':
            p.x=p.ox+dt;
            p.y=p.oy;
            break;
        case 'L':
            p.x=p.ox-dt;
            p.y=p.oy;
            break;
        case 'U':
            p.x=p.ox;
            p.y=p.oy+dt;
            break;
        case 'D':
            p.x=p.ox;
            p.y=p.oy-dt;
            break;
    }
}
static inline llf bb() {
    llf mxx=-INF,mxy=-INF,mnx=INF,mny=INF;
    for(int i=0;i<N;++i) {
        mxx=std::max(mxx,pnts[i].x);
        mnx=std::min(mnx,pnts[i].x);
        mxy=std::max(mxy,pnts[i].y);
        mny=std::min(mny,pnts[i].y);
    }
    return (mxx-mnx)*(mxy-mny);
}
int main() {
    scanf("%d",&N);
    for(int i=0;i<N;++i) {
        scanf("%Lf %Lf %c",&pnts[i].ox,&pnts[i].oy,&pnts[i].c);
    }
    // do ternary search
    llf lo=0,hi=1e9,mi1,mi2;
    for(int i=0;i<500;++i) {
        mi1=(2*lo+hi)/3;
        mi2=(lo+2*hi)/3;
        llf b1,b2;
        for(int i=0;i<N;++i)
            mov(pnts[i],mi1);
        b1=bb();
        for(int i=0;i<N;++i)
            mov(pnts[i],mi2);
        b2=bb();
        if(b1<b2) hi=mi2;
        else lo=mi1;
        ans=std::min(std::min(b1,b2),ans);
    }
    printf("%.9Lf\n",ans);
}


Measured memory_bytes: 8064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
          string line = Console.ReadLine();
          if(line[2] == line[3] && line[4] == line[5])
          {
            Console.WriteLine("Yes");
          }
          else
          {
          	Console.WriteLine("No");
          }
        }
    }
}


Measured memory_bytes: 13140
def gcd(a, b):
    if a < b:
        a, b = b, a
    c = 1
    while c != 0:
        c = a % b
        a = b
        b = c
    return a


numbers = [[] for i in range(10**6 + 1)]
flag = [True for i in range(10**6 + 1)]
for i in range(2, 10**6 + 1):
    if flag[i]:
        for j in range(2, 10**6 // i + 1):
            if i * j > 10**6:
                break
            flag[i * j] = False
            numbers[i * j].append(i)
N = int(input())
alist = list(map(int, input().split()))
adict = {}
flag = False
for a in alist:
    if a == 1:
        continue
    temp = numbers[a]
    if temp == []:
        temp = [a]
    for i in temp:
        if i not in adict:
            adict[i] = 0
        else:
            flag = True
            break
    if flag:
        break

if not flag:
    print("pairwise coprime")
    exit(0)

temp = gcd(alist[0], alist[1])
for a in alist[2:]:
    temp = gcd(temp, a)
    if temp == 1:
        print("setwise coprime")
        exit(0)

print("not coprime")

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

int main() {
    string s;
    cin >> s;
    int s_count = 0;
    int e_count = 0;
    int flag = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') {
            if (flag == 0) {
                s_count = i;
                flag = 1;
            }
        } else if (s[i] == 'Z') {
            if (flag == 1) e_count = i;
        }
    }
    cout << e_count - s_count + 1 << endl;
}

Measured memory_bytes: 640
from itertools import accumulate
n = int(input())
s = input()

l = [0] * n
for i, v in enumerate(s):
    if v == "W":
        l[i] = 1
m = [0] * n
for j, w in enumerate(s):
    if w == "E":
        m[j] = 1

l = list(accumulate(l))
m = list(accumulate(m))

ans = m[-1]
for k in range(1, n):
    ans = min(l[k-1] + m[-1] - m[k], ans)

print(ans)

Measured memory_bytes: 91736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin,(x).end()
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return b/gcd(a,b)*a;}

int main()
{
    ll n, k;
    cin >> n >> k;
    cout<<min(n%k,abs(n%k-k))<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.LongStream;

/**
 * https://atcoder.jp/contests/abc127/submissions/6227637 を参考に作成
 */
public class Main {

	private static final long MOD = 1_000_000_007;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), m = scanner.nextInt(), k = scanner.nextInt();
			long xSum = n * m % MOD * (n - 1) % MOD * (m % MOD * (n + 1) % MOD + (m - 1) % MOD * (m + 1) % MOD) % MOD
					* powMod(6, MOD - 2) % MOD;
			long ySum = n * m % MOD * (m - 1) % MOD * (m + 1) % MOD * powMod(6, MOD - 2) % MOD;
			System.out.println((xSum + ySum + MOD) % MOD * combinationMod(n * m - 2, k - 2) % MOD);
		}
	}

	/**
	 * n_C_m mod MOD を計算する
	 * 
	 * @param n
	 * @param m
	 * @return n_C_m mod MOD
	 */
	private static long combinationMod(long n, int m) {
		long min = Math.min(m, n - m), max = Math.max(m, n - m);
		long factorialMin = LongStream.rangeClosed(1, min).reduce(1L, (result, next) -> result = result * next % MOD);
		long factorialMax = LongStream.rangeClosed(min + 1, max).reduce(factorialMin,
				(result, next) -> result = result * next % MOD);
		long factorialN = LongStream.rangeClosed(max + 1, n).reduce(factorialMax,
				(result, next) -> result = result * next % MOD);
		return factorialN * powMod(factorialMin, MOD - 2) % MOD * powMod(factorialMax, MOD - 2) % MOD;
	}

	/**
	 * n^m mod MOD を計算する
	 * 
	 * @param n
	 * @param m
	 * @return n^m mod MOD
	 */
	private static long powMod(long n, long m) {
		long result = 1L;
		while (m > 0) {
			if (1 == (1 & m)) {
				result = result * n % MOD;
			}
			n = n * n % MOD;
			m >>= 1;
		}
		return result;
	}
}


Measured memory_bytes: 36008
// ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
//#define int long long


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

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

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;

bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
	ll N = 10000010;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (ll i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (ll j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (int ll i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu.pb(i);
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}


bool prime(ll n) {
	if (n == 1)return false;
	if (n == 2)return true;
	for (int i = 2; i < (int)sqrt(n) + 1; i++) {
		if (n%i == 0)return false;
	}
	return true;
}

int N, K;
vector<int> D;
bool judge(int n, int x, vector<int>D) {
	if (x < n)return false;
	while (x > 0) {
		int c = x % 10;
		x /= 10;
		for (auto d : D) {
			if (c == d)return false;
		}
	}
	return true;
}

int main() {
	cin >> N >> K;
	REP(i, K) {
		int d; cin >> d;
		D.pb(d);
	}
	FOR(i, 1, 10000001) {
		if (judge(N, i, D)) {
			p(i);
			return 0;
		}
	}
}



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

struct dice{
  int u;
  int s;
  int e;
  int w;
  int n;
  int d;
};

dice move(dice, char);
bool judge(dice, dice);


int main(){
  dice dice1, dice2;
  cin>>dice1.u>>dice1.s>>dice1.e>>dice1.w>>dice1.n>>dice1.d;
  cin>>dice2.u>>dice2.s>>dice2.e>>dice2.w>>dice2.n>>dice2.d;

  dice temp = dice1;
  bool solved = false;
  for(int j=0; j<4; j++){
     if(judge(temp,dice2)){solved = true; break;}
    temp = move(temp,'E');
    for(int k=0; k<4; k++){
      temp = move(temp,'N');
      if(judge(temp,dice2)){solved = true; break;}
      for(int l=0; l<4; l++){
	temp = move(temp,'R');
	if(judge(temp,dice2)){solved = true; break;}
      }
      if(solved) break;
    }
    if(solved) break;
  }
  if(solved) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}

bool judge(dice dice1, dice dice2){
  //cout<<dice1.u<<dice1.s<<dice1.e<<dice1.w<<dice1.n<<dice1.d<<endl;
  if(dice1.u == dice2.u &&dice1.s == dice2.s &&dice1.e == dice2.e &&dice1.w == dice2.w &&dice1.n == dice2.n &&dice1.d == dice2.d){
    return true;
  }
  return false;
}

dice move(dice dice1, char c){
    dice temp = dice1;
    if(c=='E'){     
      dice1.d = temp.e;
      dice1.w = temp.d;
      dice1.u = temp.w;
      dice1.e = temp.u;
    }else if(c=='N'){
      dice1.n = temp.u;
      dice1.u = temp.s;
      dice1.s = temp.d;
      dice1.d = temp.n;
    }else if(c=='S'){
      dice1.n = temp.d;
      dice1.u = temp.n;
      dice1.s = temp.u;
      dice1.d = temp.s;
    }else if(c=='W'){
      dice1.u = temp.e;
      dice1.w = temp.u;
      dice1.d = temp.w;
      dice1.e = temp.d;
    }else if(c=='R'){
      dice1.s = temp.w;
      dice1.w = temp.n;
      dice1.n = temp.e;
      dice1.e = temp.s;
    }
    return dice1;
}




Measured memory_bytes: 3112
MOD = 10 ** 9 + 7
n, k = map(int, input().split())

def calc(a):
    smallest = a * (a-1) // 2
    largest = smallest + a * (n-a+1)
    return largest - smallest + 1


ans = 0
for a in range(k, n+2):
    ans += calc(a)
    ans %= MOD

print(ans)

Measured memory_bytes: 9220
#include<iostream>
#include<vector>
#include<list>
#include<queue>
using namespace std;
const int MAX = 10005;
bool status[MAX]={false};
int indeg[MAX]={0};
list<int> result;
vector<int> mark[MAX];
int n;
inline void setdata(){
	int m,s,t;
	cin>>n>>m;
	while(m--){
		cin>>s>>t;
		mark[s].push_back(t);
		++indeg[t];
	}
}
inline void display(){
	for(list<int>::iterator it = result.begin();it!=result.end();++it)
		cout<<*it<<endl;
}
void bfs(int v){
	queue<int> q;
	status[v]=true;
	q.push(v);
	while(!q.empty()){
		int now = q.front();
		q.pop();
		result.push_back(now);
		for(int i =0;i<mark[now].size();++i){
			indeg[mark[now][i]]--;
			if(!indeg[mark[now][i]]&&!status[mark[now][i]]){
				status[mark[now][i]]=true;
				q.push(mark[now][i]);
			}
		}
	}
}
void dfs(int v){
	status[v] = true;
	result.push_back(v);
	for(int i =0;i<mark[v].size();++i){
		indeg[mark[v][i]]--;
		if(!indeg[mark[v][i]]&&!status[mark[v][i]]) 
			dfs(mark[v][i]);
	}
}
void slove(){
	setdata();
	for(int i = 0;i<n;++i)
		if(!indeg[i]&&!status[i])
			dfs(i);
	display();
}
int main(){
	slove();
	return 0;
}
/*
mark v
push v
for i ---v-size 
 --i-indeg
	if(allow) dfs [i]
*/


Measured memory_bytes: 4084
#include <stdio.h>

int main(void){
	char w[101]="";
	int alpha[26]={0};
	scanf("%s",w);
	int i;
	i=0;
	while(w[i] != '\0'){
		alpha[w[i]-97]++;
		i++;
	}
	for(i=0;i<26;i++){
		if(alpha[i] % 2 == 0){
			continue;
		}else{
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

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

const int N = 280005;
const int mod1 = 1e9 + 123;
const int mod2 = 1e9 + 7;

int pw1[N + N], pw2[N + N];
int e[N];
int h1[N], h2[N];
int n;
string s;

int inverse(int a, int m) {
	int b = m - 2;
	int ret = 1;
	while(b) {
		if (b & 1) ret = 1LL * ret * a % m; a = 1LL * a * a % m;
		b >>= 1;
	}
	return ret;
}

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

	cin >> n >> s;
	s = ' ' + s;

	pw1[0] = pw2[0] = 1;
	for (int i = 1; i < N + N; ++i) {
		pw1[i] = 1LL * pw1[i - 1] * N % mod1;
		pw2[i] = 1LL * pw2[i - 1] * N % mod2;
	}

	e[0] = N;
	for (int i = 1; i <= n; ++i) {
		h1[i] = h1[i - 1];
		h2[i] = h2[i - 1];
		e[i] = e[i - 1];
		if (s[i] == '<' || s[i] == '>') {
			e[i] += (s[i] == '>' ? +1 : -1);
		}
		else {
			h1[i] = (h1[i] + (s[i] == '+' ? +1 : -1) * pw1[e[i]]) % mod1;
			if (h1[i] < 0) h1[i] += mod1;
			h2[i] = (h2[i] + (s[i] == '+' ? +1 : -1) * pw2[e[i]]) % mod2;
			if (h2[i] < 0) h2[i] += mod2;
		}
	}

	long long res = 0;
	int t1 = 1LL * h1[n] * inverse(pw1[N], mod1) % mod1;
	int t2 = 1LL * h2[n] * inverse(pw2[N], mod2) % mod2;
	map < pair<int, int>, int > mp;
	mp[{1LL * t1 * pw1[N] % mod1, 1LL * t2 * pw2[N] % mod2}]++;

	for (int i = 1; i <= n; ++i) {
		res += mp[{h1[i], h2[i]}];
		int k1 = (1LL * t1 * pw1[e[i]] + h1[i]) % mod1;
		int k2 = (1LL * t2 * pw2[e[i]] + h2[i]) % mod2;
		mp[{k1, k2}]++;
	}

	cout << res << endl;
}

Measured memory_bytes: 39324
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

class bipartite_matching {
public:
    int n;
    std::vector<std::vector<int>> g;
    std::vector<int> match;

    bipartite_matching(int n_) : n(n_), g(n_), match(n_), used(n_) {}

    void add_edge(int u, int v) {
        g[u].push_back(v);
        g[v].push_back(u);
    }

    int maximum_matching(void) {
        int res = 0;
        fill(begin(match), end(match), -1);
        for (int v = 0; v < n; ++v) {
            if (match[v] == -1) {
                fill(begin(used), end(used), false);
                if (dfs(v)) res++;
            }
        }
        return res;
    }

private:
    std::vector<int> used;
    bool dfs(int v) {
        used[v] = true;
        for (int u : g[v]) {
            int w = match[u];
            if (w == -1 || (!used[w] && dfs(w))) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }
};


int main () {
    int n;
    while (cin >> n) {
        int a[2][101];
        rep(i, 2) rep(j, n) cin >> a[i][j];
        int ans = 0;
        rep(i, n) {
            int s = 0;
            rep(j, n) {
                if (j <= i) s += a[0][j];
                if (j >= i) s += a[1][j];
            }
            ans = max(ans, s);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
x, y, z, K = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
B = sorted(map(int, input().split()), reverse=True)
C = sorted(map(int, input().split()), reverse=True)
ans = []
for i in range(x):
    for j in range(y):
        for k in range(z):
            if (i+1)*(j+1)*(k+1) <= K:
                ans.append(A[i]+B[j]+C[k])
                continue
            break
ans.sort(reverse=True)

for i in range(K):
    print(ans[i])


Measured memory_bytes: 8708
N=int(input())
T=[0]+[int(x) for x in str(input()).split()]+[0]
V=[0]+[int(x) for x in str(input()).split()]+[0]
 
time=0
t=[0]
for i in T:
  time+=i
  t.append(time)
ans=0
 
for j in range(0,2*time):
  m1=1000000000
  m2=1000000000
  t1=j/2
  t2=(j+1)/2
  for i in range(N+2):
    if t1<=t[i]:
      m1=min(m1,V[i]+(t[i]-t1))
    elif t1<=t[i+1]:
      m1=min(m1,V[i])
    else:
      m1=min(m1,V[i]+t1-t[i+1])
 
    if t2<=t[i]:
      m2=min(m2,V[i]+(t[i]-t2))
    elif t2<=t[i+1]:
      m2=min(m2,V[i])
    else:
      m2=min(m2,V[i]+t2-t[i+1])
    
  #print(1,m1,m2)
  ans+=0.25*(m1+m2)
print(ans)

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

int main(){
	int n;
	cin >> n;
	if(n%4 == 0) {
		cout << "Yes" << endl;
		return 0;
	}
	int max = n / 4;
	for(int i =0; i<=max; i++){
		if((n - 4*i)%7==0) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int i, j;
    int h;
    int d[100];
    int res = 0;

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

    for(i = 0; i < h; i++) {
        for(j = i + 1; j < h; j++) res += d[i] * d[j];
    }
    printf("%d\n", res);

    return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        int[][] points = new int[n][3];

        for(int i = 0; i < n; i++) {
            String[] line = scanner.nextLine().split(" ");
            points[i][0] = Integer.parseInt(line[0]);
            points[i][1] = Integer.parseInt(line[1]);
            points[i][2] = Integer.parseInt(line[2]);
        }

        int maxScore = 0;
        for(int i = 0; i < 3; i++) {
            maxScore = Math.max(maxScore, points[0][i]);
        }

        for(int r = 1; r < n; r++) {
            points[r][0] += Math.max(points[r-1][1], points[r-1][2]);
            points[r][1] += Math.max(points[r-1][0], points[r-1][2]);
            points[r][2] += Math.max(points[r-1][0], points[r-1][1]);
        }

        for(int i = 0; i < 3; i++) {
            maxScore = Math.max(maxScore, points[n - 1][i]);
        }
        System.out.println(maxScore);
    }
}


Measured memory_bytes: 65444
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-9;
const double INF = 1e9;




int main(){
	string str;
	string ap="apple",pe="peach";
	vector<string>res;
	while(cin>>str){
		
		int pos=0;
		bool flag=false;
		while(str.find(ap,pos)!=string::npos){
			pos=str.find(ap,pos);
			REP(i,5)str[pos+i]=pe[i];
			pos++;
			flag=true;
		}
		pos=0;
		if(!flag)while(str.find(pe,pos)!=string::npos){
			pos=str.find(pe,pos);
			REP(i,5)str[pos+i]=ap[i];
			pos++;
		}
		res.PB(str);
	}
	REP(i,SZ(res)){
		cout<<res[i];
		if(i!=SZ(res)-1)cout<<" ";
	}
	cout<<endl;
	return 0;
}
/*

*/

Measured memory_bytes: 1200
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val arr: Array[Int] = Array.fill(n)(sc.nextInt())

    val (sortedArr, gList, m, cnt) = shellSort(arr)
    println(m)
    println(gList.toList.take(m).mkString(" "))
    println(cnt)
    sortedArr.foreach(println)
  }

  def insertionSort(arr: Array[Int], g: Int): (Array[Int], Int) = {
    val ret = arr.clone()
    var cnt = 0

    for((v, i) <- ret.zipWithIndex) {
      var j = i - g
      while(j >= 0 && ret(j) > v) {
        ret(j + g) = ret(j)
        cnt += 1
        j -= g
      }
      ret(j + g) = v
    }

    return (ret, cnt)
  }

  def shellSort(arr: Array[Int]): (Array[Int], Array[Int], Int, Int) = {
    var ret: Array[Int] = arr.clone()
    val gList = Array.fill(ret.length)(-1)
    var cnt = 0

    var g = arr.length
    var m = 0
    while(g > 0) {
      gList(m) = g
      var (sortedArr, c) = insertionSort(ret, g)
      ret = sortedArr
      g = g / 2
      m += 1
      cnt += c
    }

    return (ret, gList, m, cnt)
  }
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int l[51];
  for (int i = 1; i <= N; i++) cin >> l[i];

  int ans = 0;
  for (int i = 1; i <= K; i++) {
    int max = 0;
    for (int j = 1; j <= N; j++) if (l[j] > max) max = l[j];
    for (int j = 1; j <= N; j++) {
      if (l[j] == max) {
        l[j] = 0;
        break;
      }
    }

    ans += max;
  }

  cout << ans << endl;

  return 0;
}

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

typedef long long int ll;

int main(){

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

    int n,k;
    cin>>n>>k;

    vector<bool>dp(k+1,false);

    vector<int>v(n);
    for(int &x:v)cin>>x,dp[x] = true;

    for(int i=1;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i>=v[j])
            if(!dp[i-v[j]])dp[i] = true;
        }
    }

    if(dp[k])cout<<"First";
    else cout<<"Second";


    return 0;

}

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

int main(void){
    int N;
    cin >> N;
    vector<pair<int,int>> vec(N);
    for(int i=0;i<N;i++){
        int x,l;
        cin >> x >> l;
        int left = x-l, right = x+l;
        vec[i] = make_pair(right,left);
    }
    sort(vec.begin(),vec.end());

    
    int count=1;
    int i=0;
    int j=i+1;
        while(j<vec.size()){
            while(vec[i].first>vec[j].second && j<vec.size()) j++;
            if(j>=vec.size()) break;
            count++;
            i = j;
            j++;
        }
     cout << count << endl;
}

Measured memory_bytes: 1024
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
RV = [0] * N
for i in range(N):
    RV[i] = V[i] - C[i]
RV.sort(reverse=True)
res = 0
for v in RV:
    if v <= 0:
        break
    res += v
print(res)


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

int main(){
  string S;
  cin >> S;
  
  if(S.at(2) == S.at(3) && S.at(4) == S.at(5)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    string a, b, c;
    cin >> a >> b >> c;
    cout << "A" << b[0] << "C" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string.h>
#include<limits.h>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define P pair<int,int>
#define x first
#define y second

using namespace std;
const int maxn = 25;
char str[maxn][maxn];
int num[maxn][maxn];
int dir[][2] = {{1,0},{-1,0},{0,1},{0,-1}};
int n,m,ans,res;

queue<P>Q;

int main(void) {
    int BFS(int start_x,int start_y);
    scanf("%d%d",&n,&m);
    for(int i = 1; i <= n; i ++) {
        for(int j = 0; j <= m; j ++) {
            scanf("%c",&str[i][j]);
        }
    }
    ans = 0,res = 0;
    for(int i = 1; i <= n; i ++) {
        for(int j = 1; j <= m; j ++ ) {
            if(str[i][j] == '#') continue;
            res = BFS(i,j);
            ans = max(ans,res);
        }
    }
    cout << ans << endl;
    return 0;
}

bool Check(int x,int y) {
    if(x < 1 || y < 1 || x > n || y > m) return false;
    if(str[x][y] == '#' || num[x][y]) return false;
    if(str[x][y] == '.') return true;
}

int BFS(int start_x,int start_y) {
    P a,b;
    int count = 0;
    memset(num,0,sizeof(num));
    while(!Q.empty()) Q.pop();
    a.x = start_x,a.y = start_y;
    Q.push(a);
    while(!Q.empty()) {
        a = Q.front();
        Q.pop();
        count = max(count,num[a.x][a.y]);
        int v = num[a.x][a.y];
        for(int i = 0; i < 4; i ++) {
            b.x = a.x + dir[i][0];
            b.y = a.y + dir[i][1];
            if(!Check(b.x,b.y)) continue;
            if(b.x != start_x || b.y != start_y) {
                num[b.x][b.y] = v + 1;
                Q.push(b);
            }
        }
    }
    return count;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;

class Dice {
public:
    Dice(int pips[]) {
        for (int i = 0; i < 6; i++) {
            this->pips[i] = pips[i];
        }
    }

    int getTopPip() {
        return pips[0];
    }

    void roll(char direction) {
        memcpy(tmpPips, pips, sizeof(int) * 6);
        if (direction == 'E') {
            pips[0] = tmpPips[3];
            pips[2] = tmpPips[0];
            pips[3] = tmpPips[5];
            pips[5] = tmpPips[2];
        } else if (direction == 'N') {
            pips[0] = tmpPips[1];
            pips[1] = tmpPips[5];
            pips[4] = tmpPips[0];
            pips[5] = tmpPips[4];
        } else if (direction == 'W') {
            pips[0] = tmpPips[2];
            pips[2] = tmpPips[5];
            pips[3] = tmpPips[0];
            pips[5] = tmpPips[3];
        } else {
            pips[0] = tmpPips[4];
            pips[1] = tmpPips[0];
            pips[4] = tmpPips[5];
            pips[5] = tmpPips[1];
        }
    }

    int getRightPip(int top, int front) {
        for (int i = 0; i < 6; i++) {
            for (int j = 0; j < 4; j++) {
                if (pips[check[i][j]] == top &&
                    pips[check[i][j + 1]] == front) {
                        return pips[i];
                    }
            }
        }
    }

private:
    int pips[6];
    int tmpPips[6];
    // top, frontの順番でラベルがマッチした時、外側のindexがrightのラベル
    int check[6][5] = {
        {3, 1, 2, 4, 3}, {5, 2, 0, 3, 5},
        {0, 1, 5, 4, 0}, {4, 5, 1, 0, 4},
        {3, 0, 2, 5, 3}, {4, 2, 1, 3, 4}};
};

int main() {
    int pips[6], num;
    string directions;

    for (int i = 0; i < 6; i++) {
        cin >> pips[i];
    }
    cin >> num;

    Dice dice(pips);

    for (int i = 0; i < num; i++) {
        int top, front;
        cin >> top >> front;
        cout << dice.getRightPip(top, front) << "\n";
    }

    return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<cstdio>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
    int X=0,w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
    return w?-X:X;
}
inline void write(int x)
{
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
}
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
string a;
cin>>a;
int n=a.length();
if(n%2==0) n--;
for(int i=0;i<n;i=i+2)
{
	cout<<a[i];
}
getchar();getchar();
	return 0;
}


Measured memory_bytes: 512
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#ifdef LOCAL
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

ll H;
int N;
ll sum = 0;
signed main(){
	cin >> H >> N;
	rep(i, N){
		ll A;
		cin >> A;
		sum += A;
	}
	if(sum >= H) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
# define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdbool.h>

# define STACK_MAX 200 /* ???????????????????????§(100) + ?????????????????§(99) + 1 */

void push(value);
int pop();
int main(void);
bool isNum(char c);	
char* getOperand();

static	int st_stack_index = 0;
static	int st_stack[STACK_MAX];
static 	char st_Operand[STACK_MAX];

int main(void) {

	int value = 0;

	char* ope;
	int ope1;
	int ope2;

	while ((ope = getOperand()) != NULL) {
		if (*ope == ' ') {
			break;
		}
		
		/* ?????????????????°?????? */
		if (isNum(*ope)) {
			/*printf("%s ", ope);*/
			push(atoi(ope));
		}
		else { /* ??°?????§???????????°????????? */
			ope1 = pop();
			ope2 = pop();
			/*printf("%s ", ope);*/

			switch (*ope) {
			case '+':
			{
				value = ope1 + ope2;
				push(value);
			}
			break;
			case '*':
			{
				value = ope1 * ope2;
				push(value);
			}
			break;
			case '-':
			{
				value = ope2 - ope1;
				push(value);
			}
			break;
			default:
			{
				return -1;
			}
			}
			/* ?¨????????????????????????????????´? */
			/*push(value);*/
		}
	}

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

	return 0;
}

bool isNum(char c)
{
	if (isdigit(c) != 0) {
		return true;
	}
	else {
		return false;
	}
}

/* ?¨??????\???????????????????????????????????????????????§?????????????????? */
char* getOperand()
{
#if 0
	static char* question[] = { "1", "2", "+", "3", "4", "-", "*", NULL };
	//static char* question[] = { "10","5", "+", "3", "*" };
	static int question_index = 0;

	return question[question_index++];
#else
	
#endif
	while(scanf("%s", st_Operand) != EOF) {		
		return st_Operand;
	}
	return NULL;
}

void push(value) {

	st_stack_index++;
	st_stack[st_stack_index] = value;

}

int pop() {

	int p;

	p = st_stack[st_stack_index];

	st_stack_index--;

	return p;
}

Measured memory_bytes: 548
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

int main(){
    int t;
    while(scanf("%d",&t)!=EOF){
        int a[6] = {2,4,8,16,32,64};
        int flag = 0;
        for(int i = 5;i>=0;i--){
            if(t >= a[i]){
                printf("%d\n",a[i]);
                flag = 1;
                break;
            }
        }
        if(flag == 0)puts("1");

    }
}


Measured memory_bytes: 128
sub min{$_[$_[1]<$_[0]]}

($N,$M)=glob<>;
for$i(1..$N){
	$_[$i][$_]=1e9for 1..$N;
	$_[$i][$i]=0;
}
($a,$b,$c)=glob,$_[$a][$b]=$_[$b][$a]=$c for@M=<>;

for$m(1..$N){
	for$x(1..$N){
		for$y(1..$N){
			$_[$x][$y]=min($_[$x][$y],$_[$x][$m]+$_[$m][$y]);
		}
	}
}
($a,$b,$c)=glob,$%+=$_[$a][$b]<$c for@M;

print$%,$/


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int64_t> l(87);
  l[0]=2;
  l[1]=1;
  for (int i=2;i<=n;i++){
    l[i]=l[i-1]+l[i-2];
  }
  cout << l[n] << endl;
}

Measured memory_bytes: 256
S[1<<20],Q[1<<20],q;
c,b,x,i,n,u;
main(){
	for(;c=getchar(),c!='0';){
		if(c!='\n'){
			b=b<<2|(c%3+1);//eÌßð2bit(1,2,3)Å\»
			u=u<<2|1;//eÌßª1Ìp^[
		}else{
			S[b]=0;
			q=b;
			for(;b%u;){//èØêêÎSÌßª¯¶F(b!=0)AÜ½ÍL[ªó(b==0)
				x=b^(b>>2);//×ÌÌßÆÌxor
				for(i=0;x>3;i++,x>>=2){//Å¶Ì2bitÍxor³êÈ©Á½S~ÈÌÅ©È¢
					if(x&3){//×ÌÌßÆFªÙÈé
						c=(1^2^3)^(x&3);//Ç¿çÆàÙÈéF
						n=b&~(15<<i*2)^((c|c<<2)<<i*2);//Ï»
						if(!Q[n]){
							S[n]=S[b]+1;
							q=Q[q]=n;
						}
					}
				}
				b=Q[b];
			}
			if(b)
				printf("%d\n",S[b]);
			else
				puts("NA");
			b=u=0;
			memset(Q,0,sizeof(Q));
		}
	}
	exit(0);
}

Measured memory_bytes: 0
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=1e6+5,M=2e6+5,MOD=1e9+7,OO=1e9;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();
	
	int n;

	scanf("%d",&n);

	ll ans = 0;

	for(int i=0,x;i<n;i++)scanf("%d",&x),ans+=x-1;
	printf("%lld\n",ans );
}	



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LONGLONGMAX 9223372036854775807
#define LONGLONGMIN -9223372036854775807
#define INTMAX 32767
#define INTMIN -32767
#define ROUNDUP(divisor,dividend) (divisor + (dividend - 1)) / dividend
string s;
int main(){
  cin >> s;
  bool ac=false;
  for (size_t i = 0; i < s.length()-1; i++) {
    if(s[i] == 'A'&&s[i+1] == 'C')ac = true;
  }
  cout << (ac ? "Yes":"No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> S;
  Out((char)(S[0]+1));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
#define uint uint64_t
#ifdef _DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif
using namespace std;

// accumlation
void solve() {
  const int MOD = 1000000007;
  int n;
  cin >> n;

  vector<uint> A(n);
  vector<uint> B(n + 1, 0);

  uint subsum = 0;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    A.at(i) = num;
    subsum += num;
    B.at(i + 1) = subsum;
  }

  uint ans = 0;
  for (int i = 0; i < n; i++) {
    debug(A.at(i), B.at(n), B.at(i + 1));
    ans += A.at(i) * ((B.at(n) - B.at(i + 1)) % MOD);
    ans %= MOD;
  }
  cout << ans << endl;
}

void wrapper() {
  rep(i, 3) {
    cout << "[TEST " << (i + 1) << "]\n";
    solve();
    cout << "\n";
  }
}

int main() {
  fastIO;
#ifdef _DEBUG
  wrapper();
#else
  solve();
#endif
}


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

using namespace std;
const long mod = 1000000007;
typedef long long lint;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(N) for(int i = 0; i < (int)(N); i++)
#define all(x) (x).begin(),(x).end()
#define length(x) ((int)(x).size())
#define prln(s) cout<<s<<endl;

#define str(s) string s;cin>>s;
#define int1(x) int x;cin>>x;
#define int2(x,y) int x,y;cin>>x>>y;

int main() {
  str(s);
  if(s[3]==s[2]&&s[5]==s[4]){
    prln("Yes");
    return 0;
  }
  prln("No");
}


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

int main()
{
    int n,d=0,r=0,i;
    string s;
    cin>>n>>s;
    for(i=0;i<s.size();i++)
    {
        if(s[i]=='(') d++;
        else
        {
            if(d>0)
                d--;
            else
                r++;
        }
    }
    for(i=1;i<=r;i++)
        cout<<"(";
    cout<<s;
    for(i=1;i<=d;i++)
        cout<<")";
    return 0;
}


Measured memory_bytes: 256
#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>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define int long long
#define endl "\n"
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr(a,b,c) for(int a=b; a<c; a++)
#define frr(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define pii pair<int,int>
#define R(a) ll a; cin >> a;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;

#define RA(a, n) ll a[(n) + 1] = {}; fr(i, 1, (n)+1) {cin >> a[i];}
#define RM(a, n, m) int a[n + 1][m + 1] = {}; fr(i, 1, n+1) {fr(j, 1, m+1) cin >> a[i][j];}
#define reset(X) memset(X, 0, sizeof(X))
using vi=vector<int>;
const int inf = 1e18;
const int mod=1e9+7;
unsigned int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
bool isPrime(int n)
{   if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
    return true;
}
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}
int f[200005];
int dp[2010];
ll go(ll x,ll y) {
	assert(x>=0&&y>=0);
	return f[x+y]*modInverse(f[x]*f[y],mod)%mod;
}
signed main()
{
    fastio;
    int ans=0;
    string s;
    cin>>s;
    string t;
    cin>>t;
    fr(i,0,s.size())
    {
        if(s[i]!=t[i])
        {
            ans+=1;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3788
N = int(input())
V_str = input().split()
C_str = input().split()

V = list(int(n) for n in V_str)
C = list(int(n) for n in C_str)

val = []
for i in range(len(V)):
  val.append(V[i] - C[i])

positive = []
for n in val :
  if n > 0:
    positive.append(n)
  else:
    next

ans = 0
for k in positive :
  ans += k
  
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  int ans = 1;
  while(2*ans<=N) {
    ans *= 2;
  }
  cout<<ans<<endl;
}



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

int main() {
  string s,t;
  cin >> s >> t;
  if(s.size()+1==t.size()&&s==t.substr(0,s.size())) {
    cout << "Yes" << endl;
  } else {
  cout << "No" << endl;
  }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;++i)
#define REP1(i,n) for(int i=1;i<=n;++i)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"#%d: %s = ",__LINE__,#__VA_ARGS__),_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
template<typename It> ostream& _printRng(ostream &os,It bg,It ed)
{
    os<<"{";
    for(It it=bg;it!=ed;it++) {
        os<<(it==bg?"":",")<<*it;
    }
    os<<"}";
    return os;
}
template<typename T> ostream &operator << (ostream &os,vector<T> &v){return _printRng(os,v.begin(), v.end());}
template<typename T> void pary(T bg, T ed){_printRng(cerr,bg,ed);cerr<<endl;}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#define pary(...)
#endif

const int MAXN = 302;
const ll MOD = 998244353;

int n, m;
ll tw[MAXN];
bitset<MAXN> rw[MAXN];

bitset<MAXN> basis[MAXN];
int sz;

void inc (bitset<MAXN> vec) {
    for (int i=MAXN-1; i>=0; i--) {
        if (vec[i]) {
            if (basis[i].count() == 0) {
                basis[i] = vec;
                sz++;
                break;
            } else {
                vec ^= basis[i];
            }
        }
    }
}
/*********************GoodLuck***********************/
int main () {
    IOS();

    tw[0] = 1;
    REP1 (i, MAXN-1) {
        tw[i] = tw[i-1] * 2 % MOD;
    }

    cin >> n >> m;
    REP (i, n) {
        REP (j, m) {
            bool d;
            cin >> d;
            rw[i][j] = d;
        }

        inc(rw[i]);
    }

    int free = n - sz;
    ll rcob = tw[n] - tw[free];
    if (rcob < 0) {
        rcob += MOD;
    }

    cout << rcob * tw[m-1] % MOD << endl;
}


Measured memory_bytes: 384
unittest
{
	assert( [ "3", "7", "10" ].parse.expand.solve == 2 );
	assert( [ "14", "12", "112" ].parse.expand.solve == 8 );
	assert( [ "2", "100", "200" ].parse.expand.solve == 2 );
}



import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto h = input.front.to!( long );
	input.popFront;
	auto w = input.front.to!( long );
	input.popFront;
	auto n = input.front.to!( long );
	return tuple( h, w, n );
}

auto solve( long h, long w, long n )
{
	return cast( long ) ceil( n / cast( real ) max( h, w ) );
}


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

using namespace std;

int main()
{
int n,array[100000],i;
long long int fatigue=0,a,b;
scanf("%d %lld %lld",&n,&a,&b);
for(i=0;i<n;++i){
    scanf("%d",&array[i]);
}
for(i=0;i<n-1;++i){
    if((array[i+1]-array[i])*a<b){
        fatigue+=(array[i+1]-array[i])*a;
    }
    else{
        fatigue+=b;
    }
}
printf("%lld",fatigue);

    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;
#define LEN 100005
#define NIL -1

struct Node { int p, l, r;};

Node T[LEN];
int n, D[LEN];

void print(int u)
{
    int i,c;
    cout<< "node " << u << ": ";
    cout<< "parent = " << T[u].p << ", ";
    cout<< "depth = " << D[u] << ", ";

    if( T[u].p == NIL ) cout<<"root, ";
    else if( T[u].l==NIL ) cout << "leaf, ";
    else cout << "internal node, ";
    cout<< "[";
    for( i=0, c=T[u].l; c!=NIL; i++ ,c=T[c].r ) {
        if (i) cout << ", ";
        cout<< c;
    }
    cout << "]" <<endl;
}

//calculate deepth
void  rec(int u, int p)
{
    D[u]=p;
    if(T[u].r!=NIL) rec(T[u].r, p);
    if(T[u].l!=NIL) rec(T[u].l, p+1);
}
int main()
{
    int i,j,d,v,c,l,r;
    cin>>n;
    for(i=0;i<n;i++) T[i].p=T[i].l=T[i].r=NIL;
    for(i=0;i<n;i++){
        cin>>v>>d;
        for(j=0;j<d;j++){
            cin>>c;
            if(j==0) T[v].l=c;
            else T[l].r=c;
            l=c;
            T[c].p=v;
        }
    }
    for(i=0;i<n;i++) if(T[i].p==NIL) r=i;
    rec(r,0);
    for(i=0;i<n;i++) print(i);
    return 0;
}



Measured memory_bytes: 7680
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto T = lreads(N);
    T.reduce!lcm().writeln();
}

T lcm(T)(T a, T b)
{
    return a / gcd(a, b) * b;
}


Measured memory_bytes: 256
import java.util.Scanner

val sc = Scanner(System.`in`)

fun main(args : Array<String>) {
    var n = sc.nextInt()
    var s = sc.next()!!

    var prev = '-'
    val slimes = mutableListOf<Char>()
    s.forEach {
        if (it != prev) {
            slimes.add(it)
        }
        prev = it
    }

    println(slimes.count())
}

Measured memory_bytes: 35228
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<assert.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
int N,x,y,sw,pw3[13]={1},A[531441],B[531441],S[200001];
char T[200001];
char* replace(char* s,const char* before,const char* after)
{
  assert(s!=(char*)NULL);assert(before!=(char*)NULL);assert(after!=(char*)NULL);
  const size_t szb=strlen(before),sza=strlen(after);
  char* pt=s;
  if(szb==0)return s;
  for(;;)
  {
    pt=strstr(pt,before);if(pt==(char*)NULL)break;const char* remain=pt+szb;
    memmove(pt+sza,remain,strlen(remain)+1);
    memcpy(pt,after,sza);
    pt+=sza;
  }
  return s;
}
signed main(void)
{
  x=scanf("%d %s",&N,T);
  replace(T,"SS","");if(T[0]=='\n')return 0;
  rep(i,N)
  {
    rep(j,pw3[i])rep(k,3)B[j+k*pw3[i]]=k;sw=0;
    rep(j,strlen(T))
    {
      if(T[j]=='R')
      {
        y=S[j];
        rep(k,3){x=y+k*pw3[i];if(B[x]+sw==2)S[j]=x;B[x]+=sw+1;B[x]%=3;}
      }
      if(T[j]=='S')sw^=1;
    }
    rep(j,pw3[i]){y=A[j];rep(k,3){x=j+k*pw3[i];A[x]=y+(sw?3-B[x]:B[x])%3*pw3[i];}}
    pw3[i+1]=3*pw3[i];
  }
  rep(i,pw3[N])printf("%d%c",A[i],i+1==pw3[N]?'\n':' ');
}

Measured memory_bytes: 8968
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		int q = scanInt();
		for (int qq = 0; qq < q; qq++) {
			long a = scanInt();
			long b = scanInt();
			long c = scanInt() - 1;
			long d = scanInt();
			long x = (max(a, b) - 1) / (min(a, b) + 1) + 1;
			long la, lb;
			if (a >= x * b) {
				la = a + b;
				lb = 0;
			} else if (b >= x * a) {
				la = 0;
				lb = a + b;
			} else {
				la = (x * a - b) / (x - 1);
				lb = (x * b - a) / (x - 1);
			}
			boolean cB = a - la + la / (x + 1) - lb / (x + 1) == 0;
			for (long i = c; i < d; i++) {
				boolean isB = i < la ? i % (x + 1) == x :
					i >= a + b - lb ? (a + b - i - 1) % (x + 1) != x :
					cB;
				out.print(isB ? 'B' : 'A');
			}
			out.println();
		}
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 24148
n = int(input())
d = [10*[0] for _ in range(10)]
ans = 0
for i in range(1,n+1):
    s = str(i)
    if s[0] == "0" or s[-1] == "0":continue
    d[int(s[0])][int(s[-1])] += 1
for i in range(1,10):
    for j in range(1,10):
        ans += d[i][j] * d[j][i]
print(ans)

Measured memory_bytes: 3064