akhauriyash/Code-Regression huggingface dataset:
/*
lakshaygpt28
Lakshay Gupta
*/

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

string to_string(char ch) {
    return "'" + string(1, ch) + "'";
}

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

template <size_t N>
string to_string(bitset<N> v) {
    return v.to_string();
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < v.size(); ++i) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cout << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << " " << to_string(H);
    debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const double PI = acos(-1);
const long long LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

long long dp[N];
long long solve(int rem);

int main() {
    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
    memset(dp, -1, sizeof(dp));
    int s;
    cin >> s;
    cout << solve(s) << "\n";
    return 0;
}

long long solve(int rem) {
    if (rem < 0) {
        return 0;
    }
    if (rem == 0) {
        return 1;
    }
    long long &ans = dp[rem];
    if (ans != -1) {
        return ans;
    }
    ans = 0;
    for (int i = 3; i <= rem; i++) {
        ans += solve(rem - i);
        ans %= MOD;
    }
    // debug(rem, ans);
    return ans;
}


Measured memory_bytes: 4364
#!/bin/bash

declare -A a
read a["a"]
read a["b"]
read a["c"]

cnt=0;
for i in {a..c}; do
  a[${i}]=$(echo ${a[${i}]} | sed "s/\n//")
done


turn=a


while [ -n "${a[${turn}]}" ] ;do
  next=${a[${turn}]:0:1}
  a[${turn}]=${a[${turn}]:1}
  turn=$next
done

echo ${turn^^}


Measured memory_bytes: 788
#pragma region head
    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library
const int MOD = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime MOD
  mint inv() const {
    return pow(MOD-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
ostream& operator<< (ostream& os, const mint& value) {
  os << value.x;
  return os;
}
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}; 
combination cb(1005);

#pragma endregion library

mint ans = 0;
int n,a,b,c,d;

int main(){
    cin >> n >> a >> b >> c >> d;
    vv<mint> ans(n+1,vector<mint>(n+1));
    ans[a-1][0] = 1;
    repi(i,a,b+1){
        rep(k,n+1) ans[i][k] = ans[i-1][k];
        for(int j = c; j*i <= n && j <= d; ++j){
            rrep(k,n+1){
                if(k-j*i>=0)
                    ans[i][k]+=ans[i-1][k-j*i]*cb.ifact[i].pow(j)*cb.ifact[j];
            }
        }
    }
    cout << cb.fact[n]*ans[b][n] << '\n';
    
    

}

Measured memory_bytes: 11052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

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

int main() {
  int h, w, ai, aj, bi, bj;
  cin >> h >> w >> ai >> aj >> bi >> bj;

  vector<vector<pair<ll, ll>>> r(h, vector<pair<ll, ll>>(w, {1e9, 0}));

  queue<pair<int, int>> q;
  q.push({ai, aj});
  r[ai][aj] = {0, 1};
  while (!q.empty()) {
    auto p = q.front();
    q.pop();

    vector<pair<int, int>> next;
    for (int i = 0; i < 4; i++) {
      next.push_back({p.first + dy[i], p.second + dx[i]});
    }
    next.push_back({p.first, 0});
    next.push_back({p.first, w - 1});
    next.push_back({0, p.second});
    next.push_back({h - 1, p.second});

    for (auto e : next) {
      if (e == p || e.first < 0 || h <= e.first || e.second < 0 || w <= e.second) {
        continue;
      }

      if (r[p.first][p.second].first + 1 == r[e.first][e.second].first) {
        r[e.first][e.second].second += r[p.first][p.second].second;
        r[e.first][e.second].second %= mod;
      } else if (r[p.first][p.second].first + 1 < r[e.first][e.second].first) {
        r[e.first][e.second].first = r[p.first][p.second].first + 1;
        r[e.first][e.second].second = r[p.first][p.second].second;
        q.push(e);
      }
    }
  }

  // for (auto ee : r) {
  //   for (auto e : ee) {
  //     cerr << e.first << "," << e.second << " ";
  //   }
  //   cerr << endl;
  // }

  cout << r[bi][bj].first << " " << r[bi][bj].second << endl;
}



Measured memory_bytes: 5728
N, W = map(int, input().split())
items = sorted([list(map(int, input().split())) for i in range(N)])

dp = [[0] * (W + 1) for i in range(N + 1)]

# dpテーブルを埋める
for i in range(N):
    wi, vi = items[i]
    for j in range(W + 1):
        if j + wi <= W:
            dp[i + 1][j + wi] = max(dp[i + 1][j + wi], dp[i][j] + vi)
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])


ans = 0
# 最後に入れる商品は、残り容量１の時に入れるとしてしまってよい
for i, (wi, vi) in enumerate(items):
    ans = max(ans, dp[i][W - 1] + vi)

print(ans)

Measured memory_bytes: 118744
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    public static void Main()
    {
        int N = NextInt();
        int M = NextInt();
        int[] box = Enumerable.Repeat(1, N).ToArray();
        bool[] a = Enumerable.Repeat(false, N).ToArray();
        a[0] = true;
        for (int i = 0; i < M; i++)
        {
            int x = NextInt() - 1;
            int y = NextInt() - 1;
            box[x]--;
            box[y]++;
            if (a[x])
            {
                a[y] = true;
                if (box[x] == 0) a[x] = false;
            }
        }
        Console.WriteLine(a.Count(v => v == true));
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


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

char buf[100];
const char *data[10];

int main() {
  data[0] = "";
  data[1] = ".,!? ";
  data[2] = "abc";
  data[3] = "def";
  data[4] = "ghi";
  data[5] = "jkl";
  data[6] = "mno";
  data[7] = "pqrs";
  data[8] = "tuv";
  data[9] = "wxyz";

  int t;
  scanf("%d", &t);
  while (t--) {
    scanf(" %s", buf);
    int n = strlen(buf);
    char c = '\0';
    string res;
    int idx = 0;
    for (int i=0; i<n; i++) {
      if (buf[i] == '0') {
        if (c != '\0') {
          res += c;
          c = '\0';
        }
        idx = 0;
      } else {
        c = data[buf[i]-'0'][idx++];
        if (c == '\0') {
          c = data[buf[i]-'0'][0];
          idx = 1;
        }
      }
    }

    printf("%s\n", res.c_str());
  }
}

Measured memory_bytes: 3144
#include "bits/stdc++.h"
using namespace std;

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

int main() {
        int n;
        while (cin >> n && n) {
                int ans = 0;
                for (int i = 1; i < n; i ++) {
                        int sum = 0;
                        for (int j = i; j < n; j ++) {
                                sum += j;
                                if (sum >= n) {
                                        if (sum == n) ans ++;
                                        break;
                                }
                        }
                }
                cout << ans << endl;
        }
        return 0;
}

Measured memory_bytes: 3084
#include <algorithm>  //min, max, sort, unique, fill
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>  //pair, swap,
#include <vector>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using VI = vector<ll>;
using VB = vector<bool>;
using VP = vector<P>;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) for (ll i = 0; i < (n); i++)

static const ll kIntMax = numeric_limits<ll>::infinity();
static const double kFloatMax = numeric_limits<double>::infinity();

vector<ll> vi;

int main() {
  int c[3][3];

  REP(i, 3) REP(j, 3) cin >> c[i][j];

  bool result = true;
  result &= c[0][0] - c[0][1] == c[1][0] - c[1][1];
  result &= c[2][0] - c[2][1] == c[1][0] - c[1][1];
  result &= c[0][0] - c[0][1] == c[2][0] - c[2][1];

  result &= c[0][2] - c[0][1] == c[1][2] - c[1][1];
  result &= c[2][2] - c[2][1] == c[1][2] - c[1][1];
  result &= c[0][2] - c[0][1] == c[2][2] - c[2][1];

  result &= c[0][2] - c[0][0] == c[1][2] - c[1][0];
  result &= c[2][2] - c[2][0] == c[1][2] - c[1][0];
  result &= c[0][2] - c[0][0] == c[2][2] - c[2][0];

  result &= c[0][0] - c[1][0] == c[0][1] - c[1][1];
  result &= c[0][2] - c[1][2] == c[0][1] - c[1][1];
  result &= c[0][0] - c[1][0] == c[0][2] - c[1][2];

  result &= c[2][0] - c[1][0] == c[2][1] - c[1][1];
  result &= c[2][2] - c[1][2] == c[2][1] - c[1][1];
  result &= c[2][0] - c[1][0] == c[2][2] - c[1][2];

  result &= c[2][0] - c[0][0] == c[2][1] - c[0][1];
  result &= c[2][2] - c[0][2] == c[2][1] - c[0][1];
  result &= c[2][0] - c[0][0] == c[2][2] - c[0][2];

  if (result)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <climits>
using namespace std;
int main(void){
    
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    
    int ans = 0;
    for(int i = 0; i <= A; i++){
        for(int j = 0; j <= B; j++){
            for(int k = 0; k <= C; k++){
                if(X == 500 * i + 100 * j + 50 * k) ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  cin >> N;
  int ans = 0;
  
  for(int i = 1;i <= 9;i ++){
    for(int j = 1;j <= 9; j++){

      if(i * j == N)ans++;
    }
  }
  if(ans > 0){
    puts("Yes");
  }else{
    puts("No");
  }
}


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

using namespace std;
typedef long long int ll;
int main() {
    
    ll a, b, c, k, dap=0, i;
    cin>>a>>b>>c>>k;
    while(a>=b)
    {
        dap++;
        b*=2;
    }
    while(b>=c)
    {
        dap++;
        c*=2;
    }
    
    if(dap<=k)
    printf("Yes");
    else
    printf("No");
    
    return 0;
}

Measured memory_bytes: 3756
#include<iostream>
#include<vector>
#include<map>
#include<queue>

#include<unordered_set>

using namespace std;
map<int, unordered_set<int>> paths;

int main() {
	int n,m;
  cin >> n >> m;
  
  for (int i=0; i<m; ++i) {
  	int t1;
    int t2;
    cin >> t1 >> t2;
    paths[t2].insert(t1);
    paths[t1].insert(t2);
  }
  
  map<int, int> ans;
  queue<int> roots;
  vector<int> visits(n+1);
  visits[1] = 1;
  roots.push(1);
//  while (roots.empty) {
  while (!roots.empty()) {
    int r = roots.front();
    roots.pop();
    for (auto p : paths[r]) {
      if (visits[p] == 0) ans[p] = r;
      if (visits[p] == 0) roots.push(p);
      visits[p] = 1;
    }
  }
  
  
  for (int i=2; i<=n; ++i) {
  	if (ans[i]==0) {
    	cout << "No" << endl;
        return 0;
    }
  }
  cout << "Yes" << endl;
  for (int i=2; i<=n; ++i) {
    cout << ans[i] << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 37848
import Data.List

main = do
  n <- readLn :: IO Int
  cs <- map read . words <$> getLine :: IO [Int]
  putStrLn $ show (ans n cs)

ans :: Int -> [Int] -> Int
ans n cs = multMod (powMod 2 n) (foldl1 (addMod) (zipWith (multMod) (map (f n) [1..n]) (sort cs)))

f :: Int -> Int -> Int
f 1 a = 1
f n a = multMod (powMod 2 (n-2)) (n+2-a)

modulus = 10^9+7

aMod :: Int -> Int  
aMod n = n `mod` modulus

addMod :: Int -> Int -> Int
addMod a b 
    | a + b > modulus = a + b - modulus
    | otherwise = a + b

subMod :: Int -> Int -> Int
subMod a b
    | a - b < 0 = a - b + modulus
    | otherwise = a - b

multMod :: Int -> Int -> Int
multMod a b = (a * b) `mod` modulus

powMod :: Int -> Int -> Int
powMod a b 
    | b == 0 = 1
    | otherwise = f a b
  where
        f x y | even y = f (multMod x x) (y `quot` 2)
              | y == 1 = x
              | otherwise = g (multMod x x) (y `quot` 2) x
        g x y z | even y = g (multMod x x) (y `quot` 2) z
                | y == 1 = multMod x z
                | otherwise = g (multMod x x) (y `quot` 2) (multMod x z)


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

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

int main() {
    int a[5];
    rep(i,5)cin>>a[i];
    cout<<(a[2]-a[0])*60 + (a[3]-a[1])-a[4]<<endl;
	return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

struct pkt
{
    int x, y;
};

int main()
{
    ios_base::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    vector<pkt> a(n), b(m);
    for (int i = 0; i < n; ++i)
        cin >> a[i].x >> a[i].y;
    for (int i = 0; i < m; ++i)
        cin >> b[i].x >> b[i].y;
    for (int i = 0; i < n; ++i)
    {
        int d = 1e9, nr = 1e9;
        for (int j = 0; j < m; ++j)
        {
            int dl = abs(a[i].x - b[j].x) + abs(a[i].y - b[j].y);
            if (dl < d)
            {
                d = dl;
                nr = j;
            }
        }
        cout << nr + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#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 complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    string s; cin >> s;
    vector<int> basis;
    per(i, n) {
        for(int b: basis) {
                chmin(a[i], a[i] ^ b);
        }
        if(a[i]) {
            if(s[i] == '0') basis.push_back(a[i]);
            else {
                cout << 1 << endl;
                return;
            }
        }      
    }
    cout << 0 << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	int t; cin >> t; rep(i, t)solve();
	//solve();
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int a[100005],dp[100005];

int main(){
	ios::sync_with_stdio(0);
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	if(n<=k){
		cout<<abs(a[0]-a[n-1]);
	}
	else{
		for(int i=0;i<=k;i++){
			dp[i]=abs(a[i]-a[0]);
		}
		for(int i=k+1;i<n;i++){
			dp[i]=INT_MAX;
			for(int j=1;j<=k;j++){
				dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
			}
		}
		cout<<dp[n-1];
	}
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

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

        int H = scanner.nextInt();
        int h = scanner.nextInt();
        int K = scanner.nextInt();
        int k = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        int X= H * a + h * b + H / 10 * c + h / 20 * d;
        int Y= K * a + k * b + K / 10 * c + k / 20 * d;
        if (X>Y)
            System.out.println("hiroshi");
        else if (X<Y)
            System.out.println("kenjiro");
        else
          System.out.println("even");
        }

    }



Measured memory_bytes: 26188
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}
 
 double func(int x){
   int sum=0;
   for(int i=1;i<=x;i++){
     sum+=i;
   }
   return (double)sum/(double)x;
   }

int main() {
  int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  int wa=0,so=0;
  for(int i=0;i<N;i++){
    int cnt=0;
    int x=a[i];
   if(x%2!=0){so++;continue;}
   while(x%2==0){
     cnt++;
     x/=2;
   }
   if(cnt>=2){wa++;}
  }
  bool ok=false;
  if(N%2==0){
    if(wa>=so){ok=true;}
    }
  else{
    if(wa>=so-1){ok=true;}
    }
  
  if(ok){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  
  return 0;
}

Measured memory_bytes: 640
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque
inf = 10 ** 15
mod = 10 ** 9 + 7

n,m = map(int, input().split())
ab = [[] for i in range(8)]
for i in range(m):
    a,b = map(int, input().split())
    ab[a-1].append(b-1)
    ab[b-1].append(a-1)


def dfs(visited, now):
    tmp = [visited[i] for i in range(n)]
    tmp[now] = True
    if all(tmp):
        return 1
    else:
        ret = 0
        for b in ab[now]:
            if not tmp[b]:
                ret+=dfs(tmp, b)
        return ret

print(dfs([False for i in range(n)], 0))

Measured memory_bytes: 43996
while 1:
    n=int(input())
    if n==0:break
    a={}
    for _ in range(n):
        b=list(map(int,input().split()))
        a[b[0]]=sum(b[1:8:2])*60+sum(b[2:9:2])
    a=sorted(a.items(),key=lambda x:x[1])
    for i in [0,1,-2]:print(a[i][0])



Measured memory_bytes: 6440
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
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;}

const int INF = 100000; 

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

    cout << n * 800 - (n / 15) * 200 << endl;
    
    return 0;
}


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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

long long dp[1000100]={};
long long dp2[1000100]={};

int dx[2]={1,2};
int dy[2]={2,1};

int X,Y;


int main(){
    int r; cin >> r;
    cout << r*r << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
using namespace std;
const int MOD = 1000000007; 
typedef long long ll;
typedef string str;
 
int main(){
  int a,b;
  char op;
  str line;
  getline(cin,line);
  split_str(line,' '){
    if(cnt == 0) a = i_str(res);  
    if(cnt == 1) op = *res.c_str();
    if(cnt == 2) b = i_str(res);  
  }
  printf("%d",op == '+' ? a + b : a - b);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mod (long)(1e9+7)
#define fi first
#define se second
signed main()
{
    int n,w;
    cin>>n>>w;
    pair<int,int> ar[n];
    sort(ar,ar+n);
    for(int i=0;i<n;++i)
    cin>>ar[i].fi>>ar[i].se;
    int dp[n+1][w+1];
    memset(dp,0,sizeof dp);
    
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<ar[i-1].fi;++j)
            dp[i][j]=dp[i-1][j];
        for(int j=ar[i-1].fi;j<=w;++j)
            dp[i][j]=max(dp[i-1][j-ar[i-1].fi]+ar[i-1].se,dp[i-1][j]);
    }
    
    cout<<dp[n][w];
    
    
    
}

Measured memory_bytes: 79104
// atcoder/abc092/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

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

  int n, d, x;
  while (cin >> n >> d >> x) {
    vector<int> a(n);
    cin >> a;
    int sum = 0;
    for (int i = 0; i < a.size(); ++i) {
      for (int j = 1; j <= d; j += a[i]) {
        ++sum;
      }
    }
    cout << sum+x << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int k; cin >> k;
  vector<int> a(k); REP(i, k) cin >> a[i];
  ll mn = 2, mx = 2;
  for (int i = k - 1; i >= 0; --i) {
    if (mx < a[i]) {
      cout << "-1\n";
      return 0;
    }
    mx = mx / a[i] * a[i];
    mn = (mn + a[i] - 1) / a[i] * a[i];
    if (mx < mn) {
      cout << "-1\n";
      return 0;
    }
    mx = mx + a[i] - 1;
  }
  cout << mn << ' ' << mx << '\n';
  return 0;
}


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

int n,m,q;
vector<int> a,b,c,d;
int ans;

void dfs(vector<int> s){
    if(s.size()==n+1){
         int now=0;
        for(int i=0;i<q;i++){
            if(s[b[i]]-s[a[i]]==c[i])now+=d[i];
        }
        ans=max(ans,now);
        return;
    }
    s.push_back(s.back());
    while(s.back()<=m){
        dfs(s);
        s.back()++;
    }
}

int main(){
    cin>>n>>m>>q;
    a = b = c = d = vector<int>(q);
    for(int i=0;i<q;i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    }
    dfs(vector<int>(1,1));
    cout<<ans<<endl;
}

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

#define int long long int
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int cmod = 998244353;
const int N = 3002;
const int inf = 1e16 + 2;

int n , vis[N][N];
double a[N];
double dp[N][N];

double get(int idx , int heads) {
    if(idx == n) {
        return (2 * heads >= n);
    }
    double &ans = dp[idx][heads];
    if(vis[idx][heads]) return ans;
    ans = a[idx] * get(idx + 1 , heads + 1) + (1 - a[idx]) * get(idx + 1 , heads);
    vis[idx][heads] = 1;
    return ans;
}
void solve(int Case) {
    cin >> n;
    for(int i = 0 ; i < n ; i ++) cin >> a[i];
    cout << fixed << setprecision(10) << get(0 , 0) << '\n';
}
/*
 */

int32_t main()
{
    fastio
    int testcase = 1;
    //cin >> testcase;
    int Case = 1;
    while(testcase --) {
        solve(Case ++);
    }
    return 0;
}
 



Measured memory_bytes: 96212
#include <bits/stdc++.h>
using namespace std;
long long oll = 0;
#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define pii pair<int,int>
#define lcm(a,b) a*b/__gcd(a,b)
#define fl(i,a,b) for(int i = a;i < b;i++)
#define lf(i,a,b) for(int i = b;i >= a;i--)
#define MEM(x,y) memset(x,y,sizeof(x))
#define mp make_pair


void solve()
{
    ll n;
    cin>>n;
    ll colors[n+5];
    ll freq[n+5];
    MEM(freq,0);
    fl(i,1,n+1){
        cin>>colors[i];
        freq[colors[i]]++;
    }
    ll total = 0;
    fl(i,0,n+1){
        if(freq[i] >= 2){
            ll temp = freq[i] * (freq[i]-1)/2;
            total += temp;
        }
    }
    //cout << total << endl;
    for(int i = 1;i <= n;i++){
        ll t = freq[colors[i]] - 1;
        ll sum = total - t;
        cout << sum << "\n";
    }
}

int main()
{
    FIO;
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    solve();
    return 0;
}


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

int main(){
	double x[4],y[4];
	char c;
	while(cin>>x[0]>>c>>y[0]>>c>>x[1]>>c>>y[1]>>c>>x[2]>>c>>y[2]>>c>>x[3]>>c>>y[3]){
		double a[4],b[4];
		for(int i=0;i<4;i++){
			a[i] = x[(i+1)%4]-x[i];
			b[i] = y[(i+1)%4]-y[i];
		}
		double c[4];
		for(int i=0;i<4;i++) c[i] = a[i]*b[(i+1)%4] - a[(i+1)%4]*b[i];
		int d = 0;
		for(int i=0;i<4;i++) if(c[i]>0.0) d++;
		if(d==4 or d==0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

Measured memory_bytes: 1216
from queue import Queue
k = int(input())
q = Queue(maxsize = 10000000)
for i in range(1,10):
    q.put(i)
if(k<10):
    print(k)
else:
    count = 0
    while(count<k-1):
        ele = q.get()
        temp = ele%10
        if(temp-1>=0):
            q.put(int(str(ele)+str(temp-1)))
        q.put(int(str(ele)+str(temp)))
        if(temp+1<=9):
            q.put(int(str(ele)+str(temp+1)))
        count+=1
    print(q.get())



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

using namespace std;
typedef long long ll;

int main()
{
  ll N, K;
  cin >> N >> K;
  vector<char> D(K);
  for (ll j=0; j < N; ++j) {
    cin >> D[j];
  }
  ll ans = -1, j=0;
  while (ans < 0) {
    string a = to_string(N+j);
    bool f = true;
    for (size_t i=0; i < a.length(); ++i) {
      for (ll k=0; k < K; ++k) {
        if (a[i] == D[k]) {
          f = false;
          break;
        }
      }
      if (!f) break;
    }
    if (f) ans = N+j;
    j+=1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

Measured memory_bytes: 256
#include<stdio.h>

void outputnum();


int main(void){
  int n,x;
  scanf("%d%d",&n,&x);
  while(n!=0 || x!=0){
    outputnum(n,x);
    scanf("%d%d",&n,&x);
  }
  return 0;
}

void outputnum(int n,int x){
  int i,j,k,sum=0,com=0;
  for(i=1;i<=n-2;i++){
    for(j=i+1;j<=n-1;j++){
      for(k=j+1;k<=n;k++){
	if( x == i + j + k ){
	  com++;
	}
      }
    }
  }
  printf("%d\n",com);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define int long long int
mt19937 rng(std::chrono::duration_cast<std::chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=10000005;
#define M 1000000007
#define double long double
#define BINF 1000000000000000
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
#define deb(x) cout << #x << " " << x << "\n";
const int LG = 22;

int d[405][405];

#undef int 
int main() {
#define int long long int
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0);
 

    int n, m;
    cin >> n >> m;
    int a[n][m];
    for(int i = 0; i < n * m; i++)
        for(int j = 0; j < n * m; j++)
            d[i][j] = BINF;
    string s[n];
    for(int i = 0; i < n; i++){
        cin >> s[i];
        for(int j = 0; j < m; j++){
            if(s[i][j] == '#') a[i][j] = 1;
            else a[i][j] = 0;
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            int u = i * m + j; 
            if(a[i][j] == 1) continue;
            d[u][u] = 0;

            if(i - 1 >= 0 and a[i - 1][j] == 0){
                int v = (i - 1) * m + j;
                d[u][v] = 1, d[v][u] = 1;
            }
            if(i + 1 < 0 and a[i + 1][j] == 0){
                int v = (i + 1) * m + j;
                d[u][v] = 1, d[v][u] = 1;
            }
            if(j - 1 >= 0 and a[i][j - 1] == 0){
                int v = i * m + j - 1;
                d[u][v] = 1, d[v][u] = 1;
            }
            if(j + 1 < m and a[i][j + 1] == 0){
                int v = i * m + j + 1;
                d[u][v] = 1, d[v][u] = 1;
            }
        }  
    }

    int ans = 0;
    for(int mid = 0; mid < n * m; mid++){
        for(int i = 0; i < n * m; i++){
            for(int j = 0; j < n * m; j++){
                d[i][j] = min(d[i][j], d[i][mid] + d[mid][j]);
            }
        }
    }

    for(int i = 0; i < n * m; i++){
        for(int j = 0; j < n * m; j++){
            if(d[i][j] != BINF){
                ans = max(ans, d[i][j]);
            }
        }
    }

    cout << ans << endl;
    
    


return 0;
}




Measured memory_bytes: 1536
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

ll dp[5001][5001];

ll dfs(int n,int s){
  if(n<0||n<s||s<0)return 0;
  if(dp[n][s]) return dp[n][s];
  if(n==s) return dp[n][s]= 1;
  return dp[n][s] = (dfs(n-1,max(0,s-1))+2*dfs(n-1,s+1))%MOD;
}

int main() {
  int N;cin >> N;
  string s;cin >> s;
  cout << dfs(N,s.length()) << endl;
  return 0;
}


Measured memory_bytes: 193280
/* https://atcoder.jp/contests/abc169/tasks/abc169_a */
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;

#define f first
#define s second 
#define forn(i, a) for (int i = 0;i < (a);++i)
#define for1(i, b) for (int i = 1; i <= (b);++i)
#define FORd(i, a) for (int i = (a)- 1;i >= 0;--i)
#define F0Rd(i, a, b) for (int i = (a)- 1;i >= (a);--i)
#define pb push_back
#define	lb lower_bound
#define	ub upper_bound
#define	sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert

const int MAX = INT_MAX;

int main() {
	
	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;
	
	return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  string a="";
  for(int i=0;i<s.size();i++){
    char p=s.at(i);
    if(p=='0'){a=a+'0';}
    if(p=='1'){a=a+'1';}
    if(p=='B'&&a.size()>0){a=a.substr(0,a.size()-1);}
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    *A, = map(int, open(0).read().split())
    N = A[0]
    A = A[1:]

    C = []
    B = [i for i in A if i % 2 == 0]
    for i in B:
        if (i % 3 == 0 or i % 5 == 0):
            C.append(0)
        else:
            C.append(1)
    
    if sum(C) == 0:
        print("APPROVED")
    else:
        print("DENIED")



main()

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

using namespace std;

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int answer = 0;
  for (int a = 0; a <= A; a++) {
    for (int b = 0; b <= B; b++) {
      int rest = X - (500 * a + 100 * b);
      if (rest < 0) continue;
      if (rest % 50 != 0) continue;

      int c = rest / 50;
      if (c <= C) {
        answer++;
      }
    }
  }
  cout << answer;

  return 0;
}


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

using namespace std;

#define sz(a) int(a.size())

int main() {
	int n;
	cin >> n;
	vector <pair <pair <string,int> , int > > V (n);
	for (int i = 0; i < n; i++) {
		cin >> V[i].first.first >> V[i].first.second;
		V[i].first.second *= -1;
		V[i].second = i;
	}
	sort(begin(V), end(V));

	for (int i = 0; i < n; i++) {
		cout << V[i].second+1 << endl;
	}
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#define ll long long
using namespace std;

int main(){

  int X, Y;
  cin >> X >> Y;

  if (Y % 2 != 0) {cout << "No" << endl; return 0;}

  bool can = false;
  int kame, reg;
  for (int turu=0; turu<=X; turu++){
    kame = X - turu;
    reg = (2 * turu) + (4 * kame);
    if (reg == Y) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 2960
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  
  if ( N % 1110 < 10 || N % 1000 % 111 == 0){
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
}

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

using namespace std;

typedef long long int ll;

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

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	ll N;
	cin >> N;
	for(ll h = 1; h <= 3500; h++){
		for(ll n = 1; n <= 3500; n++){
			ll x = N*h*n;
			ll y = 4*h*n-N*n-N*h;
			if(y > 0 && x%y == 0){
				cout << h << " " <<  n << " " <<  x / y << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		if(N.indexOf('7') >= 0){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	}
}


Measured memory_bytes: 26996
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
k = [list(map(int,input().split())) for p in [0]*m]
p = list(map(int,input().split()))

ans = 0
for bit in range(2**n):
	flag = 1
	for x in range(m):
		t = 0
		for y in range(k[x][0]):
			t = t +  2 ** (k[x][y+1]-1)
		s = bit & t
		search = 0
		while (s != 0):
			search += s%2
			s = s//2
		if search%2 != p[x]:
			flag = 0
	if flag == 1:
		ans += 1
print(ans)

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

#define range(i, l, r) for (int i = (int)l; i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = ((int)(r) - 1); i >= (int)l; --(i))

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rwhole(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using int32 = int;
using int64 = long long;

const int mod     = 1e9 + 7;
const int32 inf   = 1001001001;
const int64 infll = 1001001001001001001ll;

const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(16); cerr << fixed << setprecision(16); } } iosetup;

template <typename T = int64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solver() {
  int N = input();
  
  int ans = 0;
  range(i, 1, N + 1) {
    if (int(log10(i)) & 1) continue;
    ans++;
  }

  cout << ans << endl;
}

signed main(int argc, char *argv[]) {
  solver();
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
// bool operator<(const pair<int, int> &a, const pair<int, int> &b)
// {
//     if (a.first == b.first)
//         return a.second < b.second;
//     return a.first < b.first;
// };

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

/*bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}*/

int N, H, W;
double arr[3000];
double dp[3000][3000];
vector<int> v1, v2;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(12);
    int A, B, C;
    cin >> A >> B >> C;
    if (A + B >= C)
    {
        cout << B + C << endl;
    }
    else
    {
        cout << B + C - (C - (A + B) - 1) << endl;
    }
    return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int    n, a;
    double t;
    cin >> n >> t >> a;
    double h[n];

    double v[n];
    int    check = 0;
    double minV  = INF;
    double x     = 0.0;
    int    ans   = 0;
    rep(i, n) {
        cin >> h[i];
        v[i]  = t - h[i] * 0.006;
        check = i;
        // cout << abs(v[i] - a) << endl;
        minV = min(minV, abs(v[i] - a));
        if (minV == abs(v[i] - a)) {
            ans = check;
        }
    }
    // rep(i, n) { cout << h[i] << " "; }
    // 処理

    // int cnt = 0;
    // rep(i, n) { value[i] = t - h[i] * 0.0006; }
    // x    = abs(a - h[i]);
    // minV = min(minV, x);

    // h[i] = t - h[i] * 0.006;
    // if (minV == h[i]) {
    //     ans = i;
    // }
    // 出力
    cout << ans + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define MOD  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
#define ps push_back
#define all(x) x.begin(),x.end()
double pi = 3.141592653589793;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//ここから始めよう
double dp[333][333][333];
signed main(){
    int n;cin>>n;
    int a[4]={};
    rep(i,0,n){
        int x;cin>>x;a[x]++;
    }
    rep(k,0,a[3]+1)rep(j,0,a[2]+a[3]+1)rep(i,0,a[1]+a[2]+a[3]+1){
        double t=0;
        if(i==0&&j==0&&k==0){
            dp[i][j][k]=0;continue;
        }
        if(i)t+=i*dp[i-1][j][k];
        if(j)t+=j*dp[i+1][j-1][k];
        if(k)t+=k*dp[i][j+1][k-1];
        t/=(double)(i+j+k);
        double jj=(double)n/(double)(i+j+k);
        t+=jj;
        dp[i][j][k]=t;
        //cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<endl;
    }
    cout<<setprecision(15)<<dp[a[1]][a[2]][a[3]]<<endl;return 0;
}

Measured memory_bytes: 262272
#include<stdio.h>
int main()
{
    int a,b,h,m,x;
    while(scanf("%d",&x)!=EOF){
   h=x/3600;
   a=x%3600;
   m=a/60;
   b=a%60;
    printf("%d:%d:%d\n",h,m,b);}
    return 0;
}



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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) {
        cin >> a[i];
    }
    long long dp[n+2][n+1] = {0};
    reverse(a.begin(), a.end());
    for(int i=0; i<n; i++) {
        for(int j=n-1-i; j<n; j++) {
            if(j == n-1-i) {
                dp[i][j] = a[i];
            } else {
                dp[i][j] = max(dp[i][n-1-i]-dp[i-1][j], dp[n-1-j][j]-dp[i][j-1]);
            }
        }
    }
    /*
    for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    cout << dp[n-1][n-1];
    // What is important so far
    // current change
    return 0;
}


Measured memory_bytes: 70656
#include <vector>
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <cstdio>
#include <utility>
#include <bitset>
#include <complex>
#include <stack>
#include <tuple>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const ll INF = 1e7;
int main(){
	ll N;
	cin >> N;
	vector<string> area(N);
	for(ll i=0;i<N;i++)
		cin >> area[i];
	ll todo=0;
	for(ll x=0;x<N;x++){
		bool flag=false;
		for(ll y=0;y<N;y++){
			if(area[y][x]=='.')
				flag=true;
		}
		if(flag)
			todo++;
	}
	ll ans=INF;
	bool emp=true;
	for(int y=0;y<N;y++)
		for(int x=0;x<N;x++)
			if(area[y][x]=='#')
				emp=false;
	if(emp){
		cout << -1 << endl;
		return 0;
	}
	for(ll base=0;base<N;base++){
		ll cost=INF;
		bool flag=true;
		for(ll x=0;x<N;x++)
			if(area[base][x]=='.')
				flag=false;
		if(flag)
			cost=0;
		else{
			bool exist=false;
			for(ll y=0;y<N;y++){
				if(area[y][base]=='#')
					exist=true;
			}
			if(exist){
				cost=0;
				for(ll x=0;x<N;x++)
					if(area[base][x]=='.')
						cost++;
			}else{
				cost=1;
				for(ll x=0;x<N;x++)
					if(area[base][x]=='.')
						cost++;
			}
		}
		ans=min(ans,(ll)cost+todo);
	}
	if(ans==INF)
		cout << -1 << endl;
	else
		cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512