akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main(){
  string p;
  cin>>p;
  int s=0,an=0,b=-1,t,j;
  for(int i=0;i<11;i++){
      int q;
      if(i<=4)q=11-i-5;
      else q=11-i+1;
      if(p[i]!='?')s+=q*(p[i]-'0');
      else t=q,j=i;
  }
  if(p[11]=='?'){
    int k=s%11;
    if(k<=1)cout<<0<<endl;
    else cout<<11-k<<endl;
  }
  else {
    for(int i=0;i<10;i++){
      int s1=s;
      s1+=t*i;
      int k=11-s1%11;
      if(s1%11<=1)k=0;
      if(p[11]-'0'==k){
	an++;
	b=i;
      }
    }
    if(an==1)cout<<b<<endl;
    else cout<<"MULTIPLE"<<endl;
  }
  return 0;
}

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

int main() {
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  
  // 配列を作る//
  
  vector<int> c500(a);
  for (int i = 0; i < a; i++){
    c500.at(i) = 500 * i;
  }
  c500.push_back(500 * a);
  
   vector<int> c100(b);
  for (int i = 0; i < b; i++){
    c100.at(i) = 100 * i;
  }
  c100.push_back(100 * b);
  
   vector<int> c50(c);
  for (int i = 0; i < c; i++){
    c50.at(i) = 50 * i;
  }
  c50.push_back(50 * c);
  

  
  int ans = 0;
    
    for (int i = 0; i <= a; i++){
      for (int j = 0; j <= b; j++){
        for (int k = 0; k <= c; k++){
          if ((c500.at(i) + c100.at(j) + c50.at(k)) == x){
            ans++;
          }
        }
      }
    }
  
   cout << ans << endl;
}
     

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define inf 1000000100

int main()
{
    string o, e;
    cin >> o >> e;
    for(int i = 0 ; i < min(o.size(), e.size()); i++)
    {
        cout << o[i];
        cout << e[i];
    }

    if(o.size() > e.size())
    {
        cout << o[o.size()-1] << endl;
    }
    else if (o.size() < e.size())
    {
        cout << e[e.size()-1] << endl;
    }
    else
    {
        cout << endl;
    }
}


Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main{
	static BufferedReader br;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}
		return ans;
	}
	static long[] splitL() throws IOException
	{
		String[] cmd=br.readLine().split(" ");
		long[] ans=new long[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Long.valueOf(cmd[i]);
		}
		return ans;
	}
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		br=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder s=new StringBuilder(br.readLine());
		Deque<Character> dq = new ArrayDeque<>();
		for(int i=0;i<s.length();i++)
		{
			dq.addLast(s.charAt(i));
		}
		int q=cin();
		int rev=0;
		for(int i=0;i<q;i++)
		{
			String[] st=br.readLine().split(" ");
			int t=Integer.valueOf(st[0]);
			if(t==1)
				rev=rev^1;
			else
			{
				StringBuilder g=new StringBuilder(st[2]);
				int f=Integer.valueOf(st[1]);
				if(f==2)
				{
					if(rev==0)
						dq.addLast(st[2].charAt(0));
					else
						dq.addFirst(st[2].charAt(0));
				}
				else
				{
					if(rev==0)
						dq.addFirst(st[2].charAt(0));
					else
						dq.addLast(st[2].charAt(0));
				}
			}
		}
		StringBuilder ans=new StringBuilder("");
		while(!dq.isEmpty())
		{
			ans.append(dq.pollFirst());
		}
		if(rev==0)
			System.out.println(ans);
		else
		{
			System.out.println(ans.reverse().toString());
		}
	}
}


Measured memory_bytes: 62696
#include<stdio.h>
int main()
{
    int n,st[100],i,max,min;
    scanf("%d",&n);
    if(n>=1&&n<=100)
    {
        for(i=0; i<n; i++)
        {
            scanf("%d",&st[i]);
        }
        max=st[0];
        min=st[0];
        for(i=1; i<n; i++)
        {
            if(st[i]>max)
                max=st[i];
            else if(st[i]<min)
                min=st[i];
        }
        printf("%d\n",max-min);
    }
    return 0;
}

Measured memory_bytes: 128
/*************************************************************************
    > File Name: 4.cpp
    > Author: PumpkinYing
    > Created Time: 2018年01月14日 星期日 18时45分17秒
 ************************************************************************/

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <cmath>
using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;

const int maxn = 100010;
ll a[maxn];

ll upper(ll a,ll b)
{
	if(a%b == 0) return a/b;
	return a/b+1;
}

int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 0;i < n;i++) scanf("%lld",&a[i]);
	ll mx = 2,mn = 2;
	int ok = 1;
	for(int i = n-1;i >= 0;i--)
	{
		mn = upper(mn,a[i])*a[i];
		if(mn > mx) ok = 0;
		mx = (mx/a[i])*a[i]+(a[i]-1);
	}
	if(ok) printf("%lld %lld\n",mn,mx);
	else printf("-1\n");
	return 0;
}


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

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

  queue<vector<int> > list;
  vector<int> seq;

  if (k < 10) {
    cout << k << endl;
    return 0;
  }

  rep(i, 9) { list.push({i + 1}); }

  k -= 9;

  while (k > 0) {
    seq = list.front();
    list.pop();

    int first = max(0, seq.back() - 1);
    int last = min(9, seq.back() + 1);
    for (int i = first; i <= last; i++) {
      vector<int> new_seq(seq);
      new_seq.push_back(i);
      list.push(new_seq);
      k--;

      if (k == 0) {
        rep(j, new_seq.size()) { cout << new_seq[j]; }
      }
    }
  }

  return 0;
}

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

int main(){
	int n;
	cin>>n;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin>>h[i];
	}
	int temp=0;
	int ans=0;
	for (int i = 0; i < n-1; i++) {
		if (h[i]>=h[i+1]) {
			temp++;
			ans=max(ans,temp);
		}else {
			ans=max(ans,temp);
			temp=0;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <sstream>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef unsigned long long ull;
typedef std::pair<int,int> P;

int main(){
    std::string s;
    while(std::cin >> s, s != "0000"){
        if(s[0] == s[1] && s[0] == s[2] && s[0] == s[3]){
            std::cout << "NA" << std::endl;
        }else{
            int t = 0;
            while(s != "6174"){
                int L, S;
                std::sort(s.begin(), s.end(), std::greater<char>());
                L = std::stoi(s);
                std::sort(s.begin(), s.end());
                S = std::stoi(s);

                s = std::to_string(L-S);
                while(s.length() < 4){
                    s += "0";
                }
                t++;
            }

            std::cout << t << std::endl;
        }
    }
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    unordered_map<int, int> m;
    rep(i, N){
        int a; cin >> a;
        m[a]++;
    }
    int d1=0, d2=0;
    ll cnt=0;
    for(auto a: m){
        if((a.first == 0 && a.second > 1) || (a.first != 0 && a.second != 2)){
            cout << 0 << endl;
            return;
        }
        if(a.first%2) d1++;
        else d2++;
        if(a.first != 0) cnt++;
    }
    if(d1 > 0 && d2 > 0){
        cout << 0 << endl;
        return;
    }
    cout << mod_pow(2, cnt, mod) << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7820
#include<bits/stdc++.h>
 
#define pb push_back
// #define mp make_pair
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell1 1000000007
#define hell2 1000000009
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define ll unsigned long long
#define ld long double 
#define no_of_digits(n) floor(log10(n)) + 1
#define see(x) cerr << (#x) << " is " << (x) << endl
#define INF 1e13
#define LL_MAX 1e18
// memset(array, -1, sizeof(array[0][0]) * row * count)
using namespace std;
 
ll mult(ll a,ll b, ll p=hell1){   return ((a%p)*(b%p))%p; }
ll multbig(ll a,ll b,ll mod=hell1){   if(a==0 or b==0) return 0;if(a==1 or b==1) return (a*b)%mod;ll cur=multbig(a,b/2,mod);cur=(2*cur)%mod;if(b%2) cur=(cur+a)%mod;return cur;}
ll add(ll a, ll b, ll p=hell1){ if(a>=p) a%=p; if(b>=p) b%=p; if(a+b>p) return (a + b)%p; else return a+b;}
ll sub(ll a, ll b, ll p=hell1){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = hell1) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = hell1) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = hell1){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
int isPowerof2(ll x) { return (x && !(x & x-1)); } 
ll log2(ll x) { ll res = 0; while (x >>= 1) res++; return res; } 
bool isPerfectSquare(long double x) {long double sr = sqrt(x); return ((sr - floor(sr)) == 0); }
bool check(ll i,ll j,ll n){return (i>=0 && i<n && j>=0 &&  j<n);} //matrix boundary checking
 
 
ll ceil(const ll &a, const ll &b){return (a - 1)/b + 1;}
 
// max({a, b, c, d})
// cout << fixed for removing e notation
 
bool comp(pair<ll, ll>a, pair<ll, ll>b)
{
    if(a.se*b.fi + b.se > b.se*a.fi + a.se) return true;
    else return false;
}
 
void convert(int arr[], int n) 
{ 
    int temp[n+1];
    for(int i=1;i<=n;i++)
        temp[i] = arr[i]; 
    // memcpy(temp, arr, n*sizeof(int)); 
  
    sort(temp+1, temp+n+1);   
    unordered_map<int, int> umap;
    int val = 1; 
    for (int i = 1; i <= n; i++) 
        umap[temp[i]] = val++;
    for (int i = 1; i <= n; i++) 
        arr[i] = umap[arr[i]]; 
}
 
bool prime[10000005];
void SieveOfEratosthenes(int n) 
{
    memset(prime, true, sizeof(prime)); 
    prime[0] = prime[1] = 0;
    for (int p=2; p*p<=n; p++) 
    {
        if (prime[p] == true) 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
    }
}

int foo(int a, int b, int c)
{
    return (abs(a-b) + abs(b-c) + abs(a-c));
}


ll getFirstSetBitPos(ll n) 
{ 
    return log2(n & -n) + 1; 
} 

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

    ll x, y;

    ll ans = INF;

    for(int i=1;i<=sqrt(n);i++)
    {
        if(n%i == 0)
        {
            x = i;
            y = n/i;

            ans = min(ans, x+y-2);
            // break;
        }
    }

    cout << ans << "\n";
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    string s[3];
    
    for(int i = 0; i < 3; i++)
    {
        cin>>s[i];
        cout<<(char)(s[i][0] +'A'-'a');
    }
        
    cout<<endl;
 
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

def qsort( a ):
	if not isinstance(a,list):
		raise TypeError('qsort can only sort \'list\'')
	if len(a) <= 1:
		return a
	p = a[0]
	for i in range(1,len(a)):
		if a[0] != a[i]:
			if a[0] < a[i]:
				p = a[i]
			break
		elif i == len(a)-1:
			#all are same
			return a
	
	while True:
		i = 0
		j = len(a)
		for i in range( 0, len(a) ):
			if p <= a[i]:
				break
		for j in range( len(a)-1, -1, -1 ):
			if a[j] < p:
				break
		if i >= j:
			a1 = qsort( a[:i] )
			if i < len(a):
				a2 = qsort( a[i:] )
				a1.extend(a2)
			return a1
		else:
			tmp  = a[i]
			a[i] = a[j]
			a[j] = tmp

if __name__ == '__main__':
	m_list = []
	for i in range(0,10):
		m_list.append( int( sys.stdin.readline() ) )
	s = qsort(m_list)
	s.reverse()
	for i in range(0,3):
		print('{}'.format(s[i]))

Measured memory_bytes: 7808
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 

*/
/* }}} */

#include <bits/stdc++.h>
using namespace std;

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const double EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << '\n';
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}

/* }}} */

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  //int n = in();
  vi v(3);
REP(i, 3) cin >> v[i];
sort(ALL(v));
if (v[0]==5&&v[1]==5&&v[2]==7) print("YES");
else print("NO");

  return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	int x,a,b;
	cin>>x>>a>>b;
	if(abs(x-a)<abs(x-b))
	{
		cout<<'A'<<endl;
	}
	else
	{
		cout<<'B'<<endl;
	}
	return 0;
}

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

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

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

int h, w;
vector<string> fi;

long long numb = 0, numw = 0;
bool seen[MAX][MAX];
void dfs(int x, int y) {
  seen[x][y] = true;
  if (fi[x][y] == '#')
    ++numb;
  else
    ++numw;

  rep(dir, 4) {
    int nx = x + dx[dir];
    int ny = y + dy[dir];
    if (nx < 0 || nx >= h || ny < 0 || ny >= w || fi[x][y] == fi[nx][ny] ||
        seen[nx][ny])
      continue;
    dfs(nx, ny);
  }
}

int main() {
  cin >> h >> w;
  fi.resize(h);
  rep(i, h) cin >> fi[i];

  long long res = 0;
  rep(x, h) {
    rep(y, w) {
      if (fi[x][y] == '.' || seen[x][y]) continue;
      numb = numw = 0;
      dfs(x, y);
      res += numb * numw;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 16488
#include<iostream>

using namespace std;

int main(void){
	double high=0,low=0,data;
	
	cin>>data;
	high=low=data;
	while(cin>>data){
		if(high<data)	high=data;
		if(low>data)	low=data;
	}
	cout<<high-low<<endl;

	return 0;
}

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

int main(){
    int N ,Q;
    cin >> N >> Q;
    vector<int> w(N+1,0);
    vector<int> v[N+1];
    rep(i,N-1){
        int a,b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    rep(i,Q){
        int p,x;
        cin >> p >> x;
        w[p]+=x;
    }

    queue<int> que;
    vector<bool> visit(N+1,false);
    que.push(1);
    while(!que.empty()){
        int cur=que.front();
        visit[cur]=true;
        que.pop();
        for(int next : v[cur]){
            if(visit[next]) continue;
            
            w[next]+=w[cur];
            que.push(next);
        }
    }

    rep2(i,1,N+1) cout << w[i] << " ";
    cout << endl;

}


Measured memory_bytes: 16576
expr = input().split()
my_stack = []
def push(stack, item):
    return stack.append(item)

def pop(stack):
    return stack[:-1], stack[-1]

for item in expr:
    if item.isdigit():
        push(my_stack, int(item))
    elif item == '+':
        my_stack, a = pop(my_stack)
        my_stack, b = pop(my_stack)
        push(my_stack, a + b)
    elif item == '-':
        # not a - b
        my_stack, a = pop(my_stack)
        my_stack, b = pop(my_stack)
        push(my_stack, b - a)
    elif item == '*':
        my_stack, a = pop(my_stack)
        my_stack, b = pop(my_stack)
        push(my_stack, a * b)

print(my_stack[0])

Measured memory_bytes: 7796
from fractions import gcd
from functools import reduce
from math import ceil

n, m = map(int, input().split())
a = list(map(int, input().split()))

b = list(map(lambda x: format(x, 'b')[::-1].find('1'), a))
if len(set(b)) != 1:
    print(0)
else:
    c = list(map(lambda x: x//2, a))
    t = reduce(lambda x, y: x*y//gcd(x, y), c)
    print(ceil((m//t)/2))


Measured memory_bytes: 16308
package main

import (
	"fmt"
)

func main() {
	var a, b, c, k int
	fmt.Scanf("%d %d %d %d", &a, &b, &c, &k)

	useA, useB, useC := 0, 0, 0
	if k > a {
		useA = a
		k -= a
		if k > b {
			useB = b
			k -= b
			if k > c {
				useC = c
			} else {
				useC = k
			}
		} else {
			useB = k
			k = 0
		}
	} else {
		useA = k
		k = 0
	}
	fmt.Println(1*useA + 0*useB + -1*useC)
}


Measured memory_bytes: 1816
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''
5 2 4
'''

def solve(n,x,y):
	adj = [[] for i in range(n+1)]
	adj[x].append(y)
	adj[y].append(x)
	for i in range(1,n):
		adj[i].append(i+1)
		adj[i+1].append(i)
	# print(adj)
	ans = []
	d = {}
	for i in range(1,n):
		d[i] = 0
	for k in range(1,n+1):
		q = [k]
		dis = [maxsize]*(n+1)
		dis[k] = 0
		while(q):
			src = q.pop()
			for nn in adj[src]:
				# if(nn > k or nn == X or nn == Y):
				if(dis[nn] > dis[src]+1):
					# if(src == 4):
						# print('src:',src,'nn:',nn)
					dis[nn] = dis[src] + 1
					q.append(nn)
				# else:
				# 	dis[nn] = 
			# if(k == 3):
			# 	print('src:',src)
			# 	print('dis:',dis)
		curr = 0
		# if(k == 3):
		# print('k:',k,dis)
		for ii in range(k+1,n+1):
			d[dis[ii]] += 1
	return d

N,X,Y = list(map(int, stdin.readline().rstrip().split()))
ans = solve(N,X,Y)
for i in range(1,N):
	print(ans[i])




Measured memory_bytes: 47708
void main() {
	auto ip = readAs!(long[]), A = ip[0], B = ip[1];
	writeln(A * B / gcd(A, B));
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
using System;

namespace ITP1_8_B
{
    class Program
    {
        static void Main(string[] args)
        {
            do
            {
                string str = Console.ReadLine();
                char[] number = str.ToCharArray();
                int[] numbers = new int[str.Length];
                for(int i=0;i<str.Length;i++)
                {
                    numbers[i] = int.Parse(number[i].ToString());
                }
                int sum = 0;

                if (str.Length == 1 && numbers[0] == 0)
                    Environment.Exit(0);

                for (int j = 0; j < str.Length; j++)
                {
                    sum += numbers[j];
                }

                Console.WriteLine("{0}", sum);

            } while (true);
        }
    }
}


Measured memory_bytes: 7924
(n,m)=gets.split.map(&:to_i)
ac = (0...m).map{ (a,b)=gets.split.map(&:to_i);c=gets.split.map{|a|1<<(a.to_i-1)}.reduce(:|); [a,c] }.sort_by{|a,c|a}.uniq{|a,c|c}

memo={0=>0}

ac.each{|v,i|
    a=memo.keys
    
    a.each{|k|
        nk=k|i;
        memo[nk]||=10**9
        memo[nk] = [memo[k]+v, memo[nk]].min
    }
}

k12=(0...n).map{|x|1<<x}.reduce(:|) 
if memo[k12]
    print memo[k12]
else
    print -1
end

Measured memory_bytes: 5112
a = {}
for s in ["S", "H", "C", "D"]:
    a.update({f'{s} {i}': 0 for i in range(1, 14)})
n = int(input())
for _ in range(n):
    s = input()
    del a[s]
        
a = list(a)
for i in range(len(a)):
    print(a[i])
    

    
    


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

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

    int c[N];
    int t[N];
    for(int i=0; i<N; i++){
        cin >> c[i] >> t[i];
    }

    int s=T;
    int cost=1000;
    int tle=0;
    for(int i=0; i<N; i++){
        if(t[i]<=T){
            if(c[i]<=cost){
                s=t[i];
                cost=c[i];
            }
        }
        else if(t[i]>T){
            tle++;
        }
    }

    if(tle==N){
        cout << "TLE" << endl;
    }
    else{
        cout << cost << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
		int n;
		cin>>n;
		int a[n],b[n],flag=0;
		for(int i=0;i<n;i++)
		{
			cin>>a[i]>>b[i];
		}
		for(int i=0;i<n-2;i++)
		{
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2])
			{
				flag=1;
				break;
			}
		}
		if(flag==1)
		cout<<"Yes";
		else
		cout<<"No";
}

Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
using namespace std;

int main(){
  int N,ans;
  cin>>N;
  vector<pair<int,int>> AB;
  for(int i=0; i<N; ++i){
    int a,b;
    cin>>a>>b;
    AB.push_back(make_pair(b,a));
  }
  
  long long int time=0;
  sort(AB.begin(),AB.end());
  
  bool CAN=true;
  for(int i=0; i<N; ++i){
    time+=AB[i].second;
    if(time>AB[i].first){
      CAN=false;
      break;
    }
  }
  
  if(CAN) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int a,b;
    cin>>a>>b;
    a--; b--;
    cout<<a*b<<endl;
}

Measured memory_bytes: 3616
#include <stdio.h>

int main(void) {
	int kousaten[110];
	int a,b;
	int i;
	int kiten;
	while(1) {
		for(i=0;i<110;i++)kousaten[i]=0;
		if(scanf("%d %d",&a,&b)==-1)break;
		kousaten[a-1]++;
		kousaten[b-1]++;
		while(1) {
			scanf("%d %d",&a,&b);
			if(a==0 && b==0)break;
			kousaten[a-1]++;
			kousaten[b-1]++;
		}
		kiten=0;
		for(i=0;i<110;i++) {
			if(kousaten[i]%2)kiten++;
		}
		if(kiten==0)printf("NG\n");
		else if(kiten==2) {
			if(kousaten[0]%2 && kousaten[1]%2)printf("OK\n");
			else printf("NG\n");
		} else printf("NG\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>

int main() {

	int a, b;

	std::cin >> a >> b;

	if (a < b) {
		std::cout << "a < b"
			<< std::endl;
	}
	else if (a > b) {
		std::cout << "a > b"
			<< std::endl;
	}
	else{
		std::cout << "a == b"
			<< std::endl;
	}
		return 0;
}



Measured memory_bytes: 3080
n, m = map(int, input().split())
heights = list(map(int, input().split()))
looked = [True for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if heights[a] < heights[b]:
        looked[a] = False
    elif heights[a] > heights[b]:
        looked[b] = False
    else:
        looked[a] = False
        looked[b] = False

ans = 0
for i in looked:
    if i is True:
        ans += 1

print(ans)


Measured memory_bytes: 20120
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]

def count(n):
    A = [0]
    c = 0
    i = 1
    while(n):
        if n & 1:
            A.append(i)
            c += 1
        n >>= 1
        i += 1
    A.append(H)
    return c, A


ans = 2000
for n in range(1 << (H-1)):
    c, A = count(n)
    X = [0]*(len(A)-1)
    j = 0
    flag=True
    while j < W:
        for k in range(len(A)-1):
            for i in range(A[k], A[k+1]):
                if S[i][j] == "1":
                    X[k] += 1
        for x in X:
            if x > K:
                if flag:
                    c += 10000
                    break
                flag = True
                c += 1
                X = [0]*(len(A)-1)
                break
        else:
            flag = False
            j += 1
        if c > 10000:
            break
    ans = min(ans, c)
print(ans)


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

int main() {
	int n, k; 
	cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a, a + n);
	vector <int>  count;
	for (int i = 0; i < n;) {
		int item = a[i];
		int c = 0;
		while (i < n && item == a[i]) {
			++c;
			++i;
		}
		count.push_back(c);
	}
	if (count.size() <= k) {
		cout << 0;
	} else {
		sort(count.begin(), count.end());
		int size = count.size() - k;
		int minNumberOfBalls = 0;
		for (int i = 0; i < size; ++i) {
			minNumberOfBalls += count[i];
		}
		cout << minNumberOfBalls;
	}
	return 0;
}

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

int main()
{

	int A, B, C;
	bool flag = false;

	cin >> A >> B >> C;

	for (int i = 0; i < 100; i++) {
		if (A*i % B == C)
			flag = true;

		if (flag) {
			cout << "YES" << endl;
			return 0;
		}

	}

	cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
using System;

namespace C_sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split();

            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);

            if (a < b)
            {
                Console.WriteLine("a < b");
            }
            else if (a > b)
            {
                Console.WriteLine("a > b");
            }
            else
            {
                Console.WriteLine("a == b");
            }
        }
    }
}



Measured memory_bytes: 15940
#include <bits/stdc++.h>
#define INF 1e9
#define endl '\n'
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define FORE(i, a, b) for (int i = (a), e = (b); i < e; ++i)
#define RFORE(i, a, b) for (int i = (b)-1, e = (a); i >= e; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, M;
    cin >> N >> M;
    vector<int> c(N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        c.at(a - 1) += 1;
        c.at(b - 1) += 1;
    }
    for (int i = 0, e = N; i < e; i++) {
        cout << c.at(i) << endl;
    }
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long

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

  int x,y,z,K; cin >> x >> y >> z >> K;
  vector<int> a(x),b(y),c(z);
  for(int i = 0; i < x; i++) cin >> a[i];
  for(int i = 0; i < y; i++) cin >> b[i];
  for(int i = 0; i < z; i++) cin >> c[i];
  sort(a.rbegin(),a.rend());
  sort(b.rbegin(),b.rend());
  sort(c.rbegin(),c.rend());

  vector<int> ans;
  for(int i = 0; i < x; i++){
    for(int j = 0; j < y; j++){
      for(int k = 0; k < z; k++){
        if(i*j*k > K) break;
        ans.push_back(a[i]+b[j]+c[k]);
      }
    }
  }

  sort(ans.rbegin(),ans.rend());
  for(int i = 0; i < K; i++){
    cout << ans[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 35176
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string a, b, c; cin >> a >> b >> c;
	int now = 'a';
	while (true) {
		if (now == 'a') {
			if (a == "") {
				cout << "A" << endl; return 0;
			}
			now = a[0];
			a.erase(a.begin());
		}
		else if (now == 'b') {
			if (b == "") {
				cout << "B" << endl; return 0;
			}
			now = b[0]; b.erase(b.begin());
		}
		else {
			if (c == "") {
				cout << "C" << endl; return 0;
			}
			now = c[0]; c.erase(c.begin());
		}
	}
	return 0;
}

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

using namespace std;

typedef long long int lli;

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

    int n, d;

    cin >> n >> d;

    cout << n/(d*2+1) + ((n%(d*2+1)) ? 1 : 0) << endl;

    return 0;
}


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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1e9+7;
const int INF = 1<<18;
const lint INFLINT = 1LL<<60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

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(b<a){a=b;return true;}return false;}

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

// Final Weapon!
// #define int lint

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    rep(i, n) cin >> x[i];
    
    int mn = INF;
    for(int i = 1; i <= 100; i++) {
        int sum = 0;
        rep(j, n) {
            sum += pow(x[j] - i, 2);
        }
        if(mn > sum) {
            mn = sum;
        }
    }
    
    cout << mn;
    
    return 0;
}


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

int main() {
    int s[14], h[14], c[14], d[14], rank, i, num;
    char suit;

    for(i=0;i<14;i++){
        s[i]=0;
        h[i]=0;
        c[i]=0;
        d[i]=0;
    }

    cin >> num;
    for(i=0;i<num;i++){
        cin >> suit >> rank;
        switch(suit){
            case 'S':
                s[rank]=1;
                break;
            case 'H':
                h[rank]=1;
                break;
            case 'C':
                c[rank]=1;
                break;
            case 'D':
                d[rank]=1;
                break;
        }
    }
    for(i=1;i<14;i++){
        if(s[i]==0)
        cout << "S " << i << endl;
    }
    for(i=1;i<14;i++){
        if(h[i]==0)
        cout << "H " << i << endl;
    }
    for(i=1;i<14;i++){
        if(c[i]==0)
        cout << "C " << i << endl;
    }
    for(i=1;i<14;i++){
        if(d[i]==0)
        cout << "D " << i << endl;
    }
    return 0;
}


Measured memory_bytes: 3036
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, m, k, lab[MAXN];
vector<int> block[MAXN], a[MAXN];

int getRoot(int u) {
    while (lab[u] > 0) u = lab[u];
    return u;
}

void unionPair(int u, int v) {
    int x = lab[u] + lab[v];
    if (lab[u] < lab[v]) {
        lab[v] = u;
        lab[u] = x;
    }
    else {
        lab[u] = v;
        lab[v] = x;
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m >> k;
    FOR(i,1,n) lab[i] = -1;
    FOR(i,1,m) {
        int u, v;
        cin >> u >> v;
        a[u].push_back(v);
        a[v].push_back(u);
        u = getRoot(u);
        v = getRoot(v);
        if (u != v) unionPair(u, v);
    }
    FOR(i,1,k) {
        int u, v;
        cin >> u >> v;
        block[u].push_back(v);
        block[v].push_back(u);
    }
    FOR(i,1,n) {
        int u = getRoot(i);
        int res = -lab[u] - 1 - SZ(a[i]);
        FOR(j,0,SZ(block[i])-1) {
            int v = block[i][j];
            v = getRoot(v);
            if (v == u) res--;
        }
        cout << res << " ";
    }
    return 0;
}


Measured memory_bytes: 12280
#include <cstdio>
#include <algorithm>
#include <string>
#include <iostream>
#include <cstdlib>
using namespace std;
#define LL long long
const int N = 1010;
const char opt[] = {'L','R','D','U'};
pair<LL,LL>point[N];
int n;
string ans[N];
LL d[33];
inline int check(LL x,LL y,char opt,LL d){
	switch(opt){
		case 'R':
			return abs(x - d) + abs(y) <= d - 1;
		case 'L':
			return abs(x + d) + abs(y) <= d - 1;
		case 'U':
			return abs(x) + abs(y - d) <= d - 1;
		case 'D':
			return abs(x) + abs(y + d) <= d - 1; 
	}
}
inline void nxt(int& x,int& y,char opt,int d){
	switch(opt){
		case 'R':
			x -= d;break;
		case 'L':
			x += d;break;
		case 'U':
			y -= d;break;
		case 'D':
			y += d;break;
	}
}
int nowx,nowy;
int main(){
	scanf("%d",&n);
	int equal = 1;
	d[1] = 1;
	for(int i = 2;i <= 31;++i)d[i] = d[i - 1] << 1;
	for(int i = 1;i <= n;++i){
		scanf("%lld%lld",&point[i].first,&point[i].second);
		equal &= ((point[i].first + point[i].second) & 1) == ((point[1].first + point[1].second) & 1);
	}
	if(!equal)
		return puts("-1"),0;
	int k = 31;
	if((point[1].first + point[1].second) % 2 == 0){
		k++;
		d[32] = 1; 
		for(int i = 1;i <= n;++i)ans[i] = 'D' + ans[i],point[i].second++;
	}
	printf("%d\n",k);
	for(int i = 1;i <= k;++i)printf("%lld ",d[i]);
	puts("");
	for(int i = 1;i <= n;++i){
		nowx = point[i].first,nowy = point[i].second;
		for(int k = 31;k;--k){
			for(int j = 0;j < 4;++j)
			if(check(nowx,nowy,opt[j],d[k])){
				ans[i] = opt[j] + ans[i];
				nxt(nowx,nowy,opt[j],d[k]);
//				cout << ans[i] << endl;
				break;
			}
		}
		cout << ans[i] << '\n';
	}
	return 0;
}

Measured memory_bytes: 384
// 文字列変換等
fun main(args: Array<String>) {
    val inputs = readInputLine().split(" ").map { Integer.parseInt(it) }
    val x = inputs[0]
    val a = inputs[1]
    
    if (x < a) {
        println("0")
    } else {
        println("10")
    }
}
 
fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 37872
#include <iostream>
using namespace std;
typedef long long ll;

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

	ll *d = new ll [n*2];
	for(ll i = 0;i < n;i++){
		cin>>d[i];
		if(i != 0){
			d[i] += d[i-1];
		}
		d[i+n] = d[i];
	}
	for(ll i =0;i < n;i++){
		d[i+n] += d[n-1];
	}
	for(ll i =0;i < n*2;i++){
		//cout<<i<<"-"<<d[i]<<endl;
	}
	ll max_min = 0;
	ll l = 0,c = 0,r = 0;
	while(l < n){
		while(d[c] - d[l] < d[n-1]/3) c++;
		c--;
		for(r = c+1 ;r < n+l;r++){
			ll cr = d[r] - d[c];
			ll rl = d[n+l] - d[r];
			ll m = d[c]-d[l];
			if(m >= cr) m = cr;
			if(m >= rl) m = rl;
		//	cout<<l<<","<<c<<","<<r<<","<<n+l<<"-"<<d[c]-d[l]<<","<<cr<<","<<rl<<endl;
			if(m > max_min){
				max_min = m;
			}
		}
		l++;
	}
	cout<<max_min<<endl;

	delete [] d;
	return 0;
}

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



int main(){
  string s;
  cin >> s;
  bool ok=false;
  int n=s.size();
  string key="keyence";
  if(s==key){
    cout << "YES" << endl;
    return 0;
  }

  for(int i=0;i<n;++i){
    for(int j=i;j<n;++j){
      string ss="";
      for(int k=0;k<n;++k){
        if(i<=k & k<=j){
          continue;
        }else{
          ss.push_back(s[k]);
        }
      }
      if(ss==key){
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	map<string, bool>mp;
	int ans = 0;
	REP(i, N) {
		string S;
		cin >> S;
		if (!mp[S]) {
			ans++;
			mp[S] = 1;
		}
	}

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



Measured memory_bytes: 19180
program main
	implicit none
    !character(4)::s
    integer::a,b,c,d,n
    read(*,*) n
    a=n/1000
    b=(n-a*1000)/100
    c=(n-a*1000 - b*100)/10
    d=(n-a*1000 -b*100 -c*10)
    if(a+b+c+d==7)then
    	write(*,'(i1,"+",i1,"+",i1,"+",i1,"=7")') a,b,c,d
    else if(a+b+c-d==7)then
    	write(*,'(i1,"+",i1,"+",i1,"-",i1,"=7")') a,b,c,d
    else if(a+b-c+d==7)then
    	write(*,'(i1,"+",i1,"-",i1,"+",i1,"=7")') a,b,c,d
    else if(a-b+c+d==7)then
    	write(*,'(i1,"-",i1,"+",i1,"+",i1,"=7")') a,b,c,d
    else if(a+b-c-d==7)then
    	write(*,'(i1,"+",i1,"-",i1,"-",i1,"=7")') a,b,c,d
    else if(a-b+c-d==7)then
    	write(*,'(i1,"-",i1,"+",i1,"-",i1,"=7")') a,b,c,d
    else if(a-b-c+d==7)then
    	write(*,'(i1,"-",i1,"-",i1,"+",i1,"=7")') a,b,c,d
    else
    	write(*,'(i1,"-",i1,"-",i1,"-",i1,"=7")') a,b,c,d
    end if
    stop
end program main

Measured memory_bytes: 2816
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    vector<int> vs(3);
    for (auto& v : vs)
    {
        cin >> v;
    }
    sort(vs.begin(), vs.end());
    int ans = vs[2] * 10 + vs[1] + vs[0];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

typedef struct pair* ppair;

typedef struct pair {
  int first, second;
} pair;


int size;
pair v[1000000];
int psize;
int preorder[1000000];

void swap(ppair a, ppair b) {
  pair t = *a;
  *a = *b;
  *b = t;
}

int getp(int begin, int end) {
  int i;
  int p = begin;
  for(i = begin+1; i < end; ++i) {
    if(v[i].first < v[p].first) {
      p = i;
    }
  }
  swap(&v[end-1], &v[p]);
  return end-1;
}

void qsort(int begin, int end) {
  int i, j;
  if(begin >= end) return;
  getp(begin,end);
  preorder[psize++] = v[end-1].second;
  if(begin+1 == end) return;
  for(i = begin, j = begin; i < end; ++i) {
    if(v[i].second < v[end-1].second) {
      swap(&v[i], &v[j++]);
    }
  }
  swap(&v[j],&v[end-1]);
  qsort(begin, j);
  qsort(j+1, end);
}

int main() {
  int i, j;
  int n, k;
  char s[100];
  size = 0;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    scanf("%s", s);
    if(s[0] == 'i') {
      scanf("%d", &k);
      v[size++] = (pair){i,k};
    } else {
      psize = 0;
      qsort(0, size);
      for(j = 0; j < size; ++j) {
        printf(" %d", v[j].second);
      }
      printf("\n");
      for(j = 0; j < size; ++j) {
        printf(" %d", preorder[j]);
      }
      printf("\n");
    }
  }
  return 0;
}

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

using namespace std;

int getSumOfDigits(int n) {
  int sum = 0;

  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }

  return sum;
}

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

  int minimum = 1 << 30;
  for (int a = 1; a < N; a++) {
    minimum = min(minimum, getSumOfDigits(a) + getSumOfDigits(N - a));
  }

  cout << minimum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> maxBetween(n - 1);
  vector<int> maxPossible(n);
  
  for(auto &i : maxBetween)
    cin >> i;
  
  maxPossible[0] = maxPossible[1] = maxBetween[0];
  
  for(int i = 1; i < n - 1; i++){
    if(maxPossible[i] > maxBetween[i])
      maxPossible[i] = maxBetween[i];
    
    maxPossible[i + 1] = maxBetween[i];
  }
  
  int sum = 0;
  for(auto &i : maxPossible)
    sum += i;
  cout << sum << '\n';
  return 0;
}

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

int main(){
    int n;
    cin>>n;
    char s[n];
    int cnt=0;
    int ans=0;
    rep(i,n) {
        cin>>s[i];
        if(s[i]=='I'){
            ++cnt;
        }
        else{
            --cnt;
        }
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  int min,max;
  if(a <= b && a <= c) min = a;
  else if(b <= a && b <= c) min = b;
  else if(c <= a && c <= c) min = c;
  if(a >= b && a >= c) max = a;
  else if(b >= a && b >= c) max = b;
  else if(c >= a && c >= c) max = c;
  cout << max - min << endl;
  return 0;
}


Measured memory_bytes: 256
N=input()
K=int(input())
m=len(N)
 
dp0=[[0]*(m+1) for _ in range(m+1)]
dp1=[[0]*(m+1) for _ in range(m+1)]
dp1[0][0]=1
for i in range(1,m+1):
    dp0[i][0]=1
    
for i in range(m):
    for j in range(m):
        if N[i]=='0':
            dp0[i+1][j+1]=dp0[i][j]*9 + dp0[i][j+1]
            dp1[i+1][j+1]=dp1[i][j+1]
        else:
            dp0[i+1][j+1]=dp0[i][j]*9 + dp0[i][j+1]+dp1[i][j]*(int(N[i])-1)+dp1[i][j+1]
            dp1[i+1][j+1]=dp1[i][j]
if m<K:
  print(0)
else:
  print(dp0[-1][K]+dp1[-1][K])

Measured memory_bytes: 43248