akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

void canP(bool x){
    if(x){
        cout << "Possible" << endl;
    }else{
        cout << "Impossible" << endl;
    }
}
int main(){
    int n; cin >> n;
    int m = n * 3;

    int a[m];
    rep(i,m) cin >> a[i];

    sort(a,a+m);
    reverse(a,a+m);

    ll ans = 0;
    for(int i = 1; i <= 2*n ; i += 2){
        ans += a[i];
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

void solve() {
    int n; cin >> n;
    cout << (n+1)/2;
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)
#define MAX_V 100
const double eps = 1e-10;
const double pi  = acos(-1.0);
const double INF = (int)1e8;

int cost[MAX_V][MAX_V]; int d[MAX_V];
int t[MAX_V][MAX_V];
bool used[MAX_V];
int V;
// cost[u][v]は辺e=(u,v)のコスト(存在しない場合はINF) // 頂点sからの最短距離
// すて&#12441;に使われたかのフラク&#12441;
// 頂点数
// 始点sから各頂点への最短距離を求める
void dijkstra(int s) {
    fill(d, d + V, INF);
    fill(used, used + V, false);
    d[s] = 0;
    while(true) {
        int v = -1;
        // また&#12441;使われていない頂点のうち距離か&#12441;最小のものを探す
        for (int u = 0; u < V; u++) {
            if (!used[u] && (v == -1 || d[u] < d[v])) v = u;
        }
        if (v == -1) break;
        used[v] = true;
        for (int u = 0; u < V; u++) {
            d[u] = min(d[u], d[v] + cost[v][u]);
            //cout << d[u] << endl;
        }
    }
}
void dijkstra2(int s) {
    fill(d, d + V, INF);
    fill(used, used + V, false);
    d[s] = 0;
    while(true) {
        int v = -1;
        // また&#12441;使われていない頂点のうち距離か&#12441;最小のものを探す
        for (int u = 0; u < V; u++) {
            if (!used[u] && (v == -1 || d[u] < d[v])) v = u;
        }
        if (v == -1) break;
        used[v] = true;
        for (int u = 0; u < V; u++) {
            d[u] = min(d[u], d[v] + t[v][u]);
        }
    }
}

int main(){
    int n,m;
    int a,b;
    int x;
    bool w;
    while(cin >> n >> m && n|m){
    	rep(i,m)rep(j,m){
    		cost[i][j]=INF;
    		t[i][j]=INF;
    	}
    	V=m;
        rep(i,n){
            cin >> a >> b;
            a--;b--;
            cin >> cost[a][b] >> t[a][b];
            cost[b][a]=cost[a][b];
            t[b][a]=t[a][b];
        }
        cin >> x;
        rep(i,x){
            cin >> a >> b >> w;
            a--;b--;
            if(!w){
                dijkstra(a);
                cout << d[b] << endl;
            }else{
                dijkstra2(a);
                cout << d[b] << endl;
            }
        }
    }
}

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

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  int n;
  cin >> n;
  int arr[n][3];
  int dp[n][3];
  for(int i = 0; i < n; ++i){
    cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
  }
  dp[0][0] = arr[0][0];
  dp[0][1] = arr[0][1];
  dp[0][2] = arr[0][2];
  for(int i = 1; i < n; ++i) {
    for(int j = 0; j < 3; ++j){
      dp[i][j] = INT_MIN;
      for(int k = 0; k < 3; ++k) {
        if(k != j) {
          dp[i][j] = max(dp[i][j], dp[i - 1][k] + arr[i][j]);
        }
      }
    }
  }
  cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << "\n";
}

Measured memory_bytes: 2560
N, M = gets.split.map(&:to_i)
S = gets.split.map(&:to_i)
T = gets.split.map(&:to_i)

dp = Array.new(N+2){Array.new(M+2, 0)}
dp[0][0] = 1
MOD = 10**9+7
(N+1).times do |i|
    (M+1).times do |j|
        next if i+j == 0
        if S[i-1] == T[j-1]
            dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD
        else
            dp[i][j] = (dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1]) % MOD
        end
    end
end
puts dp[N][M]

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

int main() {
    int N;
    int A[210];
    int res = 0;

    cin >> N;
    for (int i; i<N; i++) cin >> A[i];

    while (true) {
        bool exist_odd = false;
        for (int i=0; i<N; i++) {
            if (A[i]%2 != 0) {
                exist_odd = true;
                break;
            }
            A[i] /= 2;
        }
        if (exist_odd) break;
        res++;
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define deb(x)   cout<<"> "<<#x<<" : "<<x<<endl;
#define deb2(x,y)cout<<"> "<<#x<<"->"<<x<<"  "<<#y<<"->"<<y<<endl;
#define LINE   cout << "--- LINE NO : " << __LINE__ <<"  ---"<< endl;
#define pnr(a)   for(auto x:a){cout<<x<<" ";}cout<<endl;
#define pnr2(a)  for(auto x:a){cout<<x.first<<" "<<x.second<<endl;}

#define  vt            vector
#define  ff            first
#define  ss            second
// #define  int           long long
#define  db            long double
#define  pii           pair<int,int>
#define  Maxpq(x)      priority_queue<x>
#define  Minpq(x)      priority_queue<x,vt<x>,greater<x>>

#define  pb            push_back
#define  si(x)         (int)x.size()
#define  all(x)        x.begin(),x.end()
#define  mem(a,x)      memset(a,x,sizeof(a))
#define  FOR(a)        for(auto& x :  a )
#define  forr(i,n)     for(int i=0;i<n;i++)

#define  pi            2*acos(0.0)
#define  inf           (int)1e18
#define  mxn           (int)2e5+5
#define  mod           (int)1e9+7

int mainx()
{
	int n;
	cin >> n;
	int a[n];
	for (int i = 0 ; i < n ; i++)
		cin >> a[i];
	int s = 0;
	forr(i , n)s = s ^ a[i];
	forr(i , n)
	{
		int x = s ^ a[i];
		cout <<  x << " ";
	}
	cout << endl;
	return 0;
}


inline void __INCLUDE() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt","w",stdout);
#endif
}

int32_t main() {

	

	ios::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);

	//cout << fixed << setprecision(20);

	int tt = 1;
	//cin>>tt;
	for (int t = 1 ; t <= tt ; t++ )
	{
		// cout<<"Case #"<<t<<": ";
		mainx();
	}
	return 0 ;
}



Measured memory_bytes: 4400
import std.stdio;
import std.algorithm;
import std.conv;
import std.string;

void main()
{
	auto tokens = split(chomp(readln()));
	auto n   = to!int(tokens[0]);
	auto m   = to!int(tokens[1]);
	string s = chomp(readln());
	int[][] node;
	node.length = n;
	foreach (i; 0..m)
	{
		auto tokens2 = split(chomp(readln()));
		auto n1      = to!int(tokens2[0]) - 1;
		auto n2      = to!int(tokens2[1]) - 1;
		node[n1] ~= n2;
		node[n2] ~= n1;
	}

	bool[] nodeS;
	nodeS.length = n;
	fill(nodeS, true);

	void compute(int i)
	{
		bool isDone1 = false, isDone2 = false;
		char c1 = s[i];
		foreach (j; node[i])
		{
			if (!nodeS[j]) continue;

			char c2 = s[j];
			if (c1 == c2) isDone1 = true;
			else		  isDone2 = true;
		}
		if (!isDone1 || !isDone2)
		{
			nodeS[i] = false;
			foreach (j; node[i])
			{
				if (!nodeS[j]) continue;
				compute(j);
			}
		}
	}

	foreach (i, node2; node)
	{
		compute(cast(int)i);
	}

	bool isComplete = false;
	foreach (e; nodeS) if (e) isComplete = true;

	writeln(isComplete ? "Yes" : "No");
	stdout.flush();
}

Measured memory_bytes: 23292
def d():
    N = int(input())
    a = {}
    count = 0

    for i in range(1, N+1):
        l, r = str(i)[0], str(i)[-1]
        a[l, r] = a.get((l, r), 0) + 1

    # print(a)

    for i in range(1, N+1):
        l, r = str(i)[0], str(i)[-1]
        # print('a.get(({0}, {1}), 0) * a.get(({1}, {0}), 0) = {2}'.format(l, r, a.get((l, r), 0) * a.get((r, l), 0)))
        count += a.get((r, l), 0)

    print(count)


##########
d()


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T, vec<T>, greater<T>>;
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
#define findge lower_bound
#define findgt upper_bound
const i64 MOD = 1000000007;
const f64 EPS = 1e-10;

struct unionfind {
    vec<i32> data;
    unionfind(i32 size) : data(size, -1) { }
    void unite(i32 x, i32 y) {
        x = find(x); y = find(y); if (x == y) return;
        if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x;
    }
    i32 find(i32 x) { return data[x] < 0 ? x : data[x] = find(data[x]); }
    i32 size(i32 x) { return -data[find(x)]; }
    bool same(i32 x, i32 y) { return find(x) == find(y); }
};

i64 n, m;
vec<i64> l[100000];

i32 main()
{
    cin >> n >> m;
    times(n, i) {
        i64 k; cin >> k;
        l[i].resize(k);
        times(k, j) {
            cin >> l[i][j];
            l[i][j]--;
        }
    }
    auto uf = unionfind(m);
    times(n, i) {
        range(1, l[i].size(), j) {
            uf.unite(l[i][0], l[i][j]);
        }
    }
    bool ok = true;
    range(1, n, i) {
        ok &= uf.same(l[0][0], l[i][0]);
    }
    cout << (ok ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 6144
a,b=input().split()
c={"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,"A":10,"B":11,"C":12,"D":13,"E":14,"F":15}
print(">" if c[a]>c[b] else "<" if c[a]<c[b] else "=")

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

int main(){
    string s;cin >> s;
    int begin = 0;
    for(; begin < s.size(); begin++) if(s[begin] == 'A') break;
    int end = s.size() - 1;
    for(; end >= 0; end--) if(s[end] == 'Z') break;
    int res = end - begin + 1;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <math.h>
using namespace std;

int main(){
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    string s;
    cin >> s;

    int Q;
    cin >> Q;
    int flag = 1;
    for (int i =0;i<Q;i++){
        int f1;
        cin >> f1;
        if (f1 ==1){
            flag*=-1;
        }else{
            int f;
            char ss;
            cin >> f >> ss;
            if (flag==1){
                if (f==1){
                    s.insert(s.begin()+0, ss);
                }else{
                    s+=ss;
                }
            }else{
                if (f==1){
                    s+=ss;
                }else{
                    s.insert(s.begin()+0, ss);
                }
            }
        }
    }
    if(flag==1){
        cout << s<<endl;
    }else{
        std::reverse(s.begin(),s.end());
        cout<<s<<endl;
    }
}

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

map <int, int> counter;
long long sum_t = 0;

long long cal (long long act) {
  return (act * (act - 1)) / 2;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, val;
  cin >> n;
  int vals[n];
  for (int i = 0; i < n; i++) {
    cin >> val;
    vals[i] = val;
    counter[val]++;
  }
  
  for (int i = 1; i <= n; i++) {
    long long act = (long long) counter[i];
    sum_t += cal(act);
  }
  for (int i = 0; i < n; i++) {
    long long act = (long long) counter[vals[i]];
    long long res = sum_t - cal(act) + cal(act - 1);
    cout << res << '\n';
  }
  return 0;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i=0; i<(int)(n); ++i)
 
template<class T> inline bool chmin(T &a, T b) { if(a>b){ a=b; return true; }  return false;}
template<class T> inline bool chmax(T &a, T b) { if(a<b){ a=b; return true; }  return false;}

const int mod = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  ll ans = 0;
  REP(i, 60) { // i桁目
    ll x = 0; // i桁目が1である個数
    REP(j, n) if(a[j]>>i & 1) ++x;
    ll now = x*(n-x) % mod;

    // 2^iをかけて10進数へもどす
    REP(j, i) now = now*2%mod;
    ans += now;
    ans %= mod;
  }
  cout << ans <<endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <cassert>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::string::const_iterator State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

struct Tag_{
    std::string name;
    int child_n;
};

std::vector<Tag_> tags;
std::vector<P> ps1, ps2;

std::string Open(State& begin){
    begin += 1;

    std::string res = "";
    while(*begin != '>'){
        res += *begin;
        begin += 1;
    }
    begin += 1;

    return res;
}

void Close(State& begin){
    while(*begin != '>'){
        begin += 1;
    }
    begin += 1;
}

int Number(State& begin){
    int res = 0;
    while(std::isdigit(*begin)){
        res = res * 10 + (*begin - '0');
        begin += 1;
    }
    return res;
}

std::vector<int> TagValues(State& begin){
    std::vector<int> res;
    res.push_back(Number(begin));
    begin += 1;
    res.push_back(Number(begin));
    begin += 1;
    res.push_back(Number(begin));
    begin += 1;
    res.push_back(Number(begin));
    return res;
}

void Tag(State& begin){
    Tag_ t;
    t.name = Open(begin);
    t.child_n = 0;
    
    std::vector<int> ps = TagValues(begin);

    while(*(begin+1) != '/'){Tag(begin); t.child_n += 1;}
    
    Close(begin);

    tags.push_back(t);

    ps1.push_back(mp(ps[0], ps[1]));
    ps2.push_back(mp(ps[2], ps[3]));
}

int touchedObject(int x, int y){
    REP(i, (int)tags.size()){
        if(ps1[i].first <= x && x <= ps2[i].first &&
           ps1[i].second <= y && y <= ps2[i].second){
            return i;
        }
    }
    return -1;
}

int main(){
    int n;
    while(std::cin >> n, n){
        tags.clear();
        ps1.clear();
        ps2.clear();

        std::string gui;
        std::cin >> gui;

        State state = gui.begin();
        Tag(state);
    
        REP(i, n){
            int x, y;
            std::cin >> x >> y;

            int index = touchedObject(x, y);
            if(index != -1){
                std::cout << tags[index].name << " " << tags[index].child_n << std::endl;
            }else{
                std::cout << "OUT OF MAIN PANEL 1" << std::endl;
            }
        }
    }
}

Measured memory_bytes: 1240
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
#include <string.h>
#include <cstring>
#include <queue>
 

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    
    for(int i=0; i<n; i++){
        cin >> p[i];
    }
    
    sort(p.begin(),p.end());
    
    int ans=0;
    for(int i=0; i<k; i++){
        ans+=p[i];
    }
    cout << ans << endl;
    return 0;
 }


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

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

    int a, b;
    cin >> a >> b;
    int cnt = 0;
    for( int i = 1; i <= a; ++i ) {
        if( i == a ) {
            if( b >= i ) ++cnt;

        } else {
            ++cnt;

        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
n, m = map(int, input().split())
ac = 0
wa = 0

ac_tf = [0] * n
wa_num = [0] * n

for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        if ac_tf[p] == 0:
            ac += 1
            wa += wa_num[p]
            ac_tf[p] = 1
    else:
        wa_num[p] += 1
            
print(ac, wa)



Measured memory_bytes: 4596
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, n, ans = 0;
  scanf("%lld", &n);
  ll a[n], cnt[n];
  for(i = 0; i < n; ++i) cnt[i] = 0;
  for(i = 0; i < n; ++i) scanf("%lld", &a[i]), cnt[--a[i]]++;
  for(i = 0; i < n; ++i) ans += cnt[i] * (cnt[i] - 1) / 2;
  for(i = 0; i < n; ++i) printf("%lld\n", ans - cnt[a[i]] * (cnt[a[i]] - 1) / 2 + (cnt[a[i]] - 1) * (cnt[a[i]] - 2) / 2);
  return 0;
}

Measured memory_bytes: 5632
n, m = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]

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

cnt = 0

for i, lst in enumerate(road):
	for j in lst:
		if H[i] <= H[j]:
			break
	else:
		cnt += 1

print(cnt)

Measured memory_bytes: 29352
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
#define vall(x) (x).begin(), (x).end()
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2> bool chmin(T1 &l, const T2 &r);
template <class T1, class T2> bool chmax(T1 &l, const T2 &r);
template <class T1, class T2> void vadd(vector<T1> &v, T2 x);

lli getLisLength(vector<lli> a) {
  vector<lli> dp(a.size() + 3, 1e18);
  rep(i, a.size()) { *lower_bound(dp.begin(), dp.end(), a[i]) = a[i]; }
  return lower_bound(dp.begin(), dp.end(), 1e18) - dp.begin();
}
vector<lli> dp;
vector<int> e[200005];
int par[200005][20];
lli a[200005];
int ans[200005];
void dfs(int u, int p) {
  auto it = lower_bound(dp.begin(), dp.end(), a[u]);
  lli prev = *it;
  *it = a[u];
  ans[u] = lower_bound(dp.begin(), dp.end(), 1e18) - dp.begin();
  for (auto s : e[u]) {
    if (s == p)
      continue;
    dfs(s, u);
  }
  *it = prev;
}

void solve(long long N, std::vector<long long> u, std::vector<long long> v) {
  rep(i, N - 1) e[u[i] - 1].push_back(v[i] - 1);
  rep(i, N - 1) e[v[i] - 1].push_back(u[i] - 1);
  dp.assign(200005, 1e18);
  dfs(0, -1);
  rep(i, N) cout << ans[i] << endl;
}

signed main() {
  long long N;
  scanf("%lld", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  std::vector<long long> u(N - 1);
  std::vector<long long> v(N - 1);
  for (int i = 0; i < N - 1; i++) {
    scanf("%lld", &u[i]);
    scanf("%lld", &v[i]);
  }
  solve(N, std::move(u), std::move(v));
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2> bool chmin(T1 &l, const T2 &r) {
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2> bool chmax(T1 &l, const T2 &r) {
  return (l < r) ? (l = r, true) : false;
}

template <class T1, class T2> void vadd(vector<T1> &v, T2 x) {
  for (auto &s : v)
    s += T2(x);
}


Measured memory_bytes: 32816
import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            while (true) {
                int a = sc.nextInt();
                String op = sc.next();
                int b = sc.nextInt();
                if (op.equals("+")) {
                    System.out.println(a + b);
                } else if (op.equals("-")) {
                    System.out.println(a - b);
                } else if (op.equals("*")) {
                    System.out.println(a * b);
                } else if (op.equals("/")) {
                    System.out.println(a / b);
                } else {
                    break;
                }
            }
        }
    }



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

int main() {
  string s;
  cin >> s;
  if (s.at(2) == s.at(3) && s.at(4) == s.at(5)) {
    cout << "Yes";

  } else {
    cout << "No";
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll(x) (x << 1)
#define rr(x) (x << 1 | 1)
using namespace std;
const int N = 2e5+5;
const int inf = 0x3f3f3f3f;

int n, m, ans = 0;

vector <int> a[N];

struct SegmentTree{ int l, r, mx, tag; }t[N*4];

void up(int x){ t[x].mx = max(t[ll(x)].mx, t[rr(x)].mx); }

void build(int l, int r, int x = 1){
	t[x].l = l, t[x].r = r; int mid = (l+r>>1);
	if(l == r){ t[x].mx = -m+r-1; return; }
	build(l, mid, ll(x)), build(mid+1, r, rr(x)), up(x);
}

void pushdown(int x){
	if(!t[x].tag) return;
	t[ll(x)].tag += t[x].tag, t[ll(x)].mx += t[x].tag;
	t[rr(x)].tag += t[x].tag, t[rr(x)].mx += t[x].tag;
	t[x].tag = 0;
}

void update(int l, int r, int val, int x = 1){
	if(l <= t[x].l && t[x].r <= r){
		t[x].tag += val, t[x].mx += val; return;
	}
	int mid = (t[x].l+t[x].r>>1); pushdown(x);
	if(l <= mid) update(l, r, val, ll(x));
	if(mid < r) update(l, r, val, rr(x)); up(x);
}

int query(int l, int r, int x = 1){
	if(l <= t[x].l && t[x].r <= r) return t[x].mx;
	if(r < t[x].l || t[x].r < l) return -inf;
	pushdown(x);
	return max(query(l, r, ll(x)), query(l, r, rr(x)));
}

int main(){
	ios::sync_with_stdio(false);
	int x, y; cin >> n >> m, ans = max(ans, n-m);
	for(int i = 1; i <= n; i++) cin >> x >> y, a[x].push_back(y);
	build(0, m+1);
	for(int i = 0; i <= m-1; i++){
		for(int j = 0; j < a[i].size(); j++) update(1, a[i][j], 1);
		ans = max(ans, query(i+2, m+1)-i);
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  int x,y;
  cin >> x >> y;
  if(x*y==1){
    cout << 1000000 << endl;
  }else{
    x = min(4,x);
    y = min(4,y);
    cout << 100000*(8-x-y) << endl; 
  }
}

Measured memory_bytes: 256
// Author:: MUKUL KUMAR RAI
// Institution:: Jalpaiguri Government Engineering College
//If you are not doing well now just stick to it and learn new things one day you will be...
//Compete with yourself 
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
///*template{{{
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
#define trav(a,x) for(auto &a:x)
#define fr(i,a,b)  for(ll i=a;i<=b;i++)
#define fr1(i,a)   for(ll i=0;i<a;i++)
#define frr(i,a,b) for(ll i=b;i>=a;i--)
#define frr1(i,a)   for(ll i=a-1;i>=0;i--)
#define sorta(a,n) sort(a,a+n)
#define sortd(a,n) sort(a,a+n,greater<ll>())
#define sortva(a) sort(a.begin(),a.end())
#define sortvd(a) sort(a.begin(),a.end(),greater<ll>())
#define tc(t) while(t--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
using vi= vector<ll>;
using vvi= vector<vi>;
using vb =vector<bool>;
using vc =vector<char>;
using vs =vector<string>;
using vld =vector<ld>;
using pii =pair<ll,ll>;
using psi =pair<string,ll>;
using pci =pair<char,ll>;
using vpii =vector<pii>;
//}}}template*/
ll mod=1e9+7;
ll const maxn=1e6+5;
ll const inf=1e18;
bool ss(const pair<ll,ll> &a, const pair<ll,ll> &b) { 
    return a.first*b.second+a.second<b.first*a.second+b.second;
}
ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
ll powm(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
ll modinverse(ll a, ll m){
    return powm(a,m-2,m);
}
bool prime(ll x){
    if(x<=1)return false;
    for(int i=2;i<=sqrt(x);i++)if(x%i==0)return false;
    return true;
}
ll divisor(ll x){
    ll cnt=0;
    for(int i=1;i<=sqrt(x);i++){
        if(x%i==0){
            if(i!=x/i)cnt+=2;
            else cnt+=1;
        }
    }
    return cnt;
}
vector<ll> sieve(ll n) {     
    bool prim[n+1]; 
    memset(prim, true, sizeof(prim)); 
  
    for (ll p=2; p*p<=n; p++) {
        if (prim[p] == true) { 
            for (int i=p*p; i<=n; i += p) 
                prim[i] = false; 
        } 
    }
    vector<ll>v;
    for(int i=2;i<=n;i++)if(prim[i])v.push_back(i);
    return v; 
}
bool check(string s){
    ll l=0,r=sz(s)-1;
    while(l<=r){
        if(s[l]!=s[r])return false;
        l++;
        r--;
    }
    return true;
}
int main(){

    fio;
    ll n;
    cin>>n;
    ll a[n][3];
    ll dp[n][3]={0};
    fr1(i,n){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    dp[0][0]=a[0][0];
    dp[0][1]=a[0][1];
    dp[0][2]=a[0][2];
    fr(i,1,n-1){
        dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define reps(i, n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define repi(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(c<=a+b+1) cout<<b+c<<endl;
    else cout<<b+(a+b+1)<<endl;
}


Measured memory_bytes: 256
from heapq import heapify, heappop, heappush

N = int(input())
a = list(map(int,input().split()))

SUM = 0

""" 前半 """
left = a[:N]
SUM += sum(left)
heapify(left)

""" 後半 """
# 除外候補リスト
delete = [(i,a[i]) for i in range(N,3*N)]
delete.sort(key=lambda x:-x[1])

right = []
heapify(right)
for _ in range(N):
    tmp = delete.pop()
    SUM -= tmp[1]
    heappush(right, tmp)

def main(SUM):
    ans = SUM
    for i in range(N,2*N):
        # 前半
        tmp = heappop(left)
        if a[i] > tmp:
            SUM += a[i] - tmp
            heappush(left, a[i])
        else:
            heappush(left, tmp)
        
        # 後半
        tmp = heappop(right)
        if i == tmp[0]:
            while delete:
                sub = delete.pop()
                if i < sub[0]:
                    break
            SUM += tmp[1] - sub[1]
            heappush(right, sub)
        else:
            heappush(right, tmp)

        ans = max(ans, SUM)

    print(ans)

if __name__ == "__main__":
    main(SUM)

Measured memory_bytes: 46372
import java.util.Scanner;

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

        int n = sc.nextInt();
        int m = sc.nextInt();
        int l = sc.nextInt();

        int[][] A = new int[n][m];
        int[][] B = new int[m][l];
        long[][] C = new long[n][l];

        for(int i = 0; i < n; i++){
            for(int j = 0; j < l; j++)
                C[i][j] = 0;
        }

        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++)
                A[i][j] = sc.nextInt();
        }
        for(int i = 0; i < m; i++){
            for(int j = 0; j < l; j++)
                B[i][j] = sc.nextInt();
        }

        for(int i = 0; i < n; i++){
            for(int j = 0; j < l; j++){
                for(int k = 0; k < m; k++)
                    C[i][j] += (long)(A[i][k] * B[k][j]);
            }
        }

        for(int i = 0; i < n; i++){
            System.out.print(C[i][0]);
            for(int j = 1; j < l; j++)
            System.out.print(" " + C[i][j]);
            System.out.println("");
        }

        sc.close();
    }
}



Measured memory_bytes: 54268
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

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

long long int A[210000], F[210000];

int main(){
	long long int N, K;
	cin >> N >> K;
	long long int SA = 0;
	for(int i = 0; i < N; i++){
		cin >> A[i];
		SA += A[i];
	}
	for(int i = 0; i < N; i++){
		cin >> F[i];
	}
	if(SA <= K){
		cout << 0 << endl;
		return 0;
	}
	sort(A, A + N);
	sort(F, F + N);
	reverse(F, F + N);
	long long int L = 0, R = INF;
	while(R - L > 1){
		long long int mid = (L + R) / 2;
		long long int S = 0;
		for(int i = 0; i < N; i++){
			S += max(0LL, A[i] - mid / F[i]);
		}
		if(S <= K){
			R = mid;
		}else{
			L = mid;
		}
	}
	cout << R << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

//#define int long long
#define endl "\n"
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}




int main() {
	int n, m1 = 0, m2 = 0, m3;
	cin >> n;
	vector<int>vec(n);
	rep(i, n) {
		cin >> vec[i];
		if (m1 <= vec[i]) {
			m2 = m1;
			m1 = vec[i];
			m3 = i;
		}
		else if (m2 <= vec[i]) {
			m2 = vec[i];
		}
	}
	rep(i, n) {
		if (i == m3) {
			cout << m2 << endl;
			continue;
		}
		cout << m1 << endl;
	}
}



Measured memory_bytes: 2432
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	var n int
	fmt.Scan(&n)
	hs := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		hs[i], _ = strconv.Atoi(sc.Text())
	}

	str := "Yes"
	for i := 1; i < n; i++ {

		if hs[i-1] < hs[i] {
			//右の方が大きければ1減らす
			hs[i]--
		}
		if hs[i-1] > hs[i] {
			str = "No"
			break
		}
	}

	fmt.Println(str)
}


Measured memory_bytes: 3072
<?php
  list($n,$m) = explode(" ", trim(fgets(STDIN)));
  $a=[];
  $b=[];
  for($i=0;$i<$n;$i++){
    list($a[],$b[]) = explode(" ", trim(fgets(STDIN)));
  }
  $c=[];
  $d=[];
  for($i=0;$i<$m;$i++){
    list($c[],$d[]) = explode(" ", trim(fgets(STDIN)));
  }

  for($i=0;$i<$n;$i++){
    $min=PHP_INT_MAX;
    $ans=0;
    for($j=0;$j<$m;$j++){
//      echo abs($a[$i]-$c[$j])+abs($b[$i]-$d[$j]);
      if($min > abs($a[$i]-$c[$j])+abs($b[$i]-$d[$j])){
        $ans=$j+1;
        $min=abs($a[$i]-$c[$j])+abs($b[$i]-$d[$j]);
      }
    }
    echo $ans.PHP_EOL;
  }

Measured memory_bytes: 16296
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long int ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, PLL> PP;
typedef pair <PII, int> PPI;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int inf = 1e9+9;
const ll MOD = 1e9+696969;
const long long INF = 1e18+3;
#define maxn 1001000
int tab[maxn];

int main()
{
	boost;
	int n;
	cin >> n;
	n *= 2;
	FOR(i, 1, n) cin >> tab[i];
	sort(tab+1, tab+n+1);
	ll res = 0;
	for (int i=1; i<=n; i += 2) res += tab[i];
	cout << res;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int x;
    cin >> x;
    vector<ll> T = {0};
    fore(i,1,x+10) {
        if (T.back() >= x) break;
        T.pb(T.back()+i);
    }
    int ans = T.size()-1;
    cout << ans << endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define MAX_N 10000000
#define ll longlong
using namespace std;
int main() {
    int n; cin>>n;
    cout<<pow(n,3)<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N,A;
int main(){
    cin >> N >> A;
    pr(N*N-A);
}

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

struct Day
{
  array<int, 3> i;
  array<int, 3> b;
  Day()
  {
    i = {0, 0, 0};
    b = {0, 0, 0};
  }
};

int main()
{
  int nbDays;
  cin >> nbDays;
  vector<Day> days;
  for (int i = 0; i < nbDays; i++)
  {
    Day day;
    cin >> day.i[0] >> day.i[1] >> day.i[2];
    days.push_back(day);
  }
  days[0].b[0] = days[0].i[0];
  days[0].b[1] = days[0].i[1];
  days[0].b[2] = days[0].i[2];
  for (int j = 1; j < nbDays; j++)
  {
    for (int first = 0; first < 3; first++)
    {
      int second = (first + 1)%3;
      int third = (first + 2)%3;
      if (days[j - 1].b[first] + days[j].i[second] > days[j].b[second])
	days[j].b[second] = days[j - 1].b[first] + days[j].i[second];
      if (days[j - 1].b[first] + days[j].i[third] > days[j].b[third])
	days[j].b[third] = days[j - 1].b[first] + days[j].i[third];
    }
  }
  cout << max(max(days[nbDays - 1].b[0], days[nbDays - 1].b[1]), days[nbDays - 1].b[2]) << '\n';
}

Measured memory_bytes: 4852
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e9;



signed main(){
	int S,W;
	cin >> S >> W;
	if(S > W)out("safe");
	else out("unsafe");
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
 

  int64_t x;
  cin>>x;

  int64_t rate;
  if(x>=400 && 599>=x)
    rate=8;
  else if(x>=600 && 799>=x)
    rate=7;
  else if(x>=800 && 999>=x)
    rate=6;
  else if(x>=1000 && 1199>=x)
    rate=5;
  else if(x>=1200 && 1399>=x)
    rate=4;
  else if(x>=1400 && 1599>=x)
    rate=3;
  else if(x>=1600 && 1799>=x)
    rate=2;
  else if(x>=1800 && 1999>=x)
    rate=1;  

  cout<<rate<<endl;

	return 0;
}

Measured memory_bytes: 3632
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var v = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
        Array.Sort(v);
        Array.Reverse(v);

        var len = v.Length;
        while (len > 1)
        {
            v[len - 2] = (v[len - 2] + v[len - 1]) / 2.0;
            len--;
        }
        Console.WriteLine($"{v[0]}");
    }
}

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

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

  if(day == 25)
  {
    cout << "Christmas" << endl;
  }
  else if(day == 24)
  {
    cout << "Christmas Eve" << endl;
  }
  else if(day == 23)
  {
    cout << "Christmas Eve Eve" << endl;
  }
  else
  {
    cout << "Christmas Eve Eve Eve" << endl;
  }
}


Measured memory_bytes: 3592
#define N 100005
#include <stdio.h>
struct task {
    char name[15];
    int time;
};

struct task tasks[N];
int head, tail = 0;

void enqueue(struct task x) {
    tasks[tail] = x;
    tail = (tail + 1) % N;
}

struct task dequeue() {
    struct task t = tasks[head];
    head = (head + 1) % N;
    return t;
}

int main() {
    int time = 0;  //记录总时间
    int n, q = 0;  //任务数和时间片长度
    scanf("%d %d", &n, &q);
    for (int i = 0; i < n; i++) {
        scanf("%s %d", tasks[i].name, &tasks[i].time);
    }
    head = 0;
    tail = n;
    while (head != tail) {
        struct task t = dequeue();
        if (t.time <= q) {
            time += t.time;
            printf("%s %d\n", t.name, time);
        }
        else {
            time += q;
            t.time -= q;
            enqueue(t);
        }
    }
    return 0;   
}


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

template<typename OperatorMonoid>
struct DualSegmentTree{
    typedef function<OperatorMonoid(OperatorMonoid,OperatorMonoid)> H;
    int n,hi;
    H h;
    OperatorMonoid id1;
    vector<OperatorMonoid> laz;
    DualSegmentTree(int n_,H h,OperatorMonoid id1):h(h),id1(id1){init(n_);}
    void init(int n_){
        n=1,hi=0;
        while(n<n_) n<<=1,++hi;
        laz.assign(n<<1,id1);
    }
    inline void propagate(int k){
        if (laz[k]==id1) return;
        laz[k<<1|0]=h(laz[k<<1|0],laz[k]);
        laz[k<<1|1]=h(laz[k<<1|1],laz[k]);
        laz[k]=id1;
    }
    inline void thrust(int k){
        for (int i=hi;i;--i) propagate(k>>i);
    }
    void update(int a,int b,OperatorMonoid x){
        if (a>=b) return;
        thrust(a+=n),thrust(b+=n-1);
        for (int l=a,r=b+1;l<r;l>>=1,r>>=1){
            if (l&1) laz[l]=h(laz[l],x),++l;
            if (r&1) --r,laz[r]=h(laz[r],x);
        }
    }
    void set_val(int k,OperatorMonoid x){
        thrust(k+=n);
        laz[k]=x;
    }
    OperatorMonoid operator[](int k){
        thrust(k+=n);
        return laz[k];
    }
};

// https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_D

void DSL_2_D(){
    int n,q; cin >> n >> q;
    auto h=[](int a,int b){return b;};
    DualSegmentTree<int> seg(n,h,INT_MAX);
    for (;q--;){
        int c,s,t,x,i; cin >> c;
        if (!c){
            cin >> s >> t >> x;
            seg.update(s,t+1,x);
        } else {
            cin >> i;
            cout << seg[i] << '\n';
        }
    }
}

// https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_E

void DSL_2_E(){
    int n,q; cin >> n >> q;
    auto h=[](int a,int b){return a+b;};
    DualSegmentTree<int> seg(n,h,0);
    for (;q--;){
        int c,s,t,x,i; cin >> c;
        if (!c){
            cin >> s >> t >> x;
            seg.update(s-1,t,x);
        } else {
            cin >> i;
            cout << seg[i-1] << '\n';
        }
    }
}

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


Measured memory_bytes: 3904
import java.util.Scanner;

public class Main {



	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		
		if (c-a-b>0 && (c-a-b)*(c-a-b) > 4*a*b) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}


}



Measured memory_bytes: 25300
def gcd(a,b):
  while b:a,b=b,a%b
  return a
n,a=int(input()),list(map(int,input().split()))
if n==2:print(max(a));exit()
if n==3:print(max(gcd(a[0],a[1]),gcd(a[0],a[2]),gcd(a[1],a[2])));exit()
ans=ans2=a[0]
for i in range(1,n):
  g=gcd(ans,a[i])
  if g!=ans:
    ans=max(g,ans2)
    ans2=gcd(g,ans2)
print(ans)

Measured memory_bytes: 14584
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < int(n); i++)
#define repr(i, n) for(int i = int(n) - 1; i >= 0; i--)

const lint mod = 1e9 + 9;

int main(){
    int N, Q;
    cin >> N >> Q;
    lint pow26[N + 100];
    pow26[0] = 1;
    rep(i, N + 99){
        pow26[i + 1] = pow26[i] * 26 % mod;
    }
    string S;
    cin >> S;
    vector<int> divisor;
    for(int i = 1; i <= N; i++){
        if(N % i == 0){
            divisor.push_back(i);
        }
    }
    vector<vector<lint>> RHs(divisor.size()); // ローリングハッシュ
    vector<multiset<lint>> RHs_set(divisor.size());
    int num = 0;
    for(int len: divisor){
        rep(i, N / len){
            lint this_RH = 0;
            rep(j, len){
                this_RH = (this_RH + S[i * len + j] * pow26[j]) % mod;
            }
            RHs[num].push_back(this_RH);
            RHs_set[num].insert(this_RH);
            //cout << this_RH << " ";
        }
        //cout << endl;
        num++;
    }
    rep(_, Q){
        int p;
        char c;
        cin >> p >> c;
        p--;
        int ans = N;
        num = 0;
        for(int len: divisor){
            lint before = RHs[num][p / len];
            lint after = (before + (c - S[p] + mod) * pow26[p % len] % mod) % mod;
            RHs_set[num].erase(RHs_set[num].find(before));
            RHs[num][p / len] = after;
            RHs_set[num].insert(after);
            if(*RHs_set[num].begin() == *RHs_set[num].rbegin()){
                ans = min(ans, len);
            }
            num++;
        }
        S[p] = c;
        cout << ans << endl;
    }
}





Measured memory_bytes: 22696
def main():
    H, W = map(int, input().split())
    grid = []
    grid.append(['#']*(W+2))
    for _ in range(H):
        grid.append(['#'] + list(input()) + ['#'])
    grid.append(['#']*(W+2))
    
    for g in grid:
        print(''.join(g))

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
#include<memory>
#include<string>
typedef long long ll;


int main() {
	ll n, k;
	ll x;
	std::cin >> n >> k;
	if (n > k) {
		if (n % k == 0) {
			n = n - (n / k - 1) * k;
		}
		else {
			n = n - (n / k) * k;
		}
	}
	if (k - n < n) {
		std::cout << k - n << std::endl;
	}
	else {
		std::cout << n << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,N) for(int i=0; i<N; i++){ ;
int main() {
   int a,b,c;
   cin>>a>>b>>c;
   set<int> s{a,b,c};
 
	cout<<s.size();
}


Measured memory_bytes: 3628
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  ll N,K; cin>>N>>K;
  ll ans=0;
  for(int b=K+1;b<=N;b++){
    ll q=N/b; ans+=(b-K)*q;
    if(b*q+K<=N) ans+=N-(b*q+K)+1;
    if(K==0) ans--;
    //cout<<ans<<endl;
  }
  
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 3520
n = int(input())

a = 0

for i in range(1, n + 1):
    unko1 = i % 3 == 0
    unko2 = i % 5 == 0
    unko3 = i % 15 == 0

    if unko3 or unko2 or unko1:
        a += 0
    else:
        a += i

print(a)

Measured memory_bytes: 9168
#include<cstdio>
#include<map>
#include<algorithm>
using namespace std;
#define int long long
int n,sz[100100],u[100100],v[100100],head[100100],cnt,D;
struct Edge{
	int to,nxt;
}edge[200100];
struct node{
	int dis,x;
	bool operator<(node b)const{
		return dis>b.dis;
	}
}a[100100];
map<int,int>mp;
void addedge(int x,int y){
	edge[++cnt].to=y;
	edge[cnt].nxt=head[x];
	head[x]=cnt;
}
int dfs(int x,int fa,int now){
	D+=now;
	for(int i=head[x];i;i=edge[i].nxt){
		int upup=edge[i].to;
		if(upup==fa)continue;
		dfs(upup,x,now+1);
	}
}
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i].dis);
		a[i].x=i;
		mp[a[i].dis]=i;
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)sz[i]=1;
	for(int i=1;i<n;i++){
		int dis=a[i].dis,x=a[i].x;
		int tmp=dis-abs(n-2*sz[x]);
		int fa=mp.find(tmp)->second;
		if(fa==x||!fa)return puts("-1"),0;
		sz[fa]+=sz[x];
		D+=sz[a[i].x];
		u[i]=x,v[i]=fa;
		addedge(x,fa);
		addedge(fa,x);
	}
	//dfs(a[n].x,0,0);
	if(D!=a[n].dis)return puts("-1"),0;
	for(int i=1;i<n;i++)
		printf("%lld %lld\n",u[i],v[i]);
}

Measured memory_bytes: 17384
N, K = gets.split(" ").map(&:to_i)
A = gets.split(" ").map(&:to_i)

cs = Array.new(N + 1, 0)
i, x, y = 1, [], []
# xは初めて訪れた所を記録している→そうステップ数　= x.size
# yは一回訪れたところを記録する→周期　= y.size

until cs[i] == 2
    (cs[i].zero? ? x : y) << i
    cs[i] += 1
    i = A[i - 1]
end

puts K < x.size ? x[K] : y[(K - x.size) % (y.size)]



Measured memory_bytes: 31800