akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastInput in = new FastInput();
        PrintWriter out = new PrintWriter(System.out);

        String s = in.next(), t = in.next();
        int res = t.length();

        for (int i = 0; i + t.length() <= s.length(); i++) {
            int same = 0;
            for (int j = 0; j < t.length(); j++)
                if (t.charAt(j) == s.charAt(i + j))
                    same++;
            res = Math.min(res, t.length() - same);
        }
        out.println(res);
        out.close();
    }

    static class FastInput {
        BufferedReader br;
        StringTokenizer st;

        public FastInput() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 25908
#include <stdio.h>
#include <string.h>
using namespace std;

int main() {
  char text[4];
  int i,j,k;
  int check1, check2;
  char list_char[][4][4] ={ {'\0' ,'\0' ,'\0' ,'\0' },
   {'\0' ,'\0' ,'\0' ,'\0' } ,
   {'\0' ,'\0' ,'\0' ,'\0' },
    {'\0' ,'\0' ,'\0' ,'\0' } };
  scanf("%s", text);
  for(const char c: text) {
      for(i=0; i<=3; ++i){
        if (list_char[i][j][0] == '\0' ){           
            list_char[i][j][0] = c;
            break;
        } else if (list_char[i][j][0] == c) {
            for(j=0; j<=3; ++j){
                if (list_char[i][j][0] == '\0' ) {
                    list_char[i][j][0] = c;
                    break;
                }
            }
            break;
        }
      }
    }
    check1 = 0;
    check2 = 0;
    for(i=0; i<=3; ++i){
        if (list_char[i][j][0] != '\0') {
            check1 = check1 + 1;
        }

        if (list_char[i][j][0] != '\0') {
            check2 = check2 + 1;
        }
    }

    if ((check1 == 2) and (check2 == 2)){
        printf("%s\n", "Yes");
    }else{
        printf("%s\n", "No");
    }
  return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	An := make([]int, N)
	for i := 0; i < N; i++ {
		An[nextInt()-1] = i + 1
	}
	fmt.Println(strings.Trim(fmt.Sprint(An), "[]"))
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


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

int main(){
  ll N,a=0,b=INF,t=0;
  cin >> N;
  vector<ll> A(N),B(N);
  rep(i,N){
    cin >> A.at(i) >> B.at(i);
    if(A.at(i)!=B.at(i)) t=1;
    a+=A.at(i);
    if(A.at(i)>B.at(i))b=min(b,B.at(i));
  }
  if(t==0){
    cout << 0 << endl;
  }else{
    cout << a-b << endl;
  }
}

Measured memory_bytes: 512
S = int(input())

if S > 10 ** 9:
    X = (10 ** 9 - (S % (10 ** 9))) % (10 ** 9)
    Y = (S + X) // (10 ** 9)
    print(0, 0, 10 ** 9, 1, X, Y)
else:
    X = 1
    Y = S
    print(0, 0, X, 0, 0, Y)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 10000000000000000
#define mod 2019
int main(){
	int a,b;cin>>a>>b;

	int plug=1,ans=0;
	while(plug<b){
		plug--;
		plug+=a;
		ans++;
	}

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

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		int prev = sc.nextInt();
		long len = t;
		for (int i = 1; i < n; i++) {
		    int x = sc.nextInt();
		    len += Math.min(x - prev, t);
		    prev = x;
		}
		System.out.println(len);
	}
}


Measured memory_bytes: 62440
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define lb lower_bound
#define vi vector < ll  int >
#define CLR(a) memset((a),0,sizeof(a))
#define mp make_pair
#define hell 1000000007
#define pc __builtin_popcount
using namespace std;

void solve()
{
    int i,j=0,r=200,p,q,k,d,y=0,h,flag=1,n,m=0,a=hell,b=hell,h1,h2,a1,b1,a2,w,x,u,f,l,c,z;
    cin>>n;
    vector < int > v(n);
    rep(i,0,n) cin>>v[i];
    vector < int > cnt(1005);
    sort(all(v));
    set <int > st;
  for(i=n-1;i>=0;i--)
  {
      cnt[v[i]]=i+1;
      st.insert(v[i]);

  }
  //rep(i,0,n) cout<<cnt[v[i]]<<" ";
    rep(i,0,n-2)
    {
        rep(j,i+1,n-1)
        {
            k=v[i]+v[j];
            if(lower_bound(all(v),k)!=v.end()){
            //cout<<k<<" "<< *lower_bound(all(v),k)<<endl;
            //cout<<k<<" "<<(*st.lower_bound(k))<<" "<<cnt[*(st.lower_bound(k))]<<endl;
                k=cnt[*lower_bound(all(v),k)]-j-2;
                y+=k;
            }
            else
            {
               y+=n-j-1;
            }

        }
        //cout<<i<<" ";
    }

    cout<<y;

}


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    solve();
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    k = II()
    s = list(S())
    if len(s) > k:
        print("".join(s[:k]) + "...")
    else:
        print("".join(s))
    return


#main
if __name__ == '__main__':
    solve()


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

ll MAX = 200000;
ll cnt[200000 + 1];

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

  sort(all(A));

  rep(i, N) cnt[A[i]]++;
  for (int i = MAX; i > 0; i--) cnt[i - 1] += cnt[i];

  int ok = 2;
  int ng = MAX * 2 + 1;

  while (abs(ok - ng) > 1) {
    int mid = (ok + ng) / 2;

    ll _cnt = 0;
    rep(i, N) {
      int idx = max(0LL, mid - A[i]);
      _cnt += cnt[idx];
    }

    if (M <= _cnt)
      ok = mid;
    else
      ng = mid;
  }

  vector<ll> sum(N + 1);
  rep(i, N) sum[i + 1] = sum[i] + A[i];

  ll ans = 0;
  ll rem = M;
  rep(i, N) {
    int idx = lower_bound(all(A), ok + 1 - A[i]) - A.begin();
    ans += (sum[N] - sum[idx]);
    ans += (N - idx) * A[i];
    rem -= (N - idx);
  }

  ans += rem * ok;

  cout << ans << endl;
}


Measured memory_bytes: 3456
#include <cstring>
#include <iostream>
using namespace std;
int n, m, q, x, y, a[7][7][7], c[7][7];
bool solve(int t) {
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				for (int di = -1; di <= 1; di++) {
					for (int dj = -1; dj <= 1; dj++) {
						for (int dk = -1; dk <= 1; dk++) {
							int xc = i, yc = j, zc = k;
							if ((di | dj | dk) == 0) continue;
							int c = 0;
							while (0 <= xc && xc < n && 0 <= yc && yc < n && 0 <= zc && zc < n) {
								if (a[xc][yc][zc] != t) break;
								xc += di, yc += dj, zc += dk;
								c++;
							}
							if (c >= m) return true;
						}
					}
				}
			}
		}
	}
	return false;
}
int main() {
	while (cin >> n >> m >> q, n) {
		memset(a, 0, sizeof(a));
		memset(c, 0, sizeof(c));
		int ret = -1;
		for (int i = 0; i < q; i++) {
			cin >> x >> y; x--, y--;
			a[y][x][c[y][x]++] = i % 2 + 1;
			if (ret == -1 && solve(i % 2 + 1)) ret = i;
		}
		if (ret == -1) cout << "Draw" << endl;
		else cout << (ret % 2 ? "White" : "Black") <<  ' ' << ret + 1 << endl;
	}
	return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;   
//typedef pair<ll,P> PP;

//-----------------------------------------------------------------------------

int n;
vector<P> v;
int idx[200000];

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

	cin >> n;
	REP(i, n) {
		int x;cin >> x;
		v.pb(P(x, i));
	}
	sort(ALL(v));
	REP(i, n) {
		idx[v[i].se] = i;
	}
	REP(i, n) {
		if(idx[i] < n/2) cout << v[n/2].fi << endl;
		else cout << v[n/2 - 1].fi << endl;
	}

    return 0;
}


Measured memory_bytes: 4720
using System;
using System.Linq;
using System.Collections.Generic;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    int A=int.Parse(Console.ReadLine());
    int B=int.Parse(Console.ReadLine());
    int H=int.Parse(Console.ReadLine());
     Console.WriteLine((A+B)*H/2);
    }
    
  }

}


Measured memory_bytes: 27276
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static int H, W, i, j;
        static char[, ] maze;

        static bool[, ] reached;

        static Queue<Tuple<int, int, int>> queue;
        static void Main (string[] args)
        {
            string[] str = Console.ReadLine ().Split (' ');
            H = int.Parse (str[0]);
            W = int.Parse (str[1]);

            maze = new char[H, W];
            reached = new bool[H, W];

            int white = 0;
            //迷路を読み込む
            for (i = 0; i < H; i++)
            {
                string str2 = Console.ReadLine ();
                for (j = 0; j < W; j++)
                {
                    maze[i, j] = str2[j];
                    //白マスの数
                    if (maze[i, j] == '.') white++;
                }
            }

            //幅優先探索で最短手数を求める
            queue = new Queue<Tuple<int, int, int>> ();
            queue.Enqueue (Tuple.Create (0, 0, 0));
            reached[0, 0] = true;

            int mins = 0;
            while (queue.Count > 0)
            {
                Tuple<int, int, int> tuple = queue.Dequeue ();
                if (tuple.Item1 == H - 1 && tuple.Item2 == W - 1)
                {
                    mins = tuple.Item3;
                    break;
                }
                Search (tuple.Item1, tuple.Item2, tuple.Item3);
            }

            //最大得点＝元の白マス-最短手数
            if (reached[H - 1, W - 1] == false)
            {
                Console.WriteLine (-1);
                return;
            }
            Console.WriteLine (white - mins - 1);
            return;

        }
        //幅優先探索
        static void Search (int x, int y, int s)
        {
            int[] vx = { 1, 0, -1, 0 };
            int[] vy = { 0, 1, 0, -1 };

            for (i = 0; i < 4; i++)
            {
                int nx = x + vx[i];
                int ny = y + vy[i];

                if (nx < 0 || H <= nx || ny < 0 || W <= ny || maze[nx, ny] == '#') continue;
                if (reached[nx, ny]) continue;

                reached[nx, ny] = true;
                queue.Enqueue (Tuple.Create (nx, ny, s + 1));
            }
        }
    }

    class MyLibrary
    {

        // 自作の関数
        public static int MyFunction (int n)
        {
            return 0;
        }
    }
}

Measured memory_bytes: 13396
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
//mapの使い方
#include <map>
#include <random>

#define pb push_back



int mymain(ll n){
  // エラトステネスのふるい
    ll MAX = 1010100;
    vector<ll> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (ll i = 2; i < MAX; ++i) {
        if (!is_prime[i]) continue;
        for (ll j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }
  ll n1=n-1;
  vi a(101010);
  map<ll, ll> nums;
  
  nums[1]=1;

  for (ll i = 2; i < MAX; ++i) {
    if (is_prime[i]){
      if (n1%i==0){
        n1/=i;
        //nums[i]=1;

        map<ll, ll> nums2;
        for (auto it : nums) {
            nums2[it.first*i]=1;
        }

        for (auto it : nums2) {
            nums[it.first]=1;
        }
        i--;
        if (n1==1)break;
      }
    }
  }

  if (n1!=1){
        map<ll, ll> nums2;
        for (auto it : nums) {
            nums2[it.first*n1]=1;
        }

        for (auto it : nums2) {
            nums[it.first]=1;
        }
  }

  





  ll nn=n;
  map<ll, ll> nums3;
  nums3[1]=1;
  
  for (ll i = 2; i < MAX; ++i) {
    if (is_prime[i]){
      if (nn%i==0){
        nn/=i;
        map<ll, ll> nums2;
        for (auto it : nums3) {
            nums2[it.first*i]=1;
        }

        for (auto it : nums2) {
            nums3[it.first]=1;
        }
        i--;
        if (nn==1)break;
      }
    }
  }


  if (nn!=1){
        map<ll, ll> nums2;
        for (auto it : nums3) {
            nums2[it.first*nn]=1;
        }

        for (auto it : nums2) {
            nums3[it.first]=1;
        }
  }




  nn=n;
  for (auto it : nums3) {
      if (it.first==1)continue;
      nn=n;
      REP(i,10000){
        if (nn%it.first==0){
          nn/=it.first;
        }else{
          break;
        }
      }
      if (nn%it.first==1){
        nums[it.first]=1;
      }
  }



  return nums.size()-1;
}












int main(){

  ll i;
  cin>>i;
  cout<<mymain(i)<<endl;

  return 0;
}

/*
731771178462
4
6
499009545320
5
7
232481453060
4
6
514861015359
5
9
372433929749
6
12
511030450264
5
9
87816855914
3
5
977352474874
5
9
686386828854
6
10
556577842070
3
5
311925800445
7
13
299128657856
5
9
509300755182
4
6
727295972490
4
6
187491285072
8
10
847708005770
3
5
108313582914
5
7
542162783819
4
8
*/

Measured memory_bytes: 9472
import sys
input = sys.stdin.readline
from collections import Counter
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

N,K,L = map(int,input().split())

P = [None] * K
Q = [None] * K
for i in range(K):
  P[i], Q[i] = map(int,input().split())

R = [None] * L
S = [None] * L
for i in range(L):
  R[i], S[i] = map(int,input().split())


g1 = csr_matrix(([1]*K,(P,Q)),(N+1,N+1))
g2 = csr_matrix(([1]*L,(R,S)),(N+1,N+1))

_,comp1 = connected_components(g1,directed = False,return_labels = True)
_,comp2 = connected_components(g2,directed = False,return_labels = True)

comp_pair = comp1.astype('int64') * (N+1) + comp2
c = Counter(comp_pair)

answer = [c[comp_pair[i]] for i in range(1,N+1)]
print(*answer)

Measured memory_bytes: 57872
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    string s, t;
    cin >> s >> t;
    if(s.size() == t.size()){
        for (int i = 0; i < s.size(); i++) {
            cout << s[i] << t[i];
        }
        cout << endl;
        return 0;
    }
    else{
        for (int i = 0; i < s.size()-1; i++) {
            cout << s[i] << t[i];
        }
        cout << s[s.size()-1] << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define MOD 1000000007
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    vector <int> water;
    vector <int> sugar;
    int alim = F/(A*100);
    int blim = F/(B*100);
    int clim = F/C;
    int dlim = F/D;
    for(int i = 0; i <= alim; i++){
        for(int l = 0; l <= blim; l++){
            water.push_back(i*A*100+l*B*100);
        }
    }
    for(int i = 0; i <= clim; i++){
        for(int l = 0; l <= dlim; l++){
            sugar.push_back(i*C+l*D);
        }
    }
    int t = 0;
    int w = 0;
    int s = 0;
    for(int i = 0; i < water.size(); i++){
        for(int l = 0; l < sugar.size(); l++){
            int sum = water[i]+sugar[l];
            if(sum<=F && sugar[l]*100<=water[i]*E){
                if(s*(sum)<=t*sugar[l]){
                    s = sugar[l];
                    t = sum;
                }
            }
        }
    }
    cout << t << " " << s << "\n";
    return 0;
}

Measured memory_bytes: 2420
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N,M=rl()
P=[0]*M
Y=[0]*M
dic = [[] for _ in range(N+1)]
for i in range(M):
    P[i],Y[i] = rl()
    dic[P[i]] += [Y[i]]

for i in range(N+1):
    dic[i].sort()

import bisect
for i in range(M):
    print("{:0>6}{:0>6}".format(P[i], bisect.bisect_left(dic[P[i]],Y[i])+1))


Measured memory_bytes: 30256
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

int main(void) {
	size_t N, A, B;

	scanf("%zu", &N);
	if (N == 2) {
		scanf("\n%zu\n%zu", &A, &B);
	}

	if (N == 1) {
		puts("Hello World");
	}
	else {
		printf("%zu", A + B);
	}

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
template <typename T>
T uPow(T z,T n, T mod){
  T ans = 1;
  while(n != 0){
    if(n%2){
      ans*=z;
      if(mod)ans%=mod;
    }
    n >>= 1;
    z*=z;
    if(mod)z%=mod;
  }
  return ans;
}

int main(){
  int n,a,b,c;cin>>n>>a>>b>>c;
  vector<int> A(n);
  for(int i = 0; n > i; i++){
    cin>>A[i];
  }
  int ans = -1;
  for(int bit = 0; uPow(4,n,0) > bit; bit++){
    int kado[3] = {0,0,0};
    int kados[3] = {0,0,0};
    for(int i = 0; n > i; i++){
      if((bit%uPow(4,i+1,0))/uPow(4,i,0)){
        kado[((bit%uPow(4,i+1,0))/uPow(4,i,0))-1] += A[i];
        kados[((bit%uPow(4,i+1,0))/uPow(4,i,0))-1]++;
      }
    }
    if(kados[0]*kados[1]*kados[2]){
      int z = ((kados[0]-1)+(kados[1]-1)+(kados[2]-1))*10 + abs(kado[0]-a) + abs(kado[1]-b) + abs(kado[2]-c);
      if(ans == -1)ans = z;
      else ans = min(ans,z);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M 1000000007
using namespace std;
typedef long long int ll;
int main()
{
  ll h,k;
  cin>>h>>k;
  ll arr[h];
  for(ll i=0;i<h;i++)
    cin>>arr[i];
  sort(arr,arr+h,greater<ll>());
ll sum=0;
  for(ll i=0;i<h;i++)
  {
      if(k)
      {
          k--;
      }
      else
      {
          sum+=arr[i];
      }

  }
  cout<<sum<<endl;



}


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

class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int r, c;
        String data[];
        try {
            data = br.readLine().split(" ");
            r = Integer.parseInt(data[0]);
            c = Integer.parseInt(data[1]);
            String input[];
            int graph[][] = new int[r + 1][c + 1];
            int sum1 = 0, sum2 = 0;

            for (int i = 0; i < r; i++) {
                input = br.readLine().split(" ");
                for (int j = 0; j < c; j++) {
                    graph[i][j] = Integer.parseInt(input[j]);
                    sum1 += graph[i][j];
                    if (j == c - 1) {
                        graph[i][j + 1] = sum1;
                        sum1 = 0;
                    }
                }
            }
            for (int i = 0; i <= c; i++) {
                for (int j = 0; j < r; j++) {
                    sum2 += graph[j][i];
                    if (j == r - 1) {
                        graph[j + 1][i] = sum2;
                        sum2 = 0;
                    }
                }
            }

            for (int i = 0; i <= r; i++) {
                for (int j = 0; j <= c; j++) {
                    if (j != 0)
                        System.out.print(" ");
                    System.out.printf("%d", graph[i][j]);
                }
                System.out.print("\n");
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 42688
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,A,B;
    cin >> N >> A >> B;
    string S;
    cin >> S;
    ll cnt = 0;
    ll kaigai = 0;
    rep(i,0,N){
        if(S[i] == 'a'){
            if(cnt < A+B){
                cnt++;
                print("Yes");
            }else{
                print("No");
            }

        }else if(S[i] == 'b'){
            kaigai++;
            if(kaigai <= B && cnt < A+B){
                print("Yes");
                cnt++;
            }else{
                print("No");
            }

        }else{
            print("No");
        }
    }
}

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

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	int n, x, l, d, k;
	d = 0;
	k = 1;
	cin >> n >> x;
	while (cin >> l) {
		d += l;	
		if (d <= x)
			k++;
	}
	cout << k << ende;
  return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int a, int b) {
    if (b == 1) return 0;
    if (a >= b) return 1;

    int ans = 1;
    int x = a;
    while (x < b) {
        x = x + a - 1;
        ans++;
    }
    return ans;
}

void main() {
    int a, b; scan(a, b);
    writeln(calc(a, b));
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
        char[] cs = sc.next().toCharArray();
        Arrays.sort(cs);
 
        if (cs[0] == cs[1] && cs[2] == cs[3] && cs[0] != cs[3]) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<iomanip>
using namespace std; 
 
int main ()
{
    int n;
    cin>>n;
    int rem=0;
    int q=n;
    while (q!=0)
    {
        
        rem =rem*10+q%10;
        q=q/10;
    }
    if (rem==n)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	int[10] wSum, kSum;
	foreach (i; 0..10) {
		wSum[i] = readln.chomp.to!int;
	}
	foreach (i; 0..10) {
		kSum[i] = readln.chomp.to!int;
	}

	writeln(wSum.array.sort!("a > b")[0..3].reduce!("a+b"), " ", kSum.array.sort!("a > b")[0..3].reduce!("a+b"));
}

Measured memory_bytes: 1056
import itertools as iters

N,X,Y = [int(i) for i in input().rstrip().split()]

A = [0 for i in range(N)]
for i,j in iters.combinations(range(1,N+1),2):
    D = ( j-i , abs(i-X) + 1 + abs (j-Y))
    #print(i,j,min(D))
    A[min(D)] += 1

print(*A[1:], sep='\n')

Measured memory_bytes: 3444
#include<iostream>

using namespace std;


int main(){
    int n;
    while(cin>>n,n){
        int maxi=-1000000;
        int ans=0;
        for(int i=0; i<n;i++){
            int a,b,c; cin>>a>>b>>c;
            if(maxi<b+c){
                maxi=b+c;
                ans=a;}
        }
        cout<<ans<<" "<<maxi<<endl;	
    }
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int x; cin >> x;
    if (x) {
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }
}


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

int main()
{

long long int n,k,i,sum=0,a[200000];
cin>>n>>k;
for(i=0;i<n;i++)
{
    cin>>a[i];
}
sort(a,a+n);
for(i=0;i<k;i++)
{
    sum=sum+a[i];
}
cout<<sum<<endl;

    return 0;
}


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

typedef long long ll;
typedef ll Weight;

const ll INF = 1e16;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void shortestPath(const Graph &g, int s,
		  vector<Weight> &dist, vector<int> &prev) {
  int n = g.size();
  dist.assign(n, INF); dist[s] = 0;
  prev.assign(n, -1);
  priority_queue<Edge> Q; // "e < f" <=> "e.weight > f.weight"
  for (Q.push(Edge(-2, s, 0)); !Q.empty(); ) {
    Edge e = Q.top(); Q.pop();
    if (prev[e.dst] != -1) continue;
    prev[e.dst] = e.src;
    for(auto&& f :g[e.dst]) {
      if (dist[f.dst] > e.weight+f.weight) {
        dist[f.dst] = e.weight+f.weight;
        Q.push(Edge(f.src, f.dst, e.weight+f.weight));
      }
    }
  }
}

int main(){
  ll N;
  cin >> N;
  Graph g(N);
  for(int i=0;i<N-1;i++){
    ll a,b,c;
    cin >> a >> b >> c;
    a--; b--;
    g[a].push_back(Edge(a,b,c));
    g[b].push_back(Edge(b,a,c));
  }
  vector<Weight> dist;
  vector<int> prev;
  ll Q,K;
  cin >> Q >> K;
  K--;
  shortestPath(g, K, dist, prev);
  for(int i=0;i<Q;i++){
    ll x,y;
    cin >> x >> y;
    x--; y--;
    cout << dist[x] + dist[y] << endl;
  }
  return 0;
}


Measured memory_bytes: 11504
N, Y = map(int, input().split())
res = -1, -1, -1

for x in range(N + 1):
    for y in range(N - x + 1):
        z = N - x - y
        if 10000 * x + y * 5000 + z * 1000 == Y:
            res = x, y, z
            break

print(*res)



Measured memory_bytes: 9060
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int x; 
int main(){
	x=read();
	printf("%d\n",x/500*1000+(x%500)/5*5);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
const ll MAX=2e5+1;
const ll MOD=1e9+7;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll calc(ll a,ll b){
    ll res=1;
    rep(0,i,a-b+1){
        res=(res*(b+i))%MOD;
    }
    return res;
}
// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return calc(n,n-k+1) * (finv[k] % MOD)%MOD;
}
int main(void){
    ll n,a,b;
    cin>>n>>a>>b;
    COMinit();
    ll ans=(modpow(2,n,MOD)-1-COM(n,b)-COM(n,a))%MOD;
    if(ans<0)ans+=MOD;
    cout<<ans<<endl;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(long long)(n); i++)
#define REP(i, k, n) for(long long i=(long long)(k); i<(long long)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const ll inf = 1020304050607080910;
const int INF = 2000000000;
const ll mod = 1000000007;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x,ll y){if(x>y)swap(x, y);while(x!=0){y%=x;swap(x, y);}return y;}
ll mpow(ll x,ll r){if(r==0)return 1;if(r%2==1){return x*mpow(x,r-1)%mod;}else{ll aa=mpow(x,r/2);return aa*aa%mod;}}


int main(){
	int N; cin >> N;
	ll A[N];
	rep(i, N) cin >> A[i];
	sort(A, A+N);
	ll ans = 0, cnt = N-1;
	rep(i, N){
		if(i==0){ ans += A[N-i-1]; cnt--; }
		else{
			if(cnt==0) break;
			cnt--;
			ans += A[N-i-1];
			if(cnt==0) break;
			cnt--;
			ans += A[N-i-1];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5180
S = input()
S = S[::-1]
L = [0]
i = 0
for x in S:
    tmp = L[-1] + pow(10, i , 2019) * int(x) 
    L.append(tmp % 2019)
    i += 1
L = sorted(L[1::])
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(L)
from math import factorial
def comb(n,r):
    if n == 1: return 0
    return  n * (n - 1) // 2
ans = 0
for x in c:
    if x[0] == 0: ans += x[1]
    ans += comb(x[1],2)
print(int(ans))


Measured memory_bytes: 20176
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int w,h;
char field[55][55];
int dx[]={1,-1,0,0,-1,-1,1,1};
int dy[]={0,0,1,-1,1,-1,1,-1};

int used[55][55];
void dfs(int y,int x){
  if(used[y][x]==1)return ;
  used[y][x]=1;
  for(int i=0;i<8;i++){
    int ny=y+dy[i];
    int nx=x+dx[i];
    if(0<=ny&&ny<h&&0<=nx&&nx<w&&field[ny][nx]=='1'){
      dfs(ny,nx);
    }
  }
  return ;
}
int main(){
  while(1){
    cin >>w>>h;
    if(w==0&&h==0) break;
    for(int i=0;i<55;i++){
      for(int j=0;j<55;j++){
        used[i][j]=0;
      }
    }
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin >>field[i][j];
      }
    }
    int cnt=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(used[i][j]==1)continue;
        if(field[i][j]=='1'){
          cnt++;
          dfs(i,j);
        }
      }
    }
    cout << cnt << endl;
  }
}



Measured memory_bytes: 3124
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def main():
    N = I()
    zero = 0
    cnts = defaultdict(int)
    used = set()

    for i in range(N):
        a, b = MI()
        if a == 0 and b == 0:
            zero += 1
            continue

        g = gcd(abs(a), abs(b))
        a = a // g
        b = b // g
        if b < 0:
            a = -a
            b = -b
        cnts[(a, b)] += 1

    # print(cnts)

    ans = 1
    for key, c in cnts.items():
        if key in used:
            continue
        a, b = key
        if a > 0:
            rev = (-b, a)
        else:
            rev = (b, -a)

        if rev in cnts:
            # keyの集合から一個以上選ぶ + revの集合から一個以上選ぶ + どれも選ばない
            ans *= (pow(2, cnts[key], MOD) - 1) + (pow(2, cnts[rev], MOD) - 1) + 1
            # print(key, rev, ans)
            ans %= MOD
            used.add(rev)
        else:
            ans *= pow(2, cnts[key], MOD)

    ans += zero
    ans -= 1
    print(ans % MOD)


if __name__ == '__main__':
    main()


Measured memory_bytes: 128776
S = input()
S = [int(s) for s in S]
yymm = 0
mmyy = 0

if (S[0] == 0 and 0 <= S[1] <= 9) or (1 <= S[0] and 0 <= S[1] <= 9):
    if (S[2] == 0 and 1 <= S[3] <= 9) or (1 == S[2] and 0 <= S[3] <= 2):
        yymm = 1
if (S[0] == 0 and 1 <= S[1] <= 9) or (1 == S[0] and 0 <= S[1] <= 2):
    if (S[2] == 0 and 0 <= S[3] <= 9) or (1 <= S[2] and 0 <= S[3] <= 9):
        mmyy = 1

if yymm == mmyy == 1:
    print("AMBIGUOUS")
elif yymm == mmyy:
    print("NA")
elif yymm == 1:
    print("YYMM")
else:
    print("MMYY")
    

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

constexpr int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n - 1); }

const int mod = TEN(9) + 7;

struct SegTree { // 区間sum
	int n;
	vector<int> Sum;
	void init(int n_) {
		n = 1;
		while (n < n_) n *= 2;
		Sum.resize(2 * n);
		for (int i = 0; i < 2 * n - 1; ++i) {
			Sum[i] = 0;
		}
	}
	void update(int idx, int val) {
		idx += n - 1;
		Sum[idx] += val;
		while (idx > 0) {
			idx = (idx - 1) / 2;
			Sum[idx] = Sum[idx * 2 + 1] + Sum[idx * 2 + 2];
		}
	}
	int get_sum(int a, int b, int k = 0, int l = 0, int r = -1) { // [a, b)のmax
		if (r == -1) r = n;
		if (r <= a || b <= l) return 0;
		if (a <= l && r <= b) return Sum[k];
		int vl = get_sum(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = get_sum(a, b, k * 2 + 2, (l + r) / 2, r);
		return (vl + vr);
	}
};

signed main()
{
	int A, B; cin >> A >> B;
	cout << max({A+B,A-B,A*B}) << endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	char S[4] = {};
	char T[4] = {};
	int a = 0;

	scanf("%s", &S);
	scanf("%s", &T);

	for (int i = 0; i < 3; i++)
	{
		if(S[i] == T[i])
			a++;
	}

	printf("%d\n", a);

	return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline

N = int(input())
graph = [[] for _ in range(N)]
Edges = [[None]*N for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
    Edges[a-1][b-1] = i
    Edges[b-1][a-1] = i

def dfs(p, L, checked, goal):
    if p == goal:
        return L
    checked[p] = True
    ok = False
    for np in graph[p]:
        if not checked[np]:
            L.append(np)
            retL = dfs(np, L, checked, goal)
            if retL:
                ok = True
                break
            L.pop()
    if ok:
        return retL
    else:
        return []


M = int(input())
Compression = []
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1; b -= 1
    path = dfs(a, [], [False]*N, b)
    bit = 0
    pre = a
    for p in path:
        bit += 1<<Edges[pre][p]
        pre = p
    Compression.append(bit)

ans = 0
for bitmask in range(1,1<<M):
    whitebit = 0
    for i in range(M):
        if (1<<i)&bitmask:
            whitebit |= Compression[i]
    
    p = 1
    for n in range(M):
        if bitmask&(1<<n):
            p ^= 1
    E = 1
    for m in range(N-1):
        if whitebit&(1<<m) == 0:
            E *= 2
    
    ans += E*(-1)**p

print(2**(N-1)-ans)

Measured memory_bytes: 44284
#include <stdio.h>

int main(void)
{
  int a, b;
  int sum, k;

  while (scanf("%d%d", &a, &b) != -1) {
  sum = a + b;
  k = 0;
  do {
    sum /= 10;
    k = k + 1;
  } while (sum > 0);

  printf("%d\n", k);
  }

  return(0);
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <map>

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

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,n,s) for(int i=(int)(s);i<(int)(n);++i)
#define RREP(i,n,s) for(int i=(int)(s);i>=(int)(n);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
    int n;cin>>n;
    string s[n];
    REP(i,n) {
        cin>>s[i];
        s[i] += s[i];
    }

    int ans = 0;
    REP(x,n) {
        bool f = true;
        REP(i,n) REP2(j,n,i+1) {
            f &= (s[i][j+x] == s[j][i+x]);
            if(!f) break;
        }
        if(f) ans += n;
    }

    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
char s[10];
int main() {
	//freopen("1.txt","r",stdin);
	scanf("%s",s+1);
	if (s[3]==s[4]&&s[5]==s[6]) printf("Yes\n");
	else printf("No\n");
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());

            var result = 1;
            for(int i = 2; i < x; i++)
            {
                var current = Program.Answer(i, x);
                result = Math.Max(current, result);
            }
            Console.WriteLine(result);
        }

        private static int Answer(int i, int x)
        {
            var current = i*i;
            if(current > x)
            {
                return 0;
            }
            while (current <= x)
            {
                current *= i;
            }
            return current / i;
        }
    }
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int nax = 10123;
char k[nax];
const int mod = 1e9 + 7;

void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}

int main() {
    scanf("%s", k);
    int D;
    scanf("%d", &D);
    int len = strlen(k);
    vector<vector<int>> dp(D, vector<int>(2));
    dp[0][0] = 1;
    for(int where = 0; where < len; ++where) {
        vector<vector<int>> new_dp(D, vector<int>(2));
        for(int sum = 0; sum < D; ++sum) {
            for(bool sm_already : {false, true}) {
                for(int digit = 0; digit < 10; ++digit) {
                    if(digit > k[where] - '0' && !sm_already) {
                        break;
                    }
                    add_self(new_dp[(sum+digit)%D][sm_already || (digit < k[where]-'0')],
                        dp[sum][sm_already]);
                }
            }
        }
        dp = new_dp;
    }
    int answer = (dp[0][false] + dp[0][true]) % mod;
    --answer;
    if(answer == -1) {
        answer = mod - 1;
    }
    printf("%d\n", answer);
}


Measured memory_bytes: 3804
ans = 0
cnt = 0
s = input()
for i in range(len(s)):
    
    if s[i] =='A' or s[i] =='C' or s[i] =='T' or s[i] =='G' :
        cnt += 1
        if cnt > ans:
            ans =cnt
    else :
        cnt =0
print(ans)

Measured memory_bytes: 3060
fun main(args: Array<String>) {
    val (t, d) = readLine()!!.toString().split(' ').map { it.toLong() }
    var ans = 0
    for (i in 0 until t) {
        val (x, y) = readLine()!!.toString().split(' ').map { it.toLong() }
        if (x * x + y * y <= d * d) {
            ans++
        }
    }
    println(ans)
}

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

int main(){
    long int mod = 1000000007;
    string L;
    cin >> L;
    int N = L.size();
    long int dp_u, dp_l;
    dp_u = 2;
    dp_l = 1;
    for (int i = 1; i < N; i++) {
        if (L[i] == '0') {
            dp_l *= 3;
        }
        else {
            dp_l = dp_l * 3 + dp_u;
            dp_u *= 2;
        }
        dp_l %= mod;
        dp_u %= mod;
    }
    cout << (dp_u + dp_l) % mod << "\n";
    
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int a, b;
    cin >> a >> b;
    if (a == b)
    {
        puts("Draw");
    }
    else if (a == 1)
    {
        puts("Alice");
    }
    else if (b == 1)
    {
        puts("Bob");
    }
    else if (a > b)
    {
        puts("Alice");
    }
    else if (a < b)
    {
        puts("Bob");
    }
    return 0;
}

Measured memory_bytes: 256