akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
using Int = long long;
int main() {
    int L, R, d; cin >> L >> R >> d;
    cout << R / d - (L - 1) / d << endl;
    return 0;
}

Measured memory_bytes: 3604
//
//  volume0-0.cpp
//  
//
//  Created by anthony on 2014/11/19.
//
//

#include <iostream>


using namespace std;

int main(){
    
    for (int m = 1; m <= 9; m++) {
        for (int n = 1; n <= 9; n++) {
            int result;
            
            result = n * m;
            cout << m << "x" << n << "=" << result << endl;
        }
    }
    
    return 0;
}

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

typedef long long ll;
# define  pii pair<ll,ll> 
# define pb push_back
# define f first 
# define s second 


int main() {
	ll n;
	cin>>n;
	ll temp;
	ll net_ans;
	 n=n-1;
	if(n%2==0) {temp=n/2; net_ans=temp*(n+1);}
	else {temp=(n+1)/2; net_ans=temp*n;}
	cout<<net_ans<<endl;
// 	ll sum=0;
// 	ll new_n=n;
// 	while(n>0)
// 	{
// 	    if(n%2==0)
// 	    {
// 	        sum+=n/2-1;
// 	    }
// 	    else 
// 	    {
// 	        sum+=n/2;
// 	    }
// 	    n=n/2;
	    
// 	}
	
//	ll w;
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int same(vector<int> &v){
  unordered_map<int,int> cnt;
  int re=0;
  for(int x:v) ++cnt[x];
  for(pii p:cnt) re+=p.Y/2;
  return re;
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n,m;
  cin>>n>>m;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  vv<int> vs(m);
  for(int x:a) vs[x%m].pb(x);
  int re=vs[0].size()/2;
  //cout<<vs[0]<<endl;
  //cout<<re<<endl;
  reps(i,1,m){
    if(m-i<=i) break;
    vector<int> &v=vs[i];
    vector<int> &w=vs[m-i];
    //cout<<v<<w<<same(w)<<endl;
    if(v.size()>w.size()) swap(v,w);
    re+=v.size()+min<int>((w.size()-v.size())/2,same(w));
  }
  //cout<<re<<endl;
  if(m%2==0){
    //cout<<vs[m/2]<<endl;
    re+=vs[m/2].size()/2;
  }
  cout<<re<<endl;
  return 0;
}


Measured memory_bytes: 6144
#include<iostream>
#include<algorithm>
using namespace std;
long long n,i,A[100005],B[100005],V[200005],sumx,sumy,s,rez,ind,sum;
int main()
{
    ios::sync_with_stdio(false);
    /*
    Se observa ca exista 4 tipuri de noduri: a. Are legatura de tip A si B (se aduna A[i]+B[i])
                                             b. Are legatura de tip A (A[i])
                                             c. Are legatura de tip B (B[i])
                                             d. Nu are legatura (0)
    Se observa 3 tipuri de cicluri: 1. (nr a=nr d) + b + c
                                    2. doar b
                                    3. doar c
    */
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>A[i]>>B[i];
        sumx+=A[i];
        sumy+=B[i];
        V[2*i-1]=A[i];
        V[2*i]=B[i];
    }
    sort(V+1,V+2*n+1);
    for(i=1; i<=n; i++)
        sum+=V[i];
    rez=min(sumx,sumy);
    for(i=1; i<=n; i++)
    {
        //nodul i va fi de tip 1
        s=sum;
        ind=n;
        if(A[i]>=V[ind])
        {
            s=s-V[ind]+A[i];
            ind--;
        }
        if(B[i]>V[ind])
            s=s-V[ind]+B[i];
        rez=min(rez,s);
    }
    cout<<rez<<"\n";
    return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<numeric>

int main(){
    using namespace std;
    int n,i,j;
    vector<int> x;
    vector<int> y;
    double d1,d2,d3,di=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>j;
        x.push_back(j);
    }   
    for(i=0;i<n;i++){
        cin>>j;
        y.push_back(j);
    } 

    for(i=0;i<n;i++){
        d1 += abs(x[i]-y[i]);
        d2 += pow(abs(x[i]-y[i]),2);
        d3 += pow(abs(x[i]-y[i]),3);
    
        if(abs(x[i]-y[i])>di){
            di=abs(x[i]-y[i]);
        }
    }  

    printf("%lf\n%lf\n%lf\n%lf\n",d1,sqrt(d2),cbrt(d3),di);

    return 0;
}


Measured memory_bytes: 3452
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	s := getNextString(scanner)
	mod := int64(1e9 + 7)
	cc := make([]int64, 26)

	for i := 0; i < n; i++ {
		cc[s[i]-'a']++
	}

	ans := int64(1)
	for i := 0; i < 26; i++ {
		ans *= (cc[i] + 1)
		ans %= mod
	}
	ans--
	ans = ((ans % mod) + mod) % mod
	fmt.Fprintln(writer, ans)
	writer.Flush()
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;


void solve()
{
    ll N;
    cin >> N;
    vector<ll> U(N-1), V(N-1);
    vector<ll> W(N-1);
    
    REP(i, N-1) {
        cin >> U[i] >> V[i] >> W[i];
        U[i]--;
        V[i]--;
    }

    vector<vector<ll>> To(N), Cost(N);
    REP(i, N-1) {
        To[U[i]].push_back(V[i]);
        To[V[i]].push_back(U[i]);
        Cost[U[i]].push_back(W[i]);
        Cost[V[i]].push_back(W[i]);
    }
    
    vector<int> ans(N, -1);
    queue<int> Q;
    ans[0] = 0;
    Q.push(0);

    while (!Q.empty()) {
        int p = Q.front();
        Q.pop();
        for (int i=0; i<To[p].size(); i++) {
            int c = To[p][i];
            if (ans[c] == -1) {
                ans[c] = (ans[p]+Cost[p][i]) % 2;
                Q.push(c);
            }
        }
    }
    REP(i, N) {
        print(ans[i]);
    }
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 15104
#include<bits/stdc++.h>
using namespace std;
int main()
{ double a,s,x,y;
 cin>>a>>s>>x>>y;
 double f;
 f=a*s/2;
 cout << fixed;
        cout << setprecision(6);
	
 cout<<(double)f<<" ";
 if (x==a/2&&y==s/2)
   cout<<1;
 else
   cout<<0;
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
#include<iomanip>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef vector<string> vstring;
typedef vector<vector<string>> vvstring;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<long double> vdouble;
typedef vector<vector<long double>> vvdouble;
typedef vector<vector<vector<long double>>> vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define DIVIDER 1000000007


//
// struct Node{
//   vint children;
//   ll index;
//   ll prop;
// };
// struct edge{ll to; ll cost;};



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// struct UnionFind {
//     vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
//
//     UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
//         for(int i = 0; i < N; i++) par[i] = i;
//     }
//
//     int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
//         if (par[x] == x) return x;
//         return par[x] = root(par[x]);
//     }
//
//     void unite(int x, int y) { // xとyの木を併合
//         int rx = root(x); //xの根をrx
//         int ry = root(y); //yの根をry
//         if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
//         par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
//     }
//
//     bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

vint divisor(ll n){ // nの約数
  vint ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i == 0){
      ret.pb(i);
      if(i*i!=n) ret.pb(n/i);
    }
  }
  vsort(ret);
  return ret;
}

ll get_digits_num(ll n){
  ll ret=0;
  while(n){
    n/=10;
    ret++;
  }
  return ret;
}



int main() {
  cout<<fixed<<setprecision(10);

  ll N;cin>>N;

  vint divisors = divisor(N);
  ll ans = 11;
  rep(i, (divisors.size()+1)/2){
    ans = min(ans, max(get_digits_num(divisors[i]),get_digits_num(divisors[divisors.size()-1-i])));
  }
  cout << ans << endl;

}

















//


Measured memory_bytes: 256
N, Q = [int(s) for s in input().split(' ')]

S = input()
a = [0] * (len(S) + 1)
c = [0] * (len(S) + 1)
ac = [0] * (len(S) + 1)
for i in range(1, len(S) + 1):
    ac[i] = ac[i - 1]
    s = S[i - 1]
    if s == 'A':
        a[i] = 1
    if s == 'C':
        c[i] = 1
        if i > 1 and a[i - 1] == 1:
            ac[i] += 1
    
for q in range(Q):
    l, r = [int(s) for s in input().split(' ')]
    dl = ac[l]
    dr = ac[r]
    print(dr - dl)


Measured memory_bytes: 7700
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[0])

cnt = 0
ans = 0
for a, b in ab:
    cnt += b
    ans += a*b
    if cnt >= m:
        break
        
print(ans - (cnt - m)*a)

Measured memory_bytes: 29024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define ld long double
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define getchar gc
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=100005;
int tong[N<<1],a[N],n,k;
ll check(int x){
	memset(tong,0,sizeof(tong));
	int dq=n,dd=1; ll ans=0;
	tong[n]=1; 
	for(int i=1;i<=n;i++){
		if(a[i]>=x){
			dq++; dd+=tong[dq];
		}else{
			dd-=tong[dq]; dq--;
		}
		ans+=dd; tong[dq]++; dd++;
	}
	return ans;
}
signed main(){
	n=read(); ll k=((ll)n*(n+1)/2+1)/2;
	for(int i=1;i<=n;i++)a[i]=read(); //cout<<check(30)<<endl; return 0;
	int l=0,r=1e9;
	while(l<r){
		int mid=(l+r)>>1; mid++;
		if(check(mid)>=k)l=mid; else r=mid-1;
	}
	cout<<l<<endl;
}

Measured memory_bytes: 1536
// Problem : A - Rotation
// Contest : AtCoder - AtCoder Beginner Contest 077
// URL : https://atcoder.jp/contests/abc077/tasks/abc077_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
	string s,t;cin>>s>>t;
	int n=size(s),m=size(t);
	for(int i=0;i<n;i++)
	if(s[i]==t[2-i])
	continue;
	else
	{
		cout<<"NO";
		return;
	}
	cout<<"YES";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <bitset>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

typedef long long ll;
const int M = 4020;
typedef bitset<M> bit;

int n;
string xs;
string as[10];

const ll MOD = 998244353ll;
ll bin[5252];

int deg(bit a){
	int ret = -1;
	REP(i,M)if(a[i])ret=i;
	return ret;
}

int main(){
	cin>>n;
	cin>>xs;
	REP(i,n)cin>>as[i];

	bin[0] = 1;
	REP(i,5251)bin[i+1] = bin[i]*2ll%MOD;
	
	bit g = bit(as[0]);
	REP(i,n){
		bit a = bit(as[i]);
		while(true){
			int gdeg = deg(g);
			int adeg = deg(a);
			if(adeg == -1){
				break;
			}else if(gdeg == -1){
				g = a;
				break;
			}else if(adeg == gdeg){
				a = a ^ g;
			}else if(adeg < gdeg){
				g = g ^ (a << (gdeg - adeg));
			}else if(adeg > gdeg){
				a = a ^ (g << (adeg - gdeg));
			}
		}
	}

	ll ans = 0;
	int gdeg = deg(g);
	bit x = bit(xs);
	int xdeg = deg(x);
	if(gdeg > xdeg){
		puts("1");
		return 0;
	}
	string s = xs.substr(0,xdeg-gdeg+1);
	REP(i,s.size()){
		ans = ans * 2ll % MOD;
		ans = (ans + (s[i]-'0')) % MOD;
	}
	bit y = bit(0);
	REP(_i,xdeg-gdeg+1){
		int i = xdeg-gdeg-_i;
		bit z = y ^ (g << i);
		if(deg(z^x) < deg(y^x)){
			y = z;
		}
	}
	bool less = false;
	if(gdeg==0)less = true;
	REP(_i,gdeg){
		int i = gdeg-1-_i;
		if(y[i]==1 && x[i]==0){
			break;
		}else if(y[i]==0 && x[i]==1){
			less = true;
			break;
		}else{
			if(i==0)less = true;
		}
	}
	if(less){
		ans = (ans + 1) % MOD;
	}
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdint>

int main() {
  std::int_fast64_t i, o, t, j, l, s, z;
  std::cin >> i >> o >> t >> j >> l >> s >> z;
  if (
    (i >= 2 && i % 2 == 0 && j % 2 == 1 && l % 2 == 1) ||
    (i % 2 == 1 && j >= 2 && j % 2 == 0 && l % 2 == 1) ||
    (i % 2 == 1 && j % 2 == 1 && l >= 2 && l % 2 == 0) ||
    (i % 2 == 1 && j % 2 == 1 && l % 2 == 1)
  ) {
    std::cout << (i - 1) / 2 * 2 + o + (j - 1) / 2 * 2 + (l - 1) / 2 * 2 + 3 << std::endl;
  } else {
    std::cout << i / 2 * 2 + o + j / 2 * 2 + l / 2 * 2 << std::endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<bitset>
#include<stack>
#include<cassert>
#define F first
#define S second
#define mp make_pair
#define pii pair<int,int>
#define pb push_back
#define mem(x,y) memset(x,y,sizeof x)
#define sqr(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef double db;
const int INF=2e9;
const db eps=1e-12;
template<typename T>
inline void read(T &x) {
	x=0; int f=1; char ch=getchar();
	while( (ch<'0' || ch>'9') && ch!='-') ch=getchar(); if(ch=='-') {f=-1; ch=getchar();}
	while(ch>='0' && ch <='9') x=x*10+ch-'0',ch=getchar();
	x*=f;
}
//==========================head template==========================
const int N=100010;
int a[N],n,L=INF,R=-INF;
int seq[N];
inline int lowbit(int x) {return x&(-x);}
int c[N<<2];
inline void Add(int u,int v) {
	while(u<=2*n+1) {
		c[u]+=v;
		u+=lowbit(u);
	}
}
inline ll Query(int u) {
	ll ret=0;
	while(u) {
		ret+=1ll*c[u];
		u-=lowbit(u);
	}
	return ret;
}
inline bool Judge(int x) {
	for(int i=1;i<=n;i++) seq[i]=(a[i]<x ? -1 : 1);
	mem(c,0); seq[0]=n+1;
	for(int i=1;i<=n;i++)
		seq[i]+=seq[i-1];
	ll ans=0;
	Add(n+1,1);
	// for(int i=1;i<=n;i++) printf("%d ",seq[i]); puts("");
	for(int i=1;i<=n;i++) {
		ans+=Query(seq[i]);
		Add(seq[i],1);
		// printf("%lld\n",ans);
	}
	return ans>=1ll*n*(n+1)/2/2;
}
signed main() {
	read(n);
	for(int i=1;i<=n;i++) {
		read(a[i]);
		R=max(R,a[i]);
		L=min(L,a[i]);
	}
	// Judge(30);
	int ret=0;
	while(L<=R) {
		int mid=(L+R)>>1;
		if(Judge(mid)) {L=mid+1; ret=mid;}
		else R=mid-1;
	}
	printf("%d\n",ret);
	return 0;
}
/*
3
10 30 20
*/

Measured memory_bytes: 2560
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    ll N, D, A;
    cin >> N >> D >> A;
    vector<ll> X(N), H(N + 100), diff(N + 100);
    map<ll, ll> ma;
    rep(i, N) {
        cin >> X[i] >> H[i];
        ma[X[i]] = H[i];
    }

    sort(all(X));
    rep(i, N) { H[i] = ma[X[i]]; }

    ll ans = 0;
    rep(i, N) {
        if (H[i] > 0) {
            ll tar = X[i] + 2 * D;
            int a = upper_bound(all(X), tar) - X.begin();
            ll cnt = (H[i] / A) + (H[i] % A != 0 ? 1 : 0);
            ans += cnt;
            H[a] += (A * cnt);
            diff[a] += (A * cnt);
            diff[i] -= (A * cnt);
        }
        H[i + 1] += diff[i];
        diff[i + 1] += diff[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 20308
#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;

#define INF 1111111111
#define F first
#define S second

struct edge {
  int to, cost, thief;
  edge(int _to, int _cost, int _thief) {to=_to; cost=_cost; thief=_thief;}
};
typedef pair<int, int> PI;
typedef pair<int, PI> P;

int n, m, l;
vector<edge> G[128];
int d[128][128];

void dijkstra(int s){
  priority_queue<P, vector<P>, greater<P> > que;
  fill(d[0], d[0] + 128 * 128, INF);
  d[l][s] = 0;
  que.push(P(l, PI(0, s)));

  while(!que.empty()){
    P p = que.top(); que.pop();
    int v = p.S.S, w = p.F;
    if(d[w][v] < p.S.F) continue;
    for(int i = 0;i < G[v].size(); i++){
      edge e = G[v][i];
      if(d[w][e.to] > d[w][v] + e.thief){
	d[w][e.to] = d[w][v] + e.thief;
	que.push(P(w, PI(d[w][e.to],e.to)));
      }
      if(w >= e.cost && d[w-e.cost][e.to] > d[w][v]){
	d[w-e.cost][e.to] = d[w][v];
	que.push(P(w-e.cost, PI(d[w-e.cost][e.to],e.to)));
      }
    }
  }
}

int main(void){
  int A, B, D, E;
  for( ; ; ){
    scanf("%d %d %d", &n, &m, &l);
    if(!(n + m + l)) break;
    for(int i = 0;i <= n; i++) G[i].clear();
    for(int i = 0;i < m; i++){
      scanf("%d %d %d %d", &A, &B, &D, &E);
      G[A].push_back(edge(B,D,E));
      G[B].push_back(edge(A,D,E));
    }

    dijkstra(1);
    int ans = INF;
    for(int i = 0;i <= l; i++) ans = min(ans, d[i][n]);
    printf("%d\n", ans);
  }
}


Measured memory_bytes: 1300
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, nw, flag=0;
	vector<int> v;

	cin>> n;
	v.resize(n);
	for(int i=0;i<n;i++) cin>> v[i];

	if(n==1){
		cout<< "Yes" <<endl;
		return 0;
	}

	nw=v[0]-1;
	for(int i=1;i<n;i++){
		if(v[i]<nw){
			flag=1;
			break;
		}else if(nw<v[i]){
			nw=v[i]-1;
		}
	}
		
	if(flag==0) cout<< "Yes" << endl;
	else cout<< "No" <<endl;

}

Measured memory_bytes: 640
L = input()
flag = 1
for i in range(len(L)):
  if i % 2 == 0:
    if L[i] == 'L':
      flag *= 0
  else:
    if L[i] == 'R':
      flag *= 0
if flag == 1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll  n,x,y;
    cin>>n>>x>>y;
    vector<ll>v(n);
    ll d=y-x;
    for(ll i=1;i<=n-1;i++)
    {
        for(ll j=i+1;j<=n;j++)
        {
            if(i>x && i<y && j>=y)
            {
                v[min(i-x+1+j-y,j-i)]++;
              //  cout<<min(i-x+1,j-i)<<" yyyy";
            }
            else if(i>x && i<y && j<y)
            {
                v[min(i-x+1+y-j,j-i)]++;
            }
            else if(i<=x && j>=y)
            {
                v[x-i+j-y+1]++;
                //cout<<x-i+j-y+1<<" xxx";
            }
            else if(i<=x && j<y)
            {
                v[min(j-i,x-i+1+y-j)]++;
                //cout<<min(j-i,x-i+1+y-j)<<" dddd";
            }
            else
            {
                v[j-i]++;
                //cout<<j-i<<" sss";
            }
           // cout<<i<<" " <<j<<"\n";

        }
    }

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



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

#define      ll     long long int

const int N = 200005;
int ara[N];
map<int, int> mp;
map<int, int>::iterator it;
vector< int > v;

int main()
{
    int n, k, i, j, l;
    pair<int, int> p;
    cin >> n >> k;
    for (i = 0; i < n; i++) {
        cin >> ara[i];
        mp[ara[i]]++;
    }
    l = (int) mp.size();
    if (l <= k) {
        cout << "0\n";
    }
    else {
        for (it = mp.begin(); it != mp.end(); it++) {
            v.push_back((*it).second);
        }
        int s = 0;
        sort(v.begin(), v.end());
        for (i = 0; i < (l - k); i++) {
            s += v[i];
        }
        cout << s << '\n';
    }
    return 0;
}


Measured memory_bytes: 11516
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
import bisect
import collections
import sys


if __name__ == "__main__":
    pre_dict = collections.defaultdict(lambda: array.array("I"))
    for line in sys.stdin:
        [word, page0] = line.split()
        page = int(page0)
        bisect.insort(pre_dict[word], page)
    sorted_dict = collections.OrderedDict(sorted(pre_dict.items(), key=lambda i: i[0]))
    for k, v in sorted_dict.items():
        print(k)
        print(*v)

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

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int m,d, ans=0;
	cin >> m >> d;
	for(int i=1;i<=m;i++){
		for(int j=22;j<=d;j++){
			if((j%10)*((int)j/10) == i && (j%10) >= 2 && ((int)j/10) >= 2) ans++;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
l = [int(input()) for _ in range(5)]

a = list(map(lambda x: x % 10, l))
for i in range(len(a)):
    if a[i] == 0:
        a[i] = 10
a
mini = min(a)
index = a.index(mini)
def calc(x):
    if x % 10 == 0:
        return x
    else:
        return 10 + (x // 10) * 10
ans = 0
for i in range(len(l)):
    if i == index:
        #print(l[i])
        ans += l[i]
    else:
        add = calc(l[i])
        #print(add)
        ans += add
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#define N 101

int main() {
char c[N];
int length,i;
int count=0;
scanf("%s",&c);
length=strlen(c);
for(i=0;i<=((length-1)/2);i++) {
	if(c[i]!=c[length-1-i]) {
		count++;
	}
}
printf("%d",count);
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define int long long
#define INF 1000000000000000000
using namespace std;

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
template<typename T>
void debug(vector<vector<T>> m){ REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;} }

struct edge{int to, cost;};

class Graph
{
public:
    int N;
    vector<vector<edge>> G;

    Graph(int N): N(N){
        G = vector<vector<edge>>(N, vector<edge>(0));
    }

    void add_edge(int from, int to, int cost = 0){
        G[from].push_back(edge({to, cost}));
    }

    void add_edge2(int v1, int v2, int cost = 0){
        add_edge(v1, v2, cost);
        add_edge(v2, v1, cost);
    }

    mat waeshall_floyd(){
        mat d(N, vec(N));
        REP(i, N) REP(j, N){
            if(i == j) d[i][j] = 0;
            else d[i][j] = INF;
        }
        REP(v, N) REP(i, G[v].size()){
            edge e = G[v][i];
            d[v][e.to] = e.cost;
        }
        REP(k, N) REP(i, N) REP(j, N) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

        return d;
    }

};

signed main(){

    int N; cin >> N;
    mat A(N, vec(N));
    REP(i, N) readv(A[i]);
    Graph G(N);
    REP(i, N) REP(j, i) G.add_edge2(i, j, A[i][j]);
    mat d = G.waeshall_floyd();
    int ans = 0;
    REP(i, N) REP(j, i){
        int m = INF;
        REP(k, N) if(k != i && k != j) Min(m, d[i][k] + d[k][j]);
        if(m < A[i][j]){
            cout << -1 << endl;
            return 0;
        }else if(m > A[i][j]) ans += A[i][j];
    }
    cout << ans << endl;

    return 0;
}


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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int po = Integer.parseInt(st.nextToken());
		int z = Integer.parseInt(st.nextToken());
		int no = Integer.parseInt(st.nextToken());
		int K = Integer.parseInt(st.nextToken());
		if (K <= po) {
			System.out.println(K);
		} else if (K <= po + z) {
			System.out.println(po);
		} else {
			System.out.println(po - (K - po - z));
		}
	}
}


Measured memory_bytes: 25340
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] time = new int[n][26];
		for(int i = 0; i < n; i++) {
			char[] chars = sc.next().toCharArray();
			for(char c : chars) {
				time[i][c-'a']++;
			}
		}
		int[] ans = time[0];
		for(int i = 1; i < n; i++) {
			for(int j = 0; j < 26; j++) {
				ans[j] = Math.min(time[i][j], ans[j]);
			}
		}
		Deque<Character> ad = new ArrayDeque<>();
		for(int i = 0; i < 26; i++) {
			for(int j = 0; j < ans[i]; j++) {
				ad.addLast((char) (i+'a'));
			}
		}
		for(char c : ad) {
			System.out.print(c);
		}
		System.out.println();
	}
}

Measured memory_bytes: 23764
import bisect
N=int(input())
A=list(map(int,input().split()))
L=[]
R=[]
ans=0
for i in range(N):
    L.append(i+1+A[i])
    R.append(i+1-A[i])
L.sort()
R.sort()
for i in L:
    l=bisect.bisect_left(R,i)
    r=bisect.bisect_right(R,i)
    ans=ans+r-l
print(ans)

Measured memory_bytes: 35088
#include<iostream>
#include<vector>
#include<string>

int main(){
    int n, x;
    std::cin >> n >> x;
    int d = 0;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(d <= x) cnt++;
        int l;
        std::cin >> l;
        d = d + l;
    }
    if(d <= x) cnt++; // 最後
    std::cout << cnt << std::endl;
    return 0;
}


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

using namespace std;


static const double pi = 3.141592653589793;

void solve() {
    double A, B, H, M; cin >> A >> B >> H >> M;
    double radA = 2 * pi * (60 * H + M) / (60 * 12);
    double radB = 2 * pi * M / 60;
    double ans = sqrt(A * A + B * B - 2 * A * B * cos(radA - radB));

    cout << setprecision(15)<< ans << endl;
}


int main() {
    solve();
    return 0;
}

Measured memory_bytes: 4216
import heapq


def submit():
    x, y, a, b, c = map(int, input().split())
    reds = list(map(int, input().split()))
    greens = list(map(int, input().split()))
    uncs = list(map(int, input().split()))

    # 赤リンゴ、緑リンゴについて、大きい順にX, Y個を先に確保しヒープにする
    reds.sort(reverse=True)
    reds = reds[:x]
    heapq.heapify(reds)
    greens.sort(reverse=True)
    greens = greens[:y]
    heapq.heapify(greens)

    # uncolorsについて、大きい順にヒープにしたいのでマイナスにしてからヒープにする
    uncs = [-u for u in uncs]
    heapq.heapify(uncs)

    # 赤リンゴと緑リンゴの数を変えないように、
    # それぞれの最小を取得し、uncから最大を取得し、片方をswapする
    while True:
        if not uncs:
            break

        unc = -heapq.heappop(uncs)
        if unc <= reds[0] and unc <= greens[0]:
            break
        
        if reds[0] < greens[0]:
            heapq.heapreplace(reds, unc)
        else:
            heapq.heapreplace(greens, unc)
            
    print(sum(reds) + sum(greens))

    
submit()

Measured memory_bytes: 114728
#include"bits/stdc++.h"
#define ll long long
#define inf 100005
#define mod 1000000007
#define pb push_back
using namespace  std;

vector<vector<ll>>g(inf);
vector<ll>indgree(inf);
vector<ll>dist(inf);
bool visted[inf];



int main(){
	ll h,w,m,a,b,temp1,temp2;
	cin>>h>>w>>m;
	
	vector<ll>rw(h+1);
	vector<ll>cols(w+1);
	map<pair<ll,ll>,ll>mymap;
	for(ll i=0;i<m;i++){
		cin>>a>>b;
		mymap[make_pair(a,b)]=1;

		rw[a]++;
		cols[b]++;
	}

	a=-1;
	b=-1;

	for(ll i=1;i<=h;i++){
		if(a<rw[i]){
			a=rw[i];
		}
	}

	vector<ll>c,d;
	for(ll i=1;i<=w;i++){
		if(b<cols[i]){
			b=cols[i];
		}
	}

	for(ll i=1;i<=h;i++){
		if(rw[i]==a){
			d.pb(i);
		}
	}

	for(ll i=1;i<=w;i++){
		if(cols[i]==b){
			c.pb(i);
		}
	}
	
	ll flag=0;

	for(ll i=0;i<d.size();i++){
		for(ll j=0;j<c.size();j++){
			if(mymap[make_pair(d[i],c[j])]==0){
				flag=1;
				break;
			}
		}

		if(flag==1){
			break;
		}
	}

	if(flag==1){
		cout<<a+b<<endl;
	}else{
		cout<<(a+b-1)<<endl;
	}

	return 0;
}

Measured memory_bytes: 39004
#include <bits/stdc++.h>
using namespace std;
   
int main() {
    map<int,int> num;
   int n,m;
   cin>>n>>m;
   vector<int> s(n);
   for(int i=0;i<n;i++) cin>>s.at(i);
   for(int i=0;i<m;i++){
       map<int,int>t;
       int a,b;
       cin>>a>>b;
       t[a]=b;
       if(s.at(a-1)<=s.at(b-1)) num[a]++;
       if(s.at(a-1)>=s.at(b-1)) num[b]++;
   }
   cout<<n-num.size();
}

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

long long a,b,c,d;

int main(){
	cin>>a>>b>>c>>d;
	int zz1 = a / d , zz2 = c / b;
	if(a % d)zz1++;
	if(c % b)zz2++;
	if(zz1 >= zz2)cout<<"Yes"<<endl;
	else if(zz1 < zz2)cout<<"No"<<endl;
}

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

main() {
  int64_t L, R,ans = 2020;
	cin>>L>>R;
	for (long l=L;l<L+2020;l++) {
    for (long r=R;r>R-2020;r--) {
      if(l<r)ans=min(ans,l%2019*r%2019);
    }
  }
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0; i<n; i++)
		cin>>a[i];
	int dp[n]={0};
	for(int i=1; i<n; i++)
	{
		dp[i]=INT_MAX;
		for(int j=i-1; j>=max(0,i-k); j--)
			dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
	}
	cout<<dp[n-1];
}

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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)

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

  int n; cin >> n; n--;

  struct Tr {
    int c, s, f;
  };

  vector<Tr> a(n);

  REP(i, n) {
    cin >> a[i].c >> a[i].s >> a[i].f;
  }


  REP(i, n) {
    int t = 0;
    FOR(j, i, n) {
      if(t < a[j].s) t = a[j].s;
      else if(t % a[j].f == 0);
      else t = t + a[j].f - t % a[j].f;
      t += a[j].c;
    }
    cout << t << endl;
  }

  cout << 0 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
const int maxn = 1e3 + 20;
int vis[maxn],n;
double x[maxn],y[maxn],r[maxn],dist[maxn],mp[maxn][maxn]; 
void SPFA(int s)
{    
    queue<int>q;   
    for(int i = 1;i <= n;i++) 
    dist[i] = 1e10;  
    memset(vis,0,sizeof(vis)); 
    while(!q.empty()) q.pop(); 
    dist[s] = 0; 
    vis[s] = 1; 
    q.push(s);  
    while(!q.empty()) 
    {      
        int v = q.front();    
        q.pop();   
        vis[v] = 0;  
        for(int i = 1;i <= n;i++)  
        {           
            if(dist[i] > dist[v] + mp[v][i]) 
            {              
                dist[i] = dist[v] + mp[v][i];  
                if(!vis[i])          
                {           
                    vis[i] = 1;  
                    q.push(i);         
                }           
            }    
        }   
    }
} 
int main()
{   
    while(scanf("%lf%lf%lf%lf",&x[1],&y[1],&x[2],&y[2]) != EOF)
    {        
        scanf("%d",&n);    
        n += 2;    
        r[1] = r[2] = 0;  
        mp[1][2] = mp[2][1] = sqrt((x[1] - x[2]) * (x[1] - x[2]) + (y[1] - y[2]) * (y[1] - y[2]));
        for(int i = 3;i <= n;i++)  
        {          
            scanf("%lf%lf%lf",&x[i],&y[i],&r[i]);
        }        
        for(int i = 1;i <= n;i++)  
        {  
              
            for(int j = 1;j <= n;j++)   
            {         
                mp[i][j] = sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));     
                mp[i][j] -= r[i] + r[j];    
                if(mp[i][j] < 0)           
                {                
                    mp[i][j] = 0;        
                }            
            }       
        }       
        SPFA(1);  
        printf("%.10f\n",dist[2]);    
    }    
    return 0;
}





Measured memory_bytes: 8320
my $s = <>;chomp $s;
my @num = split(//,$s);
my %m;
my $keta = 1;
$m{0} = 1;
my $cur = 0;
for (my $i=1;$i<=($#num+1);$i++) {
  my $t = $num[-$i];
  #print "$i $t cur$cur $keta\n";
  $cur = ($cur + $t * $keta) % 2019;
  $m{$cur}++;
  $keta = $keta * 10 % 2019;
}
my $ans = 0;; 
foreach my $k (keys %m){
  #print "$k $m{$k}\n";
  my $v = $m{$k};
  $ans += $v * ( $v - 1 ) / 2;
}
print  "$ans";


Measured memory_bytes: 20784
// Author: 23forever
#include <bits/stdc++.h>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define fi first
#define se second
typedef long long LL;
const int MAXN = 200000;
using namespace std;

inline int read() {
  int x = 0, w = 1;
  char c = ' ';
  
  while (!isdigit(c)) {
    c = getchar();
    if (c == '-') w = -1;
  }

  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }

  return x * w;
}

int n, a, b;

void init() {
  n = read();
  a = read();
  b = read();
}

int main() {
#ifdef forever23
  freopen("test.in", "r", stdin);
  //freopen("test.out", "w", stdout);
#endif
  init();

  int ans = min(n * a, b);
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author amotoma3
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] s = in.nextString().toCharArray();
            s[3] = '8';
            out.println(new String(s));
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



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

#define y0 yy
#define y1 yyy

const int maxn=2000005;
const int mod=1e9+7;
void Add(int &a,int b){
	a+=b;
	if(a>=mod)a-=mod;
}
void Sub(int &a,int b){
	a-=b;
	if(a<0)a+=mod;
} 
int s,x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;
int fac[maxn],ifac[maxn];
pair<int,int>posA[4],posB[4];
int C(int a,int b){
	if(a<0||b<0||a<b)return 0;
	return 1LL*fac[a]*ifac[b]%mod*ifac[a-b]%mod;
}

int calc(int sx,int sy,int tx,int ty){
	int res=0;
	for(int i=x3;i<=x4;i++){
		Sub(res,1LL*C(i-sx+y3-sy-1,i-sx)*C(tx-i+ty-y3,tx-i)%mod*(i-sx+y3-sy)%mod);
		Add(res,1LL*C(i-sx+y4-sy,i-sx)*C(tx-i+ty-y4-1,tx-i)%mod*(i-sx+y4-sy+1)%mod);
	}
	for(int i=y3;i<=y4;i++){
		Sub(res,1LL*C(x3-sx-1+i-sy,x3-sx-1)*C(tx-x3+ty-i,tx-x3)%mod*(x3-sx+i-sy)%mod);
		Add(res,1LL*C(x4-sx+i-sy,x4-sx)*C(tx-x4-1+ty-i,tx-x4-1)%mod*(x4-sx+i-sy+1)%mod);
	}
	return res;
}

int main(){
	scanf("%d%d%d%d%d%d",&x1,&x2,&x3,&x4,&x5,&x6);
	scanf("%d%d%d%d%d%d",&y1,&y2,&y3,&y4,&y5,&y6);
	s=(max(x6,y6)+2)*2;
	fac[0]=fac[1]=ifac[0]=ifac[1]=1;
	for(int i=2;i<=s;i++){
		fac[i]=1LL*fac[i-1]*i%mod;
		ifac[i]=1LL*ifac[mod%i]*(mod-mod/i)%mod;
	}
	for(int i=1;i<=s;i++)ifac[i]=1LL*ifac[i-1]*ifac[i]%mod;
	int ans=0;
	posA[0]=make_pair(x1-1,y1-1);
	posA[1]=make_pair(x1-1,y2);
	posA[2]=make_pair(x2,y2);
	posA[3]=make_pair(x2,y1-1);
	posB[0]=make_pair(x5,y5);
	posB[1]=make_pair(x5,y6+1);
	posB[2]=make_pair(x6+1,y6+1);
	posB[3]=make_pair(x6+1,y5);
	for(int i=0;i<4;i++)for(int j=0;j<4;j++){
		int cur=calc(posA[i].first,posA[i].second,posB[j].first,posB[j].second);
		if((i+j)&1)Sub(ans,cur);
		else Add(ans,cur);
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

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

  long long A, B, N;
  cin >> N >> A >> B;
  if (A == 0) cout << 0 << endl;
  else {
    long long k = N / (A+B);
    cout << k*A + min(N%(A+B), A) << endl;
  }
 
	return 0;
}


Measured memory_bytes: 256
while True:
    L = map(int,raw_input().split())
    if L == [0]:
        break
    a = L.count(1)
    s = sum(map(lambda x:min(10,x),L))
    for _ in xrange(a):
        if s <= 11:
            s += 10
    print s if s <= 21 else 0

Measured memory_bytes: 4208
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 998244353;
const int INF = 2e18;

signed main() {
    int N;
    cin >> N;
    vector<int> A(N + 1, 0);
    for (int i = 1; i <= N; i++) cin >> A[i];
    int ans = (A[1] - 1), maxValue = 2;
    for (int i = 2; i <= N; i++) {
        if (maxValue == A[i]) {
            maxValue++;
        } else if (maxValue * 2 - 1 > A[i]) {
            ans += (A[i] > maxValue);
        } else {
            ans += (A[i] - 1) / maxValue;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 4e18;

int main() {
    int n; cin >> n;
    vector<vector<char>> s(2 * n, vector<char>(2 * n));
    REP(i, n) {
        REP(j, n) {
            cin >> s[i][j];
            s[i][j + n] = s[i][j];
            s[i + n][j] = s[i][j];
            s[i + n][j + n] = s[i][j];
        }
    }
    ll ans = 0;
    REP(k, n) {
        bool b = false;
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < i; j++) {
                if (s[j + k][i] != s[i + k][j]) {
                    b = true;
                }
            }
        }
        if (!b) {
            ans += n;
        }
    }
    cout << ans << endl;
    getchar(); getchar();
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	vector<ll>V(3,0);
	cin>>V[0]>>V[1]>>V[2];

	if(V[0]%2==1||V[1]%2==1||V[2]%2==1){
		cout<<"0"<<endl;
		return 0;
	}
	else if(V[0]==V[1]&&V[1]==V[2]){
		cout<<"-1"<<endl;
		return 0;
	}

	ll count=0;
	
	for(;;){
		if(V[0]%2==1||V[1]%2==1||V[2]%2==1)break;
		ll o,p,q;
		o=V[0];
		p=V[1];
		q=V[2];
		V[0]=p/2+q/2;
		V[1]=o/2+q/2;
		V[2]=o/2+p/2;
		count++;
	}
	cout<<count<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main(void)
{
    char num[1001];
    int sum, i;

    while(true) {
        sum=0;
        scanf("%s", num);
        if(num[0]=='0') break;
        for(i=0; num[i]!='\0'; i++) {
            sum+=num[i]-'0';
        }
    printf("%d\n", sum);
    }

    return 0;
}



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

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

    if (n % 2) {
        cout << 0 << endl;
        exit(0);
    }
    
    n /= 2;

    ll r = 0;
    for (ll k = 5; k <= n; k *= 5) {
        r += n / k;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout << (#x)<<" = "<<x<<endl
#define sz(s)    (int)(s.size())
#define PI acos(-1)
#define EPS 1e-100
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	//file();
	fast();
	int n; cin >> n;
	string str; cin >> str;
	if (n & 1) RT("No" << endl);
	for (int i = 0; i < n / 2; i++) {
		if (str[i] != str[i + n / 2])
			RT("No\n");
	}
	cout << "Yes" << endl;
	return 0;
}

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

typedef long long ll;


int main(){
  int x,n;
  cin>>x>>n;
  unordered_map<int,int> mp;
  for(int i=0;i<n;i++){
  	int y;
  	cin>>y;
  	mp[y]++;
  }
  
  if(n==0)
  cout<<x<<endl;
  else{
  	int a=x,b=x;
  	while(1){
  		if(mp[a]==0 || mp[b]==0){
  			  if(mp[a]==0)
			  cout<<a<<endl;
			  else
			  cout<<b<<endl;
          break;
  			
		  }
		  a--;b++;
	  }
  }
 return 0;
}

Measured memory_bytes: 3616
import bisect

N, K = map(int, input().split())
x = list(map(int, input().split()))

x_negative = x[:bisect.bisect_left(x,0)]
x_positive = x[bisect.bisect_left(x,0):]

# 0以上の地点にロウソクが無い場合
if len(x_positive) == 0:
    print(abs(x_negative[-K]))
    exit()

# 地点0にロウソクがある場合
if x_positive[0] == 0:
    if K == 1:
        print(0)
        exit()
    K -= 1
    del x_positive[0]

t_list = []

# 全くターンしない場合
if len(x_negative) >= K:
    t_list.append(abs(x_negative[-K]))
if len(x_positive) >= K:
    t_list.append(x_positive[K-1])

# 1回だけターンする場合
for i in range(1, K-1):
    try:
        t_list.append(2*abs(x_negative[-i]) + x_positive[K-i-1])
    except IndexError:
        pass
    
for i in range(1, K-1):
    try:
        t_list.append(2*x_positive[i-1] + abs(x_negative[-(K-i)]))
    except IndexError:
        pass

print(min(t_list))

Measured memory_bytes: 14388
#include <iostream>

#include <vector>

#include <cmath>

#include <algorithm>

using namespace std;

int main() {

    int n;

    cin >> n;

    vector<int> h(n);

    for(int i = 0; i < n; i++)

    {

        cin >> h[i];

    }

    vector<int> dp(n);

    dp[0] = 0;

    dp[1] = abs(h[1] - h[0]);

    for(int i = 2; i < n; i++)

    {

        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));

    }

    cout << dp[n - 1];

    

    return 0;

}

Measured memory_bytes: 1024