akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>

int main(){
    int N,keta=0;
    int ans=0;
    scanf("%d",&N);
    int tmp=N;
    while(tmp>0){
        tmp/=10;
        keta++;
    }
    // printf("%d\n",keta);

    if(keta%2==0){
        keta--;
        N=pow(10,keta)-1;
    }
    while(keta>0){
        ans+=N-pow(10,keta-1);
        keta-=2;
        N=pow(10,keta);
    // printf("%d\n",ans);

    }

    printf("%d\n",ans+1);

    return 0;
}

Measured memory_bytes: 384
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
#include<set>
using namespace std;
using ll = __int64_t;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;
const ll mod=1e9+7;


int main(){
      int n,k,q;
      cin>>n>>k>>q;
      ll a[n];
      fill(a,a+n,0);
      rep0(i,q){
            int b;
            cin>>b;
            b--;
            a[b]++;
      }
      rep0(i,n){
            //cout<<a[i]<<endl;
            if(a[i]>q-k){
                  cout<<"Yes"<<endl;
            }
            else cout<<"No"<<endl;
      }
      return 0;
}


Measured memory_bytes: 1408
#include <iostream>
using namespace std;
signed main() {
	int q; cin >> q;
	for (int i = 0; i < q; i++) {
		double x1, x2, x3, x4, y1, y2, y3, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double x12 = x2 - x1, y12 = y2 - y1;
		double x34 = x4 - x3, y34 = y4 - y3;
		if (x12*x34 + y12*y34 == 0)cout << "1\n";
		else if (x12 * y34 == x34 * y12) cout << "2\n";
		else cout << "0\n";
	}
}


Measured memory_bytes: 3220
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    s = input()
    count = 0
    previous = s[0]

    for i in range(1, len(s)):
        current = s[i]

        if previous != current:
            count += 1

        previous = current

    print(count)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int n;
  cin >> n;
  int ans = 0;
  int cnt = 0;
  for(int i = 1; i <= n; i += 2){
    for(int j = 1; j <= i; j++){
      if(i % j == 0) cnt++;
    }
    if(cnt == 8) ans++;
    cnt = 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn calc_e(n: u64) -> f64 {
    return ((n as f64) + 1.0) / 2.0
}

fn rolling_agg_find<T: Copy>(ai: Vec<T>, k: usize, calc: fn(T, T) -> T, calc_rev: fn(T, T) -> T, cmp: fn(T, T) -> bool) -> T {
    let mut res: Option<T> = None;
    let mut tmp_res: Option<T> = None;
    let mut index: usize = 0;
    let mut cache: Vec<T> = Vec::new();

    for i in 0..ai.len() {
        let a = ai[i as usize];

        if tmp_res.is_none() {
            tmp_res = Some(a);
        } else {
            tmp_res = Some(calc(tmp_res.unwrap(), a));
        }

        // if cache.len() < k {
        //     cache.push(a);
        //     continue
        // } else if cache.len() < k + 1{
        //     cache.push(a);
        // } else {
        //     cache[index] = a;
        // }

        // index = (i + 1) % (k + 1);
        // println!("index: {}", index);
        // tmp_res = Some(calc_rev(tmp_res.unwrap(), cache[index]));

        if cache.len() < k {
            cache.push(a);
        } else {
            if cache.len() < k + 1{
                cache.push(a);
            } else {
                cache[index] = a;
            }

            index = (i + 1) % (k + 1);
            tmp_res = Some(calc_rev(tmp_res.unwrap(), cache[index]));
        }

        if res.is_none() {
            res = Some(tmp_res.unwrap());
        }

        if cmp(tmp_res.unwrap(), res.unwrap()) {
            res = Some(tmp_res.unwrap());
        }
    }

    return res.unwrap();
}

fn add<T: std::ops::Add<Output=T>>(a: T, b: T) -> T {
    return a + b;
}

fn sub<T: std::ops::Sub<Output=T>>(a: T, b: T) -> T {
    return a - b;
}

fn gt<T: std::cmp::PartialOrd>(a: T, b: T) -> bool {
    return a > b;
}

fn main() {
    let n: u64 = read();
    let k: usize = read();
    let pi: Vec<u64> = (0..n).map(|_| read()).collect();
    let ei: Vec<f64> = pi.into_iter().map(|p| calc_e(p)).collect();

    let ans = rolling_agg_find(ei, k, add, sub, gt);
    println!("{:.12}", ans);
}


Measured memory_bytes: 10492
while(True):
	n = int(input())
	if n==0:break
	agri_list = {}
	for i in range(n):
		l,p,a,b,c,d,e,f,s,m = input().split()
		p = int(p)
		a = int(a)
		b = int(b)
		c = int(c)
		d = int(d)
		e = int(e)
		f = int(f)
		s = int(s)
		m = int(m)
		time = a + b + c + (d + e)* m
		income = s * m * f - p
		agri_list[i] = (l,income/time)
	sorted_items = sorted( agri_list.values(), key = lambda x: (-x[1],x[0]))
	for i in sorted_items:
		print(i[0])
	print("#")



Measured memory_bytes: 5624
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define mod 1000000007
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes printf("Yes\n")
#define no printf("No\n")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

const int INF=1LL<<55;

int a,b;

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

    cin>>a>>b;
    if(a<=b){
        cout<<a<<endl;
    }else{
        cout<<a-1<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    vector<int>in1(n);
    vector<int>in2(n);
    rep(i,n)cin>>in1[i]>>in2[i];
    rep(i,n)rep(j,n)if(in2[i]<in2[j]){
      swap(in1[i],in1[j]);
      swap(in2[i],in2[j]);
    }
    bool h=true;
    int co=0;
    rep(i,n){
      co+=in1[i];
      if(co>in2[i]){h=false;break;}
    }
    cout<< (h?"Yes":"No" )<<endl;
  }
}

Measured memory_bytes: 1184
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.call(in,out);
        out.close();
    }

    static class TaskA {
        public void call(InputReader in, PrintWriter out) {
           String s;
           s =in.next();
           int a =s.charAt(0);
           if(a<97)
               out.println("A");
           else{
               out.println("a");
           }


        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong(){
            return Long.parseLong(next());
        }

    }
}

Measured memory_bytes: 32844
class DisjointSetElement():
    def __init__(self, x):
        self.parent = x
        self.rank = 0


class DisjointSet():
    def __init__(self, n):
        self.elems = [DisjointSetElement(n) for n in range(n)]

    def _find_set(self, x):
        if x != self.elems[x].parent:
            self.elems[x].parent = self._find_set(self.elems[x].parent)
        return self.elems[x].parent

    def same(self, x, y):
        return self._find_set(x) == self._find_set(y)

    def _link(self, x, y):
        if self.elems[x].rank > self.elems[y].rank:
            self.elems[y].parent = x
        else:
            self.elems[x].parent = y
            if self.elems[x].rank == self.elems[y].rank:
                self.elems[y].rank += 1

    def unite(self, x, y):
        self._link(self._find_set(x), self._find_set(y))


def main():
    n, q = [int(x) for x in input().split()]
    ds = DisjointSet(n)

    for _ in range(q):
        com, x, y = [int(x) for x in input().split()]
        if com == 0:
            ds.unite(x, y)
        else:
            print(1 if ds.same(x, y) else 0)


if __name__ == '__main__':
    main()



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

int main() {
  long long N,d1,Md=0,ans=1;
  vector<int> D(100000,0);
  cin >> N >> d1;
  for(int i=1;i<N;i++){
    long long d;
    cin >> d;
    D[d]++;
    Md = max(Md,d);
  }
  
  if(d1!=0 || D[0]!=0){
    cout << 0 << endl;
    return 0;
  }
  
  D[0] = 1;
  for(int i=1;i<=Md;i++){
    long long x=1;
    for(int j=0;j<D[i];j++){
      x *= D[i-1];
      x %= 998244353;
    }
    if(D[i]==0) x = 0;
    ans *= x;
    ans %= 998244353;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
def main():
    N=int(input())
    a=list(map(int,input().split()))
    cal=1

    if a.count(0)>=1:
        print(0)
        return

    for i in range(N):
        cal*=a[i]
        if cal>10**18:
            print("-1")
            return

    print(cal)
    return


main()


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

#define mod 1000000007

using namespace std;
typedef long long ll; 
 
int main(void){
	
	int N, sho;
	
	cin >> N;
	
	ll a[N];
	
	for(int i=0; i<N; i++)
		cin >> a[i];
	
	bool zero = true;
	for(int i=0; i<N; i++)
		if(a[i] != 0)
			zero = false;
		
	if(zero){
		cout << "Yes";
		return 0;
	}
	
	if(N % 3 != 0){
		cout << "No";
		return 0;
	}else
		sho = N / 3;
	
	sort(a, a+N);
	
	bool flag = true;
	for(int i=0; i<sho-1; i++)
		if(a[i] != a[i+1])
			flag = false;
	for(int i=sho; i<2*sho-1; i++)
		if(a[i] != a[i+1])
			flag = false;
	for(int i=2*sho; i<3*sho-1; i++)
		if(a[i] != a[i+1])
			flag = false;
		
	if(!flag){
		cout << "No";
		return 0;
	}
	
	if((a[0] ^ a[sho]) == a[2*sho])
		cout << "Yes";
	else
		cout << "No";
	
	return 0;
}

Measured memory_bytes: 1024
n, m, X, Y = map(int,input().split())
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
if X>= Y:
  print('War')
else:
  xmax = max(x)
  ymin = min(y)
  if xmax >= ymin:
    print('War')
  elif xmax>=Y:
    print('War')
  elif X>= ymin:
    print('War')
  else:
    print('No War')

Measured memory_bytes: 3064
N = int(input())
H = [int(i) for i in input().split()]

before = H[-1]
for h in H[::-1]:
    if h - before > 1:
        print('No')
        break
    if h - before == 1:
        before = h - 1
    else:
        before = h
else:
    print('Yes')




Measured memory_bytes: 14396
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

int main()
{
	int n;scanf("%d",&n);
	while(n)
	{
		if(n % 10 == 7)	
		{
			cout << "Yes\n";
			return 0;
		}
		n /= 10;
	}
	cout << "No\n";
    return 0;
}


Measured memory_bytes: 3764
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 1000000007
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int,int,int,int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

ll fac[200001],inv[200001],po2[200001];
ll nCr(int n, int r)
{
	if(r>n)return 0;
	ll c = fac[n];
	c = (c*inv[r]) % MOD;
	c = (c*inv[n - r]) % MOD;
	return c;
}
int main() {
	fac[0] = inv[0] = 1;
	fup(i, 1, 200000, 1)
		fac[i] = (fac[i - 1] * i) % MOD;
	inv[200000] = POW(fac[200000], MOD - 2);
	fdn(i, 199999, 1, 1)
		inv[i] = (inv[i + 1] * (i+1)) % MOD;
	po2[0]=1;
	fup(i,1,200000,1)po2[i]=po2[i-1]*inv[2]%MOD;
	int b,w;
	scanf("%d%d",&b,&w);
	ll B=0,W=0;
	fup(i,1,b+w,1)
	{
		ll ans=(1+B-W)*inv[2]%MOD;
		if(ans<0)ans+=MOD;
		printf("%lld\n",ans);
		B=(B+po2[i]*nCr(i-1,w-1))%MOD;
		W=(W+po2[i]*nCr(i-1,b-1))%MOD;
	}
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

int main(){
  int n;
  cin >> n;
  ll a[n];
  rep(i,n) cin >> a[i];
  //  sort(a,a+n);
  ll ans=0;
  rep(i,n){    
    ans+=a[i]/2;
    if(i!=n-1){
      if(a[i]%2==1 && a[i+1]>0){
	ans++;
	a[i+1]--;
      }
    }
  }
  cout << ans << endl;
  return 0;

}


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

typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define ALL(s) (s).begin(),(s).end()
#define ALLn(s,n) s,s+n
#define F first
#define S second
#define pb push_back
#define tc(t) int t; cin >> t; while(t--)
#define _ ios_base::sync_with_stdio(false); cin.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }

const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 7;
const ll INF = LONG_LONG_MAX;

int primes[MAXN];
 
void sieve() {
	
}
void solve() {
	int n;
	cin >> n;
	int cnt=0;
	int a[n];
	map<int,int> mp;
	F0R(i,n) cin >> a[i], mp[a[i]]++;

	
	memset(primes, 1, sizeof(primes));
	for(int i = 1; i <= MAXN; ++i) {
		bool ok = 1;
		if(primes[i]&&mp.count(i)) {
			if(mp[i]>1) ok=0;
			for(int j = 2*i; j <= MAXN; j += i) {
				if(mp.count(j)) {
					primes[j] = 0;
				}
			}
			if(ok) {cnt++;}
		}
		
	}
	
	cout << cnt << "\n";
}

int32_t main() {_
	
#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif

	// tc(t)
		solve();
	cerr << "[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}



Measured memory_bytes: 17832
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

template<class T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

template<class T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll qu(ll a,ll b,ll c){
    ll c1 = c/2;
    ll c2 = c-c1;
    ll d1 = a*b*c2;
    ll d2 = a*b*c1;
    return d1-d2;
    
}

int main() {
    ll a,b,c;
    cin>>a>>b>>c;
    ll mi = a*b;
    mi = min(qu(a,b,c),mi);
    mi = min(qu(a,c,b),mi);
    mi = min(qu(c,b,a),mi);
    cout<<mi<<endl;
    
    
    

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main() {
	long long A, B;
	cin >> A >> B;
	cout << A * B / gcd(A, B) << endl;
	return 0;
}

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

using namespace std;

#define ll long long

void update(vector<int>& a){
    int n = a.size();
    vector<int> imos(n, 0);
    for (int i = 0; i < n; ++i){
        int ai = a[i];
        imos[max(0, i - ai)]++;
        if (i + ai + 1 < n)
            imos[i + ai + 1]--;
    }
    for (int i = 1; i < n; ++i)
        imos[i] += imos[i - 1];
    for (int i = 0; i < n; ++i)
        a[i] = imos[i];
    /* for (auto ai : a)
        cout << ai << " ";
    cout << endl; */
}

int main(void){
    int N, K; cin >> N >> K;
    vector<int> A(N);
    for (auto& ai : A)
        cin >> ai;
    int tmp = min(K, 100);
    while (tmp--)
        update(A);
    for (auto ai : A)
        cout << ai << " ";
    cout << endl;
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; ++i)

template<class T>
T read() {
    T x{};
    cin >> x;
    return x;
}

template<class T>
vector<T> read(int N){
    vector<T> x(N);
    for(int i = 0; i < N; ++i){
        cin >> x[i];
    }
    return x;
}

template<class T>
void write(const T &x){ cout << x << endl; }

template<class T>
void write(const vector<T> &r){
    for(const auto &x : r){
        cout << x << " ";
    }
    cout << endl;
}

int main(){
    auto N = read<ll>();
    auto S = read<string>();
    
    ll ans = 1;
    for(int i = 1; i < N; ++i){
        if(S[i-1] != S[i]) ++ans;
    }
    write(ans);
    
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<char> A(4);
  cin>>A[0]>>A[1]>>A[2]>>A[3];
  for(int i=1;i<4;i++){
    if(A[i]==A[i-1]) {
      cout<<"Bad";
      exit(0);
    }
  }
  cout<<"Good";
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

using namespace std;

int binarySearch(int *s, int s_size, int key){
    int left = 0;
    int right = s_size;
    while(left < right){
        int mid = (left + right) / 2;
        if(s[mid] == key){
            return 1;
        } else if(key < s[mid]){
            right = mid;
        } else{
            left = mid + 1;
        }
    }
    return 0;
}

int main(){

    int n;
    cin >> n;
    int *s=NULL;
    s = new int[n];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    int q;
    cin >> q;
    int *t = NULL;
    t = new int[q];
    for(int i=0;i<q;i++){
        cin >> t[i];
    }

    int counter = 0;
    for(int i=0;i<q;i++){
        counter +=binarySearch(s, n, t[i]);
    }

    cout << counter << endl;

    delete [] s;
    delete [] t;

    return 0;
}



Measured memory_bytes: 3232
#include "bits/stdc++.h"

using namespace std;

int main() {
  int N,max=100;
  cin >> N;

  for(int i=0; i< N;i++){
    int A,count=0;
    cin >> A;
    while(A%2 == 0){
      A/=2;
      count++;
    }
    if(max>count){
      max=count;
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 256
#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>;

const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main() {
  int h, w;
  cin >> h >> w;
  int si, sj;
  cin >> si >> sj;
  int ti, tj;
  cin >> ti >> tj;
  --si; --sj; --ti; --tj;
  vector<string> s(h);
  rep(i,h) cin >> s[i];
  const int INF = 1e9;
  vector<vector<int>> dist(h,vector<int>(w,INF));
  deque<P> q;
  dist[si][sj] = 0;
  q.emplace_back(si,sj);
  while (!q.empty()) {
    int i = q.front().first;
    int j = q.front().second;
    int d = dist[i][j];
    q.pop_front();
    rep(v,4) {
      int ni = i+di[v], nj = j+dj[v];
      if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
      if (s[ni][nj] == '#') continue;
      if (dist[ni][nj] <= d) continue;
      dist[ni][nj] = d;
      q.emplace_front(ni,nj);
    }
    for (int ei = -2; ei <= 2; ++ei) {
      for (int ej = -2; ej <= 2; ++ej) {
        int ni = i+ei, nj = j+ej;
        if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
        if (s[ni][nj] == '#') continue;
        if (dist[ni][nj] <= d+1) continue;
        dist[ni][nj] = d+1;
        q.emplace_back(ni,nj);
      }
    }
  }
  int ans = dist[ti][tj];
  if (ans == INF) ans = -1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9532
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned uint;
typedef pair<int, int> pairInt;
typedef pair<uint, uint> pairUInt;
#define FOR(i,n) for(int i=0; i<int(n); i++)
#define FOR1(i,m,n) for(int i=int(m); i<int(n); i++)

typedef struct _Vertex {
    int id;
    struct _Vertex *parent = nullptr;
    vector<struct _Vertex*> children;
} Vertex;

const int MAXN=1e5;
Vertex V[MAXN];

Vertex* getRoot(Vertex *v) {
    while (v->parent != nullptr) {
        v = v->parent;
    }
    return v;
}

bool dp(Vertex *root) {
    Vertex *leaf = root;
    if (root->children.size() == 0)
        return true;
    
    while (leaf->children.size() != 0)
        leaf = leaf->children[0];

    Vertex *v = leaf->parent;
    FOR1(i,1,v->children.size()) {
        v->children[i]->parent = nullptr;
        if (dp(v->children[i]) == true)
            return true;
    }
    
    if (v->parent != nullptr) {
        Vertex *p = v->parent;
        auto it = p->children.begin();
        for(; *it != v; it++);
        p->children.erase(it);
        if (dp(getRoot(p)) == true)
            return true;
    }
    
    return false;
}

int main(int argc, char *argv[])
{
    int N;
    cin >> N;

    FOR(i,N) V[i].id = i+1;
    
    FOR(i,N-1) {
        int a, b;
        cin >> a >> b;

        Vertex *v = &V[a-1];
        Vertex *w = &V[b-1];
        w->children.push_back(v);
        while (v->parent != nullptr) {
            Vertex *p = v->parent;
            auto it = p->children.begin();
            for (; *it != v; it++);
            p->children.erase(it);
            v->children.push_back(p);            
            v->parent = w;
            w = v;
            v = p;
        }
        v->parent = w;
    }

    if (dp(getRoot(&V[0])) == true)
        cout << "First\n";
    else
        cout << "Second\n";
    
    return 0;
}


Measured memory_bytes: 6912
n,m = map(int, input().split())
l = list()
for i in range(n):
  a,b = map(int, input().split())
  l.append([a,b])
l.sort()
money = 0
for i in range(n):
  x = l[i][1]
  if m > x:
    m -= x
    money += l[i][0]*x
  else:
    money += l[i][0] * m
    break
print(money)

Measured memory_bytes: 88824
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
const int INF = 1e8;

Graph G;

void dfs(int v,vector<bool> &seen, int &res){
  bool end = true;
  for(int i=0;i<seen.size();i++) if(!seen[i] && i != v) end = false;
  if(end) {
    res++;
    return;
  }
  seen[v] = true;
  for(auto nv: G[v]){
    if(seen[nv]) continue;
    dfs(nv,seen,res);
  }
  seen[v] = false;
}

int main(){
  int N,M; cin >> N >> M;
  G.assign(N,vector<int>());
  for(int i=0;i<M;i++){
    int a,b;cin >> a >> b,a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<bool> seen(N,false);
  int res = 0;
  dfs(0,seen,res);
  cout << res << endl;
}

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b==c){
    cout<<"Yes"<<endl;
  }else if(a+c==b){
    cout<<"Yes"<<endl;
  }else if(b+c==a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;

	long long int n, a[100005] = {}, b[100005] = {}, ans = 0,g=0;;

int main() {
	

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = n - 1; i >= 0; i--) {
		a[i ] +=g;
		if (a[i]%b[i]==0)continue;
		g+= abs(a[i] % b[i]-b[i]);
		
		ans += abs(a[i] % b[i]-b[i]);
		//cout << ans<<endl;
	}
	cout << ans << endl;

	return 0;

}




Measured memory_bytes: 1792
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[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)*}};}
#[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,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;

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

    let mut cnt1 = vec![0;n];
    let mut cnt2 = vec![0;n];

    for i in 0..n {
        for j in 0..n {
            if a[i] > a[j] {
                cnt1[i] += 1;
                if i < j { cnt2[i]+=1; }
            }
        }
    }
    //debug!(cnt1);
    //debug!(cnt2);
    let mut ans = 0i64;
    for i in 0..n {
        ans += (cnt2[i]*k)%MOD;
        let mut kk = k*(k-1)/2;
        kk %= MOD;
        ans += (cnt1[i]*kk)%MOD;
        ans %= MOD;
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
MOD = 10**9+7
n = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
cnt = 0
a, b = pow(2, n-1, MOD), 0 if n <= 1 else pow(2, n-2, MOD)
for i, x in enumerate(c):
    cnt += (a + b*i) * x
    cnt %= MOD

print(cnt * pow(2, n, MOD) % MOD)


Measured memory_bytes: 27108
import scala.io.StdIn._
object Main extends App {
  val n = readInt()
  val playerScore = readInt()
  val others = Array.tabulate(n - 1){_ ⇒
    val param = readLine.trim.split(' ').map(_.toInt)
    (param.head, param.tail.map(_ / 100.0))
  }
  implicit val memo = Array.fill(1 << (n - 1)){-1.0}
  memo(0) = 1.0

  println(solve(BitSet(n - 1), playerScore, others).formatted("%.10f"))

  class BitSet private (val toInt: Int) extends Iterable[Int] {
    override def iterator: Iterator[Int] = {
      var result = Nil: List[Int]
      var state = toInt
      var count = 0
      while (state > 0) {
        if ((state & 1) == 1) {
          result ::= count
        }
        count += 1
        state /= 2
      }
      result.iterator
    }
    def +(value: Int) = new BitSet(toInt | (1 << value))
    def -(value: Int) = new BitSet(toInt & ~(1 << value))
    def isSet(value: Int) = (toInt & (1 << value)) != 0
    def subset: List[BitSet] = {
      var result = Nil: List[BitSet]
      var state = 0
      while (state != toInt) {
        result ::= new BitSet(state)
        state = (state | ~toInt) + 1
        state &= toInt
      }
      result
    }
  }
  object BitSet {
    def apply(): BitSet = new BitSet(0)
    def apply(size: Int): BitSet = new BitSet((1 << size) - 1)
  }
  def solve(rest: BitSet, playerScore: Int, probability: Array[(Int, Array[Double])])(implicit memo: Array[Double]): Double = {
    if (memo(rest.toInt) >= 0) {
      memo(rest.toInt)
    }else {
      val maxScore = rest.map(i ⇒ probability(i)._1).max
      val nexts = (0 until 3).map { hand ⇒
        List(
          if (maxScore > playerScore) 0 else probabilityForDraw(rest, hand, probability),
          rest.subset.map{subset ⇒
            probabilityForWin(rest, subset, hand, probability) * solve(subset, playerScore, probability)
          }.sum).sum
      }
      memo(rest.toInt) = nexts.max
      memo(rest.toInt)
    }
  }
  def probabilityForWin(all: BitSet, winner: BitSet, winnersHand: Int, probability: Array[(Int, Array[Double])]): Double = {
    var result = 1.0
    for (player ← all) {
      if (winner.isSet(player)) {
        result *= probability(player)._2(winnersHand)
      }else {
        result *= probability(player)._2((winnersHand + 2) % 3)
      }
    }
    result
  }
  def probabilityForDraw(player: BitSet, hand: Int, probability: Array[(Int, Array[Double])]): Double = {
    var allSame = 1.0
    var notWin = 1.0
    var notLose = 1.0
    for (p ← player){
      allSame *= probability(p)._2(hand)
      notWin *= probability(p)._2(hand) + probability(p)._2((hand + 1) % 3)
      notLose *= probability(p)._2(hand) + probability(p)._2((hand + 2) % 3)
    }
    1 - notWin - notLose + 2 * allSame
  }

}


Measured memory_bytes: 455280
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;


int main() {
    string S;
    cin >> S;
    set<char> C;
    for (char c : S) {
        C.insert(c);
    }
    if (S.size() == C.size()) {
        cout << "yes" << endl;
    } else {
        cout << "no" << endl;
    }
}


Measured memory_bytes: 760
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    int k = sc.nextInt();
    String ans = "Yay!";
    if((e - a) > k) ans = ":(";
    System.out.println(ans);
  }
}

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

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int n;
    cin>>n;
    cout<<(n -1) * (n ) /2 <<endl;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];

		for (int i = 0; i < N; i++) {
			A[i] = 0;
		}

		sc.nextLine();

		int tmp = 0;
		for (int i = 0; i < N - 1; i++) {
			tmp = sc.nextInt();
			A[tmp-1]++;
		}

		for (int i = 0; i < N; i++) {
			System.out.println(A[i]);

		}

		sc.close();
	}

}


Measured memory_bytes: 60808
n, m = gets.chomp.split(" ").map{|v| v.to_i}
students  = []
n.times do
  students << gets.chomp.split(" ").map{|v| v.to_i}
end
checkpoints = []
m.times do
  checkpoints  << gets.chomp.split(" ").map{|v| v.to_i}
end

students.each do |student|
  min_distance = nil
  answer_checkpoint = nil
  checkpoints.each_with_index do |checkpoint, i|
    distance = (student[0] - checkpoint[0]).abs + (student[1] - checkpoint[1]).abs
    if not min_distance or distance < min_distance then
      min_distance = distance 
      answer_checkpoint = i+1
    end
    break if min_distance == 0
  end
  puts answer_checkpoint
end


Measured memory_bytes: 3836
coins = [100, 101, 102, 103, 104, 105]
MAX = 100000
# 100の判定
result = list()
for i in range(MAX + 1):
    if(i % coins[0] == 0) : result.append(1)
    else : result.append(0)

# 101以降
for coin in coins[1:]:
    for j in range(coin, MAX+1):
        result[j] += result[j-coin]

X = int(input())
if(result[X] >= 1): print('1')
else : print('0')



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

using namespace std;

unordered_map<long long , long long> dp;
long long n,a,b,c,d;

long long calc(long long value){
    if (value == 0)return 0;
    if (value == 1)return d;


    if (dp.count(value))return dp[value];


//    long long l2 = floor(1.0*value / 2)*2;
//    long long r2 = ceil(1.0*value / 2)*2;

//    long long l3 = floor(1.0*value / 3)*3;
//    long long r3 = ceil(1.0*value / 3)*3;
//
//    long long l5 = floor(1.0*value / 5)*5;
//////    long long r5 = ceil(1.0*value / 5)*5;

    long long l2,r2,l3,r3,l5,r5;

    l2 = (value/2)*2;
    r2 = ((value+1)/2)*2;
    l3 = (value/3)*3;
    r3 = ((value+2)/3)*3;
    l5 = (value/5)*5;
    r5 = ((value+4)/5)*5;


    long long ans = 1e18;

    if (ans/d > value) ans = value * d;

    ans = min(ans , llabs(value - l2)*d + a + calc(l2/2));
    ans = min(ans , llabs(value - r2)*d + a + calc(r2/2));

    ans = min(ans , llabs(value - l3)*d + b + calc(l3/3));
    ans = min(ans , llabs(value - r3)*d + b + calc(r3/3));

    ans = min(ans , llabs(value - l5)*d + c + calc(l5/5));
    ans = min(ans , llabs(value - r5)*d + c + calc(r5/5));

    dp[value] = ans;

    return dp[value];


}









void solve(){



    cin >> n >> a >> b >> c >> d;
    dp.clear();
//    cout << "\n";
    cout << calc(n) << "\n";


}



int main()
{

    int t;
    cin >> t;

    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 4104
#include <stdio.h>
#include <stdlib.h>

#define N 100000

typedef struct{
  int id;
  int k;
  int *c;
  int parent;
  int depth;


}NODE;

void tmpa(NODE *, int);
void parent(NODE *, int);
void depth(NODE *, int);

int main(){

  int i, j;
  int n, set;
  NODE a[N];
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%d%d", &a[i].id, &a[i].k);
    
    if(a[i].k > 0){
      a[i].c = (int *)malloc(sizeof(int) * a[i].k);
      
      for(j = 0; j < a[i].k; j++){
	scanf("%d", &a[i].c[j]);
      }
    }
    
  }
  
  tmpa(a, n);
  parent(a, n);

  for(i = 0; i < n; i++){
    if(a[i].parent == -1){
      a[i].depth = 0;
      set = i;
    }
  }

  depth(a, set);
  
  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, depth = %d, ", a[i].id, a[i].parent, a[i].depth);
    if(a[i].parent == -1) printf("root, [");
    else if(a[i].k > 0) printf("internal node, [");
    else printf("leaf, [");

    if(a[i].k > 0){
      for(j = 0; j < a[i].k; j++){
	printf("%d", a[i].c[j]);
	if(j != a[i].k - 1) printf(", ");
	else printf("]\n");
      }

    }
    else printf("]\n");

  }  

  return 0;
}

void tmpa(NODE *a, int n){

  int i;
  NODE tmp;
  
  for(i = 0; i < n; i++){
    if(a[i].id != i){
      tmp = a[a[i].id];
      a[a[i].id] = a[i];
      a[i] = tmp;
    }
    
  }
  
}

void parent(NODE *a, int n){

  int i, j;

  for(i = 0; i < n; i++){
    a[i].parent = -1;
  }

  for(i = 0; i < n; i++){
    if(a[i].k > 0){
      for(j = 0; j < a[i].k; j++){
	a[a[i].c[j]].parent = a[i].id;
      }

    }

  }

}

void depth(NODE *a, int n){

  int i;

  if(a[n].k > 0){

    for(i = 0; i < a[n].k; i++){
      a[a[n].c[i]].depth = a[n].depth + 1;
      depth(a, a[n].c[i]);
    }

  }
    
}

Measured memory_bytes: 3848
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000000000000ll
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
//#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;
  cin >> n;
  for (ll i = sqrt(n) + 1; i >= 1; i--) {
    if (n % i == 0) {
      cout << to_string(max(i, n / i)).size() << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3688
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST(N)

ans = cnt = 0
for i in range(N):
    if A[i] == 0:
        ans += cnt // 2
        cnt = 0
    else:
        cnt += A[i]
ans += cnt // 2

print(ans)


Measured memory_bytes: 7152
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	int a, b, c, k; cin >> a >> b >> c >> k;

	if (a + b >= k)
		cout << min(a, k) << '\n';

	else
	{
		int mr = k - a - b;

		cout << a - mr << '\n';
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x(x % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) {
      return 1;
    }
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) {
      a *= *this;
    }
    return a;
  }

  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) { return mint(*this) /= a; }
};

istream& operator>>(istream& is, mint& a) {
  return is >> a.x;
}
ostream& operator<<(ostream& os, const mint& a) {
  return os << a.x;
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
      fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
      ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n)
      return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main() {
  int x, y;
  cin >> x >> y;
  if ((x + y) % 3) {
    cout << 0 << endl;
    return 0;
  }
  int n = (x + y) / 3;
  x -= n;
  y -= n;
  if (x < 0 || y < 0) {
    cout << 0 << endl;
    return 0;
  }
  combination c(x + y);
  mint ans = c(x + y, x);
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 13796
unittest
{
	assert( [ "5 2", "1 4", "2 5" ].solve == 1 );
	assert( [ "9 5", "1 8", "2 7", "3 5", "4 6", "7 9" ].solve == 2 );
	assert( [ "5 10", "1 2", "1 3", "1 4", "1 5", "2 3", "2 4", "2 5", "3 4", "3 5", "4 5" ].solve == 4 );
}



import std.algorithm;
import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto m = 0L;
	input.front.formattedRead!"%s %s"( n, m );
	auto abs = new long[ 2 ][ m ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
		ab[] -= 1;
	}
	abs.sort();
	
	auto ans = 0L;
	auto b = long.max;
	foreach( i; 0L .. n + 1 )
	{
		if( i == b )
		{
			b = long.max;
			ans++;
		}
		while( !abs.empty && abs.front[ 0 ] <= i )
		{
			b = min( b, abs.front[ 1 ] );
			abs.popFront;
		}
	}
	return ans;
}


Measured memory_bytes: 5448
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,k;
    int p[1001];
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    sort(p,p+n);
    int s=0;
    for(int i=0;i<k;i++){
        // cout<<p[i]<<" ";
        s=s+p[i];
    }
    cout<<s<<"\n";
}












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

int main(){
  const long M=1e18;
  int N;cin>>N;
  vector<long> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  sort(A.begin(),A.end());
  long ans=1;
  for(int i=0;i<N;i++){
    if(A.at(i)==0){
      ans=0;
      break;
    }
    else if(M/ans+1<=A.at(i)){
      ans=-1;
      break;
    }
    else ans*=A.at(i);
  }
  cout<<ans<<endl;
}
  

Measured memory_bytes: 3968
max = 300;
max_log2 = max.toString(2).length - 1;

series = [1, 2];
col = ['#', '#.'];
j = 2;
str = '#.';
for (i = 2; i <= max_log2; i++) {
	series.push(j *= 2);
	col.push(str = str + str);
}
series.push(series[series.length-1] * 2);

function get_column(w) {
	var i, res;
	res = "";
	for (i = 1; i < series.length; i++) {
		if (w < series[i]) break;
		if (w % series[i+1] >= series[i])
			res = res + col[i];
	}
	if (w % 2 === 1) res = res + '#';
	return res;
}

line = require('fs').readFileSync('/dev/stdin', 'ascii').split('\n');
for (i in line) {
	if (line[i] === '0 0') break;
	hw = line[i].split(' ').map(Number);
	even = get_column(hw[1]);
	odd = even.slice(1) + ((hw[1] % 2 === 0) ? '#' : '.');
	for (j = 0; j < hw[0]; j++) {
		if (j % 2 === 0) console.log(even);
		else console.log(odd);
	}
	console.log("");
}

Measured memory_bytes: 17100
N = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_f)
mean = a.inject(:+) / N

b = a.map{|x| (x - mean).abs}

bmin = b.max
ans = 0

b.each_with_index do |x, i|
  if x < bmin
    bmin = x
    ans = i
  end
end
puts ans 

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl

using namespace std;
using ll = long long;


int main(){
    string s;
    cin >> s;
    set<char> c;
    for (int i=0;i<s.size();++i) {
        c.insert(s[i]);
    }

    Yes(c.size() == 2);
}

Measured memory_bytes: 256