akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a,b;
    cin >> a >> b;
    if(a.size() > b.size()){
        ANS("GREATER");
        return 0;
    }else if(a.size() < b.size()){
        ANS("LESS");
        return 0;
    }else{
        REP(i,a.size()){
            if(a[i] == b[i])continue;
            if(a[i] > b[i]){
                ANS("GREATER");
            }else if(a[i] < b[i]){
                ANS("LESS");
            }
            return 0;
        }
    }
    ANS("EQUAL");
    return 0;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    string o, e;
    cin >> o >> e;

    int strLen = o.size() + e.size();
    int oo = 0, ee = 0;
    for (int i = 1; i <= strLen; i++) {
        if (i & 1) {
            cout << o[oo++];
        } else {
            cout << e[ee++];
        }
    }
    cout << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;

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

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

  cout << 3*r*r << endl;


  return 0;
}


//cout << setprecision(13);
//next_permutation(v.begin(), v.end());



Measured memory_bytes: 256
N = int(input())
A = ['head']
for x in map(int, input().split()):
    if A[-1] != x:
        A.append(x)
if len(A) == 2:
    print(1)
    exit()
cnt = 1
inc = A[1] < A[2]
skip = False
for x, y in zip(A[2:], A[3:]):
    if skip:
        skip = False
        inc = x < y
        continue
    if inc != (x < y):
        skip = True
        cnt += 1
print(cnt)

Measured memory_bytes: 14252
#include <iostream>
#include <cstdio>
#include <string.h>
#include <vector>
#include <limits>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <assert.h>
#include <sstream>
#include <type_traits>
#define SET(x,y) x |= (1 << y)
#define CLEAR(x,y) x &= ~(1<< y)
#define READ(x,y) ((0u == (x & (1<<y)))?0u:1u)
#define TOGGLE(x,y) (x ^= (1<<y))
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define si(n) scanf("%d",&n)
#define sf(n) scanf("%f",&n)
#define sl(n) scanf("%lld",&n)
#define slu(n) scanf("%llu",&n)
#define sd(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define pnl printf("\n")
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pF first
#define pS second
#define CL(a,b) memset(a,b,sizeof(a))
#define sqr(x) ((x)*(x))
#define intLIMIT numeric_limits<int>
#define longLIMIT numeric_limits<long long>
#define GCD(a,b) __gcd((a),(b))
#define dbl(x) (double)(x)
#define vi vector <int>
#define vii vector < pair <int, int> >
#define vll vector <long long>
#define allof(x) (x).begin(), (x).end()
#define fastCin cin.sync_with_stdio(0);cin.tie(0)
#define scanUnsigned(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#define printArr(a,l) cout<<#a<<": ";for(int i=0;i<(l);i++){cout<<a[i]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(int i=0;i<(r);i++){for(int j=0;j<(c);j++){cout<<a[i][j]<<" ";}cout<<endl;}
char _;
using namespace std;
void PRINT (int x, int y) { for (int i = y-1; i >= 0; i--) { cout << READ(x,i); } cout << endl; }

vector<string>vec_splitter(string s){s+=',';vector<string>res;while(!s.empty()){res.push_back(s.substr(0,s.find(',')));s=s.substr(s.find(',')+1);}
return res;}
void debug_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,__attribute__((unused))int LINE_NUM){cerr<<endl;}
template<typename Head,typename...Tail>void debug_out(vector<string>args,int idx,int LINE_NUM,Head H,Tail...T){if(idx>0)cerr<<", ";else cerr<<"Line("<<LINE_NUM<<") ";stringstream ss;ss<<H;cerr<<args[idx]<<" = "<<ss.str();debug_out(args,idx+1,LINE_NUM,T...);}
#ifdef LOCAL_DBG
#define dbg(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define dbg(...) 42
#endif

int main () {
	fastCin;
	string s, t;
	cin >> s >> t;
	int ans = intLIMIT::max();
	for (int x = 0; x <= s.length()-t.length(); x++) {
		int cnt = 0;
		for (int i = x; i < x + t.length(); i++) {
			if (s[i] != t[i-x]) {
				cnt++;
			}
		}
		ans = min (ans, cnt);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3176
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	d := nextInt()
	x := nextIntMat(n, d)

	cnt := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			d2 := 0
			for k := 0; k < d; k++ {
				d2 += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k])
			}
			dist := math.Sqrt(float64(d2))
			if isInteger(dist) == true {
				cnt++
			}
		}
	}

	fmt.Println(cnt)

}
func isInteger(x float64) bool {
	return math.Floor(x) == x
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
func nextIntMat(a int, b int) [][]int {
	mat := make([][]int, a)
	for i := 0; i < a; i++ {
		mat[i] = make([]int, b)
		for j := 0; j < b; j++ {
			mat[i][j] = nextInt()
		}
	}
	return mat
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
#define forn(i, n) for (llong i = 0ll; i < (llong) n; ++i)
#define fornn(i, l, r) for (llong i = (llong) l; i < (llong) r; ++i)
#define size(x) ((int) (x.size()))
 
using namespace std;
 
typedef long long llong;
const llong inf = (llong) 1e+9 + 7ll;
const llong linf = (llong) 1e+18 + 7ll;
const long double eps = (long double) 1e-9;
const long double pi = acosl((long double) -1.0);
const int alph = 26;

mt19937 mrand(random_device{} ()); 

template<typename T, typename U> inline llong umin(const T& a, const U& b) { return a < b ? a : b; }
template<typename T, typename U> inline llong umax(const T& a, const U& b) { return a > b ? a : b; }
 
static char buff[(int) 2e6 + 17]; // reads std::string
const int maxn = (1 << 21);

struct pt
{
	int x, y;
	pt() { }
};

int H[maxn], F[maxn], used[maxn];

struct hash_table
{
	hash_table() { }

	int getpos(int h) const
	{
		int i = h % maxn;
		for (; used[i] && H[i] != h; ++i) if (i + 1 == maxn) i = -1;
		return i;
	}

	int& operator[](int h)
	{
		int i = getpos(h);
		H[i] = h;
		used[i] = 1;
		return F[i];
	}
};

struct fenwick
{
	int n;
	hash_table F;

	fenwick() { n = inf; }

	void upd(int i, int x)
	{
		for (; i < n; i |= i + 1)
			F[i] = max(F[i], x);
	}

	int get(int i)
	{
		int res = 0;

		for (; i >= 0; i &= i + 1, --i)
			res = max(res, F[i]);

		return res;
	}
};

int n;
pt s, f;
pt p[maxn];

bool read()
{
	if (scanf("%d %d %d %d %d", &s.x, &s.y, &f.x, &f.y, &n) != 5)
		return false;

	forn (i, n)
		scanf("%d %d", &p[i].x, &p[i].y);

	return true;
}

bool cmp(pt a, pt b) { return make_pair(a.x, a.y) < make_pair(b.x, b.y); }

void solve()
{
	if (s.x > f.x)
		swap(s, f);

	if (s.y > f.y)
	{
		f.y = 2 * s.y - f.y;

		forn (i, n)
			p[i].y = 2 * s.y - p[i].y;
	}

	vector<pt> pp;

	forn (i, n)
		if (s.x <= p[i].x && p[i].x <= f.x && s.y <= p[i].y && p[i].y <= f.y)
			pp.push_back(p[i]);

	sort(pp.begin(), pp.end(), cmp);
	fenwick dp;

	forn (i, size(pp))
		dp.upd(pp[i].y, dp.get(pp[i].y) + 1);

	int lis = dp.get(inf);
	long double ans = 0;

	if (lis != min(f.y - s.y, f.x - s.x) + 1)
		ans = 100.0 * (f.y - s.y + f.x - s.x) - 20.0 * lis + 5 * M_PI * lis;
	else
		ans = 100.0 * (f.y - s.y + f.x - s.x) - 20.0 * lis + 5 * M_PI * (lis - 1) + 10 * M_PI;

	printf("%.15f\n", (double) ans);
}

int main()
{
#if SEREZHKA
	freopen("file.in", "r", stdin);
#endif

	while (read())
		solve();

	return 0;
}


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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<ll> vll;
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

/////////////////////////////////

void solve() {

}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int a, b;
	scanf("%d %d", &a, &b);
	if (a + b == 15) {
		printf("+\n");
	} else if (a * b == 15) {
		printf("*\n");
	} else {
		printf("x\n");
	}
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
#define tl 1'000'000'007
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false); 
    ll n;
    cin >> n;
    ll x= sqrt((double)(2*n+1/4.0)) -1/2.0; 
    ll sum= x*(x+1)/2;
    ll a=0,b=0;
    if(n-sum>x) a= n-sum;
    else {
        a= x+1;
        b= x+1-(n-sum);
    }
    if(n-sum==0){
        a=0; b=0;
    }
    FOR(i,1,x+1){
        if(b==i) continue;
        cout << i << endl;
    }
    if(a) cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[110];
int main(){
    cin >> n;
    int tmp = 1;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(!(a[i]%2)) tmp <<= 1;
    }
    int ans = 1;
    for(int i=1;i<=n;i++) ans *= 3;
    cout << (ans-tmp) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,k,a[9999][9999],b[9999];
int main(){
  cin>>n>>k;
  r(i,k)r(j,n/2)cin>>a[i][j];
  while(1){
    r(i,n)b[i+1]=rand()%2;
    r(i,k){
      int cnt=0;
      r(j,n/2)cnt+=b[a[i][j]];
      if(cnt < n/8 || 3*n/8 < cnt)goto L;
    }
    r(i,n)cout<<b[i+1];
    cout<<endl;
    return 0;
    L:;
  }
}

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

#define MAXN 200010
#define ll long long
#define mod 1000000007

using namespace std;

int n, m, k, ans, tot;

string s;

int a[MAXN];

int main(){
	int t;
	scanf("%d", &n);
	while (n >= 500) {
		n -= 500;
		ans += 1000;
	}
	while (n >= 5) {
		n -= 5;
		ans += 5;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.Stream;

public class Main {

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

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(in.readLine());
      String line = in.readLine();
      int sum = 0;
      
      int offset=0,next=0;
      char regex = ' ';
      for(int i=0; i<n; i++) {
        if((next = line.indexOf(regex,offset)) == -1)
          next = line.length();
        sum += Integer.parseInt(line.substring(offset, next));
        sum--;
        offset = ++next;
      }

      System.out.println(sum);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 22996
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <string>
#include <deque>
#include <stack>
#include <cmath>

using namespace std;

#define PB push_back
#define MP make_pair
#define f first
#define s second
#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define RFOR(i, b, a) for (int i = b-1; i>=a; --i)
#define FILL(a, b) memset(a, b, sizeof a)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef pair<LL, LL> PLL;

const int INF = 1000 * 1000 * 1000;
const LL LINF = 1LL * INF*INF;
const int MAX = 310	;
const long double PI = acos(-1.);
const double EPS = 1e-6;
LL mod = 1000LL * 1000 * 1000 + 7;

double ans[MAX][MAX][MAX];
double n;

double dp(int a, int b, int c)
{
//	cout<<a<<" "<<b<<" "<<c<<endl;
	if((a+b+c)==0)
		return 0;
	if(abs(ans[a][b][c]+1)>=1)
	{
		return ans[a][b][c];
	}
	double x = 1.0*(n-a-b-c)/(1.0*(a+b+c));
	if(a)
		x+= (1.0*a/((a+b+c)*1.0)) *1.0*(1+dp(a-1,b,c));
	if(b)
		x+= (1.0*b/((a+b+c)*1.0))  *1.0*(1+dp(a+1,b-1,c));
	if(c)
		x+= (1.0*c/((a+b+c)*1.0)) *(1+dp(a,b+1,c-1));
	return ans[(int)a][(int)b][(int)c] = x;
}


int cnt[4];
int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin >> n;
	FOR(i,0,n)
	{
		int tmp;
		cin >> tmp;
		cnt[tmp]++;
	}
	FILL(ans,-1);

	cout<<fixed<<setprecision(8)<<dp(cnt[1],cnt[2],cnt[3]);
//	cout<<fixed<<setprecision(6)<<dp(1,0,0);
	return 0;
}


Measured memory_bytes: 233088
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
using namespace std;

int main() {
	string x, ch[500];
	int num = 0;
	cin >> x;
	for (int i = 0; i < x.size(); i++)x[i] = toupper(x[i]);
	for (int i = 0; i < 500; i++) {
		cin >> ch[i];
		if (ch[i] == "END_OF_TEXT")break;
		int a = 0;
		for (int j = 0; j < ch[i].size();j++) {
			ch[i][j] = toupper(ch[i][j]);
			//cout << ch[i][j] << endl;
		}
		if (ch[i] == x)num++;
		//cout << ch[i] << ":" << x << endl;
	}
	cout << num << endl;

	return 0;
}

Measured memory_bytes: 3244
from itertools import accumulate

N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0

A = list(accumulate(A))
A.insert(0,0)
B = list(accumulate(B))
B.insert(0,0)

j = M

for i in range(N+1):
    if A[i] > K:
        break
    while B[j] > K - A[i]:
        j -= 1
    ans = max(ans,i+j)

print(ans)

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

using namespace std;

const int MOD = 1000000007;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  long long ans = 0;
  for (long long i = k; i <= n + 1; i++) {
    ans += i * (2 * n - i + 1) / 2;
    ans -= i * (i - 1) / 2;
    ans += 1;
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n;
  cin>>n;
  int64_t s,a,b,c;
  s=n*(n+1)/2;
  int64_t x,y,z;
  x=n/3;
  y=n/5;
  z=n/15;
  a=x*(x+1)*3/2;
  b=y*(y+1)*5/2;
  c=z*(z+1)*15/2;
  cout<<s-a-b+c;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define mp make_pair

const int INF = INT_MAX;

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

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	long long n;
	cin >> n;

	vi arr;

	while(n > 0){
		if(n % 26 != 0){
			arr.pb(n % 26);
			n /= 26;
		}
		else{
			arr.pb(26);
			n /= 26;
			n--;
		}
	}

	for(int i = arr.size() - 1; i >= 0; i--){
		char c = arr[i] + 96;
		cout << c;
	}
	cout << "\n";

	return 0;
}

Measured memory_bytes: 3656
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var n, q int
	fmt.Fscan(r, &n, &q)

	tree := New(n)

	for i := 0; i < q; i++ {
		var com, x, y int
		fmt.Fscan(r, &com, &x, &y)

		if com == 0 {
			tree.Add(x-1, y)
		} else if com == 1 {
			fmt.Fprintln(w, tree.Query(x-1, y-1))
		}
	}
}

type Tree struct {
	n   int
	bit []int
}

func New(n int) *Tree {
	return &Tree{
		n:   n,
		bit: make([]int, n+1),
	}
}

func (t *Tree) Add(i, x int) {
	for i <= t.n {
		t.bit[i] += x
		i |= i + 1
	}
}

func (t *Tree) Query(l, r int) int {
	var ret int
	if l <= r {
		ret = t.query(r) - t.query(l-1)
	}
	return ret
}

func (t *Tree) query(i int) int {
	var ret int
	for i >= 0 {
		ret += t.bit[i]
		i = (i & (i + 1)) - 1
	}
	return ret
}



Measured memory_bytes: 5956
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();
        //素数を真偽判定する
        boolean result;

        for(long i = X; i < 100010 ; i++){
            //素数であると仮定して初期化
            result = true;
            for(long j = 2; j < i; j++){
                if(i % j == 0){
                    //約数を持つ場合素数でない
                    result = false;
                    sc.close();
                    break;
                }
            }
            //結果が真であるなら素数としてカウント
            if(result && i >= X){
            	sc.close();
            	System.out.println(i);
            	break;
            }
        }
    }
}

Measured memory_bytes: 22100
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int count=0;
    int sales=0;
    int sales_quantity=0;
    while(sc.hasNext()) {
      String line = sc.nextLine();
      String[] a  = line.split(",");
      sales += Integer.parseInt(a[0]) * Integer.parseInt(a[1]);
      sales_quantity += Integer.parseInt(a[1]);
      count++;
    }
    double avg = sales_quantity * 10 / count;
    System.out.println(String.valueOf(sales));
    System.out.println(String.valueOf(Math.round(avg/10)));
  }
}

Measured memory_bytes: 25620
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll M1,D1,M2,D2;
  cin>>M1>>D1>>M2>>D2;
  if(M1!=M2){cout<<1<<endl;}
  else{cout<<0<<endl;}

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  V<> a(n); for (auto&& e : a) cin >> e;
  sort(rbegin(a), rend(a));
  int p = 0;
  for (int e : a) p += e > 0;
  p = min(max(p, 1), n - 1);
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (i < p) res += a[i];
    else res -= a[i];
  }
  cout << res << '\n';
  for (int i = 1; i < p; ++i) {
    cout << a.back() << ' ' << a[i] << '\n';
    a.back() -= a[i];
  }
  for (int i = p; i < n - 1; ++i) {
    cout << a[0] << ' ' << a[i] << '\n';
    a[0] -= a[i];
  }
  cout << a[0] << ' ' << a.back() << '\n';
  assert(a[0] - a.back() == res);
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<double, double>;

double fact(int x) {
  double res;
  if (x == 0) res = 1;
  else res = x * fact(x-1);
  return res;
}

int main() {
  int N;
  cin >> N;
  vector<P> town(N);
  for (int i = 0; i < N; i++) {
    double x, y;
    cin >> x >> y;
    town[i].first = x;
    town[i].second = y;
  }

  vector<int> order(N);
  for (int i = 0; i < N; i++) order[i] = i;
  sort(order.begin(), order.end());

  double ans = 0;
  do {
    double length = 0;
    for (int i = 0; i < N-1; i++) {
      length += sqrt((town[order[i]].first - town[order[i+1]].first)*(town[order[i]].first - town[order[i+1]].first) + (town[order[i]].second - town[order[i+1]].second)*(town[order[i]].second - town[order[i+1]].second));
    }
    ans += length / fact(N);
  } while (next_permutation(order.begin(), order.end()));
  printf("%.10lf\n", ans);
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {


	public static void main(String[] args) {

//		long ans = 0;
//		double ans = 0.0;
		int ans = 0;
//		String ans = "";

		Scanner sc = new Scanner(System.in);
//		double waru = 1000000007;


//		long n = sc.nextLong();
//		long m = sc.nextLong();
//		long k = sc.nextLong();

		int n = sc.nextInt();
		int m = sc.nextInt();
//		int k = sc.nextInt();
//		int v = sc.nextInt();
//		String s = sc.next();


//		String string = sc.next();
//		StringBuilder s = new StringBuilder(string);

		boolean f = false;

//		String[] s = new String[n];

//		int[] a = new int[n];
//		int[] b = new int[n];
//		long[] a = new long[n];
//		long[] b = new long[n];
//		int[][] a = new int[n][m];

//		for (int i = 0; i < n; i++) {
//			a[i]= sc.nextInt();
//		}

//		for (int i = 0; i < h; i++) {
//			for(int j = 0; j < w; j++) {
//				a[i][j] = sc.nextInt();
//			}
//		}


		String s = "";

		if(n>m) {
			for(int i=0; i < n; i++) {
				s+=String.valueOf(m);;
			}
			System.out.println(s);
		} else {
			for(int i=0; i < m; i++) {
				s+=String.valueOf(n);;
			}
			System.out.println(s);
		}







//		System.out.println(ans);

		sc.close();
	}


}

Measured memory_bytes: 19668
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c;
	cin>>a>>b>>c;
	cout<<min(min(abs(a*b*(c/2)-a*b*((c+1)/2)),abs(a*c*(b/2)-a*c*((b+1)/2))),abs(b*c*(a/2)-b*c*((a+1)/2)))<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
import collections
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = collections.Counter(a)
    all_comb = 0
    for i in cnt.keys():
        all_comb += cnt[i] * (cnt[i]-1) // 2
    for i in range(n):
        comb = all_comb
        comb -= cnt[a[i]] * (cnt[a[i]]-1) // 2
        comb += (cnt[a[i]]-1) * (cnt[a[i]]-2) // 2
        print(comb)
        
if __name__ == '__main__':
    main()

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

int main() {
  string S;
  cin >> S;

  for (int n = 1; n <= S.length(); n++) {
    if (n % 2 == 0 && S[n - 1] == 'R') {
      cout << "No" << endl;
      return 0;
    }

    if (n % 2 == 1 && S[n - 1] == 'L') {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}


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

namespace{
vector<vector<int>> G;
vector<int> seq;
vector<int> idxs;

void dfs(int u){
	if(idxs[u] >= 0){
		seq.erase(seq.begin(), seq.begin() + idxs[u]);
		throw 0;
	}
	if(idxs[u] == -2){ return; }
	idxs[u] = seq.size();
	seq.push_back(u);
	for(int v : G[u]){ dfs(v); }
	seq.pop_back();
	idxs[u] = -2;
}

void main2(){
	int n, m;
	cin >> n >> m;
	G.resize(n);
	for(int i = 0; i < m; ++i){
		int a, b;
		cin >> a >> b;
		G[a - 1].push_back(b - 1);
	}
	idxs.assign(n, -1);
	try{
		for(int i = 0; i < n; ++i){
			if(idxs[i] == -1){ dfs(i); }
		}
		cout << "-1\n";
		return;
	}
	catch(int){}

	for(int z = 0; z < n; ++z){
		idxs.assign(n, -1);
		for(int i = 0; i < (int)seq.size(); ++i){
			idxs[seq[i]] = i;
		}
		int u = seq[0];
		int mx = 1;
		for(int v : G[u]){ mx = max(mx, idxs[v]); }
		seq.erase(seq.begin(), seq.begin() + mx);
		seq.push_back(u);
	}
	cout << seq.size() << '\n';
	for(int u : seq){ cout << (u + 1) << '\n'; }
}
}

int main(){
	ios::sync_with_stdio(false);
	main2();
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e10;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;
//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

int main() {

    int a, b, c, d;

    cin >> a >> b >> c >> d;

    if (abs(c - a) <= d) {
        cout << "Yes" << endl;
        return 0;
    }

    int max_dis = max(abs(b - a), abs(b - c));

    if (max_dis <= d) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
int main(){
    int n;cin >> n;
    string s; cin >> s;
    vector<int> info(n);
    set<char> a;
    rep(i,n){
        a.insert(s[n-1-i]);
        info[n-1-i] = a.size();
    }
    ll ans=0;
    rep(i,10){
        rep(j,10){
            rep(k,n-2){
                if(s[k]=='0'+i){
                    for(int l=k+1;l<n-1;l++){
                        int x=0;
                        if(s[l]=='0'+j){
                            ans+=info[l+1];
                            x=1;
                        }
                        if(x==1)break;
                    }
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int lens = s.size();
    int answer;
    for(int i = 0; i < (1<< (lens -1 ) ) ; i++){
        int ans = s.at(0) - '0';
        for(int j = 0 ; j <lens -1 ; j++){
            int tmp = s.at(j+1) - '0';
            if(i & (1<<j) ){
                ans += tmp;
            }
            else ans -= tmp;
        }
        if(ans == 7){
            answer = i;
            break;
        }
    }
    vector< char> vec= {'-', '+'};
    string ouo = "0-0-0-0=7";
    for(int k =0; k < 4 ; k++){
        ouo[2 * k  ] = s.at(k);
    }
    for(int l = 0; l<3 ; l++){
        if(answer & 1<<l){
            ouo[2 * l +1] = '+';
        }
    }
    cout<<ouo<<endl;



}

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  vector<int> x(2000);
  vector<int> y(2000);
  rep(i,1500)x.at(i)=i*0.08;
  rep(i,1200)y.at(i)=i*0.1;
  int ss=lower_bound(all(x),a)-x.begin();
  int st=upper_bound(all(x),a)-x.begin();
  int rr=lower_bound(all(y),b)-y.begin();
  int rt=upper_bound(all(y),b)-y.begin();
  if(ss<=rr&&rr<st)cout<<rr<<endl;
  else if(rr<=ss&&ss<rt)cout<<ss<<endl;
  else cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

//メイン関数
int main(void){
  int H, W;

  while(1){
    scanf("%d %d", &H, &W);
    if(H == 0 && W == 0) break;
    for(int i=0; i<H; i++){
      for(int j=0; j<W; j++){
        if(i == 0 || i == H-1) printf("#");
        else if(j == 0 || j == W-1) printf("#");
        else if(i != 0 && i != H-1) printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2084
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var q = int.Parse(line[1]);
        var ans = getAns(n, q);
        Console.WriteLine(ans);
    }
    static string getAns (int n , int q)
    {
        var na0 = "kogakubu10gokan";
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var y = int.Parse(line[0]);
            if (q > y) na0 = line[1];
            else if (q == y) return line[1];
            else return na0;
        }
        return na0;
    }
}



Measured memory_bytes: 18044
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

func UpperBound(l []int, n int) int {
	ng := -1
	ok := len(l) - 1
	for math.Abs(float64(ok - ng)) > 1 {
		mid := (ok + ng) / 2
		if l[mid] > n {
			ok = mid
		} else {
			ng = mid
		}
	}
	return l[ok]
}

func Solve(stdin io.Reader, stdout io.Writer) {
	sc := bufio.NewScanner(stdin)

	/* 単語ごとに入力するならこれ */
	sc.Split(bufio.ScanWords)

	/* 入力バッファが大きくなるならこれ */
	buf := make([]byte, 1000000)
	sc.Buffer(buf, 1000000)

	sc.Scan()
	s := sc.Text()

	sc.Scan()
	t := sc.Text()

	list := make([][]int, 26)
	for i, v := range s {
		list[int(v - 'a')] = append(list[int(v - 'a')], i)
	}
	for i, v := range s {
		list[int(v - 'a')] = append(list[int(v - 'a')], i + len(s))
	}

	var cnt int64
	pos := -1

	for _, v := range t {
		vi := int(v - 'a')
		if len(list[vi]) == 0 {
			_, _ = fmt.Fprintf(stdout, "-1\n")
			return
		}
		pos = UpperBound(list[vi], pos)
		if pos >= len(s) {
			pos -= len(s)
			cnt++
		}
	}

	/* 出力用 */
	_, _ = fmt.Fprintf(stdout, "%v\n", int64(len(s)) * cnt + int64(pos) + 1)

}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}

Measured memory_bytes: 7808
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))
X = list(map(int, sys.stdin.readline().split()))
X = np.array(X)

ML = [[] for m in range(M)]
for x in X:
    ML[x % M].append(x)
counts = [[] for m in range(M)]
remains = [0] * M
even_sums = [0] * M
for m, li in enumerate(ML):
    counts[m] = list(Counter(li).values())
    remains[m] = len([c for c in counts[m] if c % 2 == 1])
    even_sums[m] = sum([c // 2 * 2 for c in counts[m]])

ans = 0
for m in range(M):
    m1 = m
    m2 = (M - m) % M

    if m1 == m2:
        rem = remains[m1] // 2
        remains[m1] -= rem * 2
        ans += rem
        if remains[m1]:
            rem = min(even_sums[m1] , remains[m1])
            remains[m1] -= rem
            even_sums[m2] -= rem
            ans += rem
    else:
        rem = min(remains[m1], remains[m2])
        remains[m1] -= rem
        remains[m2] -= rem
        ans += rem
        if remains[m1]:
            rem = min(even_sums[m2], remains[m1])
            remains[m1] -= rem
            even_sums[m2] -= rem
            ans += rem
        if remains[m2]:
            rem = min(even_sums[m1], remains[m2])
            remains[m2] -= rem
            even_sums[m1] -= rem
            ans += rem
for m in range(M):
    ans += even_sums[m] // 2
print(ans)


Measured memory_bytes: 42052
#include <stdio.h>
#include <string.h>

int main() {
  char S[11];
  scanf("%s",S);
  int len=strlen(S);
  int max=0,cnt=0;
  for (int i = 0; i < len; i++) {
    if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
      cnt++;
    }
    else {
      cnt = 0;
    }
    if (max < cnt) max = cnt;
  }
  printf("%d\n",max);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,  n) for (int i  =  0; i < (int)(n); ++i)
#define REPR(i,  n) for (int i  =  n - 1; i >= 0; --i)
#define FOR(i, s, e) for (int i  =  s; i <= (int)(e); ++i)
using namespace std;
#define int long long int
#define MOD 998244353
//------------ATCODER TEMPLATE-------------

signed main() {
  int N, K; cin >> N >> K;
  vector<pair<int, int>> ps(K);
  REP(i, K) {
    cin >> ps[i].first >> ps[i].second;
  }
  sort(ps.begin(), ps.end());

  vector<int> cnt(N + 1, 0);
  vector<int> S(N + 1, 0);
  S[0] = 0, S[1] = 1;;
  cnt[1] = 1;
  FOR(i, 2, N) {
    for (auto [L, R] : ps) {
      int l = max(i - R - 1, 0LL);
      int r = i - L;
      if (r < 0) break;
      cnt[i] = (cnt[i] + S[r] - S[l] + MOD) % MOD;
    }
    S[i] = (S[i-1] + cnt[i]) % MOD;
  }
  cout << cnt[N] << endl;
  return 0;
}


Measured memory_bytes: 6416
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string s;
    cin >> s;
    string ans;
    rep(i, sz(s)){
        if(s[i] == 'B' && sz(ans) != 0) ans.pop_back();
        else if(s[i] != 'B') ans.push_back(s[i]);
    }
    print(ans);


    

}

Measured memory_bytes: 3660
while True:
    try:
        for i in range(3):
            line = raw_input().strip()
            if line == '0':
                raise Exception

            if line[0] == 'A':
                a = -1
                b = 0
            else:
                a = 0
                b = -1
            for i, s in enumerate(line):
                if s == 'A':
                    a += 1
                else:
                    b += 1
            if a > b:
                a += 1
            else:
                b += 1
            print a, b

    except:
        break

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

int main() {
	ll price[4];
	for (int i = 0; i < 4; ++i) scanf("%lld", &price[i]);
	ll n; scanf("%lld", &n);
	price[0] /= 0.25, price[1] /= 0.5; // 2Lは誤差がでるため変換なし

	ll min_price = *min_element(price, price + 3);

	ll ans = 0;
	if (min_price > price[3] / 2) { //ここの除算の誤差は問題なし
		ans += (n / 2) * price[3];
		n -= (n / 2) * 2;

		ans += n * min_price;
	}
	else ans += min_price * n;

	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int N, M, C;
    cin >> N >> M >> C;
    int B[20];
    REP(i, M)
    cin >> B[i];
    int ans = 0;
    int tmp, in;
    REP(i, N)
    {
        tmp = C;
        REP(j, M)
        {
            cin >> in;
            tmp += in * B[j];
        }
        if (tmp > 0)
            ans++;
    }
    cout << ans << endl;
    // system("pause");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
    if (a < b) a = b;
}

int cnt[] = {2, 5, 5, 4, 5, 6, 3, 7, 6};

signed main() {
    int n, m;
    cin >> n >> m;
    int a[m];
    rep(i, m) {
        cin >> a[i];
        a[i]--;
    }
    sort(a, a + m);
    reverse(a, a + m);
    int dp[n + 1];
    fill(dp, dp + n + 1, -INF);
    dp[0] = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j < m; j++) {
            if (i - cnt[a[j]] < 0) continue;
            chmax(dp[i], dp[i - cnt[a[j]]] + 1);
        }
    }
    string ans;
    int i = n;
    while (i > 0) {
        for (int j = 0; j < m; j++) {
            if (i - cnt[a[j]] < 0) continue;
            if (dp[i] == dp[i - cnt[a[j]]] + 1) {
                ans.push_back(a[j] + '1');
                i -= cnt[a[j]];
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int mod=1000000007;


int main()
{

  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,m,k;
  cin>>n>>m>>k;
  vector<ll> a(n+1,0);
  vector<ll> b(m+1,0);
  for(int i=1; i<=n; i++){
        cin>>a[i];
        a[i]=a[i]+a[i-1];

  }
  for(int i=1; i<=m; i++){
        cin>>b[i];
        b[i]=b[i]+b[i-1];
  }
  ll ans=0,j=m;
  for(int i=0; i<=n; i++){
    if(a[i]>k){break;}
    while(b[j]>k-a[i]){j=j-1;}
    ans=max(ans,(ll)i+j);
  }
   cout<<ans;
  return 0;
}

Measured memory_bytes: 6348
#include<bits/stdc++.h>                
using namespace std;
typedef long long lint;
#define FOR(i,o,n) for(auto i = (o); (i) < (n); ++(i))
#define REP(i,n) FOR(i,0,n) 
#define REPR(i,n) for(auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr,v) for(auto itr=v.begin(); itr != v.end(); ++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name,h,w)  vector< vector<int> > name((h), vector<int>(w));

int main(){
	int A, B; cin >> A >> B;
	if(B % A) cout << B-A << endl; 
	else cout << A+B << endl;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <queue>
#define lol long long
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string a,b,c;
    cin >> a >> b;
    c=a;
    if(a==b){
        cout << "Yes";
        return 0;
    }
    lol n=a.length();
    char temp=a[n-1];
    a.erase(n-1,1);
    a=temp+a;
    while(a!=c){
        //cout << a << " " << b << endl;
        if(a==b){
            cout << "Yes";
            return 0;
        }
        char temp=a[n-1];
        a.erase(n-1,1);
        a=temp+a;
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb1 push_back
#define mod 1000000007LL
#define INF 1234567890

const int maxn = 2e5 + 10;


//initialization here
//

map<pair<ll, ll>, int> m;
//
//initialization finish


// your function is here
//



//
// your function finished



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

	// your code is here
	//
	string s; cin >> s;

	int idx[30];
	rep(i, 30)idx[i] = 0;

	rep(i, s.size())idx[s[i] - 'a']++;

	rep(i, 30)if (idx[i] % 2 == 1) { No; return 0; }


	Yes;
	//
	// your code finished

	return 0;
}

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

int main() {
    int n, m;
    while (cin >> n >> m, n | m) {
        vector<int> h(n), w(m);
        for (int i = 0; i < n; i++) cin >> h[i];
        for (int i = 0; i < m; i++) cin >> w[i];
        map<int, int> mh, mw;
        for (int i = 0; i < n; i++) {
            int sum = 0;
            for (int j = i; j < n; j++) {
                sum += h[j];
                mh[sum]++;
            }
        }
        for (int i = 0; i < m; i++) {
            int sum = 0;
            for (int j = i; j < m; j++) {
                sum += w[j];
                mw[sum]++;
            }
        }
        int ans = 0;
        for (auto e : mh) {
            ans += e.second * mw[e.first];
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 34256
#include<bits/stdc++.h>
#include <queue>
#include <cstring>
#define mp make_pair
#define pb push_back
#define p push

#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long int

#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);

#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE 1000000007
#define MAXN 100005
using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph ;


int main (){
   vi vec ;
   ll a ,b;
   ll aa,bb;
   cin>>a>>b;
   cin>>aa>>bb;
   if(a== aa  )cout<<0;
   else cout<<1;


    return 0;
}

Measured memory_bytes: 256
input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
line = lines.shift().split(' ')
n = line[0] * 1
m = line[1] * 1 
arr = []
for (i=0; i<m; i++) {
    arr[i] = 0
}

for (i=0; i<n; i++) {
    line = lines[i].split(' ')
    k = line[0]
    for (j=1; j<=k; j++) {
        arr[line[j]-1] += 1 
    }
}

cnt = 0;
for (i=0; i<m; i++) {
    if (arr[i] == n) {
        cnt++
    }
}
console.log(cnt)

Measured memory_bytes: 7372
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final BigInteger BIGMOD = BigInteger.valueOf(MOD);
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        BigInteger ans = BigInteger.valueOf(2).modPow(BigInteger.valueOf(N), BIGMOD);
        System.err.println(ans);
        long child = N;
        long mother = 1;
        BigInteger sub;
        for (int i = 1; true; i++) {
            if (i == A) {
                sub = BigInteger.valueOf(child).multiply(BigInteger.valueOf(mother).modInverse(BIGMOD)).mod(BIGMOD);
                ans = ans.add(BIGMOD).subtract(sub).mod(BIGMOD);
                System.err.println(sub);
                System.err.println(ans);
            }
            if (i == B) {
                sub = BigInteger.valueOf(child).multiply(BigInteger.valueOf(mother).modInverse(BIGMOD)).mod(BIGMOD);
                ans = ans.add(BIGMOD).subtract(sub).mod(BIGMOD);
                System.err.println(sub);
                System.out.println(ans.subtract(BigInteger.ONE));
                return;
            }
            child *= N - i;
            child %= MOD;
            mother *= i + 1;
            mother %= MOD;
        }
    }

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


Measured memory_bytes: 24148
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define P 1000000007
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;

map<ll, ll> dp;

ll g(ll h) {
	if(h == 1) return 1ll;
	
	if(!dp.count(h)) dp[h] = g(h / 2) * 2 + 1;
	
	return dp[h];
}

void solve() {
	ll h;
	cin >> h;
	
	cout << g(h) << endl;
}

int main(){
#define MULTITEST 0
#if MULTITEST   
 
    CASET {
        solve();
    }
    
#else

    solve();
    
#endif

    return 0;
}

Measured memory_bytes: 3652