akhauriyash/Code-Regression huggingface dataset:
/*
AtCoder Beginner Contest 177- B - Substring
https://atcoder.jp/contests/abc177/tasks/abc177_b
*/

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)


void solve() {

}

int main()
{
    FAST_INP;
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt","r", stdin);
//    freopen("output.txt","w", stdout);
//    #endif
//
//    int tc; cin >> tc;
//    TC(tc) solve();
	string s, t;
	cin >> s >> t;
	int m=s.size(), n=t.size(), ans=INT_MAX;
	REP(i,m-n+1){
		int cnt=0;
		REP(j,n) cnt+=(s[i+j]!=t[j]);
		MIN(ans,cnt);
	}
	OUT(ans);
    return 0;
}


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

bool check(char x, char y){
    if(x > y)   swap(x, y);
    return (x=='('&&y==')') || (x=='{'&&y=='}') || (x=='['&&y==']');
}

int main(){
    string s;   cin >> s;
    int x = s.find('i');
    string a = s.substr(0, x), b = s.substr(x+3);
    reverse(a.begin(), a.end());
    if(a.length() > b.length()) swap(a,b);
    int ans = 0;
    for(int i = 1; i < 1<<(a.length()); i++){
        string t = "";
        for(int j = 0; j < a.length(); j++) if((i>>j)&1)    t += a.substr(j,1);
        int cur = 0;
        for(int j = 0; cur < t.length() && j < b.length(); j++){
            if(check(t[cur], b[j]))  cur++;
        }
        if(cur == t.length())   ans = max(ans, cur);
    }
    cout << 2*ans+3 << endl;
    return 0;
}


Measured memory_bytes: 3212
def main():
    n = int(input())
    s = input()
    divider = pow(10, 9) + 7
    if s[0] == "W" or s[2 * n - 1] == "W":
        print(0)
        return
    lr = [True]
    for i in range(1, 2 * n - 1):
        if s[i - 1] == s[i]:
            lr.append(not lr[i - 1])
        else:
            lr.append(lr[i - 1])
    lr.append(False)
    ret = 1
    cnt = 0
    for i in range(2 * n):
        if lr[i]:
            cnt += 1
        else:
            ret *= cnt
            ret %= divider
            cnt -= 1
    if not cnt == 0:
        print(0)
        return
    for i in range(n):
        ret *= i + 1
        ret %= divider
    print(ret)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 4916
N, M = map(int, input().split())
H = list(map(int, input().split()))
Height = []
Good = []
for i in range(N):
    Height.append(H[i])
    Good.append(0)
for i in range(M):
    A, B = map(int, input().split())
    if Height[A - 1] < Height[B - 1]:
        Good[A - 1] = 1
    elif Height[A - 1] > Height[B - 1]:
        Good[B - 1] = 1
    else:
        Good[A - 1] = 1
        Good[B - 1] = 1
n = 0
for i in range(N):
    if Good[i] == 0:
        n += 1
print(n)


Measured memory_bytes: 89812
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005 ;
int dp[MAXN] ;
int h[MAXN] ;
int n , k ;
int main(){
    cin >> n >> k ;
    for ( int i = 1 ; i <= n ; i++ ){
        cin >> h[i] ;
    }
    dp[1] = 0 ;
    dp[2] = abs( h[2] - h[1] ) ;
    for ( int i = 3 ; i <= n ; i++ ){
        dp[i] = INT_MAX ;
        for ( int l = 1 ; l <= k ; l++ ){
            if ( i - l == 0 )
                break ;
            int t = dp[i-l] + abs( h[i] - h[i-l] ) ;
            dp[i] = min ( dp[i] , t ) ;
        }
    }
    cout << dp[n] ;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int a =0;
  int b =0;
  scanf("%d %d", &a , &b);
  if(a<b){
    printf("a < b\n");
  }
  else if(a>b){
    printf("a > b\n");
  }
  else if(a==b){
    printf("a == b\n");
  }
  return 0;
}
  



Measured memory_bytes: 2092
#include <vector>
#include <math.h>
#include <iostream>

using namespace std;

int main(){

  int N, K;
  cin >> N >> K;
  vector<int> h;
  for(int i=0; i<N; i++){
    int height;
    cin >> height;
    h.push_back(height);
  }

  vector<int> C(N, (int)2e9);

  C[0] = 0;
  C[1] = (int)abs(h[1] - h[0]);
  for(int i = 2; i < N; i++){
    C[i] = (int)2e9;
    for(int j=i-1; (j >= i - K) && (j >= 0); j--){
      C[i] = (int)min(C[i], C[j] + (int)abs(h[j] - h[i]));
    }
  }

  
  cout << C[N-1] << "\n";
  
  return 0;
}


Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1e9 + 7
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main() {
    ll a, b, h, m;
    cin >> a >> b >> h >> m;
    long double angle = (pi * ((11.0 * m) / 2.0 - 30.0 * h)/180);
    long double ans = b * b + a * a - 2 * b * a * cosl(angle);
    cout << fixed << setprecision(20) << sqrtl(ans) << "\n";

}



Measured memory_bytes: 4044
#include <stdio.h>

#define MAX 1000000

int isPrime[MAX];

int main(){
    int num;
    int i, j;
    int count;
    
    // ??????????????????
    isPrime[0] = isPrime[1] = 0;
    for(i = 2; i < MAX; i++){
        isPrime[i] = 1;
    }
    
    // ??¨??????????????????????????????
    for(i = 2; i * i < MAX; i++){
        if(isPrime[i]){
            // i????????°????´???°?????????????????§????????°?????´
            for(j = 2 * i; j < MAX; j+=i){
                isPrime[j] = 0;
            }
        }
    }

    while(scanf("%d", &num) != EOF){
        count = 0;
        while(num){
            count += isPrime[num--];
        }
        printf("%d\n", count);
    }

    return 0;
}

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

int main(){
    string str;
    cin >> str;
    int num0=0,num1=0;
    for(int i=0;i<str.size();i++){
        if(str[i]=='0') num0++;
        if(str[i]=='1') num1++;
    }
    if(num0<num1) cout << num0*2;
    else cout << num1*2;
}

Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class ATakahashikunTheStrider {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        int X;
        in>>X;
        for(int i=1;;++i){
            if(X*i%360==0){
                out<<i<<'\n';
                return;
            }
        }
    }
};


int main() {
	ATakahashikunTheStrider solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        sc.next();
        sc.next();
        sc.next();
        int e = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        
        if(e-a > k){
            System.out.println(":(");
        }else{
            System.out.println("Yay!");
        }
    }
}

Measured memory_bytes: 21844
'use strict';
(function(stdin) {
  var inputs  = stdin.toString();
  var r = Number(inputs);
  //r= Number(r);
  var cicrlearea= r*r*Math.PI
  var cicr= 2*r*Math.PI
  

  console.log(cicrlearea.toFixed(5),cicr.toFixed(5));
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15604
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
const int maxn = 2e5 + 7;

LL a[maxn],f[maxn];
int n;

bool check(LL x,LL k) {
    for(int i = 1 , j = n ; i <= n ; i++ , j--) {
        LL temp = a[i] * f[j];
        if(temp > x) {
            k -= (temp - x) / f[j];
            if((temp - x) % f[j] != 0) k--;
        }
        if(k < 0) break;
    }
    if(k >= 0) return true;
    else return false;
}

int main() {
    LL k;
    while(~scanf("%d%lld",&n,&k)) {
        for(int i = 1 ; i <= n ; i++) {
            scanf("%lld",&a[i]);
        }
        for(int i = 1 ; i <= n ; i++) {
            scanf("%lld",&f[i]);
        }
        sort(a+1,a+n+1);
        sort(f+1,f+n+1);
        LL l = 0 , r = a[n]*f[n];
        LL ans = 0;
        while(l <= r) {
            LL mid = (l + r + 1LL) >> 1;
            if(check(mid,k)) {
                ans = mid;
                r = mid - 1;
            } else {
                l = mid + 1;
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}



Measured memory_bytes: 3328
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int A, B;
  cin >> A >> B;
  int ans;
  ans = A * B - (A + B - 1);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define Flash ios_base::sync_with_stdio(false); cin.tie(NULL)
#define all(v) v.begin(),v.end()
#define rev(v) reverse(all(v))
#define sot(v) sort(all(v))
#define rsot(v) sort(all(v),greater<int>())
#define printa(a,L,R) for(int i=L;i<R;i++) cout<<a[i]<<(i==R-1?'\n':' ')
#define printv(a) printa(a,0,a.size())
#define print2d(a,r,c) for(int i=0;i<r;i++) for(int j=0;j<c;j++) cout<<a[i][j]<<(j==c-1?'\n':' ')
#define mem(a,x) memset(a,x,sizeof(a))
#define N 500007
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

double dp[307][307][307];
int main() {
    Flash;
    int n, c1 = 0, c2 = 0, c3 = 0, x;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> x;
        switch(x) {
            case 1: c1 += 1; break;
            case 2: c2 += 1; break;
            case 3: c3 += 1; break;
        }
    }
    for(int k = 0; k < n + 5; k++) {
        for(int j = 0; j + k < n + 5; j++) {
            for(int i = 0; i + j + k < n + 5; i++) {
                dp[i][j][k] = 0.0;
                if(i != 0 || j != 0 || k != 0) {
                    dp[i][j][k] += 1.0 * n / (i + j + k);
                }
                if(i > 0) {
                    dp[i][j][k] += dp[i-1][j][k] * i / (i + j + k);
                }
                if(j > 0) {
                    dp[i][j][k] += dp[i+1][j-1][k] * j / (i + j + k);
                }
                if(k > 0) {
                    dp[i][j][k] += dp[i][j+1][k-1] * k / (i + j + k);
                }
            }
        }
    }
    cout << setprecision(10) << dp[c1][c2][c3];
    return 0;
}


Measured memory_bytes: 225536
#include <iostream>
#include <cmath>
#include <cstdio>
#define LL long long
using namespace std;
const int MAX=2e5+3;
LL a[MAX];
LL rin()
{
	LL s=0;
	char c=getchar();
	bool bj=false;
	for(;(c>'9'||c<'0')&&c!='-';c=getchar());
	if(c=='-')bj=true,c=getchar();
	for(;c>='0'&&c<='9';c=getchar())s=(s<<1)+(s<<3)+(c^'0');
	if(bj)return -s;
	return s;
}
int main()
{
	int i,j;
	LL n,k;
	LL l,r;
	LL s_0;
	n=rin();k=rin();
	for(i=1;i<=n;i++)a[i]=rin();
	sort(a+1,a+n+1);
//	for(i=1;i<=n;i++)printf("%lld ",a[i]);printf("\n");
	l=1,r=n;
	LL n_1=0,n_2=n+1;
	for(;l<=r;){LL mid=(l+r)>>1;if(a[mid]<0)n_1=mid,l=mid+1;else r=mid-1;}
	l=1;r=n;
	for(;l<=r;){LL mid=(l+r)>>1;if(a[mid]>0)n_2=mid,r=mid-1;else l=mid+1;}
	
	LL nam_0=n_2-n_1-1;
	s_0=nam_0*(n-nam_0)+(nam_0*(nam_0-1)/2);
	if(nam_0>0)for(i=n_1+1,j=n_2;j<=n;j++,i++)a[i]=a[j];
	n-=nam_0;
//	printf("n_1:%lld,n_2:%lld\ns_0:%lld\n",n_1,n_2,s_0);
	r=(1LL<<60);
	l=-r;
	LL ans=0;
	for(;l<=r;)
	{
		LL mid=(l+r)>>1;
		LL sum=0;
		int last;
		for(i=1;i<=n_1;i++)
		{
			last=n+1;
			int l_1=1,r_1=n;
			for(;l_1<=r_1;)
			{
				int m_1=(l_1+r_1)>>1;
				if(a[m_1]*a[i]<mid)last=m_1,r_1=m_1-1;
				else l_1=m_1+1;
			}
//			printf("mid:%lld a[%d](%lld)*a[%d](%lld)  sum:%lld-->",mid,i,a[i],last,a[last],sum);
			sum+=n-last+1;
			if(last<=i)sum--;
//			printf("%lld\n",sum);
		}
		
		for(i=n_1+1;i<=n;i++)
		{
			last=0;
			int l_1=1,r_1=n;
			for(;l_1<=r_1;)
			{
				int m_1=(l_1+r_1)>>1;
				if(a[m_1]*a[i]<mid)last=m_1,l_1=m_1+1;
				else r_1=m_1-1;
			}
//			printf("mid:%lld a[%d](%lld)*a[%d](%lld)  sum:%lld-->",mid,i,a[i],last,a[last],sum);
			sum+=last;
			if(last>=i)sum--;
//			printf("%lld\n",sum);
		}
	//	printf("l:%lld,r:%lld,mid:%lld ,sum:%lld\n",l,r,mid,sum);
		sum>>=1;if(mid>0)sum+=s_0;
//		printf("sum:%lld\n",sum);
		if(sum>=k)r=mid-1;
		else ans=mid,l=mid+1;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 4628
n = int(input())

l = [[0, 0, 0] for _ in range(n-1)]

for i in range(n-1):
  c, s, f = map(int, input().split())
  l[i][0] = c
  l[i][1] = s
  l[i][2] = f

for i in range(n-1):
  t = l[i][1] + l[i][0]
  for j in range(i+1, n-1):
    if t%l[j][2] == 0 and t >= l[j][1]:
      pass
    elif t%l[j][2] != 0 and t >= l[j][1]:
      t = (t//l[j][2]+1)*l[j][2]
    else:
      t = l[j][1]
    t += l[j][0]
  print(t)
else:
  print(0)
  


Measured memory_bytes: 3188
// https://atcoder.jp/contests/abc077/tasks/abc077_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int t = sqrt(n);
    cout << t * t << endl;

    return 0;
}


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

/**
 * 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);
        DMegalomania solver = new DMegalomania();
        solver.solve(1, in, out);
        out.close();
    }

    static class DMegalomania {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            ArrayList<Vec2l> jobs = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                jobs.add(new Vec2l(in.nextLong(), in.nextLong()));
            }
            jobs.sort(Comparator.comparing(v -> v.y));
            long time = 0;
            for (int i = 0; i < n; i++) {
                time += jobs.get(i).x;
                if (time > jobs.get(i).y) {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
        }

    }

    static class Vec2l {
        public long x;
        public long y;

        public Vec2l(long x, long y) {
            this.x = x;
            this.y = y;
        }

        public String toString() {
            return "Vec2l{" +
                    "x=" + x +
                    ", y=" + y +
                    '}';
        }

        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Vec2l vec2l = (Vec2l) o;
            return x == vec2l.x &&
                    y == vec2l.y;
        }

        public int hashCode() {
            return Objects.hash(x, y);
        }

    }
}



Measured memory_bytes: 69704
#include <cstdio>
#include <vector>

const int mod = 998244353;
#define maxm 1000010
int sum[maxm], sum2[maxm], val[maxm];
#define maxn 200010
int a[maxn];
inline int qpow(int base, int power)
{
	int ret = 1;
	for (; power; power >>= 1, base = 1ll * base * base % mod)
		power & 1 ? ret = 1ll * ret * base % mod : 0;
	return ret;
}
int main()
{
	int n; scanf("%d", &n);
	const int inv2 = 499122177;
	for (int i = 1; i <= n; ++i)
	{
		int x; scanf("%d", &x);
		for (int j = 1; j * j <= x; ++j)
			if (x % j == 0)
			{
				(sum[j] += x) %= mod;
				sum2[j] = (sum2[j] + 1ll * x * x) % mod;
				if (j * j != x)
				{
					(sum[x / j] += x) %= mod;
					sum2[x / j] = (sum2[x / j] + 1ll * x * x) % mod;
				}
			}
	}
	for (int i = 1; i < maxm; ++i)
		val[i] = (1ll * sum[i] * sum[i] % mod - sum2[i] + mod) % mod * inv2 % mod;
	int ans = 0;
	for (int i = maxm - 1; i; --i)
	{
		for (int j = 2 * i; j < maxm; j += i)
			(val[i] += mod - val[j]) %= mod;
//		if (i <= 10) printf("val[%d] = %d\n", i, val[i] );
		ans = (ans + 1ll * val[i] * qpow(i, mod - 2)) % mod;
	}
	printf("%d\n", ans );
	return 0;
}

Measured memory_bytes: 11904
package main

import (
	"fmt"
	"sort"
)

type frequency struct {
	target int
	count  int
}

type fsort []frequency

func (f fsort) Len() int           { return len(f) }
func (f fsort) Swap(i, j int)      { f[i], f[j] = f[j], f[i] }
func (f fsort) Less(i, j int) bool { return f[i].count < f[j].count }

func main() {
	var n int
	fmt.Scan(&n)
	v := make([]int, n)
	for i := range v {
		fmt.Scan(&v[i])
	}

	ov := make(map[int]int)
	ev := make(map[int]int)
	for vi, vv := range v {
		if vi%2 == 0 {
			ev[vv]++
		} else {
			ov[vv]++
		}
	}

	var of, ef []frequency
	for k, v := range ov {
		of = append(of, frequency{target: k, count: v})
	}
	for k, v := range ev {
		ef = append(ef, frequency{target: k, count: v})
	}
	sort.Sort(fsort(of))
	sort.Sort(fsort(ef))

	if of[len(of)-1].target != ef[len(ef)-1].target {
		fmt.Println(n - of[len(of)-1].count - ef[len(ef)-1].count)
		return
	}
	if of[len(of)-1].count > ef[len(ef)-1].count {
		if len(ef)-2 >= 0 {
			fmt.Println(n - of[len(of)-1].count - ef[len(ef)-2].count)
		} else {
			fmt.Println(n - of[len(of)-1].count)
		}
	} else if of[len(of)-1].count < ef[len(ef)-1].count {
		if len(of)-2 >= 0 {
			fmt.Println(n - ef[len(ef)-1].count - of[len(of)-2].count)
		} else {
			fmt.Println(n - ef[len(ef)-1].count)
		}
	} else {
		if len(of) == 1 && len(ef) == 1 {
			fmt.Println(n - of[len(of)-1].count)
			return
		}
		if of[len(of)-2].count > ef[len(ef)-2].count {
			fmt.Println(n - of[len(of)-2].count - ef[len(ef)-1].count)
		} else {
			fmt.Println(n - ef[len(ef)-2].count - of[len(of)-1].count)
		}
	}
}


Measured memory_bytes: 11136
N = int(input())

rest_dict = {}
for i in range(N):
    s, p = input().split()
    p = int(p)
    if s in rest_dict:
        rest_dict[s].append((i, p))
    else:
        rest_dict[s] = [(i, p)]

cities = list(rest_dict.keys())
cities.sort()
for city in cities:
    rest_dict[city].sort(key=lambda r: r[1], reverse=True)
    for rest in rest_dict[city]:
        print(rest[0]+1)


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

N = int(input())
L = list(map(int, input().split()))

answer = 0
for i in range(N):
  Li = L[i]
  if N-i < 3:
    break
  for j in range(i+1,N):
    Lj = L[j]
    if N-j < 2:
      break
    if Li==Lj:
      continue
    for k in range(j+1,N):
      Lk = L[k]
      if Lk==Li or Lk==Lj:
        continue
      if 2*max(Li,Lj,Lk)<Li+Lj+Lk:
        answer += 1

print(answer)

Measured memory_bytes: 9204
import bisect,sys
input = sys.stdin.readline
a,b,q = map(int,input().split())
INF = float('inf')
S = [-INF]+[int(input()) for i in range(a)]+[INF]
T = [-INF]+[int(input()) for i in range(b)]+[INF]

def f(S,T):
    res = INF
    s = bisect.bisect_left(S,x)
    for i in range(2):
    	for j in range(2):
            t = bisect.bisect_left(T,S[s-i])
            ans= abs(x-S[s-i])+abs(S[s-i]-T[t-j])
            if ans < res:
                res = ans
    return res

for i in range(q):
    x = int(input())
    print(min(f(S,T),f(T,S)))


Measured memory_bytes: 94300
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=str(input())
li=[]
ans=0
for i in range(len(t)):
    li.append(t[i])
    if i<k:
        if li[i]=="r":
            ans+=p
        elif li[i]=="s":
            ans+=r 
        else:
            ans+=s 
    else:
        if li[i]==li[i-k]:
            li[i]=0
            ans+=0
        elif li[i]=="r":
            ans+=p
        elif li[i]=="s":
            ans+=r 
        else:
            ans+=s 
print(ans)

Measured memory_bytes: 4212
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 130000;
char cn[CM + 10], * ci = cn + 10, c, * owa = cn + CM;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	swap(c, ci[8]);
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	swap(c, ci[8]);
	ci += (64 - dig >> 3) + 1;

	if (ci - owa > 0) {
		memcpy(cn, owa, 10);
		ci -= CM;
		fread(cn + 10, 1, CM, stdin);
	}
	return tmp;
}

char* di = cn;
const int MAX = 200000;
class shuturyoku_unko {
public:
	char C[MAX * 6 - 100000];
	int K[MAX + 10];
	constexpr shuturyoku_unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[1] = 1;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = K[i] + keta;
		}
	}
} f;
inline void putint(ll X) {
	int ue = X / 100000;
	if (ue >= 10) {
		memcpy(di, f.C + f.K[ue], f.K[ue + 1] - f.K[ue]);
		di += f.K[ue + 1] - f.K[ue];
		int sita = X - ue * 100000ll;
		rep(i, 5 - f.K[sita + 1] + f.K[sita])* di++ = '0';
		for (int i = f.K[sita]; i < f.K[sita + 1]; i++)* di++ = f.C[i];
	}
	else if (ue) {
		*di++ = f.C[f.K[ue]];
		int sita = X - ue * 100000ll;
		rep(i, 5 - f.K[sita + 1] + f.K[sita])* di++ = '0';
		for (int i = f.K[sita]; i < f.K[sita + 1]; i++)* di++ = f.C[i];
	}
	else for (int i = f.K[X]; i < f.K[X + 1]; i++)* di++ = f.C[i];
	*di++ = '\n';
}

int B[200001];

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


	fread(ci, 1, CM, stdin);

	int N = getint();
	ll kotae = 1;
	int A[200000];
	rep(i, N) kotae += B[(A[i] = getint())]++;
	int *a = A;
	
	int amari = N % 10800;
	int shou = N / 10800;
	rep(j, shou) {
		rep(k, 10800) putint(kotae - B[*a++]);
		fwrite(cn, 1, di - cn, stdout);
		di = cn;
	}
	rep(k, amari) putint(kotae - B[*a++]);
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 3712
print(*[11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601, 631, 641, 661, 691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201, 1231, 1291, 1301, 1321, 1361, 1381][:int(input())])

Measured memory_bytes: 3064
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]

count = 0
for i in range(N):
    minj = i
    for j in range(i+1, N):
        if A[j] < A[minj]:
            minj = j

    if i != minj:
        A[i], A[minj] = A[minj], A[i]
        count += 1

print(*A)
print(count)


Measured memory_bytes: 5612
#include <bits/stdc++.h>
#define ll long long  int
#define N 1000
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.14159265
#define cot cout.tie(0)
using namespace std;
/**
        * @author :: Sawlani
        *
        */

int main()
{
      ll n,m;
      cin >> n >>  m;


      if(n==1||m==1){
      cout << 1 << endl;
      return 0;}
      ll ans=0;

      ll fn = m/2+m%2;
      ll fm = m-(m/2+m%2);

    //   cout << fn << " " <<  fm << endl;

     ans=fn*(n/2+n%2)+fm*(n-(n/2+n%2));
     cout << ans << endl;
}

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

int main(){
    int lw, hi;
    cin >> lw >> hi;

    int cnt = 0;
    for (int i = lw; i <= hi; i++)
    {
        int a = i / 10000 % 10;
        int b = i % 10;
        int c = i % 10000 / 1000;
        int d = i % 100 / 10;
        if(a==b&&c==d)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
ans = 0

[X,A] = inpl()
if X < A:
    ans = 0
else:
    ans = 10

print(ans)

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

num_list = list(input())

if int(num_list[0]) + int(num_list[1]) + int(num_list[2]) + int(num_list[3]) == 7:
    print(num_list[0] + "+" + num_list[1] + "+" \
            + num_list[2] + "+" + num_list[3] + "=7")
elif int(num_list[0]) + int(num_list[1]) + int(num_list[2]) - int(num_list[3]) == 7:
    print(num_list[0] + "+" + num_list[1] + "+" \
            + num_list[2] + "-" + num_list[3] + "=7")
elif int(num_list[0]) + int(num_list[1]) - int(num_list[2]) + int(num_list[3]) == 7:
    print(num_list[0] + "+" + num_list[1] + "-" \
            + num_list[2] + "+" + num_list[3] + "=7")
elif int(num_list[0]) + int(num_list[1]) - int(num_list[2]) - int(num_list[3]) == 7:
    print(num_list[0] + "+" + num_list[1] + "-" \
            + num_list[2] + "-" + num_list[3] + "=7")
elif int(num_list[0]) - int(num_list[1]) + int(num_list[2]) + int(num_list[3]) == 7:
    print(num_list[0] + "-" + num_list[1] + "+" \
            + num_list[2] + "+" + num_list[3] + "=7")
elif int(num_list[0]) - int(num_list[1]) + int(num_list[2]) - int(num_list[3]) == 7:
    print(num_list[0] + "-" + num_list[1] + "+" \
            + num_list[2] + "-" + num_list[3] + "=7")
elif int(num_list[0]) - int(num_list[1]) - int(num_list[2]) + int(num_list[3]) == 7:
    print(num_list[0] + "-" + num_list[1] + "-" \
            + num_list[2] + "+" + num_list[3] + "=7")
elif int(num_list[0]) - int(num_list[1]) - int(num_list[2]) - int(num_list[3]) == 7:
    print(num_list[0] + "-" + num_list[1] + "-" \
            + num_list[2] + "-" + num_list[3] + "=7")

Measured memory_bytes: 3188
//package ac144;
import java.util.*;
import java.math.*;
public class Main {
	static Scanner scn = new Scanner(System.in);
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		long a = scn.nextLong();
		long b = scn.nextLong();
		double x = scn.nextLong();
		
		double vol = a*a*b;
		
		if(x==vol/2) {
			System.out.println("45.0000000000");
		}else if(x<vol/2){
			double ar = x/a;
			double base = (ar*2)/b;
			double ang = (Math.atan(b/base))*(180/Math.PI);
			System.out.println(ang);
		}else {
			double ang = (Math.atan((2*b-(2*x/(a*a)))/a)*180)/Math.PI;
			System.out.println(ang);
		}

	}

}


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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!

//

void solve(long long K) {
  ll even = K/2;
  ll odd = K/2 + (K%2==1 ? 1 : 0);
  cout << even*odd << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long K;
  std::cin >> K;
  solve(K);
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

void solve(ll N) {
  int ans{1};
  while (N) {
    ans <<= 1;
    N >>= 1;
  }
  ans >>= 1;
  cout << ans << endl;
}

int main() {
  ll N;
  cin >> N;
  solve(N);
  return 0;
}


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

#define NO 100000
#define NO2 1000000000
using namespace std;


int puz[14];

bool solve(int Spuz[]){
	int Bpuz[14];
	int tmp[3];
	bool f=true;
	for(int i=0;i<14;i++){
		Bpuz[i]=Spuz[i];
		if(Bpuz[i]!=NO&&Bpuz[i]!=NO2) f=false;
	}
	if(f) {
		return true;
	}
	sort(Bpuz,Bpuz+14);
	if(f==false){
		if(Bpuz[0]==Bpuz[1]&&Bpuz[1]==Bpuz[2]){
			for(int j=0;j<3;j++){
				tmp[j]=Bpuz[j];
			}
			Bpuz[0]=NO,Bpuz[1]=NO,Bpuz[2]=NO;
			f=solve(Bpuz);
			for(int j=0;j<3;j++){
				Bpuz[j]=tmp[j];
			}
		}
	}
	if(f==false){
		if(Bpuz[13]!=NO2){
			if(Bpuz[0]==Bpuz[1]){
				for(int j=0;j<2;j++){
					tmp[j]=Bpuz[j];
				}
				Bpuz[0]=NO2,Bpuz[1]=NO2;
				f=solve(Bpuz);
				for(int j=0;j<2;j++){
					Bpuz[j]=tmp[j];
				}
			}
		}
	}
	if(f==false){
		int ii[3]={0},cnt=1;
		ii[0]=0;
		for(int i=1;i<14;i++){
			if(Bpuz[ii[cnt-1]]!=Bpuz[i]){
				if(Bpuz[ii[cnt-1]]+1==Bpuz[i]){
					ii[cnt]=i;
					cnt++;
					if(cnt==3){
						Bpuz[ii[0]]=NO,Bpuz[ii[1]]=NO,Bpuz[ii[2]]=NO;
						f=solve(Bpuz);
						break;
					}
				}
				else break;
			}
		}
	}
	return f;
}

int main(void){

	string inp;
	int cnt,ans[10];
	int cou;
	bool fl;

	while(cin>>inp){
		for(int i=0;i<13;i++){
			puz[i]=inp[i]-'0';
		}
		cnt=0;
		for(int i=1;i<10;i++){
			puz[13]=i;
			fl=true;
			for(int j=1;j<10;j++){
				cou=0;
				for(int k=0;k<14;k++){
					if(puz[k]==j){
						cou++;
					}
				}
				if(cou>=5){
					fl=false;
					break;
				}
			}
			if(fl){
				if(solve(puz)){
					ans[cnt]=i;
					cnt++;
				}
			}
		}
		if(cnt!=0){
			for(int i=0;i<cnt-1;i++){
				cout<<ans[i]<<" ";
			}
			cout<<ans[cnt-1]<<endl;
		}
		else cout<<"0"<<endl;
	}

	return 0;
}

Measured memory_bytes: 1200
#!python3

def resolve():
    A, B, K = map(int, input().rstrip().split())

    if K < A:
        print(A-K, B)
    elif K < A + B:
        print(0, A + B -K)
    else:
        print(0, 0)


if __name__ == "__main__":
    resolve()


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

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	map<int, bool> m;
	while (n--) {
		int i;
		cin >> i;
		m[i] = !m[i];
	}
	int c = 0;
	for (auto i = m.begin(); i != m.end(); ++i) {
		if (i->second) c++;
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 4992
while(s=?/+gets.gsub(/\d+/){|k|?1*k.to_i})!~/#/
n=s.size-s.rindex(?/)-1
a,b,c,d=gets.split.map(&:to_i)
s[n*a-n+b]=?1
s[n*c-n+d]=?b
$><<s[1..-1].gsub(/1+/,&:size)
end

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> root(N);
  int n,m,i;
  int start,goal;
  for(n=0;n<M;n++){
    cin >> start >>goal;
      for(i=1;i<=N;i++){
        if(start == i || goal == i ){
          root.at(i-1) = 1 + root.at(i-1);
        }
        else{
          root.at(i-1) = root.at(i-1);
        }
    }
  }
  for(i=0;i<N;i++){
  cout << root.at(i) <<endl;
  }
}
      

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
void solve(int n){
  vector <int> num;
  for(int i=1;i<n;i++)num.push_back(i*i%n);
  sort(num.begin(),num.end());
  num.erase(unique(num.begin(),num.end()),num.end());
   
  int used[10001]={};
  for(int i=0;i<num.size();i++){
    for(int j=0;j<num.size();j++){
      if(i==j)continue;
      int a=num[i]-num[j];
      if(a<0)a+=n;
      if((n-1)/2<a)a=n-a;
      used[a]++;
    }
  }
  for(int i=1;i<=(n-1)/2;i++)cout << used[i]<<endl;
}
 
int main(){
  int n;
  while(cin>>n,n)solve(n);
  return 0;
}

Measured memory_bytes: 3240
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
#define il inline
#define re register
#define fo(i,j,k) for(register int i=j;i<=k;i++)
#define do(i,j,k) for(register int i=j;i>=k;i--) 
#define inf 0x7fffffff
typedef long long ll;
using namespace std;
il ll read()
{
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return f*x;	
}
int n; 
string s;
ll ans,a,b,c;
int main()
{
	cin>>n;
	cin>>s;
	s=" "+s;
	if(n<3)
	{
		cout<<"0";
		return 0;
	}
	fo(i,1,n)
	{
		if(s[i]=='R') a++;
		else if(s[i]=='G') b++;
		else c++;
	}
	ans=a*b*c;
	for(int i=1;i<=n-2;i++)
	{
		for(int j=i+2;j<=n;j+=2)
		{
			if(j>n) break;
			int k=(i+j)/2;
			if(s[i]!=s[j]&&s[j]!=s[k]&&s[k]!=s[i]) ans--;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#define MAX  1000
#define MIN -1000
int GetNumEqual( int *pNum );
void CompareNum( int numA, int numB );

int main( void )
{
    int getNumA , getNumB;
    
    if( 0 == GetNumEqual( &getNumA ) )
    {
        if( 0 == GetNumEqual( &getNumB ) )
        {
            CompareNum( getNumA , getNumB );
        }
    }
    return 0;
}

int GetNumEqual( int *pNum )
{
    int getNum;
    
    scanf( "%d" , &getNum );
    
    if( ( getNum >= MIN ) && ( getNum <= MAX ) )
    {
        *pNum = getNum;
        return 0;
    }
    
    return -1;
}

void CompareNum( int numA, int numB )
{
    if( numA < numB )
    {
        printf( "a < b\n" );
    }
    else if( numA > numB )
    {
        printf( "a > b\n" );
    }
    else if( numA == numB )
    {
        printf( "a == b\n" );
    }
    else
    {
    }
}

Measured memory_bytes: 1744
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, r, b;
string S;

int main(){
	cin >> N >> S;
	for (int i = 0; i < N; ++i) {
		if (S[i] == 'R')++r;
		else ++b;
	}
	if (r > b)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int A,B;
cin >> A >> B;
int T,roop;
for(roop=0;roop<2;roop++){
if(A>B){
T+=A;
A--;
}else{
T+=B;
B--;
}
}
cout << T << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
	string S;
	cin >> S;
	int ans1 = 0;
	int ans2 = 0;
	for (int i = 0; i < S.length(); i++) {
		if (i % 2 == 0) {
			if (S[i] == '0') ans1++;
			else ans2++;
		}
		else {
			if (S[i] == '0') ans2++;
			else ans1++;
		}
	}
	if (ans1 < ans2) cout << ans1 << endl;
	else cout << ans2 << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define rep(i, a, b) for (__typeof(a) i = a; i < b; i++)
#define repo(i, a, b) for (__typeof(a) i = a; i <= b; i++)
#define REPITER(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define eps 1e-6
#define pi 3.141592653589793
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define c(a) cout << a << "\n";
#define a(a)         \
    for (auto i : a) \
        cout << i << " ";
using namespace std;
template <class T>
inline T gcd(T a, T b)
{
    while (b)
        b ^= a ^= b ^= a %= b;
    return a;
}
template <class T>
inline T mod(T x)
{
    if (x < 0)
        return -x;
    else
        return x;
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PPII;
typedef vector<PII> VPII;
typedef vector<PPII> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;
ll N, ans;
void foo(bool s, bool t, bool f, ll n)
{
    if (n > N)
        return;
    if (s && t && f)
        ans++;
    foo(true, t, f, n * 10 + 3);
    foo(s, true, f, n * 10 + 5);
    foo(s, t, true, n * 10 + 7);
}
int main()
{
    cin >> N;
    foo(0, 0, 0, 0);
    cout << ans;
    return 0;
}

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

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n,k; cin>>n>>k;
  vector<int> A(n); for (auto& a:A) cin>>a;
  auto ok = [&](double m) {
    int cnt = 0;
    for (double a:A) {
      cnt += ceil(a/m)-1;
      if (cnt > k)
        return false;
    }
    return true;
  };
  double l = 0, r = 1e9+1;
  for (int i = 0; i < 80; i++) {
    auto c = (l+r)/2;
    if (ok(c)) {
      r = c;
    } else {
      l = c;
    }
  }
  cout << (ll)ceil(r) << endl;

  return 0;
}


Measured memory_bytes: 3856
/*
    Created by Ezio112
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
//#define inf ll(10e16)
#define mod ll(10e8+7)
#define ff first
#define ss second
inline ll p5(ll x)
{
    return x*x*x*x*x;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        ll x;
        cin>>x;
        unordered_map<ll,ll> dp;
        for(ll i=-6208;i<=6208;++i)
        {
            dp[p5(i)]=i;
        }
        for(ll i=-6208;i<=6208;++i)
        {
            ll b=p5(i);
            if(dp.count(x+b))
            {
                cout<<dp[x+b]<<" "<<i;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4144
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef pair<P,int> Pi;
typedef long long ll;

int n;


bool bfs(int t,map<P,P> &futon,pair<P,P> f) {
    queue<Pi> que;
    que.push(Pi(f.fr,t));
    f.sc.sc=t;
    futon[f.fr]=f.sc;
    map<Pi,bool> visited;
    visited[(Pi(f.fr,t))]=true;;

    while(que.size()) {
        Pi pi = que.front(); que.pop();
        P p=pi.fr;
        //printf("[debug] %d : %d %d %d\n",t,p.fr,p.sc,pi.sc);
        rep(k,4) {
            int ny=p.fr+dy[k];
            int nx=p.sc+dx[k];
            int t=pi.sc;

            if(!futon.count(P(ny,nx))) continue;
            //if(futon[P(ny,nx)].sc!=-1) continue;

            // ???????????£???
            if(futon[P(ny,nx)].fr==futon[p].fr) {
                if(futon[P(ny,nx)].sc!=-1&&futon[P(ny,nx)].sc!=(t^1)) return false;
                if(visited.count(Pi(P(ny,nx),t^1))) continue;
                visited[(Pi(P(ny,nx),t^1))]=true;
                futon[P(ny,nx)].sc=t^1;
                que.push(Pi(P(ny,nx),t^1));
            }
            else {
                if(futon[P(ny,nx)].sc!=-1&&futon[P(ny,nx)].sc!=t) return false;
                if(visited.count(Pi(P(ny,nx),t))) continue;
                visited[(Pi(P(ny,nx),t))]=true;
                futon[P(ny,nx)].sc=t;
                que.push(Pi(P(ny,nx),t));
            }

        }
    }

    return true;
}

void solve() {
    map<P,P> futon;
    rep(i,n) {
        P pos;
        char d;
        cin>>pos.sc>>pos.fr>>d;
        futon[pos]=P(i,-1);
        if(d=='x') {
            pos.sc+=1;
        }
        else {
            pos.fr+=1;
        }
        futon[pos]=P(i,-1);
    }
    bool f=true;
    for(auto e : futon) {
        if(e.sc.sc==-1) {
            if(!bfs(0,futon,e)) f=false;
        }
    }
    if(f) {
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}

int main() {
    while(cin>>n) {
        if(n==0) break;
        solve();
    }
    return 0;
}

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

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

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    ll X[N], Y[M];
    rep(i, N) cin >> X[i];
    rep(i, M) cin >> Y[i];
    ll accx = 0, accy = 0;
    rep(i, N) accx = (accx + X[i]*(2*i+1-N)) % mod;
    rep(i, M) accy = (accy + Y[i]*(2*i+1-M)) % mod;
    cout << (accx*accy) % mod << endl;
    return 0;
}


Measured memory_bytes: 1792
n = int(input())
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(n):
  for j in range(i):
    for k in range(j):
      if L[i] == L[j]: continue
      if L[j] == L[k]: continue
      if L[k] == L[i]: continue
      if L[k] + L[j] > L[i]:
        cnt += 1
print(cnt)

Measured memory_bytes: 9116
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define nummax 110000
using namespace std;

int main() {
	int N, M, L[nummax], R[nummax], Lmax, Rmin, ans;
	cin >> N >> M;
	Lmax = 1;
	Rmin = N;
	for (int i = 0; i < M; i++)
	{
		cin >> L[i] >> R[i];
		Lmax = max(Lmax, L[i]);
		Rmin = min(Rmin, R[i]);
	}
	ans = Rmin - Lmax + 1;
	if (ans < 0)
		ans = 0;
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

typedef pair<int,int> P;

long long dp[51][51][50*50+1];

int main(){
	int N;
	int A;
	int x[50];
	scanf("%d %d",&N,&A);
	for(int i=0;i<N;i++){
		scanf("%d",&x[i]);
	}

	
	for(int j=0;j<=N;j++){
		for(int k=0;k<=N;k++){
			for(int s=0;s<=N*50;s++){
				dp[j][k][s] = 0;
			}
		}
	}

	dp[0][0][0] = 1;
	for(int j=1;j<=N;j++){
		for(int k=0;k<=N;k++){
			for(int s=0;s<=N*50;s++){
				if(j>=1&&s<x[j-1]) dp[j][k][s] = dp[j-1][k][s];
				if(j>=1&&k>=1&&s>=x[j-1]) dp[j][k][s] = dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]];
			}
		}
	}

	long long ans = 0;
	for(int k=1;k<=N;k++){
		ans += dp[N][k][k*A];
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 51072