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

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

ll MAX_V = 2e5 + 5;
vector<vector<ll>> G(MAX_V);//隣接リスト(添え字は始点、値は終点)

//引数は各頂点(0-indexed)の入次数
vector<ll>tsort(vector<ll>v){
  ll n=v.size();
  vector<ll>ret(n);
  stack<ll>st;
  for(ll i=0;i<n;i++)if(v[i]==0)st.push(i);
  for(ll i=0;i<n;i++){
    if(st.empty())return vector<ll>();//閉路がある
    ll x=st.top();
    st.pop();
    ret[x]=i;
    for(ll j=0;j<G[x].size();j++){
      v[G[x][j]]--;
      if(v[G[x][j]]==0)st.push(G[x][j]);
    }
  }
  return ret;
}

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n;cin>>n;
  ll m=(1<<n);
  vector<ll>a(m);
  rep(i,0,m)cin>>a[i];
  ll maxbuf=0;
  vector<P>dp(m,MP(0,0));
  rep(i,0,m){
    dp[i].fi=a[i];
  }
  rep(i,0,n){
    rep(j,0,m){
      if(j&(1<<i)){
        auto p=max(dp[j],dp[j^(1<<i)]);
        auto q=min(dp[j],dp[j^(1<<i)]);
        dp[j]=MP(p.fi,max(p.se,q.fi));
      }
    }
  }
  rep(i,1,m){
    //cout<<dp[i].fi spa dp[i].se<<endl;
    chmax(maxbuf,dp[i].fi+dp[i].se);
    cout<<maxbuf<<endl;
  }
  return 0;
}

Measured memory_bytes: 13952
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *p;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

/*Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}*/

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key)
      x = x->left;
    else x = x->right;
  }
  z->p = y;
    
    if(y == NIL)
      root = z;
    else if(z->key < y->key)
      y->left = z;
    else
      y->right = z;
}

void inorder(Node u){
  if(u == NIL)
    return;
  inorder(u->left);
    printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u == NIL)
    return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



Measured memory_bytes: 25156
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {

  int N,K;
  string S;
  cin >> N >> K >> S;

  S = 'R' + S;
  S += 'L';
  int num = 0,ans = 0;
  for(int i = 0;i <= N;i++) {
    if(S.at(i) == 'R' && S.at(i+1) == 'L') num++;
    if(i > 0 && i < N && S.at(i) == S.at(i+1)) ans++; 
  }

  if(S.at(1) == 'R' && S.at(N) == 'L') {
    ans += 2 * min(K,num-1);
    if(K >= num) ans++;
  }else if(S.at(1) == 'L' && S.at(N) == 'R') {
    ans += 2 * min(K,num-2);
    if(K >= num-1) ans++;
  }else {
    ans += 2 * min(K,num-1);
  }

  cout << ans << endl;
  

}



Measured memory_bytes: 512
#include<iostream>
using namespace std;
int n;
int a[101],b[100];
main()
{
    while(cin>>n,n)
    {
        for(int i=0;i<n+1;i++)cin>>a[i];
        for(int i=0;i<n+1;i++)
        {
            bool f=1;int c=0;
            for(int j=0;j<n+1;j++)if(i!=j)b[c++]=a[j];
            int p=b[1]-b[0];
            for(int j=1;j<n-1;j++)f&=p==b[j+1]-b[j];
            if(f)
            {
                cout<<a[i]<<endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll N;
    cin >> N;
    vector<ll> vec(N);
    for (ll i = 0;i<N;i++) {
        ll a;
        cin >> a;
        vec.at(i) = a;
    }
    sort(vec.begin(),vec.end());
    cout << vec.at(N-1) - vec.at(0) << endl;
}

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

int main(){
   std::string S;
   std::cin >> S;
   bool b1, b2, b3;
   if (S.at(0) == 'A'){
      b1 = true;
   } else{
      b1 = false;
   }

   int cnt = 0;
   int N = S.size();
   for(int i=2; i<=N-2; i++){
      if (S.at(i) == 'C'){
         cnt++;
      }
   }
   if (cnt == 1){
      b2 = true;
   } else{
      b2 = false;
   }

   if ((S.at(1) <= 'z') && (S.at(1) >= 'a') && (S.at(N-1) <= 'z') && (S.at(N-1) >= 'a'))
      b3 = true;
   else
      b3 = false;

   bool b4 = true;
   for (int i=2; i<=N-2; i++){
      if (S.at(i) != 'C'){
         if ((S.at(i) >= 'a') && (S.at(i) >= 'z')){
            b4 = false;
         }
      }
   }

   if (b1 && b2 && b3 && b4){
      std::cout << "AC" << std::endl;
   } else{
      std::cout << "WA" << std::endl;
   }
}



Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt(),k=stdIn.nextInt(),x=stdIn.nextInt(),y=stdIn.nextInt(),s=0,i;
		for(i=0;i<n&&i<k;i++) s+=x;
		for(i=k;i<n;i++) s+=y;
		System.out.print(s);
	}
}

Measured memory_bytes: 21844
N,x=map(int,input().split())
A=list(map(int,input().split()))

ANS=0
for i in range(1,N):
    if A[i]+A[i-1]>x:
        ANS+=(A[i]+A[i-1]-x)
        if A[i]>=A[i]+A[i-1]-x:
            A[i]-=(A[i]+A[i-1]-x)
        else:
            A[i]=0

print(ANS)


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

int main(void)
{
	int N, K;
	cin >> N >> K;
	vector<bool> a(N, false);
	for (int i = 0; i < K; i++)
	{
		int d, b;
		cin >> d;
		for(int j=0; j<d; j++)
		{
			cin >> b;
			a[b - 1] = true;
		}
	}
	
	int ans = 0;
	for(int i=0; i<N; i++)
	{
		if(!a[i]) ans++;
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 3616
n=int(input())
a=list(map(int,input().split()))
total=abs(a[0])+abs(a[-1])
for i in range(1,n):
    total+=abs(a[i]-a[i-1])
a.append(0)
a.insert(0,0)
for i in range(1,n+1):
    d1=abs(a[i-1]-a[i])
    d2=abs(a[i]-a[i+1])
    d3=abs(a[i-1]-a[i+1])
    print(total-(d1+d2)+d3)

Measured memory_bytes: 14048
y,m,z,e;main(k){
	for(;m=1e7,scanf("%d",&e)*e;z=!printf("%d\n",m))
		for(;(k=z*z*z)<=e;)
			y=sqrt(e-k),
			k=y+e-y*y-k+z++,
			m>k?m=k:0;
}

Measured memory_bytes: 0
import Data.Functor
import Data.List
import Data.Bool

main :: IO()
main = getLine >> getContents >>= mapM_ (putStrLn . (bool "NO" "YES")  . f . sort) . (mapMap read . wordsLines)
    where f [a, b, c] = a ^ 2 + b ^ 2 == c ^ 2

wordsLines :: String -> [[String]]
wordsLines = map words . lines

mapMap :: (a -> b) -> [[a]] -> [[b]]
mapMap f = map (map f)


Measured memory_bytes: 4156
#include<bits/stdc++.h>
using namespace std;
int n;
int ar[100000];
int h[100000];
int val(int p)
{
	if(p==n)
	{
		return 0;
	}
	else if(p>n)
	{
		return 1000000000;
	}
	if(ar[p]!=-1)
	{
		return ar[p];
	}
	return ar[p]=min(abs(h[p-1]-h[p])+val(p+1),abs(h[p-1]-h[p+1])+val(p+2));
}
int main()
{
	cin>>n;
	memset(ar,-1,sizeof(ar));
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	cout<<val(1);
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <cstring>
#include <stdio.h>

using namespace std;


int main()
{

	int n,c,cif;
	int nr = 1;
	cin >> n;
	c = n % 10;
	n = n / 10;
	while(n != 0) {
		cif = n % 10;
		if(cif == c)
            {
                nr++;
                c = cif;
            }
        else
        {
            nr = 1;
            c = cif;
        }
		if(nr == 3)
            {
                cout << "Yes";
                return 0;
            }

		n = n / 10;

	}
	cout<<"No";

}


Measured memory_bytes: 256
function main()
  
  (A,B) = map(x -> parse(Int,x), split(readline()))
  
  if A == B
    println("Draw")
  elseif A == 1 && B != 1
    println("Alice")
  elseif B == 1 && A != 1
    println("Bob")
  elseif A > B
    println("Alice")
  else
    println("Bob")
  end
  
end

main()

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

int main(){
  int n;
  cin >> n;
  int c[2][n];
  int sum1=0,sum2=0;
  for(int i=0;i<n;i++){
  cin >> c[0][i];
    sum1+=c[0][i];
  }
  for(int i=0;i<n;i++){
  cin >> c[1][i];
    sum2+=c[1][i];
  }
  int q=c[0][0]+sum2;
  int ans =q;
  for(int i=1;i<n;i++){
    q=q-c[1][i-1]+c[0][i];
    ans = max(ans,q);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//Night's template
//orzakyrt
#include <bits/stdc++.h>
#define R register
#define LL long long
#ifdef __DEBUG__
	#define Debug (fprintf(stderr,"orzyrt\n"),fflush(stderr))
	#define debug(__a...) (fprintf(stderr,__a),fflush(stderr))
#else
	#define Debug ('orzyrt')
	#define debug(__a...) ('orzyrt')
#endif
inline void Compile(R char *s){
	char com[111];
	sprintf(com,"g++ %s.cpp -lm -o %s",s,s);
	system(com);
}
inline void setfile(R char *s){
	char inname[111],outname[111];
	sprintf(inname,"%s.in",s);
	sprintf(outname,"%s.out",s);
	freopen(inname,"r",stdin);
	freopen(outname,"w",stdout);
}
#ifdef __DEBUG__
	#define setfile(__a) (1)
#endif
template<class TT>inline TT Max(R TT a,R TT b){return a<b?b:a;}
template<class TT>inline TT Min(R TT a,R TT b){return a<b?a:b;}
template<class TT>inline TT Abs(R TT a){return a<0?-a:a;}
template<class TT>inline TT cmin(R TT &a,R TT b){(b<a)&&(a=b);}
template<class TT>inline TT cmax(R TT &a,R TT b){(a<b)&&(a=b);}
using namespace std;
template<class TT>inline void read(R TT &x){
	x=0;R bool f=false;R char c=getchar();
	for(;c<48||c>57;c=getchar())f|=(c=='-');
	for(;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	(f)&&(x=-x);
}
//end template

namespace Night{
	int main(){
		int n;read(n);
		if(n==1){
			puts("Hello World");
		}else if(n==2){
			int a,b;
			read(a);read(b);
			cout<<a+b<<endl;
		}
		return 0;
	}
}
int main(){
	return Night::main();
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (x >= r && y >= r && x + r <= w && y + r <= h)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3108
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<fstream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(!(a%3)||!(b%3)||!((a+b)%3))
	{
		cout<<"Possible";
	}
	else
    {
    	cout<<"Impossible";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define forin(in) for(int i=0; i<(int)in.size(); i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main(){
    int N; cin>> N;
    string c; cin>> c;

    int cnt_R = 0;
    rep(i, N){
        if(c[i] == 'R') cnt_R++;
    }

    int ans = 0;
    rep(i, cnt_R){
        if(c[i] == 'W') ans++;
    }
    cout<< ans << endl;
}


Measured memory_bytes: 3712
s=list(map(str, input()))
first=int("".join(s[:2]))
last=int("".join(s[2:]))

if 1 <= first <= 12:
    if 1 <= last <= 12:
        print("AMBIGUOUS")
    elif last > 12 or last == 0:
        print("MMYY")
elif 1 <= last <= 12:
    if 1 <= first <= 12:
        print("AMBIGUOUS")
    elif first > 12 or first == 0:
        print("YYMM")
else :
    print("NA")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pi pair<int,int>
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define dbg(x) cout<<#x<<": "<<x<<endl
#define clr(x,v) memset(x, v, sizeof(x))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const double eps = 1e-9;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
const int MAXN = 1e6 + 5;

ll mul(ll a, ll b)
{
    ll res = 0;
    while(b > 0)
    {
        if(b & 1)
            res = (res + a) % mod;
        a = (a + a) % mod;
        b = b / 2;
    }
    return res%mod;
}

void cp()
{
    int n, k;
    cin >> n >> k;
    vector<ll> arr(n);
    for(ll &x : arr)
        cin >> x;
    ll res = 1;
    sort(all(arr));

    if (arr.back() <= 0 && (k & 1))
    {
        for (int i = n - 1; i >= n - k; i--)
            res = mul(res, (arr[i] + mod) % mod);
        cout << res;
        return;
    }
    int i = 0;
    int j = n - 1;
    // If we have to pick odd numbers just pick 1 +ve number
    if (k & 1)
    {
        res = (arr[j]) % mod;
        j--;
        k--;
    }
    // Else we can pick -ve numbers and +ve numbers in pairs greedily deciding which one to keep
    k /= 2;
    for (int it = 0; it < k; it++)
    {
        ll lp = arr[i] * 1LL * arr[i + 1];
        ll rp = arr[j] * 1LL * arr[j - 1];
        if (lp > rp)
        {
            res = mul(res, (lp + mod) % mod);
            i += 2;
        }
        else
        {
            res = mul(res, (rp + mod) % mod);
            j -= 2;
        }
    }
    cout << res;
}

int main()
{
    FASTIO;
    int t;
    t = 1;
    // cin >> t;
    while(t--)
    {
        cp();
    }
    return 0;
}

Measured memory_bytes: 4728
def main():
    H, W = map(int, input().split())

    A = [list(input()) for i in range(H)]

    B = []
    for a in A:
        if a.count('#') != 0:
            B.append(a)
    
    B = list(map(list, zip(*B)))
    C = []
    for b in B:
        if b.count('#') != 0:
            C.append(b)

    C = list(map(list, zip(*C)))

    for c in C:
        print(*c, sep='')



main()

Measured memory_bytes: 40560
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;

long long int a = 0, b = 0, c = 1, x = 0, y = 0, z = 0, maxy = -1, mini = 9999, counter = 0,startp=0,endp=0,checker=0;
std::vector<unsigned long long int> vec{}, vecsec{};
int iremono[100001];
std::vector<long long int>kinds{}, ans{}, kaku{};

bool okada = false,okada2=false;
std::string output, output2, input, one, two;
char cutcount[201];
int kakunou2[50][50] = {};

int ctoi(const char c) {
	if ('0' <= c && c <= '9') return (c - '0');
	return -1;
}
unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int main()
{
	cin >> a>>b>>c;
	if (b-a+1<c*2) {
		for (int i = a; i <= b;i++) {
			cout << i << endl;
		}
	}
	else {
		for (int i = 0; i < c; i++) {
			cout << a + i << endl;
		}
		for (int i = 0; i < c; i++) {
			cout << b - c + i + 1 << endl;
		}
	}
	
}

	
	





Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>

const int INF = 10e6;

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int ans = a + b;
    ans = min(ans, b+c);
    ans = min(ans, c + a);
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <map>
#include <utility>
#include <numeric>

long long cs[10];

int main()
{
  long long h, w, n;
  scanf("%lld%lld%lld", &h, &w, &n);
  std::map<std::pair<long long, long long>, long long> mp;
  const long long dir[] = {0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 0};
  for (long long i = 0; i < n; ++i)
  {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    for (long long j = 0; j < 9; ++j)
    {
      long long A = a + dir[j] - 1;
      long long B = b + dir[j + 2] - 1;
      if (0 <= A && A < h && 0 <= B && B < w)
      {
        std::pair<long long, long long>&& p{A, B};
        mp[p]++;
      }
    }
  }

  for (auto &p : mp)
  {
    if (1 <= p.first.first && p.first.first < h - 1 && 1 <= p.first.second && p.first.second < w - 1)
    {
      cs[p.second]++;
    }
  }
  
  cs[0] = (h - 2) * (w - 2) - std::accumulate(cs + 1, cs + 10, 0LL);
  for (long long i = 0; i < 10; ++i)
  {
    printf("%lld\n", cs[i]);
  }
  return 0;
}

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

const ll MOD=1e9+7;

int main() {
  string s; cin>>s;
  int n=s.size();

  vector<vector<ll>> dp(100002, vector<ll>(13));
  dp[0][0]=1;
  rep(dgt, n) {
    rep(mo, 13) {
      if (s[dgt]=='?') {
        rep(nxt, 10) dp[dgt+1][(mo*10+nxt)%13]+=dp[dgt][mo];
      }
      else dp[dgt+1][(mo*10+s[dgt]-'0')%13]+=dp[dgt][mo];
    }
    rep(i, 13) dp[dgt+1][i]%=MOD;
  }
  printf("%llu\n", dp[n][5]);
  return 0;
}


Measured memory_bytes: 13568
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<math.h>
using namespace std;
#define maxx 55
char  a[maxx][maxx];
int h,w;
int main()
{
    scanf("%d%d",&h,&w);
    getchar();
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
                scanf("%c",&a[i][j]);
        }
        getchar();
    }
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(a[i][j]=='#'){
            if(!( ('#'==a[i][j+1])||('#'==a[i][j-1])||('#'==a[i-1][j])||('#'==a[i+1][j]) ) )
            {
                printf("No");
                return 0;
            }
            }
        }

    }
    printf("Yes");





//    for(int i=1;i<=w;i++)
//    {
//        for(int j=1;j<=h;j++)
//        {
//            cout<<a[i][j];
//        }
//        cout<<endl;
//    }

    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 3592
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#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 <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}
vector<long long> level(51);
vector<long long> paty(51);
long long ans = 0;

long long dfs(long long X,int L){
    if(L == 0){
        if(X == 1) ans++;
        return ans;
    }
    if(X < 1+level.at(L-1)){
        X--;
        dfs(X,L-1);
    }
    else if(1+level.at(L-1) == X){
        ans += paty.at(L-1);
        return ans;
    }
    else if(X == level.at(L-1)+2){
        ans += paty.at(L-1)+1;
        return ans;
    }
    else if(X > level.at(L-1)+2 && X < level.at(L)){
        ans += paty.at(L-1)+1;
        X -= level.at(L-1)+2;
        dfs(X,L-1);
    }
    else if(X == level.at(L)){
        ans += paty.at(L);
        return ans;
    }
}

int main() {
    int N;cin >> N;
    long long X;cin >> X;
    paty.at(0) = 1;
    level.at(0) = 1;
    for(int i = 1;i<51;i++){
        level.at(i) = level.at(i-1)*2+3;
        paty.at(i) = paty.at(i-1)*2+1;
    }
    long long OUTPUT = dfs(X,N);
    cout << OUTPUT << endl;
}


Measured memory_bytes: 256
while True:
	a,op,b=input().split()
	if op == "+":
		print(int(a)+int(b))
	elif op =="-":
		print(int(a)-int(b))
	elif op =="*":
		print(int(a)*int(b))
	elif op =="/":
		print(int(a)//int(b))
	else:
		break


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, L;
  cin >> N >> L;
  vll a(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  if(a.at(0) + a.at(1) >= L){
    cout << "Possible" << endl;
    for(int i = N-1; i >= 1; i--){
      cout << i << endl;
    }
  }
  else if(a.at(N-2) + a.at(N-1) >= L){
    cout << "Possible" << endl;
    for(int i = 1; i < N; i++){
      cout << i << endl;
    }
  }
  else{
    for(int i = 0; i < N-1; i++){
      ll left = a.at(i);
      ll right = a.at(i+1);
      if(left + right >= L){
        cout << "Possible" << endl;
        for(int j = 0; j < i; j++){
          cout << j+1 << endl;
        }
        for(int j = N-2; j >= i+1; j--){
          cout << j+1 << endl;
        }
        cout << i+1 << endl;
        return 0;
      }
    }
    cout << "Impossible" << endl;
    return 0;
  }

}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
    char c;
    string s,t;
    cin >> s;
    for(int i=0; i<s.length(); i++){
        cin >> c;
        t.push_back(c);
    }
    if(s.compare(t)==0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    string s;
    cin >> s;

    int K;
    cin >> K;
    set<string> st;
    REP(i, s.size()){
        REP(j, 5){
            if(i+j < s.size()) st.insert(s.substr(i,j+1));
        }
    }
    for(auto i : st){
        K--;
        if(K == 0){
            cout << i << "\n";
            break;
        }
    }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include<unordered_map>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 4e5;
int main() {
	string S;
	cin >> N >> S;
	vector<int>east(N + 1,0);
	for (int i = 1; i <= N; i++) {
		if (S[i-1] == 'E')east[i] = east[i - 1] + 1;
		else east[i] = east[i - 1];
	}
	for (int i = 1; i <= N; i++) {
		ll tmp = (i - 1 - east[i - 1]) + east[N] - east[i];
		ans = min(ans, tmp);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1796
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;
typedef vector<vi> vvi;

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

int ncr[2005][2005];

void calc(){
  rep(i,2005){
    ncr[i][0] = 1;
    ncr[i][i] = 1;
  }
  loop(i,1,2005)loop(j,1,i){
    ncr[i][j] = (ncr[i-1][j-1] + ncr[i-1][j])%MOD;
  }
}

signed main(void) {
    int n,k;
    cin >> n >> k;
    calc();
    loop(i,1,k+1){
        if(i == 1 && n == k){
            cout << 1 << endl;
            continue;
        }
        int ans = 0;
        if(n-k-i >= 0)(ans += (ncr[n-k-1][i-1]*2)%MOD) %= MOD;
        if(n-k-(i-1) >= 0 && i-2 >= 0)(ans += ncr[n-k-1][i-2]) %= MOD;
        if(n-k-(i+1) >= 0)(ans += ncr[n-k-1][i]) %= MOD;
        ans %= MOD;
        ans = (ans*ncr[k-1][i-1])%MOD;
        cout << ans << endl;
    }
}


Measured memory_bytes: 30208
#include <iostream>
#include <map>

using namespace std;

int main(int argc, char* argv[]) {
  long long N;
  cin >> N;

  map<long long, long long> m;
  for (int i = 0; i < N; ++i) {
    long long a;
    cin >> a;
    if (m.find(a) == m.end())
      m[a] = 0;
    ++m[a];
  }

  long long ret = 0;
  for (map<long long, long long>::iterator i = m.begin(); i != m.end(); ++i) {
    if (i->second >= i->first)
      ret += i->second - i->first;
    else
      ret += i->second;
  }

  cout << ret << endl;

  return 0;
}

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

using namespace std;

int main() {
    unsigned long long n, k;
    cin >> n >> k;
    vector<unsigned long long> teleporter(n);
    for (unsigned long long i = 0; i < n; ++i) cin >> teleporter[i];
    vector<unsigned long long> jumped(n, -1);
    unsigned long long num_jump = 0;
    unsigned long long cur_pos = 1;
    jumped[cur_pos - 1] = num_jump++;
    unsigned long long loop_length = 0;
    unsigned long long num_in_loop = 0;
    while (true) {
        auto pos = teleporter[cur_pos - 1];
        if (jumped[pos - 1] == -1) {
            jumped[pos - 1] = num_jump++;
            cur_pos = pos;
        }
        else {
            loop_length = num_jump - jumped[pos - 1];
            num_in_loop = jumped[pos - 1];
            break;
        }
    }
    unsigned long long num_jump_loop = 0;
    if (k > num_in_loop) {
        num_jump_loop = (k - num_in_loop) % loop_length;
        num_jump = num_in_loop + num_jump_loop;
    }
    else {
        num_jump = k;
    }
    for (unsigned long long i = 0; i < n; ++i) {
        if (jumped[i] == num_jump) {
            cout << i + 1 << endl;
            break;
        }
    }
    return EXIT_SUCCESS;
}

Measured memory_bytes: 6432
program jihanki
  implicit none
  integer :: i, n
  real :: t, a
  real, allocatable :: h(:)

  read(*,*)n
  allocate(h(n))
  read(*,*)t,a
  read(*,*)h

  do i=1, n
     h(i)=abs(t-h(i)*0.006-a)
  end do
  do i=1, n
     if (h(i)==minval(h)) then
        write(*,*)i
     end if
  end do

end program jihanki


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

try:
   while True:
      n, k = map(int, input().split())
      if n + k == 0:
         break
      
      l = []
      for i in range(n):
         l.append(int(input()))

      s1 = 0
      for i in range(k):
         s1 += l[i]
      
      ma = 0
      s2 = 0
      for j in range(n - k):
         s2 = s1 - l[j] + l[j + k]
         if s2 > ma:
            ma = s2
         s1 = s2
      print(ma)

except EOFError:
   pass




Measured memory_bytes: 9612
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mp make_pair
#define mm(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define repn(i,a,b) for(ll i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define fto(k,m) for(auto k:m)
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define sz(a) ll((a).size())
#define pii 3.1415926535897
#define endl "\n"
#define ld long double
#define MOD 1000000007
#define BRAHAMASTRA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll power(ll x,ll y);
int main()
{
    BRAHAMASTRA
    ll t;t=1;
    // cin >>t;
    while(t--)
    {
        char s[6];
        s[0] = 'S';
        cin >>s+1;
        ll cnt = 0,mx = 0;
        s[4]='S';
        rep(i,0,5)
        {
            if(s[i]!='R')mx = max(mx,cnt),cnt=0;
            else cnt++;
        }
        cout << mx <<endl;
    }
}

Measured memory_bytes: 3600
#include <cmath>
#include <vector>
#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	cout.precision(9);
	vector<int> S(N);
	for (int i = 0; i < N; ++i) cin >> S[i];
	for (int i = 0; i < N; ++i) {
		double a = sqrt((S[i] + 0.5) / 20);
		double cx = (i / 10) * 1000 - 4500, cy = (i % 10) * 1000 - 4500;
		cout << i + 1 << endl;
		cout << cx - 4 * a << ' ' << cy << endl;
		cout << cx - 2 * a << ' ' << cy - a << endl;
		cout << cx - 2 * a << ' ' << cy - 4 * a << endl;
		cout << cx << ' ' << cy - a << endl;
		cout << cx + 4 * a << ' ' << cy - 2 * a << endl;
		cout << cx + 2 * a << ' ' << cy << endl;
		cout << cx + 4 * a << ' ' << cy + 2 * a << endl;
		cout << cx << ' ' << cy + a << endl;
		cout << cx - 2 * a << ' ' << cy + 4 * a << endl;
		cout << cx - 2 * a << ' ' << cy + a << endl;
	}
	return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];
ll box[200010];

int main(){
  cin >> n;
  map<int,int> test;
  rep(i,0,n)cin >> d[i],test[d[i]]++;

  map<int,int> memo;
  if(test[2] > 0)memo[2] = test[2];
  if(test[-2] > 0){
    if(!(test[-2] % 2)){
      memo[-2] = test[-2];
    }
    else{
      if(test[-1]){
        memo[-2] = test[-2];
        memo[-1] = 1;
      }else{
        memo[-2] = test[-2] - 1;
      }
    }
  }
  // no 2 & -2
  //if(memo.empty())if(test[1] > 0)memo[1] = 1;
  //if(memo.empty())if(test[-1] > 1)memo[-1] = 2;
  // ans
  vi vec;
  ll ans = 1;
  rep(i,0,n){
    if(memo[d[i]] > 0){
      //cout << i + 1 << ",d = " << d[i] << endl;
      vec.pb(i + 1);
      memo[d[i]]--;
      ans *= d[i];
    }
  }
  // cout << "ans:" << ans << endl;
  print(vec.sz);
  rep(i,0,vec.sz)print(vec[i]);
  return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N, M; 
  cin >> N >> M;
  cout << ((N-M)*100+M*1900)*pow(2, M) << "\n";
  return 0;  
}



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

void get_int5(char *line, int size, int *a1, int *a2, int *a3, int *a4, int *a5) {
  if(!fgets(line, size, stdin)) return;
  sscanf(line, "%d %d %d %d %d", a1, a2, a3, a4, a5);
}

#define BUF_SIZE 50
#define min(a,b) ((a) > (b) ? (b) : (a))
#define max(a,b) ((a) > (b) ? (a) : (b))

int main(void) {
  int a, b, c, x, y;
  char line[BUF_SIZE];
  get_int5(line, BUF_SIZE, &a, &b, &c, &x, &y);
  int ans = a*x+b*y;

  int case1 = max(x, y)*c*2;
  int case2 = min(x, y)*c*2 + abs(x-y) * (x > y ? a : b);

  if(ans > case1) ans = case1;
  if(ans > case2) ans = case2;

  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 384
import numpy as np
N, M, C = map(int, input().split())

Bin = list(map(int, input().split()))
B = np.array(Bin).T

ans = 0
for i in range(N):
  Ain = list(map(int, input().split()))
  A = np.array(Ain)
  s = np.dot(A, B) + C
  if s > 0:
    ans += 1

print(ans)

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

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

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define sa(v) sort(v.begin(),v.end())
#define sd(v) sort(v.begin(),v.end(),greater<>())
#define rev(s) reverse(s.begin(),s.end())
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(ll i=a;i<b;i++)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()

#define sqr(a) ((a) * (a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define mem(a,b) memset(a,b,sizeof(a))

#define yes cout<<"YES"<<nl;
#define no cout<<"NO"<<nl;

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree< long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;
void erase ( ordered_set &s, long long val )
{
    auto it = s.upper_bound(val);

    if ( it == s.begin() && val == *s.begin() ) s.erase ( s.upper_bound(val) );
    else s.erase ( s.upper_bound(val) );
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

ll div(ll n)
{
   if(n==0)
    return n;
   return 1+2*div(n/2);
}

int main()
{
   su;
   ll h;
   cin>>h;
   cout<<div(h)<<nl;
   return 0;
}


Measured memory_bytes: 3632
#include <stdlib.h>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
    int N;
    cin >> N;

    int A[N];

    for(int i=0;i<N;i++){
        A[i] = 0;
    }
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    sort(A, A+N);
    cout << A[N-1] - A[0] << endl;
    return 0;
}

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

vector<ll> AB;
vector<ll> ans;

int main() {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<ll> A(X);
    vector<ll> B(Y);
    vector<ll> C(Z);
    rep(i, X) cin >> A[i];
    rep(i, Y) cin >> B[i];
    rep(i, Z) cin >> C[i];
    sort(all(C),greater<ll>());

    rep(x, X) rep(y, Y) {
        AB.push_back(A[x] + B[y]);
    }
    sort(all(AB),greater<ll>());

    rep(i, min(X*Y, K)) rep(z, min(K, Z)) {
        ans.push_back(AB[i] + C[z]);
    }
    sort(all(ans),greater<ll>());

    rep(i, K) cout << ans[i] << endl;
}


Measured memory_bytes: 43304
import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //This code is not meant for understanding, you have been warned.
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        int n = ni(), k = ni()-1;
        String s = n();
        pn(s.substring(0, k)+Character.toLowerCase(s.charAt(k))+s.substring(k+1));
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    long mod = (long)998244353, IINF = (long)1e18;
    final int INF = (int)1e9, MX = (int)5e5+1;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = false, memory = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        //Solution Credits: Taranpreet Singh
        int T = (multipleTC)?ni():1;
        pre();for(int t = 1; t<= T; t++)solve(t);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str = "";
            try{   
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }  
            return str;
        }
    }
}

Measured memory_bytes: 22356
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main()
{
    int N, L;
    cin>>N>>L;
    vector<string> S(N);
    for (string &s: S)
        cin>>s;
    sort(S.begin(), S.end());
    cout<<accumulate(S.begin(), S.end(), string())<<endl;
}


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

int main() {
	int N, a;
	cin >> N;
	int cnt4n = 0, cnt2n = 0;
	for (int i = 0; i < N; i++) {
		cin >> a;
		if (a % 4 == 0)
			cnt4n++;
		else if (a % 2 == 0)
			cnt2n++;
	}
	N -= 2 * cnt4n;
	if (cnt2n == 0)
		N--;
	N -= cnt2n;
	cout << (N <= 0 ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
/*
Author: Fuadul Hasan(fuadul202@gmail.com)
BSMRSTU,Gopalganj
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
//#include<bits/stdc++.h>
using namespace std;
 
int         cinn()              {int x; scanf("%d", &x); return x;}
long long   scll()              {long long x; scanf("%lld", &x); return x;}
double      scd()               {double x; scanf("%lf", &x); return x;}
void        coutt(int x)        {printf("%d ", x);}
 
#define  scll                   scll()
#define  gcd(a,b)               __gcd(a,b)
#define  lcm(a,b)               (a*b)/gcd(a,b)
#define  PI                     acos(-1.0)
#define  vi                     std::vector<int>
#define  vll                    std::vector<ll>
#define  vit                    vector<int> :: iterator
#define  sit                    set<int> :: iterator
#define  mpsi                   std::map<string, int>
#define  pb                     push_back
#define  ll                     long long int
#define  ld                     long double
#define  ull                    unsigned long long int
#define  min3(a,b,c)            min(a,min(b,c))
#define  min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define  max3(a,b,c)            max(a,max(b,c))
#define  max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define  nl                     printf("\n");
#define  no                     printf("No");
#define  yes                    printf("Yes");
#define  F                      first
#define  S                      second

typedef pair<int,int> ii;
typedef std::vector<ii> vii;
 
const int mod           = 1e9 + 7;
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)1e18 + 5;
const int N             = 1e6 + 5;
const int nn           = 2e5 + 5;


int x=1;

int solve()
{
	string s1;
	cin>>s1;
	for(int i=0;i<s1.size();i++){
		cout<<'x';
	}cout<<endl;
}

int main()
{
    int test = 1, tc = 0;
    //scanf("%d", &test);
   // (void)getchar();
    //cin >> test;
    while (test--) {
        //printf("Case %d: ", ++tc);
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);


//二項係数
const int MAX = 2010000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long C(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;
}
// 前処理 COMinit();
// 計算例 cout << COM(100000, 50000) << endl;

ll ll_pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % MOD;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

int main() 
{
  COMinit();
  int K; cin>>K;
  string S; cin>>S;
  int N; N=S.size();
  int ans=0;
  rep(x,K+1)
  {
    ans+=C(K-x+N-1,N-1)*ll_pow(25,K-x)%MOD*ll_pow(26,x)%MOD;
    ans%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 52448
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n, k, tmp, tmp2, res = -INF;
    string s;
    in(n, k);
    int a[n + 1] = {}, sum[n + 1] = {}, psum[n + 1] = {};
    rep(i, 1, n + 1){
        in(a[i]);
        sum[i] = sum[i - 1] + a[i];
        psum[i] = psum[i - 1] + max(0LL, a[i]);
    }
    rep(i, k, n + 1){
        tmp = sum[i] - sum[i - k];
        tmp2 = psum[n] - psum[i] + psum[i - k];
        chmax(res, max(0LL, tmp) + tmp2);
    }
    print(res);
}


Measured memory_bytes: 2560
Public Class Program
  Shared Sub Main()
    Dim kx As Integer() = Array.ConvertAll(Of String, Integer)(Console.ReadLine().Split(" "), AddressOf Integer.Parse)
    Dim k As Integer = kx(0)  
    Dim x As Integer = kx(1)
    Dim output As String = ""
    For i As Integer = x - k + 1 To x + k - 1
      output &= i.ToString() & " "
    Next
    Console.WriteLine(output)
  End Sub
End Class

Measured memory_bytes: 13140