akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;


struct segtree {
public:
	const int SIZE = 1 << 18;
	VI seg, lazy;
	//seg:区間の合計値 lazy:区間に対して、加える値でまだ遅延しているもの

	segtree():seg(SIZE*2),lazy(SIZE*2){}
	void lazy_evaluate(int k, int l, int r) {
		if (lazy[k] != 0) {
			seg[k] += lazy[k];
			//区間[l,r)にすべて同じ値を追加することになっていて、
			//segには合計値が入っているので、加える値を足す
			if (r - l > 1) {
				lazy[k * 2 + 1] += lazy[k];
				lazy[k * 2 + 2] += lazy[k];
			}
			lazy[k] = 0;
		}
	}

	void update(int a, int b, int k, int l, int r, int x) {
		lazy_evaluate(k, l, r);
		if (r <= a || b <= l)return;
		if (a <= l && r <= b) {
			lazy[k] += x;
			lazy_evaluate(k, l, r);
		}
		else {
			update(a, b, k * 2 + 1, l, (l + r) / 2, x);
			update(a, b, k * 2 + 2, (l + r) / 2, r, x);
			seg[k] = seg[k * 2 + 1] + seg[k * 2 + 2];
		}
	}
	int query(int a, int b, int k, int l, int r) {
		lazy_evaluate(k, l, r);
		if (r <= a || b <= l)return 0;
		if (a <= l && r <= b)return seg[k];
		int x = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int y = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return x + y;
	}

	void update(int a,int b,int x){ update(a, b, 0, 0, SIZE, x); }
	//update(a,b,x) := [a,b)を全てxを加える
	int query(int a, int b) { return query(a, b, 0, 0, SIZE); }
	//query(a,b) := [a,b)に対する合計値を求める

};

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

	int N, Q;
	cin >> N >> Q;
	segtree st;
	REP(i, Q) {
		int c,l, r;
		cin >> c >> l >> r;
		l--;
		if(!c)st.update(l, l +1, r);
		else {
			r--;
			cout << st.query(l, r + 1) << endl;
		}
	}
	
	return 0;
}




Measured memory_bytes: 11036
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
using namespace std;
 
#define int long long

const int MAX_V=1000;
int memo[1000001]={0};
int dist[MAX_V][MAX_V];


void warshall_floyd(int V){
    for(int k=0;k<V;k++){
        for(int i=0;i<V;i++){
            for(int j=0;j<V;j++){
                dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }
    }
}

 

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cin高速化
    
    int a,b,n;
    cin>>n>>a>>b;

    if(n*a>b){
        cout<<b<<endl;
    }else{
        cout<<n*a<<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 q; cin >> q;
    ll cnt=0;
    for (;q--;){
        int p,n; char c; cin >> p >> c >> n;
        cnt+=(c=='('?n:-n);
        cout << (cnt==0?"Yes":"No") << '\n';
    }
}


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

const int maxn=102;
int n,Cx,Cy,H;
int x[maxn];
int y[maxn];
int h[maxn]; 

int main()
{
	cin >> n;
	for ( int i=0 ; i<n ; ++i )
		cin >> x[i] >> y[i] >> h[i];
	for ( int i=0 ; i<n ; ++i )
		if (h[i]!=0)
		{
			swap(x[i],x[0]);
			swap(y[i],y[0]);
			swap(h[i],h[0]);
			break;
		}
	for ( Cx=0 ; Cx<=100 ; ++Cx )
		for ( Cy=0 ; Cy<=100 ; ++Cy )
		{
			H=h[0]+abs(x[0]-Cx)+abs(y[0]-Cy);
			bool f=true;
			for ( int i=1 ; i<n ; ++i )
			{
				if (h[i]>0&&H!=h[i]+abs(x[i]-Cx)+abs(y[i]-Cy)||h[i]==0&&H-abs(x[i]-Cx)-abs(y[i]-Cy)>0)
				{
					f=false;
					break;
				}
			}
			if (f==true)
			{
				cout << Cx << ' ' << Cy << ' ' << H << endl;
				return 0;
			}
		}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long double
struct one{
	lli x;
	lli y;
};
long int factorial(long int n){
	if(n==0||n==1)
	return 1;
	else return n*factorial(n-1);
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long int n,i,j,k=0,fact,fact1;
	lli sum[100000],avg=0.0;
	cin>>n;
	one a[10];
	for(i=0;i<n;i++){
		cin>>a[i].x>>a[i].y;
	}
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			sum[k++]=pow(((a[i].x-a[j].x)*(a[i].x-a[j].x)+(a[i].y-a[j].y)*(a[i].y-a[j].y)),0.5);
		}
	}
	fact1=factorial(n);
	fact=factorial(n-1);
	for(i=0;i<k;i++){
		avg+=sum[i]*2.0*(float(fact));
	}
	avg/=float(fact1);
	printf("%Lf",avg);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c && a % 2 == 0) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0;; i++) {
    if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
      cout << i << endl;
      break;
    }
    int p_a = a;
    int p_b = b;
    int p_c = c;
    a = p_b / 2 + p_c / 2;
    b = p_a / 2 + p_c / 2;
    c = p_a / 2 + p_b / 2;
  }
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define pb push_back
#define all(_obj) _obj.begin(),_obj.end()
#define F first
#define S second
#define INF 1e18
#define pll pair<ll, ll> 
#define vll vector<ll>
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=1e5+11;
inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b) {if(b==0) return a;a%=b;return gcd(b,a);}
inline vll read(int n) {vll v(n);for (int i = 0; i < v.size(); i++)cin>>v[i];return v;}
void sol()
{
cin>>a>>b>>c;
cin>>k;
while(b<=a) b*=2,k--;
while(c<=b) c*=2,k--;
if(k>=0) cout<<"Yes";
else
cout<<"No";










return ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test=1;
    //cin>>test;
    for(int i=1;i<=test;i++)
    sol();
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
using namespace std;
#define mod 1000000007;

int main() {
	// your code goes here
	int a,b,c,x,y,i,min=mod;
	cin >> a >> b >> c >> x >> y;
	for(i=0;i<=std::max(x,y);i++){
		int cost=c*2*i+a*std::max(x-i,0)+b*std::max(y-i,0);
		if(min>cost) min=cost;
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
total = r*g*b
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            total -= 1
print(total)

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")

const long long inf = 1000000000000000000;
//					     2147485794483647
int n;
long long a[100005];
long long ans = 1;

int main()
{
	ios::sync_with_stdio(false);
    cin >> n;
    bool fl = 0;
    for (int i = 1; i <= n; i++)
    {
    	cin >> a[i];
    	if (a[i] == 0) fl = 1;
	}
	if (fl)
	{
		cout << 0 << endl;
		return 0;
	}
	for (int i = 1; i <= n; i++)
	{
		if (a[i] <= inf / ans) ans *= a[i];
		else 
		{
			cout << -1 << endl;
			return 0;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4440
#pragma region template 1.0
#pragma region def
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a) \
    REP(i, (a).size()) { cout << (a[i]) << (i == (a).size() - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion enddef

int main()
{
    ll N;
    cin >> N;
    vi a(N);
    REP(i, N)
    {
        cin >> a[i];
    }

    vi acc = vi(N + 1);
    REP(i, N)
    {
        acc[i + 1] = acc[i] + a[i];
    }

    auto dp = vector<vi>(N + 1, vi(N + 1, INF));
    REP1(i, N)
    {
        REP1(j, i)
        {
            if (j == 1)
            {
                dp[i][j] = 0;
            }
            else
            {
                REP1(k, j - 1)
                {
                    dp[i][j] = min(dp[i][j], dp[i][k] + dp[i - k][j - k] + acc[i] - acc[i - j]);
                }
            }
        }
    }
    ll ans = dp[N][N];

    OUT(ans);
}
#pragma endregion template

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

using namespace std;

const int MAXN = 2e5+2;

int N,M;
bool a[MAXN]={0};
bool b[MAXN]={0};

void solve(){
	cin>>N>>M;
	a[1] = true;
	b[N] = true;
	bool flag = false;
	for (int i = 0; i < M; i++) {
		int u,v;
		cin>>u>>v;
		if (u==1){
			if (b[v]){
				flag = true;
				break;
			}
			else{
				a[v] = true;
			}
		}
		else if (v==N){
			if (a[u]){
				flag = true;
				break;
			}
			else{
				b[u] = true;
			}
		}
	}
	if (flag){
		cout<<"POSSIBLE"<<endl;
	}
	else{
		cout<<"IMPOSSIBLE"<<endl;
	}
}

int main(){
// 	freopen("in.txt","r",stdin);
// 	freopen("out.txt","w",stdout);
	std::ios::sync_with_stdio(false);

//	int TestCase;
//	cin>>TestCase;
//	for (int i=0;i<TestCase;i++){
		solve();
//	}

	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<string,int>;
using T = tuple<string,int,int>;

int main(){
  int a,b,c,d; cin >> a >> b >> c >> d;
  int A = (c+b-1) / b;
  int T = (a+d-1) / d;
  if(A <= T) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3636
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const ll N = 105, K = 2e5 + 10, mod = 1e9 + 7;
bool dp[K];
int a[N];
int main(){
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 0; i <= k; i++){
        for(int j = 1; j <= n; j++){
            if(dp[i] == false)dp[i + a[j]] = true;
        }
    }
    if(dp[k] == true){
        cout << "First\n";
    }else{
        cout << "Second\n";
    }
}   

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

struct p{
    ll i0,i1,i2,s;
    bool operator<(const p& x)const{
       return s < x.s;
    }
};
bool v[1000][1000][1000];

int main(){
    ll c[3],k,cnt=1;
    cin >> c[0] >> c[1] >> c[2] >> k;
    vector<ll> d[3];
    for(int i = 0;i < 3;i ++){
        for(int j = 0;j < c[i];j ++){
            ll x;
            cin >> x;
            d[i].push_back(x);
        }
        sort(d[i].begin(),d[i].end());
    }

    priority_queue<p> que;
    que.push({c[0]-1,c[1]-1,c[2]-1,d[0].back()+d[1].back()+d[2].back()});
    v[c[0]-1][c[1]-1][c[2]-1] = true;

    for(int i = 0;i < k;i ++){
        p p0;
        p0 = que.top();que.pop();
        if(p0.i0&&!v[p0.i0-1][p0.i1][p0.i2]) que.push({p0.i0-1,p0.i1,p0.i2,d[0][p0.i0-1]+d[1][p0.i1]+d[2][p0.i2]}),v[p0.i0-1][p0.i1][p0.i2]=1;
        if(p0.i1&&!v[p0.i0][p0.i1-1][p0.i2]) que.push({p0.i0,p0.i1-1,p0.i2,d[0][p0.i0]+d[1][p0.i1-1]+d[2][p0.i2]}),v[p0.i0][p0.i1-1][p0.i2]=1;
        if(p0.i2&&!v[p0.i0][p0.i1][p0.i2-1]) que.push({p0.i0,p0.i1,p0.i2-1,d[0][p0.i0]+d[1][p0.i1]+d[2][p0.i2-1]}),v[p0.i0][p0.i1][p0.i2-1]=1;

        cout << p0.s << endl;
    }
    return 0;
}

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

int main() {
  int k,s,ans=0;
  cin>>k>>s;
  rep(i,k+1){
    rep(j,k+1){
      if(0<=s-i-j && s-i-j<=k){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.awt.*;
import java.awt.geom.*;
import java.io.*;

import java.util.*;
class Main {
	

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		HashMap<Character,Integer> map = new HashMap<Character,Integer>();
		for(int i = 0; i < 26; i++) {
			map.put((char)('a'+i), 0);
		}
		while(sc.hasNextLine()) {
			char[] a = sc.nextLine().toCharArray();
			
			for(int i = 0; i < a.length; i++) {
				if(map.containsKey(Character.toLowerCase(a[i]))) {
					map.put(Character.toLowerCase(a[i]), map.get(Character.toLowerCase(a[i]))+1);
				}
			}
		}
		for(int i = 0; i < 26; i++) {
			System.out.println((char)('a'+i) + " : " + map.get((char)('a' + i)));
		}
	}
}

Measured memory_bytes: 17164
import sys
sys.setrecursionlimit(10000000)

n = int(input())
graph = [list() for i in range(n+1)]

for i in range(n-1):
   a, b, c = map(int, (input().split()))
   graph[a].append([b, c])
   graph[b].append([a, c])

q, k = map(int, input().split())

def dfs(pre, now, c):
    len_list[now] = min(len_list[now], len_list[pre] + c)

    while graph[now]:
        n, c = graph[now].pop()
        dfs(now, n, c)

len_list = [float("inf")] * (n + 1)
len_list[k] = 0
dfs(k, k, 0)

for _ in range(q):
    x, y = map(int, input().split())
    print(len_list[x] + len_list[y])


Measured memory_bytes: 200908
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void 
debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
int n;
int ar[4005];
char cr[4005];

int pos[2][2005];
char code[300];
int n2;

int dp[2005][2005];

int rev[2][2005][2005];
int main(){
  cin>>n;n2=n*2;
  code['B']=0;code['W']=1;
  REP(i,n2){
    char tmp[5];
    scanf("%s",tmp);
    cr[i]=tmp[0];
    cin>>ar[i],--ar[i];
  }

  REP(i,n2){
    pos[code[cr[i]]][ar[i]]=i;
  }
  int res=0;
  REP(t,2) REP(i,n) REP(j,i) if(pos[t][j]>pos[t][i]) ++res;

  REP(t,2){
    REP(i,n){
      vector<int> A;
      REPN(j,n2,pos[t][i]+1){
        if(code[cr[j]]!=t){
          A.pb(ar[j]);
        }
      }
      sort(ALL(A));
      int k=0;
      REP(j,n+1){
        rev[t][i][j]=k;
        if(k<A.size() && A[k]==j) ++k;
      }
    }
  }

  const int INF=5e8;
  REP(i,n+1) REP(j,n+1) dp[i][j]=INF;

  dp[0][0]=0;
  REP(i,n+1) REP(j,n+1){
    if(i<n) chmin(dp[i+1][j],dp[i][j]+rev[0][i][j]);
    if(j<n) chmin(dp[i][j+1],dp[i][j]+rev[1][j][i]);
  }

  res+=dp[n][n];
  
  cout<<res<<endl;
  return 0;
}





Measured memory_bytes: 47488
N = int(input())
l = len(str(N))

ans = 0
digit = 10

if N < 2:
  print(0)

#Nが奇数なら10が作れないため0個
elif N % 2 == 1:
  print(0)

#末尾0の個数 = 因数における10(=2 * 5) の個数だが
#2の個数＞5の個数のため、与えられたNが5で割り切れた回数を求めれば良い
else:
  while N >= digit:
    ans += N // digit
    digit = digit * 5
  
  print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
      ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
      int n;
      string s;
      cin >> n >> s;
      if (n>=s.size())
      {
            cout << s << endl;
      }
      else
      {
            for (int i=0; i<n; i++)cout << s[i];
            cout << "..."<< endl;
      }
      return 0;
}


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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define fork(i,n) for(ll i=0; i<(n); i++)
#define forn for(ll i=0; i<(n); i++)
#define fori(i,k,n) for(ll i=k; i<(n); i++) 
#define all(x) (x).begin(),(x).end()
#define en '\n'
#define FILL(x,v) memset(x,v,sizeof(x))
#define pb push_back
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}
template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

void solve(){
	int n;
	cin >> n;
	queue<ll> q;
	for(int i=1; i<=9; i++) q.push(i);
	while(n--){
		ll x = q.front(); q.pop();
		if(n==0){
			cout << x << en;
			return ;
		}
		//1 10// 2 21 // 3 32 // 4 43 //
		//11 110
		if(x%10!=0) q.push(10*x + x%10 -1);//no zero
		q.push(10*x + x%10);//1 11 111
		if(x%10!=9) q.push(10*x + x%10 + 1);
	}
	cout << q.front() << en;
}

int main(){
	fast;
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
		solve();
    return 0;
}

Measured memory_bytes: 1792
using System;
class hogehoge
{
	static void Main(string[] args)
	{
		int[] v_odd = new int[100001];
		int[] v_even = new int[100001];
		int n = int.Parse(Console.ReadLine());
		int[] v = new int[n];
		string[] s = Console.ReadLine().Split(' ');
		for (int i = 0; i < n; i++)
		{
			v[i] = int.Parse(s[i]);
			if (i % 2 == 0) v_odd[v[i]]++;
			else v_even[v[i]]++;
		}
		int m_o = 0, m_e = 0;
		for (int i = 0; i < 100001; i++)
		{
			if (v_odd[m_o] < v_odd[i]) m_o = i;
			if (v_even[m_e] < v_even[i]) m_e = i;
		}
		int r_o = 0, r_e = 0;
		for (int i = 0; i < 100001; i++)
		{
			if (i != m_o) r_o += v_odd[i];
			if (i != m_e) r_e += v_even[i];
		}
		int r;
		if (m_o == m_e)
		{
			int m2_o = 0, m2_e = 0;
			for (int i = 0; i < 100001; i++)
			{
				if (i == m_o) continue;
				else if (v_odd[m2_o] < v_odd[i]) m2_o = i;
			}
			for (int i = 0; i < 100001; i++)
			{
				if (i == m_e) continue;
				else if (v_even[m2_e] < v_even[i]) m2_e = i;
			}
			int r2_o = 0, r2_e = 0;
			for (int i = 0; i < 100001; i++)
			{
				if (i != m2_o) r2_o += v_odd[i];
				if (i != m2_e) r2_e += v_even[i];
			}
			if (r_o + r2_e < r2_o + r_e) r = r_o + r2_e;
			else r = r2_o + r_e;
		}
		else r = r_o + r_e;
		Console.WriteLine(r);
	}
}

Measured memory_bytes: 19552
import copy
N,M = map(int,input().split())
num = {}
tmp ={}
tmpli = []
li = []
p = []
count = 0
for i in range(M):
    for i in range(N):
        num[i+1] = 0
    a = list(map(int,input().split()))
    for j in range(len(a)-1):
        if a[j+1] in num:
            num[a[j+1]] += 1
    li.append(num.copy())
p = list(map(int,input().split()))

for i in range(2**N):
    tmpli = copy.deepcopy(li)
    for j in range(N):
        if ((i >> j) & 1):
            for k in tmpli:
                if j + 1 in k:
                    k[j+1] = 0
    tmp = 0
    for b in range(len(p)):
        if sum(tmpli[b].values()) % 2 == p[b]:
            tmp += 1
    if tmp == len(p):
        count += 1
print(count)

Measured memory_bytes: 9244
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main()
{
  int N;
  cin>>N;
  double x[10];
  double y[10];
  double ans;
  int kai=1;
  int kai2=1;
  REP(i,N)
  {
    kai=kai*(i+1);
  }
  REP(i,N-1)
  {
    kai2=kai2*(i+1);
  }


  double tmp1;
  double tmp2;

  REP(i,N)
  {
    cin>>x[i];
    cin>>y[i];
  }
  REP(i,N-1)
  {
    FOR(j,i+1,N-1)
    {
      tmp1=x[i]-x[j];
      tmp2=y[i]-y[j];
      tmp1=tmp1*tmp1;
      tmp2=tmp2*tmp2;
      ans=ans+pow(tmp1+tmp2,0.5);
    }
  }

ans=ans/kai*2*kai2;

printf("%.15f",ans);


}

Measured memory_bytes: 640
let prim a n =
  let min_costs = Array.make n max_int in
  min_costs.(0) <- 0;
  let reached_p = Array.make n false in
  let rec doit () =
    let u =
      Array.fold_left (fun (i, m, u) e ->
        if not reached_p.(i) && m > e then (i + 1, e, i) else (i + 1, m, u))
        (0, max_int, (-1)) min_costs
      |> (fun (_, _, u) -> u) in
    if u = (-1) then ()
    else begin
      reached_p.(u) <- true;
      for j = 0 to n - 1 do
        if a.(u).(j) <> (-1) && not reached_p.(j) && min_costs.(j) > a.(u).(j)
        then min_costs.(j) <- a.(u).(j);
      done;
      doit ()
    end in
  doit ();
  Array.fold_left (fun sum c -> if c = max_int then sum else sum + c) 0 min_costs

let () =
  let n = read_int () in
  let a = Array.make_matrix n n max_int in
  for i = 0 to n - 1 do
    for j = 0 to n - 1 do
      a.(i).(j) <- Scanf.scanf " %d" (fun x -> x);
    done
  done;
  prim a n |> Printf.printf "%d\n"

Measured memory_bytes: 4596
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) { 

        Scanner sc = new Scanner(System.in);
        Integer N = Integer.parseInt(sc.nextLine());

        String[] S = new String[N];
        Map<String, Integer> origin = new HashMap<>();
        Map<String, List<Integer>> scores = new HashMap<>();
        for (int i = 0; i < N; i++) {
            String[] sp = sc.nextLine().split(" ");
            S[i] = sp[0];

            List<Integer> points = scores.get(sp[0]);
            if (points == null) {
                points = new ArrayList<>();
            }
            points.add(Integer.parseInt(sp[1]));
            points.sort(Comparator.reverseOrder());
            scores.put(sp[0], points);

            origin.put(sp[0] + sp[1], i + 1);
        }

        Arrays.sort(S);
        String[] sorted = new String[N];
        String tmp = "";
        int index = 0;
        for (int i = 0; i < N; i++) {
            String store = S[i];
            List<Integer> list = scores.get(store);

            int point = 0;
            if (tmp.equals("")) {
                point = list.get(0);
            } else if (tmp.equals(store)) {
                index++;
                point = list.get(index);
            } else {
                index = 0;
                point = list.get(index);
            }

            tmp = store;

            sorted[i] = store + point;
        }

        for (String sp : sorted) {
            System.out.println(origin.get(sp));
        }
    }
}


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

int main(){

    string S;
    cin >> S;
    int f, l;
    f = atoi(S.substr(0, 2).c_str());
    l = atoi(S.substr(2, 4).c_str());
    
    if(f==0 || f > 12){
        if(l == 0 || l > 12){
            cout << "NA" << endl;
            return 0;
        }else{
            cout << "YYMM" << endl;
            return 0;
        }
    }else{
        if(l == 0 || l > 12){
            cout << "MMYY" << endl;
            return 0;
        }else{
            cout << "AMBIGUOUS" << 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;
typedef long long ll;
typedef pair<int,int> P;

P div(int N)
{
	int p = N / -2;
	if (N - p * (-2) == 0)
	{
		return P(p,0);
	}
	else if (N - p * (-2) == 1)
	{
		return P(p,1);
	}
	else
	{
		return P(p+1,1);
	}
}

int main()
{
	int N;
	cin >> N;
	//cout << div(N).first << " " << div(N).second << endl;
	if (N == 0 || N == 1)
	{
		cout << N << endl;
		return 0;
	}

	//cout << N << endl;
	string S = ""; 
	while (!(N == 1))
	{
		//cout << div(N).first << " " << div(N).second << endl;
		char q = div(N).second + '0';
		S += q;
		N = div(N).first;
	}

	cout << '1';
	for (int i = S.size() - 1; i >= 0; --i)
	{
		cout << S[i];
	}
	cout << endl;
	return 0;
}

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

#define exec_time() (1.0 * clock()/CLOCKS_PER_SEC)
#define first fst
#define second snd

typedef double lf;
typedef long long LL;
typedef std::pair<int, int> Pii;

template <typename T> inline bool maximum(T &a, T b) { return a < b? a = b, 1 : 0; }
template <typename T> inline bool minimum(T &a, T b) { return a > b? a = b, 1 : 0; }
template <typename T>
T read(T &x, T f = 0)
{
	char c = getchar(); x = 0;
	for(; !isdigit(c); c = getchar())
		f |= c == '-';
	for(;  isdigit(c); c = getchar())
		x = x*10 + c-'0';
	return x = f? -x : x;
}

const int N = 1e5 + 10;

int n;
struct Node
{
	int x, y, t;
}p[N];

bool check()
{
	for(int i = 1; i <= n; ++i){
		int deltax = p[i].x - p[i-1].x;
		int deltay = p[i].y - p[i-1].y;
		if(abs(deltax) + abs(deltay) > p[i].t - p[i-1].t)
			return false;
		if((p[i].t-p[i-1].t - (abs(deltax)+abs(deltay))) & 1)
			return false;
	}
	return true;
}

void Init()
{
	read(n);
	for(int i = 1; i <= n; ++i)
		read(p[i].t), read(p[i].x), read(p[i].y);
}

void Exec()
{
	puts(check()? "Yes" : "No");
	return ;
}

int main()
{

	Init();
	Exec();

	return 0;
}

Measured memory_bytes: 1408
// Problem : A - Registration
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define sz(x)             (int)x.size()
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*(b/gcd(a,b)))
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
#define watch(x)         cout << #x << " = " << x << endl
#define trace(x)         cerr << #x << " = " << x << endl
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void angshuGod()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){
    
	string s, t; cin>>s>>t;
	if(len(t) < len(s)) cout<<"No\n";
	else{
		fo(i,len(s)){
			if(s[i] != t[i]){
				cout<<"No\n";
				return;
			}
		}
		if(len(t)-len(s) == 1) cout<<"Yes\n";
		else cout<<"No\n";
	}	
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3512
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let l: usize = scan(tokens);
    let r: usize = scan(tokens);
    if l / 2019 < (r + 1) / 2019 {
        println!("0");
        return;
    }
    let mut ans: usize = 2019;
    for i in l..r + 1 {
        for j in i + 1..r + 1 {
            ans = std::cmp::min(ans, i * j % 2019);
        }
    }
    println!("{}", ans);
}


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

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

	int N;
	string s;
	cin >> N >> s;

	int h = 0, minH = 0;
	for(int i = 0; i < N; i++) {
		if(s[i] == '(') h++;
		else h--;
		minH = min(minH, h);
	}

	int l = -minH, r = h + l;
	if(l) s = string(l, '(') + s;
	if(r) s = s + string(r, ')');

	cout << s << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
long long n;
long long m=2;
int main()
{
    int i;
    cin>>n;
    for(i=0;i<n;i++)
    {
        m=(m+1)*2;  
    }
    cout<<m<<endl;
    return 0;
}

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

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

Measured memory_bytes: 256
N,K = map(int,input().split())
x = list(map(int,input().split()))
m = abs(x[0])*2 + abs(x[N-1])*2
for i in range(N-K+1):
    if x[i] >= 0:
        t = x[i+K-1]
    elif x[i+K-1] <= 0:
        t = -x[i]
    elif -x[i] <= x[i+K-1]:
        t = -x[i]*2 + x[i+K-1]
    else:
        t = -x[i] + x[i+K-1]*2
    if t < m:
        m = t
print(m)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int x;
  cin >> x;
  int ans = 1;
  for(int i = 2; i * i <= x; i++) {
    int now = i;
    while(now <= x) now *= i;
    ans = max(ans, now / i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int a, b, x;
	bool flag = true;
	cin >> a >> b >> x;
	for (int i = 0; i <= b; i++) {
		if ((a + b) < x) {
			cout << "NO";
			flag = false;
			break;
		}else if ((a + i) <= x) {
			cout << "YES";
			flag = false;
			break;
		}
	}
	if (flag) cout << "NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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

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

  if(a >= 13) cout << b << endl;
  else if(a >= 6) cout << b / 2 << endl;
  else cout << 0 << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{

    public static void main(String[] args)  {
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            int b = sc.nextInt();
            int res = a/b;
            if(res*b<a){
                ++res;
            }
            System.out.println(res);
    }
}



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

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<int> BALL(N, 1);
  vector<bool> RED(N, false);
  RED.at(0) = true;
  
  for (int i = 0; i < M; i++){
    int X, Y;
    cin >> X >> Y;
    X -= 1;
    Y -= 1;
    
    if (RED.at(X) == true){
      RED.at(Y) = true;
    }
    
    BALL.at(X)--;
    BALL.at(Y)++;
    
    if (BALL.at(X) <= 0){
      RED.at(X) = false;
    }
  }
  
  int ans = 0;
  for (int i = 0; i < N; i++){
    if (RED.at(i) == true){
      ans++;
    }
  }

  
  cout << ans << endl;
}

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

int main() {
  int N, M, H, A, B;
  cin >> N >> M;
  vector<vector<int>> data(N+1);
  int cnt = 0;
  for (int i = 1; i <= N; i++){
    cin >> H;
    data.at(i).push_back(H);
  }
  for (int i = 0; i < M; i++){
    cin >> A >> B;
    data.at(A).push_back(data.at(B).at(0));
    data.at(B).push_back(data.at(A).at(0));
    }
  for (int i = 1; i < data.size(); i++){
     if (data.at(i).size() == 1) {
         cnt++;
         continue;
       }
      bool judge = true;
    for (int j = 1; j < data.at(i).size(); j++){
       if(data.at(i).at(0) <= data.at(i).at(j)){
       judge = false;
       break;
       }
    }
    if (judge) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 9276
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k;
  string s;
  cin >> k >> s;
  if(s.size() <= k) cout << s << endl;
  else {
    for(int i=0;i<k;i++)cout << s.at(i);
    cout << "..." <<endl;
  }
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
template <typename Abelian>
struct BIT {
  BIT(int n, const Abelian &UNITY = 0) : n(n), UNITY(UNITY), dat(n, UNITY) {}

  void add(int idx, const Abelian &value) {
    while (idx < n) {
      dat[idx] += value;
      idx |= idx + 1;
    }
  }

  Abelian sum(int idx) {
    Abelian res = UNITY;
    while (idx >= 0) {
      res += dat[idx];
      idx = (idx & (idx + 1)) - 1;
    }
    return res;
  }

  Abelian sum(int left, int right) { return sum(right) - sum(left - 1); }

  Abelian operator[](const int idx) { return sum(idx, idx); }

  int lower_bound(Abelian value) {
    if (value <= UNITY) return 0;
    int res = 0, exponent = 1;
    while (exponent <= n) exponent <<= 1;
    for (int mask = exponent >> 1; mask > 0; mask >>= 1) {
      if (res + mask - 1 < n && dat[res + mask - 1] < value) {
        value -= dat[res + mask - 1];
        res += mask;
      }
    }
    return res;
  }

private:
  int n;
  const Abelian UNITY;
  vector<Abelian> dat;
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, k; cin >> n >> k;
  vector<int> p(n);
  REP(i, n) cin >> p[i];
  BIT<int> bit(n);
  vector<int> memo(n, 0);
  long long inv = 0;
  REP(i, k) {
    inv += i - bit.sum(p[i]);
    bit.add(p[i], 1);
  }
  int ans = 0;
  bool c = false;
  if (inv == 0) {
    c = true;
  } else {
    ++ans;
  }
  FOR(i, k, n) {
    long long bef = inv;
    inv -= bit.sum(p[i - k] - 1);
    bit.add(p[i - k], -1);
    long long tmp = k - 1 - bit.sum(p[i]);
    inv += tmp;
    bit.add(p[i], 1);
    if (inv == 0) {
      c = true;
      continue;
    }
    if (tmp > 0 || bef != inv) {
      ++ans;
    }
  }
  cout << ans + c << '\n';
  return 0;
}


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


int main() {
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    
    if (W>0 && H>0) {
        if ((x<0 || y<0) || x-r<0 || x+r>W || y-r<0 || y+r>H) {
            cout << "No\n";
        }else{
            cout << "Yes\n";
        }
    }else if(W<0 && H>0) {
        if ((x>0 || y<0) || x-r<W || x+r>0 || y-r<0 || y+r>H) {
            cout << "No\n";
        }else{
            cout << "Yes\n";
        }
    }else if(W<0 && H<0) {
        if ((x>0 || y>0) || x-r<W || x+r>0 || y-r<H || y+r>0) {
            cout << "No\n";
        }else{
            cout << "Yes\n";
        }
    }else{
        if ((x<0 || y>0) || x-r<0 || x+r>W || y-r<H || y+r>0) {
            cout << "No\n";
        }else{
            cout << "Yes\n";
        }
    }
    
    
    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

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

int n,m;
string a[50],b[50];

bool check(int y,int x) {
	REP(i,m) {
		REP(j,m) {
			if(a[y+i][x+j]!=b[i][j]) return false;
		}
	}
	return true;
}

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

	cin>>n>>m;
	REP(i,n) cin>>a[i];
	REP(i,m) cin>>b[i];

	REP(i,n-m+1) {
		REP(j,n-m+1) {
			if(check(i,j)) {
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}

	cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 256
# 1次元DP
# 番兵を手前に100000用意してしまおうｗ
n = int(input())

dp = [9999] * (200000 + 10)
offset = 100000
dp[0 + offset] = 0

coin = []
coin.append(1)
temp = 6
while temp <= 100000:
    coin.append(temp)
    temp *= 6
temp = 9
while temp <= 100000:
    coin.append(temp)
    temp *= 9

# print(coin)

for i in range(1, len(dp) - offset):
    temp_min = 9999
    for c in coin:
        temp_min = min(temp_min, dp[i + offset - c])
    dp[i + offset] = temp_min + 1

print(dp[n + offset])


Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define REP(a,b,c) for(int a=b; a<(int)c; a++)
#define REPE(a,b,c) for(int a=b; a<=(int)c; a++)
#define REPD(a,b,c) for(int a=b; a>=(int)c; a--)
#define rep(a,b) REP(a,0,b)
#define repd(a,b) REPD(a,b,0)
typedef long long int ll;
using namespace std;
string str;
int pos;
bool DFS(char c){
  // cout << endl << endl;
  //cout << pos << " " << c << endl;
  while(true){
    if(pos >= str.size()){
      return c==' ';
    }
    char ch = str[pos];
    //cout << ch;
    switch(ch){
    case  '[':
    case  '(':
      pos++;
      if(!DFS(ch)) return false;
      break;
    case  ']':
      // cout << endl;
      //cout <<pos<<":"<< c << ch << endl;
      return c=='[';
      break;
    case  ')':
      //cout << endl;
      //cout <<pos<<":"<< c << ch << endl;
      return c=='(';
      break;
    }
    pos++;
  }
  return true;
}

int main(){
  while(true){
    getline(cin,str);
    if(str == ".") break;
    pos = 0;
    if(DFS(' ')){
      cout << "yes" << endl;
    }else{
      cout << "no" << endl;
    }
  }
  return 0;
}

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

int main(){
  int n=1000;
  while(n>0){
    n--;
  int i,cnt=0;
  string locker;
  cin >> locker;
  int len = locker.size();
  for(i = 0; i < len ; i++){
    if(locker[i]=='A'){
      if(locker[i+1]=='B' || locker[i+1]=='D')cnt++;
    }else if(locker[i]=='B'){
      if(locker[i+1]=='A' || locker[i+1]=='C' || locker[i+1]=='E')cnt++;
    }else if(locker[i]=='C'){
      if(locker[i+1]=='B' || locker[i+1]=='F')cnt++;
    }else if(locker[i]=='D'){
      if(locker[i+1]=='A' || locker[i+1]=='E' || locker[i+1]=='G')cnt++;
    }else if(locker[i]=='E'){
      if(locker[i+1]=='B' || locker[i+1]=='D'
	 ||locker[i+1]=='F' || locker[i+1]=='H')cnt++;
    }else if(locker[i]=='F'){
      if(locker[i+1]=='C' || locker[i+1]=='E' || locker[i+1]=='I')cnt++;
    }else if(locker[i]=='G'){
      if(locker[i+1]=='D' || locker[i+1]=='H')cnt++;
    }else if(locker[i]=='H'){
      if(locker[i+1]=='E' || locker[i+1]=='G' || locker[i+1]=='I')cnt++;
    }else if(locker[i]=='I'){
      if(locker[i+1]=='F' || locker[i+1]=='H')cnt++;
    }    
  }
  if(cnt==len-1)cout << locker << endl;
  }
  return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	vi A(N);
	REP(i, N)cin >> A[i];
	vb win(K + 1);
	win[0] = false;
	FOR(i, 1, K + 1) {
		win[i] = false;
		REP(j, N) {
			win[i] = win[i] || (A[j] <= i && !win[i - A[j]]);
		}
	}
	if (win[K])cout << "First" << endl;
	else cout << "Second" << endl;
	PAU;
	return 0;
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

long double P[505], Q[505];
long double dp[505][505];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> P[i];
    }
    REP(i, N + 1) {
        cin >> Q[i];
    }

    REP(i, N + 1) {
        REP(j, N + 1) {
            dp[i][j] = INF;
        }
    }

    REP(len, N) {
        REP(left, N) {
            if (left + len >= N)
                break;

            long double sum = Q[left + len + 1];
            REP(i, len + 1) {
                sum += P[left + i] + Q[left + i];
            }
            REP(i, len + 1) {
                //! 頂点iをroot
                long double p = sum;
                if (i == 0)
                    p += Q[left + i];
                else
                    p += dp[left][left + i - 1];

                if (i == len)
                    p += Q[left + i + 1];
                else
                    p += dp[left + i + 1][left + len];

                dp[left][left + len] = std::min(dp[left][left + len], p);
            }
        }
    }

    cout << OF64 << dp[0][N - 1] << endl;
    return 0;
}


Measured memory_bytes: 7276
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		char S3 = S.charAt(2);
		char S4 = S.charAt(3);
		char S5 = S.charAt(4);
		char S6 = S.charAt(5);
		if(S3 == S4 && S5 == S6){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		stdIn.close();
	}
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  if(360%n==0)
    cout<<360/n;
  else
  {
    int x=360;
    for(int i=2;i<=n;i++)
    {
      if(n%i==0&&x%i==0)
      {
        n/=i;
        x/=i;
        i--;
      }
    }
    cout<<x;
  }
  }

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <chrono>
#include <random>
#include <unordered_map>
#include <cassert>
#pragma GCC optimize("O3")
#pragma comment(linker, "STACK:36777216")
using namespace std;
using i64 = int64_t;
constexpr i64 MOD = 1e9 + 7;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
using vi = vector<i64>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ii = pair<i64, i64>;

int main() {
    string s;
    cin >> s;
    if (s.size() >= 4 && s.substr(0, 4) == "YAKI") {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

int main() {
  string S,T; cin>>S>>T;
  int ans = (int)T.length();
  // 該当するTの文字を、どこからたどるか
  for(int i=0; i<(int)T.length(); ++i) {
    for(int j=i; j<(int)S.length()-(int)T.length()+1+i; ++j) {
      if(S[j]==T[i]) {
        int count = (int)T.length();
        for(int k=0; k<(int)T.length()-i; ++k) {
          if(S[j+k]==T[i+k]) count--;
        }
        ans=min(ans,count);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3572
#coding Utf-8

N,Y=map(int,input(). split())
count=0

for i in range(N+1):
    for j in range(N-i+1):
        k= N-j-i
        if 10000*i+5000*j+1000*k==Y:
            num= [i,j,k]
            count=1
            break
        else:
            continue
        break

if count>0:
    print(num[0],num[1],num[2])
else:
    print(-1,-1,-1)


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

#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long

#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
using namespace std;

int main()
{
	fastIO;
	ll n, m, i, j, k, maxProfit = 0;
	vector < pair < ll , ll > > jobs;jobs.clear();
	set < ll > st;st.clear();
	set < ll >::iterator it1, it2, it3;
	cin>>n>>m;
	Fo(i,1,m+1)st.insert(i);
	fo(i,n) {
		cin>>j>>k;
		jobs.pb({k,j});
	}
	sort(jobs.begin(), jobs.end());
	reverse(jobs.begin(), jobs.end());

	for(auto job:jobs) {
		ll minDayReq = job.S;
		it1 = st.lower_bound(minDayReq);
		if(it1==st.end())continue;
		maxProfit += job.F;
		st.erase(*it1);
	}

	cout<<maxProfit;
}

Measured memory_bytes: 7160