akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll n;
ll a[2*MAX];
ll b[2*MAX];
vl ans;
int main(){FAST;
cin>>n;
for(ll i=1;i<=n;i++){
	cin>>a[i];
}
for(ll i=n;i>=1;i--){
	ll sum = 0;
	for(ll j=i+i;j<=n;j+=i){
		sum+=b[j];
	}
	sum%=2;
	if(a[i] == sum){
		b[i]=0;
	}
	else{
		b[i]=1;
		ans.pb(i);
	}
}
sort(all(ans));
cout<<ans.size()<<'\n';
for(auto it:ans)cout<<it<<' ';
return 0;
}

Measured memory_bytes: 5108
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<math.h>
using namespace std;

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	int i = A;
	if (B - A <= K) {
		for (int i = A; i <= B; i++) {
			cout << i << endl;
		}
		return 0;
	}
	while (i < A + K) {
		cout << i << endl;
		i++;
	}
	if (i < B - K+1)i = B - K+1;
	while (i <= B) {
		cout << i << endl;
		i++;
	}
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl "\n"
#define all(v) v.begin(),v.end()
#define mp make_pair
#define mm(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define repn(i,a,b) for(ll i = a; i >= b; i--)
#define pb push_back
#define f first
#define s second
#define inp(a) cin >> a
#define out(a) cout<<a<<endl
#define in_edges(m) repp(i, 1, m){ ll a, b; cin >> a >> b; adj[a].pb(b), adj[b].pb(a);}
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define MOD 1000000007
ll power(ll x,ll y); 
int main()
{
	    // freopen("in.txt","r",stdin);
	    // freopen("out","w",stdout);
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	    ll t;t=1;
	    // cin >> t;
	    while(t--)
	    {
	    	ll n,m;
	    	cin >> n>>m;
	    	ll a[n],sum=0;
	    	rep(i,0,n)
	    	{
	    		cin >> a[i];
	    		sum+=a[i];
	    	}
			ll count=0;
	    	rep(i,0,n)
	    	{
	    		if(a[i]>=(sum/(4.0*m)))
	    			count++;
	    	}
	    	if(count>=m)
	    		cout <<"Yes\n";
	    		else
	    			cout <<"No\n";
	    	

	    }

}
ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}


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

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

    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a.at(i);

    sort(a.begin(), a.end());

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        x -= a.at(i);

        if (x < 0)
            break;
        else
            cnt++;
    }

    if (x > 0)
        cnt--;

    cout << cnt << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

class LazySegTree{
private:
	int n;
	vector<ll> node, lazy;
	vector<bool> lazyFlag;
public:
	LazySegTree(vector<ll> v){
		int sz = v.size();
		n = 1; while(n < sz) n *= 2;
		node.resize(2*n-1, 0);
		lazy.resize(2*n-1, 0);
		lazyFlag.resize(2*n-1, false);
		REP(i, sz) node[i+n-1] = v[i];
		for(int i = n-2;i >= 0;i--) node[i] = node[2*i+1]+node[2*i+2];
	}

	void eval(int k, int l, int r){
		if(lazyFlag[k]){
			node[k] += lazy[k] * (r-l);
			if(r-l > 1){
				lazy[2*k+1] += lazy[k];
				lazy[2*k+2] += lazy[k];
				lazyFlag[2*k+1] = lazyFlag[2*k+2] = true;
			}
			lazy[k] = 0;
			lazyFlag[k] = false;
		}
	}

	void add(int a, int b, ll x, int k=0, int l=0, int r=-1){
		if(r < 0) r = n;
		eval(k, l, r);
		if(b <= l || r <= a) return;

		if(a <= l && r <= b){
			lazy[k] += x;
			lazyFlag[k] = true;
			eval(k, l, r);
		}else{
			add(a, b, x, k*2+1, l, (l+r)/2);
			add(a, b, x, k*2+2, (l+r)/2, r);
			node[k] = node[k*2+1] + node[k*2+2];
		}
	}

	ll query(int a, int b, int k=0, int l=0, int r=-1){
		if(r < 0) r = n;
		eval(k, l, r);

		if(b <= l || r <= a) return 0;
		if(a <= l && r <= b) return node[k];

		return query(a, b, k*2+1, l, (l+r)/2) + query(a, b, k*2+2, (l+r)/2, r);
	}
};

struct query{
	int v, d, c;
};

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M, Q;
	vector<int> G[114514];
	int c[114514] = {};
	cin >> N >> M;
	REP(i, M){
		int a, b;
		cin >> a >> b;a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	cin >> Q;
	query q[114514];
	REP(i, Q){
		cin >> q[i].v >> q[i].d >> q[i].c; q[i].v--;
	}
	reverse(q, q+Q);
	int d[114514];
	fill(d, d+114514, -1);
	REP(i, Q){
		queue<PII> que;
		que.push({q[i].d, q[i].v});
		while(que.size()){
			PII p = que.front(); que.pop();
			if(d[p.second] >= p.first || p.first < 0) continue;
			if(d[p.second] == -1) c[p.second] = q[i].c;
			d[p.second] = p.first;
			REP(j, G[p.second].size()){
				que.push({p.first-1, G[p.second][j]});
			}
		}
	}
	REP(i, N){
		cout << c[i] << endl;
	}
}


Measured memory_bytes: 9592
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll ,ll> pll;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
#define REP(i,x,y) for(ll i = x;i <= y;++i)
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z))
        ;
    return res;
}
void debug_out(vector<string> args, int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
void localTest() {
    #ifndef ONLINE_JUDGE
        freopen("inp", "r", stdin);
        freopen("out", "w", stdout);
    #endif      
}
int main() {

    localTest();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >> s;
    ll val = s[0] - 'a';
    if(val >= 0 && val <= 25) cout << "a\n";
    else cout << "A\n";   
    
    return 0;
}

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

int main(){

    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;

    if(((0 <= x-r)&&(x+r <= W))&&((0 <= y-r)&&(y+r <= H))){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3116
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
int main() {
	int n, k; cin >> n >> k;
	rep1(i, n) {
		int x; cin >> x;
	}
	int cnt = 1; n -= k;
	cnt += (n + k-2) / (k - 1);
	cout << cnt << endl;
	return 0;
}

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

#define _ << ": " <<
#define watch1(var1) cerr << (#var1) _ var1 << '\n'
#define watch2(var1, var2) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << '\n'
#define watch3(var1, var2, var3) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << ", " << (#var3) _ var3 << '\n'
#define wloop(size, arr) cerr << (#arr) << ": "; for (int i = 0; i < int(size); i++) cerr << arr[i] << " \n"[i+1 == int(size)]

template<typename... Args>
void read(Args&... args) { ((cin >> args), ...); }

template<typename... Args>
void show(Args... args) { ((cout << args << " "), ...); }

#define ll long long
#define ints(a...) int a; read(a)
#define IN(a) for (auto &it : a) cin >> it

void solve() {
    ints(n, cap);
    vector<array<int, 2>> v(n + 1);
    vector<vector<ll>> dp(101, vector<ll>(100001, 1e18));
    for (int i = 1; i <= n; i++) read(v[i][0], v[i][1]);

    int tot = 0;
    for (int i = 1; i <= n; i++) tot += v[i][1];

    dp[0][0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= tot; j++) {
            dp[i][j] = dp[i - 1][j];
            if (j >= v[i][1])  
                dp[i][j] = min(dp[i][j], v[i][0] + dp[i - 1][j - v[i][1]]);
        }
    }

    for (int i = tot; ~i; i--) if (dp[n][i] <= cap) {
        show(i);
        return;
    }
}

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

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

using ll = long long;

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

  int num_action=3;
  vector<vector<int>> a(n+1,vector<int>(num_action));
  for(int i=1;i<=n;i++) cin >> a[i][0] >> a[i][1] >> a[i][2];

  vector<vector<int>> dp(n+1,vector<int>(num_action,0));

  rep(j,num_action) dp[1][j] = max(dp[1][j],a[1][j]);
  for(int i=2;i<=n;i++){
    rep(j,num_action){
      rep(k,num_action){
	if(j!=k){
	  dp[i][j] = max(dp[i-1][k]+a[i][j],dp[i][j]);
	}
      }
    }
  }
  
  ll ans=0;
  rep(j,num_action){
    ans = max((ll)dp[n][j],ans);
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <queue>
#include <stack>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31)) /*オーバーフローしない程度に大きい数*/
#define MOD 1000000007
int main(void){
    // Your code here!
    
    while(1){
        char line[200];
        rep(i,0,200) line[i] = 0;
        // string str(100,0);
        cin.getline(line,sizeof(line));
        // rep(i,0,100){
        //     if(line[i]!=0){
        //         str.push_back(line[i]);    
        //     }
        // }
        // cout << str << endl;
        // if(str[0]=='.') break;
        if(line[0]=='.') break;
        int maru=0,kaku=0,f=0,last=0;//0:( 1:[
        stack<int> q;
        int i = 0;
        while(1){
                if(line[i]=='('){
                    maru++;
                    q.push(0);
                    // cout << "maru" << maru << endl;
                    
                } 
                if(line[i]=='['){
                    kaku++; 
                    q.push(1);
                    // cout << "kaku" << kaku << endl;
                } 
                if(line[i]==')'){
                    maru--;
                    if(!(q.empty())){
                        if(q.top()==1) f=1;    
                        q.pop();
                    }  
                    // cout<< "maru" << maru << endl;
                } 
                if(line[i]==']'){
                    kaku--;
                    if(!(q.empty())){
                        if(q.top()==0) f=1;    
                        q.pop();
                    }
                    // cout<< "kaku" << kaku << endl;
                } 
                if(maru<0){
                    f=1;   
                }
                if(kaku<0){
                    f=1;    
                }
                if(line[i]=='.'){
                    f=1;
                }
                if(f==1) break;
                i++;
        }
        if(maru==0&&kaku==0){
            cout << "yes" << endl;
        } else{
            cout << "no" << endl;
        }
        
    }
    
}



Measured memory_bytes: 3084
package main

import "fmt"

var (
	n, a, b, c int
	l          []int
)

func minTwo(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min(a ...int) int {
	result := a[0]
	for i := 1; i < len(a); i++ {
		result = minTwo(result, a[i])
	}
	return result
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func dfs(depth, sa, sb, sc int) int {
	if depth == n {
		if min(sa, sb, sc) == 0 {
			return 1000000000
		}
		return abs(sa-a) + abs(sb-b) + abs(sc-c) - 30
	}
	return min(
		dfs(depth+1, sa+l[depth], sb, sc)+10,
		dfs(depth+1, sa, sb+l[depth], sc)+10,
		dfs(depth+1, sa, sb, sc+l[depth])+10,
		dfs(depth+1, sa, sb, sc),
	)
}

func main() {
	fmt.Scan(&n, &a, &b, &c)

	l = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&l[i])
	}

	fmt.Println(dfs(0, 0, 0, 0))
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<unordered_set>
using namespace std;
#define ll long long
#define ld long double
#define ss second
#define ff first
#define all(a) a.begin() , a.end()
#define All(a) a.rbegin() , a.rend()
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.precision(10),cout << fixed 
int main()
{
    ios;
    int x, y;
    cin >> x >> y;
    for (int i = 0; i <= x; ++i)
    {
        int j = x - i;
        if (i * 2 + j * 4 == y)
        {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 3576
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

const (
	MAX = 10000
	NIL = -1
)

type Node struct {
	p int
	l int
	r int
}

var n int
var T = make([]Node, MAX)

func preParse(u int) {
	if u == NIL {
		return
	}
	fmt.Printf(" %d", u)
	preParse(T[u].l)
	preParse(T[u].r)
}

func inParse(u int) {
	if u == NIL {
		return
	}
	inParse(T[u].l)
	fmt.Printf(" %d", u)
	inParse(T[u].r)
}

func postParse(u int) {
	if u == NIL {
		return
	}
	postParse(T[u].l)
	postParse(T[u].r)
	fmt.Printf(" %d", u)
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	var v, l, r, root int
	var err error

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	for i := 0; i < n; i++ {
		T[i].p = NIL
	}

	var ss []string
	for i := 0; i < n; i++ {
		sc.Scan()
		ss = strings.Split(sc.Text(), " ")
		v, err = strconv.Atoi(ss[0])
		checkLog(err)
		l, err = strconv.Atoi(ss[1])
		checkLog(err)
		r, err = strconv.Atoi(ss[2])
		checkLog(err)
		T[v].l = l
		T[v].r = r
		if l != NIL {
			T[l].p = v
		}
		if r != NIL {
			T[r].p = v
		}
	}

	for i := 0; i < n; i++ {
		if T[i].p == NIL {
			root = i
		}
	}

	fmt.Println("Preorder")
	preParse(root)
	fmt.Println("")
	fmt.Println("Inorder")
	inParse(root)
	fmt.Println("")
	fmt.Println("Postorder")
	postParse(root)
	fmt.Println("")
}

func checkLog(err error) {
	if err != nil {
		log.Fatalln(err)
	}
}



Measured memory_bytes: 1152
#include <stdio.h>


int main()
{

    int i, j, n, x, p, q, r, s, count = 0;

    scanf("%d", &n);

    int A[n];

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

    
    p = 0;

    r = n - 1;

    x = A[r];

    i = p-1;

    for (j = p; j <= r; j++){

        if (A[j] <= x){

            i = i + 1;

            s = A[i];
 
           A[i] = A[j];

            A[j] = s;
  
          //s = A[i+1];
   //A[i+1] = A[r];
   //A[r] = s;

   }
 
       
    }

    
    for(i = 0; i < n; i++){

        if(A[i] == x) count++;

        
    }

    
    for(i = 0; i < n - 1; i++){

        if(A[i] == x) count--;

        if(count == 0){
  
          if(A[i] == x) {
 
               printf("[%d] ", A[i]);

                continue;

                
            }

            
        }

        printf("%d ", A[i]);

        
    }

    printf("%d\n", A[n-1]);

    return 0;

}




Measured memory_bytes: 2144
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong bignum = 1_000_000_007;
alias Pair = Tuple!(long, "number", long, "times");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto k = lread();
    auto d = aryread();
    d.sort();
    auto half = d.length / 2;
    (d[half] - d[half - 1]).writeln();
}


Measured memory_bytes: 4292
#include <iostream>

int main(void)
{
    int N=0;
    std::cin >> N;
    int* buf= new int[N];
    
    int h=0;
    for(int i = 0; i<N; i++)
    {
      std::cin >> h;
      buf[h-1]=i+1;
    }
    for(int i =0;i<N; i++)
    {
      std::cout << buf[i] << " ";
    }
    delete[] buf;
}

Measured memory_bytes: 1152
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
s=sum(abs(a[i]-a[i+1]) for i in range(len(a)-1))
for i in range(1,n+1):
    print(s-abs(a[i]-a[i+1])-abs(a[i]-a[i-1])+abs(a[i-1]-a[i+1]))

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

using namespace std;

int gcd(int a,int b){ return b==0?a:gcd(b,a%b); }
int main(){
    int k;
    cin >> k;
    long long ans =0;
    for (int i = 1 ; i <= k;i++){
        for (int j = 1 ; j<= k ;j++){
            for (int l = 1 ; l <= k ;l++){
                ans += gcd(gcd(i,j),l);
            }
        }
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cmath>
#include<queue>
#define PI 3.141592653589793238
#define INF -1
using namespace std;

int main()
{
	int a, b, c;

	cin >> a >> b >> c;

	printf("%d", a * b / 2);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    string s;cin>>s;
    ll k;cin>>k;
    int n=s.size();

    set<char> st;
    rep(i,n){
        st.insert(s[i]);
    }
    if(st.size()==1){
        cout<<(n*k/2)<<endl;
        return 0;
    }


    string t=s;t+=s;
    int m=t.size();
    int bs2=0;
    for(int i=1;i<m;i++){
        if(t[i]==t[i-1]){
            t[i]='?';
            bs2++;
        }
    }
    int bs1=0;
    for(int i=1;i<n;i++){
        if(s[i]==s[i-1]){
            s[i]='?';
            bs1++;
        }
    }
    cout<<bs2*(k-1)-bs1*(k-2)<<endl;
    return 0;
}


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

static const int MAX = 200000;


int main() {
  int a,b;
  cin >> a >> b;
  ll num =  (ll)a * b / gcd(a, b);
  cout << num << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N; cin >> N;
  cout << N * (N - 1) / 2 << endl;
}


Measured memory_bytes: 256
s = list(input())
ans = 'Yes'
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] != 'h':
            ans = 'No'
    else:
        if s[i] != 'i':
            ans = 'No'
if len(s) % 2 != 0:
    ans = 'No'
print(ans)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
   int h,m;
   cin >> h >> m;
   if(h>m){
       cout << "a > b" << endl;
   }
   else if (h<m){
       cout << "a < b" << endl;
   }
   else{
       cout << "a == b" << endl;
   }
}


Measured memory_bytes: 3084
#include <iostream>

using namespace std;

int main()
{
    int n, m, ite;
    cin >> n >> m;
    while(m){
        cin >> ite;
        n -=  ite;
        if(n < 0){
            n = -1;
            break;
        }
        m--;
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 3632
# https://atcoder.jp/contests/abc075/tasks/abc075_c
# 各頂点を結ぶクエリー(a, bの情報)ごとに、
# それを実行しなくてもたどり着ける頂点が総頂点数(n)に一致するかを判定する。
n, m = map(int, input().split())

queries = []
for _ in range(m):
    a, b = map(int, input().split())
    queries.append((a, b))

def dfs(graph, n):
    visited = [False] * (n + 1)
    visited[0] = True # 1-indexedなので、0番目は関係ない
    stack = [1]
    num = 0
    while stack:
        t = stack.pop()
        for node in graph[t]:
            if visited[node]:
                continue
            visited[node] = True
            stack.append(node)
            num += 1
    if num == n:
        return True
    return False

ans = 0
for i in range(m):
    graph = [[] for _ in range(n + 1)]
    for j in range(m):
        if i == j:
            continue
        a, b = queries[j]
        graph[a].append(b)
        graph[b].append(a)
    if not dfs(graph, n):
        ans += 1
print(ans)

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

int main()
{
	string s;

	getline(cin, s);

	for (int i = 0; i < s.size(); i++){
		if ('a' <= s[i] && s[i] <= 'z') s[i] += 'A' - 'a';	
		cout << s[i];
	}
	cout << endl;
	return (0);
}

Measured memory_bytes: 3136
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)      type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
const double pi = 3.1415926535897932384626433;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void JH(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    vi v(5);
    fo0(i,5){
        cin>>v[i];
        if(v[i]==0){
            ans=i+1;
        }
    }
    cout<<ans;
}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<(double)(clock()-beg)/1000<<"s ";
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

// #define endl            "\n"
#define forn(i,x1,n)     for(int i=x1; i<n; i++)
#define forit(it, m)    for(decltype(m)::iterator it = m.begin(); it!=m.end(); ++it)
#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(x1)      __builtin_popcountll(x1)
#define zrobits(x1)      __builtin_ctzll(x1)
#define mod             1000000007
#define inf             1e18
#define ps(x1,y)         fixed<<setprecision(y)<<x1
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x1)            int x1; cin>>x1; while(x1--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


void zeus()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int n;
int k;
vector<int> h;
int memo[100005];
int solve(int i) {
    if (i == n) {
        return 0;
    }
    forn(j, 1, k) {
        if (i == n - j) {
            return abs(h[n] - h[n - j]);
        }
    }
    if (memo[i] != -1) {
        return memo[i];
    }
    memo[i] = INT_MAX;
    forn(j, 1, k + 1) {
        memo[i] = min(memo[i], solve(i + j) + abs(h[i + j] - h[i]));
    }
    return memo[i];
}

int32_t main() {

    zeus();
    cin >> n;
    cin >> k;
    vector<int> x(n + 1);
    memset(memo, -1, sizeof memo);
    forn(i, 1, n + 1) {
        cin >> x[i];
    }
    h = x;

    cout << solve(1) << endl;






}








Measured memory_bytes: 10312
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <vector>

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

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);

    REP(i, N)
    cin >> A[i];

    sort(ALL(A));

    vector<int> group;
    int prev = 0;
    REP(i, N) {
        if (A[i] == prev)
            group.back()++;
        else {
            group.push_back(1);
            prev = A[i];
        }
    }

    sort(ALL(group));

    int sum = 0;

    for (int i = 0; i < max(0, (int)group.size() - (int)K); i++) {
        sum += group[i];
    }

    cout << sum << endl;

    return 0;
}


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

int d;
vector<int> c;
vector< vector<int> > s;

int satisfaction(const vector<int>& t) {
  vector<int> last(26, -1);
  int ans = 0;
  for (int i = 0; i < (int) t.size(); i++) {
    ans += s[i][t[i]];
    last[t[i]] = i;
    for (int j = 0; j < 26; j++) {
      ans -= c[j] * (i - last[j]);
    }
  }
  return ans;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int myrand(int l, int r) {
  return uniform_int_distribution<int>(l, r)(rng);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  srand(time(nullptr));
  cin >> d;
  c.resize(26);
  for (int i = 0; i < 26; i++) {
    cin >> c[i];
  }
  s.assign(d, vector<int>(26));
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }
  vector<int> t;
  for (int i = 0; i < d; i++) {
    int best = 0;
    for (int j = 1; j < 26; j++) {
      if (s[i][j] > s[i][best]) {
        best = j;
      }
    }
    t.push_back(best);
  }
  for (int i = 0; i < 50000; i++) {
    int pos = myrand(0, d - 1), x = myrand(0, 25);
    vector<int> tmp = t;
    tmp[pos] = x;
    if (satisfaction(tmp) > satisfaction(t)) {
      swap(t, tmp);
    } 
  }
  for (auto& x : t) {
    cout << x + 1 << '\n';
  }
  return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
  string s;
  cin >> s;
  int n = s.length();
  map<char,int> m;
  FOR(i,0,n-1){
    ++m[s[i]];
  }

  if(max({m['a'],m['b'],m['c']})-min({m['a'],m['b'],m['c']}) <= 1) cout << "YES" << endl;
  else cout << "NO" << endl;

}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(ll i = 0; i < n; i++)
using namespace std;
typedef long long ll;
 
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count = 0;

  rep(i, N-2){
    if (S.at(i)=='A' && S.at(i+1)=='B' && S.at(i+2)=='C') count++;
    }
    cout << count << endl;  

  return 0;
}

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

#define MAX 1000000007;
int p[10000001];

ll power(ll x, ll y,ll mx){
	int res = 1;

	x = x % mx;

	while (y > 0){
		if (y & 1)
			res = (res * x)  % mx;

		y = y >> 1;

		x = (x * x) % mx;
	}
	return res;
}

void pre(){
	for (int i = 1; i <= 1000001; i++){
		for (int j = i; j <= 1000001; j += i)
			p[j]++; 
	}
}
 
int main() 
{ 
	// memset(p,0,sizeof(p));
	// pre();
	// ll t; cin >> t;
	
	// while (t--){
		int n; cin >> n;

		if (n == 0)	cout << 1;
		else cout << 0;
	// }

} 

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B, K;
  cin >> A >> B >> K;
  for(int i = min(A, B); i >= 1; i--){
    if(A % i == 0 && B % i == 0) K -= 1;
    if(K == 0){
      cout << i << endl;
      break;
    }
  }
  return 0;
}

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

int main()
{
	int N, A, B;
	cin >> N >> A >> B;

	long long ans = 0;
	for( int i = 1; i <= N; i++ ) {
		int n = i;
		int sum = 0;
		while( n > 0 ) {
			sum += n % 10;
			n /= 10;
		}
		if( A <= sum && sum <= B ) ans += i;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3620
'''
Created on 2020/09/19

@author: harurun
'''
def if_3(t1,ans1,t2,ans2,ans3):print(ans1 if t1 else ans2 if t2 else ans3)
def if_2(t1,ans1,ans2):print(ans1 if t1 else ans2)
def YN(t):print("YES" if t else "NO")
def yn(t):print("yes" if t else "no")
def Yn(t):print("Yes" if t else "No")
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  S=pin()[:-1]
  if S[-1]=="s":
    print(S+"es")
  else:
    print(S+"s")
  return
main()

Measured memory_bytes: 9136
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937_64 mt64(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/

int n, a[55];
signed main() {
	int ans = 0;
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n) {
		for (int j = i + 1; j < n; j++)ans += a[i] * a[j];
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
const long long mod=1000000007;
typedef long long ll;

int main(){
  int a,b,c=0;
  cin>>a>>b;
  
cout<<max(a+b,max(a-b,a*b))<<endl;
}


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

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

    vector<ll> A(K);
    REP(i, K) cin >> A[i];
    
    ll L = 2, R = 3;
    for(int i = K - 2; i >= 0; i--) {
        L =  (L + A[i] - 1) / A[i] * A[i];
        R =  R / A[i] * A[i] + A[i] - 1;
    }

    ll ans1 = R;
    ll ans2 = L;
    for(int i = 0; i < K; i++) {
        ans1 = (ans1 / A[i]) * A[i];
        ans2 = (ans2 / A[i]) * A[i];
    }


    if (ans1 == 2 && ans2 == 2){
        cout << L << " " << R << endl;
    } else {
        cout << -1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1024
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef tuple<ll,ll,ll> tl3;
// https://atcoder.jp/contests/abc177/tasks/abc177_a
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string ans[2] ={"No", "Yes"};
    ll d,t,s;
    cin >> d >> t >> s;
    bool isAnswer = false;
    if(t*s >= d) isAnswer = true;
    cout << ans[isAnswer];

    return 0;
}




Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=len(s);
    string a,b;
    rep(i,n){
      if(i%2==0){
        a.push_back('1');
        b.push_back('0');
      }else{
        a.push_back('0');
        b.push_back('1');
      }
    }
    int c=0,d=0;
    rep(i,n){
      if(s[i]!=a[i]){
        c++;
      }
      if(s[i]!=b[i]){
        d++;
      }
    }
    cout<<min(c,d)<<endl;
}

Measured memory_bytes: 720
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i+1]<p[i] and p[i]<p[i-1]):
    ans+=1
print(ans)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

LL N, A[312][312];
bool removeFlag[312][312];
LL ans;

bool warshall_floyd(LL V)
{
	for (LL k = 0; k < V; ++k)
	{
		for (LL i = 0; i < V; ++i)
		{
			for (LL j = 0; j < V; ++j)
			{
				if (A[i][j] == A[i][k] + A[k][j] && i != k&&k != j) { removeFlag[i][j] = true; }
				if (A[i][j] > A[i][k] + A[k][j]) { return false; }
			}
		}
	}
	return true;
}

int main()
{
	memset(removeFlag, false, sizeof(removeFlag));
	in >> N;
	rep(i, N) { rep(j, N) { in >> A[i][j]; } }

	if (!warshall_floyd(N)) { ans = -1; }
	else
	{
		rep(i, N)
		{
			rep(j, i)
			{
				if (!removeFlag[i][j]) { ans += A[i][j]; }
			}
		}
	}

	out << ans << std::endl;
	return 0;
}

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

void main()
{
    auto nk = readln.split.to!(int[]);
    auto N = nk[0];
    auto K = nk[1];

    int r;
    foreach (h; readln.split.to!(int[])) if (h >= K) ++r;
    writeln(r);
}

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

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

  int result = 0;
  for (int i = 1; i <= n; ++i) {
    string s = to_string(i);
    if (s.size() % 2 == 1) {
      result++;
    }
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <bitset>
#include <math.h>
#include <numeric>

using namespace std;
 
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define endl '\n'
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<ll> a(n+1);
    rep(i,n)cin>>a[i];
    rep(i,n-1)a[i+1]+=a[i];//累積和の取り方
    a[n]=0;
    sort(a.begin(),a.end());
    ll ans=0,cnt=0,pos=1e9;
    rep(i,n+1){
        if(a[i]==pos)cnt++;//累積和が同じのがあればcnt++
        else{
            ans+=cnt*(cnt-1)/2;
            cnt=1;
            pos=a[i];
        }
    }
    ans+=cnt*(cnt-1)/2;//最後の分を拾う
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
/*
        Author: Prokash
                CSE48, JU

*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
    FAST;
    int num;
    cin>>num;
    int d=(num%10);
    num/=10;
    int c=(num%10);
    num/=10;
    int b=(num%10);
    num/=10;
    int a=(num%10);
    num/=10;
    if(a+b+c+d==7)
    {
        cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
    }
    else if(a+b+c-d==7)
    {
        cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
    }
    else if(a+b-c+d==7)
    {
        cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
    }
    else if(a+b-c-d==7)
    {
        cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
    }
    else if(a-b+c+d==7)
    {
        cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
    }
    else if(a-b+c-d==7)
    {
        cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
    }
    else if(a-b-c+d==7)
    {
        cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
    }
    else if(a-b-c-d==7)
    {
        cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
N, X = map(int, input().split())
x1 = list(map(int, input().split()))
x2 = [0]*N
for i in range(N):
  x2[i] = abs(x1[i]-X)
import fractions
ans = x2[0]
for i in range(N-1):
  ans = fractions.gcd(ans,x2[i+1])
print(ans)

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

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main(){
	double L;
	cin >> L;
	double l=L/3;
	cout << setprecision(20) << l*l*l << endl;

	return 0;
}

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

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> grid(H);
	rep(i, H) {
		cin >> grid[i];
	}
	vector<bool> row(H, false);
	vector<bool> column(W, false);
	rep(i, H) {
		rep(j, W) {
			if (grid[i][j] == '#') {
				row[i] = true;
				column[j] = true;
			}
		}
	}
	rep(i, H) {
		bool flag = false;
		rep(j, W) {
			if (row[i] && column[j]) {
				cout << grid[i][j];
				flag = true;
			}
		}
		if (flag) {
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = []
for i in range(2):
    a.append([int(k) for k in input().split()])

cuml = [[0]*(n+1) for i in range(3)]

for i in range(1, 3):
    for k in range(1, n+1):
        cuml[i][k] = max(cuml[i-1][k], cuml[i][k-1]) + a[i-1][k-1]

print(cuml[2][n])


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

using namespace std;

#define debug(x) cout << #x << "::" << x << endl;
#define debug2(x, y) cout << #x << "::" << x << " " << #y << "::" << y << endl;
#define debug3(x, y, z) cout << #x << "::" << x << " " << #y << "::" << y <<" "<< #z << "::" << z << endl;

#define For(i, a, b) for (int i = a; i < b; i++)

typedef long long ll;
const ll mod = 1e9 + 7;
const int MAX = 5 * 1e3 + 5;
typedef pair<int, int> pii;

void add(ll &a, ll b)
{
    a = (a + b) % mod;
    if (a < 0) a += mod;
}

int main() {

    int n;
    cin>>n;

    vector<int> a(n+1);
    for(int i=1;i<=n;i++) cin>>a[i];

    vector<int> dp(n+1);

    for(int i=2;i<=n;i++){
        if(i == 2) dp[i] = abs(a[i] - a[i-1]); 
        else dp[i] = min(abs(a[i] - a[i-1]) + dp[i-1],abs(a[i] - a[i-2]) + dp[i-2]);
    }

    cout<<dp[n]<<endl;

    return 0;
    
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ll N, M;
using Graph = vector<Vi>;
Graph g;
int indeg[100010];
int par[100010];
int used[100010];

void solve() {
    cin >> N >> M;
    g.resize(N);
    for (ll i = 0; i < N - 1 + M; i++) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        g[u].emplace_back(v);
        ++indeg[v];
    }

    int root;
    for (ll i = 0; i < N; i++) {
        if (indeg[i] == 0) {
            root = i;
            break;
        }
    }

    for (ll i = 0; i < N; i++) {
        par[i] = -1;
    }
    par[root] = root;

    queue<int> q;
    q.emplace(root);
    while (!q.empty()) {
        int idx = q.front();
        q.pop();
        for (const auto& v : g[idx]) {
            par[v] = idx;
            --indeg[v];
            if (indeg[v] == 0) {
                q.emplace(v);
            }
        }
    }

    for (ll i = 0; i < N; i++) {
        if (i == root) {
            cout << 0 << "\n";
        }
        else {
            cout << par[i] + 1 << "\n";
        }
    }
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

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

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = INF + 9;
 
/////////////////////////////////////////////////////////////////////
 
const int N = 8e3 + 5, M = 2 * N;

bitset<2 * M> dpx, dpy;

int main() {
 
	sync;

	string s; cin >> s; s += 'T'; dpx[M] = dpy[M] = true;
	int x, y, d = 0; cin >> x >> y;
	bool up = false, flag = false;
	for (char c : s) {
		if (c == 'F') { d++; continue; }
		if (up) dpy = (dpy << d) | (dpy >> d);
		else if (flag) dpx = (dpx << d) | (dpx >> d);
		else x -= d;
		d = 0;
		up ^= 1;
		flag = 1;
	}
	cout << (dpx[M + x] && dpy[M + y] ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
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;
}
const int INF=1e18;
const int MOD=1e9+7;

bool isprime(int x){
    int y=x;
    for(int i=2;i<=sqrt(x);i++){
        while(y%i==0)y/=i;
    }
    if(y==x)return true;
    return false;
}

signed main(){
    int H,W;cin>>H>>W;
    int d[10][10];
    REP(i,10)REP(j,10)cin>>d[i][j];
    REP(k,10)REP(i,10)REP(j,10)chmin(d[i][j],d[i][k]+d[k][j]);
    int ans=0;
    REP(i,H*W){
        int a;cin>>a;
        if(a!=-1)ans+=d[a][1];
    }
    cout<<ans<<endl;
}

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

int main()
{
  int n;
  cin >> n;
  
  // エラーになってる数の個数を数えて、2以下かつ偶数なら1回入れ替えだけでOK
  int parity_check = 0;
  int tmp;
  for (int i = 0; i < n; i ++)
  {
    cin >> tmp;
    if (tmp != (i + 1)) parity_check ++;
  }
  
  // 偶数個ズレてる場合だけ入れ替えで対処可能
  if (parity_check <= 2 && parity_check % 2 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}


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

int main() {
	double n;
	int i;

	while(scanf("%lf", &n) != EOF) {
		i = 0;
		while(1) {
			if(9.8 * sqrt(5 * i / 4.9) >= n)
				break;
			i++;
		}

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

	return 0;
}

Measured memory_bytes: 628