akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;


vector<LL> fact;
vector<LL> inver(200001);

LL combination(int n,int r){
    if(n==0&&r==0) return 1LL;
    return fact[n]%mod*inver[n-r]%mod*inver[r]%mod;
}

LL fpow(LL a, LL n){
    LL x = 1;
    while(n > 0){
        if(n&1){
            x=x*a%mod;
        }
        a=a*a%mod;
        n >>= 1;
    }
    return x;
}

int main(){
    int N;
    cin >> N;
    int a[N],t[N];
    int l,r;
    memset(t,-1,sizeof(t));
    for(int i=0;i<=N;i++){
        cin >> a[i];
        if(~t[a[i]-1]){
            l=t[a[i]-1];
            r=i;
        }
        t[a[i]-1]=i;
    }
    LL s=1;
    fact.push_back(1);
    for(int i=1;i<=200000;i++){
        s*=i;
        s%=mod;
        fact.push_back(s);
    }
    inver[200000]=fpow(fact[200000],mod-2);
    for(int i=199999;i>=0;i--){
        inver[i]=inver[i+1]*(i+1)%mod;
    }
    for(int i=1;i<=N+1;i++){
        if(N-r+l>=i-1) cout << (mod+combination(N+1,i)-combination(N-r+l,i-1))%mod << endl;
        else cout << combination(N+1,i)%mod << endl;
    }
    return 0;
}

Measured memory_bytes: 5232
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

int main(){
  int n;
  cin>>n;
  vector<long> v(n);
  rep(i,n) cin>>v[i];

  vector<long> cr(n,0), cl(n,0);

  rep(_,2) {
    vector<long> vec(v);
    vector<int> nxt(n);
    nxt[n-1] = n;
    for (int i = n - 2; i >= 0; i--) {
      cr[i] = cr[i+1];
      while (vec[i] > vec[i+1]) {
        dbg(i,nxt[i+1], vec);
        cr[i] += 2 * (nxt[i+1] - i - 1);
        vec[i+1] *= 4;
        if(nxt[i+1] != i+2) vec[nxt[i+1]-1] *= 4;
        if(nxt[i+1] < n && vec[nxt[i+1] - 1] * 4 > vec[nxt[i+1]]){
          nxt[i+1] = nxt[nxt[i+1]];
        }
      }
      if(vec[i] * 4 <= vec[i+1]) nxt[i] = i+1;
      else nxt[i] = nxt[i+1];
    }
    swap(cr, cl);
    reverse(all(v));
  }
  reverse(all(cl));
  dbg(cl,cr);


  long ans = min(cr[0], n + cl[n-1]);
  rep(i,n-1){
    ans = min(ans, (i+1) + cl[i] + cr[i+1]);
  }

  cout << ans << endl;

  return 0;
}


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



int main(){
    int n,x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    vector<pair<int,int>> apple(a+b+c);
    for(int i=0;i<a;i++) {cin>>apple[i].first;apple[i].second=0;}
    for(int i=a;i<a+b;i++) {cin>>apple[i].first;apple[i].second=1;}
    for(int i=a+b;i<a+b+c;i++) {cin>>apple[i].first;apple[i].second=2;}
    sort(apple.begin(),apple.end(),greater<pair<int,int>>());
    // for(auto i : apple) cout<<i.first<<"--"<<i.second<<"\n";
    int colourless_eaten=0;
    long long ans=0;
    for(int i=0;i<apple.size();i++){
        if(colourless_eaten==x+y) break;
        if(apple[i].second==0){
            if(x>0) {ans+=apple[i].first;x--;}
            else continue;
        }
        else if(apple[i].second==1){
            if(y>0) {ans+=apple[i].first;y--;}
            else continue;
        }
        else {
            ans+=apple[i].first;
            colourless_eaten++;
        }
    }
    cout<<ans<<"\n";
    
    
    
    
   return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <queue>

using namespace std;
using ll = long long;
using pint = pair<int, int>;

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

	int ans = 0;
	int total = 1;

	while (true) {
		if (total >= B) {
			break;
		}
		total += (A-1);
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
n=int(input())
a=list(map(int,input().split()))
a.sort()
x=a[n-1]
a=a[0:n-1]
y=x
z=x
for j in range(n-1):
  if z>=abs(abs(x-a[j])-a[j]):
    y=a[j]
    z=abs(abs(x-a[j])-a[j])
print(x,y)

Measured memory_bytes: 14432
#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)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int MAX = 1e6;

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

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x, y;
    cin >> x >> y;
     int move = (x + y) / 3;
    int w, h;
    w = x - move;
    h = y - move;
    int remain = w + h;
    if (w < 0 || h < 0 || move != remain) {
        cout << 0 << endl;
        return 0;
    }
    COMinit();
    cout << COM(w + h, w) << endl;

    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define pb push_back

int main()
{
    ll H, W;
    cin >> H >> W;
    vector<string> S(H);
    REP(i,0,H) cin >> S[i];

    mat L(H, vec(W, 0));
    mat R(H, vec(W, 0));
    mat D(H, vec(W, 0));
    mat U(H, vec(W, 0));
    ll c;

    REP(i,0,H) {
        c = 0;
        REP(j,0,W) {
            if(S[i][j] == '.') {
                ++c;
                L[i][j] = c;
            }
            else c = 0;
        }
    }

    REP(i,0,H) {
        c = 0;
        for(ll j=W-1; j>=0; --j) {
            if(S[i][j] == '.') {
                ++c;
                R[i][j] = c;
            }
            else c = 0;
        }
    }

    REP(j,0,W) {
        c = 0;
        REP(i,0,H) {
            if(S[i][j] == '.') {
                ++c;
                D[i][j] = c;
            }
            else c = 0;
        }
    }

    REP(j,0,W) {
        c = 0;
        for(ll i=H-1; i>=0; --i) {
            if(S[i][j] == '.') {
                ++c;
                U[i][j] = c;
            }
            else c = 0;
        }
    }

    ll m = 0;
    REP(i,0,H) {
        REP(j,0,W) {
            c = L[i][j] + R[i][j] + D[i][j] + U[i][j] - 3;
            c = MAX(c,0);
            m = MAX(m,c);     
        }
    }
    PR(m);

    return 0;
}

/*



*/

Measured memory_bytes: 129664
import java.util.Scanner;

public class Main {

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

		int sumDigits = 0;
		int check = N;
		while(N != 0) {
			sumDigits += N % 10;
			N /= 10;
		}
		if(check % sumDigits == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21716
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const ll INF = 1e12+1;



ll N, K;
//各ビットについて、
//ビットの多数決を取ってその小さいほうを取る
int bits[100];

int ans[100];

ll A[100000];

ll f(ll x) {
    ll res = 0;
    for (int i = 0; i < N; i++) {
        res += A[i] ^ x;
    }
    return res;
}

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

    for (int i = 0; i < N; i++) cin >> A[i];
    
    for (int i = 0; i < N; i++) {
        ll a = A[i];
        int cnt = 0;
        while (a > 0) {
            bits[cnt] += (a % 2);
            a /= 2;
            cnt++;
        }
    }
    
    ll x = 0;
    ll base = 1;
    for (int i = 0; i < 50; i++) base *= 2;

    for (int i = 50; i >= 0; i--) {
        if (bits[i] < N - bits[i]) {
            if (x + base > K) {
                base /= 2;
                continue;
            }
            x += base;
        }
        base /= 2;
    }
    cout << f(x) << endl;
    





}

Measured memory_bytes: 1024
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/28 15:44:12 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	int	n, q;
	string	s;
	cin >> n >> q >> s;
	vector<int>	V(n);
	int	sum;
	sum = 0;
	rep2(i, 1, n)
	{
		if (s.substr(i - 1, 2) == "AC")
			sum++;
		V.at(i) = sum;
	}
	rep(i, q)
	{
		int	a, b;
		cin >> a >> b;
		a--;
		b--;
		cout << V.at(b) - V.at(a) << endl;
	}
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 1488
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}


int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(b-a==c-b){
        cout << "YES";
    }
    else{
        cout << "NO";
    }
}

Measured memory_bytes: 256
n = int(input())
info = []
ok = True
for _ in range(n):
    a, b = map(int, input().split())
    info.append([a, b])
info.sort(key=lambda x: x[1])
Sum = 0
for i in range(n):
    Sum += info[i][0]
    # print(Sum, info[i][1])
    if Sum > info[i][1]:
        ok = False

if ok:
    print('Yes')
else:
    print('No')

# print(info)

Measured memory_bytes: 38040
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

int main() {
	int N, M; cin >> N >> M;

	VP ab(M);
	rep(i, 0, M) {
		scanf("%d", &ab[i].first);
		scanf("%d", &ab[i].second);
	}

	VI city(N); rep(i,0, N) city[i] = 0;
	rep(i, 0, M){
		++city[ab[i].first -1]; 
		++city[ab[i].second -1];
	}
	rep(i, 0, N) printf("%d\n", city[i]);


	return 0;
}


Measured memory_bytes: 256
/*g++ file.cpp -o file.out*/
/*./file.out*/

#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
#define Mod 1000000007
#define L_Mod 17100000013

int main()
{
    LL a;
    scanf("%lld",&a);
    LL sov=a/11*2;
    a%=11;
    if(a>=1&&a<=6)
        sov+=1;
    else if(a>=7&&a<=10)
        sov+=2;
    printf("%lld\n",sov);
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

#ifdef LOCAL
#include<prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

ostream& operator << (ostream& os, const mint a) {
    os << a.x;

    return os;
}


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    string L;
    cin >> L;

    int M = L.size();
    mint dp[M+1][2];
    dp[0][0] = 0;
    dp[0][1] = 1;

    REP(i, M) {
        dp[i+1][0] = dp[i][0] * 3;
        dp[i+1][1] = dp[i][1];

        if (L[i] - '0') {
            dp[i+1][0] += dp[i][1];
            dp[i+1][1] += dp[i][1];
        }
    }

    cout << dp[M][0] + dp[M][1] << endl;

    
}


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

using namespace std;

int main(void) {
    int A, B;
    string S;
    cin >> A >> B >> S;
    bool ok = true;
    for(int i=0; i<A; i++) {
        if(!isdigit(S[i])) {
            ok = false;
        }
    }
    if(S[A] != '-') {
        ok = false;
    }
    for(int i=A+1; i<=A+B; i++) {
        if(!isdigit(S[i])) {
            ok = false;
        }
    }
    
    if(ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main() {
  string s; cin >>s;
  ll n=s.size();
  ll count=0;
  rep(i,n-1)if(s[i]!=s[i+1])count++;
  cout <<count<<endl;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<string> vs;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 2e9+7;

int main() {
    int n;
    cin >> n;
    vi h(n);
    rep(i, n) cin >> h[i];

    bool allzero = false;
    int ans = 0;
    while(!allzero) {
        vi cand;
        rep(i, n) {
            if (h[i] != 0) cand.pb(h[i]);
            if (cand.size() != 0 && (h[i] == 0 || i == n - 1)) {
                sort(all(cand));
                int mn = cand[0];
                int v1 = (h[i] != 0) ? 1 : 0;
                for(int j = i - cand.size() + v1; j < i + v1; j++) {
                    h[j] -= mn;
                }
                ans += mn;
                break;
            }
            if (h[i] == 0) continue;
        }
        allzero = true;
        rep(i, n) {
            if (h[i] != 0) {
                allzero = false;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i).sort
half = (arr[-1]+1)/2
mean_id = arr.bsearch_index {|c| c >= half }
if arr[mean_id] - half < half - arr[mean_id-1]
  puts arr[-1].to_s + " " + arr[mean_id].to_s
else
  puts arr[-1].to_s + " " + arr[mean_id-1].to_s
end


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

#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)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int k, s;
	cin >> k >> s;

	ll ans = 0;
	rep(x, k+1){
		rep(y, k+1){
			int z = s - x - y;
			if(0 <= z && z <= k) ans++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int N, A;
	
	scanf("%d", &N);
	scanf("%d", &A);
	
	if (A - (N % 500) >= 0){
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	
	return (0);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());

  int ans = 0;
  int cnt = 1;
  for (int i = 0; i < N - 1; i++) {
    if (a[i] != a[i + 1]) {
      ans += cnt % 2;
      cnt = 1;
    } else {
      cnt++;
    }
  }
  ans += cnt % 2;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;

#define ll long long
#define ull unsigned long long
#define REP(i, n) for(int i=0; i<n; i++)

int main(){
    int N, K;
    cin >> N >> K;
    vector <long long> x(N);
    ll inp;
    int index = 0;
    bool ok = false;
    REP(i, N){
        cin >> inp;
        x[i] = inp;
        if(inp >= 0 && !ok){
            index = i;
            ok = true;
           }
    }

    //printf("index:%d\n",index);
    ll _min = 1 << 30;
    ll sum = 0;
    if(!ok) index = N;
    //if(ok){
        if(index - K >= 0){
            sum = abs(x[index -K]);
            if(sum < _min)
                _min = sum;
        }
        //printf("sum:%lld\n",sum);

        if(index + K - 1 <= N-1){
            sum = x[index+K-1];
            if(sum < _min)
                _min = sum;

        }
        //printf("sum:%lld\n",sum);
    //}

    REP(i, N){
        sum = 0;
        if(i+K-1 <= N-1 && x[i] <= 0 && 0 <= x[i+K-1] ){
            //printf("high:%lld  low:%lld  min:%d\n",x[i+K-1]. x[i], min(abs(x[i]), x[i+]));
            sum = x[i+K-1] - x[i] + min(abs(x[i]), x[i+K-1]);
        }
        else continue;
        //printf("sum:%lld\n",sum);
        if(sum < _min)
            _min = sum;
    }
    cout << _min << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
	char c;
	cin >> c;

	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}

	return 0;
}

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

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
#define PI 3.14159265358979323846
const long long mod = 1000000007;

int main(){
    //    random_device rnd;
    //    mt19937 mt(rnd());
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL N, K;
    cin >> N >> K;
    vector<LL> cost (N);
    vector<LL> food (N);
    for(LL i = 0;i < N;i++){
        cin >> cost[i];
    }
    for(LL i = 0;i < N;i++){
        cin >> food[i];
    }
    SORT(cost);
    SORT(food);
    REV(food);

    LL left = 0;
    LL right = 10e12;
    while(left != right){

        LL dummy_ans = (right-left)/2+left;
        if(abs(left-right) == 1){
            dummy_ans = left;
        }
        LL used_K = 0;
        bool check = true;
        for(LL i = 0;i < N;i++){
            if(cost[i]*food[i] > dummy_ans){
                used_K += UP(cost[i]*food[i]-dummy_ans,food[i]);
                if(used_K > K){
                    left = dummy_ans+1;
                    check = false;
                    break;
                }
            }
        }
        if(check){
            right = dummy_ans;
        }

    }

    cout << left << endl;

}


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int ret[10005];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    for (int i=1; i<105; i++)
        for (int j=1; j<105; j++)
            for (int k=1; k<105; k++)
                if (i * i + j * j + k * k + i * j + i * k + j * k <= n)
                    ret[i * i + j * j + k * k + i * j + i * k + j * k]++;

    for (int i=1; i<=n; i++)
        cout << ret[i] << "\n";

    return 0;
}


Measured memory_bytes: 3532
from collections import defaultdict


def main():
    N, C = list(map(int, input().split(' ')))
    s = []
    t = []
    c = []
    channels = defaultdict(lambda: set())
    for i in range(N):
        si, ti, ci = list(map(int, input().split(' ')))
        for t in range(si-1, ti):
            channels[t].add(ci)
    n_recorders = 0
    for t in channels:
        n_recorders = max(n_recorders, len(channels[t]))
    print(n_recorders)



main()

Measured memory_bytes: 244200
#include<bits/stdc++.h>
#include<algorithm>
//#define LL long long

#define  T int t;cin>>t;while(t--)
using namespace std;
int main(){
    int a=0,b=0,c=0,d=0;
     T{
         string s;
         cin>>s;
         if(s[0]=='A') a++;
         else if(s[0]=='T') b++;
         else if(s[0]=='W') c++;
         else d++;
     }
     cout<<"AC x "<<a<<endl<<"WA x "<<c<<endl<<"TLE x "<<b<<endl<<"RE x "<<d<<endl;
    // a=0,b=0,c=0,d=0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;
    int a[N];
    int ans=0;
    rep(i,N){
        cin>>a[i];
        if(i%2==0&&a[i]%2==1) ans++;
    }
    cout << ans << endl;


    



}


Measured memory_bytes: 3636
import itertools
import sys
import math
import numpy as np
from collections import deque
from itertools import combinations
from functools import lru_cache
sys.setrecursionlimit(10**9)

def main():
    N = int(input())
    A = list(map(int, input().split()))

    denied = False
    for a in A:
        if a % 2 == 0:
            if not(a % 3 == 0 or a % 5 == 0):
                denied = True

    print("DENIED" if denied else "APPROVED")

if __name__ == "__main__":
  main()


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

int main(){
  long long a, b;
  cin >> a >> b;
  long long x = a * b;
  if(a == 1 || b == 1){
    cout << 1 << endl;
    return 0;
  }
  
  if(x % 2 == 0){ //割り切れるとき
    cout << x / 2 << endl;
  }
  else cout << x / 2 + 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    int H,W;
    string S[120];
    cin >> H >> W;
    REP(i,H){
        cin >> S[i];
    }
    string T[4];
    T[0]="6314";
    T[1]="2-2-";
    T[2]="1364";
    T[3]="5-5-";
    
    int D[120][120]={};
    REP(i,H){
        REP(j,W){
            D[i][j]=0;
        }
    }
    REP(i,H){
        REP(j,W){
            if(S[i][j]==T[i%4][j%4]){
                D[i][j]=1;
            }
        }
    }
    
    /*REP(i,H){
        REP(j,W){
            cout << D[i][j] ;
        }cout << endl;
    }*/
    
    int visited[120][120]={};
    int dx[4]={1,0,-1,0};
    int dy[4]={0,1,0,-1};
    queue<pair<int,int>> Q;
    Q.push({0,0});
    while(!Q.empty()){
        pair<int,int> q;
        q=Q.front();
        Q.pop();
        visited[q.first][q.second]=1;
        if(q.first==W-1 && q.second==H-1){
            cout << "YES" << endl;
            return 0;
        }
        REP(k,4){
            int x=q.first+dx[k];
            int y=q.second+dy[k];
            if(0<=x && x<W && 0<=y && y<H){
                if(D[y][x]==1 && visited[x][y]==0){
                    Q.push({x,y});
                    visited[x][y]=1;
                }
            }
        }
        
    }
    cout << "NO" << endl;
    return 0;
}




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

map< long long int,  long long int> prime_factor(long long int n) {
  map< long long int, long long int > ret;
  for(long long int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main() {
    long long int n, ans = 0;
    cin >> n;
    map< long long int, long long int > mp = prime_factor(n);
    auto begin = mp.begin(), end = mp.end();
    for(auto iter = begin; iter != end; iter++) {
        int i = 1;
        while(iter->second - i >= 0) {
            ans++;
            iter->second -= i;
            i++;
        }
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll n;
	cin>>n;
	vector<ll> x(n);
	vector<P> v(n);
	rep(i, n) cin>>x[i];
	rep(i, n) v[i] = P(x[i], i);
	sort(all(v));
	ll sum = 0, mx = 0, res2 = 0, p = 0, q = 0;
	vector<ll> res(n);
	while(p<n){
		//cerr<<"p: "<<p<<" ";
		while(v[q].fst<x[p]){
			sum += v[q].fst-mx;
			q++;
		}
		//cerr<<"q: "<<q<<" v[q].snd: "<<v[q].snd<<endl;
		res[p] = (n-q)*(x[p]-mx)+sum;
		res2 = res[p];
		mx = x[p];
		sum = 0;
		while(p<n && x[p]<=v[q].fst) p++;
	}
	rep(i, n) cout<<res[i]<<endl;
	return 0;
}


Measured memory_bytes: 4224
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50 == X:
                count += 1

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b){if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b){if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N, K;
  cin >> N >> K;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  
  long long ans = INF;
  
  vector<long long> B(N);
  B.at(0) = 1;
  
  for (int i = 0; i < pow(2, N - 1); i++)
  {
    int k = 1;
    for (long long j = 1, p = 1; j < N; j++)
    {
      B.at(j) = i / p % 2;
      if (B.at(j) == 1) k++;
      p *= 2;
    }
    
    if (k < K) continue;
      
    long long max_h = A.at(0);
    long long cost = 0;
    vector<long long> a = A;
    
    for (int j = 1; j < N; j++)
    {
      if (B.at(j) == 1)
      {
        if (A.at(j) <= max_h) 
        {
          a.at(j) = max_h + 1;
          cost += a.at(j) - A.at(j);
        }
      }
      chmax(max_h, a.at(j));
    }
    
    chmin(ans, cost);
    
    //for (int j = 0; j < N; j++) cout << B.at(j) << " ";
    //for (int j = 0; j < N; j++) cout << a.at(j) << " ";
    //cout << max_h << " " << cost << endl;
  }
  
  cout << ans << endl;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;
const int MAX = 5100000;
long long fac[MAX], finv[MAX], inv[MAX];

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

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

ll modpow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t =modpow(N, P/2);
        return t*t % mod;
    }
    return N * modpow(N, P-1)%mod;
}

int main(){
    COMinit();
    ll k;cin >>k;
    string s;cin >>s;
    ll n=s.size();
    ll g=1;
    for (int i = 0; i < k; ++i) {
        g=(g*26%mod+(modpow(25,i+1)*COM(n+i,i+1))%mod)%mod;
    }
    cout <<g<<endl;
    return 0;
}

Measured memory_bytes: 124868
a, b, c = map(int, input().split())

ans = 0

while True:
    if ans > 999999:
        print(-1)
        break
    elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        print(ans)
        break
    a, b, c =  (b+c) // 2, (a+c) // 2, (a+b) // 2
    ans += 1


Measured memory_bytes: 2940
package main

import "fmt"

func main(){
	var K, S int
	fmt.Scan(&K)
	fmt.Scan(&S)

	acc := 0

	for x:=0; x<=2500; x++{
		if K < x{
			break
		}
		for y:=0; y<=2500; y++{
			if K < y{
				break
			}

			z := S - (x + y)

			if 0 <= z && z <= K{
				acc++
			}
		}
	}

	fmt.Println(acc)
}


Measured memory_bytes: 512
#include <stdio.h>

int main(){
  int A,B,C,D;
  scanf("%d %d %d %d",&A,&B,&C,&D);
  
  int turn = 1;
  while(A > 0 && C > 0){
    if(turn == 1){
      C = C - B;
    }else if(turn == -1){
    A = A - D;
    }
    turn = -turn;
  }
  if( A > 0 ){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 1596
#include "bits/stdc++.h"
    using namespace std;
    
    int n;
    vector<int> v;
    multiset<int> dp[1<<18];
    int main(){
		cin>>n;
		for(int i=0;i<(1<<n);i++){
			int a;
			scanf("%d",&a);
			dp[i].insert(a);
		}
		for(int k=0;k<n;k++){
			for(int j=0;j<(1<<n);j++){
				if((j>>k)&1){
					for(auto el:dp[j^(1<<k)]){
						dp[j].insert(el);
					}
					while(dp[j].size()>2)dp[j].erase(dp[j].begin());
				}
			}
		}
		long long int aa=0;
		for(int j=1;j<(1<<n);j++){
			long long int ans=(*(dp[j].begin()))+(*(next(dp[j].begin())));
			aa=max(aa,ans);
			printf("%lld\n",aa);
		}
		return 0;
	}


Measured memory_bytes: 39936
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vll vector<ll>
#define vvll vecror<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 

 


void solve()
{
	ll n,sum=0;
	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=n;j++)
		{
			for(ll k=1;k<=n;k++)
			{
				sum+=__gcd(__gcd(i,j),k);
			}
		}
	}
	cout<<sum;
 	return;
}

int main()
{
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

LL dfs(int now, int from);

vector< int > graph[SIZE];
int n, k;


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

    cin >> n >> k;
    for( int i = 0; i < n - 1; ++i ) {
        int a, b;
        cin >> a >> b;
        
        graph[a].pb(b);
        graph[b].pb(a);

    }

    cout << dfs(1, -1) * k % MOD << endl;
    return 0;
}

LL dfs(int now, int from) {
    LL can_use;
    if( from == -1 ) {
        can_use = k - 1;

    } else {
        can_use = k - 2;

    }

    LL pattern = 1;
    for( int i = 0; i < graph[now].size(); ++i ) {
        if( graph[now][i] == from ) {
            continue;

        }
        pattern = pattern * can_use % MOD;
        --can_use;

    }

    for( int i = 0; i < graph[now].size(); ++i ) {
        if( graph[now][i] == from ) {
            continue;

        }
        pattern = pattern * dfs(graph[now][i], now) % MOD;
    }

    return pattern;
}


Measured memory_bytes: 15360
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,a[10],ans=LLONG_MAX;
void brute(ll sum){
    //cout<<sum<<endl;
    if(sum>=n){
        ans=min(ans,sum);
        return;
    }
    if(sum==0){
        for(ll i=1;i<10;i++)if(a[i])brute(i);
    }
    else{
        for(ll i=0;i<10;i++)if(a[i])brute(sum*10 + i);
    }
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n>>k;
    for(ll i=0;i<10;i++)a[i]=1;
    for(ll i=0,x;i<k;i++)cin>>x,a[x]=0;
    brute(0);
    cout<<ans;
}




Measured memory_bytes: 256
MOD=1000000007
n,m=map(int,input().split())

S=[int(_) for _ in input().split()]
T=[int(_) for _ in input().split()]

dp=[[0 for j in range(m+1)] for i in range(n+1)]
for i in range(n+1):
  dp[i][0]=1
for j in range(m+1):
  dp[0][j]=1

for i in range(n):
    for j in range(m):
        if S[i]!=T[j]:
            dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1]-dp[i][j]
            dp[i+1][j+1]%=MOD
        else:
            dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1]
            dp[i+1][j+1]%=MOD
print((dp[n][m])%MOD)

Measured memory_bytes: 76124
/*-----------------------------------------------,
|  __                                       __   |
| |  |--.-----.---.-.----.----.-----.-----.|  |_ |
| |  _  |  -__|  _  |  __|  __|  -__|  _  ||   _||
| |_____|_____|___._|____|____|_____|   __||____||
|                                   |__|         |
`-----------------------------------------------*/
#include<algorithm>
#include<array>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
typedef long long ll; typedef long double ld ;using namespace std;
#define INF 1000000000000
#define MOD 10000007
#define ALL(name) (name).begin(),(name).end()
#define REP(counter, limit) for (long long counter = 0; counter < limit; counter++)
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
struct setupios{setupios(){ios::sync_with_stdio(0);cin.tie(nullptr); /*cout<<fixed<<setprecision(20);*/};}setupios;
int main() {

  int n,d,x;
  cin>>n>>d>>x;
  int ans=x;
  REP(i,n){
    int a;
    cin>>a;
    ans+=((d-1)/a)+1;
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 256
s = input()

len_s = len(s)

def palindrome(ss):
    flg = 1
    len_ss = len(ss)
    for i in range(len_ss):
        if ss[i]!=s[len_ss-1-i]:
            flg = 0
            break
    return flg

if palindrome(s) * palindrome(s[:(len_s-1)//2]) * palindrome(s[(len_s+3)//2:len_s]):
    ans = "Yes"
else:
    ans = "No"

print(ans)

Measured memory_bytes: 3060
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    //static long mod = 1000000007;

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        if(n % 2 == 0) {
            return n / 2;
        } else {
            return n / 2 + 1;
        }
    }

}


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


int main()
{
    int N;
    string s;
    cin >> N >> s;

    ll ans = 0;

    ll key = 0;
    rep(i,N)
    {
        if( s[i] == 'I' ) key++;
        else if( s[i] == 'D' ) key--;
        chmax(ans, key);
    }
    cout << ans << endl;
}


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

int main()
{
    int N, K, tmp, count=0;
    cin >> N >> K;
    vector<int> x(N);
    for (int i = 0; i < N;i++){
        cin >> x.at(i);
        tmp=min(x.at(i) * 2, (K - x.at(i))*2);
        count += tmp;
        //cout << count << " ";
    }
    cout << count << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    long int a[256];
    long int city[256];
    long int i,count,min;
    count = min = i = 0;
    min = 1000000000000001;
    scanf("%ld %ld %ld %ld %ld %ld",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]);
    for (i = 1; i < 6; i++){
        if (min > a[i]){
            min = a[i];
        }
    }
    
    count = a[0] / min;
    
    if (a[0] % min == 0){

        count = count - 1;
    }
    //count = (a[0] + (min - 1)) / min;
  //  if (count == 1){
    //    count = 0;
    //}
    count = count + 5;

    
    printf("%ld",count);
    // うっわ、凄い遠回りした（´・ω・....
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int dp[35];

int main(){
	dp[0]=1;
	dp[1]=1;
	dp[2]=2;
	for(int i=3;i<31;i++){
		dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
	}
	
	int n;
	while(cin>>n && n){
		cout<<dp[n]/3650+(dp[n]%3650!=0)<<endl;
	}
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
// #include<stack>
// #include<queue>
using namespace std;
typedef long long ll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2;
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
// vector<vector<ll>> vec(100,vector<ll>(100));
int main(){
  ll n;
  cin >> n;
  vector<ll> h(n);
  ll ans = 0;
  rep(i,n){
    cin >> h[i];
  }
  tmp1 = 0;
  REP(i,1,n){
    if(h[i-1] >= h[i]){
      tmp1++;
    }else{
      chmax(ans,tmp1);
      tmp1 = 0;
    }
  }
  chmax(ans,tmp1);
  cout << ans;
}


Measured memory_bytes: 1024