akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;

void solve() {
	ll n;
	string s;
	cin >> n >> s;

	ll right = 0, left = 0, swap = 0;
	for (ll i = 0; i < n; ++i) {
		if (s[i] == 'W') {
			++left;
		} else {
			++right;
		}
	}
	ll ans = min(right, left);

	for (ll i = 0; i < right; ++i) {
		if (s[i] == 'W') {
			++swap;
		}
	}
	ans = min(ans, swap);

	cout << ans << '\n';
}


int main()
{
	std::ios::sync_with_stdio(false);
	solve();
	return 0;
}


Measured memory_bytes: 3760
fn main(){
 loop{
  let mut b=String::new();
  let s=std::io::stdin();
  s.read_line(&mut b).unwrap();
  if b.trim()=="0"{break}
  println!("{}",b.trim().chars().map(|c|c.to_digit(10).unwrap()).sum::<u32>());
 }
}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, m, ts, tc, x=0;
  cin >> n >> m;
  vecll c(n, -1);
  
  forll(i, 0, m){
	cin >> ts >> tc;
	if(c[ts-1] != -1 && c[ts-1] != tc){
	  cout << -1 << endl;
	  return 0;
	}
	c[ts-1] = tc;
  }
  if(n == 1)
	cout << max((ll)0, c[0]) << endl;
  else if (c[0] == 0)
	cout << -1 << endl;
  else if (n == 2)
	cout << max((ll)1, c[0]) * 10 + max((ll)0, c[1]) << endl;
  else
	cout << max((ll)1, c[0]) * 100 + max((ll)0, c[1]) * 10 + max((ll)0, c[2]) << endl;
}


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

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define hash sodnf9843bsd
#define ll long long
#define INF (1<<29)
#define INFF 0x7fffffff
#define LINF (1ll<<60)
#define LINFF 0x7fffffffffffffff
#define PI 3.14159265359
#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define YESNO(ans) cout << (ans?"YES":"NO") << endl
#define prec(x) cout << fixed << setprecision(x)
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define endl '\n'

const ll maxn = 100;
const ll maxv = 100000;

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

    ll iw[maxn+7];
    int iv[maxn+7];
    int n, w;cin>>n>>w;
    _fi(n) cin>>iw[i]>>iv[i];

    ll dp[maxv+7] = {};
    for(int i = 1;i <= maxv;i++) dp[i] = LINF;
    for(int i = 0;i < n;i++){
        for(int j = maxv;j >= iv[i];j--){
            dp[j] = min(dp[j], iw[i]+dp[j-iv[i]]);
        }
    }

    ll ans = 0;
    for(int i = 0;i <= maxv;i++){
        if (dp[i] <= w) ans = i;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include<string.h>
 
using namespace std;
 
int main()
{
    string s; cin>>s; int sum=0;
  for(auto c:s)sum+=c-'0';
  if(sum%9==0)cout<<"Yes"<<endl; else cout<<"No"<<endl;
 
    return 0;
}

Measured memory_bytes: 3720
import java.util.*;
import java.io.*;

public class Main {	
	private static void solve(){
		//Implement solution here.
		int N = ni();
		int K = ni();
		int[] H = na(N);
		Arrays.sort(H);
		long result = 0;
		for(int i = 0; i < N - K; i++) result += H[i];
		System.out.println(result);
	}
	
	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}


Measured memory_bytes: 53732
t;main(a,b,c){
    long int k;
    scanf("%d%d%d%ld",&a,&b,&c,&k);
  t=k%2?b-a:a-b;
    
  printf(abs(t)>pow(10,18)?"Unfair":"%d",t);
    /*if(abs(t)>pow(10,18)){
        printf("Unfair");
    }else{
        printf("%d",t);
    }*/
}

Measured memory_bytes: 1728
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <tuple>
#include <algorithm>
#include <ctime>
#include <map>
using namespace std;


const long long MOD = static_cast<long long>(1e9+7);
const long long INFINITE = static_cast<long long>(1e16);
const bool IS_DEBUG = false;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin>>N;
    vector<int> v(N);
    int res = 0;
    for(int c=0;c<N;c++) {
        cin>>v[c];
        for(int c2=0;c2<c;c2++) {
            if(v[c]==v[c2]) continue;
            for(int c3=0;c3<c2;c3++){
                if(v[c3]==v[c]||v[c3]==v[c2]) continue;
                vector<int> z(3);
                z[0]=v[c];
                z[1]=v[c2];
                z[2]=v[c3];
                sort(z.begin(),z.end());
                if(z[0]+z[1] > z[2]) {
                    res++;
                }
            }
        }
    }
    cout<<res;
}


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

using namespace std;
using ll = long long int;

void solve()
{
	int n; cin >> n;
	int one = n%100, two = n/100;
	bool ym = 0, my = 0;
	if (one >= 0 and one <= 99 and two >= 1 and two <= 12) my = 1;
	if (two >= 0 and two <= 99 and one >= 1 and one <= 12) ym = 1;
	if (ym and my) cout << "AMBIGUOUS";
	else if (ym) cout << "YYMM";
	else if (my) cout << "MMYY";
	else cout << "NA";

}

//  ---------------------Template---------------------------
void InputSetup()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	#ifdef LOCAL
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	#endif
}

int main(void)
{
	auto start = chrono::high_resolution_clock::now();

	InputSetup();
	solve();

	auto finish = chrono::high_resolution_clock::now();
	cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
}
//  ---------------------Template---------------------------	

Measured memory_bytes: 256
a=input()
b=a.split()
d=list()
for c in b:
    d.append(int(c))
W=d[0]
H=d[1]
x=d[2]
y=d[3]
r=d[4]
if W-r>=x>=0 and H-r>=y>=0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5596
#include<stdio.h>
#define INF 2147483647
#define MAX 101
int matrixChainOrder(int *,int);
int main(){
  int i,n,r[MAX],c[MAX],p[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d",&r[i],&c[i]);
  }
  p[0]=r[0];
  for(i=1;i<=n;i++){
    p[i]=c[i-1];
  }
  printf("%d\n",matrixChainOrder(p,n));
  return 0;
}
int matrixChainOrder(int *p,int n){
  int m[MAX][MAX];
  int i,l,j,k,q;
  for(i=0;i<=n;i++) m[i][i]=0;
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=(1<<21);//1を左に21bit＝でかい値がはいる
      for(k=i;k<=j-1;k++){
	q=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
	if(m[i][j]>q) m[i][j]=q;
      }
    }
  }
  return m[1][n];
}



Measured memory_bytes: 2108
use proconio::input;
use std::cmp;

#[allow(unused_macros)]
macro_rules! multi_max {
    ( $a:expr, $b:expr ) => (std::cmp::max($a, $b));
    ( $a:expr, $b:expr, $($rest:expr),* ) => (std::cmp::max($a, multi_max![$b, $($rest),*]));
}

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    }

    let ans = multi_max!(a * c, a * d, b * c, b * d);
    println!("{}", ans);
}


Measured memory_bytes: 2128
N = int(input())
list_B = list(map(int, input().split()))

sum = 0
for i in range(N):
    if i == 0:
        sum += list_B[i]
#         print('i == 0')
#         print('i=', i, 'sum=', sum)
    elif i == N-1:
        sum += list_B[i-1]
#         print('i == N-1')
#         print(list_B[i-1])
#         print('i=', i, 'sum=', sum)
    else:
        if (list_B[i] >= list_B[i-1]):
            sum += list_B[i-1]
        else:
            sum += list_B[i]
#         print('i=', i, 'sum=', sum)
print(sum)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;

 		
int main() {

double N,T,A;
cin>>N>>T>>A;
double mini=1000000000;
int ans;
fx(N){
	int h;
	cin>>h;
	if(mini>abs(T-h*0.006-A)){
		mini=abs(T-h*0.006-A);
		ans=x+1;
	}
}
ce(ans)
}


Measured memory_bytes: 256
def resolve():
	h, w = map(int, input().split())
	s = [input() for i in range(h)]
	import numpy as np
	from collections import deque
	directions = [[0, 1], [0, -1], [1, 0], [-1, 0]] # [y軸, x軸]
	ans = 0
	for sh in range(h): # start hight
		for sw in range(w):
			if s[sh][sw] == "#":
				continue
			distance = [[-1 for j in range(w)] for i in range(h)]
			distance[sh][sw] = 0
			q = deque([[sh, sw]])
			while q:
				y, x = q.popleft()
				for i, j in directions:
					ny = y+i
					nx = x+j
					# エリア内判定
					if not ((0 <= ny < h) and (0 <= nx < w)):
						continue
					# 壁判定
					elif s[ny][nx] == "#":
						continue
					# 訪問済み判定
					elif not distance[ny][nx] == -1:
						continue
					distance[ny][nx] = distance[y][x] + 1
					q.append([ny, nx])
			ans = max(ans, np.max(distance))
	print(ans)
resolve()


Measured memory_bytes: 13000
#include <stdio.h>

int main(void){

  int n,k,x,y,sum;

  scanf("%d\n%d\n%d\n%d/n",&n,&k,&x,&y);

  if(n<=k){

    sum = x*n;

  }else{

    sum = x*k + y*(n-k);

  }

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

  return 0;

}

    

  


Measured memory_bytes: 1708
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int A = in.nextInt();
			int B = in.nextInt();
			int C = in.nextInt();
			if(A == B) {
				out.println(C);
			}else if(B == C){
				out.println(A);
			}else {
				out.println(B);
			}
		}
	}
	
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

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

using namespace std;

using int64 = long long;

int main() {
  int A, B;
  cin >> A >> B;
  bool v[100][100] = {{}};
  for(int i = 0; i < 100; i++) {
    v[i][0] = v[0][i] = v[99][i] = v[i][99] = true;
  }
  --A, --B;
  int luz = 0;

  for(int i = 97; i >= 0; i--) {
    ++luz;
    if(luz % 3 == 0) {
      continue;
    } else if(luz % 3 == 1) {
      for(int j = 2; j <= 97; j += 2) {
        if(B == 0) break;
        --B;
        v[i][j] = true;
      }
    } else {
      for(int j = 3; j <= 97; j += 2) {
        if(B == 0) break;
        --B;
        v[i][j] = true;
      }
    }
  }

  luz = 2;
  while(A > 0) {
    for(int j = 0; j <= 97; j++) {
      v[luz][j] = true;
    }
    for(int j = 2; j <= 97; j += 2) {
      if(A == 0) break;
      --A;
      v[luz - 1][j] = true;
    }
    luz += 2;
  }
  cout << 100 << " " << 100 << endl;
  for(int i = 0; i < 100; i++) {
    for(int j = 0; j < 100; j++) {
      if(v[i][j]) cout << "#";
      else cout << ".";
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
#define KOZYUN(a) SORT(a); REVERSE(a) 
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/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;}
/*約数列挙*/vector<int> getDivisor(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(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    vector<char> s(3);VIin(s);
    int ans = 0;
    rep(i,3) if(s[i] == '1') ans++;
    ANS;

    return 0;
}

Measured memory_bytes: 256
var n;
var p = [];
var t = [];
var g = [];
var u = [];
var d = [];

function index(i, j){
	return i * 3 + j;
}

function main(){
	while(n = scan()){
		rep(n, function(i){
			p[i] = scan();
			t[i] = scan();
		});
		
		rep(index(n, 0) + 2, function(i){
			g[i] = [];
		});
		if(p[0] <= t[0]){
			g[index(n, 0)].push([index(0, 0), p[0]]);
		}
		rep(3, function(i){
			g[index(n - 1, i)].push([index(n, 0) + 1, p[n - 1]]);
		});
		rep(n - 1, function(i){
			rep(3, function(j){
				var dp = Math.abs(p[i] - p[i + 1]);
				var dt = t[i + 1] - t[i];
				if(j < 2 && dp * (j + 2) <= dt){
					g[index(i, j)].push([index(i + 1, j + 1), dp]);
				}
				if(p[i] * (j + 2) + p[i + 1] <= dt){
					g[index(i, j)].push([index(i + 1, 0), p[i] + p[i + 1]]);
				}
			});
		});

		rep(index(n, 0) + 2, function(i){
			u[i] = false;
			d[i] = Infinity;
		});

		d[index(n, 0)] = 0;
		while(true){
			var v = -1;
			rep(index(n, 0) + 2, function(i){
				if(!u[i] && (v === -1 || d[i] < d[v])){
					v = i;
				}
			});

			if(v === -1){
				break;
			}

			u[v] = true;
			rep(g[v].length, function(i){
				var e = g[v][i];
				if(d[e[0]] > d[v] + e[1]){
					d[e[0]] = d[v] + e[1];
				}
			});
		}

		if(d[index(n, 0) + 1] !== Infinity){
			print('OK ' + d[index(n, 0) + 1]);
		}
		else{
			rep(n, function(i){
				var f = false;
				rep(3, function(j){
					if(d[index(i, j)] !== Infinity){
						f = true;
						return false;
					}
				});
				if(!f){
					print('NG ' + (i + 1));
					return false;
				}
			});
		}
	}
}

function rep(a, b, c, u){
	if(c === u){
		c = b;
		b = a;
		a = 0;
	}
	for(var i = a; i < b; ++i){
		if(c(i) === false){
			break;
		}
	}
}

var input = '';

function scan(){
	return +input.pop();
}
function scan_string(){
	return input.pop();
} 
function print(val){
	console.log(val);
}
 
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk){
	input += chunk;
});
process.stdin.on('end', function(){
	input = input.trim().split(/\s+/).reverse();
	main();
});

Measured memory_bytes: 18136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 1000000000
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  int H, A;
  cin >> H >> A;
  cout << (H+A-1) / A << endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rrep1(i,n) for(ll i=n;i>=1;i--)
#define FOR(i,a,b) for(ll i=a;i<b;i++)

int main(){
	ll N; cin>>N;
    map<string,ll> m;
    ll ans=0;
    rep(i,N){
        string tmp; cin>>tmp;
        sort(all(tmp));
        m[tmp]++;
    }
    for(auto it=m.bg;it!=m.ed;it++){
        ll x=it->b;
        ans+=x*(x-1)/2;
    }
    cout<<ans;
}

Measured memory_bytes: 11136
taro_spend = []
spend_num = 0

for i in range(5):
    taro_spend.append(int(input()))
    if taro_spend[i] == 0:
        taro_spend.pop()
        break
    spend_num += 1

changes = [1000 - taro_spend[i] for i in range(spend_num)]

for change in changes:
    change_coin = 0

    if change >= 500:
        change -= 500
        change_coin += 1

    if change >= 100:
        while change >= 100:
            change -= 100
            change_coin += 1
            
    if change >= 50:
        change -= 50
        change_coin += 1
        
    if change >= 10:
        while change >= 10:
            change -= 10
            change_coin += 1

    if change >= 5:
        change -= 5
        change_coin += 1

    if change >= 1:
        while change >= 1:
            change -= 1
            change_coin += 1

    print(change_coin)

Measured memory_bytes: 7820
#include<stdio.h>

int main()
{
    int x,y,z;
    scanf("%d%d",&x,&y);

    if(x<y)
    {
        z=x;
        x=y;
        y=z;
    }
    while(z=x%y)
    {
        x=y;
        y=z;
    }
    printf("%d\n",y);
}




Measured memory_bytes: 2036
from operator import add
from functools import reduce

val = input().split(' ')
h = int(val[0])
k = int(val[1])
h = sorted([int(i) for i in input().split(' ')])

remains = h[:-k] if k > 0 else h
print(reduce(add, remains) if len(remains) > 0 else 0)


Measured memory_bytes: 26524
MOD = 10**9+7
class mint:
    def __init__(self, x):
        self.x = x % MOD if isinstance(x, int) else int(x) % MOD
    def __str__(self):
        return str(self.x)
    __repr__ = __str__
    def __iadd__(self, other):
        self.x += other.x if isinstance(other, mint) else other
        self.x -= MOD if self.x >= MOD else 0
        return self
    def __isub__(self, other):
        self.x += MOD-other.x if isinstance(other, mint) else MOD-other
        self.x -= MOD if self.x >= MOD else 0
        return self
    def __imul__(self, other):
        self.x *= other.x if isinstance(other, mint) else other
        self.x %= MOD
        return self
    def __imod__(self, other):
        self.x %= other.x if isinstance(other, mint) else other
        self.x %= MOD
        return self
    def __add__(self, other):
        return (
            mint(self.x + other.x) if isinstance(other, mint) else
            mint(self.x + other)
        )
    def __sub__(self, other):
        return (
            mint(self.x - other.x) if isinstance(other, mint) else
            mint(self.x - other)
        )
    def __mul__(self, other):
        return (
            mint(self.x * other.x) if isinstance(other, mint) else
            mint(self.x * other)
        )
    def __mod__(self, other):
        return (
            mint(self.x % other.x) if isinstance(other, mint) else
            mint(self.x % other)
        )
    def __truediv__(self, other):
        return (
            mint(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, mint) else
            mint(self.x * pow(other, MOD - 2, MOD))
        )
    def __pow__(self, other):
        return (
            mint(pow(self.x, other.x, MOD)) if isinstance(other, mint) else
            mint(pow(self.x, other, MOD))
        )
    __radd__ = __add__
    def __rsub__(self, other):
        return (
            mint(other.x - self.x) if isinstance(other, mint) else
            mint(other - self.x)
        )
    __rmul__ = __mul__
    def __rmod__(self, other):
        return (
            mint(other.x % self.x) if isinstance(other, mint) else
            mint(other % self.x)
        )
    def __rtruediv__(self, other):
        return (
            mint(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, mint) else
            mint(other * pow(self.x, MOD - 2, MOD))
        )
    def __rpow__(self, other):
        return (
            mint(pow(other.x, self.x, MOD)) if isinstance(other, mint) else
            mint(pow(other, self.x, MOD))
        )

n = int(input())
c = list(map(int, input().split()))
c.sort()
ans=mint(0)
mn=mint(n)
for i in range(n):
    r=mint(n-i-1)
    l=mint(i)
    if r.x>0:
        ans+=(2**r+2**(r-1)*r)*2**l*2**mn*c[i]
    else:
        ans+=2**l*2**mn*c[i]

print(ans)




Measured memory_bytes: 90952
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;

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

int64_t Count(int64_t A, int64_t B, int64_t C) {
  int64_t low = A / C + (A % C == 0 ? 0 : 1);
  int64_t high = B / C;
  return high - low + 1;
}

int main() {
  int64_t A, B, C, D;
  cin >> A >> B >> C >> D;
  int64_t cntC = Count(A, B, C);
  int64_t cntD = Count(A, B, D);
  int64_t Z = C * D / gcd(C, D);
  int64_t cntZ = Count(A, B, Z);
  cout << (B - A + 1) - cntC - cntD + cntZ << endl;
  return 0;
}


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

using namespace std;
/*
int f(int a, int b, int c, int k) {
  if(k == 0) return a + b + c;
  if(k == 1) return max(2*a, max(2*b, 2*c));
  return max(f(2*a, ))
}
*/
int main() {
  //int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  bool stat[60000];
  stat[0] = false; stat[1] = false;
  for(int i = 2; i < 60000; ++i) stat[i] = true;
  for(int i = 2; i < 60000; ++i) {
    if(stat[i]) {
      //cout << i << endl;
      for(int j = 2; i * j <= 60000; ++j) {
        stat[i * j] = false;
      }
    }
  }
  int sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0;
  /*
  for(int i = 1; i < 55555; ++i) {
    //if(stat[i]) cout << i << endl;
    if(stat[i]) {
      if(i%5 == 1) sum1++;

        if(i%5 == 2) sum2++;
          if(i%5 == 3) sum3++;
            if(i%5 == 4) sum4++;
    }
  }
  cout << sum1 << " " << sum2 << " " << sum3 << " " << sum4 << endl;
  */
  int n;
  scanf("%d", &n);
  for(int i = 2; i < 55555; ++i) {
    if(stat[i] && i % 5 == 2) {
      printf("%d", i);
      --n;
      if(n == 0) break;
      else printf(" ");
    }
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 256
import numpy as np

def main():
    N, M = map(int, input().split())
    if N >= M:
        print(0)
        exit()
    X = sorted(list(map(int, input().split())))
    if N == 1:
        print(X[-1] - X[0])
        exit()
    D = np.array([X[i+1] - X[i] for i in range(M-1)])
    idx_list = np.argsort(-D)[:N-1]
    ans = sum(D)
    for idx in idx_list:
        ans -= D[idx]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 37720
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef long long ll;

int main(){
    ll N,X,mod; cin>>N>>X>>mod;
    vector<ll> v;
    vector<ll> is(mod,0);
    ll cnt = 0;
    ll loop=0;
    rep(i,N){
        if(is[X]>0){
            loop += is[X];
            break;
        }else{
            is[X] = i+1;
            v.push_back(X);
            cnt++;
        }
        X *= X;
        X %= mod;
    }
    loop--;
    ll T = cnt - loop; //周期
    ll ans = 0;
    rep(i,min(cnt,N)){
        ans += v[i];
    }
    if(loop!=-1)
    {
    ll loopsum = 0;
    reverse(v.begin(),v.end());
    rep(i,loop){
        v.pop_back();
    }
    reverse(v.begin(),v.end());
    for(auto p : v){
        loopsum += p;
    }
    ans += ((N-loop)/T - 1)*loopsum;
    rep(i,(N-loop)%T){
        ans += v[i];
    }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4716
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

int32_t main()
{
    int n,d;cin>>n>>d;
    
    int cnt=0;
    int u,v;
    for(int i=0;i<n;i++){
        cin>>u>>v;
        double val=sqrt(u*u+v*v);
        if(val<=(double)d)
            cnt++;
    }

    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3676
#include <stdio.h>

int main(void) {
	int n;
	scanf("%d", &n);
	int d[n+1];
	for(int i = 1; i <= n; i++) {
		scanf("%d", &d[i]);
	}
	int sum = 0;
	for(int i = 1; i < n; i++) {
		for(int j = i + 1; j <= n; j++) {
			sum += d[i]*d[j];
		}
	}
	printf("%d", sum);
	return 0;
}

Measured memory_bytes: 128
alpha_dict = {}
for i,c in enumerate(range(ord('A'),ord('Z')+1)):
    alpha_dict[chr(c)] = i + 1
num_dict = {}
for i,c in enumerate(range(ord('A'),ord('Z')+1)):
    num_dict[i+1] = chr(c)

n = int(input())
inp = list(input())
ans = []
for al in inp:
  k = alpha_dict[al]
  k += n 
  if k > 26:
    k -= 26 
  ans += [num_dict[k]]
print(''.join(ans))


Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int a,b,count=0;
  int c;
  cin>>a>>b;
  for(int i=a;i<=b;i++){
    if(i/10000==i%10 and (i/1000)%10==(i/10)%10)
      count++;
  }
  cout<<count<<endl;
}

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

int main () {
    int n, k, v[1000];
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        cin >> v[i];
    sort(v, v + n);
    int s = 0;
    for(int i = 0; i < k; i++)
        s += v[i];
    cout << s;
}


Measured memory_bytes: 3608
import java.util.Scanner

import scala.io.StdIn._
object Main extends App {

//  val n: Int = readInt()
//  val testimoniesPerPerson: Seq[Seq[(Int, Int)]] = (1 to n).map { _ =>
//    val numOfTestimonies = readInt()
//    val testimonies: Seq[(Int, Int)] = Seq.fill(numOfTestimonies) {
//      val testimony: Array[Int] = readLine().split(" ").map(_.toInt)
//      (testimony(0) - 1, testimony(1)) // Modify to 0 origin
//    }
//    testimonies
//  }
  val sc = new Scanner(System.in)
  val n = sc.nextInt
  val testimoniesPerPerson: Array[Map[Int, Boolean]] = Array.fill(n){
    Array.fill(sc.nextInt)(sc.nextInt - 1 -> (sc.nextInt == 1)).toMap
  }


  def solve(): Int = {
    val valids = (0 until (1 << n)).map{ i =>
      val valid = (0 until n)
        .filter{j => isBitOn(i, j)}
        .forall{j => isHonestPerson(j, i)}
      if (valid) countHonest(i) else 0
    }
    valids.max
  }

  def isHonestPerson(personIndex: Int, bit: Int): Boolean =
    testimoniesPerPerson(personIndex).forall { case (x, y) =>
      y == isBitOn(bit, x)
    }

  def isBitOn(bit: Int, digit: Int): Boolean =
    ((bit >> digit) & 1) != 0

  def countHonest(bit: Int): Int=
    Integer.bitCount(bit)


  println(solve())

}


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


void solve(long long x){
    if(x < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        System.out.println(Math.abs(a - x) > Math.abs(b - x) ? "B" : "A");
    }
}

Measured memory_bytes: 22612
n = int(input())
a = [int(x) for x in input().split()]

flag = True
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            flag = False
            break

print('APPROVED') if flag else print('DENIED')


Measured memory_bytes: 3060
# AOJ 0037: Path on a Grid
# Python3 2018.6.27 bal4u

next = [[1,2,4,8],[4,8,1,2],[8,1,2,4],[2,4,8,1]]
tbl = [[0 for c in range(5)] for r in range(5)]

def move(k):
	global r, c, last, ans
	if k == 1:
		r -= 1
		last = 2
		ans += 'U'
	elif k == 2:
		c += 1
		last = 0
		ans += 'R'
	elif k == 4:
		r += 1
		last = 3
		ans += 'D'
	else:
		c -= 1
		last = 1
		ans += 'L'

for i in range(9):
	a = input()
	r = i >> 1
	if i & 1:
		for c in range(5):
			if a[c] == '1':
				tbl[r  ][c] |= 4
				tbl[r+1][c] |= 1
	else:
		for c in range(4):
			if a[c] == '1':
				tbl[r][c  ] |= 2
				tbl[r][c+1] |= 8

ans = ""
r, c, last = 0, 0, 0
while True:
	for i in range(4):
		if tbl[r][c] & next[last][i]:
			move(next[last][i])
			break;
	if r == 0 and c == 0: break
print(ans)


Measured memory_bytes: 5580
#include <cstdio>
int main(){
    int in;
    int h,m,s;
    scanf("%d",&in);

    h = in / 3600;
    in %= 3600;

    m = in / 60;
    in %= 60;

    s = in;

    printf("%d:%d:%d\n",h,m,s);
}


Measured memory_bytes: 2704
#include<iostream>
using namespace std;
main()
{
  string s;cin>>s;
  if(s[0]=='9')s[0]='1';
  else s[0]='9';
  if(s[1]=='9')s[1]='1';
  else s[1]='9';
  if(s[2]=='9')s[2]='1';
  else s[2]='9';
  cout<<s<<endl;
}


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

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

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

  int ans = a*x + b*y;
  ans = min(ans, c * 2*max(x,y));
  int tmp;
  if(x < y) tmp = b*(y-x);
  else tmp = a*(x-y);
  ans = min(ans, c * 2*min(x,y) + tmp);
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) solve();

  return 0;
}


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

#define ll long long int
#define endl '\n'
#define inf 1e18

void testCase()
{
    
    //ll t; cin>>t; while(t--)
    {
        string s;
        cin>>s;
        ll ans=0;
        for(int i=0;i<s.length();i++)
        {
            ans=(ans*10+(s[i]-'0'))%9;
        }
       
        if(ans%9==0)
        cout<<"Yes\n";
        else
        cout<<"No\n";
    }       
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    testCase();
    return 0;
}

Measured memory_bytes: 3780
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from fractions import gcd                    # for Python3.4.3


def main():
    mod = 10000007                  # 10^9+7
    inf = float('inf')
    input = sys.stdin.readline      # 改行文字が残ることに注意
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def ii():  return int(input())
    def mi():  return map(int, input().rstrip().split())
    def lmi(): return list(map(int, input().rstrip().split()))
    def li():  return list(input().rstrip())


    def dfs_traverse(start, ans_lst, val=0):
        val += counter[start]
        ans_lst[start] = val
        for v in adj[start]:
            if ans_lst[v] is None:
                dfs_traverse(v, ans_lst, val)
    
    
    n, q = mi()
    L = [list(map(lambda x: int(x)-1, input().rstrip().split())) for _ in range(n-1)]
    count_up_commands = [lmi() for _ in range(q)]

    adj = [[] for _ in range(n)]
    for link in L:
        adj[link[0]].append(link[1])
        adj[link[1]].append(link[0])
    
    counter = [0] * n
    for command in count_up_commands:
        ind = command[0] -1
        count = command[1]
        counter[ind] += count
    
    ans_lst = [None] * n
    dfs_traverse(0, ans_lst)
    for ans in ans_lst:
        print(ans, end=" ")
    print("")


if __name__ == "__main__":
    main()

Measured memory_bytes: 346632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//code
	int n;
	cin>>n;
	
	string s=to_string(n);
	if(s[0]=='7' || s[1]=='7' || s[2]=='7')
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
 	return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

#define INF 1e18
#define int long long

int digitSum(int n) {
    if(n == 0) return 0;
    return (n % 10) + digitSum(n / 10);
}

signed main() {
    int n; cin >> n;

    int ans = INF;
    for(int i = 1; i <= n - 1; i++) {
        int sum = digitSum(i) + digitSum(n - i);
        ans = min(ans, sum);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{

int a,b,c,x,y,z;
cin>>a>>b>>c;
x=a+b;
y=a+c;
z=c+b;
if(x<y&&x<z)
       cout<<x;
else if(y<x&&y<z)
       cout<<y;
else if(z<x&&z<y)
       cout<<z;
else
       cout<<x;




    return 0;
}

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main()
{
    int X, Y;
    cin >> X >> Y;    

    if(Y % 2 == 1)
    {
        cout << "No" << endl;
        return 0;
    }

    int y = Y/2;

    if((2 * X >= y) && (y >= X)) 
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }


    return 0;    
}

Measured memory_bytes: 3632
import java.util.*;
public class Main{
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			int n = s.nextInt();
			int l = s.nextInt();
			List<String> list = new ArrayList<>(n);
			for (int i = 0; i < n; i++) {
				list.add(s.next());
			}
			Collections.sort(list);
			StringBuilder sb = new StringBuilder(n*l);
			for (String t : list) {
				sb.append(t);
			}
			System.out.println(sb);
		}
	}
}


Measured memory_bytes: 22100
let [|_;K|] =
    stdin.ReadLine().Split()
    |> Array.map int
let A =
    stdin.ReadLine().Split()
    |> Array.map int

let maxA = Array.max A

let ansLt x =
    let k = Array.sumBy (fun item -> (item + x - 1)/x - 1) A
    k <= K

let rec culc low upper =
    if upper - low = 1 then low
    else
        let middle = (low + upper + 1) / 2
        if ansLt (middle - 1) then culc low middle
        else (culc middle upper)

culc 1 (maxA+1)
|> stdout.WriteLine

Measured memory_bytes: 44648
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	final int D = stdin.nextInt();
	final int N = stdin.nextInt();

	final int[] ts = new int[ D ];
	for ( int i = 0; i < D; i++ ) {
	    ts[ i ] = stdin.nextInt();
	}

	int[][] input = new int[ N ][ 3 ];
	for ( int i = 0; i < N; i++ ) {
	    for ( int j = 0; j < 3; j++ ) {
		input[ i ][ j ] = stdin.nextInt();
	    }					  
	}

	final int MIN = 0;
	final int MAX = 1;
	int[][] show = new int[ 2 ][ 61 ];
	Arrays.fill( show[ MIN ], Integer.MAX_VALUE );
	Arrays.fill( show[ MAX ], Integer.MIN_VALUE );
	for ( int i = 0; i < N; i++ ) {
	    for ( int t = input[ i ][ 0 ]; t <= input[ i ][ 1 ]; t++ ) {
		show[ MIN ][ t ] = Math.min( show[ MIN ][ t ], input[ i ][ 2 ] );
		show[ MAX ][ t ] = Math.max( show[ MAX ][ t ], input[ i ][ 2 ] );
	    }
	}

	int[][] dp = new int[ 2 ][ D ];

	for ( int i = 1; i < D; i++ ) {
	    dp[ MIN ][ i ] = Math.max( dp[ MIN ][ i - 1 ] + Math.abs( show[ MIN ][ ts[ i - 1 ] ] - show[ MIN ][ ts[ i ] ] ),
				       dp[ MAX ][ i - 1 ] + Math.abs( show[ MAX ][ ts[ i - 1 ] ] - show[ MIN ][ ts[ i ] ] ) );
	    dp[ MAX ][ i ] = Math.max( dp[ MIN ][ i - 1 ] + Math.abs( show[ MIN ][ ts[ i - 1 ] ] - show[ MAX ][ ts[ i ] ] ),
				       dp[ MAX ][ i - 1 ] + Math.abs( show[ MAX ][ ts[ i - 1 ] ] - show[ MAX ][ ts[ i ] ] ) );
	}
	System.out.println( Math.max( dp[ MAX ][ D - 1 ], dp[ MIN ][ D - 1 ] ) );
    }    
}

Measured memory_bytes: 20936
#include <iostream>

using namespace std;

int main()
{
	char today = getchar();
	switch (today)
	{
	case 'S':
		puts("Cloudy");
		break;
	case 'C':
		puts("Rainy");
		break;
	case 'R':
		puts("Sunny");
		break;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;
using namespace std;
int main(){
    unsigned long long a,b,x;
    cin >> a >> b >> x;
    if ( a == 0 ) cout << b / x + 1 << endl;
    else cout << b / x - ( a - 1 ) / x << endl;
}


Measured memory_bytes: 384
from sys import stdin
import sys
##  input functions for me
def ria(sep = ''):
    if sep == '' :
        return list(map(int, input().split())) 
    else: return list(map(int, input().split(sep)))
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    N = ri()
    S = rs()
    K = ri() - 1
    ans = []
    for i in range(N):
        if S[i] != S[K]:
            ans.append('*')
        else:
            ans.append(S[K])
    print(''.join(ans))


if __name__ == "__main__":
    main()


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

int A[100005];

int main() {
    int N, x;
    scanf("%d %d", &N, &x);
    for (int i = 0; i < N; i++) scanf("%d", &A[i]);
    long long ans = 0;
    if (A[0] > x) {
        ans += A[0] - x;
        A[0] = x;
    }
    for (int i = 1; i < N; i++) {
        if (A[i-1] + A[i] > x) {
            ans += A[i-1] + A[i] - x;
            A[i] = x - A[i-1];
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 640
// header {{{
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <utility>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <list>
#include <stack>
#include <tuple>
#include <cstdio>
#include <cmath>
using namespace std;

#define ALPHABET    26
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)

typedef long long ll;
typedef unsigned long long ull;
// }}}

int main() {
    int n;cin >> n;
    vector<int> mmin(ALPHABET, 100);
    for(int i=0;i<n;i++){
        string s;cin >> s;
        vector<int> counter(ALPHABET, 0);
        for(auto c : s){
            counter[c-'a']++;
        }
        for(int i=0;i<ALPHABET;i++){
            mmin[i] = min(mmin[i], counter[i]);
        }
    }
    for(int i=0;i<ALPHABET;i++){
        char c = 'a'+i;
        for(int j=0;j<mmin[i];j++){
            cout << c;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

int main()
{
	int a,b;
	cin>>a>>b;
	double c=a+b;
	cout<<ceil(c/2*1.0);
	return 0;
}

Measured memory_bytes: 256
let gcd x y =
  let rec doit x y =
    if y = 0 then x
    else doit y (x mod y) in
  doit (max x y) (min x y)

let lcm x y g = x * y / g

let () =
  try
    while true do
      let (x, y) = Scanf.scanf "%d %d " (fun x y -> x, y) in
      let g = gcd x y in
      lcm x y g |> Printf.printf "%d %d\n" g
    done
  with _ -> ()

Measured memory_bytes: 2296
from collections import defaultdict, deque
n, m = list(map(int, input().split()))
graph = defaultdict(list)
for i in range(m):
  u, v = list(map(int, input().split()))
  graph[u].append(v+n)
  graph[u+n].append(v+2*n)
  graph[u+2*n].append(v)
s, t = list(map(int, input().split()))
dist = [-1 for i in range(3*n+10)]

def bfs():
  que = deque([s])
  dist[s] = 0
  while len(que) > 0:
    cur = que.popleft()
    for to in graph[cur]:
      if dist[to] == -1:
        dist[to] = dist[cur]+1
        que.append(to)

bfs()
print(dist[t]//3)

Measured memory_bytes: 81232
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]
    n, k = [int(x) for x in input().split()]
    d = defaultdict(int)
    for _ in range(n):
        a, b = [int(x) for x in input().split()]
        d[a] += b
    a = [(x, d[x]) for x in d]
    a.sort()
    i = 0
    while k > a[i][1]:
        k -= a[i][1]
        i += 1

    print(a[i][0])

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""


Measured memory_bytes: 21136
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    A.sort()

    if A[0] >= 0:
        ret = sum(A) - 2 * A[0]
        print(ret)
        tmp = A[0]
        for i in range(N - 2):
            print(tmp, A[i + 1])
            tmp -= A[i + 1]
        print(A[-1], tmp)

    elif A[-1] <= 0:
        ret = -sum(A[:-1]) + A[-1]
        print(ret)
        tmp = A[-1]
        for i in range(N - 1):
            idx = -1 - i - 1
            print(tmp, A[idx])
            tmp -= A[idx]

    else:
        ret = 0
        cnt = 0
        for a in A:
            if a < 0:
                ret += -a
                cnt += 1
            else:
                ret += a
        print(ret)
        idx = cnt - 1
        tmp = A[idx]
        for i in range(idx, N - 2):
            print(tmp, A[i + 1])
            tmp -= A[i + 1]
        tmp2 = A[-1]
        for i in range(0, cnt - 1):
            print(tmp2, A[i])
            tmp2 -= A[i]
        print(tmp2, tmp)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 15972
#include <bits/stdc++.h>
const int MOD=1000*1000*1000+7,N=5005;
using namespace std;
typedef long long ll;
ll dp[N][N],n;
string s;
ll P(ll a,ll b){
    ll ans=1;
    while(b){
        if(b%2)ans=(ans*a)%MOD;
        a=(a*a)%MOD;
        b/=2;
    }
    return ans;
}
int main()
{ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    cin>>n;
    cin>>s;
    dp[0][0]=1;
    for(int i=0;i<n;i++){
        for(int p=0;p<=i;p++){
            dp[i+1][p+1]=(dp[i+1][p+1]+2*dp[i][p])%MOD;
            if(p!=0)dp[i+1][p-1]=(dp[i+1][p-1]+dp[i][p])%MOD;
            else dp[i+1][0]=(dp[i+1][0]+dp[i][0])%MOD;

            //cout<<i<<' '<<p<<' '<<dp[i][p]<<endl;
        }
    }

    int sz=s.size();
    ll v=dp[n][sz];
    for(int i=1;i<=sz;i++)v=(v*P(2,MOD-2))%MOD;
    cout<<v<<'\n';
    return 0;
}


Measured memory_bytes: 120372
#include<string>
#include<list>
#include<iostream>
using namespace std;
int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  string str;
  list<int> data;
  list<int>::iterator it,l;
  int n,x;
  cin >> n;
  while(n--){
    cin >> str;
    if(str == "insert"){
      cin >> x;
      data.push_front(x);
    }else if(str == "delete"){
      cin >> x;
      for(it=data.begin(),l=data.end();it!=l;++it){
	if(*it == x){
	  data.erase(it);
	  break;
	}
      }
    }else if(str == "deleteFirst") data.pop_front();
    else data.pop_back();
  }
  for(it=data.begin(),l=--data.end();it!=l;++it) cout << *it << " ";
  cout << *it << endl;
}



Measured memory_bytes: 34288
#include <iostream>

using namespace std;

int main(){

	int n;
  	cin>>n;
	int m= n/1000, c=(n%1000)/100, d=((n%1000)%100)/10, u=((n%1000)%100)%10;
	if(m == c && c == d)
		cout<<"Yes";
	else if(c==d && d==u)
		cout<<"Yes";
	else
		cout<<"No";
	
	return 0;
}

Measured memory_bytes: 256