akhauriyash/Code-Regression huggingface dataset:
import copy

class Dice:
    # 0: top, 1: front, 2: right, 3: left, 4: back, 5: bottom
    def __init__(self, n0, n1, n2, n3, n4, n5):
        self.faces = [n0, n1, n2, n3, n4, n5]

    def move(self, op):
        tmp = self.faces[0]
        if op == 'E':
            self.faces[0] = self.faces[3]
            self.faces[3] = self.faces[5]
            self.faces[5] = self.faces[2]
            self.faces[2] = tmp
        elif op == 'N':
            self.faces[0] = self.faces[1]
            self.faces[1] = self.faces[5]
            self.faces[5] = self.faces[4]
            self.faces[4] = tmp
        elif op == 'S':
            self.faces[0] = self.faces[4]
            self.faces[4] = self.faces[5]
            self.faces[5] = self.faces[1]
            self.faces[1] = tmp
        elif op == 'W':
            self.faces[0] = self.faces[2]
            self.faces[2] = self.faces[5]
            self.faces[5] = self.faces[3]
            self.faces[3] = tmp

    def spin_horizontally(self):
        tmp = self.faces[1]
        self.faces[1] = self.faces[2]
        self.faces[2] = self.faces[4]
        self.faces[4] = self.faces[3]
        self.faces[3] = tmp

    def top(self):
        return self.faces[0]

    def front(self):
        return self.faces[1]

    def right(self):
        return self.faces[2]

    def equals(self, other_dice):
        dice = copy.deepcopy(other_dice)
        flg = False
        for i in range(6):

            if i % 2 == 0:
                dice.move('S')
            else:
                dice.move('E')

            if dice.top() == self.top():
                for _ in range(4):
                    dice.spin_horizontally()
                    if dice.front() == self.front():
                        break

            if dice.faces == self.faces:
                flg = True
                break
        return flg

n = int(input())
faces = list(map(int, input().split()))
dice_a = Dice(faces[0], faces[1], faces[2], faces[3], faces[4], faces[5])
ans = 'Yes'
for i in range(n - 1):
    faces = list(map(int, input().split()))
    dice_b = Dice(faces[0], faces[1], faces[2], faces[3], faces[4], faces[5])
    if dice_a.equals(dice_b):
        ans = 'No'
        break

print(ans)



Measured memory_bytes: 6356
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	map<ll,ll>m;
	ll n;
	cin>>n;
	for(int i=1;i<=3500;i++)
	{
	     for(int j=1;j<3500;j++)
	     {
	     	 ll x=n*i*j;
	     	 ll y=4*i*j-n*(i+j);
	     	 if(y==0|| x<0 || y<0) continue;
	     	 if(x%y==0)
	     	 {
	     	 	if(m[x/y])
	     	 	{
	     	 		cout<<i<<" "<<j<<" "<<x/y<<endl;
	     	 		return 0;
	     	 	}
	     	 	else
	     	 	m[x/y]=1;
	     	 }
	     }
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef long long ll;
using namespace std;
typedef pair<ll,ll> P;
priority_queue<P,vector<P>,greater<P> >Q;
vector<ll> v;
int main(){
	int n;
	ll left=inf,right=0;
	ll Min_rng=inf,Max_rng=0;
	ll Min_b=inf;
	cin>>n;
	lol(i,n){
		ll a,b;cin>>a>>b;
		if(a>b)swap(a,b);
		left=min(left,a);
		right=max(right,a);
		Min_rng=min(Min_rng,a);
		Max_rng=max(Max_rng,b);
		Min_b=min(Min_b,b);
		Q.push(make_pair(a,b));
		v.push_back(a);
	}
	sort(v.begin(),v.end());
	ll ans=(right-Min_rng)*(Max_rng-Min_b);
	//cout<<"#"<<left<<" "<<right<<" "<<Min_rng<<" "<<Max_rng<<endl;
	while(!Q.empty()){
		ll a=Q.top().first,b=Q.top().second;
		Q.pop();
		int it=lower_bound(v.begin(),v.end(),a)-v.begin();
		it++;
		if(it==n)break;
		if(a>Min_b)break;
		left=min(v[it],Min_b);
		right=max(right,b);
		ll tmp=(right-left)*(Max_rng-Min_rng);
		//cout<<"$"<<" "<<right<<" "<<left<<" "<<tmp<<endl;
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 8432
#include <iostream>
#include <algorithm>
using namespace std;
int T, card[16];
bool is_same_number(int a, int b, int c) {
  return a == c && b == c;
}
bool is_sequence(int a, int b, int c) {
  return a + 2 == c && b + 1 == c;
}
bool is_good_set(int a, int b, int c) {
  return is_same_number(a, b, c) || is_sequence(a, b, c);
}
bool is_all_good_set() {
  return is_good_set(card[0], card[1], card[2])
    && is_good_set(card[3], card[4], card[5])
    && is_good_set(card[6], card[7], card[8]);
}
int win() {
  sort(card, card+9);
  do {
    if(is_all_good_set()) return 1;
  } while (next_permutation(card, card+9));
  return 0;
}
int main() {
  cin >> T;
  for (int t=0; t<T; ++t) {
    for (int i=0; i<9; ++i) {
      cin >> card[i];
    }
    string color;
    for (int i=0; i<9; ++i) {
      cin >> color;
      if (color == "G") card[i] += 10;
      else if (color == "B") card[i] += 20;
    }
    cout << win() << endl;
  }
}

Measured memory_bytes: 1224
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
MOD = 10 ** 9 + 7
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = LI()

    if N % 2 == 0:
        if sorted(A) == [i // 2 * 2 + 1 for i in range(N)]:
            print(pow(2, N // 2, MOD))
        else:
            print(0)
    else:
        if sorted(A) == [(i // 2 + 1) * 2 for i in range(-1, N - 1)]:
            print(pow(2, (N - 1) // 2, MOD))
        else:
            print(0)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 21476
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    a, b = LI()
    if a > 0 and a < 10 and b > 0 and b < 10:
        print( a*b)
    else:
        print(-1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int H,W;
string s[50];
bool connected=false;
int dh[]={1,-1,0,0};
int dw[]={0,0,1,-1};
int nh,nw;

int main(){
    cin >>H >>W;
    for(int i=0;i<H;i++)cin >>s[i];
    for(int h=0;h<H;h++){
        for(int w=0;w<W;w++){
            if(s[h][w]=='#'){
                //cout <<h <<" "<<w <<endl;
                connected=false;
                for(int i=0;i<4;i++){

                    nh=h+dh[i];
                    nw=w+dw[i];
                    //cout <<" "<<nh<<" "<<nw<<endl; 
 
                    if(nh<0||nh>=H)continue;
                    if(nw<0||nw>=W)continue;
                    if(s[nh][nw]=='#'){
                        //cout <<nh<<" "<<nw<<" "<<"connedted"; 
                        connected=true;
                        break;
                    }
                }
                if (connected==false){
                    //cout <<nh<<" "<<nw<<" "<<"No";
                    cout <<"No"<<endl;
                    return 0;
                }
            }
        }
    }
    cout <<"Yes"<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin>>S;
    int N=S.size();
    int l[N]={},r[N]={};

    rep(i,N){
        if(S[i]=='L'){
            l[i]=l[i-1]+1;
        }
    }
    for(int i=N-1;i>=0;i--){
        if(S[i]=='R'){
            r[i]=r[i+1]+1;
        }
    }
    int ans[N];
    rep(i,N){
        ans[i]=1;
    }
    rep(i,N){
        ans[i]--;
        int x=max(l[i],r[i]);
        if(x==r[i]){
            if(x%2==0){
                ans[i+x]++;
            }else {
                ans[i+x-1]++;
            }
        }else{
            if(x%2==0){
                ans[i-x]++;
            }else{
                ans[i-x+1]++;
            }
        }
    }
    rep(i,N){
        cout << ans[i] << " ";
    }
    cout << endl;



}


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

void solve() 
{
    int n;cin>>n;
    int l[2*n];REP(i,2*n)cin>>l[i];
    sort(l,l+n*2);
    int sum=0;
    REP(i,n)sum+=min(l[i*2],l[i*2+1]);
    cout<<sum<<endl;
}

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

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	a=a*b;
	c=c*d;
	if(a>=c)
	printf("%d\n",a);
	else
	printf("%d\n",c);
	return 0;
}

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

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}





int main(){//
	int N, M;
	cin >> N >> M;
	vector<int> k(M), p(M);
	vector<vector<int>> s(M, vector<int>());
	for(int i=0; i<M; i++){
		cin >> k[i];
		for(int j=0; j<k[i]; j++){
			int a;
			cin >> a;
			a--;
			s[i].push_back(a);
		}
	}
	for(int i=0; i<M; i++) cin >> p[i];
	// cout << " N: " << N << " M: " << M << endl;
	// cout << " k: "; print_vec(k);
	// cout << " p: "; print_vec(p);
	// cout << " s: " << endl; print_vec2(s);
	// cout << " 2<<N: " << (2<<N) << endl;

	//bit全探索する
	int ans = 0;
	for(int i=0; i<(1<<N); i++){// 2^N回試す
		vector<bool> is_on(N, false);
		
	
		for(int j=0; j<N; j++){
		
			if( (i>>j) & 1){// iの右からj番目が1なら
				is_on[j] = true;
			}

		}
		
		bool is_lighting = true;//全ての電球が点灯してるとtrueのまま
		for(int j=0; j<M; j++){
			
			int num_on = 0;
			for(int u=0; u<k[j]; u++){
				if(is_on[s[j][u]] == true) num_on++;
			}
			if(num_on%2 != p[j]){
				is_lighting = false;
				//cout << j << " is fals!! is_on: "; print_vec(is_on);
				break;
			} 
			//else cout << j <<  " is lighting  is_on: "; print_vec(is_on);
			if(is_lighting == false) break;
		}
		if(is_lighting == false) continue;
		ans++;


	}
	
	cout << ans << endl;


}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define PB push_back
#define SP << " " <<

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;

string x(string x, int i1, int i2);
int main(void);

__attribute__((constructor))
void initial(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed <<setprecision(15);
}



int main(void){
	int N;
    cin >> N;
    string A ="abcdefghijklmnopqrstuvwxyz";
    vector<pair<string,int>> S;
    string s = "";
    pair<string,int> st = make_pair(s,0);
    S.PB(st);
    string x ="";
    ll cnt_f = 0;
    ll cnt_e = 0;
    x.PB(A[0]);
    rep(i,N){
        for(int k = cnt_f; k <= cnt_e; k++){
            rep(j,x.size()){
                if(S[k].second < j-1) break;
                s = S[k].first;
                s.PB(x[j]);
                int b = j;
                chmax(b,S[k].second);
                st = make_pair(s,b);
                S.PB(st);
            }
        }
        cnt_f = cnt_e+1;
        cnt_e = S.size()-1;
        x.PB(A[i+1]);
        //cout << cnt_f SP cnt_e << endl;
    }

    /*for(int k = cnt_f; k <= cnt_e; k++){
        cout << S[k] << endl;
    }*/
    rep(i,S.size()){
        if(i>=cnt_f) cout << S[i].first << endl;
        
    }



    return 0;
}


Measured memory_bytes: 11504
/*
      author : nishi5451
      created: 12.08.2020 11:27:35
*/

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


int main(){
    int x,y;
    cin >> x >> y;
    int ans=0;
    if(x==1 && y==1) ans+=400000;
    ans +=max(0,(4-x)*100000)+max(0,(4-y)*100000);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=100005;
int a[maxn],b[maxn],c[maxn],n,m,q,f[maxn],mi,ma,tot[maxn];
int find(int x)
{
 return x==f[x]?x:f[x]=find(f[x]);
}
int max(int x,int y)
{
	return x>y?x:y;
}
signed main()
{
	scanf("%lld%lld%lld",&n,&m,&q);
	for(int i=1;i<=n;++i)f[i]=i;int flag=0;
	for(int i=1;i<=q;++i)
	{
		 scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);a[i]++;b[i]++;
		 if(!c[i])
		 {
		 	int x=find(a[i]);int y=find(b[i]);
		 	if(x!=y)
			{
		 		f[y]=x;
			}
		 }
	}
	for(int i=1;i<=q;++i)
	{
		if(c[i])
		{
			flag=1;
			if(find(a[i])==find(b[i]))
			{
				puts("No");return 0;
			}
		}
	}
	int hh=0;
	for(int i=1;i<=n;++i)
	{
		if(find(i)==i)
		{
	     hh++;
		}
	}
	if(!flag)mi=hh-1;
	else mi=max(3,hh);ma=hh*(hh-1)/2;
	m-=(n-hh);
	if(m>=mi&&m<=ma)puts("Yes");
	else puts("No");
}


Measured memory_bytes: 3328
T = input()
lenT = len(T)
ac = T.count("eraser")
T = T.replace("eraser","xxxxxx",ac)
cc = T.count("erase")
T = T.replace("erase","xxxxx",cc)
bc = T.count("dreamer")
T = T.replace("dreamer","xxxxxxx",bc)
dc = T.count("dream")
T = T.replace("dream","xxxxx",dc)
D = T.count("x")
if D == lenT:
  print("YES")
elif lenT > D:
  print("NO")
else :
  print("error")

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

int main(){
 int S,a,b,c;
 cin>>S;
 a=S/3600;
 b=(S-3600*a)/60;
 c=S-3600*a-60*b;
 cout<<a<<":"<<b<<":"<<c<<endl;
 return 0;
}
 


Measured memory_bytes: 3112
#include<iostream>
#include<algorithm>
using namespace std;
int dp[30][60000];
int coins[30];
const int INF=10000000;

int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)cin>>coins[i];
	for(int i=0;i<=m;i++){
		for(int j=0;j<=n;j++)dp[i][j]=INF;
	}
	dp[0][0]=0;
	
	for(int i=1;i<=m;i++){
		for(int j=0;j<=n;j++){
			if(j-coins[i-1]<0)dp[i][j]=dp[i-1][j];//i-1?????????????????????????????????????????????
			else dp[i][j]=min(dp[i-1][j],dp[i][j-coins[i-1]]+1);
		}
	}
	cout<<dp[m][n]<<endl;
	return 0;
}

Measured memory_bytes: 7020
#include <cstdio>

int main(){
    int n,k;
    scanf("%d %d",&n,&k);
    int ans = 1;
    for(int i = 1; i <= n; i++){
        if(ans * 2 <= ans + k){
            ans = ans * 2;
        }else{
            ans = ans + k;
        }
    }
    printf("%d\n",ans);

    return 0;
}

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)
#define vvi(a,b,name)    vector<vector<int>> name(a,vector<int>(b,-1))


void solve(){
    long n;cin>>n;
    vii v;
    rep(i,1,n+1){
        int a;
        cin>>a;
        v.pb({a,i});
    }
    sort(all(v));
    for(auto u:v){
        cout<<u.y<<" ";
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 1780
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	int n,r;
	double x=0. , y=0. , g=90.;
	const double PI=acos(-1);
	while(scanf("%d,%d", &n,&r) ,n||r){
		x+=n*cos(g*PI/180);
		y+=n*sin(g*PI/180);
		g-=(double)r;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0; 
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    string A,B,C;
    cin >> A>>B>>C;
    cout << A[0] << B[0] << C[0]<<endl;


   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }

void _main() {
  int a, b;
  cin >> a >> b;

  int d = b - a;
  int ans = d * (d + 1) / 2 - b;
  cout << ans << "\n";
}

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


signed main() {
  int N;
  vector<int> A;
  cin >> N;
  A.resize(N);
  for(int i=0; i<N; i++) cin >> A[i];

  map<int ,int> mp;
  for(auto a : A) mp[a]++;
#if 0
  for(int k=0; k<N; k++) {
    int ak=A[k];
    mp[ak]--;
    int ans = 0;
    for(auto m : mp) {
      int c = m.second;
      if(c<2) continue;
      ans += c*(c-1) / 2;
    }
    cout << ans << endl;
    mp[ak]++;
  }
#else
  int sum = 0;
  map<int ,int> mp2;
  for(auto m : mp) {
    int c = m.second;
    if(c<2) continue;
    sum += ((c)*(c-1) / 2);
  }
  cerr << "sum: " << sum << endl;
  for(int k=0; k<N; k++) {
    int ak=A[k];
    int c = mp[ak];
    if(c < 2) {
      cout << sum << endl;
      continue;
    }
    cout << sum - ((c)*(c-1)/2) + ((c-1)*(c-2)/2) << endl;
  }

#endif
}


Measured memory_bytes: 11008
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
for l in range(len(N)):
    cards = [1 for i in range(11)]
    cards[0] = 0
    C1,C2,C3 = [int(i) for i in N[l].split()]
    cards[C1] = 0
    cards[C2] = 0
    cards[C3] = 0

    point = C1+C2
    ok = 0
    ng = 0

    for i in range(1,11):
        if cards[i] == 1 and C1+C2+i <= 20:
            ok += 1
        elif cards[i] == 1:
            ng += 1

    if ok >= ng:
        print("YES")
    else:
        print("NO")



Measured memory_bytes: 5596
//package codeforces;

import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.TreeMap;
import java.util.TreeSet;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Stack;

public class Main {
	// Integer.bitCount(i); count no of 1 bit in a given number
	static Scanner scn = new Scanner(System.in);
//	static class FastReader {
//	BufferedReader br;
//	StringTokenizer st;
//
//	public FastReader() {
//		br = new BufferedReader(new InputStreamReader(System.in));
//	}
//
//	String next() {
//		while (st == null || !st.hasMoreElements()) {
//			try {
//				st = new StringTokenizer(br.readLine());
//			} catch (IOException e) {
//				e.printStackTrace();
//			}
//		}
//		return st.nextToken();
//	}
//
//	int nextInt() {
//		return Integer.parseInt(next());
//	}
//
//	long nextLong() {
//		return Long.parseLong(next());
//	}
//
//	double nextDouble() {
//		return Double.parseDouble(next());
//	}
//
//	String nextLine() {
//		String str = "";
//		try {
//			str = br.readLine();
//		} catch (IOException e) {
//			e.printStackTrace();
//		}
//		return str;
//	}
//}
//
//static FastReader s = new FastReader();
	

	
	public static void main(String[] args) {
		/* TODO Auto-generated method stub */
		// System.out.format("%.10f", ans);char c = sc.next().charAt(0);
		
		
		String str=scn.next();
		String t=scn.next();
		int n=str.length(),m=t.length();
		boolean bl=true;
		for(int i=0;i<n;i++)
		{
			if(str.charAt(i)!=t.charAt(i))
			{
				bl=false;
				break;
			}
		}
		if(bl)
		{
			System.out.println("Yes");
		}
		else
			System.out.println("No");
		
		
}
}
	class pair
	{
		int x;
		int y;
		
		pair(int a,int b)
		{
			this.x=a;
			this.y=b;
			
		}
		public int hashCode()
		 {
		  return x*31+y*31;
		 }
		 
		 public boolean equals(Object other)
		 {
		  if(this==other) return true;
		  
		  if(other instanceof pair)
		  {
		   pair pt = (pair)other;
		   
		   return pt.x==this.x && pt.y==this.y;
		  }
		  else return false;
		 }
	}
	class sorting implements Comparator<pair>
	{

		@Override
		public int compare(pair o1, pair o2) {
			// TODO Auto-generated method stub
			int a=Math.max(o1.x,o2.x),b=o1.y-o2.y;
			return o1.x-o2.x;
		}
		
	}



Measured memory_bytes: 35656
/*
	ex3_1
	ruuu0048
*/
#include <stdio.h>
#include <math.h>
 
int main(void){
 
    int tree_num,view_scope; //リンゴの木の本数Nと監視員の視野の広さDの変数を宣言
    int watchman_num; //必要な監視員の数の変数を宣言
    float view_capacity; //一人の監視員が見られる木の本数

    scanf("%d",&tree_num); //Nを入力
    scanf("%d",&view_scope); //Dを入力

    view_capacity = view_scope * 2 + 1; //Dから一人の監視員が見られる本数を計算

    watchman_num = ceil(tree_num / view_capacity); //float型で計算したものを繰り上げ
 
    printf("%d\n",watchman_num); //必要な監視員の数をを出力
 
    return 0; 
 
}

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    string s;
    cin >> s;
    if (s[0] == s[2]) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define TRUE 1
#define FALSE 0

int linearSearch(int A[],int key,int n){
  int i=0;
  A[n] = key;
  

  while(i != n){
    if(A[i] == key) return TRUE;
    i++;
  }

  return FALSE;
}

int main(){
  int n,q,i,t;
  int s[10001];
  int cnt=0;

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

  scanf("%d",&q);
  
  for(i=0; i<q; i++){
    scanf("%d",&t);
    if(linearSearch(s,t,n) == TRUE) cnt++;
  }

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

  return 0;
  
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

string field[1005];
int cost[1005][1005];

int main() {
    int h,w,c1,c2,d1,d2;cin>>h>>w>>c1>>c2>>d1>>d2;
    c1--;c2--;d1--;d2--;
    rep(i,h) cin>>field[i];

    rep(i,h) rep(j,w) cost[i][j] = 1e9;

    deque<P> qu;
    cost[c1][c2] = 0;
    qu.emplace_back(P(c1,c2));
    while(qu.size()) {
        int cy = qu.front().first,cx = qu.front().second;qu.pop_front();
        int d = cost[cy][cx];
        rep(i,4) {
            int ny = cy + dy[i];
            int nx = cx + dx[i];
            if(ny>=0&&ny<h&&nx>=0&&nx<w) {
                if(field[ny][nx]=='#') continue;
                if(cost[ny][nx]<=d) continue;
                cost[ny][nx] = d;
                qu.emplace_front(P(ny,nx));
            }
        }
        for(int i = -2;i<3;i++){
            for(int j=-2;j<3;j++) {
                int ny = cy + i;
                int nx = cx + j;
                if(ny>=0&&ny<h&&nx>=0&&nx<w) {
                    if(field[ny][nx]=='#') continue;
                    if(cost[ny][nx]<=d+1) continue;
                    cost[ny][nx] = d+1;
                    qu.emplace_back(P(ny,nx));
                }    
            }
        }
    }

    int ans = cost[d1][d2];
    if(ans == 1e9) ans = -1;
    cout<<ans<<endl;
}

Measured memory_bytes: 9372
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n,m;
	int box[51];
	int i;
	int a,b;
	cin>>n>>m;
	for(i=1;i<=n;i++)	box[i]=0;
	for(i=0;i<m;i++){
		cin>>a>>b;
		box[a]++;
		box[b]++;
	}
	for(i=1;i<=n;i++)	cout<<box[i]<<endl;
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/arc062/tasks/arc062_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  ll f, s;
  cin >> f >> s;

  rep(i, N - 1) {
    ll fr, sr;
    cin >> fr >> sr;

    if (f * sr == s * fr) continue;

    ll min_n_f = fr * ((f + fr - 1) / fr);  // f を超える最小の fr の倍数
    ll min_n_s = sr * ((s + sr - 1) / sr);

    VL f_cand(0);
    VL s_cand(0);

    if (min_n_f / fr * sr >= s) {
      f_cand = {min_n_f, min_n_f / fr * sr};
    }

    if (min_n_s / sr * fr >= f) {
      s_cand = {min_n_s / sr * fr, min_n_s};
    }

    if (f_cand.size() != 0 &&
        (s_cand.size() == 0 ||
         f_cand[0] + f_cand[1] <= s_cand[0] + s_cand[1])) {
      f = f_cand[0];
      s = f_cand[1];
    } else {
      f = s_cand[0];
      s = s_cand[1];
    }
  }

  cout << f + s << endl;
}

void solve2() {
  ll N;
  cin >> N;

  ll f, s;
  cin >> f >> s;

  rep(i, N - 1) {
    ll fr, sr;
    cin >> fr >> sr;

    ll times = max((f + fr - 1) / fr, (s + sr - 1) / sr);

    f = fr * times;
    s = sr * times;
  }

  cout << f + s << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve2();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


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

int main() {
	long long n;
	cin>>n;
	long long res=n*(n+1)/2;
	long long x1=n/15,x2=n/3,x3=n/5;
	res+=15*x1*(x1+1)/2;
	res-=3*x2*(x2+1)/2;
	res-=5*x3*(x3+1)/2;
	cout<<res;
	return 0;
}

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

int main(){
  int N, Y;
  cin >> N >> Y;
  
  for(int i=0; i<=N; i++){
    for(int j=0; j<=i, i+j<=N; j++){
      int d=Y-10000*i-5000*j;
      if(d%1000==0 && i+j+(d/1000)==N){
        cout << i << " " << j << " " << N-i-j <<endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" <<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
//#define d long double
#define pii pair<int,int>
#define pb push_back
#define N 200003
#define inf (ll)1e9+1
#define warmup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int mod=1e9+7; 

signed main()
{
    warmup
    
    char c;
    cin>>c;
    cout<<(char)(c+1);
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define MAX 100000

int n,A[MAX];

int binarySearch(int key){
  int left=0;
  int right=n;
  while(left<right){
    int mdl=(left+right)/2;
    if(A[mdl]==key){
      return 1;
    }
    else if(key<A[mdl]){
      right=mdl;
    }
    else left=mdl+1;
  }
  return 0;
}

  

int main(){
  int sum=0,key;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  
  int m;
  cin>>m;
  for(int i;i<m;i++){
    cin>>key;
    sum+=binarySearch(key);
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 1548
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
const int mod = 1e9+7;
const int mx = INT_MAX;
const long double pi = 4*atan((long double)1);
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define file "orz"
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int h,w,k,sx,sy,ex,ey;
signed main()
{
    //freopen(file".inp","r",stdin);
    //freopen(file".out","w",stdout);
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>h>>w>>k>>sx>>sy>>ex>>ey;
    char mat[h+5][w+5];
    int dist[h+5][w+5];
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			cin>>mat[i][j];
			dist[i][j]=mx;
		}
	}		
//		for(int i=1;i<=h;i++)
//		for(int j=1;j<=w;j++)
//			cout<<dist[i][j]<<" ";
	queue<pii> q;
	dist[sx][sy] = 0;
	q.push(mp(sx,sy));
	while(!q.empty())
	{
		
		int xx = q.front().fi;
		int yy = q.front().se;
//		cout<<xx<<" "<<yy<<endl;
		q.pop();
		for(int i=0;i<4;i++)
		{
			for(int j=1;j<=k;j++)
			{
//				cout<<"here";
				int xxx = xx + dx[i]*j;
				int yyy = yy + dy[i]*j;
//				cout<<xxx<<" "<<yyy<<endl;
				if(xxx<1 || h<xxx || yyy<1 || w<yyy || mat[xxx][yyy] != '.' || dist[xxx][yyy] <= dist[xx][yy]) 
					break;
                if(dist[xxx][yyy]>dist[xx][yy]+1) 
				{	
					dist[xxx][yyy] = dist[xx][yy]+1;
					q.push(mp(xxx,yyy));
				}
			}
		}
	}
	if(dist[ex][ey]>=mx)
		return cout<<-1,0;
//	for(int i=1;i<=h;i++)
//		for(int j=1;j<=w;j++)
//			cout<<dist[i][j]<<" ";
	cout<<dist[ex][ey];
}


Measured memory_bytes: 14024
#include <stdio.h>

int main() {
    int house[4][3][10] = {0};
    int b, f, r, v, n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d %d %d %d", &b, &f, &r, &v);
        house[b-1][f-1][r-1] = house[b-1][f-1][r-1] + v;
    }
    for (int j = 0; j < 4; j++){
        for (int k = 0; k < 3; k++){
            for (int l = 0; l < 10; l++){
                printf(" %d", house[j][k][l]);
            }
            printf("\n");
        }
        if (j < 3){
            printf("####################\n");
        }
    }
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
using namespace std;

int main(){
	int N,M;
	cin>>N>>M;
	bool flag=true;
	char A[51][51],B[51][51];
	REP(i,0,N){
		REP(j,0,N){
			cin>>A[i][j];
		}
	}
	REP(i,0,M){
		REP(j,0,M){
			cin>>B[i][j];
		}
	}
	REP(i,0,N-M+1){
		REP(j,0,N-M+1){
			flag=true;
			REP(t,0,M){
				REP(s,0,M){
					if(A[i+t][j+s]!=B[t][s]){
						flag=false;
					}
				}
			}if(flag)break;

		}if(flag)break;
	}
	if(flag){
		p("Yes");
	}else{
		p("No");
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

const int MOD = 1e9 + 7;

i64 powMod(i64 x, i64 n = MOD - 2) {
	i64 ret = 1;
	while(n) {
		if(n & 1) (ret *= x) %= MOD;
		(x *= x) %= MOD;
		n >>= 1;
	}
	return ret;
}

std::vector<i64> fact, inv;
i64 comb(int n, int r) {
	return fact[n] * inv[r] % MOD * inv[n - r] % MOD;
}

int main() {
	i64 n, a, b, c; scanf("%lld%lld%lld%lld", &n, &a, &b, &c);
	(a *= powMod(100)) %= MOD;
	(b *= powMod(100)) %= MOD;
	(c *= powMod(100)) %= MOD;
	
	fact.resize(2 * n + 1, 1);
	inv.resize(2 * n + 1, 1);
	for(i64 i = 0; i < (int)fact.size() - 1; i++) fact[i + 1] = fact[i] * (i + 1) % MOD;
	for(i64 i = 0; i < fact.size(); i++) inv[i] = powMod(fact[i]);
	
	i64 ans = 0;
	for(i64 k = n; k < 2 * n; k++) {
		i64 game = k * powMod(a + b) % MOD;
		i64 prob = 0;
		
		{ // win: A
			i64 A = n, B = k - n;
			i64 X = comb(A - 1 + B, B);
			i64 Y = powMod(a, A) * powMod(b, B) % MOD * powMod(powMod(a + b, A + B)) % MOD;
			prob += X * Y % MOD;
		}
		{ // win: B
			i64 B = n, A = k - n;
			i64 X = comb(A - 1 + B, A);
			i64 Y = powMod(a, A) * powMod(b, B) % MOD * powMod(powMod(a + b, A + B)) % MOD;
			prob += X * Y % MOD;
		}
		ans += game * prob % MOD;
		ans %= MOD;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#define ll long long int
using namespace std;
ll dp[200005];
ll func(ll cnt,ll mv)
{
    if(cnt==0)
    {
        return mv;
    }
    ll temp=dp[cnt];
    cnt=cnt%temp;
    return func(cnt,mv+1);
}
ll fastexp(ll a, ll b, ll m)
{
    ll ans=1;
    while(b)
    {
        if(b%2==1)
        {
            ans=(ans*a)%m;
            
        }
        
        a=(a*a)%m;
        b=b/2;
    }
    return ans;
}
int main()
{
    ll n;
    string s;
    cin>>n;
    
    cin>>s;
 
    for(int i=0;i<=200004;i++)
    {
        ll cnt=0;
        ll tmp=i;
        while(tmp)
        {
            if(tmp%2==1)
            cnt++;
            
            tmp/=2;
        }
        
        dp[i]=cnt;
    }
    
    ll ones=0;
    ll start[200005];
    ll ans1=0,ans2=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='1')
        {
            ones++;
        }
        
    }

    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='1')
        {
    	    ans1=(ans1+fastexp(2,s.length()-1-i,ones+1))%(ones+1);
          if(ones!=1){
        	ans2=(ans2+fastexp(2,s.length()-1-i,ones-1))%(ones-1);
          }
        }
    }
  	
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='0')
        {
            ll temp=ans1;
            temp=(temp+fastexp(2,s.length()-1-i,ones+1))%(ones+1);
            start[i]=temp;
        }
        else
        {
          if(ones==1)
          {
            continue;
          }
            ll temp=ans2;
            temp=(temp-fastexp(2,s.length()-1-i,ones-1) + ones-1)%(ones-1);
            start[i]=temp;
        }
    }
    for(int i=0;i<s.length();i++)
    {
  
        if(s[i]=='0')
        {
            cout<<func(start[i],1)<<endl;
        }
        else
        {   if(ones==1)
          {
            cout<<0<<endl;
            continue;
          }
            cout<<func(start[i],1)<<endl;
        }
    }
    
    
  
}

Measured memory_bytes: 6884
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x=min(x, y)
#define chmax(x,y) x=max(x, y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = (1<<21);
const ll INf = 1LL << 60;
const ll mod = 1e9+7;

int main(){
	int x, y, z, k;
  	cin >> x >> y >> z >> k;
  	vector<ll> A(x), B(y), C(z);
  	rep(i, x) cin >> A[i];
  	rep(i, y) cin >> B[i];
  	rep(i, z) cin >> C[i];
  	sort(C.begin(), C.end(), greater<ll>());
  	vector<ll> AB;
  	rep(i, x)rep(j, y){
        AB.push_back(A[i] + B[j]);
    }
    sort(AB.begin(), AB.end(), greater<ll>());
    vector<ll> Ans;
    rep(i, min(k, x*y))rep(j, min(k, z)){
        Ans.push_back(AB[i]+C[j]);
    }
    sort(Ans.begin(), Ans.end(), greater<ll>());
    rep(i, k){
        cout << Ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 43368
#include<stdio.h>
#define NUM 10
int main(){
  int n;
  int i,j;
  scanf("%d",&n);
  while(n!=0){
    int h[NUM]={};
    for(i=0;i<n;i++){
      int d;
      scanf("%d",&d);
      ++h[d];
    }

    for(j=0;j<NUM;j++){
      if(h[j]){
	for(i=0;i<h[j];i++){
	  putchar('*');
	}
      }else {
	putchar('-');
      }
      putchar('\n');
    }

    scanf("%d",&n);
  }

  return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
#define ll long long
#define trace(x) cerr << #x << " = " << x << endl
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

int main()
{
   /*
    #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("ouput.txt","w",stdout);
    #endif 
   */

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    while(t--){
        string s, p;
	cin>>s>>p;
	int ans = INT_MAX;
	for(int i = 0; i < (int)s.length() - (int)p.length() + 1; i++){
		int cnt = 0;
		string x = s.substr(i, p.length());
		//trace(x);
		for(int j = 0; j < (int)p.length(); j++){
			if(x[j] != p[j])
				cnt++;
	//	trace(cnt);

		}
		ans = min(ans, cnt);
	}
	cout<<ans<<endl;
    }
    return 0;
} 


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9


int main(){
  int N;
  cin >> N;
  cout << (N-1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//using namespace std;
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
//#define int long long

class fast_Fourier_transform{
    private:
    const double PI=3.14159265358979; 
    
    std::vector<std::complex<double>> DFT(std::vector<std::complex<double>> A){
        int N=A.size();
        if(N==1)return A;
        std::vector<std::complex<double>> A0(N/2),A1(N/2),iA0,iA1,iA(N);
        for(int i=0;i<N;i++){
            if(i%2==0){
                A0[i/2]=A[i];
            }else{
                A1[i/2]=A[i];
            }
        }
        iA0=DFT(A0);
        iA1=DFT(A1);
        
        for(int i=0;i<N;i++){
            std::complex<double> ith_zeta = std::complex<double>(cos(2*PI*i/N),sin(2*PI*i/N));
            iA[i]=(iA0[i%(N/2)]+ ith_zeta*iA1[i%(N/2)]);
        }
        return iA;
    }
    
    std::vector<std::complex<double>> iDFT(std::vector<std::complex<double>> iA){
        int N=iA.size();
        std::vector<std::complex<double>> A,dA,rA;
        dA=DFT(iA);
        for(int i=0;i<N;i++){
            rA.push_back(dA[(N-i)%N]);
            A.push_back(rA[i]/std::complex<double>(N,0));
        }
        return A;
    }
    
    public:
    std::vector<long long> convolution(std::vector<long long> A,std::vector<long long> B){
        int deg = A.size() + B.size() -1;
        long long N=1;
        while(N<deg){N<<=1;}
        A.resize(N);B.resize(N);
        std::vector<std::complex<double>> dC(N),iC(N),dA,iA,dB,iB;
        std::vector<long long> C(N);
        for(int i=0;i<A.size();i++){
            dA.push_back(A[i]);
        }
        for(int i=0;i<B.size();i++){
            dB.push_back(B[i]);
        }
        iA=DFT(dA);iB=DFT(dB);
        for(int i=0;i<N;i++){
            iC[i]=iA[i]*iB[i];
        }
        dC=iDFT(iC);
        for(int i=0;i<dC.size();i++){
            C[i]=(0.1+dC[i].real());
        }
        return C;
    }
    
};


signed main(void){
    long long N,M,a,Amax=0;
    std::vector<long long> A;
    std::cin >> N >> M;
    REP(i,N){
        std::cin >> a;
        Amax=std::max(Amax,a);
        A.push_back(a);
    }
    
    std::vector<long long> B,C;
    B.resize(Amax+1,0);
    REP(i,N){
        B[A[i]]++;
    }
    fast_Fourier_transform FFT;
    C=FFT.convolution(B,B);
    
    /*REP(i,C.size()){
        if(C[i]==0)continue;
        cout <<i MM C[i] << endl;
    }*/
    
    long long Ans=0;
    long long now=0;
    RREP(i,C.size()){
        long long d=C[i];
        if(M-now>=d){
            Ans+=d*i;
            now+=d;
        }else{
            Ans+=(M-now)*i;
            break;
        }
    }
    std::cout << Ans << std::endl;
    return 0;
}


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

int main(){
    int a,b;
    cin >> a;
    cin >> b;
    if(a==1)a+=13;
    if(b==1)b+=13;
    if(a>b)cout << "Alice" << endl;
    else if (a<b)cout << "Bob" << endl;
    else cout << "Draw" <<endl;
}

Measured memory_bytes: 256
(defn ∵∴∵ [[O E]]
  (str
    (apply str (interleave O E))
    (case (compare (count O) (count E))
      1  (last O)
      -1  (last E)
      0 nil)))

(->> (vector (read-line) (read-line))
  ∵∴∵
  println)

Measured memory_bytes: 66020
N,M=gets.split.map &:to_i
A=$<.map{|e|
	h={}
	e.split.each{|f|h[f.to_i]=1}
	h
}
r=N
(M-1).times{
	h=Hash.new 0
	A.each{|e|h[e.first[0]]+=1}
	k,v=h.max_by(&:last)
	r=[r,v].min
	A.each{|e|e.delete(k)}
}
p r

Measured memory_bytes: 8060
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>

using namespace std;


int main() {
	map<int, int> mp;
	long long int n, m=0,tmp=0,ax=0,k=0,t[500000],p[500000],x,y,res[5000],a,b,c;
	string str, str2[5000];
	cin >>a>>b>>c;
	tmp = a + b + c;
	tmp -= max(max(a, b), c) + min(min(a, b), c);
	if (tmp % 2 == min(min(a, b), c) % 2) {
		cout << max(max(a, b), c) - (min(min(a, b), c) +tmp) / 2;
	}
	else {
		cout << max(max(a, b), c) - (min(min(a, b), c) + tmp) / 2 +1;
	}
}

Measured memory_bytes: 256
#include <iostream>
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl "\n"
#define ALL(x) x.begin(),x.end()
using namespace std;

char a;
int main() {
	cin >> a;
	if(a < 'a') cout << 'A' << endl;
	else cout << 'a' << endl;
    return 0;
}


Measured memory_bytes: 3032
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    sort(a.begin(), a.end());

    int prev = a[0];
    rep1(i, n){
        if(prev == a[i]){
            puts("NO");
            return 0;
        }
        prev = a[i];
    }

    puts("YES");

    return 0;
}

Measured memory_bytes: 1024
// Crt. 2019-12-15  17:22:21, 20:12:00
#include <algorithm>
#include <iostream>
#include <cstdio>
#define N 500005
using namespace std;
const int eps = 1e8 + 7;

int r, c, s, n, m, a[N], b[N], top, stk[N], sh[N], in[N], out[N];

inline bool inr(int x, int y) {
    return x && x < r && y && y < c;
}

inline int getid(int x, int y) {
    if (!x && y > 0) return y;
    if (y == c && x > 0) return x + eps;
    if (x == r && y < c) return c - y + eps * 2;
    if (!y && x < r) return r - x + eps * 3;
    puts("-1"), exit(0);
}

int main() {
#ifdef LOCAL_JUDGE
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> r >> c >> n;

    for (int i = 1, x, y, xx, yy; i <= n; ++i) {
        scanf("%d%d%d%d", &x, &y, &xx, &yy);
        if (inr(x, y) || inr(xx, yy)) continue;
        //cout << x << " " << y << " " << xx << " " << yy << endl;
        a[++m] = getid(x, y), b[m] = getid(xx, yy);
        if (a[m] > b[m]) swap(a[m], b[m]);
        sh[++s] = a[m], sh[++s] = b[m];
    }

    sort(sh + 1, sh + s + 1);

    for (int i = 1; i <= m; ++i) {
        //cout << a[i] << " " << b[i] << endl;
        in[a[i] = lower_bound(sh + 1, sh + s + 1, a[i]) - sh] = i,
        out[b[i] = lower_bound(sh + 1, sh + s + 1, b[i]) - sh] = i;
    }

    for (int i = 1; i <= s; ++i) {
        if (in[i]) stk[++top] = in[i];
        if (out[i]) {
            if (stk[top] != out[i]) return puts("NO"), 0;
            --top;
        }
    }

    puts("YES");

    return 0;
}


Measured memory_bytes: 9344
def CountingSort(A, B, k, n):
    C = []
    for i in range(k + 1):
        C.append(0)
        
    for i in range(n):
        B.append(0)
        
    for i in range(n):
        C[A[i]] += 1
    
    for i in range(1, k + 1):
        C[i] = C[i] + C[i-1]
        

    for i in range(n-1, -1, -1):
        B[C[A[i]]-1] = A[i]
        C[A[i]] -= 1
        
n = int(input())
A = list(map(int, input().split())) 
B = []
k = max(A)
CountingSort(A, B, k, n)
for i in range(n-1):
    print(B[i], end = " ")
print(B[n-1])





Measured memory_bytes: 224376
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    sort(be(s));
    if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
def gets_HW_char
  h, w = gets.split.map(&:to_i)
  board = h.times.map { gets.chomp.chars }
  return h, w, board
end

H, W, c = gets_HW_char

H.times do |i|
  W.times do |j|
    count = 0
    (-1..1).each do |di|
      (-1..1).each do |dj|
        if di==0 && dj==0
          # c[i][j] の処理
        elsif 0 <= i + di && i + di < H && 0 <= j + dj && j + dj < W
          # c[i + di][j + dj] の処理
          count += 1 if c[i + di][j + dj] == "#"
        else
          # 範囲外のときの処理
        end
      end
    end
    # c[i][j] の処理
    c[i][j] = count.to_s if c[i][j] != "#"
  end
end

c.each do |e|
  puts e.join
end


Measured memory_bytes: 2172
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0; i<(n); i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define LL long long;
#define ULL unsigned long long;
using namespace std;

int H,W;
string str,ans[200];

int main() {
	cin>>H>>W;
	REP(i,H) {
		cin>>str;
		REP(j,2) {
			cout<<str<<endl;
		}
	}
}


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

int main() {
    string s;
    cin >> s;
    
    for (int i = 0; i < 3; i++) {
        if (s[i] == '1') {
            cout << 9;
        } else {
            cout << 1;
        }
    }
    cout << endl;
}

Measured memory_bytes: 256