akhauriyash/Code-Regression huggingface dataset:
split :: (Eq a) => a -> [a] -> [a] -> [[a]]
split a [] current = [(reverse current)]
split a (x:xs) current =
    if a == x then
        (reverse current) : (split a xs [])
    else
        split a xs (x:current)
        
split2 a b = split a b []

solve :: [Double] -> IO ()
solve l = do
    putStrLn $ show $ ans
    where
        a = head l
        b = l !! 1
        h = l !! 2
        m = l !! 3
        hh = h + (m / 60)
        ah = a * (cos (2 * pi * hh / 12))
        bh = b * (cos (2 * pi * m / 60))
        height = ah - bh
        aw = a * (sin (2 * pi * hh / 12))
        bw = b * (sin (2 * pi * m / 60))
        width = aw - bw
        ans = sqrt $ (height * height) + (width * width)

main = do
    l <- (map (read)) <$> ((split2 ' ') <$> getLine)
    solve l

Measured memory_bytes: 4544
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});    
	let N = parseInt(input[0][0], 10);
	let a = input[1].map(e => parseInt(e, 10));
	let countEach = [0, 0, 0, 0];
	for (let i = 0; i < N; i++){
		countEach[a[i]] ++;
	}
	allCount = countEach[1] + countEach[2] + countEach[3];
	DPrecord = [];
	DPrecord[allCount - 1] = [[], [allCount]];
	console.log(DP(countEach));
	// console.log(DPrecord);
	
}

function DP(countEach){
	// console.log("start");
	// console.log(countEach);

	let v;
	let ans;
	if (DPrecord[countEach[0]] == null){
		DPrecord[countEach[0]] = [];
		DPrecord[countEach[0]][countEach[1]] = [];
	} else if (DPrecord[countEach[0]][countEach[1]] == null){
		DPrecord[countEach[0]][countEach[1]] = [];
	}
	// console.log(DPrecord[countEach[0]][countEach[1]], "undefined?", DPrecord[countEach[0]][countEach[1]][countEach[2]]) ;

	if (DPrecord[countEach[0]][countEach[1]][countEach[2]] == null){
		v = returnExceptZero(countEach)
		if (v.length === 4){
			ans = 1+(DP([countEach[0] + 1, countEach[1] - 1, countEach[2], countEach[3]]) * countEach[1] + 
						DP([countEach[0], countEach[1] + 1, countEach[2] - 1, countEach[3]]) * countEach[2] + 
						DP([countEach[0], countEach[1], countEach[2] + 1, countEach[3] - 1]) * countEach[3])/allCount;
			ans /= (1 - countEach[0] / allCount);
		} else {
			ans = 0;
			for (let i of v){
				if (i === 0) continue;
				let ary = [];
				// console.log(countEach, "before");
				ary[i] = countEach[i] - 1;
				ary[i - 1] = countEach[i - 1] + 1;
				ary[(i + 1) % 4] = countEach[(i + 1) % 4];
				ary[(i + 2) % 4] = countEach[(i + 2) % 4];
				ans += DP(ary) * countEach[i];
			}
			ans = (ans / allCount) + 1;
			ans /= (1 - countEach[0] / allCount);

		}
		DPrecord[countEach[0]][countEach[1]][countEach[2]] =  ans;
		return ans;

	} else {
		return DPrecord[countEach[0]][countEach[1]][countEach[2]];
	}
}

function returnExceptZero(ary){
	let ans = [];
	for (let i = 0; i < ary.length; i++){
		if (ary[i] !== 0) ans.push(i);
	}
	return ans;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int GCD(int A, int B){
  if (A < B) swap(A, B);
  while (A % B != 0){
    A %= B; swap(A, B);
  }
  return B;
}

vector <int> Prime;
int N, A[int(1e6+5)], G;
map <int, bool> visited;

bool MakePrime(int num){
  for (int i = 2; i * i <= num; i++){
    if (num % i == 0) return false;
  }

  return true;
}

int main(){
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];

  G = A[0];
  for (int i = 0; i < N; i++) G = GCD(G, A[i]);
  if (G != 1){
    cout << "not coprime" << endl;
    return 0;
  }

  Prime.push_back(2);
  for (int i = 3; i <= 1000; i += 2){
    if (MakePrime(i)) Prime.push_back(i);
  }

  for (int i = 0; i < N; i++){
    int now = A[i];
    for (int j : Prime){
      if (now % j != 0) continue;
      if (visited[j]){
        cout << "setwise coprime" << endl;
        return 0;
      }
      visited[j] = true;
      while (now % j == 0) now /= j;
    }
    if (now > 1){
      if (visited[now]){
        cout << "setwise coprime" << endl;
        return 0;        
      }
      visited[now] = true;
    }
  }

  cout << "pairwise coprime" << endl;

  return 0;
}


Measured memory_bytes: 7588
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

int f(int num) {
	int cnt = 0;
	while (1) {
		if (num % 2 == 0) {
			num /= 2;
			cnt++;
		}
		else break;
	}
	return cnt;
}

signed main() {
	int N;
	cin >> N;
	int mn = INF;
	int num; 
	rep(i, N) {
		cin >> num;
		mn = min(mn, f(num));
	}
	cout << mn;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N;
	cin >> N;
	ll ans = 1;
	FOR(i,0,N){
		if(i*i>N)break;
		if(ans<i*i)ans=i*i;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
a,b = map(int,input().split())
c = list(map(int,input().split()))

x = []
y = []
z = []
for i in range(n):
    if c[i] <= a:
        x.append(c[i])
    elif (a+1) <= c[i] <= b:
        y.append(c[i])
    else:
        z.append(c[i])

print(min(len(x),len(y),len(z)))

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
//---------------------------------------------------
//library zone!!!!!
typedef long long ll;
typedef long double ld;
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ld mod_pow(ld x, ll n, ll p) {
	ld res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, l, q;
int x[200000];
int a[200000][25];
int b[200000][25];
signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}
	cin >> l >> q;
	int r = 1;
	for (int i = 1; i <= n; i++) {
		while (r <= n && x[r + 1] - x[i] <= l) {
			r++;
		}
		a[i][0] = r;
	}
	r = n;
	for (int i = n; i >= 1; i--) {
		while (r >= 1 && x[i] - x[r - 1] <= l) {
			r--;
		}
		b[i][0] = r;
	}
	for (int i = 1; i < 25; i++) {
		for (int j = 1; j <= n; j++) {
			if (a[j][i - 1] == n + 1) {
				a[j][i] = n + 1;
			}
			else {
				a[j][i] = a[a[j][i - 1]][i - 1];
			}
		}
		for (int j = n; j >= 1; j--) {
			if (b[j][i - 1] == 0) {
				b[j][i] = 0;
			}
			else {
				b[j][i] = b[b[j][i - 1]][i - 1];
			}
		}
	}
	for (int i = 0; i < q; i++) {
		int s, e;
		int ans = 0;
		cin >> s >> e;
		if (s < e) {
			while (s < e) {
				for (int j = 24; j >= 0; j--) {
					if (a[s][j] <= e) {
						s = a[s][j];
						ans += 1 << j;
						goto loop;
					}
				}
				s = a[s][0];
				ans++;
			loop:;
			}
		}
		else {
			while (s > e) {
				for (int j = 24; j >= 0; j--) {
					if (b[s][j] >= e) {
						s = b[s][j];
						ans += 1 << j;
						goto stop;
					}
				}
				s = b[s][0];
				ans++;
			stop:;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 42624
import java.util.*;
import java.util.stream.Stream;
class Main {
    public static void main(String[] args) {
        int N,A,B;
        Scanner input;
        input = new Scanner(System.in);
        N = input.nextInt();
        A = input.nextInt();
        B = input.nextInt();
        int ans = 0;
        for (int i = 1; i <= N; i++){
          String tmp = String.valueOf(i);
          String[] sa = tmp.split("");
          int[] ia = Stream.of(sa).mapToInt(Integer::parseInt).toArray();
          int sum = 0;
          for (int j = 0; j < ia.length; j++){
            sum += ia[j];
          }
          if (A <= sum && sum <= B){
            ans += i;
          }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 40932
p = []
p.extend([i ** 2 for i in range(int(1000**(1/2)) + 1)])
p.extend([i ** 3 for i in range(int(1000**(1/3)) + 1)])
p.extend([i ** 5 for i in range(int(1000**(1/5)) + 1)])
p.extend([i ** 7 for i in range(int(1000**(1/7)) + 1)])
p.sort()
p.append(1000)
p.append(1001)
 
N = int(input())
 
for j in range(len(p) - 1):
  if p[j] <= N < p[j + 1]:
    print(p[j])

Measured memory_bytes: 9388
var lines = [];

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var v = [];
    for (var i = 0; i < 5; i++) {
        v[i] = Number(lines[i]);
    }
    var k = Number(lines[5]);

    for (var i = 0; i < 4; i++) {
        for (var j = i + 1; j < 5; j++) {
            if (k < Math.abs(v[i] - v[j])) { console.log(":("); return (0); }
        }
    }
    console.log("Yay!");

});

Measured memory_bytes: 21320
fun main() {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
        .groupBy { it }.mapValues { it.value.size.toLong() }.toMutableMap()

    val q = readLine()!!.toInt()
    var total = a.map { it.key * it.value }.sum()
    for (i in 0 until q) {
        val (b, c) = readLine()!!.split(" ").map { it.toInt() }
        total += (c - b) * (a[b] ?: 0)
        a[c] = (a[c] ?: 0) + (a[b] ?: 0)
        a[b] = 0
        println(total)
    }
}


Measured memory_bytes: 81244
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;

int n;
int main(void) {
	cin >> n;
	string s;
	cin >> s;
	vector<int> left(n), right(n);
	for (int i = 1; i < n; i++) 
	{
		if (s[i-1] == 'W') left[i] = left[i-1] + 1;
		else left[i] = left[i - 1];
	}
	for (int i = n-1; i > 0; i--)
	{
		if (s[i] == 'E') right[i - 1] = right[i] + 1;
		else right[i - 1] = right[i];
	}
	int ans = n + 1;
	for (int i = 0; i < n; i++)
	{
		if (left[i] + right[i] < ans) ans = left[i] + right[i];
	}
	cout << ans << endl;

}

Measured memory_bytes: 3076
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 100000007
typedef long long ll;
using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	cout<<(a+b+1)/2<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple


int main(void)
{
    ll X;
    cin >> X;
    while(1){
        int flag = 0;
        if(X == 2){
            cout << 2 << endl;
            return 0;
        }else{
            if(X % 2 == 0){
                X++;
            }else{
                for(ll i=2;i<X;i++){
                    if(X%i == 0){
                        X++;
                        flag = 1;
                        break;
                    }
                }
                if(flag == 0){
                    cout << X << endl;
                    return 0;
                }
            }
        }
    }
    
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include <random>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  int n;
  scanf("%d",&n);
  vi a(n);
  cin >> a;
  sort(rng(a));
  int ans = 0;
  rep(i,n-1) if (a[i] == a[i+1]) ++ans;
  if (ans&1) ++ans;
  cout<<n-ans<<endl;
  return 0;
}































Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<int, int> P;



int main(){
    int n, k;   cin >> n >> k;
    vector<bool> count(n, false);
    for(int i = 0; i < k; i++){
        int d;  cin >> d;
        for(int j = 0; j < d; j++){
            int a;  cin >> a;
            a--;
            count[a] = true;
        }
    }

    int res = 0;
    for(int i = 0; i < n; i++){
        if(!count[i]){
            res++;
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(){
	int n;
	int n1, n2, n3;
	scanf("%d", &n);
	
	n1 = n/100;
	n2 = (n%100)/10;
	n3 = n%10;
	
	if (n1 == 7 || n2 == 7 || n3 == 7){
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	
	return 0;
}

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

typedef pair<int, int> P;

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
  int N, sum;
  while( cin >> N, N ){
    sum = 0;

    vector<int> j( N );
    REP( i, N ) cin >> j[i];
    sort( ALL( j ) );
    FOR( i, 1, N - 1 ) sum += j[i];

    cout << sum / ( N - 2 ) << endl;
  }
}


Measured memory_bytes: 3116
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string a;
    ll b;
    cin >> a >> b;
    char ans = a[0];
    for (int i = 1; i <= a.size(); i++) {
        if (a[i - 1] != '1' && i <= b) {
            ans = a[i - 1];
            break;
        } else if (b < i) break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
int x,y;
int num;

scanf("%d %d", &x, &y);

while((x+y) != 0) {
if(x > y) {
num = y;
y = x;
x = num;
}
printf("%d %d\n", x, y);
scanf("%d %d", &x, &y);
}
return (0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    int ans=0;
    for(;;){
        string s;
        std::cin >> s;
        if(s=="0")exit(0);
        int ans=0;
        rep(i,s.size()){
            ans+=s[i]-'0';
        }
        std::cout << ans << std::endl;
    }
    
}


Measured memory_bytes: 3172
import numpy as np
from collections import Counter

n = int(input())
vlist = list(map(int, input().split()))

c_odd = Counter(vlist[0::2])
c_even = Counter(vlist[1::2])

odd = c_odd.most_common()
even = c_even.most_common()

if odd[0][0] == even[0][0]:
    if len(odd) == 1 and len(even) == 1:
        print(int(n/2))
    elif len(odd) == 1:
        print(n - (odd[0][1]+even[1][1]))
    elif len(even) == 1:
        print(n - (odd[1][1]+even[0][1]))
    else:
        print(min(n - (odd[0][1]+even[1][1]), n - (odd[1][1]+even[0][1])))
else:
    print(n - (odd[0][1]+even[0][1]))


Measured memory_bytes: 29708
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long t1 = sc.nextLong();
		long t2 = sc.nextLong();
		long a1 = sc.nextLong();
		long a2 = sc.nextLong();
		long b1 = sc.nextLong();
		long b2 = sc.nextLong();

		long tsum = t1 * a1 + t2 * a2;
		long asum = t1 * b1 + t2 * b2;
		if (tsum == asum) {
			System.out.println("infinity");
			return;
		}

		if (asum > tsum) {
			long tmp = a1;
			a1 = b1;
			b1 = tmp;

			tmp = a2;
			a2 = b2;
			b2 = tmp;
		}

		if (b1 < a1) {
			System.out.println(0);
			return;
		}

		long delta1 = (b1 - a1) * t1;
		long delta2 = Math.abs(asum - tsum);

		System.out.println((delta1 / delta2) * 2 + (delta1 % delta2 > 0 ? 1 : 0));
	}
}


Measured memory_bytes: 23124
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

int main() {
    int N, M, X, Y; cin >> N >> M >> X >> Y;
    vector<int> x(N); for (int i = 0; i < N; ++ i) cin >> x[i];
    vector<int> y(M); for (int i = 0; i < M; ++ i) cin >> y[i];
    x.push_back(X);
    y.push_back(Y);
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    if (x[N] < y[0]) {
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC004Divide
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] v = new long[3];
            string[] vals = Console.ReadLine().Split(' ');
            v[0] = long.Parse(vals[0]);
            v[1] = long.Parse(vals[1]);
            v[2] = long.Parse(vals[2]);

            Array.Sort(v);

            if(v[2] % 2 == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(v[0] * v[1]);
            }

        }
    }
}


Measured memory_bytes: 13268
import sys
import collections
input = sys.stdin.readline

def main():
    N = int(input())
    S = [input().strip() for _ in range(N)]
    c = collections.Counter(S)
    l = c.most_common()

    ans = []
    tmp = 0

    for i, x in enumerate(l):
        if i == 0:
            tmp = x[1]

        if x[1] == tmp:
            ans.append(x[0])
        else:
            break
    
    ans.sort()

    for x in ans:
        print(x)


if __name__ == "__main__":
    main()

Measured memory_bytes: 47824
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 998244353;

int main(void){
  int n;
  cin >> n;
  int res = 0;
  int cnta = 0,cntb = 0,cntba = 0;
  for(int i = 0;i < n;++i){
    string s;
    cin >> s;
    for(int j = 0;j + 1< (int)s.size();++j){
      if(s.substr(j,2) == "AB") ++ res;
    }
    char begin = s[0], end = s[s.size()-1];
    if(begin == 'B' && end == 'A')
      ++cntba;
    else if(begin == 'B')
      ++cntb;
    else if(end == 'A')
      ++cnta;
  }
  if(cnta + cntb > 0){
    res += cntba;
    res += min(cnta,cntb);
  }else{
    res += max(cntba-1,0);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include<queue>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef long long ll;
typedef long long LL;
typedef vector<long long > VLL;
typedef vector<long long > vll;
typedef pair<long long , long long> pll;
typedef pair<long long , long long> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define VECMAX(x) *max_element(ALL(x))
#define VECMIN(x) *min_element(ALL(x))
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MULTIPLE(i,n,k) for(int i = (k) ; i<(n) ; i+=k+1)//倍数ループ
//constant
//------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define SIZEOF(x) sizeof(x)/sizeof(x[0])
#define INF 1000000000000;

int main(){
    LL n;
    cin >> n;
    vll a(n);
    REP(i,n)cin >> a[i];
    vll r(n);
    r[0] = a[0];
    REP(i,n-1){
        r[i+1] = r[i]+a[i+1];
    }
    ll ans = INF;
    REP(i,n-1){
        ll abst;
        abst = abs(r[i] - (r[n-1] - r[i]));
        if(abst < ans)ans = abst;
    }

    cout << ans;
    return 0;
    }


Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
using namespace std;
int main(){
	int n,m;
	while(cin>>n>>m,n+m){
		vvi cost(m,vi(m));
		vvi cost2(m,vi(m));
		rep(i,m)rep(j,m)cost[i][j]=cost2[i][j]=inf;
		rep(i,n){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			a--;b--;
			cost[a][b]=cost[b][a]=c;
			cost2[a][b]=cost2[b][a]=d;
		}
		int a;
		cin>>a;
		while(a--){
			int b,c,q;
			cin>>b>>c>>q;
			b--;c--;
			vi d(m);
			vi used(m);
			rep(i,m)d[i]=inf;
			d[b]=0;
			if(!q){
				while(1){
					int v=-1;
					rep(i,m)if(!used[i]&&(v==-1||d[i]<d[v]))v=i;
					if(v==-1)break;
					used[v]=true;
					rep(i,m)d[i]=min(d[i],d[v]+cost[v][i]);
				}
				cout<<d[c]<<endl;
			}else{
				while(1){
					int v=-1;
					rep(i,m)if(!used[i]&&(v==-1||d[i]<d[v]))v=i;
					if(v==-1)break;
					used[v]=true;
					rep(i,m)d[i]=min(d[i],d[v]+cost2[v][i]);
				}
				cout<<d[c]<<endl;
			}
		}
	}
}

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

int main(){
  int n;
  cin >> n;
  set<int> st;
  for(int i = 0 ; i < n ; ++i){
    int d;
    cin >> d;
    st.insert(d);
  }
  cout << st.size() << endl;
  return 0;
}

Measured memory_bytes: 256
from sys import stdin
from collections import defaultdict
from heapq import heappush, heappop
import math

readline = stdin.readline

v, e, r = map(int, readline().split())

g = defaultdict(list)
for i in range(e):
    s, t, length = map(int, readline().split())
    g[s].append((length, t))
d = [float('inf')] * v
d[r] = 0
heap = [(d[r], r)]
while heap:
    du, u = heappop(heap)
    for length, v in g[u]:
        if d[v] > du + length:
            d[v] = du + length
            heappush(heap,(d[v], v))
for di in d:
    print('INF' if math.isinf(di) else di)

Measured memory_bytes: 108588
R,G,B,N = [int(i) for i in input().split()]
c = 0
for i in range(0,N+1,R):
    for j in range(0,N+1,G):
        if (N - i - j) < 0:
            break
        if (N - i - j)%B == 0:
            c += 1
print(c)

Measured memory_bytes: 9116
package main
import . "fmt"
func main() {
  var n,m,a,b int
  var c []int
  Scan(&n,&m)
  c = make([]int,n)
  for i:=0;i<m;i++ {
    Scan(&a,&b)
    c[a-1]++
    c[b-1]++
  }
  for i:=0;i<n;i++ { Println(c[i]) }
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

ll a, b, c;

int main()
{
  scanf( "%lld%lld%lld", &a, &b, &c );

  if( c-(a+b) <= 0 )
    puts( "No" );
  else
  {
    puts( 4*a*b-(c-(a+b))*(c-(a+b)) < 0 ? "Yes" : "No" );
  }

  return 0;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D - Blue and Red Balls
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 2000;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

int cs[MAX_N + 1][MAX_N + 1];

/* subroutines */

inline int comb(int n, int k) {
  return (n < 0 || k < 0 || n < k) ? 0 : cs[n][k];
}

/* main */

int main() {
  int n, k;
  scanf("%d%d", &n, &k);

  for (int i = 0; i <= n; i++) {
    cs[i][0] = cs[i][i] = 1;
    for (int j = 1; j < i; j++)
      cs[i][j] = (cs[i - 1][j - 1] + cs[i - 1][j]) % MOD;
  }

  int m = n - k;
  for (int i = 1; i <= k; i++)
    printf("%lld\n", (ll)comb(m + 1, i) * comb(k - 1, i - 1) % MOD);
  return 0;
}


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

int main()
{
  int N;
  cin >> N;
  vector<int> D(N);
  for (int i = 0; i < N; i++) cin >> D.at(i);
  map <int, int> mpa;
  for (int i = 0; i < N; i++) mpa[D.at(i)]++;

  int M;
  cin >> M;
  vector<int> T(M);
  for (int i = 0; i < M; i++)cin >> T.at(i);
  map <int, int> mpb;
  for (int i = 0; i < M; i++) mpb[T.at(i)]++;

  for (int i = 0; i < M; i++)
  {
    int x = T.at(i) ;
    if (mpa[x] < mpb[x])
    {
      cout << "NO" << endl;
      return 0;
    }
  }

    cout << "YES" << endl;
}


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

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

int main(){
    string s;
    cin >> s;
    if(s=="ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }

    return 0;
}

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


int main() {
	int n;
	cin >> n;
	cout << n / 3 << endl;
	return 0;
}


Measured memory_bytes: 256
def main():
    H, N = map(int, input().split())
    dp = [10 ** 18] * (H + 1)

    dp[0] = 0

    for i in range(N):
        a, b = map(int, input().split())
        for j in range(H):
            nj = min(j + a, H)  # nj: 次のjのindex, 配列外参照しないようにminをとる
            dp[nj] = min(dp[nj], dp[j] + b)

    print(dp[H])


main()


Measured memory_bytes: 42864
a, b, c, d = map(int, input().split())

taka = 0
aoki = 0

while a > 0:
    a = a - d
    taka += 1   

while c > 0:
    c = c - b
    aoki += 1

if taka < aoki:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 8968
import java.io.BufferedReader
import java.util.*
import kotlin.math.max

fun main() = arc062c()

@OptIn(ExperimentalStdlibApi::class)
fun arc062c() = SimpleFastIOWithToken_arc062c().exec {
    val n = readInt()
    val pollRates = List(n) { readLong() to readLong() }

    tailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)

    var a = 1L
    var b = 1L

    for ((a0, b0) in pollRates) {
        val multiply = max((a + a0 - 1) / a0, (b + b0 - 1) / b0)
        a = a0 * multiply
        b = b0 * multiply
    }

    val answer = a + b

    println(answer)
}


// region kokokara template dayo (^o^)
@Suppress("unused", "HasPlatformType", "MemberVisibilityCanBePrivate", "ClassName")
private class SimpleFastIOWithToken_arc062c(private val separator: String = System.lineSeparator()) {
    private val br: BufferedReader = System.`in`.bufferedReader()
    private var st: StringTokenizer = StringTokenizer("")
    private val sb: StringBuilder = StringBuilder()
    private fun prepareNext() = run { if (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) }

    fun readString(): String = run { prepareNext() }.run { st.nextToken() }
    fun readInt(): Int = Integer.valueOf(readString())
    fun readLong(): Long = java.lang.Long.valueOf(readString())

    fun println(): Unit = run { sb.append(separator) }
    fun print(any: Any): Unit = run { sb.append(any) }
    fun println(any: Any): Unit = run { sb.append(any.toString() + separator) }

    fun exec(action: SimpleFastIOWithToken_arc062c.() -> Unit) {
        var t: Throwable? = null
        Thread(null, { action() }, "solve", 128 * 1024 * 1024)
            .apply { setUncaughtExceptionHandler { _, t1 -> t = t1 } }
            .apply { start() }.join()
        t?.let { throw it }
        kotlin.io.print(sb)
    }

    fun readLine(): Nothing = error("readLine is disabled.")
}
// endregion kokomade template dayo (^o^)


Measured memory_bytes: 35168
#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 <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;
int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll>a(n+1);
    for(int i=1;i<n+1;i++)cin>>a[i];
    vector<ll>b(n+1);
    int x=1;
    int count=0;
    while(1){
        if(b[x]==0)b[x]=1;
        if(b[a[x]]==1)break;
        x=a[x];count++;
    }
int y=a[x];
count++;

int e=0;
x=1;
while(1){
    if(x==y)break;
    x=a[x];e++;
}
if(k<=e){
    x=1;
    while(k>0){
       x=a[x]; k--;
    }
    cout<<x;
    return 0;
}
int f=count-e;
int q=(k-e)%f;
while(q>0){
y=a[y];q--;
}
cout<<y;
return 0;
}

Measured memory_bytes: 6024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

template<class T>
struct Vec2
{
	Vec2(){}
	Vec2(T _x, T _y) : x(_x), y(_y) {}

	Vec2 operator+(const Vec2& rhs) const { return Vec2(x + rhs.x, y + rhs.y); }
	Vec2 operator-(const Vec2& rhs) const { return Vec2(x - rhs.x, y - rhs.y); }
	Vec2 operator*(T s) const { return Vec2(x*s, y*s); }
	Vec2 operator/(T s) const { return Vec2(x/s, y/s); }
	T dot(const Vec2& rhs) const { return x*rhs.x + y*rhs.y; }
	T cross(const Vec2& rhs) const { return x*rhs.y - y*rhs.x; }
	T sqlength() const { return x*x + y*y; }
	double length() const { return sqrt(sqlength()); }
	bool operator<(const Vec2& rhs) const
	{
		if (x != rhs.x) return x < rhs.x;
		return y < rhs.y;
	}

	T x;
	T y;
};

int main()
{
	typedef Vec2<double> Vec;
	Vec P[3];
	cin >> P[0].x >> P[0].y;
	cin >> P[1].x >> P[1].y;

	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> P[2].x >> P[2].y;

		Vec d1 = P[1] - P[0];
		Vec d2 = P[2] - P[0];
		Vec prj = d1 * d1.dot(d2) / d1.sqlength();
		Vec ans = (prj - d2) + P[2];
		printf("%.10f %.10f\n", ans.x, ans.y);
	}
	return 0;
}


Measured memory_bytes: 3188
// ABC088B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++)
	{
		cin >> a.at(i);
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());

	int Alice = 0;
	int Bob = 0;

	for (int j = 0; j < N; j++)
	{
		if (j%2==0)
		{
			Alice += a.at(j);
		}
		else
		{
			Bob += a.at(j);
		}
	}
	cout << Alice - Bob << endl;
}

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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

    if (K <= A) {
        A -= K;
    } else {
        K -= A;
        A = 0;
        B -= min(B, K);
    }

    cout << A << " " << B << endl;
}

Measured memory_bytes: 256
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()

P = list(map(int, input().split()))

a = [0 for _ in range(102)]

tmp = 10**5
res = 0

for i in range(N):
    a[P[i]] += 1

for i in range(102):
    if a[i]:
        continue
    if tmp > abs(i - X):
        tmp = abs(i - X)
        res = i
print(res)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;

int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

int main()
{
    int n,i,j,k,x;
    cin>>n>>x;
    vector<int> a;
    for(i=0;i<n;i++)
    {
        int b;cin>>b;
        a.push_back(b);
    }
    a.push_back(x);
    sort(a.begin(),a.end());
    int g=a[1]-a[0];
    for(i=1;i<n;i++)
    {
        g=gcd(g,a[i+1]-a[i]);
    }
    cout<<g;
}


Measured memory_bytes: 892
/*ANKON GHOSH
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define MAX 200005
#define mod 1000000007
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) cout<<"Case #"<<i<<": "
#define pf(a) printf("%lld\n",a)
#define pfsn printf("NO\n")
#define pfs  printf("YES\n")
#define pff(a,b) printf("%lld %lld\n",a,b)
#define pfff(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pffff(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll r=x;r<=y;r++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p(a,b) make_pair(a,b)
#define p_b(a) push_back(a)
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp,vpp1;
vector<pair<ll,ll> >vp,fin;
vector<ll>v,v1,v2,dummy;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
ll n,k,a,b,c,d,ta,sum=0,cnt=0,m,l,req,sz,maxi;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
vector<pair<ll,ll> >adj[MAX+10];
ll dep[MAX+10];
int main()
{
    fast;
    string s;
    cin>>s;
    ll l=s.size();
    map<char,bool>mch;
    mch.clear();
    FOR(i,l)
    {
        mch[s[i]]=true;
    }
    string ans="None";
    for(char ch='a';ch<='z';ch++)
    {
        if(!mch[ch])
        {
            ans.clear();
            ans+=ch;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
#define rep(i,n) for(int i = 0;i<n;i++)

int main(){
	char input;
	cin >> input;

	if(input <= 0x5a) cout << 'A' << endl;
	else cout << 'a' << endl;

	return 0;
}

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

bool check(vector<int> a, vector<int> b) {
    if (a.size() != b.size()) return false;
    for (int i = 0; i < a.size(); i++) if (a.at(i) != b.at(i)) return false;
    return true;
}

int main(void) {
    int N;
    cin>>N;
    vector<int> vc;
    for (int i = 1; i <= N; i++) vc.push_back(i);
    vector<int> P, Q;
    for (int i = 0; i < N; i++) {
        int p;
        cin>>p;
        P.push_back(p);
    }
    for (int i = 0; i < N; i++) {
        int q;
        cin>>q;
        Q.push_back(q);
    }
    int P_index = 0;
    int Q_index = 0;
    int now = 0;
    do {
        now++;
        if (check(P, vc)) {
            P_index = now;
        }
        if (check(Q, vc)) {
            Q_index = now;
        }
    } while (next_permutation(vc.begin(), vc.end()));
    cout << abs(P_index - Q_index) << endl;
    return 0;
}

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

long long int solve(long long int pre, long long int next) {
	long long int tmp,sum;
	tmp = (pre / next);
	if (pre - next*tmp) {
		sum = 2 * next*tmp;
		sum += solve(next, pre - next*tmp);
	}
	else {
		sum = 2 * next*tmp - next;
	}
	
	return	sum;
}

int main()
{
	long long int n, x,sum;
	cin >> n >> x;

	sum = n;
	sum += solve(n - x, x);

	cout << sum << endl;

    return 0;
}

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



int main() {
    int n,k,a;
  cin >> n >> k;
  vector<int> x(200000);
  vector<int>ans;
  
  for(int i=0;i<n;i++){
    cin >> a;
    x[a]++;
  }
 for(int i=0;i<=n;i++){
   if(x[i]>0) ans.push_back(x[i]);
 }
  
  sort(ans.begin(),ans.end());
  
  int dif = ans.size()-k;
  
  int sum =0;
  
  for(int i=0;i<dif;i++){
    sum+=ans[i];
  }
  if(k>=ans.size()){
    cout << 0 << endl;
  }
  else{
   cout << sum << endl;
  }
}
    
 





Measured memory_bytes: 2168
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define deb(X) std::cerr << ">>> deb(" << __LINE__ << \") " << #X << " = " << (X) << std::endl

int power(int x,int y,int mo)
{
	if(y < 0 or x < 0 or mo <= 0) return 0;
	if(mo == 1) return 0;
	int res=1;
	while(y!=0)
	{
		if(y%2==1)
		res=(res%mo*x%mo)%mo;
		y=y/2;
		x=(x%mo*x%mo)%mo;
	}
	return res;
}


int  calc(ll n) {
	if(n==0)
	return 0;
	ll c = __builtin_popcount(n);

//	cout<<c<<" ";
	return 1 + calc(n%c);
}

int32_t main()
{
	fast();
	int t=1;
//	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		string s;
		cin>>s;
		int c = 0;
		for(int i=0;i<n;i++) 
		{
			if(s[i] == '1') 
			c++;
		}
		reverse(s.begin(), s.end());
		int ans1 = 0;
		int ans2 = 0;
		for(int i=0; i<n; i++) 
		{
			if(s[i] == '1')
			 {
				ans1 += power(2,i,c+1);
				ans2 += power(2,i,c-1);
				ans1 %= (c+1);
				if(c != 1)
				ans2 %= (c-1);
			}
		}
		for(int i=n-1; i>=0; i--) 
		{
			if(s[i] == '0') 
			{
				int temp =(ans1+power(2,i,c+1))%(c+1);
				cout<<1+calc(temp)<<"\n";
			} 
			else 
			{
				if(c != 1) 
				{
					int temp=(ans2 - power(2,i,c-1) + (c-1))%(c-1);
					cout<<1+calc(temp)<<"\n";
				}
				else 
				{
					cout<<"0\n";
				}
			}
		}
 	}
		
	
}







Measured memory_bytes: 3736
/******************************************************************************

            EYENINE,THE ELDER_WAND!!!
            THE ROOT OVER MINUS EIGHTY ONE!!

*******************************************************************************/

#include<bits/stdc++.h>
#define ALL_UP_WITH return 0
#define vi vector<int>
using namespace std;
int count1=0;
int a,b,c;
int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>a>>b>>c;
    int arr[3];
    arr[0]=a;
    arr[1]=b;
    arr[2]=c;
    int five=0,seven=0;
    for(int i=0;i<3;i++){
        if(arr[i]==5){
            five++;
        }
        if(arr[i]==7){
            seven++;
        }
    }
    if(five==2&&seven==1){

        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }


    ALL_UP_WITH;
}


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

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

int main(){
	int n;
	char s[100];
	bool f = false;

	cin >> n;

	rep(i, n){
		cin >> s[i];
		if(s[i] == 'Y')
			f = true;
	}

	if(f)
		cout << "Four";
	else
		cout << "Three";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using std::cin;
using std::cout;
using std::endl;

bool is_prime(int n) {
	if (n < 2) {
			return false;
	}
	if (n==2||n==3) {
		return true;
	}
	for (int i = 3; i < n; i = i+2) {
		if (n%i==0) {
			return false;
		}
	}
	return true;
}

int main(void) {
	int N = 500000;
	std::vector<bool> prime(N);
	for (int i = 0; i < N+2; i++) {
		prime[i] = true;
	}
	prime[0] = false;
	prime[1] = false;
	for (int i = 2; i <= sqrt(N); i++) {
		if (is_prime(i)) {
			for (int j = 2; i*j < N+2; j++) {
				prime[i*j] = false;
			}
		}
	}

	int m,a,b;
	cin >> m >> a >> b;
	while ( m != 0 || a != 0 || b != 0 ) {
		double rat = (double)a/b;
		int p,q;
		int pro = 0;
		for (int i = 2; i < (m/2+1) && i*i < m+1; i++) {
			if ( prime[i] ) {
				for (int j = i; !((double)i/j < rat) && !((double)i/j > 1) && !(i*j > m); j++) {
					if ( prime[j] ) {
						if ( m == 51943) {
						}
						if ( i*j > pro ) {
							p = i;
							q = j;
							pro = i * j;
						}
					}
				}
			}
		}
		cout << p << " " << q << endl;
		cin >> m >> a >> b;
	}
	return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
#include<deque>
#define jio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
//#define mp make_pair
#define pb push_back
#define lld long long int
#define clr clear()
#define ff first
#define ss second
#define N 1000005
//#define M 1000
#define endl '\n'
#define c_s_b() __builtin_popcount()

#define sze 10000009
#define pii pair<int,int>
#define big 3050
#define int long long

using namespace std;
const ll INF = 1e18L+5;
int n,k;
int a[big];
int dp[big][big][2];


//bool x
int fun(int s,int e,int turn){
    //turn =1 taro
    //turn=0 ziro

   if(s>e){
      return 0;
   }
  /* if(s==e){
    return a[s];
   }  */
   if(dp[s][e][turn]!=-1) return dp[s][e][turn];
   int ans=0;
   if(turn==1){
      ans=max(fun(s+1,e,1-turn)+a[s],fun(s,e-1,1-turn)+a[e]);
   }
   if(turn==0){
      ans=min(fun(s+1,e,1-turn)-a[s],fun(s,e-1,1-turn)-a[e]);

   }
   return dp[s][e][turn]=ans;







}



int32_t main(){
   jio;
    cin>>n;
    //int sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
       // sum+=a[i];
    }
     for(int i=0;i<big;i++){
        for(int j=0;j<big;j++){
            dp[i][j][0]=-1;
            dp[i][j][1]=-1;
        }
     }
   // memset(dp,-1,sizeof(dp));
   //cout<<"sum "<<sum<<endl;
   int x=fun(0,n-1,1);//1 for taro // 0 for jiro
   /*int y=sum-x;
   cout<<x<<" "<<y<<endl;
   cout<<abs(x-y)<<endl;*/
   cout<<x<<endl;




    return 0;


}


Measured memory_bytes: 145792