akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	ll ans[100010];
	for(ll i=0;i<n;i++){
		ans[i]=0;
		if(s[i]=='R'){
			if(i==n-1){
				continue;
			}
			else if(s[i+1]=='R'){
				ans[i]=1;
			}
		}
		else if(s[i]=='L'){
			if(i==0){
				continue;
			}
			else if(s[i-1]=='L'){
				ans[i]=1;
			}
		}
	}
	for(ll i=0;i<n-1;i++){
		if(k==0){
			break;
		}
		if(ans[i]==0&&ans[i+1]==0){
			ans[i]=1;
			ans[i+1]=1;
			k--;
		}
	}
	for(ll i=0;i<n;i++){
		if(k==0){
			break;
		}
		if(ans[i]==0){
			k--;
			ans[i]=1;
		}
	}
	ll sum=0;
	for(ll i=0;i<n;i++){
		sum+=ans[i];
	}
	cout <<min(sum,n-1);
	// your code goes here
	return 0;
}

Measured memory_bytes: 4512
#define _USE_MATH_DEFINES
 
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
 
#include <bits/stdc++.h> 
 
using namespace std;
 
#define len(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define vi vector<int> 
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<int, int>
#define beg begin
 
#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
template<class T> istream& operator>>(istream &str, vector<T> &a) {
	for (auto &i : a) {
		str >> i; 
	}
	return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    solve();    
}
 
const int INF = 1e18, MAXN = 3e5 + 10, MOD = 1e9 + 7;

void solve() {
	int a, b;
	cin >> a >> b;

	cout << max(0ll, a - 2 * b) << endl;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }

int main()
{
	vector<int>sums;
	vector<int>mis;
	vector<int>mas;
	vector<int>ns;
	while (true)
	{
		int n; cin >> n;
		if (n == 0)break;
		int tmp;
		int mi = 1000;
		int ma = 0;
		int sum = 0;
		rep(i, n)
		{
			cin >> tmp;
			chmin(mi, tmp);
			chmax(ma, tmp);
			sum += tmp;
		}
		mis.push_back(mi);
		mas.push_back(ma);
		sums.push_back(sum);
		ns.push_back(n);
	}
	rep(i, sz(sums))
	{
		int ans = (sums[i] - mis[i] - mas[i]) / (ns[i] - 2);
		co(ans);
	}
	return 0;
}



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <algorithm>
// #include <atcoder/all>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
#define REP(i, m, n) for (ll(i) = (ll)(m); i < (ll)(n); ++i)
#define REP2(i, m, n) for (ll(i) = (ll)(n)-1; i >= (ll)(m); --i)
#define rep(i, n) REP(i, 0, n)
#define rep2(i, n) REP2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define rall(hoge) (hoge).rbegin(), (hoge).rend()
#define en '\n'
using Edge = pair<ll, ll>;
using Graph = vector<vector<Edge>>;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
template <class T> inline void print(T x) { cout << x << '\n'; }
template <class T> bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) { return x / gcd(x,y)*y ;}
// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    string res = "";
    int m = n-2;
    res = s[0] + to_string(m) + s[n-1];
    print(res);

    return 0;
}


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

int main(void){
	int H,W,N,a,b,dx[9]={-1,-1,-1,0,0,0,1,1,1},dy[9]={-1,0,1,-1,0,1,-1,0,1};
	cin>>H>>W>>N;
	ll cnt[10]={(ll)(H-2)*(W-2)};
	map<pair<int,int>,int> mp;
	rep(i,N){
		cin>>a>>b;
		rep(j,9){
			if(a+dx[j]<=1 || a+dx[j]>=H || b+dy[j]<=1 || b+dy[j]>=W)continue;
			cnt[mp[{a+dx[j],b+dy[j]}]++]--;
			cnt[mp[{a+dx[j],b+dy[j]}]]++;
		}
	}
	rep(k,10)cout<<cnt[k]<<endl;
	return 0;
}


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

int main() {
  int N, D;
  cin >> N >> D;
  if(N%(2*D+1) == 0) {
    cout << N/(2*D+1) << endl;
  }
  else {
    cout << N/(2*D+1) + 1 << endl;
  }
}


Measured memory_bytes: 256
var lines = []; var result = Infinity;
var readline = require('readline');


var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var X = Number(lines[0].split(" ")[0]);
    var Y = Number(lines[0].split(" ")[1]);

    result = X + Y / 2;
    console.log(result);
});

Measured memory_bytes: 7500
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

const pair<int, int> END(0, 0);

int move_pos(int pos, int half, char dir) {
    if(pos < half and dir == 'R') return pos;
    if(pos >= half and dir == 'L') return pos - half;

    if(pos < half) return half - pos - 1;
    else return half - 1 - (pos - half);
}

string solve(int N, int A, int B) {
    // 最終状態 (自分の上・下に何枚ある？)
    pair<int, int> state(A - 1, (1LL << N) - A);

    int sub = (1LL << (N-1));
    vector<int> ops;
    while(state != END) {
        int p, q, r = -1; tie(p, q) = state;
        if(p - sub >= 0) {
            ops.push_back(0);
            r = 0;
            state = make_pair(p - sub, q);
        }
        else if(q - sub >= 0) {
            ops.push_back(1);
            r = 1;
            state = make_pair(q - sub, p);
        }
        sub >>= 1;
    }

    reverse(ops.begin(), ops.end());
    string res = "";
    int pos = B - 1, half = (1LL << (N-1));
    for(auto e : ops) {
        char c = '$';
        if(pos < half) {
            if(e == 1) c = 'L';
            if(e == 0) c = 'R';
        }
        else {
            if(e == 1) c = 'R';
            if(e == 0) c = 'L';
        }
        res += c;
        pos = move_pos(pos, half, c);
        half >>= 1;
    }
    return res;
}
 
signed main() {
    int N, A, B;
    while(cin >> N >> A >> B, N || A || B) {
        cout << solve(N, A, B) << endl;
    }
    return 0;
}



Measured memory_bytes: 3168
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#define int long long
#define INF 1000000
using namespace std;
struct data{
    int x,y;
};
char fld[1001][1001];
int H,W,N,cou;
int ans[1001][1001];
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
signed main(){
    cin>>H>>W>>N;
    data s;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>fld[i][j];
            if(fld[i][j]=='S'){
                s.x=i,s.y=j;
            }
        }
    }
    for(int l=1;l<=N;l++){
        queue<data> q;
        data g;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                ans[i][j]=INF;
                if(fld[i][j]=='0'+l)g.x=i,g.y=j;
            }
        }
        q.push(s);
        ans[s.x][s.y]=0;
        while(!q.empty()){
            data now;
            now=q.front();
            q.pop();
            if(now.x==g.x&&now.y==g.y)break;
            for(int i=0;i<4;i++){
                if(now.x+dx[i]>=0&&now.x+dx[i]<H&&now.y+dy[i]>=0&&now.y+dy[i]<W&&ans[now.x+dx[i]][now.y+dy[i]]==INF&&fld[now.x+dx[i]][now.y+dy[i]]!='X'){
                    data next;
                    next.x=now.x+dx[i],next.y=now.y+dy[i];
                    q.push(next);
                    ans[now.x+dx[i]][now.y+dy[i]]=ans[now.x][now.y]+1;
                }
            }
        }
        cou+=ans[g.x][g.y];
        s=g;
    }
    cout<<cou<<endl;
    return 0;
}

Measured memory_bytes: 10020
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;cin>>N;
  ll ans = 0;
  for(ll i=1;i*i<N;i++){
    if(N%i==0&&i<N/i-1){
      ans += N/i-1;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import time
start = time.time()

import random
from collections import defaultdict


def get_score(day, contest, prev_list, loss_list, satisfied_matrix):
    plus = satisfied_matrix[day][contest]
    minus = 0
    for type, prev in enumerate(prev_list):
        if type == contest:
            continue
        spend = day - prev
        minus += loss_list[type] * spend

    return plus - minus


def calc_score_by_contest(contest, contest_schedule, loss_base, satisfied_matrix):
    plus = 0
    minus = 0
    for day in contest_schedule:
        plus += satisfied_matrix[day][contest]

    diff = [0] + contest_schedule[:-1]
    loss_base = loss_list[contest]
    for prev, open in zip(diff, contest_schedule):
        spend = open - prev
        loss = loss_base * spend * (spend + 1) // 2
        minus += loss

    return plus - minus


def update(day, old, new, loss_list, satisfied_matrix):
    if old == new:
        return None


def schedule_to_dict(schedule):
    dict = defaultdict(list)
    for day, contest in enumerate(schedule):
        dict[contest].append(day)

    for contest in range(26):
        dict[contest].append(364)

    return dict


def calc_score(schedule, loss_list, satisfied_matrix):
    schedule_dict = schedule_to_dict(schedule)
    plus = 0
    minus = 0
    for contest in range(26):
        day_list = schedule_dict[contest]
        for day in day_list:
            plus += satisfied_matrix[day][contest]

        diff = [0] + day_list[:-1]
        loss_base = loss_list[contest]
        for prev, open in zip(diff, day_list):
            spend = open - prev
            loss = loss_base * spend * (spend+1) // 2
            minus += loss

    return plus - minus


days = int(input())
loss_list = list(map(int, input().split()))
satisfied_matrix = [list(map(int, input().split())) for _ in range(days)]

ans = [random.randint(0, 25) for _ in range(days)]
prev = calc_score(ans, loss_list, satisfied_matrix)

while time.time() - start < 1.7:
    index = random.randint(0, 25)
    for num in range(8):
        old_contest = ans[index]
        new_contest = random.randint(0, 25)
        if old_contest == new_contest:
            continue

        ans[index] = new_contest
        new_score = calc_score(ans, loss_list, satisfied_matrix)
        if new_score < prev:
            ans[index] = old_contest
        else:
            break


for contest in ans:
    print(contest + 1)
    

Measured memory_bytes: 86364
#include<bits/stdc++.h>
using namespace std;
const int M=1e5+5;
vector<int>mmp[M];
int col[M],du[M],val[M],dp1[M],dp2[M],n,rt,tot,more;
bool allb[M];
char ch[M];
void in()
{
	int a,b;
	scanf("%d",&n);
	for(int i=1;i<n;++i)
	scanf("%d%d",&a,&b),mmp[a].push_back(b),mmp[b].push_back(a);
	scanf("%s",ch+1);
	for(int i=1;i<=n;++i)col[i]=ch[i]=='W'?0:1,rt=col[i]?rt:i;
}
void dfs(int v,int f)
{
	allb[v]=col[v];int to;
	for(int i=mmp[v].size()-1;i>=0;--i)
	{
		to=mmp[v][i];if(to==f)continue;
		dfs(to,v);
		if(!allb[to])++du[v],++du[to];
		allb[v]&=allb[to];
	}
}
void dp(int v,int f)
{
	tot+=du[v];
	if((du[v]+col[v])&1)val[v]=0;
	else val[v]=2,++tot;
	int mx1=0,mx2=0,to;bool flag=0;
	for(int i=mmp[v].size()-1;i>=0;--i)
	{
		to=mmp[v][i];if(to==f||allb[to])continue;
		flag=1;dp(to,v);
		more=max(more,max(dp1[to]+mx2+val[v],dp2[to]+mx1+val[v]));
		mx1=max(dp1[to],mx1);mx2=max(dp2[to],mx2);
	}
	dp1[v]=mx1+val[v];dp2[v]=flag?mx2+val[v]:-INT_MAX;
}
void ac()
{
	dfs(rt,0);dp(rt,0);
	if(rt)printf("%d",tot-more);
	else printf("0");
}
int main()
{
	in();ac();
	return 0;
}

Measured memory_bytes: 15616
from fractions import gcd

def lcm(x,y):
    return (x*y)//gcd(x,y)
    
a,b,c,d=map(int,input().split())

dd=(b//d)-((a-1)//d)
cc=(b//c)-((a-1)//c)
cd=(b//lcm(c,d))-((a-1)//lcm(c,d))


print(b-a+1-cc-dd+cd)

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
// ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


const ll MOD=1000000007LL;

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)); }
// ll comb(ll n, ll k) { ll v=1; for(ll i=1; i<=k; i++) v = DIV(MUL(v, n-i+1),i); return v; }
//

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];


int main() {
    int a,b; cin >> a >> b;
    int y = b;
    if (a <= 5) y = 0;
    else if (a <= 12) y = b/2;
    else y = b;
    cout << y << endl;
    return 0;
}


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

int main()
{
  int N, M;
  while (cin >> N >> M && N != 0) {
    vector<vector<pair<int,int> > > g(N);
    for (int i = 0; i < N; i++) {
      int k;
      cin >> k;
      for (int j = 0; j < k; j++) {
        int c, d;
        cin >> c >> d;
        g[i].push_back(make_pair(c, d));
      }
    }

    vector<vector<vector<int> > > dp(N);
    for (int i = 0; i < N; i++) {
      dp[i].resize(g[i].size(), vector<int>(M+1, numeric_limits<int>::max()/2));
    }
    for (int i = 0; i < g[0].size(); i++) {
      dp[0][i][0] = 0;
    }
    for (int i = 0; i < g[1].size(); i++) {
      dp[1][i][1] = 0;
    }

    int ans = numeric_limits<int>::max();
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < g[i].size(); j++) {
        for (int m = 0; m <= M; m++) {
          if (i+1 == N) {
            ans = min(ans, dp[i][j][m]);
          } else {
            for (int k = 0; k < g[i+1].size(); k++) {
              dp[i+1][k][m] = min(dp[i+1][k][m], dp[i][j][m] + (g[i][j].second + g[i+1][k].second)*abs(g[i][j].first - g[i+1][k].first));
            }

            if (i < N-1 && m < M) {
              if (i+2 == N) {
                ans = min(ans, dp[i][j][m]);
              } else {
                for (int k = 0; k < g[i+2].size(); k++) {
                  dp[i+2][k][m+1] = min(dp[i+2][k][m+1], dp[i][j][m] + (g[i][j].second + g[i+2][k].second)*abs(g[i][j].first - g[i+2][k].first));
                }
              }
            }
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(begin, end) for (i=begin;i<end;i++)
#define repj(begin, end) for (j=begin;j<end;j++)
#define init(arr, end, val) for (i=0;i<end;i++) arr[i] = val;
#define printint(i0, i1) printf("%d %d\n", i0, i1)

using namespace std;
typedef long long int ll;
const int inf = 1000000000;
const int mod = 1000000007;
const int nil = -1;
int i, n, m, k, ans;
int a[1000];

int main() {
    scanf(" %d", &n);
    if (n%10 == 3) printf("bon\n");
    else if (n%10 == 0 || n%10 == 1 ||n%10 == 6 ||n%10 == 8 ) printf("pon\n");
    else printf("hon\n");
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  int N, M;
  cin >> N >> M;

  vector<vector<int>> A(M,vector<int>(2));
  REP(i, M){
    REP(j, 2){
      cin >> A.at(i).at(j);
    }
  }
  if(N==3){
    int flag2 = 0;
    FOR(i,100,1000){
      int flag = 0;
      REP(j,M){
        if(A.at(j).at(0)==1){
          if(A.at(j).at(1)!=i/100%10){
            flag = 1;
          } 
        }
        if(A.at(j).at(0)==2){
          if(A.at(j).at(1)!=i/10%10){
            flag = 1;
          } 
        }
        if(A.at(j).at(0)==3){
          if(A.at(j).at(1)!=i%10){
            flag = 1;
          } 
        }
      }
      if(flag == 0){
        flag2 = 1;
        cout << i << endl;
        break;
      }
    }
    if(flag2 == 0){
      cout << -1 << endl;
    }
  }else if(N==2){
    int flag2 = 0;
    FOR(i,10,100){
      int flag = 0;
      REP(j,M){
        if(A.at(j).at(0)==1){
          if(A.at(j).at(1)!=i/10%10){
            flag = 1;
          } 
        }
        if(A.at(j).at(0)==2){
          if(A.at(j).at(1)!=i%10){
            flag = 1;
          } 
        }
      }
      if(flag == 0){
        flag2 = 1;
        cout << i << endl;
        break;
      }
    }
    if(flag2 == 0){
      cout << -1 << endl;
    }
  }else if(N==1){
    int flag2 = 0;
    FOR(i,0,10){
      int flag = 0;
      REP(j,M){
        if(A.at(j).at(0)==1){
          if(A.at(j).at(1)!=i%10){
            flag = 1;
          } 
        }
      }
      if(flag == 0){
        flag2 = 1;
        cout << i << endl;
        break;
      }
    }
    if(flag2 == 0){
      cout << -1 << endl;
    }
  }
}

Measured memory_bytes: 256
X = int(input())

table = [0] *  100003

for i in range(1,100003+1):
    for j in range(i,100003+1,i):
        table[j-1] += 1

for i in range(X,100003+1):
    if table[i-1] == 2:
        print(i)
        break


Measured memory_bytes: 72084
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)





int main()
{
	char s[6];
	int Ans = 0;
	int i;
	scanf("%s",s);
	rep(i, 0, 6) {


		if (s[i] == '1') Ans++;
	}
	
	cout << Ans;

	
}

Measured memory_bytes: 256
#include <array>
#include <iostream>

int main() {
  const uint32_t n_max = 100'000, q_max = 50'000;
  uint32_t n = 0, q = 0;
  std::array<uint32_t, n_max> S;
  std::array<uint32_t, q_max> T;
  std::cin >> n;
  for (uint32_t i = 0; i < n; i++) std::cin >> S[i];
  std::cin >> q;
  for (uint32_t i = 0; i < q; i++) std::cin >> T[i];

  uint32_t C = 0;
  for (uint32_t i = 0; i < q; i++) {
    uint32_t start = 0, end = n;

    while (end - start != 1) {
      uint32_t t = (end + start) / 2;
      if (T[i] < S[t])
        end = t;
      else
        start = t;
    }

    if (T[i] == S[start]) C++;
  }

  std::cout << C << std::endl;

  return 0;
}


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

using namespace std;

int main()
{
  string a, b;

  cin >> a >> b;

  for(int i=0;i<3;i++){
    if(a.at(i) != b.at(2-i)){
      cout<<"NO"<<endl;
      return 0;
    }
  }

  cout<<"YES"<<endl;

  return 0;
}


Measured memory_bytes: 256
// dile a la jardinera que traigo flores
// corner cases // int vs ll // cin vs scanf
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define N 22
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int n,tab[N][N],dp[N][1<<22];

int go(int id, int msk){
	if(id == n) return 1;
	int &ans = dp[id][msk];
	if(ans != -1) return ans;
	ans = 0;
	for(int i = 0; i < n; ++i){
		if( (!(msk&(1<<i))) and tab[id][i]){
			ans = (ans + go(id+1,msk|(1<<i)))%MOD;
		}
	}
	return ans;
}

int main(){

	fastio;
	srand(time(NULL));
	cin >> n;
	FER(i,0,n) FER(j,0,n) cin >> tab[i][j];
	fill(dp,-1);
	cout << go(0,0) << endl;
	return 0;
}


Measured memory_bytes: 360832
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    
    ll r, d, x;
    cin >> r >> d >> x;
    for(ll i = 0; i < 10; i++){
        ll xx = r * x - d;
        cout << xx << endl;
        x = xx;
    }

    return 0;
}

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


int main() {
    int A, B;
    
    cin>>A>>B;
    if (A==1) {
        A=14;
    }

    if (B==1){
        B=14;
    }
    if (A>B){
        cout<<"Alice"<<endl;
    }
    if (B>A){
        cout<<"Bob"<<endl;
    }
    if (A==B){
        cout<<"Draw"<<endl;
    }
    
   

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  string s;
  cin>>n>>k>>s;
  int count=1;
  for(int i=1;i<s.length();i++) if(s[i]!=s[i-1])count++;
  count-=2*k;
  count=max(count,1);
    count=n-count;
  cout<<count<<endl;
 
}

Measured memory_bytes: 512
i = 0
m = Array.new
f = Array.new
r = Array.new
while m[i-1] != -1 || f[i-1] != -1 || r[i-1] != -1 do
	m[i], f[i], r[i] = gets.split.map(&:to_i)
	i += 1
end
i = 0
while m[i] != -1 || f[i] != -1 || r[i] != -1 do
	if m[i] == -1 || f[i] == -1
		puts "F"
	elsif m[i] + f[i] >= 80
		puts "A"
	elsif 80 > m[i] + f[i] && m[i] + f[i] >= 65
		puts "B"
	elsif 65 > m[i] + f[i] && m[i] + f[i] >= 50 || r[i] >= 50
		puts "C"
	elsif 50 > m[i] + f[i] && m[i] + f[i] >= 30
		puts "D"
	else
		puts "F"
	end
	i += 1
end

Measured memory_bytes: 8708
#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>

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

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

    int N;
    vector< pair< pair<string, int>, int > > vec;
    cin >> N;

    vec.resize(N);
    string s;
    int p;
    rep (i, N)
    {
        cin >> s >> p;
        vec[i] = make_pair(make_pair(s, p), i);
    }

    auto cmp = [](pair<pair<string, int>, int>& x, decltype(x)& y) { return (x.first.first < y.first.first ? true :
                                                                              x.first.first > y.first.first ? false :
                                                                              x.first.second > y.first.second ? true : false); };
    sort(vec.begin(), vec.end(), cmp);

    vs32 ans(N);
    rep (i, N)
    {
        ans[i] = vec[i].second + 1;
    }

    rep (i, N)
    {
        cout << ans[i] << "\n";
    }
    return 0;
}



Measured memory_bytes: 256
#include "stdio.h"
int main(void)
{
	int a = 0;
	int b = 0;
	int num = 0;
	int oldlen = 0;
	int flag = 0;
	
	
	scanf("%d %d", &a, &b);
	
	oldlen = 1;
	while(flag != 1){
		if ( oldlen >= b) {
			flag = 1;
		}
		else {
			oldlen--;
			oldlen += a;
			num++;
		}
	}
	
	printf("%d\n", num);

	return 0;
}

Measured memory_bytes: 128
// Sasageyo! Sasageyo! Shinzou wo Sasageyo !
// https://goo.gl/IwJzbx

#include<bits/stdc++.h>

using namespace std;


typedef long long int LL;
typedef pair<LL,LL> II;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define endl '\n'
const LL N = 1e5;
pair<II,LL> c[N];
int p[N+1];
int find(int u) {
  if(p[u]==u)
    return u;
  return p[u] = find(p[u]);
}
int unio(int u, int v) {
  int pu = find(u);
  int pv = find(v);
  if(pu==pv)
    return 0;
  p[pu] = pv;
  return 1;
}
int main()
{
  for(int i=0;i<=N;i++)
    p[i] = i;
	fast_io;
  LL n;
  cin >> n;
  for(LL i=0;i<n;i++) {
    cin >> c[i].F.F >> c[i].F.S;
    c[i].S = i;
  }
  sort(c, c + n);
  priority_queue< pair<LL, II> > q;
  for(LL i=1;i<n;i++)
    q.push({-abs(c[i].F.F - c[i-1].F.F),  {c[i].S, c[i-1].S}});
  for(LL i=0;i<n;i++)
    swap(c[i].F.F, c[i].F.S);
  sort(c, c + n);
  for(LL i=1;i<n;i++)
    q.push({-abs(c[i].F.F - c[i-1].F.F),  {c[i].S, c[i-1].S}});
  LL ans = 0;
  while(!q.empty()) {
    auto t = q.top();q.pop();
    if(unio(t.S.F, t.S.S))
      ans += -t.F;
  }
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11248
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;
#define vv(Type, n,m,d)vector<vector<Type>> vv(n, vector<Type>(m, d));

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);

	int n; cin >> n;
	vector<int> x(n);
	rep(i, n) cin >> x[i];

	int sum;
	int mini = 1e9;
	rep(i, 101) {
		sum = 0;
		rep(j, n) {
			sum += (x[j] - i) * (x[j] - i);
		}
		mini = min(sum, mini);
	}

	cout << mini << endl;





	return 0;
}


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

int main(){
    int N, D;
    cin >> N >> D;
    
    int K = D * 2 + 1;
    double A = N / K;
    int B = N % K;
    if(B > 0){
        cout << A + 1 << endl;
    }
    else{
        cout << A << endl;
    }
}

Measured memory_bytes: 256
import sys

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

if not x in p:
    print(x)
    sys.exit()

i = 1
while True:
    if not x - i in p:
        print(x - i)
        sys.exit()
    if not x + i in p:
        print(x + i)
        sys.exit()
    i += 1

Measured memory_bytes: 9188
N = int(input())
A_N = list(map(int, input().split()))
A_N_even = []

for i in A_N:
    if i % 2 == 0:
        A_N_even.append(i)

ans = "APPROVED"
for i in A_N_even:
    if i % 3 == 0 or i % 5 == 0:
        ans = "APPROVED"
    else:
        ans = "DENIED"
        break

print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ar = a * b;
    int lo = 2 * a + 2 * b;
    System.out.println(ar + " " + lo);
  }
}



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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> m(N);
  int msum = 0;
  
  for (int i = 0; i < N; i++) {
  	cin >> m[i];
    msum += m[i];
  }
  sort(m.begin(), m.end());
  
  int nokori = X - msum;
  
  cout << N + nokori / m[0] << endl;
  
  
}



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

#define ll     long long
#define fr     first
#define sec    second
#define rep(i,n)  for(i=0;i<n;i++)
#define vi     vector <int>
#define vc     vector <char>
#define vl     vector <ll>
#define vb     vector <bool>
#define pb     push_back
#define M      1000000007
#define ios    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define open   freopen("input.txt","r",stdin);
#define close  freopen("output.txt","w",stdout);
#define M_PI   3.14159265358979323846
#define pp     pair<int,int>
#define nn 100003

int main()
{
    ios;
    ll n,i,sum=0;
    cin>>n;
    ll a[n];
    rep(i,n)
    {
        cin>>a[i];
        sum=sum^a[i];
    }
    ll b[n];
    rep(i,n)
        b[i]=sum^a[i];
    rep(i,n)
        cout<<b[i]<<" ";
    return 0;
}


Measured memory_bytes: 6704
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int sumw=0,sume=0;
  
  vector<char> s;
  for(int i=0;i<n;i++){
    char c;
    cin>>c;
    if(c=='W') sumw++;
    else sume++;
    s.push_back(c);
  }
  int e=0,w=0;
  vector<int> ans;
  for(int i=0;i<n;i++){
    if(s[i]=='E') ans.push_back(sume-e+w-1);
    else ans.push_back(sume-e+w);
    if(s[i]=='W') w++;
    else e++;
  }
  cout<<*min_element(ans.begin(),ans.end());
}

Measured memory_bytes: 2676
/*Program from Luvwgyx*/
#include<map>
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define int long long
using namespace std;
const int maxn=2e5+10;
int n,m,len,x,y;char s[maxn],t[maxn];
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(int x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)print(x/10);
    putchar(x%10+'0');
}
void write(int x){print(x);puts("");}
signed main(){
    n=read();m=read();len=read();x=read(),y=read();
    scanf("%s%s",s+1,t+1);int l=1,r=n;
    for(int i=len;i>=1;i--){
        if(t[i]=='U')r=min(n,r+1);
        if(t[i]=='D')l=max(1ll,l-1);
        if(s[i]=='U')l++;
        if(s[i]=='D')r--;
        if(l>r){puts("NO");return 0;}
    }if(x<l||r<x){puts("NO");return 0;}
    l=1;r=m;
    for(int i=len;i>=1;i--){
        if(t[i]=='L')r=min(m,r+1);
        if(t[i]=='R')l=max(1ll,l-1);
        if(s[i]=='L')l++;
        if(s[i]=='R')r--;
        if(l>r){puts("NO");return 0;}
    }if(y<l||r<y){puts("NO");return 0;}
    puts("YES");
    return 0;
}


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

int main() {
	long long int N;cin >> N;
	long long int ans = (N/11)*2;
	if(N%11 != 0&&N%11 < 7){
		ans++;
	}
	if(N%11 > 6){
		ans += 2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define maxN 200005
#define mod 1000000007
#define pi 3.14159265358979323846264338327950

void solve()
{
    ll n;
    cin >> n;
    string s;
    while (n != 0)
    {
        int temp = n % 26;
        if (temp == 0)
        {
            s += 'z';
            n -= 26;
        }
        else
        {
            s += ('a' + (temp - 1));
        }
        n /= 26;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}

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

Measured memory_bytes: 3616
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{

  char s[101];
  int len;
  scanf("%s",s);
  len = strlen(s);
  if(len == 2){
    printf("%s\n", s);    
  }else{
    printf("%c", s[2]);
    printf("%c", s[1]);
    printf("%c\n", s[0]);
  }
  

  return 0;
  
}


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

int main() {
    int a, b, c, d;  cin >> a >> b >> c >> d;
    if (abs(a-b) <= d && abs(b-c) <= d)  cout << "Yes" << endl;
    else if (abs(a-c) <= d)  cout << "Yes" << endl;
    else  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long 
#define int long long 
#define vll vector<long long>
#define pii pair<long long ,long long > 
#define vvi vector< vector<long long > > 
#define vpii vector<pair<int,int>> 
#define pll  pair<long long ,long long > 
#define pb  push_back
#define ff  first 
#define sec second  
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend()) 
#define m_p make_pair
#define all(x) (x.begin(),x.end()) 
#define sz(v) ((int)(v.size()))
#define endl '\n'
typedef vector< long long > vi ;
const int MOD=1e9 +7 ;
int size=10000000; 
 
int32_t main(){
  fast; 
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif 
  */
  int T=1; //cin>>T; 
  while(T--){

    int n ; cin>>n; 
    vi h(n+1,0); 
    for(int i=1;i<=n;i++) cin>>h[i]; 

    vi dp(n+1,-1); 
    dp[1]=0; 

    for(int i=2;i<=n;i++){
      if(i-2>=1){
        if(dp[i]==-1) dp[i]=dp[i-2]+abs(h[i]-h[i-2]); 
        else dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2])); 
      }
      if(dp[i]==-1) dp[i]=dp[i-1]+abs(h[i]-h[i-1]); 
      else dp[i]=min(dp[i],dp[i-1]+abs(h[i]-h[i-1])); 
    }

    cout<<dp[n]<<endl; 








  }
    


  return 0; 
} 


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

void AddScore(map<long long, vector<long long>>& C, long long* S, long long i, int* visited)
{
    const auto r = C[i];
    const auto s = S[i - 1];
    visited[i - 1] = 1;
    for (auto j : r) {
        if (visited[j - 1] != 0) {
            continue;
        }
        S[j - 1] += s;
        AddScore(C, S, j, visited);
    }
}

int main()
{
    long long N, Q;
    cin >> N >> Q;

    map<long long, vector<long long>> C;
    for (long long i = 0; i < N - 1; i++) {
        long long a, b;
        cin >> a >> b;
        C[a].push_back(b);
        C[b].push_back(a);
    }

    vector<long long> S;
    S.resize(N);
    fill(S.begin(), S.end(), 0);
    for (long long i = 0; i < Q; i++) {
        long long p, x;
        cin >> p >> x;
        S[p - 1] += x;
    }

    vector<int> visited;
    visited.resize(N);
    fill(visited.begin(), visited.end(), 0);

    AddScore(C, S.data(), 1, visited.data());

    for (long long i = 0; i < N; ++i) {
        cout << S[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 54784
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  pr(s.substr(0,s.size()-8));
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 764
import math

N, X = map(int, input().split())
X_lst = list(map(int, input().split()))

if len(X_lst) == 1:
    print(abs(X_lst[0] - X))
    exit()

u = 0
if X_lst[0] == X:
    u = float('inf')

for i, x in enumerate(X_lst[1:], start=1):
    if x == X:
        u = float('inf')

    if X_lst[i - 1] < X < x:
        u = [X - X_lst[-1], x - X]

    if i == 1:
        g = X_lst[1] - X_lst[0]
    else:
        g = math.gcd(g, x - X_lst[i - 1])


if u == 0:
    u = [X - X_lst[-1]]
elif u != float('inf'):
    g = max(math.gcd(g, u[0]), math.gcd(g, u[1]))

print(g)


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

int main()
{
	int n, top=10;
	long long a[100005];
	for(int i=1; i<10; i++) a[i]=i;
	cin>>n;
	for(int i=1; i<=n; i++)
	{
		if(top>100003) break; 
		if(a[i]%10!=0) a[top++]=a[i]*10+a[i]%10-1;
		a[top++]=a[i]*10+a[i]%10;
		if(a[i]%10!=9) a[top++]=a[i]*10+a[i]%10+1;
//		cout<<a[i]<<endl;
	}
	cout<<a[n]<<endl;
}

Measured memory_bytes: 1024
s = input()
l = len(s)
h = l//2
if l == 3:
    print(1)
if l%2==0:
    for i in range(1,h):
        if s[:h-i] == s[h-i:-2*i]:
            print(len(s[:-2*i]))
            break
else:
    for i in range(1,h):
        if s[0:h-i+1] == s[h-i+1:-2*i+1]:
            print(len(s[:-2*i+1]))
            break

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

int main() {
  
  int a;
  cin >> a;
  int s1, s2, s3;
  s1 = a/100;
  s2 = a/10-s1*10;
  s3 = a-s1*100-s2*10;
    cout << s1+s2+s3 << endl;
  
}

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  const int mod=1000000007;
  int n;
  scanf("%d",&n);
  if(n==1){
    printf("%d\n",3);
    return;
  }
  char s1[53];
  char s2[53];
  scanf("%s",s1);
  scanf("%s",s2);
  int64 way=1;
  int index=0;
  int before=0;
  if(s1[index]==s1[index+1]){
    way=6;
    index+=2;
    before=2;
  } else {
    way=3;
    index++;
    before=1;
  }


  /*
    ab
    ba

    ab
    bc

    ac
    ba
   */
  while(index<n){
    if(index+1<n && s1[index]==s1[index+1]){
      if(before==2){
	way=way*3%mod;
      } else {
	way=way*2%mod;
      }
      before=2;
      index+=2;
    } else {
      if(before==1){
	way=way*2%mod;
      }
      before=1;
      index++;
    }
  }
  printf("%lld\n",way);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int a,b,c;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  int result;
  int sum;
  result = a / b;
  sum = result * c;
  if(a % b != 0){
    sum += c;
  }
  printf("%d",sum);
  return 0;
    
}

Measured memory_bytes: 2120
import java.awt.Point;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
	public static final int[] dx = {-1,0,1,0};
	public static final int[] dy = {0,1,0,-1};
	public static final int INF = 10000;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int w = sc.nextInt();
			int h = sc.nextInt();
			if (w == 0) {
				return;
			}
			int w2 = w*2+1;
			int h2 = h*2+1;
			int[][] m = new int[h2][w2];
			int[][] d = new int[h2][w2];
			for(int i=0;i<h2;i++) {
				for(int j=0;j<w2;j++) {
					m[i][j] = 1;
					d[i][j] = INF;
				}
			}
			sc.nextLine();
			for(int i=0;i<h2-2;i++) {
				String s = sc.nextLine();
				if (i%2 == 0) {
					s += " ";
					s = s.replace(' ', '0');
				}else{
					s = s.replace(' ', '1');
				}
				for(int j=0;j<w2-2;j++) {
					m[i+1][j+1] = s.charAt(j) - '0';
				}
			}
			Deque<Point> q = new ArrayDeque<Point>();
			d[1][1] = 0;
			q.offer(new Point(1,1));
			while(!q.isEmpty()) {
				Point p = q.poll();
				for(int i=0;i<4;i++) {
					int nx = p.x + dx[i];
					int ny = p.y + dy[i];
					if (m[nx][ny] == 0 && d[p.x][p.y] + 1 < d[nx][ny]) {
						d[nx][ny] = d[p.x][p.y] + 1;
						q.offer(new Point(nx,ny));
					}
				}
			}
			int dist = d[h2-2][w2-2];
			if (dist == INF) {
				System.out.println(0);
			}else{
				System.out.println(dist/2+1);
			}
		}
	}
}

Measured memory_bytes: 49680
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>

using namespace std;

vector<long long> g1(200002, 0);
vector<long long> g2(200002, 0);
int main(){
  long long n;
  cin >> n;

  for(long long i = 0; i < n; i++){
    cin >> g1[i];
  }
  g2 = g1;
  
  for(long long i = 0; i < n; i++){
    g1[i+1] = g1[i] + g1[i+1];
  }
  for(long long i = n-1; i > 0; i--){
    g2[i-1] = g2[i] + g2[i-1];
  }

  long long m = 999999999999;
  for(long long i = 0; i < n -1; i++){
    m = min(m, abs(g1[i] - g2[i+1]));
  }
  cout << m << endl;
  return 0;
} 


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

int main() {

  string S;
  cin >> S;
  
  int N = size(S);
  
  int check1 = 0;
  int check2 = 0;
  
  for(int i = 0; i <= (N-1)/2; i++) {
    if(i == (N-1)/2) {
      check1 = 1;
      break;
    }
    if(S.at(i) != S.at(N-1-i)) break; 
  }
  
  for(int i = 0; i <= (N-1)/2; i++) {
    if(i == (N-1)/2) {
      check2 = 1;
      break;
    }
    if(S.at(i) != S.at((N-1)/2-1-i)) break; 
  }
  
  if(check1*check2 == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 3628