akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main()
{
    int a;
    char s[10];
    cin >> a;
    int i = 0;
    while (cin >> s[i]) {
        i++;
    }
    s[i] = '\0';

    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }

}

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

typedef long long ll;
typedef unsigned long long ull;

ll MOD = 1000000007;

template <typename T>
class ModCalc{
public:
    ModCalc(T MOD){
        mod = MOD;
    }

    T add(T a, T b){
        return (a + b) % mod;
    }

    T sub(T a, T b){
        return (a - b) % mod;
    }

    T multi(T a, T b){
        return ((a % mod) * (b % mod)) % mod;
    }

    T power(T a, T n){
        T res = 1;
        while(n){
            if(n&1) res = multi(res, a);
            a = multi(a, a);
            n >>= 1;
        }
        return res;
    }

    T div(T a, T b){
        return multi(a, power(b, mod-2));
    }

    T comb(T n, T k){
        T res = 1;
        for(int i=0; i<k; i++){
            res = multi(res, n-i);
            res = div  (res, i+1);
        }
        return res;
    }
private:
    T mod;
};

int main()
{
    ll N, A, B, C;
    cin >> N >> A >> B >> C;

    auto mc = ModCalc<ll>(MOD);

    auto Ar = mc.div(A, A+B);
    auto Br = mc.div(B, A+B);
    auto ArN = mc.power(Ar, N);
    auto BrN = mc.power(Br, N);
    auto Ari = 1;
    auto Bri = 1;
    vector<ll> combCache(N, -1);
    combCache[0] = 1;
    for(ll i=1;i<N;i++){
        combCache[i] = mc.multi(combCache[i-1], N+i-1);
        combCache[i] = mc.div(combCache[i], i);
    }
    ll res=0;
    for(ll i=0;i<N;i++){
        auto tmpA = (N+i);
        //tmpA = mc.multi(tmpA, mc.comb(N+i-1, i));
        tmpA = mc.multi(tmpA, combCache[i]);
        tmpA = mc.multi(tmpA, ArN);
        //tmpA = mc.multi(tmpA, mc.power(Br, i));
        tmpA = mc.multi(tmpA, Bri);
        auto tmpB = (N+i);
        //tmpB = mc.multi(tmpB, mc.comb(N+i-1, i));
        tmpB = mc.multi(tmpB, combCache[i]);
        tmpB = mc.multi(tmpB, BrN);
        //tmpB = mc.multi(tmpB, mc.power(Ar, i));
        tmpB = mc.multi(tmpB, Ari);
        res += (tmpA+tmpB);
        res %= MOD;

        Ari = mc.multi(Ari, Ar);
        Bri = mc.multi(Bri, Br);
    }
    res = mc.multi(res, 100);
    res = mc.div(res, 100-C);
    cout<<res<<endl;


    return 0;
}


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

int main(){
	int n,k;
	cin >> n >> k;
	vector<int> l(n);
	rep(i,n) cin >> l[i];
	sort(l.begin(),l.end());
	reverse(l.begin(),l.end());
	int sum = 0;
	rep(i,k) sum += l[i];
	cout << sum << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N,M;cin>>N>>M;
    vector<int> K(N);
    vector<int> cnt(M);
    int ans=0;
    for(int i=0;i<N;i++){
        cin >> K[i];//何種類好きか
        for(int j = 0; j<K[i]; j++){
            int A;cin >> A; --A; 
            cnt[A]++;
        }
    }
    
    for(int i=0;i<M;i++){
        if(cnt[i]==N)
            ans++;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; i < t; ++j)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

int main() {
  int N, K;
  cin >> N >> K;
  int h[N];
  rep(i,N) {
    cin >> h[i];
  }
  int cost[N];
  cost[0] = 0;
  srep(i,1,N) {
    int mincost = INF;
    rep2(j,K){
      int ind = i - (j + 1);
      if(ind > -1){
        mincost = min(mincost,abs(h[i] - h[ind]) + cost[ind]);
      }
    }
    cost[i] = mincost;
  }
  cout << cost[N -1] << endl;
  return 0;
}

Measured memory_bytes: 1024
from itertools import combinations_with_replacement
N,M,Q=map(int,input().split())
G=[]
for _ in range(Q):
  A,B,C,D=map(int,input().split())
  G.append([A,B,C,D])

max_score=0
for A in combinations_with_replacement(range(1,M+1),r=N):  
  score=0
  for a,b,c,d in G:
    if A[b-1]-A[a-1]==c:
      score+=d
    max_score=max(max_score,score)
print(max_score)

Measured memory_bytes: 9072
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    u32 K, A, B;
    cin >> K >> A >> B;
    string res = "NG";
    for (u32 i = A; i <= B; i++) {
        if (i % K == 0) res = "OK";
    }
    cout << res << endl;
}


Measured memory_bytes: 3648
N, M, X = map(int, input().split())
A = list(map(int, input().split()))
cost = [0,0]
for i in range(X, N):
    if i in A:
        cost[0] += 1

for i in range(X, 0, -1):
    if i in A:
        cost[1] += 1

print(min(cost[0],cost[1]))

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

int main()
{   int n;
    cin >> n;
    int month = n % 100;
    int year = n / 100;
    int okYYMM = 1;
    int okMMYY = 1;
    if (month == 0 || month > 12)
    {
        okYYMM = 0;
    }
    if (year == 0 || year > 12)
    {
        okMMYY = 0;
    }
    if (okYYMM == 0 && okMMYY == 0)
    {
        cout << "NA";
    }
    if (okYYMM == 1 && okMMYY == 1)
    {
        cout << "AMBIGUOUS";
    }
    if (okYYMM == 0 && okMMYY == 1)
    {
        cout << "MMYY";
    }
    if (okYYMM == 1 && okMMYY == 0)
    {
        cout << "YYMM";
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String args[]){
    Scanner s = new Scanner(System.in);
    int c = s.nextInt();
    int r = s.nextInt();
    
    int res = (c>10)?r:(r+(100*(10-c)));
    System.out.println(res);
    }
 
	
}

Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};

int main(){
    int d,t,s; cin >> d >> t >> s;

    if((d+s-1)/s > t){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }



}

Measured memory_bytes: 3588
N = int(input())
h = list(map(int, input().split()))
INF = 10**9
dp = [INF] * N
dp[0] = 0
for i in range(1, N):
    dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i])
    if i + 1 < N:
        dp[i+1] = min(dp[i-1] + abs(h[i+1] - h[i-1]) , dp[i+1])
print(dp[N-1])

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

static const int N = 105;

int main(){
int n,p[N+1],m[N+1][N+1];
cin >> n;

for(int i=1;i<=n;i++){
cin >> p[i-1] >> p[i];
}

for(int i=1;i<=n;i++) m[i][i]=0;
for(int l=2;l<=n;l++){
for(int i=1;i<=n-l+1;i++){
int j=i+l-1;
m[i][j]=(1 << 21);
for(int k = i;k<=j-1;k++){
m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
}
}
}
cout << m[1][n] << endl;

return 0;

}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int par[100000];
int rnk[100000];

void init(int n){
	for(int i = 0;i < n;i++){
		par[i] = i;
		rnk[i] = 0;
	}
}

int find(int x){
	if(par[x] == x) return x;
	else return par[x] = find(par[x]);
}

void unite(int x,int y){
	x = find(x);
	y = find(y);
	if(x == y) return;
	if(rnk[x] < rnk[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(rnk[x] == rnk[y]) rnk[x]++;
	}
}

bool same(int x,int y){
	return find(x) == find(y);
}

signed main(){
	int n,m,a[100000],ans = 0;
	set<int> num[100000];
	cin >> n >> m;
	for(int i = 0;i < n;i++) cin >> a[i];
	init(n);
	for(int i = 0;i < m;i++){
		int x,y;
		cin >> x >> y; x--;y--;
		unite(x,y);
	}
	for(int i = 0;i < n;i++){
		num[find(i)].insert(a[i]);
	}
	for(int i = 0;i < n;i++){
		if(num[find(i)].count(i + 1)) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11904
#include <iostream>
#include <queue>
using namespace std;
int main(){
  string s;
  cin>>s;
  int n,q,w,i;
  cin>>n;
  while(n--){
    string a,b;
    cin>>a;
    if(a[2]=='p'){
      int c=0;
      cin>>q>>w>>b;
      for(i=q;i<=w;i++)s[i]=b[c++];
    }
    else if(a[2]=='v'){
      int c=0;
      cin>>q>>w;
      for(i=q;i<=w;i++)b[c++]=s[i];
      for(c=0,i=w;i>=q;i--)s[i]=b[c++];
    }
    else{
      cin>>q>>w;
      for(i=q;i<=w;i++)cout<<s[i];
      cout<<endl;
    }
  }
}



Measured memory_bytes: 3216
#include<cstdio>
int main(){
	char s[600000]={};
	long long int n;
	scanf("%s", s);
	for(long long int i=0;true;i++){
		if(s[i]==0){
			n=i;
			break;
		}
	}
	if(s[n-1]=='<'){
		s[n]='>';
		n++;
	}
	if(s[0]=='>'){
		for(int i=n-1;i>=0;i--){
			s[i+1]=s[i];
		}
		s[0]='<';
		n++;
	}
	long long int d[600000]={};
	long long int p=0;
	long long int q=1;
	for(int i=1;i<n;i++){
		if(s[i]!=s[i-1]){
			d[p]=q;
			p++;
			q=1;
		}else{
			q++;
		}
	}
	d[p]=q;
	p++;
	long long int ans=0;
	for(int i=0;i<p/2;i++){
		long long int x=d[2*i];
		long long int y=d[2*i+1];
		long long int z=0;
		if(x>y){
			z=x;
			x=y;
			y=z;
		}
		z=y*(y+1)/2+x*(x-1)/2;
		ans+=z;
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main(void){
	int num_row,num_col;

	while(std::cin >> num_row >> num_col, num_row != 0 && num_col != 0){
		//make street
		std::vector<int> street(num_row * num_col, 1);
		
		//make stop
		int stop_num,row,col;
		std::cin >> stop_num;
		for(int i = 0; i < stop_num; ++i){
			std::cin >> row >> col;
			street[num_row * (col - 1) + (row - 1)] = 0;
		}
	
		//calc
		int lRoad,uRoad; //left road, under road
		for(int j = 0; j < num_col; ++j){
			for(int k = 0; k < num_row; ++k){
				if(j + k != 0){
					if(street[j*num_row + k] != 0){
						lRoad = k == 0 ? 0 : street[j*num_row + k - 1];
						uRoad = j == 0 ? 0 : street[(j - 1)*num_row + k];
						street[j*num_row + k] = lRoad + uRoad;
					}
				}
			}
		}
	
		std::cout << street.back() << std::endl;
	}
	return 0;
}

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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef long double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }


int main() {
	int n; int k; scanf("%d%d", &n, &k);
	int total = 0;
	forn(i, n) {
		int input; scanf("%d", &input);
		if(input >= k)
			total++;
	}
	printf("%d", total);
	return 0;
}










Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <unordered_map>
#include <iterator>
#include <functional>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.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; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<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> 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);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;
string db("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	while(cin >> n, n){
		int l = 0, r = 0, p = 0;
		int ans = 0;
		REP(i, n){
			string s;
			cin >> s;
			(s[0] == 'l' ? l : r) ^= 1;
			if(p != l && p != r){
				ans ++; p ^= 1;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

typedef long long int ll;

bool isPrime(ll num){
    if(num < 2)return false;
    else if(num == 2) return true;
    else if(num %2 == 0) return false;

    double sqrtNum = sqrt(num);
    for(ll i=3;i<=sqrtNum;i+=2){
        if(num%i==0){
            return false;
        }
    }

    return true;
}

int main(){
    ll n;
    cin>> n;
    ll ans = 0;
    if(isPrime(n)){
        ans = n-1;
    }else{
        ll min=n,tem;
        double sqrtNum = sqrt(n);
        for(ll i=2;i<=sqrtNum;i++){
           if(n%i==0){
              tem = i-1 + n/i -1;
              if(tem < min){
                  min = tem;
              }
           }
        }
        ans = min;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    long long n;
    cin >> n;
    int check = 0;
    
    for (int i = 2;i <= sqrt(n);i++){
        if (n%i == 0){
            check = 1;
            break;
        }
    }
    if (check == 0 && n != 1){
        cout << 1 << endl;
    }
    else if (n == 1){
        cout << 0 << endl;
    }
    else {
        long long cycle = 0;
        long long k = 1;
        long long ans = 0;
        long long a = 2;
        while (n >= a*a){
            if (n%a == 0){
                cycle++;
                if (2*cycle >= k*(k+1)){
                    ans++;
                    k++;
                }
                n = n/a;
            }
            else {
                a++;
                cycle = 0;
                k = 1;
            }
        }
        
        if (n > a){
            cout << ans + 1 << endl;
        }
        else if (n == a){
            cycle++;
            if (2*cycle >= k*(k+1)){
                cout << ans + 1 << endl;
            }
            else {
                cout << ans << endl;
            }
            
        }
        else {
            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 3660
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	string s;
	cin >> s;
	int ans = s.length();
	for(int i = 1; i < s.length(); i++){
		if(s[i - 1] != s[i]) ans = min(ans, max(i, (int)s.length() - i));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define zero(x) (((x)>0?(x):-(x))<eps)
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int>PII;
typedef pair<int,string>PIS;
const double eps=1e-9;
const double pi=acos(-1.0);
const int inf=1e9+7;
const int INF=0x3f3f3f3f;
//LL powmod(LL a,LL b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main(){
//    freopen("in.in","r",stdin);
//    freopen("out.out",";w",stdout);
    LL n,m,ans;
    cin>>n>>m;
    if(n*2>=m){
        ans=m/2;
    }
    else{
        ans=n;
        m-=n*2;
        ans+=m/4;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(void){
  char s[16];
  int flg = 1;
  int ccnt = 0;
  
  cin >> s;
  for (int i=0; i<strlen(s); i++){
    if (i==0 && s[i]!='A') flg = 0;
    if (s[i]!='A' && s[i]!='C' && !(s[i]>='a' && s[i]<='z')) flg = 0;
    if (s[i]=='C'){
      if (i>=2 && i<=strlen(s)-2) ccnt++;
      else flg = 0;
    }
  }
  cout << (flg&&(ccnt==1)? "AC" : "WA") << endl;
  
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define mp make_pair

const int INF = INT_MAX;

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

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n;
	cin >> n;
	vi arr(n);
	int num[150001];

	for(int i = 0; i <= 150000; i++){
		num[i] = 0;
	}

	ll sum = 0;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
		sum += (long long) arr[i];
		num[arr[i]]++;
	}
	int q, b, c;
	cin >> q;
	for(int i = 0; i < q; i++){
		cin >> b >> c;
		sum -= (long long) num[b] * b;
		sum += (long long) num[b] * c;
		cout << sum << "\n";
		num[c] += num[b];
		num[b] = 0;
	}

	return 0;
}

Measured memory_bytes: 4264
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  ll i = 0;
  for (auto x : v){os << " [" << i++ << "]" << x; if (i % 5 == 0) os << std::endl;}
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 5 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll n, m;
  std::cin >> n >> m;

  ll ans = (n-1) * (m-1);
  print(ans);
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a,b,c,count=0;	cin>>a>>b>>c;
	FOR(i,a,b+1)	if(i%c==0)	count++;
	cout<<count<<endl;


    return 0;
}



Measured memory_bytes: 3648
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	string s;
	cin >> s;
	N = s.size();
	if (N == 2) {
		if (s[0] == s[1]) {
			cout << "1 2\n";
			return 0;
		}
		cout << "-1 -1\n";
		return 0;
	}
	for (int i = 0; i < N - 2; i++) {
		M = 0;
		if (s[i] == s[i + 1]||s[i]==s[i+2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}
	cout << "-1 -1\n";
	return 0;
}

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

int main(){
	// おまじない
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	ll A,B,K;
	// 出入力
	cin >> A >> B >> K;
    if (A < K){
        K = K-A;
        A = 0;
    }else{
        A = A-K;
        K = 0;
    }
    if (B < K){
        B = 0;
    }else{
        B = B-K;
    }
    string ans = to_string(A) + " " + to_string(B);
    cout << ans << "\n";

	// cout << ans << "\n";

    return 0;
}

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

signed main(){
    int n;cin>>n;
    for(int i=1;i<10;i++){
        if(n%i==0&&n/i<10){cout<<"Yes"<<endl;return 0;}
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <cstdlib>
#include <cstdio>

using namespace std;

stack <int> st;

int solve(string str)
{
    int b = st.top();
    st.pop();
    int a = st.top();
    st.pop();
    if(str=="+")
        return a+b;
    else if(str=="-")
        return a-b;
    else if(str=="*")
        return a*b;
    else if(str=="/")
        return a/b;
}

int main()
{
    string str;
    while(cin>>str)
    {
        if(str=="+"||str=="-"||str=="*"||str=="/")
            st.push(solve(str));
        else
            st.push(atoi(str.c_str()));
        if(getchar()=='\n')
        {
            cout << st.top() << endl;
            return 0;
        }
    }
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int arr[n];
    int idx = -1, m2 = -1, m = -1;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        if(arr[i] > m){
            idx = i;
            m = arr[i];
        }
    }
    for(int i = 0; i < n; i++){
        if(i != idx && m2 < arr[i])m2 = arr[i];
    }
    for(int i = 0; i < n; i++){
        if(arr[i] == m){
            cout << m2 << "\n"; 
        }else{
            cout << m << "\n";
        }
    }
}


Measured memory_bytes: 2432
N, A, B, C = map(int,input().split())
ans = []
flag = True
cnt = 0
while True:
  cnt += 1
  if cnt > N:
    break
  s = input()
  if s == 'AB':
    if A == B == 0:
      flag = False
      break
    elif A == B == 1 and C == 0:
      if cnt == N:
        ans.append('A')
        break
      else:
        cnt += 1
        s = input()
        if s == 'AB':
          ans.append('A')
          ans.append('B')
          continue
        elif s == 'AC':
          ans.append('A')
          ans.append('C')
          B -= 1
          C += 1
          continue
        else:
          ans.append('B')
          ans.append('C')
          A -= 1
          C += 1
          continue
    elif A >= B:
      A -= 1
      B += 1
      ans.append('B')
      continue
    else:
      B -= 1
      A += 1
      ans.append('A')
      continue
  elif s == 'BC':
    if B == C == 0:
      flag = False
      break
    elif B == C == 1 and A == 0:
      if cnt == N:
        ans.append('B')
        break
      else:
        cnt += 1
        s = input()
        if s == 'BC':
          ans.append('B')
          ans.append('C')
          continue
        elif s == 'AB':
          ans.append('B')
          ans.append('A')
          C -= 1
          A += 1
          continue
        else:
          ans.append('C')
          ans.append('A')
          B -= 1
          A += 1
          continue
    elif B >= C:
      B -= 1
      C += 1
      ans.append('C')
      continue
    else:
      C -= 1
      B += 1
      ans.append('B')
      continue 
  else:
    if C == A == 0:
      flag = False
      break
    elif C == A == 1 and B == 0:
      if cnt == N:
        ans.append('C')
        break
      else:
        cnt += 1
        s = input()
        if s == 'AC':
          ans.append('C')
          ans.append('A')
          continue
        elif s == 'BC':
          ans.append('C')
          ans.append('B')
          A -= 1
          B += 1
          continue
        else:
          ans.append('A')
          ans.append('B')
          C -= 1
          B += 1
          continue
    elif A >= C:
      A -= 1
      C += 1
      ans.append('C')
      continue
    else:
      C -= 1
      A += 1
      ans.append('A')
      continue
if flag:
  print('Yes')
  for item in ans:
    print(item)
else:
  print('No')

Measured memory_bytes: 9896
import java.util.Scanner;
import java.util.Stack;
public class Main{
	public static void main(String[] args){
		Scanner scanner=new Scanner(System.in);
		Stack<Character> q;
		String input="";
		while (scanner.hasNext()){
			input=scanner.nextLine();
			if (input.equals("."))break;
			q=new Stack<Character>();
			boolean badFormat=false;
			char[] ch=input.toCharArray();
			int i=0;
			while (i<ch.length){
				char c=ch[i];
				switch(c){
				case '(':
				case '[':
					q.push(c);
					break;
				case ')':
					if (!q.isEmpty()){
						if (q.peek()=='('){
							q.pop();
						}else{
							badFormat=true;
						}
					}else{
						badFormat=true;
					}
					break;
				case ']':
					if (!q.isEmpty()){
						if (q.peek()=='['){
							q.pop();
						}else{
							badFormat=true;
						}
					}else{
						badFormat=true;
					}
					break;
				default:
					break;
				}
				i++;
			}
			System.out.println((q.isEmpty()&&!badFormat)?"yes":"no");
		}
	}
}

Measured memory_bytes: 34284
s = input().split() 
k = int(s[0])
x = int(s[1])

aa = x - k + 1
if aa < -1000000:
  aa = 0
bb = x + k - 1
if bb > 1000000:
  bb = 1000000

for i in range(aa, bb+1):
  print(i, end=" ")

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

int main() {
    long long X;
    cin >> X;
    for (long long i = -200; i <= 200; i++) {
        for (long long j = -200; j <= 200; j++) {
            if (i * i * i * i * i - j * j * j * j * j == X) {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
//
int N,K;
ll mo=1000000007;
vector<int> E[101010];

ll ret=1;

void dfs(int cur,int pre,int cand) {
	ret = ret*cand % mo;
	
	cand = K-1-(pre!=-1);
	
	FORR(e,E[cur]) if(e!=pre) {
		dfs(e,cur,cand);
		cand--;
	}
}

int main() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	FOR(i,N-1) {
		cin>>x>>y;
		E[x-1].push_back(y-1);
		E[y-1].push_back(x-1);
	}
	dfs(0,-1,K);
	cout<<ret<<endl;
	return 0;
}


Measured memory_bytes: 9216
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {
  int a,b;
  char op;

  cin >> a >> op >> b;

  if(op == '+')
    cout << a + b;
  else
  {
    cout << a - b;
  }
  



  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCatSnukeandaVoyage solver = new CCatSnukeandaVoyage();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCatSnukeandaVoyage {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            boolean f = false;
            boolean[] ichi = new boolean[n + 1];
            boolean[] enu = new boolean[n + 1];
            for (int i = 0; i < n + 1; i++) {
                ichi[i] = false;
                enu[i] = false;
            }
            for (int i = 0; i < m; i++) {
                int a = in.nextInt();
                int b = in.nextInt();
                if (a == 1) {
                    ichi[b] = true;
                }
                if (b == n) {
                    enu[a] = true;
                }
            }

            for (int i = 2; i <= n-1; i++) {
                if (ichi[i] && enu[i]) {
                    f = true;
                    break;
                }
            }
            out.println(f ? "POSSIBLE" : "IMPOSSIBLE");

        }

    }
}



Measured memory_bytes: 97640
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	pp := make([]int, n)
	qq := make([]int, n)

	for i := 0; i < n; i++ {
		pp[i] = getNextInt(scanner) - 1
	}
	for i := 0; i < n; i++ {
		qq[i] = getNextInt(scanner) - 1
	}

	facs := make([]int, n+1)
	facs[0] = 0
	facs[1] = 1
	for i := 2; i <= n; i++ {
		facs[i] = facs[i-1] * i
	}
	bp := make([]int, n)
	bq := make([]int, n)
	for i := 0; i < n; i++ {
		bp[i] = 1
		bq[i] = 1
	}
	var a, b int
	for i := 0; i < n; i++ {
		c := 0
		for j := 0; j < pp[i]; j++ {
			c += bp[j]
		}
		a += facs[n-i-1] * c
		bp[pp[i]] = 0
	}
	for i := 0; i < n; i++ {
		c := 0
		for j := 0; j < qq[i]; j++ {
			c += bq[j]
		}
		b += facs[n-i-1] * c
		bq[qq[i]] = 0
	}
	fmt.Fprintln(writer, absint(a-b))
}
func absint(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 640
import scala.io.StdIn.readInt

object Main {
  val r = Array(2,3,5,7)

  def pow(x:Long, y:Long, z:Long):Long = {

    def multi(m:Long, n:Long) = { ( (m%z) * (n%z) ) % z }

    def pow2(m:Long, n:Long, odd:Long, b:Long):Long = {
      n match {
        case 0 => 1
        case 1 => multi(m, odd)
        case _ =>
          pow2(multi(m,m), n/2, (if(n%2==1) multi(odd, b) else odd), multi(b,b))
      }
    }
    pow2(x, y, 1, x)
  }

  def twoPow(d:Int,s:Int):(Int,Int) = {
    if(d%2 == 1) (d,s)
    else twoPow(d>>1,s+1)
  }

  def maybePrime(i:Int,d:Int,s:Int, n:Int):Boolean = {
    if(i>3) true
    else {
      val a = r(i)
      val x = pow(a,d,n)

      if(x==1 || x==n-1) maybePrime(i+1,d,s,n)
      else repeat(s-1,x*x%n, i, d, s, n)
    }
  }

  def repeat(j:Int, x:Long, i:Int, d:Int, s:Int, n:Int):Boolean = {
    if(j==0) false
    else if(x==1) false
    else if(x==n-1) maybePrime(i+1,d,s,n)
    else repeat(j-1,x*x%n,i,d,s,n)
  }

  def isPrime(n:Int):Boolean = {
    if(n<5000) (2 to Math.sqrt(n).toInt).forall(n%_ != 0)
    else if(n%2==0) false
    else {
      val (d,s) = twoPow(n-1,0)
      maybePrime(0,d,s,n)
    }
  }

  def main(args:Array[String]) = {
    val n = readInt
    println((0 until n).count{ _=> isPrime(readInt) })
  }
}

Measured memory_bytes: 51496
class Stock():
    def __init__(self, length):
        self.S = [None for _ in range(length)]
        self.top = 0

    def isEmpty(self):
        return self.top == 0

    def isFull(self):
        return self.top >= len(self.S) -1

    def push(self, x):
        if self.isFull():
            raise

        self.top += 1

        self.S[self.top] = x

    def pop(self):
        if self.isEmpty():
            raise

        self.top -= 1

        return self.S[self.top + 1]


class StockCalc(Stock):
    def calc(self, x):
        if x.isdigit():
            super().push(int(x))
            return

        b = super().pop()
        a = super().pop()

        if x == "+":
            y = a + b
        elif x == "-":
            y = a - b
        elif x == "*":
            y = a * b
        else:
            raise

        super().push(y)


list_input = list(input().split())

stock = StockCalc(len(list_input))


for x in list_input:
    stock.calc(x)

print(stock.pop())



Measured memory_bytes: 5608
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int one = scanner.nextInt() * scanner.nextInt();
		int two = scanner.nextInt() * scanner.nextInt();
		if (one < two) {
			System.out.println(two);
		} else {
			System.out.println(one);
		}
	}
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = ~(1<<31);
const int MOD = 1e9+7;
const double EPS = 1.0e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt = 0;
	for(int i = 1; i < n-1; i++){
		if(s[i-1] == 'A' && s[i] == 'B' && s[i+1] == 'C') cnt++;
	}
	cout << cnt << endl;
	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    ll n;
    cin >> n;

    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> s(n+1, 0);

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

    for(int i = 0; i < n; ++i){
        s[i+1] = a[i] + s[i];
    }

    int idx = 0;
    for(int i = 0; i < n; ++i){
        if(s[i]*2 < a[i]) idx = i;
    }
    ppp(n-idx);


    return 0;
}


Measured memory_bytes: 1792
def can_reach_the_goal(u, x):
    return min(u) >= x

n, m, x = map(int, input().split())

c = []
a = []
for i in range(n):
    ca = [int(row) for row in input().split()]
    c.append(ca[0])
    a.append(ca[1:])

INF = 10**7
min_cost = INF
for k in range(2**n):
    purchase = [True if c == '1' else False for c in list(format(k, '0{}b'.format(n)))]
    cost = 0
    u = [0]*m
    for i in range(n):
        cost += c[i] if purchase[i] else 0
        for j in range(m):
            u[j] += a[i][j] if purchase[i] else 0

    if can_reach_the_goal(u, x) and cost < min_cost:
        min_cost = cost

if min_cost == INF:
    print(-1)
else:
    print(min_cost)


Measured memory_bytes: 9128
N = int(input())
x = list(map(int, input().split()))
x_sorted = sorted(x)
a = x_sorted[(len(x) // 2) - 1]
b = x_sorted[(len(x) // 2)]
for i in x:
  if i <= a:
    print(b)
  else:
    print(a)

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

using namespace std;
typedef long long ll;
typedef long int lt;
typedef vector<ll> vi;
typedef vector<int> vin;
typedef pair<ll,ll> pll;
typedef pair<int,int> pin;
#define all(a) a.begin(),a.end()
#define rep(i,a,b) for(int i=a;i<b;++i)
#define f(i,b) for(int i=0;i<b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define test(t) int t; cin>>t; while(t--) solve()
#define endl "\n"
#define p1 cout<<"YES"<<endl
#define p0 cout<<"NO"<<endl
#define fst ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int mod=1e9+7;

ll mod_pow(ll a,ll n,ll mod)	//(a^n)%mod
{	ll res=1;
	while(n){	if(n&1)	res=(res*a)%mod; n/=2; a=(a*a)%mod;	}
	return res;
}

void solve();

int main()
{
    fst;
    //test(t);
     solve();
}

/**********************<="Actual code strats here"=>*****************************/


void solve()
{
    char c;
    cin>>c;
    if(c>='a' && c<='z')
        cout<<'a'<<endl;
    else 
        cout<<'A'<<endl;
}

Measured memory_bytes: 3636
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict

a,b=input().split()
b=b.replace(".","")
ans=int(a)*int(b)
print(ans//100)


Measured memory_bytes: 9480
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  
  int value = -1000000000;
  for(int a=0; a<=min(K,N-1); a++){
    for(int b=0; b<=min(K-a,N-a); b++){
      vector<int> juel(0);
      int sum = 0;
      for(int i=0; i<a; i++){
        juel.push_back(vec.at(i));
        sum += vec.at(i);
      }
      for(int j=0; j<b; j++){
        juel.push_back(vec.at(N-1-j));
        sum += vec.at(N-1-j);
      }
      sort(juel.begin(),juel.end());
      int x = juel.size();
      for(int c=0; c<min(K-a-b,x); c++){
        if(juel.at(c) > 0){
          break;
        }
        else{
          sum -= juel.at(c);
        }
      }
      //cout << a << " " << b << " " << sum << endl;
      value = max(sum,value);
    }
  }
  cout << value << endl;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
  input = input.split("\n");
  var inputNum = Number(input[0]);
  var tasks = [];
  for(var i=1; i <= inputNum; i++){
    var tmp = input[i].split(" ");
    tasks.push(tmp);
  }

  // ソート
  tasks.sort(function(a, b){
    return a[1]- b[1];
  });

  var result = 'Yes';
  var sumA = 0;

  for(var j=0; j < inputNum; j++){
    sumA = sumA + Number(tasks[j][0]);
    if(sumA > Number(tasks[j][1])){
      result = 'No';
      break;
    }
  }
  console.log(result);
 }
 //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
 Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

#ifdef BTK
#include<dvector.h>
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define DEBUG if(0)
#endif

#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
typedef vector<LL> V;
typedef vector<V> VV;

int main(){
    int N;
    cin>>N;
    V f(N,0);
    REP(i,N){
        REP(j,10){
            int v;
            cin>>v;
            f[i]|=(v<<j);
        }
    }
    VV p(N,V(11));
    REP(i,N)REP(j,11)cin>>p[i][j];
    LL ret=-1e15;
    FOR(i,1,1<<10){
        LL sum=0;
        REP(j,N){
            LL bit=i&f[j];
            sum+=p[j][__builtin_popcount((int)bit)];
        }
        chmax(ret,sum);
    }
    cout<<ret<<endl;
    return 0;
}


Measured memory_bytes: 256