akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
using Graph = vector<vector<ll> >;
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; }
const ll INF = 1e18;

map<ll, ll> prime;

void prime_factorize(ll N) {
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; 

        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        prime[a]+=ex;
    }

    if (N != 1) prime[N]++;
    return;
}

int main(){
    ll n;
    cin >> n;
    for(int i=1;i<=n;i++){
        prime_factorize(i);
    }
    ll ans = 0;

    ll c74=0;
    ll c2=0;
    ll c24=0;
    ll c4=0;
    ll c14=0;

    
    for(auto it=prime.begin();it!=prime.end();it++){
        if(it->second>1)c2++;
        if(it->second>3)c4++;
        if(it->second>13)c14++;
        if(it->second>23)c24++;       
        if(it->second>73)c74++;
    }
    ans += c74;
    ans += c24*(c2-1);
    ans += c14*(c4-1);
    ans += (c2-2)*(c4)*(c4-1)/2;
    cout<<ans<<endl;

}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;

int main() {

	int n;
	cin >> n;
	vector<ll> o(100005, 0), e(100005, 0);
	ll v;

	for (ll i = 0; i < n; i++) {
		cin >> v;
		if (i % 2 == 1)o[v]++;
		else e[v]++;
	}

	ll i = max_element(e.begin(), e.end()) - e.begin();
	ll j = max_element(o.begin(), o.end()) - o.begin();
	if (i != j) cout << n - e[i] - o[j] << endl;
	else {
		sort(e.begin(), e.end(), greater<ll>());
		sort(o.begin(), o.end(), greater<ll>());
		ll an = min(n - e[0] - o[1], n - e[1] - o[0]);

		cout << an << endl;
	}
    return 0;
}

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	if ((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d){
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  int m4 = 0;
  int m2 = 0;
  int el = 0;
  rep(i,n) {
    int a = v[i];
    if (a % 4 == 0) m4++;
    else if (a % 2 == 0) m2++;
    else el++;
  }
  if (m4  >= el) cout << "Yes" << endl;
  else if (m4 + 1 == el && m2 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>

#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a,n) sort(a, a + n)
#define vi vector<int>
#define vd vector<double>

//ここからAtCoder向けdefine
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if(a + b >= 10) cout << "error" << endl;
    else cout << a + b << endl;

    return 0;
}

Measured memory_bytes: 256
# 解説AC

N, X = map(int, input().split())

ans = N
a, b = max(N - X , X), min(N - X, X)
# Euclidの互除法
while b:
    q, r = divmod(a, b)

    ans += (b * 2) * q
    if r == 0: ans -= b # 最後

    a, b = b, r

print(ans)

Measured memory_bytes: 3060
n, m = map(int, input().split())
dp = [[0] * (m+1) for i in range(n+1)]

for i in range(n):
    w, v = map(int, input().split())
    for j in range(m+1):
        if j < w:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j-w]+v, dp[i][j])

print(dp[n][m])

Measured memory_bytes: 119916
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
//#include <multiset>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 1000000007
using namespace std;
ll n, k10[1000002], k9[1000002], k8[1000002];
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    if(n == 1) {
        cout<<0;
        return 0;
    }
    k10[0] = 1;
    k9[0] = 1;
    k8[0] = 1;
    for(int i=1;i<=n;i++) {
        k10[i] = k10[i - 1] * 10 % mod;
        k9[i] = k9[i - 1] * 9 % mod;
        k8[i] = k8[i - 1] * 8 % mod;
    }
    ll ans = k10[n];
    ans -= k9[n];
    if(ans < 0)
        ans += mod;
    ans -= k9[n];
    if(ans < 0)
        ans += mod;
    ans += k8[n];
    if(ans >= mod)
        ans -= mod;
    cout<<ans;
}


Measured memory_bytes: 26932
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n+3][4];
    int dp[n+3][4];
    for(int i=0; i<n; i++)
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    dp[0][0]=a[0][0],dp[0][1]=a[0][1],dp[0][2]=a[0][2];
    for(int i=1; i<n; i++)
    {
        dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=a[i][2]+max(dp[i-1][0],dp[i-1][1]);
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;


}



Measured memory_bytes: 3328
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {

    int N;

    private void solve() {
        N = nextInt();
        int ans = 0;
        for(int i = 0;i * i <= N;i++) {
            ans = i * i;
        }

        out.println(ans);
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

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

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

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

Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	int ans;
	int d[4];
	int tmp,big,sma;
	
	while(cin>>n,n){
		if(n%1111==0)cout<<"NA"<<endl;
		else{
			ans=0;
			while(n!=6174){
				tmp=n;
				sma=big=0;
				for(int i=0;i<4;i++){
					d[i]=tmp%10;
					tmp/=10;
				}
				sort(d,d+4);
				for(int i=0;i<4;i++){
					sma*=10;
					sma+=d[i];
				}
				for(int i=3;i>=0;i--){
					big*=10;
					big+=d[i];
				}
				n=big-sma;
				ans++;
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 1176
N, M = map(int, input().split())
S = 1
p = 0
X = []
for i in range(2, int(M ** (1/2)) + 1):
  if M % i == 0:
    if i <= M // N:
      p = i
      X.append(i)
    else:
      break
if M // N <= int(M ** (1/2)):
  if p != 0:
    S = p
else:
  if p != 0:
    S = M
    q = 0
    while S > M // N:
      S = M // X[q]
      if S <= M // N:
        break
      q += 1
      if q == len(X):
        break
    if q == len(X):
      S = max(X)
print(S)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
const int N = 1e5;  // limit for array size
ll n;  // array size

int main(){
	ll n,m;cin>>n>>m;
	
	ll a[n];
	
	unordered_map<ll,ll>rem;
	
	ll sum=0;
	
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];sum=sum%m;
		rem[sum%m]++;
	}
	
	/*for(int i=0;i<m;i++){
		cout<<rem[i]<<" "<<endl;
	}*/
	
	ll ans=0;
	
	unordered_map<ll,ll>::iterator it=rem.begin();
	
	for(;it!=rem.end();it++){
		//cout<<(*it).first<<" "<<(*it).second<<endl;
		
		if((*it).first==0){
			ans+=(*it).second;
		}
		
		ans+=(((*it).second)*((*it).second-1))/2;
		//cout<<ans<<endl;
	}
	
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;
using li=list<int>;
using lil=list<ll>;
using lis=list<string>;
using fli=forward_list<int>;
using fll=forward_list<ll>;
using fls=forward_list<string>;
using si=stack<int>;
using sl=stack<ll>;
using ss=stack<string>;
using qi=queue<int>;
using ql=queue<ll>;
using qs=queue<string>;
using pqi=priority_queue<int>;
using pql=priority_queue<ll>;
using pqs=priority_queue<string>;
using dqi=deque<int>;
using dql=deque<ll>;
using dqs=deque<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (n); i < (a); i++)
#define repr(i, n) for(int i = (n); i >= 0; i--)
#define repr2(i, a, n) for(int i = (n); i >= (a); i--)

template<typename T,typename U>
void Inparray(T &f,U n){for(int i=0;i<n;i++) cin>>f[i];}

template<typename T,typename U>
void Printarray(T f,U n){for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];}
template<typename T,typename U>
void Printarray2(T f,U n){for(int i=0;i<n;i++) cout<<f[i]<<endl;}
template<typename T,typename U,typename V>
void Printarray3(T f,U a,V b){
  rep(i,a){
    rep(j,b){
      cout<<f[i][j];
    }
    cout<<endl;
  }
}
template<typename T,typename U>
void Printarray4(T f,U n){
  rep(i,n){
    rep(j,n){
      cout<<f[i][j];
    }
    cout<<endl;
  }
}

void flagfunc(bool flag,string A,string B){flag ? cout<<A<<endl : cout<<B<<endl;}
void flag2func(bool flag){flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;}
void flag3func(bool flag){flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;cin>>n;
  cout<<(n+1)/2<<endl;
}


Measured memory_bytes: 256
import math

n = int(input())
positions = []
for i in range(n):
  positions.append(list(map(float, input().split())))

for i in range(n):
  ra = [positions[i][0],positions[i][1]]
  rb = [positions[i][2],positions[i][3]]
  rc = [positions[i][4],positions[i][5]]

  A = (rb[0]-rc[0])**2+(rb[1]-rc[1])**2
  B = (rc[0]-ra[0])**2+(rc[1]-ra[1])**2
  C = (ra[0]-rb[0])**2+(ra[1]-rb[1])**2

  P = A * (B+C-A)
  Q = B * (C+A-B)
  R = C * (A+B-C)

  rcc_x = (P*ra[0] + Q*rb[0] + R*rc[0]) / (P+Q+R)
  rcc_y = (P*ra[1] + Q*rb[1] + R*rc[1]) / (P+Q+R)

  radius = math.sqrt((rcc_x-positions[i][0])**2+(rcc_y-positions[i][1])**2)
  print("{0:.3f} {1:.3f} {2:.3f}".format(rcc_x,rcc_y,radius))


Measured memory_bytes: 5692
import os
from itertools import permutations

def main():
	p_score, q_score, count = 0,0,0
	string = ""
	num = int(input())
	p_num = tuple(list(map(str, input().split())))
	q_num = tuple(list(map(str, input().split())))
	for i in range(1,num+1):
		string  = string + str(i) 
	list_ = list(permutations(string, num))
	
	for i in list_:

		count += 1
		if p_num == i:
			q_score = count
		if q_num == i:
			p_score = count
	
		
	print(abs(q_score - p_score))
		


if __name__ == '__main__':
	main()


Measured memory_bytes: 8052
import sys
sys.setrecursionlimit(500000)
input = sys.stdin.readline
n,q=map(int,input().split())
l=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)
ans=[0]*n
for i in range(q):
  p,x=map(int,input().split())
  ans[p-1]+=x
def dsf(index,u):
  for i in l[index]:
    if i==u:continue
    ans[i]+=ans[index]
    dsf(i,index)
dsf(0,-1)
print(*ans)

Measured memory_bytes: 230960
/**
 *   author: sahushivam
 *   created: 12 April 2020 (Sunday)  18:06:46
**/
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define int long long

void calc(vector<int> R,vector<int> G,vector<int> B)
{
    for(int i=0;i<R.size();i++)
    {
        
    }
}

void solve(){
    int n; 
    string s; cin>>n>>s;
    vector<int> R(n+1,0),G(n+1,0),B(n+1,0);
    int r=0,g=0,b=0;
    int s1=0;
    for(int i=n-1;i>=0;i--)
    {
        switch(s[i])
        {
            case 'R':  R[i]=R[i+1]+1; G[i]=G[i+1]; B[i]=B[i+1]; break;
            case 'G':  G[i]=G[i+1]+1; B[i]=B[i+1]; R[i]=R[i+1]; break;
            case 'B':  B[i]=B[i+1]+1; G[i]=G[i+1]; R[i]=R[i+1]; break;
        }
    }

    for(int i=0;i<n;i++)
    {
        switch(s[i])
        {
            case 'R': s1+=(G[i]*B[i]); break;
            case 'G': s1+=(R[i]*B[i]); break;
            case 'B': s1+=(G[i]*R[i]); break;
        }
        for(int j=i+1;j<n;j++)
        {
             if(s[i] != s[j] && (j+(j-i) < n) && s[j] != s[j+(j-i)] && s[i] != s[j+(j-i)])
                s1--;
        }
    }
    cout<<s1;
}

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int t=1; while(t--) solve();
    return 0;
}

Measured memory_bytes: 3656
s = input()
S = list(s)

count = 0
check = 0

if S[0] == 'A':
    for i in range(len(S)-3):
        if S[i+2] == 'C':
            count += 1
    if count == 1:
        for j in range(len(S)-1):
            if S[j+1].islower() == False:
                check += 1
        if check == 1:
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

signed main() {
    int a,b,c;
    cin>>a>>b>>c;
    cout<<((a<=c && c<=b)?"Yes":"No")<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c;cin>>a>>b>>c;
  if(a%2==0||b%2==0||c%2==0)cout<<0<<endl;
  else{
    long long d[3];d[0]=a;d[2]=c;d[1]=b;sort(d,d+3);
    cout<<d[0]*d[1]<<endl;
  }
}

Measured memory_bytes: 256
/* it was worth becoming a chemist */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int uni;
typedef unsigned long long unll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int, long long> pil;
typedef vector<int> vi;
typedef vector<long long> vll;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define NAME "puts"
#define F first
#define S second

const ll INF = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const db EPS = (db) 1e-9;
const db pi = acos(-1.0);
const int MAXN = 2e5 + 5;

int n;
int ct;
int k;

int main() {	

	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		if (x >= k) ct++;
	}
	cout << ct;
	return 0;
}


Measured memory_bytes: 384
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string s;cin>>s;
    if((s[0]==s[1]&&s[1]==s[2])||(s[1]==s[2]&&s[2]==s[3]))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






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

int main() {
  string s[3];rep(i,3)cin>>s[i];
  string ans = "";
  rep(i,3) ans += (s[i][0]+'A'-'a');
  cout << ans << endl;
}


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

/*  <<bit全探索>>
 
    for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
        bitset<ビット数> s(tmp);
    }
*/
 
/*　<<stringで読み込んだ数列を一桁ずつint型へ変換>>
 
    string str;
    int N[桁数];
 
    cin >> str;
 
    for (int i = 0; i < 桁数; ++i) {
 
        N[i] = (int)(str[i] - '0');  //str[i]　はchar型なのでchar→intへ変換
 
        //cout << N[i] << endl;  //確認のため表示
    }
*/
 
typedef long long ll;

///////////////////////////////////////////////////////////////////////////


int main() { 
    int K, A, B, X = 0;
    cin >> K >> A >> B;

    for(int i=0; i<(B - A + 1); i++){
        if((A + i) % K == 0){
            cout << "OK" << endl;
            X++;
            break;
        }
    }

    if(X == 0){
        cout << "NG" << endl;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    vector<int> p(n);
    for(auto&i:p) cin>>i;
    partial_sort(p.begin(),p.begin()+k,p.end());
    cout<<accumulate(p.begin(),p.begin()+k,0)<<'\n';
}

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

#include <cstdlib>  // abs() for integer 絶対値求めやつ

#include <cmath>    // abs() for float, and fabs()

#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)

#define SORT(a) sort((a).begin(),(a).end());

#define che(a,string) cout<<string<<":"<<(a)<<endl;

#define ch(a,string) cout<<string<<":"<<(a)<<" ";

using namespace std;

typedef pair<int,int> p;

int main(){
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	int ans =0; 
	rep(i,n){
		if(i<k){
			ans+=x;
		  }
		  else{
			  ans+=y;
			}
	  }
	  cout<<ans<<endl;
}
	 


Measured memory_bytes: 256
import fractions
#なぜかWA
"""
A,B,C,D = list(map(int, input().split()))
cc = int(B/C) - int((A-1)/C)
dd = int(B/D) - int((A-1)/D)
cd = int(C*D / fractions.gcd(C,D))
ee = int(B/cd) - int((A-1)/cd)
U = B-A+1
print(U - (cc + dd - ee))
"""
#解説読んだ
#なんで通らなくぁｗせｄｒｆｔｇｙふじこｌｐ
#?????????????????
A,B,C,D = list(map(int, input().split()))
def y(n, c, d):
    cd = c // fractions.gcd(c,d) * d
    cc = n//c
    dd = n//d
    ee = n//cd
    return n - cc - dd + ee

print(y(B, C, D) - y(A-1, C, D))

Measured memory_bytes: 5048
/*
 _    _    _______   _    _
| |  / /  |  _____| | |  / /
| | / /   | |       | | / /
| |/ /    | |_____  | |/ /
| |\ \    |  _____| | |\ \
| | \ \   | |       | | \ \
| |  \ \  | |_____  | |  \ \
|_|   \_\ |_______| |_|   \_\

*/
#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define right(x) x << 1 | 1
#define left(x) x << 1
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
#define mkp make_pair
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define y1 kekekek

const ll ool = 1e18 + 9;
const int oo = 1e9 + 9, base = 1e9 + 7;
const ld eps = 1e-7;
const int N = 1e6 + 6, C = 19;

int n, a[N], ind[N], mn[2][C + 3][N], cnt, deg[N], lg[N], p[N];
PII val[N];
vector < int > ans, g[N];
set < pair < PII, int > > st;

int get(int k, int l, int r) {
    int dd = lg[r - l + 1];
    return min(mn[k][dd][l], mn[k][dd][r - (1 << dd) + 1]);
}

void calc(int l, int r, int par) {
    if (l > r) return;
    int posl = ind[get(l & 1, l, r)];
    int posr = ind[get((l & 1) ^ 1, posl + 1, r)];
    //cerr << l << " " << r << " " << posl << " " << posr << " " << par << "\n";
    p[++cnt] = par;
    int cur = cnt;
    g[par].eb(cnt);

    val[cnt] = PII(a[posl], a[posr]);
    deg[par]++;
    if (par == 0) {
        st.insert(mkp(PII(a[posl], a[posr]), cnt));

    }
    calc(l, posl - 1, par);
    calc(posl + 1, posr - 1, cur);
    calc(posr + 1, r, par);
}

int main() {
	ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

    cin >> n;
    forn(i, 1, n) {
        cin >> a[i];
        ind[a[i]] = i;
    }

    forn(i, 1, n) mn[0][0][i] = ((i & 1) ? oo : a[i]);
    forn(i, 1, n) mn[1][0][i] = ((i % 2 == 0) ? oo : a[i]);

    forn(i, 2, n + 1) lg[i] = lg[i >> 1] + 1;
    forn(i, 1, C)
        forn(j, 1, n - (1 << i) + 1)
            forn(k, 0, 1) mn[k][i][j] = min(mn[k][i - 1][j], mn[k][i - 1][j + (1 << (i - 1))]);

    deg[0] = oo;
    calc(1, n, 0);

    while (sz(st)) {
        pair < PII, int > v = *st.begin();
        st.erase(st.begin());
        cerr << v.F.F <<" "  << v.F.S << " " << sz(g[v.S]) << "\n";
        ans.eb(v.F.F);
        ans.eb(v.F.S);
        for (auto it : g[v.S]) {
            st.insert(mkp(val[it], it));
        }
    }

    for (auto it : ans) cout << it << " ";
    cout << "\n";

	return 0;
}


Measured memory_bytes: 163192
import java.util.Scanner;

public class Main {

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        if (A == 1 && B == 2) System.out.println(3);
        if (A == 1 && B == 3) System.out.println(2);
        if (A == 2 && B == 1) System.out.println(3);
        if (A == 2 && B == 3) System.out.println(1);
        if (A == 3 && B == 1) System.out.println(2);
        if (A == 3 && B == 2) System.out.println(1);
    }
}


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

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

    vector<string> A(N), B(M);
    for(int i{0}; i<N; ++i){
        cin >> A[i];
    }
    for(int i{0}; i<M; ++i){
        cin >> B[i];
    }

    for(int i{0}; i+M-1<N; ++i){
        for(int j{0}; j+M-1<N; ++j){
            bool flag{true};
            for(int k{0}; k<M; ++k){
                if(A[j+k].substr(i, M) != B[k]){
                    flag = false;
                    break;
                }
            }
             if(flag){
                 cout << "Yes" << endl;
                 return(0);
            }
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll n, y;
        in >> n >> y;
        y /= 1000;
        ll i, j, k = 0;
        for (i = 0; i <= n; i++) {
            for (j = 0; j <= n; j++) {
                if (n < i + j) {
                    break;
                }
                k = n - i - j;
                if (10 * i + 5 * j + k == y) {
                    n = 0;
                    break;
                }
                if (n == 0) {
                    break;
                }
            }
            if (n == 0) {
                break;
            }
        }
        if (n == 0) {
            out << i << ' ' << j << ' ' << k << '\n';
        }
        else {
            out << "-1 -1 -1" << '\n';
        }
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n, p, tri[51][51];
vector<i64> a;

int main() {
  cin >> n >> p;
  read_n(a, n);
  i64 e = 0, o = 0;
  for (i64 x : a) {
    if (x % 2 == 0) ++e;
    else ++o;
  }

  tri[0][0] = 1;
  for (i64 i = 1; i <= n; ++i) {
    for (i64 j = 0; j <= n; ++j) {
      tri[i][j] += tri[i - 1][j];
      if (j > 0) tri[i][j] += tri[i - 1][j - 1];
    }
  }

  i64 ans = 0;
  for (i64 i = 0; i <= e; ++i) {
    for (i64 j = p; j <= o; j += 2) {
      ans += tri[e][i] * tri[o][j];
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

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

  vector<int> A(N);
  rep(i,N){
    cin >> A.at(i);
  }

  string ans = "APPROVED";
  rep(i, N){
    if(A.at(i)%2 == 0){
      if(A.at(i)%3!=0 && A.at(i)%5!=0) ans = "DENIED";
    }
  }

  cout << ans;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <array>
#include <utility>
#include <valarray>

using namespace std;

int main()
{
    int N;
    scanf("%d\n", &N);
    vector<int> A(N);
    for (int i = 0; i < N; ++i){
        int Ai;
        scanf("%d", &Ai); getchar();
        A[i] = Ai;
    }
    sort(A.begin(), A.end());
    long long sum = 0;
    int count = 0;
    for (int i = 0; i < N; ++i){
        if (A[i] > sum * 2) count = 0;
        ++count;
        sum += A[i];
    }
    printf("%d\n", count);
}


Measured memory_bytes: 640
/*input

*/
#include <bits/stdc++.h>
#define up(i,a,b) for(int (i) = (a);(i)<=(b);++(i))
#define down(i,b,a) for(int (i) = (b);i>=(a);--i)
#define debug(x) cerr << (x) << '\n';
#define bits(x,i) ((x >> i) & 1)
#define mid ((l+r)/2)
#define pr pair<int,int>
using namespace std;
const int logA = 60;
const int mod = 1e9 + 7;
long long dp[logA][2][2][2];
long long l,r;
long long solve(int pos,int isLow, int isHigh,int firstBit){
	if (pos < 0) return 1;
	long long& res = dp[pos][isLow][isHigh][firstBit];
	if (res != -1) return res;
	res = 0;
	int low = (isLow ? 0 : bits(l, pos)), high = (isHigh ? 1 : bits(r, pos));
	for(int choice = low; choice <= high;++choice){
		res += 
			solve(pos - 1,isLow | (choice != low),isHigh | (choice != high), firstBit | choice == 1);
		if (choice == 1 && low == 0 && firstBit == 1)
			res += solve(pos-1, isLow, isHigh,1);
		res %= mod;
	}
	return res;
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> l >> r;
	memset(dp, -1, sizeof(dp));
	cout << solve(59, 0,0,0) << '\n';
}

Measured memory_bytes: 3636
using System;
using System.ComponentModel;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var NK = Console.ReadLine().Split(" ");
            int[] num = new int[int.Parse(NK[0]) + 1];

            for (int i = 1; i <= int.Parse(NK[1]); i++)
            {
                int d = int.Parse(Console.ReadLine());
                int[] A = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
                foreach (int j in A)
                {
                    num[j] += 1;
                }
            }

            int res = 0;

            for (int i = 1; i <= int.Parse(NK[0]); i++)
            {
                if (num[i] == 0)
                {
                    res += 1;
                }
            }

            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 28760
from sys import stdin
import queue

H, W = [int(x) for x in stdin.readline().rstrip().split()]
maze = [stdin.readline().rstrip().split()[0] for _ in range(H)]

ans = 0

for h in range(H):
    for w in range(W):
        if maze[h][w] == '#':
            continue
        else:
            q = queue.Queue()
            q.put((h, w, 0))
            temp_h = h
            temp_w = w
            visited = [[0] * W for _ in range(H)]
            visited[h][w] = 1
            while q.qsize() > 0:
                temp = q.get()
                temp_h = temp[0]
                temp_w = temp[1]
                temp_d = temp[2]
                ans = max(ans, temp_d)
                if temp_h + 1 < H and maze[temp_h + 1][temp_w] == '.' and visited[temp_h + 1][temp_w] == 0:
                    visited[temp_h + 1][temp_w] = 1
                    q.put((temp_h + 1, temp_w, temp_d + 1))
                if temp_h - 1 >= 0 and maze[temp_h - 1][temp_w] == '.' and visited[temp_h - 1][temp_w] == 0:
                    visited[temp_h - 1][temp_w] = 1
                    q.put((temp_h - 1, temp_w, temp_d + 1))
                if temp_w + 1 < W and maze[temp_h][temp_w + 1] == '.' and visited[temp_h][temp_w + 1] == 0:
                    visited[temp_h][temp_w + 1] = 1
                    q.put((temp_h, temp_w + 1, temp_d + 1))
                if temp_w - 1 >= 0 and maze[temp_h][temp_w - 1] == '.' and visited[temp_h][temp_w - 1] == 0:
                    visited[temp_h][temp_w - 1] = 1
                    q.put((temp_h, temp_w - 1, temp_d + 1))

print(ans)

Measured memory_bytes: 109544
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes" << endl;
  else if (s[0] == s[2] && s[2] != s[1] && s[1] == s[3]) cout << "Yes" <<endl;
  else if (s[0] == s[3] && s[3] != s[2] && s[2] == s[1]) cout << "Yes" << endl;
  else cout << "No" << endl;
  
 return 0;
}

Measured memory_bytes: 256
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
const bool DEBUG = 1;
#include <iostream>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>
#include <cassert>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef tuple<ll, ll> P;
typedef tuple<ll, ll, ll> P3;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<P> VP;
typedef vector<string> VS;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

#define FOR(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=int(b)-1;i>=int(a);--i)
#define RREP(i,n) RFOR(i,0,n)

#define LFOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define LREP(i,n) LFOR(i,0,n)
#define LRFOR(i,a,b) for(ll i=ll(b)-1;i>=ll(a);--i)
#define LRREP(i,b,a) LRFOR(i,0,n)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(c).size())
#define REACH(i,c) RREP(i,(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))

#define BR cout<<"\n"

#define dump(x) if(DEBUG) cerr<<"["<<__LINE__<< "] "<<#x<<"="<<(x)<<"\n"
#define dump2(x,y) if(DEBUG) cerr<<"["<<__LINE__<< "] "<<#x<<"="<<(x)\
  <<" , "<<#y<<"="<<(y)<<"\n"
#define dump3(x,y,z) if(DEBUG)cerr<<"["<<__LINE__<<"] "<<#x<<"="<<(x)\
  <<" , "<<#y<<"="<<(y)<<"\n"\
  <<" , "<<#z<<"="<<(z)<<"\n"

#define SAY(x) if(DEBUG) cerr<<"["<<__LINE__<< "] "<<(x)<<"\n"

#define YES(x) cout<<((x)?"YES":"NO")<<"\n"
#define Yes(x) cout<<((x)?"Yes":"No")<<"\n"
#define yes(x) cout<<((x)?"yes":"no")<<"\n"

inline int omajinai_int_in(){omajinai;int n;cin>>n;return n;}
inline ll omajinai_ll_in(){omajinai;ll n;cin>>n;return n;}
inline string omajinai_string_in(){omajinai;string n;cin>>n;return n;}
inline int int_in(){int n;cin>>n;return n;}
inline ll ll_in(){ll n;cin>>n;return n;}
inline string string_in(){string n;cin>>n;return n;}
#define oini omajinai_int_in()
#define oinl omajinai_ll_in()
#define oins omajinai_string_in()
#define ini int_in()
#define inl ll_in()
#define ins string_in()

#define isInside(x,y) (0<=(x)&&(x)<w&&0<=(y)&&(y)<h)

#define F(x) (get<0>(x))
#define S(x) (get<1>(x))
#define T(x) (get<2>(x))

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

ll ans;

int main() {
	//#####//
	ll n=inl,m=inl;
	ll k=n;ll c=0;
	while(k<=m){
		k*=2;
		c++;
	}
	cout<<c<<endl;
	BR;
}

//


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

int main() {
    int k, s, cnt = 0;
    cin >> k >> s;
    for (int x = 0; x <= k; x++)
    {
        for (int y = 0; y <= k; y++)
        {
            if (s - (x + y) <= k && x + y <= s) {
                cnt++;
                //cout << x << " " << y << endl;
            }
        }
        
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed _main(){
  int N,K; cin >> N >> K;
  v<int> H(N);
  rep(i,N) cin >> H[i];
  sort(H.begin(),H.end());
  int ans=0;
  for(int i=H.size()-1-K;i>=0;i--){
    ans+=H[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int main(){
    string S;
    cin >> S;

    if(S[2] == S[3] && S[4] == S[5]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (){
	int x,y;
	scanf ("%d %d",&x, &y );
	char s[x];
	scanf ("%s", &s);
	s[y-1]=s[y-1]+32;
	printf ("%s", s);
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 1628
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

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

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int N = 220000;

int n, q;
string s;
char t[N];
char d[N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> q;
	cin >> s;
	for (int i = 0; i < q; ++i)
		cin >> t[i] >> d[i];
	int ans = n;
	int now = 0;
	for (int i = q - 1; i >= 0; --i) {
		if (d[i] == 'L' && now < n && s[now] == t[i])
			++now;
		else if (d[i] == 'R' && now > 0 && s[now - 1] == t[i])
			--now;
	}
	ans -= now;
	reverse(ALL(s));
	now = 0;
	for (int i = q - 1; i >= 0; --i) {
		if (d[i] == 'R' && now < n && s[now] == t[i])
			++now;
		else if (d[i] == 'L' && now > 0 && s[now - 1] == t[i])
			--now;
	}
	ans -= now;
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 976
class Person
    @points
    def initialize
        @points = 0
    end

    def addpoint(point)
        @points = @points + point
    end

    def getpoint
        return @points
    end
end

class CardGame
    @Asan
    @Bsan
    @gyou_num
    @output
    def main
        @Asan = Person.new
        @Bsan = Person.new
        while input = gets
            input_array = input.split
            if ! input_array[1]
                init(input_array[0])
                next
            end

            vs(input_array[0].to_i, input_array[1].to_i)

            @gyou_num = @gyou_num - 1
            if @gyou_num == 0
                writeData
                @Asan = Person.new
                @Bsan = Person.new
            end
        end
    end

    def vs(pointA, pointB)
        if pointA > pointB
            @Asan.addpoint(pointA + pointB)
        elsif pointA == pointB
            @Asan.addpoint(pointA)
            @Bsan.addpoint(pointB)
        else
            @Bsan.addpoint(pointA + pointB)
        end
    end

    def writeData
        puts @Asan.getpoint.to_s + " " + @Bsan.getpoint.to_s
    end

    def init(input)
        @gyou_num = input.to_i
        if input.to_i == 0
            return 0
        end
        return TRUE
    end
end

CardGame.new.main

Measured memory_bytes: 6112
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define w(t) int t;cin>>t;while(t--)
#define pb push_back
#define mk make_pair
#define ascSort(v) sort(v.begin(), v.end())
#define descSort(v) sort(v.begin(), v.end(), greater<int>())
#define ff first
#define ss second
#define pi pair<int,int>
#define vi vector<int>
#define umapi unordered_map<int,int>
#define INF 1000000007
#define PI 3.14159265
const int mod=998244353;
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>PBDS;

void FIO(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
}
bool cmp(int a, int b){
	return a>b;
}
int32_t main(){
	
	FIO();
	
		int k,n;cin>>k>>n;
		vi a(n);
		for(int i=0; i<n; i++)
			cin>>a[i];
		int mn=0;
		for(int i=1; i<n; i++){
			mn=max(mn,a[i]-a[i-1]);
		}
		mn=max(mn,k-a[n-1]+a[0]);
		cout<<k-mn;
	return 0;
	
		
}


Measured memory_bytes: 4756
A = [ [int(x) for x in input().split()] for _ in range(3) ]
N = int(input())
B = set([ int(input()) for _ in range(N) ])
res = "No"
for i in range(3):
    c1 = 0
    c2 = 0
    for j in range(3):
        c1 += 1 if A[i][j] in B else 0
        c2 += 1 if A[j][i] in B else 0
    if c1==3 or c2==3:
        res = "Yes"
if sum([ 1 if A[j][j] in B else 0 for j in range(3) ]) == 3:
    res = "Yes"
if sum([ 1 if A[j][2-j] in B else 0 for j in range(3) ]) == 3:
    res = "Yes"
print(res)

Measured memory_bytes: 9132
#include <bits/stdc++.h>
#pragma GCC optimize(3,"Ofast","inline")
using namespace std;
int n,dp[2003][2003],a[6003],ans,tg,MX[2003],cur;
int A[100004],B[100004],C[100004],t;
void add(int x,int y,int z){A[t]=x,B[t]=y,C[t++]=z;}
int main(){
	cin>>n;
	for(int i=1;i<=3*n;i++)scanf("%d",&a[i]);
	memset(dp,-1,sizeof(dp));
	memset(MX,-1,sizeof(MX));
	dp[a[1]][a[2]]=dp[a[2]][a[1]]=MX[a[1]]=MX[a[2]]=cur=0;
	for(int i=3;i<3*n;i+=3){
		if(a[i]==a[i+1]&&a[i]==a[i+2]){tg++;continue;}
		t=0;
		if(a[i]>a[i+1])swap(a[i],a[i+1]);
		if(a[i+1]>a[i+2])swap(a[i+1],a[i+2]);
		if(a[i]>a[i+1])swap(a[i],a[i+1]);
		if(a[i]==a[i+1]||a[i+1]==a[i+2])for(int j=1;j<=n;j++){
			if(a[i]==a[i+1])if(dp[j][a[i]]>=0)add(j,a[i+2],dp[j][a[i]]+1);else;
			else if(dp[j][a[i+1]]>=0)add(j,a[i],dp[j][a[i+1]]+1);
		}
		if(dp[a[i]][a[i]]>=0)add(a[i+1],a[i+2],dp[a[i]][a[i]]+1);
		if(dp[a[i+1]][a[i+1]]>=0)add(a[i],a[i+2],dp[a[i+1]][a[i+1]]+1);
		if(dp[a[i+2]][a[i+2]]>=0)add(a[i],a[i+1],dp[a[i+2]][a[i+2]]+1);
		add(a[i],a[i+1],cur),add(a[i+1],a[i+2],cur),add(a[i],a[i+2],cur);
		for(int k=1;k<=n;k++)if(MX[k]>=0)add(a[i],k,MX[k]),add(a[i+1],k,MX[k]),add(a[i+2],k,MX[k]);
		for(int j=0;j<t;j++)if(dp[A[j]][B[j]]<C[j])
			dp[A[j]][B[j]]=dp[B[j]][A[j]]=C[j],MX[A[j]]=max(MX[A[j]],C[j]),MX[B[j]]=max(MX[B[j]],C[j]),cur=max(cur,C[j]);
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++)ans=max(ans,dp[i][j]);
		if(dp[i][i]>=0)if(i==a[3*n])ans=max(ans,dp[i][i]+1);
	}
	printf("%d",ans+tg);
}

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

int N;
string S;

int main(){
  cin >> N >> S;
  S.erase(unique(S.begin(), S.end()), S.end());
  cout << S.size() << endl;
}

Measured memory_bytes: 3712
#include <stdio.h>

int main() {

  int i,sum = 0;
  int a;
  int all;

  while(1) {
  scanf("%d",&all);
  sum = 0;
  if(all == 0) break;

  for(i=0;i<9;i++) {

    scanf("%d",&a);
    sum = sum + a;

  }

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

  }

  return 0;

}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int k,s; cin>>k>>s;
	int ans=0;
	for(int x=0;x<=k;++x){
		for(int y=0;y<=k;++y){
			int z=s-x-y;
			if(z<=k&&z>=0)++ans;
		}
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 3596
#include <string>
#include <iostream>
#include <set>

int main()
{
  int N; std::cin >> N;
  std::string S; std::cin >> S;

  size_t ans{};
  for(int i = 1; i < N - 1; ++i){
    auto t = S.substr(0, i);
    auto u = S.substr(i, S.size() - i);
    std::set<char> res{};
    for(int k = 0; k < i; ++k){
      if(u.find(t[k]) != u.npos){
        res.emplace(t[k]);
      }
    }
    ans = std::max(ans, res.size());
  }

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


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#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;}


signed main(void) {
    int n;
    cin >> n;
    vp a(n);
    rep(i,n){
        cin >> a[i].second >> a[i].first;
    }
    sort(all(a));
    int sum = 0;
    rep(i,n){
        sum += a[i].second;
        if(a[i].first < sum){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

}


Measured memory_bytes: 3328