akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cmath>

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


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    cout << ((x - z) / (y + z)) << endl;
}

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

int main(){
  char b;
  cin >> b;
  if(b=='A') cout << 'T' << endl;
  if(b=='T') cout << 'A' << endl;
  if(b=='C') cout << 'G' << endl;
  if(b=='G') cout << 'C' << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>


using namespace std;

vector<long> A, B;
vector<pair<int, int>> M;
int N = 0;
long T = 0;
string ans = "Yes";

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		long l, m;
		cin >> l >> m;
		M.emplace_back(m, l);
	}
	sort(M.begin(), M.end());
	for (const auto& e : M)
	{
		//e.first がB,e.secondがA
		T += e.second;
		if (T > e.first)
		{
			ans = "No";
			break;
		}
	}
	cout << ans;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N;
    int A = 0;
    cin >> N;
    vector<int> B(N - 1, 0);

    for(int i = 0; i < N - 1; i++)  cin >> B[i];
    A += B[0];
    A += B[B.size() - 1];
    for(int i = 1; i < N - 1; i++){
        A += min(B[i], B[i - 1]);
    }
    cout << A << endl;
    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            var input = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            var ballList = new Dictionary<long, long>();

            for (int i = 0; i < nk[0]; i++)
            {
                if (!ballList.ContainsKey(input[i])) ballList[input[i]] = 0;
                ballList[input[i]]++;
            }
            var balls = ballList.OrderBy(x => x.Value).ToArray();

            long ans = 0;
            for (int i = 0; i < ballList.Count() - nk[1]; i++)
            {
                ans += balls[i].Value;
            }
            Console.WriteLine(ans);
        }
    }
}

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

using namespace std;

int main()
{
	unsigned long long int n, a, b;
    cin >> n >> a >> b;
    if (a % 2 == b % 2) {
        cout << (b-a)/2 << endl;
    }
    else {
        cout << (b-a-1)/2 + 1 + min(a-1, n-b) << endl;
    }
	return 0;
}


Measured memory_bytes: 256
nk=list(map(int, input().split(" ")))
n=nk[0]
k=nk[1]

if n<=k:
    a=n
    while a>k:
        a=abs(a-k)
    ans=min(k-a,a)
    print(ans)
if n>k:
    a=n%k
    while a>k:
        a=abs(a-k)
    ans=min(k-a,a)
    print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int[] vis = new int[2000001];
		int N = input.nextInt();
		long cnt = 0;
		for (int i = 1; i <= N; i++) {
			int x = input.nextInt();
			if (i+x<=200000) vis[i+x]++;
			if (i-x>=0) cnt+=vis[i-x];
		} 
		System.out.println(cnt);
	}
}

Measured memory_bytes: 56344
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void) {
    int N;
    scanf("%d", &N);

    int i;
    for(i=0; i<N; i++) {
        int temp;
        scanf("%d", &temp);
        if(temp % 2 == 0) {
            if((temp % 3 != 0) && (temp % 5 != 0)) {
                printf("DENIED\n");
                return 0;
            }
        }
    }
    printf("APPROVED\n");
}

Measured memory_bytes: 128
open Printf
open Scanf

let solve a b =
  match (a, b) with
    "H", "H" -> "H"
  | "H", "D" -> "D"
  | "D", "H" -> "D"
  | _, _ -> "H"
           
let () =
  let a, b = scanf "%s %s\n" (fun x y -> (x, y)) in
  printf "%s\n" @@ solve a b


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

int main(){
    int k;
    cin >> k;
    int ans = 0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                ans += __gcd(__gcd(i,j),l);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3676
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, M) = Slice2<long>();
            var ans = 1L;
            for (var i = 1; i <= N; ++i)
                ans = ans * i % Mod;
            for (var i = 1; i <= M; ++i)
                ans = ans * i % Mod;
            if (Abs(N - M) == 1)
                WriteLine(ans % Mod);
            else if (Abs(N - M) == 0)
                WriteLine(ans * 2 % Mod);
            else
                WriteLine(0);
        }


        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 27528
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
using namespace std;

const int N = 7777;
int n, k, s;
int inf = 1e9;
map <string, int> mp;
int pref[N];
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("flow2.in", "r", stdin);
    //freopen("flow2.out", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; i++){
        string s;
        int k;
        cin >> s >> k;
        mp[s] = i;
        pref[i] = pref[i - 1] + k;
    }
    string s;
    cin >> s;
    int k = mp[s];
    cout << pref[n] - pref[k] << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li n, k;
    cin >> n >> k;
    vector<li> ps(n);
    for (int i = 0; i < n; ++i) {
        cin >> ps[i];
    }
    sort(ps.begin(), ps.end());
    li ans = 0;
    for (int i = 0; i < k; ++i) {
        ans += ps[i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>

int main(){

  int n, i;
  double sum;

  sum = 1;


  while(scanf("%d",&n) != EOF){
    
    for(i = 1; i <= n; i++){

    sum *= i;
    }
    
    printf("%.0f\n",sum);
    sum = 1;
  }

  return 0;


}

Measured memory_bytes: 0
//Volume0-0099
import java.util.*;

public class Main {
	public static void main(String[] args) {
	int n,q,a,v,top;
	int[] sum;
	
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sum = new int[n+2];
		top = n+1;
		sum[top] = Integer.MIN_VALUE;
		q = sc.nextInt();
		for(int i=0;i<q;i++){
			a = sc.nextInt();
			v = sc.nextInt();
			sum[a] += v;
			if(v<0&&a==top){
				top = n+1;
				sum[top] = Integer.MIN_VALUE;
				for(int j=1;j<=n;j++){
					if((sum[j]>sum[top])||(sum[j]==sum[top] && j<top)){
						top=j;
					}
				}
			} else {
				if((sum[a] > sum[top]) || (sum[a] == sum[top] && a < top)){
					top = a;
				}
			}
			System.out.println(top+" "+sum[top]);
		}
	}
}

Measured memory_bytes: 75412
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------/
// ax+by=gcd(a,b)を満たすx,yを求める
ll extgcd(ll a, ll b, ll &x, ll &y){
    ll gc = a;
    if(b!=0){
        gc = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }else{
        x = 1, y = 0;
    }
    return gc;
}
// 値A, B
// ll x, y;
// extgcd(A, B, x, y); //x,yにAx+By=gcd(a,b)を満たす値を返す

// ACL template
int main() {
    ll N;
    cin >> N;

    if(N == 1){
        cout << 1 << endl;
        return 0;

    }

    ll tmp = N;
    map<ll, ll> mp;
    repe(x, 2, (ll)sqrt(N) + 1){
        while(tmp % x == 0){
            mp[x]++;
            tmp /= x;
        }
    }
    if (tmp > 1) mp[tmp]++;

    mp[2]++;

    ll x, y;

    ll ans = INF;

    vc<pair<ll, ll>> P;
    for(auto [p, c]: mp){
        if (c == 0) continue;
        P.eb(p, c);
    }

    ll pn = P.size();
    
    rep(bit, 1ll << pn){
        ll ta = 1, tb = 1;
        rep(i, pn){
            auto [p, c] = P[i];
            if(bit >>i & 1){
                rep(i, c) ta *= p;
            }else{
                rep(i, c) tb *= p;
            }
        }
        extgcd(ta, tb, x, y);
        if(x != 0 and y != 0) chmin(ans, min(ta * abs(x), tb * abs(y)));
    }

    cout << ans << endl;
}

Measured memory_bytes: 3716
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
          

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int m[3] , n[3] = {5 , 5 , 7} , a = 0;
    for ( int i = 0 ; i < 3 ; i++ ) {
        cin >> m[i];
    }
    sort( m , m + 3 );
    for ( int i = 0 ; i < 3 ; i++ ) {
        if ( m[i] == n[i] ) a++;
    }
    if ( a == 3 ) cout << "YES";
    else cout << "NO";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		String Alpha = "abcdefghijklmnopqrstuvwxyz";
		Scanner sc = new Scanner(System.in);
		String line1 = "";
		String line2 = "";
		int T_Score = 0; // 太郎の得点
		int H_Score = 0; // 花子の得点
		int win = 3; // 勝者のプラス得点
		int draw = 1; // 引き分けの場合のプラス得点
		String[] animal = new String[2]; // カードに書かれた動物の組(太郎のカード、花子のカード)
		int T_Value = 0; // カードの強さ(太郎)
		int H_Value = 0; // カードの強さ(花子)
		int n = 0; // それぞれのカードの数(勝負回数)
		int compare_length = 0;
		boolean judge_n = true;
		boolean judge_line = true;

		line1 = sc.nextLine();
		n = Integer.parseInt(line1);
		if (n < 0 || n > 1000) {
			judge_n = false;
		}

		if (judge_n == true) {

			out: for (int i = 0; i < n; i++) {
				line2 = sc.nextLine();

				if (line2.length() > 100) {
					judge_line = false;
					break out;
				}
				animal = line2.split(" ");
				if (animal[0].length() > animal[1].length()) {
					compare_length = animal[1].length();
				} else if (animal[1].length() > animal[0].length()) {
					compare_length = animal[0].length();
				} else {
					compare_length = animal[0].length(); // animal[1]でもよい
				}
				in: for (int k = 0; k < compare_length; k++) {
					T_Value = Alpha.indexOf("" + animal[0].charAt(k));
					H_Value = Alpha.indexOf("" + animal[1].charAt(k));

					// 始:各文字が小文字であるかのチェック
					if (T_Value == -1 || H_Value == -1) {
						judge_line = false; // 大文字が存在すれば、条件を満たしていないのでループから出る
						break out;
					}
					// 終:各文字が小文字であるかのチェック

					if (T_Value != H_Value) {
						if (T_Value > H_Value) {
							T_Score += win;
						} else {
							H_Score += win;
						}

						break in;
					} else {
						if (k == compare_length - 1) { // kの値がcompare_length-1までき手いるということはそれまでの文字がすべて同じであるということ
							if (animal[0].length() == animal[1].length()) {
								T_Score += draw;
								H_Score += draw;
							} else if (animal[0].length() > animal[1].length()) {
								T_Score += win;
							} else {
								H_Score += win;
							}
						}

					}
				}// in:forここまで
			}// out:forここまで

			if (judge_line == true) {
				System.out.println(T_Score + " " + H_Score);
			}
		}
	}
}



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

int main() {
    int p,q,r;
  cin >> p >> q >> r ;
    int min=p+q;
    if(min > q+r){
        min = q + r;
    }
    if(min > r+p){
        min = r + p;
    }
    cout << min << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N;
    cin >> N;
    int *L;
    L = new int[N];
    urept(i, 0, N)
    {
        cin >> L[i];
    }
    sort(L, L + N);
    int sum = 0;
    urept(i, 0, N - 1)
    {
        sum += L[i];
    }
    if (sum > L[N - 1])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
S = input()
w_list = []
flag = True
for cha in S:
    w_list.append(cha)
c = 1
for i in w_list:
    w_c = i
    c += 1
    w_time = w_list.count(w_c)
    if w_time != 2:
        flag = False
if flag == True:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 2940
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define mod  1073741824
#pragma GCC optimization ("O3")
using namespace std;
const int N = 100*1000+5;
#define all(x) begin(x),end(x)
int main()
{
   
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector <int> v;
    for (int i = 0; i < n; ++i)
    {
        int a;
        cin >> a;
        if(a % 2 == 0)
        {
            v.push_back(a);
        }
    }
    int c = 0;
    for (int i = 0; i < v.size(); ++i)
    {
        if(v[i] % 3 == 0 || v[i] % 5 == 0)
        {
            c++;
        }
    }
    if(c == v.size())
        cout << "APPROVED";
    else
        cout << "DENIED";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,M;
    cin>>N>>M;
    
    int K,a;
    int A[31]={0};
    for(int i=0;i<N;i++){
        cin>>K;
        for(int j=0;j<K;j++){
            cin>>a;
            A[a]++;
        }
    }
    
    int count=0;
    for(int i=1;i<=30;i++){
        if(A[i]==N)count++;
    }
    
    cout<<count<<endl;
}

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

template <typename T>
struct monoid
{
	using F = function<T(T, T)>;

	const T e;
	const F f;

	monoid(T e, F f) : e(e), f(f)
	{
	}
};

template <typename T>
struct segment_tree : monoid<T>
{
	using F = function<T(T, T)>;

	int n;
	vector<T> tree;

	segment_tree(const int n_, const T &e, const F &f) : monoid<T>(e, f)
	{
		for (n = 1; n < n_;)
		{
			n *= 2;
		}
		tree.assign(2 * n, monoid<T>::e);
	}

	segment_tree(const int n_, const vector<T> &init, const T &e, const F &f) : monoid<T>(e, f)
	{
		for (n = 1; n < n_;)
		{
			n *= 2;
		}
		tree.assign(2 * n, monoid<T>::e);
		for (size_t i = 0; i < init.size(); i++)
		{
			update(i, init[i]);
		}
	}

	void update(int index, const T &x)
	{
		index += n;
		tree[index] = x;
		for (index /= 2; 0 < index; index /= 2)
		{
			tree[index] = monoid<T>::f(tree[2 * index + 0], tree[2 * index + 1]);
		}
	}

	T query(int index, int il, int ir, const int l, const int r)
	{
		if (ir <= l || r <= il)
		{
			return monoid<T>::e;
		}

		if (l <= il && ir <= r)
		{
			return tree[index];
		}
		else
		{
			const T left = query(2 * index + 0, il, (il + ir) / 2, l, r);
			const T right = query(2 * index + 1, (il + ir) / 2, ir, l, r);
			return monoid<T>::f(left, right);
		}
	}

	T query(const int l, const int r)
	{
		return query(1, 0, n, l, r);
	}

	T operator[](const int &index) const
	{
		return tree[n + index];
	}
};

int main()
{
	int n;
	string s;
	int q;
	cin >> n >> s >> q;

	segment_tree<int> seg(n, 0, [](auto l, auto r) {
		return (l | r);
	});

	for (int i = 0; i < n; i++)
	{
		seg.update(i, (1 << (s[i] - 'a')));
	}

	for (int t = 0; t < q; t++)
	{
		int op;
		cin >> op;

		if (op == 1)
		{
			int i;
			char c;
			cin >> i >> c;
			i--;

			seg.update(i, (1 << (c - 'a')));
		}
		else if (op == 2)
		{
			int l, r;
			cin >> l >> r;
			l--;
			r--;

			cout << __builtin_popcount(seg.query(l, r + 1)) << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 4996
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = Long.parseLong(sc.next());
		long b = Long.parseLong(sc.next());
		long x = Long.parseLong(sc.next());
		sc.close();

		long result = 0;
		if(a==0) {
			result += b/x + 1;
		}else {
			if(a%x == 0) {
				result += b/x - a/x + 1;
			}else {
				result += b/x -a/x;
			}
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 23764
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    unsigned int N;
    cin >> N;
    int X[101],Y[101],H[101];
    tuple<long long ,long long ,long long > g;

    rep(i,N){
        cin >> X[i] >> Y[i] >> H[i];
        if(H[i]>=1){
            g = make_tuple(X[i],Y[i],H[i]);
        }
    }

    rep(i,101){
        rep(j,101){
            long long center_hight =
                    get<2>(g)+abs(get<0>(g)-i)+abs(get<1>(g)-j);
            center_hight = max(center_hight,0LL);
            bool flag = true;
            rep(k,N){
                long long height=
                        center_hight - abs(X[k]-i)-abs(Y[k]-j);
                height = max(height,0LL);
                if(height !=H[k]) flag = false;
            }
            if(flag){
                printf("%d %d %lld\n", i,j,center_hight);
                break;
            }
        }

    }


    return 0;
}



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

void solve(){
	int n, k;
	cin>>n>>k;
	int v[10]={0};
	int d;
	for(int i=0;i<k;i++){
		cin>>d;
		v[d]=1;
	}
	for(int i=n; i<1e6; i++){
		string str = to_string(i);
		int chk=0;
		for(int j=0; j<str.size(); j++){
			if(v[(int)(str[j]-48)] != 0){
				chk=1;
				break;
			}
		}
		if(chk==0){
			cout<<i;
			break;
		}
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();

    return 0;
}


Measured memory_bytes: 3720
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>
#include<map>

using namespace std;

char S[3];

int main()
{
  cin>>S;
  
  if(S[1]=='R') cout<<"ABC";
  else cout<<"ARC";
  
  
}

Measured memory_bytes: 3636
n = int(input())
ab_list = [list(map(int,input().split())) 
           for nesya in range(n)]
ab_list = sorted(ab_list,key=lambda x: (x[1],x[0]))
time = 0
for ab in ab_list:
  a = ab[0]
  b = ab[1]
  time += a
  if time <= b:
    pass
  else:
    time = -1
    print('No')
    break
if time > -1:
  print('Yes')

Measured memory_bytes: 67920
use std::io;
use std::collections::HashMap;

fn main()
{
    let mut w = String::new();
    io::stdin().read_line(&mut w).unwrap();

    let mut map = HashMap::new();

    for c in w.trim().chars()
    {
        let n = map.entry(c).or_insert(0);
        *n += 1;
    }

    match map.values().find(|&x| x%2 != 0)
    {
        Some(_) => println!("No"),
        None    => println!("Yes")
    }
}


Measured memory_bytes: 380
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

k,q = LI()
d = LI()
nxm = [LI() for _ in range(q)]

for n,x,m in nxm:
    e = list(map(lambda x:(x-1)%m+1,d))
    s = sum(e)*((n-1)//k) + sum(e[:(n-1)%k])
    tmp = (s+x)//m - x//m
    print(n-1-tmp)

    
    


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

using namespace std;

int main()
{
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    x -= a[i];
    cerr << x << endl;
    if (x >= 0)
      ans = i + 1;
    else
    {
      cout << ans << endl;
      return 0;
    }
  }
  cout << (0 < x ? ans - 1 : ans) << endl;

  return 0;
}


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

int main(){
    int n, m; cin >> n >> m;
    if(n > m) swap(n, m);

    if(n == 1 and m == 1) cout << 1 << endl;
    else if(n == 1) cout << m - 2 << endl;
    else cout << (int64_t)(n - 2) * (m - 2) << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 int main() {
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   if((a+b)>(c+d))cout<<"Left"<<endl;
    else if((a+b)==(c+d))cout<<"Balanced"<<endl;
    else if((a+b)<(c+d))cout<<"Right"<<endl;
 }

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

int main(){
  int n, s;
  double sum, sum2, ave, ave2;

  while(cin>>n,n){
    sum=0;
    sum2=0;
    for(int i=0;i<n;i++){
      cin>>s;
      sum+=s;
      sum2+=s*s;
    }
    ave=sum/n;
    ave2=sum2/n;

    printf("%f\n", sqrt(ave2-ave*ave));
  }
  return 0;
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e9) + 1;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

  vector<int> a(n + 1, 0);
  for (int i = 1; i < n; ++i) {
    int v;
    cin >> v;
    a[v] += 1;
  }

  for (int i = 1; i <= n; ++i) {
    cout << a[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 4052
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

long long int getpow(int n, int r) {
	if (r == 0) return 1;
	long long int tmp = getpow(n, r / 2);
	if (r % 2 == 0) return (tmp * tmp) % mod;
	return (((tmp * tmp) % mod) * n) % mod;
}

int main() {
	int n, k;
	cin >> n >> k;
	long long int result[100001] = {};
	long long int ans = 0;
	for (int i = k; i >= 1; i--) {
		int cnt = 0;
		int tmp = i;
		while (tmp <= k) {
			cnt++;
			tmp += i;
			// cout << cnt << " " << tmp << endl;
		}
		result[i] = getpow(cnt, n);
		// cout << cnt << " " << n << " " << result[i] << endl;
		tmp = 2 * i;
		while (tmp <= k) {
			result[i] -= result[tmp];
			result[i] += mod;
			result[i] %= mod;
			tmp += i;
		}
		ans += (i * result[i]) % mod;
		ans %= mod;
		// cout << i << " " << result[i] << endl;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4428
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

ll N;
cin >> N;
vl a(N);
rep(i,N) cin >> a[i];

ll cnt = 0;
vl b;
bool zero = false;
rep(i,N) {
    if(a[i] == 0) zero = true;
    if(a[i] < 0) cnt++;
    b.push_back(abs(a[i]));
}

ll ans = 0;
rep(i,N) {
    ans += b[i];
}

if(zero || cnt % 2 == 0) cout << ans << endl;
else {
    sort(all(b));
    cout << endl;
    ans -= 2*b[0];
    cout << ans << endl;
}

return 0;
}

Measured memory_bytes: 2168
#include<stdio.h>
#define N 100001

typedef struct{
  char name[10];
  int time;
}P;

P dequeue(P *, int *, int);
int min(int, int);
void enqueue(P *, P, int *, int);

int main(){
  int i, n, q, c, head=1, tail, elaps=0;
  P Q[N], u;

  scanf("%d%d", &n, &q);
  for(i=1; i<=n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].time);
  }

  tail = n+1;
  while(head != tail){
    u = dequeue(Q, &head, n);
    c = min(q, u.time);
    u.time -= c;
    elaps += c;
    if(u.time > 0)enqueue(Q, u, &tail, n);
    else{
      printf("%s %d\n", u.name, elaps);
    }
  }
  return 0;
}

P dequeue(P *Q, int *head, int n){
  P x = Q[*head];
  *head = (*head + 1) % N;
  return x;
}

int min(int a, int b){
  if(a <= b)return a;
  else return b;
}

void enqueue(P *Q, P u, int *tail, int n){
  Q[*tail] = u;
  *tail = (*tail + 1) % N;
}



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

int main() {
    int a, b, d, r;
    double f;
    cin >> a >> b ;
    d = a / b;
    r = a % b;
    f = (double)a / b;
    printf("%d %d %.8lf\n", d, r, f);
    
    return 0;
    
}	



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

struct Dice{
    int s[6];
    
    void roll(char c){
        int tmp;
        if(c == 'E'){
            tmp = s[0];
            s[0] = s[3];
            s[3] = s[5];
            s[5] = s[2];
            s[2] = tmp;
        }
        if(c == 'W'){
            tmp = s[0];
            s[0] = s[2];
            s[2] = s[5];
            s[5] = s[3];
            s[3] = tmp;
        }
       if(c == 'N'){
            tmp = s[0];
            s[0] = s[1];
            s[1] = s[5];
            s[5] = s[4];
            s[4] = tmp;
        }
        if(c == 'S'){
            tmp = s[0];
            s[0] = s[4];
            s[4] = s[5];
            s[5] = s[1];
            s[1] = tmp;
        }
    }
    int top() {
    return s[0];
  }
};

int main(){
    Dice d;
    for(int i = 0; i < 6; i++) {
        cin >> d.s[i];
    }
    string s;
    cin >> s;
    
    for(int i = 0; i < s.size(); i++) {
        d.roll(s[i]);
    }
    cout << d.top() << endl;
    return 0;
}



Measured memory_bytes: 3168
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] n = new int[5];
        for (int i = 0; i < 5; i++) n[i] = sc.nextInt();
        int ans = 0, last = 10;
        for (int ni: n) {
            ans += Math.ceil(ni/10.0) * 10;
            if (ni % 10 != 0) last = Math.min(last, ni%10);
        }
        if (last != 10) ans -= 10 - last;
        System.out.println(ans);
    }
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
#include<cstring>
#include<cmath>
#include<iterator>
#include<cstdlib>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ses   "\n"
#define whp   " "
#define mxi 99999
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define PI acos(-1)
#define sz(a) long long(a.size())
#define ff first
#define ss second
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep0(i,a,b) for(int i=a; i<b; i++)
#define rep1(i,a,b) for(int i=a; i<=b; i++)
#define rep0in(i,a,b) for(int i=a-1; i>=b; i--)
#define rep1in(i,a,b) for(int i=a; i>b; i--)
#define repv(i,a) for(auto i=a.begin(); i!=a.end();++i)

///priority_queue <int, vector<int>, greater<int>> g
#define MS(a,b) memset(a,b,sizeof(a));

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll fx[4]= {1,-1,0,0};
ll fy[4]= {0,0,1,-1};

typedef vector<ll> vll;
typedef vector<string> vss;
typedef vector<pair<ll,ll > > vpr;
typedef vector<pair<string,ll > > vspr;
typedef list<ll> li;
typedef list<string> ls;
typedef list<pair<ll,ll> > lpr;
typedef list<pair<string,ll> > lspr;

bool rs(ll a, ll b){return(a>b);}
ll spd(ll n){ if(n%2==0)return 2; for(ll i=3; i*i<=n; i++){if(n%i==0)return i;}return n;}

int main(){
ll a,b,c,k; cin>>a>>b>>c>>k;
ll cc=0;

while(a>=b){
    b=b*2;
    cc++;
}
while(b>=c){
    c=c*2;
    cc++;
}
if(cc<=k)cout<<"Yes"<<endl;
else cout<<"No"<<endl;


return 0;
}


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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var a = ab[0];
            var b = ab[1];
            var ans = "";
            if (b < 0)
            {
                if ((b - a + 1)%2 == 0)
                {
                    ans = "Positive";
                }
                else
                {
                    ans = "Negative";
                }
            }else if (a <= 0 && 0 <= b)
            {
                ans = "Zero";
            }
            else
            {
                ans = "Positive";
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 2776
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int a,b;
  cin>>a>>b;
  if(a + b >= 10) {
    cout << "error" << endl;
  } else {
    cout << a + b << endl;
  }

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	if(n==0){
		cout<<n<<'\n';
		return 0;
	}
	ll b=1;
	string ans="";
	while(n){
		if(n%(b*(-2))){
			n-=b;
			ans='1'+ans;
		}
		else{
			ans='0'+ans;
		}
		b*=-2;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
#include<cmath>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll a,b,c;
  cin >> a >> b >> c;
  long long v = 4*a*b,x=(c-a-b);
  if(x>0&&v<x*x) cout <<"Yes\n";
  else cout <<"No\n";
}


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

int main() {
  int rows;
  int columns;
  string s;

  cin >> rows;
  cin >> columns;

  getline(cin, s); // 1行目の最後まで読んでおく

  vector<string> strs(rows);
  for (int i = 0; i < rows; i++) {
    getline(cin, strs[i]);
  }
  for (int j = 0; j < columns + 2; j++) {
      cout << '#';
  }
  cout << endl;
  for (string s: strs) {
    cout << '#' << s << '#' << endl;
  }
  for (int k = 0; k < columns + 2; k++) {
      cout << '#';
  }
}

Measured memory_bytes: 3588
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N >> M;
	if (N + M == 15)cout << "+\n";
	else if (N*M == 15) cout << "*\n";
	else cout << "x\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,mini = 10000000;
  cin >> n;
  vector<int> rui(n + 1);
  for(int i = 0;i < n;i++){
    cin >> a;
    rui[i + 1] = a + rui[i];
  }
  for(int i = 1;i <= n;i++){
    mini = min(mini , abs((rui[n] - rui[i]) - rui[i]));
  }
  cout << mini << endl;
}

Measured memory_bytes: 256
/*A - Frog 1*/
#include <bits/stdc++.h>
using namespace std;
using Long = long long;

Long minCost(const vector <Long>& altura, int pos, const int& k);
vector <Long> memo(1e5, -1);

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int tam;
	int k;

	cin >> tam >> k;

	vector <Long> altura(tam);

	for (int i = 0; i < tam; ++i){
		cin >> altura[i];
	}

	cout << minCost(altura, 0, k);

	return 0;
}

Long minCost(const vector <Long>& altura, int pos, const int& k){

	if(pos == altura.size() - 1){
		return 0;
	}

	if(memo[pos] == -1){

		Long aux = LLONG_MAX;

		//aux = abs(altura[pos] - altura[pos + 1]) + minCost(altura, pos + 1);

		for (int i = 1; i <= k; ++i)
		{
			if(pos + i < altura.size()){
				aux = min(aux, abs(altura[pos] - altura[pos + i]) + minCost(altura, pos + i, k));
			}
		}
		

		memo[pos] = aux;
	}

	return memo[pos];
}

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

using namespace std;

typedef long long ll;

int main(){
 ll N; cin >> N;
  vector<vector<ll>> to(N); vector<vector<ll>> cost(N);
  for(ll i = 0; i < N - 1; i++){
    ll a,b,c; cin >> a >> b >> c; a--; b--; //0-indexed
    to[a].push_back(b); to[b].push_back(a);
    cost[a].push_back(c); cost[b].push_back(c);}
  
  ll Q,K; cin >> Q >> K; K--;
  
  // K~を中心としたBFS
  vector<ll> path(N,-1); //-1は未到達、
  
  queue<ll> q; q.push(K); path[K] = 0;
  
  while(!q.empty()){
    ll p = q.front(); q.pop();
    for(ll i = 0; i < to[p].size(); i++){
     ll r = to[p][i];  
      if(path[r] != -1){ continue;}
      else{ path[r] = path[p] + cost[p][i]; q.push(r);}}}
  
  for(ll i = 0; i < Q; i++){
    ll x,y; cin >> x >> y; x--; y--;
    cout << path[x] + path[y] << endl;}
  
  return 0;}
    
   

Measured memory_bytes: 15464
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    long long n,m;
    vector<long long> a;
    
    cin >> n >> m;
    for (long long i = 0;i < n;i++){
        long long k;
        cin >> k;
        a.push_back(k);
    }
    
    sort(a.begin(),a.end());
    
    if (n == 1){
        for (int i = 0;i < m;i++){
            a[0] = a[0]/2;
        }
        goto EXIT;
    }
    
    while (m > 0){
        auto k = upper_bound(a.begin(),a.end(),a[n-1]/2);
        if (a.end() - k <= m){
            long long y = a.end()-k;
            m = m - (a.end()-k);
            for (long long  i = n-1;i >= n-y;i--){
                a[i] = a[i]/2;
            }
        }
        else if (a.end() > k+m){
            for (long long i = n-1;i >= n-m;i--){
                a[i] = a[i]/2;
            }
            m = 0;
        }
        sort(a.begin(),a.end());
    }
    
    EXIT:
    
    long long ans = 0;
    
    for (int i = 0;i < n;i++){
        ans += a[i];
    }
    
    cout << ans << endl;
}



Measured memory_bytes: 1400
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b,c;
    scanf("%d %d %d", &a,&b,&c);
    if (a < b && b < c){
        printf ("Yes\n");
    }
    else {
        printf ("No\n");
    }

    return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

int binpow(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = 1LL * res * a % MOD;
		a = 1LL * a * a % MOD;
		b >>= 1;
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	cout << (0ll + binpow(10, n) - 2 * binpow(9, n) + binpow(8, n) + MOD + MOD) % MOD << "\n";
	return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//const int MAX=;



int main(){
	string S;
	cin>>S;
	int N=sz(S);
	
	int a=0;
	int b=0;
	rep(i,N){
	if(i%2==0 && S[i]=='0')a++;
	if(i%2==0 && S[i]=='1')b++;
	if(i%2==1 && S[i]=='1')a++;
	if(i%2==1 && S[i]=='0')b++;
	}
	cout<<min(a,b)<<endl;
	
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main() {
    int a;
    int b;
    int c;
    cin >> a >> b >> c ;
    if (a<b) {
        if (b<c) {
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
 
int H, W;
vector<vector<int>> A(501, vector<int>(501, 0));
vector<P> p;
vector<vector<int>> out;

int main(void){
	
	scanf("%d %d", &H, &W);
	for(int i = 0; i < H; ++i) for(int j = 0; j < W; ++j) scanf("%d", &A[i][j]);
	
    for(int i = 0; i < H; ++i){
        if(i % 2 == 0) for(int j = 0; j < W; ++j) p.push_back(make_pair(i, j));
        else for(int j = W - 1; j >= 0; --j) p.push_back(make_pair(i, j));
    }
    
    int ans = 0;
    for(int i = 0; i < p.size() - 1; ++i){
        int y = p[i].first, x = p[i].second;
        if(A[y][x] % 2 == 1){
            int n = p[i + 1].first, m = p[i + 1].second;
            --A[y][x];
            ++A[n][m];
            ++ans;
            vector<int> temp;
            temp.push_back(y + 1), temp.push_back(x + 1), temp.push_back(n + 1), temp.push_back(m + 1);
            out.push_back(temp);
        }
    }
    
    printf("%d\n", ans);
    for(int i = 0; i < ans; ++i) printf("%d %d %d %d\n", out[i][0], out[i][1], out[i][2], out[i][3]);
	
    return 0;
}

Measured memory_bytes: 14060
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST

bool compare_by_pair(pair<long,long> a, pair<long,long> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }
    return false;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N;
    cin >> N;
    vector<long> A(N);
    for(size_t i=0;i<N; i++)
    {
        long a;
        cin >> A[i];
    }

    //番号の差の絶対値と身長の和なので順番は関係ない
    ll count = 0;
    vector<ll> L(N);
    vector<ll> R(N);
    for(size_t i=0;i<N; i++)
    {
        if (A[i]+i<N) L[A[i]+i]++;
        if (0<=i-A[i]&&i-A[i]<N) R[i-A[i]]++;
    }
    for(size_t i=0;i<N; i++)
    {
        count += L[i] * R[i];
    }
    cout << count << endl;
    /*
    sort(A.begin(), A.end(), compare_by_pair);
    for(const auto& a:A)
    {
        cout << a.first << ":" << a.second << endl;
    }
    auto endA = lower_bound(A.begin(), A.end(), make_pair(-INF, N));
    for(auto it = A.begin(); it != endA; ++it){
        cout << (*it).first << ":" <<(*it).second << endl;
    }
    */
    /*
    for(size_t i=0;i<N; i++)
    {
        for(size_t j=i+1;j<N; j++)
        {
            if(j - i == A[i] + A[j]) count++;
        }
    }
    */
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 7952
#include<bits/stdc++.h>
using namespace std;
int n,a[200005];
vector<pair<int,int>>p;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        p.push_back({a[i],i});
    }
    sort(p.begin(),p.end());
    for(int i=0;i<n;i++){
        if(i==p[n-1].second)cout<<p[n-2].first<<endl;
        else if(i==p[n-2].second)cout<<p[n-1].first<<endl;
        else cout<<p[n-1].first<<endl;
    }
}


Measured memory_bytes: 4080
fun main(args: Array<String>) {
    val n = readInputLine().toLong()
    
    val transNums = mutableListOf<Long>()
    
    for (i in 1..5) {
        transNums.add(readInputLine().toLong())
    }
    
    transNums.sort()
    
    // ボトルネックになる輸送機関の輸送人数で全輸送機関に乗らせる
    println((n / transNums[0] + if (n % transNums[0] != 0L) 1L else 0L) + 4L)
}
 
fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 33516
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,M;
int a[MAXN];
int64 ans,res;
struct node {
    int L,R;
    int64 a,d;
}tr[MAXN * 4];
void build(int u,int L,int R) {
    tr[u].L = L;tr[u].R = R;
    tr[u].a = tr[u].d = 0;
    if(L == R) return;
    int mid = (L + R) >> 1;
    build(u << 1,L,mid);
    build(u << 1 | 1,mid + 1,R);
}
void addlz(int u,int64 a,int64 d) {
    tr[u].a += a;tr[u].d += d;
}
void pushdown(int u) {
    int l = tr[u].L,m = (tr[u].L + tr[u].R) >> 1,r = tr[u].R;
    addlz(u << 1,tr[u].a,tr[u].d);
    addlz(u << 1 | 1,tr[u].a + (m + 1 - l) * tr[u].d,tr[u].d);
    tr[u].a = tr[u].d = 0;
}
void Add(int u,int ql,int qr,int64 a,int64 d) {
    if(ql > qr) return;
    if(ql == tr[u].L && qr == tr[u].R) {addlz(u,a,d);return;}
    int mid = (tr[u].L + tr[u].R) >> 1;
    pushdown(u);
    if(qr <= mid) Add(u << 1,ql,qr,a,d);
    else if(ql > mid) Add(u << 1 | 1,ql,qr,a,d);
    else {Add(u << 1,ql,mid,a,d),Add(u << 1 | 1,mid + 1,qr,a + (mid + 1 - ql) * d,d);}
}
void Getans(int u) {
    if(tr[u].L == tr[u].R) {res = max(tr[u].a,res);return;}
    pushdown(u);
    Getans(u << 1);Getans(u << 1 | 1);
}
void Solve() {
    read(N);read(M);
    build(1,1,M);
    for(int i = 1 ; i <= N ; ++i) {
	read(a[i]);
    }
    for(int i = 2 ; i <= N ; ++i) {
	if(a[i] > a[i - 1]) {
	    ans += a[i] - a[i - 1];
	    Add(1,a[i - 1] + 1,a[i],0,1);
	}
	else {
	    ans += M - a[i - 1] + a[i];
	    Add(1,a[i - 1] + 1,M,0,1);
	    Add(1,1,a[i],M - a[i - 1],1);
	}
    }
    Getans(1);
    out(ans - res);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


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

limit = 1000000007

def calc(k, n):
    a = 1

    for i in range(n):
        a *= k
        a = a % limit
    return a

X = calc(10, N) + calc(8, N) - 2 * calc(9, N)
X = X % limit

print(X)

Measured memory_bytes: 9188