akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<sstream>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<ctime>
using namespace std;

int n, m, q;
int a[55];
int b[55];
int c[55];
int d[55];
int A[15];
int maxans = 0;
void trysolve(int i)
{
    if(i == n + 1)
    {
        int sc = 0;
        for(int j = 0; j < q; j++)
        {
            if(A[b[j]] - A[a[j]] == c[j])
            {
                sc += d[j];
            }   
        }
        maxans = max(sc, maxans);
    }
    else
    {
        for(int j = i == 1 ? 1 : A[i - 1]; j <= m; j++)
        {
            A[i] = j;
            trysolve(i + 1);
        }
    }
}

int main()
{
    cin >> n >> m >> q;
    for(int i = 0; i < q; i++)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    trysolve(1);
    cout << maxans << endl;
    return 0;
}

Measured memory_bytes: 3588
from collections import defaultdict
import bisect
s = input()
t = input()

counter = defaultdict(list)
for i,c in enumerate(s):
  counter[c].append(i)

prev = 10**10
cycle = 0
for i,c in enumerate(t):
  if c not in counter:
    print(-1)
    exit()

  idx = counter[c]
  found = bisect.bisect_right(idx, prev)

  if found >= len(idx):
    cycle += 1
    prev = idx[0]
  else:
    prev = idx[found]

print( (cycle-1)*len(s) + prev+1 )

Measured memory_bytes: 80316
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

#define MAXK 1000
#define MAXN 100000
struct wish
{
    int x,y;
    bool color;
}A[MAXN+5];
int N,K;
int fit[2*MAXK+5],unfit[2*MAXK+5];

int main()
{
    //freopen("data.txt" ,"r", stdin);
    scanf("%d%d",&N,&K);
    for(int i=1;i<=N;i++)
    {
        char s[3];
        scanf("%d%d%s",&A[i].x,&A[i].y,s);
        A[i].color=s[0]=='W';
        A[i].x%=(2*K);
        A[i].y%=(2*K);
    }
    int Ans=0;
    for(int i=0;i<K;i++)
    {
        int cnt=0;
        for(int j=1;j<=N;j++)
        {
            bool p=(i<=A[j].x&&A[j].x<i+K);
            bool q=(0<=A[j].y&&A[j].y<0+K);
            if(p^q==A[j].color) cnt++,fit[A[j].y]++;
            else unfit[A[j].y]++;
        }
        for(int j=0;j<K;j++)
        {
            Ans=max(Ans,max(cnt,N-cnt));
            cnt=cnt-fit[j]+unfit[j]-fit[j+K]+unfit[j+K];
        }
        memset(fit,0,sizeof fit);
        memset(unfit,0,sizeof unfit);
    }
    printf("%d",Ans);
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define s second
#define f first
#define pb push_back
#define endl '\n'
using namespace std;


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

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = 1e9 + 7;

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

	int H, W;
	cin >> H >> W;

	char mp[H][W];

	vector<vector<int>> DP(H, vector<int>(W,0));

	for(int i = 0; i < H; i++) for(int j = 0; j < W; j++) cin >> mp[i][j];

	DP[0][0] = 1;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(mp[i][j] == '#') continue;
			if(i + 1 < H) DP[i+1][j] = (DP[i+1][j] + DP[i][j]) % MOD;
			if(j + 1 < W) DP[i][j+1] = (DP[i][j+1] + DP[i][j]) % MOD;
		}
	}

	if(mp[H-1][W-1] == '#') DP[H-1][W-1] = 0;

	cout << DP[H-1][W-1] << endl;

	return 0;
}


Measured memory_bytes: 8112
#include<bits/stdc++.h>
using namespace std;
string s;
int ans;
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>s;
	int len=s.size();
	for(int i=0;i<len-1;i++)
	{
		if(s[i]!=s[i+1]) ans++;
	}
	cout<<ans;
	
	
	return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  string weather[4];
  weather[0] = "Sunny";
  weather[1] = "Cloudy";
  weather[2] = "Rainy";
  weather[3] = weather[0];
  cin >> s;
  for(int i = 0; i < 3; i++){
    if(s == weather[i]){
      cout << weather[i+1] << endl;
      break;
    }
  }
  return 0;
}
  
    
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define RS resize
#define CLR clear
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
using namespace std;

int main(){
	string str;
	
	while(cin >> str){
		int cnt_j = 0, cnt_i = 0;
		string::size_type pos, t;
		
		pos = 0;
		while(pos < str.length()){
			if((t = str.find("JOI", pos)) != string::npos){
				pos = t + 1;
				++cnt_j;
			}else{
				break;
			}
		}
		
		pos = 0;
		while(pos < str.length()){
			if((t = str.find("IOI", pos)) != string::npos){
				pos = t + 1;
				++cnt_i;
			}else{
				break;
			}
		}
		
		cout << cnt_j << endl << cnt_i << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1200
#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>;
const double PI = acos(-1);
const ll MOD = 1000000007;

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


Measured memory_bytes: 3912
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = 5e15;

int main(){
    ll N, K;
    cin >> N >> K;
    ll sum = 0;
    vector<P> v(N);
    for(auto &u : v) cin >> u.first >> u.second;
    sort(v.begin(), v.end());
    for(auto &u : v){
        sum += u.second;
        if(sum >= K){
            cout << u.first << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
//using P = pair<ll,ll>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
////////////////

void solve(){
  ini(M);
  ll sum = 0 , keta = 0;
  rep(i, M){
    inl(d , c);
    sum += d * c;
    keta += c;
  }
  out(keta - 1 + (sum / 9) - (sum % 9 == 0) );
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a,ll b){
	if(a%b==0)return ((a/b)*2-1)*b;
	return gcd(b,a%b)+((a/b)*2)*b;
}
int main(){
	ll n,x;
	cin>>n>>x;
	if(x<n-x)x=n-x;
	cout<<gcd(x,n-x)+n;
	return 0;
}

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

using namespace std;

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

    vector<int> length;
    int n;
    cin  >> n;

    int sum = 0;

    for(int i = 0; i < n; ++i)
    {
        int l;
        cin >> l;
        length.push_back(l);
    }

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

    for(int i = 0 ; i < n-1 ; i++)
    {
        sum += length[i];
    }

    if(length[n-1] < sum)
    {
        cout << "Yes" << endl;
    } else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    ll w,h,x,y;
    bool hasMulti = false;
    cin >> w >> h >> x >> y;
    if(w%2==0 && w/2==x && h%2==0 && h/2 == y){
        hasMulti = true;
    }
    double ans;
    ans = (double)w * h / 2;
    cout << fixed << setprecision(15) << ans << " ";
    if(hasMulti){
        cout << 1;
    } else {
        cout << 0;
    }
    cout << endl;
    return 0;
}


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

typedef struct {
	int x;
	int y;
}position;

typedef struct node_sub{
	position data;
	struct node_sub *next;
}node;

typedef struct {
	node fst;
	node *last;
	int num;
}queue;

queue *make_queue(){
	queue *q = (queue *)malloc(sizeof(queue));
	q->fst.next = NULL;
	q->last = &(q->fst);
	q->num = 0;
	return q;
}

int is_empty(queue *q){
	if(q->num == 0){
		return 1;
	}
	else{
		return 0;
	}
}

void add_data(position p, queue *q){
	node *last = (node *)malloc(sizeof(node));
	last->data = p;
	last->next = NULL;
	q->last->next = last;
	q->last = last;
	q->num++;
}

int min(int a, int b){
	if(a < b){
		return a;
	}
	else{
		return b;
	}
}

int min4(int a, int b, int c, int d){
	return min(min(a, b), min(c, d));
}

position take_data(queue *q){
	node *fst = q->fst.next;
	q->fst.next = fst->next;
	position ans = fst->data;
	free(fst);
	if(q->num == 1){
		q->last = &(q->fst);
	}
	q->num--;
	return ans;
}

int main(){
	int H, W, K, i, j;
	position p, pos;
	scanf("%d%d%d", &H, &W, &K);
	int inf = H * W;
	char **A = (char **)malloc(sizeof(char *) * H);
	int **dis = (int **)malloc(sizeof(int *) * H);
	for(i = 0; i < H; i++){
		A[i] = (char *)malloc(sizeof(char) * (W + 1));
		dis[i] = (int *)malloc(sizeof(int) * W);
		scanf("%s", A[i]);
		for(j = 0; j < W; j++){
			if(A[i][j] == 'S'){
				dis[i][j] = 0;
				p.x = i;
				p.y = j;
			}
			else{
				dis[i][j] = inf;
			}
		}
	}
	int posx, posy, rest = min4(p.x, H - p.x - 1, p.y, W - p.y - 1);
	int dh[] = {0, 1, 0, -1};
	int dw[] = {1, 0, -1, 0};
	queue *q = make_queue();
	for(add_data(p, q);;){
		if(is_empty(q) == 1){
			break;
		}
		pos = take_data(q);
		posx = pos.x;
		posy = pos.y;
		if(rest == 0){
			printf("1\n");
			return 0;
		}
		if(dis[posx][posy] == K){
			break;
		}
		for(i = 0; i < 4; i++){
			if(A[posx + dh[i]][posy + dw[i]] == '.' && dis[posx + dh[i]][posy + dw[i]] > dis[posx][posy] + 1){
				dis[posx + dh[i]][posy + dw[i]] = dis[posx][posy] + 1;
				p.x = posx + dh[i];
				p.y = posy + dw[i];
				rest = min(min4(p.x, H - p.x - 1, p.y, W - p.y - 1), rest);
				add_data(p, q);
			}
		}
	}
	printf("%d\n", 2 + (rest - 1) / K);
	return 0;
}

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

int PRECISION = 6;

double prob(int n){

    int odd = (n+1)/2;

    return (double)odd/n;
}

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

    double result = prob(n);
    cout << setprecision(PRECISION) << fixed << result << "\n";


    return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//
//  
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
// const double PI=3.1415926535897932;

//#define __DBG__


void solve(void){
  
  int a;
  string S;
 
  cin >> a >> S;
  
  if(a>=3200){
    cout << S << endl;
  }
  else
  {
  	cout << "red" << endl;
  }
  
  return;
   
}


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

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

    solve();
 
    return 0;
}





Measured memory_bytes: 256
/*
以下のような、たてH cm よこ W cm のチェック柄の長方形を描くプログラムを作成して下さい。

#.#.#.#.#.
.#.#.#.#.#
#.#.#.#.#.
.#.#.#.#.#
#.#.#.#.#.
.#.#.#.#.#
上図は、たて 6 cm よこ 10 cm の長方形を表しています。
長方形の左上が "#" となるように描いて下さい。
 */

#include <stdio.h>

void print_field(int column, int row)
{
    // 奇数列の出力 column
    if (column % 2 != 0)
    {
        // 奇数行の出力
        if (row % 2 != 0)
            printf("#");
        // 偶数行の出力
        else
            printf(".");
    }
    // 偶数列の出力 column
    else
    {
        // 奇数行の出力
        if (row % 2 != 0)
            printf(".");
        // 偶数行の出力
        else
            printf("#");
    }
}

int main(void)
{
    int height, width;
    int column, row;

    for(;;)
    {
        scanf("%d %d", &height, &width);
        if (height == 0 && width == 0)
            break;
        
        // カウンターiとjは1スタート <- ○行目とわかりやすくするため
        for (column = 1; column <= height; column++)
        {
            for (row = 1; row <= width; row++)
            {
                print_field(column, row);
            }
            printf("\n");
        }
        printf("\n");
    }
    return (0);
}


Measured memory_bytes: 2116
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int a,b,m;
    cin>>a>>b>>m;
    int r[a], w[b];
    int min_r = INT_MAX, min_w = INT_MAX;
    for(int i=0;i<a;i++)    cin>>r[i], min_r = min(min_r, r[i]);
    for(int i=0;i<b;i++)    cin>>w[i], min_w = min(min_w, w[i]);
    int sum = min_r + min_w;
    while(m--){
        int x,y,c;
        cin>>x>>y>>c;
        x--,y--;
        sum = min(sum,r[x]+w[y]-c);
    }
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;

int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int k;
	int X;
	cin>>k>>X;
	ll lol=k*500;
	if(lol>=X) {
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
 
using namespace std;
 
int main(void) {
    int k;
    cin >> k;
    int ans;
    if(k % 2 == 1){
        ans = ((k - 1) / 2) * ((k + 1) / 2);
    }else{
        ans = (k / 2) * (k / 2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#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<ll,P> 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;

int main(){
    ll n;
    cin >> n;
    vector<ll>l(n);
    rep(i,n)cin>>l[i];
    sort(l.rbegin(),l.rend());
    ll cnt = 0;
    rep(i,n){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(l[i]==l[j])continue;
                if(l[j]==l[k])continue;
                if(l[i]>=(l[j]+l[k]))continue;
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 3628
left = "qwertasdfgzxcvb"

while True:
    s = raw_input()
    if s == "#":
        break
    cnt = 0

    if s[0] in left:
        isleft = True
    else:
        isleft = False

    for i in range(1, len(s)):
        if s[i] in left:
            if not isleft:
                cnt += 1
            isleft = True
        else:
            if isleft:
                cnt += 1
            isleft = False

    print cnt

Measured memory_bytes: 6268
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<complex>
#include<stack>
#include<queue>
#include<unordered_map>
#include<map>
using namespace std;

int main() {
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int count = 0;
  int i, j, k;

  for (i = a; i >= 0; i--) {
    for (j = b; j >= 0; j--) {
      for (k = c; k >= 0; k--) {
        if (500*i + 100*j + 50*k == x) {
          count++;
        }
      }
    }
  }
  cout << count << endl;
}


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

int main() {
    ll n;
    cin>>n;
    bool ok = false;
    for(int i=0; i<n; i++) {
        ll x; cin>>x;
        if(x % 2 == 1) ok = true;
    }
    if(ok) cout<<"first"<<"\n";
    else cout<<"second"<<"\n";
}

Measured memory_bytes: 256
MOD=10**9+7
N=int(input())
if N==3:
  print(61)
  exit()
  
dp=[[[[1]*4 for c in range(4)] for b in range(4)] for a in range(4)]
        
for x in range(4):
  dp[0][x][2][1]=0
  dp[0][2][x][1]=0
  dp[0][1][2][x]=0
  dp[2][0][1][x]=0
  dp[0][2][1][x]=0
  dp[x][0][1][2]=0
  dp[x][2][0][1]=0
  dp[x][0][2][1]=0
  
def f():
  tmp=[[[[0]*4 for c in range(4)] for b in range(4)] for a in range(4)]
  for a in range(4):
    for b in range(4):
      for c in range(4):
        t=sum([dp[x][a][b][c] for x in range(4)])
        t%=MOD
        for d in range(4):
          tmp[a][b][c][d]=t
          
  for x in range(4):
    tmp[0][x][2][1]=0
    tmp[0][2][x][1]=0
    tmp[x][0][1][2]=0
    tmp[x][2][0][1]=0
    tmp[x][0][2][1]=0
    
  return tmp
  
for k in range(4, N):
  dp=f()
  
print(sum([sum([dp[a][b][c][d] for a in range(4) for b in range(4) for c in range(4)])%MOD for d in range(4)])%MOD)

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	string S, T;
	cin >> S >> T;
	ce(T+S)
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int W, H, x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

	if(0<=x-r && x+r<=W && 0<=y-r && y+r<=H)
	{
		printf("Yes\n");
	}

	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 2696
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


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

  cin >> a >> b >> c;

  if(a + b >= c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

void insertionSort(vector<int> &A, int n, int g, int &cnt) {
  for (int i = g; i < n; i++) {
    int v = A[i];
    int j = i - g;
    while (j >= 0 && A[j] > v) {
      A[j + g] = A[j];
      j = j - g;
      cnt++;
    }
    A[j + g] = v;
  }
}
void shellSort(vector<int> &A, int n) {
  int cnt = 0;
  vector<int> tmpG;
  int index = 0;
  while (true) {
    int tmp; 
    // 1から始まり3倍 + 1をしていくのが一般的
    if (index == 0) {
      tmp = 1;
    } else {
      tmp = (3 * tmpG[index - 1]) + 1;
    }
    if (tmp <= n) {  
      tmpG.push_back(tmp);
    } else {
      break;
    }
    index ++;
  }

  int m = 0;
  vector<int> G(tmpG.size());
  int indexG = tmpG.size() - 1;
  
  cout << tmpG.size() << endl;
  while (true) {
    G[m] = tmpG[indexG];
    cout << G[m];
    if (m == tmpG.size() - 1) {
      cout << endl;
    } else {
      cout << " ";
    }
    if (indexG == 0) {
      break;
    }
    m++;
    indexG --;
  }
  for(int i = 0; i < tmpG.size(); i++) {
    insertionSort(A, n, G[i], cnt);
  }
  cout << cnt << endl;
}
int main() {
  int n;
  cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  shellSort(A, n);
  for (int i = 0; i < n; i++) {
    cout << A[i] << endl;
  }
}



Measured memory_bytes: 6764
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mp make_pair
#define inf 1000000007
#define int long long
using namespace std;
signed main(){
	int n,m;
	cin>>n>>m;
	priority_queue<int> que;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		que.push(x);
	}
	for(int i=0;i<m;i++){
		int c = que.top();que.pop();
		que.push(c/2);
	}
	int ans = 0;
	while(!que.empty()){
		ans += que.top(); que.pop();
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1400
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
static const int MAX_V = 100;
static const int INF = 1 << 17;

struct edge{int to, cap, rev;};

vector<edge> G[MAX_V];

int V, E;
bool used[MAX_V];

void add_edge(int from, int to, int cap){
  G[from].push_back((edge){to, cap, G[to].size()});
  G[to].push_back((edge){from, 0, G[from].size() - 1});
}

int dfs(int v, int t, int f){
  if(v == t) return f;
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++){
    edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0){
      int d = dfs(e.to, t, min(f, e.cap));
      if(d > 0){
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s, int t){
  int flow = 0;
  for(;;){
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if(f == 0) return flow;
    flow += f;
  }
}

int main(){
  scanf("%d %d", &V, &E);
  for(int i = 0; i < E; i++){
    int u, v, c;
    scanf("%d %d %d", &u, &v, &c);
    add_edge(u, v, c);
  }
  printf("%d\n", max_flow(0, V - 1));
  return 0;
}

Measured memory_bytes: 2828
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 2e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


int main() {
	int n, k, i, j;
	cin >> n >> k;
	vl w(n), d(n);
	for (i = 0; i < n; i++) {
		cin >> w[i] >> d[i];
	}
	ll left = 0, right = INF;
	while (left + 1 < right) {
		ll mid = (left + right) / 2;
		ll cnt = 0;
		for (i = 0; i < n; i++) {
			if (mid < w[i]) {
				continue;
			}
			cnt += (mid - w[i] + d[i]) / d[i];
			if (cnt < 0) {
				cnt = INF;
				break;
			}
		}
		if (cnt >= k) {
			right = mid;
		}
		else {
			left = mid;
		}
	}
	cout << right << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int N=3e5+10;
const int B=316;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(LL x){
    if(x>9) print(x/10);
    putchar(x%10+'0');
}
int h,w,m;
vector<int> ve[N];
int mx[N<<2];
void add(int l,int r,int id,int x,int w){
	if(l==r){
		mx[id]+=w;
		return;
	}
	int mid=l+r>>1;
	if(x<=mid) add(l,mid,id<<1,x,w);
	else add(mid+1,r,id<<1|1,x,w);
	mx[id]=max(mx[id<<1],mx[id<<1|1]);
}
int main(){
	int x,y;
	scanf("%d%d%d",&h,&w,&m);
	for(int i=1;i<=m;++i){
		scanf("%d%d",&x,&y);
		ve[x].push_back(y);
		add(1,w,1,y,1);
	}
	int ans=0,sz;
	for(int i=1;i<=h;++i){
		for(int j=0;j<ve[i].size();++j) add(1,w,1,ve[i][j],-1);
		sz=ve[i].size();
		ans=max(ans,sz+mx[1]);
		for(int j=0;j<ve[i].size();++j) add(1,w,1,ve[i][j],1);
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    int n, k, q, sum = 0;
    cin >> n >> k >> q;
    vector<int> p(n, 0);
    rep(i, q) {
        int a;
        cin >> a;
        p[a - 1]++;
        
    }
    rep(i, n) {
        if(-q+p[i] + k > 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

#define MAX_N 100000
#define INF 1e+13
ll dp[MAX_N];
ll n;
vector<ll> lis;

void solve() {
    fill(dp, dp+n, INF);
    for (int i=0; i<n; ++i) {
        *upper_bound(dp, dp+n, lis[i]) = lis[i];
    }
    cout << lower_bound(dp, dp+n, INF) - dp << endl;
}

int main() {
    cin >> n;
    lis.resize(n);
    for(int i=0; i<n; ++i) cin >> lis[i];
    reverse(ALL(lis));
    solve();
}

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

using namespace std;
using ll = int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using tpi = tuple<int, int, int>;

using vqi = vector<queue<int>>;
using vpi = vector<pii>;
using bs = bitset<60>;
using vbi = vector<bs>;

ll gcd(ll a, ll b) {
    if (a < b) {
        swap(a, b);
    }

    /* ユークリッドの互除法 */
    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

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

constexpr int64_t __pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        int64_t t = __pow_mod(n, p / 2, mod);
        return (t * t) % mod;
    }
    return (n * (__pow_mod(n, p - 1, mod) % mod)) % mod;
}

constexpr int64_t pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    int64_t res = __pow_mod(n, p, mod);
    if (res == 0) {
        res = mod;
    }
    return res;
}

constexpr int64_t nCr_mod(int64_t n, int64_t r, int64_t mod) noexcept {
    int64_t count = 1;
    auto a = r;
    for (auto i = n; i > n - r; i--) {
        count *= i;
        if (count % mod != 0) {
            count %= mod;
        }
        int64_t inv = pow_mod(a, mod - 2, mod);
        count *= inv;
        if (count % mod != 0) {
            count %= mod;
        }
        a--;
    }
    return count;
}

void solve(long long K) {
    ll ans = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            for (int n = 1; n <= K; n++) {
                ll a = gcd(i, j);
                ll b = gcd(a, n);
                ans += b;
            }
        }
    }
    cout << ans << endl;
}

int main() {
    long long K;
    std::cin >> K;
    solve(K);
    return 0;
}


Measured memory_bytes: 3596
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>
 
using namespace std;
 
//conversion
//------------------------------------------
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(); }
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())
 
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const ll MOD = (ll)1000000007;//10^9+7
const ll INF2 = (ll)100000000000000000;//10^18


int main() {
    string S[3];
    cin>>S[0]>>S[1]>>S[2];
    int p = 0;
    while(true){
        if(S[p].empty()){
            if(p==0){
                cout<<'A'<<endl;
                return 0;
            }else if(p==1){
                cout<<'B'<<endl;
                return 0;
            }else{
                cout<<'C'<<endl;
                return 0;
            }
        }
        int q = p;
        p = S[p][0] - 'a';
        S[q].erase(0,1);

    }

}


Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

int N,K;
string S;

signed main(){

    in(N,K);
    in(S);
    rep(i,S.size()){
        if(i+1==K){
            cout<<(char)tolower(S[i]);
        }else{
            cout<<S[i];
        }
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s; cin >> s;
    string ans;
    for(int i = 0 ; i < s.size() ; i++){
        if(s[i] == '0') ans.push_back('0');
        else if(s[i] == '1') ans.push_back('1');
        else if(ans != "") ans.pop_back();
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
    var fp *os.File
    fp = os.Stdin
    reader := bufio.NewReaderSize(fp, 1024)
    _ = readLine(reader)
    line2 := readLine(reader)
    arr := strings.Split(line2, " ")

    sum := 0
    var num int

    for _, v := range arr {
        num, _ = strconv.Atoi(v)
        sum += num
    }

    inc := 0
    var calc int
    var retnum = sum

    for _, v := range arr {
        num, _ = strconv.Atoi(v)
        inc += num
        calc = sum - inc

        tmp := int(math.Abs(float64(sum - calc - calc)))

        if tmp < retnum {
            retnum = tmp
        } else {
            break
        }
    }

    fmt.Println(retnum)
}

func readLine(reader *bufio.Reader) string {
    buf := make([]byte, 0, 1024)

    for {
        l, p, _ := reader.ReadLine()

        buf = append(buf, l...)

        if !p {
            break
        }
    }

    return string(buf)
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(a) (a).begin(), (a).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

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

  int k,x;
  cin >> k >> x;

  cout << ((k*500 >= x) ? "Yes" : "No") << endl;  

  return 0;
}


Measured memory_bytes: 256
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
cnt = 0
for j in range(N):
    A = list(map(int,input().split()))
    X = 0
    for l in range(M):
        X += A[l] * B[l]
    if X + C > 0:
        cnt += 1

print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

int main()
{
    int x;
    cin >> x;
    if (x == 0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3632
n = int(input())
h = list(map(int, input().split()))

now = 0
ans = 0

for i in range(n-1):
  if h[i] >= h[i+1]:
    now += 1
    
  else:
    ans = max(now, ans)
    now = 0
    
ans = max(now, ans)
    
print(ans)

Measured memory_bytes: 15020
#include<bits/stdc++.h>
using namespace std;
int main(){

  string str;
  int cnt1=0,cnt2=0,cnt3=0;

  cin>>str;
  
  for(int i=0;i<3;i++){
    if(str[i]=='a'){
      cnt1++;
    }else if(str[i]=='b'){
      cnt2++;
    }else if(str[i]=='c'){
      cnt3++;
    }
  }

  if(cnt1==1&&cnt2==1&&cnt3==1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
  
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cctype>
#include<vector>
#include<stack>
#include<queue>
#include<ctime>
#include<map>
#define ll long long
#define ld long double
#define ull unsigned long long
using namespace std;
const ll mod = 998244353;
const int maxn = 101001;
ll a[maxn];
ll mul(ll x,ll y,ll z)
{
    ll sm = (ld)x/z*y;
    return ((ull)x*y-(ull)sm*z+z)%z;
}
ll qpow(ll x,ll y,ll z)
{
    ll ans = 1;
    x %= z;
    for(ll i=y;i;i>>=1){
        if(i&1) ans = mul(ans,x,z);
        x = mul(x,x,z);
    }
    return ans%z;
}
int main(void)
{
    int n,x;
    scanf("%d",&n);
    cin>>x;	//判断首位是否为0
    if(x!=0){
        printf("0\n");
        return 0;
    }
    a[x]++;
    for(int i=1;i<n;i++){
        scanf("%d",&x);
        a[x]++;
    }
    if(a[0]>1){	//判断是否多个0
        printf("0\n");
        return 0;
    }
    int ret = 0;
    ll ans = 1,pr = 1;
    for(int i=0;i<n;i++){
        if(a[i]==0){	//判断是否有间隔
            if(ret!=n)  ans = 0;
            break;
        }
        ans = mul(ans,qpow(pr,a[i],mod),mod);
        pr = a[i];
        ret += (int)a[i];
    }
    printf("%lld\n",ans);
    return 0;
}


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

int main() {
    int n,res=0;cin>>n;
    rep(i,n){
        int l,r;cin>>l>>r;
        res+=r-l+1;
    }
    cout<<res<<endl;
}


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

int main(){
	int n, k, c;
	string s;
	cin >> n >> k >> c >> s;
	vector<int> l(k), r(k);
	int idx = 0;
	for(int i = 0; i < n; ++i){
		if(s[i] == 'x') continue;
		l[idx++] = i;
		i += c;
		if(idx == k) break;
	}
	idx = k - 1;
	for(int i = n - 1; i >= 0; --i){
		if(s[i] == 'x') continue;
		r[idx--] = i;
		i -= c;
		if(idx == -1) break;
	}
	for(int i = 0; i < k; ++i){
		if(l[i] == r[i]) cout << l[i] + 1 << endl;
	}
}

Measured memory_bytes: 3332
N,M,C = [int(s) for s in input().split()]
B=[int(s) for s in input().split()]
ans=0
for i in range(N):
  A=[int(s) for s in input().split()]
  solve=0
  for i in range(M):
    solve+=A[i]*B[i]
  if solve+C>0:
    ans+=1
print(ans)

Measured memory_bytes: 3060
a,b=map(int,input().split())
c=[list(map(int,input().split())) for i in range(a-1)]
d=[[]for i in range(a)]
for i in range(a-1):
  ca=c[i][0]
  cb=c[i][1]
  d[ca-1].append(cb-1)
  d[cb-1].append(ca-1)
g=[0 for i in range(a)]
q=[]
q.append(0)
e=b
while not q==[]:
  i=q.pop()
  h=len(d[i])
  g[i]=1
  if i==0:
      f=b-1
  else:
    f=b-2
  g[i]=1
  for j in range(h):
    if g[d[i][j]]==0:
      q.append(d[i][j])
      e=(e*f)%1000000007
      f-=1


print(e%1000000007)
  

Measured memory_bytes: 43368
import scala.collection.mutable._
import io.StdIn.readLine

object Main extends App {
  val map = new HashMap[String,Int]
  val s = readLine.split(" ")
  s.foreach(e => {
    if(!map.contains(e)) map.put(e,1)
    else map.put(e,map(e)+1)
  })
  val maxF = map.maxBy(_._2)._1
  val maxL = s.map(e => (e.length, e)).max._2

  println(maxF + " " + maxL)
}


Measured memory_bytes: 43776
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) 
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int n, m;
string fi[55];

int dp[55][55];

int main() {
    while (cin >> n >> m) {
        for (int i = 0; i < n; ++i) cin >> fi[i];
        for (int i = 0; i < 55; ++i) for (int j = 0; j < 55; ++j) dp[i][j] = 1<<29;
        dp[1][1] = 0;
        for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) {
            chmin(dp[i+1][j+1], min(dp[i+1][j], dp[i][j+1]) + (int)(fi[i][j] - '0'));
            //cout << i << ", " << j << " : " << dp[i+1][j+1] << endl;
        }
        cout << dp[n][m] << endl;
    }
    return 0;
}


Measured memory_bytes: 1224
#include<iostream>
using namespace std;
int main() {
 int a,b,c;	
 cin>>a>>b>>c;
 if(a==b&&b==c){cout<<1<<endl;}
 else if(a==b||a==c||b==c){cout<<2<<endl;}
 else{cout<<3<<endl;}
 return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int N; cin >> N;
  vector<pair<int, int>> AB(N); REP(i, N) cin >> AB[i].first >> AB[i].second;
  sort(ALL(AB));
  cout << (AB[N-1].first + AB[N-1].second) << endl;
}

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

vector < vector <int> > mv;

int a[200000];
int res[200000];
int v[200000];
int tail[200000];

int CI(int l, int r, int key) 
{ 
    while (r - l > 1) { 
        int m = l + (r - l) / 2; 
        if (tail[m] >= key) 
            r = m; 
        else
            l = m; 
    } 
  
    return r; 
} 

void loo(int ac, int fa, int vs, int le){
	v[vs] = a[ac];
	int m,f,im;
	if(ac!=0){
		if (v[vs] < tail[0]) {
			f = tail[0];
			tail[0] = v[vs];
			m = 0;
		}
		else if(v[vs] > tail[le - 1]){
			tail[le++] = v[vs];
			m = 1;
		}
		else{
			im = CI(-1, le - 1, v[vs]);
			f = tail[im];
			tail[im] = v[vs]; 
			m = 2;
		}
	}
	else tail[0] = v[vs];
	for(int i=0;i<mv[ac].size();i++)if(mv[ac][i]!=fa){
		loo(mv[ac][i],ac,vs+1,le);
	}
	res[ac] = le;
	if(ac!=0)switch(m){
		case 0:{
			tail[0] = f;
			break;
		}
		case 2:{
			
			tail[im] = f;
			break;
		}
	}
}
int main(){
	
	cin.tie(0); ios_base::sync_with_stdio(0);
	int n;
	cin>>n;
	mv.resize(n);
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=1;i<n;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		mv[u].push_back(v);
		mv[v].push_back(u);
	}
	int vs = 0;
	loo(0,-1,vs,1);
	for(int i=0;i<n;i++)cout<<res[i]<<endl;
	
	return 0;
}

Measured memory_bytes: 33000
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli m, d;
    cin >> m >> d;
    lli ans = 0;
    rep(i,m){
        rep(j,d){
            lli t = (j + 1) / 10;
            lli o = (j + 1) % 10;
            if(t*o==i+1&&o>1&&t>1)
                ans++;
        }
    }
    out(ans);
}

Measured memory_bytes: 3640
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    asum = sum(A)

    count = 0
    for i in range(N):
        if A[i] * 4 * M >= asum:
            count += 1

    if count >= M:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9080
import numpy as np

N=int(input())
A=list(map(int,input().split()))
Adic={}
for i in A:
  if Adic.get(i)==None:
    Adic[i]=1
  else:
    Adic[i]+=1
Q=int(input())
ope=[]

for i in range(Q):
  ope.append(list(map(int,input().split())))

A=np.array(A)

sum=0
for key,value in Adic.items():
  sum+=key*value
for b,c in ope:
  if Adic.get(b)!=None:
    if Adic.get(c)==None:Adic[c]=0
    sum=sum-b*Adic[b]+c*Adic[b]
    Adic[c]+=Adic.pop(b)
    print(sum)
  else:
    print(sum)

Measured memory_bytes: 54044
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define H_MAX 50
#define W_MAX 50

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

namespace patch {
  template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
}

int main() {
	char a;
	cin >> a;
	if(a == 'A') 
		cout << 'T' << endl;
	if(a == 'T')
		cout << 'A' << endl;
	if(a == 'C')
		cout << 'G' << endl;
	if(a == 'G')
		cout << 'C' << endl;

  return 0;
}
 


Measured memory_bytes: 764