akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main(void) {
    int n;
    cin >> n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    for(int i = 0; i < n; i++){
        string tmp;
        cin >> tmp;
        if(tmp == "AC"){
            ac += 1;
        }
        else if(tmp == "WA"){
            wa += 1;
        }
        else if(tmp == "TLE"){
            tle += 1;
        }
        else{
            re += 1;
        }
        // cout << "i = " << i << endl;
        // cout << "AC x " << ac << endl;
        // cout << "WA x " << wa << endl;
        // cout << "TLE x " << tle << endl;
        // cout << "RE x " << re << endl;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}


Measured memory_bytes: 3628
# -*- coding: utf-8 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    token = lines[0].split()
    n = int(token[0])

    return (n, )


def solve(n):

    count = 0
    for i in range(1, n+1):

        if 1 <= i and i <= 9:
            count = count + 1

        if 100 <= i and i <= 999:
            count = count + 1

        if 10000 <= i and i <= 99999:
            count = count + 1

    return count


def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstring>
 
#define rep(i,n) for(int i = 0; i < n; i++)
 
using namespace std;
 
string add(char a[], char b[])
{
  string ans, stt;
  int alen = strlen(a);
  int blen = strlen(b);
  int carry = 0;
  int an, bn;
 
  for(int i = alen-1,j = blen-1; i >= 0 || j >= 0 ; i--,j--){
    an = bn = 0;
    if(i >= 0){ an = a[i]-'0'; }
    if(j >= 0){ bn = b[j]-'0'; }
    int temp = an+bn;
    ans  += ((temp+carry)%10)+'0';
    carry = (temp+carry)/10;
  }
  if(carry)
    ans += carry+'0';
  for(int i = ans.size()-1; i >= 0; --i){
    stt+=ans[i];
  }
  return stt;
}
 
int main(void)
{
 
  string str;
  char  k1[100],  k2[100],  ans[100];
  char tk1[100], tk2[100], tans[100];
  int count, cn;
 
  while(cin >> str){
    int n = count = cn = 0;
    while(str[n] != '\0'){
      if(str[n]=='+' || str[n] == '='){
        if(count == 0){ k1[cn] = '\0'; }
        if(count == 1){ k2[cn] = '\0'; }
        count++;
        cn=0;
      }
      else{
        if(count == 0){  k1[cn] = str[n]; }
        if(count == 1){  k2[cn] = str[n]; }
        if(count == 2){ ans[cn] = str[n]; }
        cn++;
      }
      n++;
    }
    ans[cn] = '\0';
    int num;
    bool flag = false;
    int klen1 = (int)strlen(k1);
    int klen2 = (int)strlen(k2);
    int anslen = (int)strlen(ans);
    rep(i,10){
      strcpy(tk1, k1);
      strcpy(tk2, k2);
      strcpy(tans, ans);
      for(int j = 0;
          j < klen1 ||
            j < klen2 ||
            j < anslen; 
          j++){
        if(j < klen1){
          if( tk1[j]=='X') { tk1[j] = i+'0'; }
        }
        if(j < klen2){
          if( tk2[j]=='X') { tk2[j] = i+'0'; }
        }
        if(j < anslen){
          if(tans[j]=='X'){ tans[j] = i+'0'; }
        }
      }
      string ck = add(tk1,tk2);
      string ck_= string(tans);
      if(ck == ck_){
        num = i;
        flag = true;
        break;
      }
    }
    if(flag){ cout << num << endl;  }
    else    { cout << "NA" << endl; }
  }
 
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using st = string;
#define mrep(i, m, n) for(int i = m; i < n; i++)
#define rep(i, n) mrep(i, 0, n)
#define chmax(x, y) { x = max(x, y); }
#define chmin(x, y) { x = min(x, y); }
#define mp(x, y) make_pair(x, y)
#define mt(x, y, z) make_tuple(x, y, z)
#define t(x, y) tie(x, y)

int main() {
    int n;
    cin >> n;
    vector<tuple<string, int, int>> sp(n);
    rep(i, n){
        string s;
        int p;
        cin >> s >> p;
        int x = i + 1;
        sp.at(i) = mt(s, p, x);
    }
    sort(sp.begin(), sp.end());
    rep(i, n - 1){
        mrep(j, i + 1, n){
            string s1 = get<0>(sp.at(i));
            string s2 = get<0>(sp.at(j));
            if(s1 == s2){
                int i1 = get<1>(sp.at(i));
                int i2 = get<1>(sp.at(j));
                if(i1 < i2){
                    tuple<string, int, int> t = sp.at(i);
                    sp.at(i) = sp.at(j);
                    sp.at(j) = t;
                }
            }
        }
    }
    rep(i, n){
        cout << get<2>(sp.at(i)) << endl;
    }
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    ll a,b,c;
   scanf("%lld %lld.%lld",&a,&b,&c);

    ll ans = (a*(b*100 + c));
    cout<<ans/100<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef pair<ul, ul> P;

const int INF = 1e9;
const int MOD =1e9+7;
const ll LINF = 1e18;

int main(){
    int N;
    vector<int> B;

    cin >> N;
    rep(i, N - 1) {
        int a;
        cin >> a;
        B.push_back(a);
    }

    ll ans = 0;
    if (N - 1 >= 2) {
        ans += B[0];
        ans += B[B.size() - 1];
        
        for(int i = 1;i < N - 1; i++) {
            ans += min(B[i - 1],B[i]);
        }

        cout << ans << endl;
    } else {
        cout << B[0] * 2 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
  int S; cin >> S;

  bool isYYMM = false, isMMYY = false;

  int lsb = S%100, msb = S/100;
  if (0 <= msb && msb <= 99 && 1 <= lsb && lsb <= 12) {
    isYYMM = true;
  }
  if (0 <= lsb && lsb <= 99 && 1 <= msb && msb <= 12) {
    isMMYY = true;
  }

  string ans;
  if (isYYMM && isMMYY) {
    ans = "AMBIGUOUS";
  } else if (isYYMM) {
    ans = "YYMM";
  } else if (isMMYY) {
    ans = "MMYY";
  } else {
    ans = "NA";
  }

  cout << ans << endl;
  return 0;
}


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



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

	ll a,b;
	cin>>a>>b;
	ll d = __gcd(a,b);
	ll copy = d;
	set<ll> factors;
	for(int i=2; i<= sqrt(copy) + 1; ++i){
		if( d % i == 0 ){
			factors.insert(i);
			while( d % i == 0 ){
				d /= i;
			}
		}
	}
	if( d != 1 ){ factors.insert(copy); }
	cout<<factors.size() + 1<<endl;

	return 0;
}


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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

signed main(){
	int h,w; cin >> h >> w;
	vector<vector<int>> m(h+2, vector<int>(w+2, 0));
	for(int i = 1; i <= h; i++){
		for(int j = 1; j <= w; j++){
			char t; cin >> t;
			if(t == '#')m[i][j] = -1;
		}
	}
	for(int i = 0; i <= w+1; i++){
		m[0][i] = -1;
		m[h+1][i] = -1;
	}
	for(int i = 0; i <= h+1; i++){
		m[i][0] = -1;
		m[i][w+1] = -1;
	}
	int ans = 0;
	vector<vector<bool>> ver(h+2, vector<bool>(w+2, false));
	vector<vector<bool>> hor(ver);
	for(int i = 1; i <= h; i++){
		for(int j = 1; j <= w; j++){
			if(m[i][j] == -1)continue;
			if(!hor[i][j]){
				int k = j;
				for(; m[i][k] != -1; k++);
				for(int l = j; l < k; l++){
					m[i][l] += k-j;
					hor[i][l] = true;
				}
			}
			if(!ver[i][j]){
				int k = i;
				for(; m[k][j] != -1; k++);
				for(int l = i; l < k; l++){
					m[l][j] += k-i;
					ver[l][j] = true;
				}
			}
		}
	}
	for(auto a : m)for(auto e : a)ans = max(e-1, ans);

	cout << ans << endl;


	return 0;
}



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

//template
#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 ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end



int main(){
   int h,w,n; scanf("%d%d%d",&h,&w,&n);
   int ans=inf;
   rep(i,0,h+1)rep(j,0,w+1){
      int sub=i*w+j*h-i*j;
      if(sub>=n)chmin(ans,i+j);
   }
   printf("%d\n",ans);
   return 0;
}


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

int main()
{
	vector<int> a;
	for(int i=1;i<4000;i++)
	{
		if(i%400!=0&&i%100==0)continue;
		if(i%4==0)a.push_back(i);
	}
	int A,B;
	bool f=false;
	while(cin>>A>>B&&A&&B)
	{
		if(f)cout<<endl;
		f=true;
		bool flag=true;
		for(int i=0;i<a.size();i++)
		{
			if(A<=a[i]&&a[i]<=B)
			{
				flag=false;
				cout<<a[i]<<endl;
			}
			
		}
		if(flag)cout<<"NA"<<endl;
	}
	
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
//#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#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 debug(x) cout << '>' << #x << ':' << x << endl;
#define sq(a) (a)*(a)
#define nl "\n"
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
const int MAXN = 100005;
ll mod=1000000007;


int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t;
        t = 1;
        // cin>>t;
        while(t--) {
                int n;
                cin>>n;
                vi a(n);
                vi p(n), s(n);
                rep(i,0,n-1){
                        cin>>a[i];
                        p[i] = (i) ? p[i-1]^a[i] : a[i];
                }
                s[n-1] = a[n-1];
                rrep(i,n-2,0){
                        s[i] = s[i+1]^a[i];
                      // debug(s[i]);
                }
                vi ans(n);
                rep(i,0,n-1){
                        int before = (i) ? p[i-1] : 0;
                        int after = (i < n - 1) ? s[i+1] : 0;
                        ans[i] = before^after;
                }
                rep(i,0,n-1){
                        cout<<ans[i]<<" ";
                }
                cout<<nl;
        }
        return 0;
}


Measured memory_bytes: 6328
//* AuThOr GaRyMr *//
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define ff fflush(stdout)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int a[2000+1],b[2000+1];
vector<mp > each[2000+10];
int v[1000+10],Allv[1000+10],OK=0;int n,m;
int huan[2000+10];
int ALL=0;
void Dfs(int now){
	v[now]=1;
	Allv[now]=1;
	for(auto it : each[now]){
		if(v[it.FIR]){
			OK=it.FIR;
			ALL=1;
			huan[it.SEC]=1;
			return;
		}
		Dfs(it.FIR);
		if(OK) huan[it.SEC]=1;
		
		if(OK==now) {
			OK=0;
			return;
		}if(ALL) break;
	}
	if(!OK) v[now]=0;
} 
int Stay[1000+10];
int Is;
bool check(int step){
	int cnt=0;
	rb(i,1,m)
	if(Stay[a[i]]==step&&Stay[b[i]]==step){
		if(!huan[i]&&!Is){
			Is=i;
			huan[i]=1;
		}
		cnt++;
	} 
	int cnt2=0;
	rb(i,1,n) {
		cnt2+=bool(Stay[i]==step);
	}
	return bool(cnt2==cnt);
}
int St;
void Dfs2(int now,int step){
	Stay[now]++;
	for(auto it:each[now]){
		if(OK) return;
		if(huan[it.SEC]&&Stay[it.FIR]==step)
		{
			Dfs2(it.FIR,step);
			break;
		}
		else{
			if(huan[it.SEC]&&it.FIR==St){
				OK=1;
				return;
			}
		}
	}
	if(!OK) Stay[now]--;
}
int main(){
	cin>>n>>m;
	rb(i,1,m)
	{
		cin>>a[i]>>b[i];
		each[a[i]].PB(II(b[i],i));
	}
	rb(i,1,n)
		if(!Allv[i]&&!ALL) {
//			memset(v,0,sizeof(v));
			Dfs(i);
		}
	if(!ALL) puts("-1");
	else{
		rb(i,1,m){
			if(huan[i])
			Stay[a[i]]=Stay[b[i]]=1;
		}
//		rb(i,1,n)
//		{
//			if(Stay[i]){
//				cout<<i<<endl;
//				
//			}		}
//		cout<<endl<<"----------------------"<<endl;
		int mxi;
		int step=0;
		while(1){
			step++;
			Is=0;
			if(check(step)){
				mxi=step;
				break;
			}
			OK=0;
			St=a[Is];
			Stay[a[Is]]++;
			Dfs2(b[Is],step);
		}
		int tot=0;
		rb(i,1,n) tot+=bool(Stay[i]==mxi);
		cout<<tot<<endl;
		rb(i,1,n){
			if(Stay[i]==mxi) cout<<i<<endl; 
		}
	}
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b;
    cin >> a >> b;
    vvi grid(100, vi(100));
    rep(i, 100) rep(j, 100) {
        if (i < 50) grid[i][j] = 0;
        else grid[i][j] = 1;
    }

    for (int i = 0; i < 100; i += 2) {
        bool flag = false;
        rep(j, 100) {
            if (b == 1) {
                flag = true;
                break;
            }
            if ((i + j) % 2 == 0) {
                grid[i][j] = 1;
                b--;
            }
        }
        if (flag) break;
    }

    for (int i = 99; i >= 0; i -= 2) {
        bool flag = false;
        rep(j, 100) {
            if (a == 1) {
                flag = true;
                break;
            }
            if ((i + j) % 2 == 0) {
                grid[i][j] = 0;
                a--;
            }
        }
        if (flag) break;
    }

    cout << "100 100" << endl;
    rep(i, 100) {
        rep(j, 100) {
            if (grid[i][j] == 0) {
                cout << '.';
            } else {
                cout << '#';
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

a, b, deg = map(float, input().split())

deg = deg/180*math.pi

s = a*b*math.sin(deg)/2
l = a+b+math.sqrt(a*a+b*b-2*a*b*math.cos(deg))
h = b*math.sin(deg)

print(s)
print(l)
print(h)


Measured memory_bytes: 6920
N = int(input())
data = []
for i in range(N-1):
    c, s, f = map(int,input().split())
    data.append((c, s, f))

for i in range(N-1):
    duration, start, freq = data[i]
    total = start + duration
    for j in range(i+1, N-1):
        d, s, f = data[j]
        if total < s:
            total = s + d
        elif total % f == 0:
            total += d
        else:
            total = f * (total // f) + f + d
    print(total)
print(0)


Measured memory_bytes: 41708
import java.io.InputStream;
import java.io.PrintStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner sc = new Scanner(is);
        int N = sc.nextInt();
        int x[] = new int[N];
        int y[] = new int[N];
        for(int i = 0; i < N; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        int max1 = Integer.MIN_VALUE;
        int max2 = Integer.MIN_VALUE;
        int min1 = Integer.MAX_VALUE;
        int min2 = Integer.MAX_VALUE;
        for(int i = 0; i < N; i++) {
            max1 = Math.max(max1, x[i]+y[i]);
            min1 = Math.min(min1, x[i]+y[i]);
            max2 = Math.max(max2, x[i]-y[i]);
            min2 = Math.min(min2, x[i]-y[i]);
        }
        long diff = max1-min1;
        long diff2 = max2-min2;
        os.println(Math.max(diff, diff2));
    }

}

Measured memory_bytes: 51432
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iterator>
#include <functional>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstdio>
using namespace std;
#define sz(a)  int((a).size())
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define CLR(a) memset((a), 0, sizeof(a))
#define INF (1 << 31) - 1
const int dh[8] = {-1, 1, 0, 0,1,1,-1,-1};
const int dw[8] = {0, 0, 1, -1,1,-1,1,-1};
typedef long long ll;
typedef pair<int, int> p;
typedef vector <int> VI;
typedef vector <string> VS;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> P;
map<lli, lli> d;
set<lli> s;

int main(){
/*	
	int n;
	cin >> n;
	VI a(n+1);

	for(int i = 1; i <= n; i++){
		int num;
		cin >> num;
		a[num] = i;
	}
	
	ll ans = 0;
	vector <int> his;
	his.pb(0);
	his.pb(n+1);

	for(int i = 1; i <= n; i++){
		his.pb(a[i]);
		sort( all(his) );
		vector<int>::iterator it = lower_bound( all(his), a[i] );
		int h = a[i] - *(it - 1);
		int w = *(it + 1) - a[i];	
						
		ans += h * w * i;
	}

	cout << ans << endl;
*/
 lli n;
    lli a[200005] = {};
    cin >> n;
    s.insert(-1);
    s.insert(n);
    lli ans = 0;
    rep(i, n)
    {
        cin >> a[i];
        d[a[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
        s.insert(d[i]);
        auto it = s.find(d[i]);
        --it;
        lli left = *it;
        ++it;
        ++it;
        lli right = *it;
        ans += i * (d[i] - left) * (right - d[i]);
        //cout << ans << endl;
    }
    cout << ans << endl;
	return 0;	
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    ll x;
    cin >> x;
    ll ans = (x / 11) * 2;
    if(x % 11 > 6)
        ans += 2;
    else if(x % 11 > 0)
        ans++;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  string S, T;
  cin >> S >> T;
  bool ok = true;
  rep(i, S.size()) if(S[i] != T[i]) ok = false;
  if(S.size()+1 == T.size() && ok) cout << "Yes"<< endl;
  else cout << "No" << endl;
  return 0;
}


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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	map<string,int> cards;
	int n;
	cin >> n;
	FOR(i,0,n){
		string tmp;
		cin >> tmp;
		cards[tmp]++;
	}
	int m;
	cin >> m;
	FOR(i,0,m){
		string tmp;
		cin >> tmp;
		cards[tmp]--;
	}
	int ans = 0;
	for(pair<string, int> p : cards){
		ans = max(ans, p.second);
	}
	ANS(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long n,p;
    cin >> n >>p;
    long long ans=1LL;
    
    long long max=pow(p,1.0/n);
    while(max >1){
        if(fmod(p,pow(max,n))/*p%(pow(max,n))*/==0){
            ans*=max;
            p/=pow(max,n);
            max=pow(p,1.0/n);
        }else{
            max--;
        }
    }
                cout << ans<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
char b[20];
int main() {
scanf("2017/%s",b);
pss("2018/%s\n",b);
	return 0;
           } 

Measured memory_bytes: 256
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 110;

void query(const ll x){cout<<'?'<<' '<<x<<endl;fflush(stdout);}
char ttt[maxn];
bool get_res(){cin>>ttt;return ttt[0]=='Y'?true:false;}
void answer(const ll x){cout<<'!'<<' '<<x<<endl;fflush(stdout);}

ll pw[maxn],pw9[maxn];
bool e[maxn],e9[maxn];

int main()
{
	//freopen("tmp.in","r",stdin);
	//freopen("tmp.out","w",stdout);
	
	ll l=1; for(int i=0;i<=10;i++,l*=10ll) pw[i]=l,query(l),e[i]=get_res();
	
	if(e[10])
	{
		l=9; for(int i=1;i<=9;i++,l=l*10ll+9ll) query(l),e9[i]=get_res(),pw9[i]=l;
		for(int i=9;i>=1;i--) if(!e9[i]) { answer(pw[i]);return 0; }
		answer(pw[0]); return 0;
	}
	int now=8;
	while(!e[now]) now--;
	if(now==0)
	{
		for(ll i=1;i<10;i++)
		{
			query(i*10);
			if(get_res()) { answer(i); return 0; }
		}
	}
	else
	{
		ll k=0;
		for(int i=0;i<now;i++)
		{
			ll l=1,r=9;
			while(l<=r)
			{
				ll mid=l+r>>1;
				query(k*10+mid);
				if(get_res()) l=mid+1;
				else r=mid-1;
			}l--;
			k=k*10+l;
		}
		k*=10ll;
		for(ll i=0;i<10;i++)
		{
			query((k+i)*10);
			if(get_res()) { answer(k+i); return 0; }
		}
	}
	
	return 0;
}


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

int main()
{
	int n;
	cin >> n;
	vector<int> v(n+1, 0);
	vector<pair<int, int>> ret(n + 1, { 0,0 });
	for (int i = 1; i <= n; ++i) {
		cin >> v[i];
		if (i + v[i] <= n) {
			++ret[i + v[i]].second;
		}
		if (1 <= i - v[i]) {
			++ret[i - v[i]].first;
		}
	}

	long long sum = 0;
	for (int i = 1; i <= n; ++i) {
		long long a = ret[i].first;
		long long b = ret[i].second;
		sum += a * b;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 5636
#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...));
}

int main() {
	std::string s, t; cin >> s >> t;

	if([s, t]() {
		std::vector<bool> A(40, false);
		for(int i = 0; i < s.size(); i++) A[s[i] - 'a'] = true;
		
		return !all_of(begin(t), end(t), [A](auto v) { return A[v - 'a']; });
	}()) {
		printf("-1\n");
		return 0;
	}
	
	std::vector<std::vector<int>> vec(30);
	for(int i = 0; i < s.size(); i++) vec[s[i] - 'a'].push_back(i + 1);

	i64 A = 0, B = 0;
	for(int i = 0; i < t.size(); i++) {
		int p = t[i] - 'a';

		auto it = upper_bound(begin(vec[p]), end(vec[p]), B);
		if(it == end(vec[p])) {
			A++;
			B = vec[p].front();
		} else {
			B = *it;
		}
	}

	i64 ans = A * (i64)s.size() + B;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1216
s = input()
k = int(input())

li = []

count = 1
tmp = s[0]

if len(s) == 1:
    print(k//2)
    exit()

for i in range(1,len(s)):
    if s[i] == tmp:
        count += 1
    else:
        li.append((s[i-1],count))
        count = 1
    tmp = s[i]
if count != 1:
    li.append((s[-1],count))

if len(li) == 1:
    print(li[0][1] * k // 2)
elif li[0][0] == li[-1][0] and k >= 2:
    li2 = [(li[0][0],li[0][1]+li[-1][1])]
    for i in range(1,len(li)-1):
        li2.append(li[i])
    ans = 0
    for i in li2:
        ans += i[1] // 2
    ans *= k - 1
    for i in li:
        ans += i[1] // 2
    print(ans)
else:
    ans = 0
    for i in li:
        ans += i[1] // 2
    ans *= k
    print(ans)


Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    ll n;
    cin >> n;
    
    vector<ll> a(n);
    REP(i, n){
        cin >> a[i];
    }
    
    ll ans = 0;
    for(ll i = 1; i < n; i++){
        if(a[i] == a[i - 1]){
            ans++;
            a[i] = 10005 + i;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  bool ans = true;
  bool nbool = false;
  bool wbool = false;
  bool sbool = false;
  bool ebool = false;
  int sizes = s.size();
  for(int i=0;i<sizes;i++){
    if(s[i]=='N'){
      nbool = true;
    } else if (s[i]=='W'){
      wbool = true;
    } else if (s[i]=='S'){
      sbool = true;
    } else {
      ebool = true;
    }
  }
  if(nbool!=sbool){
    ans = false;
  } else if (wbool!=ebool){
    ans = false;
  }
  if(ans == true){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), greater<type>())
#define SORTF(a, comp) sort(ALL(a), comp)
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUT2(a) REPx(&x, a) INPUT(x);
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define ENDL cout << endl;

const int INF = 2e9;
// const LL INF = 9e18;
const LL MOD = 1e9+7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI a(n), ans(n);
  INPUT(a);
  ans[0] = a[1];
  REP2(int, i, 2, n) ans[0] ^= a[i];
  REP2(int, i, 1, n) ans[i] = a[0] ^ a[i] ^ ans[0];
  debug1(ans);

  return 0;
}

Measured memory_bytes: 5416
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a,q=0,w=0;
  int c[100000],d[100000],e[100000];
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>c[i];
  }
  for(int i=0;i<a;i++){
    cin>>d[i];
  }
  for(int i=1;i<a;i++){
    cin>>e[i];
  }
  for(int i=0;i<a;i++){
    // cout<<c[i-1]<<" "<<c[i]<<" "<<i<<"\n";
    if(i!=0&&c[i-1]+1==c[i]) q=q+e[c[i]-1];
    q=d[c[i]-1]+q;
  }
  cout<<q<<"\n";
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int a, b, max;
    scanf("%d %d", &a, &b);
    max = a;
    if (a < b) {
        max = b;
    }
    if (8 >= max) {
        printf("Yay!\n");
    } else {
        printf(":(\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    long double n, t, a, c=1;
    int h;
    cin >> n >> t >> a;
    vector <long double> d(n);
    for(int i=0; i<n; i++)
    {
        cin >> h;
        d[i]=abs(a-(t-h*0.006));
    }
    long double b=d[0];
    for(int i=1; i<n; i++)
    {
        if(b>d[i])
        {
            c=i+1;
            b=d[i];
        }
    }
    cout << c << '\n';
}

Measured memory_bytes: 384
#include<math.h>
#include<iomanip>
#include<iostream>
using namespace std;

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

    double sum = 0;
    for(int i = 0; i < n; i++){
        sum += 1 / (double)a[i];
    }

    //cout << sum << endl;

    double ans = 0;
    ans = (double) (1 / sum);

    cout << fixed << setprecision(15) << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<numeric>
#include<algorithm>
#include <sstream>
#include<cstring>
#include<cmath>
#include<iterator>
#include<utility>
#include<array>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<forward_list>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;

int main()
{
#ifdef RAHUL
    freopen("input.txt","r",stdin);
#endif
    ll int a;
    string s,t;
    cin>>a;
    cin>>s;
    cin>>t;
    string rahul;
    for(int i=0;i<a;i++)
    {
    	cout<<s[i]<<t[i];
    }
    cout<<endl;
    //cout<<rahul<<endl;


}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,k,d,ans,x,a[110];
int main(void)
{
    cin>>n>>k;
    for(int i=1;i<=k;i++)
    {
        cin>>d;
        while(d--)
        {
            cin>>x;
            a[x]++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(!a[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3192
i = list(input())
yy = int(i[0] + i[1])
mm = int(i[2] + i[3])
 
if ((yy > 12) or (yy == 0))  and (0 < mm <= 12):
    print("YYMM")
elif (0 < yy <= 12) and ((mm > 12) or (mm == 0)):
    print("MMYY")
elif (0 < yy <= 12) and (0 < mm <= 12):
    print("AMBIGUOUS")
else:
    print("NA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007

int main() {
    int X, Y, Z, K; cin >> X >> Y >> Z >> K;
    vll A(1000, 0), B(1000, 0), C(1000, 0);
    rep(i, X) cin >> A[i];
    rep(j, Y) cin >> B[j];
    rep(k, Z) cin >> C[k];
    vll D(1e6 + 1, 0);
    rep(i, X) {
        rep(j, Y) {
            D[i * Y + j] = A[i] + B[j];
        }
    }
    sort(all(D), greater<ll>());
    vll E(3e6 + 1, 0);
    //int a = min(X * Y, K), b = min(Z, K);
    rep(i, min(X * Y, K)) {
        rep(j, min(Z, K)) {
            E[i * min(Z, K) + j] = D[i] + C[j];
        }
    }
    sort(all(E), greater<ll>());
    rep(i, K) cout << E[i] << endl;

}



Measured memory_bytes: 31616
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
using namespace std;

int main()
{
    int n, l, tmp = 100000, ans = 0;

    cin >> n >> l;

    for(int i = 1;i <= n;i++){
        if(tmp > abs(l + i - 1)){
            tmp = abs(l + i - 1);
        }
    }

    if(tmp == 0){
        for(int i = 1;i <= n;i++){
            ans += l + i - 1;
        }

        cout << ans;
    }
    else if(l < 0){
        for(int i = 1;i <= n;i++){
            ans += l + i - 1;
        }
        ans += tmp;

        cout << ans;
    }
    else{
        for(int i = 1;i <= n;i++){
            ans += l + i - 1;
        }
        ans -= tmp;

        cout << ans;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    int n;
    cin>>n;
    vi as(n - 1);
    cin>>as;

    vi cnt(n);
    rep(i, n - 1) cnt[as[i] - 1]++;
    rep(i, n) cout<<cnt[i]<<endl;
}

Measured memory_bytes: 4784
N, M = gets.chomp.split.map(&:to_i)

graph = Array.new(N) { Array.new(N, false) }

M.times do
  a, b = gets.chomp.split.map { |i| i.to_i - 1 }

  graph[a][b] = true
  graph[b][a] = true
end

queue = [[1, 0]]
ans = 0

until queue.empty?
  mask, cur = queue.shift

  if mask == ((1 << N) - 1)
    ans += 1
    next
  end

  (0...N).each do |i|
    next if i == cur
    next if (mask >> i & 1) == 1
    next unless graph[cur][i]

    queue << [mask | (1 << i), i]
  end
end

puts ans



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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef pair<ld, ld> pld;

int main() {

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

	//ifstream cin("input.txt");
	//freopen("input.txt", "r", stdin);
	//ofstream cout("output.txt");

	int n;
	cin >> n;

	map<ll, int> mapa;
	
	while (n--) {
		ll a;
		cin >> a;
		++mapa[a];
	}

	vector<ll> two, four;
	for (auto it : mapa) {
		if (it.second >= 2) {
			two.pb(it.first);
		}
		if (it.second >= 4) {
			four.pb(it.first);
		}
	}

	sort(all(two));
	sort(all(four));

	ll ans = 0;
	if (sz(four) >= 1) {
		ans = max(ans, four.back() * four.back());
	}
	if (sz(two) >= 2) {
		ans = max(ans, two.back() * two[sz(two) - 2]);
	}

	cout << ans << "\n";

}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

const int maxN = 100005;
const int INF = 1e9;

class TaskA {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		string s, t;
		cin >> s >> t;
		t.pop_back();

		if(s == t){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}

	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};

int main(){
	srand(time(NULL));
	ios_base::sync_with_stdio(false);
	TaskA solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;


int main(){FIN
    int a,b;cin>>a>>b;

    cout<< ((b%a==0) ? a+b : b-a )<<endl;
    return 0;
}

Measured memory_bytes: 892
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

int main() {
  char s[1024];
  scanf("%s", s);
  int w = in();

  const int n = strlen(s);
  for (int i = 0; i < n; i += w) {
    putchar(s[i]);
  }
  puts("");

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, seisu) for(int i = 0; i < (int)(seisu); i++)
typedef long long ll;
///vector<pair<string, int>>;

int main(){
  ll n, m;
  cin >> n >> m;
  ll del =  (n + m) * 2 - 4;
  ll ans;
  if (n == 1 || m == 1) ans = abs(n * m - 2);
  else ans = n * m - del;
  cout << ans << endl;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (int argc, char const *argv[])
{
    int64_t N, A;
    int64_t ans = 0, num = 0, min = (int)1e9;

    scanf("%"PRId64, &N);
    for (int i = 0; i < N; i++) {
        scanf("%"PRId64, &A);
        ans += llabs(A);
        if (A < 0) num++;
        if (llabs(A) < min) min = llabs(A);
    }

    printf("%"PRId64"\n", (num % 2) ? (ans - min * 2) : ans);
}


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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int H, W, h, w; cin >> H >> W >> h >> w;
	int ans = H * W - h * W - w * H + h * w;
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

int main() {
    string t;
    cin >> t;
    int n = t.size();

    for (int i=0; i<n; i++){
        if ((t[i] == 'P' or t[i] == '?') and  i < n-1 and (t[i+1] == '?' or t[i+1] == 'D')){
            t[i+1] = 'D';
            t[i] = 'P';        
        }
        else if (t[i] == '?'){
            t[i] = 'D';
        }
    }
    cout << t << endl;   
}

Measured memory_bytes: 3756
let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let read_ints () = read_line () |> split_on_char ' ' |>  List.map int_of_string

let dfs vs n =
  let d = Array.make n (-1) in
  let rec doit i j =
    d.(i) <- j;
    List.iter (fun v -> if d.(v) = (-1) then doit v j) vs.(i) in
  Array.iteri (fun i e -> if e = (-1) then doit i i) d;
  d

let solve n m =
  let g = Array.make n [] in
  for _ = 0 to m - 1 do
    match read_ints () with
    | [s; t] ->
      g.(s) <- t :: g.(s);
      g.(t) <- s :: g.(t);
    | _ -> assert false
  done;
  let v = dfs g n in
  let q = read_int () in
  for _ = 0 to q - 1 do
    match read_ints () with
    | [s; t] -> print_endline (if v.(s) = v.(t) then "yes" else "no")
    | _ -> assert false
  done

let () =
  match read_ints () with
  | [n;m] -> solve n m
  | _ -> assert false

Measured memory_bytes: 19016
#include<stdio.h>
#include<string.h>

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

   int sizeS=strlen(S);
   if(sizeS<=K){
      printf("%s",S);
   }
   if(sizeS>K){
      for(int i=0;i<K;i++){
         printf("%c",S[i]);
      }
      printf("...");
   }
   return 0;
}

Measured memory_bytes: 1732
main = do
  [n,a,b] <- map read . words <$> getLine
  print . sum $ [n' | n' <- [1..n], a <= (sumDigit n') && (sumDigit n') <= b]

sumDigit :: Int -> Int
sumDigit 0 = 0
sumDigit n = sumDigit (n `div` 10) + n `mod` 10


Measured memory_bytes: 508
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace abc163
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
			solve_abc163A();
			Console.Out.Flush();
        }

        public static void solve_abc163C()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int[] res = new int[n];
            //int prev = a.Length > 1 ? a[0] != a[1] ? a[1] : a[0] : a[0];
            //int cnt = a.Length > 1 ? a[0] != a[1] ? 1 : 0 : 0;
            //List<int> children = new List<int>();
            for (int i = 0; i < a.Length; i++)
            {
                res[a[i] - 1]++;
            }

            for (int i = 0; i < res.Length; i++)
            {
                Console.WriteLine(res[i]);
            }
        }

        public static void solve_abc163B()
        {
            int[] nm  = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int n = nm[0];
            int m = nm[1];
            int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            long sum = 0;
            for (int i = 0; i < m; i++)
            {
                sum += a[i];
            }
            Console.WriteLine(sum <= n ? n - sum : -1);
        }

        public static void solve_abc163A()
        {
            int r = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine(2 * Math.PI * r);
        }
    }
}


Measured memory_bytes: 28512
a[]={0,0,3,4,0,2,5,0,3,6,1,4,6};main(m,d){for(;scanf("%d%d",&m,&d)*m;printf("%.6sday\n","WednesThurs\0Fri\0  Satur\0Sun\0  Mon\0  Tues"+(a[m]+d)%7*6));}

Measured memory_bytes: 604