akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

int W, H;
char field[101][101];

int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };

int ans;

void dfs( int x, int y, char c )
{
	field[x][y] = ' ';

	for( int i = 0; i < 4; i++ )
	{
		int nx = x + dx[i], ny = y + dy[i];

		if( 0 <= nx && nx < W && 0 <= ny && ny < H && field[nx][ny] == c )
			dfs( nx, ny, c );
	}
}

int main()
{
	while( std::cin >> H >> W, H | W )
	{
		for( int i = 0; i < H; i++ )
			for( int j = 0; j < W; j++ )
				std::cin >> field[j][i];

		ans = 0;

		for( int i = 0; i < W; i++ )
		{
			for( int j = 0; j < H; j++ )
			{
				if( field[i][j] != ' ' )
				{
					dfs( i, j, field[i][j] );
					ans++;
				}
			}
		}

		std::cout << ans << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
    int n,d;
    cin >> n >> d;

    int ans = n/(d+d+1);
    n -= ans*(d+d+1);
    if(n>0)ans++;

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
typedef long long int ll;
using namespace std;

int main(){
  ll n; cin >> n;
  if (n % 2) {cout << 0 << endl; return 0;}
  ll ans = 0;
  n /= 2;
  while(n > 0){
    n /= 5;
    ans += n;
  }
  cout << ans << endl;
  return 0;
}
  

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

int main(){ double aa, bb, cc, dd;
	scanf("%lf %lf %lf %lf", &aa, &bb, &cc, &dd);
	printf ("%lf\n", sqrt((aa-cc)*(aa-cc)+(bb-dd)*(bb-dd)));
	return 0;
}

Measured memory_bytes: 652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT32_MAX;

ll i,j,k;
long long euclid(long long x,long long y){
    long long a=max(x,y);
    long long b=min(x,y);
    if(a%b==0)return b;
    else{
        return euclid(b,a%b);
    }
}





int main(){
   ll N;
   cin>>N;
   string S;
   cin>>S;

   V red,blue,green;
   rep(i,N){
      if(S[i]=='R')red.push_back(i);
      if(S[i]=='G')green.push_back(i);
      if(S[i]=='B')blue.push_back(i);
   }
   ll ans=red.size()*blue.size()*green.size();
   for(ll cnt=1;cnt<=(N-1)/2;cnt++){
      for(ll c=0;c<N-2*cnt;c++)if(S[c]!=S[c+cnt]&&S[c+cnt]!=S[c+2*cnt]&&S[c+2*cnt]!=S[c])ans--;
   }
   cout<<ans<<endl;
   

}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000001
#define PI 3.14159265358979323846
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	string s;
	cin >> n >> s;
	int r=0, w=0, nb=0;
	for(int i = 0; i < n; i++)
	{
		if(s[i]=='R')
			r++;
		else
			w++;
	}
	for(int i = 0; i < r; i++)
	{
		if(s[i]=='W')
			nb++;
	}
	cout << nb << '\n';
}

Measured memory_bytes: 3772
#include<cmath>
using namespace std;
#define MAX 1000000

void eratos ( int n, bool prime[]){
    for ( int i = 0; i <= n; i++ ) prime[i] = false;
    for ( int i = 3; i <= n; i += 2 ) prime[i] = true;
    prime[2] = true;
    int limit = (int)sqrt((double)n) + 1;
    for ( int i = 3; i <= limit; i += 2 ){
        if ( !prime[i] ) continue;
        for ( int j = i + i; j <= n; j += i ) prime[j] = false;
    }
}


int main(){
    bool prime[MAX+1];
    eratos(MAX, prime);
    int n, sum, q;
    while( cin >> n && n){
	sum = 0;
	for ( int p = 2; p <= n; p++ ){
	    if ( !prime[p] ) continue;
	    q = n - p;
	    if ( p > q ) break;
	    if ( prime[q] ) sum++;
	}
	cout << sum << endl;
    }
    return 0;
}

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

int main()
{
	int n; cin >> n;

	vector<int> l(n); for (int i = 0; i < n; i++) cin >> l[i];

	int maxl = 0;
	int maxIndex;
	for (int i = 0; i < n; i++) {	
		if (maxl < l[i]) {
			maxl = l[i];
			maxIndex = i;
		}	
	}

	int sum = 0;
	for (int i = 0; i < n; i++) {
			if (i != maxIndex) sum += l[i];
	}

	string ans = "No";

	if (maxl < sum) ans = "Yes";
	
	cout << ans << endl;

	return 0;
}

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


public class Main {
    public static void main(String[] a){
    	Scanner input = new Scanner(System.in);
    	int[] m_height = new int[10];
    	for(int i = 0 ; i < m_height.length ; i++){
    		m_height[i] = input.nextInt();
    	}
    	Arrays.sort(m_height);
    	for(int i = 9 ; i >= 7 ; i--){
    		System.out.println(m_height[i]);
    	}
    }
}

Measured memory_bytes: 17236
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

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

    double l;
    cin >> l;
    l /= 3;
    cout << fixed << setprecision(10) << l * l * l << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

int main(void){
    int A,B,K;
    cin>>A;
    cin>>B;
    cin>>K;

    int ans=0;
    int count=0;

    for(int i=A;i>=1;i--){
        if(A%i==0&&B%i==0){
            count++;
        }
        if(count==K){
            ans=i;
            break;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    int n; cin >> n;
    vector<int> P(n), Q(n);
    for(int i = 0; i < n; i++) cin >> P[i];
    for(int i = 0; i < n; i++) cin >> Q[i];
    vector<int> buffer(P);
    sort(buffer.begin(), buffer.end());
    int a, b;
    int cnt = 0;
    do
    {
        bool isOK = true;
        for(int i = 0; i < n; i++)
        {
            if(buffer[i] != P[i]) isOK = false;
        }
        if(isOK) a = cnt;
        cnt++;
    } while (next_permutation(buffer.begin(), buffer.end()));
    buffer = Q;
    sort(buffer.begin(), buffer.end());
    cnt = 0;
    do
    {
        bool isOK = true;
        for (int i = 0; i < n; i++)
        {
            if(buffer[i] != Q[i]) isOK = false;
        }
        if(isOK) b = cnt;
        cnt++;
    } while (next_permutation(buffer.begin(), buffer.end()));

    cout << abs(a - b) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  int a[N];
  int c[M]{};
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    a[i]--;
    c[a[i]]++;
  }
  // 累積和
  int b[M][N + 1]{};
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (a[i] == j) {
        b[j][i + 1] = b[j][i] + 1; 
      } else {
        b[j][i + 1] = b[j][i];
      }
    }
  }
  // bitDP
  int n = 1<<M;
  int dp[n]{};
  for (int i = 0; i < n; i++) {
    dp[i] = N;
  }
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    // 整列させたぬいぐるみの数
    int l = 0;
    for (int j = 0; j < M; j++) {
      if ((i & (1<<j)) != 0) {
        l += c[j];
      }
    }
    for (int j = 0; j < M; j++) {
      int t = (1<<j);
      if ((i & t) == 0) {
        int idx = (i | t);
        // l 以降にぬいぐるみjを置くためのコスト
        int cost = c[j] - (b[j][l + c[j]] - b[j][l]); 
        dp[idx] = min(dp[idx], dp[i] + cost);
      }
    }
  }
  cout << dp[n - 1] << "\n";
  return 0;
}


Measured memory_bytes: 15424
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    struct Doll : IComparable
    {
        internal int h, r, size;

        public int CompareTo(object obj)
        {
            Doll other = (Doll)obj;
            return size - other.size;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                List<Doll> list = new List<Doll>();

                for (int i = 0; i < n; i++)
                {
                    string[] input = Console.ReadLine().Split(' ');

                    Doll temp;
                    temp.h = int.Parse(input[0]);
                    temp.r = int.Parse(input[1]);
                    temp.size = temp.h * temp.r * temp.r;
                    list.Add(temp);
                }

                int m = int.Parse(Console.ReadLine());

                for (int i = 0; i < m; i++)
                {
                    string[] input = Console.ReadLine().Split(' ');

                    Doll temp;
                    temp.h = int.Parse(input[0]);
                    temp.r = int.Parse(input[1]);
                    temp.size = temp.h * temp.r * temp.r;
                    list.Add(temp);
                }

                list.Sort();

                int[] memo = new int[list.Count];
                int max = 0;

                for (int i = 0; i < list.Count; i++)
                {
                    memo[i] = 1;

                    for (int j = 0; j < i; j++)
                    {
                        if (list[i].h > list[j].h && list[i].r > list[j].r)
                        {
                            memo[i] = Math.Max(memo[i], memo[j] + 1);
                        }
                    }
                    max = Math.Max(max, memo[i]);
                }
                sb.AppendLine(max.ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9624
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)
int H, A[MAX+1];
void maxHeapify(int i) {
    int l,r,largest;
    l=2*i;
    r=2*i+1;
    
    if(l<=H && A[l]>A[i])largest=l;
    else largest=i;
    if(l<=H && A[r]>A[largest])largest=r;
    
    if(largest!=i){
        swap(A[i],A[largest]);
        maxHeapify(largest);
    }
}
int extract() {
    int maxv; 
    if ( H < 1 ) return - INFTY; 
    maxv = A[1]; 
    A[1] = A[H--]; 
    maxHeapify(1); 
    return maxv;
}
void increaseKey(int i, int key) { 
    if ( key <A[i] ) return; 
    A[i] = key; 
    while (i > 1 && A[i / 2] < A[i]) {
        swap(A[i], A[i / 2]); 
        i = i / 2;
    }
}
void insert(int key) {
    H++; 
    A[H] = -INFTY; 
    increaseKey(H, key);
}
int main() {
    int key; 
    char com[10];
    while (1){
        scanf("%s", com); 
        if ( com[0] == 'e' && com[1] == 'n' ) break; 
        if ( com[0] == 'i' ) {
            scanf("%d", &key);
            insert(key); 
        } else {
            printf("%d\n", extract());
        }
    }
    return 0;
}



Measured memory_bytes: 6496
#include <bits/stdc++.h>
#define FLASH ios_base::sync_with_stdio(0);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";


using namespace std;

const ll MOD=1000000007LL;
ll f[5000010];

ll poww(ll a,ll b)
{
  ll res=1;
  a%=MOD;
  for(;b;b>>=1)
  {
	if(b&1)res=(res*a)%MOD;
	a=(a*a)%MOD;  
  }	
  return res;
}

ll cnk(ll n,ll k)
{
  return (((f[n]*poww(f[k],MOD-2))%MOD)*poww(f[n-k],MOD-2))%MOD;
}

int main(){
FLASH;
ll k;
cin>>k;
string stroka;
cin>>stroka;
ll n=(ll)stroka.size();
f[0]=1;
ll ans=0; 
for(ll i=1;i<=n+k;i++)f[i]=(f[i-1]*i)%MOD;
for(ll i=n;i<=n+k;i++)
{
  ans=(ans+(cnk(n+k,i)*poww(25LL,n+k-i))%MOD)%MOD;
}
cout<<ans<<endl;




return 0;
} 


Measured memory_bytes: 19876
#include <iostream>
using namespace std;
int dp[21][50010], c[21];

const int INF = 1e9;

int main(void) {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> c[i];

  for (int i = 0; i < m; i++) {
    for (int j = 1; j <= n+1; j++) {
      if (!i) dp[i][j] = dp[i][j - c[i]] + 1;
      else {
        if (j - c[i] >= 0) dp[i][j] = min(dp[i-1][j], dp[i][j - c[i]] + 1);
        else dp[i][j] = dp[i-1][j];
      }
      //cout << "dp[" << i << "][" << j << "] = " << dp[i][j] << endl;
    }
  }

  cout << dp[m-1][n] << endl;
  return 0;
}

Measured memory_bytes: 5252
n = int(input())
A = tuple(map(int, input().split()))
q = int(input())
M = tuple(map(int, input().split()))

sums = set()
from collections import deque
st = deque([[0, 0], [0, A[0]]])
while st:
    i, s = st.pop()
    i += 1
    if i == n:
        sums.add(s)
        continue
    st.append([i, s])
    st.append([i, s+A[i]])

for m in M:
    print('yes' if m in sums else 'no')
    


Measured memory_bytes: 6080
def put_era(day):
  if day < [1868, 9, 8]:
    print("pre-meiji")
  
  elif day <= [1912, 7, 29]:
    print("meiji",day[0] - 1868 + 1, day[1], day[2])
  
  elif day <= [1926, 12, 24]:
    print("taisho",day[0] - 1912 + 1, day[1], day[2])
  
  elif day <= [1989, 1, 7]:
    print("showa",day[0] - 1926 + 1, day[1], day[2])
  
  else:
    print("heisei",day[0] - 1989 + 1, day[1], day[2])

while True:
  try:
    day = list(map(int, input().split()))
    put_era(day)

  except EOFError:
    break


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

int main(int argc, const char * argv[]) {
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    
    //          div50
    // a 500    10
    // b 100    2
    // c 50     1
    
    int i,j,k;
    int counter =0;
    int amount;
    
    for(i=0;i<=a;i++){
        for(j=0;j<=b;j++){
            for(k=0;k<=c;k++){
                amount = i*500+j*100+k*50;
                if(amount == x)
                    counter++;
            }
        }
    }
    
    cout << counter << endl;
    
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    var v = readLine()!!.split(" ").map(String::toInt)
    var c = readLine()!!.split(" ").map(String::toInt)
    var ans = 0

    for (i in 0 until n){
        var f = v[i] - c[i]
        if (f > 0) ans += f
    }

    println(ans)
}

Measured memory_bytes: 37652
#include "bits/stdc++.h"
#define ll long long int
#define all(x) x.begin(), x.end()
#define pb push_back
#define se second
#define fi first
using namespace std;
typedef pair<ll,ll> pll;

const int N = 1e5+5;
int a[N],n,mark[N];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i] == i){
            mark[i] = 1;
        }
    }
    int ans = 0;
    for(int i=1;i<=n;){
        if(!mark[i]){
            i ++;
        }
        else{
            if(i == n){
                ans ++;
                i ++;
            }
            else{
                i += 2;
                ans ++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll K;
        cin >> K;
        vll v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

        cout << v[K-1] << endl;
}


Measured memory_bytes: 3568
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
#include<map>
#include<queue>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define LLINF (LLONG_MAX)
#define MAX_V 10000

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;
struct edge{ 
  ll to,cap,cost,rev;
  edge(ll to=LLINF,ll cap=LLINF,ll cost=LLINF,ll rev=LLINF):to(to),cap(cap),cost(cost),rev(rev){}
};
int V;
vector<edge> G[MAX_V];
ll h[MAX_V],dist[MAX_V],prevv[MAX_V],preve[MAX_V];

void add_edge(ll from,ll to,ll cap,ll cost){
  G[from].push_back(edge(to,cap,cost,(ll)G[to].size()));
  G[to].push_back(edge(from,0,-cost,(ll)G[from].size()-1));
}

ll min_cost_flow(ll s,ll t,ll f){
  ll res = 0;
  rep(i,V)h[i] = 0;
  while( f > 0 ){
    priority_queue<P,vector<P>,greater<P> > que;
      rep(i,V)dist[i] = LLINF;
      dist[s] = 0;
      que.push(P(0,s));
      while(!que.empty()){
	P p = que.top(); que.pop();
	ll v = p.second;
	if( dist[v] < p.first )continue;
	for(int i=0;i<G[v].size();i++){
	  edge &e = G[v][i];
	  if( e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to] ){
	    dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
	    prevv[e.to] = v;
	    preve[e.to] = i;
	    que.push(P(dist[e.to],e.to));
	  }
	}
      }
      if(dist[t]==LLINF)return -1;
      for(int v=0;v<V;v++)h[v] += dist[v];
      ll d = f;
      for(int v=t;v!=s;v=prevv[v])d = min(d,G[prevv[v]][preve[v]].cap);
      f -= d;
      res += d * h[t];
      for(int v=t;v!=s;v=prevv[v]){
	edge &e = G[prevv[v]][preve[v]];
	e.cap -= d;
	G[v][e.rev].cap += d;
      }
  }
  return res;
}

int main(){
  int N;
  cin >> N;
  int *A = new int[N];
  int *B = new int[N];
  map<int,int> getIndex;
  int dex = 0;
  rep(i,N){
    cin >> A[i] >> B[i];
    if( getIndex.find(A[i]) == getIndex.end() )getIndex[A[i]] = dex++;
    if( getIndex.find(B[i]) == getIndex.end() )getIndex[B[i]] = dex++;
  }
  V = N + (int)getIndex.size();
  int source = V,sink = source+1,grave = sink+1;
  V += 3;
  add_edge(grave,sink,LLINF,0);
  rep(i,N)add_edge(source,i,1,0);
  rep(i,(int)getIndex.size())add_edge(N+i,sink,1,0);
  rep(i,N){
    int to1 = getIndex[A[i]]+N;
    int to2 = getIndex[B[i]]+N;
    add_edge(i,to1,1,-B[i]);
    add_edge(i,to2,1,-A[i]);
    add_edge(i,grave,LLINF,0);
  }
  delete [] A;
  delete [] B;
  cout << -min_cost_flow(source,sink,N) << endl;

  return 0;
}

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

int main(){
  int n; cin >> n;
  for(int i = 0; i < n; i++){
    char c; cin >> c;
    if(c == 'Y') {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}

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

string push[10]={
"",
".,!? ",
"abc",
"def",
"ghi",
"jkl",
"mno",
"pqrs",
"tuv",
"wxyz"
};

string solve(string in){
  string res="";
  int c=0;
  int n_in=0;
  for(int i=0;i<in.size();i++){
    int t_in=in[i]-'0';
    if(t_in==0){
      if(n_in!=0){
        res+=push[n_in][(c%push[n_in].size())];
      }
      n_in=0;
      c=0;
    }else{
      if(t_in==n_in){
        c++;
      }else{
        c=0;
	n_in=t_in;
      }
    }
  }
  return res;
}



int main(){
  string in;
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>in;
    string ans=solve(in);
    if(ans.size()!=0){
      cout<<ans<<endl;
    }
  }
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define ll long long
#define BUF 1e5
#define INF 1 << 30
constexpr ll mod = 1e9 + 7;
using namespace std;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <ll mod>
class Fp {
public:
    ll val;

private:
    inline void calc_mod(ll &v) {
        if (v >= mod)
            v -= mod;
    }

public:
    Fp() {}
    Fp(ll v) : val(v % mod) {
        if (val < 0)
            val += mod;
    }
    Fp operator+=(const Fp &in) {
        val += in.val;
        calc_mod(val);
        return *this;
    }
    Fp operator+(const Fp &in) const {
        return Fp(*this) += in;
    }
    Fp &operator-=(const Fp &in) {
        val -= in.val;
        calc_mod(val);
        if (val < 0)
            val += mod;
        return *this;
    }
    Fp operator-(const Fp &in) const {
        return Fp(*this) -= in;
    }
    Fp &operator*=(const Fp &in) {
        val = val * in.val % mod;
        return *this;
    }
    Fp operator*(const Fp &in) const {
        return Fp(*this) *= in;
    }
    Fp &operator/=(const Fp &in) {
        *this *= modpow(in, mod - 2);
        return *this;
    }
    Fp operator/(const Fp &in) const {
        return Fp(*this) /= in;
    }
    bool operator==(const Fp &in) const {
        return val == in.val;
    }
    bool operator!=(const Fp &in) const {
        return val != in.val;
    }
    friend Fp modpow(const Fp &in, ll n) {
        if (n == 0)
            return 1;
        if (n & 1) {
            return in * modpow(in * in, n / 2);
        } else {
            return modpow(in * in, n / 2);
        }
    }
};
using modll = Fp<mod>;
class Factorial {
public:
    vector<modll> fact, finv;
    Factorial(ll n) : fact(n + 1, modll(1)), finv(n + 1, modll(1)) {
        for (int i = 2; i <= n; i++) {
            modll tmp(i);
            fact[i] = fact[i - 1] * tmp;
            finv[i] = finv[i - 1] / tmp;
        }
    }
    modll com(const ll &n, const ll &k) {
        if (n < k || n < 0 || k < 0)
            return modll(0);
        return fact[n] * finv[k] * finv[n - k];
    }
};

int main() {
    cin >> N >> M >> K;
    vector<modll> dp(M + 1);
    dp[0] = 0;
    dp[1] = 0;
    modll diff = 0;
    modll tmp = N * (N + 1) / 2;
    for (int i = 1; i <= N; i++) {
        dp[1] += i * (N - i);
        diff += tmp;
        tmp -= N - 2 * i;
    }
    for (int i = 2; i <= M; i++) {
        dp[i] = dp[i - 1] * 2 + diff - dp[i - 2];
        diff += N * N;
    }
    Factorial f(N * M);
    dp[M] *= f.com(N * M - 2, K - 2);
    cout << dp[M].val << endl;
}

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

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

  int c[h][w], k = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      c[i][j] = k + 1;
      if (--a[k] == 0) k++;
    }
  }

  for (int i = 0; i < h; i++) {
    if (i % 2) {
      cout << c[i][w-1];
      for (int j = w-2; j >= 0; j--)
        cout << " " << c[i][j];
      cout << endl;
    }
    else {
      cout << c[i][0];
      for (int j = 1; j < w; j++)
        cout << " " << c[i][j];
      cout << endl;
    }
  }
}

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

int main() {
  int N, K;
  string S;
  cin >> N >> K >> S;

  vector<int> v;
  bool iszero = false;
  int count = 0;
  for (int i=0; i<N; i++) {
    if (S[i] == '0' && iszero || S[i] =='1' && !iszero) {
      count++;
    } else {
      v.push_back(count);
      count = 1;
      iszero = !iszero;
    }
  }
  v.push_back(count);
  if (iszero) v.push_back(0);

  int max_person = 0, sum;
  if (2*K+1 > v.size()) {
    for (int i=0; i<v.size(); i++) {
      max_person += v[i];
    }
  } else {
    for (int i=0; i+2*K+1 <= v.size(); i+=2) {
      sum = 0;
      for (int j=0; j<2*K+1; j++) {
        sum += v[j+i];
      }
      if (sum > max_person) max_person = sum;
    }
  }
  cout << max_person << endl;
}


Measured memory_bytes: 1020
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#define MAXN 200000;
#define Amari 1000000007;
#define p pair <int,int>
using namespace std;
int main(int argc,char const* argv[])
{
  int n;
  long long temp;
  cin >> n;
  vector<long long> ans(n,0);
  if(n % 2 ==0)
    {
      for(int i=0;i<n;i++)
	{
	  cin >> temp;
	  if(i==0)
	    {
	      ans[n/2]=temp;
	    }
	  else
	    {
	      if(i % 2 == 0) ans[n/2+i/2]=temp;
	      else if(i % 2 !=0) ans[n/2-((i+1)/2)]=temp;
	    }
	}
    }
  else
    {
       for(int i=0;i<n;i++)
	{
	  cin >> temp;
	  if(i==0)
	    {
	      ans[n/2]=temp;
	    }
	  else
	    {
	      if(i % 2 != 0) ans[n/2+((i+1)/2)]=temp;
	      else if(i % 2 ==0) ans[n/2-i/2]=temp;
	    }
	}
    }
  for(int i=0;i<n;i++)
    {
      cout << ans[i] << " ";
    }
  return 0;
}


Measured memory_bytes: 3712
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define llong long long
#define ldouble long double
#define uint unsigned int
#define ullong unsigned long long
#define udouble unsigned double
#define uldouble unsigned long double
#define modinc(x) {if(x>=P) x-=P;}
#define pii pair<int,int>
#define piii pair<pair<int,int>,int>
#define piiii pair<pair<int,int>,pair<int,int> >
#define pli pair<llong,int>
#define pll pair<llong,llong>
#define Memset(a,x) {memset(a,x,sizeof(a));}
using namespace std;

const int N = 3e3;
int a[N+2][N+2];
int cnt[N+2];
int n,m;

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=m; j++) scanf("%d",&a[i][j]);
	}
	int mn = n;
	for(int i=1; i<=m; i++)
	{
		for(int j=0; j<=m; j++) cnt[j] = 0;
		for(int j=1; j<=n; j++)
		{
			for(int k=1; k<=m; k++)
			{
				if(a[j][k]!=0)
				{
					cnt[a[j][k]]++; break;
				}
			}
		}
		int tmp = 0,t = 0;
		for(int j=1; j<=m; j++)
		{
			if(cnt[j]>tmp) {tmp = cnt[j],t = j;}
		}
		mn = min(mn,tmp);
		for(int j=1; j<=n; j++)
		{
			for(int k=1; k<=m; k++)
			{
				if(a[j][k]==t) {a[j][k] = 0; break;}
			}
		}
	} printf("%d\n",mn);
	return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

V<int> c;
V< V<int> > edges;
vll ans;
V<int> subsz;

map<int, int> dfs(int i, int p) {
    map<int, int> colcnt;
    for (int e: edges[i]) {
        if (e == p) continue;
        map<int, int> chcol = dfs(e, i);
        subsz[i] += subsz[e];
        ll sz;
        if (chcol.find(c[i]) == chcol.end()) sz = subsz[e];
        else sz = subsz[e] - chcol[c[i]];
        ans[c[i]] -= sz * (sz + 1) / 2;
        if (colcnt.size() < chcol.size()) swap(colcnt, chcol);
        for (P<int, int> mmm: chcol) colcnt[mmm.first] += mmm.second;
    }
    subsz[i]++;
    colcnt[c[i]] = subsz[i];
    return colcnt;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    c.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        c[i]--;
    }

    edges.resize(n);
    for (int i = 1; i < n; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        edges[a].emplace_back(b), edges[b].emplace_back(a);
    }

    ans.resize(n);
    for (int i = 0; i < n; i++) {
        ans[i] = (ll)n * (ll)(n + 1) / 2;
    }

    subsz.resize(n, 0);
    map<int, int> colcnt = dfs(0, -1);
    for (int i = 0; i < n; i++) {
        ll sz = n - colcnt[i];
        ans[i] -= sz * (sz + 1) / 2;
    }
    
    for (int i = 0; i < n; i++) cout << ans[i] << '\n';
    return 0;
}


Measured memory_bytes: 64164
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ii pair<ll,ll>;
#define vi vector<int>;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fbo find_by_order
#define ook order_of_key
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define fo(i,a,b) for(int i = a; i < b; i++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
int main(){
    IOS
    //io_set();
    ll n,m;
    cin>>n>>m;
    cout<<max(n+(n-1),max(m+(m-1),n+m))<<endl;
    return 0;
}

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

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

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

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

	int N, D, X;
	cin >> N >> D >> X;

	int sum = N + X, A;
	for (int i = 0; i < N; i++) {
		cin >> A;
		sum += (D - 1) / A;
		DMP(sum);
	}

	cout << sum << "\n";


	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb the vegetable chicken
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define pb              push_back
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
//#define usingFiles
using namespace std;

typedef unsigned int ui;
typedef pair<int, int> pii;
typedef long long ll;

inline bool Read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool Write(int x){
	if(x >= 10) Write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;
const int Mod = 1000000007;

int n;
ll dp[100100];
vector<int> tree[100100];
vector<int> child[100100];
vector<int> gr_child[100100];

void predfs(int now, int par, int gr_par){
	if(par >= 0) child[par].pb(now);
	if(gr_par >= 0) gr_child[gr_par].pb(now);
	rep(i, tree[now].size()){
		if(tree[now][i] != par){
			predfs(tree[now][i], now, par);
		}
	}
}

ll dfs(int now){
	if(dp[now] != -1) return dp[now];
	if(child[now].size() == 0) return dp[now] = 2;
	ll ans1 = 1;
	rep(i, child[now].size()){
		ans1 *= dfs(child[now][i]);
		ans1 %= Mod;
	}
	ll ans2 = 1;
	rep(i, gr_child[now].size()){
		ans2 *= dfs(gr_child[now][i]);
		ans2 %= Mod; 
	}
	dp[now] = ans1 + ans2;
	dp[now] %= Mod;
	return dp[now];
}

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	memset(dp, -1, sizeof(dp));
	cin >> n;
	rep(i, n - 1){
		int a, b;
		cin >> a >> b;
		a--, b--;
		tree[a].pb(b);
		tree[b].pb(a);
	}
	predfs(0, -1, -1);
	cout << dfs(0) << endl;
	return 0;
}

Measured memory_bytes: 24448
k = int(input())
ans = []


def dfs(x):
    if x > 3234566667:
        return 0
    else:
        ans.append(x)
        y = x % 10
        for i in range(10):
            if abs(y-i) <= 1:
                dfs(10*x+i)
    

for i in range(1, 10):
    dfs(i)
    
ans.sort()
print(ans[k-1])

Measured memory_bytes: 7708
#include <iostream>
#include <cstdint>

constexpr int64_t Mod = 1000000007;
int64_t fact(int n) {
	int64_t ret = 1;
	for (int i = 2; i <= n; ++i)
		(ret *= i) %= Mod;

	return ret;
}

int main() {
	int n, m;
	std::cin >> n >> m;
	if (n > m)
		std::swap(n, m);

	if (m - n >= 2) {
		std::cout << 0 << std::endl;
		return 0;
	}

	auto tmp = fact(n);
	if (m - n == 1)
		std::cout << ((tmp * tmp) % Mod * m) % Mod << std::endl;
	else
		std::cout << (tmp * tmp * 2) % Mod << std::endl;
}

Measured memory_bytes: 256
//問題３　2704 上石彩花
import java.util.Scanner;
public class Main{
	public void solve(){
		Scanner sc=new Scanner(System.in);
		int N,x,y,b,p,goukei,goukei1;
		
		N=sc.nextInt();
		goukei1=0;
		
		for(int i=1;i<=N;i++){
		x=sc.nextInt();
		y=sc.nextInt();
		b=sc.nextInt();
		p=sc.nextInt();
			
			goukei=(x*b+y*p);
			
			if(b>=5&&p>=2){
				goukei1=(x*b+y*p)*4/5;
				}else{
					if(b<5){
						b=5;
						}
						if(p<2){
							p=2;
						}
						goukei1=(x*b+y*p)*4/5;
				}
					if(goukei>goukei1){
						goukei=goukei1;
					}
					System.out.println(goukei);
		}
	}
		public static void main(String[]args){
			Main obj=new Main();
			obj.solve();
		}
}

Measured memory_bytes: 23428
#include <cassert>
#include <climits>
#include <cstdio>
#include <vector>
#include <queue>

using namespace std;

class Point {
  public:
    int x;
    int y;
    int v;
    Point(int _x, int _y, int _v) { x = _x; y = _y; v = _v; }
    Point(const Point& p) { x = p.x; y = p.y; v = p.v; }
};

int main()
{
  int h, w;
  scanf("%d %d\n", &h, &w);
  vector<vector<int>> board(h, vector<int>(w, INT_MAX));
  queue<Point> q;
  for (int x = 0; x < h; x++) {
    for (int y = 0; y < w; y++) {
      char ch = getchar();
      assert(ch == '#' || ch == '.');
      if (ch == '#') {
        q.push(Point(x, y, 0));
      }
    }
    getchar(); // discard LF
  }
  int res = 0;
  while (!q.empty()) {
    Point p(q.front());
    q.pop();
    if (p.x < 0 || h <= p.x || p.y < 0 || w <= p.y) {
      continue;
    }
    if (board.at(p.x).at(p.y) <= p.v) {
      continue;
    }
    board.at(p.x).at(p.y) = p.v;
    res = max(res, p.v);
    q.push(Point(p.x-1, p.y, p.v+1));
    q.push(Point(p.x+1, p.y, p.v+1));
    q.push(Point(p.x, p.y-1, p.v+1));
    q.push(Point(p.x, p.y+1, p.v+1));
  }
  printf("%d\n", res);
  return 0;
}


Measured memory_bytes: 53832
A = int(input())
B = int(input())
C = int(input())
D = int(input())
if A >= B and C >= D:
  print(B+D)
elif A >= B and C <= D:
  print(B+C)
elif A <= B and C >= D:
  print(A+D)
else:
  print(A+C)

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

int main() {
	int n;
	string s;
	cin >> n >> s;

	string ans = "Yes";
	for (int i = 0; i < n/2; i++) {
		if (s.at(i) != s.at(i+n/2)) {
			ans = "No";
			break;
		}
	}
	if (n % 2 == 1) {
		ans = "No";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

void dfs(int now, int prev, int cost, vvi &G, V(P) &T) {
    
    int cnt = 0;
    rep(i, G[now].size()) {
        if(prev != G[now][i]) {
            dfs(G[now][i], now, cost+1, G, T);
            cnt++;
        }
    }
    if(!cnt) T.pb(P(now, cost));
    if(cnt==1 && cost==0) T.pb(P(now, cost));
}


signed main() {
    int N, u, v;
    cin >> N >> u >> v;
    u--; v--;

    vvi G(N);
    rep(i, N-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    
    V(P) ut, vt;
    dfs(u, -1, 0, G, ut);
    dfs(v, -1, 0, G, vt);
    SORT(ut); SORT(vt);

    int res = 0;
    rep(i, ut.size()) {
        if(ut[i].se < vt[i].se) res = max(res, vt[i].se-1);
    }

    cout << res << endl;

    return 0;
}

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

#define BUF_SIZE 15
int main(void) {
  FILE *fp = stdin;
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, fp)) return 0;

  int arr[4];
  int i, j;
  for(i = 0; i < 4; i++) {
    arr[i] = line[i] - '0';
  }
  for(i = 0; i < 8; i++) { // 2**3
    int sum = arr[0];
    char buf[BUF_SIZE];
    buf[0] = arr[0] + '0'; int cnt = 1;
    for(j = 0; j < 3; j++) {
      if(i & (1<<j)) {
        sum += arr[j+1];
        buf[cnt] = '+';
      } else {
        sum -= arr[j+1];
        buf[cnt] = '-';
      }
      buf[cnt+1] = arr[j+1] + '0';
      cnt += 2;
    }
    buf[cnt] = '=';
    buf[cnt+1] = '7';
    buf[cnt+2] = '\0';
    if(sum ==7) {
      printf("%s\n", buf);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long int
#define mod 1000000007
#define vi vector<ll>
#define pb push_back
#define mp make_pair
#define str string
#define sp(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define w(x) ll x; cin>>x; while(x--)
#define endl '\n'
void kehsihba() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int32_t main(){
	//kehsihba();
	ll t=1;
	//cin>>t;
	while(t--){
		str a,b;
		cin>>a>>b;
		if(a.length()+1!=b.length()){
			cout<<"No";
		}
		else{
			ll n=a.length();
			bool check=true;
			for(int i=0;i<n;i++){
				if(a[i]!=b[i]){check=false;break;}
			}
			if(check){cout<<"Yes";}
			else{cout<<"No";}
		}
	}
}

Measured memory_bytes: 3624
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
print(180*(n-2))

Measured memory_bytes: 76988
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> s(m);
    vector<int> p(m);
    for(int i = 0; i < m; i++) {
        int k;
        cin >> k;
        s[i].resize(k);
        for(int j = 0; j < k; j++) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    for(int i = 0; i < m; i++) {
        cin >> p[i];
    }
    int ans = 0;
    for(int bit = 0; bit < (1 << n); bit++) {
        set<int> on;
        for(int i = 0; i < n; i++) {
            if(bit & (1 << i)) {
                on.insert(i);
            }
        }
        bool ok = true;
        for(int i = 0; i < m; i++) {
            int cnt = 0;
            for(int j = 0; j < s[i].size(); j++) {
                if(on.count(s[i][j])) {
                    cnt++;
                }
            }
            if(cnt % 2 != p[i]) {
                ok = false;
            }
        }
        if(ok) {
            ans++;
        }
    }
    cout << ans << endl;
}

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll a, b, x;
  cin >> a >> b >> x;

  cout << (a + b >= x && a <= x ? "YES" : "NO") << "\n";
}

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



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

	int tmpn=N*(N-1)/2, tmpm=M*(M-1)/2;
	
	
	if (N <= 1) tmpn= N / 2;
	if (M <= 1) tmpm = M / 2;


	int ans = tmpn + tmpm;
	cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int a; cin >> a;
    string s; cin >> s;

    cout << (a >= 3200 ? s : "red") << endl;
    return 0;
}


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

#define rep(i, a, b) for(int i=a; i<b; i++)
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define tr(c, it) for(auto it=(c).begin(); it!=c.end(); it++)
#define pb push_back
#define bitcount __builtin_popcount
#define ispresent(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define watch(x) cout<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef list<int> li;
typedef complex<int> ci;
typedef complex<double> cd;
typedef complex<long double> cld;
const int inf = 5e8;
const int modn = 1e9+7;
const int MAX = 1e5;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
	ll a, b, c;
	cin>>a>>b>>c;
	if(a+b<c) {
		cout<<a+2*b+1<<"\n";
	}
	else {
		cout<<b+c<<"\n";
	}
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
using namespace std;
using ll=int64_t;
using vi=vector<int>;
using VI=vector<ll>;
using vis=vector<string>;
using vvi=vector<vi>;
int gcd(int a,int b){
    if(a%b==0)
    return b;
    return gcd(b,a%b);
}
int main(){
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    s.at(k-1)+=32;
    cout<<s<<endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define in2(N,s,t) rep(i,N){in(s[i] , t[i]);}
#define in3(N,s,t,u) rep(i,N){in(s[i] , t[i] , u[i]);}
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vs = V<string>;
using vd = V<double>; using vvi = V< V<int> >; using vvl = V< V<> >;
template<typename T>using heap = priority_queue< T , V<T> , greater<T> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

using P = pair<ll,ll>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////////////

void solve(){
  ini(H , A);
  out((H + A - 1) / A);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int a, b;

    //入力
    scanf("%d %d", &a, &b);

    if( a >= 13 )
    {
    }
    else if( a >= 6 )
    {
        b = b/2;
    }
    else
    {
        b = 0;
    }
    

    //出力
    printf("%d\n", b);
    return 0;
}


Measured memory_bytes: 128
n, k = map(int, input().split())
s = list(map(int, input()))
x = [0]
if s[0] == 0:
    x.append(0)
for i in range(n-1):
    if s[i] != s[i+1]:
        x.append(i+1)
x.append(n)
if s[n-1] == 0:
    x.append(n)
r = len(x) // 2 - 1
if k >= r:
    print(n)
else:
    print(max(x[2*(i+k)+1]-x[2*i] for i in range(r-k+1)))

Measured memory_bytes: 7840
open System
open System.Linq;


let input =stdin.ReadLine().Split() |> Array.map int
let A=input.[0]
let B=input.[1]
[<EntryPoint>]
let sf argv =
    let ans = if A-2*B >0 then A-2*B else 0
    printfn "%d" ans
    0 

Measured memory_bytes: 14040