akhauriyash/Code-Regression huggingface dataset:
'use strict'

const main = arg => {
    var input = arg.trim().split("\n").join("");
    const result = {
        a : 0,
        b : 0,
        c : 0,
        d : 0,
        e : 0,
        f : 0,
        g : 0,
        h : 0,
        i : 0,
        j : 0,
        k : 0,
        l : 0,
        m : 0,
        n : 0,
        o : 0,
        p : 0,
        q : 0,
        r : 0,
        s : 0,
        t : 0,
        u : 0,
        v : 0,
        w : 0,
        x : 0,
        y : 0,
        z : 0
    };

    [...Array(input.length)].forEach((a, i) => {
        const alpha = input[i].toLowerCase();
        if(alpha.match(/[a-z]/)){
            result[alpha]++;
        }
    })

    const finalResult = [];
    for(let key in result){
        finalResult.push(`${key} : ${result[key]}`);
    }
    console.log(finalResult.join("\n"));
}

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


Measured memory_bytes: 16280
#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<limits>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int count=0;
    for (int i = 1; i <= n; i++)
    {
        count+=((n-1)/i);
    }
    cout<<count<<endl;
    

    return 0;
}

Measured memory_bytes: 3192
#!/usr/bin/env python3
x, y = map(int, input().split())

if x == 1:
    if (y == 2) or (y == 4):
        print("Yes")
    else:
        print("No")
else:
    ans = (4 * x - y) / 2

    if ans == 0:
        print("Yes")
    elif not(ans == int(ans)):
        print("No")
    elif ans <= x and ans >= 1:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 9184
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include<complex>

using namespace std;

typedef long long            ll;
typedef unsigned             ui;
typedef unsigned long long   ull;
typedef pair<int,int>        i_i;
typedef pair<ll,int>         ll_i;
typedef pair<ll,ll>          ll_ll;
typedef pair<double,int>     d_i;
typedef pair<double,double>  d_d;
typedef vector<int>          vi;
typedef vector<vector<int> > vii;

#ifdef DEBUG
#define dprintf      printf
#define dputs        puts
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dputs        (1)?0:puts
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__)
#define array(T,id,n) T id[(n)]; for(int i=0;i<(n);i++)cin>>id[i]
#define putv(n)     cout<<(n)<<endl

//#define int long long
#ifndef int
#define INF __INT32_MAX__
#else
#define INF __INT64_MAX__
#endif

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  string s="ai1333";
  in(int,n);
  n=n/100;
  int i;
  cout<<s;
  rep(i,n){
    cout<<"3";
  }
  cout<<endl;
  return 0;
}



Measured memory_bytes: 3188
N,A,B,C=map(int,input().split())
leng=[int(input()) for i in range(N)]


def dfs(cur,a,b,c,cost):
    if cur == N:
        if min(a,b,c)>0 :
            return abs(A-a)+abs(B-b)+abs(C-c)+cost
        else: return 10**9
    
    return0=dfs(cur+1,a,b,c,cost)
    return1=dfs(cur+1,a+leng[cur],b,c,cost+10)
    return2=dfs(cur+1,a,b+leng[cur],c,cost+10)
    return3=dfs(cur+1,a,b,c+leng[cur],cost+10)
    
    return min(return0,return1,return2,return3)


print(dfs(0,0,0,0,0)-30)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A;
  int min;
 
  cin >> N;  
  cin >> A;
  
  for (int i = 0; ; i++) {
    if (A % 2 != 0) {
      min = i;
      break;
    }
    A /= 2;
  }
  
  for (int i = 0; i < N - 1; i++) {
    cin >> A;
    for (int j = 0; ; j++) {
      if (A % 2 != 0) {
        if (j < min) {
          min = j;
        }
        break;
      }
      A /= 2;
    }
  }
  
  cout << min << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    int a, b;
    vector<int> v(101);
    while (cin >> a >> b) {
        if (a != 0 || b != 0) {
            v[a] ++;
            v[b] ++;
        } else {
            bool ok = true;
            if (v[1] % 2 == 0 || v[2] % 2 == 0) {
                ok = false;
            }
            for (int i=3; i<101; ++i) {
                if (v[i] % 2 != 0) {
                    ok = false;
                }
            }
            cout << (ok ? "OK" : "NG") << endl;
            fill(v.begin(), v.end(), 0);
        }
    }
    return 0;
}

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

int main(){
    int N;  cin >> N;
    vector<pair<int, int>> P(N);
    for(int i=0; i<N; i++)
        cin >> P[i].first >> P[i].second;
    
    sort(P.begin(), P.end());
    cout << P.back().first + P.back().second << endl;
}


Measured memory_bytes: 1024
def lucas(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
    current = 0
    n_1 = 1
    n_2 = 2
    for i in range(n - 1):
        current = n_1 + n_2
        n_2 = n_1
        n_1 = current
    return current

n = int(input())
print(lucas(n))


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll n,y;
  cin>>n>>y;
  if(y%1000==0)
  {
  	ll val=y/1000-n;
  //	cout<<"hello";
  	for(ll i=0;i<=val;i++)
  	{
  		ll x=val-9*i;
		 if(x%4==0)
		 {
		 	ll a=i;
		 	ll b=x/4;
		 	ll c=n-(a+b);
		 	if(a>=0 and b>=0 and c>=0)
		 	{
			cout<<a<<" "<<b<<" "<<c;
			return 0;
			}
		}	
	}
	cout<<"-1 -1 -1";
  }
  else
  cout<<"-1 -1 -1";
 
}

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


auto solve(long long X, long long A, long long B){
    return ((A + X) < B) ? "dangerous" :
           (A < B) ? "safe" :
           "delicious";
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    auto result = solve(X, A, B);
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
function main(input) {
    const args = input.split(/\n/);
    const N = args[0],
          nums = args.slice(1, args.length - 1);
    
    console.log(nums.filter((n, i) => nums.indexOf(n) === i).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
	for (auto i : a) cerr << i << ' ';\
	cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.length();
	forn(i, 0, n - 1)
		if (s[i] == s[i + 1]) {
			cout << i + 1 << ' ' << i + 2 << '\n';
			return 0;
		}
	forn(i, 0, n - 2)
		if (s[i] == s[i + 2]) {
			cout << i + 1 << ' ' << i + 3 << '\n';
			return 0;
		}
	cout << "-1 -1\n";
	return 0;
}


Measured memory_bytes: 512
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

int A, B;
char arr[105][105];
vector<int> indRow, indCol;
int flag = 0;
int vis[105];
int vis1[105];

int main() {
	scanf("%d %d", &A, &B);
	for(int i = 0; i < A; i++) {
		for(int j = 0; j < B; j++) {
			cin >> arr[i][j];
		}
	}
	for(int i = 0; i < A; i++) {
		flag = 0;
		for(int j = 0; j < B; j++) {
			if(arr[i][j] == '#') {
				flag = 1;
				break;
			}
		}
		if(!flag) {
			indRow.push_back(i);
			vis[i] = 1;
		}
	}
	for(int j = 0; j < B; j++) {
		flag = 0;
		for(int i = 0; i < A; i++) {
			if(arr[i][j] == '#') {
				flag = 1;
				break;
			}
		}
		if(!flag) {
			indCol.push_back(j);
			vis1[j] = 1;
		}
	}
	// for(int i = 0; i < indRow.size(); i++) {
	// 	cout << indRow[i] << " ";
	// }
	// cout << "\n";
	// for(int i = 0; i < indCol.size(); i++) {
	// 	cout << indCol[i] << " ";
	// }
	// cout << "\n";

	// for(int i = 0; i < A; i++) {
	// 	for(int j = 0; j < B; j++) {
	// 		for(int k = 0; k < indRow.size(); k++) {
	// 			for(int z = 0; z < indCol.size(); z++) {
	// 				if(i != indRow[k] && j != indCol[z]) {
	// 					cout << arr[i][j];		
	// 				}
	// 			}
	// 		}
	// 	}
	// 	cout << "\n";
	// }
	for(int i = 0; i < A; i++) {
		flag = 0;
		for(int j = 0; j < B; j++) {
			if(vis[i] != 1 && vis1[j] != 1) {
				cout << arr[i][j];
				flag = 1;
			}
		}
		if(flag) {
			cout << "\n";
		}
	}
	return 0;

}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int c[100005];

int main() {
    int n, q;
    int l, r;
    string s;
    cin >> n >> q;
    cin >> s;
    int count = 0;
    for (int i = 0; i < n - 1; ++i) {
        if (s[i] == 'A' && s[i + 1] == 'C') {
            ++count;
        }
        c[i + 1] = count;
    }
    c[n] = count;
    for (int i = 0; i < q; ++i) {
        cin >> l >> r;
        cout << c[r - 1] - c[l - 1] << endl;
    }
}

Measured memory_bytes: 1472
#include <stdio.h>
int n[100][4],hit[50],brow[50];

int main(void)
{
	int i=0,count=0,j;
	
	while (scanf("%d%d%d%d", &n[i][0], &n[i][1], &n[i][2], &n[i][3]) != EOF){
		i++;
		count++;
	}
	
	for (i=0; i<count; i+=2){
		for (j=0; j<4; j++){
			if (n[i][j] == n[i+1][j]){
				hit[i]++;
			}
			else if ((n[i][j] == n[i+1][0]) || (n[i][j] == n[i+1][1]) || (n[i][j] == n[i+1][2]) ||  (n[i][j] == n[i+1][3])){
				brow[i]++;
			}
		}
		printf("%d %d\n", hit[i], brow[i]);
	}
	
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  deque<int> D;
  for (int i = 0; i < N; i++) {
    if (i % 2) D.push_front(A.at(i));
    else D.push_back(A.at(i));
  }
  if (N % 2) reverse(D.begin(), D.end());
  for (auto d : D) cout << d << "\n";
}

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

int main(){
    int n,a,b,c;
    cin >> a >> b >> c >> n;
    int p=0;
    int ah=0;
    int bh=0;
    int ch=0;
    for(int i=0; i!=1000000; i++){
        if(ch == c){
            if(bh == b){
                if(ah == a){
                    break;
                }else{
                    ch = 0;
                    bh = 0;
                    ah = ah + 1;
                    if(ah * 500 == n){
                        p = p + 1;
                    }
                }
            }else{
                ch = 0;
                bh = bh + 1;
                if(bh * 100 + ah * 500 == n){
                    p = p + 1;
                }
            }
        }else{
            ch = ch + 1;
            if(ch * 50 + bh * 100 + ah * 500 == n){
                p = p + 1;
            }
        }
    }
    cout << p << '\n';
    return 0;
}


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

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] input = new int[N];
		for (int i = 0; i < N; i++) {
			int tmp = sc.nextInt();
			input[i] = tmp;
		}
		Arrays.sort(input);
		double res = input[0];
		for (int i = 1; i < N; i++) {
			res = (res + input[i]) / 2;
		}
		System.out.println(res);

	}
}


Measured memory_bytes: 35792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int X = in.nextInt();
		int[] x = new int[n];
		for(int i=0;i<n;i++) {
			x[i] = abs(X-in.nextInt());
		}
		if(n==1) System.out.println(x[0]);
		else {
			int ans = gcd(x[0],x[1]);
			for(int i=2;i<n;i++) {
				ans = gcd(ans,x[i]);
			}
			System.out.println(ans);
		}
		
		

	}
	
	public static int abs(int a) {
		if(a>0) return a;
		else return -a;
	}
	
	public static int gcd(int a,int b) {
		if(a%b==0) return b;
		else return gcd(b,a%b);
	}

}


Measured memory_bytes: 50364
using System;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = Console.ReadLine();
			var d = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
			var ans = 0;

			for (int i = 0; i < d.Length; i++)
			{
				for (int j = i + 1; j < d.Length; j++)
				{
					for (int k = j + 1; k < d.Length; k++)
					{
						var a = d[i];
						var b = d[j];
						var c = d[k];

						if (a != b && b != c && c != a &&
							a < b + c &&
							b < a + c &&
							c < a + b)
						{
							ans++;
						}
					}
				}

			}
			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 27500
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef pair<long long, long long> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;
const int MAX_N = 500000;

int cnt[MAX_N];
int C[MAX_N];
int ans = 0;

// void init(int N) { cnt = vi(N, 0); }

void add(int p) {
    // pの位置をクエリ範囲に加えるときの処理
    if(cnt[C[p]]++ == 0)
        ans++;
}

void del(int p) {
    // pの位置をクエリ範囲から除くときの処理
    if(--cnt[C[p]] == 0)
        ans--;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j, k;
    int N, Q;
    cin >> N >> Q;
    for(i = 0; i < N; i++) {
        int c;
        cin >> c;
        C[i] = c;
    }
    // init(N);

    vector<pi> LR(Q);
    for(i = 0; i < Q; i++) {
        int l, r;
        cin >> l >> r;
        l--;
        LR[i] = pi(l, r);
    }

    vi qi(Q);
    for(i = 0; i < Q; i++) {
        qi[i] = i;
    }
    int sq = sqrt(N);
    sort(qi.begin(), qi.end(), [&](int i, int j) {
        if(LR[i].first / sq != LR[j].first / sq)
            return LR[i].first < LR[j].first;
        // return LR[i].second < LR[j].second;
        return bool((LR[i].second < LR[j].second) ^ (LR[i].first / sq % 2));
    });

    int nl = 0, nr = 0;
    vi vans(Q);
    for(auto i : qi) {
        while(nl > LR[i].first)
            add(--nl);
        while(nr < LR[i].second)
            add(nr++);
        while(nl < LR[i].first)
            del(nl++);
        while(nr > LR[i].second)
            del(--nr);
        vans[i] = ans;
    }

    for(i = 0; i < Q; i++) {
        cout << vans[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 15472
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())






int nlz(unsigned int b) {
	if (b == 0)return -1;
#ifdef __GNUC__
	return 31 - __builtin_clz(b);
#else 
	int res = 0;
	for (int i = 4; i >= 0; i--) {
		int shift = 1 << i;
		if (b >> shift) {
			b >>= shift;
			res |= shift;
		}
	}
	return res;
#endif
}



template<class S, int MAX_LOG = 31>
class RadixHeap {
	vector<pair<int, S>> bucket[MAX_LOG + 1];
	int last_deleted;
	int sz;
public:
	RadixHeap() :sz(0), last_deleted(0) {}
	void push(int key, const S &s) {
		sz++;
		bucket[nlz(key^last_deleted) + 1].emplace_back(key, s);
	}
	pair<int, S> pop() {
		sz--;
		if (bucket[0].empty()) {
			int i = 1;
			while (bucket[i].empty()) i++;
			last_deleted = bucket[i][0].first;
			for (int j = 0; j<(int)bucket[i].size(); j++) {
				pair<int, S> &d = bucket[i][j];
				last_deleted = min(last_deleted, d.first);
			}
			for (int j = 0; j<(int)bucket[i].size(); j++) {
				pair<int, S> &p = bucket[i][j];
				bucket[nlz(last_deleted^p.first) + 1].push_back(p);
			}
			bucket[i].clear();
		}
		pair<int, S> r = bucket[0].back();
		bucket[0].pop_back();
		return r;
	}
	int size()const { return sz; }
	bool empty()const { return !sz; }
};







int n, k;
vector<int> edge[100000];


int a[100000];



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

	scanf("%d", &n);
	rep(i,n-1) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--; b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	RadixHeap<int, 21> pq;

	fill_n(a, n, INF);
	scanf("%d", &k);
	rep(i,k) {
		int v, p;
		scanf("%d%d", &v, &p);
		v--;
		a[v] = p;
		pq.push(p, v);
	}
	while (!pq.empty()) {
		int v, p;
		tie(p, v) = pq.pop();
		for (int u : edge[v]) {
			if (a[u]==INF) {
				a[u] = p + 1;
				pq.push(p + 1, u);
			}
			else if (abs(a[u] - a[v]) != 1) {
				puts("No");
				return 0;
			}
		}
	}
	puts("Yes");
	rep(i, n)printf("%d\n", a[i]);

	
	return 0;
}

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

int top = 0, S[1000];

void push(int x) {
  S[++top] = x;
}

int pop(void) {
  top--;
  return S[top+1];
}

int main(void) {
  int a, b;
  top = 0;
  char s[100];
  while(scanf("%s",s) != EOF) {
    if(s[0] == '+') {
      a = pop();
      b = pop();
      push(a + b);
    } else if(s[0] == '-') {
      b = pop();
      a = pop();
      push(a - b);
    } else if(s[0] == '*') {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }
  printf("%d\n",pop());

  return 0;
}


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

int main() {
	int N;
	cin >> N;
	int cnt = 0, b = 1;
	vector <int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int j = 0; j < N; j++) {
		if (a[j] == b) {
			++b;
		}
		else cnt++;
	}
	
	if (cnt == N) cout << -1 << endl;
	else cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1024
H,W = map(int,input().split())
A = []
for _ in range(H):
    a = list(input())
    if '#' in a:
        A.append(a)
    else:
        H -= 1

for i in range(W-1,-1,-1):
    ch = 0
    for j in range(H):
        if A[j][i] == '#':
            ch = 0
            break
        else:
            ch = 1
    if ch == 1:
        for k in range(H):
            del A[k][i]
    
for a in A:
    print(''.join(a))

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

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

    sort(arr,arr+n);

    int mid1 = arr[n/2-1];
    int mid2 = arr[n/2];

    //cout << mid1 << endl;
    //cout << mid2 << endl;

    int ans = 0;

    if(mid1 < mid2){
        for(int i=mid1+1;i<=mid2;i++){
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4020
def getN():
    return int(input())

def getMN():
    return list(map(int, input().split()))

def getlist():
    return list(map(int, input().split()))

h, w = getlist()
hori = [[] for i in range(h)]
valt = [[] for i in range(w)]

for i in range(h):
    inp = input()
    for j, s in enumerate(inp):
        if s == "#":
            hori[i].append(j)
            valt[j].append(i)


def search(hori, w, h):
    board_h = [0 for i in range(h * w)]
    for i, retu in enumerate(hori):
        tmp = -1
        for p in retu:
            wi = p - tmp -1
            for color in range(tmp+1, p):
                board_h[color + w*i] = wi
            tmp = p

        wi = w - tmp - 1
        if retu:
            for color in range(tmp + 1, w):
                board_h[color + w * i] = wi

        else:
            for color in range(w):
                board_h[i * w + color] = w


    return board_h

def search2(hori, w, h):
    board_h = [0 for i in range(h * w)]
    for i, retu in enumerate(hori):
        tmp = -1
        for p in retu:
            wi = p - tmp -1
            for color in range(tmp+1, p):
                board_h[i + color * w] = wi
            tmp = p

        wi = h - tmp - 1
        if retu:
            for color in range(tmp + 1, h):
                board_h[i + color * w] = wi

        else:
            for color in range(h):
                board_h[i + color * w] = h
    return board_h

board_h = search(hori, w, h)
board_v = search2(valt, w, h)
# print(board_h)
# print(board_v)
# print(valt)

ans = 0
for ph, pw in zip(board_h, board_v):
    light = ph + pw - 1
    if ans < light:
        ans = light

print(ans)
"""
4 6
#..#..
......
....#.
#.#...
"""



Measured memory_bytes: 336244
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
x = [0] * N
u = [0] * N
for i in range(N):
	x[i], u[i] = input().split()

ans = 0
for i in range(N):
	if u[i] == "JPY":
		ans += float(x[i])
	else:
		ans += float(x[i]) * 380000
print(ans)


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

int main()
{
  int a, b, c; cin >> a >> b >> c;
  
  bool ok = false;
  if (a + b == c) ok = true;
  if (a + c == b) ok = true;
  if (b + c == a) ok = true;
  
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

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

int N, K, A[20], req[20];

int main() {
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; i++) scanf("%d", &A[i]);
	int cur = 0;
	for (int i = 0; i < N; i++) {
		req[i] = cur;
		cur = max(cur, A[i] + 1);
	}
	long long mini = 100000000000000000ll;
	for (int i = 0; i < (1 << N); i++) {
		if (__builtin_popcount(i) == K) {
			vector<int> v, idx;
			for (int j = 0; j < N; j++) {
				if (i & (1 << j)) {
					v.push_back(A[j]);
					idx.push_back(j);
				}
			}
			long long ans = 0;
			for (int j = 1; j < v.size(); j++) {
				if (v[j] < max(v[j - 1] + 1, req[idx[j]])) {
					ans += max(v[j - 1] + 1, req[idx[j]]) - v[j];
					v[j] = max(v[j - 1] + 1, req[idx[j]]);
				}
			}
			mini = min(mini, ans);
		}
	}
	printf("%lld\n", mini);
}


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

using namespace std;

int main(){
	int A, B;
	cin >> A >> B;
	rep(i,1100){
		if(i*8/100==A&&i*10/100==B){
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left
N,K = map(int,input().split())
V = list(map(int,input().split()))
vmax = -10**9
for n in range(min(N,K)+1):
    A = V[:n]
    for m in range(min(N,K)-n+1):
        B = V[N-m:]
        B = B+A
        B = sorted(B)
        ind = bisect_left(B,0)
        k = min(ind,K-n-m)
        v = sum(B[k:])
        vmax = max(vmax,v)
print(vmax)       

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

const int N = 1e6 + 5;
const int mod = 1e9 + 7;

int n;
long long cnt[61];
long long a[N], ans;

int main(){



    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 1; i <= n; ++i){
        for (int j = 0; j <= 60; ++j){
            if ((a[i] & (1ll << j)) == 0) continue;
            else ++cnt[j];
        }
    }
    for (int i = 1; i <= n; ++i){
        for (int j = 0; j <= 60; ++j){
            if ((a[i] & (1ll << j)) == 0)
                ans = ((ans + ((1ll << j) % mod) * cnt[j]) % mod) % mod;
           // else ++cnt[j];
        }
    }
    //for (int j = 0; j < 60; ++j) cout << j << ' ' << cnt[j] << '\n';
    cout << ans;

}


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

int main() {
  long N;
  cin >> N;
  vector<int> a(N);

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

    long ans=0;
    int r=0;
    long sum=0;
  for(int l=0;l<N;l++){
    while(sum+a[r]==(sum^a[r])&&r<N){
      sum += a[r];
      r++;
    }
   // cout<<l<<" "<<r<<endl;
    ans += r-l;
    if(l==r) r++;
    else sum -= a[l];
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int sum,n,A[5];
char character;
int main() {
    
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>character;
        if(character=='G')
        {
            A[0]=A[0]+1;
        }
        else if(character=='W')
        {
            A[1]=A[1]+1;
        }
        else if(character=='Y')
        {
            A[2]=A[2]+1;
        }
        else
        {
            A[3]=A[3]+1;
        }
    }
    for(int i=0;i<4;i++)
    {
        if(A[i]>=1)
        {
            sum=sum+1;
        }
    }
    if(sum==3)
    {
        printf("Three");
    }
    else
    {
        printf("Four");
    }
    
    
    
}
    
    
    
       

Measured memory_bytes: 768
"""
abb
acc  6

ab
ab   6

bbc
aac  3

bbaa
ccdd  2
"""

n = int(input())
u = input()
d = input()

bef = -1 #0:vert,  1:horizon

ans = 1
ind = 0
mod = 1000000007
while (True):
    if u[ind] == d[ind]:
        ind += 1
        if bef == -1:
            ans *= 3
        elif bef == 0:
            ans *= 2
            ans %= mod
        else:
            ans *= 1
            ans %= mod
        bef = 0

    else:
        ind += 2
        if bef == -1:
            ans *= 6
        elif bef == 0:
            ans *= 2
            ans %= mod
        else:
            ans *= 3
            ans %= mod
        bef = 1
    # print(ans)
    if ind > n-1:
        break
print(ans)



Measured memory_bytes: 3064
import sys
from math import sqrt, gcd, ceil, log
from bisect import bisect
from collections import defaultdict
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))

# sys.setrecursionlimit(10**6)



def solve():
	a, b = read()
	if 2*a <= b <= 4*a and b%2 == 0:
		print("Yes")
	else:
		print("No")





if __name__ == "__main__":
	solve()

Measured memory_bytes: 9476
N, W = map(int, input().split())
l = []
for i in range(N):
  L = list(map(int, input().split()))
  l.append(L)
sum_of_weight = 0
sum_of_value = 0
for i in range(N):
  sum_of_weight += l[i][0]
  sum_of_value += l[i][1]
dp = [[sum_of_weight+1 for i in range(sum_of_value+1)] for j in range(N+1)]
dp[0][0] = 0
for i in range(1,N+1):
  for j in range(sum_of_value+1):
    if j >= l[i-1][1]:
      dp[i][j] = min(dp[i-1][j], dp[i-1][j-l[i-1][1]]+l[i-1][0])
    else:
      dp[i][j] = dp[i-1][j]
ans = 0
for i in range(N+1):
  for j in range(sum_of_value+1):
    if W >= dp[i][j] and ans < j:
      ans = j
print(ans)

Measured memory_bytes: 171244
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 A, B, C, K;
  std::cin >> A >> B >> C >> K;
  std::cout << (K % 2 == 0 ? A - B : B - A) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int a,b,c,d,p,x,y;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
	x = p * a;
	if(p > c){
		y = b + (p - c)*d;
	}else{
		y = b;
	}
	if(x > y){
		printf("%d\n",y);
	}else{
		printf("%d\n",x);
	}
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#define N 200005
#define LL long long
#define PI asin(1)*2
using namespace std;

struct point{
	int x,y;
	point(){};
	point(int x,int y){
		this->x=x;
		this->y=y;
	}
};

point s,t;
int n; 
int dp[N],x[N];
vector<point> p;

int cmp(point a,point b)
{
	return a.x<b.x;
}

int main()
{
	//cout<<PI<<endl;
	while(~scanf("%d%d%d%d",&s.x,&s.y,&t.x,&t.y))
	{
		if(s.x>t.x) swap(s,t);
		point ld=point(s.x,min(s.y,t.y));
		point ru=point(t.x,max(t.y,s.y));
		scanf("%d",&n);
		point tmp;
		while(n--)
		{
			scanf("%d%d",&tmp.x,&tmp.y);
			if(tmp.x>=ld.x&&tmp.x<=ru.x&&tmp.y>=ld.y&&tmp.y<=ru.y)
				p.push_back(tmp);
		}
		sort(p.begin(),p.end(),cmp);
		double ans;
		ans=abs(s.x-t.x)+abs(s.y-t.y);
		ans*=100;
		if(s.x==t.x||s.y==t.y)
		{
			if(p.size()!=0) 
				ans=ans-10*2+10*PI;
		}
		else if(s.y<t.y&&p.size()>0)
		{
			int maxn;
			x[1]=p[0].y;
			int k=1;
			dp[0]=1;
			for(int i=1;i<p.size();i++)
			{
				if(x[k]<p[i].y)
				{
					x[++k]=p[i].y;
					dp[i]=k;
				}
				else
				{
					int l=1,r=k;
					while(l<=r)
					{
						int mid=(l+r)/2;
						if(x[mid]<=p[i].y)
							l=mid+1;
						else
							r=mid-1;
					} 
					dp[i]=l;
					x[l]=p[i].y;
				}
			}
			maxn=k;
			if(maxn==abs(s.x-t.x)+1||maxn==abs(s.y-t.y)+1)
				ans+=5*PI;
			ans=ans-20*maxn+5*PI*maxn;
		}
		else if(s.y>t.y&&p.size()>0)
		{
			int maxn;
			x[1]=p[p.size()-1].y;
			int k=1;
			dp[p.size()-1]=1;
			for(int i=p.size()-2;i>=0;i--)
			{
				if(x[k]<p[i].y)
				{
					x[++k]=p[i].y;
					dp[i]=k;
				}
				else
				{
					int l=1,r=k;
					while(l<=r)
					{
						int mid=(l+r)/2;
						if(x[mid]<=p[i].y)
							l=mid+1;
						else
							r=mid-1;
					} 
					dp[i]=l;
					x[l]=p[i].y;
				}
			}
			maxn=k;
			if(maxn==abs(s.x-t.x)+1||maxn==abs(s.y-t.y)+1)
				ans+=5*PI;
			ans=ans-20*maxn+5*PI*maxn;
		}
		printf("%.15lf\n",ans);
		p.clear();
	}
}

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

ll h,w,k;
vector<string> s;

int main(){
    cin >> h >> w >> k;
    s.resize(h);
    for(ll i=0;i<h;i++) cin >> s[i];
    ll res=1e18;
    for(ll bit=0;bit<(1<<h-1);bit++){
        bool flag=true;
        ll count=0;
        vector<ll> memo(h,0);
        for(ll i=0;i<h-1;i++){
            if(bit&(1<<i)){
                memo[i+1]=memo[i]+1;
                count++;
            }
            else memo[i+1]=memo[i];
        }
        ll com=0;
        vector<ll> cal(count+1,0);
        for(ll i=0;i<w;i++){
            vector<ll> one(count+1,0);
            bool ok=true;
            for(ll j=0;j<h;j++){
                one[memo[j]] += s[j][i]-'0';
                cal[memo[j]] += s[j][i]-'0';
                if(one[memo[j]]>k) flag=false;
                if(cal[memo[j]]>k) ok=false;
            }
            if(!ok){
                com++;
                cal=one;
            }
        }
        if(flag) res=min(res,count+com);
    }
    cout << res << endl;
    return 0;
}  


Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    long long N;
    cin >> N;
    vector<long long> A(N,0);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    
    int num=60;

    vector<long long> dig(num,0);
    for(int i=0; i<N; i++){
        for(long long j=0; j<num; j++){
            long long x = (A[i]>>j)%2;
            dig[j]+=x;
        }
    }

    long long ans=0;
    long long tmp=1;
    for(long long i=0; i<num; i++){
        ans=(ans+dig[i]*(N-dig[i])%MOD*tmp)%MOD;
        tmp=tmp*2;
        tmp%=MOD;
        //cout << tmp << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include<stdio.h>
int h[251];
int main(){
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&h[i]);
	} 
	for(int i=1;i<=n;i++){
		printf("node %d: ",i);
		printf("key = %d, ",h[i]);
		if(i/2>=1)printf("parent key = %d, ",h[i/2]);
		if(2*i<=n)printf("left key = %d, ",h[2*i]);
		if(2*i+1<=n)printf("right key = %d, ",h[2*i+1]);
		printf("\n");
	} 
	return 0;
} 


Measured memory_bytes: 2684
import math
import heapq
import sys
from collections import Counter
import numpy as np

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
#s = [input() for i in range(3)]

A,B=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき

needs=B-A
cnt=1

cnt+= math.ceil(needs/(A-1))

print(cnt)

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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#pragma endregion Macros

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

    int ans;
    if (X <= 599){
        ans = 8;
    }else if( X <= 799) {
        ans = 7;
    }else if( X <= 999){
        ans = 6;
    }else if( X <= 1199){
        ans = 5;
    }else if( X <= 1399){
        ans = 4;
    }else if( X <= 1599){
        ans = 3;
    }else if( X <= 1799){
        ans = 2;
    }else if( X <= 1999){
        ans = 1;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3592
S = input()
a, b, c = 0, 0, 0
for i in S:
    if i == 'a': a += 1
    if i == 'b': b += 1
    if i == 'c': c += 1
print('Yes' if a == 1 and b == 1 and c == 1 else 'No')

Measured memory_bytes: 3060
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scanf("%d %d %d %d", &a, &b, &c, &d)
	for a > 0 || c > 0 {
		c = c - b
		a = a - d
		if c <= 0 {
			fmt.Println("Yes")
			break
		}
		if a <= 0 {
			fmt.Println("No")
			break
		}
	}
}


Measured memory_bytes: 1820
#include<iostream>
using namespace std;
#include<cstdio>
#include<cmath>

struct Point{ double x, y; };

Point set_p(double a, double b)
{
    Point p;
    p.x = a; p.y = b;
    return p;
}

struct Vector{ double vx, vy; };

Vector set_v(const Point &p1, const Point &p2)
{
    Vector v;
    v.vx = p2.x - p1.x;
    v.vy = p2.y - p1.y;
    return v;
}

double dot(const Vector &v1, const Vector &v2)
{
    return (v1.vx * v2.vx) + (v1.vy * v2.vy);
}

double cross(const Vector &v1, const Vector &v2)
{
	return (v1.vx * v2.vy) - (v1.vy * v2.vx);
}

double onenorm(const Vector &v)
{
	return abs(v.vx) + abs(v.vy);
}

int ccw(const Point &P0, const Point &P1, const Point &P2)
{
	Vector V1 = set_v(P0, P1);
	Vector V2 = set_v(P0, P2);
	double c = cross(V1, V2);
	if(c > 0){ return 1; }else if(c < 0){ return -1; }
	if(dot(V1, V2) < 0){ return -2; }
	if(onenorm(V1) < onenorm(V2)){ return 2; }
	return 0;
}

int main()
{
    double x0, x1, y0, y1;
    scanf("%lf %lf %lf %lf", &x0, &y0, &x1, &y1);
    Point P0 = set_p(x0, y0);
    Point P1 = set_p(x1, y1);
	int val;

    double x2, y2;
    int q;
    scanf("%d", &q);
    for(int i = 0; i < q; i++){
        scanf("%lf %lf", &x2, &y2);
        Point P2 = set_p(x2, y2);
        val = ccw(P0, P1, P2);
        switch(val){
            case 1:
                printf("COUNTER_CLOCKWISE\n");
                break;
            case -1:
                printf("CLOCKWISE\n");
                break;
            case -2:
                printf("ONLINE_BACK\n");
                break;
            case 2:
                printf("ONLINE_FRONT\n");
                break;
            default:
                printf("ON_SEGMENT\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1204
n,m = map(int,input().split())
coordinate = [list(map(int,input().split())) for c in range(n)]
point = [list(map(int,input().split())) for c in range(m)]
for c in coordinate:
  num = 10**9
  ans = []
  for index,p in enumerate(point):
    tmp = abs(c[0]-p[0])+abs(c[1]-p[1])
    ans.append(tmp)
  print(ans.index(min(ans))+1)
      
    

Measured memory_bytes: 68484
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
//const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    string s;cin>>s;
    
    int c0=0;
    int c1=0;
    
    rep(i,s.size()){
        if(s[i]=='0')c0++;
        else c1++;
    }
    
    cout<<min(c0,c1)*2<<endl;
    
    return 0;
}






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

int main() {
    int n, k; cin >> n >> k;
    int A[n] = {};
    for (int i = 0; i < k; i++) {
        int d; cin >> d;
        for (int j = 0; j < d; j++) {
            int a; cin >> a;
            A[a-1]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (A[i] == 0) ans++;
    }
    cout << ans << endl;
}

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



// long long int cnt = 0;
int comp[21][21];
int n;
// map<pair<int,set<int> , int > dp;

// void solve(int curr_man,set<int>&taken){
// 	if(curr_man==n)
// 	{
// 		if(taken.size()==n)
// 		cnt++;
// 		return;
// 	}

// 	for(int i =0;i<n;i++){
// 		if(comp[curr_man][i]==1 && taken.find(i)==taken.end()){
// 			taken.insert(i);
// 			solve(curr_man+1,taken);
// 			taken.erase(i);
// 		}
// 	}
// }
const int modi = 1e9 + 7;

void add_mod(int& a,int b){
	a+=b;
	if(a>=modi)
		a-=modi;
}
int dp[22][(1<<21)]; // number of ways such that n men are considered and the relationhsips are in bitsets
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for(int i =0;i<n;i++){
		for(int j =0;j<n;j++)
			cin >> comp[i][j];
	}
	int maxi = (1<<n) - 1;

	dp[0][0] = 1;
	for(int i = 1;i<=n;i++){
		for(int j =0;j<=maxi;j++){
			int taken = __builtin_popcount(j);
			if(taken<i-1)
				continue;
			for(int k = 0;k<n;k++){
				if(comp[i-1][k]){
					int wmn = (1<<(k));
					if((wmn&j) == 0){
						add_mod(dp[i][wmn|j],dp[i-1][j]);
					}
				}
			}
			// cout << dp[i][j] << " ";
		}
		// cout << endl;
	}
	cout << dp[n][maxi] << endl;
}

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

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  map<int, int> m;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    m[a]++;
  }
  vector<int> v;
  for (auto p : m) {
    v.push_back(p.second);
  }
  sort(v.rbegin(), v.rend());
  int ans = 0;
  for (int i = K; i < v.size(); i++) {
    ans += v[i];
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 10748
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    a, b = list(map(int, readline().split()))
    print(str(a) * b if str(a) * b <= str(b) * a else str(b) * a)


if __name__ == '__main__':
    solve()


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

// 引数xの桁数を返す関数
// ※xは正の整数でなければならない
int keta(int x){
	int k=0;
	while(x > 0){
		x /= 10;
		k++;
	}
	return k;
}

main(){
	int a,b;
	// 入力の終わりまで繰り返す
	while(cin >> a >> b){
		
		// a+b の桁数を計算して出力する
		printf("%d\n", keta(a+b));
	}
}



Measured memory_bytes: 3048
N = int(input())
W = [input() for i in range(N)]
sum = 0
for i in range(N):
  for j in range(N):
    if W[i] == W[j]:
      sum = sum+1
if sum != N:
  print("No")
  exit()
for i in range(N-1):
  if W[i][-1] != W[i+1][0]:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 3064
n, m = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(m)]
ans =[0] * (n + 1)

for l, r in LR:
  ans[l - 1] += 1
  ans[r] -= 1
  
accu =[0] * (n + 1)
for i in range(n):
  accu[i + 1] += ans[i] + accu[i]
  
ans = accu.count(m)

print(ans)

Measured memory_bytes: 32312
// https://atcoder.jp/contests/abc047/tasks/arc063_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

bool dp[100][100];
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int len = s.length(), ans = 0;
    REP(i, len - 1) ans += (s[i] != s[i + 1]);
    cout << ans << endl;

    return 0;
}


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

int main() {
  long long A,B,C,D,m,n,tmp,s;
  cin >> A >> B >> C >> D;
  m=C;
  n=D;
  while(m%n!=0){
    tmp=n;
    n=m%n;
    m=tmp;
    }
  m=C*D/n;
  s+=B/C-(A-1)/C;
  s+=B/D-(A-1)/D;
  s-=B/m-(A-1)/m;
  s=B+1-A-s;
  cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;

int main()
{
	int a;
	ll b;
	cin >> a >> b;
	vector<ll> aa(a);
	rep(i, a) {
		ll c, d;
		cin >> c >> d;
		aa[i] = (c * c + d * d);
	}
	int ans = 0;
	rep(i, a) {
		if (b * b >= aa[i])
			ans++;
	}
	cout << ans;
	
	
}

Measured memory_bytes: 4776
# Python3 program to count 
# number of factors 
# of an array of integers 
MAX = 10000001; 

# array to store 
# prime factors 
factor = [0]*(MAX + 1); 

# function to generate all 
# prime factors of numbers 
# from 1 to 10^6 
def generatePrimeFactors(): 
	factor[1] = 1; 

	# Initializes all the 
	# positions with their value. 
	for i in range(2,MAX): 
		factor[i] = i; 

	# Initializes all 
	# multiples of 2 with 2 
	for i in range(4,MAX,2): 
		factor[i] = 2; 

	# A modified version of 
	# Sieve of Eratosthenes 
	# to store the smallest 
	# prime factor that divides 
	# every number. 
	i = 3; 
	while(i * i < MAX): 
		# check if it has 
		# no prime factor. 
		if (factor[i] == i): 
			# Initializes of j 
			# starting from i*i 
			j = i * i; 
			while(j < MAX): 
				# if it has no prime factor 
				# before, then stores the 
				# smallest prime divisor 
				if (factor[j] == j): 
					factor[j] = i; 
				j += i; 
		i+=1; 

# function to calculate 
# number of factors 
def calculateNoOFactors(n): 
	if (n == 1): 
		return 1; 
	ans = 1; 

	# stores the smallest 
	# prime number that 
	# divides n 
	dup = factor[n]; 

	# stores the count of 
	# number of times a 
	# prime number divides n. 
	c = 1; 

	# reduces to the next 
	# number after prime 
	# factorization of n 
	j = int(n / factor[n]); 

	# false when prime 
	# factorization is done 
	while (j > 1): 
		# if the same prime 
		# number is dividing 
		# n, then we increase 
		# the count 
		if (factor[j] == dup): 
			c += 1; 

		# if its a new prime factor 
		# that is factorizing n, 
		# then we again set c=1 and 
		# change dup to the new prime 
		# factor, and apply the formula 
		# explained above. 
		else: 
			dup = factor[j]; 
			ans = ans * (c + 1); 
			c = 1; 

		# prime factorizes 
		# a number 
		j = int(j / factor[j]); 

	# for the last 
	# prime factor 
	ans = ans * (c + 1); 

	return ans; 



n=int(input())

generatePrimeFactors()
ans=0
for i in range(1,n+1):
    ans+=calculateNoOFactors(i)*i
    


print(ans)
    



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

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


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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  char a, b, c;
  cin >> a >> b >> c;
  cout << (a + b + c == 294 ? "Yes" : "No") << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int NUM = 1000001;
bool prime[NUM];

void init()
{
    for (int i = 0; i < NUM; i++)
        prime[i] = true;
    prime[0] = prime[1] = false;

    for (int i = 2; i * i < NUM; i++) 
        for (int j = 2 * i; j < NUM; j += i) 
            if (prime[j])
                prime[j] = false;
}

int main()
{
    int n;

    init();
    while (cin >> n, n) {
        int cnt = 0;

        for (int i = 2; i <= n - i; i++) 
            if (prime[i] && prime[n - i]) 
                cnt++;

        cout << cnt << endl;
    }

    return 0;
}

Measured memory_bytes: 2136
#include<string>
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
typedef long long int llint;
#define pub push_back
#define mp make_pair
#define fir first
#define sec second
const int big=((llint)1<<30);
int main(void){
	string st;int i,gen=0,ans=0;
	cin>>st;
	for(i=0;i<st.size();i++){if(st[i]=='S'){gen--;}else{gen++;}ans=max(ans,gen);}
	cout<<ans*2<<endl;
	return 0;
}


Measured memory_bytes: 640