akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first 
#define se second
ll fac[N];
ll ksm(ll a,ll n){
	ll ans=1;
	while(n){
		if(n&1) ans=ans*a%mod;
		a=a*a%mod;
		n>>=1; 
	}
	return ans;
}
ll C(ll n,ll m){
	return fac[n]*ksm(fac[m]*fac[n-m]%mod,mod-2)%mod;
}
int main(){
	int h,w,a,b;
	scanf("%d%d%d%d",&h,&w,&a,&b);
	fac[0]=1;
	for(int i=1;i<=2e5+5;i++)
		fac[i]=i*fac[i-1]%mod;
	ll ans=0;
	for(int i=b;i<=w-1;i++){
		ans+=C(h-a+i-1,i)*C(a+w-i-2,w-i-1)%mod;
		ans%=mod;
	}
	printf("%lld\n",(ans%mod+mod)%mod);
	return 0;
}

Measured memory_bytes: 5384
n, a, b = map(int, input().split())
mod = 10**9 + 7
 
def powerDX(n, r, mod):
  if r == 0: return 1
  if r%2 == 0:
    return pow(n*n % mod, r//2, mod) % mod
  if r%2 == 1:
    return n * pow(n, r-1, mod) % mod
 
def combination(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * powerDX(denom, mod-2, mod) % mod
 
ans = pow(2, n, mod) - 1
ans -=  combination(n, a, mod)
ans -=  combination(n, b, mod)
ans += 3*mod
ans %= mod
print(ans)

Measured memory_bytes: 3064
#include <cstdio>

int main()
{
	int n;
	scanf("%d", &n);
	switch (n % 10 ) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			printf("hon\n");
			break;
		case 0:
		case 1:
		case 6:
		case 8:
			printf("pon\n");
			break;
		case 3:
			printf("bon\n");
			break;
	}

	return 0;
}


Measured memory_bytes: 1644
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <utility>
#include <map>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}

int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll cnt=0;
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]<0)
            cnt++;
        ans+=abs(a[i]);
        a[i]=abs(a[i]);
    }
    sort(a.begin(),a.end());
    if(cnt%2!=0)
    {
        ans-=(2*a[0]);
    }
    
    
    cout<<ans<<endl;
    return 0;
}




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

using namespace std;

int main()
{
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for (int i = 0; i < M; i++)
    cin >> B[i];
  vector<vector<int>> A(N, vector<int>(M));
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++)
      cin >> A[i][j];
  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    int tmp = C;
    for (int j = 0; j < M; j++)
      tmp += A[i][j] * B[j];
    if (0 < tmp)
      ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
struct uftree{
private:
  vector<int> par,rank,val;
  int siz;
public:
  uftree(int n){
    par.resize(n+5,0);
    rank.resize(n+5,0);
    val.resize(n+5,0);
    siz=n;
    for(int i=0;i<=n;i++) par[i]=i;
  }
  int find(int x){
    return (par[x]==x?x:par[x]=find(par[x]));
  }
  bool val_set(int x,int y){
    x=find(x);
    if(val[x]==0||val[x]==y){
      val[x]=y;
      return true;
    }
    else return false;
  }
  bool same(int x,int y){return find(x)==find(y);};
  bool unite(int x,int y){
    x=find(x);
    y=find(y);
    if(val[x]!=0&&val[y]!=0&&val[x]!=val[y]) return false;
    if(rank[x]<rank[y]){
      par[x]=y;
      val[y]=max(val[x],val[y]);
    }
    else{
      par[y]=x;
      val[x]=max(val[x],val[y]);
      if(rank[x]==rank[y]) rank[x]++;
    }
    return true;
  }
};
int main(){
  int n,m,k;
  cin>>n>>m>>k;
  uftree uf=uftree(n+5);
  int ans=0;
  bool f=false;
  for(int i=1;i<=k;i++){
    int t,a,b;
    cin>>t>>a>>b;
    if(f) continue;
    if(t==1){
      if(!uf.unite(a,b)){
        ans=i;
        f=true;
      }
    }
    else{
      if(!uf.val_set(a,b)){
        ans=i;
        f=true;
      }
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3856
using System;

namespace UnityChan
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			int a, b, c;

			string[] str = Console.ReadLine ().Split(' ');
			a = int.Parse (str[0]);
			b = int.Parse (str[1]);
			c = int.Parse (str[2]);

			if ((a < b) && (b < c))
				Console.WriteLine ("Yes");
			else
				Console.WriteLine ("No");
			

		}
	}
}

Measured memory_bytes: 8876
class Segtree():

    def __init__(self, n):
        self.num = 1 << (n - 1).bit_length()
        self.tree = [0] * 2 * self.num
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = max(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = max(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        res = 0
        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = max(res, self.tree[l])
                l += 1
            if r & 1:
                res = max(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res


n, k = map(int, input().split())
a = [int(input()) for _ in range(n)]

num = max(a) + k + 1
seg_dp = Segtree(num)
for ai in a:
    tmp = seg_dp.query(max(ai - k, 0), min(ai + k + 1, num))
    seg_dp.update(ai, tmp + 1)
print(max(seg_dp.tree))


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

int main()
{
  int W, H, N;
  cin >> W >> H >> N;

  vector<vector<bool>> c(W, vector<bool>(H, true));
  int x, y, a;
  for (int i = 0; i < N; i++)
  {
    cin >> x >> y >> a;
    if (a == 1)
    {
      for (int j = 0; j < x; j++)
      {
        for (int k = 0; k < H; k++)
          c[j][k] = false;
      }
    }
    else if (a == 2)
    {
      for (int j = x; j < W; j++)
      {
        for (int k = 0; k < H; k++)
          c[j][k] = false;
      }
    }
    else if (a == 3)
    {
      for (int j = 0; j < W; j++)
      {
        for (int k = 0; k < y; k++)
          c[j][k] = false;
      }
    }
    else if (a == 4)
    {
      for (int j = 0; j < W; j++)
      {
        for (int k = y; k < H; k++)
          c[j][k] = false;
      }
    }
  }
  int count = 0;
  for (int i = 0; i < W; i++)
  {
    for (int j = 0; j < H; j++)
    {
      if (c[i][j])
        count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
def swap(x, y, z, temp):
    temp = x
    x = z
    z = y
    y = temp
    print(x, end = ' ')
    print(y, end = ' ')
    print(z)

input_number = list(map(int, input().strip().split(' ')))
tmp = 0
n = 3

swap(input_number[0], input_number[1], input_number[2], tmp)

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

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> ii;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vii;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<vector<ld>> vvld;
typedef vector<bool> vbl;
typedef vector<vbl> mbl;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(s) (s).begin(), (s).end()
const ll MOD = 1e9 + 7;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    ll x;
    cin >> x;
    ll p = 100, itr = 0;
    while (p < x){
        p += p/100;
        itr++;
    }
    cout << itr << endl;
    return 0;
}

Measured memory_bytes: 3640
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

total = 0; pre_num = -1
for i in A:
    total = total + B[i-1]
    if pre_num+1 == i:
        total = total + C[pre_num-1]
    pre_num = i

print(total)

Measured memory_bytes: 3316
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();
		int kazu[] = new int[N+1];
		boolean flag = true;
		int ans = -1;

		//インクルメント
		for (int i=0; i<=N; i++){
			kazu[i] = -1;
		}

		for(int i = 0; i < M; i++){
			int s = scan.nextInt();
			int c = scan.nextInt();
			if (kazu[s] != -1 && kazu[s] != c ) flag =false;
			if (s == 1 && c == 0 && N != 1)flag = false;
			kazu[s] = c;
		}

		if(flag){
			String str = "";
			for(int i = 1; i <= N; i++){
				if(kazu[i] == -1) {
					kazu[i] = 0;
					if(i == 1 && N != 1)kazu[i] =1 ;
				}
				str += Integer.toString(kazu[i]);
			}
			ans = Integer.parseInt(str);
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 23252
n=int(input())
an=[int(i) for i in input().split()]
an.sort()
maxA=an[-1]

ans_table=[0]*(maxA+1)


for ai in an:
    for k in range(1,int(maxA/ai)+1):
        ans_table[ai*k]+=1
ans=0
for ai in an:
    if ans_table[ai]==1:
        ans+=1

print(ans)

Measured memory_bytes: 32192
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        x: i64,
        k: i64,
        d: i64,
    }


    //let hugou;
    let x_abs = x.abs();
    let move_num = x_abs / d;
    let pos = x_abs % d;

    let mut ans = pos;
    if move_num > k {
        ans = x_abs - d*k;
    } else {
        let remaining_move = k - move_num;
        if remaining_move == 0 {
            ans = pos;
        }
    
        if remaining_move % 2 == 0 {
            ans = pos;
        } else {
            ans = (pos - d.abs()).abs();
        }
    }

    println!("{}", ans);
}


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

using namespace std;

string S,T;

int main(void) {
    cin>>S>>T;
    bool F = true;

    for(int i = S.size() - T.size();i >= 0;i--) {
        bool flag = false;
        string temp = S.substr(i,T.size());
        for(int j = 0;j < T.size();j++) {
            if(temp[j] == '?')
                continue;
            if(temp[j] != T[j]) {
                flag = true;
                break;
            }
        }
        if(!flag) {
            S = S.erase(i,T.size());
            S.insert(i,T);
            F = false;
            break;
        }
    }

    for(int i = 0;i < S.size();i++)
        if(S[i] == '?') {
            S[i] = 'a';
        }

    if(!F)
        cout<<S<<endl;
    else
        cout<<"UNRESTORABLE"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    map<vi, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        vi cnt('z' - 'a' + 1);
        rep(j, sz(s)) {
            cnt[s[j] - 'a']++;
        }
        mp[cnt]++;
    }
    ll ans = 0;
    for (auto p : mp) {
        ans += (ll)p.se * ((ll)p.se - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 19072
loop do
  n=gets.to_i
  break if n==0
  ts = []
  n.times do |i|
    t = {}
    t[:no]=i
    arr=gets.chomp.split
    t[:name]=arr[0]
    t[:lose]=0
    t[:win]=0
    for i in arr[1,n] do
      t[:lose]+=1 if i=='1'
      t[:win]+=1 if i=='0'
    end
    ts << t
  end

  ts.sort! do |a,b|
    (b[:win] <=> a[:win]).nonzero? or (a[:lose] <=> b[:lose]).nonzero? or (a[:no] <=> b[:no]).nonzero?
  end

  for t in ts do
    puts t[:name]
  end
end

Measured memory_bytes: 6112
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
import std.concurrency;
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}
// fold was added in D 2.071.0.
template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
        static if (S.length < 2) {
            return reduce!fun(seed, r);
        } else {
            return reduce!fun(tuple(seed), r);
        }
    }
}

void main() {
    int N; long x;
    readf("%d %d\n", &N, &x);
    long[] ary = readln.split.to!(long[]);
    N.iota.map!((i) {
        long s = max(0, ary[i]-x);
        ary[i] = min(ary[i], x);
        if (i>0) {
            s += max(0, ary[i]+ary[i-1]-x);
            ary[i] = min(ary[i], x-ary[i-1]);
        }
        return s;
    }).sum.writeln;
}


Measured memory_bytes: 3784
from sys import stdin, stdout


n = int(stdin.readline())
step = [1]

cur = 6
while cur <= n:
    step.append(cur)
    cur *= 6

cur = 9
while cur <= n:
    step.append(cur)
    cur *= 9
    
dp = [float('inf') for i in range(n + 1)]
dp[0] = 0

for i in range(n):
    if dp[i] == float('inf'):
        continue
    
    for v in step:
        if v + i <= n:
            dp[i + v] = min(dp[i + v], dp[i] + 1)
    
stdout.write(str(dp[n]))

Measured memory_bytes: 6296
#include "bits/stdc++.h"
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}//continue break
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define fastio  cin.sync_with_stdio(0); cin.tie(0);cin.exceptions(cin.failbit);
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<pii> vpii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
   
    fastio;
    int T=1;
    // cin>>T;
    while(T--){
        ll k;cin>>k;
        ll ans=-1;
        ll num=7;
        ll temp=1;
        while(temp<=(10000000)){
            if(num%k==0){
                ans=temp;
                break;
            }
            num=num*10+7;num%=k;
            temp++;
        }
        cout<<ans;
    }   
    timecalculater();
    return 0;   
} 

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;


const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll MAXN = 2e5 + 10;
const ll INF = 1e18;
ll po(ll x, ll t){
	if (t == 0) return 1;
	if (t % 2 == 1) return (x * po((x * x), t / 2));
	return po((x * x), t / 2);
	
}

ll n, p;
int main(){
	IOS;
	cin >> n >> p;
	ll Cnt;
	ll ans = 1;
	if (n == 1) kill(p);
	for (int i = 2; i <= 1000000; i++){
		ll PP = p;
		Cnt = 0;
		while (p % i == 0){
			Cnt ++;
			p /= i;
		}
		ans *= (po(i, Cnt / n));
		
	}
	cout << ans;
	
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

ll factor(ll x) {
    map<ll, ll> m;
    if(x == 1) {
        m[1]++;
        return 1;
    }
    ll temp = x;
    for(ll i = 2;i * i <= x;i++) {
        while(temp % i == 0) temp /= i, m[i]++;
    }
    ll ans = 1;
    iter(i, m) ans *= i.second + 1;
    return ans;
}

int main(void) {
    ll N;
    ll ans = 0;
    cin >> N;
    repi2(i, 1, N) {
        if(factor(i) == 8) ans++;
        i++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,n) for(int i=(int)(n-1);i>=0;--i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x)*(x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    vvc chartable;
    chartable.push_back({'.',',','!','?',' '});
    chartable.push_back({'a','b','c'});
    chartable.push_back({'d','e','f'});
    chartable.push_back({'g','h','i'});
    chartable.push_back({'j','k','l'});
    chartable.push_back({'m','n','o'});
    chartable.push_back({'p','q','r','s'});
    chartable.push_back({'t','u','v'});
    chartable.push_back({'w','x','y','z'});

    int n;
    cin >> n;
    REP(i, n) {
        string s;
        cin >> s;
        int a = -1, b = 0;
        REP(j, SZ(s)) {
            if (s[j] == '0') {
                if (a != -1) {
                    cout << chartable[a][b];
                }
                a = -1;
            } else {
                if (a != s[j] - '0' - 1) {
                    a = s[j] - '0' - 1;
                    b = -1;
                }
                b = (b + 1) % SZ(chartable[a]);
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 2984
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) ((m).find((a)) != m.end())
#define CONTAINS_SET(m, a) ((m).find((a)) != m.end())
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }



signed main()
{
	string s;
	cin >> s;
	string ans;
	for (int i = 0; i < s.length(); i += 2) ans += s[i];
	cout << ans << endl;
}



Measured memory_bytes: 3700
// AtCoder150 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int revcompare(const void* a, const void* b) {
    return *(int*)b- *(int*)a;
}

int main(void)
{
    int i,j,n;
    
    scanf("%d", &n);
    int* a = (int*)malloc(sizeof(int) * n);
    int min = 1000000000;
    for(i=0;i<n;i++){
        scanf("%d", a+i);
        for(j=0;*(a+i) % 2 == 0; *(a+i) /= 2, j++);
        if(min > j) min = j;
    }
    printf("%d", min);
    return 0;

}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        new Main().solve();
    }

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(System.out);
    StringTokenizer st;

    int readInt() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine(), " ");
        }
        return Integer.parseInt(st.nextToken());
    }

    String next() throws IOException {
        while (st == null  || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine(), " ");
        }
        return st.nextToken();
    }

    long N;
    char[][] arr = new char[105][2105];
    boolean[][] vis = new boolean[105][2105];
    void solve() throws IOException {
        N = readInt();
        out: for (int i = 0; i < N; i++) {
            String[] strs = in.readLine().split(" ");
            int[] arr = new int[strs.length];
            for (int j = 0; j < strs.length; j++) {
                arr[j] = Integer.parseInt(strs[j]);
            }
            int l = 0, r = 0;
            for (int j = 0; j < arr.length; j++) {
                if (arr[j] > l) {
                    l = arr[j];
                } else if (arr[j] > r) {
                    r = arr[j];
                } else {
                    out.println("NO");
                    continue out;
                }
            }
            out.println("YES");
        }
        out.flush();
    }




}



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

typedef long long ll;
const int inf = 1e9;
ll k;

int main(){
	cin>>k;
	ll cur = 7 % k;
	for(int i = 0; i < k; ++i){
		if(cur == 0){
			cout<<i + 1<<endl;
			return 0;
		}
		cur *= 10 % k;
		cur += 7;
		cur %= k;
	}
	cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>
#include <stack>
#include <iomanip>
#include <sstream>

using namespace std;

template <typename T>
inline bool sign(T A) {
    return (A>0)-(A<0);
}

#define REP(i,s,n) for(int i=s; i!=n; i+=sign(n-s))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

#define MOD (1'000'000'000+7)

bool _less(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

template <template<class,class,class...> class C, typename K, typename V, typename... Args>
V map_get(const C<K,V,Args...>& m, K const& key, const V & defval)
{
    typename C<K,V,Args...>::const_iterator it = m.find( key );
    if (it == m.end())
        return defval;
    return it->second;
}

int N, K;
int a[100];
int dp[100001];

bool solve(int k) {
    if (k < a[0]) return false;
    if (dp[k] != 0) return dp[k] == 1;
    
    bool res = false;
    REP(i, 0, N) {
        if (k-a[i] >= 0) {
            res |= !solve(k-a[i]);
        }
    }
    dp[k] = res?1:-1;
    return res;
}

int main() {
    cin >> N >> K;
    REP(i, 0, N) {
        cin >> a[i];
    }
    
    cout << (solve(K)?"First":"Second") << endl;
    
    
}


Measured memory_bytes: 3712
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1LL << 60;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<pll> pos;
  map<ll,ll> xm,ym;
  vvl a(n, vl(n, 0)), s(n, vl(n, 0));
  rep(i,n) {
    ll x,y;
    cin >> x >> y;
    pos.emplace_back(x,y);
    xm[x] = 0;
    ym[y] = 0;
  }
  int xcnt = 0, ycnt = 0;
  vl xpos(n), ypos(n);
  for (auto& x : xm) {
    xpos[xcnt] = x.first;
    x.second = xcnt++;
  }
  for (auto& y : ym) {
    ypos[ycnt] = y.first;
    y.second = ycnt++;
  }
  for (auto& pt : pos) {
    ll x = pt.first, y = pt.second;
    a[xm[x]][ym[y]] = 1;
  }
  s[0][0] = a[0][0];
  REP(j, 1, n) {
    s[0][j] = s[0][j-1] + a[0][j];
  }
  REP(i, 1, n) {
    s[i][0] = s[i-1][0] + a[i][0];
    REP(j, 1, n) {
      s[i][j] = s[i-1][j] + s[i][j-1] - s[i-1][j-1] + a[i][j];
    }
  }
  // rep(i,n) {
  //   rep(j,n) {
  //     cout << a[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  // cout << endl;
  // rep(i,n) {
  //   rep(j,n) {
  //     cout << s[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  ll ans = (xpos[n-1] - xpos[0]) * (ypos[n-1] - ypos[0]);
  REP(i0, -1, n - 1) {
    REP(i1, i0 + 1, n) {
      REP(j0, -1, n - 1) {
        REP(j1, j0 + 1, n) {
          ll cnt = s[i1][j1];
          if (i0 >= 0) cnt -= s[i0][j1];
          if (j0 >= 0) cnt -= s[i1][j0];
          if (i0 >= 0 && j0 >= 0) cnt += s[i0][j0];
          if (cnt >= k) {
            ll s = (xpos[i1] - xpos[i0+1]) * (ypos[j1] - ypos[j0+1]);
            // cout << xpos[i0+1] << "," << ypos[j0+1] << " x " << xpos[i1] << "," << ypos[j1] <<  " : " << s << endl;
            ans = min(ans, s);
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

struct pepe {
    int y1, x1, y2, x2;
};

int m, n, tab[503][503];
vector <pepe> ans;

int main() {
    cin >> m >> n;
    for (int y = 1; y <= m; y++) {
        for (int x = 1; x <= n; x++) {
            cin >> tab[y][x];
        }
    }
    for (int y = 1; y <= m; y++) {
        for (int x = 1; x <= n; x++) {
            if (tab[y][x] % 2) {
                if (x < n) {
                    tab[y][x]--;
                    tab[y][x + 1]++;
                    ans.push_back({y, x, y, x + 1});
                } else if (y < m) {
                    tab[y][x]--;
                    tab[y + 1][x]++;
                    ans.push_back({y, x, y + 1, x});
                }
            }
        }
    }
    cout << ans.size() << endl;
    for (auto i : ans) {
        cout << i.y1 << " " << i.x1 << " " << i.y2 << " " << i.x2 << endl;
    }
}

Measured memory_bytes: 5232
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var T = Console.ReadLine();

            if (S == T.Substring(0, T.Length - 1))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 25856
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int r;
    cin >> r;
    cout << r * r << '\n';
}


Measured memory_bytes: 3612
import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n,k = rl()
ans=0
for i in range(1,n+1):
    if i>=k:
        ans+=1/n
        continue
    if i>=k/2:
        ans+=1/2/n
        continue
    a=math.ceil(math.log2(k/i))
    ans+=(1/2)**a/n
    
print(ans)
    

Measured memory_bytes: 3440
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 310
#define INF LLONG_MAX/4
typedef long long ll;
 
ll N,a[MAX],s[MAX];
ll memo[MAX][MAX];
 
int getSize(ll v){
    int cnt = 0;
    while(v > 0){
        v /= 10; cnt++;
    }
    return cnt;
}
 
ll calc(ll X,ll Y){
    ll res = 0LL,c = 0;
    int size = max(getSize(X),getSize(Y));
    for(int i = 0 ; i < size ; i++){
        ll x = X%10,y = Y%10;
        c = (x + y + c) / 10;
        res += x*y+c;
        X /= 10; Y /= 10;
    }
    return res;
}
 
ll solve(int L,int R){
    if(L+1 == R) return 0;
    ll &res = memo[L][R];
    if(res != INF) return res;
    for(int i = L+1 ; i < R ; i++){
        ll cost = calc(s[i]-s[L],s[R]-s[i]);
        res = min(res,solve(L,i)+solve(i,R)+cost);
    }
    return res;
}
 
int main(){
    int N;
    cin >> N;
    for(int i = 0 ; i < N ; i++){
        cin >> a[i];
        s[i+1] = a[i] + s[i];
    }
    fill(memo[0],memo[0]+MAX*MAX,INF);
    cout << solve(0,N) << endl;
    return 0;
}

Measured memory_bytes: 3864
// Library
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

// TYPEDEFS
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

// CONSTANTS
#define SZA 0
#define SZB 0

// MACRO
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
#define ABS(X) (((X) > 0)? (X) : -(X))
#define YN(X) ((X)? "YES" : "NO")
#define SWAP(T, X, Y) {T t; t = X; X = Y; Y = t;}

#define F1 first
#define S2 second
#define PB push_back
#define MP make_pair


// Global Tables

//ull gPreProcess[SZA][SZB];

// Functions

void Print2DVector(vector<vector<int>>& v)
{
    ull i, j; 
    for(i = 0; i < v.size(); i++)
    {
        for(j = 0; j < v[i].size(); j++)
        {
            cout << v[i][j];
            if(j == v[i].size()-1)
            {
                cout << endl;
            }
            else
            {
                cout << " ";
            }
        }
    }
}

void PrintVector(vi& v)
{
    ull i;
    for(i = 0; i < v.size(); i++)
    {
        cout << v[i];
        if(i == v.size()-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PrintArr(int* a, ull N)
{
    ull i;
    for(i = 0; i < N; i++)
    {
        cout << a[i];
        if(i == N-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PreProcessTables()
{
    ull i, j;
    for(i = 0; i < SZA; i++)
    {
        for(j = 0; j < SZB; j++)
        {
            break;
        }
        break;
    }
}

void TC(int t)
{
    ull N, out, mod_val = 1E9+7, ten_pow = 1, eight_pow = 1, nine_pow = 1, ten = 10, eight = 8, nine = 9, n;
    cin >> N;
    if(N == 1)
    {
        out = 0;
    }
    else
    {
        n = N;
        while(n)
        {
            if(n&1)
            {
                ten_pow = (ten_pow*ten)%mod_val;
                nine_pow = (nine_pow*nine)%mod_val;
                eight_pow = (eight_pow*eight)%mod_val;
            }
            ten = (ten*ten)%mod_val;
            nine = (nine*nine)%mod_val;
            eight = (eight*eight)%mod_val;
            n >>= 1;
        }
        out = (mod_val + ten_pow + eight_pow - (2*nine_pow)%mod_val)%mod_val;
    }
    cout << out << endl;
}

// Main

int main(void)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    PreProcessTables();

    int T = 1, t;
    //cin >> T;
    for(t = 1; t <= T; t++)
    {
        TC(t);
    }
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int N, M;
  while(cin >> N >> M){
    cout << (N == M ? "Yes" : "No") << endl;
    
  }


  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
#define DOUBLE(d) cout << fixed << setprecision(15) << (d) << endl

const int MAX = 2e5+10;
const int INF = 2e9;

int N;
ll A[MAX];
vi adj[MAX];

vi dp;
ll ans[MAX];

void dfs(int v, int p) {
    int l = lower_bound(ALL(dp), A[v]) - dp.begin();
    ll cur = dp[l];
    CHMIN(dp[l], A[v]);
    ans[v] = lower_bound(ALL(dp), INF) - dp.begin() - 1;

    FORE (n, adj[v]) if (n != p) {
        dfs(n, v);
    }
    dp[l] = cur;
}

void solve() {
    dp = vi(MAX, INF);
    dp[0] = 0;
    dfs(0, -1);
    REP (i, N) cout << ans[i] << endl;
}

int main() {
    cin >> N;
    REP (i, N) cin >> A[i];
    REP (i, N-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    solve();
}

Measured memory_bytes: 30400
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
ll int large=(ll int)1e18;
ll int mod=(ll int)1e9+7;


ll int mod_exp(ll int x,ll int n)
{
    ll int result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=(x*x)%mod;
        n=n/2;
    }
    return result;
}

ll int mod_inverse(ll int a)
{
    return mod_exp(a,mod-2);
}



int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
ll int T,i,j,ij;
T=1;
//cin>>T;
while(T--)
{
    ll int x,n;
    cin>>x>>n;
    vector<ll int>v(n);
    rep(i,0,n)
    cin>>v[i];
    map<ll int,ll int>mp;
    rep(i,0,n)
    mp[v[i]]++;

    ll int aage=large;
    ll int peeche=large;

    rep(i,x,10000)
    {
        if(mp[i]==0)
        {
            aage=i;
            break;
        }
    }

    for(ll int i=x;i>=-10000;i--)
    {
        if(mp[i]==0)
        {
           // cout<<i<<endl;

            peeche=i;
        break;
        }
    }

    if(abs(x-peeche)<=abs(aage-x))
        cout<<peeche;
    else
        cout<<aage;




}
return 0;
}










Measured memory_bytes: 3664
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <vector>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
#include <iomanip>
#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)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define ll long long
using namespace std;
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;

int main()
{
	int n;
	cin >> n;
	vector<int> xl(n);
	vector<int> sxl(n);
	rep(i, n) {
		cin >> xl[i];
		sxl[i] = xl[i];
	}
	int ind = (n - 1) / 2 + 1;
	sort(sxl.begin(), sxl.end());

	rep(i, n) {
		int ans;
		int x = xl[i];
		int s = sxl[ind];
		if (x >= s) {
			ans = sxl[ind - 1];
		}
		else
		{
			ans = sxl[ind];
		}
		cout << ans << endl;
	}

	//cout << fixed << setprecision(10) << ans << endl;
	system("pause");
}



Measured memory_bytes: 4704
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef unsigned long long ll;


int main(){
	string S; cin >> S;
	if(S == "ABC") cout << "ARC" << endl;
	else cout << "ABC" << endl;
}

Measured memory_bytes: 3592
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heappop, heappush

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
ab = [LIST() for _ in range(N-1)]

def dijkstra(E, start):
   N_d = len(E)
   dist = [INF] * N_d
   dist[start] = 0
   q = [(0, start)]
   while q:
       dist_v, v = heappop(q)
       if dist[v] != dist_v:
           continue
       for u, dist_vu in E[v]:
           dist_u = dist_v + dist_vu
           if dist_u < dist[u]:
               dist[u] = dist_u
               heappush(q, (dist_u, u))
   return dist

E = [[] for _ in range(N)]

for a, b in ab:
	E[a-1].append((b-1, 1))
	E[b-1].append((a-1, 1))

d_f = dijkstra(E, 0)
d_s = dijkstra(E, N-1)

f = 0
s = 0
for i in range(N):
	if d_f[i] <= d_s[i]:
		f += 1
	else:
		s += 1

if f > s:
	print("Fennec")
else:
	print("Snuke")


Measured memory_bytes: 62440
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = ReadLine();


            var gyaku = "";

            for (int q = s.Length - 1; q >= 0; q--) {
                gyaku += s[q];
            }

            var re = 0;

            for (int i = 0; i < s.Length; i++) {
                if (s[i] != gyaku[i]) re++;
            }


            Console.WriteLine(re/2);
            ReadLine();
        }

        //メモ

        //配列
            //降順
            //var sort = array.OrderBy(x => -x).ToArray();

            //合計値
            //array.Sum();

        //kのn乗
        //(int) Math.Pow(k, n);

        //for文の逆
        //for(int i = array.Length - 1; i >= 0; i--) { }


        //最大公約数
        static int gcd(int a, int b)
        {
            if (a > b) {
                return gcd(b, a);
            }

            while (b != 0) {
                var remainder = a % b;
                a = b;
                b = remainder;
            }

            return a;
        }

        //最小公倍数
        static int lcm(int a, int b) => a * b / gcd(a, b);

        /// <summary>
        /// コンビネーション
        /// </summary>
        static int nCm(int n, int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m;
        }

        public static string ReadLine() => Console.ReadLine();
        public static int ReadLineInt() => int.Parse(Console.ReadLine());
        public static long ReadLineLongInt() => long.Parse(Console.ReadLine());
        public static string[] ReadLineStringSplit(char a = ' ') => ReadLine().Split(a).ToArray();
        public static int[] ReadLineIntSpilit(char a = ' ') => ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        public static long[] ReadLineLongSpilit(char a = ' ') => ReadLine().Split(a).Select(x => long.Parse(x)).ToArray();
        static string[] GetAplhaLowerArray() => new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
        static string[] GetAplhaUpperArray() => new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
    }
}


Measured memory_bytes: 11092