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

import static java.lang.Integer.parseInt;

/**
 * Soccer
 */
public class Main {

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

		int N = parseInt(br.readLine());

		int f, a, t, x, y;
		int _f, _a, _t, _x, _y;

		int LA = -1, FA = -1;
		int LB = -1, FB = -1;

		words = br.readLine().split(" ");

		_f = parseInt(words[0]);
		_a = parseInt(words[1]);
		_t = parseInt(words[2]);
		_x = parseInt(words[3]);
		_y = parseInt(words[4]);

		for (int i = 1; i < N; i++) {

			words = br.readLine().split(" ");

			f = parseInt(words[0]);
			a = parseInt(words[1]);
			t = parseInt(words[2]);
			x = parseInt(words[3]);
			y = parseInt(words[4]);

			if (a != _a && t == _t) {
				int l = (x - _x) * (x - _x) + (y - _y) * (y - _y);
				if (t == 0) {
					if (l > LA) {
						LA = l;
						FA = f - _f;
					} else if (l == LA) {
						FA = Math.min(FA, f - _f);
					}
				} else {
					if (l > LB) {
						LB = l;
						FB = f - _f;
					} else if (l == LB) {
						FB = Math.min(FB, f - _f);
					}
				}
			}

			_f = f;
			_a = a;
			_t = t;
			_x = x;
			_y = y;
		}

		if (FA != -1) {
			System.out.println(Math.sqrt(LA) + " " + ((double) FA) / 60);
		} else {
			System.out.println("-1 -1");
		}

		if (FB != -1) {
			System.out.println(Math.sqrt(LB) + " " + ((double) FB) / 60);
		} else {
			System.out.println("-1 -1");
		}

	}
}

Measured memory_bytes: 24916
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int color[200010];
ll dp[200010];

int main(){
  int n; cin >> n;
  vector<int> c(n);
  rep(i,n) cin >> c[i];
  rep(i,200010) color[i]=-1;
  dp[0]=1;
  rep(i,n-1){
    color[c[i]]=i;
    dp[i+1]+=dp[i];
    if(color[c[i+1]]!=-1&&color[c[i+1]]!=i) dp[i+1]+=dp[color[c[i+1]]];
    dp[i+1]%=mod;
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 3456
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
long long GCD(long long a, long long b){
	long long m=a;
	long long n=b;
	while(n!=0){
		long long r=m%n;
		m=n;
		n=r;
	}
	return m;
}
int main(){
	//freopen("MC.inp","r",stdin);
	int n;
	cin>>n;
	long long tam;
	cin>>tam;
	long long t;
	for(int i=2;i<=n;i++){
		cin>>t;
		long long tam1=GCD(tam,t);
		tam=(long long)(tam/tam1*t);
	}
	cout<<tam;
}

Measured memory_bytes: 256
#a値段,b本数
#n軒,m本
n,m = list(map(int, input().split()))

ab_list = [list(map(int, input().split())) for _ in range(n)]
#print(ab_list)
ab_list.sort()
ans = 0
num = 0
for ab in ab_list:
    ans += ab[0]*ab[1]
    num += ab[1]
    if num >= m:
        i_stop=ab_list.index(ab)
        break
diff_num = num - m
ans -= diff_num * ab_list[i_stop][0]
print(ans)

Measured memory_bytes: 27316
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define l first
#define r second

using namespace std;

const int maxn = 3e5 + 1;

int a[maxn];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, k; cin >> n >> k;
    int x = 0, y = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        x = max(x, a[i]);
        y = __gcd(y, a[i]);
    }
    if (k <= x && k % y == 0) {
        cout << "POSSIBLE";
    } else {
        cout << "IMPOSSIBLE";
    }
    return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

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

  int N;
  cin >> N;
  string S;

  set<string> s;
  rep(i, 0, N) {
    cin >> S;
    s.insert(S);
  }

  cout << s.size() << endl;


  return 0;
};


Measured memory_bytes: 19248
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;




namespace contest
{

    class contest
    {


        static void Main(string[] args)
        {


            //int n = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();


            var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int h = num[0];
            int w = num[1];
            var map = new string[h];
            int memo = 0;
            bool ok = true;
            for(int i =0; i< h; i++)
            {
                map[i] = Console.ReadLine();
                int tmp =map[i].IndexOf('#');
                if (tmp < 0) continue;
                else if (tmp < memo)
                {
                    ok = false;
                }
                else
                {
                    memo = map[i].LastIndexOf('#');
                }
            }




            if(ok)Console.WriteLine("Possible");
            else Console.WriteLine("Impossible"); 





       


        }

       

    }


}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


template<class T> struct PrimalDual {
  struct Edge {
    int to, rev;
    T cap, cost;
    Edge(int to, int rev, T cap, T cost) : to(to), rev(rev), cap(cap), cost(cost) {}
  };

  const int n;

  PrimalDual(int n) : n(n), g(n), pot(n), dist(n), pv(n), pe(n) {
    assert(n >= 2);
  }

  void add_edge(int from, int to, T cap, T cost) {
    assert(0 <= from and from < n);
    assert(0 <= to and to < n);
    assert(from != to);
    assert(cap >= 0);
    assert(cost >= 0);
    g[from].emplace_back(to, g[to].size(), cap, cost);
    g[to].emplace_back(from, g[from].size() - 1, 0, -cost);
  }

  T min_cost_flow(int s, int t, T f) {
    assert(0 <= s and s < n);
    assert(0 <= t and t < n);
    assert(s != t);
    T res = 0;
    fill(begin(pot), end(pot), 0);
    while (f > 0) {
      dijkstra(s);
      if (dist[t] == inf) return -1;
      for (int v = 0; v < n; ++v) pot[v] += dist[v];
      T d = f;
      for (int v = t; v != s; v = pv[v]) {
        d = min(d, g[pv[v]][pe[v]].cap);
      }
      f -= d;
      res += d * pot[t];
      for (int v = t; v != s; v = pv[v]) {
        Edge& e = g[pv[v]][pe[v]];
        e.cap -= d;
        g[v][e.rev].cap += d;
      }
    }
    return res;
  }

private:
  static constexpr T inf = numeric_limits<T>::max();
  VV<Edge> g;
  V<T> pot, dist;
  V<> pv, pe;

  void dijkstra(int s) {
    using P = pair<T, int>;
    priority_queue< P, V<P>, greater<P> > pque;
    fill(begin(dist), end(dist), inf);
    pque.emplace(dist[s] = 0, s);
    while (!pque.empty()) {
      T d; int v;
      tie(d, v) = pque.top(); pque.pop();
      if (d > dist[v]) continue;
      for (int i = 0; i < g[v].size(); ++i) {
        const Edge& e = g[v][i];
        if (e.cap <= 0 or dist[e.to] <= dist[v] + e.cost - (pot[e.to] - pot[v])) continue;
        pv[e.to] = v;
        pe[e.to] = i;
        pque.emplace(dist[e.to] = dist[v] + e.cost - (pot[e.to] - pot[v]), e.to);
      }
    }
  }
};

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n, m, f; cin >> n >> m >> f;
  PrimalDual<int> pd(n);
  for (int i = 0; i < m; ++i) {
    int from, to, cap, cost; cin >> from >> to >> cap >> cost;
    pd.add_edge(from, to, cap, cost);
  }
  cout << pd.min_cost_flow(0, n - 1, f) << '\n';
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i = x; i < n; i++)
#define MAX 100
#define INF 1000000001
typedef long long ll;

string s;
int k;
int n;
// char X[100][100];
// int dp[1000000001];

int main(void) {
    cin >> n;
    string ans = "";
    if (n == 0) {
        ans = "0";
        cout << ans << endl;
        return 0;
    }
    while(n != 0) {
        // cout << n % 2 << endl;
        if (n % 2 != 0) {
            ans = '1' + ans;
            n--;
            // cout << "a";
        }
        else {
            ans = '0' + ans;
        }
        n /= -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;
using ll = long long;
using P = pair<int,int>;

int main() {
  ll N;
  cin >> N;
  for (ll h = 1; h <= 3500; ++h) {
    for (ll n = 1; n <= 3500; ++n) {
      ll a = 4*h*n - N*(h+n);
      ll b = N*h*n;
      if (a <= 0) continue;
      if (b % a == 0) {
        ll w = b / a;
        printf("%lld %lld %lld\n", h, n, w);
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3684
from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
#from functools import lru_cache   #use @lru_cache(None)
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')
#
def input(): return sys.stdin.readline()
def mapi(arg=0): return map(int if arg==0 else str,input().split())
#------------------------------------------------------------------


n = int(input())
a = list(mapi())
mpi = defaultdict(list)
mpj = defaultdict(list)
for i in range(n):
    mpi[a[i]+i].append(i+1)
    mpj[-a[i]+i].append(i+1)
res =0
for i in mpi.keys():
    tmpi = mpi[i]
    tmpj = mpj[i]
    m = len(tmpj)
    #print(i,tmpi,tmpj)
    for j in tmpi:
        res+=m-bisect.bisect_left(tmpj,j)
print(res)


Measured memory_bytes: 170516
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] $) {
        Scanner sc=new Scanner(System.in);
        int n = Integer.parseInt(sc.next()), q = Integer.parseInt(sc.next());
        String s = sc.next();
        int[] AC = new int[n + 1];
        for (int i = 1; i < n; i++) {
            if (s.charAt(i - 1) == 'A' && s.charAt(i) == 'C') {
                AC[i] = 1;
            }
        }
        for (int i = 1; i < n + 1; i++) {
            AC[i] += AC[i - 1];
        }
        for (int i = 0; i < q; i++) {
            int l = Integer.parseInt(sc.next()), r = Integer.parseInt(sc.next());
            int k = 0;
            if (r < n && s.charAt(r - 1) == 'A' && s.charAt(r) == 'C') k++;

            out.println(max(0, AC[r] - AC[l - 1] - k));
        }
        out.close();
    }
}


Measured memory_bytes: 51160
#include <stdio.h>
int main(void)
{
    int m,f,r;
   
    while(1){
    scanf("%d %d %d",&m,&f,&r);
        if(m==-1&&f==-1&&r==-1)break;
       
        if(m==-1||f==-1)
            printf("F\n");
        else if(m+f<30)
            printf("F\n");
        else if(80<=m+f)
            printf("A\n");
        else if(65<=m+f&&m+f<80)
            printf("B\n");
        else if(50<=m+f&&m+f<65)
            printf("C\n");
        else if(30<=m+f&&m+f<50){
            if(r>=50)printf("C\n");
            else printf("D\n");
        }
       
    }
        return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N);
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    sum += vec.at(i);
  }
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (4 * M * vec.at(i) >= sum) {
      cnt++;
    }
  }
  if (cnt >= M) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second
#define PQ priority_queue

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
const int N = 2e5 + 5;
const int mod = 0;
int dsu[N], sz[N];
int findPar(int x){
	if(x == dsu[x]) return x;
	return dsu[x] = findPar(dsu[x]);
}
int uni(int x, int y){
	x = findPar(x), y = findPar(y);
	if(x == y) return sz[x];
	if(sz[x] > sz[y]){
		dsu[y] = x;
		sz[x] += sz[y];
		return sz[x];
	}
	else{
		dsu[x] = y;
		sz[y] += sz[x];
		return sz[y];
	}
}
int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++){
		dsu[i] = i, sz[i] = 1;
	} 
	int ma = 1;
	for(int i = 1; i <= m; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		ma = max(ma, uni(x, y));
	}
	printf("%d", ma);

}

Measured memory_bytes: 5372
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;
vector<LL> A;

LL ans = 0;

void solve(){
	sort(A.begin(),A.end());
	map<LL,int> remain;
	for(int i=0;i<N;i++){
		remain[A[i]]++;
	}
	for(int i=N-1;i>=0;i--){
		if(remain[A[i]]==0) continue;
		remain[A[i]]--;
		LL pow2 = 1;
		while(pow2<=A[i]) pow2 <<= 1;
		LL target_num = pow2 - A[i];
		if(remain.find(target_num)!=remain.end()){
			if(remain[target_num]==0) continue;
			ans++;
			remain[target_num]--;
		}
	}
}

int main(){
    cin >> N;
    A = vector<LL>(N);
    for(int i=0;i<N;i++) cin >> A[i];

    solve();

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

Measured memory_bytes: 14336
com =list(map(int,input().split()))
t_s = com[0]
t_a = com[1]
a_s = com[2]
a_a = com[3]
while 1:
    a_s -= t_a
    if a_s <= 0:
        print("Yes")
        break
    t_s -= a_a
    if t_s <= 0:
        print("No")
        break



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

using ll=long long;
using namespace std;
int main()
{
    int n;
    cin >> n;

    vector<ll> a;
    for (int i=0; i < n + 1; i++)
    {
        ll val;
        cin >> val;
        a.push_back(val);
    }
    
    vector<ll> b;
    for (int i=0; i < n; i++)
    {
        ll val;
        cin >> val;
        b.push_back(val);
    }

    ll c = 0;
    for (int i=0; i < n; i++)
    {
        if (a[i] < b[i])
        {
            b[i] -= a[i];
            c += a[i];
            a[i] = 0;

            if (b[i] < a[i+1])
            {
                a[i+1] -= b[i];
                c += b[i];
                b[i] = 0;
            }
            else
            {
                b[i] -= a[i+1];
                c += a[i+1];
                a[i+1] = 0;
            }
        }
        else
        {
            a[i] -= b[i];
            c += b[i];
            b[i] = 0;
        }
    }

    cout << c << endl;
    return 0;
}


Measured memory_bytes: 2548
#include <stdio.h>
#include <stdlib.h>//random,NULL
#include <string.h>
#include <time.h>
#include <unistd.h>//sleep()
#include <math.h>
#include <stdbool.h>

#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000
const int mod = INF+7;

int main(){
  char buf[1024];
  int W,H,x,y;

  fgets(buf,sizeof(buf),stdin);
  sscanf(buf, "%d %d %d %d", &W, &H, &x, &y);

  printf("%f ", (double)W*H/2);

  if(x==(double)W/2 && y==(double)H/2){
    printf("1\n");
  }
  else{
    printf("0\n");
  }

  return 0;

}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#define X first
#define Y second
#define sqr(x) (x)*(x)
using namespace std;
const double PI = acos(-1.0);
map<int,int>::iterator it;
typedef long long LL ;
#pragma comment(linker,"/STACK:102400000,102400000")

const int N = 1005;
struct CaoDai
{
    char nam[22];
    LL from,to;
}C[N];
int n,m;
int main()
{
    while(1)
    {
        scanf("%d%d",&n,&m);
        if(n==0&&m==0)break;
        for(int i=0;i<n;++i)
        {
            LL last,to;
            scanf("%s%lld%lld",C[i].nam,&last,&C[i].to);
            C[i].from=C[i].to-last+1;
        }
        LL y;
        for(int i=0;i<m;++i)
        {
            scanf("%lld",&y);
            int pos=-1;
            for(int j=0;j<n;++j)
            {
                if(y>=C[j].from&&y<=C[j].to)
                {
                    pos=j;
                    break;
                }
            }
            if(~pos)
            {
                printf("%s %lld\n",C[pos].nam,y-C[pos].from+1);
            }
            else
            {
                puts("Unknown");
            }
        }
    }
	return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
int main(){
    int  a, b ,c;
    char X,Y;
    string S1,S2;
    cin >> a>> b >> c;
    if(a == b) cout << c << endl;
    if(a == c) cout << b << endl;
    if(c == b) cout << a << endl;

    
    
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;


const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()

int main(){
    int N,K;
    cin>>N>>K;
    vector<ll> A(N),B;
    rep(i,N){
        cin>>A[i];
    }
    ll ans=0;

    rep(i,N-1){
        if(A[i]+A[i+1]>K){
            ll a=(A[i]+A[i+1])-K;
            if(a>0){
                ans+=a;
                if(a>A[i+1]){
                    a-=A[i+1];
                    A[i+1]=0;
                    A[i]-=a;
                }else{
                    A[i+1]-=a;
                }
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}

//a=97,z=122

Measured memory_bytes: 1152
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

int main(void) {
	int w,h,n;
	cin >> w >> h >> n;
	int x,y,a;
	int xl=0,xr=w,yh=h,yl=0;
	for(int i=0; i<n; i++){
		cin >> x >> y >> a;
		if(a==1)xl=max(xl,x);
		if(a==2)xr=min(xr,x);
		if(a==3)yl=max(yl,y);
		if(a==4)yh=min(yh,y);
	}
	int ans=0;
	if(xl<xr && yl<yh){
		ans=(xr-xl)*(yh-yl);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC_prac
{
    public class Program
    {
        #region templete

        private static void WL(string s) { WriteLine(s);}

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        /// <summary>
        /// 最小公倍数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }
        /// <summary>
        /// 最小公約数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
        public static void Main(string[] args)
        {
            new Program().Solve();
            Read();
        }

        #endregion

        public void Solve()
        {
            var s = Read();
            int min = 1000;
            for (int i = 0; i < s.Length-2; i++)
            {
                var tmp = s.Substring(i, 3);
                var diff = Abs(753 - int.Parse(tmp));
                min = (min < diff) ? min : diff;
                if (min == 0) break;
            }
            WL($"{min}");

        }

    }


}


Measured memory_bytes: 11220
#define DREP(i, s, e) for(register int i = s; i >= e ;i--)
#define  REP(i, s, e) for(register int i = s; i <= e ;i++)

#define DEBUG fprintf(stderr, "Passing [%s] in Line %d\n", __FUNCTION__, __LINE__)
#define chkmax(a, b) a = max(a, b)
#define chkmin(a, b) a = min(a, b)

#include <bits/stdc++.h>

using namespace std;
const int maxn = 20 + 5, MOD = 1e9 + 7, maxt = (1 << 21) + 10;

template <typename T> inline T read()
{
	T ans(0), p(1);
	char c = getchar();
	while (!isdigit(c))
	{
		if (c == '-') p = -1;
		c = getchar();
	}
	while (isdigit(c))
	{
		ans = ans * 10 + c - 48;
		c = getchar();
	}
	return ans * p;
}

int n, m, k, ret, tmp, lim;
int nxt[maxt][maxn], a[maxn][maxn], dp[2][maxn][maxt];

int main()
{
#ifdef CraZYali
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif
	n = read<int>() - 1, m = read<int>(), k = read<int>(), lim = (1 << n) - 1;
	REP(i, 0, lim)
	{
		ret = -1;
		DREP(j, n - 1, 0)
		{
			if (i & (1 << j)) ret = j;
			nxt[i][j] = ret;
		}
	}
	memset(a, -1, sizeof(a));
	while (k --> 0)
	{
		register int x(read<int>()), y(read<int>()), z(read<int>());
		a[x][y-1] = z;
	}
	dp[0][n][0] = 1;
	int cur = 1;
	REP(i, 1, m)
	{
		REP(s, 0, lim) dp[cur][0][s] = dp[cur ^ 1][n][s];
		REP(j, 0, n)
			REP(s, 0, lim)
			dp[cur ^ 1][j][s] = 0;
		REP(j, 0, n - 1)
			REP(s, 0, lim)
			if (dp[cur][j][s])
			{
				REP(k, 0, 1)
				{
					if (a[i][j] != -1 && a[i][j] != k) continue;
					ret = (s & (1 << j));
					if (ret) ret = 1;
					if (k == 0 && ret == 1) continue;
					if (k == ret) (dp[cur][j+1][s] += dp[cur][j][s]) %= MOD;
					else
					{
						tmp = nxt[s][j];
						if (tmp == -1) (dp[cur][j+1][s + (1 << j)] += dp[cur][j][s]) %= MOD;
						else (dp[cur][j+1][s + (1 << j) - (1 << tmp)] += dp[cur][j][s]) %= MOD;
					}
				}
			}
		cur ^= 1;
	}
	cur ^= 1;
	int ans = 0;
	REP(s, 0, lim) (ans += dp[cur][n][s]) %= MOD;
	cout << (ans + MOD) % MOD << endl;
	return 0;
}


Measured memory_bytes: 213248
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===
def prepare(n, MOD):
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    return factorials, invs


def main():
    n, k = ns()

    if n < k:
        print(0)
        exit(0)
    # 使い方
    facts, invs = prepare(n + k, MOD)

    tmp = facts[n - 1] * invs[k - 1] * invs[n - k] % MOD
    print(tmp)


if __name__ == '__main__':
    main()



Measured memory_bytes: 7436
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;


int *read_array(int N)
{
    int *array;
    int i,m;
    array = new int[N];
    for(i=0;i<N;i++){
        scanf("%d",&m);
        array[i] = m;
    }
    return array;
}

int *read_array1(int N)
{
    int *array;
    int i,m;
    array = new int[N+1];
    for(i=0;i<N;i++){
        scanf("%d",&m);
        array[i] = m;
    }
    return array;
}

void print_array(int *array, int N)
{
    int i;
    for(i=0;i<N;i++){
        if(i!=N-1){
            printf("%d ",array[i]);
        }else{
            printf("%d",array[i]);
        }
    }
    printf("\n");
    return;
}

int linearSearch(int *S, int N, int key)
{
    int i = 0;
    S[N] = key;
    while(S[i]!=key) i++;
    if(i==N) return false;
    return true;
}

int binarySearch(int *S, int N, int key)
{
    int left,right,mid;
    left = 0; right = N;
    
    while(left < right){
        mid = (left + right)/2;
        if(S[mid] == key){
            return 1;
        }else if(key < S[mid]){
            right = mid;
        }else{
            left = mid + 1;
        }
    }
    return 0;
}


int main()
{
    int N,M,*S,*T,count,i,key;
    cin >> N;
    S = read_array(N);
    cin >> M;
    T = read_array(M);

    count = 0;
    for(i=0;i<M;i++){
        key = T[i];
        count += binarySearch(S,N,key);
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3756
//解説を見てきれいにかきなおした
 #include <bits/stdc++.h>
 using namespace std;
 #define rep(i,N) for(int i=0;i<int(N);++i)
 using ll = long long;

int main(){
    int k,s;
    cin >> k >> s;
    int cnt=0;
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            if(s-i-j>=0&&s-i-j<=k){
                int l = s-i-j;
                // if(i+j+l==s){ //←これいらん
                    cnt++;
                // }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a, b, mul, add, pul, max;
  scanf("%d %d", &a, &b);
  add=a + b;
  pul=a - b;
  mul=a * b;
  
  max=add;
  if (pul>max){
       max=pul;
  }
  if (mul>max){
       max=mul;
  }
  printf("%d\n", max);
  return 0;
}
  

Measured memory_bytes: 128
from collections import deque

n, x = map(int, input().split())

print('Yes' if 1 < x < (2 * n - 1) else 'No')
if 1 < x < (2 * n - 1):
    ans = deque([1, x, 2 * n - 1])
    cnt = deque([i for i in range(2, 2 * n - 1) if i != x])
    for i in range(n - 2):
        ans.append(cnt.popleft())
        ans.appendleft(cnt.pop())
    print(*ans, sep='\n')


Measured memory_bytes: 91552
/*
                                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/

#include <bits/stdc++.h>

#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define ll         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
 
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}
int main()
{   string str;
    cin>>str;
    if(str=="MON")
    cout<<6;
    else if(str=="TUE")
    cout<<5;
    else if(str=="WED")
    cout<<4;
    else if(str=="THU")
    cout<<3;
    else if(str=="FRI")
    cout<<2;
    else if(str=="SAT")
    cout<<1;
    else 
    cout<<7;
}

Measured memory_bytes: 256
if __name__ == '__main__':

	n = int(input())

	cnt = 0
	for i in range(1,n+1,2):
		tmp = 0
		for j in range(1,n+1):
			if i % j == 0:
				tmp += 1
		if tmp == 8:
			cnt += 1
		tmp = 0

	print(cnt)

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
ll mod = 1e9 + 7;
const int M = 2e6 + 5;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   if(pow < 0) return 0;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;ll c = (a * b)%mod;return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(2e6 + 7)] , inv_fac[(int)(2e6 + 7)];
void precomp_factorial(){fac[0] = 1;for(ll i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(ll i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};


int main() {
    
    int n;
    cin >> n;
    cout << (n-1)/2;
}
 


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int W[100]={0};
  int K[100]={0};
  int i,j,k,scr,sumW=0,sumK=0;

  for(i=0;i<10;i++){
    scanf("%d", &scr);
    W[scr]++;
  }
  for(j=0;j<10;j++){
    scanf("%d", &scr);
    K[scr]++;
  }
  for(i=0;i<3;){
    for(j=100;j!=0;j--){
      if(i==3) break;
      if(W[j]!=0){
	for(k=0;k<W[j];k++){
	  if(i==3) break;
	  sumW=sumW+j;
	  i++;
	}
      }
    }
  }
  for(i=0;i<3;){
    for(j=100;j!=0;j--){
      if(i==3) break;
      if(K[j]!=0){
	for(k=0;k<K[j];k++){
	  if(i==3) break;
	  sumK=sumK+j;
	  i++;
	}
      }
    }
  }
  printf("%d ", sumW);
  printf("%d\n", sumK);

  return 0;
}


Measured memory_bytes: 592
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin >> n >> k;
	
	vector<int> a(n);
	for(int i=0;i<n;i++)
		cin >> a[i];
	vector<int> dp(n,INT_MAX);
	dp[0] = 0;
	for(int i=1;i<n;i++)
	{
		for(int j = max(0,i-k);j<i;j++)
		{
			dp[i] = min(dp[j] + abs(a[i]-a[j]),dp[i]);
		}
	}
	cout << dp[n-1];
}


Measured memory_bytes: 3936
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

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

int main() {
	int n, q; scanf("%d%d", &n, &q);
	std::string s; cin >> s;

	std::vector<int> sum(n + 1, 0);
	for(int i = 0; i < (int)s.size() - 1; i++) {
		if(s.substr(i, 2) == "AC") sum[i + 1]++;
	}
	for(int i = 0; i < s.size(); i++) sum[i + 1] += sum[i];
	
	while(q--) {
		int l, r; scanf("%d%d", &l, &r);

		printf("%d\n", sum[r - 1] - sum[l - 1]);
	}
	return 0;
}


Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<lint, lint> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	if (!b)return T(1);
	if (b & 1)return mypow(a, b - 1) * a;
	T memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int n,k,a[2][200010];
int main(){
	std::cin>>n>>k;
	rep(i,n)std::cin>>a[0][i];
	rep(i,k){
		rep(j,n){
			a[1][std::max(0,j-a[0][j])]++;
			a[1][std::min(n,j+a[0][j]+1)]--;
		}
		REP(j,n-1)a[1][j]+=a[1][j-1];
		bool f=true;
		rep(j,n){
			a[0][j]=a[1][j];
			a[1][j]=0;
			if(a[0][j]!=n)f=false;
		}
		if(f)break;
	}
	printArray(a[0],a[0]+n);
	return 0;
}


Measured memory_bytes: 5196
main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r['   ']={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;for(puts("");p&&l;)putchar(--l?--r[p]>0?32:94:10);}}

Measured memory_bytes: 8608
#include<bits/stdc++.h>
int main()
{
	char s[1000];
	gets(s);
	int flag=0;
	for(int i=0;i<strlen(s);i++)
	{
		if(s[i]>='a'&&s[i]<='z' ||s[i]>='A'&&s[i]<='Z')
		flag++;
	}
	printf("%c%d%c",s[0],flag-2,s[strlen(s)-1]);
	return 0;
}

Measured memory_bytes: 256
N = int(input())

min_count = N
for i in range(N + 1):

    count = 0

    six = i
    while six > 0:
        count += six % 6
        six //= 6

    nine = N - i
    while nine > 0:
        count += nine % 9
        nine //= 9

    min_count = min(min_count, count)

print(min_count)

Measured memory_bytes: 3068
fun main() {
    val builder = StringBuilder()

    val n = readInputLine().toInt()

    builder.appendln(
        when(n % 10) {
            2,4,5,7,9 -> "hon"
            0,1,6,8 -> "pon"
            3 -> "bon"
            else -> ""
        }
    )

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 35764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vpi = vector<pii>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpl = vector<pll>;
using vs = vector<string>;

int main()
{
    string s, t;
    cin >> s >> t;
    int idx = -1;
    for(int i=0; i+t.size()-1<s.size(); i++)
    {
        bool fl = true;
        for(int j=i; j-i<t.size(); j++)
        {
            if(s.at(j) != '?' && s.at(j) != t.at(j - i))
            {
                fl = false;
                break;
            }
        }
        if(fl) idx = i;
    }
    if(idx != -1)
    {
        for(int i=idx; i-idx<t.size(); i++)
        {
            s.at(i) = t.at(i-idx);
        }
        for(int i=0; i<s.size(); i++)
        {
            if(s.at(i) == '?') s.at(i) = 'a';
        }
        cout << s << endl;
    }
    else cout << "UNRESTORABLE" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define ll long long
//#define int long long
using namespace std;
void boost()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}
void free()
{
	freopen("A.in", "r", stdin);
	freopen("A.out", "w", stdout);
}
string s;
main()
{
	//free();
	boost();
	cin >> s;
	sort(s.begin(), s.end());
	if(s == "abc") cout << "Yes";
	else cout << "No";
	exit(0);
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double

#define sonic ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

ll a[100010];



int main () {
sonic

int n1,n2,n3,n4;
cin>>n1>>n2>>n3>>n4;

int q = 0;

if(n1 == n2 || n1 == n3 || n1 == n4 || n2 == n3 || n2 == n4 || n3 == n4) {cout<<"NO";return 0;}


if(n1 == 1 || n2 == 1 || n3 == 1 || n4 == 1) { q++;}
if(n1 == 9 || n2 == 9 || n3 == 9 || n4 == 9) {q++;}
if(n1 == 7 || n2 == 7 || n3 == 7 || n4 == 7) {q++;}
if(n1 == 4 || n2 == 4 || n3 == 4 || n4 == 4) {q++;}

if(q == 4) {cout<<"YES";}
else cout<<"NO";

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define pi          3.14159265358979323


void solve()
{
       ll r, g, b, n;
       cin>>r>>g>>b>>n;
       ll ans=0;
       for(ll i=0; i*r <= n; i++){
              for(ll j=0; j*g <= n; j++){
                     ll k = n - i*r - j*g;
                     if(k < 0) break;
                     if(k % b == 0) ans++;
              }
       }
       cout<<ans;
}

int main()
{
       speed_up;
       ll T=1;
       //cin>>T;
       while(T--) solve();
	return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	n, k, c := io.NextInt(), io.NextInt(), io.NextInt()
	s := io.Next()

	fw := greedy(n, k, c, s)
	bw := greedy(n, k, c, reverse(s))
	for i := 0; i < k/2; i++ {
		bw[i], bw[k-1-i] = bw[k-1-i], bw[i]
	}
	for i := 0; i < k; i++ {
		bw[i] = n - 1 - bw[i]
	}
	for i := range fw {
		if fw[i] == bw[i] {
			io.Println(fw[i] + 1)
		}
	}
}

func greedy(n, k, c int, s string) []int {
	ret := make([]int, k)
	for i := range ret {
		ret[i] = -1
	}
	cnt := 0
	for i := 0; i < n; i++ {
		if s[i] == 'x' {
			continue
		}
		ret[cnt] = i
		cnt++
		if cnt == k {
			break
		}
		i += c
	}
	return ret
}

func reverse(s string) string {
	runes := []rune(s)
	n := len(runes)
	for i := 0; i < n/2; i++ {
		runes[i], runes[n-1-i] = runes[n-1-i], runes[i]
	}
	return string(runes)
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 8008
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define per(i, a, b) for(int i = (a); i >= (b); i--)
#define pb push_back
using namespace std;
const int N = 300010;
int n, m, l, r, mid, mx;
int a[N + N];

template<typename T> void gi(T &x) {
	x = 0; register char c = getchar();
	for(; c < '0' || c > '9'; c = getchar());
	for(; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + (c ^ 48);
}
bool check(int x) {
	rep(i, 1, n - x) if(a[x + x + i] + a[n + n - i + 1] < m) return 0; return 1;
}
int main() {
	gi(n), gi(m); rep(i, 1, n + n) gi(a[i]);
	sort(a + 1, a + n + n + 1);
	l = 0, r = n, mid = 0;
	for(; l < r;) {
		mid = (l + r) >> 1;
		if(check(mid)) r = mid;
		else l = mid + 1;
	}
	rep(i, 1, r) mx = max(mx, (a[i] + a[r + r - i + 1]) % m);
	rep(i, 1, n - r) mx = max(mx, (a[r + r + i] + a[n + n - i + 1]) % m);
	printf("%d\n", mx);
	return 0;
}

Measured memory_bytes: 1024
import math
def solve():
    global N, A, PA, XA, i
    N = int(input())
    A = list(map(int, input().split()))

    PA = [0]*(N+1)
    XA = [0]*(N+1)
    PA[0] = A[0]
    XA[0] = A[0]

    for i in range(1,N):
        PA[i] = PA[i-1] + A[i]
        XA[i] = XA[i-1] ^ A[i]

    count = 0
    for i in range(N):
        r = bs(i, N, solver) - 1
        count += r-i+1
    print(count)

def bs(ng, ok, solver):  # binary search for integer set
    """
    input:
        ng: max number known to be ng. default -1
        ok: min number known to be ok. default max number + 1
    output:
        the number that is OK firstly
    """
    while math.fabs(ok-ng) > 1:
        mid = (ok+ng)//2
        if solver(mid):
            ok = mid
        else:
            ng = mid
    return ok

def solver(x):
    if PA[x] - PA[i-1] == XA[x] ^ XA[i-1]:
        return False
    else:
        return True

if __name__ == "__main__":
    solve()


Measured memory_bytes: 77512
import bisect
N=int(input())
A=list(map(int,input().split()))
A.sort()
A.append(999999999999999)
B=[]
for i in range(1,35):
    B.append(2**i)
ans=0
for i in range(N):
    if A[N-1-i]==int(A[N-1-i]):
        for j in range(len(B)):
            if A[N-1-i]<B[j]:
                break
        if A[bisect.bisect_left(A,B[j]-A[N-1-i])]==B[j]-A[N-1-i]:
            if bisect.bisect_left(A,B[j]-A[N-1-i])<N-1-i:
                A[bisect.bisect_left(A,B[j]-A[N-1-i])]-=0.1
                A[N-1-i]+=0.1
                ans+=1
print(ans)

Measured memory_bytes: 25492
#include<bits/stdc++.h>
using namespace std;
template<typename T> void read(T &x){
	char c=getchar();x=0;int f=1;
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}x*=f;
}
int a,b,c;
int main(){
	read(a);read(b);read(c);
	if((a==b)&&(a==c)){cout<<"Yes\n";}
	else cout<<"No\n";return 0;
}

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

typedef long long ll;

int main() {
    ll n; cin >> n;
    ll k; cin >> k;
    ll A=0;
    vector<ll> b(k);
    for(ll i=0; i<k; i++){
        cin >> b[i];
        A |= (1<<b[i]);
    }
    vector<ll> sb;
    for(ll bit=A; ; bit = (bit-1)&A){
        sb.push_back(bit);
        
        if(!bit) break;
    }
    sort(sb.begin(),sb.end());
    
    for(int i=0; i<sb.size(); i++){
        cout << sb[i] <<":";
        for(int j=0; j<n; j++){
            if(sb[i] & (1<<j)){
                cout <<" "<< j;
            }
        }
        cout << endl;
    }

}



Measured memory_bytes: 4972
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	S := nextString()

	ans := false
	hitachi := ""
	for i := 1; i <= 5; i++ {
		hitachi += "hi"
		if hitachi == S {
			ans = true
		}
	}

	if ans {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int count_str(string str1, string str2)
{
    int ans = 0;
    for(char c = 'a'; c <= 'z'; c++)
    {
        bool found_left = false;
        bool found_right = false;

        REP(i, str1.length())
        {
            if (str1[i] == c)
            {
                found_left = true;
            }
        }

        REP(i, str2.length())
        {
            if (str2[i] == c)
            {
                found_right = true;
            }
        }

        if (found_left && found_right)
        {
            ans++;
        }
    }

    return ans;
}

int main()
{
    int x = 0;

    cin >> x;

    int ans = 1;

    for (int i = 2; i <= x; i++)
    {
        int power = i * i;
        for (int p = 2;; p++)
        {
            if (power > x)
            {
                break;
            }
            ans = max(ans, power);
            power *= i;
        }
    }

    COUT(ans);

    return 0;
}

Measured memory_bytes: 256