akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	ll lb=0;
	ll ub=(ll)s.size()+1;
	while(ub-lb>1) {
		ll mid=(lb+ub)/2;
		vector<bool> foo((ll)s.size(),false);
		REP(i,(ll)s.size()) {
			if(i>=mid||(ll)s.size()-1-i>=mid||(i==mid-1&&(ll)s.size()-1-i==mid-1))  foo[i]=true;
		}
		ll buf=-1;
		bool d=true;
		REP(i,(ll)s.size()) {
			if(!foo[i]) {
				if(buf==-1) buf=(ll)(s[i]-'0');
				else if(((ll)(s[i]-'0')!=buf)) d=false;
			}
		}
		if(d) lb=mid;
		else ub=mid;
	}
	cout<<lb<<endl;
}


Measured memory_bytes: 512
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		char[] str = sc.next().toCharArray();
		
		int ans = 0;
		for(int i = 0; i < n - 1; i ++) {
			if (str[i] == str[i + 1])
				ans++;
		}
		ans += 2 * k;
		out.println(Math.min(ans, n - 1));

		out.close();
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}


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

max_count = 0
max_num = 1

for i in range(1, n + 1):
  count = 0
  if i % 2 == 0:
    count += 1
    num = int(i / 2)
    while num % 2 == 0:
      count += 1
      num /= 2
  if count > max_count:
    max_count = count
    max_num = i

print(max_num)
 

Measured memory_bytes: 2940
def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

N = int(input())

table = makelist(101, 101)
for num in range(1, N+1):
    for i in range(2, 100):
        table[num][i] = table[num-1][i]

    n = num
    div = 2
    while n > 1:
        if n % div == 0:
            table[num][div] += 1
            n //= div
        else:
            div += 1

primes = []
for i in range(2, 100):
    flag = True
    for e in primes:
        if i % e == 0:
            flag = False
            break
    if flag:
        primes.append(i)

l = len(primes)
memo = table[N]
ans = 0

for e1 in primes:
    for e2 in primes:
        for e3 in primes:
            if e1 != e2 and e2 != e3 and e1 != e3 and memo[e1] >= 4 and memo[e2] >= 4 and memo[e3] >= 2:
                ans += 1

ans //= 2
for e in primes:
    if memo[e] >= 74:
        ans += 1
for e1 in primes:
    for e2 in primes:
        if e1 != e2 and memo[e1] >= 24 and memo[e2] >= 2:
            ans += 1
for e1 in primes:
    for e2 in primes:
        if e1 != e2 and memo[e1] >= 14 and memo[e2] >= 4:
            ans += 1

print(ans)


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

int main(){
    int n;
    cin >> n;
    vector<double> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) a[i] = 1/a[i];
    double ans = 0;
    
    rep(i, n) ans += a[i];
    ans = 1/ans;

    printf("%.6lf", ans);


    return 0;
}

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

using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mp make_pair
#define ld long double
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
const int N = 1e6 + 100;
int T;
char str[N];

int main() {
    scanf("%s", str + 1);
    int n = strlen(str + 1);
    int tot = 0, cnt[2] = {0, 0};
    ll ans = 0;
    for (int i = 1; i <= n; i++)tot += ((str[i] - '0') == 0);
    for (int i = 1; i <= n; i++) {
        if (str[i] == '0')cnt[0]++;
        else {
            if (str[i + 1] == '1') {
                ans += tot + 1;
                cnt[1] += 2;
                i++;
            } else {
                cnt[1] += 1;
                ans += i % 2;
                ans += tot - cnt[0];
                if (i % 2)ans += cnt[0] / 2;
                else ans += (cnt[0] + 1) / 2;
            }
        }
    }
    for (int i = 1; i <= cnt[1] - 1; i++)ans += (i + 1) / 2;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3936
#include <iostream>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    map<ll, ll> m;
    for (int i = 0; i < N; i++) {
        ll A;
        cin >> A;
        m[A]++;        
    }

    int count = 0;
    for (auto p: m) {
        if (p.second&1) count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 6528
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

A, B, C, X, Y = i_l()

if X < Y:
    X * C + (Y - X) * B
    print(min((X * A + Y * B), (X * C * 2 + (Y - X) * B), C * max(X, Y) * 2))
else:
    print(min((X * A + Y * B), (Y * C * 2 + (X - Y) * A), C * max(X, Y) * 2))
    

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

using namespace std;

void doc() {
    freopen("OB.inp", "r", stdin);
    freopen("OB.out", "w", stdout);
}

const   int MaxN = 3*1e3 + 5;
int f[MaxN][MaxN];
string s, t;

void Trace(int n, int m){
    if (n <= 0 || m <= 0) return;
    if (f[n][m] == f[n - 1][m])
        Trace(n - 1, m);
    else
        if (f[n][m] == f[n][m - 1])
            Trace(n, m - 1);
        else {
            Trace(n - 1, m - 1);
            cout << s[n - 1];
        }
}

void solve(){

    cin >> s >> t;
    int n = s.length();
    int m = t.length();
    //int f[n + 1][m + 1];
    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++) {
            int x = i + 1;
            int y = j + 1;
            if (s[i] == t[j]) f[x][y] = f[x - 1][y - 1] + 1;
            f[x][y] = max(f[x][y], max(f[x - 1][y], f[x][y - 1]));
        }
//    for(int i = 1; i <= n; i++){
//        for(int j = 1; j <= m; j++)
//            cout << f[i][j] << " ";
//        cout << '\n';
//    }
//    cout << f[n][m];
    Trace(n, m);
}

int main()
{
//    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
   // doc();
    solve();
}



Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000007
#define sz(a) ((int)(a).size())
 
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcountll(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-6
typedef pair<int, int> II;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI 2 * acos(0)
#define maxn 1000005

string s;
int a[maxn];

void sol(){
  cin >> s;
  int n = (int)(sz(s)) + 1;
  ms(a, 0);
  Rep(i, n - 1){
    if(s[i] == '<') a[i + 1] = max(a[i + 1], a[i] + 1);
  }
  for(int i = n - 2; i >= 0; i--){
    if(s[i] == '>') a[i] = max(a[i], a[i + 1] + 1);
  }

  ll res = 0;
  Rep(i, n) res += a[i];
  cout << res << endl;

}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  sol();
  return 0;
}

Measured memory_bytes: 4764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <random>
#include <ctime>
#include <sstream>
#include <numeric>
#include <queue>
using namespace std;

int main(){
    int d ;
    cin >> d ;
    cout << "Christmas" ;
    for (size_t i = d; i < 25; i++)
    {
        cout << " Eve" ;
    }
    cout << endl ;
}

Measured memory_bytes: 256
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
A = LIST()

count = 0
for i in range(N):
    if A[i] >= sum(A) / (4 * M):
        count += 1
if count >= M:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 5192
#include <iostream>

using namespace std;



int n;
int sum = 0;

void solve()
{
    int ret = 0;
    for(int i = 105; i <= n; i+=2) {
        ret = 0;
        if(i % 2 == 0) continue;
        for(int j = 3; j < i / 2; j++){
            if(i % j == 0) ret++;
        }
        //cout << ret << endl;
        if(ret == 6) sum++;
    }

    cout << sum << endl;
}

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


    return EXIT_SUCCESS;
}

Measured memory_bytes: 256
S = input()
T = input()

ans = []
for i in range(len(S) - len(T) + 1):
    c = ""
    for j in range(len(T)):
        if S[i+j] != "?" and S[i+j] != T[j]:
            break
        c += T[j]
    if len(c) == len(T):
        ans.append((S[:i] + c + S[i+len(T):]).replace("?", "a"))
print(min(ans) if ans else "UNRESTORABLE")


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

const int N = 21 + 1;
const int M = 21 + 1;
const int MOD = 1e9 + 7;

bool can[N][M];

int main() { 
    ios_base::sync_with_stdio(false); 
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> can[i][j];
        }
    }
    vector<int> dp(1 << n);
    dp[0] = 1;
    for (int mask = 0; mask < (1 << n) - 1; mask++) {
        int a = __builtin_popcount(mask);
        for (int b = 0; b < n; b++) {
            if (can[a][b] and !(mask & (1 << b))) {
                int mask2 = mask ^ (1 << b);
                (dp[mask2] += dp[mask]) %= MOD;
            }
        }
    }
    cout << dp[(1 << n) - 1] << '\n';
}


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

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
LL n;
std::vector<LL> arr;
int main() {
	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt", "r", stdin);
 //    freopen("output.txt", "w", stdout);
	// #endif
	off;
	cin>>n;
	arr.resize(n);
	rep(i,0,n)
	{
		cin>>arr[i];
	}
	multiset<LL> last;
	last.insert(arr[0]);
	rep(i,1,n)
	{
		auto it = last.lower_bound(arr[i]);
		if(it == last.begin())
			last.insert(arr[i]);
		else
		{
			it--;
			last.erase(it);
			last.insert(arr[i]);
		}
	}
	cout<<last.size();
  	return 0;
}

Measured memory_bytes: 5760
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int hist[2][500000];

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

  int N, M, K;
  while(cin>>N>>M>>K,N){
	fill((int*)hist, (int*)hist+2*500000, 0);
	int crt=0, nxt=1;
	for(int i=1;i<=M;++i)
	  hist[crt][i] = 1;

	REP(i,N-1){
	  fill(hist[nxt], hist[nxt]+500000, 0);
	  REP(j,500000){
		if(hist[crt][j] == 0) continue;
		for(int k=1;k<=M;++k)
		  hist[nxt][j+k] += hist[crt][j];
	  }
	  swap(crt, nxt);
	}

	double ans = 0., tot = pow(M, N);
	FOR(i,N,500000){
	  if(hist[crt][i] == 0) break;
	  if(i <= K)
		ans += hist[crt][i];
	  else
		ans += hist[crt][i] * (i - K);
	}
	cout << fixed << setprecision(8) << ans / tot << endl;
  }
  
  return 0;
}

Measured memory_bytes: 5228
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] abc = scanner.nextLine().split(" ", 3);
        int a = Integer.parseInt(abc[0]);
        int b = Integer.parseInt(abc[1]);
        int c = Integer.parseInt(abc[2]);

        if (b - a == c - b) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 21332
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

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

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;


map<string, int> memo;

using P=pair<int, int>;




/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}

int a_1(int a) {
	return a / 2;
}
int a_2(int a) {
	return 3 * a + 1;
}
int main() {
	int s;
	cin >> s;
	vector<int> vec;
	vec.push_back(s);
	int a = s,ans=1;
	while (1) {
		
		if (a % 2 == 0) {
			a = a_1(a);
			vec.push_back(a);
		}
		else {
			a = a_2(a);
			vec.push_back(a);
		}
		ans++;
		for (int i = 0; i < vec.size()-1; i++) {
			if (vec[i] == a) {
				cout << ans;
				return 0;
			}
		}
	}
	return 0;
}












Measured memory_bytes: 256
#if 1

#include <bits/stdc++.h>
using namespace std;
vector <int> v[100050];
int m,n,ans[100050],p[100050],s[100050],d[100050];

void dfs(int u,int fa)
{
	int y;
	d[u] = 1;
	for (int i=0;i<v[u].size();i++)
    {
        y = v[u][i];
        if(y != fa)
        {
            dfs(y,u);
            p[y] = d[u];
            d[u] = (d[y]+1)* 1LL *d[u]%m;
        }
	}
	int k = 1;
	for (int i = v[u].size()-1;i >= 0;i--)
    {
        y = v[u][i];
        if (y != fa)
        {
            s[y] = k;
            k = ((d[y]+1)* 1LL * k) % m;
        }
	}
}

void get_ans(int u,int fa,int t)
{
	ans[u] = ((t+1) * 1LL * d[u]) % m;
	int y;
	for(int i = 0;i < v[u].size();i++)
    {
        y = v[u][i];
        if(y != fa)
        {
            get_ans(y,u,(((t+1) * 1ll * p[y]) % m * s[y]) % m);
        }
    }
}

int main()
{
	int x,y;
	scanf("%d %d", &n, &m);
	for(int i = 1;i < n;i++)
    {
        scanf("%d %d", &x, &y);
        v[y].push_back(x);
        v[x].push_back(y);
    }
	dfs(1,0);
	get_ans(1,0,0);
	for(int i = 1;i <= n;i++)
    {
        printf("%d\n",ans[i]);
    }
}

#endif // 1

Measured memory_bytes: 13824
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
long long int MOD = 1000000007;
int N;
typedef int Weight;
struct Edge {
	int src, dst;
	//Weight weight;
};
/*bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}*/
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

bool augment(const Graph& g, int u,
			 vector<int>& matchTo, vector<bool>& visited) {
	if (u < 0) return true;
	FOR(e, g[u]) if (!visited[e->dst]) {
										visited[e->dst] = true;
		if (augment(g, matchTo[e->dst], matchTo, visited)) {
			matchTo[e->src] = e->dst;
			matchTo[e->dst] = e->src;
			return true;
		}
	}
	return false;
}
int bipartiteMatching(const Graph& g, int L, Edges& matching) {
	const int n = g.size();
	vector<int> matchTo(n, -1);
	int match = 0;
	REP(u, L) {
			   vector<bool> visited(n);
		if (augment(g, u, matchTo, visited)) ++match;
	}
	REP(u, L) if (matchTo[u] >= 0){// make explicit matching
			Edge hen={u, matchTo[u]};
		matching.push_back(hen);
	}
	return match;
}

vector<pii> R,B;
Graph data;
int main(){
	cin>>N;
	Graph data(2*N);
	int x,y;
	for(int i=0;i<N;i++){
		cin>>x>>y;
		R.pb(mp(x,y));
	}
	for(int i=0;i<N;i++){
		cin>>x>>y;
		B.pb(mp(x,y));
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			int a=R[i].first,b=R[i].second,c=B[j].first,d=B[j].second;
			if(a<c&&b<d){
				Edge hen={i,j+N};
				data[i].pb(hen);
			}
		}
	}
	Edges matching;
	int ans=bipartiteMatching(data,N,matching);
	cout<<ans<<endl;
}


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	int N;
	map<llong,int, greater<llong>> m;

	cin >> N;
	llong in;
	for(int i = 0; i < N; i++){
		cin >> in;
		m[in]++;
	}

	vector<llong> v;
	for(auto it = m.begin(); it != m.end(); it++){
		if(it->second >= 2){
			for(int i = 0; i < it->second/2; i++)
				v.push_back(it->first);
		}
		if(v.size() >= 2){
			cout << v[0]*v[1] << endl;
			return 0;
		}
	}

	cout << 0 << endl;

	return 0;
}

Measured memory_bytes: 6528
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<cstring>
#define ll long long
using namespace std;
const int D=998244353,MAXN=300005;
ll n,a,b,k,x,y,ans;
ll ifac[MAXN],fac[MAXN];
ll power_(ll x,ll k)
{
	ll ret=1;
	while(k)
	{
		if(k&1) ret=(ret*x)%D;
		x=(x*x)%D;
		k>>=1;
	}
	return ret;
}
void first_()
{
	fac[0]=fac[1]=1;
	for(int i=2;i<=n;i++) fac[i]=(fac[i-1]*i)%D;
	ifac[n]=power_(fac[n],D-2);
	for(int i=n;i>=1;i--)
		ifac[i-1]=(ifac[i]*i)%D;
}
ll C(ll aa,ll bb)
{
	if(bb<aa) return 0;
	return (fac[bb]*ifac[aa]%D*ifac[bb-aa])%D;
}
int main()
{
	scanf("%lld%lld%lld%lld",&n,&a,&b,&k);
	if(!k) {printf("1\n");return 0;}
	first_();
	for(int i=0;;i++)
	{
		if(a*i>k) break;
		if((k-a*i)%b==0)
		{
			x=i;
			y=(k-a*i)/b;
			ans=(ans+C(x,n)*C(y,n)+D)%D;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ":" << x << "\n"
using ll = long long;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>;

int main () {
	int N; cin >> N;
	vector<vector<double>> dp(N + 1); // dp[i][j]=(i(1<=i<=N)番目までのコインを投げて表がj(0<=j<=i)回出る確率)
	dp[0].push_back(1.0); // d[0][0]
	double p, q;
	rep2(i, 1, N + 1) {
		cin >> p; q = 1.0 - p;
		dp[i].push_back(q * dp[i - 1][0]);
		rep2(j, 1, i + 1) dp[i].push_back(p * dp[i - 1][j - 1] + q * dp[i - 1][j]);		
	}
	double ans = 0.0;
	rep2(j, (N + 1) / 2, N + 1) ans += dp[N][j];
	cout << fixed << setprecision(12);
	cout << ans << endl;
}

Measured memory_bytes: 43776
#include<bits/stdc++.h>
using namespace std;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int main(){
	FIO
	string s;
	cin>>s;
	int cnt1=0,cnt2=0;
	for(int i=0;i<3;i++)
	{
		if(s[i]=='A')cnt1++;
		else cnt2++;
	}	
	if(cnt1==0||cnt2==0)cout<<"No";
	else cout<<"Yes";
	
}	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
ll int sum(ll int a, ll int b)
{
    return (b - a + 1) * (a + b) / 2;
}
void findAns()
{
    int k;
    cin >> k;

    string s;
    cin >> s;

    if (s.size() <= k) cout << s;
    else
    {
       
        cout << s.substr(0, k);
         cout << "...";
    }
}
int main()
{
// #ifndef ONLINE_JUDGE
//     freopen("in.txt", "r", stdin);
//     freopen("o1.txt", "w", stdout);
// #endif

    fastio;

    // ll int t;
    // cin >> t;,
    findAns();
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long
#define MAX 1000000
#define INF 1000000 
#define M 1000000007
#define PI 2 * acos(0.0)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main(){
    fast_io
    ll n,d;
    cin>>n>>d;
    ll sum = 0;
    while(n--){
        long double x,y;
        cin>>x>>y;
        long double s =  pow(x,2);
        long double f = pow(y,2);
        long double ans = sqrt(s+f);
        if(ans <= d){
            sum++;
        }
    } 
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3860
# -*- coding: utf-8 -*-
import numpy as np
from math import factorial
from itertools import permutations

def cmb_fnct(MOD):
    #MOD:素数
    fact_mod = [1,1]
    inv_mod = [0,1]
    inv_fact_mod = [1,1]
    i = len(fact_mod)
    i_ = len(inv_fact_mod)

    def cmb(n,r):
        nonlocal i, i_
        r = min(r, n-r)
        if r<0: 
            return 0
        if r==0:
            return 1
        if r==1: 
            return n%MOD

        while n >= i:
            fact_mod[i:i] = [(fact_mod[i-1]*i)%MOD]
            i += 1

        while n-r >= i_:
            inv_mod[i_:i_] = [(-inv_mod[MOD%i_]*(MOD//i_))%MOD]
            inv_fact_mod[i_:i_] = [(inv_fact_mod[i_-1]*inv_mod[i_])%MOD]
            i_ += 1

        return fact_mod[n] * inv_fact_mod[r] * inv_fact_mod[n-r] % MOD
    return cmb

def solve():
    X, Y = map(int, input().split())
    a = -(X-2*Y)/3
    b = -(-2*X+Y)/3
    if a == int(a) and b == int(b):
        a = int(a)
        b = int(b)
    else:
        return '0'
    cmb = cmb_fnct(10**9+7)

    return str(cmb(a+b,a))

if __name__ == '__main__':
    print(solve())


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

int main(){
    uint_fast32_t N;
    scanf("%u", &N);

    vector<uint_fast64_t> a(N), pt(N + 1);
    for(auto& i : a)scanf("%llu", &i);
    partial_sum(a.begin(), a.end(), pt.begin() + 1);

    vector<vector<uint_fast64_t>> ans(N, vector<uint_fast64_t>(N + 1));

    for(auto i = 2; i <= N; ++i)
        for(auto j = 0; i + j <= N; ++j){
            ans[j][j + i] = pt[j + i] - pt[j];
            auto tmp = numeric_limits<uint_fast64_t>::max();
            for(auto k = 1; k < i; ++k){
                tmp = min(tmp, ans[j][j + k] + ans[j + k][j + i]);
            }
            ans[j][j + i] += tmp;
        }

    cout << ans[0][N] << endl;

    return 0;
}

Measured memory_bytes: 1536
#include <queue>
#include <cstdio>

using std::queue;

int main() {
        int n, u, k, v;
        const int N = 100;
        bool graph[N][N] = {{false}};
        int cost[N];
        queue<int> q;
        for (int i = 0; i < N; i++) {
                cost[i] = -1;
        }

        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
                scanf("%d %d", &u, &k);
                for (int j = 0; j < k; j++) {
                        scanf("%d", &v);
                        graph[u-1][v-1] = true;
                }
        }
        q.push(0);
        cost[0]++;
        while (!q.empty()) {
                int cur = q.front();
                q.pop();
                for (int to = 0; to < n; to++) {
                        if (!graph[cur][to] || cost[to] > -1) {
                                continue;
                        }
                        q.push(to);
                        cost[to] = cost[cur] + 1;
                }
        }
        for (int i = 0; i < n; i++) {
                printf("%d %d\n", i+1, cost[i]);
        }

        return 0;
}

Measured memory_bytes: 2736
#include <stdio.h>
    #include <math.h>

    int getgcd(int n, int m){
    int r;
    if(n>m){
      int t= m;
      m=n;
      n=t;
    }
    while ((r = m % n) != 0) {
      m = n;
      n = r;
    }
    return n;
    }
    void main()
    {
      int N,t,i,j,k,m,n,sum=0,r;
      scanf("%d", &N);
      for(i=1;i<=N;i++){
        for(j=1;j<=N;j++){
          for(k=1;k<=N;k++){
            t=getgcd(i,j);
            sum+=getgcd(t,k);
          }
        }
      }
      printf("%d", sum);
    }

Measured memory_bytes: 1728
using System;

namespace diverta2019_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var aaa = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var R = aaa[0];
            var G = aaa[1];
            var B = aaa[2];
            var N = aaa[3];
            var count = 0;

            for(var i =0;i<=N/R;i++)
            {
                for(var j=0;j<=N/G;j++)
                {
                    var sum = N - (i * R + j * G);
                    if (sum % B == 0 && sum >= 0)
                        count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11220
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}

    mint operator-() const { return mint(-x); }

    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint& operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }

    mint operator+(const mint a) const { return mint(*this) += a; }

    mint operator-(const mint a) const { return mint(*this) -= a; }

    mint operator*(const mint a) const { return mint(*this) *= a; }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(MOD - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

struct combination {
    vector<mint> fact, ifact;

    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;

        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }

    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    // 順列の計算
    mint p(int n, int k) { return fact[n] * ifact[n - k]; }
};

int main() {
    INIT;

    ll N, K;
    cin >> N >> K;

    combination comb(200005);
    mint ans = 0;

    reps(i, K, N + 2) {
        // ans += comb(N + 1, i);
        // cout << ((N - i + 1) + N) * i / 2 << ", " << (i - 1) * i / 2 << endl;
        ans += ((N - i + 1) + N) * i / 2 - (i - 1) * i / 2 + 1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using u64 = uint_fast64_t; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
////////////////////////////////////////////////////////////////////////

template<typename TF,typename TC>
struct PrimalDual{
    struct edge{
        int to;
        TF cap;
        TC cost;
        int rev;
        edge(){}
        edge(int to,TF cap,TC cost,int rev):
        to(to),cap(cap),cost(cost),rev(rev){}
    };

    static const TC INF;
    vector<vector<edge>> G;
    vector<TC> h,dist;
    vector<int> prevv,preve;

    PrimalDual(){}
    PrimalDual(int n):G(n),h(n),dist(n),prevv(n),preve(n){}

    void add_edge(int u,int v,TF cap,TC cost) {
        G[u].emplace_back(v,cap,cost,G[v].size());
        G[v].emplace_back(u,0,-cost,G[u].size()-1);
    }

    void dijkstra(int s) {
        struct P {
            TC first;
            int second;
            P(TC first,int second):first(first),second(second){}
            bool operator<(const P&a) const{return a.first<first;}
        };
        priority_queue<P> que;
        fill(dist.begin(),dist.end(),INF);

        dist[s]=0;
        que.emplace(dist[s],s);
        while(!que.empty()){
            P p=que.top();que.pop();
            int v=p.second;
            if(dist[v]<p.first) continue;
            for(int i=0;i<(int)G[v].size();i++) {
                edge &e=G[v][i];
                if(e.cap==0) continue;
                if(dist[v]+e.cost+h[v]-h[e.to]<dist[e.to]){
                dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
                prevv[e.to]=v;
                preve[e.to]=i;
                que.emplace(dist[e.to],e.to);
                }
            }
        }
    }

    TC flow(int s,int t,TF f,int &ok){
        TC res=0;
        fill(h.begin(),h.end(),0);
        while(f>0){
            dijkstra(s);
            if(dist[t]==INF){
                ok=0;
                return res;
            }

            for(int v=0;v<(int)h.size();v++)
                if(dist[v]<INF) h[v]=h[v]+dist[v];

            TF d=f;
            for(int v=t;v!=s;v=prevv[v])
                d=min(d,G[prevv[v]][preve[v]].cap);

            f-=d;
            res=res+h[t]*d;
            for(int v=t;v!=s;v=prevv[v]){
                edge &e=G[prevv[v]][preve[v]];
                e.cap-=d;
                G[v][e.rev].cap+=d;
            }
        }
        ok=1;
        return res;
    }
};
template<typename TF, typename TC>
const TC PrimalDual<TF, TC>::INF = numeric_limits<TC>::max()/2;

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

void GRL_6_B() {
    int N,M,f; cin >> N >> M >> f;

    PrimalDual<int, int> G(N);
    rep(i,M) {
        int u,v,c,d;
        cin >> u >> v >> c >> d;
        G.add_edge(u,v,c,d);
    }
    int ok = 0;
    int res = G.flow(0,N-1,f,ok);
    cout << (ok ? res : -1) << ln;
}

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
    GRL_6_B();
}


Measured memory_bytes: 3240
//wawando's template

#include <iostream>
#include <string>
#include <fstream>
#include <functional>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <set>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>  //clock_t , clock() , CLOCKS_PER_SEC
#include <cstring>
#include <cctype>
#include <climits> // LLONG_MAX , LLONG_MIN , INT_MAX , INT_MIN

//MACROS
#define pb              push_back
#define mp              make_pair
#define INF             1000000000     //1 billion safer for floyd warshall, avoid overflow

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ios::sync_with_stdio(false);
  string S;
  cin >>S;
  int ans1 = 0;
  int ans2 = 0;
  int sz = S.length();
  for(int i = 0; i < sz; i++) {
    if(i % 2 == 0) {
      if(S[i] == '0') ans1++;
      if(S[i] == '1') ans2++;
    }
    else {
      if(S[i] == '1') ans1++;
      if(S[i] == '0') ans2++;
    }
  }
  printf("%d\n", min(ans1, ans2));
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

int n,a[100005],b[100005],t,ans,x[100005],y[100005];

map <int,vector<int>> m;
map <int,int> v;

void DFS(int nod){
    if(v[nod]) return;
    v[nod]=1;
    for(int i : m[nod]){
        DFS(i);
    }
}

int32_t main(){
    ios_base :: sync_with_stdio(0);
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> a[i];
        a[n+1]^=a[i];
        x[i]=a[i];
    }
    for(int i=1;i<=n;i++){
        cin >> b[i];
        b[n+1]^=b[i];
        y[i]=b[i];
    }
    x[n+1]=a[n+1]; y[n+1]=b[n+1];
    n++;
    sort(x+1,x+n+1);
    sort(y+1,y+n+1);
    for(int i=1;i<=n;i++){
        if(x[i]!=y[i]){
            cout << -1;
            return 0;
        }
    }

    ans=-2;

    for(int i=1;i<=n;i++){
        m[a[i]].push_back(b[i]);
        m[b[i]].push_back(a[i]);
        if(a[i]!=b[i] || i==n) ans++;
    }

    for(int i=1;i<=n;i++){
        if((a[i]!=b[i] || i==n) && !v[a[i]]) DFS(a[i]),ans++;
    }

    cout << ans;
}


Measured memory_bytes: 25216
# N,M = map(int, input().split())
A = [0] * 5
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())

minidx = 0
minv = A[0] % 10

for i in range(1,5):
    if A[i] % 10 == 0: continue
    if A[i] % 10 < minv:
        minv = A[i] % 10
        minidx = i

ans = 0
for i in range(5):
    if i == minidx:
        ans = ans + A[minidx]
    else:
        ans = ans + (( A[i] + 9) // 10) * 10
print(ans)


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var nx = IO.RSInt;
            var x = IO.RSInt;

            var sub = new int[nx[0]];
            for (int i = 0; i < nx[0]; i++)
            {
                sub[i] = Abs(nx[1] - x[i]);
            }

            //Array.Sort(sub);

            for (int i = 0; i < nx[0] - 1; i++)
            {
                sub[i + 1] = GCD(sub[i], sub[i + 1]);
            }

            WriteLine(sub.Last());
        }

        public static int GCD(int x, int y)
        {
            if (x < y) Swap(ref x, ref y);
            if (y == 0) return x;
            else return GCD(x % y, y);
        }

        public static void Swap(ref int x, ref int y)
        {
            int tmp = x;
            x = y;
            y = tmp;
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 22112
p = int(input())
for i in range(p):
    x1, y1, x2, y2, x3, y3 = map(float, input().split(" "))
    xa, ya, xb, yb = x2-x1, y2-y1, x3-x1, y3-y1
    a = complex(xa, ya)
    b = complex(xb, yb)
    z0 = abs(a) ** 2 * b - abs(b) **2 * a
    z0 /= a.conjugate() * b - a * b.conjugate()

    z = z0 + complex(x1, y1)
    zx = "{0:.3f}".format(z.real)
    zy = "{0:.3f}".format(z.imag)
    r = "{0:.3f}".format(abs(z0))
    print(zx, zy, r)

Measured memory_bytes: 7500
#include<stdio.h>
int main(void)
{
	int a,b,i,cnt;
	while(scanf("%d %d",&a,&b) != EOF){
		cnt=1;
		for(i=10;i<=10000000;i=i*10){
			if(a+b>=i){
				cnt+=1;
			}
			else{
				printf("%d\n",cnt);
				break;
			}
		}
	}
	return 0;
}



Measured memory_bytes: 2044
//PLUS ULTRA
//one who sits atop all the clans : Lion's Sin Escanor 

#include<bits/stdc++.h>
using namespace std;
     
     
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define nfor(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first
#define ll long long 

typedef pair <int , int> pii;

const int N = 1e5 + 10 , mod =  1000000007;

void solve(){


	string str; cin >> str;

	cout << 'A';

	if(str[1] == 'B')cout << 'R' ;
	else cout << 'B';

	cout << 'C';

	cout << "\n";
    
        


}

int main(){
    SPEED;

    solve();


    return 0;
}
      
       


Measured memory_bytes: 3652
while True:
    l=[]
  
    w=input()
    if w=="END OF INPUT":
        break
   
    list=w.split(' ')
    
    for i in range(len(list)):
        l.append(len(list[i]))
    l=[str(a) for a in l]
    l=''.join(l)
    print(*l,sep='')


Measured memory_bytes: 5564