akhauriyash/Code-Regression huggingface dataset:
x,n = map(int,input().split())
if n == 0:
    print(x)
    exit()
    
p = input().split()
for i in range(100):
    for j in p:
        if int(j) == x - i:
            break
    else:
        print(x - i)
        break
    for j in p:
        if int(j) == x + i:
            break
    else:
        print(x + i)
        break

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define ll long long
int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//ll tt;	cin>>tt;	while(tt--)
	{
		ll n,i;
		cin>>n;
		
		cout<<fixed<<setprecision(7)<<2*3.14159265358979*n;
 	
 	}
	cerr<<" Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s \n";
		
		
return 0;
}

Measured memory_bytes: 3788
while True:
    n,x = map(int,input().split())
    if n == 0  and x == 0:
        break
    ans = 0
    for i in range(1,n+1):
        for j in range(1,n+1):
            if j <= i:
                continue
            c = x-(i+j)
            if c > j and c <= n:
                ans += 1
    print(ans)



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

#define reint register int
#define coint const int

using namespace std;

int main(void) {
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", (b - 1 + a - 2) / (a - 1));

    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>
#include <iomanip>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

const double pi = acos(-1.0);

template <class T = double>
struct coord {
  T x, y;
  coord<T> operator-() const {return {-x, -y};}
  T norm_sq() const {return x * x + y * y;}
  coord<T> operator+(const coord &p) const {return {x + p.x, y + p.y};}
  coord<T> operator-(const coord &p) const {return {x - p.x, y - p.y};}
  T operator*(const coord &p) const {return x * p.x + y * p.y;}
  T det(const coord &p) const {return x * p.y - y * p.x;}
  bool operator<(const coord &p) const {
    if(x != p.x) return x < p.x;
    return y < p.y;
  }
};

typedef coord<double> CD;

struct point {
  int id;
  coord<double> cd;
  bool operator<(const point &p) const {
    return cd < p.cd;
  }
};

vector<point> convex_hull(const vector<point> &ps) {
  int n = ps.size();
  int k = 0;
  vector<point> qs(n * 2);
  REP(i,0,n) {
    while(k > 1 && (qs[k-1].cd-qs[k-2].cd).det(ps[i].cd-qs[k-1].cd) <= 0) {
      k--;
    }
    qs[k++] = ps[i];
  }
  for(int i = n-2, t = k; i >= 0; i--) {
    while (k > t && (qs[k-1].cd-qs[k-2].cd).det(ps[i].cd-qs[k-1].cd) <= 0) {
      k--;
    }
    qs[k++] = ps[i];
  }
  qs.resize(k - 1);
  return qs;
}

double arg(coord<double> p, coord<double> q) {
  double norm = sqrt(p.norm_sq() * q.norm_sq());
  return acos(p * q / norm) / pi / 2.0;
}

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<point> ps(n);
  REP(i,0,n) {
    ps[i].id = i;
  }
  FOR(p,ps) {
    cin >> p.cd.x >> p.cd.y;
  }
  sort(ps.begin(), ps.end());
  vector<point> qs = convex_hull(ps);
  int k = qs.size();
  vector<double> ans(n, 0.0);
  REP(i,0,k) {
    int prev = (i - 1 + k) % k;
    int next = (i + 1) % k;
    CD v1 = qs[i].cd - qs[prev].cd;
    CD v2 = qs[next].cd - qs[i].cd;
    double t = arg(v1, v2);
    ans[qs[i].id] = t;
  }
  FOR(a,ans) {
    cout << setprecision(20) << a << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

ll mod = 1000000007;

signed main()
{
    int n;
    cin >> n;
    int sum = 0;
    rep(i, n + 1)
    {
        sum += i + 1;
        if (sum >= n)
        {
            int rest = sum - n;
            if (rest == 0)
            {
                rep(j, i + 1)
                {
                    cout << j + 1 << endl;
                }
                return 0;
            }
            else
            {
                rep(j, i + 1)
                {
                    if (j + 1 != rest)
                    {
                        cout << j + 1 << endl;
                    }
                }
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3636
package main

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

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_B&lang=jp>
 */

func init() {
}

func main() {
	//scanner := bufio.NewScanner(os.Stdin)
	scanner := bufio.NewReader(os.Stdin)
	alpha := make([]int, 26)
	for {
		//scanner.Scan()
		//str := scanner.Text()
		//if scanner.Err() == io.EOF {
		//	break
		//}
		str, err := scanner.ReadString('\n')
		if err == io.EOF{
			break
		}
		for _, c := range str {
			tmp := strings.ToLower(string(c))
			if tmp[0] >= 'a' && tmp[0] <= 'z' {
				alpha[tmp[0]-'a']++
			}
		}
	}
	for i := 0; i < len(alpha); i++ {
		fmt.Printf("%s : %d\n", string('a'+i), alpha[i])
	}
}

Measured memory_bytes: 1116
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef __int128 lll;
const int Mod=998244353;

int n; char str[110];
int dp[21][1<<20]; bool vis[21][1<<20];
int get(lll S,int k){return S>>k-1&1;}
int dfs(int,lll);
lll fold(lll S,int L,int n){
	static lll t=1; lll T=0;
	for (int i=0;i<L;i++) T|=t<<i;
	for (int i=0,j=0;i<n;i++,j=j+1==L?0:j+1)
		if (!(S>>i&1)&&(T>>j&1)) T^=t<<j;
	return T;
}
int trans(int n,lll S){
	int T=1; for (int i=1;i<=n;i++) T&=get(S,i);
	int res=1+T;
	for (int i=2;i*i<=n;i++) if (n%i==0){
		res=(res+dfs(i,fold(S,i,n)))%Mod;
		if (i*i!=n) res=(res+dfs(n/i,fold(S,n/i,n)))%Mod;
	}
	return res;
}
int dfs(int n,lll S){
	if (n<=20&&vis[n][S]) return dp[n][S];
	int f[110];
	f[0]=1; for (int i=1;i<=n;i++) f[i]=0;
	for (int i=0;i<n;i++){
		if (!f[i]) continue;
		lll T=0;
		for (int j=i+1;j<=n;j++){
			T|=(S>>j-1&1)<<j-i-1;
			f[j]=(f[j]+1LL*f[i]*trans(j-i,T))%Mod;
		}
	}
	if (n<=20) vis[n][S]=1,dp[n][S]=f[n];
	return f[n];
}
int main()
{
	scanf("%s",str+1); n=strlen(str+1);
	lll S=0;
	for (int i=n;i;i--) S=S<<1|(str[i]^48);
	int ans=dfs(n,S);
	printf("%d\n",(ans+Mod)%Mod);
	return 0;
}

Measured memory_bytes: 6976
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long int llint;
int mod=1e9+7,f[200005],x[3005],bc1[3005][3005],b1;
map <pair<llint,llint>,int> p,c;
vector <pair<int,int> > v;
map <pair<int,int>,int> cnt;
int sum(int a,int b) {
	if(a+b<mod) return a+b;
	return a+b-mod;
}
int diff(int a,int b) {
	if(a-b+mod<mod) return a-b+mod;
	return a-b;
}
int mul(llint a,llint b) {
	if(a*b<mod) return a*b;
	return (a*b)%mod;
}
int get_p(llint x,llint a) {
	if(a==0) return 1;
	if(a==1) return x;
	//int p1=p[make_pair(x,a)];
	//if(p1) return p1;
	int r=get_p(x,a/2),ret=mul(r,r);
	if(a%2) ret=mul(ret,x);
	//p[make_pair(x,a)]=ret;
	return ret;
}
int divide(int a,int b) {
	//return 2;
	//cout << a << " " << get_p(b,mod-2) << "\n";
	return mul(a,get_p(b,mod-2));
}
int bc(int x,int y) {
	if(x==y) return 1;
	if(y==0) return 1;
	if(x-y==1 or y==1) return x;
	if(b1) {
		int c1=c[make_pair(x,y)];
		if(c1) return c1;
	}
	//cout << x << " " << y << " " << f[x] << " " << f[y]*f[x-y] << "\n";
	int ret=divide(f[x],mul(f[y],f[x-y]));
	if(b1) c[make_pair(x,y)]=ret;
	if(b1) c[make_pair(x,x-y)]=ret;
	return ret;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int h,w,n;
	cin >> h >> w >> n;
	int sol=0;
	for(int i=0;i<n;i++) {
		int r,c;
		cin >> r >> c;
		v.push_back(make_pair(r-1,c-1));
	}
	sort(v.begin(),v.end());
	for(int i=1;i<v.size();i++) {
		cnt[make_pair(v[i].first-v[i-1].first,v[i].second-v[i-1].second)]+=1;
	}
	for(int i=1;i<v.size();i++) {
		if(cnt[make_pair(v[i].first-v[i-1].first,v[i].second-v[i-1].second)]>=5e2) b1=1;
	}
	f[0]=1;
	f[1]=1;
	for(int i=2;i<=h+w;i++) {
		f[i]=mul(i,f[i-1]);
	}
	for(int i=0;i<v.size();i++) {
		for(int j=0;j<i;j++) {
			if(v[j].second>v[i].second) continue;
			//get_p(mul(v[i].first-v[j].first,v[i].second-v[j].second),mod-2);
			bc1[i][j]=bc(v[i].first-v[j].first+v[i].second-v[j].second,v[i].first-v[j].first);
		}
	}
	//cout << "abc\n";
	//cout << bc(h+w-2,h-1) << "\n";
	for(int i=0;i<v.size();i++) {
		//cout << i << "\n";
		llint x1=bc(v[i].first+v[i].second,v[i].first);
		for(int j=0;j<i;j++) {
			if(v[j].second>v[i].second) continue;
			x1=diff(x1,mul(x[j],bc1[i][j]));
		}
		x[i]=x1;
		//cout << x[i] << "\n";
	}
	sol=bc(h+w-2,h-1);
	for(int i=0;i<v.size();i++) {
		sol=diff(sol,mul(x[i],bc(h-1-v[i].first+w-1-v[i].second,h-1-v[i].first)));
	}
	cout << sol;
	return 0;
}


Measured memory_bytes: 32728
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <utility>
#include <stack>
#include <cstring>
#include <cmath>
#include <vector>
#include <ctime>
#include <ostream>
using namespace std;
typedef long long ll;
int a,b,c;
int k,s;
ll ans;
int arrange(int x)
{
    ll cnt=0;
    for(int i=0;i<=x;++i)
    {
        b=i,c=x-b;
        if(b<0||c<0||c>k||b>k)continue;
        int eq=0;
        if(a==b)++eq;
        if(a==c)++eq;
        if(c==b)++eq;
        if(!eq)++cnt;
        else if(eq==1)++cnt;
        else ++cnt;
//        printf("%d %d %d\n",a,b,c);
    }
//    printf("%d\n",cnt);
    return cnt;
}
int main()
{
#ifdef LOCAL
    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
#endif // LOCAL
    scanf("%d%d",&k,&s);
    if(3*k<s)
        printf("0");
    else if(3*k==s)
        printf("1");
    else
    {
//        ll ans;
        ans=0;
        for(int i=0;i<=k;i++)
        {

                a=i;
                ans+=arrange(s-a);

        }
        printf("%lld",ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

/*
Problem Statement
Takahashi is a user of a site that hosts programming contests.
When a user competes in a contest, the rating of the user (not necessarily an integer) 
changes according to the performance of the user, as follows:

Let the current rating of the user be 
a
Suppose that the performance of the user in the contest is 
b
Then, the new rating of the user will be the avarage of 
a
 and 
b
For example, if a user with rating 
1
 competes in a contest and gives performance 
1000
, his/her new rating will be 
500.5
, the average of 
1
 and 
1000
.
Takahashi's current rating is 
R
, and he wants his rating to be exactly 
G
 after the next contest.
Find the performance required to achieve it.
*/

int aRating(int a, int b){
    return (2 * b) - a;
}

int main(){
    int r,g;
    std::cin>>r>>g;
    std::cout<<aRating(r,g);
    return 0;
}

Measured memory_bytes: 3556
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,m=n1()

import math
print(n*(n-1)//2+m*(m-1)//2)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(ll i=(x);i<(y);i++)
#define disp(a) cout << a << endl;
typedef long long ll;
using namespace std;
int main()
{
	int a, b, c, d;
	vector<int> v;
	cin >> a >> b >> c >> d;
	v.push_back(abs(a-b));
	v.push_back(abs(b-c));
	v.push_back(abs(c-a));

	if (v[2]<=d) {
		disp("Yes");
	}
	else if(v[0]<=d&&v[1]<=d){
		disp("Yes");
	}
	else {
		disp("No");
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll N,M;
    cin >> N >> M;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        if (i == 0) {
            A.at(i) = a % M;
        }
        else {
            A.at(i) = (A.at(i - 1) + (a % M)) % M;
        }
    }
    map<ll,ll> list;
    for (int i = 0; i < N; i++) {
        list[A.at(i)]++;
    }
    ll ans = 0;
    for (auto lt : list) {
        ans += lt.second * (lt.second - 1) / 2;
        if (lt.first == 0) {
            ans += lt.second;
        }
    }
    cout << ans << endl;
}

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

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define sz(x) ((int)(x).size())
using ll  = long long;
using vi  = vector<int>;

int countBlock(vi x){
  int res = 0;
  FOR(i,1,sz(x))
    if(x[i-1] <= 0 and x[i] > 0) res++;
  return res;
}

bool hasPositive(vi x){
  rep(i,sz(x)) if(x[i] > 0) return true;
  return false;
}

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

  int res = 0;
  while(hasPositive(h)){
    res += countBlock(h);
    rep(i,sz(h)) h[i]--;
  }
  cout << res << endl;
}

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

int main(){
    string s;  cin >> s;
    int n = s.length();
    if((n%2==0)^(s[0]==s[n-1])){
        cout << "Second" << endl;
    }else{
        cout << "First" << endl;
    }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define Cint boost::multiprecision::cpp_int
#define int long long
#define ll long long

using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

int N, K, A[202020];

bool check(long double x) {
    Cint cnt = 0;
    bool flag = false;
    for (int i = 0; i < N; i++) {
        cnt += (Cint)ceil(A[i] / x) - 1;
        if (x <= A[i])
            flag = true;
    }
    if (!flag)
        return true;
    cerr << cnt << endl;
    return cnt <= K;
}

void solve() {
    long double ok = 1e10;
    long double ng = 0;
    while (abs(ok - ng) > 0.0000000001) {
        long double mid = (ok + ng) / 2;
        if (check(mid)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cerr << ok << endl;
    if (abs(ok - (int)ok) < 0.00000001)
        cout << (int)ok << endl;
    else
        cout << (int)ceil(ok) << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }


    solve();
    return 0;
}


Measured memory_bytes: 5428
#include <iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	int sum = 0;
	// n を保存する
	int tmp = n;
	while(n){
		sum += n%10;
		n /= 10;
	}
	cout << (tmp%sum==0? "Yes": "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
int main(){
	int a,b,h,m;
	scanf("%d%d%d%d",&a,&b,&h,&m);
	if(h>=12) h-=12;
	ld hang,mang;
	mang=m*1.0*6;
	hang=30*h+(ld)m/2;
	ld ang=fabs(hang-mang);
	if(ang>=180) ang=360-ang;
	ang=ang/180*acos(-1);
	ld ans=pow(a,2)+pow(b,2)-2*a*b*cos(ang);
	printf("%.15Lf\n",sqrt(ans));
} 

Measured memory_bytes: 4160
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
#define ALL(x) (x).begin(), (x).end()
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }

    return true;
}
int sum;
int main(void) {
    int a, b;
    cin >> a >> b;
    int ans = b - a;
    rep(i, ans) {
        sum += i;
    }
    cout << sum - a << endl;
    return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#define f first
#define s second
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define vi vector <int>
#define ld long double
#define pii pair<int, int>
#define y1 sda
using namespace std;    
const int N = int(3e5), mod = int(1e9)  + 7; 

char s[N];

int n;

int cnt[30];

ll ans;

int main () {
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for(int i = 1; i <= n; i++){
		cnt[s[i] - 'a']++;
		for(int j = 0; j < 26; j++){
			if(s[i] - 'a' != j){
				ans += cnt[j];
			}
		}
	}

	printf("%lld", ans + 1);
return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

bool cmp(P a, P b) {
    if(a.se != b.se) return a.se < b.se;
    else return a.fi < b.fi;
}

signed main() {
    int n, m;
    cin >> n >> m;
    V(P) dis(m);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        dis[i] = P(a, b);
    }
    sort(ALL(dis), cmp);

    int prev = -1, res = 0;
    rep(i, m) {
        if(dis[i].fi >= prev) {
            res++;
            prev = dis[i].se;
        }
    }

    cout << res << endl;
    

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int x; cin>>x;
    if(x <30) cout << "No"<< endl;
    else cout << "Yes"<< endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pii pair<int,int>
#define pb push_back
const int maxn = 1e5 + 5;
ll a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    string a; cin >> a;
    int n = a.size();
    bool win;
    if (a[0] == a.back()) win = !(n & 1);
    else win = (n & 1);
    cout << (win ? "First" : "Second") << endl;
    return 0;
}


Measured memory_bytes: 3760
#include <stdio.h>

#define MAX 100005
#define NIL -1

typedef struct {int p, l, r;} Node;

Node T[MAX];
int n, D[MAX];

void print(int u) {
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if( T[u].p == NIL ) printf("root, ");
  else if( T[u].l == NIL ) printf("leaf, ");
  else printf("internal node, ");

  printf("[");

  for(i=0, c=T[u].l; c != NIL; i++, c=T[c].r) {
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

void rec(int u, int p) {
  D[u] = p;
  if(T[u].r != NIL) rec(T[u].r,p);
  if(T[u].l != NIL) rec(T[u].l,p+1);
}

int main(void) {
  int i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;
  for(i=0;i<n;i++) {
    scanf("%d %d",&v,&d);
    for(j=0;j<d;j++) {
      scanf("%d",&c);
      if(j==0) T[v].l=c;
      else T[l].r =c;
      l = c;
      T[c].p = v;
    }
  }
  for(i=0;i<n;i++) {
    if(T[i].p == NIL) r = i;
  }
  
  rec(r,0);
  
  for(i=0;i<n;i++) print(i);
  
  return 0;
}


Measured memory_bytes: 6416
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>


int main(int argc, char* argv[])
{
	using std::cin;
	using std::cout;
	std::ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int N, K;
	cin >> N >> K;

	int pairs = ((N-1)*(N-2)) / 2;
	if (K > pairs)
	{
		cout << -1 << std::endl;
		return 0;
	}

	std::vector<std::pair<int,int>> edges;
	for (int i = 2; i <= N; ++i)
	{
		edges.emplace_back(1, i);
	}

	int i = 2, j = 3;
	while (pairs > K)
	{
		edges.emplace_back(i, j);
		--pairs;
		++j;
		if (j > N)
		{
			++i;
			j = i + 1;
		}
	}

	cout << edges.size();
	for (auto& e : edges)
	{
		cout << '\n' << e.first << ' ' << e.second;
	}
	cout << std::endl;

	return 0;
}


Measured memory_bytes: 384
def main():
    n = int(input())
    s = input()

    prev = ''
    c = 0

    for i in s:
        if prev == '':
            if i == 'A':
                prev = 'A'
        elif prev == 'A':
            if i == 'A':
                prev = 'A'
            elif i == 'B':
                prev = 'B'
            else:
                prev = ''
        elif prev == 'B':
            if i == 'A':
                prev = 'A'
            elif i == 'C':
                c += 1
                prev = ''
            else:
                prev = ''

    print(c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		long A = sc.nextLong();
		long B = sc.nextLong();
		long K = sc.nextLong();
		
		System.out.println(Math.max(0, A - K) + " " + Math.max(0, Math.min(B, B - (K - A))));
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    int n, a[200020], b[200020];
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];

    vector<int> ans;
    for (int i = n; i > 0; i--) {
        if (a[i] == 1) {
            ans.push_back(i);
            for (int j = 1; j <= sqrt(i); j++) {
                if (i % j == 0) {
                    a[j] = (a[j] + 1) % 2;
                    if (j != 1 && i / j != j) a[i / j] = (a[i / j] + 1) % 2;
                }
            }
        }
    }
    
    sort(ans.begin(), ans.end());
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
        if (i != 0) cout << " " ;
        cout << ans[i];
    }
    cout << endl;
}

/*
g++ -std=c++14 abc134/d.cpp
 */

Measured memory_bytes: 2424
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

int main(void){
    int n;cin>>n;
    string s;cin>>s;
    int cnt=0;
    rep(i,n-2){
        if(s.substr(i, 3)=="ABC")cnt++;
    }
    co(cnt);
}


Measured memory_bytes: 384
/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;
void FastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
}

const int N = 1e5;

bool is_pal(string &s){
  int n = s.size();
  for (int i = 0, j = n-1;i < n/2;i++, j--){
    if (s[i] != s[j])return false;
  }
  return true;
}

int main()
{
  FastIO();
  int tc, ca = 0;
  string s;
  cin >> s;
  int n = s.size();
  string pref;
  string suf;
  for (int i = 0;i < (n-1)/2;i++){
    pref += s[i];
  }
  for (int i = (n+3)/2;i <= n;i++){
    suf += s[i-1];
  }
  //cout << pref << ' ' << s << ' ' << suf << '\n';
  if (is_pal(s) && is_pal(pref) && is_pal(suf))cout << "Yes" << '\n';
  else cout << "No" << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
//java11
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		int length = s.length();

		long ans = 0;

		//bit全探索
		for(int i=0; i<(1 << length-1); i++) {
			List<Integer> plus = new ArrayList<>();

			for(int j=0; j<length-1; j++) {
				if((1 & (i >> j)) == 1) {
					plus.add(j);
				}
			}

			StringBuilder sb = new StringBuilder(s);

			int index = 0;
			for(int j=0; j<plus.size(); j++) {
				int a = plus.get(j);
				sb.insert(a+1+index, "+");
				index++;
			}

			String[] nums = sb.toString().split("\\+");

			for(int j=0; j<nums.length; j++) {
				ans += Long.parseLong(nums[j]);
			}
		}

		System.out.println(ans);

	}

}


Measured memory_bytes: 22740
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    
    if(a+b+c!=17){
      System.out.println("NO");
    }else{
      if((a==5 || a==7)&&(b==5 || b==7)){
        System.out.println("YES");
      }
    }
  }
}


Measured memory_bytes: 21844
n = int(input())
a = list(map(int,input().split()))
b= list(map(int,input().split()))
a1 = [0]
b1 = [0]
for i in range(n):
    a1.append(a1[-1]+a[i])
    b1.append(b1[-1]+b[i])
ans = 0
for i in range(1,n+1):
    count = a1[i]+b1[-1]-b1[i-1]
    ans = max(ans,count)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define mod 1000000007
#define maxn 100005
using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  char s[LEN + 5]; int len,it;
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(len == LEN) fwrite(s,1,LEN,stdout), len = 0;
    s[len++] = c;
  }
  void flush(){
    fwrite(s,1,len,stdout);
    len = 0;
  }
}buff,bufo;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get())
    res = (res << 3) + (res << 1) + (c - '0');
  return sig * res;
}
inline void putll(ll x){
  if(!x) bufo.put('0');
  else if(x < 0) bufo.put('-'), x = -x;
  char s[25]; int k = 0;
  while(x){
    s[++k] = x % 10 + '0';
    x /= 10;
  }
  for(int i = k;i >= 1;i--) bufo.put(s[i]);
}

int n,k;
vector <int> adj[maxn];
ll dfs(int u,int f,int bad){
  int nxt = (f == -1) ? 1 : 2;
  if(bad >= k) return 0;
  ll res = (k - bad) % mod;
  for(int i = 0;i < (int)adj[u].size();i++){
    int v = adj[u][i];
    if(v == f) continue;
    res = res * dfs(v,u,nxt) % mod;
    nxt++;
  }
  return res;
}
int main(){
  n = getint(), k = getint();
  for(int i = 1;i < n;i++){
    int u = getint(), v = getint();
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  putll(dfs(1,-1,0));
  bufo.flush();
  return 0;
}


Measured memory_bytes: 11648
n = gets.to_i
map = Hash.new(0)
(1..100).each do |x|
  (1..100).each do |y|
    (1..100).each do |z|
      map["#{(x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)}"] += 1
    end
  end
end
(1..n).each do |i|
  puts map[i.to_s]
end


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

template<typename T, typename U> void dmin(T &x, U y) { if(x > y) x = y; }

const int MAX_N = 100;
const int INF = 1001001001;

int main() {
  int n, r, c;
  int rc[MAX_N][2];
  cin >> n;
  for (int i=0; i<n; i++) {
    cin >> r >> c;
    rc[i][0] = r; rc[i][1] = c;
  }

  int dp[MAX_N][MAX_N];
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      dp[i][j] = INF;
    }
    dp[i][i] = 0;
  }

  for (int l=2; l<=n; l++) {
    for (int i=0; i+l-1<n; i++) {
      for (int j=1; j<l; j++) {
        dmin(dp[i][i+l-1], dp[i][i+j-1] + rc[i][0]*rc[i+j-1][1]*rc[i+l-1][1] + dp[i+j][i+l-1]);
      }
    }
  }

  cout << dp[0][n-1] << endl;
  return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vdo=vector<double>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vvdo=vector<vector<double>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using pqin=priority_queue<int>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i,s,n) for(ll i=(s);i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
int main()
{
    ll n;
    cin>>n;
    int ans=100;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            string s=to_string(i);
            string t=to_string(n/i);
            int ds=s.size();
            int dt=t.size();
            int m=max(ds,dt);
            if(m<ans)ans=m;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;

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

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

ll choose2(ll n){
    return n*(n-1)/2;
}

int main(){
    int x,a;
    cin>>x>>a;
    if(x<a) cout<<"0"<<endl;
    else cout<<"10"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(20);
    int h, w, k; cin >> h >> w >> k;
    int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
    x1--, y1--, x2--, y2--;
    vector<vector<char>> a(h, vector<char>(w));
    vector<set<int>> rows(h), cols(w);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
            rows[i].insert(j);
            cols[j].insert(i);
        }
    }
    queue<int> qx, qy, qd;
    auto add = [&](int x, int y, int d) {
        if (x == x2 && y == y2) {
            cout << d << "\n";
            exit(0);
        }
        qx.push(x); qy.push(y); qd.push(d);
        rows[x].erase(y);
        cols[y].erase(x);
    };
    auto goUp = [&](int x, int y, int d) {
        auto it = cols[y].upper_bound(x);
        while (it != cols[y].begin()) {
            it--;
            int i = *it;
            if (abs(x - i) > k || a[i][y] != '.') {
                break;
            }
            add(i, y, d + 1);
            it = cols[y].upper_bound(x);
        }
    };
    auto goDown = [&](int x, int y, int d) {
        auto it = cols[y].upper_bound(x);
        while (it != cols[y].end()) {
            int i = *it;
            if (abs(x - i) > k || a[i][y] != '.') {
                break;
            }
            add(i, y, d + 1);
            it = cols[y].upper_bound(x);
        }
    };
    auto goLeft = [&](int x, int y, int d) {
        auto it = rows[x].upper_bound(y);
        while (it != rows[x].begin()) {
            it--;
            int j = *it;
            if (abs(y - j) > k || a[x][j] != '.') {
                break;
            }
            add(x, j, d + 1);
            it = rows[x].upper_bound(y);
        }
    };
    auto goRight = [&](int x, int y, int d) {
        auto it = rows[x].upper_bound(y);
        while (it != rows[x].end()) {
            int j = *it;
            if (abs(y - j) > k || a[x][j] != '.') {
                break;
            }
            add(x, j, d + 1);
            it = rows[x].upper_bound(y);
        }
    };
    add(x1, y1, 0);
    while (!qx.empty()) {
        int x = qx.front(); qx.pop();
        int y = qy.front(); qy.pop();
        int d = qd.front(); qd.pop();
        goUp(x, y, d);
        goDown(x, y, d);
        goLeft(x, y, d);
        goRight(x, y, d);
    }
    cout << "-1\n";
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int mi = 0, cu = 0;
  rep(i, n) {
    if (s[i] == ')') cu--, amin(mi, cu);
    if (s[i] == '(') cu++;
  }
  rep(i, -mi) cout << '(';
  cout << s;
  rep(i, cu - mi) cout << ')';
  cout << '\n';
}


Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let k: usize = iterator.next().unwrap().parse().unwrap();

    let mut ans: usize = 0;
    for b in 1..=n {
        if b <= k {
            continue;
        }
        let mut now = (b - k) * (n / b);
        if k == 0 {
            now += n % b
        } else if n % b > k - 1 {
            now += n % b - (k - 1)
        }
        ans += now;
    }
    ans.to_string()
}


Measured memory_bytes: 2116
#include<bits/stdc++.h>
using namespace std;
int main(){
  long n,d;cin>>n>>d;
  int count=0;
  for(int i=0;i<n;i++){
    long tx,ty;
    cin>>tx>>ty;
    if((tx*tx+ty*ty)<=(d*d)){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384
 
std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}
 
int main() {
	string s;
	cin>>s;
	s[3]='8';
	cout<<s;
}

Measured memory_bytes: 256
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

vector<string> v;
map<string, int> mp;

int
main(void){  
  ios_base::sync_with_stdio(false);

  int k;
  string s;
  cin >> s >> k;

  REP(i, s.size()) {
    //cout << "i:" << i << endl;
    string stmp = "";    
    FOR(j, i, i+k){
      if(j == s.size()) break;
      stmp += s[j];
      if(mp[stmp] != 0) continue;
      v.push_back(stmp);
      mp[stmp]++;
      //cout << "stmp:" << stmp << endl;
    }
  }

  sort(v.begin(), v.end());

  /*
  for(auto itr = v.begin(); itr != v.end(); ++itr){
    cout << *itr << endl;
  }
  */

  cout << v[k-1] << endl;
  
  return 0;
}


Measured memory_bytes: 2048
//author rhythmicankur
                                                                  //god_is_almighty
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#define f 		first
#define s 		second
#define int     long long
#define ll      int
#define ld 		long double
#define pb 		push_back
#define eb 		emplace_back
#define mk 		make_pair
#define vi 		vector<int>
#define pii 		pair<int,int>
#define pip             pair<int,pii>
#define vpi 		vector<pii>
#define sbcount(x) __builtin_popcountll(x)
#define REP(i,n) for (int i = 1; i <= n; i++)
#define trav(a, x)      for(auto& a : x)
#define all(x)          x.begin(), x.end()
#define fill(a,val)	memset(a,val,sizeof(a))
#define 	PI acos(-1)
#define coud(a,b) cout<<fixed << setprecision((b)) << (a) <<endl
#define M1 	998244353
#define M2 	1000000007
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); } 
#define test4(x,y,z,a) 		    cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<"  |  "<<#a<<": "<<a<<endl;
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
ll power(ll a,ll b,ll m=M2){ll answer=1;while(b){if(b&1)answer=(answer*a)%m;b/=2;a=(a*a)%m;}return answer;}
using namespace std;
void ctrl(){cout<<"Control"<<endl;}
int make_num(string p){stringstream geek(p); int x = 0; geek >> x;return x;}
string make_str(int x){ostringstream str1; str1 << x; string geek = str1.str(); return geek;}
int A,B;


signed main()
{	ios::sync_with_stdio(0);
	cin.tie(0); 
	cin.exceptions(cin.failbit);
	
    int n;
    cin>>n;
    int s=0;
    int cnt = 3982;
    unordered_map<int,int>mp;
    
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        s+=mp[i-x];
        mp[i+x]++;
    }
    cout<<s;

return 0;
}

Measured memory_bytes: 18488
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
s = [input() for i in range(n)]
m = inp()
t = [input() for i in range(m)]
ds = defaultdict(int)
dt = defaultdict(int)
for i in s:
    ds[i] += 1
for i in t:
    dt[i] += 1
res = 0
for key in ds.keys():
    res = max(res, ds[key] - dt[key])
print(res)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
long long gcd(long x,long y){
    if(y==0)return x;

    return gcd(y,x%y);
}
long long lcm(long x,long y){
    return x*y/gcd(x,y);
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main()
{
    int N,C,K,T[100010]={},ans=0,pcnt=0,et=0;

    cin>>N>>C>>K;

    for(int i=0;i<N;i++){
        cin>>T[i];
    }

    sort(T,T+N);

    for(int i=0;i<N;i++){
        if(et==0||pcnt==C||T[i]>et){
            et=T[i]+K;
            pcnt=1;
            ans++;
        }else{
            pcnt++;
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
using namespace std;
int main() {
    int N; scanf("%d\n", &N);
    char S; int x = 0, max = 0;
    for(int i = 0; i < N; i++) {
        scanf("%c", &S);
        if(S == 'I') ++x;
        else if(S == 'D') --x;
        if(max < x) max = x;
    }
    printf("%d\n", max);
}

Measured memory_bytes: 128
n, m = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
fl = []

for i in range(len(l)-1):
  fl.append(l[i+1]-l[i])

fl.sort()

total = 0
for j in range(len(fl)-n+1):
  total+=fl[j]

print(total)

Measured memory_bytes: 13968
#include <bits/stdc++.h>
using namespace std;
const int N=2*10000+5;
const int maxn=0x3f3f3f3f;
int dp[N];

int main()
{
    int h,n,x,y,i,j;
	cin>>h>>n;
    memset(dp,maxn,sizeof(dp));
    dp[0]=0;
    
    for(i=0;i<n;i++){
        cin>>x>>y;
        for(j=0;j+x<N;j++)
        dp[j+x]=min(dp[j+x],dp[j]+y);
    }
    
    int minv=maxn;
    for(i=h;i<N;i++)
    if(minv>dp[i])
    minv=dp[i];
   
    cout<<minv;
    return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 00:38:52 2020

@author: Kanaru Sato
"""

n = int(input())
p = list(map(int,input().split()))

yesflag = 1
a = [p[i] for i in range(n)]
for k in range(n-1):
    if a[k] > a[k+1]:
        yesflag = 0
        break

if yesflag == 0:
    for i in range(n-1):
        for j in range(i+1,n):
            a = [p[i] for i in range(n)]
            tmp = a[i]
            a[i] = a[j]
            a[j] = tmp
            yesflag = 1
            for k in range(n-1):
                if a[k] > a[k+1]:
                    yesflag = 0
                    break
            if yesflag == 1:
                break
        if yesflag == 1:
            break

if yesflag == 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064