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

int main() {
    int const MOD = 1e9 + 7;

    int n;
    string s1, s2;
    cin >> n >> s1 >> s2;

    ll ans = 3;
    rep(i, n) {
        bool a = s1[i - 1] == s2[i - 1];
        if (s1[i] == s2[i]) {
            if (i > 0 && a) ans = ans * 2 % MOD;
        } else {
            ans = ans * (a ? 2 : 3) % MOD;
            i++;
        }
    }

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


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

using namespace std;

int main(){
	string S;
	cin>>S;
	bool C=false,F=false;
	for(int i=0;i<S.size();i++){
		if(S[i]=='C'){
			C=true;
		}else if(S[i]=='F' && C){
			F=true;
			break;
		}
	}
	if(C && F){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define nl cout<<endl
#define P 1000000007
#define MOD(x) ((x%P)+P)%P
#define NMAX 100100

#define INF 100000000
int mod=1e9;

int main() 
{


    int n;
    cin>>n;

    int a[n],b[n],c[n];

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

    int dp[n][3];
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    for(int i = 1;i<n;i++)
    {
        dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][1],dp[i-1][0]) + c[i];
    }

    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));

	return 0;
    	
}

Measured memory_bytes: 2560
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	int A,B,C;
	cin >> A >> B >> C;
	if(A==B&&B==C){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

	return 0;

}



Measured memory_bytes: 888
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <map>

using namespace std;

void solve()
{
	string s;
	cin >> s;
	int ans = 0;
	int cnt1 = 0;
	char c = s[0];
	for (int i = 1; i < s.size(); ++i)
	{
		if (s[i] != c)
		{
			++cnt1;
			c = s[i];
		}
	}
	reverse(s.begin(), s.end());
	int cnt2 = 0;
	c = s[0];
	for (int i = 1; i < s.size(); ++i)
	{
		if (s[i] != c)
		{
			++cnt2;
			c = s[i];
		}
	}
	ans = min(cnt1, cnt2);
	cout << ans << endl;
}

int main()
{
	solve();
	return(0);
}

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

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);

  string text;
  cin >> text;

  const int N = (int)text.size();
  constexpr int SIGMA = 26;

  vector<vector<int>> next(N + 1);
  vector<int> point(SIGMA);

  for (int i = 0; i <= N; i++){
    next[i].assign(SIGMA, N);
  }

  for (int i = N - 1; i >= 0; i--){
    for (int j = 0; j < SIGMA; j++){
      next[i][j] = next[i + 1][j];
      next[i][text[i] - 'a'] = i;
    }
  }


  vector<int> dp(N + 2);
  dp[N] = 1;

  for (int i = N - 1; i >= 0; i--){
    dp[i] = N + 1;

    for (int j = 0; j < SIGMA; j++){
      dp[i] = min(dp[i], dp[next[i][j] + 1] + 1);
    }
  }

  int pos = 0, len = 0;
  while (len < dp[0]){
    for (int j = 0; j < SIGMA; j++){
      if (dp[pos] == dp[next[pos][j] + 1] + 1){
        cout << char('a' + j);
        pos = next[pos][j] + 1;
        len++;
        break;
      }
    }
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 27796
function main(arg) {
    let [a,b,c] = arg.split("\n")[0].split(" ").map(Number)
    let k = Number(arg.split("\n")[1])
    
    
    b_ = b
    c_ = c
    for(let i=0; i<k; i++) {
        if(b <= a){
            b=b*2;
        } else {
            c=c*2;
        }
    }
    console.log((b>a && c>b) ? 'Yes' : 'No')
    
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29676
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, sta, n) for (int i = sta; i < (n); ++i)
#define all(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
const int mod = 1000000007;

struct UnionFind {
    vector<int> par, rank, size;

    UnionFind(int n) : par(n, -1), rank(n, 0) {};
    void init(int n) { par.assign(n, -1), rank.assign(n, 0); }

    int root(int x) {
        if (par[x] == -1) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
    
};

typedef pair<int, int> P;

vector<int> kr[200100];
vector<int> lr[200100];
int main() {
    int n, k, l;
    cin >> n >> k >> l;
    
    int p, q;
    UnionFind uf1(n);
    rep(i, k) {
        cin >> p >> q;
        --p, --q;
        uf1.merge(p, q);
    }
    int r, s;
    UnionFind uf2(n);
    rep(i, l) {
        cin >> r >> s;
        --r, --s;
        uf2.merge(r, s);
    }

    map<P, int> cnt;
    rep(i, n) cnt[P(uf1.root(i), uf2.root(i))]++;
    
    rep(i, n) cout << cnt[P(uf1.root(i), uf2.root(i))] << " ";

    cout << endl;
    return 0;
}




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

int main () {
	int n, d, x, a[110], cnt = 0;
	cin >> n >> d >> x;
	for (int i = 1; i <= n; i++) {
		cin >>a[i];
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= d; j++) {
			if (d >= a[i] * (j - 1) + 1) {
				cnt++;
			}
			else break;
		}
	}
	cout << cnt + x << endl;

	return 0;	
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = (1e-10);
long long const MOD = 1000000007;

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

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

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

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

int dfs(int crt, int color, vector<vector<int>> &G, vector<int> &v) {
    v[crt] = color;
    color ^= 1;
    int ret = 0;
    for (int i = 0; i < G[crt].size(); i++) {
        int nv = G[crt][i];
        if (v[nv] == -1) {
            ret = min(dfs(nv, color, G, v), ret);
        }
        if (v[nv] != color) return -1;
    }
    return ret;
}

vector<int> solve(int N, int M) {
    vector<vector<int>> G(N);

    for (int i = 0; i < M; i++) {
        int u, v; cin >> u >> v;
        u--;
        v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    set<int> s;
    for (int i = 0; i < N; i++) {
        vector<int> v(N, -1);
        int check = dfs(i, 0, G, v);
        if (check == -1) continue;
        int cnt = 0;
        for (int j = 0; j < N; j++) {
            if (v[j] == 1) cnt++;
            if (j == N-1) {
                if (cnt % 2) break;
                s.insert(cnt/2);
            }
        }
    }
    
    vector<int> ret;
    for (auto itr = s.begin(); itr != s.end(); itr++) {
        ret.push_back(*itr);
    }
    return ret;
}

int main(void) {
    int N, M;
    vector<vector<int>> ans;
    while (1) {
        cin >> N >> M;
        if (!N && !M) break;
        ans.push_back(solve(N, M));
    }
    for (auto &v : ans) {
        cout << v.size() << endl;
        for (auto &i : v) {
            cout << i << endl;
        }
    }
}





Measured memory_bytes: 3236
import java.util.*;
import java.io.*;

class Main {

	void solve () {

		int a = in.nextInt(), b = in.nextInt();
		int ans = 0;
		
		if (a >= 13) ans = b;
		else if (a >= 6 && a <= 12) ans = b/2;
		else ans = 0;
		
		out.println(ans);
		
		
	}

	public static PrintWriter out = new PrintWriter(System.out);
	public static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

}

Measured memory_bytes: 21588
#include <stdio.h>

int main(void){
	int n,a[100],i;
	
	scanf("%d",&n);
	for(i = 0;i < n;i++){
		scanf(" %d",&a[i]);
	}
	for(i = n-1;i >= 1;i--){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[0]);
	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define ll long long
#define db double
using namespace std;
const int M=2020,MOD=1e9+7;
ll dp[M];
int main()
{
    for(int i=3;i<M;i++)
    {
        dp[i]=1;
        for(int j=3;j<i;j++)
            dp[i]=(dp[i]+dp[i-j])%MOD;
        //printf("%d %lld\n",i,dp[i]);
    }
    int n;
    cin>>n;
    cout<<dp[n]<<'\n';
    return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <string.h>
char t[1510];
int main(){
	int i,j;
	int n,m;
	int	cnt=0;
	int h;
	while(scanf("%s",&t)){
		// printf("%s\n",t);
		if(strcmp(t,"-")==0) break;
		n=strlen(t);
		for(i=0;i<n;i++){
			t[n+i]=t[i];
		}
		scanf("%d",&m);
		cnt=0;
		for(i=0;i<m;i++){
			scanf("%d",&h);
			cnt+=h;		
		}
		cnt%=n;
		for(i=0;i<n;i++){
			printf("%c",t[i+cnt]);
		}
		puts("");
	}
	return 0;
}


Measured memory_bytes: 2112
base1 = 1009
base2 = 1013
mask = (1 << 32) - 1


def calc_hash(f, r, c):
    global ph, pw, h
    tmp = [[0] * c for _ in range(r)]
    dr, dc = r - ph, c - pw

    t1 = 1
    for _ in range(pw):
        t1 = (t1 * base1) & mask
    for i in range(r):
        e = 0
        for j in range(pw):
            e = e * base1 + f[i][j]
        for j in range(dc):
            tmp[i][j] = e
            e = (e * base1 - t1 * f[i][j] + f[i][j + pw]) & mask
        tmp[i][dc] = e

    t2 = 1
    for _ in range(ph):
        t2 = (t2 * base2) & mask
    for j in range(dc + 1):
        e = 0
        for i in range(ph):
            e = e * base2 + tmp[i][j]
        for i in range(dr):
            h[i][j] = e
            e = (e * base2 - t2 * tmp[i][j] + tmp[i + ph][j]) & mask
        h[dr][j] = e


th, tw = map(int, input().split())
t = [[ord(c) for c in input().strip()] for _ in range(th)]
ph, pw = map(int, input().split())
p = [[ord(c) for c in input().strip()] for _ in range(ph)]

if th >= ph and tw >= pw:
    h = [[0] * tw for _ in range(th)]
    calc_hash(p, ph, pw)
    key = h[0][0] & mask
    calc_hash(t, th, tw)
    for i in range(th - ph + 1):
        for j in range(tw - pw + 1):
            if h[i][j] & mask == key:
                print(i, j)

Measured memory_bytes: 94860
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int H,W,h,w;
  cin >> H >> W >> h >> w;
  cout << (H - h) * (W - w) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int i,j,N,count,minj,swap;
  int A[100];
  count=0;

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<=N-1;i++){
    minj=i;
    for(j=i;j<=N-1;j++){
      if(A[j]<A[minj]){
	minj=j;
      }
    }
    if(A[i]!=A[minj]){
      swap=A[i];
      A[i]=A[minj];
      A[minj]=swap;
      count++;
    }
  }

  printf("%d",A[0]);
  for(i=1;i<N;i++){
    printf("% d",A[i]);
  }
  printf("\n%d\n",count);

  return 0;
}



Measured memory_bytes: 2084
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import deque

n, m = map(int, readline().split())
s = readline().rstrip().decode()[::-1]
index = 0
ans = deque([])
for i in range(n):
    for j in range(m, 0, -1):
        if index + j >= n:
            ans.appendleft(n - index)
            print(*ans)
            exit()
        if s[index + j] == '0':
            ans.appendleft(j)
            index += j
            break
    else:
        print(-1)
        exit()


Measured memory_bytes: 6700
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod=998244353;

#define pb push_back
#define mp make_pair


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll t,n,an;
    cin>>n;
    vector<ll> a(n);
    map<ll,ll> c;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        c[a[i]]++;
    }
    ll sum=0;
    for(auto k:c)
        sum+=k.second*(k.second-1)/2;
    ll ans=0;
    for(ll i=0;i<n;i++){
        ans=sum-c[a[i]]*(c[a[i]]-1)/2+(c[a[i]]-1)*(c[a[i]]-2)/2;
        cout<<ans<<"\n";
    }

    return 0;
}




Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define rep(i,l) for(int i=0;i<l;i++)
#define reP(i,l) for(int i=1;i<=l;i++)
#define FOR(i,l,r) for(int i=l;i<=r;i++)
#define ROF(i,l,r) for(int i=l;i>=r;i--)
#define in(x) scanf("%d",&x)
#define lin(x) scanf("%lld",&x)
#define out(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define uout(x) printf("%llu\n",x)
//#define pair<int,int> pr
typedef long long ll;
typedef unsigned long long ull;
const int N=3e5;
struct node{
	ll s,t,x;
}stu[N];
bool cmp(node a,node b){
	return a.x<b.x;
}
set<pair<ll,int> >s;
ll n,q,ans[N],d[N];
signed main(){
 	lin(n),lin(q);
	rep(i,n){
		lin(stu[i].s),lin(stu[i].t),lin(stu[i].x);
		stu[i].s-=stu[i].x;
		stu[i].t-=stu[i].x;
	}   
	sort(stu,stu+n,cmp);
	
	memset(ans,-1,sizeof(ans));
	rep(i,q){
		lin(d[i]);
		s.insert({d[i],i});
	}
	rep(i,n){
		set<pair<ll,int> >::iterator it;
		it=s.lower_bound({stu[i].s,0});//结构体指针 
		while(it!=s.end()){
			if(it->first>=stu[i].t)break;
			ans[it->second]=stu[i].x;
			s.erase(it++);
		}
	}
	rep(i,q)cout<<ans[i]<<endl;
    return 0;
}

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

vector<int> dp;
vector<vector<int>> line;

int calc(int n){
    if(dp[n] != -1) return dp[n];

    int len = line[n].size();
    if(len == 0){
        dp[n] = 0;
        return 0;
    }

    int ret = 0;
    for(int i=0; i<len; i++){
        ret = max(ret, calc(line[n][i]) + 1);
    }
    dp[n] = ret;
    return ret;
}

int main(){
    int N, M;  cin >> N >> M;
    
    line = vector<vector<int>>(N+1);
    for(int i=0; i<M; i++){
        int x, y;  cin >> x >> y;
        line[x].push_back(y);
    }

    dp = vector<int>(N+1, -1);
    for(int i=1; i<=N; i++) dp[i] = calc(i);

    int ans = 0;
    for(int i=1; i<=N; i++) ans = max(ans, dp[i]);
    cout << ans << endl;
}

Measured memory_bytes: 8192
#include<stdio.h>
int main(void)
{
    int x[3],n,i,y;
	for(i=0;i<3;i++){
	    scanf("%d",&x[i]);
	}
	for(i=0;i<2;i++){
	    for(n=i+1;n<3;n++){
		    if(x[i]>x[n]){
			    y=x[i];
				x[i]=x[n];
				x[n]=y;
			}
		}
	}
	for(i=0;i<3;i++){
	    printf("%d",x[i]);
		if(i!=2) printf(" ");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 2716
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <fstream>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}

};
typedef vector<vector<Edge>> Graph;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll facmemo[200000] = {};

ll factorial(ll n) {//階乗
	if (facmemo[n] != 0) return facmemo[n];
	if (n == 0) return 1;
	ll ret = n * factorial(n - 1);
	ret %= MODU;
	return facmemo[n] = ret;
}

ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x %mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
ll divmod(ll a, ll b, ll m) { // a/b(mod m)
								  // a/b (mod m)
								  // a*b^-1
								  // b^-1 * b = 1
								  // b^(m-1) = 1 
								  // b^(m-2) * b = 1
								  // b^-1 = b^(m-2)

								  // a/b = a * b^(m-2)

	return (a * 1LL * mod_pow(b, m - 2, m)) % m;
}
ll ncr(ll n, ll r) {
	if (r == 0) return 1;
	if (n < r) return 1;
	return divmod(factorial(n), (factorial(r) * (factorial(n - r))) % MODU, MODU);
}

bool sankaku(int a, int b, int c) {
	return a <= b + c && b <= a + c && c <= b + a;
}
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}

signed main() {
	int n, m;
	cin >> n >> m;
	if (n == m) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
T=[]
for i in range(5):
    T.append(int(input()))
t=[]
for i in range(5):
    t.append(T[i]%10)
a=0
if 0 not in t:
    for i in range(5):
        if t[i]==min(t):
            a=T[i]
            T.remove(T[i])
            break
    for i in range(4):
        a+=((T[i]//10)+1)*10

if 0 in t:
    U=[s for s in T if s%10==0]
    G=[s for s in T if s%10!=0]
    g=[]
    for i in range(len(G)):
        g.append(G[i]%10)
        
    for i in range(len(U)):
        a+=U[i]
        
    for i in range(len(G)):
        if g[i]==min(g):
            a+=G[i]
            G.remove(G[i])
            break
            
    for i in range(len(G)):
        a+=((G[i]//10)+1)*10

print(a)

Measured memory_bytes: 9276
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;



//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr;	} cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int i = 1; i < N; i++) cout << ", " << v[i]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define all(x) (x).begin(), (x).end()



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

int H, W;
vector<string> S;

void mine(int x, int y)
{
	if (S[y][x] == '#') return;

	int count = 0;
	for (int d = 0; d < 8; d++) {
		int nx = x + dx[d];
		int ny = y + dy[d];

		if (nx < 0 || W <= nx || ny < 0 || H <= ny || S[ny][nx] != '#') continue;

		count++;
	}
	
	S[y][x] = (char)('0' + count);
}

int problemB()
{
	cin >> H >> W;
	
	string tmp;
	for (int i = 0; i < H; i++) {
		cin >> tmp;
		S.push_back(tmp);
	}

	for (int y = 0; y < H; y++) {
		for (int x = 0; x < W; x++) {
			mine(x, y);
		}
	}

	for (int i = 0; i < H; i++) cout << S[i] << endl;

	return 0;
}

int main()
{
	//clock_t start, end;
	//start = clock();

	problemB();
	
	//end = clock();
	//printf("%d msec.\n", end - start);

	return 0;
}

Measured memory_bytes: 256
//#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

//ifstream cin("x.in"); ofstream cout("x.out");

int main() {
    cin.sync_with_stdio(false);
    cin.tie(); cout.tie();
    int n;
    cin >> n;

    long long ans = 0, mn = 1LL << 60;

    bool ok = 1;

    for (int i = 1; i <= n; ++ i) {
        int a, b;
        cin >> a >> b;

        if (a != b)
            ok = 0;
        ans += a;

        if (b < a)
            mn = min(mn, 1LL * b);
    }

    if (ok == 1)
        mn = ans;

    cout << ans - mn << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int x,y;
    scanf("%d %d",&x,&y);
    if((x==1 || x==3 || x==5 || x==7 || x== 8 || x==10 || x==12)&&(y==1 || y==3 || y==5 || y==7 || y== 8 || y==10 || y==12))
       printf("Yes\n");
    else if((x==4 || x== 6 || x== 9 || x==11)&&(y==4 || y==6 || y== 9 || y==11))
    printf("Yes\n");
    else if(x==2 && y==2)
        printf("Yes\n");
    else printf("No\n");
    return 0;
}


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


def main():
    d, g = i_map()
    num_list = i_row_list(d)

    min_count = INF
    for bit in list(product([0,1], repeat=d)):
        tmp_score = 0
        tmp_count = 0
        max_i = -1
        for i in range(d):
            if bit[i] == 0:
                max_i = max(max_i, i)
                continue
            tmp_score += num_list[i][0] * 100 * (i+1) + num_list[i][1]
            tmp_count += num_list[i][0]
        if tmp_score < g:
            for _ in range(num_list[max_i][0]):
                tmp_score += 100 * (max_i+1)
                tmp_count += 1
                if tmp_score >= g:
                    break
        if tmp_score >= g:
            min_count = min(min_count, tmp_count)
        
    print(min_count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 77436
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <complex>
using namespace std;

typedef long long ll;

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

int main(){
  int n;

  while(cin >> n){
    printf("3C%02d\n", (n - 1) % 39 + 1);
  }
}

Measured memory_bytes: 0
import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sca = new Scanner(System.in);
        int n = sca.nextInt();
        Deque<Integer> quu = new LinkedList<>();
        Deque<String> name = new LinkedList<>();
        int hour = 0;
        
        int qa = sca.nextInt();
        int K = 0;
        while (K < n) {
            name.add(sca.next());
            quu.add(sca.nextInt());
             ++K;
        }
        while (quu.size() > 0) {
            
            quu.addLast(quu.poll() - qa);
            name.addLast(name.poll());
            hour += qa;
            
            if (quu.peekLast() <= 0) {
                hour += quu.pollLast();;
                System.out.println(name.pollLast() + " " + hour);
            }
        }
    }
}


Measured memory_bytes: 76652
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        for (int i = 1; i < s.length(); ++i) {
            if (check(s.substring(0, s.length()-i))) {
                System.out.println(s.length()-i);
                return;
            }
        }
    }

    public static boolean check(String s) {
        if (s.length() % 2 != 0) {
            return false;
        }

        for (int i = 0; i < s.length() / 2; ++i) {
            if (s.charAt(i) != s.charAt(i+s.length()/2)) {
                return false;
            }
        }

        return true;
    }
}

Measured memory_bytes: 23508
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int mod = 1e9 + 7;

inline int add(int a, int b) {
  return a+b >= mod ? a+b-mod : a+b;
}

inline int sub(int a, int b) {
  return a >= b ? a-b : a-b+mod;
}

inline int mul(int a, int b) {
  return llint(a)*b % mod;
}

int main(void) {
  int n;
  scanf("%d", &n);
  
  int c = 0;
  int ans = 1;
  REP(i, n) {
    int x;
    scanf("%d", &x);

    if (c == 0) {
      c++;
    } else {
      if (x == 2*c) {
        ans = mul(ans, c+1);
      } else {
        c++;
      }
    }
  }

  REP(i, c) ans = mul(ans, i+1);
  printf("%d\n", ans);
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back

#define rep(i, N) for(ll i = 0; i < N; i++)
#define repa(i, a, N) for(ll i = a; i < N; i++)
#define repr(i, N) for(ll i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

#define all(A) A.begin(), A.end()

const ll mod = 1e9 + 7;
// const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

ll id(char c) {
	return c - 'a';
}

int main() {
	ll H, W, A, B;
	cin >> H >> W >> A >> B;

	rep(y, H) {
		rep(x, W) {
			if (x < A && y < B) {
				cout << 1;
			}
			else if (x >= A && y >= B) {
				cout << 1;
			}
			else {
				cout << 0;
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n, m, l;
  cin >> n >> m >> l;
  vector<vector<i64>> a(n, vector<i64>(n, MOD));
  for (int i = 0; i < n; ++i) a[i][i] = 0;
  for (int i = 0; i < m; ++i) {
    int x, y, d;
    cin >> x >> y >> d;
    --x, --y;
    a[x][y] = a[y][x] = d;
  }
  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        uin(a[i][j], a[i][k] + a[k][j]);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (a[i][j] <= l) uin(a[i][j], 1LL);
      else a[i][j] = MOD;
    }
  }
  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        uin(a[i][j], a[i][k] + a[k][j]);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (a[i][j] == MOD) a[i][j] = 0;
    }
  }
  int q; cin >> q;
  while (q--) {
    int s, t;
    cin >> s >> t; --s, --t;
    cout << a[s][t] - 1 << '\n';
  }
  
  return 0;
}


Measured memory_bytes: 1280
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;

int solve() 
{
	//happy coding

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

	sort(all(a));
	int sum = 0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			int x = a[i]+a[j];
			auto xx = lower_bound(all(a),x);
			sum += (xx-a.begin()-(j+1));
		}
	}
	cout<<sum<<endl;

	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void printCurrent(int a[], int n) {
    for (int i = 0; i < n; i++) {
        if (i != 0) {
            cout << " ";
        }
        cout << a[i];
    }
    cout << endl;
}

void insertionSort(int a[], int n) {
    for (int i = 1; i < n; i++) {
        int v = a[i];
        int j = i;
        while (v < a[j - 1]) {
            a[j] = a[j - 1];
            j--;
        }
        a[j] = v;
        printCurrent(a, n);
    }
}

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

    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
const int mod = 1000000007;
vector<int> v[MAX];

long long int dfs(int now,int from,int color){
  int canuse;
  if(from==-1)canuse=color-1;
  else{canuse=color-2;}
  if(color<(int)v[now].size())return 0;
  else{
  long long int co_no_iro = 1;
	for (int i=0;i<(int)v[now].size();i++){
    if(v[now].at(i)==from)continue;
    else{
		co_no_iro *= canuse;
    canuse--;
    co_no_iro %= mod;
		}}
 	for (int i=0;i<(int)v[now].size();i++){
    if(v[now].at(i)==from)continue;
    else{
		co_no_iro *= dfs(v[now].at(i),now,color);
    co_no_iro %= mod;
		}}
  return co_no_iro;
	}
}
int main(){
  int N,K;
	cin >> N >> K;
  int a,b;
  long long int ans =0;
	for(int i=0;i<N-1;i++){
		cin >> a >> b;
		v[a-1].push_back(b-1);
		v[b-1].push_back(a-1);
	}
	ans = K * dfs(0,-1,K);
  ans %= mod;
	cout<< ans <<endl;
}

Measured memory_bytes: 11520
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


while 1:
    h, w = LI()
    if w == h == 0:
        break
    for i in range(h):
        for q in range(w):
            if i % 2 == 1 and q % 2 == 0:
                print('.', end='')
            elif i % 2 == 1 and q % 2 == 1:
                print('#', end='')
            elif i % 2 == 0 and q % 2 == 0:
                print('#', end='')
            elif i % 2 == 0 and q % 2 == 1:
                print('.', end='')
        print('', end='\n')
    print('', end='\n')



Measured memory_bytes: 7112
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		System.out.printf("%d %d\n",a*b,(a+b)*2);

	}

}



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

using namespace std;
using ll = long long;
using ld = long double;

void solve() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  ll ma = max(a * c, max(a * d, max(b * c, b * d)));

  cout << ma << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


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

int N, A[100000];
vector<int> edges[100000];

int64_t up[100000];

void fail(){
    cout << "NO" << endl;
    exit(0);
}

void dfs(int i, int par){
    if(par >= 0 && edges[i].size() == 1){
        up[i] = A[i];
        return;
    }
    vector<int64_t> vs;
    int64_t s = 0, mx = 0;
    for(int j : edges[i]) if(j != par){
        dfs(j, i);
        vs.push_back(up[j]);
        s += up[j];
        mx = max(mx, up[j]);
    }
    int64_t p = s-A[i], u = 2*A[i]-s;
    if(p < 0 || u < 0) fail();
    if(mx-u > p) fail();
    up[i] = u;
}

int main(){
    cin >> N;
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<N-1; i++){
        int a, b;
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }

    for(int i=0; i<N; i++) if(edges[i].size() == 1){
        dfs(i, -1);
        if(up[i] != A[i]) fail();
        cout << "YES" << endl;
        return 0;
    }
}

Measured memory_bytes: 17920
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int time = 1900*m + 100 * (n-m);
        int times = (int) Math.pow(2,m);
        System.out.print(time * times);
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cctype>
using namespace std;

struct ToLower {
    char operator ()(char c) {
        return tolower(c);
    }
};

int main() {
    string w; cin >> w;
    transform(w.begin(), w.end(), w.begin(), ToLower());
    int sum = 0;
    while(true) {
        string s; cin >> s;
        if(s == "END_OF_TEXT") break;
        transform(s.begin(), s.end(), s.begin(), ToLower());
        if(w == s) sum++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
#define ck(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf=1e9;

int main() {
	int A,B;
	cin>>A>>B;
	if(A+B<10) p(A+B);
	else p("error");
	return 0;
}


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

#define bit(x) (1 << (x))
#define MX 400005
#define L 20    //N 보다  큰  2 의  최소제곱지수

inline void chkmin(int &x, int y) {
	if (y < x) x = y;
}

struct RMQ {
	int b[MX];
	int x[MX][L];
	int N;
	void build(int *p, int n) {
		int i, j, k;
		N = n;
		for (k = 0, i = 1; i <= N; i++) {
			if (i == bit(k + 1)) k++;
			b[i] = k;
		}
		for (i = 0; i < N; i++) x[i][0] = p[i];
		for (j = 1; j <= k; j++) {
			for (i = 0; i < N; i++) {
				x[i][j] = x[i][j - 1];
				if (i + bit(j - 1) < N)
					chkmin(x[i][j],  x[i + bit(j  -  1)][j  -  1]);
			}
		}
	}
//return min value between [st, en)
	int range_min(int st, int en) {
		int j = b[en - st];
		return min(x[st][j], x[en - bit(j)][j]);
	}
} m[2];

typedef pair<int ,int> pii;
int p[200005], pos[200005];
vector<pair<pii, pii> > ans;

void calc(int l, int r, pii par) {
	if(l == r) return ;
	int val_min = m[l % 2].range_min(l / 2, (r - 1) / 2 + 1);
	int pos1 = pos[val_min];
	val_min = m[(pos1 + 1) % 2].range_min((pos1 + 1) / 2, r / 2 + 1);
	int pos2 = pos[val_min];
	pii rlt = {p[pos1], p[pos2]};
	ans.push_back(make_pair(rlt, par));
	if(l < pos1 - 1) calc(l, pos1 - 1, rlt);
	if(pos1 + 1 < pos2 - 1) calc(pos1 + 1, pos2 - 1, rlt);
	if(r > pos2 + 1) calc(pos2 + 1, r, rlt);
}
map<pii, int> M;
map<int, pii> MM;
int a[2][200005];
set<pair<int, int> > S;
vector<pair<int, int> > res, adj[200005];

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i ++) cin >> p[i], a[i % 2][i / 2] = p[i], pos[p[i]] = i;
	m[0].build(a[0], n / 2);
	m[1].build(a[1], n / 2);
	calc(0, n - 1, make_pair(0, 0));
	int T = 1;
	M[make_pair(0, 0)] = 0;
	for(auto it : ans){
		if(!M.count(it.first)) M[it.first] = T ++; 
	}
	for(auto it : ans) adj[M[it.second]].push_back(it.first);
	for(auto it : adj[0]) S.insert(it);
	while(!S.empty()){
		pii tmp = *S.begin();
		res.push_back(tmp);
		S.erase(S.begin());
		for(auto it : adj[M[tmp]]) S.insert(it);
	}
	int m = res.size();
	for(int i = 0; i < m; i ++) cout << res[i].first << ' ' << res[i].second << " \n"[i == m - 1];
}

Measured memory_bytes: 54384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl '\n'
#define ld long double
typedef pair<ll,ll> pii;
const int maxn=5005;
const int mod=1e9+7;
ll qp(ll a,ll b)
{
    ll ret=1;
    while(b)
    {
        if(b&1) ret=ret*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return ret;
}
ll f[maxn][maxn];
char s[maxn];
int main()
{
    #ifdef local
    freopen("in.txt","r",stdin);
    #endif // local
    IOS;
    f[0][0]=1;
    for(int i=1;i<=5000;i++)
    {
        for(int j=0;j<=5000;j++)
        {
            f[i][j]+=f[i-1][j+1]*2;
            if(!j) f[i][j]+=f[i-1][j];
            else f[i][j]+=f[i-1][j-1];
            f[i][j]%=mod;
        }
    }
    int n;
    cin>>n;
    cin>>s+1;
    int k=strlen(s+1);
    cout<<f[n][k]<<endl;
}


Measured memory_bytes: 195840
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string a, b, c;
  cin >> a >> b;
  c = b + b;
  for(int i = 0;i<a.size();++i) {
    if(a==string(c.begin() + i, c.begin() + i + a.size())) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0; 
}

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

vector<long> fact, factinv;
long n, k, ans, t;

long powMod(long x, long n, long mod){
	if (n == 0) return 1;
	else if (n == 1) return (x % mod);
	else if (n % 2 == 0){
		long t = powMod(x, n/2, mod);
		return (t*t) % mod;
	}
	else{
		return (x*powMod(x, n-1, mod)) % mod;
	}
}

void preproc(int n){
    // preproc till n!
    fact.push_back(1);
    for (int i = 1; i <= n; ++i) fact.push_back((fact[i-1]*i)%MOD);
    for (int i = 0; i <= n; ++i) factinv.push_back(powMod(fact[i], MOD-2, MOD));
}

int main(){
    cin >> n >> k;
    preproc(n);
    ans = 0;
    for (int m = 0; m <= min(n-1, k); ++m){
        t = (fact[n]*fact[n-1]) % MOD;
        t = (((t*factinv[m]) % MOD) * factinv[m]) % MOD;
        t = (((t*factinv[n-m]) % MOD) * factinv[n-m-1]) % MOD;
        ans = (ans + t) % MOD;
    }
    cout << ans;
}

Measured memory_bytes: 4848
#include <iostream>

using namespace std;

void swap(int *a, int *b){
        if(a == b)
                return;

        *a = *a ^ *b;
        *b = *a ^ *b;
        *a = *a ^ *b;
}

int main(){
        int W, a, b;

        cin >> W >> a >> b;

        //常にa < b//
        if(a > b)
                swap(&a, &b);

        //bの左端とaの右端の差を求める//
        int answer = b - a - W;

        if(answer < 0)
                cout << 0 << endl;
        else
                cout << answer << endl;

        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
void solve()
{
    ll a, b;
    cin>>a>>b;
    cout<<a*b/__gcd(a, b);
}
int main()
{
	#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3788
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AGoodInteger solver = new AGoodInteger();
        solver.solve(1, in, out);
        out.close();
    }

    static class AGoodInteger {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int a = Integer.parseInt(s.substring(0, 3));
            int b = Integer.parseInt(s.substring(1, 4));
            out.println(a * b % 111 == 0 ? "Yes" : "No");
        }

    }
}



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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

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

int dp[100005][2];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  string s; cin>>s;
  int n=s.size();
  dp[0][0] = 1;
  
  rep(i,n){
    // a+b=0
    if(s[i]=='0'){
      dp[i+1][0]=dp[i][0];
      dp[i+1][1]=dp[i][1];
    }else if(s[i]=='1'){
      dp[i+1][1]=(dp[i][0]+dp[i][1])%MOD;
    }
    // a+b=1
    if(s[i]=='0'){
      (dp[i+1][1]+=dp[i][1]*2%MOD)%=MOD;
    }else if(s[i]=='1'){
      (dp[i+1][0]+=dp[i][0]*2%MOD)%=MOD;
      (dp[i+1][1]+=dp[i][1]*2%MOD)%=MOD;
    }
  }
  int ans=(dp[n][0]+dp[n][1])%MOD;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1232