akhauriyash/Code-Regression huggingface dataset:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N=II()-1
crr=[chr(97 + i) for i in range(26)]

res = []
cnt = 0
for i in range(1, 15):
    if N >= 26**i:
        cnt = i
        # print(26**i)
        N -= 26**i

# print(N)
while N:
    res.append(crr[N%26])
    N //= 26
res.reverse()
# res.append(crr[N%26])

print(("a"*(cnt+1) + "".join(res))[-(cnt+1):])


Measured memory_bytes: 9148
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    ll a, b, h[100005] = {}, l = 0, r = 1000000000;
    cin >> n >> a >> b;
    for (int i = 0; i < n; i++) cin >> h[i];
    while (l + 1 < r) {
        ll m = (l + r) / 2, c[100005] = {}, d = 0;
        for (int i = 0; i < n; i++) c[i] = max(0ll, h[i] - m * b);
        for (int i = 0; i < n; i++) if (c[i]) d += (c[i] - 1) / (a - b) + 1;
        if (d <= m) {
            r = m;
        } else {
            l = m;
        }
    }
    cout << r;
}


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

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
           
#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main(){
    int n, h;
    while (scanf("%d%d", &n, &h), n | h)
    {
	set<pair<int, pint> > passed;
	while (h--)
	{
	    char c[8];
	    int a, b;
	    scanf("%s%d%d", c, &a, &b);
	    for (int i = 1; i <= n; ++i)
	    {
		pair<int, pint> p;
		if (!strcmp(c, "xy"))
		    p = make_pair(a, pint(b, i));
		else if (!strcmp(c, "xz"))
		    p = make_pair(a, pint(i, b));
		else
		    p = make_pair(i, pint(a, b));
		passed.insert(p);
	    }
	}
	printf("%d\n", n*n*n - passed.size());
    }
}

Measured memory_bytes: 2328
#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 gpf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;
const ll md = 1e9 + 7;
const int N = 1000000;
ll n, m, k;
ll fac[N], inv[N], m3[N];

ll fm(ll x, ll y){
	ll res = 1;
	while (y){
		if (y & 1) res = (res * x) % md;
		y /= 2;
		x = (x * x) % md;
	}
	return res;
}

ll C(int x, int y){
	if (y < 0) return 0;
	if (x < y) return 0;
	ll res = ((fac[x] * inv[x - y]) % md * inv[y]) % md;
	return res;
}

int main(){
	scanf("%lld%lld%lld", &n, &m, &k);
	fac[0] = 1;
	rep(i, 1, n + m + k) fac[i] = (fac[i - 1] * i) % md;
	rep(i, 1, n + m + k) inv[i] = fm(fac[i], md - 2);
	m3[0] = 1;
	rep(i, 1, n + m + k) m3[i] = (m3[i - 1] * 3) % md;
	inv[0] = 1;
	ll ans = 0;
	ll t = 1;
	rep(i, 0, m + k){
		ll tt = C(n + i - 1, n - 1) * t % md;
		tt = tt * m3[m + k - i] % md;
		ans = (ans + tt) % md;
		t = ((t * 2 + md - C(i, m)) % md + md - C(i, i - k)) % md;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 22912
#include <stdio.h>
int main(){
  int a,b,c,d;
  scanf("%d",&a);
  b=a/3600;
  c=(a%3600)/60;
  d=(a%3600)%60;
		  

  printf("%d:%d:%d\n",b,c,d);
    return 0;
}


Measured memory_bytes: 2128
N = int(input())
S = [0] * N
m = 0
a = 0
r = 0
c = 0
h = 0

for i in range(N):
    S[i] = input()
    if S[i][0] == 'M':
        m += 1
    if S[i][0] == 'A':
        a += 1
    if S[i][0] == 'R':
        r += 1
    if S[i][0] == 'C':
        c += 1
    if S[i][0] == 'H':
        h += 1

ans = 0

l = [m, a, r, c, h]
for i in range(0,3):
    for j in range(i+1,4):
        for k in range(j+1, 5):
            ans += l[i] * l[j] * l[k]

print(ans)



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

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	ll n, a, b;
	cin >> n >> a >> b;
	vector<ll> x(n);
	rep(i, n) cin >> x[i];
	
	vector<int> cost(n, 0);
	for(int i = 1; i < n; ++i){
		 cost[i] = min((x[i] - x[i-1]) * a, b);
	}
	
	ll ans = 0;
	for(int i = 1; i < n; ++i){
		ans += cost[i];
	}
	
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1408
""" A
"""
import sys
import math
from functools import reduce
from bisect import bisect_left

def readString():
    return sys.stdin.readline()

def readInteger():
    return int(readString())

def readStringSet(n):
    return sys.stdin.readline().split(" ")[:n]

def readIntegerSet(n):
    return list(map(int, readStringSet(n)))

def readIntegerMatrix(n, m):
    return [lambda _: readIntegerSet(m) for _ in range(0, n)]

def main(x):
    return 0 if x == 1 else 1

if __name__ == "__main__":
    _x = readInteger()

    print(main(_x))

Measured memory_bytes: 9564
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


//階乗先に計算
class Kaizyou{
    public:
    long long int *kaizyou;
    Kaizyou(){};
    Kaizyou(long long int n,long long int mod){
        kaizyou=new long long int[n+1];
        kai(1,n,mod);
        return;
    }

    long long int kai(long long int a, long long int b, long long int mod) {
        long long int tmp = 1;
		kaizyou[0]=1;
        for (long long int i = a; i <= b; i++) {
            tmp *= i;
            tmp %= mod;

            kaizyou[i] = tmp;
        }
        return tmp;
    }
};

//累乗(繰り返し2乗法)　aのb乗(mod)を求める。
class Ruizyou{
    public:
    long long int rui(long long int a, long long int b, long long mod) {
        int memo[65] = {};
        long long int A[65] = {};
        long long int tmp = 1;
        for (int i = 0; i < 65; i++) {
            memo[i] = b % 2;
            b /= 2;
        }

        A[0] = a;
        A[0] %= mod;

        for (int i = 1; i < 65; i++) {
            A[i] = A[i - 1] * A[i - 1];
            A[i] %= mod;
        }
        for (int i = 0; i < 65; i++) {
            if (memo[i] == 1) {
                tmp *= A[i];
                tmp %= mod;
            }
        }
        tmp %= mod;
        return tmp;
    }
};
//コンビネーション計算
class Combination{
    public:
        Kaizyou * Kaizyou_Instance;
        Ruizyou Ruizyou_Instance;
    Combination(long long int n,long long int mod){
        Kaizyou_Instance=new Kaizyou(n,mod);
    }
    long long int comb(long long int n, long long int r, long long int mod) {
        long long int tmp;
		if(r>n){return 0;}
        tmp = (Kaizyou_Instance->kaizyou[n] * Ruizyou_Instance.rui(Kaizyou_Instance->kaizyou[r], mod - 2, mod)) % mod;
        tmp *= Ruizyou_Instance.rui(Kaizyou_Instance->kaizyou[n - r], mod - 2, mod);
        tmp %= mod;
        if (tmp < 0) { tmp = (mod - tmp) % mod; }
        return tmp;
    }
};	

long long int N,A[100005],b[100005],color[100005],K=0,res=0;
vector<long long int> vec[100005];
queue<long long int > task;
map<pair<long long int,long long int>, long long int>coloring;
int main() {
	cout << fixed << setprecision(18);
	cin>>N>>K;
	Combination Comb(100005,mod);
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	sort(A,A+N);
	for(int i=K-1;i<N;i++){
		res+=Comb.comb(i,K-1,mod)*A[i];
		res%=mod;
		//cout<<res<<endl;
	}
	for(int i=0;i<=N-K;i++){
		res-=Comb.comb(N-i-1,K-1,mod)*A[i];
		res%=mod;
	}
	cout<<(mod+res)%mod;
} 

Measured memory_bytes: 5760
fun main(args: Array<String>) {
    var (a, b, c, d) = readLine()!!.split(" ").map(String::toLong)
    var ans=0L
    ans=Math.max(a*c,a*d)
    ans=Math.max(ans,b*c)
    ans=Math.max(ans,b*d)

    println(ans)
}

Measured memory_bytes: 36400
import java.util.Scanner;
import java.util.regex.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int count = 0;

		sc.next();
		String s = sc.next();
		Pattern p = Pattern.compile("ABC");
		Matcher m = p.matcher(s);

		while(m.find()) count++;

		System.out.println(count);
	}
}

Measured memory_bytes: 35624
import sys
N = int(raw_input())
arr = []
must = -1
for i in range(N):
    arr.append(list(map(int,raw_input().split())))
    if arr[i][2]:
        must = i
for i in range(101):
    for j in range(101):
        if must!=-1:
            h = arr[must][2]+abs(arr[must][0]-i)+abs(arr[must][1]-j)
            v = 1
            for k in range(N):
                if arr[k][2]:
                    if arr[k][2]+abs(arr[k][0]-i)+abs(arr[k][1]-j)!=h:
                        v = 0
                else:
                    if abs(arr[k][0]-i)+abs(arr[k][1]-j)<h:
                        v = 0
            if v:
                print i,j,h
                sys.exit()
        else:
            v = 1
            for k in range(N):
                if arr[k][0]==i and arr[k][1]==j:
                    v = 0
            if v:
                print i,j,1
                sys.exit()

Measured memory_bytes: 33260
import java.util.*;

class Main {
	public static void main(String[] args) {
		String[] day = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

		Scanner s = new Scanner(System.in);
		String c = s.next();
		int ans = 7;
		for (int i = 0; i<day.length && !(c.equals(day[i])); i++, ans--);
		System.out.println(ans);
	}
}

Measured memory_bytes: 22996
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
int h[100005];
vector<int> mem(100005,-1);
int fanc(int n);
signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }
    cout<<fanc(n)<<"\n";
    return 0;
}
int fanc(int n){
    if(n==1){
        mem[n]=0;
    }
    if(n==2){
        mem[n]=abs(h[1]-h[2]);
    }
    if(mem[n]<0){
        mem[n]=min(abs(h[n]-h[n-1])+fanc(n-1),abs(h[n]-h[n-2])+fanc(n-2));
    }
    return mem[n];
}

Measured memory_bytes: 6340
#include<stdio.h>
int main(void)
{
    for(;;){
        int x,y;
        scanf("%d %d",&x,&y);
        if(x==0&&y==0){
            break;
        }
        if(x>y){
            printf("%d %d\n",y,x);
        }else{
            printf("%d %d\n",x,y);
        }
    }
    return 0;
}


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

const int MAXN = 105, mod = 1e9+7, inv2 = (mod+1)/2, phi = mod-1;

int n, a[MAXN], dp[MAXN][MAXN][2];

inline int power(int a, int n)
{
	int ans = 1;
	for (; n; n >>= 1) {
		if (n&1) ans = (long long)ans*a%mod;
		a = (long long)a*a%mod;
	}
	return ans;
}

void dfs(int L, int R)
{
	int pos = L, tmp;
	for (int i = L; i <= R; i++)
		if (a[i] < a[pos])
			pos = i;
	tmp = a[pos];
        for (int i = L; i <= R; i++)
		a[i] -= tmp;
	int cnt_len = 0, cnt_cnt = 0;
	for (int i = L; i <= R; i++)
		if (a[i] == 0)
			cnt_cnt++;
	if (cnt_cnt == R-L+1) {
		dp[L][R][0] = power(2, tmp);
		dp[L][R][1] = ((power(2, R-L+1)-2)%mod+mod)%mod;
		// cerr << L << " " << R << " " << dp[L][R][0] << " " << dp[L][R][1] << endl;
		return;
	}
	int cnt_sub = 0;
	dp[L][R][0] = dp[L][R][1] = 1;
	for (int i = L; i <= R; ) {
		if (a[i] == 0) {
			int j = i;
			while (j+1 <= R && a[j+1] == 0) j++;
			cnt_len++;
			i = j+1;
		} else {
			int j = i;
			while (j+1 <= R && a[j+1] != 0) j++;
			cnt_sub++;
			dfs(i, j);
			dp[L][R][0] = (long long)dp[L][R][0]*dp[i][j][0]%mod;
			dp[L][R][1] = (long long)dp[L][R][1]*((dp[i][j][0]*2ll+dp[i][j][1])%mod)%mod;
		}
	}
	dp[L][R][0] = (long long)dp[L][R][0]*2%mod;
	dp[L][R][1] = (long long)dp[L][R][1]*power(2, cnt_cnt)%mod;
	dp[L][R][1] = ((dp[L][R][1]-dp[L][R][0])%mod+mod)%mod;
	dp[L][R][0] = (long long)dp[L][R][0]*power(2, tmp-1)%mod;
	// cerr << L << " " << R << " " << dp[L][R][0] << " " << dp[L][R][1] << endl;
}

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	if (n == 1) {
		cout << power(2, a[1]) << endl;
		return 0;
	}
	a[0] = a[n+1] = 0;
	int cnt = 0;
	for (int i = 1; i <= n; i++)
		if (a[i] > a[i-1] && a[i] > a[i+1]) {
			int tar = max(a[i-1], a[i+1]);
			cnt = (cnt+a[i]-tar)%phi;
			a[i] = tar;
		}
	dfs(1, n);
	cout << (long long)(dp[1][n][0]+dp[1][n][1])%mod*power(2, cnt)%mod << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>

using ll = long long int;

constexpr ll mod = (1e9)+7;
constexpr int MAX = 2*1e5+10;

ll fac[MAX];

void init() {
	fac[0]=1;
	for(int i=1;i<MAX;++i)
		fac[i]=(fac[i-1]*i)%mod;
}

ll inv(ll x){
	ll n = mod-2;
	ll y = 1;
	ll z = 1;
	for(int i=0;i<40;++i){
		if(n&y) z = (z*x)%mod; 
		x=(x*x)%mod;
		y*=2;
	}
	return z;
}

ll func(ll x, ll y) {
	return ((x*(x+1)/2%mod)*y%mod + (y*(y+1)/2%mod)*x%mod)%mod;
}

ll g(ll x){return x*(x+1)/2%mod;}

int main(){
	init();
	int n, m, k;
	std::cin>>n>>m>>k;

	ll comb = (fac[n*m-2] * inv(fac[k-2]) % mod) * inv(fac[n*m-k]) % mod;

	ll sum = 0;

	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			sum+=func(i-1,j-1)+func(i-1,m-j)+func(n-i,j-1)+func(n-i,m-j)+g(i-1)+g(j-1)+g(m-j)+g(n-i);
			sum%=mod;
		}
	}
	

	std::cout<<((comb*sum)%mod)*inv(2)%mod<<std::endl;

	return 0;
}


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

int main() {
	int N;
	cin >> N;
	if ((N % 1000) % 111 == 0) {
		cout << "Yes" << endl;
	}
	else if ((N % 1110) < 10) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<long long>> vvll;
typedef long double ld;
typedef std::vector<long double> vld;
typedef std::vector<std::vector<long double>> vvld;
using namespace std;
void yesno(bool state);

void Main(){
    ll N,K;
    cin >> N >> K;
    vll A(N);
    rep(i,N) cin >> A[i];

    ll left = 0;
    ll right = 1e9+1;
    while(right - left > 1){
        ll mid = (left + right) / 2.;
        ll sum = 0;
        rep(i,N)
            sum+=ceil(A[i]/ld(mid)) - 1;
        // cout << mid << endl;
        if(sum <= K)
            right = mid;
        else
            left = mid;
    }
    cout << right << endl;
    
}

int main(int argc, char const *argv[])
{
    Main();
    return 0;
}

void yesno(bool state){
    if(state)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 4796
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main( ) {
    //freopen("A.01.in","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int topings=0;
    // string s;
    char s[256];
    scanf("%s",s);
    for (int i = 0; i < 3; i++)
    {
        (s[i]!='o')?:topings+=100;
    }
    printf("%d",700+topings);
    return 0;
}

Measured memory_bytes: 3816
#include <iostream>
using namespace std;
int main (){
	int Info1,Math1,Science1,English1,Info2,Math2,Science2,English2,S,T;
		cin>>Info1>>Math1>>Science1>>English1;
			S=Info1+Math1+Science1+English1;
		cin>>Info2>>Math2>>Science2>>English2;
			T=Info2+Math2+Science2+English2;
				if(S>=T){
					cout<<S<<endl;
				}
				else {
					cout<<T<<endl;
				}
	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
int f(int a){
    int ans1=0;
    while(a>=1){
        ans1+=a%10;
        a/=10;
    }
    return ans1;
}
int main(){
    int n,a,b,ans=0;
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++){
        if(a<=f(i)&&f(i)<=b){
            ans+=i;
            //cout<<f(i)<<endl;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  pair<double,int> d[3][8],dd[18];
  for(int i=0;i<3;i++){
    for(int j=0;j<8;j++)cin>>d[i][j].second>>d[i][j].first;
    sort(d[i],d[i]+8);
    for(int j=2;j<8;j++)dd[i*6+j-2]=d[i][j];
  }
  sort(dd,dd+18);
  for(int i=0;i<3;i++)
    for(int j=0;j<2;j++)cout<<d[i][j].second<<' '<<d[i][j].first<<endl;
  cout<<dd[0].second<<' '<<dd[0].first<<endl;
  cout<<dd[1].second<<' '<<dd[1].first<<endl;
  return 0;
}

Measured memory_bytes: 1300
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
cnt = 0
for i in range(n):
    d = [0]*m
    for j in range(m):
        d[j]= a[i][j]*b[j]
    if sum(d) > -c:
        cnt += 1
print(cnt)

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n;
  cin>>n;
  
  vll ans(n+1);
  
  reps(x,n){
    reps(y,n){
      reps(z,n){
        ll a=x*x+y*y+z*z+x*y+y*z+z*x;
        if(a>n) break;
        ans[a]++;
      }
    }
  }
  
  reps(i,n){
    cout<<ans[i]<<endl;
  }
  
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
int main() {
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    int n = abs(60*h-11*m);
    long double PI = acosl(-1);
    long double c = (pow(a,2.0)+pow(b,2.0)-2.0*a*b*cosl(n*PI/360.0));
    long double l = sqrt(c);
    cout << fixed << setprecision(18);
    cout << l << endl;
}


Measured memory_bytes: 4112
// B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
    int n;

    cin >> n;
    int h;

    int max = 0;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        cin >> h;
        if (max <= h) {
            cnt++;
            max = h;
        }
    }

    cout << cnt << endl;

    return 0;
}



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

signed main(void)
{
	int a, b, n;
	cin >> a >> b;
	n = b - a;
	cout << n * (n - 1) / 2 - a << endl;
	return 0;
}


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

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

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

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, m; cin >> a >> b >> m;
    vector<int> aa(a); rep (i, a) cin >> aa[i];
    vector<int> bb(b); rep (i, b) cin >> bb[i];
    vector<int> price;
    rep (i, m) {
        int x, y, c; cin >> x >> y >> c;
        x--; y--;
        price.push_back(aa[x] + bb[y] - c);
    }
    sort(all(aa)); sort(all(bb));
    price.push_back(aa[0] + bb[0]);
    sort(all(price));
    cout << price[0] << "\n";
    return 0;
}

Measured memory_bytes: 1660
#include<iostream>
#include<vector>
#include<numeric>

using namespace std;

void printAns(vector<int>& A, vector<int>& G, int* count){
  cout << G.size() << endl;
  for(int i = G.size()-1; i >= 0; i--) {
    if (i == 0){
    cout << G[i] << endl;
    break;
    }
    cout << G[i] << " ";
  }
  cout << *count << endl;
  for(int i = 0; i <= A.size()-1; i++){
    if(i == A.size()-1){
      cout << A[i];
      break;
    } 
    cout << A[i] << endl;
  }
}

void insertionSort(vector<int>& A, int n, int g, int* count){
  for(int i = g; i < n; i++){
    int j = i-g;
    while(j >= 0 and A[j]>A[j+g]){
      swap(A[j], A[j+g]);
      j-=g;
      (*count)++;
    }
  } 
}

void shellSort(vector<int>& A, int n){
  int count = 0;
  vector<int> G;
  G.push_back(1);
  for(int i = 1;;i++){
    int newG = 1 + 3*G[i-1]; 
    if(newG+accumulate(G.begin(), G.end(), 0) > n) break;
    G.push_back(newG);
  }
  int m = G.size();
  for(int i = m-1; i >= 0; i--){
    insertionSort(A, n, G[i], &count);
  }
  printAns(A, G, &count);
}


int main(int argc, char* argv[]){
  int n, v;
  vector<int> A;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> v;
    A.push_back(v);
  }
  shellSort(A, n);
}

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

#define itn int
#define vi vector<int>
#define pb push_back
#define srt sort(v.begin(), v.end())

//int infiint = std::numeric_limits<int>::max();
//float infiflt = std::numeric_limits<float>::infinity();
void solve() {    
	string s1, s2;
	cin >> s1 >> s2;
	stringstream str(s1);
	int n = 0;
	str >> n;
	stringstream str1(s2);
	int m = 0;
	str1 >> m;
	if(s1 > s2){
	  	for(int i = 0; i < n; i++)
	  		cout << s2;
	}	
	else{
	 	for(int i = 0; i < m; i++)
	 		cout << s1;
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.txt", "rt", stdin);
	solve();

	return 0;
}

Measured memory_bytes: 256
n, q = gets.split.map(&:to_i)
nums = Array.new(n){|i| i = []}
(n-1).times{
  a, b = gets.split.map(&:to_i)
  nums[a-1] << b-1
  nums[b-1] << a-1
}
opn = Array.new(n){|i| i = 0}
q.times{
  p, x = gets.split.map(&:to_i)
  opn[p-1] += x
}

stack = [0]
check = Array.new(n){|i| i = 0}

while stack.count > 0
  e = stack.pop
  if check[e] == 1
    next
  end
  check[e] += 1
  nums[e].each do |i|
    if check[i] == 1
      opn[e] += opn[i]
    else
      stack.push(i)
    end
  end
end
puts opn.join(" ")

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

typedef int64_t Int;
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << endl; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

int main() {
    string s;
    cin >> s;
    Int n = s.size();
    for (Int i = 0; i < (Int)n; i++) {
        if (s[i] == '?') {
            s[i] = 'D';
        }
    }
    print(s);
    return 0;
}

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

int main() {
    int N;
    int L;
	cin >> N;
    cin >> L;
    int min;
    if (1-L < 1) {
        min = L;
    } else if (1-L < N) {
        min = 0;
    } else {
        min = N + L - 1;
    }
    cout << N * (L-1) + N * (N+1) / 2 - min << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	int fum = 0;
	ll res = 0;

	rep(i,N){
		cin >> A.at(i);
	}

	rep(i, N-1) {
		if (A.at(i) <= A.at(i + 1) ){
			continue;
		}else{
			fum=A.at(i)-A.at(i+1);
			res += fum;
			A.at(i + 1) = fum + A.at(i + 1);
		}
	}

	cout << res << endl;
}


Measured memory_bytes: 4040
#include<bits/stdc++.h>
using namespace std;
string s;
long long int ans;
int last;

int main() {
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int res=0;
    if(k<=a)
        cout<<k;
    else if(k>a && k<=a+b)
        cout<<a;
    else cout<< a-(k-a-b);


}

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

int n, m;
int a[50], b[50];//隣接list
int G[50][50];
bool visited[50];

void dfs(int s) {
	visited[s] = true;
	for (int i = 0;i < n;i++) {
		if (G[s][i] == 0 || visited[i] == true)continue;
		dfs(i);
	}
}

int main() {
	cin >> n >> m;
	for (int i = 0;i < n;i++)for (int j = 0;j < n;j++)G[i][j] = 0;
	for (int i = 0;i < m;i++) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		G[a[i]][b[i]]++;
		G[b[i]][a[i]]++;
	}
	int ans = 0;
	for (int i = 0;i < m;i++) {
		G[a[i]][b[i]] = 0;G[b[i]][a[i]] = 0;
		for (int j = 0;j < n;j++)visited[j] = false;
		dfs(0);
		for (int j = 0;j < n;j++) {
			if (visited[j] == false) {
				ans++;
				break;
			}
		}
		G[a[i]][b[i]] = 1;G[b[i]][a[i]] = 1;
	}
	cout << ans << endl;
}

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

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t, countAC = 0, countWA = 0, countTLE = 0, countRE = 0;
	vector<string> v;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		string str;
		cin >> str;
		v.push_back(str);
	}
	for (int i = 0; i < v.size(); i++)
	{
		if (v[i] == "AC")
			countAC++;
		else if (v[i] == "WA")
			countWA++;
		else if (v[i] == "TLE")
			countTLE++;
		else if (v[i] == "RE")
			countRE++;
	}
	cout << "AC x " << countAC << "\n";
	cout << "WA x " << countWA << "\n";
	cout << "TLE x " << countTLE << "\n";
	cout << "RE x " << countRE << "\n";
	return 0;
}

Measured memory_bytes: 7408
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, x, y int
	fmt.Scanf("%d %d %d %d %d", &a, &b, &c, &x, &y)
	sum := (a * x) + (b * y)
	if x == y {
		tmp := (c * x * 2)
		if sum > tmp {
			sum = tmp
		}
	} else {
		diff := x - y
		v1 := 0
		v2 := 0
		if diff > 0 {
			v1 = (c * (x * 2))
			v2 = (c * (y * 2)) + (a * diff)
		} else {
			v1 = (c * (y * 2))
          v2 = (c * (x * 2)) + (b * int(math.Abs(float64(diff))))
		}
		if sum > v1 {
			sum = v1
		}
		if sum > v2 {
			sum = v2
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 1836
import sys
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
enum = enumerate
inf = 1001001002002002002

import random

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().rstrip().split()))

def vinput(rep=1, ty=int, cvt=list):
	return cvt(ty(input().rstrip()) for _ in "*"*rep)

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def bye(res):
	sT = "No Yes".split()
	print(sT[res])
	#exit(0)

def sol(N,vF):
	P,E = 1e9, 1e-3
	vA = [int(f*P+E) for f in vF]
	
	def divcnt(n):
		m,n = n,n
		a,b = 0,0
		while m%2<1: m//=2; a+=1
		while n%5<1: n//=5; b+=1
		return a,b

	vM = [divcnt(a) for a in vA]
	
	mX = [[0,]*50 for _ in "*"*50]
	for a,b in vM:
		mX[b][a] += 1
	
	mC = [[0,]*51,]
	for vX in mX:
		vC = [0,]
		t = 0
		for c,x in zip(mC[-1][1:],vX):
			t += x
			vC.append(t+c)
		mC.append(vC)
	
	#print(*mC[:20], sep="\n")###
	
	res = 0
	
	for a,b in vM:
		x = max(18-a, 0)
		y = max(18-b, 0)
		t = N - mC[y][-1] - mC[-1][x] + mC[y][x]
		if t and x<=a and y<=b:
			t-=1
		#t//=2
		#print(t,N,mC[y][-1],mC[-1][x],mC[y][x],a,b,x,y)##
		res += t

	print(res//2)


def main():
	N, = linput()
	sol(N, vinput(N,float))

if __name__ == "__main__":
	main()


Measured memory_bytes: 106924
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 100000000
#define INF 300000000000000000
#define MOD 1000000007
#define mod 1000000007
#define INT_MAX_ 2147483647
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[5]={-1,0,1,0,0};
int dy[5]={0,-1,0,1,0};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    ll x;cin>>x;
    map<ll,ll>m;
    for(ll a=-5000;a<=5000;a++){
        ll a5=pow(a,5);
        m[a5]++;
    }
    for(ll a=-5000;a<=5000;a++){
        ll a5 = pow(a,5);
        ll b5 = a5-x;
        bool abc=0;

        if(m[b5]){
            for(ll b=-5000;b<=5000;b++){
                if(pow(b,5)==b5){
                    cout<<a<<" "<<b<<endl;
                    return 0;
                }
            }
        }
    }
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------





































Measured memory_bytes: 5152
import java.util.*;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		long n=0;
		String s = sc.nextLine();
		s = sc.nextLine();
		String[] st = s.split(" ");
		long[] a = new long[st.length];
		for(int i=0;i<a.length;i++){
			a[i] = Long.parseLong(st[i]);
		}
		Arrays.sort(a);
		for(long i:a){
			n+=i;
		}
		System.out.println(a[0]+" "+a[a.length-1]+" "+n);
	}
}

Measured memory_bytes: 32860
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	int n, k;
	ll s;
	cin >> n >> k >> s;
	
	vector<ll> v(n);
	
	for(int i = 0; i < k; i++)
		v[i] = s;
	ll x = s + 1;
	if(x > 1000000000)
		x = s - 1;
	for(int i = k; i < n; i++)
		v[i] = x;
	
	for(int i = 0; i < n; i++)
		cout << v[i] << " \n"[i + 1 == n];

	return 0;
}


Measured memory_bytes: 2176
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#include<stdio.h>
#include<functional>
#include<queue>

using ll = long long;

using namespace std;

ll mod = 1000000007;

ll n_pow(ll a, ll n) {
	if (n == 0)return 1;
	ll t = n_pow(a, n / 2);
	t *= t;
	t %= mod;
	if (n % 2 == 1)t *= a;
	return t % mod;
}

const int INF = 1001001001;
//const ll INF = 1e18;

ll cal_gcd(ll m, ll n) {
	while (m%n != 0) {
		ll c = m % n;
		m = n;
		n = c;
	}
	return n;
}



int main() {
	int n, y;
	cin >> n >> y;
	bool ok = false;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n - i; j++) {
			int k = n - i - j;
			if (10000 * i + 5000 * j + 1000 * k == y) {
				ok = true;
				cout << i << " " << j << " " << k << endl;
				break;
			}
			if (ok)break;
		}
		if (ok)break;
	}
	if (!ok)cout << "-1 -1 -1" << endl;
	return 0;
}

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (unfoldr)

main :: IO ()
main = do
  [n, m, k] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    cumSum :: [Int] -> [Int]
    cumSum = unfoldr next . (,) 0
      where
        next :: (Int, [Int]) -> Maybe (Int, (Int, [Int]))
        next (acc, x : xs) | acc <= k - x, acc' <- acc + x = Just (acc', (acc', xs))
        next _                                             = Nothing
    go :: Int -> Int -> Int -> [Int] -> [Int] -> Int
    go t i j xs@(x : xs') ys@(y : ys') | y <= k - x = go t i (j + 1) xs ys'
                                       | otherwise  = go (t `max` (i + j)) (i - 1) j xs' ys
    go t 0 j _            ys                        = t `max` (j + length ys)
    go t i j _            []                        = t `max` (i + j)
  as <- cumSum . map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  bs <- cumSum . map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  print $ go 0 (length as) 0 (reverse as) bs

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 38108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static kyoupuro.Input;
using static kyoupuro.MyMath;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var S = Line();

            Console.WriteLine(Math.Min(S.Where((v, n) => n % 2 == v - '0').Count(), S.Where((v, n) => n % 2 != v - '0').Count()));
        }
    }

    class MyMath {
        public const long mod = 1000000007;

        public static long Gcd(long a, long b) {
            return b == 0 ? a : Gcd(b, a % b);
        }

        public static List<long> Factor(long n) {
            var list = new List<long>();
            n = DivideToLimit(n, 2, list);
            n = DivideToLimit(n, 3, list);
            long sqrt = Sqrt(n);
            for (int i = 5; i <= n && i <= sqrt; i += 4) {
                n = DivideToLimit(n, i, list);
                i += 2;
                n = DivideToLimit(n, i, list);
            }
            if (n > 1) list.Add(n);
            return list;
        }

        public static long Sqrt(long n) {
            if (n < 0) return 0;
            long a = 0, tmp = 0, b = 0;
            for (int i = 62; i >= 0; i -= 2) {
                tmp = (b << 1) + 1 <= (n >> i) ? 1 : 0;
                a = a << 1 | tmp;
                n -= (((b << 1) + 1) * tmp) << i;
                b = (b << 1) + tmp + tmp;
            }
            return a;
        }

        static long DivideToLimit(long divisor, long dividend, List<long> list) {
            while (divisor % dividend == 0) {
                list.Add(dividend);
                divisor /= dividend;
            }
            return divisor;
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13408
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, a: [usize; n]};

    let mut count = 0;

    for i in 0..n {
        if (i + 1) % 2 == 1 && a[i] % 2 == 1 {
            count += 1;
        }
    }

    println!("{}", count)
}


Measured memory_bytes: 2176
N, M = map(int, input().split())
parents = [i for i in range(N+1)]

def find(x):
    if x == parents[x]:
        return x
    else:
        parents[x] = find(parents[x])
        return parents[x]
    
def same(A, B):
    x, y = find(A), find(B)
    if x==y:
        return
    else:
        parents[x] = y

for _ in range(M):
    A, B = map(int, input().split())
    same(A, B)
    
for i in range(N):
    find(i+1)

print(len(set(parents)) - 2)

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

int sumdigits(int i){
  int sum=0;
  while(i>0){
    sum += i % 10;
    i /= 10;
  }
  return sum;
}

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  int sum, cnt=0;
  for(int i=1; i<=n; ++i){
    sum = sumdigits(i);
    if(a <= sum && sum <= b)cnt+=i;
  }
  cout << cnt << endl;
  return 0;
}


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

int64_t sum( const string& s, const vector<int>& p ) {
	int64_t result = 0;
	int n = p.size();
	int x = 0;

	for( int i = 0; i < n; ++i ) {
		result += stoll( s.substr( x, p.at( i )-x ) );
		x = p.at( i );
	}

	result += stoll( s.substr( x ) );
	return result;
}

int64_t split( string& s, int beg, vector<int>& p, int cut ) {
	if( cut == 0 ) {
		return sum( s, p );
	}

	int64_t result = 0;
	int n = s.size() - cut;

	for( int i = beg; i < n; ++i ) {
		p.push_back( i+1 );
		result += split( s, i+1, p, cut-1 );
		p.pop_back();
	}

	return result;
}

int main() {
	ios_base::sync_with_stdio( false );

	string S;
	cin >> S;

	int64_t result = 0;
	vector<int> p;

	for( int i = 0; i < S.size(); ++i ) {
		result += split( S, 0, p, i );
	}

	cout << result << endl;
}


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

int main() {
    string a, b;
    cin >> a >> b;
    int n = stoi(a + b);

    for (int i = 1; i * i <= n; ++i) {
        if (i * i == n) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque

def q(d, c): #dは9以下、cは桁数
    digsum = d * c
    add = c - 1 + (digsum - 1) // 9
    rem = digsum - 9 * ((digsum - 1) // 9)
    return add, rem

def solve():
    input = sys.stdin.readline
    M = int(input())
    count = -1
    ans = 0
    for _ in range(M):
        d, c = map(int, input().split())
        add, rem = q(d, c)
        count += add
        ans += rem
        count += 1
        if ans > 9:
            ans -= 9
            count += 1

    print(count)
    
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <set>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iterator>
#include<deque>
#include<cstdio>

#define lp(i,a,n) for(int i=a;i<n;++i)
#define rep(i,a,n) for(ll i=a;i<=n;++i)
#define all(v) v.begin(),v.end()
#define clr(n,a) memset(n,a,sizeof(n))
#define vi vector <int>
#define sc set <char>
#define si set<int>
#define pb push_back
#define vb vector <bool>
#define pi(n) printf("%d\n",n)
#define ln "\n"
#define mahmoud_abdelsamie ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
using namespace std;


int main()
{
    mahmoud_abdelsamie
    int n,k;
    cin>>n>>k;
    int a[n]={};
    lp(i,0,n) cin>>a[i];
    sort(a,a+n);
    ll sum=0;
    lp(i,0,k) sum+=a[i];
    cout<<sum<<ln;
    return 0;
}


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

using namespace std;

#define ll long long
#define F first
#define S second
#define ii pair < int , int >

const int N=500000;
ll a[N];
int md=1e9+7;
    ll sum,ans;
int main()
{
    int n;
    cin>>n;

    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }

    for(int i=0;i<n;i++){
            sum-=a[i];
        ans+=((sum%md) * (a[i]%md))%md;
        ans%=md;
    }
    cout<<ans;

}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}

//a,b x
int main(){
	ll N; cin>>N;
    if(N==1){
        cout<<"Hello World";
    }
    else{
        ll A,B; cin>>A>>B;
        cout<<A+B;
    }
		
	
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vi nums;
    int t = 1, cnt1 = 0;
    rep(i, n) {
        if (s[i]==(char)(t+'0')) ++cnt1;
        else {
            nums.pb(cnt1);
            t = 1 - t;
            cnt1 = 1;
        }
    }
    if (cnt1 != 0) nums.pb(cnt1);
    int n2 = nums.size();
    vi sum(n2+1);
    rep(i, n2) sum[i+1] = sum[i] + nums[i];
    int len = 2 * k + 1;
    int ans = 0;
    for (int i=0; i<(int)nums.size(); i+=2) {
        int left = i, right = min(i+len, n2);
        ans = max(ans, sum[right]-sum[left]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1272