akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define MOD 998244353LL

LL bigmod(LL a,LL p)
{
    LL ret=1;
    while(p>0)
    {
        if(p&1)ret=(ret*a)%MOD;
        p>>=1;
        a=(a*a)%MOD;
    }
    return ret;
}

LL modinverse(LL a)
{
    return bigmod(a,MOD-2);
}

LL fact[300009],inv[300009];

LL ncr(LL n, LL r)
{
    if(n<r || r<0)return 0;
    return (((fact[n]*inv[r])%MOD)*inv[n-r])%MOD;
}

int main()
{
    fact[0]=inv[0]=1;
    for(LL i=1;i<=300000;i++)
    {
        fact[i]=(i*fact[i-1])%MOD;
        inv[i]=modinverse(fact[i]);
    }
    LL n,a,b,k;
    cin>>n>>a>>b>>k;
    LL ans=0;
    for(LL i=0;i<=n;i++)
    {
        if((k-i*a)%b || (k-i*a)<0)continue;
        LL j=(k-i*a)/b;
        if(j>n)continue;
        ans+=(ncr(n,i)*ncr(n,j))%MOD;
    }
    ans%=MOD;
    cout<<ans<<endl;
    return 0;
}


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

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        int[] c = new int[n];
        for (int i = 0; i < n; i++) {
            c[i] = sc.nextInt();
        }
        Arrays.sort(a);
        Arrays.sort(b);
        Arrays.sort(c);
        System.out.println(solve(a, b, c));
    }

    private static long solve(int[] a, int[] b, int[] c) {
        int n = a.length;
        long[] bmemo = new long[n];
        int cidx = 0;
        for (int j = 0; j < n; j++) {
            for (int k = cidx; k < n; k++) {
                if (b[j] >= c[k]) {
                    cidx++;
                } else {
                    bmemo[j] = n - k;
                    break;
                }
            }
        }
        for (int i = n - 2; i >= 0; i--) {
            bmemo[i] += bmemo[i + 1];
        }
        long sum = 0;
        int bidx = 0;
        for (int i = 0; i < n; i++) {
            for (int j = bidx; j < n; j++) {
                if (a[i] >= b[j]) {
                    bidx++;
                } else {
                    sum += bmemo[j];
                    break;
                }
            }
        }
        return sum;
    }
}


Measured memory_bytes: 92812
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define REP(i,a,b) for(int i=a;i<(b);++i)
using namespace std;
typedef long long ll;

int xi[100000];
int dyi[100000];
int S[100000];
int I[100000];
int A[100000] , B[100000];
ll n,m,k;

void mult(int *a,int *b){
    REP(i,0,n) A[i] = a[i] , B[i] = b[i];
    REP(i,0,n) a[i] = B[A[i]];
}

int main(){

    cin >> n;
    for(int i=0;i<n;i++){
        int tmp;
        cin >> xi[i];
        dyi[i]= xi[i] - (i == 0 ? 0 : xi[i-1]);
        S[i]=i;
        I[i]=i;
    }
    cin >> m>>k;
    
    vector<long long> ai;
    for(long long i=0;i<m;i++){
        long long tmp;
        cin >>tmp;
        swap(S[tmp],S[tmp-1]);
    }
    for(ll t=k;t;t>>=1){
        if(t&1) mult(I,S);
        mult(S,S);
    }
    ll Sum = 0;
    REP(i,0,n){
        Sum += dyi[I[i]];
        cout << Sum << endl;
    }
}


Measured memory_bytes: 3584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    void solve() throws IOException {
        int n = ni();
        String s = ns();

        int cnt = 0;
        int max = 0;
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == 'I') {
                cnt++;
            } else {
                cnt--;
            }
            if (cnt > max) {
                max = cnt;
            }
        }

        out.println(max);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

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

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 8272
fun main(args: Array<String>) {
    var line = readLine()
    val N = line!!.toInt()
    line = readLine()
    var a = line!!.split(" ").map{ it.toInt() }.map{
        var count = 0
        var aa = it
        while (aa % 2 == 0 && aa > 0) {
            count += 1
            aa /= 2
        }
        count
    }
    println(a.sum())
}

Measured memory_bytes: 42056
from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
#from functools import lru_cache   #use @lru_cache(None)
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')
#
def input(): return sys.stdin.readline()
def mapi(arg=0): return map(int if arg==0 else str,input().split())
#------------------------------------------------------------------

a,b,c,d = mapi()
#print((a+d-1)//d,(c+b-1)//b)
if (a+d-1)//d>=(c+b-1)//b:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 68168
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  int a,b,k;
  cin >> a >> b >> k;
  int cnt = 0;
  int i = 101;
  while(cnt<k){
    i--;
    if(a%i==0&&b%i==0) cnt++;
  }
  cout << i << endl;
  return 0;
}


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

using namespace std;
constexpr int64_t MOD = 1'000'000'007;

int64_t modinv(int64_t a) {
    int64_t b = MOD, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

int main(void) {
    int N;
    cin >> N;
    vector<int64_t> x(N);
    for(int i=0; i<N; i++) {
        cin >> x[i];
    }

    for(int i=0; i<N; i++) {
        x[i] = x[N-1] - x[i];
    }

    vector<int64_t> factorial(N, 1);
    for(int i=1; i<N; i++) {
        factorial[i] = (factorial[i-1] * i) % MOD;
    }

    int64_t ans = 0;
    for(int i=0; i<N-1; i++) {
        ans = (ans + x[i] * modinv(i+1)) % MOD;
    }

    cout << (ans * factorial[N-1]) % MOD << endl;
    return 0;
}


Measured memory_bytes: 1792
function gcd(a,b:Longint):Longint;
begin
if b=0 then gcd:=a else gcd:=gcd(b,a mod b);
end;
var K,a,b,c,ans:Longint;
begin
read(K);
for a:=1 to K do for b:=1 to K do for c:=1 to K do inc(ans,gcd(a,gcd(b,c)));
writeln(ans);
end.

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)

using Graph=vii;

int main(){
    int N,X,Y;
    cin>>N>>X>>Y;
    X--,Y--;
    Graph G(N);
    REP(i,1,N){
        G[i].pb(i-1);
        G[i-1].pb(i);
    }
    G[X].pb(Y);
    G[Y].pb(X);
    map<int,int> mp;
    rep(i,N){
        queue<pair<int,int>> que;
        vi dist(N,INF);
        vector<bool> c(N,false);
        que.push({i,0});
        while(!que.empty()){
            int x=que.front().first;
            int d=que.front().second+1;
            que.pop();

            for(auto y:G[x]){
                if(dist[y]<d)continue;
                if(c[y])continue;
                if(y<=i)mp[d]--;
                dist[y]=d;
                c[y]=true;
                que.push({y,d});
            }
        }
        rep(j,N){
            if(dist[j]==INF)continue;
            mp[dist[j]]++;
            //cout<<j<<":"<<dist[j]<<" ";
        }
        //cout<<endl;
        //cout<<"i:"<<i<<endl;
    }
    //REP(i,1,N)cout<<mp[i]<<endl;
    REP(i,1,N)cout<<mp[i]<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<set>
#include<map>
#include<queue>
#include<math.h>
using namespace std ;
using ll = long long ;
using vi = vector<int> ;
using vii = vector<vi> ;
using pii = pair<ll,ll> ;

int main(){
	ll n ;cin >> n ;
	map<string,ll> p ;
	vector<string> vec ;
	for(int i=0;i<n;i++){
		string str ; cin >> str ;
		if(p.count(str)) p.at(str)++ ;
		else{
			p[str] = 1 ;
			vec.push_back(str) ;
		}
	}
	sort(vec.begin(),vec.end()) ;
	ll up = 0 ;
	for(int i=0;i<vec.size();i++){
		if(p.at(vec.at(i))>up) up = p.at(vec.at(i)) ;
	}
	for(int i=0;i<vec.size();i++){
		if(p.at(vec.at(i))==up) cout << vec.at(i) << endl ;
	}
}

Measured memory_bytes: 26736
times = [[], [], []]
losers = []
3.times{|i|
    8.times{|j|
        line = gets.chomp.split
        times[i] << line
        losers << line
    }
    times[i].sort_by!{|item| (item[1].to_f)}
    puts times[i][0].join(" ")
    puts times[i][1].join(" ")
    losers.delete times[i][0]
    losers.delete times[i][1]
}

losers.sort_by!{|item| (item[1].to_f)}
puts losers[0].join(" ")
puts losers[1].join(" ")

Measured memory_bytes: 8660
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long
#define INF INT_MAX
#define mod 1000000007
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll pw(ll a, ll b) {
    if (b == 0) return 1;
    ll t = pw(a, b / 2);
    if (b % 2 == 0) return (t * t)%mod;
    else return ((t * t)%mod * a)%mod;
}
int main()
{
	int n;cin>>n;
	int a[n+1];for(int i=0;i<n;i++)cin>>a[i];
	int dp[n+1];
	dp[1]=0;
	dp[2]=abs(a[1]-a[0]);
	for(int i=3;i<=n;i++)
	{
		dp[i]=min(dp[i-1]+abs(a[i-1]-a[i-2]),dp[i-2]+abs(a[i-1]-a[i-3]));
	}
	cout<<dp[n]<<endl;
}


Measured memory_bytes: 4344
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
const double PI=acos(-1.0);
const double eps=1e-6;
int n;
char s[500];
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    n=read();
    scanf("%s",s+1);
    if(n%2==1) cout<<"No"<<endl;
    else{
        bool ok=1;
        for(int i=1;i<=n/2;i++) if(s[i]!=s[i+n/2]) ok=0;
        if(!ok) cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <queue>
#include <vector>
#include <iostream> 
#include <algorithm>
#include <math.h>
#include <map>  
#include <string.h> 

using namespace std;

int d[11][11];

const int INF=100000000;

int main() {
  
  while(1){
    
    int E; cin>>E; if(E==0) break;
    
    fill(d[0],d[11],INF);
    
    for(int i=0; i<11; i++){
      d[i][i]=0;
      }
    
    int MAX_V=0;
    
    for(int i=0; i<E; i++){
      
      int u,v,cost; cin>>u>>v>>cost;
      
      if(u>MAX_V) MAX_V=u;
      if(v>MAX_V) MAX_V=v;
      
      d[u][v]=cost; d[v][u]=cost;
      
      }
      
     for(int k=0; k<MAX_V+1; k++)
       for(int i=0; i<MAX_V+1; i++)
         for(int j=0; j<MAX_V+1; j++)  d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
         
       int A,ANS=INF;
        
      for(int i=0; i<MAX_V+1; i++){
        int ans=0;
         for(int j=0; j<MAX_V+1; j++){
           ans+=d[i][j];
           }
           if(ans<ANS) {ANS=ans; A=i;}
         }

      cout<<A<<' '<<ANS<<endl;

    }
     
}

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


void solve(long long N){
    long long sum = 0;
    rep(i,N){
        if(i%3 == 0 || i%5 == 0){
            continue;
        }
        sum += i;
    }
    cout << sum << endl;

}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3760
#include <stdio.h>


int gcd(int,int);


int main(){

  int x,y;
  int result=0;

  scanf("%d %d",&x,&y);

  result = gcd(x,y);

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

  return 0;
}

int gcd(int x,int y){
int r=0;
int temp = 0;

if(x < y){
temp = x;
x = y;
y = temp;
}

while( y > 0){

r = x % y;
x = y;
y = r;
}

return x;
}



Measured memory_bytes: 2128
#include<stdio.h>
#include<math.h>

int main(){

    int n,d;
    scanf("%d %d",&n,&d);
    float X[n][d];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            scanf("%f",&X[i][j]);
        }
    }

    int count=0;
    float dist=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            
            for(int k=0;k<d;k++){
                dist+=(X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
            }
            dist = sqrt(dist);

            if(floor(dist)==ceil(dist)){
                count++;
            }
            dist=0;
        }
    }
    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int> data(N), ans(N);
  for(int i = 0; i < N; i++)cin >> data.at(i);
  int a, count;
  for(int i = N - 1; i >= 0;i--){
    a = 2, count = 0;
    while((i + 1) * a <= N){
      if(ans.at((i + 1) * a - 1) == 1)count++;
      a++;
    }
    if((count + data.at(i)) % 2 != 0)ans.at(i) = 1;
  }
  int M = 0;
  for(int i = 0; i < N; i++){
    if(ans.at(i) == 1)M++;
  }
  cout << M << endl;
  for(int i = 0; i < N; i++){
    if(ans.at(i) == 1)cout << i + 1 << ' ';
  }
  return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main() {
	int H;
	cin >> H;
	if (H % 1000 == 0)
		cout << 0 << endl;
	else 
		cout<<1000 - (H % 1000)<<endl;
	return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include <limits>
#include <iomanip>
#include <cassert>

using namespace std;

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

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 1e9 + 7;

int N;

pair<int, int> find_repr(string &s) {
  int n = s.size();
  ll num = 0;
  int di = -1;

  for(int i = 0;i < n;i++) {
    if(s[i] == '.') {
      di = i;
      continue;
    }
    num = num*10 + int(s[i]-'0');
  }

  int j = (di == -1 ? 0 : n-di-1);
  for(;j < 9;j++) {
    num *= 10;
  }

  // debug(num);

  int x = -9, y = -9;
  while(num % 2 == 0) {
    x++;
    num /= 2;
  }
  while(num % 5 == 0) {
    y++;
    num /= 5;
  }

  return {x, y};

}

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 cout << setprecision(10) << fixed;

 map<pair<int,int>, int> ma;

 string s;
 cin>>N;
 rep(i, N) {
   cin >> s;
   ma[find_repr(s)]++;
 }

 ll ans = 0;
 for(auto it = ma.begin();it != ma.end();it++) {
   auto x1 = it->first;
   auto y1 = it->second;
   for(auto it2 = ma.begin();it2 != it;it2++) {
     auto x2 = it2->first;
     auto y2 = it2->second;
     if((x1.F + x2.F) >= 0 && (x1.S + x2.S) >= 0) {
       ans += 1LL*y1*y2;
     }
   }

   if(x1.F >= 0 && x1.S >= 0) {
     ans += 1LL*(y1)*(y1-1)/2;
   }
 }
 cout << ans << endl;

 return 0;
}


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

int main(){
    int x;
    cin >> x;
    for(int i=1; i<100000; i++){
        int sum = i*(i+1)/2;
        if(x <= sum){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
 
int main(){
  ll x, n;
  ll mp[100];
  ll a, b;
  cin >> x >> n;
  rep(i,n){
    cin >> a;
    mp[a] = 1;
  }
  rep(i, 100){
    if(mp[x-i] != 1){
      cout << x-i << endl; break;
    }
    if(mp[x+i] != 1){
      cout << x+i << endl; break;
    }
  }
  return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
int main(){
  int i,N;
  scanf("%d",&N);
  int A[N];
  for(i=0;i<N;++i){
    scanf("%d",&A[i]);
  }
    int min = A[0],max = A[1] - A[0];
    for(i=1;i<N;++i){
      max = max < A[i] - min ? A[i] - min : max;
      min = min > A[i] ? A[i] : min;
    }
    printf("%d\n",max);
    return 0;
  }



Measured memory_bytes: 2564
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5])yes;
	else no;
	
}






Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let a: i32 = sc.read();
    let b: i32 = sc.read();
    let c: i32 = sc.read();

    let res = std::cmp::min(b/a, c);
    println!("{}", res);
}



Measured memory_bytes: 4352
using System;

class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        int n = int.Parse(s);

        int len = s.Length;//桁数

        int ret = 0;
        if (len == 1)
        {
            ret = n;
        }
        else if (len == 2)
        {
            ret = 9;
        }
        else if (len == 3)
        {
            ret = n - 99 + 9;
        }
        else if (len == 4)
        {
            ret = 909;
        }
        else if (len == 5)
        {
            ret = n - 9000 - 90;
        }
        else 
        {
            ret = 90909;
        }



        Console.WriteLine(ret.ToString());

    }
}



Measured memory_bytes: 11092
from collections import deque
import sys

dq = deque()
num = int(sys.stdin.readline())
line = sys.stdin.readlines()

for i in range(num):

    order = line[i].split()

    if order[0] == 'insert':
        dq.appendleft(order[1])
    elif order[0] == 'deleteFirst':
        dq.popleft()
    elif order[0] == 'deleteLast':
        dq.pop()
    else:
        if order[1] in dq:
            dq.remove(order[1])

print(' '.join(dq))

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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
	return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
	return a / gcd(a, b) * b;
}

string IntToString(int number)
{
	stringstream ss;
	ss << number;
	return ss.str();
}

llint cnt = 0;
int n;

int main()
{
    ci >> n;
    string a, b, c;
    ci >> a >> b >> c;

    rep(i, n) {
	if(a[i] == b[i] && b[i] == c[i]) {
	    ;
	} else {
	    if(a[i] == b[i]) cnt++;
	    else if(b[i] == c[i]) cnt++;
	    else if(c[i] == a[i]) cnt++;
	    else cnt += 2;
	}
    }

    co << cnt << en;
    
    return 0;
}



Measured memory_bytes: 256
S=list(input())
N=len(S)
def f(ary):
    n=len(ary)
    h=n//2
    A,B=ary[:h],ary[h:]
    if n%2!=0:
        B=ary[h+1:]
    for a,b in zip(A,reversed(B)):
        if a!=b: 
            print('No')
            exit()
f(S)
Sl=S[:(N-1)//2]
Sr=S[(N+3)//2-1:]
f(Sl)
f(Sr)

print('Yes')

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;



const int MX = 1e6 + 5, MOD = 998244353;
int N, inv[MX];
vi A;
ll freq[MX], ans[MX];

ll add(ll x, ll y) {
    x += y;
    while(x >= MOD)
        x -= MOD;
    while(x < 0)
        x += MOD;
    return x;
}

ll mul(ll x, ll y) {
    return (x * y) % MOD;
}

int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	inv[1] = 1;
	for(int i = 2; i < MX; ++i)
		inv[i] = (MOD - (MOD / i) * 1LL * inv[MOD % i] % MOD) % MOD;

	cin >> N;
	A.assign(N, 0);


	ll totAns = 0;

	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		++freq[A[i]];
		totAns = add(totAns, -A[i]);
	}

	db(totAns);

	for (int i = MX - 1; i >= 1; --i) {
		ll& sum = ans[i];
		for (int j = i; j < MX; j += i)
			sum = add(sum, mul(j, freq[j]));
		if (sum)
			db(i, sum);
		sum = mul(sum, sum);
		if (sum)
			db(sum);
		for (int j = 2 * i; j < MX; j += i)
			sum = add(sum, -ans[j]);
		if (sum)
			db(sum);
		totAns = add(totAns, mul(sum, inv[i]));
		if (sum)
			db(totAns);
	}

	cout << mul(totAns, inv[2]) << '\n';

	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


Measured memory_bytes: 20608
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########

n=int(input())
A=[list(map(int,input().split())) for i in range(n-1)]
for i in range(n):
    if i==n-1:print(0);exit()
    now=0
    for l in A[i:]:
        c,s,f =l 
        now=max(now,s)
        for plus in range(0,101):
            if (now+plus)% f==0:
                now+=plus
                break
        now+=c
    print(now)



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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    int idx = -1;
    int mx = 0;
    bool dup = false;
    REP(i, n) {
        cin >> a[i];
        if (a[i] > mx) {
            idx = i;
            mx = a[i];
            dup = false;
        } else if (a[i] == mx) {
            dup = true;
        }
    }
    sort(ALL(a));
    int sec = a[n - 2];

    REP(i, n) {
        if (dup) {
            cout << mx << endl;
        } else {
            if (idx == i) {
                cout << sec << endl;
            } else {
                cout << mx << endl;
            }
        }
    }
}


Measured memory_bytes: 2432
#include <iostream>
#include <queue>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reprv(i, n) for (int i = n - 1; i >= 0; i--)
#define ll long long
using namespace std;


int main() {
    ll n;

    cin >> n;

    // idx : 1 2 3 4 5 6 7 8  9 10 11 12 13
    // list: 2 3 4 5 6 7 8 9 10 11 12 13  1
    // mod:  1 2 3 4 5 6 7 8  9 10 11 12  0
    // 1 + 2 + 3 ... idx - 1 を求めればよい.
    // n * (n + 1) / 2

    ll res = (n - 1) * (n) / 2;

    cout << res << endl;


    return 0;
}


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

using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int x = c - a, y = d - b;

	cout << c - y << " " << d + x << " " << a - y << " " << b + x << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int isPrime(int x){
	int i;
	if(x <= 1)return 0;
	else if (x <= 3)return 1;

	if(x % 2 == 0)return 0;
	if(x % 3 == 0)return 0;

	for(i = 5 ; i*i <= x ;i += 6){
		if(x % i == 0)return 0;
		if(x % (i+2) == 0)return 0;
	}
	return 1;
}
 
int main(){
	int x,i,n;
	int count = 0;
	scanf("%d", &n);
	for(i = 0 ; i < n ; i++){
		scanf("%d", &x);
		if(isPrime(x))count++;
	}
	printf("%d\n", count);

	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007; 

using namespace std;
typedef long long lint;

template< class T = lint>
struct Edge {
	int from, to;
	T cost;
	Edge() {}
	Edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};

template< class T = lint>
vector<T> Bellman_Ford(vector<Edge<T>> &edges, int V, int st) {
	const T INF = numeric_limits<T>::max();
	vector<T> dist(V, INF);
	dist[st] = 0;
	for (int i = 0; i < V; i++) {
		for (const auto &ele : edges) {
			if (dist[ele.from] != INF && dist[ele.to] > dist[ele.from] + ele.cost) {
				dist[ele.to] = dist[ele.from] + ele.cost;

				if (i == V - 1) dist[ele.to] = -INF; // negative loop
			}
			if (i == V - 1) if (dist[ele.from] == -INF) dist[ele.to] = -INF;
		}
	}
	return dist;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M;
	cin >> N >> M;

	vector<Edge<lint>> edge(M);
	for (int i = 0; i < M; i++) cin >> edge[i].from >> edge[i].to >> edge[i].cost;
	for (auto &&elem : edge) {
		elem.from--;
		elem.to--;
		elem.cost *= -1;
	}

	vector<lint> ans = Bellman_Ford<lint>(edge, N, 0);
	
	if(ans[N - 1] == -numeric_limits<lint>::max()) cout << "inf";
	else cout << -ans[N - 1];

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    string t;
    cin >> t;
    string ss = t.substr(0, len(s));
    if (ss == s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3604
n, m = gets.split.map(&:to_i)

ss = Array.new(m) { [] }
m.times do |i|
  _, *s = gets.split.map(&:to_i)
  ss[i] = s
end
ps = gets.split.map(&:to_i)

ans = 0

(1 << n).times do |bit|
  valid = true

  m.times do |i|
    count = ss[i].count { |s| bit[s - 1] == 1 }

    if count % 2 != ps[i]
      valid = false
      break
    end
  end

  ans += 1 if valid
end

puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
 
using namespace std;

char maze[20][20];

int H, W;

queue<pair<int, int>> que;

int main()
{
  int i,j,k,l,m;
  string line;
  int col;
  int ret;
  int maxlen(int, int);

  cin >> H >> W;
  for (i=0; i<H; i++) {
    cin >> line;
    for (j=0; j<W; j++) {
      maze[i][j] = *(line.c_str()+j);
    }
  }

  ret=0;
  for (i=0; i<H; i++) {
    for (j=0; j<W; j++) {
      if (maze[i][j] == '#') continue;
      ret = max(ret, maxlen(i,j));
    }
  }
  printf("%d\n", ret-1);

  return 0;
}

int mmap[20][20];
int maxlen(int i, int j) { // �_(i, j)����ł������_�܂ł̋���
  int p,q;
  int mlen=0;
  void mmove();

  for (p=0; p<H; p++)
    for (q=0; q<W; q++)
      mmap[p][q] = 0;
  mmap[i][j] = 1;
  pair<int, int> pa;
  pa.first = i;
  pa.second = j;
  que.push(pa);
  mmove();
  for (p=0; p<H; p++)
    for (q=0; q<W; q++)
      if (maze[p][q] == '.')
        mlen = max(mlen, mmap[p][q]);
//printf("maxlen(%d, %d) = %d\n", i, j, mlen);
  return mlen;
}
void mmove() {  // �_(p,q)����C�ӂ̓_�Ɉړ����A(p,q)����̋������L�^����
  int l;
  pair<int, int> pa;
  int p,q;

//printf("que.size() = %d\n", que.size());
  while (que.empty() == false) {
    pa = que.front();
    que.pop();
    p = pa.first;
    q = pa.second;

//printf("mmap[%d][%d] = %d\n", p, q, mmap[p][q]);
    l = mmap[p][q]+1;
    if (p>0 && maze[p-1][q] == '.') { // ��ړ�
      if (mmap[p-1][q] == 0 || mmap[p-1][q]>l) {
        mmap[p-1][q] = l;
        pa.first = p-1;
        pa.second = q;
        que.push(pa);
      }
    }
    if (q>0 && maze[p][q-1] == '.') { // ���ړ�
      if (mmap[p][q-1] == 0 || mmap[p][q-1]>l) {
        mmap[p][q-1] = l;
        pa.first = p;
        pa.second = q-1;
        que.push(pa);
      }
    }
    if (p<H-1 && maze[p+1][q] == '.') { // ���ړ�
      if (mmap[p+1][q] == 0 || mmap[p+1][q]>l) {
        mmap[p+1][q] = l;
        pa.first = p+1;
        pa.second = q;
        que.push(pa);
      }
    }
    if (q<W-1 && maze[p][q+1] == '.') { // �E�ړ�
      if (mmap[p][q+1] == 0 || mmap[p][q+1]>l) {
        mmap[p][q+1] = l;
        pa.first = p;
        pa.second = q+1;
        que.push(pa);
      }
    }
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {
  int N;
  scanf("%d", &N);
  char S[N];
  scanf("%s", S);

  char alp[2]['z'+1];
  for (int i = 'a'; i <= 'z'; i++) alp[0][i] = -1;
  for (int i = 'a'; i <= 'z'; i++) alp[1][i] = -1;
  for (int i = 0; i < N; i++) {
    if (alp[0][S[i]] == -1) {
      alp[0][S[i]] = i;
    } else {
      alp[1][S[i]] = i;
    }
  }

  int max = 0;
  for (int i = 1; i < N-1; i++) {
    int cnt = 0;
    for (int j = 'a'; j <= 'z'; j++) {
      if (alp[0][j] >= 0 && alp[0][j] < i && alp[1][j] >= i) {
        cnt++;
      }
    }
    if (cnt > max) max = cnt;
  }
  printf("%d\n", max);

  return 0;
}

Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870
struct pig
{
    int x,y;
}info[200100];
int cnt,n,a[200100],c[200100],xo,xt,yo,yt,len,num;
double ans;
bool cmp1(pig a,pig b)
{
    return a.y < b.y;
}
bool cmp(pig a,pig b)
{
    if(a.x == b.x)return a.y > b.y;
    return yo < yt ? a.x < b.x : a.x > b.x;
}
int main()
{
    scanf("%d%d%d%d",&xo,&yo,&xt,&yt);if(xt < xo)swap(xo,xt),swap(yo,yt);
    scanf("%d",&n);
    for(int i = 1;i <= n;i++)scanf("%d%d",&info[i].x,&info[i].y);
    sort(info + 1,info + 1 + n,cmp);
    len=0;  c[0]=-0x7fffffff;
    for(int i = 1;i <= n;i++)
    {
        if(info[i].x > max(xt,xo) || info[i].y > max(yt,yo) || info[i].y < min(yo,yt) || info[i].x < min(xo,xt))continue;
        int tmp;
        if(info[i].y>c[len]) tmp = ++len;
        else tmp = lower_bound(c + 1,c + 1 + len,info[i].y) - c;
        c[tmp]=info[i].y;
    }
    ans = (double)(abs(xt - xo) + abs(yt - yo)) * 100 - (20 - 5 * pi) * len;
    if(len == min(abs(xt - xo),abs(yt - yo)) + 1)ans += 5 * pi;
    printf("%.15lf\n",ans);
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <functional>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, x, y, a, b, c, ans = 0;
  scanf("%lld%lld%lld%lld%lld", &x, &y, &a, &b, &c);
  ll p[a], q[b], r[c];
  for(i = 0; i < a; ++i) scanf("%lld", &p[i]);
  for(i = 0; i < b; ++i) scanf("%lld", &q[i]);
  for(i = 0; i < c; ++i) scanf("%lld", &r[i]);
  sort(p, p + a, greater<ll>()), sort(q, q + b, greater<ll>()), sort(r, r + c,greater<ll>());
  vector<ll> v;
  for(i = 0; i < x; ++i) v.push_back(p[i]);
  for(i = 0; i < y; ++i) v.push_back(q[i]);
  sort(v.begin(), v.end());
  if(x + y < c) c = x + y;
  for(i = 0; i < c; ++i) if(v[i] < r[i]) v[i] = r[i];
  for(i = 0; i < x + y; ++i) ans += v[i];
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 4724
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
#include <queue>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n, a, b;
    cin >> n >> a >> b;
    int x = abs(a-b);
    string ans;
    if (x%2==0) ans = "Alice";
    else ans = "Borys";
    cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    S = input()
    T = input()

    ls = len(S)
    if S == T[:ls]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 8872
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int P = 1e9 + 7;
int pot(int a,int w){
  int r = 1;
  while(w){
    if(w & 1){
      r = r * a % P;
    }
    w/=2;
    a = a * a % P;
  }
  return r;
}
const int MAX = 1e6;
int dp[MAX];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int sum = 0;
  int n;
  cin >> n;
  for(int i = 1; i <= n;i++){
    dp[i] = (sum * pot(i,P-2) + 1) % P;
    sum += dp[i];
    sum %= P;
    debug(dp[i]);
  }
  int res = 0;
  R(i,n){
    int pom;
    cin >> pom;
    res += (dp[i+1] + dp[n-i] - 1) * pom % P;
  }
  res = (res % P + P) % P;
  R(i,n){
    res = res * (i + 1) % P;
  }
  cout << res << "\n";
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cstdint>
#include<unordered_map>
#include<sstream>
#include<boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P& element1, const P& element2)
{//first昇順
	return element1.first < element2.first;
}
bool ps2(const P& element1, const P& element2)
{//first降順
	return element1.first > element2.first;
}
bool ps3(const P& element1, const P& element2)
{//second昇順
	return element1.second < element2.second;
}
bool ps4(const P& element1, const P& element2)
{//second降順
	return element1.second > element2.second;
}

ll combination(ll n, ll r) {
	if (r * 2 > n) r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}

int main() {
	
	int n;
	cin >> n;
	map<ll, ll>alre;
	vector<ll>a(n);
	int count = 0;
	deque<ll>kouho;
	rep(i, n) {
		cin >> a[i];
		if (alre[a[i]] == 0) {
			kouho.push_back(a[i]);
		}
		alre[a[i]]++;
	}
	sort(all(kouho));
	count = kouho.size();
	if (count == 3) {
		bool ans = false;
		ll m = kouho[0] xor kouho[1];
		if (m == kouho[2]) {
			vector<ll>v(3);
			v[0] = alre[kouho[0]];
			v[1] = alre[kouho[1]];
			v[2] = alre[kouho[2]];
			if (v[0] == v[1] && v[2] == v[1]) {
				ans=true;
			}
		}
		if (ans) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else if (count == 2) {
		bool ans = false;
		ll m = kouho[0] xor kouho[1];
		if (m == kouho[0] or m==kouho[1]) {
			vector<ll>v(2);
			v[0] = alre[kouho[0]];
			v[1] = alre[kouho[1]];
			if (v[0]*2 == v[1]&& kouho[0]==0) {
				ans = true;
			}
			else if (v[0] == v[1]) {
				ans = true;
			}
		}
		if (ans) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else if (count == 1) {
		if (kouho[0] == 0) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 6272
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int n,i,j,flg;
	flg=0;
	cin>>n;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(4*i+7*j==n){
				flg=1;
			}
		}
	}
	if(flg==1){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
///******* In the name of Allah *******///

#include <bits/stdc++.h>
using namespace std;

//long int ar[10013];
//long int gcd(long int a, long int b)
//{
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//long int sieve(long long int a)
//{
//    long long int i,j,k = 0;
//    memset(ar,0,sizeof(ar));
//    ar[1] = 1;
//    for(i=2; i<=713; i++)
//    {
//        if(ar[i]==0)
//        {
//            for(j=i+i; j<=713; j+=i)
//            {
//                ar[j] = 1;
//            }
//        }
//    }
//    return ar[a];
//}

void Ok()
{
    long int a,b,c,d,e,h,t,i,j,k,l,m,n;
    long int ans_1,ans_2,ans_3,ans_4,cnt = 0,Max,Min,flag,temp,sum = 0;
    double aa,bb,cc,dd,ee,ff,gg;
    char aaa[113],bbb[113],ccc,ddd;
    string spc,in,store[13];

    cin>>a;
    ans_1 = a%10;
    if(ans_1==2 || ans_1==4 || ans_1==7 || ans_1==9 || ans_1==5)
        cout<<"hon"<<endl;
    else if(ans_1==0 || ans_1==1 || ans_1==6 || ans_1==8)
        cout<<"pon"<<endl;
    else if(ans_1==3)
        cout<<"bon"<<endl;


    return;
}

int main()
{
    Ok();

    return 0;
}


Measured memory_bytes: 3600