akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
 
using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

 
int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	vector<ll> a(n), b(n);
	rep(i,n) cin >> a[i];
	
	//+-+
	ll ans = 1LL<<60, sm=0, cnt=0;
	rep(i,n){
		if(i%2==0 && sm+a[i]<=0){
			cnt +=  1-(sm+a[i]);
			sm = 1;
		}else if(i%2 && sm+a[i]>=0){
			
			cnt += sm+a[i]+1;
			sm = -1;
		
		}else sm +=a[i]; 
	
	}
	ans = min(ans, cnt);
	sm=0; cnt=0;
	rep(i,n){
		if(i%2==0 && sm+a[i]>=0){
			cnt += sm+a[i]+1;
			sm = -1;
		}else if(i%2 && sm+a[i]<=0){
			cnt +=  1-(sm+a[i]);
			sm =1;
		}else sm +=a[i];
	
	}
	ans = min(ans, cnt);
	
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define inf1 100000000000000
#define endl '\n'
ll power(ll a,ll b,ll m){ll ans=1;while(b){if(b&1) ans=(ans*a)%m; b/=2;a=(a*a)%m;}return ans;}
ll arr[200005];
ll pre[200005];
int main()
{
	fastio;
	#ifdef gdb_18
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll n;
	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		cin>>arr[i];
		pre[i]=(pre[i-1]+arr[i])%mod;
	}
	ll ans=0;
	for(ll i=1;i<=n;i++)
	{
		ll cur=(pre[i-1]*arr[i])%mod;
		ans=(ans+cur)%mod;
	}	
	cout<<ans<<endl;
	return 0;	
}

Measured memory_bytes: 6764
#include <iostream>
#include <algorithm>

bool is_palindromic(int n) {
    std::string str = std::to_string(n);
    return std::equal(str.begin(), str.end(), str.rbegin());
}

int main() {
    int A, B;
    std::cin >> A >> B;

    int count = 0;
    for (int n = A; n <= B; n ++) {
        count += is_palindromic(n);
    }
    std::cout << count << std::endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){
    int n;
    scanf("%d",&n);
    double x[n];
    double y[n];
    int i;
    for(i=0; i<n; i++){
        scanf("%lf %lf", &x[i],&y[i]);
        }
    for(i=1; i<n; i++){
        x[i]=x[i]-x[0];
        y[i]=y[i]-y[0]; //平行移動・x_0,y_0が原点
    }
    x[0]=0;
    y[0]=0;
    double S=0;
    for(i=1; i<n-1; i++){
        S=S + (x[i]*y[i+1]-x[i+1]*y[i])/2;
    }

    printf("%.1lf\n",S);
    return 0;
}


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

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void) {
  int n, k;
  scanf("%d%d", &n, &k);
  int p[1001] = { 0 };
  for(int i = 0;i < n;i++) {
    scanf("%d", p + i);
  }
  qsort(p, n, sizeof(int), compare_int);
  int sum = 0;
  for(int i = 0;i < k;i++) {
   sum += p[i];
  }
  printf("%d\n", sum);
  return 0;
}


Measured memory_bytes: 2172
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n<3200)s="red";
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
def AP(N):
    A = [1]
    P = [1]

    for i in range(1,N+1):
        A.append(A[i-1]*2 + 3)
        P.append(P[i-1]*2 + 1)

    return A,P

def count(N, X, A, P):

    if N == 0:
        return 1

    else: # N > 1
        if X == 1:
            return 0

        elif X <= 1 + A[N-1]:
            return count(N-1, X-1, A, P)

        elif X == 2 + A[N-1]:
            return P[N-1] + 1

        elif X <= 2+2*A[N-1]:
            return P[N-1] + 1 + count(N-1, X-2-A[N-1], A, P)

        else:
            return 2*P[N-1]+1


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

A, P = AP(N)

ans = count(N,X,A,P)
print(ans)


Measured memory_bytes: 3064
import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        String S = arr[0];
        String T = arr[1];                 
        arr = reader.readLine().split (" ");
        int A = Integer.parseInt (arr[0]);
        int B = Integer.parseInt (arr[1]);
        String U = reader.readLine();
        if (S.equals(U)) {
            A--;
        } else {
            B--;
        }
        System.out.println (A + " " + B);
    }
}

Measured memory_bytes: 21076
def clean(max_r, count):
  if max_r < count:
      max_r = count
  return max_r

mojiretsu = input()
count = 0
max_r = 0
for moji in mojiretsu:
  if moji == 'R':
    count += 1
  else:
    max_r = clean(max_r, count)
    count = 0
    
if count != 0:
  max_r = clean(max_r, count)
  
print(max_r)

Measured memory_bytes: 9052
#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);
}
int N;
int K;
int Q;
int A[100100];
int pts[100100];
int main(){
	cin >> N >> K >> Q;
	for(int i=0;i<N;i++)pts[i] = K-Q;
	for(int i=0;i<Q;i++){
		cin >> A[i];
		A[i]--;
		pts[A[i]]++;
	}
	for(int i=0;i<N;i++){
		if(pts[i]<=0)cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	return 0;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;

    ll ans = s.size();
    for (char c = 'a'; c <= 'z'; c++) {
        ll tmp = 0;
        ll cnt = 0;
        rep (i, s.size()) {
            if (c == s[i]) {
                tmp = max(tmp, cnt);
                cnt = 0;
            } else {
                cnt++;
            }
        }
        tmp = max(tmp, cnt);
        ans = min(ans, tmp);
    }

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


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
using namespace std;
typedef long long int ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, a[200010], t = 0, h;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i != n - 1)t += a[i];
		else h = a[i];
	}
	ll ans = abs(t - h);
	for (int i = n - 2; i > 0; i--) {
		h += a[i];
		t -= a[i];
		ans = min(ans, abs(t - h));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	string s;
	cin>>s;
	int n=s.size();
	rep(i,n)REP(j,i+1,n){
		if(s[i]=='C'&&s[j]=='F'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    int h, w;
    cin >> h >> w;
    vector<string> vs;
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        vs.push_back(s);
    }
    vector<int> vh(h, 0), vw(w, 0);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (vs[i][j] == '#') {
                vh[i] = 1;
                vw[j] = 1;
            }
        }
    }
    for (int i = 0; i < h; i++) {
        int flag = 0;
        for (int j = 0; j < w; j++) {
            if (vh[i] == 1 && vw[j] == 1) {
                cout << vs[i][j];
                flag = 1;
            }
        }
        if (flag) cout << endl;
    }
}


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

int main(){
    char arare;
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> arare;
        if(arare=='Y'){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n;cin >>n;
    unordered_set<char>s;
    for (int i = 0; i < n; ++i) {
        char c;cin >>c;
        s.insert(c);
    }
    if(s.size()==3){
        puts("Three");
    }
    else puts("Four");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) int((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl '\n'
#define ff first
#define ss second
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v) cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clzll(x) - 1;	}

struct pair_hash{
	template<class T1, class T2>
	size_t operator() (const pair<T1, T2> &p) const {
		auto h1 = hash<T1>{}(p.first);
		auto h2 = hash<T2>{}(p.second);
		return h1 ^ h2;
	}
};

int fast_mod(int x, int m = MOD) {
	while(x <= m) x -= m;
	if(x < 0) x += m;
	return x;
}

int mod_add(int x, int y) {
	return fast_mod(x + y);
}

ll a, b, c;

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

	cin >> a >> b >> c;
	if(a + b + c >= 22) cout << "bust" << endl;
	else cout << "win" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
using namespace std;

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

const int maxn = 205 + 10;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

#define dbg(x1) cout<<#x1<<" = "<<(x1)<<endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<" "<<#x3<<" = "<<(x3)<<endl
int sg[maxn][maxn];
int dfs(int x,int y)
{
   // dbg2(x,y);
    if(sg[x][y]!=-1) return sg[x][y];
    int vis[200];
    for(int i=0;i<=200;i++) vis[i]=0;
    for(int i=2;i<=x;i+=2) vis[dfs(x-i,y+i/2)]=1;
    for(int i=2;i<=y;i+=2) vis[dfs(x+i/2,y-i)]=1;
    for(int i=0;i<=200;i++) if(vis[i]==0) return (sg[x][y]=i);
}
ll abs_(ll x)
{
    if(x<0) return -x;
    return x;
}
int main() {
    //freopen(".in", "r", stdin);
//    memset(sg,-1,sizeof(sg));
//    sg[0][0]=0;
//    sg[0][1]=0;
//    sg[1][0]=0;
//    sg[1][1]=0;
//    dfs(2,2);
//    for(int i=0;i<=10;i++)
//    {
//        for(int j=0;j<=10;j++)
//        {
//            sg[i][j]=dfs(i,j);
//            if(sg[i][j]==0) dbg3(i,j,sg[i][j]);
//        }
//    }
    ll x,y;scanf("%lld%lld",&x,&y);
    if(abs_(x-y)<=1) printf("Brown\n");
    else printf("Alice\n");
    return 0;
}



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

int main() {
	char* o = new char[50];
	char* e = new char[50];
	for(int i = 0; i < 50; i++) {
		o[i] = ' ';
		e[i] = ' ';
	}
	cin >> o >> e;
	char* result = new char[100];
	for(int i = 0; i < 50; i++) {
		if(o[i] == ' ') break;
		result[i * 2] = o[i];
		if(e[i] == ' ') break;
		result[i * 2 + 1] = e[i];
	}
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

string S;

int main(void){
    cin>>S;
    int left=0,right=SZ(S)-1,ans=0;
    while(left<right){
        if(S[left]==S[right]){
            left++;
            right--;
        }else if(S[left]=='x'){
            left++;
            ans++;
        }else if(S[right]=='x'){
            right--;
            ans++;
        }else{
            ans=-1;
            break;
        }
    }
    cout<<ans<<endl;
     return 0;
}

Measured memory_bytes: 512
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

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

    vector<int> D(N+1), L(N);

    rep(i, N) cin >> L[i];

    D[0] = 0;

    for (int i = 1; i <= N; ++i) { D[i] = D[i - 1] + L[i - 1]; }

    int j = 0;

    rep(i, N+1) if (D[i] <= X) { ++j; }

    cout << j << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 100005
#define mod 1000000007
#define pp pair<ll,ll>
typedef long long int ll;
typedef long double ld;
typedef vector<pp> vpl;
#define MP make_pair

#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++)     
void fastIO(void);

void decimal(int);
ll modmulti(ll, ll, ll);
ll modadd(ll, ll, ll);
ll modpower(ll, ll, ll);
ll gcd(ll, ll );
ll modinv(ll, ll);







int main()
{
   decimal(8);
   ll n;
   cin>>n;
   ld sum,temp;
   sum = 0;
   rep(i,n){
      cin>>temp;
      sum += 1.0/temp;
   }
   sum = 1.0/sum;
   cout<<sum<<endl;
   
}























void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}

void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b, ll m){
   return ((a%m)*(b%m))%m;
}
ll modadd(ll a, ll b, ll m){
   return ((a%m)+(b%m)+m)%m;
}
ll modpower(ll a, ll n, ll m){
   if(n==0)
      return 1;
   ll result = 1;
   while(n>0){
      if(n%2==1)
         result = modmulti(result,a,m);
      a = modmulti(a,a,m);
      n = n/2;
   }
   return result;
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a, ll m){
   return modpower(a,m-2,m);
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;
  int p;
  cin>>n;
  int sum=0,max=0;
  for(int i=0;i<n;i++){
    cin>>p;
    sum+=p;
    if(max<p)max=p;
  }
  sum-=max/2;
  cout<<sum<<"\n";
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>


using namespace std;


int main(void){
  
  vector<string> S,ans,T;
  vector<int> C1,C2;
  int N;
  
  cin >> N;
  
 
  for(int i = 0; i < N ; i++){
    string tmp;
    cin >> tmp;
    S.push_back(tmp);
  }

  sort(S.begin(),S.end());
  int count =1;

  for(int i = 0; i < N-1 ; i++){
    
    if(S.at(i) == S.at(i+1)){
      count++;
    }else{
      C1.push_back(count);
      C2.push_back(count);

      T.push_back(S.at(i));
      count = 1;
    }

  }

  C1.push_back(count);
  C2.push_back(count);
  T.push_back(S.at(N-1));


  sort(C1.begin(),C1.end(),greater<int>());
  int max = C1.at(0);
  

  for(int i = 0; i < C2.size() ; i++){
    if(C2.at(i) == max){
      ans.push_back(T.at(i));
    }
  }

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

  for(int i = 0; i < ans.size() ; i++){
    cout << ans.at(i) << endl;
  }

  

  return 0;
}



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

vector<int> Substr(vector<int> X, int p, int l){
	vector<int> Y;
	for(int i = p; i < p + l; i++) Y.push_back(X[i]);
	return Y;
}

vector<int> BubbleSort(vector<int> A, int i){
	int N = A.size() - 1;
	for(int j = 0; j < N-i; j++){
		if(A[j] > A[j+1]){
			int a = A[j];
			A[j] = A[j+1];
			A[j+1] = a;
			A[N]++;
		}
	}
	return A;
}

void Output(vector<int> A){
	int n = A.size() - 1;
	for(int i = 0; i < n; i++) cout << A[i] << ' ';
	cout << A[n] << endl;
}

int main(){
	int N;
	cin >> N;
	vector<int> A;
	for(int i = 0; i < N; i++){
		int a;
		cin >> a;
		A.push_back(a);
	}
	A.push_back(0); //A[N]?????\??????????????°?????¨???
	for(int i = 1; i < N; i++) A = BubbleSort(A, i);
	Output(Substr(A, 0, N));
	cout << A[N] << endl;
	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define inf 1000000007;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

int n, a, b, x[100010], ta, mu;

signed main() {
	cin >> n >> a >> b;
	rep(i, n)cin >> x[i];
	ta = b / a + 1;
	rep(i, n - 1) {
		if (x[i + 1] - x[i] < ta)mu += (x[i + 1] - x[i])*a;
		else mu += b;
	}
	cout << mu << endl;
	getchar(); getchar();
	return 0;
}

Measured memory_bytes: 1024
a, b = map(int, input().split())

a_inf = a / 0.08
a_sup = (a + 1) / 0.08
b_inf = b / 0.1
b_sup = (b + 1) / 0.1
a_min = int(a_inf // 1)

a = a_min
al = []
while a < a_sup:
    if a_inf <= a < a_sup:
        al.append(a)
    a += 1

if al[0] >= b_sup:
    print('-1')
else:
    for i in range(len(al)):
        if b_inf <= al[i]:
            print(int(al[i]))
            break
    else:
        print('-1')

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
#define MOD 1000000007
#define MSG(a) cout << #a << " " << a << endl;
#define print(a) cout << a << endl;
template <class T, class C>
void chmax(T &a, C b) { a > b ?: a = b; }
template <class T, class C>
void chmin(T &a, C b) { a < b ?: a = b; }

// const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
// const int dx[]{0, 1, 0, -1}, dy[]{1, 0, -1, 0};

template <class T>
T sum(const vector<T> &v) { T res = 0; for (size_t i = 0; i < v.size(); ++i) res += v[i]; return res; }
// vector の出力
template<typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
    size_t last = v.size() - 1;
    for(size_t i = 0; i < v.size(); ++i) {
        out << v[i];
        if (i != last) 
            out << " ";
    }
    return out;
}


int main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //////////////////////////////////////////


    // string a, b;
    // cin >> a >> b;
    int n;
    cin >> n;
    string s;
    cin >> s;
    int tmp=0;
    int ans =0;
    rep(i,s.length()){
        if(s[i] == 'D')tmp-=1;
        else tmp +=1;
        chmax(ans,tmp);
    }
    print(ans);

    
    return 0;

}


Measured memory_bytes: 3604
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}
template<class T> bool lcmp(const pair<T, T>& l, const pair<T, T>& r) {
  return l.first < r.first;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  // A*B < N を満たす正整数A,Bの組

  i64 r = 0;
  FOR(A, 1, N) {
    int a = (N - 1) / A;
    if (a > 0) {
      r += a;
    }
  }
  cout << r;
}
#endif


Measured memory_bytes: 3648
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#endif


typedef long long ll; 
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
const ll mod = 998244353;
 
#define mp make_pair
#define pb push_back
#define lb lower_bound

ll binpow(ll a, ll n) {
	if (n == 0)
		return 1;
	if (n % 2 != 0) return binpow(a, n-1)*a; else {
		ll b = binpow(a, n/2);
		return b*b;
	}
}

ll gcd(ll a, ll b) {
	while(b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

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

void solve() {
	int n;
	cin >> n;
	int ans = (n/500) * 1000;
	n %= 500;
	ans += (n/5) * 5;
	cout << ans << endl;
}
 
int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int ans = inf;
	for (int i = 0; i <= 300000; ++i) {
		int tmp_c = i;
		int tmp_cost = i * c;
		int tmp_a = max(0, x - tmp_c / 2);
		int tmp_b = max(0, y - tmp_c / 2);
		int add_cost = tmp_a * a + tmp_b * b;
		mins(ans, tmp_cost + add_cost);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod=1e9+7;

ll t[101010];
ll a[101010];

ll h[101010];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>t[i];
	}
	for (int i=1;i<=n;i++){
		cin>>a[i];
	}
	ll v=1;
	for (int i=1;i<=n;i++){
		if (t[i]>t[i-1]) {
			h[i]=t[i];
			continue;
		}
		if (a[i]>a[i+1]) {
			h[i]=a[i];
			continue;
		}
		v*=min(t[i], a[i]);
		v%=mod;
	}
	ll ma=0;
	for (int i=1;i<=n;i++){
		ma=max(ma, h[i]);
		if (ma>t[i]){
			cout<<0<<endl;
			return 0;
		}
	}
	ma=0;
	for (int i=n;i>=1;i--){
		ma=max(ma, h[i]);
		if (ma>a[i]){
			cout<<0<<endl;
			return 0;
		}
	}
	cout<<v<<endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string x;
	cin>>x;
	string y;
	cin>>y;
	ll n;
	n=x.length();
	ll m;
	m=y.length();
	bool ans=true;
	ll i;
	for(i=0;i<n;i++)
	{
		if(x[i]==y[i])
		{
			ans=true;		
		}
		else
		{
			ans=false;
			break;
		}
	}
	if(ans==true)
	{
		cout<<"Yes"<<"\n";	
	}
	else
	{
		cout<<"No"<<"\n";
	}		
	return 0;
}


Measured memory_bytes: 3568
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

using namespace std;

using ll = long long;
using ld = long double;

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); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve(ll N, ll A, ll B) {
  if (N > A * B) { cout << -1 << endl; return; }
  if (N < A + B - 1) { cout << -1 << endl; return; }
  set<pair<ll,ll>> s;
  REP(i,A) s.emplace(i, 0);
  REP(i,A) {
    if (int(s.size()) >= N) break;
    REP(j,B) {
      if (int(s.size()) >= N) break;
      if (j == 0) continue;
      s.emplace(i, j);
    }
  }
  vector<ll> vec;
  for (auto p: s) vec.push_back(p.first * 1000000LL - p.second);
  assert(int(vec.size()) == N);
  vector<ll> sorted = vec;
  sort(ALL(sorted));
  REP(i,N) {
    int pos = lower_bound(ALL(sorted), vec[i]) - begin(sorted);
    cout << pos + 1 << " \n"[i == N - 1];
  }
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll B;
	ll N;
	ll A;
	scanf("%lld", &N);
	scanf("%lld", &A);
	scanf("%lld", &B);
	solve(N, A, B);
	return 0;
}


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

using namespace std;

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

#define reps(i,f,n) for(int i = int(f); i <= int(n); i++)
#define rep(i,n) reps(i,0,int(n)-1)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)

#define all(x) (x).begin(),(x).end()
#define X first
#define Y second

#define sz size()
#define eb emplace_back
#define pb push_back


vector<pii> lr;
const bool DEBUG=false;
 // ||
int main(void){
  int n, k;
  string str;
  cin >> n >> k;
  cin >> str;

  rep(i,n){
    if(lr.size() != 0 && lr[lr.size()-1].X == str[i]){
      lr[lr.size()-1].Y++;
    }else{
      lr.eb(make_pair(str[i], 1));
    }
  }
  if(DEBUG){
    rep(i, lr.size()){
      cout << lr[i].X << ", " << lr[i].Y << endl;
    }
  }

  rep(i, k){
    if(lr.size() <= 2){
      if(lr.size() == 2){
        lr[0].Y += lr[1].Y;
        lr.resize(1);
      }
    }else{
      lr[lr.size()-3].Y += lr[lr.size()-2].Y + lr[lr.size()-1].Y;
      lr.resize(lr.size()-2);
    }
  }
  int ans = 0;
  rep(i, lr.size()){
    ans += (lr[i].Y-1);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1528
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
    string str[3];
    rep(i, 3) cin >> str[i];

    int pt[3] = {0, 0, 0};
    int turn = 0;
    while (pt[turn] < str[turn].size()) {
        turn = str[turn][pt[turn]++] - 'a';
    }

    cout << (char)(turn + 'A') << endl;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
check = True
ans = True
i = 0
j = 0
count = 0
while check:
    if a[j]==i+1:
        i += 1
        count = i
    j += 1
    if j==n:
        check = False

if count!=0:
    print(n-i)
else:
    print("-1")


Measured memory_bytes: 25768
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<ll> A(n);
  for (auto &x : A)
    cin >> x;
  sort(A.begin(), A.end());
  if (A[0] == 0) {
    cout << 0 << endl;
    return 0;
  }
  long double inf = 1000000;
  inf = inf * inf * inf;
  // cerr << inf << endl;
  ll ans = 1;
  for (auto &x : A) {
    if (ans > inf / x) {
      cout << -1 << endl;
      return 0;
    }
    ans *= x;
  }
  if (ans > inf)
    cout << -1 << "\n";
  else
    cout << ans << "\n";
}

Measured memory_bytes: 4004
#include <stdio.h>

int main () {
	int N, T;
	int i;
	int min_c = 2000;
	scanf ("%d %d", &N, &T);

	int c[N];
	int t[N];
	
	for (i = 0; i < N; i++) {
		scanf ("%d %d", &c[i], &t[i]);
	}

	for (i = 0; i < N; i++) {
		if (c[i] < min_c && t[i] <= T)
			min_c = c[i];
	}

	if (min_c == 2000)
		printf ("TLE\n");
	else
		printf ("%d\n", min_c);
	
	return 0;
}

Measured memory_bytes: 128
S = input()
boxes = [0] * len(S)

R_count = 0
L_count = 0
tmp = 'R'
for i in range(len(S)):
    if i == 0:
        R_count += 1
        continue

    if S[i] == 'R':
        R_count += 1
        if tmp == 'L':
            boxes[i-L_count-1] += L_count // 2
            boxes[i-L_count] += L_count // 2 + L_count % 2
            L_count = 0
    else:
        L_count += 1
        if tmp == 'R':
            boxes[i-1] += R_count // 2 + R_count % 2
            boxes[i] += R_count // 2
            R_count = 0
        if i == len(S) - 1:
            boxes[i-L_count] += L_count // 2
            boxes[i-L_count+1] += L_count // 2 + L_count % 2
    tmp = S[i]
print(" ".join(map(lambda v: str(v), boxes)))


Measured memory_bytes: 10484
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

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); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

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

signed main(void)
{
  int n, a, b;
  cin >> n >> a >> b;

  int ret = 0;
  FOR(i, 1, n+1) {
    string s = to_string(i);
    int tmp = 0;
    REP(j, s.size()) {
      tmp += s[j] - '0';
    }
    if(a <= tmp && tmp <= b) ret += i;
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	
	priority_queue<pair<int,int> > h;
	while(a--)
	{
		int w;
		cin>>w;
		h.push(make_pair(w,1));
	}
	while(b--)
	{
		int w;
		cin>>w;
		h.push(make_pair(w,2));
	}
	while(c--)
	{
		int w;
		cin>>w;
		h.push(make_pair(w,3));
	}
	int z=x+y,ans=0;
	while(z)
	{
		pair<int,int> f=h.top();
		h.pop();
		if(f.second==3)
		{
			ans+=f.first;
			z--;
		}
		if(f.second==1 && x)
		{
			ans+=f.first;
			z--;
			x--;
		}
		if(f.second==2 && y)
		{
			ans+=f.first;
			z--;
			y--;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 10476
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
    vector<int> arr(n);
    for(int i=0;i<n;i++){
    	cin>>arr[i];
	}
	long long int g=arr[n-1];
	long long int ans=0;
	long long int mod=1000000007;
	for(int i=n-2;i>=0;i--){
		ans=(ans%mod+((arr[i]%mod)*(g%mod))%mod)%mod;
		g=(g%mod+arr[i]%mod)%mod;
	}
	cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3996
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int L = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		System.out.println(L - Math.max((A + C - 1) / C, (B + D - 1) / D));
	}

}

Measured memory_bytes: 17292
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

count = 0
for i in range(len(S)):
	if i%2 == 0:
		if S[i] == "1":
			count += 1
	else:
		if S[i] == "0":
			count += 1

count2 = 0
for i in range(len(S)):
	if i%2 == 0:
		if S[i] == "0":
			count2 += 1
	else:
		if S[i] == "1":
			count2 += 1

print(min(count, count2))

Measured memory_bytes: 61420
#include <iostream>
#include <cmath>
#include <iomanip>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>

#define int64 long long
using namespace std;

int main()
{
	int aa, bb;
	cin >> aa >> bb;
	cout << (aa * bb) << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int N = S.size();
    vector<int> A(N, 0);
    int temp = 1;
    for (int i = 0; i < 100; i++) {
        temp *= 10;
        temp %= N;
    }
    int r = 0, l = 0, li;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') {
            if (l != 0) {
                A[li] = (l+r)/2;
                A[li-1] = (l+r)/2;
                if ((l+r)%2 == 1) {
                    A[li-(r%2)]++;
                }
                r = l = 0;
            }
            r++;
        } else {
            if (l == 0) {
                li = i;
            }
            l++;
        }
    }
    A[li] = (l+r)/2;
    A[li-1] = (l+r)/2;
    if ((l+r)%2 == 1) {
        A[li-(r%2)]++;
    }
    for (int i = 0; i < N; i++) {
        printf("%d%c", A[i], i == N-1 ? '\n' : ' ');
    }
    return 0;
}

Measured memory_bytes: 1104
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
  int i;
  int K,A,B;
  long cnt = 0;
  scanf("%d", &K);
  scanf("%d %d", &A, &B);
  if (K == 1) {
    printf("OK\n");
    return 0;
  }
  if (A == B) {
    if ((A / K )*K == A) {
      printf("OK\n");
    } else {
      printf("NG\n");
    }
    return 0;

  }
  int c;
  if (A % K == 0) {
    c = (A / K);
  } else {
    c = (A / K) + 1;
  }
    int d = B / K;
    if (c <= d) {
      printf("OK\n");
    } else {
      printf("NG\n");
    }
    return 0;
  }


Measured memory_bytes: 2088
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] lines=br.readLine().split(" ");
        double r=Double.parseDouble(lines[0]);
        System.out.printf("%f %f",Math.PI*r*r,2.0*Math.PI*r);
    }
}

Measured memory_bytes: 24620
#include <stdio.h>
#include <string.h>
#include <math.h>
int mini(int a, int b){
    if (a>=b) return b;
    else return a;
}
int main ()
{
    int c=0, c2=0;
    char s[100005];
    scanf ("%s", s);
    for (int i=1;i<strlen(s);i=i+1) {
        if (s[0]=='0') {
            if (i%2==1 && s[i]=='0') c++;
            else if (i%2==0 && s[i]=='1') c++;
        }
        else {
            if (i%2==1 && s[i]=='1') c++;
            else if (i%2==0 && s[i]=='0') c++;
        }
    }

    for (int i=strlen(s)-1;i>=0;i=i-1) {
            if (strlen(s)%2==1) {

        if (s[strlen(s)-1]=='0') {
            if (i%2==1 && s[i]=='0') c2++;
            else if (i%2==0 && s[i]=='1') c2++;
        }
        else {
            if (i%2==1 && s[i]=='1') c2++;
            else if (i%2==0 && s[i]=='0') c2++;
        }
    }

    else {
        if (s[strlen(s)-1]=='0') {
            if (i%2==1 && s[i]=='1') c2++;
            else if (i%2==0 && s[i]=='0') c2++;
        }
        else {
            if (i%2==1 && s[i]=='0') c2++;
            else if (i%2==0 && s[i]=='1') c2++;
        }
    }

    }

    printf ("%d", mini(c, c2));
    return 0;
}


Measured memory_bytes: 1832
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
  int a;
  cin >> a;
  int ans = 0;

  vector<int> b(a);
  rep(i,a){
    cin >> b[i];
  }
  rep(i,a){
    bool flag = true;
    for(int j=0;j<i;j++)
     {
       if(b[j]>b[i]){

       flag = false;
         break;
       }
     }
     if(flag) ++ans;
  }
  cout << ans << endl;
 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<map>
using namespace std;
int main(){
	long long a,b,ans=0;
    int cnt;
	cin>>a;
	for(long long i=2;i*i<=a;i++){
		int cnt=0;
		if(a%i==0){
		while(a%i==0){
			cnt++;
			a=a/i;
		}}
		for(int j=1;j<=cnt;cnt-=j,j++)
		ans++;
		
	}
	if(a>1)
	ans++;
	cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
#define N 200005
const ll INF = 1000000000000000001;
const ll MOD = 1000000007;

//vector< vector<ll> > g(N);
//vector< pair<ll, pair< ll, ll > > > g(N);
//ll vis[N] = {0}, par[N] = {0}, child[N] = {0},cnt = 0;


void solve(){
    ll n; cin >> n;
    string s;
    unordered_map<string , ll> mp;
    while(n--){
        cin >> s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << "\n";
    cout << "WA x " << mp["WA"] << "\n";
    cout << "TLE x " << mp["TLE"] << "\n";
    cout << "RE x " << mp["RE"] << "\n";

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
   //ll t;cin >> t;for(ll index=1; index<=t; index++){
        //cout << "Case #" << index << ": " ;
        solve();
   // }
    return 0;
}

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

   int a,b;
   cin>>a>>b;
if((a==1||a==5||a==7||a==3||a==10||a==12||a==8)&&(b==1||b==5||b==7||b==3||b==10||b==12||b==8))
    {
        cout<<"Yes"<<endl;
    }

else if((a==4||a==6||a==9||a==11)&&(b==4||b==6||b==9||b==11))
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}





Measured memory_bytes: 256
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# a, b
# s = input()

A, B, C, D = list(map(int, input().split()))
ans = True

while True:
    if ans:
        C -= B
        if C <= 0:
            break
        ans = False
    else:
        A -= D
        if A <= 0:
            break
        ans = True

if ans:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9192
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FAST            ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll              long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vll             vector<long long>
#define all(a)          (a).begin(),(a).end()
#define clz(a)          __builtin_clz(a) // count leading zeroes
#define ctz(a)          __builtin_ctz(a) // count trailing zeroes
#define popc(a)         __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul             1000000007
#define rep(i,a,b)      for(int i=a;i<b;i++)
#define rfor(i,a,b)     for(int i=a; i>=b; i--)
#define debug(x)        cerr << #x << " = " << x << endl;
#define F               first
#define S               second
#define mod             998244353 
#define pll             pair<ll,ll>
#define endl            '\n'
#define SIZE            1000005
#define deci(n)         cout<<fixed<<setprecision(n)
#define ordered_set     tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key(k)
// find_by_order(k)
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%lul;
        a = (a * a)%lul;
        b >>= 1;
    }
    return res;
}
void solve()
{
    int n; cin>>n;
    int a[n];
    rep(i,0,n) cin>>a[i];
    rep(i,0,n)
    {
        if(a[i]%2 == 0)
        {
            if(a[i]%3!=0 and a[i]%5!=0)
            {
                cout<<"DENIED";
                return;
            } 
        }
    }
    cout<<"APPROVED";
}
int main()
{   
    FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; /*cin>>t;*/ t=1;
    rep(i,1,t+1){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256