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

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

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

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

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

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

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

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

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

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

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

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

int a[4];
long long ans = -0x3f3f3f3f3f3f3f3fll;

int main() {
	for (int i = 0; i < 4; ++i) {
		read(a[i]);
	}
	for (int i = 0; i < 2; ++i) {
		for (int j = 2; j < 4; ++j) {
			ans = std::max(ans, 1ll * a[i] * a[j]);
		}
	}
	print(ans);
}

Measured memory_bytes: 3640
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

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

const int INF=1<<29;
const double EPS=1e-9;

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


int main(){
	int n;
	cin>>n;
	cin.ignore();
	string str;
	rep(i, n){
		cin>>str;
		deque<char> train;
		train.push_back(str[0]);
		deque<char>::iterator it =train.begin();
		for(int j =1;j <str.length();j+=3){
			if(str[j]=='-'){
				it++;
				if(it==train.end())train.push_back(str[j+2]);
			}else{
				if(it==train.begin())train.push_front(str[j+2]);
				it--;
			}
		}
		while(!train.empty()){
			cout <<train.front();
			train.pop_front();
		}
		cout <<endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
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; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int n, m; cin >> n >> m;
    int left = 1, right = n;
    rep(i, m)
    {
        int a, b; cin >> a >> b;
        left = max(left, a);
        right = min(right, b);
    }

    cout << max(right - left + 1, 0) << endl;
}

Measured memory_bytes: 384
#include<stdio.h>
int main ()
{
    int n,h,w;
    int i,j;
    int max;
    scanf("%d%d%d",&h,&w,&n);
    if(h>w) max=h;
    else max=w;
    if(n%max==0) i=n/max;
    else i=n/max+1;
    printf("%d",i);
	return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    s, t = rl()
    a, b = rli()
    u = input()
    if u == s:
        print(a-1, b)
    else:
        print(a, b-1)


if __name__ == '__main__':
    main()


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

int a,b,c,d;

int main(){
  cin>>a>>b>>c>>d;
  
  if ( a+b > c+d ){
    cout<<"Left"<<endl;
  }
  
  else if ( a+b < c+d ){
    cout<<"Right"<<endl;
  }
  
  else{
    cout<<"Balanced"<<endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll r;
    cin>>r;
    if(r<1200)cout<<"ABC";
    else if(r<2800)cout<<"ARC";
    else cout<<"AGC";
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
using namespace std;

int main() {

int a,b,c,j,n,x;

while(true){

j=0;

cin >> n >> x;

if(n==0 && x==0){break;}

for(a=1;a<=n-2;++a){
for(b=a+1;b<=n-1;++b){
for(c=b+1;c<=n;++c){
if(a+b+c==x){
++j;
}
}
}
}

cout << j << endl;
}

}


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

typedef long long ll;

using namespace std;

int main()

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

    int n, ans = 0;

    cin >> n;

    for (int i = 1; i <= n; i++) {

        if (to_string(i).size()%2) ans++;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using ll = long long int;
using namespace std;

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> pluss;
    vector<ll> minuss;
    vector<ll> zeros;
    for(ll i=0; i<n; ++i){
        ll a; cin >> a;
        if(a < 0){ minuss.push_back(a); }
        else if(a == 0){ zeros.push_back(a); }
        else{ pluss.push_back(a); }
    }
    sort(pluss.begin(), pluss.end());
    sort(minuss.begin(), minuss.end());

    ll p_len = pluss.size();
    ll m_len = minuss.size();
    ll z_len = zeros.size();

    ll minus_num = p_len * m_len;
    ll zeros_num = z_len * (z_len - 1LL) / 2LL + z_len * (m_len + p_len);

    ll l = -(ll)1e18 - 10LL; ll r = (ll)1e18 + 10LL;
    while(r - l > 1LL){
        ll mid = (l + r) / 2LL;
        ll cnt = 0LL;
        if(mid > 0LL){
            ll ret = 0;
            for(ll i=0; i<(ll)pluss.size(); ++i){
                ret += upper_bound(pluss.begin(), pluss.end(), mid / pluss[i]) - pluss.begin(); 
                if(pluss[i] * pluss[i] <= mid){ ret -= 1LL; }
            }
            cnt += ret / 2LL;
            ret = 0LL;
            for(ll i=0; i<(ll)minuss.size(); ++i){
                ret += m_len - (ll)(lower_bound(minuss.begin(), minuss.end(), mid / minuss[i]) - minuss.begin()); 
                if(minuss[i] * minuss[i] <= mid){ ret -= 1LL; }
            }
            cnt += ret / 2LL;
            cnt += minus_num;
            cnt += zeros_num;
        }
        else if(mid == 0LL){
            cnt += minus_num;
            cnt += zeros_num;
        }
        else{
            for(ll i=0; i<(ll)pluss.size(); ++i){
                cnt += upper_bound(minuss.begin(), minuss.end(), (mid - pluss[i] + 1) / pluss[i]) - minuss.begin();
            }
        }
        if (cnt >= k){
            r = mid;
        }
        else{
            l = mid;
        }
    }
    cout << r << endl;
}

Measured memory_bytes: 2548
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
  return a * b // gcd(a, b)

A, B, C, D = [int(s) for s in input().split()]
E = B-B//C-B//D+B//lcm(C,D)
Ap = A-1
F = Ap-Ap//C-Ap//D+Ap//lcm(C,D)
print(E-F)

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

int main(){
  int X,Y,Z, K, S, counter;
  counter = 0;
  cin >> K >> S;
  for(X = 0;X<=K;X++){
    for(Y = 0;Y<=K;Y++){
      if(0<=S-X-Y&&S-X-Y<=K)counter+=1;
    }
  }
  cout << counter << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
string str;
long long cnt(int j) {
    const int n = str.size();
    char ch = str[j];
    char a, b;
    if (ch == 'R') a = 'G', b = 'B';
    else if (ch == 'G') a = 'R', b = 'B';
    else if (ch == 'B') a = 'R', b = 'G';
    int cntla = 0, cntlb = 0, cntra = 0, cntrb = 0;
    for (int i = 0; i < j; ++i) {
        if (str[i] == a) ++cntla;
        else if (str[i] == b) ++cntlb;
    }
    for (int i = j + 1; i < n; ++i) {
        if (str[i] == a) ++cntra;
        else if (str[i] == b) ++cntrb;
    }
    long long ans = cntla * cntrb + cntlb * cntra;
    int minn = min(j, n - 1 - j);
    for (int len = 1; len <= minn; ++len) {
        if (str[j - len] != str[j + len] && str[j] != str[j - len] && str[j] != str[j + len])
            --ans;
    }
    return ans;
}
int main() {
    int dummy;
    cin >> dummy;
    cin >> str;
    long long ans = 0;
    for (int j = 1; j < str.size(); ++j)
        ans += cnt(j);//以j为中心
    cout << ans << endl;
    return 0;
} 


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, str s) {
	/*if (depth == n) {
		ans.push_back(s);
		return false;
	}
	for (int i = 0; i < n; i++) {
		if (dfs(depth + 1, s + dic.at(i))) {
			return true;
		}
	}*/
	return false;
}


int main() {
	int n; cin >> n;
	cout << (n % 2 == 0 ? n / 2 : n / 2 + 1) << endl;


	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define N 1000010
char s[N],t[N];
queue<int>q;
int n,ans;
int main(){
	cin>>n>>s>>t;
	if(!strcmp(s,t)){
		puts("0");
		return 0;
	}
	int u=n-1,d=u;
	while(d>=0){
		while(d&&t[d-1]==t[d])d--;
		while(u>=0&&(u>d||s[u]!=t[d]))u--;
		if(u<0){
			puts("-1");
			return 0;
		}
		while(!q.empty()&&q.front()-q.size()>=d)q.pop();
		if(u!=d)q.push(u);
		ans=max(ans,(int)q.size()+1);
		d--;
	}
	cout<<ans;
}

Measured memory_bytes: 6272
n, x, y = map(int, input().split())
ans = [0]*(n-1)
for i in range(1, n):
    for j in range(i+1, n+1):
        ans[min(j-i, abs(i-x)+abs(j-y)+1)-1] += 1

for i in ans:
    print(i)


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

int main() {
  int N;
  cin >> N;
  int max_n = 100000;
  int n = N / 2;
  pair<int, int> odd[max_n];
  pair<int, int> even[max_n];
  for (int i = 0; i < n; i ++) {
    int o, e;
    cin >> o >> e;
    odd[o].first ++;
    even[e].first ++;
    odd[o].second = o;
    even[e].second = e;
  }

  sort(odd, odd + max_n);
  reverse(odd, odd + max_n);
  sort(even, even + max_n);
  reverse(even, even + max_n);
  int ans;
  if (odd[0].second == even[0].second) {
    int a = (n - odd[0].first) + (n - even[1].first);
    int b = (n - odd[1].first) + (n - even[0].first);
    ans = min(a, b);
  } else {
    ans = (n - odd[0].first) + (n - even[0].first);
  }

  cout << ans << endl;
}


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

using namespace std;

using llong = long long int;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000007;
const static int INF = 1<<30;
const static int dx[4] = {1, 0, -1, 0};
const static int dy[4] = {0, 1, 0, -1};

template<typename S, typename T, typename U> 
map<S, T> factorization(U p) {
    map<S, T> M;
    U i = 2;
    while (i * i <= p) {
        if (p % i == 0) {
            ++M[i];
            p /= i;
        } else {
            ++i;
        }
    }

    if (p != 1) ++M[p];

    return M;
}

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

    llong n;
    cin >> n;
    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }

    map<int, int> M = factorization<int, int, llong>(n);

    vector<int> sum(100);
    sum[0] = 0;
    for (int i = 0; i < 100; ++i) {
        sum[i + 1] = sum[i] + i + 1;
    }

    int ans = 0;
    int resi = 0;
    int cnt = 0;
    stl_rep(itr, M) {
        // cout << itr->first << ' ' << itr->second << endl;
        ans += upper_bound(all(sum), itr->second) - sum.begin() - 1;
        // cout << ans << endl;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3620
s = int(input())
a = [s]
while True:
  if a[-1] % 2 == 0:
    a.append(int(a[-1] / 2))
  else:
    a.append(a[-1] * 3 + 1)
  if a[-1] in a[:-1]:
    print(len(a))
    break

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

void solve(long long N, std::vector<long long> P){
    set<ll> s;
    s.insert(-1);
    s.insert(N);
    map<ll,ll> mp;
    for(int i=0;i<N;i++){
        mp[P[i]] =i;
    }
    s.insert(mp[N]);
    ll ans =0;
    for(int i=N-1;i>0;--i){
        ll t = mp[i];
        auto itr = s.upper_bound(t);
        // cerr <<"t=" <<t  <<"*itr=" << *itr << endl;
        ll r1 = *itr;
        itr++;
        ll r2;
        if(itr == s.end()){
            r2 = r1;
        }else{
            r2 = *itr;
        }
        itr = s.upper_bound(t);
        itr--;
        ll l1 = *itr;
        ll l2;
        if(itr == s.begin()){
            l2 = l1;
        }else{
            itr--;
            l2 = *itr;
        }
        // cerr <<"r2= " << r2 <<"r1="<<r1 << endl;
        // cerr <<"l1= "<<l1 <<"l2=" << l2 << endl;
        ll rightV = (r2-r1) *(t-l1);
        ll leftV = (l1-l2) * (r1-t);
        // cerr <<"rightV=" << rightV <<"leftV=" << leftV << endl;
        ans += (rightV+leftV)*i;
        s.insert(t);
    }
    cout << ans << endl;

}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    solve(N, std::move(P));
    return 0;
}


Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll MOD2=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI = 2.0*acos(0);

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 (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

void solve(){
    int N; cin>>N;
    vector<int> a(N),cnt(N,0);
    for (int i = 0; i < N-1; ++i) {
        cin>>a[i];
        cnt[a[i]-1]++;
    }
    for (int i = 0; i < N; ++i) {
        cout<<cnt[i]<<"\n";
    }
}

//#define MULTI
int main() {
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve();
#endif
    return 0;
}


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

using namespace std;

int a[105];

int main ()
{
int n, x;
cin >> n >> x;
for(int i = 0 ; i < n ; ++i){
	cin >> a[i];
}
sort(a, a + n);
int sol = 0;
for(int i = 0 ; i < n ; ++i){
	if(x - a[i] < 0)
		break;
	x -= a[i];
	sol++;
}
sol -= (x > 0 && sol == n);
cout << sol << endl;

return 0;
}


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

int main()
{
  string s;
  cin >> s;
  string ans = "Yes";
  for (int i = 0; i < int(s.length()); i++) {
    if (i % 2 == 0) {
      if (s[i] == 'L') {
        ans = "No";
        break;
      }
    } else {
      if (s[i] == 'R') {
        ans = "No";
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

/*
using PAIR = pair<string, int>;
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second
#define debug_() cerr << "AAAAA" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;

using Graph = vector<vector<int>>;
using P = pair<int, int>;

int main()
{

    string s;
    cin >> s;
    if (s <= "2019/04/30")
    {
        cout << "Heisei" << endl;
    }
    else
    {
        cout << "TBD" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int K,N;
  cin>>K>>N;
  int A[N];
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  sort(A,A+N);
  reverse(A,A+N);
  int distance=K-A[0]+A[N-1];
  for(int i=0;i<N-1;i++){
    if(distance<A[i]-A[i+1]){
      distance=A[i]-A[i+1];
    }
  }
  int ans=K-distance;
  
  printf("%d",ans);
}


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

int main(){
	int a;
	int b[10];
	cin>>a;
	
	for(int j=0;j<a;j++){
		
			int flg=0;
			
	for(int i=0;i<10;i++){
		cin>>b[i];
		}
		
		stack<int>ta,tb;
		ta.push(b[0]);
		tb.push(0);
		
		for(int k=1;k<10;k++){
			if(b[k]>ta.top()){ta.push(b[k]);}
			else if(b[k]>tb.top()){tb.push(b[k]);}
			else{
				flg++;
				break;
				}
			}
			if(flg==0){cout<<"YES"<<endl;}
			else{cout<<"NO"<<endl;}
		}
		return 0;
	}

Measured memory_bytes: 2980
import java.util.*;

public class Main{
    public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String a[] ={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    for(int i=0; i<7; i++){
	if(a[i].equals(S)){
	    System.out.println(7-i);
	}
    }
    }
}


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

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define PB push_back
#define F first
#define S second

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

#define MAX 10000007

int h, w, k;

vector<string> grid;

ll solve(int bit){
    bitset<10> b(bit);

    ll ans = b.count();

    vi cnt(b.count()+1, 0);
    for(int j = 0; j < w; j++){
        bool ok = true;
        int idx = 0;
        for(int i = 0; i < h; i++){
            cnt[idx] += (grid[i][j] == '1');
            if(cnt[idx] > k) ok = false;
            if(b[i]) idx++;
        }
        if(!ok){
            ans++;
            idx = 0;
            //clean
            for(auto& c : cnt) c = 0;

            bool ok = true;
            for(int i = 0; i < h; i++){
                cnt[idx] += (grid[i][j] == '1');
                if(cnt[idx] > k) ok = false;
                if(b[i]) idx++;
            }
            if(!ok) return 1e15;
        }

    }

   // cout << b << ' ' << ans << '\n';
    return ans;
}

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

    cin >> h >> w >> k;
    grid.resize(h);
    FOR(i, h) cin >> grid[i];

    ll ans = 1e15;
    for(int i = 0; i < (1<<h); i++){
        ans = min(ans, solve(i));
    }

    cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int w, h, x, y, r;
  scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
  if((x-r >= 0) && (x+r <= w) && (y-r >= 0) && (y+r <= h))
    puts("Yes");
  else
    puts("No");
  return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

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

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    ll n; cin >> n;
    ll sum = 0;
    ll div = n*(n+1)/2;
    vector<ll> a(n); rep(i,n) cin >> a[i], sum += a[i];
    if(sum%div != 0){ cout << "NO" << endl; return 0; }
    ll num = sum / div;
    ll count = 0;
    rep(i,n){
        ll k = a[(i+1)%n] - a[i];
        k -= num;
        k *= -1;
        if(k < 0 || k%n != 0){ cout << "NO" << endl; return 0; }
        count += k/n;
    }
    cout << (num == count ? "YES" : "NO") << endl;
}

Measured memory_bytes: 4024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int n, q;
string s;
vector<vector<char>> ope;

bool IsOK(bool first, int index) {
    for (int i = 0; i < q; i++) {
        if (s[index] == ope[i][0]) index += ope[i][1] == 'L' ? -1 : 1;
        if (index < 0 || n <= index)break;
    }
    if (first)return index >= 0;
    return index < n;
}

int Bin(bool first) {
    int ng = first ? -1 : n;
    int ok = first ? n : -1;

    while (abs(ok - ng) > 1) {
        int mid = ng + (ok - ng) / 2;

        if (IsOK(first, mid)) ok = mid;
        else ng = mid;
    }

    return ok;
}

int main() {
    cin >> n >> q >> s;

    ope = vector<vector<char>>(q, vector<char>(2));
    for (int i = 0; i < q; i++)cin >> ope[i][0] >> ope[i][1];

    cout << Bin(false) - Bin(true) + 1 << endl;
    return 0;
}

Measured memory_bytes: 11396
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int len[300005];
vector<int> vec[300005];

int main()
{
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	if(LL(a) * b < n || a + b - 1 > n) printf("-1\n");
	else {
		rep(i, a) len[i] = b;
		LL exd = LL(a) * b - n;
		rep(i, a) {
			len[i] -= min(exd, b - 1LL);
			exd -= min(exd, b - 1LL);
		}
		int cur = 0;
		rep(i, a) {
			rep(j, len[i]) vec[i].push_back(++ cur);
			reverse(vec[i].begin(), vec[i].end());
		}
		rep(i, a) rep(j, len[i]) printf("%d ", vec[i][j]);
	}
	return 0;
}

Measured memory_bytes: 18432
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
   //   String[] nyu=sc.nextLine().split(" ");

     String nyu=sc.nextLine();
//int[] num=new int[6];
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);
int C=Integer.parseInt(nyu);
//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);

switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}


	}
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
int main(){
  string n;cin>>n;
  for(int i=0;i<n.size();i++){
    if(n[i]=='1'){
      n[i]='9';
    }else if(n[i]=='9'){
      n[i]='1';
    }
  }
  cout<<n<<endl;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
int a[60], b[60];
int can[60][60];
int f[60][60];

int func(int u, int v, ll mask)
{
	if (f[u][v] != -1) {
		return f[u][v];
	}

	f[u][v] = can[u][v];

	rep(i, 60) if ((mask >> i) & 1) {
		int t = func(u % i, v, mask);
		if (t != 114514) {
			f[u][v] = min(f[u][v], t);
		}
	}

	return f[u][v];
}

int main() {
	cin >> N;
	rep(i, N) cin >> a[i];
	rep(i, N) cin >> b[i];

	rep(i, 60) {
		rep(j, 60) {
			can[i][j] = 114514;
		}
	}

	for (int i = 0; i < 60; ++i) {
		for (int j = 0; j < 60; ++j) {
			if (i == j) can[i][j] = 0;
			for (int k = 1; k < 60; ++k) {
				if (i % k == j) {
					can[i][j] = min(can[i][j], k);
				}
			}
		}
	}

	rep(k, 60) {
		rep(i, 60) {
			rep(j, 60) {
				can[i][j] = min(can[i][j], max(can[i][k], can[k][j]));
			}
		}
	}

	ll ret = 0;

	for (int k = 60; k >= 1; --k) {
		int mn = 0;
		memset(f, -1, sizeof(f));

		rep(i, N) {
			mn = max(mn, func(a[i], b[i], ret));
		}

		if (mn == 114514) {
			puts("-1");
			return 0;
		} else if (mn == k) {
			ret += (1LL << k);
		}
	}

	rep(i, N) if (func(a[i], b[i], ret) == 114514) {
		puts("-1");
		return 0;
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define SortAsc(c) std::sort(c.begin(), c.end())
#define SortDesc(c) std::sort(c.rbegin(), c.rend())
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};

int main() {
  int N;
  cin >> N;
  vector<vector<int>> a(N);
  for (int i = 1; i < N; i++) {
    int p;
    cin >> p;
    a.at(p - 1).push_back(i);
  }

  for (int i = 0; i < N; i++) {
    cout << a.at(i).size() << endl;
  }
}

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

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

    ll n;
    cin >> n;
    vector<int> a(n);
    ll mx_a = 0;
    ll mx_idx = -1;
    rep(i, n){
        cin >> a[i];
        if(a[i] > mx_a){
            mx_a = a[i];
            mx_idx = i;
        }
    }

    ll min_val = 1001001001;
    ll min_idx = -1;
    rep(i, n){
        if(i == mx_idx) continue;
        if(abs(mx_a - 2*a[i]) < min_val){
            min_val = abs(mx_a - 2*a[i]);
            min_idx = i;
        }
    }

    cout << mx_a << " " << a[min_idx] << endl;



    return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
LL z = 1;
int read(){
	int x, f = 1;
	char ch;
	while(ch = getchar(), ch < '0' || ch > '9') if(ch == '-') f = -1;
	x = ch - '0';
	while(ch = getchar(), ch >= '0' && ch <= '9') x = x * 10 + ch - 48;
	return x * f;
}
int ksm(int a, int b, int p){
	int s = 1;
	while(b){
		if(b & 1) s = z * s * a % p;
		a = z * a * a % p;
		b >>= 1;
	}
	return s;
}
int v[15], a[15];
char s[15];
int pd(int x){
	int i;
	while(x){
		i = x % 10;
		x /= 10;
		if(v[i]) return 0;
	}
	return 1;
}
int main(){
	int i, j, t, n, m, flag = 0;
	n = read();
	m = read();
	for(i = 1; i <= m; i++){
		j = read();
		v[j] = 1;
	}
	for(i = n; i <= 100000; i++){
		if(pd(i)){
			printf("%d", i);
			return 0;
		}
	}
	return 0;
}


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

using namespace std;

int main()
{
    map<int,int>m;
    int a[3];
    int maks=0;
    for(int i=0;i<3;i++)
    {
        cin>>a[i];
        m[a[i]]++;
        if(m[a[i]]>maks)
        {
            maks=m[a[i]];
        }
    }
    if(maks==2)
    {
        cout<<"Yes"<<endl;
    }else
    {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	LL k;
	pair<LL,LL> p[3],d[3];
	cin>>p[0].st>>p[1].st>>p[2].st>>k;
	for(int i=0;i<3;++i)
		p[i].nd=i;
	sort(p,p+3);
	p[1].st-=p[0].st; p[2].st-=p[0].st; p[0].st=0;
	d[0]=p[0]; d[1]=p[1]; d[2]=p[2];
	if(k%2==1) {
		d[0].st=p[2].st; d[1].st=p[2].st-p[1].st; d[2].st=0;
		//cout<<d[0].st<<" "<<d[1].st<<" "<<d[2].st<<endl;
	}
	LL ans=0;
	for(int i=0;i<3;++i)
		if(d[i].nd==0) ans+=d[i].st;
		else if(d[i].nd==1) ans-=d[i].st;
	cout<<ans<<endl;

}

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

int main(){
  int a, b, c;
  int x, y;
  cin >> a >> b >> c;
  x = b;
  b = a;
  a = x;
  y = c;
  c = a;
  a = y;
  cout << a << " " << b << " " << c;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		if (x.charAt(0) < y.charAt(0)) {
			System.out.println("<");
		} else if (x.charAt(0) > y.charAt(0)) {
			System.out.println(">");
		}  else {
			System.out.println("=");
		}
		}
	}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
static const ll LOGN=55;




int main(void) {
  ll H, W;
  cin >> H >> W;
  ll i, j;
  ll a[555][555];
  
  
  
  for(i=0; i<H; i++) {
    for(j=0; j<W; j++) {
      cin >> a[i][j];
      a[i][j]%=2;
    }
  }
  
  vector<pair<P, P>> v;
  ll f=0;
  for(i=0; i<H; i++) {
    
    if((i&1)==0) {
      for(j=0; j<W-1; j++) {
        
        if(a[i][j]==1) {
          a[i][j]--;
          a[i][j+1]++;
          v.push_back({{i, j}, {i, j+1}});
        }else if(a[i][j]==2) {
          a[i][j]=0;
        }
        
      }
      
      if(i<H-1 && a[i][W-1]==1) {
        a[i][W-1]--;
        a[i+1][W-1]++;
        v.push_back({{i, W-1}, {i+1, W-1}});
      }
      
    }else {
      
      for(j=W-1; j>0; j--) {
        
        if(a[i][j]==1) {
          a[i][j]--;
          a[i][j-1]++;
          v.push_back({{i, j}, {i, j-1}});
        }else if(a[i][j]==2) {
          a[i][j]=0;
        }
        
      }
      
      if(i<H-1 && a[i][0]==1) {
        a[i][0]--;
        a[i+1][0]++;
        v.push_back({{i, 0}, {i+1, 0}});
      }
      
    }
    
    
  }
  
  pt(v.size());
  for(i=0; i<v.size(); i++) {
    cout << v[i].first.first+1 <<" "<<v[i].first.second+1  << " ";
    cout << v[i].second.first+1<<" "<<v[i].second.second+1 << endl;
  }
  
  
  
  
}






Measured memory_bytes: 8688
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
  ll N,m=1e9;
  cin>>N;
  ll a[N];
  for(ll i=0;i<N;i++) cin>>a[i];
  sort(a,a+N);
 
  for(ll i=a[0];i<=a[N-1];i++){
    ll x=0;
    for(ll j=0;j<N;j++){
      ll y=(i-a[j])*(i-a[j]);
      x+=y;
    }
    m=min(m,x);
  }
  cout<<m<<endl;
}


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

ll calc(string s)
{
  int len = s.length();
  ll ret = stoll(s);
  for (int i=1; i<len; i++) {
    string sl = s.substr(0, i);
    ret += stoll(sl) * pow(2, (len-i-1));
    string sr = s.substr(i, len-1);
    ret += calc(sr);
  }
  return ret;
}

int main()
{
  string s;
  cin >> s;
  cout << calc(s) << endl;

  return 0;
}

Measured memory_bytes: 4000
function factorial(num) {
  if (num === 1) {
    return 1;
  } else {
    return num * factorial(num - 1);
  }
}

function Main(input) {
  var N = input[0].trim();
  var x = [];
  var y = [];
  for (var i = 0; i < N; i++) {
    var tmp = input[i + 1].split(" ");
    x[i] = parseInt(tmp[0], 10);
    y[i] = parseInt(tmp[1], 10);
  }

  var kyori = 0;
  for (var u = 0; u < N; u++) {
    for (var v = 0; v < N; v++) {
      if (u != v) {
        var z = Math.sqrt(
          (x[u] - x[v]) * (x[u] - x[v]) + (y[u] - y[v]) * (y[u] - y[v])
        );
        // console.log("u:%s v:%s %s", u, v, z);
        kyori += z;
      }
    }
  }

  var all = factorial(N);
//   console.log("%s", all);
//   console.log("%s", kyori);
  console.log("%s", (kyori * (all/N) )/ all);
}

Main(
  require("fs")
    .readFileSync("/dev/stdin", "utf8")
    .split("\n")
);


Measured memory_bytes: 21064
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		int nam  = in.nextInt();
      	int nam2 = in.nextInt();
      	int min =  Math.min(nam,nam2);
      	int K    = in.nextInt();
      	int KK[] = new int[min+1];
      
      int cnt = 0;
      for(int i = 1;i <= min ;i++){
        if(nam % i==0 && nam2 % i==0){
        	cnt++;
          	KK[cnt] = i;
          }
        }
      
  		System.out.print(KK[cnt-K+1]);
      
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include<cxxabi.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define TYPEVS(x) typeid(x).name()
#define TYPEGC(x) abi::__cxa_demangle(typeid(x).name(), 0, 0, 0)
#define Y1 "YES"
#define N1 "NO"
#define ENDL '\n'
#define count2(x) _builtin_popcount(x)
int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();++i){
		if(s[i]!='?')
		cout<<s[i];
		else
		cout<<'D';
	}
}


Measured memory_bytes: 3716
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#define maxn 100005

using namespace std;
typedef long long ll;
const int mod = 1000000007;
int n;
bool st[maxn << 1];
string s;

int main(){
  ios :: sync_with_stdio(false);
  cin >> n >> s;
  ll cur = 0, ans = 1;
  for(int i = 0;i < (n << 1);i++){
    if(s[i] == 'W') st[i] = (cur & 1);
    else st[i] = !(cur & 1);
    cur += (st[i] ? 1 : -1);
    if(cur < 0){
      cout << "0" << endl;
      return 0;
    }
  }
  if(cur){
    cout << "0" << endl;
    return 0;
  }
  cur = 0;
  for(int i = 0;i < (n << 1);i++){
    if(!st[i]) (ans *= cur) %= mod;
    cur += (st[i] ? 1 : -1);
  }
  for(int i = 1;i <= n;i++) (ans *= i) %= mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 788
/**
 *      ABC 82 A
 *      author  : kyomukyomupurin
 *      created : 2018-09-02 04:13:01
**/

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b; cin >> a >> b;
    (a + b) % 2 == 0 ? cout << (a + b) / 2 : cout << (a + b) / 2 + 1;
    return 0;
}



Measured memory_bytes: 256
// int型のオーバーフローに注意
// 文字列の比較は==ではなく.equalsを使おう
// Stringの入力はnext();が丸い

import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		    Scanner sc = new Scanner(System.in);

		    int n = sc.nextInt();
		    long[] luca = new long[87];
		    
		    luca[0] = 2;
		    luca[1] = 1;
		    for(int i = 2; i < 87; i++) {
		    	luca[i] = luca[i-1] + luca[i-2];
		    }
		    System.out.println(luca[n]);
		    
		    sc.close(); }

	public static  int gcd(int a, int b) {
	    if (a < b) {
	        int tmp = a;
	        a = b;
	        b = tmp;
	    }

	    int r = -1;
	    while (r != 0) {
	        r = a % b;
	        a = b;
	        b = r;
	    }

	    return a;
	}
}


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

int main() {
  int N, K;
  string S;
  cin >> N >> S >> K;
  for (int i = 0; i < N; i++) {
    if (S.at(i) != S.at(K - 1)) cout << '*';
    else cout << S.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 3592
import sys
 
stdin = sys.stdin

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n, mw = na()
wv = [na() for i in range(n)]
w = [wv[i][0] for i in range(n)]
v = [wv[i][1] for i in range(n)]
dp = [(mw + 1) * [0] for i in range(n + 1)]

for i in range(n):
    for j in range(mw + 1):
        if j < w[i]:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i])

print(dp[n][mw])


Measured memory_bytes: 120044
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using psi=pair<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD ((ll)1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
template<class T>void geti(T&a){for(auto&_:a)cin>>_;}
template<class T>void getii(T&a){for(auto&_:a)geti(_);}
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__)
#define dclt(t,...) t __VA_ARGS__;get(__VA_ARGS__)


 
class Eratosthenes{
  public:
    int n, sqlim;
    vector<bool> prime;
    Eratosthenes(int N):n(N+1){
        sqlim=(int)ceil(sqrt(n));
        prime=vector<bool>(n,1); prime[0]=prime[1]=0;
        for(int i=2;i<=sqlim;i++) if(prime[i]) for(int j=i*i;j<=n;j+=i) prime[j]=0;}
    vector<int> primeArray(int s=0, int l=1000){vi ret; for(int i=s;ret.size()!=l;i++) if(prime[i]) ret.push_back(i); return ret;}
};


int main(){
	dcl(n);
	map<int,int> mp;
	vi divide=Eratosthenes(1000).primeArray();
	range(i,1,n+1){
	    int p=i;
	    for(auto d:divide){
	        while(p%d==0){
	            p/=d;
	            if(mp.find(d)==mp.end()){
	                mp[d]=0;
	            }
	            mp[d]++;
	        }
	    }
	}
	ll ans=1;
	for(auto m:mp){
	    ans=ans*(m.sc+1)%MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265358979323846
#define MOD 1000000007
using namespace std;
using ll = long long;

const int MAX = 1000000;

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

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

template <class T> struct cord{
  T x,y;
};

template <class T> double dist(cord<T> a, cord<T> b){
  T dx=a.x-b.x;
  T dy=a.y-b.y;
  return sqrt(dx*dx+dy*dy);
}

int main()
{

  //cout << fixed << setprecision(10);
  
  int x,a,b; cin >> x >> a >> b;
  cout << x - a - (x-a)/b * b;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
tmps = input()
max_val = 1
Sdic = {tmps:1}
max_string = [tmps]
for i in range(1, N):
    tmps = input()
    if tmps in Sdic:
        Sdic[tmps] += 1
    else:
        Sdic[tmps] = 1

    if Sdic[tmps] > max_val:
        max_val = Sdic[tmps]
        max_string = [tmps]
    elif Sdic[tmps] == max_val:
        max_string.append(tmps)
max_string.sort()
for string in max_string:
    print(string)

Measured memory_bytes: 33416
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

class KnuthMorrisPratt
{
private:
    int n;
    string pattern;
    vector<int> failure;
public:
    KnuthMorrisPratt(const string& pattern){
        n = pattern.size();
        this->pattern = pattern;
        failure.assign(n+1, 0);
        for(int i=0; i<n; ++i){
            int j = i;
            while(j != 0){
                if(pattern[failure[j]] == pattern[i]){
                    failure[i+1] = failure[j] + 1;
                    break;
                }
                j = failure[j];
            }
        }
    }
    int transition(int curr, char c){
        if(curr < n && pattern[curr] == c)
            return curr + 1;
        if(curr == 0)
            return 0;
        return transition(failure[curr], c);
    }
};

int main()
{
    string s, t;
    cin >> s >> t;

    KnuthMorrisPratt kmp(t);
    int n = max(s.size(), t.size());
    vector<int> dp(3*n+1, 0);
    int curr = 0;
    for(int i=0; i<3*n; ++i){
        curr = kmp.transition(curr, s[i%s.size()]);
        if(curr == t.size())
            dp[i+1] = dp[i+1-t.size()] + 1;
    }

    int ans = *max_element(dp.begin(), dp.end());
    if(ans * t.size() >= 2 * n)
        ans = -1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9608
N=int(input())
d={}
mod=10**9+7
from itertools import product
import re
for t in product('ATGC',repeat=3):
    s=''.join(t)
    d[s]=[0]*(N-2)
    d[s][0]=0 if s in ['AGC','ACG','GAC'] else 1
p=re.compile('.AGC|.ACG|.GAC|A.GC|AG.C')
for i in range(N-3):
    for t in product('ATGC',repeat=3):
        for c in 'ATGC':
            s=''.join(t)+c
            if p.search(s)==None:
                d[s[1:]][i+1]=(d[s[1:]][i+1]+d[s[:-1]][i])%mod
print(sum([i[-1] for i in d.values()])%mod)

Measured memory_bytes: 3444
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>
#include<functional>
#include<unordered_set>
#include<unordered_map>
#include<atcoder/all>

using ll=long long;

using namespace std;
int main()
{
	ll N, Q;
	cin >> N >> Q;

	atcoder::dsu uf(N);
	for (auto i = 0LL; i < Q; i++) {
		ll t, u, v;
		cin >> t >> u >> v;
		if (t == 0) {
			uf.merge(u, v);
		}
		else {
			cout << uf.same(u, v) << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 4000
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a==b){
		cout << c << endl;
	}
	else if(b==c){
		cout << a << endl;
	}
	else{
		cout << b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First first, Rest... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

ll cnt_div(ll div, ll X, ll Y){
    ll fX = X - (X % div);
    if(fX < X) {
        fX += div;
    }
    ll fY = Y - (Y % div);
    ll res = 0;
    if(fX <= fY) {
        res = (fY - fX) / div + 1;
    }
    return res;
}

int main(){
    ll A, B, C, D;
    read(A, B, C, D);
    ll sum = B - A + 1;
    ll csum = cnt_div(C, A, B);
    ll dsum = cnt_div(D, A, B);
    ll CD = C * D / __gcd(C, D);
    ll cdsum = cnt_div(CD, A, B);
    write(sum - (csum + dsum) + cdsum);
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First first, Rest... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

Measured memory_bytes: 256