akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int INF = 1e9;

long long S;

int main() {
	read(S);
	print(0, ' '), print(0, ' ');
	print(INF, ' '), print(1, ' ');
	print(((S - 1) / INF + 1) * INF - S, ' '), print((S - 1) / INF + 1);
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////

ll d(ll n) {
	if (n < 10) { return 1; }
	return d(n / 10) + 1;
}

ll keta(ll n, ll k) {
	if (k == 1) { return n % 10; }
	else { return keta(n / 10, k - 1); }
}

ll p(ll n) {
	if (n == 0) { return 1; }
	return p(n-1) * 10;
}


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

	ll ans = 1;
	ll c = 0;

	while (c < X) {
		ll b = 1;
		for(ll i=d(ans)-1; i>=1; i--) {
			if (abs(keta(ans, i) - keta(ans, i + 1)) > 1) {
				b = 0;
				ans += p(i-1);
				break;
			}
		}

		//cout << ans << c << b << endl;

		if (b == 1) {
			c++;
			if (c == X) { break; }
			ans++;
		}
	}

	cout << ans;


	system("PAUSE");
}


Measured memory_bytes: 504
#include <stdio.h>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <map>
#include <string.h>
#define inf 0x7fffffff
using namespace std;
//1232
int a,b,c,n,m,l[100110][30],o[100010],k,i,d,dx[10]={0,1,-1,0,0,-1,-1,1,1},dy[10]={0,0,0,-1,1,1,-1,1,-1};
long long x,y,z[100010];
stack<int> s;
struct P
{
    int x;
    int y;
    bool operator<(const P &a)const
    {
        return y>a.y;
    }
};
 map<int, int> p;
queue<int> q;
priority_queue<int> q1;
string r;
vector<int> v[200010];

bool sdf(P a,P b){return a.y<b.y;}




int main()
{
    scanf("%lld",&y);
    for(int t=1;t<=y;x+=z[t],t++)
        scanf("%lld",&z[t]);
    if(x%((y*y+y)/2)>0)
    {
        puts("NO");
        return 0;
    }
    x=(x/((y*y+y)/2));
    o[1]=z[1]-z[y];
    for(int t=2;t<=y;t++)
        o[t]=z[t]-z[t-1];
    long long h=0;
    /*for(int t=1;t<=y;t++)
        h+=(x-o[t]);
    if(h==x*y)
        puts("YES");
    else puts("NO");
    */
    for(int t=1;t<=y;t++)
    {
        long long j;
        if(x-o[t]<0||(x-o[t])%y!=0)
        {
            puts("NO");
            return 0;
        }
        h+=(x-o[t])/y;
        //printf("%d ",h);
    }
    if(h==x)
        puts("YES");
    else puts("NO");
    return 0;
}

Measured memory_bytes: 6272
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#define ll long long
#define fr(j,p) for (int i=j; i<p ;i++)
#define fastScan ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define inar(x,n) fr(0,n) scanf("%d",&x[i])
const long long md=998244353;
using namespace std;

int modu(int x)
{
    if (x<0)return x*(-1);
    return x;
}
int main()
{
    int n;
    cin>>n;
    int arr[n];
    inar(arr,n);
    int cost[n];
    cost[0]=0;
    cost[1]=modu(arr[1]-arr[0]);
    fr(2,n)
    {
        cost[i]=min(cost[i-1]+modu(arr[i]-arr[i-1]),cost[i-2]+modu(arr[i]-arr[i-2]));
    }
    cout<<cost[n-1];

    return 0;
}


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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

void solve(){

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

    vector<ll> sum(N);
    sum[0] = a[0];
    for (int i = 1; i < N; i++){
        sum[i] = sum[i-1] + a[i];
    }

    ll ans = LLONG_MAX;
    for (int i = 0; i < N-1; i++){
        ll x = sum[i];
        ll y = sum[N-1] - sum[i];
        ans = min(ans,abs(x-y));
    }
    cout << ans << endl;









    return 0;
}


Measured memory_bytes: 2560
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# いっこ入力
n =int(input())
p = 10**9+7 

a=[[[[0]*4]*4]*4]*101
a=[[[[0 for i in range(4)] for j in range(4)] for j in range(4)] for j in range(101)]
a[3][0][0][0]= 1
a[3][0][0][1]= 1
a[3][0][0][2]= 1
a[3][0][0][3]= 1
a[3][0][1][0]= 1
a[3][0][1][1]= 1
a[3][0][1][2]= 0
a[3][0][1][3]= 1
a[3][0][2][0]= 1
a[3][0][2][1]= 0
a[3][0][2][2]= 1
a[3][0][2][3]= 1
a[3][0][3][0]= 1
a[3][0][3][1]= 1
a[3][0][3][2]= 1
a[3][0][3][3]= 1
 
a[3][1][0][0]= 1
a[3][1][0][1]= 1
a[3][1][0][2]= 1
a[3][1][0][3]= 1
a[3][1][1][0]= 1
a[3][1][1][1]= 1
a[3][1][1][2]= 1
a[3][1][1][3]= 1
a[3][1][2][0]= 1
a[3][1][2][1]= 1
a[3][1][2][2]= 1
a[3][1][2][3]= 1
a[3][1][3][0]= 1
a[3][1][3][1]= 1
a[3][1][3][2]= 1
a[3][1][3][3]= 1
 
a[3][2][0][0]= 1
a[3][2][0][1]= 0
a[3][2][0][2]= 1
a[3][2][0][3]= 1
a[3][2][1][0]= 1
a[3][2][1][1]= 1
a[3][2][1][2]= 1
a[3][2][1][3]= 1
a[3][2][2][0]= 1
a[3][2][2][1]= 1
a[3][2][2][2]= 1
a[3][2][2][3]= 1
a[3][2][3][0]= 1
a[3][2][3][1]= 1
a[3][2][3][2]= 1
a[3][2][3][3]= 1
 
a[3][3][0][0]= 1
a[3][3][0][1]= 1
a[3][3][0][2]= 1
a[3][3][0][3]= 1
a[3][3][1][0]= 1
a[3][3][1][1]= 1
a[3][3][1][2]= 1
a[3][3][1][3]= 1
a[3][3][2][0]= 1
a[3][3][2][1]= 1
a[3][3][2][2]= 1
a[3][3][2][3]= 1
a[3][3][3][0]= 1
a[3][3][3][1]= 1
a[3][3][3][2]= 1
a[3][3][3][3]= 1
 

for i in range(4,n+1):
    for s in range(4):
        for t in range(4):
            for u in range(4):
                if (s==0 and t==2 and u==1) or (s==2 and t==0 and u ==1) or (s==0 and t==1 and u ==2):
                    a[i][s][t][u]=0
                elif (s==2 and t==3 and u==1) or (s==2 and t==2 and u ==1) or (s==3 and t==2 and u ==1):
                    a[i][s][t][u] = a[i-1][1][s][t] + a[i-1][2][s][t] + a[i-1][3][s][t]
                else:
                    a[i][s][t][u] = a[i-1][0][s][t] + a[i-1][1][s][t] + a[i-1][2][s][t] + a[i-1][3][s][t]
#                print(a[i][s][t][u])

answer =0
for s in range(4):
    for t in range(4):
        for u in range(4):
            answer += a[n][s][t][u]

print(answer % p)
# print(a)


Measured memory_bytes: 12524
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var array = Console.ReadLine().Split();
            int n = int.Parse(array[0]);
            long m = long.Parse(array[1]);

            List<long> divisors = new List<long>();
            for (long i = 1; i * i <= m; i++)
            {
                if (m % i == 0)
                {
                    divisors.Add(i);
                    divisors.Add(m / i);
                }
            }

            long ans = divisors.Where(d => d * n <= m).Max();
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
     int n,k;
     cin>>n>>k;
     int sum=0;
     for(int i=1;i<=n;i++)
     {
         int a;
         cin>>a;
         sum+=min(a-0,k-a)*2;
     }
     cout<<sum<<endl;
}


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

#define int long long

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

/*
#define cin ifs
#define cout ofs
ifstream ifs("in.txt");
ofstream ofs("out.txt");
//*/

typedef pair<int, int> P;
pair<int, int> a[99000];
int d[99000];
int ans[100000];

signed main() {
    int H, W, D;
    cin >> H >> W >> D;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            int A;
            cin >> A;
            a[A] = P(i, j);
        }
    }
    for (int i = 1; i <= D; i++) {
        d[i] = 0;
        for (int j = i; j <= H * W; j += D) {
            d[j] = d[j - D] + abs(a[j].first - a[j - D].first) +
                   abs(a[j].second - a[j - D].second);
        }
    }
    int Q;
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        int L, R;
        cin >> L >> R;
        ans[i] = d[R] - d[L];
    }
    for (int i = 0; i < Q; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

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

int ans, len;
string s, t[5] = {"dream", "dreamer", "erase", "eraser"};

int main() {
    cin >> s;
    len = s.length();
    while ( len > 0 ) {
        bool ok = false;
        for ( int i = 0; i < 4; i++ ) {
            bool b = true;
            if ( len < t[i].length() ) b = false;
            else for ( int j = 0; j < t[i].length(); j++ ) {
                if ( s[len - t[i].length() + j] != t[i][j] ) {
                    b = false;
                }
            }
            if ( !b ) continue;
            len -= t[i].length();
            ok = true;
            break;
        }
        if ( !ok ) {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    return 0;
}


Measured memory_bytes: 3744
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	count := 0
	for _, cnt := range PrimeFactorize(n) {
		for i := 1; i <= cnt; i++ {
			count++
			cnt -= i
		}
	}

	fmt.Println(count)
}

// generated by https://github.com/murosan/gollect

func PrimeFactorize(n int) map[int]int {
	m := make(map[int]int)
	for n%2 == 0 {
		m[2]++
		n /= 2
	}
	for i := 3; i*i <= n; i += 2 {
		for n%i == 0 {
			m[i]++
			n /= i
		}
	}
	if n != 1 {
		m[n]++
	}
	return m
}


Measured memory_bytes: 1820
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (ll i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << (x) << endl
#define int long long
using namespace std;
using II = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
template <class T = int> inline T in() { T x; cin >> x; return x; }
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { int n = d.size(); REP (i, n) s << d[i] << " "; return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& dd) { for (vector<T> d: dd) s << d << endl; return s; }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
const int MOD = 1e9 + 7;
class Grid {
  // queryを計算しやすいようにaccの範囲外の値も便宜的に定義
  int acc_any(int i, int j) {
    if (i + j < 0 || H + W - 1 <= i + j) return 0;
    if (i < 0 || j >= W) return 0;
    if (j < 0 && i + j < H) return acc[i + j][0];
    if (i >= H && i + j >= H) return acc[H - 1][i + j - (H - 1)];
    return acc[i][j];
  }
public:
  VVI t; int H, W;
  VVI acc;
  Grid(VVI tbl) : t(tbl), H(tbl.size()), W(tbl[0].size()) {
    set_acc();
  }
  VI& operator[](int i) {
    return t[i];
  }
  bool exist(int i, int j) {
    return 0 <= i && i < H && 0 <= j && j < W && t[i][j];
  }
  // 左下方向への累積和
  void set_acc() {
    acc = VVI(H, VI(W));
    REP (i, H) {
      REP (j, W) {
        int before = (i == 0 || j == W - 1) ? 0 : acc[i - 1][j + 1];
        acc[i][j] = before + t[i][j];
      }
    }
  }
  // 時計回りに90度回転
  void rotate() {
    VVI t2(W, VI(H));
    REP (i, H) {
      REP (j, W) {
        t2[j][H - i - 1] = t[i][j];
      }
    }
    t = t2;
    swap(H, W);
    set_acc();
  }
  // [i0, i1)の斜めのsum
  int query(int i0, int j0, int i1, int j1) {
    assert(i0 + j0 == i1 + j1);
    assert(i1 > i0);
    return acc_any(i1 - 1, j1 + 1) - acc_any(i0 - 1, j0 + 1);
  }
};

signed main() {
  int H, W; cin >> H >> W;
  VVI t(H, VI(W));
  REP (i, H) {
    REP (j, W) {
      t[i][j] = in<char>() == '#';
    }
  }
  Grid g(t);
  int ans = 0;
  int times = 4;
  while (times--) {
    REP (i, g.H) {
      REP (j, g.W) {
        if (!g.exist(i, j)) continue;
        REPI (k, 1, g.H + g.W - 1) {
          if (!g.exist(i + k, j - k)) continue;
          ans += g.query(i + k, j + k, i + 2 * k, j);
        }
      }
    }
    g.rotate();
  }
  cout << ans << endl;
}


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

main() {
  string S; cin >> S;
  bool ok[26];
  memset(ok, false, sizeof(ok));
  for (int i = 0; i < S.length(); i++) {
    ok[S[i] - 'a'] = true;
  }
  for (int i = 0; i <= 26; i++) {
    if (i == 26) {
      cout << "None" << endl;
    } else if (!ok[i]) {
      cout << (char)('a' + i) << endl;
      break;
    }
  }
}


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

int main()
{
  int64_t H, W, D, Q, a, l, r;
  cin >> H >> W >> D;
  map<int, pair<int, int>> mp;
  vector<vector<int64_t>> A(H + 1, vector<int64_t>(W + 1));
  for (int i = 1; i <= H; i++)
  {
    for (int j = 1; j <= W; j++)
    {
      cin >> a;
      mp[a] = make_pair(i, j);
      A.at(i).at(j) = a;
    }
  }
  cin >> Q;
  vector<pair<int64_t, int64_t>> lr(Q);
  for (int i = 0; i < Q; i++)
  {
    cin >> l >> r;
    lr.at(i) = make_pair(l, r);
  }
  vector<int64_t> dp(H * W + 1, -1);
  for (int i = 1; i <= H * W; i++)
  {
    if (i - D <= 0)
    {
      dp[i] = 0;
      continue;
    }
    int x = abs(mp.at(i - D).first - mp.at(i).first) + abs(mp.at(i - D).second - mp.at(i).second);
    dp[i] = dp[i - D] + x;
  }
  for (int i = 0; i < Q; i++)
  {
    tie(l, r) = lr.at(i);
    cout << dp[r] - dp[l] << endl;
  }
}


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

queue<int> q;
std::vector<int> ch;

std::vector<int> ans;
std::vector<std::vector<int> > ab;


int main(){
  int n,m;
  std::cin >> n>>m;
  ab.assign(n,std::vector<int>());
  ch.assign(n,-1);
  ans.assign(n,-1);

  rep(i,m){
    int a,b;
    std::cin >> a>>b;
    a--;b--;
    ab[a].push_back(b);
    ab[b].push_back(a);
  }


    q.push(0);
    ch.assign(n,-1);
    ch[0]=0;

    //0から広さ優先探索
    while (!q.empty()) {
      int v=q.front();q.pop();
      for (int nv : ab[v]) {
        if(ch[nv]!=-1)continue;
        ch[nv]=ch[v]+1;
        q.push(nv);
      }
    }

    for (int i = 1; i < n; i++) {
      int cost=ch[i];
      for (int v: ab[i]) {
        if(ch[v]+1==cost){
          ans[i]=v;
          break;
        }
      }
    }

  for (int i = 1; i < n; i++){
    if(ans[i]==-1){
      std::cout << "-1" << '\n';
      return 0;
    }
  }

  std::cout << "Yes" << '\n';
  for (int i = 1; i < n; i++) {
    std::cout << ans[i]+1 << '\n';
  }





  return 0;
}


Measured memory_bytes: 10464
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x;
	cin>>x;
	long long a[41];
	a[0]=2;
	for(int i=1;i<=x;i++)
		a[i]=a[i-1]*2+2;
	cout<<a[x];
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

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

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(), a.end());
    // 最大公約数を求め続ければOK
    int64_t res = a.at(0);
    rep(i,n-1){
        res = gcd(a.at(i+1), res);
        if(res==1) break;
    }
    cout << res << endl;
    
}


Measured memory_bytes: 1024
import java.util.*;
import java.util.stream.*;

public class Main {
	Scanner sc;
	int N;
	
//=============
// constructor
//
	public Main() {
		sc = new Scanner(System.in);
	}
	
//==================
// instance methods
//
	/**
	 * アルゴリズム本体
	 */
	private void calc() {
		N = sc.nextInt();
		
		int count = 0;
		for (int i = 1; i <= N; i++) {
			int digits = 1 + (int)Math.log10(i);
			if (digits % 2 == 1) count++;
		}
		out(count);
	}
	
	private void out(Object o) {
		System.out.println(o);
		System.out.flush();
	}
	
//======
// main
//
	public static void main(String[] args) {
		Main m = new Main();
		m.calc();
	}

}

Measured memory_bytes: 23252
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

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

    string ans;
    if (s.size() > k)
    {
        ans = s.substr(0, k) + "...";
    }
    else
    {
        ans = s;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>

using namespace std;

int main() {
	vector<int> a(3, 0);
	for (int i = 0; i < 3; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
}
	


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

int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    bool u=false,d=false;
    int ans=0;
    rep(i,n-1){
        if(!u&!d){
            if(a[i]<a[i+1])u=true;
            else if(a[i]>a[i+1])d=true;
        }
        else if(u){
            if(a[i]>a[i+1])ans++,u=false;
        }
        else if(d){
            if(a[i]<a[i+1])ans++,d=false;
        }
    }
    cout<<ans+1<<endl;
    return 0;
}

Measured memory_bytes: 3720
//#pragma optimization_level 3
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordset;
*/

#define fr first
#define sc second
#define vec vector
#define pb push_back
#define pii pair<int, int>
#define fo(x,y) for(int x = 1 ; x <= y ; ++x)
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;

typedef long long ll;
typedef unsigned int uint;
const int nmax = 200005;
const ll linf = LLONG_MAX;
const int mod = 1e9+7;
const int inf = INT_MAX;

ll n;

ll f(ll x){
    if(x == 1)return 1;
    return 1 + 2*f(x/2);
}

int main(){
    cin >> n;
    cout << f(n) << '\n';
}


Measured memory_bytes: 256
//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vint vector<int>
#define sint set<int>
#define mint map<int,int>
#define pint pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define precision(x) cout<<fixed<<setprecision(x);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void solve(){
	string s;
	rd(s);
	cout<<s;
	if(s[s.size()-1]=='s')cout<<"es";
	else cout<<"s";	
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


Measured memory_bytes: 3652
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
 

int main() {
	// 入力
	ll N[4];
	for (ll i = 0; i < 4; ++i) cin >> N[i];
 
	// 解法	
	sort(N, N+4);
	if (N[0]==1 & N[1]==4 & N[2]==7 & N[3]==9) cout << "YES" <<endl;
	else cout << "NO" <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main(void){

  int i,x[5],k,max=0,min=200;
  for(i=0;i<5;i++){
  scanf("%d",&x[i]);
   if(max<=x[i]){
    max=x[i];
   }
   if(min>=x[i]){
     min=x[i];
   }
  }
  scanf("%d",&k);
  if(abs(max-min)<=k)
   printf("Yay!");
  else
   printf(":(");
}

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

using namespace std;

const int MAX_N = 260;
int n;
string grid[MAX_N];
int max_len;
int memo[MAX_N][MAX_N][4];

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

int rec(int y, int x, int d)
{
    if (memo[y][x][d] >= 0)
        return memo[y][x][d];

    int nx = x + dx[d];
    int ny = y + dy[d];

    if (nx < 0 || nx >= n || ny < 0 || ny >= n)
        return 1;
    if (grid[ny][nx] == '0')
        return 1;

    return memo[y][x][d] = (rec(ny, nx, d) + 1);
}

int main()
{
    while (cin >> n, n) {
        max_len = 0;
        for (int i = 0; i < n; i++) {
            cin >> grid[i];
            for (int j = 0; j < n; j++)
                for (int k = 0; k < 4; k++)
                    memo[i][j][k] = -1;
        }

        for (int y = 0; y < n; y++) 
            for (int x = 0; x < n; x++) 
                if (grid[y][x] == '1') {
                    for (int k = 0; k < 4; k++) {
                        int nx = max_len * dx[k] + x;
                        int ny = max_len * dy[k] + y;
                        if (nx < 0 || nx >= n || ny < 0 || ny >= n)
                            continue;
                        if (grid[ny][nx] != '1')
                            continue;
                        max_len = max(max_len, rec(y, x, k));
                    }
                }

        cout << max_len << endl;
    }

    return 0;
}

Measured memory_bytes: 2352
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

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

    int k, n;
    cin >> n >> k;

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

    sort(a, a + n);

    int sum = 0;
    rep(i, k) sum += a[i];

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3660
N, W = map(int, input().split())
vw = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(N):
  for j in range(W+1):
    if j - vw[i][1] >= 0:
      dp[i+1][j] = max(dp[i+1][j-vw[i][1]]+vw[i][0], dp[i][j])
    else:
      dp[i+1][j] = dp[i][j]

print(dp[N][W])


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EPS (1e-8)

typedef complex<double> P;

vector<P> intersection(P a, P b) {
	vector<P> res;
	
	if (abs(abs(b - a) - 2.0) < EPS) {
		//????????\????????????
		P c = a + b;
		res.push_back(P(c.real() / 2.0, c.imag() / 2.0));
	}
	else if (abs(b - a) < 2.0) {
		//??????????????£?????????
		P ab = b - a;
		P nv1 = (ab * P(0, +1)) / abs(ab); //ab????¨??????????????????????????????????
		P nv2 = (ab * P(0, -1)) / abs(ab); //??????????????????????????????
		P c = a + P(ab.real() / 2.0, ab.imag() / 2.0); //ab???????????????????????????
		double d = sqrt(1 - pow(abs(ab) / 2.0, 2)); //????????¨ab???????????¨????????¢
		
		res.push_back(c + nv1 * d);
		res.push_back(c + nv2 * d);
	}
	
	return res;
}

int main() {
	while (true) {
		int n;
		cin >> n;
		if (!n) break;
		
		P p[100];
		REP(i, n) {
			double a, b;
			scanf("%lf,%lf", &a, &b);
			p[i] = P(a, b);
		}
		
		int ans = 1;
		REP(i, n) {
			FOR(j, i + 1, n) {
				vector<P> v = intersection(p[i], p[j]);
				if (v.empty()) continue;
				
				int cnt1 = 2, cnt2 = 2;
				REP(k, n) if (i != k && j != k) {
					if (abs(v[0] - p[k]) - 1.0 < EPS) cnt1++;
					if (v.size() == 2 && abs(v[1] - p[k]) - 1.0 < EPS) cnt2++;
				}
				
				ans = max(ans, max(cnt1, cnt2));
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1296
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main () {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

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

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

Measured memory_bytes: 256
n,m,c=(map(int,input().split()))
b=list(map(int,input().split()))
a=[]
e=0
f=0
g=0
for i in range(n):
    d=list(map(int,input().split()))
    for u in range(m):
        e+=b[u]*d[u]
        f+=1
        if f == m:
            e+=c
            a.append(e)
            e=0
            f=0
for q in a:
    if q > 0:
        g+=1
print(g)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  int n; cin>>n;
  vll a(n+1),b(n); rep(i,n+1) cin>>a[i]; rep(i,n) cin>>b[i];
  ll ans=0;
  rep(i,n){
    if(a[i]>b[i]){
      //a[i]-=b[i];
      ans+=b[i];
    }else if(a[i]+a[i+1]>b[i]){
      ans+=b[i];
      a[i+1]-=(b[i]-a[i]);
    }else{
      ans+=(a[i]+a[i+1]);
      a[i+1]=0;
    }
  }
  cout<<ans<<endl;
}


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

int main() {
  int N;
  cin >> N;
  bool f = true;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    if (A % 2 == 1) f = false;
  }
  cout << (f ? "second" : "first") << endl;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    int ans = 1;
    while(ans*2 <= N) ans *= 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a = str(input())
if a[0] == a[-1]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <typeinfo>
#include <vector>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int gcd(int a, int b)
{
  int r;
  do{
    r = a % b;
    a = b;
    b = r;
  } while (r > 0);
  return a;
}

int main()
{
  int n, X;
  cin >> n >> X;
  vi x(n);
  for (int &i : x)
  {
    cin >> i;
  }
  x.push_back(X);
  sort(x.begin(), x.end());
  vi d(n);
  rep(i, n)
  {
    d.at(i) = x.at(i + 1) - x.at(0);
  }
  int ans = d.at(0);
  rep(i, n)
  {
    ans = gcd(ans, d.at(i));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#define N 100
int G[N + 1][N + 1];
int main()
{
    int i, j;
    int n, k, v, u;
    //int G[N+1][N+1];

    scanf("%d", &n);
    G[0][0] = 0;
    for (i = 1; i <= n; i++)
    {
        scanf("%d%d", &u, &k);
        for (j = 1; j <= k; j++)
        {
            scanf("%d", &v);
            G[i][v] = 1;
        }
    }

    for (i = 1; i <= n; i++)
    {
        for (j = 1; j <= n; j++)
        {
            printf("%d", G[i][j]);
            if (j != n)
                printf(" ");
        }
        printf("\n");
    }

    return 0;
}



Measured memory_bytes: 2108
n = 0
while True:
    a = input().split()
    if a[1] == "?":
        break
    else:
        if a[1] == "+":
            n = int(a[0]) + int(a[2])
        elif a[1] == "-":
            n = int(a[0]) - int(a[2])
        elif a[1] == "*":
            n = int(a[0]) * int(a[2])
        elif a[1] == "/":
            n = int(a[0]) / int(a[2])
    print(int(n))



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

int main() {
    vector<int> v(2);
    rep(i,2) {
        cin >> v.at(i);
    }
    sort(v.begin(),v.end());
    int a = v[0];
    int b = v[1];
    rep(i,b) {
        cout << a;
    }
}

Measured memory_bytes: 256
S = input()
ans = -1
for i in range(ord('a'), ord('z') + 1):
    if chr(i) in S:
        continue
    else:
        ans = S + chr(i)
        print(ans)
        exit()
R = set()
for i, s in enumerate(S[::-1], 1):
    for j in range(ord(s)+1, ord('z')+1):
        if chr(j) in R:
            ans = S[:-i] + chr(j)
            print(ans)
            exit()
    R.add(s)
print(ans)



Measured memory_bytes: 61772
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}
pair<ll, ll> f(ll x) {
  string s = to_string(x);
  return make_pair(*s.begin()-'0', *(s.end()-1)-'0');
}

ll g(ll x) {
  return to_string(x).size();
}

void solve(long long N){
  ll ans = 0;
  string s = to_string(N);
  string ss ="";
  for(ll i=1; i+1<s.size(); i++) {
    ss+=s[i];
  }
  ll ls;
  if(ss == "")
    ls = 0;
  else
    ls = stoll(ss);

  ll v[] = {0, 0, 0, 0, 10, 110, 1110};
  for(ll i=1; i<=N; i++) {
    //std::cout << i<<", "<<ans << std::endl;
    ll now = 0;
    ll x = f(i).second;
    ll y = f(i).first;
    //std::cout << x << y << std::endl;
    if(x==0) continue;
    if(x==y and x<=N) ans += 1;
    if(x*10+y > N) continue;
    ans += 1;
    if(s.size()<3) continue;
    ans+=v[s.size()];
    if (*s.begin()-'0'<x) continue;
    if (*s.begin()-'0'>x) {
      ans+=pow(10, s.size()-2);
    } else {
      if(y>*(s.end()-1)-'0') ans+=ls;
      else {
	ans+=ls+1;
      }
    }
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  solve(N);
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<string>

using namespace std;

int main(){
    int N;
    string s;
    map<string, int> dict = {};
    int max_n = 0;

    cin >> N;
    
    for(int i=0;i<N;++i){
        cin >> s;
        if(dict.count(s)!=0){
            ++dict.at(s); 
        }else{
            dict[s] = 1; 
        }
        
        if( dict.at(s) > max_n ){
            max_n = dict.at(s);
        }
    }

    for( auto& e: dict){
        if( e.second == max_n ){
            cout << e.first << endl;
        }
    }
    
    return 0;
   
}


Measured memory_bytes: 25216
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s.at(i) == '9') s.at(i) = '1'; else s.at(i) = '9';
	}
	cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;
 
struct ST {
  ll x;
  ST():x(0){}
  ST(int x):x(x){}
};
ST combine(const ST& lhs, const ST& rhs){
  ST st;
  st.x = lhs.x + rhs.x;
  return st;
}
template<class S>
class SegmentTree {
  int N;
  vector<S> t;
  void build(){
    for(int i=N-1; i>0; i--){
      t[i] = combine(t[i<<1], t[i<<1|1]);
    }
  }
public:
  SegmentTree(int n_ = 500005){
    N = 1;
    while(N < n_) N *= 2;
    t.resize(2*N);
    for(int i=N; i<2*N; i++){
      t[i] = S();
    }
    build();
  }
  SegmentTree(const vector<S>& v){
    N = 1;
    while(N < v.size()) N *= 2;
    t.resize(2*N);
    for(int i=0; i<v.size(); i++){
      t[i+N] = v[i];
    }
    build();
  }
  void modify(int p, S val){
    for(t[p+=N] = val; p>>=1;){
      t[p] = combine(t[p<<1], t[p<<1|1]);
    }
  }
  S query(int l, int r){
    S resl, resr;
    for(l+=N, r+=N; l<r; l>>=1, r>>=1){
      if(l&1) resl = combine(resl, t[l++]);
      if(r&1) resr = combine(t[--r], resr);
    }
    return combine(resl, resr);
  }
};
 
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
 
  SegmentTree<ST> seg[30];
  rep(i,S.size()){
    seg[S[i]-'a'].modify(i, (ST){1});
  }
  
  int Q;
  cin >> Q;
  rep(i,Q){
    int t;
    cin >> t;
 
    if(t == 1){
      int a;
      string c;
      cin >> a >> c;
      a--;
      if(S[a] != c[0]){
        seg[S[a]-'a'].modify(a, (ST){0});
        seg[c[0]-'a'].modify(a, (ST){1});
        S[a] = c[0];
      }
    }else{
      int a, b;
      cin >> a >> b;
      a--;
      b--;
      int cnt = 0;
      rep(j,30){
        if(seg[j].query(a,b+1).x != 0) cnt++;
      }
      cout << cnt << endl;
    }
  }
 
  return 0;
}


Measured memory_bytes: 246788
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	int n; cin >> n;
	int a[n], score[n+10];
	forn(i,0,n) cin >> a[i];
	sort(a,a+n,greater<>());
	memset(score,0,sizeof(score));
	score[1] = a[0];
	int score_val_idx = 1;
	for(int i = 2; i < n; i+=2){
		score[i] = score[i+1] = a[score_val_idx];
		++score_val_idx;
	}
	ll ans = 0;
	forn(i,0,n) ans += score[i];
	debuga(score,n);
	cout << ans;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 



Measured memory_bytes: 5188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

int main(void){
    int n;
    cin >> n;
    // 全部 mod5 = k であるような素数ならok
    vector<int> primes;
    vector<bool> isP(55556);
    for(int i=0; i<=55555; i++){
        isP[i] = true;
    }
    isP[0] = false;
    isP[1] = false;

    for(int i=2; i<=55555; i++){
        if(isP[i] == true){
            for(int j=i; j<=55555; j+=i){
                isP[j] = false;
            }
            if(i % 5 == 4){
                primes.push_back(i);
            }
        }
    }

    for(int i=0; i<n; i++){
        cout << primes[i] << " ";
    }
    return 0;
}

Measured memory_bytes: 3652
/* ***********************************************
Author        :devil
************************************************ */
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <stdlib.h>
#define inf 0x3f3f3f3f
#define LL long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dec(i,a,b) for(int i=a;i>=b;i--)
#define ou(a) printf("%d\n",a)
#define pb push_back
#define mkp make_pair
template<class T>inline void rd(T &x){char c=getchar();x=0;while(!isdigit(c))c=getchar();while(isdigit(c)){x=x*10+c-'0';c=getchar();}}
#define IN freopen("in.txt","r",stdin);
#define OUT freopen("out.txt","w",stdout);
using namespace std;
const int mod=1e9+7;
const int N=2e3+10;
int n,x,a[N],mi[N][N];
LL ans;
int main()
{
    rd(n),rd(x);
    rep(i,1,n) rd(a[i]),ans+=a[i];
    rep(i,1,n) rep(j,i,n) mi[i][j]=(j==i)?a[i]:min(a[j],mi[i][j-1]);
    rep(l,1,n-1)
    {
        LL now=(LL)l*x;
        rep(i,1,n) now+=(i>l)?mi[i-l][i]:min(mi[1][i],mi[i+n-l][n]);
        ans=min(ans,now);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 14080
n = int(input())
a = list(input().split())
tmp = []
flag = 0
for i in range(n):
    if int(a[i]) % 2 == 0:
        tmp.append(a[i])
for j in range(len(tmp)):
    if int(tmp[j]) % 3 == 0 or int(tmp[j]) % 5 == 0:
        continue
    else:
        flag = 1
if flag == 1 : print("DENIED")  
else : print("APPROVED")

Measured memory_bytes: 8996
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int n ;
	cin >> n;  
	vi p(n);re(p);
	int cnt = 0 ;
	for(int i = 1 ;i+1 < n ; ++i){
		vi v = {p[i-1], p[i] ,p[i+1]};
		sort(all(v));
		cnt+=(v[1]==p[i]);
	}
	cout << cnt << endl;
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3652
X,Y=map(int,input().split())

A=(Y-2*X)/2
B=X-A

if (Y-2*X)%2==0:
    if A>=0 and B>=0 and A+B==X and 4*A+2*B==Y:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 9184
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;

int n,a[200010],d; 

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n>>d;
	int ans=0ll;
	for(int i=1;i<=n;i++) cin>>a[i],ans+=a[i];
	ans+=(n-1)*d;
	for(int i=2;i<=n;i++) a[i]=min(a[i],a[i-1]+d);
	for(int i=n-1;i>=1;i--) a[i]=min(a[i],a[i+1]+d);
	for(int i=2;i<=n-1;i++) ans+=a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5212