akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] f=br.readLine().split(" ");
        int n=Integer.parseInt(f[0]);
        int m=Integer.parseInt(f[1]);
        int l=Integer.parseInt(f[2]);
        int[][] A=new int[n][m];
        int[][] B=new int[m][l];
        for(int i=0;i<n;i++){
        	String[] s=br.readLine().split(" ");
        	for(int j=0;j<m;j++) A[i][j]=Integer.parseInt(s[j]);
        }
        for(int i=0;i<m;i++){
        	String[] t=br.readLine().split(" ");
        	for(int j=0;j<l;j++) B[i][j]=Integer.parseInt(t[j]);
        }
    	StringBuilder sb = new StringBuilder();
        for(int ni=0;ni<n;ni++){
        	for(int li=0;li<l;li++){
        		long b=0;
            	for(int mi=0;mi<m;mi++) b+=A[ni][mi]*B[mi][li];
            	sb.append(b);
            	if(li!=l-1) sb.append(" ");
        	}
        	sb.append("\n");
        }
    	System.out.print(sb);
	}
}

Measured memory_bytes: 32676
#include<stdio.h>
#include<math.h>
int main()
{
        char fuhao[4];

        int i;
        int n,nn;
        int a,b,c,d;
        scanf("%d",&n);
        nn=n;
        d=n%10;
        n/=10;
        c=n%10;
        n/=10;
        b=n%10;
        n/=10;
        a=n;
        if(a+b+c+d==7)
        {
                printf("%d+%d+%d+%d=7",a,b,c,d);
                return 0;
        }
        if(a+b+c-d==7)
        {
                printf("%d+%d+%d-%d=7",a,b,c,d);
                return 0;
        }
        if(a+b-c+d==7)
        {
                printf("%d+%d-%d+%d=7",a,b,c,d);
                return 0;
        }
        if(a+b-c-d==7)
        {
                printf("%d+%d-%d-%d=7",a,b,c,d);
                return 0;
        }
        if(a-b+c+d==7)
        {
                printf("%d-%d+%d+%d=7",a,b,c,d);
                return 0;
        }
        if(a-b+c-d==7)
        {
                printf("%d-%d+%d-%d=7",a,b,c,d);
                return 0;
        }
        if(a-b-c+d==7)
        {
                printf("%d-%d-%d+%d=7",a,b,c,d);
                return 0;
        }
        if(a-b-c-d==7)
        {
                printf("%d-%d-%d-%d=7",a,b,c,d);
                return 0;
        }
}

Measured memory_bytes: 128
import numpy as np
import itertools
import sys

N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]
sorce = np.array(range(101))
xyh.sort(key=lambda x:x[2],reverse=True)

for ar in itertools.product(sorce,repeat=2):
    H = 0
    cnt = 0
    f = 0
    for i in xyh:
        X,Y = abs(np.subtract( [ar[0],ar[1]] , [i[0],i[1]] ))
        if f == 0:
            H = X+Y+i[2]
            f = 1
        if i[2] == max((H-X-Y),0):
            cnt += 1
        else:
            break
        if cnt == N:
            print(ar[0],ar[1],H)
            sys.exit()


Measured memory_bytes: 20252
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main(){
    int K; string s;
    cin >> K >> s;
    if(s.size() <= K) cout << s << "\n";
    else cout << s.substr(0, K) << "...\n";
}

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

int main() {
	//cout<<"GfG!";
	int a, b, k, f = 0;
	cin>>k>>a>>b;
	for(int i = a; i <= b; i++)
	    if (i % k == 0)
	    {
	        f = 1;
	        break;
	    }
	if (f)
	    cout<<"OK";
	else
	    cout<<"NG";
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const string no = "IMPOSSIBLE";

int main()
{
  ll A;
  scanf("%lld",&A);
  ll B;
  scanf("%lld",&B);
  ll t = A+B;
  if (t%2==1) cout << no << endl;
  else cout << t/2 << endl;

  return 0;
}


Measured memory_bytes: 256
import heapq as q

def main():
	n = int(input())
	a = list(map(int,input().split()))
	s = []
	for i in a:
		q.heappush(s,i)
	while len(s) != 1:
		a = q.heappop(s)
		b = q.heappop(s)
		q.heappush(s,(a+b)/2)
	print(q.heappop(s))
main()

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

string s;

int dp[10009][100][2],p,d;


int dfs(int idx,int z,bool tight=true){
  if(idx==s.size())return !z;
  int &res=dp[idx][z][tight];
  if(~res)return res;
  res=0;
  int x=s[idx]-'0';
  int r=(tight?x:9);
  for(int i=0;i<=r;i++){
    res+=dfs(idx+1,(z+i)%d,tight&&i==r);
    res%=1000000007;
  }
  return res;
}

int main(){
  memset(dp,-1,sizeof(dp));
  cin>>s>>d;
  cout<<(dfs(0,0)-1+1000000007)%1000000007<<endl;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 8832
N = gets.to_i
ary = gets.split.map(&:to_i).sort.reverse
sum = ary[0]
done = Array.new(N, 0)
pre_idx = 1
2.upto(N-1) do |n|
    sum += ary[pre_idx]
    if done[pre_idx] == 0
        done[pre_idx] = 1
    else
        pre_idx += 1
    end
end
puts sum

Measured memory_bytes: 32768
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;

public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str;
		String[] arrStr;
		try {
			str = br.readLine();
			arrStr = str.split(" ");

			long a = Integer.parseInt(arrStr[0]);
			long b = Integer.parseInt(arrStr[1]);

			long d = a/b;
			long r = a%b;
			double f = (double)a/b;

			DecimalFormat df = new DecimalFormat("0.00000000");
			System.out.println(d+" "+r+" "+df.format(f));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 17304
#include <bits/stdc++.h>
using namespace std;
#define N 300005
int main(){
	cin.tie(NULL);
	int n,a[N];
	long long ans=0;
	cin>>n;
	for(long long i=0;i<3*n;i++)
		cin>>a[i];
	sort(a,a+3*n);
	for(long long i=1;i<=n;i++)
		ans+=a[3*n-2*i];
	cout<<ans<<'\n';
} 

Measured memory_bytes: 1408
package main

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

func main() {
	var S string
	var ans int

	fmt.Scan(&S)
	strs := read()
	for strs != "END_OF_TEXT" {
		strs = strings.ToLower(strs)
		str := strings.Split(strs, " ")
		for _, value := range str {
			if value == S {
				ans++
			}
		}
		strs = read()
	}
	fmt.Println(ans)
}

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}



Measured memory_bytes: 1192
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}
int main(){
    int n=in(),k=in(),c=in();
    vec a(n);
    string s=stin();
    rep(i,n){
        a[i]=s[i]=='o'?1:0;
    }
    vec dp1(n),dp2(n);
    dp1[0]=a[0]==1?1:0;
    dp2[n-1]=a[n-1]==1?1:0;
    rep(i,n-1){
        if(i<c){
            dp1[i+1]=a[i]==1?1:dp1[i];
            dp2[n-i-2]=a[n-i-2]==1?1:dp2[n-i-1];
        }else{
            dp1[i+1]=a[i+1]==1?max(dp1[i-c]+1,dp1[i]):dp1[i];
            dp2[n-i-2]=a[n-i-2]==1?max(dp2[n-i-1+c]+1,dp2[n-i-1]):dp2[n-i-1];
        }
    }
    vec ans;
    rep(i,n){
        bool flag=false;
        if(a[i]==0)continue;
        if(i<1){
            if(dp2[i+1]==k-1)flag=true;
        }else if(i<n-1){
            if(dp1[i-1]+dp2[i+1]==k-1)flag=true;
        }else{
            if(dp1[i-1]==k-1)flag=true;
        }
        if(flag)ans.pb((int)(i+1));
    }
    REP(e,ans){
        cout<<e<<endl;
    }
}



Measured memory_bytes: 6944
import java.util.ArrayList;
import java.util.Scanner;

class Node{
	int depth = 0;
	int height = 0;
	int degree = 0;
	int parent = -1;
	String type = "";
	int sibling = - 1;
	ArrayList<Integer> children = new ArrayList<Integer>();
} 

public class Main {
	
	private static Scanner src;
	public static Node[] tree;
	public static void main(String[] args) {
		src = new Scanner(System.in);
		int n = src.nextInt();
		tree = new Node[n];
		for(int i = 0; i < n; i++) tree[i] = new Node(); 
		for(int i = 0; i < n; i++) {
			int id = src.nextInt(); 
			Integer lc = src.nextInt(), rc = src.nextInt();
			if(lc != -1) {
				tree[id].children.add(lc);
				tree[lc].parent = id;
				tree[lc].sibling = rc;
			}
			if(rc != -1) {
				tree[id].children.add(rc);
				tree[rc].parent = id;
				tree[rc].sibling = lc;
			}
		}
		for(int i = 0; i < n; i++) {
			tree[i].degree = tree[i].children.size();
			if(tree[i].parent == -1) {
				setDepth(i, 0);
				setHeight(i);
			}
		}
		for(int i = 0; i < n; i++) {
			StringBuilder answ = new StringBuilder();
			answ.append("node ").append(i).append(": parent = ").append(tree[i].parent).append(", sibling = ")
			.append(tree[i].sibling).append(", degree = ").append(tree[i].degree).append(", depth = ")
			.append(tree[i].depth).append(", height = ").append(tree[i].height).append(", ");
			if(tree[i].parent == -1) { answ.append("root"); } 
			else if(tree[i].children.size() > 0) { answ.append("internal node"); }
			else answ.append("leaf");
			System.out.println(answ);
		}
	}
	static void setDepth(int i, int j) {
		tree[i].depth = j;
		for(int n = 0; n < tree[i].children.size(); n++) {
			setDepth(tree[i].children.get(n), j + 1);
		}
	}
	private static void setHeight(int i) {
		if(tree[i].children.size() == 0) return;
		int max = 0;
		for(int j = 0; j < tree[i].children.size(); j++) {
			setHeight(tree[i].children.get(j));
			if(tree[tree[i].children.get(j)].height > max) 
				max = tree[tree[i].children.get(j)].height;
			}
		tree[i].height = max + 1;
	}
}



Measured memory_bytes: 26356
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N, M;
  cin >> N >> M;
  int sum = 0;
  vector<int> a(N);
  rep(i,N) {
    cin >> a[i];
    sum += a[i];
  }

  sort(a.begin(), a.end(), greater<int>());
  double th = (double)sum/(4*M);

  if ((double)a[M-1] < th ) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<int, int> P;
int N, T, H, L; 

int solve(vector<P> &v){
  int n = 0, c = 0;
  while(true){
    if(v[n].first == 0 && v[n].second == 0) return n + 1;

    if(v[n].first > 0) { c += 10; v[n].first--; T++; }
    else if(v[n].second > 0) { c += 100; v[n].second--; H++; }

    if(T > L) return n + 1;
    if(c >= 90){
      int a = 0, b = 0, r = c - 90;;
      while(r / 10 > T) { r -= 100; b++; }
      a = r / 10;
      if(a > T || b > H || a < 0) return n + 1;
      T -= a; H -= b;
      v[n].first += a; v[n].second += b;
      c = 0;
    }
    n = (n + 1) % N;
  }
}

int main() {
  cin >>N >>T >>H >>L;
  vector<P> v(N); REP(i, N) cin >>v[i].first >>v[i].second;
  cout <<solve(v) <<endl;
  return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int Max = max({a,b,c}), mi = min({a,b,c}), mid = a + b + c - Max - mi;
    int rsl = Max - mid;
    int n_ = rsl + mi;
    if((Max - n_)%2==0){
        cout << (Max - n_) / 2 + rsl << endl;
    }else{
        cout << (Max - n_) / 2 + 2 + rsl << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, y, z, k; cin >> x >> y >> z >> k;
    vector<ll> a(x); rep (i, x) cin >> a[i];
    vector<ll> b(y); rep (i, y) cin >> b[i];
    vector<ll> c(z); rep (i, z) cin >> c[i];
    vector<ll> prod;
    rep (i, x) rep (j, y) prod.push_back(a[i] + b[j]);
    sort(all(prod), greater<ll>());
    vector<ll> ans;
    rep (i, min(k, x*y)) rep (j, z) ans.push_back(prod[i] + c[j]);
    sort(all(ans), greater<ll>());
    rep (i, k) cout << ans[i] << "\n";
    return 0;
}

Measured memory_bytes: 42984
#define NDEBUG

#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <utility>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <tuple>
#include <set>
#include <map>

// [0, max)
#define FOR0(var, max) for (sl (var) = 0; (var) < (max); ++(var))
// [min, max)
#define FORi(var, min, max) for (sl (var) = (min); (var) < (max); ++(var))
// [min, max)
#define FORi_INV(var, min, max) for (sl (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

// a < b < c
#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
// a <= b < c
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
// a < b <= c
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
// a <= b <= c
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

#ifndef NDEBUG
#  define MASSERT(cond) m_assert(cond, __LINE__, #cond);
#else
#  define MASSERT(...)
#endif

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

using ld = long double;

void m_assert(const bool& cond, const sl& line, const char *condstr) {
  if (!cond) {
    cerr << "Assertion Failed: " << condstr << " at line " << line << endl;
    exit(1);
  }
}

static sl N, K;
static string S;

void solve(void) {
  char prev = S[0];
  sl prev_idx = 0;
  sl res = 0;
  sl count = 0;
  vector<pair<sl, char>> data;
  FOR0(i, N) {
    if (S[i] != prev) {
      data.emplace_back(i - prev_idx, prev);
      prev_idx = i;
      prev = S[i];
    } 
  }
  data.emplace_back(N - prev_idx, prev);
  FORITER(data, it) {
    it++;
    if (it == data.end()) {
      break;
    }
    if (count >= K) {
      break;
    }
    auto pit = std::prev(it);
    it->second = pit->second;
    count++;
  }
  vector<char> x(N);
  sl cur = 0;
  FORITER(data, it) {
    FOR0(j, it->first) {
      x[cur++] = it->second;
    }
  }
  res = 0;
  FOR0(i, N) {
    if (x[i] == 'L' && i > 0) {
      if (x[i - 1] == 'L') {
        res++;
      }
    }
    if (x[i] == 'R' && i <= N - 2) {
      if (x[i + 1] == 'R') {
        res++;
      }
    }
  }
  cout << res << endl;
}

int main(void) {
  cin >> N >> K;
  cin >> S;
  solve();
  return 0;
}

Measured memory_bytes: 2676
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define printll(a) printf("%lld\n", a)
#define printdbl(a) printf("%lf\n", a)
#define printYes() printf("Yes\n")
#define printNo() printf("No\n")
#define scanll(a) scanf("%lld", &a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define scan4Int(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
typedef long long ll;
const int INF = 1001001001;
using namespace std;
void swap(int *a, int *b) {
    int tmp = *a;
    *a = *b;
    *b = tmp;
    return;
}
int gdc(int a, int b) {
    int r;
    if (a < b)
        swap(&a, &b);
    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}
int factorial(int a) {
    int ans = 1;
    for (int i = 1; i <= a; ++i) 
        ans *= i;
    return ans;
}

int main() {
    int n;
    scanInt(n);
    ll ls[n];
    rep(i, n) cin >> ls[i];
    if (n < 3) {
        printInt(0);
        return 0;
    }
    ll count = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++ j) {
            for (int k = j + 1; k < n; ++k) {
                if (ls[i] == ls[j] || ls[i] == ls[k] || ls[j] == ls[k])
                    continue;
                if (ls[i] + ls[j] > ls[k] &&
                    ls[j] + ls[k] > ls[i] &&
                    ls[k] + ls[i] > ls[j])
                    count++;
            }
        }
    }
    printll(count);
    return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if(a > b)
    cout << 2 * a - 1 << endl;
  else if(b > a)
    cout << 2 * b - 1 << endl;
  else
    cout << a + b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    if(N==3){
        cout1("2 5 63");
        return 0;
    }
    
    int a=N%3?N-2:N-4;
    if(a>15000) a=N%2?14999:15000;
    rep1(i,a) cout<<i*2<<" ";
    rep(i,N-a) cout<<i*6+3<<" ";
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> b(m);
    rep(i,m) cin >> b[i];
    int ans = 0;
    rep(i,n){
        int cost = 0;
        rep(j,m){
            int a;
            cin >> a;
            cost += a*b[j];
        }
        if(cost + c > 0) ++ans;
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3580
# include <iostream>
using namespace std;
const int N=306,M=90006;
struct node
{
	int x,y;
}a[M];
int b[N][N],c[M];
int n,m,p,q,u,s;
void work (void)
{
	int i,j,k,t;
	for (i=1;i<=p;i++)
	{
		j=i;
		k=i+p;
		s=0;
		while (k<=u)
		{
			if (a[k].x>=a[j].x)
			t=a[k].x-a[j].x;
	   else t=a[j].x-a[k].x;
	        s+=t;
	        if (a[k].y>=a[j].y)
			t=a[k].y-a[j].y;
	   else t=a[j].y-a[k].y;
	        s+=t;
	        c[k]=s;
	        j=k;
	        k+=p;
		}
	}
	cin>>q;
	for (i=1;i<=q;i++)
	{
		cin>>j>>k;
		s=c[k]-c[j];
		cout<<s<<endl;
	}
}
int main (void)
{
	int i,j;
	cin>>n>>m>>p;
	u=n*m;
	for (i=1;i<=n;i++)
	for (j=1;j<=m;j++)
	{
		cin>>b[i][j];
		a[b[i][j]].x=i;
		a[b[i][j]].y=j;
	}
	work ();
	return 0;
}


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


vector<int> ki[110000];
map<P,int> ans;
void dfs(int now,int last,int banned){
    int c = 1;
    for(int next:ki[now]){
        if(next == last)continue;
        if(c == banned)c++;
        ans[P(now,next)] = c;
        ans[P(next,now)] = c;
        dfs(next,now,c);
        c++;
    }
    return;
}
int main(){
    int n;
    cin >> n;
    vector<int> a(n-1),b(n-1);
    rep(i,n-1){
        cin >> a[i] >> b[i];
        a[i]--;b[i]--;
        ki[a[i]].push_back(b[i]);
        ki[b[i]].push_back(a[i]);
    }
    int dim = 0;
    rep(i,n){
        dim = max(dim,(int)ki[i].size());
    }
    cout << dim << endl;
    dfs(0,-1,-1);
    rep(i,n-1){
        cout << ans[P(a[i],b[i])] << endl;
    }
    return 0;
}

Measured memory_bytes: 20736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
	vector<char> s(4);
	rep(i, 4) {
		cin >> s[i];
	}
	int count = 0;
	rep(i, 4) {
		if (s[i] == '+') {
			count++;
		}
		if (s[i] == '-') {
			count--;
		}
	}
	cout << count << endl;
}

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

using namespace std;
using ll=long long;

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
const int MOD=1e9+7;

template<typename T>
void fail(T v){cout << v << endl;exit(0);}

void solve(){
  int a,b;
  cin >> a >> b;
  if(a>9||b>9)
    fail(-1);
  cout << a*b << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;
 map<char, int>mp;
int main(){

    string s;
    cin >> s;
   
    for (int i = 0; i < s.size(); i++)
    {
        mp[s[i]]++;
    }
    for (int i = 0; i < s.size(); i++)
    {
        if(mp[s[i]]!=2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 764
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))

res = []
for i in range(N-1):
    res.append(A[i+1] - A[i])
    if i+1 == N-1:
        res.append(K - A[i+1] + A[0])
print(sum(res) - max(res))

Measured memory_bytes: 26420
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;
std::string s[100];
ll t[100];
std::string X;

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

  rep( i, N )
    std::cin >> s[i] >> t[i];

  std::cin >> X;

  bool fl = false;
  ll ans = 0;

  rep( i, N ) {
    if( fl )
      ans += t[i];

    if( s[i] == X )
      fl = true;
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 3608
#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>;
//pow(x,n)
//cout << fixed << setprecision(桁数);

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

    if(c>b || a>d) cout << 0 << endl;
    else if(c>=a){
        cout << min(b-c,d-c) << endl;
    }
    else cout << min(d-a,b-a) << endl;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    val n = sc.nextLong()
    val a = sc.nextLong()
    val b = sc.nextLong()

    var total = n / (a+b) * a
    if (n % (a+b) != 0L) total += Math.min(n % (a+b), a)

    println(total)
}

Measured memory_bytes: 31384
import java.util.*;
 
public class Main{
  static public void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num[] = new int[3];
    num[0] = sc.nextInt();
    num[1] = sc.nextInt();
    num[2] = sc.nextInt();
    
    int count5 = 0, count7 = 0;
    
    for(int i=0; i<3; i++){
      if(num[i] == 5){
        count5++;
      }else if(num[i] == 7){
        count7++;
      }else{
        System.out.println("NO");
      }
    }
    
    if(count5 == 2 && count7 == 1)
      System.out.println("YES");
    else{
      System.out.println("NO");
    }
    
  }
}

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

#define lowbit(x) ((x) & -(x))

const int maxn = 1e5 + 20;
const int MOD = (int) 1e9 + 7;

int n, k;
int a[55];

int l[55][111], r[55][111];

void work()
{
    cin >>n >>k;
    for(int i = 1; i <= n; i++) cin >>a[i];

    multiset<int> s;
    int tot = 0;

    for(int i = 1; i <= n; i++)
    {
        if(a[i] < 0) s.insert(a[i]);
        tot += a[i];

        l[i][i] = tot;

        int cnt = 0;
        multiset<int> tmps = s;
        int tmptot = tot;

        while(tmps.size())
        {
            int v = *tmps.begin();
            tmps.erase(tmps.find(v));
            tmptot -= v;
            cnt++;
            l[i][i + cnt] = tmptot;
        }
    }

    reverse(a + 1, a + 1 + n);

    s.clear();
    tot = 0;

    for(int i = 1; i <= n; i++)
    {
        if(a[i] < 0) s.insert(a[i]);
        tot += a[i];

        r[i][i] = tot;

        int cnt = 0;
        multiset<int> tmps = s;
        int tmptot = tot;

        while(tmps.size())
        {
            int v = *tmps.begin();
            tmps.erase(tmps.find(v));
            tmptot -= v;
            cnt++;
            r[i][i + cnt] = tmptot;
        }
    }

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= k; j++)
            l[i][j] = max(l[i][j], max(l[i - 1][j], l[i][j - 1])),
            r[i][j] = max(r[i][j], max(r[i - 1][j], r[i][j - 1]));

    int ans = 0;
    for(int i = 0; i <= n; i++)
        for(int j = 0; j <= k; j++)
            ans = max(ans, l[i][j] + r[n - i][k - j]);

    cout <<ans <<endl;
}

int main()
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
    int tc = 1;
//    cin >>tc;
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 256
from sys import stdin
n = int(stdin.readline().rstrip())
abc = []
for i in range(n):
    abc.append([int(x) for x in stdin.readline().rstrip().split()])
dp = [[0] * (n + 1) for i in range(3)]
dp[0][0] = abc[0][0]
dp[1][0] = abc[0][1]
dp[2][0] = abc[0][2]
for i in range(n - 1):
    for j in range(3):
        for k in range(3):
            if j != k:
                renew = dp[k][i] + abc[i + 1][j]
                if dp[j][i + 1] < renew:
                    dp[j][i + 1] = renew
ans = 0
for i in range(3):
    if ans < dp[i][n-1]:
        ans = dp[i][n-1]
print(ans)


Measured memory_bytes: 36152
#include <iostream>
#include <map>
//#include <bits/stdc++.h>

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

//using ll = long long;
using namespace std;


int main(){

  // std::cin >>
  // int N = 3;
  // string input = "3\napple\norange\napple";
  int N;
  string input;
  //std::cin << input;
  std::cin >> N;

  string items[N];
  items[0] = "apple";
  items[1] = "orange";
  items[2] = "apple";
  map<string, int> mp;


  for(int i=0; i<N; ++i){
    std::cin >> items[i];
    mp[items[i]] = 1;
  }
  //std::cout << "hello\n";
  std::cout << mp.size() << endl;


  return 0;
}


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


int32_t main()
{
    int a,b,c;

    cin>>a>>b>>c;
    int k;
    cin>>k;

    for(int i=0; i<k; i++){

        if(a>=b) b*=2;
        else if(b>=c) c*=2;
    }

    //cout<<a<<" "<<b<<" "<<c<<endl;
    if(a<b and b<c) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}


Measured memory_bytes: 3672
n = int(input())

bld = [0 for i in range(10 * 3 * 4)]

for i in range(n):
    b,f,r,v = map(int,input().split())
    bld[(b-1) * 30 + (f - 1) * 10 + (r - 1)] += v

for i in range(0,len(bld),10):
    if i % 30 == 0 and i > 0:
        print("####################")
    print(" " + " ".join(map(str,bld[i:i+10])))



Measured memory_bytes: 5608
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
     String[] nyu=sc.nextLine().split(" ");

   //  String nyu=sc.nextLine();
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);
//int C=Integer.parseInt(nyu[2]);
//int D=Integer.parseInt(nyu[3]);



double A=Double.parseDouble(nyu[0]);
double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/

//int res=(24-C)+24;
//if(A+B<C+D){
double res=Math.ceil((A+B)/2);

System.out.println((int)res);
//}else if(A+B>C+D){
//System.out.println("Left");

//}else{
//System.out.println("Balanced");

//}




	}
}

Measured memory_bytes: 21716
n = int(input())
h = list(map(int, input().split()))

maxV = 0
temp = 0

for i in range(1, n):
#    print("\n#i: " + str(i))
    if h[i] <= h[i-1]:
#        print('increment!')
        temp += 1
#        print('now temp: ' + str(temp))
    else:
#        print('finish!')
        temp = 0

    if temp > maxV:
        maxV = temp

print(maxV)



Measured memory_bytes: 63856
N = gets.to_i
A = gets.chomp.split(" ").map(&:to_i)

if A.count(0) > 0 then
  puts 0
else
  ans = 1
  A.each{|a|
    ans *= a
    break if ans > 10 ** 18
  }
  puts ans > 10**18 ? -1 : ans
end


Measured memory_bytes: 23384
using System;
using System.Linq;

class abc126b{
  static void Main(){
    var S=Console.ReadLine();
    
    var AA = "" + S[0] + S[1];
    var BB = "" + S[2] + S[3];
    
    var aa = int.Parse(AA);
    var bb = int.Parse(BB);
    
    var result = "";
    
    if(aa>0&&aa<13)
    {
    	if(bb>0&&bb<13)
    	{
    		result = "AMBIGUOUS";
    	}
    	else
    	{
    		result = "MMYY";
    	}
    }
    else
    {
    	if(bb>0&&bb<13)
    	{
    		result = "YYMM";
    	}
    	else
    	{
    		result = "NA";
    	}
    }
    
    
    Console.WriteLine(result);
    
    return;
  }
}


Measured memory_bytes: 13140
n = int(input())
chars = 'Xabcdefghijklmnopqrstuvwxyz'
res = ''
while True:
    x = n%26
    if x == 0:
        x = 26
    res += chars[x]
    n -= x
    if n == 0 :
        break
    n //= 26
print(res[::-1])

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int r, g, b;
    cin >> r >> g >> b;

    if((g*10+b)%4==0) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}

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

using namespace std;

typedef long long ll;

struct WeightedUnionFind{
    vector<int> par; // 親の番号
    vector<int> ws;  // 親との重みの差
    
    WeightedUnionFind(int n) : par(n,-1), ws(n,0){}
    
    int find(int x){
        if(par[x] < 0){
            return x;
        }else{
            int parent = find(par[x]);
            ws[x] += ws[par[x]];
            return par[x] = parent;
        }
    }
    
    int weight(int x){
        find(x); 
        return ws[x];
    }
    
    bool unite(int x, int y, int w){ // x <-(w)- y (x + w = y)
        w += weight(x); 
        w -= weight(y);
        x = find(x); y = find(y);
        
        if(x != y){
            if(par[y] < par[x]) {  // 多い方が根になるようにスワップする.
                int tmp = x; x = y; y = tmp; w = -w;
            }
            par[x] += par[y]; par[y] = x;
            ws[y] = w;
            return true;
        }else{
            return false;
        }
    }
    
    bool same(int x, int y){
        return find(x) == find(y);
    }
    
    void init(int size){
        for(int i=0;i<size;i++){
            par[i]=-1;
            ws[i]=0;
        }
    }
};

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

    int n,m;cin>>n>>m;
    WeightedUnionFind uf(111111);
    bool f=true;
    for(int i=0;i<m;i++){
        int l,r,d;cin>>l>>r>>d;l--;r--;
        if(uf.same(l,r)){
            if(uf.weight(r)-uf.weight(l)!=d) f=false;
        }
        else{
            uf.unite(l,r,d);
        }
    }
    if(f) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1844674407370955161
typedef long long int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

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

    // 素数である
    return true;
}
template<typename T>
int  GetDigit(T num){
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){
        }

        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size;i++){
                makeSet(i);
            }
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x,int y){
            return findSet(x) == findSet(y);
        }
        void unite(int x,int y){
            link(findSet(x), findSet(y));
        }
        void link(int x,int y){
            if(rank[x]>rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x]==rank[y]){
                    rank[y]++;
                }
            }
        }
        int findSet(int x){
            if(x!=p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};



int main()
{
    ll N;
    cin>>N;
    vector<ll> enu=enum_div(N);
    ll A=enu[enu.size()-1];
    ll B=N/A;
    A=GetDigit(A);
    B=GetDigit(B);
    cout<<max(A,B)<<endl;
}

Measured memory_bytes: 256
using System;
 
namespace abc072_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            for (int i = 0; i < s.Length; i += 2)
            {
                Console.Write(s[i]);
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <queue>
#include <stack>
typedef long long ll;
using namespace std;

int main(){
  ll i,j,k,n,a,b;
  cin >> a >> b;
  if(b%a==0)cout << a+b << endl;
  else cout << b-a << endl;
  string s;
  return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

int main() {
  ll a, b;
  cin >> a >> b;
  vector<ll> va;
  vector<ll> vb;

  // bについて
  bool con = true;
  for (ll i = 2; con; i *= 2) {
    if (b < i) con = false;
    ll res = 0;
    res += (b + 1) / i * (i / 2);
    if (i / 2 < (b + 1) % i) {
      res += (b + 1) % i - i / 2;
    }
    vb.push_back(res);
  }

  // aについて
  con = true;
  for (ll i = 2; con; i *= 2) {  // bと同じ回数繰り返す
    if (b < i) con = false;
    ll res = 0;
    res += a / i * (i / 2);
    if (i / 2 < a % i) {
      res += a % i - i / 2;
    }
    va.push_back(res);
  }

  vector<ll> vc(vb.size());
  for (ll i = 0; i < vc.size(); i++) {
    vc[i] = vb[i] - va[i];
  }

  ll ans = 0;
  ll step = 1;
  for (ll i = 0; i < vc.size(); i++) {
    if (vc[i] % 2) ans += step;
    step *= 2;
  }

  cout << ans << endl;
}


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

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

    int a, b, c;
    int x, y;
    cin >> a >> b >> c >> x >> y;

    int ans = 0;
    if (a + b > 2 * c) {
        if (x == y) ans = 2 * c * x;
        else if (x > y) {
            ans += 2 * c * y;
            if (a >= 2 * c) ans += 2 * c * (x - y);
            else ans += a * (x - y);
        }
        else if (x < y) {
            ans += 2 * c * x;
            if (b >= 2 * c) ans += 2 * c * (y - x);
            else ans += b * (y - x);
        }
    }
    else if (a + b <= 2 * c) {
        ans += a * x + b * y;
    }

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
using namespace std;
typedef long long ll;

vector<pair<int, int>> to[100010];
bool visited[100010];
ll dist[100010];
int main() {
    
    ll a,b,c;
    cin>>a>>b>>c;
    if((c-a-b) < 0) {
       cout << "No" << endl;
        return 0;
    }
    
    if(4*a*b < (c-a-b)*(c-a-b)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 5992
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define mp(a, b) make_pair(a, b)
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = (1e9 + 7);
using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
ll dp[100010];
ll gcd(ll x, ll y){
  return y == 0 ? x : gcd(y, x % y);
}
ll lcg(ll x, ll y){
  return x * y / gcd(x, y);
}
map<ll, ll> factor(ll n){
  map<ll, ll> ans;
  ll a = 2;
  while (n >= a * a){
    if (n % a == 0){
      ans[a]++;
      n /= a;
    }
    else a++;
  }
  ans[n]++;
  return ans;
}
template<class T> inline bool chmin(T& a, T b){
  if (a > b){
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b){
  if (a < b){
    a = b;
    return true;
  }
  return false;
}

int main(){
  cout << fixed << setprecision(15);
  //int ans = 0;
  string ans = "Yes";

  string s, t; cin >> s >> t;

  int n = s.size();
  vector<int> ss(26, -1);
  rep(i, n){
    if (ss[s[i] - 'a'] < 0) ss[s[i] - 'a'] = t[i] - 'a';
    else if (ss[s[i] - 'a'] != t[i] - 'a') ans = "No";
  }
  rep(i, 26){
    for (int j = i + 1; j < 26; j++){
      if (ss[i] == ss[j] && ss[i] >= 0) ans = "No";
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 776
a11, a12, a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())
pairs = [
    [a11, a12, a13],
    [a21, a22, a23],
    [a31, a32, a33],
    [a11, a21, a31],
    [a12, a22, a32],
    [a13, a23, a33],
    [a11, a22, a33],
    [a13, a22, a31],
]
n = int(input())
bList = []
for i in range(n):
    bList.append(int(input()))
flag = False
for pair in pairs:
    if (pair[0] in bList) and (pair[1] in bList) and (pair[2] in bList):
        flag = True
        break
print('Yes' if flag else 'No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
  public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

void solve(long long N, long long K){
    cout << N - K + 1 << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


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

int main() {
  string s;
  bitset<3> ans;
  cin >> s;
  vector<int> n(4);
  for(int i=0; i<4; i++) {
    n[i] = stoi(s.substr(i,1));
  }
  for(int i=0; i<pow(2,3); i++) {
    bitset<3> s(i);
    int a=n[0];
    for(int j=0; j<3; j++) {
      if(s.test(j)) {
        a+=n[j+1];
      } else
      if(!s.test(j)) {
        a-=n[j+1];
      }
    }
    if(a==7) {
      ans=s;
      break;
    }
  }
  cout << n[0];
  for(int i=1; i<n.size(); i++){
    if(ans.test(i-1)) cout << "+";
    else cout << "-";
    cout << n[i];
  }
  cout << "=7" << endl; 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define exp pow(10,-9)
#define F first
#define S second
#define PB push_back 
#define MP make_pair
#define daman ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define lowercase(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define uppercase(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
main(){
	int n;
	cin>>n;
	
	int ans[10005] = {0};
	for(int i=1;i<=101;i++)
	{
		for(int j=1;j<=101;j++)
		{
			for(int k=1;k<=101;k++)
			{
				int ind = i*i + j*j + k*k + i*j + j*k + k*i;
				if(ind < 10005)
					ans[ind]++;
			}
		}
	}
	
	for(int i=1;i<=n;i++)
		cout<<ans[i]<<"\n";
}

Measured memory_bytes: 3604
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
const int INF=1e9+7;

int main(){
  ll n,m,sum=0,ans=0;cin>>n>>m;
  vp a(n+m);
  rep(i,0,n){
    cin>>a[i].first;
    a[i].second=1;
  }
  rep(i,0,m){
    cin>>a[n+i].second>>a[n+i].first;
  }
  sort(a.begin(),a.end());reverse(a.begin(),a.end());
  ll i=0;
  while(sum<n){
    ll tmp=min(a[i].second,n-sum);
    ans+=a[i].first*tmp;
    sum+=tmp;
    i++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3328