akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 1000000000
using namespace std;


//=============is_prime============================
bool is_prime(int N)
{
  if (N == 1)
  {
    return false;
  }
  for (int i = 2; i * i <= N; ++i)
  {
    if (N % i == 0)
    {
      return false;
    }
  }
  return true;
}
//=================================================

vector<int> make_prime_vec()
{
  vector<int> ans(100001, 1);
  ans.at(0) = 0;
  ans.at(1) = 0;
  for (int i = 2; i * i < 100001; ++i)
  {
    if (ans.at(i) == 0)
    {
      continue;
    }
    if (is_prime(i))
    {
      int cnt = 2;
      while (cnt * i <= 100000)
      {
        ans.at(cnt * i) = 0;
        cnt += 1;
      }
    }
  }
  return ans;
}

int main()
{
  vector<int> test = make_prime_vec();
  vector<int> ans(100001, 0);
  for (int i = 0; i < 49999; ++i)
  {
    if (test.at(i) == 1)
    {
      if (test.at(i * 2 - 1) == 1)
      {
        ans.at(i * 2 - 1) = 1;
      }
    }
  }
  // for (int i = 0; i < 10; ++i)
  // {
  //   cout << ans.at(i) << endl;
  // }
  for (int i = 0; i < 100000; ++i)
  {
    ans.at(i + 1) += ans.at(i);
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i)
  {
    int l, r;
    cin >> l >> r;
    cout << ans.at(r) - ans.at(l - 1) << endl;
  }
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const int mod = 1e9+7;
const int N = 1e5+5;
//int a[N];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n;

    cin >> n;

    cout << ((n+1)/2) * (n/2);

    return 0;
}


//long long vs int
//pow function (+0.5)
//read carefully: overflow, constraints, etc...


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;



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

	int n;
	cin >> n;
	string s;
	cin >> s;
	int t = 0, ans = 0;
	rep(i, n) {
		if (s[i] == 'I') {
			t++;
		}
		else {
			t--;
		}
		ans = max(t, ans);
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int L = 60;
const int N = 200100;
const long long INF = (long long) 1e18;

int n, a[N];
long long k;
set <int> has;
vector <int> ans;
vector <int> idx[N];

int main() {

	scanf("%d %lld", &n, &k);

	k *= n;

	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		idx[a[i]].push_back(i);
	}

	vector <long long> w(n, 0);

	for (int i = 0; i < N; i++) {
		if (idx[i].size() == 0) {
			continue;
		}
		int s = idx[i].size();
		idx[i].push_back(idx[i][0] + n);
		for (int j = 0; j < s; j++) {
			w[idx[i][j]] = idx[i][j + 1] - idx[i][j] + 1;
		}
	}

	vector < vector <long long> > nx;

	nx.push_back(w);

	for (int i = 1; i < L; i++) {
		vector <long long> &x = nx.back();
		vector <long long> y(n, 0);
		for (int j = 0; j < n; j++) {
			y[j] = min(INF, x[j] + x[(j + x[j]) % n]);
		}
		nx.push_back(y);
	}

	long long cur = 0;

	for (int i = nx.size() - 1; i >= 0; i--) {
		if (cur + nx[i][cur % n] <= k) {
			cur += nx[i][cur % n];
		}
	}

	if (cur == k) {
		exit(0);
	}

	for (int i = cur % n; i < n; i++) {
		if (has.count(a[i]) != 0) {
			while (true) {
				int v = ans.back();
				ans.pop_back();
				has.erase(v);
				if (v == a[i]) break;
			}
		} else {
			has.insert(a[i]);
			ans.push_back(a[i]);
		}
	}

	for (int i = 0; i < ans.size(); i++) {
		if (i != 0) {
			printf(" ");
		}
		printf("%d", ans[i]);
	}

	puts("");

	return 0;

}

Measured memory_bytes: 120216
// Greedy Takahashi

#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>

using namespace std;

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

    long long x = max(0LL, A - K) ;
    long long y = B + min(0LL, A - K);
    y = max(0LL, y);

    cout << x << " " << y << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,k,n) for(int i = (k); i < (n); i++)
#define repr(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
const int INF = 114514810;
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,A;
	int mi,ma,si;
	vi X,B;
	cin >> N;
	repr(i,N){
		cin >> A;
		X.push_back(A);
		B.push_back(A);
	}
	sort(B.begin(),B.end());
	si=N/2;
	mi=B[si-1];
	ma=B[si];
	repr(i,N){
		if(X[i]<=mi){
			cout << ma << endl;
		}else{
			cout << mi << endl;
		}
	}
}

Measured memory_bytes: 3948
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=10;
char a[N][N];
main()
{
    int n,m,k,s=0;
    cin>>n>>m>>k;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    int ans=0;
    for(int mask=0;mask<(1<<n);mask++){
        for(int mask2=0;mask2<(1<<m);mask2++){
            s=0;
            for(int i=0;i<n;i++){
                if(mask&(1<<i))continue;
                for(int j=0;j<m;j++){
                    if(mask2&(1<<j))continue;
                    if(a[i][j]=='#')s++;
                }
            }
            if(s==k)ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(){
    int n, a, b;
    scanf("%d %d %d\n", &n, &a, &b);
    if((n * a) <= b)
        printf("%d\n", n * a);
    else{
        printf("%d\n", b);    
    }
    
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n;
    cin>>n;
    cout<<2*n/__gcd(2,n);
  	return 0;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const long long MOD = 1e9 + 7;
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;
}

///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    ll A,B,N;
    cin >> A >> B >> N;
    ll x;
    if (N >= B-1){
        x = B-1;
    }else{
        x = N;
    }

    cout << ((A*x)/B) - (A*(x/B)) << endl;
}

Measured memory_bytes: 3648
x, y = map(int, input().split())

group_A = [1, 3, 5, 7, 8, 10, 12]
group_B = [4, 6, 9, 11]
group_C = [2]
for group in [group_A, group_B, group_C]:
    if x in group and y in group:
        print("Yes")
        break
else:
    print("No")


Measured memory_bytes: 2940
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

struct Cake{
	int w, h;

	bool operator <(const Cake& c) const{
		return w * h < c.w * c.h;
	}
};


int main() {
	int n, w, h;
	while(cin >> n >> w >> h, n|w|h){
		vector<Cake> cake;
		cake.push_back({w, h});
		REP(i, n){
			int p, s;
			cin >> p >> s;
			p--;

			Cake c = cake[p];
			cake.erase(cake.begin() + p);
			int N = s % (c.w + c.h);
			int cutpoint, other;
			//			LOG("CUT %d %d\n",c.w, c.h);
			if(N > c.w){//よこ
				cutpoint = N - c.w;
				other = c.h - cutpoint;

				Cake c1 = {c.w, cutpoint};
				Cake c2 = {c.w, other};

				//				LOG("W 1:%d %d ,,, 1:%d %d\n",c1.w, c1.h, c2.w,c2.h);

				if(c1 < c2){
					cake.push_back(c1);
					cake.push_back(c2);
				}else{
					cake.push_back(c2);
					cake.push_back(c1);
				}
			}else{
				cutpoint = N;
				other = c.w - cutpoint;

				Cake c1 = {cutpoint, c.h};
				Cake c2 = {other, c.h};

				//				LOG("H 1:%d %d ,,, 1:%d %d\n",c1.w, c1.h, c2.w,c2.h);

				if(c1 < c2){
					cake.push_back(c1);
					cake.push_back(c2);
				}else{
					cake.push_back(c2);
					cake.push_back(c1);
				}
			}
		}

		SORT(cake);

		cout << cake[0].w * cake[0].h;
		FOR(i, 1, cake.size()){
			cout << " " <<cake[i].w * cake[i].h;
		}
		cout << endl;
	}
}

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

#define ll long long
#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define repr(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back
#define debug(x) cout << x << endl;
#define END cout << endl;

int main() {
  int n; cin >> n;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  vector<ll> a(n), b(n);
  ll maxi = 20001;
  rep(i,n) {
    a[i] = maxi*(i+1);
    b[i] = maxi*(n-i-1) + 1;
  }
  rep(i,n) {
    a[p[i] - 1] += i;
  }
  for (auto itr : a) {
    cout << itr << " ";
  } END;
  for (auto itr : b) {
    cout << itr << " ";
  } END;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() 
{
ios_base::sync_with_stdio(false);
cout.tie(0);
cin.tie(NULL);
  int n; cin>>n;
  int h[n];
  for(int i=0;i<n;i++)
    cin>>h[i];
  int dp[n][2];
  dp[0][0]= dp[0][1]=0;
  dp[1][0]=abs(h[1]-h[0]);
  dp[1][1]=10000001;
  for(int i=2;i<n;i++)
  {
    dp[i][0]=min(dp[i-1][0],dp[i-1][1])+abs(h[i]-h[i-1]);
    dp[i][1]=min(dp[i-2][0],dp[i-2][1])+abs(h[i]-h[i-2]);
  }
  cout<<min(dp[n-1][0],dp[n-1][1]);
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define pb push_back
#define int long long 
using namespace std;

inline int read()
{
	int sum=0,ff=1; char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-') ff=-1;
		ch=getchar();
	}
	while(isdigit(ch))
		sum=sum*10+(ch^48),ch=getchar();
	return sum*ff;
}

const int N=1e5+5;

int n,m,a[N],k,p,b[N];

signed main()
{
	n=read();
	m=read();
	k=read();
	p=read();
	for ( int i=1;i<=n;i++ ) 
		a[i]=read();
	sort(a+1,a+n+1); 
	reverse(a+1,a+n+1);
	for ( int i=1;i<=n;i++ ) b[i]=b[i-1]+a[i];
	int ans=p;
	int i;
	for ( i=p+1;i<=n;i++ )
	{
		if(a[i]+m<a[p]) continue;
		int j=i;
//		while(a[j]==a[i]&&j<=n) j++;
//		j--;
		int sum=(n-i+1)+(p-1); 
		if(sum>=k) ans+=(j-i+1);
		else 
		{
			int alb=b[i-1]-b[p-1];
			int need=(k-((n-i+1)+(p-1)))*m;
			if(((a[i]+m)*(i-p)-alb)>=need) ans+=(j-i+1);
		}
		i=j;
	}
	printf("%lld\n",ans);
	return 0;
}

			
			
		
	

Measured memory_bytes: 1792
from heapq import heappush,heappop,heapify
INF=10**18
def dijkstra(G,s,n):
    que=[(0,s)]
    dist=[INF]*n
    dist[s]=0
    while que:
        mincost,u=heappop(que)
        if(mincost>dist[u]):
            continue
        for v,c in G[u]:
            if(dist[u]+c<dist[v]):
                dist[v]=dist[u]+c
                heappush(que,(dist[v],v))
    return dist
 
n,m,s,t=map(int,input().split())  
s,t=s-1,t-1
enG=[[] for i in range(n)]
snG=[[] for i in range(n)]

for i in range(m):
    u,v,a,b=map(int,input().split())
    u,v=u-1,v-1
    enG[u].append((v,a))
    enG[v].append((u,a))
    snG[u].append((v,b))
    snG[v].append((u,b))

enc=dijkstra(enG,s,n)
snc=dijkstra(snG,t,n)
res=[(enc[i]+snc[i],i) for i in range(n)]
heapify(res)
for i in range(n):
    while(res[0][1]<i):
        heappop(res)
    print(10**15-res[0][0])

Measured memory_bytes: 120172
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

int main() {
	int D, G;
	cin >> D >> G;
	vector<int> p(D);
	vector<int> c(D);
	for (int i = 0; i <D; i++) {
		cin >> p.at(i)>>c.at(i);
	}
	ll ans = 99999999999;
	for (int bit = 0; bit < (1 << D); ++bit)
	{
		ll poi=0;
		ll kai = 0;
		ll nom = -1;
		
		rep(i, D) {
			if (bit & (1 << i)) { 
				poi += (100*(i+1) * p.at(i)+c.at(i));
				kai += p.at(i);
			}
			else {
				nom = max(ll(nom), i);
			}
		}
		if (nom>-1&&G > poi + 100 * (nom + 1) * (p.at(nom) - 1)) {
			continue;
		}
		else if(nom > -1 && G>poi){
			kai += (G - poi-100) / (100 * (nom + 1))+1;
		}
		


		ans = min(ans, kai);

	}
	cout << ans << endl;
}


Measured memory_bytes: 256
from collections import Counter


def main(n: int, k: int, a: list):
    calc = Counter(a)
    calc = sorted(calc.values())

    print(sum(calc[:len(calc) - k]))


if __name__ == '__main__':
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    main(n, k, a)


Measured memory_bytes: 32564
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
t = 10 ** 10

for i in range(N):
    tmp = abs(T - H[i] * 0.006 - A)
    if tmp < t:
        ans = i + 1
        t = tmp

print(ans)


Measured memory_bytes: 3060
#include<iostream>

#include<string>
using namespace std;



int main (void){
  int n;
  int ans=0;
  cin >>n;

  for(int i=1;i<10;i++){
    if(n<=100*i+10*i+i){
      ans=i;
      break;
    }
  }

  cout <<100*ans+10*ans+ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <map>

int main(){
	long long N;
	scanf("%lld",&N);
	std::vector<int> a;
	std::vector<int> b(N+5);
	a.push_back(-1);
	b.push_back(-1);
	int temp;
	for (long long i=0; i<N; i++){
		scanf("%d", &temp);
		a.push_back(temp);
	}
	long long num = 0;
	for (long long i=N; i>0; i--){
		int sum = 0;
		for (long long j=2*i; j<=N; j+=i){
			sum += b[j];
			sum%=2;
		}
		b[i]=(a[i]+sum)%2;
		//printf("b[%d]=%d\n",i,b[i]);
		num += b[i];
	}
	printf("%lld\n",num);
	long long count =0;
	for (long long i=1; i<=N; i++){
		if (b[i]==1){
			printf("%lld%s",i,count!=num-1?" ":"\n");
			count++;
		}
	}
	return 0;
}

Measured memory_bytes: 3516
n = int(input())
list = []
for i in range(n):
  a = [int(j) for j in input().split()]
  list.append(a)
  
root = []
for i in range(n):
  for j in range(i+1, n, 1):
    a = list[i]
    b = list[j]
    r =  ((a[0]-b[0])**2 + (a[1]-b[1])**2)**(1/2)
    root.append(r)
    
print((sum(root)*(n-1))/((n*(n-1))/2))

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

long long fact(long long x){
    if(x == 0) return 1;
    
    return fact(x-1)*x % 1000000007;
}

int main(void){
    long long n, m; cin>>n>>m;
    if(abs(n-m)>1){
        cout << 0 << endl;
        return 0;
    }
    long long ans = fact(n) * fact(m) % 1000000007;
    if(n==m) ans = ans * 2 % 1000000007;
    cout << ans << endl;
}


Measured memory_bytes: 1792
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int a, b, c;
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		int[] arr = {a, b, c};
		Arrays.sort(arr);
		int max = arr[2];
		int diff1 = max - arr[0];
		int diff2 = max - arr[1];
		//System.out.println(diff1 + " " + diff2 + " " + max);
		if(diff1 % 2 == 0 && diff2 % 2 == 0) {
			System.out.println(diff1/2 + diff2/2);
		} else if(diff1 % 2 == 1 && diff2 % 2 == 1) {
			System.out.println(1+(diff1-1)/2 + (diff2-1)/2);
		} else if(diff1 % 2 == 0 && diff2 % 2 == 1) {
			int ans = 0;
			ans += (diff2+1)/2 + diff1/2 + 1;
			System.out.println(ans);
		} else if(diff1 % 2 == 1 && diff2 % 2 == 0) {
			int ans = 0;
			ans += (diff1+1)/2 + diff2/2 + 1;
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 21844
def main():
    N, K = map(int, input().split())
    *A, = map(int, input().split())

    ans = []
    for i in range(K, N):
        cond = A[i] > A[i - K]
        ans.append('Yes' if cond else 'No')

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()


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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n), b(100010,0);
	rep(i,n) cin >>a[i];
	
	rep(i,n) b[a[i]]++;
	
	int ans =0;
	rep(i,100005){
		int sm = b[i] + b[i+1] + b[i+2];
		ans = max(ans , sm);
	}
	
	//for(auto x :a) printf("%d, ",x); puts("");
	cout << ans<<"\n";
	return 0;
}

Measured memory_bytes: 1024
/*
	author: zhaodeyin
	time: 2018.3.17
*/
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
const int MaxN = 1e5 + 4;
typedef long long LL;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b >= c) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

using namespace std;

int main() {
	
	string a;
	
	getline(cin, a);
	
	int i=0;
	
	for(;;) {
        int j = a.find("apple", i);
        int k = a.find("peach", i);
        
        if(j == string::npos && k == string::npos)
            break;
            
        if(k == string::npos || (j != string::npos && j < k)) {
        	
            a.replace(j, 5, "peach");
            i = j + 5;
            
        }
        
		else {
			
            a.replace(k, 5, "apple");
            i = k + 5;
            
        }
    }
    
	cout << a << "\n";
	
		
	return 0;
}



Measured memory_bytes: 2980
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++) 

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<char> Vc;
typedef vector<double> Vd;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int>> VVi;
typedef vector<vector<ll>> VVl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 30;
const ll linf = 1LL << 60;
const int MOD = 1000000007;


int main()
{
	int n, x;
	cin >> n >> x;

	int ans = 1;
	int cur = 0;
	REP(_i, n)
	{
		int l; cin >> l;
		if (cur + l <= x)
		{
			++ans;
			cur += l;
		}
		else
			break;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
let nil = -1

type t = {
  mutable parent : int;
  mutable left : int;
  mutable right : int;
}

let make () = {
  parent = nil;
  left = nil;
  right = nil;
}

let search_root t n =
  let rec doit i =
    if i = n then nil
    else if t.(i).parent = nil then i
    else doit (i + 1)
  in doit 0

let preorder t root f =
  let rec doit i =
    f i;
    if t.(i).left <> nil then doit t.(i).left;
    if t.(i).right <> nil then doit t.(i).right
  in doit root

let inorder t root f =
  let rec doit i =
    if t.(i).left <> nil then doit t.(i).left;
    f i;
    if t.(i).right <> nil then doit t.(i).right
  in doit root

let postorder t root f =
  let rec doit i =
    if t.(i).left <> nil then doit t.(i).left;
    if t.(i).right <> nil then doit t.(i).right;
    f i
  in doit root

let () =
  let n = read_int () in
  let t = Array.init n (fun _ -> make ()) in
  let rec read i =
    if i < n then begin
      let (id, l, r) = Scanf.scanf "%d %d %d\n" (fun id l r -> (id, l, r)) in
      t.(id).left <- l;
      t.(id).right <- r;
      if l <> nil then t.(l).parent <- id;
      if r <> nil then t.(r).parent <- id;
      read (i + 1)
    end in
  read 0;
  let root = search_root t n in
  print_endline "Preorder";
  preorder t root (fun i -> Printf.printf " %d" i);
  print_newline ();
  print_endline "Inorder";
  inorder t root (fun i -> Printf.printf " %d" i);
  print_newline ();
  print_endline "Postorder";
  postorder t root (fun i -> Printf.printf " %d" i);
  print_newline ()

Measured memory_bytes: 2424
while 1:
    n,q = map(int, raw_input().split())
    if n == 0 and q == 0: break
    dates = [0 for i in xrange(100)]
    for i in xrange(n):
        cDate = map(int, raw_input().split())
        if cDate[0] != 0:
            for j in xrange(cDate[0]):
                dates[cDate[j+1]] += 1
    nom = max(dates)
    if nom >= q:
        for i in xrange(len(dates)):
            if dates[i] == nom:
                print i
                break
    else:
        print 0

Measured memory_bytes: 4236
def main():
    import sys
    import time
    start=time.time()
    K=int(sys.stdin.readline())
    if K%2==0:
        print(-1)
        return

    L=[7%K]
    L2=[7%K]
    if L[0]==0:
        print(1)
        return

    idx=0
    while True:
        L2.append((L2[idx]*10)%K)
        L.append((L[idx]+L2[idx+1])%K)
        if L[-1]==0:
            print(len(L))
            return
        idx+=1

        if time.time()-start>=1.5:
            print(-1)
            return
main()

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

typedef long long ll;
const int N = 505;
const int M = 1000000007;

int n, m;
char a[N][N], b[N][N], c[N][N];

int main() {
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 0; i < n; i++) {
      scanf("%s", c[i]);
      for (int j = 0; j < m; j++) {
        a[i][j] = c[i][j] == '#' || j == 0 || (!(i & 1) && j != m - 1) ? '#' : '.';
        b[i][j] = c[i][j] == '#' || j == m - 1 || ((i & 1) && j != 0) ? '#' : '.';
      }
      a[i][m] = b[i][m] = 0;
    }
    for (int i = 0; i < n; i++) { puts(a[i]); }
    puts("");
    for (int i = 0; i < n; i++) { puts(b[i]); }
  }
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll num[114514];
bool f[114514];
int main(){
	ll n,m;
	cin>>n>>m;
	vector<vector<P>>v(n+1);
	for(int i=0;i<m;i++){
		ll l,r,d;
		cin>>l>>r>>d;
		v[l].push_back({r,d});
		v[r].push_back({l,-d});
	}
	ll inf=1e15;
	for(int i=2;i<=n;i++)num[i]=inf;
	queue<ll>que;
	que.push(1);
	f[1]=1;
	while(!que.empty()){
		ll x=que.front();
		que.pop();
		for(int i=0;i<v[x].size();i++){
			//cout<<v[x][i].first<<' '<<v[x][i].second<<endl;
			if(!f[v[x][i].first])que.push(v[x][i].first);
			f[v[x][i].first]=1;
			if(num[v[x][i].first]==inf)num[v[x][i].first]=v[x][i].second+num[x];
			else{
				if(num[v[x][i].first]!=v[x][i].second+num[x]){
					cout<<"No\n";
					return 0;
				}
			}
		}
	}
	//for(int i=1;i<=3;i++)cout<<f[i]<<' ';
	for(int i=2;i<=n;i++){
		if(f[i])continue;
		if(num[i]==inf)num[i]=0;
		que.push(i);
		while(!que.empty()){
			ll x=que.front();
			que.pop();
			for(int j=0;j<v[x].size();j++){
				if(!f[v[x][j].first])que.push(v[x][j].first);
				f[v[x][j].first]=1;
				if(num[v[x][j].first]==inf)num[v[x][j].first]=num[x]+v[x][j].second;
				else{
					if(num[v[x][j].first]!=v[x][j].second+num[x]){
						cout<<"No\n";
						return 0;
					}
				}
			}
		}
	}
	cout<<"Yes\n";
	return 0;
}


Measured memory_bytes: 17024
/*
  Vivek Rathi
  CSE 3rd Year
  MNNIT
  THUMB RULE - THINK FOR DP FIRST AND THEN GREEDY!!!
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define sz(x)	(ll)x.size()
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
#define flush fflush(stdout);
#define endl '\n'
//unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
//shuffle (foo.begin(), foo.end(), std::default_random_engine(seed));
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}
//-------------------------------Template--Above-----------------------------------------------

int main()
{
	boost
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		ll a[n];
		for(ll i=0;i<n;i++)
		{
			cin>>a[i];
		}
		sort(a,a+n);
		ll sum=a[n-1];
		ll cnt=0;
		cnt=n-2;
		for(ll i=n-2;i>=0&&cnt>0;i--)
		{
			sum+=min(2LL,cnt)*a[i];
			cnt-=2LL;
		}
		cout<<sum<<endl;
	}
	return 0;
}

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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(A);
    scanInt(B);
    cout << max({A + A - 1, A + B, B + B - 1}) << endl;
}


Measured memory_bytes: 256
s, c = input(), 0
for i in range(len(s) // 2):
    if s[i] == "i" or s[i] == "w":
        if s[i] != s[- i - 1]:c += 1
    elif s[i] == "(":
        if s[- i - 1] != ")":c += 1
    elif s[- i - 1] != "(":c += 1
if len(s) % 2:
    if s[len(s) // 2] == ")" or s[len(s) // 2] == "(":c+=1 
print(c)


Measured memory_bytes: 5564
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	char s[100010];
	vint x(n);
	cin >> s;
	rep(i, n) {
		x[i] = s[i] - 'a';
	}
	int cnt = 0;
	int cntb = 0;
	rep(i, n) {
		if (x[i] == 0) {
			if (cnt < a + b) {
				cout << "Yes" << endl;
				cnt++;
				continue;
			}
		}
		if (x[i] == 1) {
			cntb++;
			if (cnt < a + b&&cntb <= b) {
				cout << "Yes" << endl;
				cnt++;
				continue;
			}
		}
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> xs(n);
  for(Int i=0;i<n;i++) cin>>xs[i];

  Int m,k;
  cin>>m>>k;
  vector<Int> as(m);
  for(Int i=0;i<m;i++) cin>>as[i],as[i]--;

  vector<Int> id(n-1);
  iota(id.begin(),id.end(),0);

  vector<Int> ch(id);
  for(Int a:as) swap(ch[a-1],ch[a]);

  auto mg=
    [&](auto as,auto bs){
      auto cs(id);
      for(Int i=0;i+1<n;i++)
        cs[i]=as[bs[i]];
      return cs;
    };

  vector<Int> res(id);
  while(k){
    if(k&1) res=mg(res,ch);
    ch=mg(ch,ch);
    k>>=1;
  }

  vector<Int> ans(xs);
  for(Int i=0;i+1<n;i++) ans[i+1]=ans[i]+(xs[res[i]+1]-xs[res[i]]);

  for(Int i=0;i<n;i++) cout<<ans[i]<<"\n";
  cout<<flush;
  return 0;
}


Measured memory_bytes: 6736
N, K = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))
K = K-1
ans = -10**9-1
for h in range(N):
   i = h+1
   start = i
   circle = [c[i-1]]
   i = p[i-1]
   while i != start:
      score = circle[-1] + c[i-1]
      circle.append(score)
      i = p[i-1]
   l=len(circle)
   for j in range(min(l, K+1)):
      if circle[l-1] > 0:
         score = circle[j] + ((K - j)//l)*circle[l-1]
      else:
         score = circle[j]
      ans = max(score, ans)      
print(ans)

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    string s;
    int a,b; cin >>a>>b;
    if(a<=5) {
        cout << 0 << '\n';
    } 
    else if(a>=13){
        cout << b << '\n';
    }
    else {
        cout << b/2 << '\n';
    }

    // printf("ExcutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}

Measured memory_bytes: 512
fn main() {
    let n: i64 = read_line_as_value();

    let mut ans = std::i64::MAX;
    let mut divider = 1;
    while divider * divider <= n {
        if n % divider == 0 {
            let dest_i = divider;
            let dest_j = n / divider;
            ans = std::cmp::min(dest_i + dest_j - 2, ans);
        }
        divider += 1;
    }
    println!("{}", ans);
}

fn read_line_as_value<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    let res = std::io::stdin().read_line(&mut input);
    if let Err(error) = res {
        panic!("io error at stdin.read_line: {}", error);
    };
    match input.trim().parse() {
        Ok(val) => val,
        _ => panic!("error while parsing input: {}", input)
    }
}

Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
  int n;
  cin>>n;
  vector<int> b(n);
  rep(i,n-1)
    cin>>b[i];
  vector<int> a(n);
  a[0]=b[0];
  a[n-1]=b[n-2];
  b[n-1]=b[n-2];
  rep(i,n-1)
  {
   if(b[i]<b[i+1])
     a[i+1]=b[i];
    else
      a[i+1]=b[i+1];
  }
  int ans=0;
  rep(i,n){
    ans+=a[i];
  }
  cout<<ans<<endl;
    }

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  ll x, k, d;
  cin >> x >> k >> d;
  if(x < 0) {
    x *= -1;
  }
  if(x / k >= d) {
    cout << x - k * d << endl;
  } else {
    ll num = x / d;
    k -= num;
    ll mini1 = x % d;
    ll mini2 = x % d - d;
    if(k % 2 == 0) {
      cout << mini1 << endl;
    } else {
      cout << abs(mini2) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3632
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	var c int
	for i := 1; i <= n; i++ {
		if i < 10 {
			c++
		} else if i < 100 {
		} else if i < 1000 {
			c++
		} else if i < 10000 {
		} else if i < 100000 {
			c++
		}
	}
	fmt.Println(c)
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  string str = readString();
  str[3] = '8';
  std::cout << str << std::endl;
}


Measured memory_bytes: 2304
package main

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

func main() {
	k := nextInt()
	v := strings.Split(nextLine(), " ")

	a, _ := strconv.Atoi(v[0])
	b, _ := strconv.Atoi(v[1])

	for i := a; i <= b; i++ {
		if i % k == 0 {
			fmt.Println("OK")
			return
		}
	}
	fmt.Println("NG")
}

// =================================
// I/O util
// =================================

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

// =================================


Measured memory_bytes: 1756
def main(argv)
  n = gets.chomp.to_i
  a = gets.chomp.split(' ').map(&:to_i)

  as = [[]]
  prev = a[0]
  n.times do |i|
    if prev != a[i] then
      as.push([a[i]])
      prev = a[i]
    else
      as[as.size - 1].push(a[i])
    end
  end
  
  puts as.map{|a| a.size / 2}.reduce(:+).to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <queue>

using std::cerr;
using std::cin;
using std::cout;
using std::pair;
using std::string;
using std::vector;
//region
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (b); i >= (b); --i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n)-1; i >= 0; --i)
#define repr1(i, n) for (int i = (n); i > 0; --i)
#define outif(b, t, f) cout << ((b) ? (t) : (f)) << endl
#define all(vec) (vec).begin(), (vec).end()
#define sz(x) (int((x).size()))
#define mset(v, n) std::memset((v), n, sizeof(v))
#define BIT(N) (1LL << (N))
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using vint = vector<int>;
using vlong = vector<ll>;
using vstr = vector<string>;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpll = vector<pll>;
using vvi = vector<vint>;
using vvl = vector<vlong>;
vector<string> split(const string &s, const string &delim) {
  vector<string> res;
  uint pos = 0;
  while (true) {
    const int found = s.find(delim, pos);
    if (found < 0) {
      res.push_back(s.substr(pos));
      break;
    }
    res.push_back(s.substr(pos, found - pos));
    pos = found + delim.size();
  }
  return res;
}
template<typename T> string join(vector<T> &vec, const string &sep) {
  size_t size = vec.size();
  if (!size) return "";
  std::stringstream ss;
  for (int i = 0; i < size - 1; i++)
    ss << vec[i] << sep;
  ss << vec[size - 1];
  return ss.str();
}
template<typename T> std::istream &operator>>(std::istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template<typename Iter> inline void print(const Iter &first, const Iter &last, const std::string &d, bool endline) {
  cout << *first;
  for (Iter iter = first + 1; iter < last; ++iter) {
    cout << d << *iter;
  }
  if (endline) cout << "\n";
}
constexpr ll powmod(ll a, ull b, ull p) {
  ll res = 1;
  while (b > 0) {
    if (b % 2) res = res * a % p;
    a = a * a % p;
    b >>= 1u;
  }
  return res;
}
template<class T> bool chmax(T &a, const T &b) { return a < b ? (a = b, true) : false; }
template<class T> bool chmin(T &a, const T &b) { return a > b ? (a = b, true) : false; }
template <typename T> void bsort(vector<T>& v) { std::sort(v.begin(), v.end()); }
template <typename T> void rsort(vector<T>& v) { std::sort(v.begin(), v.end(), std::greater<T>()); }
struct iii {
    iii() {
      cin.tie(nullptr); cout.tie(nullptr);
      std::ios::sync_with_stdio(false);
      cout << std::fixed << std::setprecision(16);
    }
} init;
//endregion

void solve();

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

void solve() {
  string S;cin>>S;

  vint a(S.size());
  for (size_t i = 0; i < S.size(); ++i) a[i] = S[i]=='A'||S[i]=='G'||S[i]=='C'||S[i]=='T';
  for(size_t i=1;i<S.size();++i)if(a[i])a[i]+=a[i-1];
  int ans=0;
  for(int x:a)chmax(ans,x);
  printf("%d\n",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int main(){
  cin >> n;
  pair<int, int> p[n];
  for(int i=0 ; i<n ; i++){
    int x; cin >> x;
    p[i].first = x; p[i].second = i;
  }
  sort(p, p+n);
  for(int i=0 ; i<n ; i++){
    cout << p[i].second + 1 << " " ;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL _a[10005];
LL _b[10005];
LL _c[10005];
int main(void)
{
    int N;
    cin>>N;
    for(int i = 0;i < N;i++)
        cin>>_a[i];
    for(int i = 0;i < N;i++)
        cin>>_b[i];
    LL sum = 0;
    for(int i = 0;i < N;i++)
        _c[i] = _b[i] - _a[i];
    for(int i = 0;i < N;i++)
    {
        if(_c[i] > 0)
            sum += _c[i]/2;
    }
    for(int i = 0;i < N;i++)
    {
        if(_c[i] < 0)
            sum += _c[i];
    }
    //cout<<sum<<endl;
    if(sum >= 0)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int N;
  cin >>N;
  int count = 0;
  vector<int> A(N);
  vector<int> B(N);
  for(int i =0;i < N;++i)
    cin >> A[i];
 for(int i=0;i < N;++i)
   B[i] = A[i];
  sort(A.begin(),A.end());
  
  for(int j=0;j < N;++j){
  if(A[j] != B[j])
    count++;
  }
  if(count <= 2)
    cout << "YES" << endl;
  else 
    cout << "NO" << endl;
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>n;
    //vector<vector<ll>> v(tate,vector<ll> (yoko));
    cout<<n+n*n+n*n*n<<endl;

    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
	int n;
	string s;
	cin >> n >> s;
	if (n % 2 == 1)cout << "No" << endl;
	else if (s.substr(0, n / 2) == s.substr(n / 2))cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

ll GetDigit(ll num)
{
  return log10(num) + 1;
}

//n ~ mの和
ll sigma(ll n, ll m)
{
  return ((n + m) * (m - n + 1) * 0.5);
}

void Main()
{
  str s, t; cin >> s >> t;
  for(ll i = 0;i <= s.size();i++)
  {
    if(s == t)
    {
      fin("Yes");
    }
    str a;
    a = s[s.size() - 1];
    s.pop_back();
    s = a + s;
  }
  fin("No");
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}


Measured memory_bytes: 256