akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define faster_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
#define bug(a)       cerr << #a << " : " << a << endl;
#define itc(n) char(n+48)
#define cti(ch) (ch-48)

#define pi acos(-1.0)

int len, len1,dp[3005][3005],nxt[3005][3005];
string s,ss;

int fnc(int pos, int pos1)
{
    if(pos == len || pos1 == len1) return 0;

    if(dp[pos][pos1] != -1) return dp[pos][pos1];

    int p = 0, q = 0;
    if(s[pos] == ss[pos1]){
        p = fnc(pos + 1, pos1 +1) + 1;

        return dp[pos][pos1] = p;
    }
    else{
        p = fnc(pos + 1, pos1);
        q = fnc(pos, pos1 + 1);
        if(p>=q)nxt[pos][pos1] = 1;
        else nxt[pos][pos1] = 2;

        return dp[pos][pos1] = max(p,q);
    }
}

int main()
{
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
    faster_io;

//    string s,ss;

    cin>>s>>ss;

    memset(dp, -1, sizeof dp);

    len = s.size();
    len1 = ss.size();

    fnc(0,0);

    int curpos = 0, curpos1 = 0;

    while(true){
        if(curpos == len || curpos1 == len1)break;
        if(s[curpos] == ss[curpos1]){
            cout<<s[curpos];
            curpos++;
            curpos1++;
        }
        else if(nxt[curpos][curpos1] == 1)curpos++;
        else curpos1++;
    }

    return 0;
}


Measured memory_bytes: 71040
from sys import stdin
from collections import deque
def main():
    #入力
    readline=stdin.readline
    N=int(readline())
    g=[[] for _ in range(N)]
    B=[]
    for _ in range(N-1):
        a,b=map(lambda x:int(x)-1,readline().split())
        g[a].append(b)
        g[b].append(a)
        B.append(b)

    link=[0]*N
    que=deque([0])
    is_searched=[False]*N
    is_searched[0]=True
    K=0
    while len(que)>=1:
        now=que.popleft()
        color=1
        for x in g[now]:
            if is_searched[x]:
                continue
            else:
                is_searched[x]=True
                que.append(x)
                if color==link[now]:
                    color+=1
                link[x]=color
                color+=1
        color-=1
        K=max(K,color)

    print(K)
    for x in B:
        print(link[x])
if __name__=="__main__":
    main()

Measured memory_bytes: 24976
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll A,B;
    cin >>A>>B;
    
    cout << ((A+B)%24) << endl;


    return 0;
    

}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

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

  cout << ((a + b == c || a == b + c || b == a + c) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApplication16
{
    class Program
    {
        static void Main(string[] args)
        {

            int a, b ;
            double d,r,f;

            string[] s = Console.ReadLine().Split(' ');
            a = int.Parse(s[0]);
            b = int.Parse(s[1]);
            d = a / b;
            r = a % b;
            f = (double)a / b;

            Console.WriteLine(d + " " + r + " " + f.ToString("F5"));


        }
    }
}

Measured memory_bytes: 9236
#include <cstdio>
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main(void){
    int a,b;

    cin >> a >> b;

    int x=a+b,y=a-b,z=a*b;

    cout << (x<y?y<z?z:y:x<z?z:x);

    return 0;
}


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

int main(void) {
  char s[101];
  int slen, i, t, count = 0;

  while (scanf("%s", s) != EOF) {
    slen = strlen(s);
    t = slen / 2;
    if (slen % 2) {
      for (i = 1; i <= t; i++) 
	if (s[t-i] != s[t+i]) break;
      if (i == t + 1) count++;
    }
    else {
      for (i = 0; i < t; i++) 
	if (s[t-i-1] != s[t+i]) break;
      if (i == t) count++;
    }
  }
  printf("%d\n", count);

  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


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

    ll ans = 0;
    int i = 0;
    while(i < sz(s)-1){
	if(s[i] != s[i+1]){
	    ans++;
	    s.erase(i,2);
	    // P(s);
	    i--;
	    i = max(i,0);
	}else i++;
    }
    
    P(ans*2);
    return  0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a;
        cin >> a;
        mp[a]++;
    }

    cout << mp.size() << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool IsPrime(long long num)
{
    if (num < 2) return true;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (long long i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main(){
    long long a, b, c, d, i, ans=0, cnt2=0, cnt=0;
    vector<long long> kou, ret;
    cin >> a >> b;
    c=min(a, b);
    d=max(a, b);
    for(i=1;i*i<=c;i++){
        if(c % i == 0) {
            ret.push_back(i);
            cnt++;
            if(i * i != c){ 
                ret.push_back(c / i);
                cnt++;
            }
        }
    }
    for(i=0;i<cnt;i++){
        if(d%ret[i]==0){
             kou.push_back(ret[i]);
             cnt2++;
        }
    }
    for(i=0;i<cnt2;i++){
        if(IsPrime(kou[i])) ans++;
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int gcd(int u, int v) {
    int r;
    while (v) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}
int gcd(vector<int> a){
    int l = a.size();
    if(l<=0){
        return 0;
    }else if(l==1){
        return a[0];
    }else{
        int res = gcd(a[0],a[1]);
        FOR(i,2,l){
            res = gcd(res,a[i]);
        }
        return res;
    }
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i,n){
        cin >> a[i];
    }
    put(gcd(a));
    return 0;
}


Measured memory_bytes: 1024
n=int(input())
s=[]
for i in range(n):
    s+=[input()]

a=[]
if len(s)==1:
    for i in s[0]:
        a+=[i]
    a.sort()
    a=''.join(a)
    print(a)

else:
    s1=s[0]
    s=s[1:]
    for i in s1:
        for j in range(len(s)):
            c1=0
            for k in range(len(s[j])):
                if i==s[j][k]:
                    s[j]=s[j][:k]+s[j][k+1:]
                    c1+=1
                    break
            if c1==0:
                break
        if c1==1:
            a+=[i]
    a.sort()
    a=''.join(a)
    print(a)




Measured memory_bytes: 3064
/*===================*\
|ID : harryPotter_421  |
|      LANG: C++       |
\*====================*/
#include <iostream>
#include<bits/stdc++.h>
#define lli long long int
#define pb push_back
#define INT_MIN -1000000007
#define ld  double
#define pi 3.14159265358979
#define f(j,m,n) for(lli j=m;j<n;j++)
#define harry ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define forn(n) for(i=0;i<n;i++);
using namespace std;
int main()
   {harry
    lli n,k;
    cin>>n;
    k=n%10;
    if(k==2||k==5||k==4||k==7||k==9)
    {
        cout<<"hon";
    }
    if(k==0||k==1||k==6||k==8)
        cout<<"pon";
    if(k==3)
        cout<<"bon";
     }






















Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;

int main(){
  string S;
  ll N;
  cin >> N >> S;
  rep(i,S.size()){
    S.at(i)=(((S.at(i)-'A')+N)%26)+'A';
  }
  cout << S << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
int a,b,k;
cin>>a>>b>>k;
	if(a>b || b>1000000000 || k>100 || k<1 || a<1)
	return 0;
	if(k*2>b-a+1)
	{
		for(int i=a;i<=b;i++)
		cout<<i<<"\n";
	}
	else
	{
		for(int q=a;q<a+k;q++)
		cout<<q<<"\n";
		for(int j=b-k+1;j<=b;j++)
		cout<<j<<"\n";
	}
return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#define pb push_back
#define MOD 1000000007
typedef long long ll;
int dp[100005], cnt[15][100005];
std::vector<int> adj[15];
int main()
{
	// freopen("AGC016-F.in", "r", stdin);
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		adj[--u].pb(--v);
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < 1 << n; j++)
		{
			for (int v : adj[i])
			{
				if (j & (1 << v))
					cnt[i][j]++;
			}
		}
	}
	for (int i = 0; i < 1 << n; i++)
	{
		if ((i & 3) && (i & 3) != 3)
			continue;
		dp[i] = 1;
		for (int j = i - 1 & i; j; j = j - 1 & i)
		{
			if ((j & 3) && (j & 3) != 3)
				continue;
			int x = i ^ j, val = dp[x];
			for (int k = 0; k < n; k++)
			{
				if (x & (1 << k))
					val = (ll)val * ((1 << cnt[k][j]) - 1) % MOD;
				else if (j & (1 << k))
					val = (ll)val * (1 << cnt[k][x]) % MOD;
			}
			(dp[i] += val) %= MOD;
		}
	}
	int ans = 1;
	for (int i = 0; i < m; i++)
		ans = ans * 2 % MOD;
	printf("%d\n", (ans - dp[(1 << n) - 1] + MOD) % MOD);
	return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll A, B, C, D;
	cin >> A >> B >> C >> D;
	if (max(A, C) < min(B, D))
		cout << min(B, D) - max(A, C) << endl;
	else
		cout << 0 << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
class Main {
    static boolean isMultiple(int a, int b, int k) {
        for(int i = a; i<=b; i++)
            if(i%k==0)
                return true;
            return false;
    }
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(isMultiple(a, b, k)?"OK":"NG");
    }
}

Measured memory_bytes: 27028
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
using namespace std;

int main() {

	long A;
	long B;
	cin >> A;
	cin >> B;

	long Amin = 25 * A / 2;
	if (A % 2 != 0) {
		Amin += 1;
	}
	long Amax = 25 * (A + 1) / 2;

	long Bmin = 10 * B;
	long Bmax = 10 * B + 9;

	// 解が存在する場合
	if (Amax > Bmin && Bmax > Amin) {
		long val = max(Amin, Bmin);
		cout << val << endl;
	}
	// 解が存在しない場合
	else {
		cout << -1 << endl;
	}
	

	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;++a)
#define Dor(a,b,c) for(int a=b;a>=c;--a)
using namespace std;
typedef long long LL;
const int N=507;
int n,F[N][N],H[N][N];
bool eat(int &f,int g) {
	if(g<f) return f=g,1;
	return 0;
}
void fly(int x,int y) {
	if(eat(F[x+1][y],F[x][y]+H[x+1][y])) fly(x+1,y);
	if(eat(F[x-1][y],F[x][y]+H[x-1][y])) fly(x-1,y);
	if(eat(F[x][y+1],F[x][y]+H[x][y+1])) fly(x,y+1);
	if(eat(F[x][y-1],F[x][y]+H[x][y-1])) fly(x,y-1);
}
int main() {
	scanf("%d",&n);
	For(i,1,n) For(j,1,n) F[i][j]=min(min(i,j),min(n-i+1,n-j+1)),H[i][j]=1;
	int ans=0;
	For(i,1,n*n) {
		int x,a,b;
		scanf("%d",&x),a=(x-1)/n+1,b=(x-1)%n+1;
		--F[a][b],fly(a,b);
		ans+=F[a][b],H[a][b]=0;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 28432
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size())cout << a[i] << " ";cout << "\n"
#define vecvec(a) vector<vector<(a)>>
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,M;
    cin >> N >> M;
    vector<ll> vec(N);
    vecin(vec);
    ll ans = INF;
    for(ll i = 0;i < (1 << N);i++){
        ll n = 0;
        rep(j,N){
            if(i >> j&1)n++;
        }
        if(n != M)continue;
        ll cnt = 0,up = 0;
        rep(j,N){
            if(i >> j&1){
                if(up < vec[j]){
                    chmax(up,vec[j]);
                }
                else{
                    cnt += (up - vec[j] + 1);
                    up++;
                }
            }
            else chmax(up,vec[j]);
        }
        chmin(ans,cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<algorithm>
using namespace std;
int R[2100];
int b[2100];
int c[2100];
int dp[1100][1100];
int cs[2100];
int calc(int a,int j){
	if(~dp[a][j])return dp[a][j];
	if(a==j)return dp[a][j]=1;
	int l=cs[j+1]-cs[a+1];
	int r=cs[j]-cs[a];
	if(calc(a+1,j)&&l<=b[a])return dp[a][j]=1;
	if(calc(a,j-1)&&r<=b[j])return dp[a][j]=1;
	return dp[a][j]=0;
}
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d%d",b+i,c+i);
	for(int i=0;i<a;i++)cs[i+1]=cs[i]+c[i];
	for(int i=0;i<a;i++)for(int j=0;j<a;j++)
		dp[i][j]=-1;
	for(int i=0;i<a;i++){
		for(int j=i;j<a;j++){
			if(calc(i,j)){
				R[i]=max(R[i],j);
			}
		}
	}
	int ret=0;
	int at=0;
	while(at<a){
		ret++;
		at=R[at]+1;
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 5428
#include<stdio.h>
int main(void){
  int a,b,c,h=0;
  scanf("%d %d %d",&a,&b,&c);
  if(a>b){
   h=a;
   a=b;
   b=h;
  }if(a>c){
   h=a;
   a=c;
   c=h;
  }if(b>c){
   h=b;
   b=c;
   c=h;
  }
  printf("%d %d %d\n",a,b,c);
  return 0;
}



Measured memory_bytes: 2080
//nomura2020_c.cpp
//Sat Jun 27 18:12:55 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

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

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

	if (n!=0 && a[0] != 0){
		cout << -1 << endl;
		return 0;
	}else if (n==0 && a[0] == 1){
		cout << 1 << endl;
		return 0;
	}else if (n==0 && a[0] != 1){
		cout << -1 << endl;
		return 0;
	}

	ll asum[n+1];
	asum[n] = a[n];
	for (int i=n-1;i>=0;i--){
		asum[i] = asum[i+1]+a[i];
	}

	ll ans = 1;
	ll kotsuki = 1;
	for (int i=1;i<=n;i++){
		ll max1 = kotsuki*2;
		ll max2 = asum[i];
		ll max = min(max1,max2);
		// cout << i << " " << max << endl;
		if (i!=n && max<=a[i]){
			cout << -1 << endl;
			return 0;
		}else if (i==n && max<a[i]){
			cout << -1 << endl;
			return 0;
		}
		ans += max;
		kotsuki = max-a[i];
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 5120
#include "bits/stdc++.h"
using namespace std;
#define LL long long

void solve() {
   LL n,p,q;
   cin>>n;
   LL ok=0,i=100;
   while(i<n){
       i+=i/100;
       ok++;
   }
   cout<<ok;
}

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

Measured memory_bytes: 3592
#include<stdio.h>
#include<math.h>
#define pi 2*acos(0.0)
int main()
{
   int R;
   double c;
   scanf("%d",&R);
   if(R>=1 && R<=100)
   {
   c=2*pi*R;
   printf("%.18lf\n",c);
   }
   return 0;
}

Measured memory_bytes: 1752
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
	int a,b,c,flag=0;
	scanf("%d %d %d",&a,&b,&c);
	if(a==5 && b==5 && c==7 ) printf("YES\n");
	else if(a==5 && b==7 && c==5 ) printf("YES\n");
	else if(a==7 && b==5 && c==5 ) printf("YES\n");
	else  printf("NO\n");

	return 0;
} 

Measured memory_bytes: 256
H, W = map(int, input().split())

a = [[-1]*(W+2) for _ in range(H+2)]
odd_count = 0

for i in range(1, H+1):
    tmp = list(map(int, input().split()))
    for j in range(1, W+1):
        a[i][j] = tmp[j-1]
        odd_count += int(a[i][j] % 2 == 1)

moves = []
# 一筆書きの経路を作成
routes = []
for h in range(1, H+1):
    tmp = []
    for w in range(1, W+1):
        tmp.append((h, w))
    if h % 2 == 1:
        routes += tmp
    else:
        routes += tmp[::-1]

is_carrying = 0
for i, (h, w) in enumerate(routes):
    if i == H*W-1:
        break
    if odd_count == 1:
        break
    if a[h][w] % 2 == 1 and not is_carrying:
        tmp = (h, w)
        is_carrying = 1
        moves.append((h, w, routes[i+1][0], routes[i+1][1]))
    elif a[h][w] % 2 == 1 and is_carrying:
        is_carrying = 0
        odd_count -= 2
        
    elif a[h][w] % 2 == 0 and is_carrying:
        moves.append((h, w, routes[i+1][0], routes[i+1][1]))

print(len(moves))
for move in moves:
    print(*move)

Measured memory_bytes: 109448
import java.util.*;
class Main{
    public static void main(String[] $){
        Scanner s=new Scanner(System.in);
        String c=s.next();
        long a=0, w=0;
        for(int i=0;i<c.length();i++) if(c.charAt(i)=='W') a+=i-w++;
        System.out.print(a);
    }
}

Measured memory_bytes: 26512
#include<bits/stdc++.h>
using namespace std;
string s;
bool b[4];
int main() {
	cin >> s;
	if(s.find('N') != string::npos) {
		b[0] = true;
	}
	if(s.find('S') != string::npos) {
		b[1] = true;
	}
	if(s.find('E') != string::npos) {
		b[2] = true;
	}
	if(s.find('W') != string::npos) {
		b[3] = true;
	}
	if((b[0]^b[1]) || (b[2]^b[3])) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	return 0;
}

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];
        long asum = 0;
        int[] b = new int[N];
        int[] d = new int[N];
        long bsum = 0;
        long msum = 0;
        int ans = 0;
        for(int i = 0; i < N; i++){ a[i] = sc.nextInt(); asum += a[i];}
        for(int i = 0; i < N; i++){
            b[i] = sc.nextInt();
            bsum += b[i];
            d[i] = a[i] - b[i];
            if(d[i] <0) {msum += d[i]; ans++;}
            }
        if(asum < bsum){
            System.out.println(-1);
        }else{
            Arrays.sort(d);
            int idx = N-1;
            while(msum < 0){
                ans++;
                msum += d[idx];
                idx--;
            }
            System.out.println(ans);
        }
        sc.close();
    }

}


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

const int MAX=3000005;
const int MOD=1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void f() {
    fac[0]=1;
    fac[1]=1;
    finv[0]=1;
    finv[1]=1;
    inv[1]=1;
    for (int i=2; i<MAX; i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

long long C(int n, int k){
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

long long F(int x, int y) {
    return (C(x+y+2, x+1)-x-y-2)%MOD;
}

int main(void) {
    int r1, c1, r2, c2;
    long long X;
    scanf("%d%d%d%d", &r1, &c1, &r2, &c2);
    f();
    X=F(r2, c2)-F(r1-1, c2)-F(r2, c1-1)+F(r1-1, c1-1);
    // X=F(r2, c2)-F(0, c2)-F(r2, 0)+F(0, 0);
    if (X<0) X+=2*MOD;
    X%=MOD;
    printf("%lld\n", X);
    return 0;
}


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


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

    for(int i=0;i<S.size();i++)
    {
        S[i] = S[i] + N;
        if(S[i] > 'Z')
        {
            S[i] = S[i] - ('Z' - 'A' + 1);
        }
    }

    cout << S;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT64_MAX__ / 2)
#define EPS 10e-8
#define MAX_M 1000
#define MAX_2_N (1 << 12)

using namespace std;
typedef pair<llong, llong> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

llong dp[MAX_M + 1][MAX_2_N];

int N, M, a[MAX_M];
int keys[MAX_M];

llong solve() {
    for(int i = 0; i <= M; ++i)
        for(int j = 0; j < (1 << N); ++j)
            dp[i][j] = INF;
    dp[0][0] = 0;

    for(int i = 0; i < M; ++i) {
        for(int j = 0; j < (1 << N); ++j)
            dp[i + 1][j] = dp[i][j];


        for(int j = 0; j < (1 << N); ++j) {

            if(dp[i][j] != INF)
                dp[i + 1][(j | keys[i])] = min(dp[i + 1][(j | keys[i])], dp[i][j] + a[i]);

        }
    }

    if(dp[M][(1 << N) - 1] >= INF)
        return -1;
    else
        return dp[M][(1 << N) - 1];
}

int main(int argc, char **argv) {
    cin >> N >> M;

    for(int i = 0; i < M; ++i) {
        int b;
        cin >> a[i] >> b;
        for(int j = 0; j < b; ++j) {
            int c;
            cin >> c;
            keys[i] = (keys[i] | (1 << (c - 1)));
        }
    }

    cout << solve() << endl;
}

Measured memory_bytes: 32256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string X;
    cin >> X;
    
    int S=0, T=0, ans=0;
    for(int x=0; x<X.size(); x++) {
        if(X[x]=='S') {
            S++;
        } else {
            T++;
            if(S<T) {
                ans++;
                T--;
            }
        }
    }

    cout << ans*2 << endl;


    return 0;
    
}

Measured memory_bytes: 832
from itertools import accumulate
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
l = []
for i in range(n - 1):
    s2 = s[i:i + 2]
    if s2 == "AC":
        l.append(1)
    else:
        l.append(0)
l = [0] + l
l = list(accumulate(l))
for i in lr:
    print(l[i[1] - 1] - l[i[0] - 1])

Measured memory_bytes: 34032
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N;
  ll X;
  cin>>N>>X;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];

  vector<ll> mi(N);
  ll sum=0;
  rep(i,N){
      mi[i]=A[i];
      sum+=A[i];
  }

  ll ans=sum;
  for(int k=1;k<=N;k++){
      ll res=X*k;
      for(int i=0;i<N;i++){
          mi[i]=min(mi[i],A[(i-k+N)%N]);
          res+=mi[i];
      }
      ans=min(ans,res);
  }
  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 256
import collections

N = int(input())
area = []
for i in range(N):
    area.append(input())
c = collections.Counter(area)
max_val = max(c.values())
keys_of_max_val = [key for key in c if c[key] == max_val]
keys_of_max_val.sort()
for i in keys_of_max_val:
    print(i)

Measured memory_bytes: 35564
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String a = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		String s = kb.next();
		String p = "";
		for (int i = 0; i < s.length(); i++) {
			char b = s.charAt(i);
			int c = a.indexOf(b);
			p += a.charAt(c + n);
		}
		System.out.println(p);
		kb.close();
	}

}


Measured memory_bytes: 146644
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{h:usize, w:usize, a:[chars;h]};
    for i in 0..h+2 {
        for j in 0..w+2 {
            if i == 0 || i == h+1 {
                print!("#");
            }
            else if j == 0 || j == w+1 {
                print!("#");
            }
            else {
                print!("{}", a[i-1][j-1]);
            }
        }
        println!("");
    }
}


Measured memory_bytes: 4352
x, y = [int(i) for i in input().split()]

flag = False
for i in range(x+1):
    turu = x - i
    kame = i

    if (turu * 2 + kame * 4) == y:
        flag = True
        break

if(flag):
    print("Yes")
else:
    print("No")




Measured memory_bytes: 9172
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
#define INF 2147483647
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
int main(){
    string s;
    cin>>s;
    int a=0;
    for(int i=0;i<4;i++)if(s[i]=='2')a++;
    cout<<a<<endl;
    
}


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

int main() {
 char s;
 cin >> s;
 
 if(s == 'a' || s == 'e' || s=='o' || s=='i' || s=='u'){
  cout << "vowel" <<endl;
}
 else {
  cout << "consonant" <<endl;
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
 
int solve(int i,int a[], int dp[]){
	if(i==1){
		return abs(a[i]-a[0]);
	}
	if(i==0){
		return 0;
	}

	// int c = abs(a[i]-a[i-1]);
	int d,e;
	if(dp[i-1]==-1)
		dp[i-1] =  solve(i-1,a,dp);
	d = abs(a[i]-a[i-1])+dp[i-1];
	
	if(dp[i-2]==-1)
		dp[i-2] = solve(i-2,a,dp);
	e = abs(a[i]-a[i-2])+dp[i-2];

	return min(d,e);

}
 
 
int main() {
	int n;
	cin >> n;
	int a[n];
	int dp[n];
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<n;i++)
		cin >> a[i];
	cout<<solve(n-1,a,dp)<<endl;
}

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

int main() {
  // input
  string S; cin >> S;
  
  // compute
  int ans = S.size();
  
  for (int i = 0; i < 2; i++) {
    int cnt = 0;
  	for (int j = 0; j < S.size(); j++) {
      if (j%2 == 0 && S[j] != (char)(i + '0')) ++cnt;
      if (j%2 == 1 && S[j] == (char)(i + '0')) ++cnt;
  	}
    ans = min(ans, cnt);
  } 
  
  // output
  cout << ans << endl;
}

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

int main(){
    int n ,count = 0, ans , m;
    cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++){
        cin >> v[i];
    }

    sort(v.begin(),v.end());
    m = n/2-1;   
    if(v[m]==v[m+1])ans = 0;
    else ans = v[m+1] - v[m];
    
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 640
import sys
from math import gcd

sys.setrecursionlimit(10 ** 6)


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


K = int(input())
print(sum(gcd(a, gcd(b, c)) for a in range(1, K + 1)
          for b in range(1, K + 1) for c in range(1, K + 1)))


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

using std::pair;
using std::vector;
using std::string;

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

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

const int N = 1000;

const char* dir = "RULD";
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, -1, 0, 1 };

int n;
vector<int> step;
ll x[N + 5], y[N + 5];

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    read(n);
    for(int i = 1; i <= n; ++i) {
        read(x[i]), read(y[i]);

        if(((x[i] + y[i]) ^ (x[1] + y[1])) & 1) {
            return !puts("-1");
        }
    }

    if((x[1] + y[1]) % 2 == 0) step.pb(1);
    for(int i = 0, j = 1; i <= 30; ++i, j <<= 1) step.pb(j);

    printf("%d\n", (int) step.size());
    for(int i = 0; i < (int) step.size(); ++i) printf("%d ", step[i]);
    puts("");

    for(int i = 1; i <= n; ++i) {
        string str;
        for(int j = (int) step.size() - 1; j >= 0; --j) {
            int _dir = 0;
            ll mn = LLONG_MAX;

            for(int d = 0; d < 4; ++d) {
                if(chkmin(mn, std::abs(x[i] + dx[d] * step[j]) + std::abs(y[i] + dy[d] * step[j]))) { 
                    _dir = d;
                }
            }

            //if(j == 0) assert(mn == 0);

            str += dir[_dir]; 
            x[i] += dx[_dir] * step[j];
            y[i] += dy[_dir] * step[j];
        }
        std::reverse(str.begin(), str.end());
        std::cout << str << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define BOLT ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define X first
#define Y second
#define endl "\n"
using namespace std;
int pwr(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1ll) {
			res = res * x;
		}
		y >>= 1ll;
		x = x * x;
	}
	return res;
}
void solve() {
	vector<int> cnt;
	cnt.pb(0);
	int lim = pwr(10, 15) + 1;
	int sum = 0;
	int cur = 1;
	while (sum <= lim) {
		sum += pwr(26, cur);
		cnt.pb(pwr(26, cur));
		cur += 1;
	}
	int n;
	cin >> n;
	string ans = "";
	int done = 0;
	int till = 1;
	while (true) {
		if (done + cnt[till] >= n) {
			break;
		}
		done += cnt[till];
		till += 1;
	}
	for (int i = 0; i < till; i++) {
		for (int j = 0; j < 26; j++) {
			if (done + pwr(26, till - i - 1) < n) {
				done += pwr(26, till - i - 1);
			} else {
				ans += (char)(j + 'a');
				break;
			}
		}
	}
	cout << ans << endl;
}
int32_t main() {
	BOLT;
	solve();
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
#include<stdio.h>

int main(){
    
    char ch;
    
    while(1){
        scanf("%c", &ch);
        if ( ch == '\n') break;
        else if ( 65 <= ch && ch <= 90 ){
            ch += 32;
            printf ( "%c", ch );
        }
        else if ( 97 <= ch && ch <= 122 ){
            ch -= 32;
            printf ( "%c", ch);
        }
        else printf ( "%c", ch );
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 3120
#include <iostream>

using namespace std;

int main(){
  int a, b, k;
  std::cin >> a >> b >> k;
  int count = 0;
  for(int i=100; 1<=i; i--){
    if( a%i == 0 && b%i == 0 ){
      count += 1;
    }
    if( count == k ){
      std::cout << i << '\n';
      return 0;
    }
  }
  return 0;
}


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

using namespace std;
using ll = long long;
using mat = vector<vector<bool>>;
int H, W, K;
int count(const mat& Board, int ibit, int jbit){
    int ans = 0;
    for(int i=0; i<H; i++){
        if(ibit & (1<<i)) continue;
        for(int j=0; j<W; j++){
            if(jbit & (1<<j)) continue;
            if(Board[i][j]) ans++;
        }
    }
    return ans;
}

int main() { 
    cin >> H >> W >> K;
    char c;
    mat Board(H, vector<bool>(W, false));
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> c;
            Board[i][j] = c=='#';
        }
    }

    int ans = 0;
    for(int ibit=0; ibit < (1<<H); ibit++){
        for(int jbit=0; jbit < (1<<W); jbit++){
            if(count(Board, ibit, jbit)==K){
                ans++;
            }
        }
    }
    cout << ans << endl; 
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <int,int>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

int main()
{
	string s;
	int t1[N], t2[N], c1 = 0, c2 = 0, ans = 0;
	cin >> s;
	int n = (int) s.size();
	for (int i = 0; i < n; ++i)
	{
		t1[i] = (i & 1);
	}
	for (int i = 0; i < n; ++i)
	{
		t2[i] = 1 - (i & 1);
	}

	for (int i = 0; i < n; ++i)
	{
		if(s[i] != (t1[i] + '0'))
			c1++;
		if(s[i] != (t2[i] + '0'))
			c2++;
	}
	ans = min(c1, c2);
	cout << ans;
}



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

#define int long long
template <typename T> void maxi(T& a, T b) {a = std::max(a, b);}

int32_t main() {
  int n;
  scanf("%lld", &n);

  std::vector<int> a(4, 1);
  for (int i = 0; i < 3; i++)
    scanf("%lld", &a[i]);

  std::vector<int> b(4, 1);
  for (int i = 0; i < 3; i++)
    scanf("%lld", &b[i]);

  std::vector<int> dp(n+1);
  //dp[i] -> maximum value with capacity i

  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < 4; j++) {
      const int wt = a[j], v = b[j];
      if (wt <= i)
        maxi(dp[i], dp[i - wt] + v);
    }
  }

  n = dp[n];
  dp.clear();
  dp.resize(n+1);

  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < 4; j++) {
      const int wt = b[j], v = a[j];
      if (wt <= i)
        maxi(dp[i], dp[i - wt] + v);
    }
  }

  printf("%lld", dp[n]);
  return 0;
}


Measured memory_bytes: 195584
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#define ll long long
#define P(a) cout << a << " ";
#define NCONS 200001
#define endl '\n'
using namespace std;

int main(void)
{
	cin.tie(NULL); ios_base::sync_with_stdio(false);
	int ret = 0;
	int N, M; cin >> N >> M;
	vector<int> vec(M); for (int i = 0; i < M; i++) cin >> vec[i];
	sort(vec.begin(), vec.end());

	vector<int> temp;
	for (int i = 1; i < vec.size(); i++)
	{
		temp.push_back(vec[i] - vec[i - 1]);
	}
	sort(temp.begin(), temp.end());

	N--;
	while (N > 0 && !temp.empty())
	{
		N -= 1;
		temp.pop_back();
	}

	for (int i = 0; i < temp.size(); i++)
		ret += temp[i];

	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i=0; i<n; i++)
 
using namespace std;
const double PI = acos(-1);
using Graph = vector<vector<int>>;
 
int main() {
	int n;
	cin >> n;
	int ac = 0;
	int wa = 0;
	int tle = 0;
	int re = 0;
	rep(i, n)
	{
		string s;
		cin >> s;
		if (s == "AC")
			ac++;
		else if (s == "WA")
			wa++;
		else if (s == "TLE")
			tle++;
		else if (s == "RE")
			re++;
	}
	cout << "AC" << " x " << ac << endl;
	cout << "WA" << " x " << wa << endl;
	cout << "TLE" << " x " << tle << endl;
	cout << "RE" << " x " << re << endl;
}

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

int main(int argc, const char * argv[])
{
    char inputN[3];
    scanf("%s", inputN);
    
    long len = strlen(inputN);
    int digitCounter = 0;
    
    for(int i = 0; i < len; i++)
    {
        if(inputN[i] == '7')
        {
            digitCounter++;
        }
    }
    
    if(digitCounter > 0)
    {
        printf("Yes \n");
    }
    else
    {
        printf("No \n");
    }
    
    return 0;
}


Measured memory_bytes: 1636
#include <bits/stdc++.h>
using namespace std;
int main(){
    int x,y;
    cin >> x >> y;
    if (x == 2 || y == 2) cout << "No" << endl;
    else 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))cout << "Yes" << endl;
    else if( (x == 4 || x == 6 || x == 9 || x == 11) &&  (y == 4 || y == 6 || y == 9 || y == 11)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


int main() 
{
	int N = 0, M = 0;
	cin >> N;
	vector<string> sVec(N);
	for (int i = 0; i < sVec.size(); i++)
	{
		cin >> sVec.at(i);
	}
	cin >> M;
	vector<string> tVec(M);
	for (int i = 0; i < tVec.size(); i++)
	{
		cin >> tVec.at(i);
	}

	vector<string>tempoVec = sVec;
	sort(tempoVec.begin(), tempoVec.end());
	tempoVec.erase(unique(tempoVec.begin(), tempoVec.end()), tempoVec.end());

	int precounter = 0;
	for (int i = 0; i < tempoVec.size(); i++) {
		string target = tempoVec.at(i);
		int counter = 0;
		for (int i = 0; i < sVec.size(); i++)
		{
			if (target == sVec.at(i))
			{
				counter++;
			}
		}
		for (int i = 0; i < tVec.size(); i++)
		{
			if (target == tVec.at(i))
			{
				counter--;
			}
		}
		if (precounter <= counter)
		{
			precounter = counter;
		}
	}
	cout << precounter << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
 
using namespace std;
 
int main(){
  int len, n;
  cin >> n >> len;
  vector<string> s(n);
  
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }
  
  sort(s.begin(), s.end());
  
  for(int i = 0; i < n; i++){
    cout << s[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <functional>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)

#define huge 1000000007
typedef long long ll;
ll gcd(ll a, ll b);

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll D = 0;
	ll M = 0;
	//ll M = 0;
	//ll a[200] = {};
	//ll b[200] = {};
	//ll v[3] = {};
	ll *c, *s, *n;
	string S,T,U[52];
	ll count = 0;
	ll count2 = 0;
	ll sum = 0;
	ll min = 100000;
	ll max = 0;
	ll smax = 0;
	ll max2 = 0;
	ll smax2 = 0;
	int tmax = 0;
	int tmax2 = 0;
	int flag = 0;
	char temp,head;
	//int is = 0;
	
	
	//char p;


	

	

	//cin >> S;
	
	//b = (ll *)malloc(M * sizeof(ll));
	//vector<pair<int,int>> ch(50);

	
	cin >> N;

	A = N / 100;
	N %= 100;
	B = N / 10;
	N %= 10;
	C = N;

	if(A == C)
	cout << "Yes" << endl;
	else
		cout << "No" << endl;
	//x = (ll *)malloc((N+1) * sizeof(ll));
	//c = (ll *)malloc((N) * sizeof(ll));
	//cin >> D >> G;
	//vector<pair<int,int>> tr(M);
	//vector<pair<int,int>> qes(Q);
	//sort(c.begin(), c.end());
	
	//cout << c[2] - c[1] << endl;

	

	/*A = N / 1000;
	N %= 1000;
	B = N / 100;
	N %= 100;
	C = N / 10;
	N %= 10;
	D = N;*/
	


	return 0;

}

ll gcd(ll a, ll b) {
	ll x = a * b;

	/* 自然数 a > b を確認・入替 */
	if (a<b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}


	return x/b;
}



Measured memory_bytes: 256
/*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0002&lang=jp
*/


#include <stdio.h>
int main(void)
{
    int i=0,n=3,sum,len=0;
    int a,b;
    char c[10];

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

    while(scanf("%d %d",&a,&b)!=EOF){   
        sum=a+b;
        
        while(sum!=0){
            sum=sum/10;
            ++len;
        }
        printf("%d\n",len);
 //       scanf("%d %d",&a,&b);
        len=0;
    }

    return 0;

}


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

int main(){
    int ans, N, sum;
    cin >> N;
    vector<int> a(N), b(N), c(N-1);

    for(int i=0; i<N; i++)
	cin >> a[i];
    for(int i=0; i<N; i++)
	cin >> b[i];
    for(int i=0; i<N-1; i++)
	cin >> c[i];


    sum = accumulate(b.begin(), b.end(), 0);

    for(int i=0; i<N-1; i++){
	if(a[i]+1==a[i+1])
	    sum += c[a[i]-1];
    }
    ans = sum;
    cout << ans << endl;    
}



Measured memory_bytes: 256