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

using namespace std;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef long long ll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    string s;
    cin >> k;
    cin >> s;
    if(s.size() <= k){
        cout << s << "\n";
    }else{
        s = s.substr(0, k);
        s += "...";
        cout << s << "\n";
    }
    return 0;
}

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

signed main() {
    int n, m, k; cin >> n >> m >> k;

    for(int i = 0; i <= n; i++) {
        for(int j = 0; j <= m; j++) {
            int cnt = i * (m - j) + j * (n - i);
            if(cnt == k) {
                cout << "Yes" << endl;
                return 0;
            }
        }
     }

     cout << "No" << endl;
     return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines

import numpy as np

N = int(readline())
LR = [tuple(int(x) for x in line.split()) for line in readlines()]

"""
・奇数個のとき：中央にどれかを固定。
・偶数のとき：原点で左右に分けるとしてよい。
・基本的に長さで内側から昇順（奇数のときの中央は謎）。→ソートしてdpできる。
・左に置いた個数をもってdp更新。また、中央を使ったかも同時に持って。
・偶数のときは、中央に1つ置いた状態から始める。
・大きい区間から外側に入れていく。
"""

LR.sort(key = lambda x: -x[1]-x[0])

INF = 10**18
dp_0 = np.full(1,INF,np.int64) # 左に置いた個数 → コスト。中央未確定。
dp_1 = np.full(1,INF,np.int64) # 左に置いた個数 → コスト。中央確定。
if N&1:
    dp_0[0] = 0
else:
    dp_1[0] = 0
for n,(L,R) in enumerate(LR):
    length = R + L
    prev_0 = dp_0
    prev_1 = dp_1
    dp_0 = np.full(n+2,INF,np.int64)
    dp_1 = np.full(n+2,INF,np.int64)
    x = np.arange(n+1,dtype=np.int64) # もともと左側にあった個数
    # 左側に置く場合
    np.minimum(prev_0[:n+1] + R + x * length, dp_0[1:n+2], out=dp_0[1:n+2])
    np.minimum(prev_1[:n+1] + R + x * length, dp_1[1:n+2], out=dp_1[1:n+2])
    # 右側に置く場合
    np.minimum(prev_0[:n+1] + L + (n-x) * length, dp_0[:n+1], out=dp_0[:n+1])
    np.minimum(prev_1[:n+1] + L + (n-x) * length, dp_1[:n+1], out=dp_1[:n+1])
    # 中央に置く場合
    np.minimum(prev_0[:n+1] + (N-1)//2 * length, dp_1[:n+1], out = dp_1[:n+1])

answer = dp_1[N//2]
print(answer)

Measured memory_bytes: 23180
#include "bits/stdc++.h"
using namespace std;

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(40) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,n,a) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,n,0)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef pair<long long, long long> pll;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion

int main() {
	string s; put s;
	string chk = s;
	int b = 0;
	int ans = 0;
	char flag = chk[0];
	rep(i, s.size())if (s[i] == 'B')b++;
	if (b == 0 || b == s.size()) {
		putans(0);
		goto END;
	}

	REP(i,1,chk.size()) {
		if (flag != chk[i]) {
			flag = chk[i];
			ans++;
		}
	}
	putans(ans);
END:
	return 0;
}
/*
	double a, b, c; put a >> b >> c;
	dputans(c*b/a);*/

Measured memory_bytes: 640
void main(){
	int[] abc = _scanln();
	writeln(abc.count(5)==2 && abc.count(7)==1? "YES": "NO");

}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


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


int main()
{
    string  s1,s2;
    cin >>s1 >>s2;
    int n1=s1.length();
    for(int i=0; i<n1; i++)
    {
        if(s1.substr(i,n1-i)+s1.substr(0,i)==s2)
        {
            cout <<"Yes\n";
            return 0;

        }

    }
    cout <<"No\n";

    return 0;
}




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


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    int n,i,a[200005],memo,plus=1;
    long long ans=1,mod=1e9+7;
    char s[200005];
    cin >> n >> s;
    n=2*n;
    for(i=0;i<n;i++){
    	if(s[i]=='B') a[i+1]=1;
    	else a[i+1]=0;
    }
    if(a[1]==0||a[n]==0){
    	cout << "0" << endl;
    	return 0;
    }
    n=n/2;
    for(i=1;i<=n;i++) ans=ans*i%mod;
    if(a[2]==1){
    	memo=0;
    	plus=-1;
    } else {
    	memo=2;
    	plus=1;
    }
    for(i=3;i<=2*n;i++){
    	if(memo>(2*n-i+1)){
    		cout << "0" << endl;
    		return 0;
    	}
    	if(a[i-1]==a[i]&&plus==1){
    		ans=ans*memo%mod;
    		memo--;
    		plus=-1;
    	} else if(a[i-1]==a[i]&&plus==-1){
    		memo++;
    		plus=1;
    	} else if(a[i-1]!=a[i]&&plus==1){
    		memo++;
    		plus=1;
    	} else if(a[i-1]!=a[i]&&plus==-1){
    		ans=ans*memo%mod;
    		memo--;
    		plus=-1;
    	}
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int n, a[45], b[45], c[45], ma, mb, dp[450][450];
int main() {
	cin >> n >> ma >> mb;
	for (int i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];
	memset(dp, -1, sizeof(dp));
	dp[0][0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int A = 400; A > 0; A--)
			for (int B = 400; B > 0; B--) {
				if (A-a[i] < 0 || B-b[i] < 0) break;
				if (dp[A-a[i]][B-b[i]]==-1) continue;
				if (dp[A-a[i]][B-b[i]]+c[i]<=dp[A][B] || dp[A][B]==-1)
					dp[A][B]=dp[A-a[i]][B-b[i]]+c[i];
			}
//			fprintf(stderr,"DP(%d,%d)=%d\n",A,B,dp[A][B][n]);
		}
	int ans = -1;
	for (int i = 1; i * ma <= 400 && i * mb <= 400; i++)
		if ((ans > dp[i * ma][i * mb] && dp[i * ma][i * mb] != -1) || ans == -1)
			ans = dp[i * ma][i * mb];
	cout << ans << endl;
	return 0;
}

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

int main(){

vector <ll> k(26,1),k2(26,0);

 int ans;
 ans='y';
 int n;
 cin >> n;
 string s;
 cin >> s;
 char ss;
 string s2;
 s2=s[0];
 ss=s[0];
 ans=ss;
    

rep(i,n){
    ss=s[i];
    ans=ss-97;
    ++k[ans];
}

ll se=1;
rep(i,26){
    se*=k[i];
    se=se%1000000007;
}

cout << se-1 << endl;
    

    return 0;
}

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

int main() {
	string w;
	int a, c, b;
	while (cin >> w >> a) {
	    if (w == "-") break;
	    for (int i = 0; i < a; i++) {
	        cin >> b;
	        w = w.substr(b) + w.substr(0, b);
	    }
	    cout << w << endl;
	}
}



Measured memory_bytes: 3144
#include <stdio.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <utility>
#include <queue>
#include <climits>
using namespace std;

#define endl '\n'
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define FORE(i, a, b) for(int i=(a); i<=(b); i++)
typedef pair<int, int> ii;
typedef long long LL;
typedef long double LD;

int H, W;
char a[305][305];
int dp[305][305];
int cost[305][305];

int calc_cost(int L, int R, int Ld, int Rd) {
	int res = 0, i = Rd, j = Ld;
	while(i < H-Ld && j < H-Rd) {
		if(a[i][L] == a[j][R]) res++;
		i++; j++;
	}
	return res;
}

void debug() {
	cout << "cost: " << endl;
	FORE(i, 0, H) {
		FORE(j, 0, H) {
			cout << cost[i][j] << ' ';
		}
		cout << endl;
	}
	cout << endl;
}

void debug2() {
	cout << "dp: " << endl;
	FORE(i, 0, H) {
		FORE(j, 0, H) {
			cout << dp[i][j] << ' ';
		}
		cout << endl;
	}
	cout << endl;
}

void solve(){
	int res = 0;
	FOR(col, 1, W) {
		int L = col-1, R = col;
		FORE(i, 0, H) cost[0][i] = calc_cost(L, R, 0, i);
		FORE(i, 0, H) cost[i][0] = calc_cost(L, R, i, 0);
		FORE(i, 1, H) {
			FORE(j, 1, H) {
				cost[i][j] = cost[i-1][j-1] - (a[H-i][L] == a[H-j][R] ? 1 : 0);
			}
		}
		
//		debug();
		
		dp[0][0] = 0;
		FORE(i, 1, H) dp[0][i] = dp[0][i-1] + cost[0][i-1];
		FORE(i, 1, H) dp[i][0] = dp[i-1][0] + cost[i-1][0];
		FORE(i, 1, H) {
			FORE(j, 1, H) {
				dp[i][j] = min(dp[i][j-1] + cost[i][j-1], dp[i-1][j] + cost[i-1][j]);
			}
		}
		
//		debug2();
		
		res += dp[H][H];
	}
	cout << res << endl;
}

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    std::cin.tie(0);
    while(cin >> H >> W) {
    	FOR(i, 0, H) {
    		cin >> a[i];
    	}
		solve();
    }
    return 0;
}

Measured memory_bytes: 1024
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key


yn = 'YNeos'
ynflg = False
cnt = 0
ans = None

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

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas




N, R = mulinputs()

if N >= 10:
    print(R)
else:
    print(R + (100*(10-N)))




Measured memory_bytes: 5688
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <cassert>
#include <map>
#include <numeric>
#include <cstring>
#include <set>
#include <ctime>
#include <queue>
#include <cmath>
#include <iomanip>
#include <iterator>

using namespace std;

clock_t timeStart, timeFinish;

void timeBegin() {
    timeStart = clock();
}

void timeEnd() {
    timeFinish = clock();
}

void timeDuration() {
    double time_taken = double(timeFinish - timeStart) / double(CLOCKS_PER_SEC);
    cout << "Time taken by program is : " << fixed << time_taken << setprecision(5);
    cout << " sec " << endl;
}

class InputReader {
public:
    InputReader() {
        input_file = stdin;
        cursor = 0;
        fread(buffer, SIZE, 1, input_file);
    }
    InputReader(const char *file_name) {
        input_file = fopen(file_name, "r");
        cursor = 0;
        fread(buffer, SIZE, 1, input_file);
    }
    inline InputReader &operator >>(int &n) {
        while((buffer[cursor] < '0' || buffer[cursor] > '9') && buffer[cursor] != '-') {
            advance();
        }
        int sign = 1;
        if (buffer[cursor] == '-') {
            sign = -1;
            advance();
        }
        n = 0;
        while('0' <= buffer[cursor] && buffer[cursor] <= '9') {
            n = n * 10 + buffer[cursor] - '0';
            advance();
        }
        n *= sign;
        return *this;
    }
private:
    FILE *input_file;
    static const int SIZE = 1 << 17;
    int cursor;
    char buffer[SIZE];
    inline void advance() {
        ++ cursor;
        if(cursor == SIZE) {
            cursor = 0;
            fread(buffer, SIZE, 1, input_file);
        }
    }
};

const int MAXN = 200000;

int v[1 + MAXN], w[1 + MAXN + 1];

long long getSum(int n) {
    long long answer = 0;
    for (int i = 1; i <= n; i++) {
        answer += v[i];
    }
    return answer;
}

void change(int n) {
    for (int i = 1; i <= n + 1; i++) {
        w[i] = 0;
    }
    for (int i = 1; i <= n; i++) {
        w[max(1, i - v[i])]++;
        w[min(n + 1, i + v[i] + 1)]--;
    }
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        sum += w[i];
        v[i] = sum;
    }
}

int main() {
    timeBegin();
    //ifstream cin("input.in");
    //ofstream cout("output.txt");
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> v[i];
    }
    long long sum = getSum(n);
    for (int i = 1; i <= k; i++) {
        change(n);
        long long newSum = getSum(n);
        if (sum == newSum) {
            break;
        }
        sum = newSum;
    }
    for (int i = 1; i <= n; i++) {
        cout << v[i] << " ";
    }
    //timeDuration();
    return 0;
}




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

int main()
{
  int n, k, u, i, j;
  int a[101][101];

  while(scanf("%d", &n)!=EOF){
    memset(a, 0, sizeof(a));
    for(i = 0; i < n; ++i){
      scanf("%d %d", &u, &k);
      while(0 < k--){
	scanf("%d", &j);
	a[u][j] = 1;
      }
    }

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

  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int i,j,H,W;
    while(1){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0)break;
        for(i = 0; i < H; i++){
            for(j = 0; j < W; j++)
                if(i == 0 || i == H-1 || j == 0|| j == W-1){
                    printf("#");
                }else{
                    printf(".");
                }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion

#pragma region Combination
const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++)
	{
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k)
{
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
#pragma endregion

int main()
{
	int n, k; cin >> n >> k;
	vector<int> a(n); rep(i, n)cin >> a[i];
	sort(all(a));
	COMinit();
	ll res = 0;
	for (int i = k - 1; i < n; ++i)
	{
		res += a[i] * COM(i, k - 1);
		res %= MOD;
	}
	for (int i = 0; i + k - 1 < n; ++i)
	{
		res -= a[i] * COM(n - i - 1, k - 1);
		if (res < 0)res -= (res - MOD + 1) / MOD * MOD;
		res %= MOD;
	}
	cout << res << endl;
}

Measured memory_bytes: 24064
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#define PRE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
const int Max = 1e6 + 5;
const int Mod = 1e9 + 7;
ll lst[Max];
int ls[Max];

int main()
{
	PRE
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	double res = 0, r1=0, r2=0;
	for(int i=0;i<=f/(100*a);i++)
		for (int j = 0;j <= f - a * i * 100;j++)
		{
			int s = min(f - 100 * (i * a + b * j), (i*a+ b*j) * e);
			for (int k = 0;k <= s / c;k++)
			{
			
				int u = (s - k * c) / d;
				if (double(u * d + k * c) / (u * d + k * c + (i * a + j * b) * 100) > res)
				{
					res = (double(u * d + k * c) / (u * d + k * c + (i * a + j * b) * 100));
					r1 = u * d + k * c + (i * a + j * b) * 100;
					r2 = u * d + k * c;
				}
			}
		}
	if (res != 0)
		cout << r1 << " " << r2 << endl;
	else cout << a * 100 << " " << 0 << endl;
}

Measured memory_bytes: 3252
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
int main(void){
    lint N,K;
    cin >> N >> K;
    lint ans=0;
    ans+=pow(N/K,3);
    if(K%2==0) ans+=pow((N+K/2)/K,3);
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 1001
#define dmp make_pair
#define dpb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

ll a[MAX], b[MAX], dp[MAX][MAX];
int main(){
	int n, m;
	fill((int*)dp, (int*)(dp+MAX), INF);
	scanf("%d%d", &n, &m);
	rrep(i,n)scanf("%d", &a[i]);
	rrep(i,m)scanf("%d", &b[i]);
	rep(i,m)dp[i][0] = 0;
	for(int i = 1;i <= m;i++){
		for(int j = 1;j <= n;j++){
			dp[i][j] = min(dp[i][j], dp[i-1][j-1]+b[i]*a[j]);
			dp[i][j] = min(dp[i][j], dp[i-1][j]);
		}
	}
	printf("%lld\n", dp[m][n]);
	return 0;
}

Measured memory_bytes: 11036
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

// #include <iostream>
// #include <fstream>

#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

class AChangingACharacter {
public:
	void solve(std::istream& in, std::ostream& out) {
        int N, K;
        in >> N >> K;
        K--;
        string s = "";
        REP(i, N) {
            char a;
            in >> a;
            if (i == K) a += 32;
            s += a;
        }
        out << s << '\n';
	}
};


int main() {
	AChangingACharacter solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;

using ll = long long;

constexpr ll MOD = 1000000007;

#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
#else
#define print(...)
#endif

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

    string s;

    cin >> s;

    if(s == "ABC"){
        s = "ARC";
    }else{
        s = "ABC";
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3640
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    // 数値の配列を作る
    const numList0 = input[0].split(' ').map(x => parseInt(x, 10));
    const N = numList0[0];
    console.log(Math.pow(N, 3))


}

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

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

int main(){
	string st, sh;
	int n;
	int t = 0;
	int h = 0;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> st >> sh;
		if (st < sh) h += 3;
		if (st > sh) t += 3;
		if (st == sh) (h += 1, t += 1);
	}
	cout << t << " " << h << endl;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;

int main(){
string ass;

cin >> ass;

if(ass=="ARC"){
  cout<<"ABC"<<endl;

}else { cout<<"ARC"<<endl;}

} 

Measured memory_bytes: 3064
N = int(input())
m = dict()

prev = input()
m[prev] = True
flg = True

for _ in range(N - 1):
  s = input()
  flg = all([flg, s not in m, prev[len(prev) - 1] == s[0]])
  m[s] = True
  prev = s

print("Yes" if flg else "No")

Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std;
const int N = 25010, K = 405, p = 1e9 + 7;
int n, k, m, a[N], ans, bk[K], f1[N][K], f2[N][K];
inline void A(int &x, int y) { x = (x + y >= p ? x + y - p : x + y); }
inline int Qmi(int x, int y = p - 2) {
	int ans = 1;
	for (; y; y >>= 1, x = 1ll * x * x % p) if (y & 1) ans = 1ll * ans * x % p;
	return ans;
}
inline void Dp(int f[N][K], int st) {
	f[0][st] = 1;
	for (int i = 0; i < n; ++i) {
		for (int j = 1; j < k; ++j) A(f[i][0], f[i][j]);
		for (int j = 1; j < k; ++j) {
			A(f[i + 1][1], f[i][j]);
			A(f[i + 1][j + 1], 1ll * (k - j - 1) * f[i][j] % p);
			A(f[i + 1][j + 2], p - 1ll * (k - j) * f[i][j] % p);
		}
		for (int j = 2; j < k; ++j) A(f[i + 1][j], f[i + 1][j - 1]);
	}
}
inline void _Dp() {
	f1[0][0] = 1;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < k; ++j) {
			A(f1[i + 1][1], f1[i][j]);
			A(f1[i + 1][j + 1], 1ll * (k - j - 1) * f1[i][j] % p);
			A(f1[i + 1][j + 2], p - 1ll * (k - j) * f1[i][j] % p);
			A(f2[i + 1][1], f2[i][j]);
			A(f2[i + 1][j + 1], 1ll * (k - j - 1) * f2[i][j] % p);
			A(f2[i + 1][j + 2], p - 1ll * (k - j) * f2[i][j] % p);
		}
		for (int j = 2; j < k; ++j) {
			A(f1[i + 1][j], f1[i + 1][j - 1]);
			A(f2[i + 1][j], f2[i + 1][j - 1]);
		}
		for (int j = m; j < k; ++j) A(f2[i + 1][j], f1[i + 1][j]);
	}
}
int main() {
	scanf("%d%d%d", &n, &k, &m);
	for (int i = 1; i <= m; ++i) scanf("%d", a + i);
	int ans = 1ll * (n - m + 1) * Qmi(k, n - m) % p;
	int F = 0, B = 0, flag = 0;
	for (int l = 1, r = 1; r <= m; ++r) {
		++bk[a[r]];
		while (bk[a[r]] > 1) --bk[a[l++]];
		if (l == 1) F = r;
		if (r == m) B = r - l + 1;
		if (r - l + 1 == k) flag = 1;
	}
	if (flag) {
		printf("%d\n", ans);
	} else if (F == m) {
		_Dp();
		int sum = 0, fac = 1;
		for (int i = 1; i < k; ++i) A(sum, f2[n][i]);
		for (int i = k - m + 1; i <= k; ++i) fac = 1ll * fac * i % p;
		sum = 1ll * sum * Qmi(fac) % p;
		A(ans, p - sum);
		printf("%d\n", ans);
	} else {
		Dp(f1, F);
		Dp(f2, B);
		for (int i = 0; i + m <= n; ++i) ans = (ans - 1ll * f1[i][0] * f2[n - i - m][0]) % p;
		if (ans < 0) ans += p;
		printf("%d\n", ans);
	}
	return 0;
}

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

typedef long long ll;
const int INF = 1e9 + 5;


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


vector<int> sieve(int n) {
	vector<int> primes;
	vector<bool> v(n + 1);

	for (int i = 2; i <= n; i++) {
		if (v[i]) continue;
		primes.push_back(i);
		for (int j = i * i; j <= n; j+=i) {
			v[j] = true;
		}
	}
	return primes;
}

int prime_divisor(int a, int b, vector<int> &primes) {
	for (int i = 0; i < primes.size(); i++) {
		if (a % primes[i] == 0 && b % primes[i] == 0) return primes[i];
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	int o = 10;
	int sum = 0;
	for (int i = 0; i < 5; i++) {
		int c;
		cin >> c;
		 


		sum += ceil(((double)c / 10)) * 10;
		if (c % 10 != 0)
			o = min(o, c % 10);
	}
	sum -= 10 - o;
	cout << sum;
}


Measured memory_bytes: 256
N, M = input().split()
X = input().split()
deff = []
ans = 0

for i in range(len(X)):
    X[i] = int(X[i])

if int(N) >= int(M):
    print(0)
else:
    X.sort()

    for i in range(len(X)):
        if i == 0:
            pass
        else:
            deff.append(X[i] - X[i-1])

    deff.sort()

    for i in range(int(M) - int(N)):
        ans += deff[i]

    print(ans)

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int i=0;i<(n);i++)        //repeat n times
#define REP2(i,s,n) for(int i=(s);i<(n);i++)   //repeat from s to n 
#define REPD(i,n) for(int i=(n);i>=0;i--)      //repeat from n to 0
#define REPD2(i,s,e) for(int i=(s);i>=(e);i--) //repeat from s to e
#define RANGE(i,v) for(auto &i:v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T1,typename T2> using P = pair< T1, T2 >;
using Pii = P<int,int>;
using Pll = P<LL,LL>;
using Pdd = P<double,double>;
using Psi = P<string,double>;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

int main(){
    LL N;
    cin>>N;
    Vll A(N);
    REP(i,N) cin>>A[i];
    LL Q;
    cin>>Q;
    Vll B(Q),C(Q);
    REP(i,Q) cin>>B[i]>>C[i];
    
    Vll num_A(100005);
    LL total_A = 0;
    REP(i,N){
        num_A[A[i]]++;
        total_A += A[i];
    }

    REP(i,Q){
        total_A -= B[i] * num_A[B[i]];
        total_A += C[i] * num_A[B[i]];
        cout<<total_A<<endl;
        num_A[C[i]] += num_A[B[i]];
        num_A[B[i]] -= num_A[B[i]];
    }  

    return 0;
}

Measured memory_bytes: 6436
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#define INF 10e10

using namespace std;

//  #define y cout << "yes"<< endl
  #define Y cout << "YES" << endl
  #define y cout << "Yes" << endl
//  #define n cout << "no"<< endl
  #define N cout << "NO" << endl
  #define n cout << "No" << endl
  #define pu(q) cout << q ;
  #define put(q) cout << q << " ";
  #define puts(q) cout << q << endl;
  
  
	int a,b,c,d,e,f,g,h,ans,res;
//	char a,b,c,d,e,f,g,h,ans,res;
//	string a,b,c,d,e,f,g,h,ans,res;
//	double a,b,c,d,e,f,g,h,ans,res;
	
void take(int x);
  
int main(void){
	take(3);//数
	
	
	
	if(a<c && b>c){
		
		
		y;	//Yes
	//	Y;	//YES
	//	n;	//No
	//	N;	//NO
	}
	
	else if(a>c && b<c){
		
		
		y;
	//	Y;
	//	n;
	//	N;
		
	}/*
	else if(){
		
		
	//	y;
	//	Y;
	//	n;
	//	N;
		
	}
	else if(){
		
		
	//	y;
	//	Y;
	//	n;
	//	N;
		
	}
	*/
	else{
		
		
	//	y;
	//	Y;
		n;
	//	N;
		
	}
//	cout << ans << endl;
	
	return 0;
}
void take(int x){
	if(x==1)
		cin >> a;
	else if(x==2)
		cin >> a >> b;
	else if(x==3)
		cin >> a >> b >> c;
	else if(x==4)
		cin >> a >> b >> c >> d;
	else if(x==5)
		cin >> a >> b >> c >> d >> e;
	else if(x==6)
		cin >> a >> b >> c >> d >> e >> f;
	else if(x==7)
		cin >> a >> b >> c >> d >> e >> f >> g;
	else if(x==8)
		cin >> a >> b >> c >> d >> e >> f >> g >> h;
	return ;
}

Measured memory_bytes: 256
#coding:utf-8
a,op,b=map(str,input().split())
a,b=int(a),int(b)

while op!="?":
    if op=="+":
        ans=a+b
    elif op=="-":
        ans=a-b
    elif op=="*":
        ans=a*b
    elif op=="/":
        ans=a//b

    print(ans)

    a,op,b=map(str,input().split())
    a,b=int(a),int(b)

Measured memory_bytes: 7688
#include <cstdio>
using namespace std;

int a,b,c;

int main() {
	// your code goes here
	scanf("%d%d%d",&a,&b,&c);
	if(b-a==c-b) 
	  printf("YES\n");
	else
	  printf("NO\n");
	return 0;
}


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

string N;
int len;
int ans;
int anstmp;

int main() { 
	cin >> N;
	len = N.length();

	ans = 0;
	for (int i = len - 1; i >= 0; i--) {
		anstmp = 0;
		for (int j = 0; j < len; j++) {
			anstmp += N[j] - '0';
		}
		if (anstmp > ans) {
			ans = anstmp;
		}
		if (i > 0) {
			N[i] = '9';
			N[i - 1]--;
		}
	}

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

Measured memory_bytes: 256
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
setrecursionlimit(1000000)

# INF = float('inf')
INF = int(1e10)

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

def main():
    from builtins import int, map
    X, Y, Z = map(int, input().split())
    print(Z, X, Y)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
import java.util.Scanner;

public class Main {

    static int n;
    static boolean[] primes;

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

        sieve();

        solve();
    }

    static void solve() {
        int count = 0;
        for (int i = 5; i < primes.length; i++) {
            if (!primes[i]) {
                continue;
            }

            if (i % 5 == 1) {
                count++;
                if (count != n) {
                    System.out.print(i + " ");
                } else {
                    System.out.println(i);
                    break;
                }
            }
        }
    }

    static void sieve() {
        int n = 55555;

        final int MAX = n + 1;
        primes = new boolean[MAX];

        for (int i = 3; i < MAX; i+=2) {
            primes[i] = true;
        }
        primes[2] = true;

        for (int i = 3; i <= Math.sqrt(MAX); i += 2) {
            if (primes[i]) {
                for (int j = i*2; j < MAX; j += i) {
                    primes[j] = false;
                }
            }
        }
    }
}


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

using namespace std;

#define REP(i, x, y) for (int i = x; i < y; i++)

const int8_t  INFC = 0x3f;
const int16_t INFS = 0x3f3f;
const int32_t INF  = 0x3f3f3f3f;
const int64_t INFL = 0x3f3f3f3f3f3f3f3fLL;
const int     MAXN = 2e5;

int64_t a[ MAXN ];

int main()
{
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) { cin >> a[ i ]; }
    sort(a, a + n);
    if (n == 2)
    {
        cout << a[ 1 ] - a[ 0 ] << endl << a[ 1 ] << " " << a[ 0 ] << endl;
        return 0;
    }
    int nonPositive = 0;
    for (int i = 0; i < n; i++)
    {
        if (a[ i ] <= 0) nonPositive++;
    }
    int64_t ans=-a[0];
    for (int i=1;i<n;i++)
    {
        ans+=abs(a[i]);
    }
    ostringstream sout;
    nonPositive=max(1,nonPositive);
    nonPositive=min(n-1,nonPositive);
    for (int i=nonPositive;i<n-1;i++)
    {
        sout <<a[0] << " "<<a[i]<< endl;
        a[0]-=a[i];
    }
    for (int i=0;i<nonPositive;i++)
    {
        sout <<a[n-1] << " "<<a[i]<< endl;
        a[n-1]-=a[i];
    }
    cout << a[n-1] << endl;
    cout<<sout.str();
    return 0;
}

Measured memory_bytes: 6148
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using vi=vector<int>;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> ans(n,0);
    ans[0]=a[0];
    for(int i=1;i<n;++i){
        if(i%2==1 || i==1) ans[0]-=a[i];
        else ans[0]+=a[i];
    }
    for(int i=1;i<n;++i){
        ans[i]=2*(a[i-1]-(ans[i-1]/2));
    }
    rep(i,n){
        cout << ans[i] << "\n";
    }
    return 0;
}   

Measured memory_bytes: 3936
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	int n,q;
	Queue<Process> process;
	public static void main(String args[]) {
		new Main().run();
	}
	Main() {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		q = scan.nextInt();
		process = new ArrayDeque<Process>();
		for (int i = 0; i < n; i++) {
			Process p = new Process(scan.next(),scan.nextInt());
			process.add(p);
		}
	}
	void run() {
		int sumTime = 0;
		while (true) {
			Process p = process.poll();
			if (p == null) break;
			if (p.time > q) {
				p.time -= q;
				process.add(p);
				sumTime += q;
			} else if (p.time <= q) {
				sumTime += p.time;
				System.out.println(p.name + " " + sumTime);
			}
		}
	}
}
class Process {
	String name;
	int time;
	Process(String txt, int num) {
		name = txt;
		time = num;
	}
	public String toString() {
		return name + " : " + time;
	}
}


Measured memory_bytes: 71436
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <numeric>
#include <cstring>
#include <cmath>
#include <list>

const int MAX = 100000;
const int MOD = 1e9 + 7;
#define rep(i,n) for(int i=0;i<(n);i++)

using ll = long long int;
using namespace std;

vector<int> G[MAX];
list<int> out;
bool V[MAX];
int N;

void dfs(int u)
{
    V[u] = true;
    for(int i = 0; i < G[u].size(); i++)
    {
        int v = G[u][i];
        if(!V[v]) dfs(v);
    }

    out.push_front(u);
}


int main()
{
    int s, t, M;
    cin >> N >> M;

    for(int i = 0; i < N; i++)
        V[i] = false;

    for(int i = 0; i < M; i++)
    {
        cin >> s >> t;
        G[s].push_back(t);
    }

    for(int i = 0; i < N; i++)
        if(!V[i]) dfs(i);

    for(auto it = out.begin(); it != out.end(); it++)
        cout << *it << endl;

    return 0;
}


Measured memory_bytes: 6096
//If you are reading this then you are at wrong place.
#include<bits/stdc++.h>
#define mod 1000000007
#define lli long long int
using namespace std;
bool prime [1000001];
void debug(lli a){cout<<a<<endl;}
lli sieve(lli a){memset(prime,true,sizeof(prime));lli p,i;for(p=2;p*p<=a;p++){if(prime[p]==true){for(i=p*2;i<=a;i+=p)prime[i]=false;}}return 0;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli find_max(lli __a,lli __b){return __a^((__a^__b) & -(__a<__b));}
lli add(lli __a,lli __b,lli MOD){lli x = (__a+__b)%MOD; return x; }
lli mul(lli a,lli b,lli MOD){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b,lli MOD){lli x = (a-b+MOD)%MOD; return x; }
lli div(lli a,lli b,lli MOD){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}
int main()
{
	//ifstream cin("testcase.txt");
	//ofstream cout("output.txt");	
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);	
	cout.precision(20);
	lli t,i,j;
	//cin>>t;
	//memset(dp, -1, sizeof dp);
	t=1;
	lli counter1=0;
	while(t--)
	{
		counter1++;
		int n,k;
		cin>>n>>k;
		int a[n];
		for(i=0;i<n;i++)
			cin>>a[i];
		sort(a,a+n);
		reverse(a,a+n);
		int ans=0;
		for(i=0;i<k;i++)
			ans+=a[i];
		cout<<ans<<endl;
	
		//cout<<"Case #"<<counter1<<" ";
		//cout<<endl;	
	}	
}


Measured memory_bytes: 256
from collections import*;M=lambda:map(int,input().split());n,k,l=M();d=[-1]*n;t=[-1]*n;r=range
def f(l,x):
  if l[x]<0:return x
  else:l[x]=f(l,l[x]);return l[x]
def u(l,x,y):
  if f(l,x)!=f(l,y):l[f(l,y)]=f(l,x)
for i in r(k+l):a,b=M();u(d if i<k else t,a-1,b-1)
p=[(f(d,i),f(t,i))for i in r(n)];c=Counter(p);print(*[c[p[i]]for i in r(n)])

Measured memory_bytes: 44392
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define lll __int128
#define lp(i, a, b) for (int i = a; i < b; i++)
#define vec(v, type, sz) vector<type> v(sz)
#define in(v) \
    for (auto &i : v) cin >> i
#define all(v) v.begin(), v.end()
#define prv(v)                         \
    for (auto i : v) cout << i << " "; \
    cout << "\n"
#define MOD 1000000007
#define INF 1000000000
#define INFL 1000000000000000000ll
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define vii(v, n, m, val) vector<vector<int>> v(n, vector<int>(m, val))
#define viii(v, i, j, k, val)        \
    vector<vector<vector<int>>> v(i, \
                                  vector<vector<int>>(j, vector<int>(k, val)))
#define pii pair<int, int>
#define pb push_back
#define file_io                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);

int main() {
	fast_io;
	int n; cin>>n;
	vi v(n+1);
	lp(i,0,n-1){
		int t; cin>>t;
		v[t]++;
	}
	lp(i,1,n+1)
	cout<<v[i]<<"\n";
}

Measured memory_bytes: 3984
use std::cmp;
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let mut v: Vec<usize> = sc.vec(3);
    v.sort();
    if v[0] == v[2] {
        println!("Yes");
    } else {
        println!("No");
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

using namespace std;

#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 all(a)  (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

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

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

int main()
{
  ll a, b;
  cin>>a>>b;

  cout<<lcm(a,b)<<endl;

  return 0;
}

Measured memory_bytes: 3652
#include<iostream>
using namespace std;
int A,B;
int main(){
  cin >> A >> B;
  for(int i = 1; i <= 3; i++){
    if((A*B*i)%2 == 1){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n, h; cin >> n >> h;
  vector<int> a(n), b(n);
  for(int i=0;i<n;i++) cin >> a[i] >> b[i];
  sort(a.begin(), a.end(), greater<int>());
  sort(b.begin(), b.end(), greater<int>());
  int i;
  for(i=0;i<n;i++){
    if (b[i] < a[0]) break;
    h -= b[i];
    if (h <= 0) {cout << 1+i << endl; return 0;}
  }
  cout << i + (h+a[0]-1)/a[0] << endl;
  return 0;
}
  
  
  

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int ret[100005];
vector<pair<int, int>> G[100005];
int arrived[100005];

int dfs(int node, int val) {
  arrived[node] = 1;
  ret[node] = val;
  for (int i=0; i<G[node].size(); i++) {
    int j = G[node][i].first;
    int odd = G[node][i].second;
    if (!arrived[j]) {
      if (odd) {
        dfs(j, 1 - val);
      } else {
        dfs(j, val);
      }
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  for (int i=0; i<N-1; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    int odd = w & 1;
    G[u].push_back(make_pair(v, odd));
    G[v].push_back(make_pair(u, odd));
  }
  dfs(1, 0);
  for (int i=1; i<=N; i++) {
    cout << ret[i] << '\n';
  }
}

Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, m; cin >> n >> m;
  vector<vector<int>> v(n);
  vector<int> xx(m), yy(m);
  for(int i = 0, x, y; i < m; ++i){
    cin >> x >> y;
    xx[i] = x;
    yy[i] = y;
    x--;
    v[x].push_back(y);
  }
  for(int i = 0; i < n; ++i){
    sort(v[i].begin(), v[i].end());
  }
  int index;
  for(int i = 0; i < m; ++i){
    cout << setfill('0') << setw(6) << xx[i];
    index = lower_bound(v[xx[i] - 1].begin(), v[xx[i] -1].end(), yy[i]) - v[xx[i] - 1].begin();
    index++;
    cout << setfill('0') << setw(6) << index; 
    cout << endl;
  }
}

Measured memory_bytes: 7808
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))


n,k = miinps()

ans = 0

while(n != 0):
  n //= k
  ans += 1

print(ans)

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
c=Counter(a)
flg=True
if n%2==1:
    if c[0]!=1:
        print(0)
        exit()
for i in range(n//2):
    if c[i*2+n%2+1]!=2:
        flg=False
        break
ans=1
mod=10**9+7
if flg:
    for i in range(n//2):
        ans*=2
        ans%=mod
    print(ans)
else:
    print(0)


Measured memory_bytes: 55644
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define ll unsigned long long
using namespace std;
int main(){
    int N;cin>>N;
    vector<int> P(N);
    REP(i,N)cin>>P[i];
    int cnt=0;
    REP(i,N)if(i+1!=P[i])cnt++;
    cout<<(cnt==2||cnt==0?"YES":"NO")<<endl;
}

Measured memory_bytes: 256
n,y=map(int,input().split())
y//=1000
y-=n
i=0
while 9*i<=y:
    a=y-9*i
    if a%4==0:
        j=a//4
        if n-i-j>=0:
            print(str(i)+" "+str(j)+" "+str(n-i-j))
            break
    i+=1
else:
    print(str(-1)+" "+str(-1)+" "+str(-1))

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  int ans = 1;
  int plus = -1;
  REP(i,n) {
    if(plus == -1) {
      if(a[i-1] < a[i]) plus = 1;
      if(a[i-1] > a[i]) plus = 0;
    }
    if(plus == 0) {
      if(a[i-1] < a[i]) {ans++; plus = -1;}
    }
    if(plus == 1) {
      if(a[i-1] > a[i]) {ans++; plus = -1;}
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main(void){
	int a,b,c,d,e,f;
	
	while(cin >> a >> b >> c >> d >> e >> f){
		if((a|b|c|d|e|f) == 0) break;
		int MD = a + d, GG = b + e, GO = c + f;
		int ret = 0;
		
		for(int i=0;i<=2;i++){
			if(MD >= i && GG >= i && GO >= i)
				ret = max(ret, (MD-i)/3 + (GG-i)/3 + (GO-i)/ 3 + i);
		}
		cout << ret << endl;
	}
}

Measured memory_bytes: 868
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#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 rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define from1(obj) obj.begin() + 1, obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbp(p) cerr << #p << ":(" << p.first << ", " << p.second << ") "
#define dbpl(p) cerr << #p << ":(" << p.first << ", " << p.second << ")\n"
#define dbt3(t3) cerr << #t3 << ":(" << get<0>(t3) << ", " << get<1>(t3) << ", " << get<2>(t3) << ") "
#define dbt3l(t3) cerr << #t3 << ":(" << get<0>(t3) << ", " << get<1>(t3) << ", " << get<2>(t3) << ")\n"
#define dbt4(t4) cerr << #t4 << ":(" << get<0>(t4) << ", " << get<1>(t4) << ", " << get<2>(t4) << ", " << get<3>(t4) << ") "
#define dbt4l(t4) cerr << #t4 << ":(" << get<0>(t4) << ", " << get<1>(t4) << ", " << get<2>(t4) << ", " << get<3>(t4) << ")\n"
#define dbv(vec) cerr << #vec << ":{ "; for (auto e : vec) cerr << e << ", "; cerr << "}\n"
#define dbvv(vv) cerr << #vv << ":{\n"; for (auto vec : vv) { cerr << "{ "; for (auto e : vec) cerr << e << ", "; cerr << "}\n"; } cerr << "}\n"
#define dbm(map) cerr << #map << ":{ "; for (auto p : map) cerr << "(" << p.first << ", " << p.second << "), "; cerr << "}\n"
#define YN(f) cout << (f ? "YES" : "NO") << "\n"
#define Yn(f) cout << (f ? "Yes" : "No") << "\n"
#define yn(f) cout << (f ? "yes" : "no") << "\n"
using ll = long long;
using vi = vector<int>; using vl = vector<ll>; using vs = vector<string>; using vb = vector<bool>;
using vvi = vector<vi>; using vvl = vector<vl>; using vvb = vector<vb>;
using pii = pair<int, int>; using pil = pair<int, ll> ; using pll = pair<ll, ll>; using pli = pair<ll, int>;
using vpii = vector<pii>; using vpll = vector<pll>;
using ti3 = tuple<int, int, int>; using tl3 = tuple<ll, ll, ll>;
using ti4 = tuple<int, int, int, int>; using tl4 = tuple<ll, ll, ll, ll>;
using mii = map<int, int>; using mil = map<int, ll>; using mll = map<ll, ll>; using mli = map<ll, int>;

int main() {
	int A, B, C; cin >> A >> B >> C;
	cout << C << " " << A << " " << B << endl;	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cstdint>
#include <istream>
#include <sstream>
#include <cctype>
#include <functional>
#define fore(i,x,y) for(ll i=(x);i<(y);i++)
#define disp(a) cout << a << endl;
typedef long long ll;
using namespace std;
int main()
{
	int N;
	cin >> N;
	int i=2;
	while(N>=i){
		i=i*2;
	}
	cout << i/2 << endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  double win_rate = 0;
  for (int n=1; n<=N; n++) {
    if (n >= K) {
      win_rate += 1.0/N;
    }
    else {
      int cnt = 0;
      while (true) {
        cnt ++;
        if (pow(2, cnt) * n >= K) {
          break;
        }
      }
      win_rate += 1.0 / (N * pow(2, cnt));
    }
  }
  cout << setprecision(12) << win_rate << endl;
  return 0;
}


Measured memory_bytes: 256