akhauriyash/Code-Regression huggingface dataset:
#include<stack>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
LL A[200111];

LL r_cst[200111];
LL l_cst[200111];

int cmp(LL x, LL xp, LL y, LL yp) {
    LL g = min(xp, yp);
    xp -= g;
    yp -= g;
    if (xp > 32) return 1;
    if (yp > 32) return -1;
    x <<= xp;
    y <<= yp;
    if (x > y) return 1;
    if (x == y) return 0;
    return -1;
}

struct Data {
    int len;
    LL s, sp;
    LL l, lp;
    Data(){};
    Data(int len_, LL s_, LL sp_, LL l_, LL lp_) {
	len = len_;
	s = s_;
	sp = sp_;
	l = l_;
	lp = lp_;
    }
};

void R() {
    stack<Data> st;
    st.emplace(1, A[N-1], 0, A[N-1], 0);

    for (int i=N-2; i>=0; i--) {
	LL cst = r_cst[i+1];
	Data d(1, A[i], 0, A[i], 0);

	while (!st.empty()) {
	    Data x = st.top();
	    if (cmp(d.l, d.lp, x.s, x.sp) > 0) {
		st.pop();
		int up = 2;
		while (cmp(d.l, d.lp, x.s, x.sp + up) > 0) {
		    up += 2;
		}
		cst += x.len * up;

		d = Data(d.len + x.len, d.s, d.sp, x.l, x.lp + up);
	    } else {
		break;
	    }
	}

	st.push(d);
	r_cst[i] = cst;
    }
}

void L() {
    stack<Data> st;
    st.emplace(1, A[0], 1, A[0], 1);
    l_cst[1] = 1;

    for (int i=1; i<N; i++) {
	LL cst = l_cst[i] + 1;
	Data d(1, A[i], 1, A[i], 1);
	while (!st.empty()) {
	    Data x = st.top();
	    if (cmp(d.l, d.lp, x.s, x.sp) > 0) {
		st.pop();
		int up = 2;
		while (cmp(d.l, d.lp, x.s, x.sp + up) > 0) {
		    up += 2;
		}
		cst += x.len * up;

		d = Data(d.len + x.len, d.s, d.sp, x.l, x.lp + up);
	    } else {
		break;
	    }
	}
	st.push(d);
	l_cst[i+1] = cst;
    }
}

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%lld", A+i);



    R();
    L();

//    rprintf("%lld", r_cst, r_cst + N);
//    rprintf("%lld", l_cst, l_cst + N + 1);

    LL ans = r_cst[0];
    REP (i, N+1) amin(ans, l_cst[i] + r_cst[i]);
    printf("%lld\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 13200
let s = stdin.ReadLine()

let paturn1 = seq{0..s.Length-1} |> Seq.mapi (fun i x -> if i%2=0 then '0' else '1') |> Seq.toArray
let paturn2 = seq{0..s.Length-1} |> Seq.mapi (fun i x -> if i%2=0 then '1' else '0') |> Seq.toArray

let compare (paturn: char[]) =
    s.ToCharArray() |> Seq.zip (paturn) |> Seq.fold (fun count (x,y) ->if x<>y then count+1 else count ) 0

min (compare paturn1) (compare paturn2) |> stdout.WriteLine


Measured memory_bytes: 19520
#include <bits/stdc++.h>
#define int long long 
using namespace std;
const int mod=1e9+7ll;

int n,a,b,ans1,ans2,ans3,ans;

inline int ksm(int x,int y)
{
	int ret=1ll;
	while(y)
	{
		if(y&1) ret=ret*x%mod;
		x=x*x%mod;
		y>>=1ll;
	}
	return ret;
}

inline int qpow(int a,int b)
{
    if(b==1) return a;
    int t=qpow(a,b/2);
    t=t*t%mod;
    if(b&1ll) t=t*a%mod;
    return t;
}

inline int C(int n,int m)
{
    if(n<m) return 0;
    if(m>n-m) m=n-m;
    int a=1,b=1;
    for(int i=0;i<m;i++)
	{
        a=(a*(n-i))%mod;
        b=(b*(i+1))%mod;
    }
    return a*qpow(b,mod-2ll)%mod;
}

inline int Lucas(int n,int m)
{
    if(!m) return 1ll;
    return Lucas(n/mod,m/mod)*C(n%mod,m%mod)%mod;
}

signed main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	ans1=ksm(2ll,n); 
	ans2=Lucas(n,a);
	ans3=Lucas(n,b);
	ans=((ans1-ans2-ans3-1ll)%mod+mod)%mod;
	printf("%lld\n",ans); 
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i = n;i >= 0;--i)
#define FOR(i,m,n) for(int i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

int main(void)
{
    int n;
    string s;
    cin >> n >> s;
    int ans = 1;


    FOR(i,1,n){
        if(s[i-1] != s[i]){
            ans++;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll i,j,n,m,w,ans,p[109],wt[109],dp[100009][109];
ll func(ll w,ll i)
{
    if(dp[w][i]!=-1) return dp[w][i];
    if(i==n) return 0;
    if(w>=wt[i])
        dp[w][i]=max(p[i]+func(w-wt[i],i+1),func(w,i+1));
    else
        dp[w][i]=func(w,i+1);

    return dp[w][i];
}
int main()
{
  ios_base::sync_with_stdio(false),cin.tie(0);
  cin>>n>>w;
  for(i=0;i<n;i++)
    cin>>wt[i]>>p[i];
  memset(dp,-1,sizeof(dp));
  ans=func(w,0);
  cout<<ans<<endl;
}


Measured memory_bytes: 85376
#include <iostream>

using namespace std;

int main()
{
  int h,n,sum,x;
  cin>>h>>n;
  sum=0;
  while (n>0){
    cin>>x;
    sum+=x;

     n--;
  }
    if (sum>=h){
        cout<<"Yes";
    }
    else if (sum<h){
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,ans=0,tmp;
  cin >> n;
  long long a[n-1],b[n-1],c[n-1];
  for(int i=0;i<n-1;i++){
    cin >> a[i] >> b[i] >> c[i];
  }
  for(int i=0;i<n-1;i++){
    ans=b[i];
    ans+=a[i];
    for(int j=i+1;j<n-1;j++){
      if(ans<=b[j]){
        ans=b[j];
      }else{
        tmp=b[j];
        while(1){
          tmp+=c[j];
          if(ans<=tmp){
            ans=tmp;
            break;
          }
        }
      }
      ans+=a[j];
    }
    cout << ans << endl;
  }
  cout << 0 << endl;
  return 0;
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

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

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    ll N, K;
    cin >> N >> K;

    ll ans = K;
    for (ll i = 1; i < N; i++) {
        ans *= (K - 1);
    }

    cout << ans << endl;

    return 0;
}

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

static long long int MOD = 1000000007;

int main()
{
    unsigned long long int n, i, ans = 1;
    cin >> n;
    for (i = 2; i <= n; i++)
        ans = ans * i % MOD;
    cout << ans << endl;
}

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

using namespace std;

int n;
int a[10000];

int main() {
    int count = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int j = 0; j < n; ++j) {
        while (a[j] % 2 == 0) {
            a[j] /= 2;
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {


    public static void main(String[] args) {
        new Main().execute();
    }

    private static final char BASE = '0';

    public void execute() {
        Scanner sc = new Scanner(System.in);
        final String S = sc.nextLine();
        System.out.println(dfs(S, 0,0));
        sc.close();

    }

    private long dfs(String S,long current, int pos) {
        current = current * 10 + (long) (S.charAt(pos) - BASE);
        if (pos == S.length() - 1) {
//            System.out.println(current);
            return current;
        }
        int depth = (S.length() - pos -2);
        long a = (current << depth) + dfs(S, 0, pos + 1);
        long b =  dfs(S, current, pos + 1);
        return a + b;

    }
}

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

int main()
{
    string s, t;
    cin >> s >> t;
    
    int a = stoi(s + t);

    for (int i = 0; i < 1001; i++) {
        if (i * i == a) return cout << "Yes" << endl, 0;
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int n;

int main() {
    while(1) {
        cin >> n;
        if(n == 0) break;
        int l = 0, r = 0;
        int now = 0;
        int cnt = 0;
        for(int i = 0; i < n; ++i) {
            string s; cin >> s;
            if(s[0] == 'l') {
                if(s[1] == 'u') {
                    if(now == 0) {
                        if(r == 1) {
                            cnt++;
                            now = 1;
                        }
                    }
                    l = 1;
                }else {
                    if(now == 1) {
                        if(r == 0) {
                            cnt++;
                            now = 0;
                        }
                    }
                    l = 0;
                }
            }else {
                if(s[1] == 'u') {
                    if(now == 0) {
                        if(l == 1) {
                            cnt++;
                            now = 1;
                        }
                    }
                    r = 1;
                }else {
                    if(now == 1) {
                        if(l == 0) {
                            cnt++;
                            now = 0;
                        }
                    }
                    r = 0;
                }
            }
        }
        cout << cnt << endl;
    }
}


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

int main() {
  int N;
  cin >> N;
  cout << (N + 1) / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
/*
13:11 - 
 */

#include<algorithm>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#include<climits>
#include<cassert>
#include<deque>

#define MAX 20010
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)

using namespace std;

struct Point{
  int x,y;
  char c;
  Point(int x=IINF,int y=IINF,char c='$'):x(x),y(y),c(c){}
  bool operator < (const Point& a)const{
    return ( (x!=a.x) ? (x < a.x) : (y < a.y) );
  }
};

int n;
vector<int> G[MAX];
char color[MAX];

inline void makeGraph(const vector<Point>& vec,map<Point,int>& Index){
  rep(i,n)G[i].clear();
  rep(i,vec.size()){
    Point p1 = vec[i];
    Point p2 = p1;
    assert(Index.find(vec[i]) != Index.end());
    int cur = Index[vec[i]];
    if(p1.c == 'x')p2.x++;
    else if(p1.c == 'y')p2.y++;
    else assert(false);
    //cout << "Futon( (" << p1.x << "," << p1.y << ") , (" << p2.x << "," << p2.y << ") )" << endl;

    for(int y=p1.y-1;y<=p2.y+1;y++){
      for(int x=p1.x-1;x<=p2.x+1;x++){
	if(x == p1.x-1 && y == p1.y-1)continue;
	if(x == p2.x+1 && y == p1.y-1)continue;
	if(x == p1.x-1 && y == p2.y+1)continue;
	if(x == p2.x+1 && y == p2.y+1)continue;
	//cout << "check => (" << x << "," << y << ")" << endl;
	if(Index.find(Point(x,y)) != Index.end()){

	  int next = Index[Point(x,y)];
	  if(cur == next)continue;

	  G[cur].push_back(next);
	}
      }
    }
  }

  rep(i,n){
    sort(G[i].begin(),G[i].end());
    G[i].erase(unique(G[i].begin(),G[i].end()),G[i].end());
  }
}

bool dfs(int cur,char c){
  color[cur] = c;
  char rec = ((c == 'w')?'b':'w');
  for(int i=0;i<G[cur].size();i++){
    if(color[G[cur][i]] == c)return false;
    if(color[G[cur][i]] == 'x' && !dfs(G[cur][i],rec))return false;
  }
  return true;
}

int main(){

  while(cin >> n,n){
    // out = false;
    map<Point,int> Index;
    vector<Point> input;
    int dex = 0;
    for(int i=0;i<n;i++){
      int x,y;
      char c;
      cin >> x >> y >> c;
      Point p;
      if(c == 'x'){
	p = Point(x+1,y);
      } else {
	p = Point(x,y+1);
      }
      input.push_back(Point(x,y,c));
      Index[Point(x,y)] = Index[p]= dex++;
      color[i] = 'x';
    }
    assert(dex == n);
    makeGraph(input,Index);

    for(int i=0;i<n;i++){
      if(color[i] == 'x'){
	if(!dfs(i,'w')){
	  cout << "No" << endl;
	  goto Fin;
	}
      }
    }
    cout << "Yes" << endl;
  Fin:;


  }
  return 0;
}

Measured memory_bytes: 6192
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	int i, n; 
	double x = 100000;
	scanf("%d", &n);
	for(i = 1; i <= n; i++){
		x = x * 1.05;
		if((int)x % 1000 != 0){
			x = 1000 * floor(x/1000 + 1);
		}
	}
	i = (int)x;
	printf("%d\n", i);

	return 0;
}

Measured memory_bytes: 592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
 
    /**
     * @param args
     */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		int[]	r = parseRange();
		System.out.printf("%.6f\n", (double)(r[0] * r[1]) / 3.305785);
	}

	private static int[] parseRange() {
		int[]	params = new int[2];
		String	strin  = null;

		if ((strin = parseStdin()) != null) {
			String[]	lines = strin.split(" ");
			params[0] = Integer.parseInt(lines[0]);
			params[1] = Integer.parseInt(lines[1]);
		}
 
		return params;
	}

	private static String parseStdin() {
        String  stdin = null;
        
        try {
        	String  tmp = br.readLine();
        	if (!tmp.isEmpty()) stdin = tmp;
        }
        catch (IOException e) {}
 
        return stdin;
	}
}

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

#define ll  long long

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

    int n;vector<int> arr;
    cin>>n;
    int tot=0;
    for(int i=0;i<n;i++){
        int t=0;
        cin>>t;
        arr.push_back(t);
        tot+=t;
    }
    int p =tot/n;
    int ans1 =0,ans2=0;
    for(int i=0;i<n;i++){
        ans1+=(arr[i]-p)*(arr[i]-p);
        ans2+=(arr[i]-p-1)*(arr[i]-p-1);

    }
    
    
    cout<<min(ans1,ans2)<<endl;
    
    return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
p = []
z = []
m = []
for i in range(n):
    if a[i] > 0:
        p.append(a[i])
    elif a[i] == 0:
        z.append(a[i])
    else:
        m.append(a[i])
nb1 = -10**18-1
nb2 = 10**18+1
p1 = len(p)
z1 = len(z)
m1 = len(m)
#print(p,m)
#print(p1,z1,m1)
def sytr(x,p,z,m,p1,z1,m1):
    ans = 0
    ans2 = 0
    ans3 = -10**18
    if x > 0:
        m.sort(reverse=True)
        p.sort()
        ans += p1*m1 + (p1+m1)*z1 + (z1-1)*z1//2
        ans2 += ans
        now = 0
        #print(p)
        now1 = p1-1
        now2 = 0
        now3 = p1-1
        if p1 > 1:
            while now < now1:
                if p[now]*p[now1] > x:
                    now1 -= 1
                else:
                    ans3 = max(ans3,p[now]*p[now1])
                    ans += now1-now
                    now += 1
            while now2 < now3:
                if p[now2]*p[now3] >= x:
                    now3 -= 1
                else:
                    ans2 += now3 - now2
                    now2 += 1
        if m1 > 1:
            now = 0
            now1 = m1-1
            now2 = 0
            now3 = m1-1
            while now < now1:
                if m[now]*m[now1] > x:
                    now1 -= 1
                else:
                    ans3 = max(ans3,m[now]*m[now1])
                    ans += now1 - now
                    now += 1
            while now2 < now3:
                if m[now2]*m[now3] >= x:
                    now3 -= 1
                else:
                    ans2 += now3 - now2
                    now2 += 1
    elif x == 0:
        p.sort()
        m.sort()
        if p1 > 0 and m1 > 0:
            ans3 = p[0]*m[m1-1]
        if z1 > 0:
            ans3 = 0
        ans += p1*m1+1
        ans2 += (p1+m1)*z1 + ans - 1
        if z1 > 1:
            ans2 += z1*(z1-1)//2
    else:
        p.sort(reverse=True)
        m.sort()
        now = 0
        now1 = m1-1
        now2 = 0
        now3 = m1-1
        if p1 > 0 and m1 > 0:
            while now < p1 and now1 >= 0:
                if p[now]*m[now1] > x:
                    now1 -= 1
                else:
                    ans3 = max(ans3,p[now]*m[now1])
                    ans += now1+1
                    now += 1
            while now2 < p1 and now3 >= 0:
                if p[now2]*m[now3] >= x:
                    now3 -= 1
                else:
                    ans2 += now3+1
                    now2 += 1
    return [ans,ans2,ans3]
while nb1 + 1 < nb2:
    #print(nb1,nb2)
    x = (nb1+nb2)//2
    #print(sytr(x,p,z,m,p1,z1,m1))
    if max(sytr(x,p,z,m,p1,z1,m1)[0],sytr(x,p,z,m,p1,z1,m1)[1]) < k:
        nb1 = x
    elif min(sytr(x,p,z,m,p1,z1,m1)[0],sytr(x,p,z,m,p1,z1,m1)[1]) > k:
        nb2 = x
    else:
        if abs(sytr(x,p,z,m,p1,z1,m1)[1]-sytr(x,p,z,m,p1,z1,m1)[0]) == 0:
            x = sytr(x,p,z,m,p1,z1,m1)[2]
            break
        else:
            break
print(x)

Measured memory_bytes: 97236
n,m,x=map(int,input().split())
ans=999999999999999999
a=[0]*n
for i in range(n):
  a[i]=list(map(int,input().split()))
for i in range(2**n):
  t=[0]*m
  temp=0
  for j in range(n):
    if (i>>j)&1:
      temp=temp+a[j][0]
      for k in range(m):
        t[k]=t[k]+a[j][k+1]
  if min(t)>=x:
    ans=min(ans,temp)
if ans==999999999999999999:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 9256
#!/usr/bin/env python
import bisect
from collections import defaultdict
import math

def main():
    N, M = map(int, input().split())

    clusters = []
    index = {}
    for _ in range(M):
        x, y, z = map(int, input().split())
        if x in index and y in index:
            cx = index[x]
            cy = index[y]
            if cx != cy:
                for a in clusters[cy]:
                    index[a] = cx
                    clusters[cx].add(a)
                clusters[cy] = None
        else:
            for a, b in [(x, y), (y, x)]:
                if a in index:
                    c = index[a]
                    index[b] = c
                    clusters[c].add(b)

            if not x in index and not y in index:
                new_c = len(clusters)
                for a in [x, y]:
                    index[a] = new_c
                clusters.append(set([x, y]))

    num = N - len(index) + len([c for c in clusters if c])
    print(num)

if __name__ == '__main__':
    main()


Measured memory_bytes: 36800
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double lb;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)

ll f(ll H){
    if(H == 1){
        return 1;
    }
    return 2*f(floor(H/2))+1;
}

int main() {
    ll H;
    cin >> H;
    cout << f(H) << endl;
}


Measured memory_bytes: 256
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int A=sc.nextInt(),B=sc.nextInt();
    if((A+B)%2==0)
      System.out.println((A+B)/2);
    else
      System.out.println("IMPOSSIBLE");
  }
}

Measured memory_bytes: 23764
using System;
class p
{
  static void Main()
  {
    string A = Console.ReadLine();
    string B = Console.ReadLine();
    string C = Console.ReadLine();
    
    char next = 'A';
    int n = A.Length + B.Length + C.Length;
    for (int i = 0; i < n; i++) {
      if (next == 'A') {
        if (A.Length <= 0) { break; }
        next = (A[0] == 'a' ? 'A' : (A[0] == 'b' ? 'B' : 'C'));
        A = A.Remove(0, 1);
      } else if (next == 'B') {
        if (B.Length <= 0) { break; }
        next = (B[0] == 'a' ? 'A' : (B[0] == 'b' ? 'B' : 'C'));
        B = B.Remove(0, 1);
      } else {
        if (C.Length <= 0) { break; }
        next = (C[0] == 'a' ? 'A' : (C[0] == 'b' ? 'B' : 'C'));
        C = C.Remove(0, 1);
      }
    }
    Console.WriteLine(next);
  }
}

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

int main(){
    string a,b,c;
    cin>>a>>b>>c;
    string ans="";
    ans+=a[0]-'a'+'A';
    ans+=b[0]-'a'+'A';
    ans+=c[0]-'a'+'A';
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

using ll = long long int;
using vi = vector<int>;
#define f(n) for(int i = 0; i < n; i++)
#define fj(n) for(int j = 0; j < n; j++)
#define fk(n) for(int k = 0; k < n; k++)
#define ci(n) cin >> n;
#define ic(n) int n; cin >> n;
#define lc(n) int n; cin >> n;
#define all(a) a.begin(), a.end()
#define pri(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << "\n";
#define scl(a, n) ll a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define pb push_back
#define sc(a, n) int a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define eb emplace_back
#define ft first
#define int long long
void prip(int a[], int n){f(n) cout << a[i] << ' '; cout << '\n';}


const int mod = 1e9 + 7, inf = 2e9;
bool cmp(int a, int b)
{
    return abs(a) > abs(b);
}
int bp(int a, int n)
{
    if(n == 0) return 1;
    if(n & 1ll) return (a * bp(a, n - 1)) % mod;
    int res = bp(a, n >> 1);
    return (res * res) % mod;
}
main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ic(n)
    ic(k)
    sc(a, n)
    vector<int> ps, ng, b;
    int amz = 0;
    f(n)
    {
        if(a[i] > 0) ps.pb(a[i]), b.pb(a[i]);
        else if(a[i] < 0) ng.pb(-a[i]), b.pb(a[i]);
        else amz++;
    }
    sort(all(ps)), sort(all(ng));
    reverse(all(ps)), reverse(all(ng));
    if(ps.empty())
    {
        if(k > ng.size())
        {
            cout << 0;
            return 0;
        }
        if(k & 1)
        {
            if(amz) cout << 0;
            else
            {
                int ans = 1;
                reverse(all(ng));
                f(k) ans = (ans * ng[i]) % mod;
                cout << mod - ans;
            }
        }
        else
        {
            int ans = 1;
            f(k) ans = (ans * ng[i]) % mod;
            cout << ans;
        }
        return 0;
    }
    if(ps.size() + (ng.size() ^ (ng.size() & 1)) < k)
    {
        if(amz) cout << 0;
        else
        {
            int ans = 1;
            f(n) ans = (ans * abs(a[i])) % mod;
            if(ng.size() & 1) cout << mod - ans;
            else cout << ans;
        }
        return 0;
    }

    sort(all(b), cmp);
    int ans = 1, mp = inf, mn = inf, mxp = 0, mxn = 0, am = 0;
    f(k)
    {
        ans = (ans * abs(b[i])) % mod;
        if(b[i] > 0) mp = min(mp, b[i]);
        else mn = min(mn, -b[i]), am++;
    }
    for(int i = k; i < b.size(); i++)
    {
        if(b[i] > 0) mxp = max(mxp, b[i]);
        else mxn = max(mxn, -b[i]);
    }
    if(am % 2 == 0)
    {
        cout << ans;
        return 0;
    }
    vector<int> p, q;
    if(mxp > 0 && mn < inf) p.pb(mxp), q.pb(mn);
    if(mxn > 0 && mp < inf) p.pb(mxn), q.pb(mp);
    if(p.size() == 1)
    {
        cout << (((ans * p[0]) % mod) * bp(q[0], mod - 2)) % mod;
    }
    else if(p[0] * q[1] >= p[1] * q[0]) cout << (((ans * p[0]) % mod) * bp(q[0], mod - 2)) % mod;
    else cout << (((ans * p[1]) % mod) * bp(q[1], mod - 2)) % mod;
}


Measured memory_bytes: 8948
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
using ll=long long;
using pint=pair<int,int>;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define el '\n'
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define ceil_div(a,b) ((a+(b-1))/b)
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl
#define $in(v,n) ;rep(II,0,n)cin>>v[II]
inline void IN(void){return;}
template<typename F,typename... R>inline void IN(F& f, R&... r){cin>>f;IN(r...);}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}


struct UnionFind {
    vector<int> data;
    UnionFind(int size = 0) : data(size, -1) {}
    int root(int x) {
        if(data[x] < 0) return x;
        return data[x] = root(data[x]);
    }
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if(x == y) return false;
        if(data[x] > data[y]) swap(x, y);
        data[x] += data[y]; data[y] = x;
        return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -data[root(x)]; }
};

int main(){
    int n, m; IN(n, m);
    UnionFind UF(n);
    rep(_, 0, m){
        int a, b; IN(a, b); a--; b--;
        UF.unite(a, b);
    }

    int ans = 0;
    rep(i, 1, n){
        if(!UF.same(i, i-1)){
            ans++;
            UF.unite(i, i-1);
        }
    }

    cout << ans << el;
    return 0;
}


Measured memory_bytes: 3232
def main():
    N = int(input())
    A = [[int(i) for i in input().split()] for j in range(2)]
    ans = 0
    for i in range(N):
        cur = 0
        for j in range(i, N):
            cur = sum(A[0][:i+1]) + sum(A[1][i:])
        ans = max(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 40432
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end


d,n=gi
if n == 100
  puts (100**d)*(n+1)
else
  puts (100**d)*(n)

end


Measured memory_bytes: 4348
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]

    return (s, )


def solve(s, ):
    
    return s[:3]
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 61988
from collections import defaultdict
def main():
    def factorization(num):
        result = []
        count = 0
        temp = num
        for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.append([i, count])
        if temp != 1:
            result.append([int(temp), 1])
        if result == []:
            result.append([num, 1])
        return result
    n = int(input())
    d = defaultdict(int)
    mod = 1000000007
    if n == 1:
        print(1)
        exit()
    for i in range(2, n + 1):
        res = factorization(i)
        for (f, v) in res:
            d[f] += v
    ans = 1
    for v in d.values():
        ans = ans * (v + 1) % mod
    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 41820
//
// Created on 2020/06/14.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int n;
    cin>>n;
    vector<int>A(n);
    vector<int>list(1000005,0);
    for (int i = 0; i < n; ++i) {
        int a;
        cin>>a;
        A[i] = a;
        list[a] ++;
        if(list[a] > 1) continue;
        for (int j = a + a; j < list.size(); j = j + a) {
            list[j] ++;
        }
    }
    int ans = 0;
    for (int j = 0; j < n; ++j) {
        if(list[A[j]] == 1){
            ans ++;
        }
    }

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


Measured memory_bytes: 7944
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
String s=sc.next();
int c=0;
    for (char i = 'a'; i <= 'z'; i++) {
        if(!(s.contains(Character.toString(i)))){
            out.println(i);break;
        }else{c++;}
    }
if(c==26)out.println("None");
}
}

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

int main(){
  long long ans=0,n,array[100000];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>array[i];
  }
  sort(array,array+n);
  for(int i=0;i<n;i++){
    int c=1;
    if(i!=n-1){
      while(array[i]==array[i+1]){
      i++;
      c++;
      }
    }
    ans+=(c%2?1:0);
  }
  cout<<ans<<endl;
}
    
    

Measured memory_bytes: 1024
#include <stdio.h>

int fibonacci(int);
int F[45];

int main() {

  int n;

  scanf("%d",&n);
  
  printf("%d\n",fibonacci(n));
  return 0;
}


int fibonacci(int n)
{
  if(n == 0 || n == 1)
    return F[n] = 1;
  if(F[n] > 0)
    return F[n];
  else
    return F[n] = fibonacci(n - 2) + fibonacci(n - 1);
}



Measured memory_bytes: 2104
#include<stdio.h>
int gcd(long long a,long long b);
int main(void){
	long long a,b,ans;
	scanf("%lld %lld",&a,&b);
	if(a>b) ans=gcd(a,b);
	else ans=gcd(b,a);
	printf("%lld\n",ans);
	return 0;
}

int gcd(long long a,long long b){
	long long temp;

    if(a<b){ 
		temp=a;
		a=b;
		b=temp;
	}
    if(b<1) return -1;

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

Measured memory_bytes: 596
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    fp(s.substr(5,2) <= "04","Heisei","TBD");
    return 0;
}

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

vector<ll> even;
ll even_d[2];
ll even_n[2];
vector<ll> odd;
ll odd_d[2];
ll odd_n[2];

int main()
{
  ll n;
  cin >> n;
  rep(n/2){
    ll tmp;
    cin >> tmp;
    odd.push_back(tmp);
    cin >> tmp;
    even.push_back(tmp);
  }
  sort(odd.begin(),odd.end());
  sort(even.begin(),even.end());

  even_n[0] = 0;
  even_n[1] = 0;
  ll tmp = 0;
  ll cnt = 0;
  for (ll i = 0; i < n/2; i++)
  {
    if(even[i]==tmp){
      cnt++;
    } else {
      if(even_n[0]<cnt){
        even_n[1] = even_n[0];
        even_d[1] = even_d[0];
        even_n[0] = cnt;
        even_d[0] = tmp;
      } else if(even_n[1] < cnt) {
        even_n[1] = cnt;
        even_d[1] = tmp;
      }
      tmp = even[i];
      cnt = 1;
    }
  }
  if(even_n[0]<cnt){
    even_n[1] = even_n[0];
    even_d[1] = even_d[0];
    even_n[0] = cnt;
    even_d[0] = tmp;
  } else if(even_n[1] < cnt) {
    even_n[1] = cnt;
    even_d[1] = tmp;
  }


  odd_n[0] = 0;
  odd_n[1] = 0;
  tmp = 0;
  cnt = 0;
  for (ll i = 0; i < n/2; i++)
  {
    if(odd[i]==tmp){
      cnt++;
    } else {
      if(odd_n[0]<cnt){
        odd_n[1] = odd_n[0];
        odd_d[1] = odd_d[0];
        odd_n[0] = cnt;
        odd_d[0] = tmp;
      } else if(odd_n[1] < cnt) {
        odd_n[1] = cnt;
        odd_d[1] = tmp;
      }
      tmp = odd[i];
      cnt = 1;
    }
  }

  if(odd_n[0]<cnt){
    odd_n[1] = odd_n[0];
    odd_d[1] = odd_d[0];
    odd_n[0] = cnt;
    odd_d[0] = tmp;
  } else if(odd_n[1] < cnt) {
    odd_n[1] = cnt;
    odd_d[1] = tmp;
  }

/*
  cout << odd_d[0] << " " << odd_d[1] << endl;
  cout << odd_n[0] << " " << odd_n[1] << endl;
  cout << even_d[0] << " " << even_d[1] << endl;
  cout << even_n[0] << " " << even_n[1] << endl;
*/

  ll nrep;
  if(odd_d[0]!=even_d[0]){
    nrep = odd_n[0] + even_n[0];
  } else {
    nrep = max(odd_n[1] + even_n[0],odd_n[0] + even_n[1]);
  }
  
  cout << n-nrep << endl;

  return 0;
}

Measured memory_bytes: 1276
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^18 -> 18回
// double pi = M_PI or acos(-1)
// printf("%.10f\n", ans);

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h.at(i);

    sort(h.begin(), h.end());
    reverse(h.begin(), h.end());

    ll ans = 0;
    rep(i, n) {
        if(i >= k) {
            ans += h.at(i);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3968
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int N, M, a, b, cnt = 0;
vi T[13], vec;

bool CheckPath(int u, int v){
    rep(i,T[u].size())
        if(T[u][i] == v) return true;
    return false;
}

void solve(){
    vec.resize(N-1);
    rep(i,N-1) vec[i] = i+1;

    do{
        int prev = 0; cnt++;

        rep(i,N-1){
            int id = vec[i];
            if(!CheckPath(prev,id)){
                // printf("No Path from %d to %d\n", prev, id);
                cnt--;
                break;
            }
            // printf("Path from %d to %d exists\n", prev, id);
            prev = id;
        } 
        // printf("Count:%d\n",cnt);
    }while(next_permutation(vec.begin(), vec.end()));

    cout << cnt << endl;
}

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

    rep(i, M){
        cin >> a >> b; a--; b--; //0-indexに
        T[a].push_back(b); T[b].push_back(a);
    } 
    solve();
}


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

int main()
{
  string s;
  cin >> s;
  if(s[0] != s[1] && s[1] != s[2] && s[0] != s[2]) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3636
import sys
input = sys.stdin.readline
import math
#N, M, C = (int(i) for i in input().split())
#B = [int(x) for x in stdin.readline().rstrip().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
R = int(input())

print(2*R*math.pi)


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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

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

const long long INF = 1LL<<60;
const int mod = 1000000007;

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

int N, M;


Graph G;
vector<int> dp(100100, -1);

int rec(int v) {
    if (dp.at(v) != -1) return dp.at(v);

    int res = 0;
    for (auto nv : G.at(v)) {
        chmax(res, rec(nv) + 1);

    }
    return dp.at(v) = res;
}

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

    cin >> N >> M;
    G.assign(N, vector<int>());
    REP(i, M) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        G.at(x).push_back(y);
    }

    int ans = 0;
    for (int v = 0; v < N; v++) {
        chmax(ans, rec(v));
    }

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

Measured memory_bytes: 8192
n, k = map(int, input().split())
l = list(map(int, input().split()))
nums = [i for i in range(10) if not i in l]

while True:
  total = 0
  for num in nums:
    total += list(str(n)).count(str(num))
  
  if total == len(list(str(n))):
    print(n)
    break
  
  n += 1

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

bool countBlack(vector<string> grid,int H, int W, int K) {
  int sum = 0;
  rep (i, H) {
    rep (j, W) {
      if (grid[i][j] == '#') sum ++;
    }
  }
  return sum == K;
}

vector<string> paintH(vector<string> grid, int H, int target) {
  rep (i, H) {
    grid[i][target] = 'x';
  }
  return grid;
}

vector<string> paintW(vector<string> grid, int target, int W) {
  rep (i, W) {
    grid[target][i] = 'x';
  }
  return grid;
}

int main(){
  ll H, W, K;cin>>H>>W>>K;
  vector<string> grid(H);

  rep(i, H) {
    cin >> grid[i];
  }

  int ans = 0;
  // if(countBlack(grid, H, W, K)) ans ++;

  vector< vector<int> > heightC;
  for (int bit = 0; bit < (1 << H); ++bit) {
    vector<int> S;
    for (int i = 0; i < H; ++i) {
      if (bit & (1 << i)) {
        S.push_back(i);
      }
    }
    heightC.push_back(S);
  }
  // rep(i, heightC.size()) {
  //   rep(j, heightC[i].size()) {
  //     cout << heightC[i][j] << endl;
  //   }
  // }
  // cout << heightC.size() << endl;

  vector< vector<int> > wideC;
  for (int bit = 0; bit < (1 << W); ++bit) {
    vector<int> S;
    for (int i = 0; i < W; ++i) {
      if (bit & (1 << i)) {
        S.push_back(i);
      }
    }
    wideC.push_back(S);
  }
  // rep(i, wideC.size()) {
  //   rep(j, wideC[i].size()) {
  //     cout << wideC[i][j] << endl;
  //   }
  // }
  // cout << wideC.size() << endl;

  rep (i, heightC.size()) {
    vector<string> tmp1Grid = grid;

    if (i != 0) {
      rep(ii, heightC[i].size()) {
        tmp1Grid = paintW(tmp1Grid, heightC[i][ii], W);
      }
    }
      rep (j, wideC.size()) {
        vector<string> tmp2Grid = tmp1Grid;
        if (j != 0) {
          rep(jj, wideC[j].size()) {
            tmp2Grid = paintH(tmp2Grid, H, wideC[j][jj]);
          }
        }
          // rep (i, H) {
          //   rep (j, W) {

          //     cout << tmp2Grid[i][j];
          //   }
          //   cout << endl;
          // }
          // cout << "---------" << endl;
        if (countBlack(tmp2Grid, H, W, K)) ans ++;
      }
  }

  cout << ans << endl;


  // for(int i = -1; i < H; i ++) {
  //   vector<string> tmp1Grid = grid;


  //   if (i != -1) {
  //     tmp1Grid = paintW(tmp1Grid, i, W);

  //   }
  //     vector<string> tmp2Grid = tmp1Grid;
  //     for(int j = -1; j < W; j ++) {
  //       if (j != -1) {
  //         tmp2Grid = paintH(tmp2Grid, H, j);
  //       }
  //         rep (i, H) {
  //           rep (j, W) {

  //             cout << tmp2Grid[i][j];
  //           }
  //           cout << endl;
  //         }
  //         cout << "---------" << endl;
  //       if (countBlack(tmp2Grid, H, W, K)) ans ++;
  //     }
  // }
  // cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 9e18;

signed main() {
    vector<vector<int>> A(3, vector<int>(3));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }
    int N;
    cin >> N;
    for (int a = 0; a < N; a++) {
        int temp;
        cin >> temp;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (A[i][j] == temp) A[i][j] = -1;
            }
        }
    }
    bool ans = false;
    for (int i = 0; i < 3; i++) {
        bool temp = true;
        for (int j = 0; j < 3; j++) if (A[i][j] != -1) temp = false;
        if (temp) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    for (int i = 0; i < 3; i++) {
        bool temp = true;
        for (int j = 0; j < 3; j++) if (A[j][i] != -1) temp = false;
        if (temp) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if (A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1) {
        cout << "Yes" << endl;
        return 0;
    }

    if (A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[3];
    int i;
    for(i=0;i<3;i++)cin>>a[i];
    sort(a,a+3, greater<int>());
    int c,d;
    c=10*a[0];
    c=c+a[1];
    c=c+a[2];
    d=10*a[1];
    d=d+a[2];
    d=d+a[0];
    cout<<max(c,d);



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, a, b) for (int i = (a); i < (int)(b); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long ll;


ll Main(int A, int B)
{
    if(A < B) swap(A, B);
    ll M = (ll)A*B;
    int r = A % B;
    while(r > 0) {
        A = B;
        B = r;
        r = A % B;
    }
    return M/B;
}

int main(void){
    int A, B;
    cin >> A >> B;
    cout << Main(A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define pp pop_back
#define mp make_pair
typedef long long Long;
void FastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
}

const int N = 1e5;

int main()
{
  FastIO();
  int tc, ca = 0;
  Long n;
  cin >> n;
  vector <Long> v(n);
  Long x = 0;
  for (int i = 0;i < n;i++){
    cin >> v[i];
    x ^= v[i];
  }
  for (int i = 0;i < n;i++){
    cout << (v[i]^x) << ' ';
  }cout << '\n';
  return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;


int main() {
    int n, k; cin >> n >> k;
    V<ll> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];
    sort(ALL(h));

    ll ans = 1LL << 60;
    for(int i = 0; i < n - k + 1; i++){
        ans = min(ans, abs(h[i] - h[i + k - 1]));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4032
a, b, c, d = list(input())

ops = ['+', '-']

for op1 in ops:
    for op2 in ops:
        for op3 in ops:
            s = a + op1 + b + op2 + c + op3 + d
            if eval(s) == 7:
                print(s + '=7')
                exit(0)


Measured memory_bytes: 2940