akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	int a[4][3][10];
	for (int i = 0; i < 4; i++)
		for (int j = 0; j < 3; j++)
			for (int k = 0; k < 10; k++)
				a[i][j][k] = 0;
	for (int i = 0; i < n; i++) {
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		a[b - 1][f - 1][r - 1] += v;
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++)
				cout << ' ' << a[i][j][k];
			cout << endl;
		}
		if (i != 3)
			cout << "####################" << endl;
	}
}



Measured memory_bytes: 3088
def main():
    N = int(input())

    if N is 0:
        print(0)
        return

    ans = []  # 末尾の桁から
    while N:
        q, r = divmod(N, 2)
        ans.append(r)
        N = -q
    print(*reversed(ans), sep='')


if __name__ == '__main__':
    main()


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

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;
const int maxn = 1e6+10;

bool ex[maxn];
int main()
{
    int x,n,p;
    cin>>x>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>p;
        ex[p]=1;
    }
    int ans=0,mi=1000;
    for(int i=0;i<=101; i++)
    {
        if(ex[i])
            continue;
        if(abs(i-x)<mi)
        {
            mi=abs(i-x);
            ans=i;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3568
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INF = 1e6+7;
const long long MOD = 1e9+7;
const double PI=acos(-1);

using namespace std;

int main(){
	
	long long n,k;
	cin >> n >> k;
	vector<long long> a(n);
	for(long long i=0;i<n;i++){
		cin >> a[i];
		a[i]--;
	}
	vector<long long> b;
	vector<int> check(n,0);
	long long now=0;
	b.push_back(0);
	check[0]++;
	while(1){
		now=a[now];
		b.push_back(now);
		check[now]++;
		if(check[now]==2){
			break;
		}
	}
	int dist_1=1,dist_2=0;
	bool f=false;
	reverse(b.begin(),b.end());
	for(int i=0;i<b.size();i++){
		if(i==0)continue;
		if(b[0]!=b[i] && !f){
			dist_1++;	
		}else{
			if(f){
				dist_2++;
			}
			f=true;
		}
	}
	reverse(b.begin(),b.end());
	k-=dist_2;
	if(k<=0){
		k+=dist_2;
		cout << b[k]+1 << endl;
	}else{
		b.erase(b.begin(),b.begin()+dist_2-1);
		int temp=k%dist_1;
		cout << b[temp+1]+1 << endl;
	}
	return 0;
}


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

#define read(a) cin >> a
#define out(a)  cout << a
#define ull unsigned long long
#define ll long long
#define FOR(i, l, r) for (ll i = l; i <= r; i++)
#define FOD(i, l, r) for (ll i = l; i >= r; i--)
#define fast ios_base::sync_with_stdio(false);
#define mod 1000000007

ll d[300];

int main()
{
    ll dem = 0;
    string s;
    cin >> s;
    string t = s;
    FOR(i, 0, s.size()-1)
    {
        if (s[i] == 'R')
            d[s[i]]++;
            dem += d[s[i]];
    }
    FOR(i, 0, s.size()-1)
    {
        if (dem == 1)
            return cout << 1, 0;
        else

            if (s[0] == 'R' and s[1] == 'R' and s[2] == 'R')
                return cout << 3, 0;
            else if (s[i] == 'S')
            {
                if (i > 0)
                    return cout << i, 0;
                else
                {
                    reverse(t.begin(), t.end());
                    FOR(i, 0, t.size()-1)
                    {
                        if (t[0] == 'R' and t[1] == 'R' and t[2] == 'R')
                            return cout << 3, 0;
                        else if (t[i] == 'S')
                            return cout << i, 0;
                    }
                }
            }
    }
}


Measured memory_bytes: 3548
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
using namespace std;

int q;
int dp[1010][1010];

int lcs(string& X, string& Y) {
  int m = X.size(), n = Y.size();
  X = ' ' + X, Y = ' ' + Y;
  int result = 0;
  rep1(i, m) dp[i][0] = 0;
  rep1(j, n) dp[0][j] = 0;
  rep1(i, m) rep1(j, n) {
    if (X[i] == Y[j]) dp[i][j] = dp[i - 1][j - 1] + 1;
    else dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
    result = max(result, dp[i][j]);
  }
  return result;
}

int main() {
  cin >> q;
  rep(i, q) {
    string X, Y;
    cin >> X;
    cin >> Y;
    cout << lcs(X, Y) << endl;
  }
  return 0;
}



Measured memory_bytes: 7064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int main(){
    int n,k; cin >> n >> k;
    long h[n]; for(int i=0; i<n; i++) cin >> h[i];
    sort(h,h+n);
    long minh=1000000000;
    for(int i=0; i<n-k+1; i++){
        minh = min(minh,h[i+k-1]-h[i]);
    }
    cout << minh << endl;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int a[1000],b[1000],leng=0;
int f(){
    int i,j;
    for(i=1;i<=leng;i++)
    if(b[a[i]]>0)return 1;
    return 0;
}
int main(){
    int i,j,l;
    long long k,n,m;
    cin>>k>>n;
    for(i=1;i<=n;i++)cin>>l,b[l]++;
    m=k;
    while(m>0){
        a[++leng]=m%10;
        m/=10;
    }
    while(f()){
        int s1=f();
        a[s1]++;
        k++;
        while(a[s1]>=10)a[s1]=0,s1++,a[s1]++;
        leng=max(leng,s1);
    }
    cout<<k<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
  int H, W;
  cin >> H >> W;
  if (H == 1 || W == 1)
    cout << 1 << endl;
  else 
    cout << (1ll * H * W / 2) + (H & W & 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

int main(){
  int n, x, t;
  cin >> n >> x >> t;
  int ans;
  if (n % x == 0){
    ans = n / x * t;
  }
  else{
    ans = (n / x + 1) * t;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3620
n = int(input())
a = list(map(int, input().split()))
ln = max(a) + 1
l = [0]*ln
ans = 0

for i in a:
    for j in range(i, ln, i):
        l[j] += 1

for i in a:
    if l[i] == 1:
        ans += 1

print(ans)


Measured memory_bytes: 32188
#include <bits/stdc++.h>
#include <unistd.h>
#include <cctype>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1 << 30
#define LLINF LLONG_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
using ll = long long;
using Pll = pair<ll,ll>;
using Pii = pair<int,int>;
using Pdd = pair<double,double>;
using dcomplex = complex<double>;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;}
ll power(ll x,ll n){ll a=1;REP(i,n)a*=x;return a;}
double inf() {return std::numeric_limits<double>::infinity();}

ll N;

int main()
{
  cin >> N;
  vector<ll> A(N),B(N);
  REP(i,N) cin >> A[i];
  sort(A.begin(),A.end());
  B[0] = A[0];
  REP(i,N-1) B[i+1] = A[i+1] + B[i];
  ll ans = 1;
  for(int i = N-2; i >= 0; i--) {
    if(A[i+1] <= B[i]*2) {
      ans++;
    } else {
      break;
    }
  }
  cout << ans << endl;
}


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

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

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};
use std::collections::VecDeque;

fn main() {
    let mut vd: VecDeque<char> = VecDeque::new();
    let mut isReverse = false;
    let c: String = read();
    let cc: Vec<char> = c.chars().collect();
    for i in cc {
        vd.push_back(i)
    }

    let n: i64 = read();
    for _ in 0..n {
        let f: usize = read();
        if f == 1 {
            isReverse = !isReverse;
        } else {
            let w: usize = read();
            let ch: String = read();
            let cc: Vec<char> = ch.chars().collect();
            let isFront = if !isReverse { w == 1 } else { w == 2 };
            if isFront {
                vd.push_front(cc[0])
            } else {
                vd.push_back(cc[0])
            }
        }
    }

    let mut ans = "".to_string();
    while !vd.is_empty() {
        if !isReverse {
            ans += &vd.pop_front().unwrap().to_string()
        } else {
            ans += &vd.pop_back().unwrap().to_string()
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6652
#include<bits/stdc++.h>
using namespace std ; 
int main()
{
    int n ; 
    cin>>n ; 
    vector<int> v(n) ; 
    for(int i =0 ;i<n;i++)
        cin>>v[i] ; 
    sort(v.begin() , v.end()) ; 
    long long  ans = 0 ; 
    for(int i =0 ;i<n-2;i++)
    {
        for(int j = i+1 ; j<n-1;j++)
        {
            int temp = v[i] + v[j] ;
            
            auto  l = lower_bound(v.begin() , v.end() , temp)  ; 
             l-- ; 
            
            ans += (l-v.begin() - j) ;  
            
            
        }
    }
    cout <<ans ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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; }

const long long INF = 1LL << 60;

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

  int sum = 0;
  rep(i, n){
    int x; cin >> x;
    sum += min(x, k-x) * 2;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

int main()
{
    int K, X;
    cin >> K >> X;
    rep(i, 2*K-1)
    {
        cout << X - K + 1 + i << " ";
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	string S;
	cin>>S;
	int a=0;
	rep(i,6)if(S[i]=='1')a++;
	cout<<a;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, X = LI()
    M = []
    for _ in range(N):
        M.append(I())
    M = sorted(M)
    cnt = N
    X -= sum(M)
    cnt += X // M[0]
    print(cnt)

main()



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

int n, a[200001];
map<int, int> m;

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

    cin >> n;
    for(int i = 1; i <= n; i++) {
        int h;
        cin >> h;
        a[i] = i - h;
        m[i + h]++;
    }

    long long ans = 0;
    for(int i = 1; i <= n; i++)
        ans += m[a[i]];

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 21440
#include<bits/stdc++.h>
#define N 123456
using namespace std;
typedef long long ll;
    map<int,int>mp;
int main(void)
{
//    freopen("in.txt","r",stdin);
    int x,n;
    cin>>x>>n;
    int a[n+4];
    int mx=INT_MIN;
    int mn=INT_MAX;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        mx=max(mx,a[i]);
        mn=min(mn,a[i]);
        mp[a[i]]=1;
    }
    for(int i=0;i<=1000;i++)
    {
        int d1=x+i;
        int d2=x-i;
        if(mp[d2]!=1)
        {
            cout<<d2<<endl;
            return 0;
        }
        if(mp[d1]!=1)
        {
            cout<<d1<<endl;
            return 0;
        }
    }
    //main();
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,e,f=2,g;
	cin>>a>>b>>c;
	d=a%b;
	g=a;
	while(d!=e){
		g=a*f;
		f++;
		e=g%b;
		if(e==c){
			cout<<"YES"<<endl;
			return(0);
		}
	}
	cout<<"NO"<<endl;
  return(0);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *parent;
  struct node *right;
  struct node *left;
  int key;
};
 
typedef struct node *Tree;
 

 
Tree t;Tree
 
Search(Tree n,int k){
  if(n == NULL || k == n->key){
    return n;
  }
  if(k < n->key){
    return Search(n->left,k);
  }
  else{
    return Search(n->right,k);
  }
}
 
void Insert(int k){
  Tree m = NULL;
  Tree l = t;
  Tree n;
 
  n = malloc(sizeof(struct node));
  n->key = k;
  n->left = NULL;
  n->right = NULL;
 
  while(l != NULL){
    m = l;
    if(n->key < l->key){
      l = l->left;
    }
    else{
      l = l->right;
    }
  }
  n->parent = m;
   
  if(m == NULL){
    t = n;
  }
  else if(n->key < m->key){
    m->left = n;
  }
  else{
    m->right = n;
  }
}
 
void Preorder(Tree n){
  if(n != NULL){
    printf(" %d",n->key);
    Preorder(n->left);
    Preorder(n->right);
  }
}
 
void Inorder(Tree n){
  if(n != NULL){
    Inorder(n->left);
    printf(" %d",n->key);
    Inorder(n->right);
  }
}
 
int main(void){
  int n,i,j;
  char command[10];
  scanf("%d",&n);
 
  for(i =0;i < n;i++){
    scanf("%s",command);
    if(command[0] == 'i'){
      scanf("%d",&j);
      Insert(j);
    }
    else if(command[0] == 'p'){
      Inorder(t);
      printf("\n");
      Preorder(t);
      printf("\n");
    }
    else if(command[0] == 'f'){
      scanf("%d", &j);
      Tree temp = Search(t,j);
      if(temp != NULL)printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

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

#define int long long
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define yn(x) ((x) ? "Yes" : "No")

typedef pair <int, int> ii;
typedef pair <int, ii> iii;

const int siz = 1e6 + 10;
const int SIZ = 1e6 + 10;
const int mod = 1e9 + 7;
const int maxx = 2e9;
const int MAXX = 1e18;
const string file = "3";

int divs[SIZ];

void prepare() {
    for (int i = 1; i < SIZ; i++) {
        for (int j = i; j < SIZ; j += i) {
            divs[j]++;
        }
    }
}

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

//    freopen ((file + ".inp").c_str(), "r", stdin);
//    freopen ((file + ".out").c_str(), "w", stdout);

    prepare();

    int n;
    cin >> n;

    int ans = 0;
    for (int c = 1; c <= n - 1; c++) {
        int m = n - c;
        ans += divs[m];
    }

    cout << ans << "\n";

//    cerr << "Time: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}


Measured memory_bytes: 11460
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = list(input())
    t = list(input())
    ls = len(s)
    lt = len(t)

    s_true = ""
    from copy import copy

    for i in range(ls - lt + 1):
        s_temp = copy(s)
        for j in range(lt):
            if s[i + j] == t[j]:
                pass
            elif s[i + j] == "?":
                s_temp[i + j] = t[j]
            else:
                break

            if j == lt - 1:
                s_true = copy(s_temp)

    if not s_true:
        print("UNRESTORABLE")
    else:
        for i in range(ls):
            if s_true[i] == "?":
                s_true[i] = "a"

    print("".join(s_true))


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
import java.util.*;
import static java.lang.Math.*;

public class Main {
	final Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
		new Main().init();
	}
	void init(){
		new AOJ1262();
	}
	
	class AOJ1262{
		final double INF=Double.MAX_VALUE/4.0;
		AOJ1262(){
			while(true){
				int N=sc.nextInt();
				if(N==0)	break;
				System.out.printf("%.4f\n",solve(N));
			}
		}
		double solve(int N){
			int[] a=new int[N+1];
			for(int i=1; i<=N; i++)	a[i]=sc.nextInt();
			double b=sc.nextDouble();
			int r=sc.nextInt();
			double v=sc.nextDouble(),e=sc.nextDouble(),f=sc.nextDouble();
			double[][] dp=new double[N+1][N+1];
			for(int i=1; i<=N; i++)for(int j=0; j<=N; j++)dp[i][j]=INF;
			//flash(dp,N);
			double tmp=0.0;
			for(int i=0; i<a[1]; i++)	tmp+=exp(i,r,v,e,f);
			dp[1][0]=tmp;
			for(int w=1; w<N; w++){
				for(int h=0; h<w; h++){
					int d=a[w+1]-a[w],x=a[w]-a[h];
					double exp=0.0;
					for(int i=0; i<d; i++)	exp+=exp(x++,r,v,e,f);
					//TODO debug
					//System.out.println(exp);
					dp[w+1][h]=dp[w][h]+exp;
					double exp2=0.0;
					for(int i=0; i<d; i++)	exp2+=exp(i,r,v,e,f);
					dp[w+1][w]=min(dp[w+1][w], dp[w][h]+exp2+b);
				}
				//TODO debug
				//System.out.println("new "+dp[w+1][w]);
			}
			//flash(dp,N);
			double ans=INF;
			for(int i=0; i<=N; i++)	ans=min(ans,dp[N][i]);
			return ans;
		}
		double exp(int x,double r,double v,double e,double f){
			return x>=r?(1/(v-e*(x-r))):(1/(v-f*(r-x)));
		}
		void flash(double[][] dp,int N){
			for(int y=0; y<=N; y++){
				for(int x=0; x<=N; x++)	System.out.printf("%3.3f ",dp[x][y]>=INF?-1:dp[x][y]);
				System.out.println();
			}
		}
	}
}

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

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

    vector<long long> A(N+1,0);
    vector<long long> B(N+1,0);
    rep(i,N+1) cin>>A[i];
    rep(i,N)cin>>B[i];

    long long ans=0;
    rep(i,N){
        ans+=min(A[i],B[i]);
        if(B[i]-min(A[i],B[i])>0){//体力が残ってる
            ans+=min(A[i+1],B[i]-min(A[i],B[i]));
            A[i+1]=A[i+1]-min(A[i+1],B[i]-min(A[i],B[i]));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		sc.close();
		
		str2 += str2;
		
		String res = str2.contains(str1) ? "Yes" : "No";
		
		System.out.println(res);
	}
  
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll;
typedef pair<ll, ll> pll;
#define pb push_back
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
ll inf = 1e18;
ll p = 1e9 + 7;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i, j, y, x,  z, w, g, key, l, r, n, m, t, k, d;
    ll t2, t3, t4, t1;
    string s;
    cin >> n >> k;
    ll ans = -inf;
    ll p[n + 1], c[n + 1];
    for (i = 1; i <= n; i++)
        cin >> p[i];
    for (i = 1; i <= n; i++)
        cin >> c[i];
    for (i = 1; i <= n; i++)
    {
        t1 = c[i], t2 = k - 1, t3 = c[i], t4 = i;
        vector<ll>marked(n + 2, 0), val(n + 2, 0);
        marked[i] = 1;
        ll cur = 1;
        val[cur++] = c[i];
        while (t2 > 0)
        {

            if (marked[p[t4]] == 0)
            {
                t4 = p[t4];
                t3 += c[t4];
                t2--;
                marked[t4] = cur;
                val[cur++] = t3;
                t1 = std::max(t1, t3);
            }
            else
            {

                ll len = marked[t4] - marked[p[t4]] + 1;

                ll t6 = val[marked[t4]] - val[marked[p[t4]] - 1];
                //cout << val[1];
                ll t5 = t2 / len;
                if (t2 % len == 0)
                {
                    t5--;
                    t2 = len;
                }
                else
                    t2 %= len;
                t3 += t5 * t6;
                t1 = std::max(t1, t3);


                while (t2 > 0)
                {
                    t4 = p[t4];
                    t3 += c[t4];
                    t1 = std::max(t1, t3);
                    t2--;

                }
                break;



            }
        }
        ans = std::max(t1, ans);

    }
    cout << ans;







    return 0;
}

Measured memory_bytes: 3796
N,C=gets.split(" ").map &:to_i
IA=N.times.map{gets.split(" ").map &:to_i}
MS,CS,rs,IA[N]=[[0,0]],[0],0,[C,0]
IA.each_with_index{|v,i|CS[i+1]=CS[i]+v[1];MS[i+1]=[CS[i+1]-v[0],MS[i][0]].max,[CS[i+1]-2*v[0],MS[i][1]].max}
(0..N).map{|i|ob=CS[N]-CS[i];rs=[rs,ob+MS[i][0]-2*(C-IA[i][0]),ob+MS[i][1]-(C-IA[i][0])].max}
puts rs


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


void solve(long long a, long long b, long long x){
    double X = (double)x / (double)a;
    double A = (double)a;
    double B = (double)b;
    // cout<<X<<A<<B<<endl;
    if(X <= A * B / 2){
        double tmp = atan(2.0*X/B/B)*180.0/acos(-1);
        tmp = 90.0 - tmp;
        cout<<setprecision(20)<<tmp<<endl;
    }
    else{
        X = A * B - X;
        double tmp = atan(2.0*X/A/A)*180.0/acos(-1);
        cout<<setprecision(20)<<tmp<<endl;
    }
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long x;
    scanf("%lld",&x);
    solve(a, b, x);
    return 0;
}


Measured memory_bytes: 256
/*
 * src.cpp
 *
 *  Created on: 2016/09/11
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

typedef long long ll;

const int MAX_M=2e5,MAX_N=1e5,INF=1e8,MAX_C=1e6;

typedef pair<int,int> P;

int N,M;

struct edge{
	P to;
	int cost;
	edge(P to=P(),int cost=0):to(to),cost(cost){}
};

struct S{
	P v;
	int cost;
	S(P v=P(),int cost=0):v(v),cost(cost){}
	bool operator < (const S &s)const{
		return cost>s.cost;
	}
};

map<int,vector<edge> > G[MAX_N];
map<int,int> dist[MAX_N];

void dijkstra(){
	priority_queue<S> pq;
	dist[0][-1]=0;
	pq.push(S(P(0,-1),0));
	while (!pq.empty()){
		S s=pq.top();
		pq.pop();
		if (s.cost>dist[s.v.first][s.v.second]){
			continue;
		}
		REP(i,(int)G[s.v.first][s.v.second].size()){
			edge e=G[s.v.first][s.v.second][i];
			if (dist[e.to.first].find(e.to.second)==dist[e.to.first].end() || dist[e.to.first][e.to.second]>s.cost+e.cost){
				dist[e.to.first][e.to.second]=s.cost+e.cost;
				pq.push(S(P(e.to.first,e.to.second),s.cost+e.cost));
			}
		}
	}
}

int main(){
	scanf("%d %d",&N,&M);
	REP(i,M){
		int p,q,c;
		scanf("%d %d %d",&p,&q,&c);
		p--;
		q--;
		G[p][c].push_back(edge(P(q,c),0));
		G[q][c].push_back(edge(P(p,c),0));
	}
	REP(i,N){
		for (map<int,vector<edge> >::iterator ite=G[i].begin();ite!=G[i].end();ite++){
			if (ite->first==-1) continue;
			G[i][-1].push_back(edge(P(i,ite->first),1));
			G[i][ite->first].push_back(edge(P(i,-1),0));
		}
	}
	dijkstra();
	if (dist[N-1].find(-1)==dist[N-1].end()){
		printf("-1\n");
	}else{
		printf("%d\n",dist[N-1][-1]);
	}
	return 0;
}


Measured memory_bytes: 93364
n=int(input())
a=[list(map(int,input().split())) for i in range(n-1)]
def t(x,k):
    if a[k][1]<=x:
        return (x+a[k][2]-1)//a[k][2]*a[k][2]+a[k][0]
    return a[k][1]+a[k][0]
for i in range(n-1):
    p=t(0,i)
    for j in range(i+1,n-1):
        p=t(p,j)
    print(p)
print(0)

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

using ll=long long; 

ll inf=1LL<<60;

void solve(){
	ll n,x,y;
	cin>>n>>x>>y;
	if((y-x)%2==0){
		cout<<(y-x)/2<<endl;
	}
	else{
		ll ans1=min(n-x, y-1);
		ll xdif=x-1;
		ll ydif=n-y;
		ll ansx=(y-xdif-1);
		ll ansy=(x+ydif+1);
		//if(ansx<0)ansx=inf;
		//else{
			ansx=(ansx-1)/2;
			ansx+=xdif;
			ansx+=1;
		//}
		//if(ansy>y)ansy=inf;
		//else{
			ansy=(n-ansy)/2;
			ansy+=ydif;
			ansy+=1;
		//}
		cout<<min(ans1, min(ansx, ansy))<<endl;
		//cout<<ans1<<" "<<ansx<<" "<<ansy<<endl;
	}
}

signed main(){
	//while(1)
	solve();
}

Measured memory_bytes: 256
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n,x,m=nii()

ans=x
x_list=[x]
zan=0
for i in range(n-1):
  a=(x**2)%m
  ans+=a
  x=a
  if x in x_list:
    inx=x_list.index(x)
    zan=(n-1)-i-1

    inx=x_list.index(x)+1
    nx_list=x_list[inx:]+[x_list[inx-1]]

    if zan<=len(nx_list):
      ans+=sum(nx_list[:zan])
    else:
      num=zan//len(nx_list)
      q=zan%len(nx_list)
      ans+=sum(nx_list)*num
      ans+=sum(nx_list[:q])
    break
  else:
    x_list.append(x)

print(ans)

Measured memory_bytes: 69568
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		String s=sc.nextLine();

		Pattern pattern=Pattern.compile("peach|apple");
		Matcher matcher=pattern.matcher(s);
		StringBuffer sb=new StringBuffer();
		while(matcher.find()){
			if(matcher.group().equals("peach"))
				matcher.appendReplacement(sb, "apple");
			else
				matcher.appendReplacement(sb, "peach");
		}
		matcher.appendTail(sb);

		println(sb.toString());
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 12000
N=int(input())
S_list=[]
for i in range(N):
    s=input()
    ss=list(s)
    ss.sort()
    S_list.append(ss)
S_list.sort()
ans=0
cnt=0
for i in range(1,N):
    if S_list[i]==S_list[i-1]:
        cnt+=1
        ans+=cnt
    else:
        cnt=0
print(ans)

Measured memory_bytes: 26668
import math
import heapq
import sys
from collections import Counter

#N,K=map(int, input[].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
b=list(map(str,input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

a=[]

for i in range(1,N+1):
    for k in reversed(range(len(b))):
        #rint('{}回目 要素番号:{} 値:{} {}{}'.format(i,k+1,b[k],b,a))
        if k+1==int(b[k]):
            a.insert(0,b.pop(k))
            break
if len(a)==N:
    for i in a:
        print(int(i))
else:
    print('-1')


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#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)
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const ll mod2 = 998244353;

int main() {
  int n, T;
  cin >> n >> T;
  int ans = mod;
  rep(i, n) {
    int c, t;
    cin >> c >> t;
    if (t <= T) ans = min(ans, c);
  }
  if (ans == mod) {
    cout << "TLE" << endl;
    return 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
dic = {}
S = input()
key_set = []
for c in S:
	if c in dic:
		dic[c] += 1
	else:
		dic[c] = 1
		key_set.append(c)



for i in range(n-1):
	dic_tmp = {}
	key_set_tmp = []
	S = input()
	for c in S:
		if c in dic_tmp:
			dic_tmp[c] += 1
		else:
			dic_tmp[c] = 1
			key_set_tmp.append(c)

	for key in set(key_set) & set(key_set_tmp):
		dic[key] = min(dic_tmp[key],dic[key])

	for key in set(key_set):
		if not key in key_set_tmp:
			dic.pop(key)
			key_set.remove(key)

ans = []
for key,value in dic.items():
	ans.append(key * value)

ans.sort()
print(''.join(ans))



Measured memory_bytes: 3064
import math
n = int(input())
if n % 2 != 0 or n == 0:
    print(0)
    exit()
l = math.ceil(math.log(n, 5))
#print(l)
ans = 0
for i in range(1, l + 1):
    #print(pow(5, i), n // pow(5, i))
    ans += n // pow(5, i) // 2
print(ans)

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

int main() {

  int a,b,k,x,y;
  cin >> a >> b >> k;
  
  x = a;
  y = b;
  
  if ( b - a < k * 2 ){
    while(x <= b){
      cout << x << endl;
      x++;
    }
  }else{
    while(x < a + k ){
      cout << x << endl;
      x++;
    }
    while( y - (k - 1) <= b ){
      cout << y - ( k - 1) << endl;
      y++;
    }
  }      
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

ll getLast(multimap<ll, ll> &par) {
  auto it = par.end();
  it--;
  ll res = it->first;
  par.erase(it);
  return res;
}

pair<ll, ll> getLast2(multimap<pair<ll, ll>, ll> &par) {
  auto it = par.end();
  it--;
  pair<ll, ll> res = it->first;
  par.erase(it);
  return res;
}

ll getVal(multimap<ll, ll> &par, ll val) {
  auto it = par.lower_bound(val);
  if (it == par.begin())
    return -1;
  it--;
  ll res = it->first;
  par.erase(it);
  return res;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin >> n;

  ll n2 = (1 << n);
  ll arr[n2 + 5];
  multimap<ll, ll> par;
  for (ll i = 1; i <= n2; i++) {
    cin >> arr[i];
    par.insert({arr[i], 1});
  }

  ll val = getLast(par);

  multimap<pair<ll, ll>, ll> par2;

  par2.insert({{n, val}, 1});

  while (par2.size()) {

    pair<ll, ll> curr = getLast2(par2);
    //   cout << curr.first << " " << curr.second << en;

    if (curr.first == 0)
      continue;

    ll val = getVal(par, curr.second);
    if (val == -1) {
      cout << "No" << en;
      return 0;
    }
    par2.insert({{curr.first - 1, val}, 1});
    curr.first--;
    if (curr.first)
      par2.insert({{curr.first, curr.second}, 1});
  }

  if (par.size() == 0)
    cout << "Yes" << en;
  else
    cout << "No" << en;

  return 0;
}


Measured memory_bytes: 18688
N = input() 
A = input().split()
count = 0

flg = False
tmp = A

while flg == False:
    List = []
    for Number in tmp:
        if  int(Number) % 2 != 0:
            flg = True
        else:
            List.append(int(Number) / 2)
    
    if flg == False:
        count += 1
        tmp = List
    
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#endif


typedef long long ll; 
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
 
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

const int INF = (int)1e9;

void solve() {
  ll x;
  cin >> x;
  ll now = 100;
  ll year = 0;
  while (now < x) {
    year++;
    ll add = now * 0.01;
    now += add;
  }
  cout << year;
}
 
int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
  int t = 1;
  // cin >> t;
  while (t--) {
    solve();
  }
 
  return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>
#include<utility>
using namespace std;
typedef long long int LL;

LL dp[3001][3001][2];

class solution {
private:
	LL ar[3001];
	int n;
	LL serc(int l, int r, int m) {
		if (l > r) return 0;
		if (m == 0) {
			if (dp[l][r][m] != (1ll << 63)) return dp[l][r][m];
			dp[l][r][m] = max(dp[l][r][m], ar[r] + serc(l, r - 1, m ^ 1));
			dp[l][r][m] = max(dp[l][r][m], ar[l] + serc(l + 1, r, m ^ 1));
		}
		else {
			if (dp[l][r][m] != (~(1ll << 63))) return dp[l][r][m];
			dp[l][r][m] = min(dp[l][r][m], serc(l, r - 1, m ^ 1) - ar[r]);
			dp[l][r][m] = min(dp[l][r][m], serc(l + 1, r, m ^ 1) - ar[l]);
		}
		return dp[l][r][m];
	}
	LL max(LL a, LL b) {
		if (a > b) return a;
		return b;
	}
	LL min(LL a, LL b) {
		if (a < b) return a;
		return b;
	}
	void reset() {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j][1] = ~(1ll << 63);
				dp[i][j][0] = (1ll << 63);
			}
		}
	}
public:
	solution() {
		scanf("%d", &n);
		for (int i = 0; i < n; i++) {
			scanf("%lld", &ar[i]);
		}
		reset();
		printf("%lld\n", serc(0, n - 1, 0));
	}
};

#ifndef L0C4L
int main() {
	solution();
	return 0;
}
#endif

Measured memory_bytes: 141056
H,N=map(int,input().split())
ls=[list(map(int,input().split())) for i in range(N)]

def dp(H,N,ls):
    table=[[float('inf')]*(H+1)] + [[0]*(H+1) for i in range(N)]
    for i in range(1,N+1):
        atk,cost=ls[i-1][0],ls[i-1][1]
        for h in range(H+1):
            if atk>=h:
                table[i][h]=min(table[i-1][h], cost)
            else:
                table[i][h]=min(table[i-1][h], table[i][h-atk]+cost)
    return(table[-1][-1])

print(dp(H,N,ls))


Measured memory_bytes: 119920
S=input()
L0=len(S)
C=0
if L0 % 2 == 0:
    for i in range(int(L0 / 2)):
        if (S[i*2:i*2+2] == "hi"):
            C=1
if C==1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,b=0;
    cin>>n;
    int k[n+5];
    for(int i=1;i<=n;i++)
    {
        cin>>k[i];
    }
    for(int i=1;i<=n;i++)
    {
        if(i!=k[i])
        {
                b++;
        }
    }
    if(b==0 || b==2)
    {
        cout<<"YES"<<endl;
    }
    else
    {
            cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
	input = input.split("\n")[1].split(" ");
  input.sort(function(a,b){
  	return parseInt(a) - parseInt(b);
  });
  //console.log(input);
  var output = 0;
  for(var i = 0; i < input.length; i = i + 2){
  	output += parseInt(input[i]);
  }
  console.log(output)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);
    
    int D;
    cin >> D;
    if(D == 22) cout << "Christmas Eve Eve Eve" << endl;
    if(D == 23) cout << "Christmas Eve Eve" << endl;
    if(D == 24) cout << "Christmas Eve" << endl;
    if(D == 25) cout << "Christmas" << endl;
    
    return 0;
}

/*
int main(){
    iostream::sync_with_stdio(false);
    
    
    
    return 0;
}*/

/*
int main(){
    iostream::sync_with_stdio(false);
    
    
    
    return 0;
}*/

/*
int main(){
    iostream::sync_with_stdio(false);
    
    
    
    return 0;
}*/

Measured memory_bytes: 256
#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;
    int q;
    cin >> s >> q;

    int t, r = 1;
    string fr, bc;
    rep(i, q) {
        cin >> t;
        if (t == 1) {
            r *= -1;
            swap(fr, bc);
        } else {
            int f;
            char c;
            cin >> f >> c;
            (f == 1 ? fr : bc) += c;
        }
    }

    reverse(fr.begin(), fr.end());
    if (r == -1) reverse(s.begin(), s.end());

    cout << fr + s + bc << endl;
    return 0;
}


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

using namespace std;

int main(){
	string yaki = "YAKI";
	string s;
	cin>>s;
	bool f = true;
	if(s.length() < 4){
		cout <<"No"<<endl;
		return 0;
	}
	for(int i = 0;i < 4;i++){
		if(s[i] != yaki[i])f = false;
	}
	cout << (f?"Yes":"No") << endl;
	return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        long[] a = new long[n];
        long[] b = new long[m];

        long[] aruiseki = new long[n];
        long[] bruiseki = new long[m];
        int aMaxIndex = - 1;
        int bMaxIndex = - 1;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            aruiseki[i] = a[i];
            if (i > 0) {
                aruiseki[i] += aruiseki[i - 1];
            }
            if (aruiseki[i] <= k) {
                aMaxIndex = i;
            }
        }

        for (int i = 0; i < m; i++) {
            b[i] = sc.nextInt();
            bruiseki[i] = b[i];
            if (i > 0) {
                bruiseki[i] += bruiseki[i - 1];
            }
            if (bruiseki[i] <= k) {
                bMaxIndex = i;
            }
        }

        if (aMaxIndex == - 1) {
            System.out.println(bMaxIndex + 1);
            return;
        }
        int lastIndex = m - 1;
        int ans = aMaxIndex + 1;
        parent: for (int i = 0; i <= aMaxIndex; i++) {
            long nokori = k - aruiseki[i];
            for (int j = lastIndex; j >= 0; j--) {
                if (bruiseki[j] <= nokori) {
                    lastIndex = j;
                    ans = Math.max(ans, i + j + 2);
                    continue parent;
                }
            }
            ans = Math.max(i + 1, ans);
        }
        System.out.println(Math.max(ans, bMaxIndex + 1));
    }
}

Measured memory_bytes: 66148
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define Cout(n) cout<<(n)<<endl
#define INF 1000000000000000000LL

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << ", ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

int main()
{
	string s,t;
	cin >> s >> t;
	cout << t+s << endl;
	return 0;
}


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

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> hiku(N);
    for (int i=0; i<N; i++) {
        cin >> A[i];
        hiku[i] = i - A[i];
    }
    map<int, int> hist_hiku;
    for (int i=0; i<N; i++) {
        if (hist_hiku.count(hiku[i])) {
            hist_hiku[hiku[i]]++;
        }
        else {
            hist_hiku[hiku[i]] = 1;
        }
    }
    ll count = 0;
    for (int i=0; i<N; i++) {
        if (hist_hiku.count(i + A[i])) {
            count += hist_hiku[i + A[i]];
        }
        hist_hiku[hiku[i]]--;
    }
    cout << count << endl;
}

Measured memory_bytes: 13472
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <functional>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
using namespace std;
// #define int long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = (((1<<30)-1)<<1)+1;
const int nINF = 1<<31;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, int> pci;

/////////////////////////////////////////////////////////////////////

signed main() {
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);
	vector<pii> ans;
    int n;
    cin >> n;
    if(n & 1) {
    	FOR(i, 1, n) {
    		FOR(j, i+1, n) {
    			if(i+j != n) ans.push_back({i, j});
    		}
    	}
    } else {
    	FOR(i, 1, n) {
    		FOR(j, i+1, n) {
    			if(i+j != n+1) ans.push_back({i, j});
    		}
    	}
    }
	cout << ans.size() << endl;
	for(pii p : ans) cout << p.first << ' ' << p.second << endl;

    return 0;
}

// Easy things to check:
// - LONG LONGS (WA)
// - const int N is correct (WA, RTE)
// - .size()-k underflow (WA, RTE, TLE)
// - small n edge cases (WA)

// Rare mistakes made in the past:
// - division by 0 (WA)
// - integer division (WA)
// - setprecision (WA)
// - INF not big enough using ll (WA)
// - setting max to 0 instead of -INF/min to 0 instead of INF (WA)
// - outputting debug (WA)
// - allocating too much memory (locRTE, MLE)
// - stack size (locRTE)
// - round announcements (WA)
// - multiset::erase (WA)



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll X,N;
  cin>>X>>N;
set<ll> S;
  for(ll i=0;i<N;i++) {
ll p;
    cin>>p;
    S.insert(p);
  }
  if(!S.count(X)) {
    cout<<X<<endl;
    return 0;
  }
  for(ll i=1;i<1000;i++) {
    if(!S.count(X-i)) {
      cout<<X-i<<endl;
      break;
    }
    else if(!S.count(X+i)) {
cout<<X+i<<endl;
      break;
    }
  }
cout<<endl;
}


Measured memory_bytes: 3636