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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

signed main() {
	int n, m;
	cin >> n >> m;
	cout << (n == m ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n;
  cin>>n;
  std::vector<int> b(n-1),a(n);
  for (int i = 0; i < n-1; ++i)
  {
    cin>>b[i];
  }
  a[0]=b[0];
  a[n-1]=b[n-2];
  for (int i = 1; i < n-1; ++i)
  {
    a[i]=min(b[i-1],b[i]);
  }
  int sum=0;
  for(auto&& e: a) {
    sum+=e;
  }
  cout<<sum;
}

Measured memory_bytes: 256
sixexp=[6**i for i in range(1,7)]
nineexp=[9**i for i in range(1,6)]
lis=[1]+sixexp+nineexp

n=int(input())

dp=[1000000 for i in range (n+1)]
dp[0]=0

for i in range(n):
    for j in lis:
        if i+j<=n:
            dp[i+j]=min(dp[i+j],dp[i]+1)

print(dp[n])

Measured memory_bytes: 3864
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
import math
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math as M
MOD=10**9+7
import sys
#####################################
a,b,c=INPUT()
x=int(input())
bool=True
if b<=a:
    while(b<=a and x>0):
        b*=2
        x-=1
    if b>a:
        if b>=c:
            while(b>=c and x>0):
                c*=2
                x-=1
            if x<0 or c<=b:
                bool=False
    else:
        bool=False
else:
    if b>=c:
        while(b>=c and x>0):
            c*=2
            x-=1
        if x<0 or c<=b:
            bool=False
    
if bool is True:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 62248
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long
#define inf 1000000001
#define INF 1000000000000000001ll
using namespace std;
#define N 200005
#define lc (now<<1)
#define rc (now<<1|1)
int n,Q,a,b,x[N];ll tg[N<<2],f[N<<2],g[N<<2],h[N<<2];
void up(int now){
	f[now]=min(f[lc],f[rc]);
	g[now]=min(g[lc],g[rc]);
	h[now]=min(h[lc],h[rc]);
}
void add(int now,ll v){
	if (f[now]!=INF) tg[now]+=v,f[now]+=v,g[now]+=v,h[now]+=v;
}
void down(int now){
	if (!tg[now]) return;
	add(lc,tg[now]);add(rc,tg[now]);tg[now]=0;
}
void upd(int now,int l,int r,int x,ll y){//单点修改 
	if (l==r){
		if (y<f[now]) f[now]=y,g[now]=y-l,h[now]=y+l;
		return;
	}
	down(now);int mid=l+r>>1;
	if (x<=mid) upd(lc,l,mid,x,y);else upd(rc,mid+1,r,x,y);
	up(now);
}
ll qmin(int now,int l,int r,int x,int y,int typ){
	if (x>y) return INF;
	if (x<=l&&r<=y) return typ?h[now]:g[now];
	down(now);int mid=l+r>>1;ll res=INF;
	if (x<=mid) res=min(res,qmin(lc,l,mid,x,y,typ));
	if (y>mid) res=min(res,qmin(rc,mid+1,r,x,y,typ));
	return res;
}
int main(){
	scanf("%d%d%d%d",&n,&Q,&a,&b);
	rep (i,1,Q) scanf("%d",&x[i]);x[0]=b;
	rep (i,0,(N<<2)-1) f[i]=g[i]=h[i]=INF,tg[i]=0;
	upd(1,1,n,a,0);
	rep (i,1,Q){
		ll tmp=min(qmin(1,1,n,1,x[i],0)+x[i],qmin(1,1,n,x[i]+1,n,1)-x[i]);
		add(1,abs(x[i]-x[i-1]));upd(1,1,n,x[i-1],tmp);
	}
	printf("%lld\n",f[1]);
	return 0;
}

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

string s,t;
int Hash1[26],Hash2[26];

template<typename Drake>
void read(Drake &x){
	x=0;char ch=getchar();bool f=1;
	while(!isdigit(ch)){
		if(ch=='-')f^=1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	x*=(2*f-1);
}

template<typename Drake>
void write(Drake x){
	if(x<0){x=-x;putchar('-');}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}

template<typename Drake>
void writeln(Drake x){
	write(x);
	puts("");
}

void init(){
	cin>>s>>t;
}

int main(){
	init();
	memset(Hash1,0,sizeof Hash1);
	memset(Hash2,0,sizeof Hash2);
	for(int i=0;i<s.size();++i)
	if(Hash1[s[i]-'a']>0&&Hash1[s[i]-'a']!=t[i]-'a'){
		puts("No");return 0;
	}
	else Hash1[s[i]-'a']=t[i]-'a';
	for(int i=0;i<t.size();++i)
	if(Hash2[t[i]-'a']>0&&Hash2[t[i]-'a']!=s[i]-'a'){
		puts("No");return 0;
	}
	else Hash2[t[i]-'a']=s[i]-'a';
	puts("Yes");
	return 0;
}

Measured memory_bytes: 776
#include <cstdio>

const int MOD=1e9+7;

int dp[4005][2005];

int main(){
  int N,M,K;
  scanf("%d %d %d",&N,&M,&K);
  int nodes=(N+M-1)/(K-1);
  dp[0][0]=1;
  for(int i=0;i<nodes;i++){
    for(int j=0;j<=N;j++){
      //printf("dp[%d][%d]=%d\n",i,j,dp[i][j]);
      for(int k=0;k<K&&j+k<=N;k++){
	dp[i+1][j+k]=(dp[i+1][j+k]+dp[i][j])%MOD;
      }
    }
  }
  int total=dp[nodes][N];
  if(N>=K){
    while(M>=1){
      total=(total+dp[nodes-1][N-K])%MOD;
      nodes--;
      M-=K-1;
    }
  }
  printf("%d\n",total);
  return 0;
}


Measured memory_bytes: 31488
N = int(input())
h = list(map(int, input().split()))

cost = [0 for _ in range(N)]

cost[1] = abs(h[0] - h[1])
for i in range(2,N):
    cost[i] = min(cost[i-1] + abs(h[i] - h[i-1]), cost[i-2] + abs(h[i] - h[i-2]))
    
print(cost[-1])

Measured memory_bytes: 13908
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(ll n){
    ll res = 0;
    vector<ll> w(n); for(auto &in:w) cin >> in;
    vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));
    for(int i = 2; i <= n;i++){
        for(int j = 0; j < n;j++){
            int k = j + i -1;
            if(k >= n) continue;
            
            if(dp[j+1][k-1] == i-2 && abs(w[j] - w[k]) <= 1) dp[j][k] = i;
            for(int l = j; l < k;l++){
                dp[j][k] = max(dp[j][k],dp[j][l] + dp[l+1][k]);
            }
        }
    }
    res = dp[0][n-1];
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll n;
    while(cin >> n,n){
        cout << solve(n) << endl;
    }
    return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

int N, H;
std::vector<int> a, b;

int main() {
  cin >> N >> H;
  a.resize(N);
  b.resize(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i] >> b[i];
  }
  
  int ans = 0;
    
  std::sort(a.begin(), a.end(), std::greater<int>());
  std::sort(b.begin(), b.end(), std::greater<int>());
  
  for (int i = 0; i < N; ++i) {
    if (H <= 0 || b[i] <= a[0]) {
      break;
    }
    H -= b[i];
    ans++;
  }
  
  if (H > 0) {
    ans += (H / a[0]) + (H % a[0] == 0 ? 0 : 1);
  }
  
  cout << ans << endl;
    
  return 0;
}
  


Measured memory_bytes: 1024
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define int long long


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

    int q; cin >> q;
    vector<int> l(q),r(q);
    for(int i = 0;i < q;i ++){
        cin >> l.at(i) >> r.at(i);
    }  
    for(int i = 0;i < q;i ++){
        if(l.at(i) < 3) l.at(i) = 3;
    }

    vector<int> sosu(100001),sosunomi(1);
    sosunomi.at(0) = 2;
    for(int i = 3;i < 100001;i ++){
        for(int j = 0;j < sosunomi.size();j ++){
            if(i % sosunomi.at(j) == 0){
                break;
            }
            if(j == sosunomi.size() - 1){
                sosu.at(i) = 1;
                sosunomi.push_back(i);
            }
        }
    }  

    sosu.at(2) = 1;

    vector<int> a(100001);
    for(int i = 0;i < 100001;i ++){
        if(sosu.at(i) && sosu.at((i+1) / 2)){
            a.at(i) = 1;
        }
    }
    a.at(2) = 1;

    vector<int> sum(100001);
    for(int i = 1;i < 100001;i ++){
        sum.at(i) = sum.at(i-1) + a.at(i);
    }

    for(int i = 0;i < q;i ++){
        cout << sum.at(r.at(i)) - sum.at(l.at(i) - 1) << endl;
    }
}

Measured memory_bytes: 4736
'use strict'

function Main(input){
	let temp = input.trim().split('\n');
	const N = parseInt(temp[0].split(' ')[0]);
	const Q = parseInt(temp[0].split(' ')[1]);
	const S = temp[1];

	const ac = new Array(N);
	let count = 0;
	ac[0]=0;
	for(let i=1;i<N;i++){
		if((S[i-1]+S[i])=='AC') count++;
		ac[i] = count;
	}
	//console.log(ac);
	const answer = new Array(Q);
	for(let i=0;i<Q;i++){
		let li = parseInt( temp[i+2].split(' ')[0] )-1;
		let ri = parseInt( temp[i+2].split(' ')[1] )-1;
		//console.log(ri,li,ac[ri],ac[li])
		answer[i] = ac[ri] - ac[li] ;
	}

	console.log(answer.join('\n'));

}

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


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

int d(int n,int i){return i>1 ? n%i ? d(n,i-1) : 0 : 1;}
int p(int n){return n>1 ? d(n,sqrt(n)) : 0;}

int main(){
	int n,r;
	while(cin >> n){
		r=0;
		for(int i=1;i<=n;i++){
			r+=(p(i)+p(n-i+1))/2;
		}
		cout << r << endl;
	}
}

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

int main()
{
    string s;
    cin>>s;
    if(s.at(0)==s.at(1)&&s.at(1)==s.at(2))
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int H, W, N;
    cin >> H >> W >> N;
    map<pair<int, int>, int> mp;
    REP (i, N) {
        int a, b;
        cin >> a >> b;
        REP (dy, 3) REP (dx, 3) {
            int ny = a - dy;
            int nx = b - dx;
            if (ny >= 1 && nx >= 1 && ny <= H - 2 && nx <= W - 2) mp[{ny, nx}]++;
        }
    }
    vector<int> cnt(10, 0);
    cnt[0] = (H - 2) * (W - 2);
    for (auto p : mp) {
        cnt[p.second]++;
        cnt[0]--;        
    }
    REP (i, 10) cout << cnt[i] << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 56576
//https://atcoder.jp/contests/dp/tasks/dp_b
//B - Frog 2 
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N, K; cin>>N>>K;
    vector<ll> hn(N+1,0);
    FOR(i,1,N+1){
        cin>>hn.at(i);
    }
    vector<ll> ans(N+1,INT64_MAX);
    ans[1]=0;
    auto get_val = [&](ll p,ll ofs)->ll{
        if(p-ofs<=0) return INT64_MAX;
        ll a=abs(hn[p]-hn[p-ofs]);
        return a+ans[p-ofs];
    };

    FOR(i,2,N+1){
        FOR(j,1,K+1){
            ll v=get_val(i,j);
            chmin(ans[i],v);
        }
    }
    cout<<ans[N]<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
 
int main(void){
  long long int n = 0, a = 0, b = 0;
  long long int ans = 0;
  
  scanf("%lld %lld %lld",&n,&a,&b);
  
  if(a>b){
    ans = a;
    a = b;
    b = ans;
  }
  
  if((b-a) % 2 == 0){
    ans = (b-a) / 2;
  }else if((a+b-1)<=n){
    ans = (a+b-1)/2;
  }else{
    ans = (n-a+n-b+1)/2;
  }
  
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=405;
ll a[maxn],minn[maxn][maxn],front[maxn];
void fl()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int main()
{
//    fl();
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		front[i]=front[i-1]+a[i];
	}
	memset(minn,0x3f,sizeof(minn));
	for(int i=1;i<=n;i++)
		minn[i][i]=0;
	for(int len=2;len<=n;len++)
		for(int i=1;i+len-1<=n;i++)
		{
			int l=i,r=i+len-1;
			for(int b=l;b<r;b++)
				minn[l][r]=min(minn[l][r],minn[l][b]+minn[b+1][r]);
			minn[l][r]+=front[r]-front[l-1];
		}
	printf("%lld\n",minn[1][n]);
	return 0;
}


Measured memory_bytes: 5072
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
const int N=200000+10;
const int B=29;

int n,ans,a[N],b[N],rb[B][N];

void prework()
{
	int i,j,S;
	for(i=0;i<B;++i)
	{
		S=(1<<(i+1))-1;
		for(j=1;j<=n;++j)
			rb[i][j]=b[j]&S;
		sort(rb[i]+1,rb[i]+n+1);
	}
}

void solve(int x)
{
	int i,S,S1,A,t;
	for(i=0;i<B;++i)
	{
		S=(1<<i)-1;
		t=x&(S1=(A=1<<(i+1))-1);
		ans^=((
				upper_bound(rb[i]+1,rb[i]+n+1,S1-t)-
				upper_bound(rb[i]+1,rb[i]+n+1,S-t)+
				upper_bound(rb[i]+1,rb[i]+n+1,(A^S1)-t)-
				upper_bound(rb[i]+1,rb[i]+n+1,(A^S)-t))&1)<<i;
	}
}

int main()
{
	scanf("%d",&n);
	int i;
	for(i=1;i<=n;++i)
		scanf("%d",a+i);
	for(i=1;i<=n;++i)
		scanf("%d",b+i);
	prework();
	for(i=1;i<=n;++i)
		solve(a[i]);
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 24448
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    int h, w; cin >> h >> w;
    int n; cin >> n;
    vector<int> a;
    vector< vector<int> > res;
    REP(i, n) {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    int color = 1;
    REP(i, h) {
        vector<int> row;
        REP(j, w) {
            row.push_back(color);
            a[color-1]--;
            if (a[color-1] == 0) {
                color++;
            }
        }
        if (i % 2 == 1) {
            sort(ALL(row), greater<int>());
        }
        res.push_back(row);
    }
    REP(i, h) {
        REP(j, w) {
            if (j != 0) {
                cout << " ";
            }
            cout << res[i][j];
        }
        cout << endl;
    }
    return 0;
}

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

int main(){
int N, A, B, C, D;
cin >> N >> A >> B >> C >> D;
string S;
cin >> S;

// S.at(A - 1) = 'A';
// S.at(B - 1) = 'B';
bool flag = true;
bool flag2 = false;
for(int i = 0; i < N; i++){ 
     if (i > A - 1 && i < C - 1) {
         if(S.at(i) == '#' && S.at(i + 1) == '#') {
             flag = false;
             break;
         }
     }    
     if (i > B - 1 && i < D - 1) {
         if(S.at(i) == '#' && S.at(i + 1) == '#') {
             flag = false;
             break;
         }
     }
     if (C > D && i > B - 3 && i < min(C, D) - 1){
         if(S.at(i) ==  '.' && S.at(i + 1) ==  '.' && S.at(i + 2) ==  '.' )
         flag2 = true;
     }
    

     }  


if(C < D) flag2 = true;
// cout << flag << flag2 << endl;

if(flag && flag2){
    cout << "Yes" << endl;
}else{
    cout << "No" << endl;
}


}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

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

		solve(sc, out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		String s = sc.next();
		
		char[] c = s.toCharArray();
		c[k-1] = Character.toLowerCase(c[k-1]);
		
	for(char ch : c) {
		out.print(ch);
	}
	}

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

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

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

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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

const int MAXN = 2005;
int n, a, b, d[MAXN], k, h[MAXN], ans = MAXN;
vector<pair<int, int> > R;
vector<int> Mat[MAXN];
bool se[MAXN];

void DFS(int v, int lh) {
	h[lh]++;
	se[v] = true;
	for (int i = 0; i < Mat[v].size(); i++)
		if (!se[Mat[v][i]])
			DFS(Mat[v][i], lh + 1);
}

int main() {
	cin >> n >> k;
	for (int i = 0; i < n - 1; i++) {
		cin >> a >> b;
		Mat[a].push_back(b);
		Mat[b].push_back(a);
		R.push_back({a, b});
	}
	if (k % 2 == 0) {
		for (int i = 1; i <= n; i++) {
			int res = 0;
			fill_n(h, MAXN, 0);
			fill_n(se, MAXN, 0);
			DFS(i, 0);
			for (int j = k / 2 + 1; j < n; j++)
				res += h[j];
			ans = min(ans, res);
		}
	} else {
		for (int i = 0; i < n - 1; i++) {
			int res = 0;
			fill_n(h, MAXN, 0);
			fill_n(se, MAXN, 0);
			se[R[i].first] = true;
			se[R[i].second] = true;
			DFS(R[i].first, 0);
			DFS(R[i].second, 0);
			for (int j = k / 2 + 1; j < MAXN; j++)
				res += h[j];
			ans = min(ans, res);
		}
	}
	cout << ans;
}

Measured memory_bytes: 512
// pana1-3
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    ll a, b, c;
    cin >> a >> b >> c;
    string ans = "No";
    if(a + b >= c){
        cout << "No" << endl;
        return 0;
    }
    ll d = c - a - b;
    if(4 * a * b < d * d)ans = "Yes";
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep2(i, n) for(ll i = 2; i <=(ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)

ll pow(ll a, ll n) { //compute a^n with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

ll pow(ll a, ll n, ll mod) { //compute a^n (mod mod) with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int MAX = 199;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

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

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

//順列計算
ll PER(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[n - k] % MOD) % MOD;
}

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll ans1 = a*c;
    ll ans2 = a*d;
    ll ans3 = b*c;
    ll ans4 = b*d;
    ll ans = ans1;
    ans = max(ans,ans2);
    ans = max(ans,ans3);
    ans = max(ans,ans4);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
inline int read_() {
	int x_=0,f_=1;char c_=getchar();
	while(c_<'0'||c_>'9') {if(c_=='-') f_=-1;c_=getchar();}
	while(c_>='0'&&c_<='9') {x_=(x_<<1)+(x_<<3)+c_-'0';c_=getchar();}
	return x_*f_;
}
#define maxn 100020
int n,head[maxn],tot = 0,sze[maxn],max_sze[maxn],mind,root;
long long ans = 0;
struct edge {
	int v,nxt,w;
}e[maxn<<1];
inline void add_(int u,int v,int w) {
	e[++tot].v = v;
	e[tot].w = w;
	e[tot].nxt = head[u];
	head[u] = tot;
}

void dfs_(int u,int fa)  {
	sze[u] = 1;
	for(int i = head[u];~i;i = e[i].nxt)  {
		int v = e[i].v;
		if( v == fa ) continue;
		dfs_(v,u);
		sze[u] += sze[v];
		max_sze[u] = max( max_sze[u],sze[v] );
		ans += (long long) 2 * e[i].w * min( sze[v],n - sze[v] );
	}
	max_sze[u] = max( max_sze[u],n - sze[u] );
	if( max_sze[u] < mind ) {
		mind = max_sze[u];
		root = u;
	}
}

int main() {
	memset(head,-1,sizeof(head));
	n = read_();int x,y,z;
	for(int i = 1;i < n;++i) {
		x = read_();y = read_();z = read_();
		add_(x,y,z);add_(y,x,z);
	}
	mind = n + 1;
	dfs_(1,0);
	mind = 200000000;
	for(int i = head[root];~i;i = e[i].nxt) {
		int v = e[i].v;
		if( max_sze[root] == max_sze[v] ) {ans -= e[i].w;printf("%lld",ans);return 0;}
		mind = min( mind,e[i].w );
	}	
	printf("%lld",ans-mind);
	return 0;
}

Measured memory_bytes: 9088
A = {}

for i in range(3):
    a1, a2, a3 = map(int, input().split())
    A[a1] = (i+1,1)
    A[a2] = (i+1,2)
    A[a3] = (i+1,3)

N = int(input())

Bingo = {}
for i in range(3):
    Bingo[(i+1,1)] = False
    Bingo[(i+1,2)] = False
    Bingo[(i+1,3)] = False

for i in range(N):
    B = int(input())
    if B in A:
        Bingo[A[B]] = True

ans = False

for i in range(1, 4):
    ans = ans or (Bingo[(i,1)] and Bingo[(i,2)] and Bingo[(i,3)])
    ans = ans or (Bingo[(1,i)] and Bingo[(2,i)] and Bingo[(3,i)])
ans = ans or (Bingo[(1,1)] and Bingo[(2,2)] and Bingo[(3,3)])
ans = ans or (Bingo[(1,3)] and Bingo[(2,2)] and Bingo[(3,1)])

if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
// 2020 4/15
// ABC 057 B checkpoints
#include <algorithm>
#include <complex>
#include <string>
#include <deque>
#include <iostream>
#include <set>
#include <stack>
#include <string>
#include <queue>
#include <utility>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;


int main() {
    int n, m;
    cin >> n >> m;
    ll a, b, c, d;
    vector<P> student;
    vector<P> point;
    for(int i = 0; i < n; i++){
        cin >> a >> b;
        student.push_back(make_pair(a, b));
    }
    for(int j = 0; j < m; j++){
        cin >> c >> d;
        point.push_back(make_pair(c, d));
    }
    // for(auto a : student){
    //     cout << a.first << a.second << endl;
    // }
    // for(auto a : point){
    //     cout << a.first << a.second << endl;
    // }
    for (int i = 0; i < n; i++){
        int index = 0;
        ll ans = 10000000000;
        for (int j = 0; j < m; j++){
            // cout << i << j << endl;
            int dst = abs(student[i].first - point[j].first) 
                + abs(student[i].second - point[j].second);
            if (dst < ans) {
                ans = dst;
                index = j;
            }
        }
        cout << ++index << 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();
        char[] aArr = sc.next().toCharArray();
        char[] bArr = sc.next().toCharArray();
        char[] cArr = new char[n * 2];
        for (int i = 0; i < n; i++) {
            cArr[i * 2] = aArr[i];
            cArr[i * 2 + 1] = bArr[i];
        }
        System.out.println(cArr);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define pb push_back
#define int long long
//#define M 998244353
#define M 1000000007
using namespace std;
const int inf=4e18;
const int MX=100;
const int MN=-100;
const double pi=3.14159265358979;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n,o=0;cin>>n;
	if(!(n&1))
	{
		int i=5,j=1;
		while(i<=n)
		{
			int x=n/i;
			int y=x-x%10;
			int z=(y/5)*2+(x%10)/2;
			o+=z*j;
			j++;
			i*=5;
		}
	}
	cout<<o<<endl;
}

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

int main(void){
  string s1, s2;
  cin >> s1 >> s2;
  for(int i=0;i<s1.size();++i){
    cout << s1[i];
    if(s2.size() > i) cout << s2[i];
  }
  cout << endl;
}

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

int main(void){
  string tbl = "abcdefghijklmnopqrstuvwxyz.?! ";
  string msg, dec;
  int err;
  
  while (cin >> msg){
    if (msg.size()%2){ // msg length is odd
      cout << "NA" << endl;
      continue;
    }
    err = 0;
    dec = "";
    for (int i=0; i<msg.size(); i+=2){
      int n,m;
      n = msg[i]-'1';
      m = msg[i+1] - '1';
      if (n<0 || n>=6 || m<0 || m>=5){
        err = 1;
        break;
      }
      dec += tbl[n*5+m];
    }
    if (err){
      cout << "NA" << endl;
    } else {
      cout << dec << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define rep(i,n) for (int i=1;i<=(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int ans=0;
  int a,b;
  cin >> a >> b;
  rep(i,100000){
    int temp8 = i *0.08;
    if(temp8==a){
      int temp10 = i*0.1;
      if(temp10==b){
        cout << i << endl;
        return 0;
      }
    }
  }
  cout << -1 <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
const long long MOD = 1000000007;
int N, X, Y, root, semiroot, count[200001];
long long fc[200001], fi[200001];
std::vector < std::pair < int, int > > C[200001];
int main()
{
	scanf("%d%d%d", &N, &X, &Y);
	fc[0] = fi[0] = fi[1] = 1;
	for (int i = 2; i <= N; i++)
		fi[i] = (MOD - MOD / i) * fi[MOD % i] % MOD;
	for (int i = 1; i <= N; i++)
	{
		fc[i] = fc[i - 1] * i % MOD;
		fi[i] = fi[i - 1] * fi[i] % MOD;
	}
	for (int i = 1, c, w; i <= N; i++)
	{
		scanf("%d%d", &c, &w);
		C[c].push_back({ w, 1 });
	}
	for (int i = 1; i <= N; i++)
		std::sort(C[i].begin(), C[i].end());
	for (int i = 1; i <= N; i++)
	{
		auto &V = C[i];
		auto it = V.begin();
		while (it != V.end() && V.front().first + it -> first <= X)
			it++;
		if (it - V.begin() > 1)
		{
			std::vector < std::pair < int, int > > tmp(V.end() - it + 1);
			tmp.front() = { V.front().first, it - V.begin() };
			std::copy(it, V.end(), tmp.begin() + 1);
			V = std::move(tmp);
		}
	}
	for (int i = 1; i <= N; i++)
		if (!C[i].empty() && (!root || C[i].front().first < C[root].front().first))
			root = i;
	for (int i = 1; i <= N; i++)
		if (!C[i].empty() && i != root && (!semiroot || C[i].front().first < C[semiroot].front().first))
			semiroot = i;
	if (!semiroot || C[root].front().first + C[semiroot].front().first > Y)
	{
		puts("1");
		return 0;
	}
	for (int i = 1; i <= N; i++)
		for (auto j : C[i])
			if (j.first + C[i == root ? semiroot : root].front().first <= Y)
				count[i] += j.second;
	long long O = fc[std::accumulate(count + 1, count + N + 1, 0)];
	for (int i = 1; i <= N; i++)
		O = O * fi[count[i]] % MOD;
	printf("%lld\n", O);
	return 0;
}


Measured memory_bytes: 15360
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll n, p;
    string s;
    cin >> n >> p >> s;
    ll ans = 0, cnt = 0;
    vector<ll> a(n);
    if(p == 2 || p == 5){
        rep(i, n){
            cnt = cnt * 10;
            cnt += s[i]-'0';
            cnt %= p;
            a[i] = cnt;
        }
        rep(i, n){
            if(a[i] == 0)ans += i+1;
        }
        cout << ans << endl;
    }
    else{
        ll t = 1;
        for(int i = n-1; i >= 0; i--){
            cnt += t * (s[i]-'0') % p;
            cnt %= p;
            a[i] = cnt;
            t = t * 10 % p;
        }
        map<ll, ll> mp;
        mp[0]++;
        for(int i = n-1; i >= 0; i--){
            ans += mp[a[i]];
            mp[a[i]]++;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 2564
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = "";    
        str = sc.nextLine();
        int i;
        String result = "";
        char c;
        for(i=0;i<str.length();i++){
            c = str.charAt(i);
            if(Character.isUpperCase(c)== true) {
                c += 32;
                result += c;
            }else if(Character.isLowerCase(c)== true){
                c -= 32;
                result += c;
            }else{
                result += c;
            }
        }
        
        System.out.println(result);
        sc.close();
    }
}



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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String s;

            // キーボードから文字列を読み込む
            s = Console.ReadLine();

            // char型の配列に変換する
            char[] cs = s.ToCharArray();

            // 4番目の文字を 7 から 8 に書き換える
            cs[3] = '8';

            // 結果を表示する
            Console.WriteLine(cs);

            // キー入力待ち
            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 11092
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int K = sc.nextInt();
	int[] l = new int[N-1];
	int[] x = new int[N];
	if(K == 1) {
	    System.out.println(sc.nextInt());
	    return;
	}
	for(int i = 0; i<N; i++) {
	    x[i] = sc.nextInt();
	    if(i > 0) {
		l[i-1] = x[i] - x[i-1];
	    }
	}
	int min = Integer.MAX_VALUE;
	for(int i = 0; i+K-2 < N-1; i++) {
	    int kl = 0;
	    for(int j = 0; j< K-1; j++){
		kl = kl + l[i+j];
	    }
	    int n = Math.min(Math.abs(x[i])+kl, Math.abs(x[i+K-1])+kl);
	    if(n<min) min = n;
	}
	System.out.println(min);

    }
}

Measured memory_bytes: 59472
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <fstream>
#include <iomanip>
//#include <unordered_map>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;
typedef pair<int, int> P;
typedef long long ll;

int main()
{
   // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    map<char, int> m;
    string op;
    cin >> op;
    for(int i = 0; i < op.size(); i++)
    {
        m[op[i]]++;
    }
    for(auto it = m.begin(); it != m.end(); it++)
    {
        if(it -> second % 2)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long n,a,b;
  cin>>n>>a>>b;
  long count=0,lo=1;
  lo=n/(a+b);
  count+=lo*a;
  long left=n-(lo*a + lo*b);
  if(left>a)
    left=a;
  cout<<count+left;

	}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main(void) {
  string S, T;
  cin >> S >> T;
  int minhd = T.size();
  for (size_t i = 0; i + T.size() - 1 < S.size(); i++) {
    int hd = 0;
    for (size_t j = 0; j < T.size(); j++) {
      if (S[i + j] != T[j]) hd++;
    }
    minhd = min(hd, minhd);
  }
  cout << minhd << endl;
  return 0;
}

Measured memory_bytes: 3596
a,b=map(int,input().split())
l=[]
for i in range(a):
    s=input()
    if set(s)=={"."}:
        continue
    else:
        l.append(s)
#print(l)
r=""
l2=[]
for i in range(b):
    for t in range(len(l)):
        r+=l[t][i]
#    print(r)
    if set(r)!={"."}:
        l2.append(r)
    r=""
g=""
#print(l2)
for i in range(len(l2[0])):
    for t in l2:
        g+=t[i]
    print(g)
    g=""
        

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

int main() {
  long long X;
  cin >> X;
  int ans=0;
  long long A=100;

  for(int i=0;i<10000000;i++){
    if(A>=X){
      cout<<i<<endl;
      break;
    }
    else {
      A*=1.01;
    }
  }
}


Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
int ddx[8]={0,0,-1,1,1,1,-1,-1};
int ddy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	char s[101];
	cin>>s;
	cout<<s[0]<<strlen(s)-2<<s[strlen(s)-1]<<endl;
	return 0;
}

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

using namespace std;

typedef pair<int, int> P;

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  int x_r = -100;
  int y_l = 100;
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    x_r = max(x_r, x);
  }
  x_r = max(x_r, X);
  for (int i = 0; i < M; ++i) {
    int y;
    cin >> y;
    y_l = min(y_l, y);
  }
  y_l = min(y_l, Y);
  if (x_r < y_l) cout << "No War" << endl;
  else cout << "War" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>

using namespace std;


int main(void){

	int m,f,r;

	while(1){
		cin>>m>>f>>r;
		if(m==-1&&f==-1&&r==-1) break;
		if(m==-1||f==-1) cout<<"F"<<endl;
		else if(m+f>=80) cout<<"A"<<endl;
		else if(m+f>=65) cout<<"B"<<endl;
		else if(m+f>=50) cout<<"C"<<endl;
		else if(m+f>=30&&r>=50) cout<<"C"<<endl;
		else if(m+f>=30&&r<50) cout<<"D"<<endl;
		else cout<<"F"<<endl;
	}

	return 0;
}

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

int main(){
	while (true){
		int x, y;
		cin >> x >> y;

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

		if (x > y){
			cout << y << " " << x << endl;
		}
		else {
			cout << x << " " << y << endl;
		}
	}
	return 0;
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n; cin >> n;
  vector<int> d(n);
  rep(i,n) cin >> d[i];

  ll ans = 0;
  rep(i,n){
    for(int j = i+1;j<n;j++){
      ans += d[i]*d[j];
    }
  }

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


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

int main(){
    int n; cin >> n;
    int p[n]; for (int i=0; i<n; i++) cin >> p[i];

    int count=0;
    for(int i=1; i < n-1; i++){
        if((p[i-1] < p[i] && p[i] < p[i+1])||(p[i-1] > p[i] && p[i] > p[i+1])){
            count++;
        }
    }

    cout << count << endl;



}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;

int main()
{
	//ifstream cin("input.txt");

	int N, x;

	cin >> N >> x;

	if (x == 2 * N - 1 || x == 1)
	{
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
	if (x == N)
	{
		for (int i = 1; i <= 2 * N - 1; ++i)
			cout << i << endl;
	}
	else if (x < N)
	{
		int a = 2 * N - 1;
		for (int i = 1; i <= N - x; ++i)
		{
			cout << a << endl;
			--a;
		}

		for (int i = 1; i <= a; ++i)
			cout << i << endl;
	}
	else
	{
		for (int i = x - N + 1; i <= 2 * N - 1; ++i)
			cout << i << endl;

		int a = x - N;
		for (int i = 1; i <= x - N; ++i)
		{
			cout << a << endl;
			--a;
		}
	}

	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define inf 1001001001
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(void) {
    int n; cin >> n;
    vector<bool> x(n+1, false);
    x[4] = x[7] = true;
    for (int i=8; i<=n; i++) {
        if(x[i-4]||x[i-7]) x[i] = true;
    }
    if(x[n]) cout << "Yes";
    else cout << "No";
}


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

int numofbits(long bits)
{
  bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
  bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
  bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
  bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
  return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main()
{
  int n; cin >> n;
  vector<int> a(n, 0);
  vector<vector<int>> x(n, vector<int>(n, 0));
  vector<vector<int>> y(n, vector<int>(n, 0));
  for (int i=0; i<n; i++) {
    cin >> a[i];
    for (int j=0; j<a[i]; j++) {
      cin >> x[i][j] >> y[i][j];
      x[i][j]--;
    }
  }

  int ans = 0;
  for (int bits=1; bits<(1<<n); bits++) {
    bool flg = true;
    for (int i=0; i<n; i++) {
      if (!(bits & (1<<i))) continue;
      for (int j=0; j<a[i]; j++) {
        if (((bits >> x[i][j]) & 1) ^ y[i][j]) flg = false;
      }
    }
    if (flg) {
      ans = max(ans, numofbits(bits));
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
use std::collections::BinaryHeap;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let q: usize = sc.read();
    let mut center = 0;
    let mut lower = BinaryHeap::new();
    let mut upper = BinaryHeap::new();
    let mut lower_sum = 0;
    let mut upper_sum = 0;

    let mut b: i64 = 0;
    for _ in 0..q {
        let t: usize = sc.read();
        if t == 1 {
            let a: i64 = sc.read();

            if lower.is_empty() {
                lower.push(a);
            } else {
                if a < center {
                    lower.push(a);
                    lower_sum += center - a;
                } else {
                    upper.push(-a);
                    upper_sum += a - center;
                }
            }
            while lower.len() < upper.len() || lower.len() > upper.len() + 1 {
                if lower.len() < upper.len() {
                    let upper_min = -upper.top();
                    let diff = upper_min - center;

                    lower_sum += lower.len() as i64 * diff;
                    upper_sum -= diff * upper.len() as i64;
                    upper.pop().unwrap();
                    lower.push(upper_min);
                } else {
                    let lower_max = lower.pop().unwrap();
                    let diff = center - lower.top();
                    upper.push(-lower_max);

                    lower_sum -= diff * lower.len() as i64;
                    upper_sum += upper.len() as i64 * diff;
                }
                center = lower.top();
            }

            center = lower.top();
            // println!("center={}", center);
            // println!("{:?} {}", lower, lower_sum);
            // println!("{:?} {}", upper, upper_sum);

            b += sc.read::<i64>();
        } else {
            println!("{} {}", center, b + lower_sum + upper_sum);
        }
    }
}

trait PeekTop<T> {
    fn top(&mut self) -> T;
}

impl<T> PeekTop<T> for BinaryHeap<T>
where
    T: Copy + Ord,
{
    fn top(&mut self) -> T {
        let top = self.pop().unwrap();
        self.push(top);
        top
    }
}

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: 8572
#include <bits/stdc++.h>
//#include <iostream>
//#include <vector>
using namespace std;

int main(){
    int L, R, d;
    cin >> L >> R >> d;
    int cnt = 0;
    for(int i=L; i<=R; ++i){
        if (i%d==0) ++cnt;
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3520
def main():
    N, K, S = map(int, input().split())
    MaxN = 10 ** 9
    if S == MaxN:
        A = [S] * K + [1] * (N - K)
    else:
        A = [S] * K + [S + 1] * (N - K)

    print(" ".join(map(str, A)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 17828
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll>Q;



int main(void){
  ll x;
  cin>>x;
  ll ans = 100;
  ll n = 0;
  while(true){
    ans = ans*1.01;
    n++;
    //cout<<ans<<endl;
    if(ans>=x)break;
  }
  cout<<n<<endl;
  return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include<time.h>
#include<cmath>
#include<vector>
using namespace std;

int main(void)
{
	string s;
	
	cin >> s;
	vector<char> ans;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'B') {
			if (ans.size())
				ans.pop_back();
		}
		else {
			ans.push_back(s[i]);
		}
	}
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
N = int(input())
lis = [str(input()) for i in range(N)]
print('AC x {}'.format(str(lis.count('AC'))))
print('WA x {}'.format(str(lis.count('WA'))))
print('TLE x {}'.format(str(lis.count('TLE'))))
print('RE x {}'.format(str(lis.count('RE'))))

Measured memory_bytes: 82552
#include <iostream>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;




pair<double, double>a[10];

double dis(pair<double, double>x, pair<double, double>y) {
	return sqrt((x.first - y.first) * (x.first - y.first) + (x.second - y.second) * (x.second - y.second));
}

int main() {
	int fac[10];
	fac[0] = 0;
	fac[1] = 1;
	for (int i = 2; i <= 8; i++) {
		fac[i] = fac[i - 1] * i;
	}

	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}
	double ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (i == j)continue;
			ans += dis(a[i], a[j]) * (fac[n - 1]);
		}
	}
	cout << std::fixed << std::setprecision(9) << (ans / fac[n]) << endl;


}

Measured memory_bytes: 256