akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>

#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef long double dd;



int main() {
	int N;
	dd ans = 0;
	cin >> N;
	rep(i, N) {
		dd a;
		cin >> a;
		ans += (1.0 / a);
	}
	ans = (1.0 / ans);
	cout << setprecision(16) << ans << endl;
	return 0;
}

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

void printstack( double st[80], int number  )
{
        printf( "==>\n" );
        for ( int i = 0 ; i <= number ; i++ ) {
                printf( "|%2d||%8lf|\n", i, st[i] );
        }
}

int main()
{
        char input[81], *p;
        double st[81];
        int i;
        double tmp1, tmp2;

        while ( fgets( input, 81, stdin )!= NULL ) {
                i = 0;
                p = input;
                tmp1 = 0; tmp2 = 0;
                while ( *p ) {
                        // printstack( st, i );
                        if ( isspace(*p) ) { p++; continue; }

                        /* *p$,?tCM$N>l9g, ?t;z$r%9%?%C%/$K%W%C%7%e$9$k*/
                        if ( isdigit( *p ) ) {
                                tmp1 = strtof( p, &p );
                                i++;
                                st[i] = tmp1;
                                continue;
                        }

                        if ( *p == '+' ) {
                                tmp1 = st[i];
                                tmp2 = st[i-1];
                                st[i-1] = tmp1+tmp2;
                                st[i] = 0;
                                i--;
                                p++;
                                continue;
                        }

                        if ( *p == '-' ) {
                                if ( isdigit (*(p+1) ) ) {
                                        tmp1 = strtof( p+1, &p );
                                        i++;
                                        st[i] = -1*tmp1;
                                } else {
                                        tmp1 = st[i];
                                        tmp2 = st[i-1];
                                        st[i-1] = tmp2-tmp1;
                                        st[i] = 0;
                                        i--;
                                        p++;
                                }
                                continue;
                        }

                        if ( *p == '*' ) {
                                tmp1 = st[i];
                                tmp2 = st[i-1];
                                st[i-1] = tmp1*tmp2;
                                st[i] = 0;
                                i--;
                                p++;
                                continue;
                        }

                        if ( *p == '/' ) {
                                tmp1 = st[i];
                                tmp2 = st[i-1];
                                st[i-1] = tmp2 / tmp1;
                                st[i] = 0;
                                i--;
                                p++;
                                continue;
                        }
                }
                printf( "%lf\n", st[i] );
        }

        return 0;
}



Measured memory_bytes: 2056
eval'H,W='+gets.split*?,;W+=1;B=$<.map(&:chop)*?#+?#*W;*Q=i=0;d=B.count ?.;p((loop{(d-=1;i+=Q.size)if-1==i-=1;break d if H*W==2+k=Q.shift;[-W,-1,W,1].map{|l|l+=k;(B[l]==B[l]=?#)||Q<<l}}rescue-1))

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

int main (){
  int n,p;
  cin >> n;
  int a[n];
  char b[n];
  int ans[52];
  for (int i=0; i<52; i++){
    ans[i]=0;
  }

  for (int i = 0; i<n; i++){
    cin >> b[i] >> a[i] ; 
  }
 for (int i=0; i<n; i++){
   if (b[i]=='S'){
     ans[a[i]-1]=1;
     } else if (b[i]=='H'){
       ans[a[i]+12]=1;
       }else if (b[i]=='C'){
         ans[a[i]+25]=1;
         }else if (b[i]=='D'){
           ans[a[i]+38]=1;
         }
       
     

 }
 for (int i=0; i<52; i++){
   if (ans[i]==0){
     if (13>i){
       cout << 'S'<<' ' << i+1 <<endl;
     } else if (26>i){
       cout << 'H'<<' '<< i-12 << endl;
     } else if (39>i){
       cout << 'C'<<' '<< i-25 << endl;
     } else {
       cout << 'D'<<' '<< i-38<<endl;
     }
     
   }
 }
  return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
class DJS{
public:
	vector<int> sz, parent;
	int mxsz;
	DJS(int n){
		mxsz = 1;
		sz.resize(n,1);
		parent.resize(n);
		for(int i=0; i<n; i++)
			parent[i] = i;
	}
	int get_parent(int u){
		if(parent[u] == u)
			return u;
		return parent[u] = get_parent(parent[u]);
	}
	void join(int u, int v){
		u = get_parent(u);
		v = get_parent(v);
		if(u != v){
			if(sz[u] > sz[v]){
				swap(u,v);
				swap(sz[u], sz[v]);
			}
			sz[v] += sz[u];
			parent[u] = v;
			mxsz = max(sz[v] , mxsz);
		}
	}
};
int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,m;
	cin >> n >> m;
	DJS st(n);
	for(int i=0; i<m; i++){
		int a, b;
		cin >> a >> b;
		a--, b--;
		st.join(a,b);
	}
	cout << st.mxsz << endl;
	return 0;
}

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

#define xx first
#define yy second

const int N = 17;

int a[N][N];
ll val[1 << N];

void solve() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            cin >> a[i][j];
    fill(val, val + (1 << n), 0);
    for (int i = 0; i < (1 << n); i++)
        for (int j = 0; j < n; j++)
            if (i & (1 << j))
                for (int k = j + 1; k < n; k++)
                    if (i & (1 << k))
                        val[i] += a[j][k];
    for (int i = 0; i < (1 << n); i++)
        for (int j = i; j; j = (j - 1) & i)
            val[i] = max(val[i], val[j] + val[i ^ j]);
    cout << val[(1 << n) - 1] << '\n';
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // int _; cin >> _; while (_--)
    solve();
    return 0;
}


Measured memory_bytes: 4128
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n%2==1)n-=1;
		int max = 0,a, count,ans=1;
		for(int i = 2;i <= n;i+=2) {
			count = 0;
			a = i;
			for(;;) {
				if(a / 2 != 0) {
					a = a/2;
					count++;
				}
				else {
					count++;
					break;
				}
			}
			if(max < count) {
				max = count;
				ans = i;
			}
		}
		System.out.println(ans);
	}

}


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

using namespace std;
int main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	string S;
	cin >> S;
	for (int i = A; i < C; i++) {
		if (S[i - 1] == '#' && S[i] == '#') {
			cout << "No" << endl;
			return 0;
		}
	}
	for (int i = B; i < D; i++) {
		if (S[i - 1] == '#' && S[i] == '#') {
			cout << "No" << endl;
			return 0;
		}
	}
	if (C < D) {
		cout << "Yes" << endl;
	}
	else {
		for (int i = B - 1; i < D; i++) {
			if (S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.') {
				cout << "Yes" << endl;
				return 0;
			}
		}
		cout << "No" << endl;
	}
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
#define dmp(x) cerr << __LINE__ << " " << #x << " " << x << endl;
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
template<class T>
void input(vector<T>& vec,int n){
	vec.resize(n);
	for(int i=0;i<n;i++){
		cin >> vec[i];
	}
}
void fastio(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
}
string s[3];
int main(){
	s[0] = "Sunny";
	s[1] = "Cloudy";
	s[2] = "Rainy";
	string t;
	cin >> t;
	for(int i=0;i<3;i++){
		if(s[i]==t){
			cout << s[(i+1)%3] << endl;
		}
	}
	return 0;
}


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


int main() {
  string s = "aiueo";
  char c;
  cin >> c;
  string ans = "consonant";
  if(s.find(c) != string::npos) ans = "vowel";
    
  cout << ans << endl;  
  return 0;
  
}

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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    string S;
    ull K;
    cin >> S >> K;
    auto n = min((ull)S.size(), K);
    for(ull i=0; i<n; i++){
        if(S[i] == '1') continue;
        cout << S[i] << endl;
        return 0;
    }
    cout << S[n-1] << endl;
    return 0;
}

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

int d[1000][2];
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> d[i][0] >> d[i][1];
    bool ok = false;
    for (int i = 0; i+2 < n; i++) {
        if (d[i][0]==d[i][1]&&d[i+1][0]==d[i+1][1]&&d[i+2][0]==d[i+2][1])
            ok = true;
    }
    if (ok)
        cout << "Yes";
    else
        cout << "No";
}

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

using namespace std;

int main()
{
    vector<int> vs(4);
    for (auto& v : vs)
    {
        cin >> v;
    }
    cout << (min(vs[0], vs[1]) + min(vs[2], vs[3])) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> v(n+1, 0);
    while(m--){
        int a, b;
        cin >> a >> b;
        v[a]++; v[b]++;
    }
    for(int i = 1; i <= n; i++)
        cout << v[i] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
 
  long a, b, n;
  scanf("%ld %ld %ld", &a, &b, &n);
  long x = b - 1;
  if (x > n) {
    x = n;
  }
  long answer = a*x/b-a*(x/b);
  printf("%ld\n", answer);
  return 0;
}

Measured memory_bytes: 1656
#include<iostream>
#include<math.h>
#include<cassert>
using namespace std;

bool isPrime(int x){
  if ( x < 2 ) return false;
  else if ( x == 2 ) return true;
  if ( x % 2 == 0 ) return false;
  int limit = (int)sqrt((double)x) + 1;
  for ( int i = 3; i <= limit; i+=2 ){
    if ( x % i == 0 ) return false;
  }
  return true;
}

int main(){
  int n, x;
  int cnt = 0;
  cin >> n;
  assert(1 <= n && n <= 10000);
  for ( int i = 0; i < n; i++ ){
    cin >> x;
    assert(2 <= x && x <= 1000000000);
    if ( isPrime(x) ) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 0
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: June 8 2019
 * 
 */

#include <bits/stdc++.h>

//#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define endl '\n'
using namespace std;




auto SOLUTION_FUNCTION( void ) ->void {

    // your solution goes here 

    string s;
    cin>>s;
    map<char , int > m;
    for(auto ch:s){
        m[ch]++;
    }
    puts((m.size()==2)?"Yes":"No");


    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("input","r",stdin);
    freopen("output","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=100005,INF=1<<28;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N,Q;cin>>N>>Q;
        vector<int> cnt(200,0);
        int maxi=-1,when=0;
        if(N==0) break;
        
        for(int i=0;i<N;i++){
            int M;cin>>M;
            for(int j=0;j<M;j++){
                int a;cin>>a;
                cnt[a]++;
            }
        }
        
        for(int i=0;i<200;i++){
            if(cnt[i]>=Q&&maxi<cnt[i]){
                maxi=cnt[i];
                when=i;
            }
        }
        
        cout<<when<<endl;
    }
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384626433832795

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}
struct node {
	node *left=NULL,*right=NULL,*parent=NULL;
	int key=-1;
};

node *root = NULL;

void insert(node *z) {
	node *y =NULL;
	node *x = root;
	while (x != NULL) {
		y = x;
		if (z->key < x->key)x = x->left;
		else x = x->right;
	}
	z->parent = y;

	if (y == NULL) {
		root = z;
	}
	else if(z->key < y->key){
		y->left = z;
	}
	else y->right = z;
}

void preprint(node* n) {
	cout << " " << n->key;
	if (n->left != NULL)preprint(n->left);
	if (n->right != NULL)preprint(n->right);
}

void inoprint(node* n) {
	if (n->left != NULL)inoprint(n->left);
	cout << " " << n->key;
	if (n->right != NULL)inoprint(n->right);
}

void findkey(int key) {
	node *curr=root;
	while (curr != NULL) {
		if (curr->key == key) {
			cout << "yes" << endl;
			return;
		}
		if (key < curr->key)curr = curr->left;
		else curr = curr->right;
	}
	cout << "no" << endl;
	return;
}

void del(node *curr) {
	if (curr->left == NULL&&curr->right == NULL) {
		if (curr->parent->left == curr)curr->parent->left = NULL;
		else curr->parent->right = NULL;
	}
	else if (curr->left == NULL&&curr->right != NULL) {
		curr->right->parent = curr->parent;
		if (curr->parent->left == curr)curr->parent->left = curr->right;
		else curr->parent->right = curr->right;
	}
	else{
	//else if (curr->left != NULL&&curr->right == NULL) {
		curr->left->parent = curr->parent;
		if (curr->parent->left == curr)curr->parent->left = curr->left;
		else curr->parent->right = curr->left;
	}
}

void deletekey(int key) {
	node *curr = root;
	while (curr != NULL) {
		if (curr->key == key) {
			if (curr->left != NULL&&curr->right != NULL) {
				node *next = curr->right;
				while (next->left != NULL) next = next->left;
				curr->key = next->key;
				del(next);
			}
			else {
				del(curr);
			}

		}
		if (key < curr->key)curr = curr->left;
		else curr = curr->right;
	}
}


int main(){
	int n,in;
	string s;
	cin >> n;
	vector<node> zz(n);
	rep(i, n) {
		cin >> s;
		if (s == "insert") {
			cin >> in;
			zz[i].key = in;
			zz[i].left = NULL;
			zz[i].right = NULL;
			zz[i].parent= NULL;
			insert(&zz[i]);
		}
		else if (s == "find") {
			cin >> in;
			findkey(in);
		}
		else if (s == "delete") {
			cin >> in;
			deletekey(in);
		}
		else {
			inoprint(root);
			cout << endl;
			preprint(root);
			cout << endl;

		}
	}
}


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

const int mod = (int) 1e9 + 7;

int A[200005];
long long dpPos[200005], dpCol[200005];

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

    int Q;
    cin >> Q;

    while(Q--)
    {
        long long a, b;
        cin >> a >> b;

        if(a == 1 && b == 1)
        {
            cout << 0 << "\n";
            continue;
        }

        if(a > b)
            swap(a, b);

        long long pro = a * b - 1;
        long long sq = sqrt((long double) pro);

        if(pro / sq == sq)
            cout << sq * 2 - 1 - (a <= sq) << "\n";
        else
            cout << sq * 2 - (a <= sq) << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n;  cin >> n;
    vector<int>a(n);
    rep(i, n)   cin >> a[i];
    map<int, int>m;
    ll ans = 0;
    rep(i, n){
        int s = i-a[i];
        int w = a[i]+i;
        ans += m[s];
        m[w]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 21080
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
vector<int> p;
bool syoujunn(vector<int> p){
  int s=p.size();
  bool ok=true;
  rep(i,s-1){
    if(p[i]>p[i+1]){
      ok=false;
      break;
    }
  }
  return ok;
}
int main() {
 int n;
  cin>>n;
  p.resize(n);
  rep(i,n) cin>>p[i];
  ///////////
  bool ans=false;
  if(syoujunn(p)) {
    cout<<"YES"<<endl;
    return 0;
  }
  rep(i,n-1){
    if(ans) break;
    for(int j=i+1;j<n;j++){
   
      swap(p[i],p[j]);
    //cout<<p[i]<<endl;
      if(syoujunn(p)){
        ans=true;
        break;
      }
      swap(p[i],p[j]);
    }
  }
  if(ans) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int i = 1;
		int n = sc.nextInt();
		while(i <= n){
			int x = i;
			if(x%3 == 0){
				System.out.printf(" %d",i);
			}else{
				while(x >= 1){
					if(x % 10 == 3){
						System.out.printf(" %d",i);
						break;
					}
					x /= 10;
				}
			}
			i++;
		}
		System.out.printf("\n");
	}
};



Measured memory_bytes: 38760
from collections import deque
n=int(input())
g=[set() for i in range(n+1)]
for i in range(n-1):
  a,b=map(int,input().split())
  g[a].add(b)
  g[b].add(a)
c=list(map(int,input().split()))
c.sort(reverse=True)
print(sum(c)-c[0])
q=deque()
nums=[0]*(n+1)
q.appendleft(1)
while q:
  d=q.popleft()
  nums[d]=c.pop(0)
  for node in g[d]:
    if nums[node]==0:
      q.append(node)
print(*nums[1:])

Measured memory_bytes: 7576
name = ['A', 'B', 'C', 'D', 'E']
shop = []

while True:
  a,b = map(int, input().split())
  if a == 0 and b == 0:
    break
  shop.append(a+b)
  if len(shop) == 5:
    m = max(shop)
    print(name[shop.index(m)], m)
    shop = []


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

int main()
{
	int n,k,i;

	cin>>n>>k;


	int a[n];

	for(i=0;i<n;i++)
		cin>>a[i];

	sort(a,a+n);
	int sum=0;
	for(i=0;i<k;i++)
		sum+=a[i];

	cout<<sum<<"\n";
}


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int m,mi,ma;
    while(cin >> m >> mi >> ma,m){
        vector<int> p(m);
        REP(i,m){
            cin >> p[i];
        }
        //sort(All(p));
        int ga=0;
        int ans;
        for(int i=mi-1;i<ma;i++){
            if(ga<=p[i]-p[i+1]){
                ga=p[i]-p[i+1];
                ans=i+1;
            }
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 2992
#include <iostream>
#include <map>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int* array = new int[N];
  map<int, bool> mp;
  bool allDistinct = true;
  
  for (int i = 0; i < N; i++) {
    int key;
    cin >> key;
    if (mp.count(key) != 0) allDistinct = false;
    mp[key] = true;
  }

  string resultStr = allDistinct ? "YES" : "NO";
  cout << resultStr << endl;
  delete[] array;
  return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n, k);
    Cin(string, s);
    
    vc<int> cmp;
    {
        char c = 'x';
        int cnt = -1;
        For(i, n){
            cnt ++;
            if(s[i] == c){
                continue;
            }
            if(cnt > 0) cmp.push_back(cnt);
            cnt = 0;
            c = s[i];
        }
        cmp.push_back(cnt+1);
    }
    // Couts(cmp);
    
    Rep(2*k){
        if(cmp.size() == 1) break;
        int m = cmp.back();
        cmp.pop_back();
        cmp.back() += m;
    }
    
    // Couts(cmp);
    
    ll ans = 0;
    for(int e : cmp) ans += e-1;
    Cout(ans);
}


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

int main() {
  uint64_t N;
  cin >> N;
  vector<uint64_t> A(N+1);
  vector<uint64_t> B(N);
  rep(i, N+1) cin >> A[i];
  rep(i, N) cin >> B[i];
  uint64_t sum = 0;
  rep(i, N) {
    if (A[i] >= B[i]) sum += B[i];//B[i]の戦闘力を使い切ってA[i]の一部を倒す.i+1番以降はA[i]の敵には触れられないので関係ない。
    else {
      if (B[i]-A[i] <= A[i+1]){//B[i]の戦闘力をA[i+1]で使い切るとき
        A[i+1] -= B[i]-A[i]; // A[i+1]の残りの数は次回に関わるので計算
        sum += B[i];
      }
      else {//B[i]の戦闘力が使い切らないとき
        sum += A[i]+A[i+1];
        A[i+1] = 0;
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    int N,a;
    vector<int> A;
    int D=0;
    map<int,int> Mp;
    cin >> N;
    REP(i,N){
        cin >> a;
        A.push_back(a);
        D^=a;
        Mp[a^(a-1)]+=1;
    }
    int now=1,Ans=0;
    while(now<D)now=2*now+1;
    //cout << now MM D<< endl;
    while(now>0){
        if((D^now)<D){
            if(Mp[now]>0){
                //cout << now << endl;
                D^=now;
                Ans++;
            }else{
                cout << -1 << endl;
                return 0;
            }
        }
        now/=2;
    }
    cout << Ans << endl;
    return 0;
}



Measured memory_bytes: 1404
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int m = x*y;
        int syu = 2*(x+y);
        System.out.println(m+" "+syu);
        
    }
}


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

int main () {
  int N;
  cin >> N;
  char data[N];
  for (int i = 0; i < N; i++) {
    cin >> data[i];
  }
  string ans = "Three";
  for (int i = 0; i < N; i++) {
    if (data[i] == 'Y') {
      ans = "Four";
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long l[105];
int n,ans;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>l[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(l[i]!=l[j]&&l[j]!=l[k]&&l[i]!=l[k]){
					long long a[3];
					a[0]=l[i];a[1]=l[j];a[2]=l[k];
					sort(a,a+3);
					if(a[2]<a[1]+a[0])ans++;
					//cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
 } 

Measured memory_bytes: 3576
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-3;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int n, k;
int a[100];
bool win[1 << 17];
bool used[1 << 17];
bool dfs(int id) {
	if (used[id])return win[id];
	used[id] = true;
	bool res = false;
	rep(i, n) {
		int nex = id - a[i];
		if (nex < 0)continue;
		if (!dfs(nex))res = true;
	}
	return win[id] = res;
}
int main() {
	cin >> n >> k;
	rep(i, n)cin >> a[i];
	if (dfs(k))cout << "First" << endl;
	else cout << "Second" << endl;
	//stop
	return 0;
}

Measured memory_bytes: 6656
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

const int MAXN = 100;
const int N = 100;
const int Wt = 1e5; 

using namespace std;

ll wt[MAXN+1],val[MAXN+1];
ll dp[N+1][Wt+1];

ll knapsack (int n, ll W)
{
    if (n==0 || W==0)
    {
        dp[n][W]=0;
        return dp[n][W];
    }
    if (wt[n]>W)
    {
        if (dp[n-1][W]!=-1)
            dp[n][W]=dp[n-1][W];
        else
            dp[n][W]=knapsack(n-1,W);
        return dp[n][W];
    }
    else
    {
        if (dp[n-1][W-wt[n]]==-1)
            dp[n-1][W-wt[n]]=knapsack(n-1,W-wt[n]);
        if (dp[n-1][W]==-1)
            dp[n-1][W]=knapsack(n-1,W);
        dp[n][W]=max(dp[n-1][W-wt[n]]+val[n],dp[n-1][W]);
        return dp[n][W];
    }
}

main()
{
    fast;
    int n,i,j;
    ll W,wi,vi;
    cin>>n>>W;
    for (i=1;i<=n;i++)
        cin>>wt[i]>>val[i];
    memset(dp,-1,sizeof(dp));
    cout<<knapsack(n,W)<<endl;
}

Measured memory_bytes: 79232
#include <iostream>
#include "string.h"
using namespace std;
int main(){
string x,y,z;
cin>>x>>y>>z;
for(int i=0;i<100;i++)
if(65<=(int)y[i]<=90){
    cout<<"A"<<y[0]<<"C \n";
    break;
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 

const ll large_P = 1e9 + 7;


int main(){
  int K, X;
  cin >> K >> X;
  
  if(500*K >= X) cout << "Yes";
  else cout << "No";
  
}

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

using namespace std;

typedef long long ll;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    string s;
    cin >> n >> s;
    s += s[0];
    s += s[1];
    n += 2;
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
            vector<int> a(n);
            a[0] = i;
            a[1] = j;
            bool f = true;
            for (int i = 1; i + 1 < n; ++i) {
                if ((s[i] == 'o') ^ a[i]) {
                    a[i + 1] = a[i - 1];
                } else {
                    a[i + 1] = 1 - a[i - 1];
                }
            }
            if (a[0] == a[n - 2] && a[1] == a[n - 1]) {
                for (int i = 0; i + 2 < n; ++i) {
                    if (a[i]) {
                        cout << 'W';
                    } else {
                        cout << 'S';
                    }
                }
                return 0;
            }
        }
    }
    cout << -1;
    return 0;
}

Measured memory_bytes: 924
def Base_10_to_n(X, n):
    if (int(X / n)):
        return Base_10_to_n(int(X / n), n) + str(X % n)
    return str(X % n)


if __name__ == '__main__':
    n, k = list(map(int, input().split(" ")))
    # print(int(str(n), 2))
    #
    # x10 = 35
    x2 = Base_10_to_n(n, k)
    print(len(x2))  # "100011"が表示される．

Measured memory_bytes: 2940
#include <stdio.h>
#include <math.h>

int main(void)
{
    int r;
    scanf("%d", &r);

    double pi = 3.141592653589793238;
    double ans = (2 * pi * (double)r)+pow(10,-7);

    printf("%10lf", ans);

    return 0;
}


Measured memory_bytes: 1744
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	long long N;
	cin >> N;

	string s;
	//cin >> s;

	//int A[5]
	//sort(A, A + 5);

	if (true)
	{
		for (;;)
		{
			N -= 1000;
			if (N <= 0)
			{
				N *= -1;
				break;
			}
		}
		cout << N << endl;
	}
	else
	{
		cout << "No" << endl;
	}

}

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

using namespace std;


int main()
{
	int n; cin >> n;
	map<string, int> m;
	for(int i = 0; i < n; i++){
		string s; cin >> s;
		m[s]++;
	}
	cout << "AC x " << m["AC"] << endl;
	cout << "WA x " << m["WA"] << endl;
	cout << "TLE x " << m["TLE"] << endl;
	cout << "RE x " << m["RE"] << endl;
}


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

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

    int ans = 1;
    for (int i = 1; i < n; i++) {
        int count = 0;
        for (int j = 0; j < i; j++) {
            if (h[i] >= h[j]) count++;
        }
        if (count >= i) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int32_t main() {
	ios::sync_with_stdio(0);cin.tie(0);
	string s, t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	int ans = 1000;
	for(int i=0; i<=n-m; i++) {
		int cnt = 0;
		for(int j=0; j<m; j++) {
			if(t[j] != s[i+j])
				cnt++;
		}
		ans = min(ans, cnt);
	}
	cout << ans;
}

Measured memory_bytes: 3644
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] x=new long[n];
		for(int i=0;i<n;i++) x[i]=sc.nextInt();
		long[] y=Arrays.copyOf(x, n);
		Arrays.sort(y);
		for(int i=0;i<n;i++){
			if(x[i]>=y[n/2]) System.out.println(y[n/2-1]);
			else System.out.println(y[n/2]);
		}
	}
}


Measured memory_bytes: 93708
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        String s1 = s.next();
        String s2 = s.next();
        s1 += s2.charAt(s2.length()-1);
        if(s1.equals(s2)) System.out.println("Yes");
        else System.out.println("No");
    }
}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25312
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < (n); i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

ll a, b, n;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> a >> b;

	if ((b - a) % 2 == 0) {
		cout << (b - a) / 2 << endl;
	} else {
		cout << min(n - b + (b - a + 1) / 2, a - 1 + (b - a + 1) / 2) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
 
n = ni()
a1 = [int(i) for i in ns().split()]
a2 = [int(i) for i in ns().split()]

a1_acc = [0]
for i, a in enumerate(a1):
  a1_acc.append(a1_acc[i]+a)
a2_acc = [0]
for i, a in enumerate(reversed(a2)):
  a2_acc.append(a2_acc[i]+a)
del a1_acc[0]
del a2_acc[0]
a2_acc = list(reversed(a2_acc))

out = 0
for i in range(n):
  if out < a1_acc[i] + a2_acc[i]:
    out = a1_acc[i] + a2_acc[i]
print(out)    

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
    int a,b,c,x,y; cin >> a >> b >> c >> x >> y;
    if((a+b) > 2*c) {
        if(x > y)
            cout << y*2*c + (x-y)*min(a,2*c) << endl;
        else
            cout << x*2*c + (y-x)*min(b,2*c) << endl;
    } else {
        cout << a*x + b*y << endl;
    }
}


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

int main() {
	int N, count=0;
    cin >> N;
    vector<int> A(N), B(3);
    for (int i=0; i<N; i++){
        cin >> A[i];
    }
    for (int i=0; i<N; i++){
        for (int j=0; j<N; j++){
          	for (int k=0; k<N; k++){
                 if (A[i]==A[j]||A[j]==A[k]||A[k]==A[i]) continue;
                 B = {A[i], A[j], A[k]};
                 sort (B.begin(),B.end());
                 if (B[2]<B[1]+B[0]){
                 	count++;
                 }
            }
        }
    }
    cout << count/6 << endl;
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;
int main(void){
	int n,a[105];
	cin>>n;
	REP(i,n)cin>>a[i];
	int cnt=0;
	REP(i,n){
		if(i%2==0&&a[i]%2==1)cnt++;
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<vector>

using namespace std;
const int N=2e5+10,inf=1e9;
int dp[N][2];
char s[N];

int main(){
    int n,x,now=0,ans=1;
    cin >> n >> x;
    vector<int> L(n);
    for(int i=0;i<n;i++){
        cin >> L[i];
    }
    for(int i=0;i<n;i++){
        now = now + L[i];
        if(now>x)break;
        ans++;
    }

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int 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>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< 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 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//const ll MOD = 1000000007;
const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    string s;
    cin >> s;
    int n = s.size();
    string t1 = s.substr(0, n / 2);
    string t2 = s.substr(n / 2 + 1, n / 2);

    string t3 = t1, t4 = t2;
    reverse(all(t3));
    reverse(all(t4));
    if (t1 == t2 and t3 == t4) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    if N >= K:
        ans = X*K + Y*(N-K)
    else:
        ans = X*N
    print(ans)        

if __name__ == "__main__":
    solve()


Measured memory_bytes: 2940
#include<bits/stdc++.h> 
#define ll                 long long                            
#define ra                 return a;                                          
#define pb                 push_back                                                     
#define sti                stack<ll>
#define spi                stack<pair<ll,ll>>
#define S                  second
#define msi                map<string,ll >
#define msi                map<string,ll >
#define mii                map<ll ,ll >
#define dbg(x)             { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y)          { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z)        { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define mis                map<ll , string>
#define rep(i,a,b)         for(ll  i=a;i<b;i++)
#define mpi                map<pair<ll ,ll >,ll >                                                
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define F                  first 
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define pqi                priority_queue<ll>
#define si                 set <ll>
#define vs                 vector<string>
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define hell               1000000007
#define bs                 binary_search
#define mp                 make_pair
#define qi                 queue<ll>
#define qs                 queue<string>
#define qpi                queue<pair<ll,ll>>
#define qps                queue<pair<ll,string>> 
#define endl               '\n' 
#define itr(a,it)          for(typeof(a.begin()) it=a.begin();it!=a.end();it++)// This will produce const_iterator for const object and normal iterator for non-const object
#define ss                 set<string>
using namespace std;
#define N  100005
vi edge[N];
bool vis[N];
ll dp[N];
void dfs(ll node)
{
	vis[node]=1;
	for(auto i:edge[node])
	{
		if(!vis[i])
		dfs(i);
		dp[node]=max(dp[node],dp[i]+1);
	}
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
//    cin>>t;
    while(t--)
{
    ll n,m;
 	cin>>n>>m;
 	rep(i,0,m)
 	{
 		ll a,b;
 		cin>>a>>b;
 		edge[a].pb(b);
 	}
 	ll ans=0;
 	rep(i,1,n+1)
 	{
 		if(!vis[i])dfs(i);
 	}
 	rep(i,1,n+1)
 	ans=max(ans,dp[i]);
 	cout<<ans;
}
    return 0;
}

Measured memory_bytes: 8704
# coding: utf-8
S = list(raw_input())
T = list(raw_input())

idx = []
for i in range(len(S)):
    match = 0
    for j in range(len(T)):
        if i+len(T) > len(S):
            break
        if S[i+j] == T[j] or S[i+j] == '?':
            match += 1
    if match == len(T):
        idx.append(i)

if len(idx) == 0:
    print 'UNRESTORABLE'
else:
    i = max(idx)
    for j in range(len(T)):
        S[i+j] = T[j]
    prev_idx = i

    # fill a
    for i in range(len(S)):
        if S[i] == '?':
            S[i] = 'a'

    print ''.join(S)


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

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  
  int sum=0;
  for(int i=0;i<n;i++){
    if(a[i]==i+1){
      sum++;
    }
  }
  
  if(sum==n-2||sum==n){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1<<19;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 200007;

int n,loc[_]={0},f[_]={0};

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);

	n=ty();
	for(int i=1;i<=n;i++)loc[ty()]=i;

	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(loc[i]>loc[i-1])f[i]=f[i-1]+1;
		else f[i]=1;
		ans=max(ans,f[i]);
	}

	cout<<n-ans<<lf;
	
	return 0;
}


Measured memory_bytes: 2304
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	ll H, W;
	cin >> H >> W;
	if (H == 1 || W == 1) {
		cout << 1 << endl;
		return 0;
	}
	cout << (H * W + 1) / 2;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  if(N%2==0)
    cout<<fixed<<setprecision(7)<<0.5<<endl;
  else
  {cout<<fixed<<setprecision(7)<<(((double)N+1)/(2*(double)N))<<endl;}
  
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    List<Pair> list = new ArrayList<>();

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

    void run() {

        int n = sc.nextInt();
        long[][] dp = new long[n+1][n+1];
        long[] arr = new long[n];
        for (int i=0; i<n; i++) {
            arr[i] = sc.nextInt();
            Pair tmpP = new Pair(i, arr[i]);
            list.add(tmpP);
        }

        Collections.sort(list, (o1, o2) -> Long.compare(o2.power, o1.power));

//        System.out.println(list.get(0).power);

        long ans = 0;


        label:
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                if (n <= i +j) continue label;
                Pair tmp = list.get(i + j);
                dp[i+1][j] = Math.max(dp[i+1][j], dp[i][j]+(tmp.idx-i)*tmp.power);
                dp[i][j+1] = Math.max(dp[i][j+1], dp[i][j]+(n-1-j-tmp.idx)*tmp.power);
            }
        }

        for (int i=0; i<=n; i++) {
            ans = Math.max(ans, dp[i][n-i]);
        }

        System.out.println(ans);

    }

    class Pair {
        long idx;
        long power;
        public Pair(long i, long p) {
            this.idx = i;
            this.power = p;
        }

    }
}


Measured memory_bytes: 87224