akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
using namespace std;
const int INF = int(1E9);
const int MAXN = 12;
const int MAXM = 1000;
int f[1<<MAXN];
int main() {
	int N, M; scanf("%d%d", &N, &M);
	int t = (1<<N);
	for(int i=0;i<t;i++)
		f[i] = INF;
	f[0] = 0;
	for(int i=1;i<=M;i++) {
		int a, b; scanf("%d%d", &a, &b);
		int s = 0;
		for(int j=1;j<=b;j++) {
			int c; scanf("%d", &c);
			s |= (1<<(c - 1));
		}
		for(int s1=t-1;s1>=0;s1--)
			f[s1|s] = min(f[s1|s], f[s1] + a);
	}
	if( f[t - 1] == INF ) puts("-1");
	else printf("%d\n", f[t - 1]);
}

Measured memory_bytes: 128
#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 if(s[i]=='9')cout << 1;
    else cout << s[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

const long long MOD = 1e9 + 7;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    string ans = "Yes";
    if (s[2] != s[3] || s[4] != s[5])
        ans = "No";
    cout << ans << endl;
}


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

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  
  vector<int> v;
  char prev = '1';
  int curr = 0;
  for (int i = 0; i <= s.size(); ++i) {
    if (s[i] != prev) {
      v.push_back(curr);
      prev = s[i];
      curr = 0;
    }
    ++curr;
  }
  
  vector<int> p(v.size() + 1);
  partial_sum(v.begin(), v.end(), p.begin() + 1);
  
  int mx = 0;
  for (int l = 0; l < v.size(); l += 2) {
    int r = min<int>(l + 2 * k + 1, v.size());
    mx = max(mx, p[r] - p[l]);
  }
  cout << mx << endl;
}

Measured memory_bytes: 1272
#include <iostream>

using namespace std;

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

    if (h == 1 || w == 1) {
        cout << "1" << endl;
    } else {
        cout << ((h + 1) / 2 + h / 2) * (w / 2) + ((h + 1) / 2) * (w % 2) << endl;
    }
}


Measured memory_bytes: 256
N = [int(e) for e in input().split()]
if(N[2]+N[0] <= N[1]):
    ans = N[1] - (N[2]+N[0])
else:
    ans = N[2] - (N[1]+N[0])
if(ans > 0):
    print(ans)
else:
    print(0)

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

#define INF 1234567890
#define ll long long
#define MOD 998244353

int N, M, K;
ll fa[200201];

ll pw(ll a, ll n)
{
	ll ret = 1;
	while(n)
	{
		if (n&1) ret=ret*a%MOD;
		a=a*a%MOD;
		n>>=1;
	}
	return ret;
}

ll inv(ll a)
{
	return pw(a, MOD-2);
}

ll C(ll n, ll r)
{
	return fa[n]*inv(fa[r])%MOD*inv(fa[n-r])%MOD;
}

int main()
{
	fa[0] = 1;
	for(int i=1; i<200201; i++)
		fa[i] = fa[i-1]*i%MOD;
	scanf("%d %d %d", &N, &M, &K);
	int X = N-1-K;
	
	ll res = 0;
	for(int x=X; x<=N-1; x++)
	{
		ll val = C(N-1, x)*M%MOD*pw(M-1, x)%MOD;
		res += val; res %= MOD;
	}
	printf("%lld", res);
	return 0;
}

Measured memory_bytes: 5408
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = Console.ReadLine();
            for (int i = 0; i < cin.Length-1; i ++)
            {
                if(cin[i] == cin[i+1] )
                {
                    Console.WriteLine("Bad");
                    return;
                }
            }

            Console.WriteLine("Good");
            return;
        }
    }
}


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

using namespace std;
typedef long long ll;

#define out(ans) cout << ans << endl
#define in(n) cin >> n
#define floop(i, N) for (ll i = 0; i < N; i++)
#define floop1(i, N) for (ll i = 1; i <= N; i++)
#define floopi(i, j, N) for (ll j = i + 1; j < N; j++)

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;

void solve();

int main()
{
    solve();
}

void solve()
{
    string s;
    in(s);
    ll flag = 0;
    ll ans = 0;
    floop(i, s.size())
    {
        if (s[i] == 'A')
        {
            flag++;
        }
        else if (s[i] == 'T')
        {
            flag++;
        }
        else if (s[i] == 'G')
        {
            flag++;
        }
        else if (s[i] == 'C')
        {
            flag++;
        }
        else
        {
            flag = 0;
        }
        chmax(ans, flag);
    }

    out(ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

ll frac[2000005];

ll comb(ll a, ll b) {
  ll ans = frac[a];
  ll tmp1, tmp2;
  ll h=mod-2;
  ll two;
  while(h>0) {
    two = 1;
    tmp1 = frac[b];
    tmp2 = frac[a-b];
    while(2*two<h) {
      two *= 2;
      tmp1 *= tmp1;
      tmp1 %= mod;
      tmp2 *= tmp2;
      tmp2 %= mod;
    }
    h -= two;
    ans *= tmp1*tmp2%mod;
    ans %= mod;
  }
  return ans;
}

int main() {
  frac[0] = 1;
  for(ll i=1;i<2000005;++i) frac[i] = frac[i-1]*i%mod;

  ll r1, c1, r2, c2;
  cin>>r1>>c1>>r2>>c2;
  ll ans = 0;
  for(ll r=r1;r<=r2;++r) {
    ans += (comb(r+c2+1, r+1)-comb(r+c1, r+1)+mod)%mod;;
    ans %= mod;
  }
  cout<<ans<<endl;
}



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

int main(){
  int n,m,ans=0;cin>>n>>m;
  if(m!=1){
    vector<int> x(m,0),d(m-1,0);
    REP(i,m) cin>>x.at(i);
    sort(x.begin(),x.end());
    REP(i,m-1) d.at(i)=x.at(i+1)-x.at(i);
    sort(d.begin(),d.end(),greater<int>());
    ans=accumulate(d.begin(),d.end(),0);
    for(int i=0;(i<n-1)&&(i<m-1);i++) ans-=d.at(i);
  }
  cout<<ans;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>

using namespace std;
using Int = long long;

constexpr double EPS = 1e-10;
constexpr long long MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

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

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int A, B, X;
double pi = 3.141592653589793;

bool check_1(double mid) {
    double empty_water = A * A * tan(pi/2 - mid) * A * (1.0/2);
    return empty_water + X < A * A * B;
}

bool check_2(double mid) {
    return X < A * B * tan(mid) * B * (1.0/2);
}

int main(void) {
    cin >> A >> B >> X;
    double mid, ng, ok;
    ng = 0;
    ok = pi/2;
    if (A*A*B/2.0 <= X) {
        for (int i = 0; i < 100; i++) {
            mid = (ng+ok)/2;
            if (check_1(mid)) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        printf("%.12f", 90 - (180 * ok/pi));
    } else {
        for (int i = 0; i < 100; i++) {
            mid = (ng+ok)/2;
            if (check_2(mid)) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        printf("%.12f", 90 - (180 * ok/pi));
    }
}


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

using namespace std;

int main(void){
	int n;

	cin >> n;


	int ok = 0;

	char s;

	for (int i = 0; i < n; i++){
		cin >> s;
		if (s == 'Y')
			ok = 1;
	}


	if (ok)
		cout << "Four";
	else
		cout << "Three";
}

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

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))

int main(void)
{
	//変数の宣言
	int n,m;
	int a,b;
	int num[100010];
	
	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	long long int temp,temp1,temp2;
	int max,min;
	int len;
	//データの読み込み
	
	scanf("%d %d",&n,&m);
	
	for(i=0;i<100010;i++){
		num[i]=0;
	}
	
	for(i=0;i<m;i++){
		scanf("%d %d",&a,&b);
		num[a]++;
		num[b]++;
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	for(i=1;i<=n;i++){
		if(num[i]%2==1) flag=1;
	}
	
	
//	printf("計算部分終了\n");
	//出力
	
	if(flag==0){
		printf("YES");
	}else{
		printf("NO");
	}
	
//	printf("結果の出力終了\n");
	
	return 0;
	
}



Measured memory_bytes: 512
/*
[abc114] C - 755
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

int N;
int t[] = {7, 5, 3};

bool is_ok(ll n) {
    bool has_t[3] = {false, false, false};
    for (; n > 0; n /= 10) {
        for (int i = 0; i < 3; i++) {
            if (n % 10 == t[i]) {
                has_t[i] = true;
            }
        }
    }
    return has_t[0] && has_t[1] && has_t[2];
}

int dfs(ll n) {
    if (n > N) {
        return 0;
    }

    int cnt = is_ok(n) ? 1 : 0;
    for (int d : t) {
        cnt += dfs(n * 10 + d);
    }

    return cnt;
}

ll solve() { return dfs(0); }

int main() {
    cin >> N;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
    
int main(){
    int n, in;
    int n0 = 0;
    int n1 = 0;
    int n2 = 0;
    cin >> n;
    rep(i, n){
        cin >> in;
        if(in%4 == 0){
            n2++;
        }else if(in%2 == 0){
            n1++;
        }else{
            n0++;
        }
    }
    if(n1 == 0) n2++;
    if(n2 >= n0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<map>
#include<queue>
#include<cstdio>
#include<bitset>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
using namespace std;
inline char nc() {
	static char b[100000],*s=b,*t=b;
	return s==t&&(t=(s=b)+fread(b,1,100000,stdin),s==t)?-1:*s++;
}
inline void read(int &x) {
	char b = nc(); x = 0;
	for (; !isdigit(b); b = nc());
	for (; isdigit(b); b = nc()) x = x * 10 + b - '0';
}
int n, m, N;
int dis[500005];
map < pair < int , int > , int > h;
vector < pair < int , int > > g[500005];
bitset < 500005 > vis;
priority_queue < pair < int , int > , vector < pair < int , int > > , greater < pair < int , int > > > q;
inline void aE(int u, int v, int w) {
	g[u].pb(mp(v, w)); g[v].pb(mp(u, w));
}
inline int idx(int u, int c) {
	return h.count(mp(u, c)) ? h[mp(u, c)] : h[mp(u, c)] = ++N;
}
int dijkstra() {
	memset(dis, 0x3f, sizeof(dis));
	q.push(mp(dis[1] = 0, 1));
	while (!q.empty()) {
		int u = q.top().sec; q.pop();
		if (!vis[u]) for (int v, w, i = 0; i < g[u].size(); ++i) {
			v = g[u][i].fir, w = g[u][i].sec;
			if (!vis[v] && dis[v] > dis[u] + w) {
				dis[v] = dis[u] + w; q.push(mp(dis[v], v));
			}
		} vis[u] = 1;
	} return dis[n] == 0x3f3f3f3f ? -1 : dis[n] / 2;
}
int main() {
	read(n); read(m); N = n;
	for (int u, v, c, a, b, i = 0; i < m; ++i) {
		read(u); read(v); read(c);
		a = idx(u, c); b = idx(v, c);
		aE(u, a, 1); aE(v, b, 1); aE(a, b, 0);
	}
	printf("%d\n", dijkstra());
	return 0;
}

Measured memory_bytes: 58364
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    if n%2 == 0 {
        println!("0.5");
    } else {
        println!("{}", (n-n/2) as f64 / n as f64);
    }
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FASTIO ios::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define mod 1000000007

int main() {
    FASTIO;
    int n, ans = 0;
    cin >> n;
    rep(i, n) {
        int a;
        cin >> a;
        ans += a - 1;
    }
    cout << ans << "\n";
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<string> a = {"SS", "SW", "WS", "WW"};
  s = s + s[0];
  string ans = "-1";
  for (int i = 0; i < 4; i ++) {
    string tmp = a[i];
    for (int j = 1; j <= n; j ++) {
      if (s[j] == 'o' && tmp[j] == 'S') {
        if (tmp[j - 1] == 'S') tmp += 'S';
        else tmp += 'W';
      } else if (s[j] == 'o' && tmp[j] == 'W') {
        if (tmp[j - 1] == 'S') tmp += 'W';
        else tmp += 'S';
      } else if (s[j] == 'x' && tmp[j] == 'S') {
        if (tmp[j - 1] == 'S') tmp += 'W';
        else tmp += 'S';
      } else if (s[j] == 'x' && tmp[j] == 'W') {
        if (tmp[j - 1] == 'S') tmp += 'S';
        else tmp += 'W';
      }
    }
    if (tmp[0] == tmp[n] && tmp[1] == tmp[n + 1]) ans = tmp.substr(0, n);
  }

  cout << ans << endl;
}

Measured memory_bytes: 720
fun main(args:Array<String>) {
	val (n,m) = readLine()!!.split(" ").map{ it.toInt() }
	val cake = (1..n).map{
		readLine()!!.split(" ").map{it.toLong()}
	}.map{
		listOf(
				 it[0] + it[1] + it[2],
				 it[0] + it[1] - it[2],
				 it[0] - it[1] + it[2],
				 it[0] - it[1] - it[2],
				-it[0] + it[1] + it[2],
				-it[0] + it[1] - it[2],
				-it[0] - it[1] + it[2],
				-it[0] - it[1] - it[2]
		)
	}
	
	(0..7).map{ i->
		cake.map{ it[i] }.sorted().takeLast(m).sum()
	}.max().let { println(it) }
	
}

Measured memory_bytes: 41300
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
	int n,t,a[7],y;
	while(1){
		cin >> n;
		if(n==0){
			return 0;
		}
		for(t=0;t<7;t++){
			a[t]=0;
		}
		for(t=0;t<n;t++){
			cin >> y;
			y=y/10;
			if(y>6){
				y=6;
			}
			a[y]++;
		}
		for(t=0;t<7;t++){
			cout << a[t] << endl;
		}

	}
}

Measured memory_bytes: 1160
#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)

#define rep2(i, N, s) for(int (i) = (s); (i) < (N) + (s); (i) ++)
#define rrep(i, N) for(int (i) = (N) - 1; (i) >= (0); (i) --)
#define rrep2(i, N, s) for(int (i) = (s); (i) >= (s) - (N) + 1; (i) --)
#define INF 1e9
#include <cmath>
#include <limits>

#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
using namespace std;

typedef long long ll;
typedef  pair<int, int> pint;

int main() {
    vector<int> n(3);
    rep(i, 3){
        cin >> n[i];
    }
    sort(n.begin(), n.end());
    cout << 10 * n[2] + n[1] + n[0] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int ans=0;
  string a,b,c;
  cin >> n >> a >> b >> c;
  for(int i=0; i<n; i++){
    if(a[i] == b[i] && b[i] == c[i]){
      continue;
    }else{
      if(a[i] == b[i] || b[i] == c[i] || c[i] == a[i]){
        ans++;
        continue;
      }else{
        ans += 2;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)

constexpr int evx[4] = { 1, 0, -1, 0 };
constexpr int evy[4] = { 0, 1, 0, -1 };

//----------------------------------
//----------------------------------

signed main()
{
    ios::sync_with_stdio(false);
	double n, d, x;
	cin >> n >> d >> x;
	double a = 0;
	while(n > 0)
	{
		a += d + (2*n - 1)*x / 2.0;
		d = (d * (n + 1) /n + 5*x/(2*n));
		x = (n + 2)/n*x;
		n -=1;
	}
	cout << scientific <<  std::setprecision(12) <<  a << '\n';

}



Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main (){

	char a[13];
	cin>>a;

	for(int i = 0;i < 4;i++){
		printf("%c",a[i]);
	}
	printf(" ");
	for(int i = 4;i < 12;i++){
		printf("%c",a[i]);
	}

	printf("\n");
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

// get<K>(tuple型の変数)

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

const long double pi = acos(-1);
const long double eps = 0.0000000001;

long double a, b, x;

// theta(radian) 傾けて維持できる水の体積
long double f(long double theta){
    if(theta > pi/2.0 - eps) return 0.0;
    if(theta < eps) return a*a*b;
    if(a * tan(theta) <= b) return a * a * b - a * a * a * tan(theta) / 2.0;
    else return a * b * b / 2.0 / tan(theta);
}

void input(){
    cin >> a >> b >> x;
}

void solve(){
    long double ng = pi / 2.0;
    long double ok = 0.0;

    for(int _=0; _<100000; ++_){
        long double mid = (ok + ng) / 2.0;
        (f(mid) > x? ok:ng) = mid; 
    }
    cout << setprecision(20) << ok * 180.0 / pi << endl;
}


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

    input();
    solve();
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
	// write your code here
        Scanner scanner = new Scanner(System.in);
            int b = scanner.nextInt();
        
            while(b > 0){
                int c = b % 10;
                if(c == 7)
                {
                    System.out.println("Yes");
        
                    return;
                }
                b /= 10;
 
            }
            System.out.println("No");
 
        }
    }


Measured memory_bytes: 35840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, a, b;
  in(n);
  string s, u;
  vector<char> t(10);
  map<string, ll> c;
  rep(i, n){
    in(s);
    rep(j, 10)
      t[j] = s[j];
    s = "";
    sort(all(t));
    rep(j, 10){
      u = t[j];
      s += u;
    }
    if(c[s] != 0)
      c[s]++;
    else
      c[s] = 1;
  }
  a = 0;
  for(auto i = c.begin(); i != c.end(); i++){
    if(i->second > 1)
      a += i->second * (i->second - 1) / 2;
  }
  out(a);
  memi;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
#define fst first
#define snd second
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}
inline int Log2(ll x) {int k; for(k=0; x>0; ++k) x>>=1; return k;} // number of binary digits
template<typename T> inline int count_between(vector<T>& a, T l, T r) {
  return lower_bound(all(a), r) - lower_bound(all(a), l); // [l, r)
}


int main() {
  ll n; cin >> n;
  V a(n);
  V cnt(n);
  rep(i, n) {
    cin >> a[i];
    a[i];
    ++cnt[a[i]];
  }

  bool ok = true;

  int m = *max_element(all(a));
  int k = (m+1)/2;
  rep(i, k) if (cnt[i] > 0) ok = false;
  if (cnt[k] != 1 + m%2) ok = false;
  rep2(i, k+1, m+1) if (cnt[i] < 2) ok = false;

  cout << (ok ? "Possible" : "Impossible") << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
dp = [0 for i in range(n+10)]
for i in range(n):
    dp[a[i]] += 1
ans = 0
for i in range(n+10):
    ans += dp[i]*(dp[i]-1)//2
for i in range(n):
    print(ans-(dp[a[i]]-1))
    


Measured memory_bytes: 26140
from collections import Counter

n = int(input())
s_input = [input()[0] for i in range(n)]

s_c = [v for k,v in Counter(s_input).items() if k in 'MARCH']
n_c = len(s_c)
if n_c<3:
    print(0);exit()
ans = 0
for i in range(n_c):
    for j in range(i+1,n_c):
        for k in range(j+1,n_c):
            ans+=s_c[i]*s_c[j]*s_c[k]
print(ans)

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
#define plll pair <pair <ll, ll>, ll>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define pld pair <ld, ld>
#define all(a) a.begin(), a.end()
#define vvl vector <vector <ll> >
#define cld complex <double>

typedef long long ll;

typedef long double ld;

using namespace std;

const ll maxn = 1e6 + 100;

ll n, m, k, t;

// ll A[maxn];
vector <ll> A;

int main() {
    pyshnapyshnakaa
    ll q, w, e, a, b, c;
    cin >> n;
    A.resize(n);
    for (q = 0; q < n; q++) {
        cin >> A[q];
        A[q]--;
    }
    vector <ll> cur = A;
    vector <ll> ANS;
    for (q = 0; q < n; q++) {
        ll i = -1;
        // cout << cur.size() << " SZ" << endl;
        for (w = cur.size() - 1; w >= 0; w--) {
            // cout << w << " " << cur[w] << endl;
            if (cur[w] == w) {
                i = w;
                break;
            }
        }
        // cout << i << " I" << endl;
        if (i == -1) {
            cout << i;
            return 0;
        }
        ANS.pb(i);
        vector <ll> cur1;
        for (w = 0; w < i; w++) {
            cur1.pb(cur[w]);
        }
        for (w = i + 1; w < cur.size(); w++) {
            cur1.pb(cur[w]);
        }
        cur = cur1;
    }
    reverse(all(ANS));
    for (q = 0; q < ANS.size(); q++) {
        cout << ANS[q] + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3668
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct E{char n[6];int c;}E;
E e[100000000],t;
int N,p,i,j;
int cmp(const void *a,const void *b)
{
	E *x=(E*)a,*y=(E*)b;

	
	return strlen(x->n)-strlen(y->n)==0?strcmp(x->n,y->n):strlen(x->n)-strlen(y->n);
}

int main()
{
	scanf("%d\n",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s%d\n",t.n,&t.c);
		for(j=0;j<p;j++)
		{
			if(strcmp(e[j].n,t.n))continue;
			e[j].c+=t.c;
			break;
		}
		if(j==p)
			e[p++]=t;
	}
	qsort(e,p,sizeof(E),cmp);
	for(i=0;i<p;i++)
		printf("%s %d\n",e[i].n,e[i].c);
	return 0;
}

Measured memory_bytes: 640
//-------------
//include
//-------------
#include <map>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <random>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef long long LL;
typedef  vector<int> VI;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MK make_pair
#define PB push_back
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(a) cout<<a<<endl
//-------------
//repetition
//-------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(c) REP(i,SZ(c))cerr<<#c<<i<<"="<<(c[i])<<endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const int MOD = 1000000007;
int main()
{
	int a;
	cin >> a;
	if (a / 100 == a % 10)
	{
		COUT("Yes");
	}
	else
	{
		COUT("No");
	}

#ifdef _DEBUG
	while(1);
#endif // _DEBUG

	return 0;
}

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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

typedef long long ll;
typedef pair<int, int> ii;

int main(){

  string s;
  cin >> s;
  rep(i, s.size() - 1){
    if(s[i] == 'A' && s[i+1] == 'C'){
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int S,h,m;
	scanf("%d",&S);
	for(h=0;S>=3600;h++)S-=3600;
	for(m=0;S>=60;m++)S-=60;
	printf("%d:%d:%d\n",h,m,S);
	return 0;
}

Measured memory_bytes: 592
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static         Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);

	public static void main(String[] args) {
			int N=sc.nextInt();
			int M=sc.nextInt();
			
			ArrayList<Integer> cc=new ArrayList<>(N);
			Map<Integer, Integer> map = new HashMap<Integer, Integer>(N);
			
			for(int i=0;i<N;i++) {
				int a=sc.nextInt();
				int b=sc.nextInt();
				
				if(map.containsKey(a)) {
					map.replace(a, map.get(a)+b);
					
				}else {
					map.put(a, b);
					cc.add(a);
				}
			}
			Collections.sort(cc);
			
			long ans=0;
			long M2=0;
			for(int i:cc) {
				long v=map.get(i);
				if(M-M2<=v) {
					ans+=(M-M2)*i;
					break;
				}else {
					M2+=v;
					ans+=(long)v*i;
				}
			}
			p(ans);
			
			
			
	}
	static int c=0;

	
	//N==S
	//E==W
//83 S 
	//69E
	//78N
	//87W
	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 100728
#include<stdio.h>

int n, A[50];

// 入力値の M から選んだ要素を引いていく再帰関数
int solve(int i, int m) {
  if ( m == 0 ) return 1;
  if ( i >= n ) return 0;
  int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}

int main() {
  int q, M, i;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  scanf("%d", &q);
  for ( i = 0; i < q; i++ ) {
    scanf("%d", &M);
    if ( solve(0, M) ) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}


Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,m,i,a,b,dad[N],ind[N];
vector<int>e[N];
queue<int>q;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;
	for(i=1;i<=n-1+m;++i)cin>>a>>b,e[a].push_back(b),ind[b]++;
	for(i=1;i<=n;++i)if(!ind[i])q.push(i);
	while(!q.empty()){
		a=q.front();q.pop();
		for(int i:e[a])if(!--ind[i])dad[i]=a,q.push(i);
	}
	for(i=1;i<=n;++i)cout<<dad[i]<<'\n';
	return 0;
}

Measured memory_bytes: 7040
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<cassert>
#include<complex>//real().imag().
#include<cctype>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<string>
#include<utility>
#include<iterator>
#define pii pair<int,int>
#define make_pair mp
using namespace std;
typedef long long ll;
int main()
{
    // freopen("D:\\in.txt","r",stdin);
    // freopen("D:\\out.txt","w",stdout);
    //ios::sync_with_stdio(false);
    //system("pause");
  ll a,b,x,l,r;
  cin>>a>>b>>x;
  if(a%x==0)l=a/x;
  else
    l=a/x+1;
  r=b/x;
  cout<<r-l+1<<endl;

  return 0;
}



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

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    int N;cin>>N;
    set<int> S;
    rep(i,N){
        int d;cin>>d;
        S.insert(d);
    }
    int ans=0,prev=-1;
    for(auto v : S){
        if(prev!=v) ans++;
        prev=v;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    a, b, c = i_map()

    for i in range(1,b+1):
        if a * i % b == c:
            print('YES')
            exit()

    print('NO')

if __name__ == '__main__':
    main()


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

dict = {"A":"00000",\
        "B":"00001",\
        "C":"00010",\
        "D":"00011",\
        "E":"00100",\
        "F":"00101",\
        "G":"00110", \
        "H":"00111", \
        "I":"01000", \
        "J":"01001", \
        "K":"01010", \
        "L":"01011", \
        "M":"01100", \
        "N":"01101", \
        "O":"01110", \
        "P":"01111", \
        "Q":"10000", \
        "R":"10001", \
        "S":"10010", \
        "T":"10011", \
        "U":"10100", \
        "V":"10101", \
        "W":"10110", \
        "X":"10111", \
        "Y":"11000", \
        "Z":"11001", \
        " ":"11010", \
        ".":"11011", \
        ",":"11100", \
        "-":"11101", \
        "'":"11110", \
        "?":"11111"}

dict2 = {"101":" ",\
         "000000":"'",\
         "000011":",", \
         "10010001":"-", \
         "010001":".",\
         "000001":"?",\
         "100101":"A",\
         "10011010":"B",\
         "0101":"C",\
         "0001":"D",\
         "110":"E",\
         "01001":"F",\
         "10011011":"G",\
         "010000":"H",\
         "0111":"I",\
         "10011000":"J",\
         "0110":"K",\
         "00100":"L",\
         "10011001":"M",\
         "10011110":"N",\
         "00101":"O",\
         "111":"P",\
         "10011111":"Q",\
         "1000":"R",\
         "00110":"S",\
         "00111":"T",\
         "10011100":"U",\
         "10011101":"V",\
         "000010":"W",\
         "10010010":"X",\
         "10010011":"Y",\
         "10010000":"Z"}

N = list(get_input())

for l in range(len(N)):
    S1 = N[l]
    S2 = ""

    for i in range(len(S1)):
        S2 = S2 + dict[S1[i]]

    S3 = ""
    while S2 != "":
        flag = False
        for i in range(3, len(S2)+1):
            s = S2[0:i]
            if s in dict2:
                S3 = S3 + dict2[s]
                S2 = S2[i:]
                flag = True
                break
        if flag == False:
            break

    print(S3)



Measured memory_bytes: 5716
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
//		int z = Integer.parseInt(sa[1]);
		int w = Integer.parseInt(sa[2]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);;
		}
		br.close();

		if (n == 1) {
			System.out.println(Math.abs(a[0] - w));
		} else {
			int m1 = Math.abs(a[n - 1] - w);
			int m2 = Math.abs(a[n - 1] - a[n - 2]);
			System.out.println(Math.max(m1, m2));
		}
	}
}


Measured memory_bytes: 23892
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
vector<ll> pw2(51,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    string s,t; cin>>s>>t;
    bool ans=true;
    if(sz(s)+1==sz(t)){
        rep(i,sz(s)){
            if(s[i]!=t[i]) ans=false;
        }
    }
    else ans=false;
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int H,W;
  int ans=0;
  cin>>H>>W;
  vector<string> s(H);
  for(int i=0;i<H;i++){
    cin>>s[i];
  }
  vector<vector<int> > up(H,vector<int>(W)),down(H,vector<int>(W)),right(H,vector<int>(W)),left(H,vector<int>(W));
  for(int i=0;i<H;i++){
    for(int j=1;j<W;j++){
      if(s[i][j]=='#'){
        left[i][j]=0;
      }else{
        if(s[i][j-1]=='.'){
          left[i][j]=left[i][j-1]+1;
        }else{
          left[i][j]=0;
        }
      }
    }
  }
  for(int i=0;i<H;i++){
    for(int j=W-2;j>=0;j--){
      if(s[i][j]=='#'){
        right[i][j]=0;
      }else{
        if(s[i][j+1]=='.'){
          right[i][j]=right[i][j+1]+1;
        }else{
          right[i][j]=0;
        }
      }
    }
  }

  for(int i=1;i<H;i++){
    for(int j=0;j<W;j++){
      if(s[i][j]=='#'){
        up[i][j]=0;
      }else{
        if(s[i-1][j]=='.'){
          up[i][j]=up[i-1][j]+1;
        }else{
          up[i][j]=0;
        }
      }
    }
  }

  for(int i=H-2;i>=0;i--){
    for(int j=0;j<W;j++){
      if(s[i][j]=='#'){
        down[i][j]=0;
      }else{
        if(s[i+1][j]=='.'){
          down[i][j]=down[i+1][j]+1;
        }else{
          down[i][j]=0;
        }
      }
    }
  }

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      ans=max(up[i][j]+right[i][j]+left[i][j]+down[i][j]+1,ans);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 67328
#include<stdio.h>
int main()
{
	int n,k,sum=0;
	scanf("%d",&n);
	k=n;
	while(n)
	{
		sum+=n%10;
		n=n/10;
	}
	if(k%sum==0)
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;

int main(){
	int N;
	
	while(cin>>N,N){
		map<int,long long int> mp;
		vector <int> vi;
		int cnt=0;
		for(int i=0;i<N;i++){
			long long int num,tanka,suuryo;
			cin>>num>>tanka>>suuryo;
			if(mp[num]==0){
				vi.push_back(num);
			}
			mp[num]+=tanka*suuryo;
		}
		vector<int>::iterator it=vi.begin();
		for(;it!=vi.end();it++){
			if(mp[*it]>=1000000){
				cout<<*it<<endl;
				cnt++;
			}
		}
		if(cnt==0){
			cout<<"NA"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1288
//Volume0-0027
import java.util.*;

public class Main {
	
	//declare
  	private static final int END = 0;
	
    public static void main(String[] args) {

    	Calendar cl  = Calendar.getInstance();
    	String   ans;
    	String[] s;
    	int      month,
         	     date;

    	//initialize
    	cl.set(Calendar.YEAR,2004);
    	
    	//input
    	Scanner sc = new Scanner(System.in);
    	while(true){
    		s     = sc.nextLine().split("\\s");
    		month = Integer.parseInt(s[0]);
    		if(month==END){break;}
    		month--;
    		date  = Integer.parseInt(s[1]);
    		cl.set(Calendar.MONTH, month);
    		cl.set(Calendar.DATE, date);
    		
    		//calculate
    		ans = "";
    		switch (cl.get(Calendar.DAY_OF_WEEK)){
    			case (Calendar.MONDAY)   :{ans = "Monday";   break;}
    			case (Calendar.TUESDAY)  :{ans = "Tuesday";  break;}
    			case (Calendar.WEDNESDAY):{ans = "Wednesday";break;}
    			case (Calendar.THURSDAY) :{ans = "Thursday"; break;}
    			case (Calendar.FRIDAY)   :{ans = "Friday";   break;}
    			case (Calendar.SATURDAY) :{ans = "Saturday"; break;}
    			case (Calendar.SUNDAY)   :{ans = "Sunday";         }
    		}
    		//output
    		System.out.println(ans);
    	}
    }
}

Measured memory_bytes: 17240
#include <iostream>

// nの約数の個数を返す
long long d_num(long long n) {
  long long cnt = 0;
  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) cnt += 2; 
    if (i*i == n) --cnt;
  }
  return cnt;
}

// n以下の正の整数の約数の和を返す
long long d_num2(long long N) {
  long long cnt = 0;
  for (int n = 1; n <= N; ++n) {
    for (int i = 1; i * i <= n; ++i) {
      if (n % i == 0) cnt += 2; 
      if (i*i == n) --cnt;
    }
  } 
  return cnt;
}

int main() {
  int n; std::cin >> n;
  // long long sum = 0;
  // for (int c = 1; c <= n-1; ++c) {
  //   sum += d_num(n-c);
  // }
  std::cout << d_num2(n-1) << std::endl;
  // std::cout << sum << std::endl;

  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#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--)
typedef long long LL;
int N;
LL a[100001];
int main(){
	cin>>N;
	bool check=false;
	REP(i,N){
		cin>>a[i];
		if(a[i]%2==1){
			check=true;
		}
	}
	if(check==false){
		cout<<"second"<<endl;
	}else{
		cout<<"first"<<endl;
	}
}

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

#define ll long long
#define fr first
#define se second

using namespace std;

const long long N = 2e6 + 7;

ll res, n, m, x, a[N], cnt, q = 1;
string s, str;
set < ll > st;
vector< string > v;
int main()
{
    /// freopen( "input.txt", "r", stdin );
    /// freopen( "output.txt", "w", stdout );
	cin >> n;
	for ( int i=-1000; i<=1000; i++ ) {
		ll x = pow( i, 5 );
		for ( int j=-1000; j<=1000; j++ ) {
			ll y = pow( j, 5 );
			if ( x - y == n )
				return cout << i << ' ' << j, 0;
		}
	}
}


Measured memory_bytes: 4012
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
static inline void fast_io()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}
using namespace std;
using ll = long long;
using ld = long double;

int main()
{
    fast_io();

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


Measured memory_bytes: 3192
using System;
using System.Linq;
namespace ITP1_4_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] S = Console.ReadLine().Split();
            long[] a = new long[n];
            int i;
            for(i = 0; i < n; i++)
            {
                a[i] = long.Parse(S[i]);
            }
            Console.WriteLine("{0} {1} {2}", a.Min(), a.Max(), a.Sum());
        }
    }
}


Measured memory_bytes: 20180
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;

    int cnt = 0;
    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++){
            if(i >= j && s[i] == t[j]){
                int index = 0;
                while(i + index < n && s[i+index] == t[j+index])index++;
                cnt = max(cnt,index);
            }
        }
    }
    cout << 2 * n - cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string ans = "YES";
  int  n, m, cnt = 1;
  cin >> n ;
  vector<long long> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  for(int i=1;i<n;i++){
    if(a[i] != a[i-1]){
      cnt++;
    }
  }
  if(cnt != n){
    ans ="NO";
  }
  
  cout << ans <<endl;
}


Measured memory_bytes: 1792