akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

template<typename T>
struct edge {
    int src, to;
    T cost;

    // to, costで初期化
    edge (int to, T cost) : src(-1), to(to), cost(cost) {}

    // src, to, costで初期化
    edge (int src, int to, T cost) : src(src), to(to), cost(cost) {}

    // toにxを代入？
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }

    // edge()でtoを返す？
    operator int() const {return to;}
};

template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<Edges<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

template<typename T>
vi topologicalSort (const WeightedGraph<T> &graph) {
    int sz = graph.size();
    vi ans;
    stack<int> st;
    vi h(sz);
    for(int i=0;i<sz;i++) {
        for(int j=0;j<graph[i].size();j++) {
            h[graph[i][j].to]++;
        }
    }

    for(int i=0;i<sz;i++) {
        if(h[i] == 0) {
            st.push(i);
            break;
        }
    }

    while(!st.empty()) {
        int i = st.top(); st.pop();
        ans.push_back(i);
        for(auto& j: graph[i]) {
            h[j]--;
            if(h[j] == 0) st.push(j);
        }
    }

    return ans;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  int n, m; cin >> n >> m;
  WeightedGraph<int> graph(n);
  WeightedGraph<int> graphinv(n);
  REP(i, n+m-1) {
    int a, b; cin >> a >> b;
    a--; b--;
    graph[a].pb(edge<int>(a, b, 0));
    graphinv[b].pb(edge<int>(b, a, 0));
  }

  vi sortedGraph = topologicalSort(graph);

  map<int, int> mp;
  REP(i, n) {
    mp[sortedGraph[i]] = i;
  }

  map<int, int> ans;

  RREP(i, n-1) {
    priority_queue<int> pq;
    int from = sortedGraph[i];
    if(SZ(graphinv[from]) == 0) {
      ans[from] = -1;
      continue;
    }
    REP(j, SZ(graphinv[from])) {
      pq.push(mp[graphinv[from][j].to]);
    }

    ans[from] = sortedGraph[pq.top()];
  }

  REP(i, n) {
    cout << ans[i] + 1 << endl;
  }



}

Measured memory_bytes: 21492
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST
import Data.Array.IO
import Data.Char
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
readInt = fst . fromJust . B.readInt
readInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine :: IO [Int]
readIntegers = map (fst . fromJust . B.readInteger) . B.words <$> B.getLine :: IO [Integer]
read2dInts = map (map (fst . fromJust . B.readInt) . B.words) . B.lines <$> B.getContents
readVInts = map (fst . fromJust . B.readInt) . B.lines <$> B.getContents

main :: IO ()
main = do
  (n:q:_) <- map read . words <$> getLine :: IO [Int]
  qs <- read2dInts
  solve n qs

solve n qs = do
  arr <- newArray (0, n) [] :: IO (IOArray Int [Int])
  forM_ qs $ \(query:t:qss) -> do
    at <- readArray arr t :: IO [Int]
    case query of
      0 -> do
        let ([x]) = qss 
        writeArray arr t (x:at) -- :: IO (IOArray Int [Int])
        return arr
      1 -> do
        putStrLn . unwords . map show $ reverse at 
        return arr
      2 -> do
        writeArray arr t [] -- :: IO (IOArray Int [Int])
        return arr
        


Measured memory_bytes: 259296
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();

    let n = s.len();
    let mut ans = 0;
    for i in 0..(1 << n - 1) {
        let mut temp = 0;
        let mut t = 0;
        for x in 0..n {
            t *= 10;
            t += s[x].to_digit(10).unwrap() as i64;
            if (i >> x) & 1 > 0 {
                temp += t;
                t = 0;
            }
        }
        temp += t;
        ans += temp;
    }

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


Measured memory_bytes: 4352
#include<stdio.h>

int main (void) {
   int h, m, s, x;
   scanf("%d", &x);

   h = x/3600;
   s = (x%3600)/60;
   m = (x%3600)%60;

   printf("%d:%d:%d\n", h, s, m);
   return 0;
}


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

int main(){
  string s;
  cin >> s;
  int ex = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'o'){
      ex++;
    }
  }
  cout << 700 + 100 * ex << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
using vi  = vector<int>;
using ii  = pair<int,int>;
using vii = vector<ii>;
using ll  = long long;

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

#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) int((x).size())
#define REP(i, a, b) for (auto (i) = (a); (i) <= (b); (i)++)
#define PER(i, a, b) for (auto (i) = (a); (i) >= (b); (i)--)
#define ITR(i, x) for (auto (i) = (x).begin(); (i) != (x).end(); (i)++)

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int n; ll d;
	cin >> n >> d;
	int cnt = 0;
	while (n--) {
		ll x, y;
		cin >> x >> y;
		if (x*x + y*y <= d*d) {
			cnt++;
		}
	}
	cout << cnt << '\n';
	return 0;
}

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

int main(){
    long long N;
    long long people[5];
    int i, k;
    cin >> N >> people[0] >> people[1] >> people[2] >> people[3] >> people[4];
    long long min_people = 1000000000000000;
    long long shortest;
    for(i=0;i<5;i++){
        if(people[i]<=min_people){
            min_people = people[i];
            k = i;
        }
    }
    if(N==people[k]){
        shortest = 5;
    }
    else{
        shortest = 5 + N/people[k];
        if(N%people[k]==0){
            shortest = shortest - 1;
        }
    }
    cout<<shortest;


    return 0;

}

Measured memory_bytes: 256
import           Data.List
main :: IO ()
main = do
    _ <- getLine
    a <- map read . words <$> getLine
    print . calc 0 0 . sortOn negate $ a
  where
    calc n i (a:ax) = calc (if even i then n + a  else n - a) (i + 1) ax
    calc n _ []     = n


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

int main(int argc, const char * argv[]) {
    bool bingo[3][3];
    // init
    for (int i = 0; i < 3; i++) {
        bingo[i][0] = false;
        bingo[i][1] = false;
        bingo[i][2] = false;
    }
    
    int A[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }
    
    int N;
    cin >> N;
    
    for (int i = 0; i < N; i++) {
        int b;
        cin >> b;
        
        // check hit
        for (int j = 0; j < 3; j++) {
            bool hit = false;
            for (int k = 0; k < 3; k++) {
                if (A[j][k] == b) {
                    bingo[j][k] = true;
                    hit = true;
                    break;
                }
            }
            if (hit) { break; }
        }
    }
    
    // check bingo
    if (bingo[1][1] == true) {
        if ((bingo[0][0] & bingo[2][2]) ||
            (bingo[0][2] & bingo[2][0]) ||
            (bingo[0][1] & bingo[2][1]) ||
            (bingo[1][0] & bingo[1][2])) {
            std::cout << "Yes" << endl;
            return 0;
        }
    }
    if ((bingo[0][0] & bingo[1][0] & bingo[2][0]) ||
        (bingo[0][0] & bingo[0][1] & bingo[0][2]) ||
        (bingo[0][2] & bingo[1][2] & bingo[2][2]) ||
        (bingo[2][0] & bingo[2][1] & bingo[2][2])) {
        std::cout << "Yes" << endl;
        return 0;
    }

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


Measured memory_bytes: 888
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  string S;
  cin >> N;
  cin >> S;

  vector<ll> W(N, 0), E(N, 0);
  if(S[0] == 'W'){
    W[0] = 1;
  }
  if(S[N-1] == 'E'){
    E[N-1] = 1;
  }
  rep(i, 1, N){
    if(S[i] == 'W'){
      W[i] = W[i-1] + 1;
    }else{
      W[i] = W[i-1];
    }
    if(S[N-1-i] == 'E'){
      E[N-1-i] = E[N-i] + 1;
    }else{
      E[N-1-i] = E[N-i];
    }
  }

  ll count_min=0;
  count_min = min(W[N-1-1], E[1]);

  rep(i, 1, N-1){
    count_min = min(count_min, E[i+1]+W[i-1]);
  }

  cout << count_min << "\n";

  return 0;
}

Measured memory_bytes: 5396
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;

const int MAX = 100;
const ll INF = (1LL << 32);

int n;
ll d[MAX][MAX];

void warshallFloyd() {
    rep(k, n) {
        rep(i, n) {
            if(d[i][k] == INF) {
                continue;
            }
            rep(j, n) {
                if(d[k][j] == INF) {
                    continue;
                }

                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main() {
    int e, u, v, c;
    cin >> n >> e;

    rep(i, n) {
        rep(j, n) {
            d[i][j] = ( (i == j) ? 0 : INF );
        }
    }

    rep(i, e) {
        cin >> u >> v >> c;
        d[u][v] = c;
    }

    warshallFloyd();

    bool negative = false;
    rep(i, n) {
        if(d[i][i] < 0) {
            negative = true;
        }
    }

    if(negative) {
        cout << "NEGATIVE CYCLE" << endl;
    }
    else {
        rep(i, n) {
            rep(j, n) {
                if(j) {
                    cout << " ";
                }
                if(d[i][j] == INF) {
                    cout << "INF";
                }
                else {
                    cout << d[i][j];
                }
            }
            cout << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>

using namespace std;

int main()
{
    int a, b, c, count = 0;
    cin >> a >> b >> c;

    for (int i = a; i <= b; i++)
    {
        if (c % i == 0)
        {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3112
object Main extends App {
  val N = io.StdIn.readLine.toInt

  val Ws = for (i <- 1 to N) yield io.StdIn.readLine

  val out = if (Ws.sliding(2).forall(w => w(0).last == w(1).head) && Ws.toSet.size == Ws.size) "Yes" else "No"

  println(out)
}


Measured memory_bytes: 25420
// #define _GLIBCXX_DEBUG

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
void dump_func()
{
    cerr << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&h, Tail &&... t)
{
    cerr << h << (sizeof...(Tail) == 0 ? "" : ", "),
        dump_func(forward<Tail>(t)...);
}
#define dump(...)                                                             \
    cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ \
         << "]" << endl,                                                      \
        dump_func(__VA_ARGS__), cerr << "*/\n\n";
typedef long long ll;

int main()
{
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll res = a - b;
    if (k % 2 != 0) {
        res *= -1;
    }
    cout << res << endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;

ll f(ll d, ll n){
    if(d == 0 && n < 100) return n;
    else if(d == 0) return n + 1;
    else if(n < 100){
        ll a = pow(100, d);
        //an = a + (n - 1) * d
        return a + (n - 1) * a;
    }
    else return  pow(100, d) + (n) * pow(100, d);
}

void solve(){
    int d, n;
    cin >> d >> n;
    cout << f(d, n);
}


int main(){
    int q = 1;
    //cin >> q;}
    while(q--) solve();
}
// vse dolzhny vyiti v internet po hhtp


Measured memory_bytes: 256
// Problem : A - Don't be late
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


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


#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar,n) for(int pen=0;pen<n;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define mem(ar,x) memset(ar,x,sizeof(ar))
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define rt return 0;
#define ct continue;
#define pb push_back
#define ll long long int
#define ff first
#define ss second
#define mod 1000000007
#define maxn 1000003
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main(){
	
	fastio;
	ll d,s,t;
	cin>>d>>s>>t;
	
	if(s*t>=d)cout<<"Yes";
	else cout<<"No";
	
	}


	
	
	
	



Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<cmath>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cout << '!' << endl;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int h,w,k;
	
	cin >> h >> w >> k;
	
	REP(i,h)
	{
		REP(j,w)
		{
			int n = 0;
			if((i+j) % (2*k) > (k-1))
			{
				n++;
			}
			if((i*((2*k)-1)+j) % (2*k) > (k-1))
			{
				n += 2;
			}
			
			cout << "RYGB"[n] ;
		}

		cout << endl;
	}
		
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

// union-find
struct union_find {
    vector<int> data;

    union_find(int size) {data.resize(size,-1);}

    int find(int x) {
        if (data[x] < 0) {return x;}
        return data[x] = find(data[x]);
    }

    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) {return false;}
        if (data[x] > data[y]) swap(x,y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }

    int size(int x) {return -data[find(x)];}
};


int main() {
    int n, m; cin >> n >> m;
    union_find uf(n);
    rep(i,m) {
        int x, y, z; cin >> x >> y >> z;
        x--; y--;
        if (uf.find(x) != uf.find(y)) {
            uf.unite(x,y);
        }
    }
    map<int,int> ct;
    rep(i,n) ct[uf.find(i)]++;
    cout << ct.size() << endl;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
 
#define forn(i, n) for (llong i = 0ll; i < (llong) n; ++i)
#define fornn(i, l, r) for (llong i = (llong) l; i < (llong) r; ++i)
#define size(x) ((int) (x.size()))
 
using namespace std;
 
typedef long long llong;
const llong inf = (llong) 1e+9 + 7ll;
const llong linf = (llong) 1e+18 + 7ll;
const long double eps = (long double) 1e-9;
const long double pi = acosl((long double) -1.0);
const int alph = 26;

mt19937 mrand(random_device{} ()); 

template<typename T, typename U> inline llong umin(const T& a, const U& b) { return a < b ? a : b; }
template<typename T, typename U> inline llong umax(const T& a, const U& b) { return a > b ? a : b; }
 
static char buff[(int) 2e6 + 17]; // reads std::string
const int maxn = (int) 2e5 + 17;

int n;
int a[maxn];

bool read()
{
	if (scanf("%d", &n) != 1)
		return false;

	forn (i, n)
		scanf("%d", a + i);

	return true;
}

void solve()
{
	if (*max_element(a, a + n) - *min_element(a, a + n) > 1)
	{
		printf("No\n");
		return ;
	}

	if (*max_element(a, a + n) == *min_element(a, a + n))
	{
		bool good = true;

		forn (i, n)
			if (a[i] != n - 1)
				good = false;

		if (good)
		{
			printf("Yes\n");
			return ;
		}
	}

	int mx = *max_element(a, a + n);
	int cnt = 0;

	forn (i, n)
		if (a[i] == mx - 1)
			++cnt;

	if (n - cnt == 1)
	{
		printf("No\n");
		return ;
	}

	if (cnt + 1 <= mx && mx <= cnt + (n - cnt) / 2)
		printf("Yes\n");
	else
		printf("No\n");
}

int main()
{
#if SEREZHKA
	freopen("file.in", "r", stdin);
#endif
 
	while (read())
		solve();
 
	return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;
int n, m;
int main()
{
    cin >> n >> m;

    for(int i = m / n; i >= 1; i--)
        if(m % i == 0 and 1LL * n * i <= 1LL * m)
        {
            cout << i;

            return 0;
        }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int n,k,i,t;
    while(scanf("%d %d %d",&n,&k,&i)==3)
    {
        if(k<i)
        {
            t=k;
            k=i;
            i=t;
        }
        if(k-i>n)
            printf("%d\n",k-i-n);
        else
            printf("0\n");
    }
    return 0;
}


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

int main(){
  int N;
  int tManzoku = 0;
  cin >> N;
  vector<int> Ryouri(N);
  vector<int> Manzoku(N);
  vector<int> mBonus(N-1);
  for(int i = 0; i < N; i++)
  cin >> Ryouri.at(i);
  for(int i = 0; i < N; i++)
  cin >> Manzoku.at(i);
  for(int i = 0; i < N-1; i++)
  cin >> mBonus.at(i);
  for(int i = 0; i < N; i++){
    tManzoku += Manzoku.at(Ryouri.at(i)-1);
    if(i != 0 && Ryouri.at(i - 1) + 1 == Ryouri.at(i))
    tManzoku += mBonus.at(Ryouri.at(i - 1) - 1);
  }
  cout << tManzoku << endl;
}

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

using namespace std;
using ll = long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

int a[2000];

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

    int n, m, sum = 0, c = 0;
    cin >> n >> m;
    REP(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    REP(i, n) {
        if (a[i] * 4 * m >= sum) {
            c++;
        }
    }
    Yn(c >= m);

  return 0;
}

Measured memory_bytes: 256
S=input()
ls=list(map(int,[S[i] for i in range(len(S))]))
l=len(S)
if l==1:
  print(S)
  exit()
su=0
sl=[]
a=0
for i in range(1<<l-1):
  ls=[]
  j=0
  x=0
  while j<l-1:
    if i&(1<<j):
      ls.append(S[x:j+1])
      x=j+1
    j+=1
    if j==l-1:
      ls.append(S[x:])
  su=sum(map(int,[ls[k] for k in range(len(ls))]))
  a+=su
print(a)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

constexpr int MOD = int(1e9) + 7;

int N, K;
vector<int> G[100010];

bool visited[100010];
i64 dfs(i64 u, int depth, int childID) {
    visited[u] = true;
    i64 res = depth == 0 ? K
                         : depth == 1 ? max(0, K - childID - 1)
                                      : max(0, K - childID - 2);

    int cnt = 0;
    for (const int nxt : G[u]) {
        if (visited[nxt]) continue;
        res *= dfs(nxt, depth + 1, cnt);
        res %= MOD;
        ++cnt;
    }

    return res;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    read(N, K);
    rep(i, 0, N - 1) {
        var(int, a, b);
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    print(dfs(0, 0, 0));

    return 0;
}


Measured memory_bytes: 10496
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
	int w, casecount = 0;
	while(cin >> w && w != 0){
		casecount++;
		int n;
		cin >> n;
		
		vector<vector<int> > table(n + 1, vector<int>(w + 1, 0));
		vector<pair<int, int> > trea;
		
		for(int i = 0; i < n; i++){
			pair<int, int> tmp;
			scanf("%d,%d", &tmp.first, &tmp.second);
			trea.push_back(tmp);
		}
		
		for(int i = 1; i < n + 1; i++){
			for(int j = 1; j < w + 1; j++){
				if(j < trea[i - 1].second){
					table[i][j] = table[i - 1][j] > table[i][j] ? table[i - 1][j] : table[i][j];
				}
				else{
					table[i][j] = table[i - 1][j] > trea[i - 1].first + table[i - 1][j - trea[i - 1].second] ? table[i - 1][j] : trea[i - 1].first + table[i - 1][j - trea[i - 1].second];
				}
			}
		}

		int max = -1, cost = -1;
		
		for(int j = 0; j < w + 1; j++){
			if(max < table[n][j]){
				max = table[n][j];
				cost = j;
			}
		}

		printf("Case %d:\n%d\n%d\n", casecount, max, cost);		
	}
	return 0;
}

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define rep(i, x)  for(int i = 0; i < (x); i++)
#define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
#define sqrt(x) sqrt(abs(x))
#define y1 y1_1234413
#define j1 j1_235
#define y0 y0_235
#define j0 j0_256
#define fi first
#define se second
#define re return
#define prev PREV
#define next NEXT
#define sz(x) ((int)x.size())

template<typename T> T sqr(T a) { re a * a; }
template<typename T> T gcd(T a, T b) { re b ? gcd(b, a % b) : a; }
template<typename T> T sgn(T a) { re a > 0 ? 1 : (a < 0 ? -1 : 0); }
template<typename T> T abs(T a) { re a > 0 ? a : -a; }

const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int MAXN = 100000;

#define FILENAME ""
               
int main() {
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    //	freopen(FILENAME ".in", "r", stdin);
    //	freopen(FILENAME ".out", "w", stdout);
   	ll n, m;
   	cin >> n >> m;
   	vector <ll> a;
   	ll sum = 0;
   	for (int i = 1; i <= n; i++) {
   		sum += m + i - 1;
   		a.pb(m + i - 1);	 	
   	}
   	ll ans = inf;
   	for (int i = 0; i < n; i++) {
   		ll sumi = 0;
   		for (int j = 0; j < n; j++) {
   		 	if (i != j) {
   		 	 	sumi += a[j];
   			}
   	 	}
   	 	ans = min(ans, abs(sum - sumi));
   	}
   	for (int i = 0; i < n; i++) {
   		ll sumi = 0;
   		for (int j = 0; j < n; j++) {
   		 	if (i != j) {
   		 	 	sumi += a[j];
   			}
   	 	}
   	 	if (abs(sum - sumi) == ans) {
   	 	 	cout << sumi;
   	 	 	re 0;
   	 	}
   	}
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect

class Solver(object):
    def __init__(self):
        self.n = int(input())
        self.t, self.a = list(map(int, input().split(" ")))
        self.locations = list(map(int, input().split(" ")))
        self.locations = [(x+1, self.t - (0.006*y)) for (x, y) in enumerate(self.locations)]
        self.locations.sort(key=lambda x: x[1])

    def solve(self):
        temps = [y for x, y in self.locations]
        b = bisect(temps, self.a)
        if b >= len(temps):
            print(self.locations[b-1][0])
        else:
            left = abs(self.a - self.locations[b-1][1])
            right = abs(self.a - self.locations[b][1])
            if left < right:
                print(self.locations[b-1][0])
            else:
                print(self.locations[b][0])

    def debug(self):
        for x in self.locations:
            print(x)


if __name__ == "__main__":
    s = Solver()
    s.solve()

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define lamsort(v,p) sort(v.begin(),v.end(),[](p a, p b){return a.num < b.num;});
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
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; }
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

ll dp[105][100005];
ll weight[105], value[105];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,w; cin >> n >> w;
    rep(i,n) cin >> weight[i] >> value[i];
    
    rep(i,n) {
        rep(j,w+1) {
            if(j>=weight[i]) chmax(dp[i+1][j],dp[i][j-weight[i]]+value[i]);
            chmax(dp[i+1][j],dp[i][j]);
        }
    }
    cout << dp[n][w] << endl; 
    return 0;
}

Measured memory_bytes: 79360
#include<stdio.h>
	int a,i;
	char b[100010];
int main(){
	scanf("%s",b);
	scanf("%d",&a);
	for(i=0;b[i]!='\0';i++){
		if(b[i]=='a') continue;
		if(a>'z'-b[i]){
			a=a-('z'-b[i])-1;
			b[i]='a';
		}
	}
	b[i-1]=(b[i-1]-'a'+a)%26+'a';
	
		printf("%s",b);
}

Measured memory_bytes: 384
using System;
using System.Text.RegularExpressions;

namespace ConsoleApp1
{
    class Program
    {
  
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int cnt = 0;
            int Z = 0;
            string lead = S.Substring(0, 1);
            for (int i = 0; i < S.Length; i++)
            {
                if(lead == "A")
                {
                    if(S.Substring(i, 1) == "C" && i >= 2 && i < S.Length - 1)
                    {
                        cnt++;
                    }
                }
                if(Regex.IsMatch("ABCDEFGHIJKLMNOPQRSTUVWXYZ" , S.Substring(i, 1)))
                {
                    Z++;
                }
            }
            if(cnt == 1 && Z == 2)
            {
                Console.WriteLine("AC");
            }
            else
            {
                Console.WriteLine("WA");
            }
        }
    }
}

Measured memory_bytes: 16184
N = gets.to_i
D, X = gets.split.map(&:to_i)
as = N.times.map { gets.to_i }
sum = 0
N.times do |i|
  a = as[i]
  sum += 1
  n = 1
  while n * a + 1 <= D
    sum += 1
    n += 1
  end
end
puts sum + X

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

int V, E, R, S[500010], T[500010], D[500010];
int C[100010];
const int inf = 10000*100000+100;

int main() {
  cin >> V >> E >> R;
  for (int i=0; i<E; i++) cin >> S[i] >> T[i] >> D[i];
  for (int i=0; i<V; i++) C[i] = inf;
  C[R] = 0;

  for (int t=0; t<V; t++) {
    bool update = false;
    for (int i=0; i<E; i++) {
      int s = S[i], t = T[i], d = D[i];
      if (C[s] < inf && C[t] > C[s] + d) {
        C[t] = C[s] + d;
        update = true;
      }
    }
    if (!update) break;
  }

  for (int i=0; i<V; i++) {
    if (C[i] < inf) {
      cout << C[i] << endl;
    } else {
      cout << "INF" << endl;
    }
  }  

}



Measured memory_bytes: 9120
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        long[] a = new long[n + 1];
        for (int i = 1; i <= n; i++) {
            a[i] = scanner.nextInt();
        }

        Arrays.sort(a);
        Arrays.parallelPrefix(a, Long::sum);

        int ans = 1;
        for (int i = n; i > 0; i--) {
            if (a[i] - a[i - 1] <= a[i - 1] * 2) {
                ans++;
            } else {
                break;
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 53112
<?php
list($n,$k)=explode(" ",trim(fgets(STDIN)));
$a=explode(" ",trim(fgets(STDIN)));
$p=array_fill(1,$n,-1);
$p[1]=0;
$c=$a[0];
$i=1;
while($i<$k){
  if($p[$c]==-1){
    $p[$c]=$i;
  }else{
    $k-=$i;
    $r=$k%($i-$p[$c]);
    echo array_search($p[$c]+$r,$p);
    exit;
  }
  $c=$a[$c-1];
  ++$i;
}
echo $c;

Measured memory_bytes: 36132
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

int main(int argc, char *argv[]){
        int a,b,c;
        scanf("%d %d %d", &a, &b, &c);
        int five=0,seven=0;
        if(a == 5 ){
                five++;
        }
        if(a == 7){
                seven++;
        }
        if(b == 5 ){
                five++;
        }
        if(b == 7){
                seven++;
        }
        if(c == 5 ){
                five++;
        }
        if(c == 7){
                seven++;
        }
        if(five == 2 && seven == 1){
                printf("YES\n");
        }else{
                printf("NO\n");
        }
        return 0;
}

Measured memory_bytes: 1620
while True :
 m, f, r = map(int, input().split())
 if(m == -1 and f == -1 and r == -1) :
   break
 elif(m == -1 or f == -1) :
   print("F")
 elif(m + f >= 80) :
   print("A")
 elif(65 <= m + f and m + f < 80) :
   print("B")
 elif(50 <= m + f and m + f < 65) :
   print("C")
 elif(30 <= m + f and m + f < 50) :
   if(50 <= r) :
     print("C")
   else :
     print("D")
 else :
   print("F")


Measured memory_bytes: 5596
a, b, c = map(int, input().split())
if a == 5 and b == 5 and c == 7:
    print('YES')
elif a == 5 and b == 7 and c == 5:
    print('YES')
elif a == 7 and b == 5 and c == 5:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define REP(i,n) for(int i=1;i<=(n);++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  string s;
  cin>>s;
  int N = int(s.size());
  for (int i(0);i<N/2;i++){
    if (s[i] != s[N-i-1]){
      cout << "No" << endl;
      return 0;
    }
  }
  for (int i(0);i<(N-1)/4;i++){
    if (s[i] != s[(N-1)/2-i-1]){
      cout << "No" << endl;
      return 0;
    }
  }
  for (int i(0);i<(N-((N+3)/2)+1)/2;i++){
    int j = (N+3)/2-1+i;
    if (s[j] != s[N-i-1]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << # x << "; "<< x << endl


int main() {
	string S;
	cin >> S;
	int total = 0;
	for (int i = 0; i < S.size() / 2; i++) {
		if (S.at(i) == S.at(S.size() - 1 - i)) {
			continue;
		}
		else {
			total++;
		}
	}
	cout << total << endl;
}

Measured memory_bytes: 3588
n = int(input())
numL = [0 for i in range(n)]

x = input()
for i in range(n):
    numL[i] = int(x.split()[i])

ctr = 0
for i in range(n-1):
    min = i
    for j in range(i+1,n):
        if numL[j] < numL[min]:
            min = j
    if min == i:
        pass
    else:
        ctr += 1
        tmp = numL[i]
        numL[i] = numL[min]
        numL[min] = tmp

print(*numL)
print(ctr)


Measured memory_bytes: 5608
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int h=0,w=0,i=0,j=0;
    while(1){
        scanf("%d %d",&h,&w);
        if(h==0 && w==0){
            break;
        }
            for(i=0; i<h; i++){
                for(j=0; j<w; j++){
                    printf("#");
                }
                printf("\n");
            }
            printf("\n");
    }
    return 0;
}

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

using namespace std;

int main(void){
    int n,m;
    int ac_cnt = 0;
    int wa_cnt = 0;

    cin >> n >> m;

    vector<int> ac(n,0);
    vector<int> wa(n,0);

    for(int i=0; i<m; i++){
        int p;
        string s;
        cin >> p >> s;

        p -= 1;

        if(s == "AC"){
            if(ac[p] == 0){
                ac_cnt++;
                wa_cnt += wa[p];
            }
            ac[p] = 1;
        }else{
            if(ac[p] == 0)
                wa[p]++;
        }
    }
    
    cout << ac_cnt << " " << wa_cnt << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
ll MOD;

// Mod int
// cf. https://www.youtube.com/watch?v=1Z6ofKN03_Y
struct mint {
  ll x;
  mint(ll x = 0) : x(x % MOD) {
    if (x < 0) { x += MOD; }
  }
  mint& operator+= (const mint a) {
    if ((x += a.x) >= MOD) x %= MOD;
    return *this;
  }
  mint operator+ (const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint& operator-= (const mint a) {
    if ((x += MOD - a.x) >= MOD) x %= MOD;
    return *this;
  }
  mint operator- (const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint& operator*= (const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  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;
  }
};

// Combination mod prime.
// cf. https://www.youtube.com/watch?v=1Z6ofKN03_Y
struct Combination {
  vector<mint> fact, ifact;
  Combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < MOD); // n must be lower than MOD.
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) { fact[i] = fact[i-1] * i; }
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) { ifact[i-1] = ifact[i] * i; }
  }
  mint operator() (int n, int k) {
    if (k < 0 || k > n) { return 0; }
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main(int argc, char** argv) {
  int p;
  cin >> p;
  MOD = p;

  vector<int> a(p);
  rep(i, p) {
    cin >> a[i];
  }

  Combination c(p-1);
  vector<mint> b(p);
  rep(i, p) {
    if (!a[i]) { continue; }
    // 1 - (x-i) ** (p-1) = b[p-1] * x ** (p-1) + b[p-2] * x ** (p-2) + ... + b[0]
    b[0] += 1;
    mint pw = 1; // pw = (-i) ** (p - 1 - j) in each step.
    for (int j = p - 1; j >= 0; --j) {
      b[j] -= pw * c(p-1, j);
      pw *= -i;
    }
  }
  rep(i, p) {
    cout << b[i].x;
    if (i != p-1) {
      cout << " ";
    }
  }
  cout << endl;
}


Measured memory_bytes: 512
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define swap(p,q) r=(p);(p)=(q);(q)=r
#define INF 1000000000000//10^12
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007

using namespace std;

//void型なので返り値は無し　d[]に結果が格納されるので欲しいものをansに
int main(void)
{
	//変数の宣言
	ll int n,m;

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	ll int ans=0;
	int count=0;
	int temp,temp1,temp2;
	int max,min;
	int len;
	int sum=0;
	int ok,ng;



	//データの読み込み


	scanf("%lld %lld",&n,&m);
//	scanf_s("%lld %lld",&n,&m);


/*	for(i=0;i<n;i++){
//		scanf("%s",&s[i]);
		scanf_s("%s",&s[i]);
	}*/

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	ans=min(n,m/2)+(m-2*min(n,m/2))/4;

	//	printf("計算部分終了\n");

	//出力
	
	printf("%lld",ans);

	//	printf("結果の出力終了\n");


	return 0;
}



Measured memory_bytes: 256
def solve(k):
  def gcd(a, b):
    if a < b:
      a,b = b,a
    while b:
      a, b = b, a%b
    return a

  ans = 0
  for a in range(1, k+1):
    for b in range(1, k+1):
      for c in range(1, k+1):
        ans += gcd(gcd(a,b),c)
  return ans

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('csolve', 'i8(i8)')(solve)
    cc.compile()

if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import csolve
    print(csolve(int(input())))


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

int main() {
   cin.tie(0);
   ios::sync_with_stdio(false);
   int n, d, x;
   vector<int> vc;
   cin >> n >> d >> x;
   for(int i = 0;i < n;i++) {
      int x;
      cin >> x;
      vc.push_back(x);
   }
   int sum = 0;
   for(int i = 0;i < n;i++) {
      sum+=(d-1)/vc[i]+1;
   }
   cout << sum + x << endl;
   
   return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <random>
using namespace std;
using ll = long long;

int main() {
    int a, b, x;
    cin >> a >> b >> x;

    cout << (a <= x && x <= a + b ? "YES" : "NO") << endl;

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  double v[n];
  for (int i = 0; i < n; i++){
  	cin >> v[i];
  }
  
  sort(v, v+n);
  
  double res = (v[0] + v[1]) / 2;
  if (n > 2){
  	for (int j = 2; j < n; j++){
      res = (res + v[j]) / 2;
  	}
  }
  
  cout << fixed << setprecision(5) << res << endl;
  return 0;
}

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) {
      cout << s << endl;
    } else {
      cout << "red" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
using namespace std;

int main(){
    int N,X,Y;
    cin >> N >> X >> Y;
    X--; Y--;

    vector<int> ans(N);
    for(int sv=0;sv<N;sv++){
        vector<int> dist(N,-1);
        queue<int> q;
        auto push = [&](int v, int d){
            if(dist[v] != -1) return;
            dist[v] = d;
            q.push(v);
        };
        push(sv,0);
        while(!q.empty()){
            int v = q.front(); q.pop();
            int d = dist[v];
            if(v-1>=0) push(v-1,d+1);
            if(v+1<N) push(v+1,d+1);
            if(v==X) push(Y,d+1);
            if(v==Y) push(X,d+1);
        }
        for(int i=0;i<N;i++){
            ans[dist[i]]++;
        }
    }
    for(int i=0;i<N;i++) ans[i] /= 2;
    for(int i=1;i<N;i++){
        cout << ans[i] << endl;
    }

    return 0;
    


}

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

int main(){
  int A[3];
  for(int i=0;i<3;i++)cin >> A[i];
  
  sort(A, A+3,greater<int>());
  
  cout << A[0]*10+A[1]+A[2]<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>

#define MAX 100001

using namespace std;

int n,a,b;
int h[MAX];

int enough(int t){
  long long cnt=0;
  for(int i=0;i<n;i++){
    if(h[i]>b*t){
      if((h[i]-b*t)%(a-b)==0){
        cnt=cnt+(h[i]-b*t)/(a-b);
      }else{
        cnt=cnt+(h[i]-b*t)/(a-b)+1;
      }
    }
  }
  if(cnt<=t) return 1;
  else return 0;
}

int binarySearch(int l,int r){
  int left=l;
  int right=r;
  while(left<right){
    int mid=(left+right)/2;
    if(enough(mid)==0 && enough(mid+1)==1){
      return mid+1;
    }else if(enough(mid)==0){
      left=mid+1;
    }else{
      right=mid;
    }
  }
  return -1;
}

int main(){
  cin >> n >> a >> b;
  int maxh=0;
  for(int i=0;i<n;i++){
    cin >> h[i];
    maxh=max(maxh,h[i]);
  }
  //for(int i=0;i<maxh/b+1;i++) cout << enough(i) << endl;
  cout << binarySearch(0,maxh/b+1) << endl;
}

Measured memory_bytes: 640