akhauriyash/Code-Regression huggingface dataset:
(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  let i, j, X, Y, xlen, ylen, maxlen;
  let c;
  while ((X = lines.shift()) && (Y = lines.shift())) {
    xlen = X.length;
    ylen = Y.length;
    c = Array.from(Array(xlen + 1), () => []);

    for (i = 1; i <= xlen; i++) {
      for (j = 1; j <= ylen; j++) {
        if (X[i-1] === Y[j-1]) c[i][j] = c[i - 1][j - 1] + 1||1;
        else c[i][j] = Math.max(c[i - 1][j]||0, c[i][j - 1]||0);
      }
    }
    console.log(c[xlen][ylen]);
  }
})();



Measured memory_bytes: 142548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int N, M;
  cin >> N >> M;
  int a[M];
  int b[M];
  int f[M]{};
  int t = 0;
  int flag[N]{};
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
    for (int j = 0; j < b[i]; j++) {
      cin >> t;
      t--;
      flag[t] = 1;
      f[i] += (1<<t);
    }
  }
  // 全ての宝箱を開けることができるかをチェック
  for (int i = 0; i < N; i++) {
    if (flag[i] == 0) {
      cout << "-1\n";
      return 0;
    }
  }
  int l = (1<<N);
  int dp[l];
  int inf = 100000000;
  fill(dp, dp + l, inf);
  dp[0] = 0;

  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      int t = (1<<j);
      if ((f[i] & t) == 0) continue;
      for (int k = 0; k < l; k++) {
        int idx = k | f[i];
        dp[idx] = min(dp[idx], dp[k] + a[i]);
      }
    }
  }
  cout << dp[l - 1] << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s, ans;

	cin >> s;

	for (int i = 0; i < s.size(); i++)
	{
		switch (s[i])
		{
		case '0':
			ans.push_back('0');
			break;
		case '1':
			ans.push_back('1');
			break;
		case 'B':
			if (!ans.empty())
				ans.pop_back();
			break;
		default:
			break;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}


int main(void){
  ll n;cin>>n;
  vector<ll> A;
  ll sum = 0;
  rep(i,n){
    char p = '+';
    if(i != 0){
      cin>>p;
    }
    ll a;cin>>a;
    if(p == '+'){
      A.push_back(a);
    }else{
      A.push_back(-a);
    }
    sum += A[i];
  }
  /*rep(i,A.size()){
    cerr<<A[i]<<" ";
  }
  cerr<<sum<<endl;*/

  ll ps = 0, ms = 0;
  ll ans = sum;
  int i = n-1;
  while(i >= 0){
    while(i >= 0 && A[i] > 0){
      ps += A[i];
      i--;
    }
    if(i >= 0){
      chmax(ans, sum + (-ms - ps) * 2);
      ms += A[i];
      ps = 0;
    }
    i--;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1400
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n;
    cin >> n;
    vector< P > v;
    for( int i = 0; i < n; ++i ) {
        int x, y;
        cin >> x >> y;
        v.pb( MP( x, y ) );
        
    }

    double d = 1;
    double dd = 1;
    for( int i = 2; i <= n - 2; ++i ) d *= i;
    for( int i = 2; i <= n; ++i ) dd *= i;
    double res = 0;
    for( int i = 0; i < n; ++i ) {
        for( int j = i + 1; j < n; ++j ) {
            double di = sqrt( (v[i].F - v[j].F) * (v[i].F - v[j].F) + 
                            (v[i].S - v[j].S) * (v[i].S - v[j].S) );
            res += di * d;

        }
    }
    printf( "%.10lf\n", res / dd * (n - 1) * 2 );
    return 0;
}


Measured memory_bytes: 256
/******************************************************/
/******************************************************/
/**                                                  **/
/**            BISMILLAHIR RAHMANIR RAHIM            **/
/**         REAZ AHAMMED CHOWDHURY - reaziii         **/
/**  Department of Computer Science and Engineering  **/
/*         INSTITUTE OF SCIENCE AND TECHNOLOGY       **/
/**                                                  **/
/******************************************************/
/******************************************************/



#include<bits/stdc++.h>
#define sc(x)        scanf("%lld",&x)
#define pcase(x)     printf("Case %d: ",x++)
#define pn           printf("\n")
#define fri(f)       for(int i=0;i<f;i++)
#define frj(f)       for(int j=0;j<f;j++)
#define reset(x,e)   memset(x,e,sizeof(x))
#define all(x)       x.begin(),x.end()
#define input        freopen("input.txt","r",stdin);
#define output       freopen("output.txt","w",stdout)
#define infi         INT_MAX
#define m_v          3000000
#define pii          pair<int,int>
#define pch          pair<char,char>
#define pll          pair<ll,ll>
#define mgraph       map<int,vector<int> >
#define mp           make_pair
#define pb           push_back
#define clr(x)       memset(x,0,sizeof(x))
#define frx(x,y)     for(int x=0;x<y;x++)
#define ff           first
#define ss           second
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
bool checkbitt(ll num, int pos);
ll setbitt(ll num, ll pos);
ll resetbitt(ll num, int pos);
void read(int *aa, int sz) {fri(sz) scanf("%d", (aa + i));}
void read(ll *aa, int sz) {fri(sz) scanf("%lld", (aa + i));}
void read(ll *aa, int s, int e) {for (int i = s; i < s + e; i++)scanf("%lld", (aa + i));}
void read(int *aa, int s, int e) {for (int i = s; i < s + e; i++)scanf("%d", (aa + i));}
const ll mod =       1e9 + 7;
const ll N =     1e6 + 10;

//.................___Start from here___.................//
//.................._____________________................//


int solve() {
	int n;
	cin >> n;
	int arr[n + 1];
	read(arr, 1, n);

	int dp[n + 100];
	clr(dp);

	for (int i = n - 1; i >= 1; i--) {
		int op1 = abs(arr[i] - arr[i + 1]) + dp[i + 1];
		int op2 = infi;

		if (i <= n - 2) {
			op2 = abs(arr[i] - arr[i + 2]) + dp[i + 2];
		}
		dp[i] = min(op1, op2);
	}

	cout << dp[1] << endl;


	return 0;
}
int main() {
// #ifndef ONLINE_JUDGE
// 	input;
// 	output;
// #endif
// #ifdef ONLINE_JUDGE
// 	ios_base::sync_with_stdio(false);
// 	cin.tie(0);
// #endif
	int cs = 1;
	int cn = 1;
	//cin>>cs;
	while (cs--) {
		solve();

	}
}


bool checkbitt(ll num, int pos) {return (num >> pos) & 1;}
ll setbitt(ll num, ll pos) {return (1 << pos) | num;}
ll resetbitt(ll num, int pos) {if (!checkbitt(num, pos)) return num; else return (1 << pos)^num;}



Measured memory_bytes: 4556
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,a=1,b,c;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    b=a*2;
    c=a+k;
    a=min(b,c);
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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

int main() {
	ll a;
	long double b;
	cin >> a >> b;
	cout << (ll)floor(a*b) << endl;

  return 0;
}


Measured memory_bytes: 3732
import java.util.*;import java.io.*;import java.math.*;

public class Main
{

    public static void process()throws IOException
    {
        int k=ni();
        long res=0l;
        for(int a=1;a<=k;a++)
            for(int b=1;b<=k;b++)
                for(int c=1;c<=k;c++)
                    res+=(gcd(a,gcd(b,c)))*1l;

        pn(res);
    }


    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

       // oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;



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

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
    
    
    

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

int main(){
  int N,n;
  cin >> N;
  vector<int>vec(N);
  vector<int>vec_2(0);
  vector<int>vec_count(0);
  int count,count_2,c;

  for (int i_1 = 0; i_1 < N; i_1 ++) cin >> vec.at(i_1);

  for (int i_2 = 0; i_2 < N; i_2 ++){
    n = vec.at(0);
    count_2 = 0;
    for (int j_2_1 = 0; j_2_1 < N; j_2_1 ++){
      if (n < vec.at(j_2_1)) {
        n = vec.at(j_2_1);
        vec_count.push_back(j_2_1);//見つけた時の添字の値をログ
        count ++;
        count_2 ++;
      }
    }

    vec_2.push_back(n);//広義単調減少の順に並び替えたvec
    if(count_2 != 0){
      c = vec_count.at(count-1);//ログの最後の値を知りたい
      vec.at(c) = 0;
    }
    else vec.at(0) = 0;
  }
  
  int count_3 = 1;
  int d = vec_2.at(0);
  for (int i_3 = 1; i_3 < N; i_3 ++){
    if (d > vec_2.at(i_3)) {
      count_3 ++;
      d = vec_2.at(i_3);
    }
  }

  cout << count_3 << endl;

  
  
}

Measured memory_bytes: 256
from collections import deque
import sys
input = sys.stdin.readline
def solve():
  n,m = (int(i) for i in input().split())
  a = [None]*(m+1)
  b = [None]*(m+1)
  takara = [0]*m
  for i in range(m):
    ta,tb = (int(i) for i in input().split())
    a[i] = ta
    b[i] = tb
    c = list(int(i) for i in input().split())
    for j in c:
      tmp = j-1
      takara[i] += 1<<tmp
  inf = float("Inf")
  dp = [[inf]*(2**n+1) for _ in range(m+1)]
  dp[0][0] = 0
  for i in range(m):
    for j in range(2**n):
      dp[i+1][j] = min(dp[i][j],dp[i+1][j])
      dp[i+1][j|takara[i]] = min(dp[i][j]+a[i],dp[i+1][j|takara[i]])
  if not dp[m][2**n-1] == inf:
    print(dp[m][2**n-1])
  else:
    print(-1)
solve()

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

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int testCases = 1;
   // cin >> testCases;
    
    while(testCases--)
    {
        int i,j;string s,t;
        
        cin >> s >> t;
        
        int minn = LLONG_MAX;
        
        int n = s.length();
        int N = t.length();
       // cout << n << '\n';
        
        for(i = 0;i < n;++i)
        {
            for(int len = 1;len <= n - i;++len)
            {
                string ss = s.substr(i,len);
              //   cout << ss << '\n';
                
                if((int)ss.size() == N)
                {
                  //  cout << ss << '\n';
                    int cnt = 0;
                    for(int I = 0;I < N;++I)
                    {
                        if(ss[I] != t[I])
                            cnt++;
                    }
                    
                    minn = min(minn,cnt);
                }
            }
        }
        
       cout << minn;
        
        cout << '\n';
    }
    
}


Measured memory_bytes: 3696
#include<stdio.h>
#include<string.h>

int main(void){
  char S[100];
  int len;
  scanf("%s",S);
  len = strlen(S);
  for(int i = 0;i < len;i++){
    if(i % 2 == 0){      
      if((S[i] != 'R') && (S[i] != 'U') && (S[i] != 'D')){
	printf("No");
	return 0;
      }
    }
    else{
      if((S[i] != 'L') && (S[i] != 'U') && (S[i] != 'D')){
	printf("No");
	return 0;
      }
    }
  }
  printf("Yes");
  return 0;
}


Measured memory_bytes: 128
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int N = Integer.valueOf(s.next());
		int K = Integer.valueOf(s.next());
		int[] A = new int[N];
		BigInteger cur = BigInteger.ONE;
		BigInteger former = BigInteger.ONE;
		int cnt = 0;
		for(int i = 0; i < N; i++) {
			A[i] = Integer.valueOf(s.next());
			cnt++;
			if(cnt <= K) {
//				cur = cur.multiply(BigInteger.valueOf(A[i]));
			}else {
//				former = cur;
//				cur = cur.multiply(BigInteger.valueOf(A[i])).divide(BigInteger.valueOf(A[i-K]));
				if(A[i] > A[i-K]) {
					System.out.println("Yes");
				}else {
					System.out.println("No");
				}
			}
		}
	}
}

Measured memory_bytes: 61032
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 9223372036854775807;
const int MOD = 1000000007;

int main(){
	string s;
	std::cin >> s;
	if(s=="Sunny")std::cout << "Cloudy" << std::endl;
	if(s=="Cloudy")std::cout << "Rainy" << std::endl;
	if(s=="Rainy")std::cout << "Sunny" << std::endl;
}

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

#define _fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1)
#define MAXS 100000
#define MOD 998244353
#define all(v) v.begin(),v.end()
#define pb push_back

using namespace std;
typedef long long ll;

int tc;


void solve(){

    ll n,x,y;
    map<ll,ll>mp;
    cin>>n>>x>>y;
    for(int i=1; i<n; i++){
        for(int j=i+1; j<=n; j++){
            ll p = j-i;
            ll q = abs(i-x)+abs(y-j)+1;
            //cout<<"i: " << i << " j: " << j << " p: " << p << " q: " << q << endl;
            p = min(p,q);
            mp[p]++;
        }
    }
    for(int i=1; i<n; i++){
        cout<<mp[i]<<endl;
    }
}

int main()
{

    _fastIO;


    //cin>>tc; while(tc--)
    solve();

    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
   
typedef struct{
  double x;
  double y;
}koch;
 
void fractal(int,koch,koch);
  
int main(){
   
  koch p1,p2;
  int n;
   
  p1.x = 0;
  p2.x = 100;
  p1.y = 0;
  p2.y = 0;
   
  scanf("%d",&n);
   
  printf("%f %f\n",p1.x,p1.y);
  fractal(n,p1,p2);
  printf("%f %f\n",p2.x,p2.y);
   
  return 0;
}
 
void fractal(int n, koch p1, koch p2){
  
  if(n==0) return;
  koch s,t,u;
   
  s.x = (p2.x-p1.x)/3+p1.x;
  s.y = (p2.y-p1.y)/3+p1.y;
  t.x = 2*(p2.x-p1.x)/3+p1.x;
  t.y = 2*(p2.y-p1.y)/3+p1.y;
  u.x = (t.x-s.x)/2-sqrt(3)/2*(t.y-s.y)+s.x;
  u.y = (t.y-s.y)/2+sqrt(3)/2*(t.x-s.x)+s.y;
   
  fractal(n-1,p1,s);
  printf("%f %f\n",s.x,s.y);
     
  fractal(n-1,s,u);
  printf("%f %f\n",u.x,u.y);
     
  fractal(n-1,u,t);
  printf("%f %f\n",t.x,t.y);
   
  fractal(n-1,t,p2);
}

Measured memory_bytes: 2704
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
 
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define PB push_back
 
int main() {
    string N;
    cin >> N;
    
    cout << N.erase(3) << endl;
    
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	string s;
	cin>>s;
	int n = s.size();
	int l = -1, r = -1;
	if(s.size()==2 && s[0] == s[1]) {
		cout<<1<<" "<<2<<endl;
		return 0;
	}
	for(int i = 0; i + 2 < n; i++){
		if(s[i] == s[i+1] || s[i] == s[i+2] || s[i+1] == s[i+2]){
			cout<<i+1<<" "<<i+3<<endl;
			return 0;
		}
	}
	cout<<l<<" "<<r<<endl;
}

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

const long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair
#define int long long

int areasub(int x, int y, int a, int b){
    int ret = 0;
    if(a < x && b < y){
        ret += (x - a) * (y - b);
    }
    return ret;
}
signed main(){
    int n;
    int x[112], y[112];
    int t, b, l, r;
    int xmin, ymin;
    auto succ = [&](int x){if(x == n - 1) return 0ll; else return ++x;};

    auto area = [&](int x, int y){
        int ret;
        ret = areasub(x, y, l, b) - areasub(x, y, l, t) - areasub(x, y, r, b) + areasub(x, y, r, t);
        return x * y - ret;
    };

    while(cin >> n, n){
        int ans = 0;
        t = -100000;
        b = 100000;
        l = 100000;
        r = -100000;
        xmin = 0, ymin = 0;
        REP(i, n){
            cin >> x[i] >> y[i];
            xmin = min(xmin, x[i]);
            ymin = min(ymin, y[i]);
        }
        REP(i, 4){
            int tmp_a, tmp_b;
            cin >> tmp_a >> tmp_b;
            l = min(l, tmp_a);
            r = max(r, tmp_a);
            t = max(t, tmp_b);
            b = min(b, tmp_b);
            xmin = min(xmin, tmp_a);
            ymin = min(ymin, tmp_b);
        }
        REP(i, n){
            x[i] -= xmin;
            y[i] -= ymin;
        }
        l -= xmin;
        r -= xmin;
        b -= ymin;
        t -= ymin;
        REP(i, n){
            if(x[i] == x[succ(i)]){

            }else if(y[i] == y[succ(i)]){
                ans += area(x[succ(i)], y[succ(i)]) - area(x[i], y[i]);
            }else{
                while(1);
            }
        }
        cout << abs(ans) << endl;
    }
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  int K;
  cin >> S >> K;
  int N = (int)S.size();
  vector<vector<vector<int>>> dp(N + 1,
                                 vector<vector<int>>(2, vector<int>(K + 2, 0)));
  dp[0][0][0] = 1;
  for (int i = 0; i < N; i++) {
    int c = S[i] - '0';
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < K + 1; k++) {
        for (int nc = 0; nc < 10; nc++) {
          if (nc > c && j == 0) continue;
          int nj = j;
          if (nc < c) nj = 1;
          int nk = k;
          if (nc != 0) nk++;
          dp[i + 1][nj][nk] += dp[i][j][k];
        }
      }
    }
  }
  cout << dp[N][0][K] + dp[N][1][K] << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll n,k; cin>>n>>k;
    vector<ll> A(n);
    rep(i,n) cin>>A[i];
    ll a=0,b=0,c=0;
    vector<ll> plus={},zero={},minus={};
    rep(i,n){
        if(A[i]<0) {a++; minus.push_back((-1)*A[i]);}
        else if(A[i]==0) {b++; zero.push_back(A[i]);}
        else {c++; plus.push_back(A[i]);}
    }
    sort(plus.begin(),plus.end());
    sort(minus.begin(),minus.end());
    if(k<=a*c){
        //a*c-k+1番目に小さい
        ll x=a*c-k+1;
        ll upper=0, under=0;
      	upper=minus[a-1]*plus[c-1];
        while(upper-under>1){
            ll mid=(upper+under)/2;
            ll cnt=0;
            rep(i,a){
                auto Iter=upper_bound(plus.begin(),plus.end(),mid/minus[i]);
                cnt+=Iter-plus.begin(); //keyより小さい要素の個数
            }
            if(cnt>=x) upper=mid;
            else under=mid;
        }
        cout<<(-1)*upper<<endl;
    }else if(k<=a*c+b*(b-1)/2+b*(a+c)){
        cout<<0<<endl;
    }else{
        //k-(a*c+b*(b-1)/2+b*(a+c)番目に小さい
        ll x=k-(a*c+b*(b-1)/2+b*(a+c));
        //vector<ll> plus_c=plus, minus_c=minus;
        ll upper=0, under=0;
      	if(a>0) upper=minus[a-1]*minus[a-1];
      	if(c>0) upper=max(upper,plus[c-1]*plus[c-1]);
        while(upper-under>1){
            ll mid=(upper+under)/2;
            ll cnt=0;
            rep(i,a){
                auto Iter=upper_bound(minus.begin(),minus.end(),mid/minus[i]);
                if(Iter-minus.begin()>i) cnt+=Iter-minus.begin()-i-1;
            }
            rep(i,c){
                auto Iter=upper_bound(plus.begin(),plus.end(),mid/plus[i]);
                if(Iter-plus.begin()>i) cnt+=Iter-plus.begin()-i-1;
            }
            if(cnt>=x) upper=mid;
            else under=mid;
        }
        cout<<upper<<endl;
    }
    return 0;
}


Measured memory_bytes: 4084
import math
N,K = map(int,input().split())
mod = 10**9+7

def f(n):
  if n == 1:
    return 1
  else:
    a = n
    m = n
    for i in range(2,math.floor(math.sqrt(n))+1):
      if m % i == 0:
        a = a*(i-1)//i
        while m % i == 0:
          m = m // i
        if m == 1:
          break
    if m != 1:
      return a*(m-1)//m
    else:
      return a
      
    
ans = 0  
for i in range(1,K+1):
  ans = (ans + (pow(K//i,N,mod)*f(i))) % mod

print(ans)

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

using namespace std;
typedef long long ll;
ll getLong(){
	ll a;
	scanf("%lld",&a);
	return a;
}
int main(int argc, char const *argv[]){
  ll x,y;
  x=getLong();
  y=getLong();
  int count=0;
  for(int i=1;;i++){
  	if(x<=y){
  		count+=1;
  	}else{
  		break;
  	}
  	x*=2;
  }
  printf("%d\n",count);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll t;
  cin>>t;
  ll ac=0,wa=0,tle=0,re=0;
  while(t--){
    string s;
    cin>>s;
    if(s=="AC"){
      ac++;
    }else if(s=="WA"){
      wa++;
    }else if(s=="TLE"){
      tle++;
    }else if(s=="RE"){
      re++;
    }
  
  }
  cout<<"AC x "<<ac<<endl;
  cout<<"WA x "<<wa<<endl;
  cout<<"TLE x "<<tle<<endl;
  cout<<"RE x "<<re<<endl;

}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <cassert>
#include <sstream>
using namespace std;
using ll = long long;

ll f(ll n) {
  if(n==0) { return 0; }
  ll popcnt = __builtin_popcount(n);
  return 1+f(n%popcnt);
}
int main() {
  ll n;
  string S;
  cin >> n >> S;
  ll popcnt = 0;
  for(ll i=0; i<n; i++) {
    if(S[i]=='1') {
      popcnt++;
    }
  }
  vector<ll> MOD{popcnt-1, popcnt+1};
  if(MOD[0]<=0) {
    MOD[0] = 1;
  }

  vector<ll> SM(2, 0);
  vector<vector<ll>> P2(2, vector<ll>(n, 0));
  for(ll i=0; i<MOD.size(); i++) {
    P2[i][0] = 1;
    for(ll j=1; j<n; j++) {
      P2[i][j] = (P2[i][j-1]*2)%MOD[i];
    }

    ll val = 0;
    for(ll j=0; j<n; j++) {
      val = (val + (S[n-1-j]=='1' ? P2[i][j] : 0))%MOD[i];
    }
    SM[i] = val;
  }
  //cerr << "popcnt=" << popcnt << " SM[0]=" << SM[0] << " SM[1]=" << SM[1] << endl;

  vector<ll> ANS(n, 0);
  for(ll i=0; i<n; i++) {
    ll idx = (S[n-1-i]=='1' ? 0 : 1);
    ll p2 = P2[idx][i];
    ll val = (SM[idx]+(idx==0 ? -p2 : p2))%MOD[idx];
    while(val<0) { val += MOD[idx]; }
    assert(val>=0);
    ANS[n-1-i] = (S[n-1-i]=='1' && popcnt==1 ? 0 : 1+f(val));
    //cerr << "i=" << (n-1-i) << " val=" << val << " S[i]=" << S[n-1-i] << " P2[i]=" << p2 << " idx=" << idx << " ANS[i]=" << ANS[n-1-i] << endl;
  }
  ostringstream out;
  for(ll i=0; i<n; i++) {
    out << ANS[i] << endl;
  }
  cout << out.str();
}


Measured memory_bytes: 8972
A = list(input())
B = list(input())
C = list(input())

w = A.pop(0)

while True:
  if w == 'a':
    if len(A) == 0:
      print('A')
      break
    else:
      w = A.pop(0)
  if w == 'b':
    if len(B) == 0:
      print('B')
      break
    else:
      w = B.pop(0)
  if w == 'c':
    if len(C) == 0:
      print('C')
      break
    else:
      w = C.pop(0)

      

  

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define ld long double
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
#define MOD 1000000007

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

    int x;
    cin>>x;
    if(x == 0){
        cout<<"1\n";
    }else{
        cout<<"0\n";
    }
}

Measured memory_bytes: 3660
#define _GLIBCXX_DEBUG
#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(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  ll x;
  cin >> x ;
  ll ans = x/11*2;
  if(x%11>0 && x%11<=6) ans ++;
  if(x%11>6) ans+=2;
  cout << ans << endl;
}




Measured memory_bytes: 256
dataset = []
op = ""
while op is not "?":
    a, op, b = map(str, input().split())
    a = int(a)
    b = int(b)
    if (a >= 0 and a <= 20000) and (b >= 0 and b <= 20000):
        listed = []
        listed.append(a)
        listed.append(op)
        listed.append(b)
        dataset.append(listed)
    elif op is "?":
        break
    else:
        break

for i in dataset:
    if i[1] is "+":
        print("{0}".format(i[0] + i[2]))
    elif i[1] is "-":
        print("{0}".format(i[0] - i[2]))
    elif i[1] is "*":
        print("{0}".format(i[0] * i[2]))
    elif i[1] is "/":
        print("{0}".format(int(i[0] / i[2])))
    else:
        pass

Measured memory_bytes: 7704
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

typedef vector<int> vi;
const int maxn = 100005;
//vector<vi> graph;
vector<int> graph[maxn];
ll fact[maxn];
ll k;
ll ans = 1;
const ll Mod = 1e9 + 7;

void dfs(int v, int p)
{
    ll cnt = k - 1;
    if (p != -1) cnt--;

    for (auto x : graph[v])
    {
        if (x == p) continue;
        if (cnt <= 0) {
            ans = 0;
            return;
        }

        ans = ans * cnt;
        cnt--;
        ans %= Mod;
        dfs(x, v);
    }
}

int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    int T;
    //cin >> T;
    T = 1;
    for (int cs = 1; cs <= T; cs++) {

        int n;
        cin >> n;

        //for (int i = 0; i < n; i++) {
          //  vector<int> blank;
          //  graph.push_back(blank);
       // }

        cin >> k;
        for (int i = 0; i < n - 1; i++) {
            int u, v;
            cin >> u >> v;
            --u;
            --v;
            graph[u].push_back(v);
            graph[v].push_back(u);
        }

        ans = k;
        dfs(0, -1);
        cout << ans << endl;
    }

    //double end_time = clock();
    //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
    return 0;
}

Measured memory_bytes: 10368
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        List<int> x = new List<int>();
        string[] input = Console.ReadLine().Split(' ');
        int P = int.Parse(input[0]);
        int Q = int.Parse(input[1]);
        int R = int.Parse(input[2]);
        x.Add(int.Parse(input[0]));
        x.Add(int.Parse(input[1]));
        x.Add(int.Parse(input[2]));

        x.Sort();

        var sum = x.Sum();
        var max = x.Max();
        int ans = sum - max;

        Console.WriteLine(ans);
        
    }
}




Measured memory_bytes: 13268
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll n=in();
    string s,t;cin>>s>>t;
    for(ll i=0;i<n;++i){
        cout<<s[i]<<t[i];
    }
    cout<<endl;
}


Measured memory_bytes: 256
def rec(s, start, d):
    if d == 0:
        return [s[start:]]

    cand = []
    for i in range(start + 1, len(s)):
        c = rec(s, i, d - 1)
        for cc in c:
            cand.append(s[start:i] + '+' + cc)
    return cand


s = input()
# s = '125'
# s = '9999999999'

N = len(s)
cnt = 0
for i in range(N):
    eqs = rec(s, 0, i)
    for eq in eqs:
        if len(eq.replace('+', "")) == N:
            cnt += eval(eq)
    # cnt += sum([eval(eq) for eq in eqs])
print(cnt)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
const long mod=998244353;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
long fac[2<<17],inv[2<<17];
int N,M,K;
main()
{
	fac[0]=1;
	for(int i=1;i<2<<17;i++)fac[i]=fac[i-1]*i%mod;
	inv[(2<<17)-1]=power(fac[(2<<17)-1],mod-2);
	for(int i=(2<<17)-1;i--;)inv[i]=inv[i+1]*(i+1)%mod;
	cin>>N>>M>>K;
	long ans=power(M,N);
	for(int L=K+1;L<N;L++)
	{
		ans-=fac[N-1]*inv[N-1-L]%mod*inv[L]%mod*M%mod*power(M-1,N-L-1)%mod;
	}
	cout<<(ans%mod+mod)%mod<<endl;
}


Measured memory_bytes: 7732
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    auto AS = readln.split.to!(int[]);
    int max_a = int.min;
    foreach (i; 0..N-1) {
        foreach (j; i+1..N) {
            max_a = max(max_a, abs(AS[i] - AS[j]));
        }
    }
    writeln(max_a);
}

Measured memory_bytes: 348
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> n >> s;
	x = 0; y = 0;
	rep(i, n){
		if(s[i] == 'I') ++x;
		if(s[i] == 'D') --x;
		y = max(y, x);
	}
	cout << y << endl;
}

Measured memory_bytes: 256
import sys, random
input = sys.stdin.readline
def main():
    D = int(input())
    c = list(map(int, input().split()))
    s = []
    for _ in range(D):
        si = list(map(int, input().split()))
        s.append(si)
    last_list = [0] * 26
    minus_sat_list = [0] * 26
    for i in range(D):
        for j in range(26):
            minus_sat_list[j] += c[j] * (i+1-last_list[j])
        best_idx = 0
        worst_sat, worst_sat_idx  = 0, -1
        worst2_sat, worst2_sat_idx  = 0, -1
        worst3_sat, worst3_sat_idx  = 0, -1
        worst4_sat, worst4_sat_idx  = 0, -1
        worst5_sat, worst5_sat_idx  = 0, -1
        for j in range(26):
            if (minus_sat_list[j] > worst_sat) or (minus_sat_list[j] == worst_sat and s[i][j] > s[i][worst_sat_idx]):
                worst_sat = minus_sat_list[j]
                worst_sat_idx = j
            elif (minus_sat_list[j] > worst2_sat) or (minus_sat_list[j] == worst2_sat and s[i][j] > s[i][worst2_sat_idx]):
                worst2_sat = minus_sat_list[j]
                worst2_sat_idx = j
            elif (minus_sat_list[j] > worst3_sat) or (minus_sat_list[j] == worst3_sat and s[i][j] > s[i][worst3_sat_idx]):
                worst3_sat = minus_sat_list[j]
                worst3_sat_idx = j
            elif (minus_sat_list[j] > worst4_sat) or (minus_sat_list[j] == worst4_sat and s[i][j] > s[i][worst4_sat_idx]):
                worst4_sat = minus_sat_list[j]
                worst4_sat_idx = j
            elif (minus_sat_list[j] > worst5_sat) or (minus_sat_list[j] == worst5_sat and s[i][j] > s[i][worst5_sat_idx]):
                worst5_sat = minus_sat_list[j]
                worst5_sat_idx = j
        worst_val = s[i][worst_sat_idx] * (i + 1) // 2 + worst_sat
        worst2_val = s[i][worst2_sat_idx] * (i + 1) // 2 + worst2_sat
        worst3_val = s[i][worst3_sat_idx] * (i + 1) // 2 + worst3_sat
        worst4_val = s[i][worst4_sat_idx] * (i + 1) // 2 + worst4_sat
        worst5_val = s[i][worst5_sat_idx] * (i + 1) // 2 + worst5_sat
        best_val = max(worst_val, worst2_val, worst3_val, worst4_val, worst5_val)
        if best_val == worst_val:
            best_idx = worst_sat_idx
        elif best_val == worst2_val:
            best_idx = worst2_sat_idx
        elif best_val == worst3_val:
            best_idx = worst3_sat_idx
        elif best_val == worst4_val:
            best_idx = worst4_sat_idx
        elif best_val == worst5_val:
            best_idx = worst5_sat_idx
        minus_sat_list[best_idx] = 0
        last_list[best_idx] = i + 1
        print(best_idx+1)
if __name__ == "__main__":
    main()

Measured memory_bytes: 79060
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <vector>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int c,a,b;
  cin>>c;
  if(c==1){
    cout<<"Hello World"<<"\n";
  }
  else{
    cin>>a>>b;
    a+=b;
    cout<<a<<"\n";
  }
  return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
int main(){
	int a=0, b=0, ans1=0, ans2=0;
	double ans3=0.0, aaa;
	
	scanf("%d %d", &a, &b);
	aaa = (double)a/b;
	printf("%d %d %.5lf\n", a/b, a%b, aaa);
	return 0;
}


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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        //int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        //s桁のbit列で全探索を行う
        long ans = 0;
        for (int x = 0; x < Math.Pow(2, s.Length - 1); x++)
        {
            var array = new bool[s.Length - 1];

            // 右からk桁目を取り出す
            for (int k = 0; k < s.Length - 1; k++)
            {
                var y = (x >> k) & 1;
                if (y == 1) array[k] = true;
            }

            long tmp = 0;
            int f = 0;
            int c = 1;
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i])
                {
                    tmp += long.Parse(s.Substring(f, c));
                    f = i+1;
                    c = 1;
                }
                else
                {
                    c++;
                }
            }
            tmp += long.Parse(s.Substring(f, c));
            ans += tmp;
        }
        // 出力
        Console.WriteLine(ans);
    }
}

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

int main() {
  int N, A;
  string op;
  cin >> N >> A;

  if ( N - (N / 500) * 500 <= A ) {
    cout << "Yes" << endl;
  }
 
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
<?php
list($h, $n) = ints();
$dp = array_fill(0, $h + 1, PHP_INT_MAX);
$dp[0] = 0;
for ($i = 0; $i < $n; $i++) {
    list($a, $b) = ints();
    for ($j = 1; $j <= $h; $j++) {
        if ($a >= $j) $dp[$j] = min($dp[$j], $b);
        else $dp[$j] = min($dp[$j], $b + $dp[$j - $a]);
    }
}
echo $dp[$h];

function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 5496
s=input()
n=len(s)

evensum=0
oddsum=0
for i in range(n):
    evenflg=i%2
    if s[i]=="0":
        if evenflg==1:
            oddsum=oddsum+1
        else:
            evensum=evensum+1
    else:
        if evenflg==0:
            oddsum=oddsum+1
        else:
            evensum=evensum+1
if evensum<oddsum:
    print(evensum)
else:
    print(oddsum)  

Measured memory_bytes: 3188
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
//#include"matrix.h"
using namespace std;
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define REP(i,x,y) for(ll (i)=(x);(i)<(y);(i)++)
#define RREP(i,x,y) for(ll (i)=(x);(i)>=(y);(i)--)
#define sqr(x) ((x)*(x))
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define fst first
#define snd second
#define itm1 fst
#define itm2 snd.fst
#define itm3 snd.snd
#define sz(v) ((ll)v.size())
#define oo 200000000000
//#define EPS 1e-9

//#define pi acos(-1)
#define MOD 1000000007
#define MAXN 999409605
#define cot 20
//#define N 300005
//#define min -9042414321442
#define INF 1065435634
#define N1 90
//typedef long double ld;
typedef  long long ll;
//typedef short int ll;
//typedef ll ll;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef pair<ll,ii> tri;
typedef vector<ll> vi;

#define N 243555   
#define M 31
//#define cap 1000000000
#define bas 31

inline ll ma(ll a, ll b){ return ((a-b>0)? a:b);}
inline ll mi(ll a, ll b){return ((a-b>0)? b:a);}
 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif

inline ll go(ll a){
  ll ans=0;
  while(a) ans+=a%10, a/=10;
  return ans;
}
ll dp[N], ar[N], p[N];
vi b;
inline ll chek(ll &n){
  ll flag=1;
  REP(i,0,n-1) if(ar[i+1]-ar[i]>1) flag=0;
  if(ar[0]!=0) flag=0;
  return flag;
}
inline void solve(ll &n){
  ll ans=0;
  REP(i,0,n) ans+=dp[i];
  cout<<ans<<endl; 
}
inline ll lis(vi &v){
  ll sz=0;
  REP(i,0,v.size()){
    auto id=lower_bound(all(b),v[i])-b.begin();
    if(id==sz) {sz++, b.pb(v[i]);}
  }
  return sz;
}
int main(){
  fastio;
  ll a,b,c,k;cin>>a>>b>>c>>k;
  ll ans=(k&1)? b-a:a-b;
  (abs(ans)>1e18)? cout<<"Unfair"<<"\n":cout<<ans<<"\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll a,b,k;
  cin >> a >> b >> k;
  ll ax = max(0LL,a-k);
  k-=a;
  if(k<0) k = 0;
  ll bx = max(0LL,b-k);
  cout<<ax<< " " <<bx<<endl;

  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)


n = int(input())
COLORS = [True] * (n + 1)

TREE = [[] for _ in range(n + 1)]
LENGTHS = {}
for _ in range(n - 1):
    u, v, w = map(int, input().split())
    TREE[u].append(v)
    TREE[v].append(u)
    LENGTHS[(u, v)] = w

def dfs(now, prev):
    for vertex in TREE[now]:
        if vertex == prev:
            continue
        else:
            next = vertex
        u, v = min(now, next), max(now, next)
        if LENGTHS[(u, v)] % 2 == 0:
            COLORS[next] = COLORS[now]
        else:
            COLORS[next] = not COLORS[now]
        dfs(next, now)
dfs(1, 0)

for i in range(1, n + 1):
    ans = int(COLORS[i])
    print(ans)


Measured memory_bytes: 79580
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int ab = Math.abs(a - b);
        int bc = Math.abs(b - c);
        int ca = Math.abs(c - a);
        int min = Math.min(a, b);
        min = Math.min(min, c);
        int max = Math.max(a, b);
        max = Math.max(max, c);

        if (min == a && max == b || min == b && max == a) {
            System.out.println(ca + bc);
        } else if (min == b && max == c || min == c && max == b) {
            System.out.println(ab + ca);
        } else if (min == c && max == a || min == a && max == c) {
            System.out.println(bc + ab);
        }
    }
}

Measured memory_bytes: 23380