akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

vector<bool> seen;
vector<vector<int>> edge(100, vector<int>(100, -1));
vector<int> ord;
vector<int> low;
void dfs(const Graph &G, int v, int& k){
    seen[v] = true;
    ord[v] = k;
    k++;
    low[v] = ord[v];
    for (auto next_v : G[v])
    {
        if(!seen[next_v]){
            edge[v][next_v] = 1;
            edge[next_v][v] = 1;
            dfs(G, next_v, k);
            low[v] = min(low[v], low[next_v]);
        }
        else if(edge[v][next_v] != 1) low[v] = min(low[v], ord[next_v]);
    }
}


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

    Graph G(N);
    for (int i = 0; i < M; i++)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    int k = 0;
    seen.assign(N, false);
    ord.resize(N, 1000);
    low.resize(N);
    dfs(G, 0, k);

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < G[i].size(); j++)
        {
            if(ord[i] < low[G[i][j]]) ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=105;
int lx[N],ly[N],rx[N],ry[N];
int n,m,x[N],y[N],p[N*4],cnt[N*4];
ll dis[N*4],v[N],ans;
int vis[N*4],q[N*N*4];
int S,T,from[N*4];
char tp[N*4][5];
struct edge{
	int from,to,next,f;
	ll v;
}e[N*N*N];
int head[N*4],tot;
void add(int x,int y,int f,ll v){
	e[++tot]=(edge){x,y,head[x],f,v};
	head[x]=tot;
	e[++tot]=(edge){y,x,head[y],0,-v};
	head[y]=tot;
}
bool bfs(ll &sum){
	For(i,1,T)
		dis[i]=-(1ll<<60),vis[i]=0;
	int h=0,t=1;
	q[1]=S; dis[S]=0;
	while (h!=t){
		int x=q[++h]; vis[x]=0;
		for (int i=head[x];i;i=e[i].next)
			if (dis[e[i].to]<dis[x]+e[i].v&&e[i].f){
				dis[e[i].to]=dis[x]+e[i].v;
				from[e[i].to]=i;
				if (!vis[e[i].to]){
					vis[e[i].to]=1;
					q[++t]=e[i].to;
				}
			}
	}
	if (dis[T]==-(1ll<<60)) return 0;
	sum+=dis[T];
	for (int i=from[T];i;i=from[e[i].from])
		e[i].f--,e[i^1].f++;
	return 1;
}
void update(int k){
	memset(head,0,sizeof(head));
	tot=1;
	For(i,1,k){
		lx[i]=ly[i]=1;
		rx[i]=ry[i]=N-1;
	}
	For(i,1,m){
		if (cnt[i]>k) continue;
		if (tp[i][1]=='L') lx[cnt[i]+1]=max(lx[cnt[i]+1],p[i]+1);
		if (tp[i][1]=='R') rx[k-cnt[i]]=min(rx[k-cnt[i]],p[i]-1);
		if (tp[i][1]=='D') ly[cnt[i]+1]=max(ly[cnt[i]+1],p[i]+1);
		if (tp[i][1]=='U') ry[k-cnt[i]]=min(ry[k-cnt[i]],p[i]-1);
	}
	For(i,2,k){
		lx[i]=max(lx[i],lx[i-1]);
		ly[i]=max(ly[i],ly[i-1]);
	}
	Rep(i,k-1,1){
		rx[i]=min(rx[i],rx[i+1]);
		ry[i]=min(ry[i],ry[i+1]);
	}
	S=2*N+2*k+1; T=S+1;
	For(i,1,k){
		add(S,i,1,0);
		add(i+2*N+k,T,1,0);
		For(j,lx[i],rx[i]) add(i,j+k,1,0);
		For(j,ly[i],ry[i]) add(j+N+k,i+2*N+k,1,0);
	}
	For(i,1,n)
		add(x[i]+k,y[i]+k+N,1,v[i]);
	ll sum=0;
	For(i,1,k)
		if (!bfs(sum))
			return;
	ans=max(ans,sum);
}
int main(){
	scanf("%d",&n);
	For(i,1,n) scanf("%d%d%lld",&x[i],&y[i],&v[i]);
	scanf("%d",&m);
	For(i,1,m) scanf("%s%d%d",tp[i]+1,&p[i],&cnt[i]);
	For(i,1,n) update(i);
	printf("%lld\n",ans);
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;

    vector<string> c(h);
    for (int i = 0; i < h; i++) {
        cin >> c[i];
    }

    for (int i = 0; i < 2 * h; i++) {
        cout << c[i / 2] << endl;
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(Type, ...)  Type __VA_ARGS__; input(__VA_ARGS__)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
inline i64  sigma(i64 n)            { return (n * (n + 1) >> 1); }
inline i64  updiv(i64 a, i64 b)     { return (a + b - 1) / b; }
inline i64  sqr(i64 n)              { return n * n; }
inline string to_string(char c)     { return string(1, c); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}
template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void input() {}
template <class Head, class... Tail>
inline void input(Head &head, Tail&... tail) { cin >> head; input(tail...); }

inline void print() { cout << "\n"; }
template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}

template <typename Func>
struct FixPoint : Func {
    inline constexpr FixPoint(Func &&f) noexcept : Func(forward<Func>(f)) {}

    template <typename... Args>
    inline decltype(auto) operator()(Args &&... args) const {
        return Func::operator()(*this, forward<Args>(args)...);
    }
};

template< typename Func >
inline decltype(auto) makeFixPoint(Func &&f) {
    return FixPoint< Func >{forward< Func >(f)};
}
// }}} End Header

signed main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr);

    var(string, t);
    if (t == "SUN") print(7);
    if (t == "MON") print(6);
    if (t == "TUE") print(5);
    if (t == "WED") print(4);
    if (t == "THU") print(3);
    if (t == "FRI") print(2);
    if (t == "SAT") print(1);

    return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,P,*A = map(int,read().split())

od,ev = 0,1
for x in A:
    if x & 1:
        od,ev = od+ev,od+ev
    else:
        od,ev = od+od,ev+ev

answer = od if P else ev
print(answer)

Measured memory_bytes: 3060
import math
import fractions

N = int(input())
A = list(map(int, input().split()))

L = [0 for _ in range(N)]
L[0] = A[0]
for i in range(1,N):
    L[i] = fractions.gcd(L[i-1], A[i])

R = [0 for _ in range(N)]
R[N-1] = A[N-1]
for i in range(N-2, -1, -1):
    R[i] = fractions.gcd(R[i+1], A[i])

GCD = [0 for _ in range(N)]

GCD[0] = R[1]
GCD[N-1] = L[N-2]
for i in range(1,N-1):
    GCD[i] = fractions.gcd(L[i-1],R[i+1])

print(max(GCD))



Measured memory_bytes: 16152
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
#define se second
#define fi first
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971
#define MAX 9223372036854775807
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
//	cout<<fixed<<setprecision(10);
	ll x,xx,y,yy;
	cin>>x>>xx>>y>>yy;
	ll x1,y1;
	x1=(y+xx-1)/xx;
	y1=(x+yy-1)/yy;
	if(x1<=y1)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}

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


int main()
{
    int n;
    cin>>n;
    ll a[n];
    ll sum =0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum += a[i];
    }
    ll curr =0;
    ll ans =LLONG_MAX;
    for(int i=0;i<n;i++)
    {
        curr += a[i];
        ans = min( ans , abs(sum - 2*curr ) );
    }
    cout<<ans;
}

Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
#define oo 666666666
#define ll long long
#define ld long double

vector<vector<ll>>Mul(vector<vector<ll>>A, vector<vector<ll>>B, ll mod)
{
    int n = A.size();
    vector<vector<ll>>ats(n,vector<ll>(n));
        for(int i=0; i<n; i++)
        for(int j=0; j<n; j++)
        for(int k=0; k<n; k++)
        ats[i][j] = (ats[i][j] + A[i][k]*B[k][j])%mod;

    return ats;
}

vector<vector<ll>>Pow(vector<vector<ll>>A, ll n, ll mod)
{
    if(n<=1)return A;
    if(n&1)return Mul(A,Pow(A,n-1,mod),mod);
    return Pow(Mul(A,A,mod),n/2,mod);
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n,k,mod=1e9+7;
    cin>>n>>k;
    vector<vector<ll>>A(n,vector<ll>(n));
    for(auto&r:A)for(auto&c:r)cin>>c;
    A = Pow(A,k,mod);
    ll ats = 0;
    for(auto&r:A)for(auto&c:r)ats = (ats + c) % mod;

    cout<<ats;
}


Measured memory_bytes: 5376
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#endif
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int n,a[3005];
vector<int>g[3005];
int dp[3005];
void dfs(int x,int par){
	dp[x]=0;
	for(auto to:g[x]){
		if(to!=par){
			dfs(to,x);
			if(a[x]>a[to]&&!dp[to]){
				dp[x]=1;
			}
		}
	}
}
bool check(int x){dfs(x,-1);return dp[x];}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<n;i++){
		int x,y;cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	for(int i=1;i<=n;i++){
		if(check(i))cout<<i<<" ";
	}
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;cin>>n;
  rep(i,n){
    bool out=true;
    vector<int>a(1,0);
    vector<int>b(1,0);
    rep(j,10){
      int in;cin>>in;
      if(a[a.size()-1]<in)a.pb(in);
      else if(b[b.size()-1]<in)b.pb(in);
      else out=false;
    }
    if(out)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }

}

Measured memory_bytes: 1208
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        a: usize,
        b: usize,
        x: usize,
    }

    if a+b>=x {
        if a>x {
            println!("NO");
            return;
        }
        println!("YES");
    } else {
        println!("NO");
    }

}


Measured memory_bytes: 2124
n = int(input())

d = {'AC':0,'WA':0,'TLE':0,'RE':0}

for i in range(n):

    s = input()

    d[s] += 1

print('AC x',d['AC'])
print('WA x',d['WA'])
print('TLE x',d['TLE'])
print('RE x',d['RE'])

Measured memory_bytes: 9196
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

const int Maxn = (int)1e5;

int main() {
    int n, k, s = 0;
    cin >> n >> k;
    map<int, int> mp;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        if (mp[a] == 0) ++s;
        ++mp[a];
    }

    vector<int> v;
    for(auto i : mp) v.emplace_back(i.second);
    sort(v.begin(), v.end());

    int ans = 0;
    for (int i = 0; i < s - k; ++i) {
        ans += v[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 10748
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		ArrayList<String> shuff= new ArrayList<String>();
		int w,n,tmp;
		int shuf_num[] =new int[2];
		String buf[]=new String[2];
		w=in.nextInt();
		n=in.nextInt();
		int a[]=new int[w];
		for (int i=0;i<w;i++) {
			a[i] = i+1;
		}
		for(int i=0;i<n;i++){
			buf =(in.next()).split(",",0);
			shuf_num[0]=Integer.parseInt(buf[0])-1;
			shuf_num[1]=Integer.parseInt(buf[1])-1;
			tmp=a[shuf_num[0]];
			a[shuf_num[0]]=a[shuf_num[1]];
			a[shuf_num[1]]=tmp;
		}
		for (int i=0;i<w;i++) {
				System.out.printf("%d%n",a[i]);
		}
	}
}

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

int main() {
  long long N, cnt=0;
  cin >> N;
  vector<long> A(N), B(N+1,0);
  rep(i, N){
    cin >> A.at(i);
    B.at(A.at(i))++;
  }
  rep(i, N+1) cnt+=B.at(i)*(B.at(i)-1)/2;
  rep(i, N) cout << cnt-B.at(A.at(i))+1 << endl;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j,k,x,y,ans,curr,temp;
    scanf("%d",&n);
    double rose = 0;
    while(n--)
    {
        double val;
        string a;
        cin >> val >> a;
        if(a[0] == 'J')
        {
            rose += val;
        }
        else
        {
            rose += (val*380000);
        }
    }
    printf("%.12f\n",rose);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	long long H, N;
	cin >> H >> N;
	vector<long long>A(N);
	long long sum = 0;
	for (long long i = 0; i < N; i++) {
		cin >> A.at(i);
		sum += A.at(i);
	}
	if (H <= sum) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 1024
import math

A, B, H, M = list(map(int, input().split()))

hTheta = math.pi * (60 * H + M) / 360
mTheta = math.pi * M / 30

delta = hTheta - mTheta

print(math.sqrt(A**2+B**2 - 2*A*B*math.cos(delta)))


Measured memory_bytes: 9496
from sys import stdin


def main():
    _ = int(input())
    a_lists = [int(x) for x in stdin.readline().rstrip().split()]
    z = 0

    for a in a_lists:
        z ^= a

    if z == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

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

using namespace std;

#define ll long long
#define fi first
#define se second

void test_case(){
	string s;
	cin>>s;
	int n=s.size();
	for(int i=0;i<n;i++){
		if(s[i]!=s[n-1-i]){
			cout<<"No\n";
			return ;
		}
	}
	for(int i=0;i<n/2;i++){
		if(s[i]!=s[n/2-1-i]){
			cout<<"No\n";
			return ;
		}
	}
	for(int i=n/2+1;i<n;i++){
		if(s[i]!=s[n-1-i]){
			cout<<"No\n";
			return ;
		}
	}
	cout<<"Yes\n";
}

int main(){
	int t=1;
	//cin>>t;
	while(t--)test_case();
}


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

using namespace std;
using ll = long long;

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

  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    if (i % 2 == 1 && a % 2 == 1)
      ans++;
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

template<class T>
struct CumulativeSum {
  vector<T> v;

  CumulativeSum(size_t n) : v(n+1) {};
  CumulativeSum(vector<T> v_) : v(v_) {
    v.push_back(T());
  };

  void add(size_t i, T x) {
    v[i] += x;
  }

  // O(N)
  void build() {
    for (size_t i = v.size()-1; i > 0; i--)
      v[i-1] += v[i];
  }

  // O(1) sum [l, r]
  T sum(size_t l, size_t r) const {
    return v[l]-v[r+1];
  }

  // O(1) sum [0, r]
  T sum(size_t r) const {
    return sum(0, r);
  }
};

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

  ll n, k;
  cin >> n >> k;
  vl a(n);
  rep(i, n) cin >> a[i];
  CumulativeSum<ll> cs(a);
  cs.build();

  vl sum;
  rep(i, n) {
    for (ll j = i; j < n; j++) {
      sum.push_back(cs.sum(i, j));
    }
  }
  ll m = sum.size();

  ll ans = 0;
  bitset<1'000'000> bs;
  bs.flip();
  for (ll i = 40; i >= 0; i--) {
    ll cnt = 0;
    rep(j, m) {
      if (bs[j] && (sum[j] >> i & 1LL)) cnt++;
    }
    //cerr << cnt << endl;

    if (cnt >= k) {
      rep(j, m) {
        if (bs[j] && !(sum[j] >> i & 1LL)) {
          bs.reset(j);
        }
      }
      ans |= 1LL << i;
    }
  }

  cout << ans << endl;
}



Measured memory_bytes: 6524
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define ll long long int

ll mod=1e9+7;

int main(){
    int n;
    cin>>n;
    vector<double> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    vector<vector<double>> dp(n+1,vector<double> (n+1));
    for(int i=0;i<=n;i++)dp[i][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=i;j++){
            dp[i][j]=dp[i-1][j]*(1-a[i-1])+(dp[i-1][j-1]*a[i-1]);
        }
    }
    int thrs=(n/2)+1;
    cout<<setprecision(100)<<dp[n][thrs]<<"\n";
    return 0;
}

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


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

   else if(S.at(0) == S.at(1) && S.at(2) ==S.at(3)){
     cout << "Yes" << endl;
   }
   else if(S.at(0) == S.at(2) && S.at(1) ==S.at(3)){
     cout << "Yes" << endl;
   }
   else if(S.at(0) == S.at(3) && S.at(1) ==S.at(2)){
     cout << "Yes" << endl;
   }
  else {
    cout << "No" << endl;
  }
  
  
  return 0;
}



Measured memory_bytes: 3600
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int D = sc.nextInt();
        int x = sc.nextInt();
        sc.close();
        for (int i = 0; i < 10; i++) {
            x = r * x - D;
            System.out.println(x);
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)
const ll INF = (1LL << 50);
using Edge = pair<int, int>;//頂点,重み
using Graph = vector<vector<Edge>>;
int N;
Graph G;

vector<int>ans;

void dfs(int v, int p, int c) {
	ans[v] = c;//cで塗る
	for (auto e : G[v]) {
		if (e.first == p) continue;
		if (e.second & 1) dfs(e.first, v, 1 - c);//重みが奇数ならば、現在の頂点につながっている頂点を異なる色で塗る
		else dfs(e.first, v, c);//重みが偶数ならば、現在の頂点と同じ色で塗る
	}
}



int main() {

	cin >> N;

	G.assign(N, vector<Edge>());

	for (int i = 0; i < N - 1; i++) {
		int u, v, w;
		cin >> u >> v >> w;
		u--; v--;
		G[u].push_back(Edge(v, w));
		G[v].push_back(Edge(u, w));
	}

	ans.assign(N, 0);
	dfs(0, -1, 1);

	for (auto v : ans) cout << v << endl;

	return 0;

}

Measured memory_bytes: 8960
import sys
N = int(input())
L = list(map(int, input().split()))
if N <= 2:
    print(0)
    sys.exit()
L.sort()
ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] + L[j] > L[k]:
                if L[i] != L[j] and L[i] != L[k] and L[j] != L[k]:
                    ans += 1
print(ans)

Measured memory_bytes: 67992
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;



int main(){
    int n,q,a;
    vector<int> S;
    vector<int> T;
    cin >> n;
    for (int i = 0; i < n ; ++i) {
        cin >> a;
        S.push_back(a);
    }
    cin >> q;
    for (int i = 0; i < q ; ++i) {
        cin >> a;
        T.push_back(a);
    }

    int count = 0;
    for (int i = 0; i < q ; ++i) {
        if(binary_search(S.begin(),S.end(),T[i])){
         count ++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1800
#include<bits/stdc++.h>
using namespace std;
int main() {
	int  N, M; cin >> N >> M;
	int C; cin>>C;
	int B[M];
	for (int i = 0; i < M; i++) cin >> B[i];
	int ans = 0;
	for (int i = 0; i < N; i++) {
		int temp=0;
		int A[M];
		for (int i = 0; i < M; i++) {
			cin >> A[i];
			temp += A[i] * B[i];
		}
		temp += C;
		if (temp > 0) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ii=pair<ll,ll>;
using vi=vector<ll>;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (ll)1e18
#define all(x) (x).begin(),(x).end()
#define print(a); for(auto x:a)cout<<x<<" "; cout<<"\n";
#define mset(a); memset(a,0,sizeof(a));

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
    ll n,k;cin>>n>>k;
    string s;cin>>s;
    ll cnt=0;
    for(int i=0;i<n-1;i++)if(s[i]!=s[i+1])cnt++;
    cout<<n-1-max(cnt-2*k,0ll)<<"\n";
}


Measured memory_bytes: 512
int main(void){
    char c;
    scanf("%c", &c);
    if(c == 'a' || 
       c == 'i' ||
       c == 'u' ||
       c == 'e' ||
       c == 'o') printf("vowel\n");
    else printf("consonant\n");
    
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int ans=INT_MAX;
    for(int i=0;i<s.size();i++)
    {
        int c=0;
        for(int j=0;j<t.size();j++)
        {
            if(i+j>=s.size())
            {
                c=INT_MAX;
                break;
            }
            if((i+j)<s.size()&&s[i+j]!=t[j])
                c++;
        }
        ans=min(ans,c);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
S = input()
l = len(S) // 2
ll = l // 2
former = S[:l]
latter = S[l+1:]

for i in range(l):
  if S[i] != S[-i-1]:
    print("No")
    break
else:
  for i in range(ll):
    if former[i] != former[-i-1] or latter[i] != latter[-i-1]:
      print("No")
      break
  else:
    print("Yes")

Measured memory_bytes: 9136
import collections

N = int(input())
cs = list(input())


count_R = cs.count("R")
count_W = cs.count("W")

W_check = cs[: count_R]
R_check = cs[count_R:]

#print(W_check, R_check)

print(min(W_check.count("W"), R_check.count("R")))

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

int main(){
  int a,b;
  cin >> a >> b;
  
  int x=0;
  if (a>=b){
    for (int i=0 ; i<a ; i++){
      x += b*std::pow(10, i);
    }
    cout << x << endl;
  }
  else if (b>=a){
    for (int i=0 ; i<b ; i++){
      x += a*std::pow(10, i);
    }
    cout << x << endl;
  }
  else {
    for (int i=0 ; i<a ; i++){
      x += a*std::pow(10, i);
    }
    cout << x << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        boolean ns = true;
        if (0 <= s.indexOf("N") || 0 <= s.indexOf("S")) {
            ns = (0 <= s.indexOf("N") && 0 <= s.indexOf("S"));
        }
        boolean ew = true;
        if (0 <= s.indexOf("E") || 0 <= s.indexOf("W")) {
            ew = (0 <= s.indexOf("E") && 0 <= s.indexOf("W"));
        }
        String result = ns && ew ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 23380
n=int(input())
l=list(map(int,input().split()))
count1=0
count2=0
sum1,sum2=0,0
now=1#一致させたい符号
for i in range(n):#第一項は正の時
  sum1+=l[i]
  if sum1*now>0:
    pass
  else:
    count1+=abs(now-sum1)
    sum1=now
  now*=-1
now=-1
for i in range(n):#第一項はhuの時
  sum2+=l[i]
  if sum2*now>0:
    pass
  else:
    count2+=abs(now-sum2)
    sum2=now
  now*=-1
print(min(count1,count2))

Measured memory_bytes: 14468
#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define FORD(i, a, b) for (int i=(a); i>(b); i--)
#define PPC(x) __builtin_popcountll(x)
#define MSB(x) (31 - __builtin_clz(x))
#define SZ(x) ((int)(x).size())
#define BACK(x) prev((x).end())
#define HASK(x, y) ((x).find(y) != (x).end())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
 
const int maxN = 53, maxM = 20;

vector <pair <int, int> > G[maxN];
long long pats[maxN][maxN], subg[1 << maxM];

void dfs(int v, int fat, int r)
{
	for (auto [u, e] : G[v]) if (u != fat)
	{
		pats[r][u] = pats[r][v] | 1ll<<e;
		dfs(u, v, r);
	}
}

void solve()
{
	int n;
	scanf ("%d", &n);
	FOR(i, 0, n-1)
	{
		int a, b;
		scanf ("%d%d", &a, &b);
		G[a].pb({b, i});
		G[b].pb({a, i});
	}
	
	FOR(v, 1, n+1)
		dfs(v, v, v);
		
	int q;
	scanf ("%d", &q);
	vector <pair <int, int> > Q(q);
	FOR(i, 0, q)
		scanf ("%d%d", &Q[i].ft, &Q[i].sd);
		
	__int128 res = 0;
		
	FOR(m, 1, 1<<q)
	{
		int i = __builtin_ctz(m);
		subg[m] = subg[m ^ (1<<i)];
		int a, b; tie(a, b) = Q[i];
		subg[m] |= pats[a][b];
		
		long long dx = 1ll << (n-1-PPC(subg[m]));
		if (PPC(m) % 2 == 0)
			dx *= -1ll;
		res += dx;
	}
	
	res = (1ll << n-1) - res;
	printf("%lld\n", res);
}
 
int main()
{
	int t = 1;
	//scanf ("%d", &t);
	FOR(tid, 1, t+1)
	{
		//printf("Case #%d: ", tid);
		solve();
	}
	return 0;
}





Measured memory_bytes: 12004
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

bef=a[0]-1
man=b[bef]

for i in a[1:]:
  ind=i-1
  if ind==bef+1:
    man+=c[bef]
  man+=b[ind]
  bef=ind
print(man)


Measured memory_bytes: 9092
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define P pair<int,int>
const LL inf = 0x3f3f3f3f;
const LL mod = 1e9+7;
const LL N = 1e5+10;
template <typename tp> inline void read(tp &x)
{
	x=0;char c=getchar();int f=0;
	for(;c>'9'||c<'0';f|=(c=='-'),c=getchar());
	for(;c<='9'&&c>='0';x=(x<<3)+(x<<1)+c-'0',c=getchar());
	if(f) x=-x;
}
int n,ans;
P x[N];
signed main()
{
	read(n);
	for(int i=1;i<=n;i++)  read(x[i].first),x[i].second=i;
	sort(x+1,x+n+1);
	for(int i=1;i<=n;i++) if(i%2!=x[i].second%2) ans++;
	printf("%d\n",ans/2);
	return 0;
}

Measured memory_bytes: 1024
x = int(input())

n_11 = x // 11

x_tmp = x % 11

if x_tmp > 6:
    ans = 2 * n_11 + 2
elif x_tmp > 0:
    ans = 2 * n_11 + 1
else:
    ans = 2 * n_11

print(ans)


Measured memory_bytes: 2940
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort((x).rbegin(),(x).rend())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
template<class T>bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
// clang-format on

void solve(long long N, std::vector<long long> A) {
  vector<ll> ans(N + 1);
  rep(i, N) ans[A[i]]++;
  rep1(i, N) ANS(ans[i]);
}

// clang-format off
int main() {
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N-2+1);
  for(int i = 0 ; i < N-2+1 ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


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

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N,K; cin >> N >> K;
    VI h(N); REP(i,N) cin >> h[i];
    SORT(h);
    int ans = INT_INF;
    REP(i,N-K+1){
        chmin(ans, h[i+K-1]-h[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getval(_T& a) {
	std::cin >> a;
}
template<class _T> static void getval(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getval(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	int N;
	getval(N);

	std::vector<LLONG> ai(3 * N);
	for (int i = 0; i < 3 * N; i++) {
		getval(ai[i]);
	}
	std::sort(ai.begin(), ai.end(), std::greater<LLONG>());

	LLONG ans = 0;
	for (int i = 0; i < 2 * N; i++) {
		if (i % 2) ans += ai[i];
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 5632
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<int ,int> P;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W, d; cin >> H >> W >> d;
  FOR(i,0,H) {
    FOR(j,0,W) {
      int x = ((i + j) / d) % 2;
      int y = ((i - j + W) / d) % 2;
      cout << (x==0?(y==0?'R':'Y'):(y==0?'G':'B'));
    }
    cout << '\n';
  }
  return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
// #define LOCAL
const int MAXN=1e6+10;
const ll MOD=0;
ll _gcd(ll a,ll b){if(b==0)return a;return _gcd(b,a%b);}
ll gcd(ll a,ll b){a=abs(a),b=abs(b);if(a<b)swap(a,b);return _gcd(a,b);}
ll qpow(ll a,ll n){ll rt=1;while(n){if(n&1)rt=(rt*a)%MOD;a=a*a%MOD;n>>=1;}return rt;}
ll factor[MAXN];
void cal_factor(){factor[0]=1;for(int u=1;u<MAXN;u++){factor[u]=(factor[u-1]*u)%MOD;}}
ll C(ll n,ll k){return factor[n]*qpow(factor[n-k],MOD-2)%MOD*qpow(factor[k],MOD-2)%MOD;}
int illegal[MAXN];
const int MAXA=2e5+10;
int N;
int A[MAXA];
unordered_map<int,int>cnt;
void solve()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N;
    for(int u=1;u<=N;u++){
        cin>>A[u];
        cnt[A[u]]++;
        if(cnt[A[u]]>1)illegal[A[u]]=1;
        else {
            for(int k=A[u]+A[u];k<MAXN;k+=A[u])
                illegal[k]=1;
        }
    }
    int ans=0;
    for(int u=1;u<=N;u++){
        if(illegal[A[u]]==0)ans++;
    }
    cout<<ans;
}
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    solve();
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template<typename T>
ostream& operator << (ostream& os, vector<T> v)
{
  os << "(";
  each (i, v) os << i << ",";
  os << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  while (cin >> n >> m) {
    vector<lli> a(n);
    each (i, a) cin >> i;
    map<lli, lli> cnt;
    lli x = 0;
    each (i, a) {
      x += i;
      x %= m;
      ++cnt[x];
    }
    lli sum = cnt[0];
    each (i, cnt) {
      sum += i.second * (i.second - 1) / 2;
    }
    cout << sum << endl;
  }

  return 0;
}


Measured memory_bytes: 4992
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		sc.close();
		int ans = (int)(X/500)*1000;
		ans += ((X%500)-(X%5));
		System.out.println(ans);
	}
}


Measured memory_bytes: 35692
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define ss second
#define ff first
#define INF 30000000000001
#define ll_max 9000000000000000001
#define mod 1000000007
#define PI 3.14159265358979323846L
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll;
const ll N = 10001;
const ll M = 1;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, x = 0, y, ans = 0, k;
        cin >> n;
        ll a[n + 1], dp[n + 1] = {};
        a[0] = INF;
        for(int i = 1; i <= n; i++) cin >> a[i];
        for(int i = 2; i <= n; i++)
        {
            dp[i] = min(dp[i - 1] + abs(a[i - 1] - a[i]), dp[i - 2] + abs(a[i - 2] - a[i]));
        }
        cout << dp[n] << "\n";
    }
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
#include <algorithm>
#include <functional>
//#include<stdlib.h>
using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	cout <<((k!=1)?( n - k):(0));
	return 0;
}

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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(10);
    /*start*/
    int n;
    cin >> n;
    set<ll> a;
    rep(i, n)
    {
        int b;
        cin >> b;
        if (a.count(b))
        {
            a.erase(b);
        }
        else
        {
            a.insert(b);
        }
    }
    c(a.size());
    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    int a[21], b[21];
    int n, m, c; cin >> n >> m >> c;
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int sum = c;
        for (int j = 0; j < m; j++) {
            int tmp; cin >> tmp;
            sum += b[j] * tmp;
        }
        
        if (sum > 0) cnt++;
    }
    
    cout << cnt << '\n';
    
    return 0;
}


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

int main() {
  string S , T ; 
 
  
  cin >> S >> T ;
 

 
  
  T.pop_back() ; 
    
  if (S != T){
    cout << "No" << endl ; 

    
      }
  else{
  
    cout << "Yes" << endl ; 
  }
  
  
}


Measured memory_bytes: 3604
def main():
  N,K= map(int,input().split())
  h = list(map(int,input().split()))
  dp = [-1]*N
  dp[0] = 0
  dp[1] = abs(h[0] - h[1])
  for i in range(2,N):
    tmp = i - K
    if tmp < 0: tmp = 0
    cost_min = 10**9
    for j in range(tmp,i):
      ans = dp[j] + abs(h[i] - h[j])
      if cost_min > ans: cost_min = ans
    dp[i] = cost_min
  print(dp[N-1])

if __name__ == '__main__':
  main()

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

int main()
{
    int n;
    cin>>n;
    vector<double> prob(n);
    for(ll i=0;i<n;i++)
    cin>>prob[i];
    // columns represents number of heads
    vector<vector<double> > prob_table(n,vector<double> (n+1,0.0));
    prob_table[0][0]=1-prob[0];
    prob_table[0][1]=prob[0];
    for(ll i=1;i<n;i++)
    {
        prob_table[i][0]=(1.0-prob[i])*prob_table[i-1][0];
    }
    for(ll i=1;i<n;i++)
    {
        for(ll j=1;j<=n;j++)
        {
            prob_table[i][j]=prob[i]*prob_table[i-1][j-1] + (1.0-prob[i])*prob_table[i-1][j];
        }
    }
    /*for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<=n;j++)
        cout<<prob_table[i][j]<<" ";
        cout<<"\n";
    }*/
    double final_ans=0.0;
    for(ll i=(n+1)/2;i<=n;i++)
    final_ans+=prob_table[n-1][i];
    cout<<setprecision(10)<<final_ans;
    return 0;
}


Measured memory_bytes: 70656
#include<stdio.h>
int main()
{
	int num[3] = {};
	scanf("%d %d %d", &num[0], &num[1], &num[2]);
	int tmp;

	if (num[0] < num[1])
	{
		tmp = num[0];
		num[0] = num[1];
		num[1] = tmp;
	}
	if (num[0]<num[2])
	{
		tmp = num[0];
		num[0] = num[2];
		num[2] = tmp;
	}
	if (num[1] < num[2])
	{
		tmp = num[1];
		num[1] = num[2];
		num[2] = tmp;
	}
	printf("%d", 10 * num[0] + num[1] + num[2]);
	return 0;
}

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

//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long

int main() {
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for(int i=0;i<s.size();i++) {
		if(s[i] != t[i])
			ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3888
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
char PS(char x) {
return x-0X20;
}
  
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  
  string a;
  string b;
  string c;
  cin >>a>>b>>c;
  char x=a.at(0);
  char y=b.at(0);
  char z=c.at(0);
  char x1=PS(x);
  char y1=PS(y);
char z1=PS(z);
  cout << x1<<y1<<z1<< endl;
}
  
    


Measured memory_bytes: 256
class PriorityQueue
  def initialize(&comp)
    @heap = []
    @node_num = 0
    if !block_given?
      @comp = Proc.new { |x, y| x <= y }
    else
      @comp = comp
    end
  end
  attr_reader :heap

  def push(x)
    i = @node_num # 自分のノード番号
    @node_num += 1
    while i > 0
      par = (i - 1) / 2 # 親のノード番号
      break if @comp.call(@heap[par], x) # 逆転してないなら抜ける
      # 親ノードを下ろして自分を上に
      @heap[i] = @heap[par]
      i = par
    end
    @heap[i] = x
  end

  alias_method(:<<, :push)

  def pop
    # 最(小|大)値
    ret = @heap[0]
    # 根にもってくる値
    @node_num -= 1
    x = @heap[@node_num]
    # 根から下ろしていく
    i = 0
    while i * 2 + 1 < @node_num
      # 子どうしを比較
      a, b = i * 2 + 1, i * 2 + 2
      a = b if b < @node_num && !@comp.call(@heap[a], @heap[b])
      break if @comp.call(x, @heap[a])
      @heap[i] = @heap[a]
      i = a
    end
    @heap[i] = x
    return ret
  end

  def get
    @node_num == 0 ? nil : @heap[0]
  end

  def empty?
    return get.nil?
  end
end

n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort.reverse
q = PriorityQueue.new { |x, y| x > y }
a.each do |ai|
  q << ai
end
m.times do
  max_n = q.pop()
  q << (max_n / 2)
end
p q.heap.inject(:+)


Measured memory_bytes: 11008
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        String str1 = S.substring(0, 1);
        String str2 = "";
        String str3 = "none";
        boolean hantei = false;
        for(int i = 1; i < S.length(); i++){
            if(str1.equals(S.substring(i, i+1))){
                hantei = true;
            }else{
                if(str2.equals("")){
                    str2 = S.substring(i, i+1);
                }else{
                    str3 = S.substring(i, i+1);
                }
            }
        }
        if(str2.equals(str3) && hantei){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        1e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
   
    #endif
}

// friend ostream & operator << (ostream &out, const Complex &c); 
// friend istream & operator >> (istream &in,  Complex &c); 



void solve()
{
 
 int x,n;

 cin >> x >> n;
 set<int>cont;

 for(int i=0;i<n;i++)
 {
  int e;
  cin >>e;
  cont.insert(e); 
 }
 
 int an = -1,vl=big;
 for(int i=-100;i<=200;i++)
 if(cont.find(i)==cont.end())
 {
   if(abs(i-x) < vl)
   {
    vl=abs(i-x);
    an = i;
   }
 }
 cout<<an<<endl;

}


int32_t main()
{
  //pr_init();
  fastio;
  solve();

 }
      
      

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define R(n)for(L i;i<n;i++)
#define M make_pair
typedef long L;using namespace std;int main(){L n,k,s,t,a[50];cin>>n>>k>>s>>t;R(n)cin>>a[i];map<pair<L,L>,L>p[50];R(n){for(L j=k-1;j;j--)for(auto&l:p[j-1])p[j][M(l.first.first&a[i],l.first.second|a[i])]+=l.second;p[0][M(a[i],a[i])]=1;}n=0;R(k)n+=p[i][M(s,t)];cout<<n;}

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

int main(void) {
	int A, B, C, D;
	scanf("%d %d %d %d", &A, &B, &C, &D);

	while (A > 0 && C > 0) {
		C -= B;
		if (C <= 0) {
			cout << "Yes" << endl;
			return 0;
		}
		A -= D;
		if (A <= 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>

using namespace std;

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

	char ca = a.at(0) - 0x20;
	char cb = b.at(0) - 0x20;
	char cc = c.at(0) - 0x20;

	cout << ca << cb << cc << endl;

}

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

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

  sort(a, a + N, greater<int>());
  int Alice = 0;
  int Bob = 0;
  for (int i = 0; i < N; i++){
    if (i % 2 == 0){
      Alice += a[i];
    }
    else {
      Bob += a[i];
    }
  }
  cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,x,y) for (int i=x; i<=y; i++)
#define ROF(i,x,y) for (int i=x; i>=y; i--)
#define ll long long
#define fi first
#define se second
#define MOD 1000000007
#define FORR(i,x) for(int i=0; i<x.size(); i++)
using namespace std;
ll n;
vector <ll> adj[500010];
bool ok[500010];
string a;
ll dp[500010];

void dfs(ll u)
{
    FORR(i,adj[u])
    {
        ll v=adj[u][i];
        dp[v]=max(dp[v],dp[u]+1);
        dfs(v);
    }
}

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

    cin >>a;
    a=" "+a;
    n=a.length();
    FOR(i,1,n-1)
    {
        if (a[i]=='>')
        {
            adj[i+1].push_back(i);
            ok[i]=true;
        }
        else
        {
            adj[i].push_back(i+1);
            ok[i+1]=true;
        }
    }

    FOR(i,1,n)
    {
        if (ok[i]==false)
        {
            //cout <<i <<endl;
            dfs(i);
        }
    }
    ll res=0;
    FOR(i,1,n) res+=dp[i];
    cout <<res;
    //cout <<dp[i] <<" ";
    return 0;
}


Measured memory_bytes: 55984