akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    
    for(int i = 3; i <= n; i++){
        if(i % 3 == 0){
            cout << " " << i;
        }
        else {
            int b = 1;
            for(int j = 0; j < 5; j++){
                int a = i / b;
                if(a % 10 == 3){
                    cout << " " << i;
                    break;
                    
                }
                b *= 10;
            }
        }
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 3084
import math
from operator import itemgetter

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
 
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)
 

def f(b,n):
	if n < b:
		return n
	return f(b, n//b) + n%b
 
# 4 3
# 1 2 1420
# 2 3 1120
# 3 4 1420

N = int(input())
nums = [int(input()) for _ in range(N)]

all10 = True
for elem in nums:
	if elem % 10 != 0:
		all10 = False
		break

if(all10):
	print(0)
	exit()

min_nums = []
for i in range(0,len(nums)):
	if(nums[i] % 10 != 0 ):
		min_nums.append(nums[i])



if(sum(nums) % 10 == 0):
	print(sum(nums)-min(min_nums))
else:
	print(sum(nums))

Measured memory_bytes: 3064
/*
グリッド型の幅優先探索はABC151(復習)の問題にある。よく見ておくように

*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#include <math.h> /* M_PI */
#define INF 2147483647
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int> >;
vector<ll> dg;
int main()
{
    // 頂点数と辺数
    int N, M;
    cin >> N >> M;
    dg.resize(N);
    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    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);
    }

    // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化 distanceの略
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty())
    {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v])
        {
            if (dist[nv] != -1)
                continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            dg[nv] = v;
            que.push(nv);
        }
    }

    // 結果出力 (各頂点の頂点 0 からの距離を見る)
    int flag = 1;
    for (int v = 0; v < N; ++v)
    {
        if (dist[v] == -1)
        {
            flag = 0;
        }
    }
    if (flag == 1)
    {
        cout << "Yes" << endl;
        for (int i = 1; i < N; i++)
        {
            cout << dg[i] + 1 << endl;
        }
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 10916
#include<stdio.h>

int main(void)
{
	int a,b;
	scanf("%d %d",&a, &b);
	if(a < b){
		printf("a < b\n");
	}else if(a > b){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	          }
	return 0;
}	

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const auto INF = (ll)1e9;
using v = vector<ll>;
using p = pair<ll,ll>;
using m = map<ll,ll>;
using vv = vector<v>;
int gcd(int a,int b){
    return a==0? b :gcd(a,a%b);
}


int main(){
    ll h,w;
    cin >> h >> w;
    ll diff =INF;
    for (int i = 1; i < h; i++)
    {
        ll a,b,c;
        a = i*w;
        b = (h-i)/2*w;
        c = (h-i)*w-b;
        diff = min(diff,max({a,b,c})-min({a,b,c}));
      	//cout << a << " " << b << " "<<c << endl;
      	b = w/2*(h-i);
      	c = (w-w/2)*(h-i);
      	diff = min(diff,max({a,b,c})-min({a,b,c}));
      	//cout << a << " " << b << " "<<c << endl;
    }
  	//cout << endl;
  	for (int i = 1; i < w; i++)
    {
        ll a,b,c;
        a = i*h;
        b = (w-i)/2*h;
        c = (w-i)*h-b;
        diff = min(diff,max({a,b,c})-min({a,b,c}));
      	//cout << a << " " << b << " "<<c << endl;
      	b = h/2*(w-i);
      	c = (h-h/2)*(w-i);
      	diff = min(diff,max({a,b,c})-min({a,b,c}));
      	//cout << a << " " << b << " "<<c << endl;
    }
  
    cout << diff<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n,m,a,b,c;
	string str;
	cout << fixed << setprecision(10);
	cin>>a>>b;
	if(abs(a-b)%2==1){cout<<"IMPOSSIBLE";}
	else{cout<<(a+b)/2;}


	cout<<endl;
} 


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

using namespace std;

const long long INF = 1e18;
const int N = 1e5;
const int MOD = 1e9 + 7;

const double PI = acos(-1);


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int x;
    cin >> x;
    int y = x / 100;
    cout << (x <= y * 105 && x >= y * 100);
}

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

struct dat {
	char s[8][9];
	};
dat *da;

void bomb(int x,int y,int i) {
	int b; 
	da[i].s[y][x]='0';
	for (b=1;b<4;b++) {
		if (y-b>=0) if (da[i].s[y-b][x]=='1') bomb(x,y-b,i);
		if (y+b<=7) if (da[i].s[y+b][x]=='1') bomb(x,y+b,i);
		if (x-b>=0) if (da[i].s[y][x-b]=='1') bomb(x-b,y,i);
		if (x+b<=7) if (da[i].s[y][x+b]=='1') bomb(x+b,y,i);
	}
}

int main() {
    int n,i,j,x,y;
	char a[2];
	cin >> n;
	da=new dat[n];
	for (i=0; i<n; i++) {
		gets(a);
		for (j=0;j<8;j++) cin >> da[i].s[j];
		cin >> x;
		cin >> y;
		bomb(x-1,y-1,i);
		}

	for (i=0;i<n;i++) {
		cout << "Data " << i+1 << ':' << endl;
		for (j=0;j<8;j++) cout << da[i].s[j] << endl;
	}
	delete [] da;
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    string ans = "Yes";

    for (auto i = 0; i < s.size(); i++)
    {
        if((i+1) % 2 == 0){
            if(s[i] == 'R'){
                ans = "No";
            }
        }

        if((i+1) % 2 == 1){
            if(s[i] == 'L'){
                ans = "No";
            }
        }
    }
    cout << ans << endl;
}

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

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

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

	int N; cin >> N;

	cout << (N >= 1000? "ABD":"ABC") << endl;

	return 0;

}


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

int main()
{
    int n;
    cin >> n;
    int a;
    rep(i, n) {
        cin >> a;
        if (a%2 == 1) continue;
        if (!(a % 2 == 0 && (a%3 == 0 || a%5 == 0))) {
            cout << "DENIED" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 3616
/* ???M?????±????????????????£???????????????¨???????¬¬????????±??????
 * ???????????????????????????????????????????????????????¬¬????????±
 * ?????????????????????????????¶???????????±????????¶???????????????
 * ?????????????????°???????°±?????????????????????
 * ?°???????????????°???????????????(INF/0)????°???????????????????
 * ??????a???b?????¨a?????????????????????b?????????????¢????(w/1)
 * ???M-1????°??????¨??????
 */
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<vector>
#include<utility>
#include<cstring>
#define INF 1000000000
#define MAX_V 10000

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

struct edge{
	int to, cap, cost, rev;
	edge(int to, int cap, int cost, int rev) : to(to), cap(cap), cost(cost), rev(rev) {}
};
int N, M, K, V;
vector<edge> G[MAX_V];
int dist[MAX_V];
int prevv[MAX_V], preve[MAX_V];

void add_edge(int from, int to, int cap, int cost){
	G[from].push_back(edge(to, cap, cost, G[to].size()));
	G[to].push_back(edge(from, 0, -cost, G[from].size()-1));
}

int min_cost_flow(int s, int t, int f){
	int res = 0;
	while(f > 0){
		//Bellman-Ford
		fill(dist, dist+V, INF);
		dist[s] = 0;
		bool update = true;
		while(update){
			update = false;
			for(int v = 0; v < V; v++){
				if(dist[v] == INF) continue;
				for(int i = 0; i < G[v].size(); i++){
					edge &e = G[v][i];
					if(e.cap > 0 && dist[e.to] > dist[v] + e.cost){
						dist[e.to] = dist[v] + e.cost;
						prevv[e.to] = v;
						preve[e.to] = i;
						update = true;
					}
				}
			}
		}
		if(dist[t] == INF){
			return -1;
		}
		int d = f;
		for(int v = t; v != s; v = prevv[v]){
			d = min(d, G[prevv[v]][preve[v]].cap);
		}
		f -= d;
		res += dist[t];
		for(int v = t; v != s; v = prevv[v]){
			edge &e = G[prevv[v]][preve[v]];
			e.cap -= d;
			G[v][e.rev].cap += d;
		}
	}
	return res;
}
int w[MAX_V], s[MAX_V], last[MAX_V];
int main(){
	cin>>M>>N>>K;
	int sum = 0;
	for(int i = 0; i < N; i++) scanf("%d", &w[i]);
	int index = 0;
	for(int i = 0; i < K; i++){
		scanf("%d", &s[index]);
		if(index == 0 || s[index] != s[index-1]){
			sum += w[s[index]-1];
			index++;
		}
	}
	V = index;
	memset(last, -1 ,sizeof(last));
	for(int i = 0; i < V; i++){
		if(last[s[i]] >= 0) add_edge(last[s[i]] + 1, i, 1, -w[s[i]-1]);
		if(i < V-1) add_edge(i, i+1, INF, 0);
		last[s[i]] = i;
	}
	printf("%d\n",sum + min_cost_flow(0, V-1, M-1));
	return 0;
}
	
	

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

using namespace std;

#define int long long

int h;

map<int,int> dp;
         
int f(int x)
{
	if (dp[x]) 
		return dp[x];
	if (x == 1)
		return dp[x] = 1;	
	int cur = 2*f(x/2) + 1;
	return dp[x] = cur;
}

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

	cin >> h;
	cout << f(h);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

std::vector<long> a(3);
std::vector<std::vector<long> > list;

int main(){
	scanf("%ld%ld%ld", &a[0], &a[1], &a[2]);
	for(int i = 0; ; i++){
		if(a[0] % 2 == 0 && a[1] % 2 == 0 && a[2] % 2 == 0){
			std::sort(a.begin(), a.end());
			for(int j = 0; j < list.size(); j++){
				if(a == list[j]){
					printf("-1\n");
					return 0;
				}
			}
			/*
			for(int i = 0; i < 3; i++){
				printf("%ld ", a[i]);
			}
			printf("\n");
			//*/
			long a1 = (a[1]+a[2])/2;
			long b1 = (a[2]+a[0])/2;
			long c1 = (a[0]+a[1])/2;
			a[0] = a1;
			a[1] = b1;
			a[2] = c1;
			list.push_back(a);
		}else{
			printf("%d\n", i);
			return 0;
		}
	}
	return 0;
}
		


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int h,w,p,q;
    while(true){
        cin>>h>>w;
        p = h/2;
        q = w/2;
        
        if(h ==0 && w ==0){
            break;
        }
        for(int i =0;i<p;i++){
            for(int j =0;j<q;j++){
                cout<<"#.";
            }
            if(w%2 ==1){
                cout<<"#";
            }
            cout<<endl;
            
            for(int j =0;j<q;j++){
                cout<<".#";
                
            }
            if(w%2 ==1){
                cout<<".";
                
            }
            cout<<endl;
            
        }
        if(h%2 ==1){
            for(int j =0;j<q;j++){
                cout<<"#.";
                
            }
            if(w%2 ==1){
                cout <<"#";
                
            }
            cout<<endl;
            
        }
        cout<<endl;
        
    }
    return 0;
}


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

bool check(string s){
  return s == string(s.rbegin(), s.rend());
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);    
    
    string s;
    cin >> s;
    int n = s.length();
    if (check(s) && check(s.substr(0, (n - 1) / 2)) && check(s.substr((n + 3) / 2 -1)))
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
}



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

int main() {
    char c;
    cin >> c;

    int c_i = (int)c;
    
    int next_c_i = c_i + 1;
    if (next_c_i > 122) next_c_i -= 26;

    char next_c = (char)next_c_i;

    cout << next_c << endl;
    return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

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

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

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

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main(void){
  int N;
  cin >> N;
  long long A[N], T[N];
  long long minimum;
  REP(i, N) cin >> T[i];
  REP(i, N) cin >> A[i];

  if(T[N-1] != A[0]){
    cout << 0 << endl;
    return 0;
  }

  if(N == 1){
    cout << 1 << endl;
    return 0;
  }

  long long dp[N];
  dp[0] = 1;
  for(int i=1;i<N-1;i++){
    if(T[i] > T[i-1]){
      if(T[i] > A[i]) dp[i] = 0;
      else dp[i] = dp[i-1];
    }
    else if(A[i] > A[i+1]){
      if(A[i] > T[i]) dp[i] = 0;
      else dp[i] = dp[i-1];
    }
    else{
      minimum = (T[i] > A[i]) ? (A[i]) : (T[i]);
      dp[i] = (dp[i-1]*minimum)%mod;
    }
  }

  printf("%lld\n", dp[N-2]);

  return 0;
}


Measured memory_bytes: 2560
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    int n; cin>>n;
    ll k; cin>>k;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i], a[i]--;

    vector<int> idx2idx(n);
    for(int i=0; i<n; i++) idx2idx[i] = a[i];

    vector<bool> visited(n, false);
    int cur = 0, cnt = 0;
    while(!visited[cur]){
        visited[cur] = true;
        cur = idx2idx[cur];
        cnt++;

        if(cnt == k){
            cout << cur + 1 << endl;
            return 0;
        }
    }

    k -= cnt;

    for(int i=0; i<n; i++) visited[i] = false;

    int turn = 0;
    while(!visited[cur]){
        visited[cur] = true;
        cur = idx2idx[cur];
        turn++;
    }

    k %= turn;

    for(int i=0; i<k; i++){
        cur = idx2idx[cur];
    }

    cout << cur + 1 << endl;

    return 0;
}

Measured memory_bytes: 4788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp12 {
    class Program {
        static void Main(string[] args) {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            int C = int.Parse(Console.ReadLine());
            int D = int.Parse(Console.ReadLine());
            int E = int.Parse(Console.ReadLine());

            int[] X = new int[5] { A, B, C, D, E };

            int[] ans = new int[5];
            int[] remainder = new int[5];

            //末尾の一桁を計算していく
            for (int i = 0; i < 5; i++) {
                if (X[i] % 10 == 0) {
                    remainder[i] = 10;
                    
                } else {
                    remainder[i] = X[i] % 10;
                }
                
            }

            int minRemain = remainder.Min();

            for (int i = 0; i < 5; i++) {
                ans[i] = (int)(Math.Ceiling((double)X[i] / 10) * 10);
            }

            Console.WriteLine(ans.Sum() - 10 + minRemain);

        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n, i;
    cin >> n >> i;
    cout << n + 1 - i << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    if(y%2!=0)
    {
        cout<<"No\n";
    }

    else if((x*4)>=y && (x*2)<=y )
    {
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 3600
#define C
typedef long long readtype;

/* Header {{{ */
#ifdef C
#include <stdio.h>
#include <math.h>
#include <string.h>
#define isdigit(a) ((a) >= '0' && (a) <= '9' ? true : false)
template<typename type> type abs(type a) { return a < 0 ? -a : a; }
template<typename type> type min(type a, type b) { return a < b ? a : b; }
template<typename type> type beMin(type &a, type b) { return a = (a < b ? a : b); }
template<typename type> type max(type a, type b) { return a > b ? a : b; }
template<typename type> type beMax(type &a, type b) { return a = (a > b ? a : b); }
template<typename type> void swap(type &a, type &b) { type c; c = a; a = b; b = c; }
#endif

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

typedef long long var;

readtype read() {
  readtype a = 0, c = getchar(), s = 0;
  while (!isdigit(c)) s |= c == '-', c = getchar();
  while (isdigit(c)) a = a * 10 + c - 48, c = getchar();
  return s ? -a : a;
}
/* }}} */

int main() {
  /*
#ifndef ONLINE_JUDGE
  freopen("source.in", "r", stdin);
  freopen("source.out", "w", stdout);
#endif
  */
  int n = read(), a = 0, b = 0, anum = 0, bnum = 0;
  for (int i = 1; i <= n; ++i) {
    int x = read();
    if (!a) a = x, anum = 1;
    else if (x == a) anum++;
    else if (!b) b = x, bnum = 1;
    else if (x == b) bnum++;
    else return !puts("No");
  }
  if (a < b) swap(a, b), swap(anum, bnum);
  if (b && b != a - 1) return !puts("No");
  if (bnum) a -= bnum, n -= bnum;
  else {
    if (a == n - 1) return !puts("Yes");
    a--, n -= 2;
    if (a == 0) return !puts("Yes");
  }
  if (a <= 0 || a == n) return !puts("No");
  puts(a * 2 <= n ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <cmath>
#include <map>

using namespace std;
const long long INF = (long long) (1e18)+1;

int main() {
  long double a,b,h,m;
  cin >> a >> b >> h >> m;
  
  if (h == 0) h = 12; 
  
  long double k = 0;
  long double new_h = ( (h+m/60) * 5);
  if (m == 0) m = 60;
  if (new_h > m) {
    k = (new_h - m);
  } else {
    k = (m - new_h);
  }
  // cout << new_h << endl;
  k *= 6;
  // cout << k << endl;


  long double r = (long double)(k * 3.14159265358979323846264338327950) / (long double)(180);
  // long double r = 3.14159265358979323846264338327950 * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long double)m / 60.0);

  long double ans = (long double)(a * a) + (long double)(b * b) - (long double)(2 * a * b * cosl( r ));
  // cout << ans << endl;

  printf("%.16Lf", sqrtl( ans ));// << endl;
  return 0; 
}

Measured memory_bytes: 4156
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <cmath>
#include <iomanip>
#include <functional>

#define MOD (1000000007)

using namespace std;

typedef long long ll;
typedef pair<ll, ll> tup;
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];


ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

map<ll,ll> prime;//素因数分解でそれぞれの素数がいくつ出てきたかを保存するmap

//O(√n)
//整列済み(mapはkeyで自動で整列される)
void prime_factorize(ll n){
    if(n<=1) return;
    ll l=sqrt(n);
   for(ll i=2;i<=(ll)(l);i++) { //
        if(n%i==0){
            prime_factorize(i);prime_factorize(ll(n/i));return;
        }
    }
    //mapでは存在しないkeyの場合も自動で構築される
    prime[n]++;return;
}


int main() {
    ll X, Y;
    cin >> X >> Y;

    ll diff = 4 * X - Y;


    if(diff % 2 == 0 && diff >= 0) {
        ll turtle = diff / 2;
        ll crane = Y - turtle;
        if(turtle >= 0  && turtle <= X ) {
            cout << "Yes" << endl;
            return 0;
        }
    } 

    cout << "No" << endl;

    return 0;    
}



Measured memory_bytes: 3656
def countcut(A, length):
    ret = 0
    for a in A:
        ret += -(-a//length) - 1
    return ret


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    lo = 1
    hi = int(1e9)
    while lo < hi:
        mid = (lo+hi) // 2
        if countcut(A, mid) <= K:
            hi = mid
        else:
            lo = mid + 1
    print(lo)


if __name__ == "__main__":
    main()


Measured memory_bytes: 93880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);
#define f first
#define s second

const int maxn = 100010;
#define all(x) x.begin(),x.end()

#define ld long double

int n;

int main() {
	cin >> n;
	
	ld sum = 0;
	for (int i =0;i<n;i++) {
		ld x; cin >> x;
		sum += ((ld) 1 / x);
	}
	cout << setprecision(10) <<  (1 / sum);
	
}



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

int update(int r1,int r2,char op) {
    if(op == 0) return r2;
    else if(op == '+') return r1+r2;
    else if(op == '-') return r1-r2;
    else if(op == '*') return r1*r2;
}

int main() {
    string input;
    while(cin>>input) {
        int r1=0,r2=0;
        bool error = false;
        char op = 0;

        for(int i=0; i<input.length(); ++i) {
            if(input[i] >= '0' && input[i] <= '9') {
                r2 *= 10;
                r2 += input[i] - '0';
            }else if(input[i] == '=' || input[i] == '+'
                     || input[i] == '-' || input[i] == '*') {
                r1 = update(r1,r2,op);
                if(r1 < 0 || r1 >= 10000) error = true;
                r2 = 0;
                op = input[i];

                if(input[i] == '=') {
                    if(!error) cout<<r1<<endl;
                    else cout<<"E"<<endl;
                }
            }
            if(r2 >= 10000) error = true;
        }
    }
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int t = Integer.parseInt(sc.next());

		int ans = (int) ((t + 0.5) / a) * b;
		System.out.println(ans);
	}

}


Measured memory_bytes: 23764
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define ef emplace_front
#define pof pop_front()
#define pob pop_back()
#define Rep(i,n) for(li i=0,nn=(li)(n);i!=nn;++i)
#define Rep1(i,n) for(li i=1,nn=(li)(n)+1;i!=nn;++i)
#define Size(v) (li)(v.size())
#define SortA(v) sort(v.begin(),v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii);}
#define Input2(a,b) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii)>>(b).at(ii);}
#define mp make_pair
using li = int64_t;
using intl = int64_t;
using vi = vec<li>;
using vb = vec<bool>;
using vvi = vec<vi>;
using qi = deque<li>;
using pi = pair<li,li>;
using vpi = vec<pi>;
using si = set<li>;
using vsi = vec<si>;
using mii = map<li,li>;
using vmii = vec<mii>;
vec<li> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<li> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr li INF = 9223372036854775807;

void Yes(li b){
  if(b)cout<<"Yes";
  else cout<<"No";
}
void yes(li b){
  if(b)cout<<"yes";
  else cout<<"no";
}

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

  int A,B,C,K;
  cin >>A>>B>>C>>K;

  int times=0;

  while(B<=A){
  	B*=2;
  	times++;
  }
  while(C<=B){
  	C*=2;
  	times++;
  }

  Yes(times<=K);
  
  }

Measured memory_bytes: 3652
N, K = map(int, input().split())
X = list(map(int, input().split()))

dist = []
for i in range(N-K+1):
    dist.append(abs(X[i]) + abs(X[K+i-1]-X[i]))
    dist.append(abs(X[K+i-1]) + abs(X[i]-X[K+i-1]))

if not len(dist) == 0:
    print(min(dist))
else:
    print(0)

Measured memory_bytes: 15020
import itertools
def main():
    N, M, Q = map(int, input().split())
    a = [0]*Q
    b = [0]*Q
    c = [0]*Q
    d = [0]*Q
    for i in range(Q):
        a[i], b[i], c[i], d[i] = map(int, input().split())
    A = list(itertools.combinations_with_replacement([i for i in range(1,M+1)], N))
    D = []
    for f in A:
        e=0
        for i in range(Q):
            if f[b[i]-1]-f[a[i]-1] == c[i]:
                e = e + d[i]
        D.append(e)
    print(max(D))
main()

Measured memory_bytes: 25048
import java.util.Scanner;

public class Main {
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        while(true){
        	int m=sc.nextInt();
            int f=sc.nextInt();
            int r=sc.nextInt();
            int p=m+f;
            if(m==-1&&f==-1&&r==-1)
            	break;
            if(m==-1||f==-1){
            	System.out.println("F");
            }else if(p>=80){
            	System.out.println("A");
            }else if(65<=p&&p<80){
            	System.out.println("B");
            }else if(50<=p&&p<65){
            	System.out.println("C");
            }else if(30<=p&&p<50&&r>=50){
            	System.out.println("C");
            }else if(30<=p&&p<50){
            	System.out.println("D");
            }else if(0<=p&&p<30){
            	System.out.println("F");
            }
        }
    }
}



Measured memory_bytes: 26316
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;

int a[4];

int main()
{
    int ans=10000;
    cin>>a[1]>>a[2]>>a[3];
    ans=min(ans,a[1]+a[2]);
    ans=min(ans,a[2]+a[3]);
    ans=min(ans,a[3]+a[1]);
    cout<<ans<<endl;


    return 0;
}



Measured memory_bytes: 256
from itertools import combinations

S = input()

ans = int(S)
for n in range(1, len(S)):
    for c in combinations(range(len(S) - 1), n):
        op = [''] * len(S)
        for ci in c:
            op[ci] = '+'
        shiki = ''
        for i in range(len(S)):
            shiki += S[i] + op[i]
        ans += eval(shiki)
print(ans)


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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if ((A+B)>(C+D))
    cout << "Left" << endl;
  else if ((A+B)<(C+D))
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}


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


int main(){
    char a,b;
    cin>>a>>b;
    if((a-'A')==(b-'A')){
        cout<<"="<<endl;
    }else if((a-'A')>(b-'A')){
        cout<<">"<<endl;
    }else{
        cout<<"<"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int sx, sy, tx, ty;
    std::cin >> sx >> sy >> tx >> ty;

    for (int i = 0; i < ty - sy; ++i)
    {
        std::cout << 'U';
    }
    for (int i = 0; i < tx - sx; ++i)
    {
        std::cout << 'R';
    }
    // tに到達した

    for (int i = 0; i < ty - sy; ++i)
    {
        std::cout << 'D';
    }
    for (int i = 0; i < tx - sx; ++i)
    {
        std::cout << 'L';
    }
    // sに戻った

    std::cout << 'L';
    for (int i = 0; i < ty - sy + 1; ++i)
    {
        std::cout << 'U';
    }
    for (int i = 0; i < tx - sx + 1; ++i)
    {
        std::cout << 'R';
    }
    std::cout << 'D';
    // 2回目のt

    std::cout << 'R';
    for (int i = 0; i < ty - sy + 1; ++i)
    {
        std::cout << 'D';
    }
    for (int i = 0; i < tx - sx + 1; ++i)
    {
        std::cout << 'L';
    }
    std::cout << 'U';

    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 3532
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

const int Maxn = 500005;
const int Maxm = 4;
const int Inf = 1000000000;

int n;
char S[Maxn];
int dp[Maxn][Maxm][Maxm];

int main()
{
	scanf("%d", &n);
	scanf("%s", S);
	S[n] = S[n + 1] = '0'; 
	fill((int*)dp, (int*)dp + Maxn * Maxm * Maxm, -Inf);
	dp[n][0][0] = 0;
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j < Maxm; j++) {
			int give = (j & 1) << 1 | int(S[i + 2] == '1');
			for (int k = 0; k < Maxm; k++) {
				int ret = (j & 2) | (k & 2) >> 1;
				dp[i][j][ret] = max(dp[i][j][ret], dp[i + 1][give][k]);
			}
			if (j & 2) dp[i][j][1] = max(dp[i][j][1], dp[i + 1][give][1] + 1);
		}
		if (S[i + 2] == '1')
			for (int k = 0; k < Maxm; k++) {
				int ret = (k & 2) >> 1;
				dp[i][2][ret] = max(dp[i][2][ret], dp[i + 1][2][k] + 1);
			}
	}
	int mask = int(S[0] == '1') << 1 | int(S[1] == '1');
	int res = 0;
	for (int j = 0; j < Maxm; j++)
		res = max(res, dp[0][mask][j]);
	printf("%d\n", res);
	return 0;
}

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

typedef struct P{
    int key,pri;
    struct P *left,*right,*parent;
}Node;

Node *root,*NIL;

void pre(Node *node){
    if(node==NIL){return;}
    printf(" %d",node->key);
    pre(node->left);
    pre(node->right);
}

void ino(Node *node){
    if(node==NIL){return;}
    ino(node->left);
    printf(" %d",node->key);
    ino(node->right);
}

void insert(int key){
    Node *y,*x,*z;
    y=NIL; x=root;
    z=(Node*)malloc(sizeof(Node));
    z->key=key; z->left = NIL; z->right=NIL;
    while(x!=NIL){
        y=x;
        if(z->key<x->key){
            x=x->left;
        }else{
            x=x->right;
        }
    }
    z->parent=y;
    if(y==NIL){
        root=z;
    }else{
        if(z->key<y->key){
            y->left=z;
        }else{
            y->right=z;
        }
    }
}

Node* find(Node *node,int k){
    while(node!=NIL){
        if(k < node->key){node = node->left;}
        else if(k>node->key){node = node->right;}
        else{return node;}
    }
    return NIL;
}

Node* treeMin(Node *x){
    while(x->left!=NIL){
        x=x->left;
    }
    return x;
}

Node* treeSuccessor(Node *x){
    Node *y;
    if(x->right!=NIL){return treeMin(x->right);}
    /*y=x->parent;
    while(y!=NIL&&x==y->parent){
        x=y;
        y=y->parent;
    }*/
    return y;
}

void delete(int key){
    Node *x,*y,*z;
    z = find(root,key);
    if(z->left==NIL||z->right==NIL){y=z;}
    else{
        y = treeSuccessor(z);
    }
    if(y->left!=NIL){
        x=y->left;
    }else{
        x=y->right;
    }
    if(x!=NIL){
        x->parent=y->parent;
    }
    if(y->parent==NIL){
        root=x;
    }else if(y==y->parent->left){
        y->parent->left=x;
    }else{
        y->parent->right=x;
    }
    if(y!=z){
        z->key=y->key;
    }
    free(y);
}

int main(void){
    int n,i,j,x,y;
    char str[7];
    Node *node;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",str);
        if(str[0]=='i'){
            scanf("%d",&y);
            insert(y);
            x++;
        }else if(str[0]=='f'){
            scanf("%d",&y);
            node = find(root,y);
            if(node!=NIL){printf("yes\n");}
            else{printf("no\n");}
        }else if(str[0]=='d'){
            scanf("%d",&y);
            delete(y);
        }else{
            ino(root);
            printf("\n");
            pre(root);
            printf("\n");
        }
    }
    return 0;
}



Measured memory_bytes: 20456
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
ll dp[101][10];
int main() {
	int H, W, K;
	cin >> H >> W >> K;
	dp[0][0] = 1;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			for (int bit = 0; bit < (1 << (W - 1)); bit++) {
				bool NG = 0;
				for (int k = 0; k + 1 < W - 1; k++) {
					if ((bit&(1 << k)) && (bit&(1 << (k + 1)))) {
						NG = 1;
						break;
					}
				}
				if (NG) continue;
				if (j + 1 < W && (bit&(1 << j))) {
					(dp[i + 1][j + 1] += dp[i][j]) %= MOD;
				}
				else if (j > 0 && (bit&(1 << (j - 1)))) {
					(dp[i + 1][j - 1] += dp[i][j]) %= MOD;
				}
				else {
					(dp[i + 1][j] += dp[i][j]) %= MOD;
				}
			}
		}
	}
	cout << dp[H][K - 1] << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = GetNumber();

            var max = int.MinValue;
            var min = int.MaxValue;
            var prev = 0;
            for (int i = 0; i < N; i++)
            {
                var now = GetNumber();
                if (i != 0)
                {
                    min = Math.Min(min, prev);
                    max = Math.Max(max, now - min);
                }

                prev = now;
            }

            System.Console.WriteLine(max);
        }

        //static StreamReader Console = new StreamReader("input.txt");

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static double GetDounble()
        {
            return double.Parse(Console.ReadLine().Trim());
        }

        static int[] GetNumbersInt(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static long[] GetNumbersLong(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();
        }

        static double[] GetNumbersDouble(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => double.Parse(x)).ToArray();
        }

        static string[] GetStrings(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToArray();
        }
    }
}

Measured memory_bytes: 9324
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, a, b) for (int i = (a); i < (int)(b); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;

VI Main(int N, VI& A)
{
    VI ans(N, 0);
    REP(i, N) ans[A[i]-1] = i+1;
    return ans;
}

int main(void){
    int N;
    cin >> N;
    VI A(N);
    REP(i, N) cin >> A[i];
    VI out = Main(N, A);
    REP(i, N) cout << out[i] << ' ';
    cout << endl;
    return 0;
}

Measured memory_bytes: 1536
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    cout<<-a*60-b+c*60+d-e<<endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

int main(){
    string l;cin>>l;
    int s=l.size();
    vvll dp(s+1,vll(2));
    dp[0][0]=(ll)1;
    //a,bを二進数表記したとき各桁がともに1でなければok→3通り
    rep(i,s){
        dp[i+1][1]+=dp[i][1]*3;
        if(l[i]=='1'){
            dp[i+1][1]+=dp[i][0];//a,bのi+1桁目が共に0
            dp[i+1][0]+=dp[i][0]*2;//a,bのi+1桁目が異なる
        }
        else dp[i+1][0]+=dp[i][0];//a,bのi+1桁目が共に0
        rep(j,2)dp[i+1][j]%=inf;
    }
    cout<<(dp[s][0]+dp[s][1])%inf<<endl;
}

Measured memory_bytes: 8792
/*
 *Author - Abhas Jain
 */
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define endl '\n'
#define pb push_back
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
 
typedef long long ll;
typedef long double ld;
 
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
 
const ld PI = 3.141592653589793;
const ll INF = 9223372036854775807ll;
const ll mod = 1e9 + 7;
 
void solve() 
{
    int a, b, c;
    cin >> a >> b >> c;
    c -= (a - b);
    if (c < 0) c = 0;
    cout << c << endl;
}
 
int main( )
{   
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
    return 0;
}

Measured memory_bytes: 256
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, readline().split()))
    a = list(map(int, readline().split()))
    sa = sum(a)
    cnt = 0
    for v in a:
        if v >= sa / (4 * m):
            cnt += 1
    print("Yes" if cnt >= m else "No")


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38256
#include<iostream>

using namespace std;

int main(void){
  int i, j, max, max_n,  N;
  
  while(cin >> N) {
    max = 0;
    max_n = 1;
    
    for(i = 1; i <= N; i++) {
      int k = i;
      for(j = 0; k % 2 == 0; j++) {
	k /= 2;
      }
      if(max < j) {
	max_n = i;
	max = j;
      }
    }
    cout << max_n;
  }

  return 0;
}
  


Measured memory_bytes: 256
K, A, B = gets.split(' ').map(&:to_i)

if A + 2 >= B
  puts(1 + K)
  exit 0
end

n = K - (A - 1)
m = n / 2
k = n % 2

ans = m == 0 ? 1 + K : m * B + k - (m - 1) * A
puts ans


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  int asw = 0;
  for (int i = 1; i <= n; ++i) {
    int d = 0, j = i;
    while (j) {
      j /= 10;
      ++d;
    }
    asw += d % 2;
  }
  cout << asw << endl;
  return 0;
}


Measured memory_bytes: 256
x,y=map(int,input().split())

mod=10**9+7
def C(n, r ,mod=10**9+7):
    if n-r<r: r=n-r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k]) %mod

    return result % mod

a=(-x+2*y)/3
b=(2*x-y)/3
if a<0 or b<0 : print(0) ; exit()
if a%1!=0 or b%1!=0:
    print(0) 
    exit()
a=int(a) ; b=int(b)
print(C(a+b,a))

Measured memory_bytes: 46068
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin >> N >> M;
  int i;
  int sum=0;
  vector <int> A(N,0);
  for(i=0;i<N;i++){
		cin >> A.at(i);
    	sum+=A[i];
  }
  
  sort(A.begin(), A.end()); 
    reverse(A.begin(), A.end());
  if((double)A[M-1]>=(double)sum/(double)(4*M)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
h = gets.chomp.split.map(&:to_i)

dp = []
(0..n).each do |i|
  dp << Float::INFINITY
end
dp[0] = 0

(1...n).each do |i|
  a = dp[i - 1] + (h[i] - h[i - 1]).abs
  if dp[i] > a
    dp[i] = a
  end
  if i > 1 
    b = dp[i - 2] + (h[i] - h[i - 2]).abs
    if dp[i] > b
      dp[i] = b
    end
  end
end
p dp[n - 1]

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

using namespace std;

using llong = long long int;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000007;
const static int INF = 1000000000;
const static int dx[4] = {1, 0, -1, 0};
const static int dy[4] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int h, w, m;
    cin >> h >> w >> m;
    map<int, int> Hm, Wm;
    vector<int> H(m), W(m);
    rep(i, m) {
        int h, w;
        cin >> h >> w;
        --h, --w;
        ++Hm[h];
        ++Wm[w];
        H[i] = h;
        W[i] = w;
    }

    priority_queue<pair<int, int> > Hpq, Wpq;
    stl_rep(itr, Hm) {
        // cout << itr->second << endl;
        Hpq.push(make_pair(itr->second, itr->first));
    }
    stl_rep(itr, Wm) {
        // cout << itr->second << endl;
        Wpq.push(make_pair(itr->second, itr->first));
    }
    int Hmax = Hpq.top().first, Wmax = Wpq.top().first;
    vector<int> Hcan, Wcan;
    while (! Hpq.empty() ) {
        if (Hpq.top().first != Hmax) break;
        Hcan.push_back(Hpq.top().second);
        Hpq.pop();
    }
    while (! Wpq.empty() ) {
        if (Wpq.top().first != Wmax) break;
        Wcan.push_back(Wpq.top().second);
        Wpq.pop();
    }
    sort(all(Hcan));
    sort(all(Wcan));

    // cout << Hcan.size() << "-?" << Wcan.size() << endl;

    int cnt = 0;
    rep(i, m) {
        // cout << H[i] << ' ' << W[i] << ' ' << upper_bound(all(Hcan), H[i]) - lower_bound(all(Hcan), H[i]) << ' ' << upper_bound(all(Wcan), W[i]) - lower_bound(all(Wcan), W[i]) << endl;
        if ((upper_bound(all(Hcan), H[i]) - lower_bound(all(Hcan), H[i])) && (upper_bound(all(Wcan), W[i]) - lower_bound(all(Wcan), W[i]))) {
            ++cnt;
        }
    }

    if (cnt < (llong)Hcan.size()*(llong)Wcan.size()) cout << Hmax + Wmax << endl;
    else cout << Hmax + Wmax - 1 << endl;

    return 0;
}

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


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)
map<ll, vector<ll>> m;
map<ll, pair<ll, ll>> final;
ll dist(pair<ll, ll> a, pair<ll, ll> b) {
	return abs(a.ff - b.ff) + abs(a.ss - b.ss);
}
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, i, x, y;
    cin >> n;
    for(i = 0; i < n; i++) {
    	cin >> x >> y;
    	m[x].pb(y);
    }	
    for(auto u: m) {
    	vector<ll> temp = u.ss;
    	sort(all(temp));
    	final[u.ff] = mp(temp[0], temp.back());
    }
    ll ans = 0;
    pair<ll, ll> top, bottom;
    bool first = true;
    for(auto u: final) {
    	ans = max(ans, abs(u.ss.ff - u.ss.ss));
    	if(first) {
    		top = mp(u.ff, u.ss.ss);
    		bottom = mp(u.ff, u.ss.ff);
    		first = false;
    	} else {
    		ans = max({ans, dist(top, mp(u.ff, u.ss.ff)), dist(bottom, mp(u.ff, u.ss.ss))});
    		// top with (u.ff, u.ss.ss)
    		if(u.ff - top.ff < u.ss.ss - top.ss) {
    			top = mp(u.ff, u.ss.ss);
    		}
    		// bottom with (u.ff, u.ss.ff)
    		if(u.ff - bottom.ff < bottom.ss - u.ss.ff) {
    			bottom = mp(u.ff, u.ss.ff);
    		}
    	}
    }
    cout << ans << "\n";
}

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

typedef long long int ll;

int main(){
    ll p[3];
    scanf("%lld %lld %lld",&p[0],&p[1],&p[2]);
    sort(p,p+3);
    ll ans =p[0]+p[1];
    printf("%lld\n",ans);
    return 0;
}


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

int main(){
	int N;
	cin >> N;
	vector<char> vec (N);
	for(int i = 0;i < N;i++){
		cin >> vec.at(i);
	}
	sort(vec.begin(),vec.end());
	reverse(vec.begin(),vec.end());
	if(vec.at(0) == 'Y'){
		cout << "Four" << endl;
		return 0;
	}
	else{
		cout << "Three" << endl;
		return 0;
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int i,j,p,n;
  char t[100];
  char str[1100];

  scanf("%d ",&n);
  for(i=0;i<n;i++){
    scanf("%s",str);

    for(j=0;j<100;j++)t[j] = 0;

    p = 50;
    t[p] = str[0];
    j = 1;
    while(1){
      if(str[j] == '-'){
	j += 2;
	p++;
	t[p] = str[j];
	j++;
      }else if(str[j] == '<'){
	j += 2;
	p--;
	t[p] = str[j];
	j++;
      }else if(str[j] == '\0')break;
    }

    for(j=0;j<100;j++){
      if(t[j]!=0)printf("%c",t[j]);
    }
    putchar('\n');
  }

  return 0;
}

Measured memory_bytes: 0
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

struct MyStruct
{
	string city;
	int score;
	int page;

	bool operator<(const MyStruct &another) const
    {
        if(city != another.city) return city < another.city;
		else return score > another.score;
    };
};

int main() {
    int ans = 0;
    vector<MyStruct> lis;
	MyStruct tmp;
	int n, p, t;
	string s;
	cin >> n;
	REP(i, n){
		cin >> s >> p;
		tmp.city = s;
		tmp.score = p;
		tmp.page = i+1;
		lis.push_back(tmp);
	}
	sort(lis.begin(), lis.begin()+n);
	REP(i, n){
		//cout << lis[i].city << lis[i].score << endl;
		cout << lis[i].page << endl;
	}
	//cout << ans << endl;

}

Measured memory_bytes: 256