akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1e+9 + 7;
// constexpr int mod = 998244353;

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

    string s;
    cin >> s;
    int n = s.length();
    if(n % 2 != 0){
        cout << "No\n";
        return 0;
    }
    bool flag = true;
    for(int i = 0; i < n - 1; i += 2){
        if(s[i] != 'h' || s[i + 1] != 'i'){
            flag = false;
            break;
        }
    }
    if(flag)    cout << "Yes\n";
    else    cout << "No\n";
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var l, r, d int
	fmt.Scan(&l, &r, &d)

	cnt := 0
	for i := l; i <= r; i++ {
		if i %d == 0 {
			cnt++
		}
	}
	fmt.Println(cnt)
}

// http://cavaliercoder.com/blog/optimized-abs-for-int64-in-go.html
func abs(n int) int {
	y := n >> 63
	return (n ^ y) - y
}


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

using namespace std;

int main() {
  int64_t H, W;
  cin >> H >> W;
  vector<vector<bool>> grid;
  for (int64_t i = 0; i < H; ++i) {
    grid.emplace_back();
    for (int64_t j = 0; j < W; ++j) {
      char c;
      cin >> c;
      grid.back().emplace_back(c == '#');
    }
  }

  vector<pair<int64_t, int64_t>> directions{
    {0, 1},
    {0, -1},
    {1, 0},
    {-1, 0},
  };

  int64_t count = 0;
  vector<vector<bool>> seen(H, vector<bool>(W));
  for (int64_t h = 0; h < H; ++h) {
    for (int64_t w = 0; w < W; ++w) {
      if (!seen[h][w] && grid[h][w]) {
        seen[h][w] = true;
        deque<pair<int64_t, int64_t>> bfs;
        bfs.emplace_back(h, w);
        int64_t black = 1;
        int64_t white = 0;
        for (; !bfs.empty();) {
          auto&& cell = bfs.front();
          auto h = cell.first;
          auto w = cell.second;
          bool next = !grid[h][w];
          bfs.pop_front();
          for (auto&& dir : directions) {
            auto next_h = h + dir.first;
            auto next_w = w + dir.second;
            if (0 <= next_h && next_h < H && 0 <= next_w && next_w < W && !seen[next_h][next_w] && grid[next_h][next_w] == next) {
              bfs.emplace_back(next_h, next_w);
              seen[next_h][next_w] = true;
              if (next) ++black;
              else ++white;
            }
          }
        }
        count += black * white;
      }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;

	long long int sum = 0;
	
	for(long long int i = 1; i <= n; i++){
		if(i % 3 == 0 && i % 5 == 0){
			
		} else if(i % 3 == 0){
			
		} else if(i % 5 == 0){
			
		} else {
			sum += i;
		}
	}
	
	cout << sum;
	return 0;
}


Measured memory_bytes: 3636
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
x = gets.chomp.to_i

n = 0
(0..a).each{|coin500|
  (0..b).each{|coin100|
    (0..c).each{|coin50|
      if coin500*500 + coin100*100 + coin50*50 == x
        n += 1
      end
      }
    }
  }
puts n

Measured memory_bytes: 1788
#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(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

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

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

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


int main() {

	ll N;
	cin >> N;

	if (N == 0) { cout << 0; }

	vector<ll> s;

	
	while (N != 0) {
		if (abs(N % 2) == 1) { s.push_back(1); N--; }
		else { s.push_back(0); }

		N = N/(-2);
	}

	repn(i, s.size()) {
		cout << s[s.size() - i];
	}

	
	system("PAUSE");
}

Measured memory_bytes: 504
package main

import (
	"fmt"
)

func main(){
	var s[] int
	var x int
	for {
		fmt.Scan(&x)
		s = append(s, x)
		if x == 0 {
			s = s[:len(s) - 1]
			break;
		}	
	}

	for i, v := range s {
		fmt.Printf("Case %d: %d\n", i + 1, v)
	}
}


Measured memory_bytes: 2276
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(auto i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
const ll INF = ~(1<<31);
#define fs first
#define sc second
#define pb push_back

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) {
    return (a % b + b) % b;
}

ll n;
ll memo[1020][20'020];

ll W[1020];
ll S[1020];
ll V[1020];

vi I;
ll comp(ll a, ll b) {
    return (W[a]+S[a]) > (W[b]+S[b]);
}

ll dp(ll at, ll can_put) {
    if(at >= n) return 0;
    if(can_put == 0) return 0;
    if(memo[at][can_put] != -1) return memo[at][can_put];

    ll mx = dp(at+1,can_put);

    if(W[I[at]] <= can_put) {
        mx = max(mx, dp(at+1,  min(can_put - W[I[at]], S[I[at]])) + V[I[at]]);
    }

    return memo[at][can_put] = mx;
}

int main() {
    cin.sync_with_stdio(false);
    memset(memo,-1,sizeof(memo));
    cin >> n;
    rep(i,0,n) {
        cin >> W[i] >> S[i] >> V[i];
    }

    rep(i,0,n) I.pb(i);
    sort(I.begin(), I.end(), comp);
    cout << dp(0,20'000) << endl;
    return 0;
}


Measured memory_bytes: 159872
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
int n, m, l, r, min_l, max_l, min_r, max_r, ans;
void solve() {
    cin >> n >> m;
    max_l = -INF;
    min_l = INF;
    max_r = -INF;
    min_r = INF;
    for (int i = 0; i < m; ++i) {
        cin >> l >> r;
        max_l = max(max_l, l);
        min_l = min(min_l, l);
        max_r = max(max_r, r);
        min_r = min(min_r, r);
    }
    ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (min_l <= i && i <= min_r) {
            if (max_l <= i && i <= max_r) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return;
}
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main(int args, char* argv[]) {
    solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    puts("square1001");
    return 0;
}


Measured memory_bytes: 2928
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  string s,t="YAKI";
  cin >> s;
  bool tt=true;
  rep(i,4){
    if (s[i]!=t[i]) tt=false;
  }
  if (tt) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    ll N; cin >> N;
    ll res = 0;
    for (int i = 1; i <=N; i++) res += (ll)(i * (i + 1LL)) / 2LL;
    rep(i, N-1) {
        ll u, v; cin >> u >> v;
        if (u > v) swap(u, v);
        res -= u * (N - v + 1);
    }
    cout << res << endl;
}


Measured memory_bytes: 3532
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int INF = 987654321;
const int MOD = 1000000007;

ll A[100005];
ll sumA[100005];
ll sumT[100005];
ll sumb[100005];
vector<ll> v;
vector<ll> ans;

int main(){
  int N,Q;
  scanf("%d %d",&N,&Q);
  for(int i=1;i<=N;i++){
    scanf("%lld",&A[i]);
  }
  for(int i=N;i>=0;i--){
    sumb[i] = sumb[i+1] + A[i];
  }
  if(N % 2 == 0){
    sumA[1] = A[1];
    sumT[2] = A[2];
    for(int i=3;i<=N;i+=2){
      sumA[i] = sumA[i-2] + A[i];
      sumT[i+1] = sumT[i+1-2] + A[i+1];
    }
  }
  else{
    sumT[1] = A[1];
    sumA[2] = A[2];
    for(int i=3;i<=N;i+=2){
      sumT[i] = sumT[i-2] + A[i];
      sumA[i+1] = sumA[i+1-2] + A[i+1]; 
    }
  }
  int cnt = 1;
  while(cnt*2 < N){
    ll x = A[N-(2*cnt)];
    ll y = A[N-cnt];
    ll mid = (x+y)/2;
    v.pb(mid);
    cnt++;
  }
  for(int i=0;i<v.size();i++){
    cnt = i+1;
    ans.pb(sumb[N-cnt+1] + sumT[N-cnt*2]);
  }
  v.pb(-INF);
  ans.pb(sumb[N-(N+1)/2+1]);
  reverse(v.begin(),v.end());
  reverse(ans.begin(),ans.end());
  // for(int i=0;i<ans.size();i++){
  //   printf("v : %lld ans : %lld\n",v[i],ans[i]);
  // }
  for(int i=0;i<Q;i++){
    ll X; scanf("%lld",&X);
    int idx = lower_bound(v.begin(),v.end(),X)-v.begin();
    // printf("idx : %d\n",idx);
    printf("%lld\n",ans[idx-1]);
  }
}

Measured memory_bytes: 5880
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	//for(int i=1;i<=s.length();i++)
//	{
		if(s[2]==s[3] && s[4]==s[5])
		{
			cout<<"Yes"<<endl;
			return 0;
		} 
		cout<<"No"<<endl;
//	}
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int n,m,ans;
int co[105][105];
int from[21005],to[21005],cost[21005];
signed main() {
	cin>>n>>m;
	rep(i,n)rep(j,n)co[i][j]=INF;
	rep(i,m){
		cin>>from[i]>>to[i]>>cost[i];
		co[from[i]-1][to[i]-1]=cost[i];
		co[to[i]-1][from[i]-1]=cost[i];
	}
	rep(k,n)rep(i,n)rep(j,n)co[i][j]=min(co[i][j],co[i][k]+co[k][j]);
	rep(i,m){
		if(co[from[i]-1][to[i]-1]!=cost[i])ans++;
	}
	cout<<ans<<endl;
}



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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

struct RollingHash {
  const int nmod = 2;
  using hash_type = tuple<ll, ll>; // 衝突が起こるようならmodを増やして

  vector<ll> base{ 1009, 1007 };                // 2339, 9973 など
  vector<ll> mod{ 1000000007LL, 1000000009LL }; // 1000000087LL, 999999937LL など
  vector<vector<ll>> hash;
  vector<vector<ll>> pow;

  RollingHash() {
    hash.resize(nmod);
    pow.resize(nmod);
  }

  // 文字列からハッシュテーブルを作成する
  void init(const string& s) {
    int n = s.size();
    for (int j = 0; j < nmod; j++) {
      hash[j].assign(n + 1, 0);
      pow[j].assign(n + 1, 1);
      for (int i = 0; i < n; i++) {
        hash[j][i + 1] = (hash[j][i] + s[i]) * base[j] % mod[j];
        pow[j][i + 1] = pow[j][i] * base[j] % mod[j];
      }
    }
  }
  // ハッシュ値を返す [l, r) : 例えばget(0, len)は先頭len文字
  hash_type get(int l, int r) {
    ll h[nmod];
    for (int j = 0; j < nmod; j++) {
      h[j] = ((hash[j][r] - hash[j][l] * pow[j][r - l]) % mod[j] + mod[j]) % mod[j];
    }
    return make_tuple(h[0], h[1]);
  }
  // ハッシュ値h1に長さh2_lenのハッシュ値h2を結合する
  hash_type concat(hash_type h1, hash_type h2, int h2_len) {
    ll h[nmod];
    h[0] = (std::get<0>(h1) * pow[0][h2_len] + std::get<0>(h2)) % mod[0];
    h[1] = (std::get<1>(h1) * pow[1][h2_len] + std::get<1>(h2)) % mod[1];
    return make_tuple(h[0], h[1]);
  }
};

// 型の名前が長いので省略名を定義
using hs = RollingHash::hash_type;

void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  RollingHash rh;
  rh.init(s);

  map<hs, int> dp;
  auto check = [&](int w) {
    for (int i = 0; i + w <= n; i++) {
      hs h = rh.get(i, i + w);
      if (dp.count(h)) {
        if (i - dp[h] >= w)
          return true;
      } else {
        dp[h] = i;
      }
    }
    return false;
  };

  int ans = 0;
  int left = 1, right = n / 2 + 1;
  while (left <= right) {
    int mid = left + (right - left) / 2;
    if (check(mid)) {
      left = mid + 1;
      ans = max(ans, mid);
    } else {
      right = mid - 1;
    }
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i=0;i<(n); ++i)
using namespace std;
typedef long long ll;


int main()
{
	ll n;
	double sum = 0;
	cin >> n;
	vector <double>a(n);
	rep(i, n)cin >> a[i];
	rep(i, n) { a[i] = pow(a[i], -1); }
	sum = accumulate(a.begin(), a.end(), 0.0);
	cout << fixed << setprecision(10) << pow(sum,-1) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 6005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,m;
void add(int &a,int b) {a+=b; if(a>m) a-=m;}
void dec(int &a,int b) {a-=b; if(a<0) a+=m;}
int dp[MAXN][MAXN];
int main()
{
    scanf("%d%d",&n,&m);
    dp[0][0]=1;
    for(int i=1;i<=3*n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            add(dp[i][j],dp[i-1][j]);
            if(j)
            {
                if(i>=2) add(dp[i][j],1LL*dp[i-2][j-1]*(i-1)%m);
                if(i>=3) add(dp[i][j],1LL*dp[i-3][j-1]*(i-1)%m*(i-2)%m);
            }
        }
    }
    int ans=0;
    for(int i=0;i<=n;i++) add(ans,dp[3*n][i]);
    printf("%d\n",ans);
    return 0;
}

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

class Dice{
private:
	int num[6];
public:
	Dice(int input[6]);
	~Dice(){};
	int getNum(int want);
	int getTop();
	void moveStep(char direction);
	int func1(int ue, int mae);
	bool func2(int in[6]);
};

Dice::Dice(int input[6]){
	for(int i = 0; i < 6; i++){
		num[i] = input[i];
	}
}

int Dice::getNum(int want){
	return num[want - 1];
}

int Dice::getTop(){
	return num[0];
}

void Dice::moveStep(char direction){
	int temp[6];
	for(int i = 0; i < 6; i++){
		temp[i] = num[i];
	}
	switch(direction){
	case 'N':
		num[0] = temp[1];
		num[1] = temp[5];
		num[5] = temp[4];
		num[4] = temp[0];
		break;
	case 'E':
		num[0] = temp[3];
		num[3] = temp[5];
		num[5] = temp[2];
		num[2] = temp[0];
		break;
	case 'S':
		num[0] = temp[4];
		num[4] = temp[5];
		num[5] = temp[1];
		num[1] = temp[0];
		break;
	case 'W':
		num[0] = temp[2];
		num[2] = temp[5];
		num[5] = temp[3];
		num[3] = temp[0];
		break;
	}
}

int Dice::func1(int ue, int mae){
	if(num[0] == ue && num[1] == mae) return num[2];

	string str("NNNNENNNNENNNNENNNNENENNNEENNN");//??????????????´???????¶??????????????????°????????????
	for(unsigned int i = 0; i < str.length(); i++){
		moveStep(str[i]);
//		cout << num[0] << " " << num[1] << endl;
		if(num[0] == ue && num[1] == mae) return num[2];
	}

	return -1;
}

bool Dice::func2(int in[6]){
	if(num[0] == in[0] && num[1] == in[1] && num[2] == in[2] && num[3] == in[3] && num[4] == in[4] && num[5] == in[5]) return true;

	string str("NNNNENNNNENNNNENNNNENENNNEENNN");//??????????????´???????¶??????????????????°????????????
	for(unsigned int i = 0; i < str.length(); i++){
		moveStep(str[i]);
		if(num[0] == in[0] && num[1] == in[1] && num[2] == in[2] && num[3] == in[3] && num[4] == in[4] && num[5] == in[5]) return true;
	}

	return false;
}

int main() {

	int in1[6], in2[6];
	for(int i = 0; i < 6; i++){
		cin >> in1[i];
	}
	for(int i = 0; i < 6; i++){
		cin >> in2[i];
	}

	Dice dice1(in1);
	if(dice1.func2(in2)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 1200
let a = Int(readLine()!)!
var b = readLine()!.split(separator: " ")
    .map({Int($0)!})
var count = 0

while true {
    var c = b.map({$0/2}).filter({$0.isMultiple(of: 2)}).count
    if c != a {
    if count != 0 {
    count += 1
    }
        break
    }
    b = b.map({$0/2})
    count += 1
    
}

print(count)

Measured memory_bytes: 8224
#include<stdio.h>

int main(void){
    int A,B,C,D;
    scanf("%d %d %d %d",&A,&B,&C,&D);
    int ans=A+B-C-D;
    if(ans > 0){
        printf("Left");
    }
    else if(ans==0){
        printf("Balanced");
    }
    else{
        printf("Right");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int N;
bool c[101010];
int main()
{
  int N; scanf("%d", &N);
  for(int i=0; i<N; ++i)
  {
    int t; scanf("%d", &t);
    c[i] = (t == i+1);
  }
  int ans = 0;
  for(int i=0; i<N; ++i)
  {
    if(c[i])
    {
      ++ans; c[i] = c[i+1] = false;
    }
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <limits.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int a, b;
    int i;
    int ans;

    scanf("%d %d", &a, &b);

    ans = 0;
    for (i = 0; i < 2; i++) {
        if (a < b) {
            ans += b;
            b--;
        } else {
            ans += a;
            a--;
        }
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 128
/*
 * b.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  string y(n, '0');

  for (int i = 0, j = n; i < n; i++, j--) {
    if (d >= j) {
      y[i] = (x[i] == '0') ? '1' : '0';
      d--;
    }
    else if (d > 0 && x[i] == '0') {
      y[i] = '1';
      d--;
    }
    else y[i] = x[i];
  }

  cout << y << endl;
  return 0;
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	int ans = 100;
	for(int i = 1; i < n; i++)
	{
		int tmp = 0, a = i, b = n - i;
		while(a)
		{
			tmp += a % 10;
			a /= 10;
		}
		while(b)
		{
			tmp += b % 10;
			b /= 10;
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
string s;
using MIte = multimap<vector<char>, int>::iterator;

int main() {
	int N, A, B;
	cin >> N >> A >> B;

	if (N * A < B) {
		cout << N*A << endl;
	}
	else {
		cout << B << endl;
	}

	return 0;
}

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const ll INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

struct Edge{
    int i,j,d;
};
int di[] = {0, 1, 0, -1};
int dj[] = {1, 0, -1, 0};

int h,w;
vector<string> g;

int bfs(){
    queue<Edge> q;
    g[0][0] = '#';
    q.push(Edge{0,0,1});
    while(!q.empty()){
        Edge e = q.front(); q.pop();
        if(e.i == h-1 && e.j == w-1) return e.d;
        rep(k,4){
            int ni = e.i + di[k];
            int nj = e.j + dj[k];
            if(ni < 0 || h <= ni) continue;
            if(nj < 0 || w <= nj) continue;
            if(g[ni][nj] == '.'){
                g[ni][nj] = '#';
                q.push(Edge{ni,nj,e.d+1});
            }
        }
    }
    return -1;
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");

    cin >> h >> w;
    g = vector<string>(h);
    rep(i,h) cin >> g[i];
    int cnt = 0;
    rep(i,h) rep(j,w) if(g[i][j] == '.') cnt++;

    int dist = bfs();
    if(dist == -1){
        cout << -1 << endl;
    }else{
        cout << cnt - dist << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout<< name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define end_time()
#endif


#define int long long 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007


void solve(){
	int a,b;
	cin>>a>>b;
	if(a==1){
		if(b==2) cout<<3;
		if(b==3) cout<<2;
	}
	else if(a==2){
		if(b==1) cout<<3;
		if(b==3) cout<<1;
	}
	else if(a==3){
		if(b==1) cout<<2;
		if(b==2) cout<<1;
	}
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	end_time();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>

using namespace std;

using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const ll INF = (1e+18)+100;
const ll mod = 1000000007;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repl(i, l, n) for(int i=l;i<n;++i)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define stop char nyaa;cin>>nyaa;

typedef long double ld;
const ld eps = 1e-8;

void solve() {
	vector<int> c(3, -1);
	int n; cin >> n;
	ll ans = 1;
	rep(i, n) {
		int a; cin >> a;
		bool f = false;
		rep(j, 3) {
			if (c[j] + 1 == a) {
				int num = 0;
				rep(k, 3) {
					if (c[j] == c[k])num++;
				}
				ans = ans * num%mod;
				f = true;
				c[j]++; break;
			}
		}
		if (!f) {
			ans = 0;
		}
		sort(c.begin(), c.end());
	}
	cout << ans << endl;
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
 
using namespace std;
 
int main() {
  
  int N;
  int v[51];
  float out = 0;
  
  cin >> N;
  for (int i=0;i<N;i++){
    cin >> v[i] ;
  }
  sort(v,v+N);
  out = (float)v[0];
  
  for(int i=1; i<N;i++){
    out = (float)(out + v[i]) / 2;
  }
  
  cout << out;
  
  return 0;
}

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

int main(void){
    int n,a,b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    for(int i = 0,j = 0,l = 0;i < n;i++){
        if((j >= a+b) || s[i] == 'c'){
            cout << "No" << endl;
            continue;
        }
        if(s[i] == 'a'){
            cout << "Yes" << endl;
            j++;
        } else if(l < b){
            cout << "Yes" << endl;
            l++;j++;
        } else cout << "No" << endl;
    }
}

Measured memory_bytes: 896
from collections import defaultdict as dd
s=input()
t=input()
ds=dd(int)
dt=dd(int)
for ss in s:
    ds[ss]+=1
for tt in t:
    dt[tt]+=1
# print(ds)
# print(dt)
ls,lt=[],[]
for k,v in ds.items():
    ls.append(v)
for k,v in dt.items():
    lt.append(v)
# print(ls)
# print(lt)
ls.sort()
lt.sort()
for a,b in zip(ls,lt):
    if a!=b:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 3888
#include <bits/stdc++.h>
#define ll long long
#define vl vector<ll int>
#define vs vector<string>
#define v vector<int>
#define mi map<int,int>
#define mc map<char,int>

//ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	int n,dig;
	cin>>n;
	dig=n%10;
	if(dig==2 || dig==4||dig==5||dig==7||dig==9){
		cout<<"hon" <<"\n";
		}
		else if(dig==0||dig==1||dig==6||dig==8){
			cout<<"pon" <<"\n";
			}
			else{cout<<"bon" <<"\n";}
}


Measured memory_bytes: 3532
n, m = gets.split.map(&:to_i)
MOD = 1_000_000_007
def nPk(n, k)
  r = 1
  while k > 0
    r *= n
    r %= MOD
    n -= 1
    k -= 1
  end
  r
end
if (n - m).abs > 1
  puts 0
elsif n == m
  puts nPk(n, n) * nPk(m, m) * 2 % MOD
else
  puts nPk(n, n) * nPk(m, m) % MOD
end

Measured memory_bytes: 1788
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

k,n = map(int,input().split())
A = list(map(int,input().split()))
mans = k + A[0] - A[-1]
for i in range(n-1):
  mans = max(mans,A[i+1]-A[i])
print(k-mans)

Measured memory_bytes: 86128
h, w = map(int, input().split())
ls = []
for _ in range(h):
    ls.append(input())

b = [[False] * w for _ in range(h)]

for y in range(h):
    for x in range(w):
        if ls[y][x] == '.':
            b[y][x] = True

for y in range(h):
    for x in range(w - 1):
        if ls[y][x] == ls[y][x + 1] == '#':
            b[y][x] = b[y][x + 1] = True

for x in range(w):
    for y in range(h - 1):
        if ls[y][x] == ls[y + 1][x] == '#':
            b[y][x] = b[y + 1][x] = True

print(('No', 'Yes')[all(all(xs) for xs in b)])


Measured memory_bytes: 3064
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split();
            int a = int.Parse(line[0]);
            int b = int.Parse(line[1]);
            int c = int.Parse(line[2]);

            if(a + b == c || a + c == b || b + c == a)
            {
                Console.WriteLine("Yes");
            }else
            {
                Console.WriteLine("No");
            }
        }
    }
}


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

typedef unsigned long long LL;

vector<map<int, int>> tree;
map<int, LL> costs;

void dfs(int current, LL cost)
{
	costs[current] = cost;
	for (auto node : tree[current]) {
		if (costs.find(node.first) != costs.end()) {
			continue;
		}
		dfs(node.first, cost + tree[current][node.first]);
	}
}

int main(void)
{
	int N;
	cin >> N;
	tree.resize(N);
	for (int i = 0; i < (N - 1); i++) {
		int A, B;
		LL C;
		cin >> A >> B >> C;
		tree[A - 1][B - 1] = C;
		tree[B - 1][A - 1] = C;
	}

	int Q, K;
	cin >> Q >> K;
	dfs(K - 1, 0);

	for (int i = 0; i < Q; i++) {
		int X, Y;
		cin >> X >> Y;
		cout << costs[X - 1] + costs[Y - 1] << endl;
	}

	return 0;
}


Measured memory_bytes: 29952
#include<iostream>
#include<string>
using namespace std;
int main(){
  int k;
  string s;
  cin >> k;
  cin >> s;
  if(s.size()<=k){
    cout << s << endl;
  }
  else{
    for(int i=0; i<k; i++){
      cout << s.at(i);
    }
    cout << "..." << endl;
  }
}


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

using namespace std;

int main(void){
    int N;
    const long long mod = 1E9+7;
    cin >> N;
    map<string, long long> m, n;
    string s = "ACGT";
    m["****"] = 1;
    for(int i = 0; i < N; i++){
        for(auto itr = m.begin(); itr != m.end(); itr++){
            for(int j = 0; j < s.length(); j++){
                n[itr->first.substr(1, 3) + s.substr(j, 1)] += itr->second % mod;
            }
        }
        for(auto itr = n.begin(); itr != n.end(); itr++){
            string t = itr->first;
            string u = t.substr(1, 3);
            if(u == "AGC" || u == "ACG" || u == "GAC") itr->second = 0;
            if(t[0] == 'A' && t[2] == 'G' && t[3] == 'C') itr->second = 0;
            if(t[0] == 'A' && t[1] == 'G' && t[3] == 'C') itr->second = 0;
        }
        m = n;
        n.clear();
        // for(auto itr = m.begin(); itr != m.end(); itr++){
        //     cout << itr->first << " " << itr->second << endl;
        // }
        // cout << endl;
    }
    long long ans = 0;
    for(auto itr = m.begin(); itr != m.end(); itr++){
        ans += itr->second;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=3+1e5;
const int inf = 0x3f3f3f3f;

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

int D[maxn], R[maxn], L[maxn];
int top;
int n, a[maxn];
long long ans;

int main()
{

	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();

	cin >> n;

	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	top = 0;
  D[0] = 0;
	for (int i = 1; i <= n; ++i){
    while (top > 0 && a[D[top]] < a[i]) --top;
    L[i] = D[top] + 1;
    --L[i];
    D[++top] = i;
	}
	top = 0;
	D[0] = n+1;
	for (int i = n; i >= 1; --i) {
    while (top > 0 && a[D[top]] < a[i]) --top;
    R[i] = D[top] - 1;
    ++R[i];
    D[++top] = i;
	}

//	for(int i=0;i<n;++i) cout<<L[i+1]<< " "<<R[i+1]<<'\n';

	for (int i = 1; i <= n; ++i) {
    int l = L[i], r = R[i];
    int cnt = 0;
    if (l > 0) {
      --l;
      while (a[l] < a[i] && l > 0) l = L[l];
      cnt += (R[i] - i) * (L[i] - l);
    }
    if (r <= n) {
			++r;
      while (a[r] < a[i] && r <= n) r = R[r];
//      cerr<<r;
      cnt += (i - L[i]) * (r - R[i]);
    }
//		cout<<l<<" "<<r<<" "<<cnt<<'\n';;
    ans += ll(cnt) * a[i];
	}

	cout<<ans;

   return 0;
}


Measured memory_bytes: 5180
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InfiniteCoins
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int A = int.Parse(Console.ReadLine());

            if (N % 500 <= A)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 11092
import collections
N, QQ = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(N - 1)]
PX = [[int(_) for _ in input().split()] for _ in range(QQ)]
cd = collections.defaultdict
G = cd(set)
for ab in AB:
    a, b = ab
    G[a].add(b)
    G[b].add(a)
count = [0] * (N + 1)
for px in PX:
    p, x = px
    count[p] += x
ans = [0] * (N + 1)
visited = [False] * (N + 1)
visited[1] = 1
Q = [1]
while Q:
    q = Q.pop()
    for nq in G[q]:
        if not visited[nq]:
            visited[nq] = True
            Q += [nq]
            count[nq] += count[q]
print(*count[1:])


Measured memory_bytes: 169620
package main

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

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := scanInt64()
	m := int64(26)
	var ans = make([]int, 0)
	for n > 0 {
		n--
		ans = append(ans, int(n%m))
		n /= m
	}

	for i := len(ans) - 1; i >= 0; i-- {
		fmt.Print(string(ans[i] + 'a'))
	}
	fmt.Println()
}


Measured memory_bytes: 1776
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define maxn 100010
int n,k;
int a[maxn];
int main()
{
	cin>>n>>k;
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]>=k)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
 } 

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
//#include <tuple>
#include <cmath>
#include <string>
#include <vector>

#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
using namespace std;

int table[505][505];
int h, w;
vvi sol;

int main() {
	cin >> h >>w;
	
	int sum = 0;
	rep(i, h) {
		rep(j, w) {
			int x;
			cin >> x;
			table[i][j] = x;
			sum += x % 2;
		}
	}

	sum %= 2;

	int cnt = 0;


	rep(i, h) {
		rep(j, w) {
			if (table[i][j] % 2){
				if (i < h - 1) {
					cnt++;
					//table[i][j]--;
					table[i + 1][j]++;
					vi tmp{ i,j,i + 1,j };
					sol.pb(tmp);
				}
				else if(j<w-1){
					cnt++;
					//table[i][j]--;
					table[i][j + 1]++;
					vi tmp{ i,j,i,j + 1 };
					sol.pb(tmp);
				}
			
			}
		
		}
	}

	cout << cnt << "\n";
	rep(i, sol.size()) {
		rep(j, 4) {
			cout <<sol[i][j]+1;
			if (j < 3) cout << " ";
		}
		cout << "\n";
	}



	return 0;
}

Measured memory_bytes: 9904
#include<bits/stdc++.h>
#define read(x) scanf("%lld",&x)
using namespace std;
const int maxn=1e5+6;
typedef long long LL;
int main() {
    LL n,m;
    read(n);
    read(m);
    for(int i=m/n;i>=1;i--) {
        if(m%i==0) {
            LL t=m/i;
            if(t>=n){
                cout<<i<<endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int H,W,i,j;
  for(;;){
  scanf("%d %d",&H,&W);
   if(H==0 && W==0) break;
    for(j=1;j<=H;j++){
      for(i=1;i<=W;i++){
        if(j==1 || j==H ){
          printf("#");
        } else if(j !=1 && j !=H && i==1 || i==W){
          printf("#");
        } else{
          printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>

#define N_size 100000000000

using namespace std;

int main(){
    int N,D,wa=1;
    cin >> N >> D;

    int i = 1;
    while(wa < N){
        wa += 2*D;
        if(N <= wa)
            break;
        i++;
        wa++;
    }

    cout << i << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	char c;
  cin>>c;
  if(isupper(c))cout<<'A';
  else cout<<'a';
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#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 out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int a; cin >> a;
    cout << "ABC" << a << endl;

    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

#define pll pair<ll,ll>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define rep(i,n) for (int i = 0; i < n; ++i) 
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define watch(x) cout << (#x) << " is " << (x) << endl
#define sz(a) int((a).size())
#define endl '\n' // remove for interactive

const int INF = 1e9;
const ll mod = 1e9 + 7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}



void solve()
{
    string s; cin>>s;
    if(s.back() == 's') s += "es";
    else s += "s";
    cout<<s;
}

int main()
{
    // clock_t start, end;
    // start = clock();
    ios_base::sync_with_stdio(0); //cant use scanf, printf
    cin.tie(0);cout.tie(0); // no longer auto flush cout before each cin, remove for interactive
    int t = 1;
    // cin>>t;
    REP(i, 1, t)
    {
        solve();
        
    }
    // end = clock();
    // double time_taken = double(end - start) / double(CLOCKS_PER_SEC); 
    // watch(time_taken);
    ll x = INF; x++;
    return 0;
    
}



/*before sub
TEST: 0(1 by 1 too), 1, equal, -ve, bounds(random and ez)
ERR/WA: loop vars, out of bounds, endl, finish taking inputs, large doubles, larger INF, corr mod, t, early/late mod
RE: double dec, integer overflow(ll or 1LL mult)
*/





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

vector<vector<bool>> connection(8, vector<bool> (8));

int one_stroke(int tmp_node, int N, vector<bool> visited){
  bool complete = true;
  for (int i=0; i<N; i++){
    if(visited.at(i) == false){
      complete = false;
    }
  }
  if(complete){
    return 1;
  }
  
  int cnt = 0;
  for (int i=0; i<N; i++){
    if(connection.at(tmp_node).at(i)==false){continue;}
    if(visited.at(i)==true){continue;}
    
    visited.at(i) = true;
    cnt += one_stroke(i, N, visited);
    visited.at(i) = false;
  }
  return cnt;
}
    
  


int main(){
  int N, M; cin >> N >> M;
  for (int i=0; i<M; i++){
    int x, y;
    cin >> x >> y;
    connection.at(x-1).at(y-1)=connection.at(y-1).at(x-1)=true;
  }
  
  vector<bool> visited(N, false);
  visited.at(0)=true;
  cout << one_stroke(0, N, visited) << endl;
}

Measured memory_bytes: 3564
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	char O[51], E[51];
	scanf("%s%s", O, E);
	int i = 0, j = 0;

	while (1) {
		if (i < strlen(O)) {
			printf("%c", O[i]);
			i++;
		}
		if (j < strlen(E)) {
			printf("%c", E[j]);
			j++;
		}
		if (i == strlen(O) && j == strlen(E)) {
			printf("\n");
			return 0;
		}
	}

#ifdef DEBUGF
	getch();
#endif
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()

{
    int a[5],i;
    for(i=0;i<5;i++)
    {
        cin>>a[i];
    }
    for(i=0;i<5;i++)
    {
        if(a[i]==0)
        {
            cout<<i+1;
        break;
        }
    }
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <algorithm>

int main()
{
    int64_t m, ct = 0, ch = 0;
    std::string sW;
    std::getline(std::cin, sW);
    std::cin >> m;
    for (int64_t i = 0; i < m; i++)
    {
        std::string ope;
        int a, b;
        std::cin >> ope >> a >> b;
        if (ope == "print")
        {
            for (int i = a; i <= b; i++)
            {
                std::cout << sW[i];
            }
            std::cout << "\n";
        }
        else if (ope == "reverse")
        {
            for (int i = 0; i < (b - a + 1) / 2; i++)
            {
                std::swap(sW[a + i ], sW[b - i]);
            }
        }
        else if (ope == "replace")
        {
            std::string ors;
            std::cin >> ors;
            sW.erase(a , b - a + 1);
            sW.insert(a , ors);
        }
    }
    return 0;
}


Measured memory_bytes: 3172