akhauriyash/Code-Regression huggingface dataset:
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(ll i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	ll n,m,a,b,p,q;
	cin>>n>>m>>a>>b>>p>>q;
	if(a+b==2){
		ll t=p+q;
		ll T=min(n,m/t);
		ll out=m;
		loop(i,max(0ll,T-10),min(n+1,T+10))
			out=min(out,abs(t*i-m));
		cout<<out<<endl;
		return 0;
	}
	vi A,B;
	ll t=p;
	int co=0;
	while(1){
		A.pb(t);
		if(to_string(t).size()+to_string(a).size()>16)break;
		t*=a;
		if(a==1&&co==40)break;
		co++;
	}
	t=q;
	co=0;
	while(1){
		B.pb(t);
		if(to_string(t).size()+to_string(b).size()>16)break;
		t*=b;
		if(b==1&&co==40)break;
		co++;
	}
	//show1d(A);
	//show1d(B);
	vi in;
	rep(i,min((ll)A.size(),n))
		if(i<B.size()&&A[i]+B[i]<=3*m)in.pb(A[i]+B[i]);
	n=in.size()/2;
	ll N=1<<n;
	vi dp;
	rep(i,N){
		ll sum=0;
		rep(j,n)if(i&1<<j)sum+=in[j];
		if(sum<=3*m)dp.pb(sum);
	}
	sort(all(dp));
	ll nn=in.size()-n;
	N=1<<nn;
	ll out=m;
//	show1d(in);
	rep(i,N){
		ll sum=0;
		rep(j,nn)if(i&1<<j)sum+=in[n+j];
		if(sum>3*m)continue;
		auto it=upper_bound(all(dp),m-sum);
		if(it!=dp.end())out=min(out,abs(*it+sum-m));
		if(it==dp.begin())continue;
		it--;
		out=min(out,abs(*it+sum-m));
	}
//	show1d(dp);
	cout<<out<<endl;
}
















Measured memory_bytes: 11180
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int n;
        for (n = 0; a * n - (n - 1) < b; ++n) ;
        writer.println(n);
        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        private void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        private char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        private String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        private int nextInt() {
            return Integer.valueOf(next());
        }

        private long nextLong() {
            return Long.valueOf(next());
        }

        private double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n,cnt=0; cin>>n;
    rep(i,n){
        ll a; cin>>a;
        if(i%2==0 && a%2==1) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(){
  int a, b, c, d, n, tw[2048] = {};
  long long th[4096] = {};
  for(a = 0;a <= 1000;a++) for(b = 0;b <= 1000;b++) tw[a+b]++;
  for(a = 0;a <= 2000;a++) for(b = 0;b <= 2000;b++) th[a+b] += tw[a]*tw[b];

  while(~scanf("%d", &n))
    printf("%lld\n", th[n]);
  return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  st s,t="YAKI";
  cin >> s;
  rep(i,4){
    if(s[i]!=t[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


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

void extended_euclid(ll x,ll y,ll *c,ll *a,ll *b){
  ll a0,a1,a2,b0,b1,b2,r0,r1,r2,q;r0=x;r1=y;a0=1;a1=0;b0=0;b1=1;
  while(r1>0){q=r0/r1;r2=r0%r1;a2=a0-q*a1;b2=b0-q*b1;r0=r1;r1=r2;a0=a1;a1=a2;b0=b1;b1=b2;}
  *c=r0;*a=a0;*b=b0;
}

ll get_inv(ll n, ll p){
  ll a,b,c;
  extended_euclid(n,p,&c,&a,&b);
  if(a<p) a+=p;
  return a%p;
}

ll fact[2000100],fact_inv[2000100];

void init() {
  fact[0]=1;
  REP(i,1,2000100) fact[i]=fact[i-1]*i%MAX;
  fact_inv[2000050]=get_inv(fact[2000050],MAX);
  rrep(i,2000050)fact_inv[i]=fact_inv[i+1]*(i+1)%MAX;
}

ll nCr(int N,int K){
  if(K<0||K>N)return 0;
  return fact[N]*fact_inv[K]%MAX*fact_inv[N-K]%MAX;
}

void Main() {
  init();
  ll n,m;
  cin >> n >> m;
  REP(i,1,m+1) {
    ll x=n-m;
    if(x==0) {
      if(i==1) pr(1);
      else pr(0);
      continue;
    }
    ll ans=nCr(m-1,i-1)*nCr(x-1,i-1)*2%MAX;
    ans+=nCr(m-1,i-1)*nCr(x-1,i)%MAX;
    ans+=nCr(m-1,i-1)*nCr(x-1,i-2)%MAX;
    pr(ans%MAX);
  }
}

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

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

using namespace std;

#define pb push_back
#define mp make_pair
#define NL endl
#define pi 2.0*acos(0.0)
#define INTM 1e18
#define mod 1e9+7
#define FOR(i,j,n)    for(ull i=j;i<n;i++)
#define RFOR(i,j,n)    for(ull i=j;i>=n;i--)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;

int main(){
    fastIO;
    string a,b,c;
    ll x,y;
    cin>>a>>b;
    cin>>x>>y;
    cin>>c;
    if(c == a) cout<<x-1<<" "<<y<<endl;
    else cout<<x<<" "<<y-1<<endl;
}


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

typedef tuple<int, int, int> ti;
typedef tuple<long long, int, int> tli;
int main() {
  int n, m;
  cin>>n>>m;
  ti lrc[m];
  for (int i=0; i<m; i++) {
    int l, r, c;
    cin>>l>>r>>c;
    --l;
    --r;
    lrc[i] = make_tuple(l, r, c);
  }
  long long d[n];
  for (int i=0; i<n; i++) d[i] = -1;
  d[0] = 0;

  priority_queue<tli, vector<tli>, greater<tli>> pq_cost;
  priority_queue<ti, vector<ti>, greater<ti>> pq_left;

  for (int i=0; i<m; i++) {
    int l = get<0>(lrc[i]);
    int r = get<1>(lrc[i]);
    int c = get<2>(lrc[i]);
    if (l == 0) {
      pq_cost.push(make_tuple(c, l, r));
    } else {
      pq_left.push(make_tuple(l, r, c));
    }
  }
  int right = 0;
  while (right < n - 1 && !pq_cost.empty()) {
    auto cost_top = pq_cost.top();
    pq_cost.pop();
    long long c = get<0>(cost_top);
    int l = get<1>(cost_top);
    int r = get<2>(cost_top);
    if (r <= right) {
      continue;
    }
    for (int i=right+1; i<=r; i++) {
      d[i] = c;
    }
    right = r;
    while (!pq_left.empty()) {
      auto left_top = pq_left.top();
      int l = get<0>(left_top);
      int r = get<1>(left_top);
      int c = get<2>(left_top);
      if (l <= right) {
        pq_cost.push(make_tuple(d[l] + c, l, r));
        pq_left.pop();
      } else {
        break;
      }
    }
  }
  cout<<d[n-1]<<endl;
}

Measured memory_bytes: 6260
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: i64 = read();
    let b: i64 = read();
    println!("{}", a * b);
}


Measured memory_bytes: 2152
//   __                    .__              ________ .________ ________   ______  
//  |  | __  ____    ______|  |__   __ __  /  _____/ |   ____//   __   \ /  __  \ 
//  |  |/ /_/ __ \  /  ___/|  |  \ |  |  \/   __  \  |____  \ \____    / >      < 
//  |    < \  ___/  \___ \ |   Y  \|  |  /\  |__\  \ /       \   /    / /   --   \
//  |__|_ \ \___  >/____  >|___|  /|____/  \_____  //______  /  /____/  \______  /
//       \/     \/      \/      \/               \/        \/                  \/ 

#include<bits/stdc++.h>
#define range 100005
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<

using namespace std;

typedef long long ll;
typedef vector <char> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<char, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

iii kkpro[3010][3010];
int dp[3010][3010];

string a,b;


int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
	cin>>a>>b;
	int n = a.length();
	int m = b.length();
	a = "a" + a;
	b = "b" + b;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			kkpro[i][j] = {'1',{-1,-1}};
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(dp[i-1][j]>dp[i][j]){
				dp[i][j] = dp[i-1][j];
				kkpro[i][j] = {'1',{i-1,j}};
			}
			if(dp[i][j-1]>dp[i][j]){
				dp[i][j] = dp[i][j-1];
				kkpro[i][j] = {'1',{i,j-1}};
			}
			if(a[i]==b[j]){
				if(dp[i-1][j-1]+1>dp[i][j]){
					dp[i][j] = dp[i-1][j-1] + 1;
					kkpro[i][j] = {a[i],{i-1,j-1}};
				}
			}
		}
	}
	ii temp = {n,m};
	vi output;
	while(temp.fi!=-1){
		int nn = temp.fi,mm = temp.se;
		if(kkpro[temp.fi][temp.se].fi!='1'){
			output.pb(kkpro[temp.fi][temp.se].fi);
		}
		temp = kkpro[nn][mm].se;
	}
	reverse(output.begin(),output.end());
	for(int i=0;i<output.size();i++){
		cout<<output[i];
	}
	return 0;
}


Measured memory_bytes: 141568
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <queue>
#include <cmath>
#include <cstdio>

using namespace std;

int main(){
    int n; cin >> n;
    vector<vector<int>> ds(10, vector<int>(10));
    for(int i=1; i<=n; ++i){
        int msd=i, lsd=i%10;
        while(msd>=10){
            msd/=10;
        }
        ++ds[lsd][msd];
    }
    long long ans=0;
    for(int i=1; i<=n; ++i){
        int msd=i, lsd=i%10;
        while(msd>=10){
            msd/=10;
        }
        ans+=ds[msd][lsd];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    H, W, K = map(int, input().split())
    S = [input() for i in range(H)]
    ans = H * W

    for pat in range(2 ** (H - 1)):
        Cnt_sum = [0] * H  # 区分における1の数
        ans_w = 0
        ans_h =  bin(pat).count('1')
        fail = False
        for j in range(W): #横のj番目を見る
            if fail:
                break
            s = 0 #区分
            Cnt = [0] * H
            for i in range(H):
                if (S[i][j] == '1'):
                    Cnt[s] += 1
                    Cnt_sum[s] += 1

                if Cnt[s] > K:
                    fail = True
                    break

                if (1 << i) & pat > 0: 
                    s += 1

            if any([v > K for v in Cnt_sum]):
                ans_w += 1
                Cnt_sum = Cnt[::]
        else:
            ans = min(ans, ans_h + ans_w)

    print(ans)

if __name__ == '__main__':
    main()

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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int x=c-a;
  int y=d-b;
  for(int i=0;i<x;i++) cout<<'R';
  for(int i=0;i<y;i++) cout<<'U';
  for(int i=0;i<x;i++) cout<<'L';
  for(int i=0;i<y;i++) cout<<'D';
  cout<<'D';
  for(int i=0;i<x+1;i++) cout<<'R';
  for(int i=0;i<y+1;i++) cout<<'U';
  cout<<'L'<<'U';
  for(int i=0;i<x+1;i++) cout<<'L';
  for(int i=0;i<y+1;i++) cout<<'D';
  cout<<'R';
}



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

using namespace std;

typedef long long LL;
typedef unsigned int UI;

#define rSort(a) 		sort(a.rbegin(),a.rend())
#define Sort(a) 		sort(a.begin(),a.end())
#define Reverse(a) 		reverse(a.begin(),a.end())
#define Sum(a)  		accumulate(a.begin(), a.end(), 0)
#define REP(i, n) 		for(UI i = 0;i < n;i++)
#define REPR(i, n) 		for(UI i = n;i >= 0;i--)
#define FOR(i, m, n) 	for(UI i = m;i < n;i++)
#define pb(i) 			push_back(i)

#define MOD  			(LL)1e9 + 7;
#define INF  			(LL)1 << 62;

int main(int argc, const char * argv[]) {

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

	LL a, b, i;

	cin >> a >> b;

	for (i = 1; i <= 999; i++) {
		// aの高さを基準
		if ((i * (i + 1)) / 2 - a == (((i + 1) * (i + 2)) / 2 - b)) {
			break;
		}
	}

	cout << ((i + 2) * (i + 1)) / 2 - b << endl;

	return 0;

}




Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] a = new int[N];
    for (int i = 0; i < N; i++) {
      a[i] = sc.nextInt();
    }
    int[] num = new int[200001];
    for (int i = 0; i < num.length; i++) {
      num[i] = 200001;
    }
    for (int i = 0; i < N; i++) {
      if (num[a[i]] == 200001) {
        num[a[i]] = 0;
      }
      num[a[i]]++;
    }
    Arrays.sort(num);
    int kind = 0;
    for (int i = 0; i < num.length; i++) {
      if (num[i] < 200001) {
        kind++;
      }
    }
    int result = 0;
    for (int i = 0; i < kind - K; i++) {
      result += num[i];
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 64604
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

    int N;

    cin>>N;
    cout<<N/500*1000+N%500/5*5<<endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int ns = s.length();
		int nt = t.length();
		sc.close();
		String ans[] = { "Yes", "No" };
		int a = 0;
		if (nt != ns)
			a = 1;
		else {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		}
		System.out.println(ans[a]);
	}

}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

struct data {
  ll x, y, w;
  bool operator<(const data &d) const {
    return pll(x, y) < pll(d.x, d.y);
  }
};

int main(void) {
  ll N;
  cin >> N;
  vector<data> vec(N);
  REP(i, 0, N) cin >> vec[i].x >> vec[i].y >> vec[i].w;

  sort(vec.begin(), vec.end());

  vector<pll> p(N);
  vector<ll> w(N);
  REP(i, 0, N) {
    p[i] = pll(vec[i].x, vec[i].y);
    w[i] = vec[i].w;
  }

  ll ans = 0;
  REP(i, 0, N) {
    REP(px, -1, 1) REP(py, -1, 1) {
      ll x = vec[i].x + px, y = vec[i].y + py, s = 0;
      REP(dx, 0, 2) REP(dy, 0, 2) {
        if(binary_search(p.begin(), p.end(), pll(x + dx, y + dy))) {
          ll idx = lower_bound(p.begin(), p.end(), pll(x + dx, y + dy)) - p.begin();
          s += w[idx];
        }
      }
      ans = max(ans, s);
    }
  }
  cout << ans << " / " << 1 << endl;
}


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


int main(){

    int n,k;
    string s;
    cin>>n>>k>>s;
    for(int i=0;i<n;i++){
        if(i==k-1){
            putchar(s[i]-'A'+'a');
        }
        else putchar(s[i]);
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define int long long int
using namespace std;
vector<int> bit(int x){
	vector<int> a;
	while(x){
		a.push_back(x%2);
		x /=2;
	}
	reverse(a.begin(), a.end());
	return a;
}
signed main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	int x; cin>>x;
	//cout<<x<<endl;
	map<int, int> m;
	for(int i=0; i<2001; i++){
		int y=i*i*i*i*i;
		//if(i==) cout<<y<<endl;
		m[y]=i;
		m[-1*y]= (-1*i);
	}
	for(auto i=m.begin(); i != m.end(); i++){
		if(m.find(x+i->first) != m.end()){
			cout<<m[x+i->first]<<" "<<i->second<<endl;
			break;
		}
	}
	
	
}


Measured memory_bytes: 3892
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define range(i,l,h) for(int i=l;i<h;i++)
#define endl '\n'
#define I INT_MAX
#define L INT_MIN
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vi vector<int>
using namespace std;
using std::ios;
constexpr int MOD=1e9+7;
constexpr int mod=998244353;

int main()
{
 
  fastio;
  int n,x,t;
  cin>>n>>x>>t;
  int k=n/x;
  if(n%x!=0)k++;
  cout<<t*k;
}


Measured memory_bytes: 3612
#include <iostream>

using namespace std;

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

  cin >> a >> b;
  int ans;
  for(int i=0; i<2; i++){
    if(a>=b){
      ans += a;
      a--;
    }else if(a<b){
      ans += b;
      b--;
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner
import java.lang.Long.parseLong


// reverse binary //

object Main extends App {
  val sc = new Scanner(System.in)

  val N = sc.nextInt(); val K = sc.nextLong().toBinaryString.reverse

  val nums = new Array[(String, Int)](N)  // (binary, value)

  for(i <- 0 until N) {
    val a = sc.nextLong().toBinaryString.reverse
    val b = sc.nextInt()
    nums(i) = (a, b)
  }

  var ans = 0L

  // 最上位たてない
  for((bi, v) <- nums) {
    if (bi.length < K.length)
      ans += v
  }

  // on top
  var tmp = 0L
  for((bi, v) <- nums) {
    if (bi.length <= K.length) {
      var flag = true
      for (i <- 0 until bi.length) {
        if (bi(i) > K(i))
          flag = false
      }
      if (flag)
        tmp += v
    }
  }
  ans = Math.max(ans, tmp)

  // all loop
  for (i <- (0 until K.length - 1).reverse) {
    var tmp = 0L
    for((bi, v) <- nums) {
      if (bi.length > K.length || K(i) == '0')
        ()
      else if (bi.length <= i) {
        tmp += v
      }
      else if (bi.length == i)
        ()
      else {
        var flag = true
        if (bi(i) == '1')
          flag = false
        for(k <- i+1 until bi.length) {
          if (bi(k) > K(k))
            flag = false
        }
        if (flag)
          tmp += v
      }
    }
    ans = Math.max(ans, tmp)

    //println(s"${i}  ${ans}")
  }

  println(ans)
}


Measured memory_bytes: 122692
#include<cstdio>
#include<algorithm>

int main(void) {
    long long int n;
    scanf("%lld",&n);

    while(n > 0) {
        int ng=0, ok=n;
        while(ok - ng > 1) {
            long long int m = (ok+ng)/2;
            if(m*(m+1)/2 >= n)
                ok = m;
            else
                ng = m;
        }
        printf("%d\n", ok);
        n -= ok;
    }
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#define ll long long
using namespace std;
int main(){
	ll k,a,b,ans=0x7fffffffffffffff;
	scanf("%lld%lld%lld",&k,&a,&b);
	if(a>=k){
		printf("1\n");
		return 0;
	}
	if(a-b<=0){
		printf("%d\n",-1);
		return 0;
	}
	printf("%.0Lf\n",ceil((long double)(k-a)/(a-b))*2+1);
	return 0;	
}

Measured memory_bytes: 384
import java.util.*

fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map {it.toInt()}
    val ps = Array(M) { readLine()!!.split(" ").map {it.toInt()}}

    println(Math.max(Collections.min(ps.map { it[1] }) - Collections.max(ps.map {it[0]}) + 1, 0))
}


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

typedef long long ll;
constexpr ll MOD = 998244353;
constexpr int MAX_N = int(1e6) + 5;

ll power(ll x, ll n) {
    ll ans = 1;
    x %= MOD;
    while (n > 0) {
        if ((n & 1) == 1) {
            ans = ans * x % MOD;
        }
        x = x * x % MOD;  //一周する度にx, x^2, x^4, x^8となる
        n >>= 1;          //桁をずらす n = n >> 1
    }
    return ans;
}

ll mod_inv(ll x){
    return power(x, MOD-2);
}

vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }
    return res;
}

ll f(ll sum, ll sum2){
    return (((sum*sum % MOD - sum2 + MOD) % MOD) * mod_inv(2) % MOD + MOD) % MOD;
}

int main(){
    ll n, ans = 0;
    cin >> n;
    vector<ll> a(MAX_N), w(MAX_N), cnt(MAX_N);
    for(int i=0;i<n;i++){
        cin >> a[i];
        cnt[a[i]]++;
    }
    vector<ll> sum(MAX_N), sum2(MAX_N), div;
    for(int i=1;i<MAX_N;i++){
        w[i] += mod_inv(i);
        for(int j = i*2; j < MAX_N; j += i){
            w[j] = (w[j] - w[i] + MOD) % MOD;
        }
        for(ll j = i; j < MAX_N; j += i){
            sum[i] += j*cnt[j] % MOD;
            sum[i] %= MOD;
            sum2[i] += j*j%MOD*cnt[j] % MOD;
            sum2[i] %= MOD;
        }
    }
    for(int i=1;i<MAX_N;i++){
        ans += f(sum[i], sum2[i]) * w[i] % MOD;
        ans = (ans % MOD + MOD) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 39424
N = int(input())
def yakusuu(n):
    i = 1
    count = 0
    while i != n:
        if n % i == 0:
            count+=1
        i+=1
    return count+1

j = 0
n = 1
counter =0
while (n-1) != N:
    if n%2==1:
        if yakusuu(n)==8:
            counter +=1
    n+=1

print(counter)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
using namespace std;
int main()
{
 int n;
 string s;
 cin >> n;
 s=to_string(n);
 if(s.length()%2)
 {
  if(s.length()==1)
  cout << n;
  else if(s.length()==3)
  cout << n-90;
  else
  cout << n-9090;
 }
 else
 {
  if(s.length()==2)
  cout << "9";
  else if(s.length()==4)
  cout << "909";
  else
  cout << "90909";
 }
 return 0;
}


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

int main(){
    string S, T;
    cin >> S >> T;
    int ans = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] != T[i]) ans++; 
    }
    cout << ans << endl;
}




Measured memory_bytes: 3852
#include <iostream>
#include <cstdio>
using namespace std;
int n, t, ans;
int x[200005];
int main()
{
    cin >> n >> t;
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    for(int i = 1; i < n; i++){
        if(x[i] - x[i - 1] >= t){
            ans += t;
        }else{
            ans += x[i] - x[i - 1];
        }
    }
    cout << ans + t;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<string>
#include<algorithm>
#include<numeric>
using namespace std;

#define ll long long
#define int ll

int n;
int a[100010];
int x, ans;


int gcd(int a, int b)
{
	int c;

	if (a < b) {
		a += b; b = a - b; a -= b;
	}

	while (b != 0) {
		c = a % b;
		a = b;
		b = c;
	}

	return a;
}

signed main()
{
	cin >> n;
	/*
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	*/
	cin >> ans;
	for (int i = 1; i < n; i++) {
		cin >> x;
		ans = gcd(ans, x);
	}
	
	cout << ans << endl;

//	system("pause");
    return 0;
}


Measured memory_bytes: 256
n = int(input())
sqrtN = n**(1/2)
if sqrtN.is_integer():
    Pos = [int(sqrtN), int(sqrtN)]
#    print(Pos)
else:
    for i in range(int(sqrtN), 0, -1):
#        print(i)
        if n%i == 0:
            Pos = [i, n//i]
#            print(Pos)
            break
print(sum(Pos) - 2)

Measured memory_bytes: 40044
n,d= list(map(int, input().split()))
li=[list(map(int,input().split())) for _ in range(n)]
ans=0
for i in range(n-1):
    for j in range(i+1,n):
        tmp=0
        for k in range(d):
            tmp+=(li[i][k]-li[j][k])**2
        if tmp**0.5==int(tmp**0.5):
            ans+=1
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll N;
  cin >> N;
  string S, T;
  cin >> S >> T;

  string ans = "";
  for (ll i = 0; i < N; i++)
  {
    ans += S.at(i);
    ans += T.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
#define maxn 100010
#define mod 1000000007

int n,f[maxn];

int main()
{
	scanf("%d",&n);
	f[0]=1;
	for(int j=0;j<=n;j++){
		for(int i=3;j+i<=n;i++){
			f[j+i]+=f[j];
			f[j+i]%=mod;
		}
	}
	printf("%d",f[n]);
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    vector<ll> P(N), Q(N);
    rep(i, N) cin >> P[i];
    rep(i, N) cin >> Q[i];
    ll a = -1;
    ll b = -1;
    vector<ll> X;
    rep(i, N) {
        X.push_back(i + 1);
    }

    ll start = 1;
    do {
        bool ok_a = true;
        rep(i, N) {
            if (X[i] != P[i]) {
                ok_a = false;
            }
        }
        if (ok_a) a = start;
        bool ok_b = true;
        rep(i, N) {
            if (X[i] != Q[i]) {
                ok_b = false;
            }
        }
        if (ok_b) b = start;
        start++;
    } while (next_permutation(X.begin(), X.end()));
    cout << abs(a - b) << '\n';
}

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


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>
#include <algorithm>
#include <bitset>
#include <set>
#include <functional>

using namespace std;
typedef long long int lint;

string swap(string state, int i, int j) {
	char buf = state[i];
	state[i] = state[j];
	state[j] = buf;
	return state;
}

int getpos0(string state) {
	for (int i = 0; i < state.size(); i++) {
		if (state[i] == '0') return i;
	}
	return -1;
}

map<string, int> dp;

void addNextState(string state, queue<string>& states) {
	int pos0 = getpos0(state);
	switch (pos0)
	{
	case 0:
		states.push(swap(state, 0, 1));
		states.push(swap(state, 0, 4));
		break;
	case 1:
		states.push(swap(state, 1, 0));
		states.push(swap(state, 1, 2));
		states.push(swap(state, 1, 5));
		break;
	case 2:
		states.push(swap(state, 2, 1));
		states.push(swap(state, 2, 3));
		states.push(swap(state, 2, 6));
		break;
	case 3:
		states.push(swap(state, 3, 2));
		states.push(swap(state, 3, 7));
		break;
	case 4:
		states.push(swap(state, 4, 0));
		states.push(swap(state, 4, 5));
		break;
	case 5:
		states.push(swap(state, 5, 1));
		states.push(swap(state, 5, 4));
		states.push(swap(state, 5, 6));
		break;
	case 6:
		states.push(swap(state, 6, 2));
		states.push(swap(state, 6, 5));
		states.push(swap(state, 6, 7));
		break;
	case 7:
		states.push(swap(state, 7, 3));
		states.push(swap(state, 7, 6));
	default:
		break;
	}
}

bool AOJ0121()
{
	string input;
	if (!getline(cin, input)) return false;

	istringstream iss(input);
	
	char buf;
	string state;
	while (iss >> buf) {
		state += buf;
	}
	
	cout << dp[state] << endl;
	
	return true;
}

int main()
{
	string str = "01234567";

	queue<string> qu;
	qu.push(str);

	int step = 0;
	while (step < 37) {
		int sz = qu.size();
		for (int i = 0; i < sz; i++) {
			//??????????????????
			if (dp.find(qu.front()) == dp.end()) {
				dp[qu.front()] = step;
				addNextState(qu.front(), qu);
			}

			qu.pop();
		}
		step++;
	}

	while (AOJ0121()) {

	}

	return 0;
}

Measured memory_bytes: 5424
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;
using namespace std;

const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ll N = 2e3 + 1;

int s, fact[N];

ll fastpow(ll a, ll n, ll m) {
    ll res = 1;
    while (n) {
        if (n & 1)res = (res * a) % m;
        n >>= 1;
        a = (a * a) % m;
    }
    return res;
}
ll add(ll a, ll b, ll m) {
    return (a % m + b % m) % m;
}
ll sub(ll a, ll b, ll m) {
    return ((a - b) % m + m) % m;
}
ll mul(ll a, ll b, ll m) {
    return (a % m * b % m) % m;
}
ll div(ll a, ll b, ll m) {
    return mul(a, fastpow(b, m - 2, m), m);
}

int ncr(int n, int r) {
    int x = mul(fact[r], fact[n - r], mod);
    return div(fact[n], x, mod);
}

void code() {
    cin >> s;
    ll ans = 0;
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++) {
        fact[i] = mul(fact[i - 1], i, mod);
    }

    for (int i = 1; i <= s / 3; i++) {
        int tmp = s - 3 * i;
        int a = ncr(tmp + i - 1, i - 1);
        ans = add(ans, a, mod);
    }

    cout << ans << "\n";
}

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

    int t = 1;
    // cin>>t;

    while (t-- > 0) {
        code();
    }
}

Measured memory_bytes: 3644
#include<stdio.h>

int main(void)

{

    int W,H,x,y,r;



    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);



    if(x+r>W || x>=W) {

       printf("No\n");

}else if(y+r>H || y>=H){
      printf("No\n");    
}else if(x-r<0 || x<=0){
      printf("No\n");
}else if(y-r<0 || y<=0){
      printf("No\n");
}else{
      printf("Yes\n");
}
 return 0;

}

Measured memory_bytes: 584
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int a[30];

int main(void){
	int i,j;

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

	int N,K;
	cin >> N >> K;
	vector<string>v;
	for(i=1;i<=N;i++){
		string x;
		cin >> x;
		v.push_back(x);
		a[x[0]-'A']++;
	}

	sort(v.begin(),v.end());
	for(i=0;i<N-1;i++){
		if(v[i]==v[i+1]){
			a[v[i][0]-'A']--;
		}
	}

	int ans;
	for(i=N/K;i>=0;i--){
		int c=0;
		for(j=0;j<26;j++){
			if(a[j]>i) c+=i;
			else c+=a[j];
		}

		if(c>=i*K){
			ans=i; break;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 768
// ALDS1_5_A
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

vector<int> num(21);
vector<int> want(201);
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n;
    cin>>n;
    rep(i,n) cin>>num[i];
    int q;
    cin>>q;
    rep(i,q) cin>>want[i];
    int l=pow(2,n);
    map<int,int> kind;
    rep(i,l){
        int cur=0;
        rep(j,n){
            if((i>>j)&1) cur+=num[j];
        }
        kind[cur]=1;
    }  
    rep(i,q){
        if(kind.count(want[i])==1) cout<<"yes"<<endl;
        else cout<<"no"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3360
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>


typedef long long LL;
using namespace std;

inline void read(int &v){int k=0,l=1;char ch;ch=getchar();while (ch>'9' || ch<'0'){if (ch=='-') l=-1;ch=getchar();}while (ch>='0' && ch<='9') k=k*10+ch-'0',ch=getchar();v=l*k;}
inline void print(int v){if (v<0) putchar('-'),v=-v;if (v>9) print(v/10);putchar(v%10+'0');}
inline int max(int a, int b) { return a > b ? a: b;}
inline int min(int a, int b) { return a < b ? a: b;}

int n,a[200005],Next[200005],t[200005];
LL k,p;
bool v[200005];

int getNext(int now){
        p++;
        if (Next[now]<=now){
                p+=Next[now]+n-now;
        }else p+=Next[now]-now;
        now=Next[now];
        if (now==n) now=1;
        else now=now+1;
        return now;
}

int main(){
        cin>>n>>k;
        for (int i=1;i<=n;++i){
                scanf("%d",&a[i]);
        }
        for (int i=n;i>=1;--i){
                if (t[a[i]]) Next[i]=t[a[i]];
                t[a[i]]=i;
        }
        memset(t,0,sizeof t);
        for (int i=1;i<=n;++i){
                if (t[a[i]]==0) t[a[i]]=i;
                if (Next[i]==0){
                        Next[i]=t[a[i]];
                }
        }
        int now=1;
        while (1){
                if (v[now]){
                        k=((k)%p)*(n%p)%p;
                        if (k==0) return 0;
                        k--; p=0;
                        while (1){
                                int tt=getNext(now);
                                if (p>=k){
                                        break;
                                }
                                now=tt;
                        }
                        break;
                }
                v[now]=1;
                int tt=getNext(now);
                now=tt;
        }
        memset(t,0,sizeof t);
        deque <int> q;
        for (int i=now;i<=n;++i){
                if (t[a[i]]!=0){
                        int z;
                        do{
                                z=q.back(); q.pop_back();
                                t[z]=0;
                        }while (z!=a[i]);
                }else q.push_back(a[i]),t[a[i]]=1;
        }
        while (!q.empty()){
                cout<<q.front()<<" "; q.pop_front();
        }
        return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F first
#define S second
#define bitcnt(v) __builtin_popcount(v)
#define all(v) v.begin(), v.end()

int mod = 998244353;

void solution(){
	int n, k; cin >> n >> k;
	vector<vector<int>> jumps(k, vector<int>(2));
	for(int i = 0 ; i < k ; i++){
		cin >> jumps[i][0] >> jumps[i][1];
	}
	vector<ll> dp(n+1,0);
	vector<ll> pre(n+1,0);
	dp[0] = 1;
	dp[1] = 1;
	pre[1] = 1;
	for(int i = 2; i <= n; i++){
		for(auto interval : jumps){
			int l = max(1, i-interval[1]);
			int r = min(i-1, i-interval[0]);
			if(l <= r)
				dp[i] = (dp[i] + pre[r] - pre[l-1] + mod) % mod;
		}
		pre[i] = (pre[i-1] + dp[i]) % mod;
	}
	cout << dp[n]%mod << endl;



	

}	


int main(){ 
	fio;
	int t;
	t = 1;
	// cin >> t;
	for(int i = 1; i <= t; i++){
		// cout << "Case #" << i << ": ";
		solution();
	} 
	return 0;
}

Measured memory_bytes: 6372
-- A - ABC Swap

originSplit :: [Char] -> [Char] -> [[Char]]
originSplit n [] = reverse n : []
originSplit n (x:xs) = if x == ' '
                       then reverse n : originSplit "" xs
                       else originSplit (x : n) xs

doProcess input = input!!2 ++ " " ++ input!!0 ++ " " ++ input!!1

main :: IO ()
main = do
  n <- getLine
  let input = originSplit "" n
  putStrLn (doProcess input)

Measured memory_bytes: 380
# coding: utf-8
N = int(input())
X = list(map(int, input().split()))
sorted_X = sorted(X)
one = sorted_X[N//2]
two = sorted_X[N//2-1]
for i in range(N):
    if X[i] < one:
        print(one)
    else:
        print(two)

Measured memory_bytes: 25224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int Cnt(int n) {
    int cnt = 0;
    while (n) {
        n /= 10;
        cnt++;
    }
    return cnt;
}

signed main() {
    int n;
    cin >> n;
    int cnt = Cnt(n);
    int ans = (cnt - 1) * 9 + n / (int)pow(10, cnt - 1) % 10 - 1;
    int sum = 0;
    rep(i, 0, cnt) { sum += n / (int)pow(10, i) % 10; }
    // cout << sum << "\n";
    cout << max(ans, sum) << "\n";
}

Measured memory_bytes: 4032
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
using namespace std;


void solve(){
  int a, b, c, d, ans = 0; cin >> a >> b >> c >> d;
  if(a > b) ans += b;
  else ans += a;
  if(c > d) ans += d;
  else ans += c;
  cout << ans << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Speed_UP  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define 	pb	push_back 
#define 	ff	first 
#define 	ss	second 
#define sz(x) (int)x.size()
#warning Remeber to change t
using namespace std;
typedef long long ll;
inline void setIO(string name="") {
	#ifndef ONLINE_JUDGE 
	freopen((name+".in").c_str(), "r", stdin); 
	freopen((name+".out").c_str(), "w", stdout);
	#endif
	}

int main(){
	Speed_UP
	ll t;
	t=1;
	while(t--){
		ll n,m,c;
		cin>>n>>m>>c;
		ll arr[m];
		for(int i=0;i<m;i++)
			cin>>arr[i];
		ll co=0;
		for(int i=0;i<n;i++){
				ll ans=c;
				for(int j=0;j<m;j++){
					ll a;
					cin>>a;
					ans+=a*arr[j];
				}
				if(ans>0)
					co++;
		}
		cout<<co;
		
		
		
	}





}


Measured memory_bytes: 3664
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H, W = MAP()
C = [input() for _ in range(H)]

for x in C:
	print(x)
	print(x)

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


long long int mod = 1e9+7;
long long int height,width;
long long int dp[1009][10009];
char c[1009][1009];

int main(){

    cin>>height>>width;
    
    for(long long int i=1;i<=height;++i){
        for(long long int j=1;j<=width;++j){
            cin>>c[i][j];
        }
    }
    
    for(long long int i=height;i>=1;--i){
        for(long long int j=width;j>=1;--j){
            if(c[i][j]=='.'){
                if(i==height && j==width){
                    dp[i][j] = 1;
                }
                else{
                    dp[i][j] = (dp[i][j+1]%mod + dp[i+1][j]%mod)%mod;
                }
            }
        }    
    }
    
    cout<<dp[1][1];
    return 0;
}

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

static const set<char> chars{'A', 'C', 'G', 'T'};

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

  int ans{};
  int sum{};
  int right{};
  for (int left{}; left < N; left = right) {

    while (right < N
      // rightを1進めるための満たすべき条件
      && chars.find(S[right]) != chars.end()
        ) {
      // 条件更新となる処理
      ++right;
    }

    // 条件を満たすright取得時の処理
    ans = max(ans, right - left);

    while (right < N
        && chars.find(S[right]) == chars.end()
        ) {
      ++right;
    }
  }

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


Measured memory_bytes: 384
/*
 * Matheus Oliveira
 * 08:45:52 01/09/2019
 * a.cpp
*/

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

#define EPS
#define INF
#define MAXN
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define debug(x) printf("%s: %d\n", #x, x);
#define debugarr(x, ini, fim) printf("%s: ", #x); for(int i = ini; i <= fim; i++) printf("%d%c", x[i], (i == fim) ? '\n' : ' ');

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

int main() {
	int ans = 0;
	string a, b;
	cin >> a;
	cin >> b;
	for(int i = 0; i < 3; i++) ans += (a[i] == b[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		char a=sc.next().charAt(0);
		if(Character.isUpperCase(a)){
			System.out.println("A");
		}else{
			System.out.println("a");
		}
	}
}


Measured memory_bytes: 35684
n = int(input().strip())
if n == 0:
    print(1)
elif n == 1:
    print(1)
else:
    lst = [0 for i in range(0,n+1)]
    lst[0] = 1
    lst[1] = 1
    for i in range(0,n-1):
        lst[i+2] = lst[i+1] + lst[i]
    print(lst[n])


Measured memory_bytes: 5604
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

using namespace std;

#define ll long long
#define db double
#define clr(a, b) memset(a, b, sizeof(a))

const int maxn = 5e5 + 10;
const int inf = 0x7ffffff;
const ll mod = 1e9 + 7;

int n, k;
void solve()
{
    cin >> n >> k;
    ll lsum = 0, rsum = 0;
    for (int i = 0; i < k;i++)
    {
        lsum += i;
        rsum += n  - i;
    }
    ll sum = 0;
    sum = (sum + rsum - lsum + 1) % mod;
    for (int i = k; i < n + 1;i++)
    {
        lsum += i, rsum += n - i;
      //  cout << lsum << " " << rsum << " " << rsum - lsum << "\n";
        sum = (sum + rsum - lsum + 1) % mod;
    }
    cout << sum << "\n";
}

int main()
{
    //freopen("out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T = 1;
    //cin >> T;
    while(T-- > 0)
        solve();

}

Measured memory_bytes: 3688
package main

import (
	"fmt"
	"bufio"
	"os"
	"reflect"
	"strconv"
	"strings"
)

func mapf(f interface{}, list interface{}) interface{} {
	fv, listv := reflect.ValueOf(f), reflect.ValueOf(list)

	if fv.Kind() != reflect.Func || listv.Kind() != reflect.Slice {
		return nil
	}

	len := listv.Len()
	ret := reflect.MakeSlice(reflect.SliceOf(fv.Type().Out(0)), len, listv.Cap())

	for i := 0; i < len; i++ {
		v := fv.Call([]reflect.Value{listv.Index(i)})
		ret.Index(i).Set(v[0])
	}

	return ret.Interface()
}

func main() {
	var n, m, l int
	scanner := bufio.NewScanner(os.Stdin)

	fmt.Scan(&n, &m, &l)

	A := mapf(func ([]int)[]int { scanner.Scan(); return mapf(strconv.Atoi, strings.Split(scanner.Text(), " ")).([]int) }, make([][]int, n)).([][]int)
	B := mapf(func ([]int)[]int { scanner.Scan(); return mapf(strconv.Atoi, strings.Split(scanner.Text(), " ")).([]int) }, make([][]int, m)).([][]int)
	for i := 0; i < n; i++ {
		x := make([]string, l)
		for j := 0; j < l; j++ {
			v := 0
			for k := 0; k < m; k++ {
				v += A[i][k]*B[k][j]
			}
			x[j] = strconv.Itoa(v)
		}
		fmt.Println(strings.Join(x, " "))
	}
}



Measured memory_bytes: 4644
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

int main()
{
	long L, R;
	std::cin >> L >> R;

	if (R/2019 != L/2019 || L%2019 == 0) {
		std::cout << "0\n";
		return 0;
	}
	
	long result = 2018;
	for (long i = L; i < R; ++i) {
		for (long j = i+1; j <= R; ++j) {
			result = std::min(result, (i*j)%2019);
		}
	}
	
	std::cout << result << "\n";
}


Measured memory_bytes: 256