akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        char[] s = Console.ReadLine().ToArray();
        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < s.Length - 1; i++)
        {
            var distToA = ('z' - s[i] + 1) % 26;
            if (distToA <= n)
            {
                s[i] = 'a';
                n -= distToA;
            }
        }
        s[s.Length - 1] = (char)('a' + ((s[s.Length - 1] - 'a') + n) % 26);
        Console.WriteLine(string.Join("", s));
    }
}


Measured memory_bytes: 15452
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n >> s;
  int k=s.size();
  for(int i=0;i<k;i++){
    int num=s[i]-'A';
    num=(num+n)%26;
    putchar(num+'A') ;
  }
  cout << endl;
}

Measured memory_bytes: 3640
N, A, B, C, D = map(int,input().split())
# k回正の方向に, N-k-1回負の方向に移動する
for k in range(N):
    if C*k-(N-k-1)*D <= B-A <= D*k-(N-k-1)*C:
        print("YES")
        exit(0)
print("NO")


Measured memory_bytes: 2940
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        x: i8,
    }
    let ans = match x {
        7 | 5 | 3 => "YES",
        _ => "NO",
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
string s, s1;
int k;
int ans[4];
int main()
{
	while (cin >> s >> k)
	{
		s1 = s + s + s;
		for (int i = 1; i < s1.size(); i++)
		{
			if (s1[i] == s1[i - 1])
			{
				s1[i] = '.';
				ans[(i / s.size())]++;
			}
		}
		k--;
		long long res = ans[0];
		res += 1ll * (k + 1) / 2 * ans[1];
		res += 1ll * k / 2 * ans[2];
		cout << res << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	for (int i = 0; i < S.length(); i++) {
		cout << S[i];
		if (i == 3) {
			cout << " ";
		}
	}
	cout << endl;

}






Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

    private static final int MOD = 1_000_000_007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[] S = sc.next().toCharArray();

        char prev = S[0];
        for (int i = 1; i < S.length; i++) {
            if (prev == S[i]) {
                System.out.println("Bad");
                return;
            }

            prev = S[i];
        }

        System.out.println("Good");
    }

}


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

typedef pair<int, int> P;


int main() {
    int N;  cin >> N;
    vector<vector<long long>> dp(N + 1, vector<long long>(N + 1));
    vector<P> A(N);
    for (int i = 0; i < N; ++i) {
        int a;  cin >> a;
        A[i] = P(a, i);
    }
    sort(A.begin(), A.end(), greater<P>());

    long long ans = 0;
    for (int l = 0; l < N; ++l) {
        for (int r = 0; r < N; ++r) {
            if (l + r == N) {
                ans = max(ans, dp[l][r]);
                break;
            }
            long long activeness = A[l + r].first, idx = A[l + r].second;
            dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + activeness * abs(idx - l));
            dp[l][r + 1] = max(dp[l][r + 1], dp[l][r] + activeness * abs(idx - N + r + 1));
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 34960
import sys

input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    k = [None] * M
    s = [None] * M
    for i in range(M):
        line = tuple(map(int, input().split()))
        k[i], s[i] = line[0], line[1:]
    p = tuple(map(int, input().split()))

    ans = 0
    for bit in range(2 ** N):
        light_all = True
        # on/off on switches
        sw = [None] * N
        for i in range(N):
            if bit & (1 << i):
                sw[i] = True
            else:
                sw[i] = False
        for i in range(M):
            n_on = 0
            for j in s[i]:
                n_on += sw[j - 1]
            if n_on % 2 == p[i]:
                pass
            else:
                light_all = False
        ans += light_all

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import numpy as np

N = int(input())

A = np.array(list(map(int, input().split())))

y = sum(A * ([1, -1]*(len(A)//2)+[1]))//2

answer = [y]
AA = y
for i in range(N-1):
    AA = -AA + A[i]
    answer.append(AA)
answer = np.array(answer)*2

for i in answer:
    print(i, end=" ")

Measured memory_bytes: 23112
H, W, k = map(int, input().split())
MOD = 10 ** 9 + 7

if W == 1:
	print(1)

else:
	l = [1, 2, 3, 5, 8, 13, 21, 34, 1, 1, 1]

	dp = [[0 for _ in range(W)] for _ in range(H+1)]
	dp[0][0] = 1
	for h in range(0, H):
		for w in range(W):
			if w != 0 and w != W-1:
				dp[h+1][w] = l[w-1] * l[W-2-w] * dp[h][w] + l[w-2] * l[W-2-w] * dp[h][w-1] + l[w-1] * l[W-3-w] * dp[h][w+1]
			elif w == 0:
				dp[h+1][w] = l[w-1] * l[W-2-w] * dp[h][w] + l[w-1] * l[W-3-w] * dp[h][w+1]
			else:
				dp[h+1][w] = l[w-1] * l[W-2-w] * dp[h][w] + l[w-2] * l[W-2-w] * dp[h][w-1]

			dp[h+1][w] %= MOD

	#print(dp)
	print(dp[H][k-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N);
  for (int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    vec.at(a - 1)++;
    vec.at(b - 1)++;
  }
  for (int i = 0; i < N; i++){
    cout << vec.at(i) << endl;
  } 
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define mp make_pair
#define pii pair<int,int>
using namespace std;

void solve()
{
    int a,b;
    cin>>a>>b;
    cout<<a*b;
}


main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //int t;
    //cin>>t;
    //while(t--)
        solve();
}


Measured memory_bytes: 3648
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define deb(x) cout << #x << " is " << x << "\n";

using namespace std;
using namespace __gnu_pbds;

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	string s;
	cin >>n; 
	unordered_map<string, int> mp;
	while(n--) {
		cin >>s;
		mp[s]++;
	}
	int mx = INT_MIN;
	for(auto ele : mp) {
		mx = max(mx, ele.second);
	}
	vector<string> arr;
	for(auto ele : mp) {
		if(ele.second == mx) {
			arr.push_back(ele.first);
		}
	}
	sort(arr.begin(), arr.end());
	for(auto ele : arr) {
		cout <<ele <<"\n";
	}
	return 0;
}


Measured memory_bytes: 25284
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
int main()
{
    int N;
    cin >> N;
    vll H(N);
    cin >> H;
    vint cnt(N,0);
    REP(i,N-1){
        if(H[i] >= H[i+1]){
            cnt[i+1] = cnt[i]+1;
        }
    }
    sort(cnt.begin(),cnt.end());
    cout << cnt[N-1] << endl;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)

using P   = pair<int, int>;
using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int t;cin >> t;
    while(t-- > 0){
        int n, d;cin >> n >> d;
        priority_queue<int, vector<int>, greater<int>> pq;
        pq.push(d);
        for(int i=0;i<n-1;i++){
            int x = pq.top();
            pq.pop();
            pq.push(127);
            pq.push(127^x);
        }
        int ans = 0;
        while(!pq.empty()){
            ans += pq.top();
            pq.pop();
        }
        cout << ans << endl;
    }
    return 0;
}


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

int main() {
  
  int a, b, c, d;
  cin >> a >> b >> c >> d;
 
  int ans = max(a*b,c*d);
  
  cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

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

#define S second
#define F first
#define int long long  

//////////

signed main()
{
	fastio;
	// #ifndef ONLINE_JUDGE
	// 	freopen("inputf.in","r",stdin);
	// 	freopen("outputf.in","w",stdout);
	// #endif
	int n,m,c;
	cin>>n>>m>>c;
	int b[m];
	int ans=0;
	for(int i=0;i<m;++i)
	{
		cin>>b[i];
	}
	for(int i=0;i<n;++i)
	{
		int v=0;
		for(int j=0;j<m;++j)
		{
			int d;
			cin>>d;
			v+=d*b[j];
		}
		v+=c;
		if(v>0)
			++ans;
	}
	cout<<ans;
}

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

for i in range(N+1):
    count = 0
    t = i
    while(t):
        count += t%6
        t//=6
    t = N-i
    while(t):
        count += t%9
        t//=9
    score = min(count,score)

print(score)

Measured memory_bytes: 41068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define f(x,y) g[(x)+2503][(y)+2503]
#define MOD 1000000007

ll read(){
	ll s=0,w=1; char ch=getchar();
	while (ch<'0'||ch>'9') {if (ch=='-') w=-1; ch=getchar();}
	while (ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^'0'), ch=getchar();
	return s*w;
}

void write(ll s){
	if (s<0) s=-s,putchar('-');
	if (s>9) write(s/10);
	putchar(s%10+'0');
}

void writeln(ll s){
	write(s); puts("");
}

void writeln(){
	puts("");
}

int ADD(int x,int y){
	return ((0LL+x+y)%MOD+MOD)%MOD;
}

int SUB(int x,int y){
	return ((0LL+x-y)%MOD+MOD)%MOD;
}

int qpow(int x,int y){
	int ret = 1;
	while (y){
		if (y&1) ret = 1LL*ret*x%MOD;
		x = 1LL*x*x%MOD; y >>= 1;
	}
	return ret;
}

int inv(int x){
	return qpow(x,MOD-2);
}

int g[5008][5008];

int X[400007],Y[400007];

int fac[400007],ifac[400007];

int C(int x,int y){
	if (y>x) return 0;
	return 1LL*fac[x]*ifac[y]%MOD*ifac[x-y]%MOD;
}

int n;

signed main(){
	memset(g,0,sizeof(g));
	fac[0] = 1; for (int i=1;i<=400002;i++) fac[i] = 1LL*fac[i-1]*i%MOD;
	ifac[400002] = inv(fac[400002]); for (int i=400001;i>=0;i--) ifac[i] = 1LL*ifac[i+1]*(i+1)%MOD;
	n = read();
	for (int i=1;i<=n;i++) X[i] = read(), Y[i] = read(), f(-X[i],-Y[i])++;
	for (int i=1;i<=5005;i++)
		for (int j=1;j<=5005;j++)
			g[i][j] = ADD(g[i][j],ADD(g[i][j-1],g[i-1][j]));
	int ans = 0;
	for (int i=1;i<=n;i++) ans = ADD(ans,f(X[i],Y[i]));
	for (int i=1;i<=n;i++) ans = SUB(ans,C(2*ADD(X[i],Y[i]),2*X[i]));
	writeln(1LL*ans*inv(2)%MOD);		
	return 0;
}



Measured memory_bytes: 208916
#include <iostream>
using namespace std;
#define MAX_N 200000
#define rep(i, n) for (int i = 0; i < (n); i++)

int main(void) {
  int N;
  cin >> N;

  int A[MAX_N];
  rep(i, N) { cin >> A[i]; }

  int B[MAX_N * 2+2];
  int lp = MAX_N;
  int rp = MAX_N;
  rep(i, N) {
    if(i % 2) {
      B[lp--] = A[i];
    } else {
      B[++rp] = A[i];
    }
  }

  if(N % 2) {
    for (int i = rp; i != lp; i--) {
      cout << B[i] << " ";
    }
  } else {
    for (int i = (lp+1); i != (rp+1); i++) {
      cout << B[i] << " ";
    }
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<61;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;

string f(string s,string t){
	int S=s.size(),T=t.size();
	string res;
	int I=n/S;
	while((n-I*S)%T!=0) I--;
	for(int i=0;i<I;i++) res+=s;
	for(int i=0;i<(n-I*S)/T;i++) res+=t;
	return res;
}

string s,t;

int main(){
	cin>>n>>s>>t;
	cout<<min(f(s,t),f(t,s))<<endl;
}

Measured memory_bytes: 1408
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li      int32_t
#define lli     long long
#define ulli unsigned long long

#define pn           printf("\n")
#define nl           cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))

#define pb      push_back
#define pob     pop_back
#define itr     iterator
#define sz()    size()
#define szof    sizeof
#define lb      lower_bound
#define ub      upper_bound
#define mp      make_pair
#define vlli    vector<lli>
#define plli    pair<lli,lli>
#define vplli   vector<plli >
#define F       first
#define Sec       second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()

#define MX1     100000
#define MX2     1000000
#define mod     1000000007
#define Inf     1000000000000000
using namespace std;

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

int main()
{
    opt;
    
    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // */

    lli Q,H,S,D;
    cin>>Q>>H>>S>>D;
    
    lli N;
    cin>>N;
    
    lli a=4*Q,b=2*H,c=S,d=D;
    
    lli Min2=N*a;
    
    Min2=min(N*b,Min2);
    
    Min2=min(N*S,Min2);
    
    lli a1=4*Q,b1=2*H,c1=S;
    
    Min2=min(Min2,(N%2)*a1+(N/2)*d);
    Min2=min(Min2,(N%2)*b1+(N/2)*d);
    Min2=min(Min2,(N%2)*c1+(N/2)*d);
    
    cout<<Min2;
    

    
    
    

 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<bits/stdc++.h>
using namespace std;

int main()
{
	
	string w;
	cin>>w;
	
	int count;
	 size_t i,j;
	for(i=0;i<w.size();i++)
	{
		  count=0;
	     for(j=0;j<w.size();j++)
	     {
	     	 
	     	   if(w[i]==w[j])
	     	   {
	     	   	
	     	       count++;	
	     	   	
			   }
	     	
	     		
		 }
		 
		 
		 if(count%2!=0)
		 {
		 	
		 	break;
		 	
		 }
		
		
	
	}
	
	
	
	
	if(i==w.size())
	{
		
		cout<<"Yes"<<endl;
		
	}
	
	
	else
	{
		
		
		cout<<"No"<<endl;
	}
	

	return 0;
	
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b;
	scanf("%d",&n);
	if(n==1)
	{
		printf("Hello World\n");
		return 0;
	}
	scanf("%d%d",&a,&b);
	printf("%d\n",a+b);
	return 0;
}

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

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define int long long
#define endl '\n'

using namespace std;

const int N = 2e5 + 77;
int A[N];
// string s;

void sol(){
    int a , b , x ; cin >> a >> b >> x;
    int ans = b/x - a/x + (a%x==0);
    cout << ans << endl;
}  

int32_t main(){
    fast;
    int t = 1; 
    // cin >> t; 
    while(t--) sol();    
    return 0;
}

Measured memory_bytes: 3664
S = list(input())
T = list(input())
dic = {}

for s,t in zip(S,T):
    if s in dic:
        if dic[s] != t:
            print("No")
            exit(0)   
    else:
        dic[s] = t

if len(set(dic.values())) != len(dic):
    print("No")
else:
    print("Yes")

Measured memory_bytes: 6704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
long double EPS=1E-8;
////////////////////////////////////////

#define N (ll)1E5+5
int main(){
    ll n,k;cin>>n>>k;
    ll d[N];memset(d,0,sizeof(d));
    rep(i,0,n-1){
        ll a,b;cin>>a>>b;
        d[a]+=b;
    }
    ll count=0;
    rep(i,0,N-1){
        count+=d[i];
        if(count>=k){
            cout<<i<<endl;
            return 0;
        }
    }
    
    return 0;
}


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

/*
二つのなす角をthetaとすると、余弦定理より
ans = sqrt(a^2 + b^2 - 2 * a * b * cos(theta))

0からの角度は、
時針がH * 30 + M * 0.5
分針がM * 6
*/

int	main(void)
{
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	double hour = (double)h * 30 + (double)m * 0.5;
	double minite = m * 6;
	double theta = hour - minite;
	while (theta < 0) theta += 360;
	while (theta > 360) theta -= 360;
	theta = min(theta, 360 - theta);
	cout << setprecision(15) << sqrt((double)a * a + (double)b * b - 2 * (double)a * b * cos(M_PI * theta / 180)) << endl;
	return (0);
}


Measured memory_bytes: 4140
import sys
import math
import string
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
from bisect import bisect, bisect_left, bisect_right

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

s = input()
N = len(s)
p = 0
g = 0
ans = 0
for i in range(N):
    if s[i] == "g":
        if p + 1 <= g:
            ans += 1
            p += 1
        else:
            g += 1
    else:
        if p + 1 <= g:
            p += 1
        else:
            ans -= 1
            g += 1
print(ans)


Measured memory_bytes: 65772
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int a[200001];
int main(){
	cin>>N;
	int now=1;
	int ans=0;
	REP(i,N){
		cin>>a[i];
		if(now==a[i]){
			now++;
		}else{
			ans++;
		}
	}
	if(ans==N){
		cout<<-1<<endl;
	}else{
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1024
#include <stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int a[n];
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	int c=0,max=0;
	for(int i=1;i<n;i++)
	{
		if(a[i]<=a[i-1])
		{
			c++;
			//printf("%d\n",c);
			if(c>max)
			{
				max=c;
			}
		}
		else if(a[i]>a[i-1])
		{
			c=0;
		}
	}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int h, n;
  cin >> h >> n;
  vi a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];
  vi dp(h + 1, 1e9);
  dp[0] = 0;
  rep(i, n) rep(j, h + 1) {
    int nj = min(h, j + a[i]);
    dp[nj] = min(dp[nj], dp[j] + b[i]);
  }
  cout << dp[h] << endl;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}


fn main() {
  let s: String = read();
  let t: String = read();

  let scs: Vec<char> = s.chars().collect();
  let tcs: Vec<char> = t.chars().collect();

  let mut cnt = 0;

  if scs[0] == tcs[0] { cnt += 1; };
  if scs[1] == tcs[1] { cnt += 1; };
  if scs[2] == tcs[2] { cnt += 1; };

  println!("{}", cnt);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<pair<int, int>> sushi;
  for (int i = 0; i < n; i++) {
    int t, d;
    cin >> t >> d;
    t--;
    sushi.push_back({d, t});
  }
  sort(sushi.begin(), sushi.end());
  reverse(sushi.begin(), sushi.end());
  vector<bool> usd(n, false);
  long long ans = 0;
  long long score = 0;
  int cnt = 0;
  priority_queue<int> unused_repr;
  priority_queue<int, vector<int>, greater<int>> used_subj;
  for (int i = 0; i < n; i++) {
    auto sus = sushi[i];
    int d = sus.first;
    int t = sus.second;
    if (usd[t]) {
      if (i < k) {
        score += d;
        used_subj.push(d);
      }
    } else {
      usd[t] = true;
      if (i < k) {
        score += d + 2 * cnt + 1;
        cnt++;
      } else {
        unused_repr.push(d);
      }
    }
  }
  ans = score;
  while (!unused_repr.empty() && !used_subj.empty()) {
    int repr = unused_repr.top();
    unused_repr.pop();
    int subj = used_subj.top();
    used_subj.pop();
    score += (long long)repr - subj + 2 * cnt + 1;
    cnt++;
    ans = max(ans, score);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 1524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (500000)
#define pii pair<int, int>
#define vc vector
#define a first
#define b second
#define pb pusu_back

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

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

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

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> &V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

template<typename T>
T euclid(T a, T b){
  if(b == 0) return a;
  else return euclid(b, a % b);
}

vector<ll> fact(MAX, 0), fact_inv(MAX, 0);

ll pow_mod(ll a, ll b){
	ll res = 1;
	while(b > 0){
		if(b & 1) res = res * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return res;
}

void prepare_comb_mod(ll n){
	fact[0] = 1LL;
	for(ll i = 0; i < n; i++) fact[i+1] = fact[i] * (i + 1) % MOD;
	fact_inv[n] = pow_mod(fact[n], MOD - 2);
	for(ll i = n - 1; i >= 0; i--) fact_inv[i] = fact_inv[i + 1] * (i + 1) % MOD;
}

ll comb_mod(ll n, ll r){
	return (fact[n] * fact_inv[r]) % MOD * fact_inv[n - r] % MOD;
}

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

void Main() {
  int H, W; cin >> H >> W;
  vc<string> s(H);
  rep(i, 0, H) cin >> s[i];
  queue<pair<int, XY>> que;
  que.push(make_pair(1, XY(0, 0)));
  int res = 0;
  rep(i, 0, H){
    rep(j, 0, W){
      if(s[i][j] == '.') res++;
    }
  }
  while(true){
    pair<int, XY> tmp = que.front();
    que.pop();
    int n = tmp.a;
    int h = tmp.b.x;
    int w = tmp.b.y;
    if(s[h][w] == '#') continue;
    else s[h][w] = '#';
    if(h == H - 1 && w == W - 1){
      res -= n;
      break;
    }
    if(h > 0 && s[h - 1][w] == '.') que.push(make_pair(n + 1, XY(h - 1, w)));
    if(h < H - 1&& s[h + 1][w] == '.') que.push(make_pair(n + 1, XY(h + 1, w)));
    if(w > 0 && s[h][w - 1] == '.') que.push(make_pair(n + 1, XY(h, w - 1)));
    if(w < W - 1 && s[h][w + 1] == '.') que.push(make_pair(n + 1, XY(h, w + 1)));
    if(que.empty()){
      res = -1;
      break;
    }
  }
  cout << res << endl;
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}


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

using namespace std;

const int N = 2e5 + 10;

int n;
int a[N];

int main() {
    cin >> n;
    int sumxor = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        sumxor ^= a[i];
    }
    for (int i = 1; i <= n; i++)
        cout << (sumxor ^ a[i]) << " ";
}


Measured memory_bytes: 4348
# from math import factorial,sqrt,ceil
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
from datetime import date
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
y,m,d = map(int,input().split("/"))
S = date(y,m,d)
F = date(2019,4,30)

ans = "TBD"
if S<=F:
    ans = "Heisei"

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 3312
s=require('fs').readFileSync('/dev/stdin','utf8').split('\n');
[n, h, w]=s[0].split(' ')
r=0
for(i=1;i<=n;i++){
	[a, b]=s[i].split(' ').map(n=>n|0)
	if (a >= h && b >= w) {
		r++
	}
}
console.log(r)


Measured memory_bytes: 7740
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;


ll N,L;
ll a[100010];
bool used[100010];


bool judge(){
    REP(i,N-1)if(used[i])return true;
    return false;
}

int knot_index(){
    REP(i,N-1)if(used[i])return i;
    return -1;
}


int main(){
    
    cin>>N>>L;
    REP(i,N)cin>>a[i];
    REP(i,N)used[i]=false;
    
    REP(i,N-1){
        if(a[i]+a[i+1]>=L){
            used[i]=true;
            break;
        }
    }
    
    if(!judge()){
        cout<<"Impossible"<<endl;
        return 0;
    }
    
    cout<<"Possible"<<endl;
    
    int index=knot_index();
    
    for(int i=0;i<index;i++){
        cout<<i+1<<endl;
    }
    
    for(int i=(int)N-2;i>index;i--){
        cout<<i+1<<endl;
    }
    
    cout<<index+1<<endl;
    
    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[200005];
int main(){
	ll n,k;
	cin>>n>>k;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
	}
	ll sum=0;
	sort(a+1,a+1+n);
	for(ll i=1;i<=n-k;i++){
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 2e6+6;
void solve(){
	string s,t; 
	cin>>s>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end());
	reverse(t.begin(),t.end());
	if(s<t){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

//#define int long long
int md = 100000;
#define addm(X, Y) ((X) = ((X) + (Y) % md) % md)

int n;
int a[105],cnt[10];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i, n) {
        cin >> a[i];
        if (a[i] >= 3200) cnt[8]++;
        else cnt[a[i] / 400]++;
    }
    int ans = 0;
    rep(i, 8) if (cnt[i]) ans++;
    cout << max(1, ans) << " " << ans + cnt[8] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef int ut;
typedef complex<int> cli;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr> PQ;
string target="CODEFESTIVAL2016";
int main(){
	int n,m;
	string s;
	cin >> s;
	int ans=0;
	REP(i,16){
		ans+=target[i]!=s[i];
	}
	cout << ans << endl;
	return 0;
}

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


string N;
ll dp[110][110][2];
int K;

ll solve(int i, int k, int b) {

    if (i >= N.size()) {
        return (k == K);
    }

    ll& ret = dp[i][k][b];
    if (~ret) return ret;

    ll d = N[i] - '0';
    ret = 0;

    // 自由度がある
    if (b) {
        // すべての数字を使える
        ret += solve(i+1, k, b) + solve(i+1, k+1, b) * 9LL;
    }
    else {
        // 自由度がない
        if (d == 0) {
            return ret += solve(i+1, k, b);
        }
        else {
            return ret += solve(i+1, k, !b) + solve(i+1, k+1, !b) * (d - 1) + solve(i+1, k+1, b);
        }
    }

    return ret;
}

int main() {
    cin >> N >> K;
    rep(i, 110) rep(j, 110) rep(k, 2) dp[i][j][k] = -1;
    cout << solve(0, 0, false) << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    set<int> A;
    int N;
    cin >> N;
    REP(i,N) {
        int a;
        cin >> a;
        A.insert(a);
    }

    if (A.size() != N) {
        cout << "NO" << endl;
        return 0;
    }

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


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
     ll n,i;
     cin>>n;

     ll arr[n];
     for(i=0;i<n;i++)
     {
         cin>>arr[i];
     }

     unordered_map<ll,ll>mp;
     for(i=0;i<n;i++)
     {
         mp[arr[i]]++;
     }
     ll ans=0;
     for(auto it:mp)
     {
         ll x = it.fi;
         ll y = it.se;

         if(y<x)
         {
             ans+=y;
         }
         else
         {
             ans+=(y-x);
         }
     }

     cout<<ans<<endl;
}


Measured memory_bytes: 5028
import sys
fin = sys.stdin.readline
from collections import defaultdict


N, M = [int(elem) for elem in fin().split()]
pref_years = [[int(elem) for elem in fin().split()] for _ in range(M)]
formatter = lambda x: "{:06}".format(x)

# sort by year in ascending order
sorted_pref_years = sorted(pref_years, key=lambda x: x[1])
number_cities_per_city = defaultdict(int)
identity_numbers = {}
for pref, year in sorted_pref_years:
    number_cities_per_city[pref] += 1
    identity_numbers[year] = formatter(pref) \
                           + formatter(number_cities_per_city[pref])

for _, year in pref_years:
    print(identity_numbers[year])


Measured memory_bytes: 43184
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

char s[101010];
int main(){
    scanf("%s",s);
    int n = strlen(s);
    int ans = n;
    for(int i=1;i<n;i++){
        if (s[i] != s[i-1]){
            int t = max(i, n-i);
            ans = min(ans, t);
        }
    }
    printf("%d\n", ans);
}


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


int GCD(int a,int b)
{
	if (b==0) return a;
	else return GCD(b,a%b);
}


int main()
{
	int n,v,mh;

	cin >> n;
	vector<int>vc;

	for (int i=0;i<n;i++){
        cin>>v;
		vc.push_back(v);
	}

	mh=vc[0];

	for (int i=1;i<n;i++){
		mh = GCD(mh, vc[i]);
	}
	cout<<mh<<endl;

	return 0;

}


Measured memory_bytes: 892
H, W = gets.split.map(&:to_i)
A = readlines.map{|l| l.chomp.split(//)}
 
hs = (0 ... H).select{|h| A[h].uniq == ['.']}
ws = (0 ... W).select{|w| A.transpose[w].uniq == ['.']}
A.values_at(*[*0 ... H] - hs).transpose.values_at(*[*0 ... W] - ws).transpose.each{|l| puts l.join('')}

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

vector<string> ans = {"","SAT","FRI","THU","WED","TUE","MON","SUN"};

int main(){
	string s;
	cin>>s;
	for(int i=1;i<=7;i++)
		if(ans[i]==s)
			cout<<i<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;++i)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;
const int lim = 55555;
int main(){
    bool mp[lim]={};
    mp[0]=true,mp[1]=true;
    vector<int>lis;
    for(int i=2;i<pow(lim,0.5);i++){
        if(!mp[i]){
            for(int j=2;i*j<lim;j++){
                mp[i*j]=true;
            }
        }
    }
    fol(i,lim){
        if(!mp[i]&&i%5==1)lis.pb(i);
    }
    int n;cin>>n;
    fol(i,n-1)cout << lis[i]<<" ";
    cout << lis[n-1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n == 25)
        cout<<"Christmas"<<endl;
    if(n == 24)
        cout<<"Christmas Eve"<<endl;
    if(n == 23)
        cout<<"Christmas Eve Eve"<<endl;

    if(n == 22)
        cout<<"Christmas Eve Eve Eve"<<endl;

    return 0;
}


Measured memory_bytes: 256
s = list(input())
len = len(s)
a =["0"]*len
b =["0"]*len

for i in range(len):
    if i % 2 == 0:
        a[i] = "1"

for i in range(len):
    if i % 2 == 1:
        b[i] = "1"


len_a = 0
len_b = 0

for i in range(len):
    if s[i] != a[i]:
        len_a += 1

for i in range(len):
    if s[i] != b[i]:
        len_b += 1

ans = min(len_a,len_b)
print(ans)

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

const int INF = 1e9 + 10;

int N, K;

int main() {
    cin >> N >> K;
    vector<int> p(N);
    rep(i,N) cin >> p[i];
    sort(p.begin(), p.end());
    int res = 0;
    rep(i,K) res += p[i];
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void solve() {
    int n;
    cin >> n;
    map<pair<int, int>, int> cnt;
    for (int i = 1; i <= n; ++i) {
        long double ai;
        cin >> ai;
        ll val = (ll) (ai * 1000000000.0 + 0.5);
        ll cnt2 = 0;
        ll cnt5 = 0;
        while (val % 2 == 0) {
            cnt2++;
            val /= 2;
        }
        while (val % 5 == 0) {
            cnt5++;
            val /= 5;
        }
        cnt[make_pair(cnt2, cnt5)]++;
    }

    ll ans = 0;
    for (const auto &pi: cnt) {
        for (const auto &pj: cnt) {
            if (pi.first.first + pj.first.first >= 18 &&
                pi.first.second + pj.first.second >= 18) {
                if (pi == pj) {
                    ans += pi.second * (pi.second - 1ll);
                } else {
                    ans += pi.second * 1ll * pj.second;
                }
            }
        }
    }
    cout << ans / 2 << endl;
}
int main(){
	solve();
}



Measured memory_bytes: 3684
#097
# 1 <= a,b,c <= 100
# 1 <= d <= 100

a, b, c, d = map(int, input().split())

AB = abs(a - b)
BC = abs(b - c)
AC = abs(a - c)

if AC <= d:
    print("Yes")
elif AB <= d and BC <= d:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 9168
n,a,b=map(int,input().split())

c=10**9+7

ans=pow(2,n,c)-1

nca=1
ncb=1

for i in range(a):
    nca*=(n-i)*pow(i+1,c-2,c)
    nca%=c

for i in range(b):
    ncb*=(n-i)*pow(i+1,c-2,c)
    ncb%=c

ans-=(nca+ncb)

while ans<0:
    ans+=c

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b,t=0;cin>>n>>a>>b;
	if(a+b-1>n||1LL*a*b<n)cout<<-1;
	else{
		for(int i=a-1;i>=0;i--){
			int sz=min(n-i,b);
			for (int j=0;j<sz;j++)cout<<t+sz-j<<" ";
			t+=sz;
			n-=sz;
		}
	}
}

Measured memory_bytes: 2176
import collections
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
count=0
b=len(collections.Counter(a))
c=collections.Counter(a).most_common()
#print(b)
for i in range(min(k,b)):
    count+=c[i][1]
#    print(count)
ans=len(a)-count
print(ans)

Measured memory_bytes: 49820
#include<stdio.h>

int main(){

    int x,A[10000],N,j,minj,i,count=0;

    scanf("%d",&N);

    for(i = 0 ; i < N ; i++){
        scanf("%d",&A[i]);
    }

    for(i = 0 ; i <= N-1 ; i++){
        minj = i;
        
        for( j = i ; j <= N-1 ; j++){
            if (A[j] < A[minj]){
              minj = j;
            }
          }

        if(i != minj){
            x = A[i];
            A[i] = A[minj];
            A[minj] = x;
            count++;
        }
    }

    for(i = 0 ; i < N ; i++){
        printf("%d",A[i]);
        if(i+1!=N){
            printf(" ");
        }
    }

    printf("\n%d\n",count);


}



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

int main()
{
	int i, N, x[9], y[9];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d %d", &(x[i]), &(y[i]));
	
	int j;
	double total = 0.0;
	for (i = 1; i <= N; i++) {
		for (j = i + 1; j <= N; j++) total += sqrt((double)((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])));
	}
	
	printf("%lf\n", total * 2 / N);
	fflush(stdout);
	return 0;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  int64_t sum = 0;
  for (int i = 0; i <= N; i++) {
    if (i % 3 != 0 && i % 5 != 0) sum += i;
  }
  cout << sum << endl;

  return 0;
}


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

ll MOD = 1e9 + 7;

ll modPow(ll a, ll x) {
  if (x == 0) return 1;
  if (x == 1) return a;
  ll temp = modPow(a, x / 2);
  ll ans = (temp * temp) % MOD;
  if (x % 2 == 1) ans = (ans * a) % MOD;
  return ans;
}

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

  ll N; cin >> N;
  ll K; cin >> K;
  ll ans = 0;
  vector<ll> memo(K + 1, 0);
  for (ll i = K; i >= 1; i--) {
    ll t = K / i;

    ll temp = modPow(t, N);
    if (t > 1) {
      for (ll j = 2; j <= K; j++) {
        if (i * j > K) break;
        temp = (temp - memo[i * j] + MOD) % MOD;
      }
    }
    memo[i] = temp;
    ans += (i * temp);
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3992
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
using namespace std;


int main()
{
    int N,T,A;
    cin >> N >> T >> A;
    int H[N];
    for (int i = 0; i < N; i++) cin >> H[i];
    double tmp[N];
    for (int i = 0; i < N; i++) tmp[i] = T - H[i] * 0.006;
    double res = 1000000;
    int num = 0;
    for (int i = 0; i < N; i++)
    {
        double pti = abs(A - tmp[i]);
        if (res > pti)
        {
            res = pti;
            num = i;
        }
    }
    cout << num + 1 << endl;
}

Measured memory_bytes: 256
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;
string s;
vi k;
int d,n;
int dp[10005][2][101];
int find(int i,int flag,int mod)
{
	if(i==n)
	{
		if(mod==0)return 1;
		return 0;
	}
	if(dp[i][flag][mod]!=-1)return dp[i][flag][mod];
	int limit;
	if(flag==0)limit=k[i];
	else limit=9;
	int sum=0,check=0;
	rep(j,limit+1)
	{
		check=0;
		if(j<k[i])check=1;
		sum+=find(i+1,check|flag,(mod+j)%d);
		sum%=hell;
	}
	return dp[i][flag][mod]=sum%hell;
	
}
void solve()
  {

	cin>>s>>d;
	rep(i,sz(s))k.pb(s[i]-'0');
	n=k.size();
	rep(i,10005)rep(j,2)rep(kk,101)dp[i][j][kk]=-1;
	int i=0,mod=0,flag=0;
	cout<<(find(i,flag,mod)-1+hell)%hell;

  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


Measured memory_bytes: 20304
import java.util.Scanner;

public class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        // input
        int a  = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();

        // answer
        if(a + b + c >= 22){
            System.out.println("bust");
        } else {
            System.out.println("win");
        }

    }
}

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

int main() {
  int n, t, d = 0, m = 1001001001, o = 0;
  scanf("%d %d", &n, &t);
  for(int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    m = min(m, a);
    if(a - m >= d) {
      if(a - m > d) o = 0;
      o++;
      d = a - m;
    }
  }
  printf("%d\n", o);
}

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

#define FasterIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(), v.end()
const int MOD = 1e9+7;

int main(){
    FasterIO;

    int a, p;

    while(cin>>a>>p){
        cout<<(3*a+p)/2<<endl;
    }

    return 0;
}



Measured memory_bytes: 892