akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>

int main(){
    int N,K;
    scanf("%d%d", &N, &K);
    
    int x,y;
    int ans=0;
    int flag=0;
   
    x = -1;
    while( flag == 0 ){
        x += 1;
        y = N / pow(K, x);
        if( y < 1 ) flag = 1;
        else ans = x+1;
    }

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


Measured memory_bytes: 128
n = gets.to_i
s = gets.chomp.chars

ans = 0
k = s.uniq.size
n.times do |i|
    f = s[0..i].uniq
    l = s[i+1..-1].uniq
    t = f.size + l.size - k
    ans = t if ans < t
end

p ans

Measured memory_bytes: 1788
from sys import stdin


def main():
    N, M = [int(x) for x in stdin.readline().rstrip().split()]
    As = [int(x) for x in stdin.readline().rstrip().split()]
    S = sum(As)
    x = [a for a in As if (S / (4 * M)) <= a]
    print('Yes' if M <= len(x) else 'No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main (void){
    long long L, R;
    long long result = 10000;
    scanf("%lld%lld", &L, &R);

    if(R - L > 2018){
        cout << 0 << endl;
        return 0;
    }

    vector<long long> A(R - L + 1);

    iota(A.begin(), A.end(), L);
    for (int i = 0; i < R - L; i++){
        for (int j = i + 1; j <= R - L; j++){
            result = min(result, (A[i] * A[j]) % 2019);
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
use std::io::*;

fn main() {
    let a = read();
    let b = read();
    let c = read();

    let out = stdout();
    let mut out = BufWriter::new(out.lock());

    if b - a == c - b {
        out.write(b"YES");
    } else {
        out.write(b"NO");
    }
}

fn read() -> u32 {
    let s = stdin();
    let b = s.bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    b.parse().ok().unwrap()
}



Measured memory_bytes: 4352
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            //var n = int.Parse(ReadLine());
            var line = ReadLine().Split(' ').Select(value => float.Parse(value)).ToArray();
            var d = line[0];
            var t = line[1];
            var s = line[2];

            WriteLine((d / s <= t) ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 28068
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 08/02/20 20:55:48
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
template <typename T>
class binary_indexed_tree {
 private:
  vector<T> tree_;

 public:
  explicit binary_indexed_tree(size_t size) : tree_(size+1) {}

  template <typename Iter>
  explicit binary_indexed_tree(Iter begin, Iter end) : binary_indexed_tree(end-begin) {
    for (auto it = begin; it != end; ++it)
      add(it-begin, *it);
  }

  void add(size_t index, T x) {
    for (size_t i = index+1; i < tree_.size(); i += i&(-i))
      tree_[i] += x;
  }

  T sum(size_t index) const {
    T sum = 0;
    for (size_t i = index+1; i > 0; i -= i&(-i))
      sum += tree_[i];
    return sum;
  }

  T range_sum(size_t l, size_t r) const {
    return l > 0 ? sum(r-1)-sum(l-1) : sum(r-1);
  }

};

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

  int n,q; cin>>n>>q;
  vector<int> C(n); for (auto &c:C) cin>>c;

  struct Query {
    int i;
    int l,r;
  };
  vector<Query> Q(q);
  for (int i = 0; i < q; i++) {
    int l,r; cin>>l>>r; l--; r--;
    Q[i] = {i,l,r};
  }
  sort(Q.begin(), Q.end(), [](auto l, auto r) {return l.r<r.r;});

  vector<int> ans(q);
  vector<int> p(n+1, -1);
  binary_indexed_tree<int> bit(n);
  int k = 0;
  for (auto [i,l,r]:Q) {
    while (k < n and k <= r) {
      bit.add(k, 1);
      if (p[C[k]] != -1)
        bit.add(p[C[k]], -1);
      p[C[k]] = k;
      k++;
    }
    ans[i] = bit.range_sum(l, r+1);
  }
  for (auto a:ans)
    cout << a << endl;

  return 0;
}


Measured memory_bytes: 17400
#include <iostream>

using namespace std;
typedef long long ll;

ll n, a, b, c, d, e;

void solve() {
  ll minVal = min(a, min(b, min(c, min(d, e))));
  cout << (4 + (n + minVal - 1) / minVal) << endl;
}

int main() {
  cin >> n >> a >> b >> c >> d >> e;
  solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
string s;
vector<int> r,b,g;
int rsize,bsize,gsize;
ll ans;
int main()
{
	cin>>n;
	cin>>s;
	for(int i=0;i<n;i++)
	{
		if (s[i]=='R')
		{
			++rsize;
			r.push_back(i);
		}
		else if (s[i]=='G')
		{
			++gsize;
			g.push_back(i);
		}
		else
		{
			++bsize;
			b.push_back(i);
		}
	}
	for(int i=0;i<rsize;i++)
		for(int j=0;j<gsize;j++)
		{
			int rpos=r[i],gpos=g[j];
			if (rpos>gpos)
				swap(rpos,gpos);
			ans+=bsize;
			if ((rpos+gpos)%2==0&&s[(rpos+gpos)/2]=='B')
				ans--;
			int fro=gpos+gpos-rpos;
			int bac=rpos-(gpos-rpos);
			if (fro<n&&s[fro]=='B')
				ans--;
			if (bac>=0&&s[bac]=='B')
				ans--;
		}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  set<string> S;
  rep(i, N) {
    string x;
    cin >> x;
    S.insert(x);
  }
  cout << S.size() << endl;
  return 0;
}

Measured memory_bytes: 19152
#include<stdio.h>
#define N 8
#define able -1
#define not_able 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

int X[N][N];
//int i,j;

void initialize(){
  int i,j;
  for(i=0;i<N;i++)row[i]=col[i]=able;
  for(i=0;i<2*N-1;i++)dpos[i]=dneg[i]=able;
}

void print(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(X[i][j]){if(row[i]!=j)return;}
      
    }
  }

for(i=0;i<N;i++){
  for(j=0;j<N;j++){
    if(row[i]==j)printf("Q");
    else printf(".");
  }
  printf("\n");
 }
}

void recursive(int x){
  int j;
  if(x==N){
    print();
    return;
}
  for(j=0;j<N;j++){
    if(not_able==col[j] ||
       not_able==dpos[x+j] ||
       not_able==dneg[x-j+N-1])continue;

    //Put Queens
    row[x]=j;
    col[j]=dpos[x+j]=dneg[x-j+N-1]=not_able;                                    
    recursive(x+1);
    //Remove Queens
    row[x]=col[j]=dpos[x+j]=dneg[x-j+N-1]=able;
  }
}

int main(){
  int i,j;
  int k,r,c;
  initialize();

  for(i=0;i<N;i++)
    for(j=0;j<N;j++)X[i][j]=0;
  
  scanf("%d",&k);

  for(i=0;i<k;i++){
    scanf("%d %d",&r,&c);
    X[r][c]=1;
  }

  recursive(0);//don?¨?

  return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    string S,T; cin >> S >> T;
    int A,B; cin >> A >> B;
    string U; cin >> U;
    if(S == U){
        cout << A-1 << " " << B << endl;
    }
    else{
        cout << A << " " << B-1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define mod1 998244353 
#define inf 1000000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'

vll adj[10005];
ll deg[10005],c[10005],ans[10005],val,ind;

void dfs(ll x,ll pr)
{
    for(auto i:adj[x])
    {
        if(i!=pr)
        {
            ans[i]=c[ind];
            val+=min(ans[i],ans[x]);
            ind++;
        }
    }
    for(auto i:adj[x])
    {
        if(i!=pr)
        {
            dfs(i,x);
        }
    }

}

int main()
{
    fastio;
    #ifdef APNA_IO
        start_routine();
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);    
    #endif

    ll n;cin>>n;
    for(ll i=1;i<n;i++)
    {
        ll x,y;cin>>x>>y;
        adj[x].pb(y);
        adj[y].pb(x);
    }

    for(ll i=1;i<=n;i++)
        cin>>c[i];
    sort(c+1,c+1+n);
    reverse(c+1,c+1+n);

    ind=1;
    ans[1]=c[1];
    ind++;
    dfs(1,1);

    cout<<val<<endl;
    for(ll i=1;i<=n;i++)
        cout<<ans[i]<<" ";

    #ifdef APNA_IO
        end_routine();
    #endif
}

Measured memory_bytes: 1536
// 未使用変数(cPrice)を削除し, 再提出.
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const int MAX = 101010;
LL A[MAX];

int main(){
    
    // 1. 入力情報.
    int N;
    scanf("%d", &N);
    rep(i, N) scanf("%lld", &A[i]);
    
    // 2. 品物の販売個数が最大になるようにする.
    LL ans = 0, resPrice = 0;
    rep(i, N){
        // 先頭の人には, 価格1 の品物を, (A[0] - 1)個 販売.
        if(i == 0){
            ans += A[i] - 1;
            A[0] = 1;
            resPrice = 2;
            continue;
        }
        
        // すでに販売したメンバーの残価格(resPrice)を比較して, 販売価格をチェック.
        // 等しかったら, メンバーの残価格を, インクリメント.
        if(A[i] == resPrice){
            resPrice++;
            continue;
        }
        
        // 2番目以降の人にも販売.
        LL c = A[i] / resPrice;
        if(A[i] ==  c * resPrice){
            // 価格(resPrice + 1) を 1個販売し, 残りを, 価格resPrice で, 販売.
            if(A[i] > resPrice + 1){
                ans++;
                A[i] -= (resPrice + 1);
                ans += A[i] / resPrice;
                A[i] %= resPrice;
                resPrice = max(resPrice, A[i] + 1);
            }
        }else{
            ans += c;
            A[i] %= resPrice;
            resPrice = max(resPrice, A[i] + 1);
        }
    }
    
    // 3. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define GET5(_1, _2, _3, _4, _5, F, ...) F
#define IN1(T, a) \
    T a;          \
    cin >> a;
#define IN2(T, a, b) \
    T a, b;          \
    cin >> a >> b;
#define IN3(T, a, b, c) \
    T a, b, c;          \
    cin >> a >> b >> c;
#define IN4(T, a, b, c, d) \
    T a, b, c, d;          \
    cin >> a >> b >> c >> d;
#define in(...)                           \
    GET5(__VA_ARGS__, IN4, IN3, IN2, IN1) \
    (__VA_ARGS__)
#define ll(...) in(ll, __VA_ARGS__)
int main() {
  ll(D, T, S);
  cout << (S * T >= D ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int n;
const long long INF = 1e15;
long long a[405], cost[405];
long long dp[405][405]; //[l, r]のスライムを1体にするのに必要なコスト
void calccost(){
  cost[0] = 0;
  for(int i=0; i<n; i++) cost[i+1] = cost[i] + a[i];
}
long long solve(int l, int r){
  if(l == r) return 0;
  if(dp[l][r] == INF) for(int i=l; i<r; i++) dp[l][r] = min(dp[l][r], solve(l, i) + solve(i+1, r) + cost[r+1] - cost[l]);
  return dp[l][r];
}
int main(){
  cin >> n;
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=0; i<n; i++) for(int j=0; j<n; j++) dp[i][j] = INF;
  calccost();
  cout << solve(0, n-1) << endl;
}

Measured memory_bytes: 4852
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

int main(){
  int n;string s;
  cin>>n>>s;
  int ans=0;
  int count;
  string key="qwertyuiopasdfghjklzxcvbnm";
  for(int i=0;i<n;i++){
    count=0;
    string t=s;
    string left=t.substr(0,i);
    string right=t.substr(i,n-i);
    set<char>s1,s2;
    for(int j=0;j<left.size();j++)s1.insert(left[j]);
    for(int j=0;j<right.size();j++)s2.insert(right[j]);
    for(int j=0;j<26;j++){
      if(s1.count(key[j]) && s2.count(key[j]))count++;
    }
    ans=max(count,ans);
  }
  cout<<ans<<endl;
}
    

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

int main() {
int n;
cin >> n;
for (int i = 1; i <=n ; i++) {
if ( i % 3 ==0 || i % 10 == 3) {
cout << " " << i;
}else {
int p = i;
while(p / 10 != 0){
p /= 10;
if (p % 10 == 3) {
cout << " " << i;
break;
}
}
}} cout << endl;

return 0;
}


Measured memory_bytes: 3088
// JAI SHREE RAM
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define loop for(int i=0;i<n;i++)
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max3(a,max(b,c),d)
#define max5(a,b,c,d,e) max4(a,max(b,c),d,e)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min3(a,min(b,c),d)
#define min5(a,b,c,d,e) min4(a,min(b,c),d,e)
#define sec second
#define fir first
// #define all(a) (a).begin(),(a).end()
#define vec vector<int>
#define M_PI           3.14159265358979323846  /* pi */
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
std::vector<ll> v;
ll n;
std::vector<ll> memo(100005,-1);
ll dp(ll i)
{
	if(i==0)
		return 0;

	if(i==1)
		return abs(v[1]-v[0]); 

	if(memo[i]==-1)
	return memo[i]=min(dp(i-1)+abs(v[i]-v[i-1]),dp(i-2)+abs(v[i]-v[i-2]));
	else
	return memo[i];
}
int main()
{
	fast
	cin>>n;
	FOR(i,n)
	{
		ll x;
		cin>>x;
		v.pb(x);
	}
std::vector<ll> v2(n);
v2[0]=0;
v2[1]=abs(v[1]-v[0]);


for(int i=2;i<n;i++)
{
	v2[i]=min(v2[i-2]+abs(v[i-2]-v[i]),abs(v[i]-v[i-1])+v2[i-1]);
}
cout<<v2[n-1];


return 0;
}


Measured memory_bytes: 2804
#include <stdio.h>
 
int main(void)
{
  int A,B,C;
  
  do {
  	scanf("%d ",&A);
  } while (A < 1 || A > 9);
  do {
  	scanf("%d ",&B);
  } while (B < 1 || B > 9);
  do {
  	scanf("%d",&C);
  } while (C < 1 || C > 9);
  
  if(A==B && B==C)
    printf("No\n");
  else if((A==B || B==C) || A==C)
    printf("Yes\n");
  else
    printf("No\n");
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

int main() {
  ll N, K, S, T, ans{};
  cin >> N >> K;
  vector<int> A(N);
  ll P = K * (K+1) / 2 % MOD;
  ll Q = K * (K-1) / 2 % MOD;
  for (int &a: A) cin >> a;
  for (int i = 0; i != N; ++i) {
    S = T = 0;
    for (int j = 0; j != N; ++j)
      if (A[i] > A[j]) ++(i < j ? S : T);
    ans = (ans + S * P + T * Q) % MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3604
h,n=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
dp=[[10**9+1]*(h+1) for i in range(n+1)]
for i in dp:
  i[0]=0

for i in range(n):
  for j in range(h+1):
    if j-ab[i][0]>=0:
      dp[i+1][j]=min(dp[i][j],dp[i+1][j-ab[i][0]]+ab[i][1],(j//ab[i][0]+1)*ab[i][1])
    else:
      dp[i+1][j]=min(dp[i][j],ab[i][1])
print(dp[-1][h])

Measured memory_bytes: 145900
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	string s;
	cin >> s;
	rep(i, s.size()) cout << 'x';
	cout << endl;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i=(ll)(r);i<(ll)(n);++i)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define pb(n) push_back(n)
#define endl '\n'
#define debug(x) cout << #x << " = " << (x) << endl
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define VIN(V) for(int ii = 0; ii < (V).size(); ii++) {cin >> (V).at(ii);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(ii,(V).size()){cout << (V)[ii] << " ";} cout<<endl;
#define VOUT2(V) REP(jj,(V).size()){VOUT(V[jj])}
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi > vvi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
ll n, m, k, ans, sum, cnt = 0; string s; char c;

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  double n,d;
  IN2(n,d);

  OUT(ceil(n/(2*d+1)));
}


Measured memory_bytes: 256
a1, a2, a3 = map(int,input().split())
a4, a5, a6 = map(int, input().split())
a7, a8, a9 = map(int, input().split())
lis = [a1, a2, a3, a4, a5, a6, a7, a8, a9]
n = int(input())

for _ in range(n):
  b = int(input())
  for i in range(9):
    if b == lis[i]:
      lis[i] = 0

if (lis[0] == 0 and lis[1] == 0 and lis[2] == 0) or (lis[3] == 0 and lis[4] == 0 and lis[5] == 0) or (lis[6] == 0 and lis[7] == 0 and lis[8] == 0):
  print("Yes")
elif (lis[0] == 0 and lis[3] == 0 and lis[6] == 0) or (lis[1] == 0 and lis[4] == 0 and lis[7] == 0) or (lis[2] == 0 and lis[5] == 0 and lis[8] == 0):
  print("Yes")
elif (lis[0] == 0 and lis[4] == 0 and lis[8] == 0) or (lis[2] == 0 and lis[4] == 0 and lis[6] == 0):
  print("Yes")
else:
  print("No")
    

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

int main() {
    int N;
    cin >> N;
    vector<int>v(N);
    set<int>s;
    int count = 0; 
    rep(i, 0, N) cin >> v[i];
    rep(i, 0, N){
        if(v[i] >= 3200) count++;
        else s.insert(v[i]/400);
    }
    if(s.size() == 0){
        cout << "1" << " " << count << endl;
    }else{
        cout << s.size() << " " << s.size() + count << endl;
    }
}


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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  rep(i, n/2) if (s[i] != s[n-1-i]) {cout << "No" << endl; return 0;}
  rep(i, n/2) {
    if (s[i] != s[n/2-1-i]) {cout << "No" << endl; return 0;}
    if (s[n/2+1+i] != s[n-1-i]) {cout << "No" << endl; return 0;}
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<typename T>
struct BIT{
    vector<T> bit;
    int size;
    BIT(int n):size(n), bit(n+1, 0){}
    T sum(int i){ //[0, i)
        T s=0;
        while(i>0){
            s+=bit[i];
            i-=(i&(-i));
        }
        return s;
    }
    T sum(int l, int r){ //[l, r)
        return sum(r)-sum(l);
    }
    void add(int i, T x){
        i++;
        while(i<=size){
            bit[i]+=x;
            i+=(i&(-i));
        }
    }
};
int main()
{
	int t; cin>>t;
	while(t--){
		int n; cin>>n;
		ll ans=0;
		vector<vector<ll>> vl(n+1), vr(n+1);
		for(int i=0; i<n; i++){
			int k, l, r; cin>>k>>l>>r;
			if(l==r){
				ans+=l;
				continue;
			}
			if(l>r){
				ans+=r;
				vl[k-1].push_back(l-r);
			}else{
				ans+=l;
				if(k<n) vr[k].push_back(r-l);
			}
		}
		priority_queue<ll, vector<ll>, greater<ll>> que;
		vector<ll> sl(n+1), sr(n+1);
		multiset<int> st1, st2;
		ll sum=0;
		for(int i=0; i<n; i++) for(auto x:vl[i]) st2.insert(x);
		for(int i=0; i<n; i++){
			for(auto x:vl[i]) que.push(x);
			while(que.size()>i+1){
				int y=que.top();
				que.pop();
				if(st2.find(y)!=st2.end()) st2.erase(st2.find(y));
				else st1.erase(st1.find(y)), sum-=y;
			}
			while(!st2.empty() && st1.size()<i+1){
				int y=*st2.rbegin();
				st2.erase(st2.find(y));
				st1.insert(y);
				sum+=y;
			}
			sl[i+1]=sum;
		}
		while(!que.empty()){
			que.pop();
		}
		st1.clear(); st2.clear();
		sum=0;
		
		for(int i=0; i<n; i++) for(auto x:vr[i]) st2.insert(x);
		for(int i=n-1; i>=0; i--){
			for(auto x:vr[i]) que.push(x);
			while(que.size()>n-i){
				int y=que.top();
				que.pop();
				if(st2.find(y)!=st2.end()) st2.erase(st2.find(y));
				else st1.erase(st1.find(y)), sum-=y;
			}
			while(!st2.empty() && st1.size()<n-i){
				int y=*st2.rbegin();
				st2.erase(st2.find(y));
				st1.insert(y);
				sum+=y;
			}
			sr[n-1-i]=sum;
		}

		ll mx=0;
		for(int i=0; i<=n; i++){
			mx=max(mx, sl[i]+sr[n-i]);
		}
		cout<<ans+mx<<endl;
	}
	return 0;
}

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


int main(){
	

		string s;
		cin>>s;
		int n = s.length();
		char ch = s[n-1];
		
		if(ch=='s')
		s = s+"es";
		else 
		s= s+"s";
		
		cout<<s;
	
	return 0;
}


Measured memory_bytes: 3576
n, k = gets.chomp.split.map &:to_i
sunuke = Array.new(n,false)

k.times do
  d = gets.chomp.to_i
  a = []
  a << gets.chomp.to_i if d == 1
  a = gets.chomp.split.map &:to_i if d != 1
  a.each do |i|
    sunuke[i-1] = true
  end
end

cnt = sunuke.select{|i| i==false}
p cnt.length

Measured memory_bytes: 14312
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    ll a,b;
    ll ans=0;
    vector<pair<ll,ll> > v;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        v.pb(make_pair(a,b));
    }
    multiset<ll> ms;
    sort(be(v));
    ll im=1;
    multiset<ll>::iterator itr;
    for(int i=0;i<n;i++){
        im=max(im,v[i].first);
        ms.insert(v[i].second);
        if(i==n-1){
            for(itr=ms.end();itr!=(ms.begin())&&im<=m;im++){
                itr--;
                ans+=*itr;
                if(*itr!=0)ms.erase(itr);
            }
        }
        else if(v[i].first!=v[i+1].first){
            for(itr=ms.end();itr!=(ms.begin())&&im<v[i+1].first&&im<=m;im++){
                itr--;
                ans+=*itr;

                
                
                /////
                if(*itr!=0)ms.erase(itr);
            }
        }
    }
    cout << ans<<endl;
    return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++) {
    cin >> A.at(i);
  }
  bool ok = true;
  for(int i=0;i<N;i++) {
    if(A.at(i)%2==1) {
      continue;
    }
    else if(A.at(i)%3!=0&&A.at(i)%5!=0){
      ok=false;
    }
    else {
    }
  }
  if(ok==true) {
    cout << "APPROVED" << endl;
  }
  else {
    cout << "DENIED" << endl;
  }
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    for (int kk = 0; kk < n; kk++)
    {
        int x, y, b, p;
        cin >> x >> y >> b >> p;
        int ans = x * b + y * p;
        for (int i = 1; i <= 5; i++)
        {
            int tmp = ((5 * x + 2 * y) * i + max(0, b - 5 * i) * x + max(0, p - 2 * i) * y) * 0.8;
            ans = min(ans, tmp);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3080
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

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

    string S; cin >> S;

    int count[2];
    count[0] = 0;
    count[1] = 0;
    int lastPair = -1;
    char cur = 'R';
    int N = sz(S);
    int ans[N]; F0R(i, N) ans[i] = 0;
    F0R(i, N) {
        if (S[i] == cur) {
            count[i%2]++;
        } else {
            if (S[i] == 'L') {
                lastPair = i-1;
                ans[lastPair] += count[lastPair%2];
                ans[lastPair+1] += count[(lastPair+1)%2];
            } else {
                ans[lastPair] += count[lastPair%2];
                ans[lastPair+1] += count[(lastPair+1)%2];
            }
            count[0] = 0;
            count[1] = 0;
            count[i%2]++;
            cur = S[i];
        }

    }

    ans[lastPair] += count[lastPair%2];
    ans[lastPair+1] += count[(lastPair+1)%2];

    F0R(i, N) {
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343
// license: https://github.com/bqi343/USACO/blob/master/LICENSE

Measured memory_bytes: 1104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

signed main() {
#ifdef LOCAL
  assert(freopen("d.in", "r", stdin));
#endif
  int n, m, d;
  cin >> n >> m >> d;
  string s("RGBY");
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int c1 = ((i + j) / d) % 2;
      int c2 = ((i + m - j) / d) % 2;
      cout << s[c1 * 2 + c2];
    }
    cout << '\n';
  }
}

Measured memory_bytes: 512
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------
from collections import deque
class Dinic:
    def __init__(self, N):
        self.N = N
        self.G = [[] for i in range(N)]

    def add_edge(self, fr, to, cap):
        forward = [to, cap, None]
        forward[2] = backward = [fr, 0, forward]
        self.G[fr].append(forward)
        self.G[to].append(backward)

    def add_multi_edge(self, v1, v2, cap1, cap2):
        edge1 = [v2, cap1, None]
        edge1[2] = edge2 = [v1, cap2, edge1]
        self.G[v1].append(edge1)
        self.G[v2].append(edge2)

    def bfs(self, s, t):
        self.level = level = [None]*self.N
        deq = deque([s])
        level[s] = 0
        G = self.G
        while deq:
            v = deq.popleft()
            lv = level[v] + 1
            for w, cap, _ in G[v]:
                if cap and level[w] is None:
                    level[w] = lv
                    deq.append(w)
        return level[t] is not None

    def dfs(self, v, t, f):
        if v == t:
            return f
        level = self.level
        for e in self.it[v]:
            w, cap, rev = e
            if cap and level[v] < level[w]:
                d = self.dfs(w, t, min(f, cap))
                if d:
                    e[1] -= d
                    rev[1] += d
                    return d
        return 0

    def flow(self, s, t):
        flow = 0
        INF = 10**9 + 7
        G = self.G
        while self.bfs(s, t):
            *self.it, = map(iter, self.G)
            f = INF
            while f:
                f = self.dfs(s, t, INF)
                flow += f
        return flow

# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
R = [tuple(map(int,input().split())) for _ in range(N)]
B = [tuple(map(int,input().split())) for _ in range(N)]

# 0 : start
# 1..N : 赤
# N+1..2N: 青
# 2N+1 : end
dinic = Dinic(N*2+2)

# 始点 -> 赤
for i in range(N):
    dinic.add_edge(0,i+1,1)
# 青 -> 終点
for i in range(N):
    dinic.add_edge(N+i+1,N*2+1,1)
# 条件を満たす 赤 -> 青 
for i in range(N):
    for j in range(N):
        rx,ry = R[i]
        bx,by = B[j]
        if rx < bx and ry < by:
            dinic.add_edge(i+1,N+j+1,1)

print(dinic.flow(0,N*2+1))

Measured memory_bytes: 4080
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <set>
#include "time.h"
#include "math.h"

using namespace std;

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

  int n, q;
  string s;
  vector< set<int> > sets(26);

  cin >> n >> s >> q;

  for (int i = 0; i < n; i ++) {
    sets[s[i] - 'a'].insert(i);
  }

  for (int i = 0; i < q; i ++) {
    int mode;
    cin >> mode;
    if (mode == 1) {
      int i;
      char c;
      cin >> i >> c;
      i -= 1;
      sets[s[i] - 'a'].erase(i);
      s[i] = c;
      sets[c - 'a'].insert(i);
    } else {
      int l, r;
      cin >> l >> r;
      l -= 1; r -= 1;
      int count = 0;
      for (int j = 0; j < 26; j ++) {
        auto it = sets[j].lower_bound(l);
        if (it != sets[j].end() && *it <= r) {
          count += 1;
        }
      }
      cout << count << endl;
    }
  }
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    ll A, B, C;
    cin >> A >> B >> C;
    if ((A == B && B != C) || (A == C && A != B) || (B == C && B != A))
        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 < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main() {
	int N, K; cin >> N >> K;	
	vector<int> A(N); rep(i, N) cin >> A.at(i);
	/*
	int i = find(all(A), 1) - A.begin(); // 0-indでの1の位置
	int ans = (i + (K - 1) - 1) / (K - 1) + ((N - 1 - i) + (K - 1) - 1) / (K - 1);
	*/
	int ans = ((N - 1) + (K - 1) - 1) / (K - 1);
	cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<cstring>
#pragma GCC optimize(2)
using namespace std;
int a,b;
int main(){
	ios::sync_with_stdio(false);
	cin>>a>>b;
	for(int i=1;i<=a;i++){
		string st;
		cin>>st;
		cout<<st<<endl<<st<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

int main(void) {
	int n,m; cin >> n >> m;
	vi p(m); vector<string> s(m);
	rep(i,m) cin >> p[i] >> s[i];
	rep(i,m) p[i]--;
	int ac=0;
	int wa=0;
	vi acv(n,0),wav(n,0);
	vector<bool> clr(n,false);
	rep(i,m){
		if(clr[p[i]]) continue;
		if(s[i]=="AC"){
			acv[p[i]]++;
			clr[p[i]]=true;
		}else{
			wav[p[i]]++;
		}	
	}
	rep(i,n){
		if(clr[i]){
			ac+=acv[i];
			wa+=wav[i];
		}
	}
	cout << ac << " " << wa << endl;

}




Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  int n, W;
  cin >> n >> W;
  vector<int> v(n), w(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i] >> w[i];
  }

  int dp[n + 10][W + 10] = {};

  for (int i = 0; i < n; i++) {
    for (int lim = 0; lim <= W; lim++) {
      if(w[i] > lim) {
        dp[i + 1][lim] = dp[i][lim];
      } else {
        dp[i + 1][lim] = max(dp[i][lim - w[i]] + v[i], dp[i][lim]);
      }
    }
  }

  cout << dp[n][W] << ln;

  return 0;
}


Measured memory_bytes: 7528
#include<stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){				//1.r的含义与自打以不同（对应自打1//3.） 
	int x,i,j,t;
	x=A[r];
	i=p-1;
	for(j=p;j<r;j++){					//1.	//2.		
		if(A[j]<=x){
			i++;				
			t=A[i];A[i]=A[j];A[j]=t;		
		}
	}
	t=A[i+1];A[i+1]=A[r];A[r]=t;		//2.i没到r所以要在这换 
	return i+1;
}

int main(){
	int i,q;
	
	scanf("%d",&n);
	for(int i=0;i<n;++i) scanf("%d",&A[i]);
	
	q=partition(0,n-1);	
				
	for(int i=0;i<n;++i){				//1. 
		if(i) printf(" ");
		if(i==q) printf("[");
		printf("%d",A[i]);
		if(i==q) printf("]");
	}
	printf("\n");
	
	return 0;
} 


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, aCnt = 0, bCnt = 0;
    cin >> n;
    int cards[n];
    for(int i = 0; i < n; i++)
        cin >> cards[i];
    sort(cards, cards + n, greater<int>());
    for(int i = 0; i < n; i++){
        if((i + 1) % 2 != 0)
            aCnt += cards[i];
        else
            bCnt += cards[i];
    }
    cout << aCnt - bCnt << "\n";
    return 0;
}


Measured memory_bytes: 3616
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
typedef struct _data
{
    int x, y;
}Data;
Data red[105], blue[105];
int N, result, chk[105];

bool comp(Data t, Data u)
{
    if(t.x == u.x)
    {
        return t.y < u.y;
    }
    return t.x < u.x;
}

int main()
{
    scanf("%d", &N);
    for(int i = 0; i < N; i++)
    {
        scanf("%d %d", &red[i].x, &red[i].y);
    }
    for(int i = 0; i < N; i++)
    {
        scanf("%d %d", &blue[i].x, &blue[i].y);
    }
    sort(blue, blue + N, comp);
    for(int i = 0; i < N; i++)
    {
        int Max, Maxidx;
        Max = -1;
        Maxidx = -1;
        for(int j = 0; j < N; j++)
        {
            if(chk[j] == 0 && red[j].x < blue[i].x && red[j].y < blue[i].y)
            {
                if(Max < red[j].y)
                {
                    Max = red[j].y;
                    Maxidx = j;
                }
            }
        }
        if(Maxidx != -1)
        {
            chk[Maxidx] = 1;
            result++;
        }
    }
    printf("%d", result);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N, a[112345];
std::vector<int>dp[112345];

int do_dp(int v)
{
	int res = 0;
	std::vector<int>chs;
	if (dp[v].size() == 0) { return 0; }
	for (auto i : dp[v]) { chs.push_back(do_dp(i)); }
	std::sort(chs.begin(), chs.end());
	rep(i, chs.size()) { res = std::max(res, chs[i] + (int)chs.size() - i); }
	return res;
}

int main()
{
	in >> N;
	rep(i, N - 1) { in >> a[i]; }
	rep(i, N - 1) { dp[a[i] - 1].push_back(i + 1); }
	out << do_dp(0) << std::endl;
	return 0;
}

Measured memory_bytes: 14208
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

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

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

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0):x(x%mod){}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		res -= a;
	}
	mint operator*(const mint a)const {
		mint res(*this);
		return res *= a;
	}
};

map<string, int> memo;

using P=pair<int, int>;

struct Clock {
	int hour, minute, second;
	void set(int h, int m, int s) {
		hour = h; minute = m; second = s;
	}
	string to_str() {
		string h, m, s;
		h = to_string(hour);
		m= to_string(minute);
		s= to_string(second);
		if (h.size() < 2) h = "0" + h;
		if (m.size() < 2) m = "0" + m;
		if (s.size() < 2) s = "0" + s;
		return h + ":" + m + ":" + s;
	}
	void shift(int diff_second) {
		int h, m;
		h = diff_second / 3600;
		m = diff_second / 60;
		diff_second %= 60;
		second += diff_second;
		
	}
};


/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
int main() {
	int n, k;
	string s;
	cin >> n >> k >> s;
	s[k - 1] = tolower(s[k - 1]);
	cout << s;
	return 0;
}










Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
typedef long long LL;

int main(){
	int n,a;
	cin >> n >> a;
	for(int i = 0;i <= a;i++){
		if((n - i) % 500 == 0 && n - i >= 0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	int h, w;
	cin >> h >> w;
	vector<vector<char>> g(h, vector<char>(w));
	rep(i, h) rep(j, w) cin >> g[i][j];
	
	vector<int> eh, ew;
	for(int i = 0; i < h; ++i){
		bool erase = false;
		for(int j = 0; j < w; ++j){
			if(g[i][j] == '#'){
				erase = true;
			}
		}
		if(erase) eh.push_back(i);
	}
	
	for(int i = 0; i < w; ++i){
		bool erase = false;
		for(int j = 0; j < h; ++j){
			if(g[j][i] == '#'){
				erase = true;
			}
		}
		if(erase) ew.push_back(i);
	}
	
	for(int i = 0; i < h; ++i){
		auto rh = find(eh.begin(), eh.end(), i);
		if(rh != eh.end()){
			for(int j = 0; j < w; ++j){
				auto rw = find(ew.begin(), ew.end(), j);
				if(rw != ew.end()){
					cout << g[i][j];
				}
			}
			cout << endl;
		}
	}
	
	return 0;
}



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

#input
N = int(input())
S = str(input())

#output
import numpy as np

if N % 2 == 1:
    print("No")
    exit()
else:
    M = int(N/2)
    T = [0] * M
    for i in range(M):
        if S[i] == S[M+i]:
            T[i] = 1
        else:
            continue

if np.sum(T) == M:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 12508
N, Q = map(int, input().split())
s = " " + input() + " "
td = [input().split() for i in range(Q)]
#print("td = {}".format(td))

llim = 0
rlim = N + 1
for t, d in reversed(td):
    if("L" == d):
        if(s[llim + 1] == t):
            llim += 1
        if(s[rlim] == t):
            rlim += 1
    else:# if("R" == d):
        if(s[rlim - 1] == t):
            rlim -= 1
        if(s[llim] == t):
            llim -= 1
#    print("td = {}, llim = {}, rlim = {}".format([t, d], llim, rlim))

print(str(max(0, rlim - llim - 1)))


Measured memory_bytes: 39344
import sys
sys.setrecursionlimit(10**6)
stdin = sys.stdin
na = lambda: map(int, stdin.readline().split())
N, Q = na()
ans = [0] * N
g = [[] for _ in range(N)]

def dfs(cur, par): 
  for e in g[cur]:
    if e == par:
      continue
    ans[e] += ans[cur]
    dfs(e, cur)

for _ in range(N - 1):
    a, b = na()
    g[a-1] += [b-1]
    g[b-1] += [a-1]
    
for _ in range(Q):
    p, x = na()
    ans[p-1] += x
 
dfs(0, -1)
print(*ans)
 


Measured memory_bytes: 230972
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
typedef long long ll;
typedef long double ld;
#define trace(x)  cerr << #x << ": " << x << endl;
const ll MOD = 1e9+7;
const ll N=2*1e5+5;
#define vl vector<ll>
template<typename ForwardIterator, typename T>
ForwardIterator first_less_than (ForwardIterator first, ForwardIterator last, T value) {
auto it = std::lower_bound (first, last, value);
return (it == first ? last : --it);
}
int main()
{
	ll n;cin>>n;
	string s;
	cin>>s;
	set<ll> w,r;
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='R')
		{
			r.insert(i);
		}
		else w.insert(i);
	}
	ll ans=0;
	if(r.empty()|| w.empty()){cout<<ans;return 0;}
	while(1)
	{
		ll x=*(--r.end());ll y=*(w.begin());
		if(x<y)break;
		w.erase(y);r.erase(x);w.insert(x);r.insert(y);ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 12928
import java.util.*;

class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		int count=0;
		while(sc.hasNext()){
			String str=sc.next();
			boolean ok=true;
			for(int i=0,j=str.length()-1;i<j;i++,j--){
				if(str.charAt(i)!=str.charAt(j)){
					ok=false;break;
				}
			}
			if(ok)count++;
		}
		ln(count);
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

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


struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


int main(){
  int n ,m;
  cin >> n >> m;
  int tmp[n] = {};
  UnionFind tree(n);
  int x, y;
  for(int i=0;i<m;i++){
    cin >> x >> y;
    tree.unite(x, y);
  }
  for(int i=0;i<n;i++){
    tmp[tree.root(i)] ++;
  }
  int MAX = -1;
  for(int i=0;i<n;i++){
    if(MAX < tmp[i])
      MAX = tmp[i];
  }
  cout << MAX << endl;;
}


Measured memory_bytes: 11108
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        var safe = new bool[n];
        for (int i = 0; i < k; i++)
        {
            var d = int.Parse(Console.ReadLine().Trim());
            line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < d; j++)
                safe[int.Parse(line[j]) - 1] = true;
        }
        Console.WriteLine(safe.Count(x => x == false));
    }
}


Measured memory_bytes: 18868
#include <cstdio>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
// #include <map>
#include <iomanip>
#include <cstring>
#include <cmath>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int uii;
typedef pair<int,int> pii;
typedef unsigned long long uLL; 
typedef vector<int> vii; 
const int maxn = 1e5;
int d[maxn + 5], a[111];

int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGE
	//freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; ++i){
		cin >> a[i];
	}
	// sort(a + 1, a + n);
	for(int i = 1; i <= k; ++i){
		for(int j = 1; j <= n; ++j){
			if(i - a[j] >= 0 && d[i - a[j]] == 0){
				d[i] = 1;
			}
		}
	}

	if(d[k] == 1) cout << "First" << endl;
	else cout << "Second" << endl;
	// cout << d[n][k] << endl;
	return 0;
}

Measured memory_bytes: 640