akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define uu unsigned
#define io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define pl pair<ll,ll>
#define mkp make_pair
#define ss second
#define ff first
#define mit(a,b) map<a,b>::iterator
#define sit(a) set<a>::iterator
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
//#define printf __mingw_printf
#define printcas cout<<"Case "<<cas<<": "
#define _ continue;
#define endl '\n'
#define __ cout<<endl;continue;
const ll oo=(1ll<<60);
int gi(){
	int x=0,w=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')w=0,ch=getchar();
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
int main()
{
    // io;
    //string hudai(1000000,'a');
    int T=1;
    //T=gi();
     for(int cas=1;cas<=T;cas++)
    {
       ll n=gi(),i,j;double ph,sum=0.0;
       vector<double> dp(n+5);
       dp[0]=1;
       for(i=1;i<=n;i++)
       {
           cin>>ph;
           for(j=i;j>=0;j--)
           {
               dp[j]=(!j ?0:dp[j-1]*ph)+dp[j]*(1.0-ph);
           }
       }
       for(i=(n>>1)+1;i<=n;i++)sum+=dp[i];
       printf("%.10lf\n",sum);

    }
    return 0;
}


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

long long fact[5000009], factinv[5000009], mod = 1000000007;

long long mul3(long long a, long long b, long long c) {
	return ((a*b)%mod)*c%mod;
}
long long mul2(long long a, long long b) {
	return (a*b) % mod;
}
long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a;
	for (int i = 0; i < 60; i++) {
		if ((b / (1LL << i)) % 2 == 1) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}
long long Div(long long a, long long b, long long m) {
	return (a*modpow(b, m - 2, m)) % m;
}
long long ncr(long long n, long long r) {
	if (r < 0 || n < r) return 0;
	return mul3(fact[n], factinv[n - r], factinv[r]);
}
void init() {
	fact[0] = 1; for (int i = 1; i <= 5000000; i++) fact[i] = (fact[i - 1] * i) % mod;
	for (int i = 0; i <= 5000000; i++) factinv[i] = Div(1, fact[i], mod);
}
long long comb(long long a, long long b) {
	if (b == 0) {
		if (a == 0) return 1;
		return 0;
	}
	return ncr(a - 1, b - 1);
}

long long X, Y, A, B, C;

int main() {
	init();
	while (true) {
		cin >> A >> B >> C >> X >> Y; if (A + B + C + X + Y == 0) break;

		long long sum = 0;
		for (int i = 0; i <= min(X, Y); i++) {
			long long V1 = ncr(A + B, B)*ncr(A + B + C, C); V1 %= mod;
			long long V2 = comb(i + A + B + C, A + B + C);
			long long V3 = comb(X - i, A);
			long long V4 = comb(Y - i, B);
			sum += mul2(mul2(V1, V2), mul2(V3, V4)); sum %= mod;
		}
		cout << sum << endl;
	}
	return 0;
}


Measured memory_bytes: 81236
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    string A[N], B[M];
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];

    int c = N-M+1;
    int flag = 0;
    rep(k, c) {
        rep(l, c){
            flag = 1;
            rep(i, M) {
                rep(j, M) {
                    if (A[i+k][j+l] != B[i][j]) flag = 0;
                }
            }
            if (flag) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


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

int main(){
    int N,K;
    cin >> N >> K;
    int flag[N];
    for(int i=0;i<N;i++) flag[i] = 1;
    for(int i=0;i<K;i++){
        int di;
        cin >> di;
        int A;
        for(int j=0;j<di;j++){
            cin >> A;
            flag[A-1] = 0;
        }
    }
    cout << accumulate(flag, flag+N, 0) << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

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



Measured memory_bytes: 256
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split();
	public K()
	{
		var N = F;
		var ps = new Complex[N];
		for (var i = 0; i < N; i++) { var I = G; ps[i] = new Complex(I[0], I[1]); }
		var M = 600000;
		var d = 2 * PI / M;
		var ans = new int[N];
		for (var i = 0; i < M; i++)
		{
			var p = Complex.FromPolarCoordinates(1, i * d);
			var k = -1;
			var r = double.NegativeInfinity;
			for (var j = 0; j < N; j++)
			{
				var tmp = (p * ps[j]).Real;
				if (tmp > r) { r = tmp; k = j; }
			}
			ans[k]++;
		}
		for (var i = 0; i < N; i++) WriteLine(ans[i] / (decimal)M);
	}
}


Measured memory_bytes: 13396
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
double a,b,c,d,e,f;
double x,y;
while(cin >> a >> b >> c >> d >> e >> f){
  x = (double)((e*c-b*f) / (a*e-b*d));
  y = (double)((-(d*c)+a*f) / (a*e-b*d));
  if(x == 0){x = 0;}
  if(y == 0){y = 0;}
  printf("%.3f %.3f\n",x,y);
 }
}

Measured memory_bytes: 3176
a = [int(input())]

for i in range(100000):
  if a[i] % 2 == 0:
    a.append(a[i]//2)
  else:
    a.append(3*a[i] + 1)
    
  if a[i+1] in a[:i]:
    print(i+2)
    break
      

Measured memory_bytes: 2940
N = int(input())
a = list(map(int,input().split()))
c = 0
for i in range(len(a)):
  if (i == 0 or i == len(a)-1):
    pass
  else:
    #print(i)
    if a[i-1]<a[i]<a[i+1] or a[i-1]>a[i]>a[i+1]:
      c+=1
print(c)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};



int main() {
    string s;cin>>s;
    int mn = INT_MAX;
    rep(i,s.size()-2){
        int val = 0;
        
        val += s[i]-'0';
        val = val*10 + s[i+1]-'0';
        val = val*10+s[i+2]-'0';
        
        mn = min(mn,abs(val-753));
    }
    cout<<mn<<endl;
    
    return 0;
}





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

using namespace std;

int main(void)
{
	int n;

	cin >> n;

	for( int i = 0;i < n;i++ ){
		string input;
		cin >> input;

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

		unsigned int min = atoi( input.c_str() );

		sort( input.begin(), input.end(), greater<char>() );

		unsigned int max = atoi( input.c_str() );

		cout << max - min << endl;
	}

	return 0;
}

Measured memory_bytes: 0
<?php
fscanf(STDIN, "%d %d", $a,$b);
if($b == 1){
    echo 0;
    exit;
}
$i=1;
$result = $a;
if($result >= $b){
    echo 1;
    exit;
}
while(true){
    $result += $a-1;
    $i++;
    if($result >= $b){
        break;
    }
}
echo $i;
?>

Measured memory_bytes: 4728
def main():
    N, T = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(N)]

    dp = [-1] * (T + 3000)
    dp[0] = 0
    for a, b in sorted(AB):
        for i in range(T - 1, -1, -1):
            if dp[i] == -1:
                continue
            if dp[i + a] < dp[i] + b:
                dp[i + a] = dp[i] + b
    print(max(dp))


main()


Measured memory_bytes: 3956
#include "bits/stdc++.h"
using namespace std;

const int MAXN = 2e5 + 5;

int lsone(int x){ return (x&(-x)); }

string s;
int a[MAXN], ft[MAXN], n, num[MAXN];
vector<int> loc[100];
pair<int,int> pos[MAXN];
long long ans = 0;

int query(int k){
	int sum = 0;
	for(sum = 0; k > 0; k -= lsone(k))
		sum += ft[k];
	return sum;
}

void upd(int k, int v){
	for(; k < MAXN; k += lsone(k))
		ft[k] += v;
}

int main(){
	cin >> s;
	n = s.size();
	for(char i : s){
		num[i]++;
	}
	int numOdd = 0;
	for(int i = 'a'; i <= 'z'; ++i){
		if(num[i]%2 == 1)
			numOdd++;
	}
	if(numOdd > 1){
		printf("-1\n");
		return 0;
	}

	for(int i = 0; i < n; ++i){
		loc[s[i]-'a'].push_back(i+1);
	}
	int middle = 0;
	for(int i = 0; i < 26; ++i){
		for(int l = 0, r = loc[i].size()-1; l <= r; ++l, --r){
			if(l == r){
				a[loc[i][l]] = s.size()/2;
				pos[s.size()/2] = make_pair(2*n, loc[i][l]);
				// printf("%d -> %d\n", s.size()/2, loc[i][l]);
			}else{
				pos[middle] = make_pair(loc[i][l], loc[i][r]);
				// printf("%d -> %d %d\n", middle, loc[i][l], loc[i][r]);
				a[loc[i][l]] = a[loc[i][r]] = middle++;
			}
		}
	}

	sort(pos, pos+(s.size()/2)+(s.size()%2));
	for(int i = 0; i < n/2; ++i){
		int correct = n-i;
		int dist = correct-pos[i].second+query(pos[i].second-1);
		// printf("(%d, %d) %d\n", pos[i].first, pos[i].second, dist);
		dist = max(0, dist);
		ans += dist;
		upd(pos[i].second, 1);
		// assert(dist >= 0);
	}
	if(n%2 == 1){
		ans += n/2+1-pos[n/2].second+query(pos[n/2].second-1);
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3452
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<cstdlib>
using namespace std;

int main() {
  string a,b;
  cin >> a;
  for(int i = 0; i < a.length(); i++) {
    b = a;
    a.erase(i, 1);
    if(a.find(b[i]) != string::npos){
      a.erase(a.find(b[i]), 1);
      i--;
    }else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 384
N =int(input())
A = list(map(int,input().split()))
d ={}
r ={}
ans =0
for x in range(N):
    d[x] =0
    r[x] =0
for x in range(N):
    dt = A[x]+x
    rt = x-A[x]
    if dt<N:
        d[dt] +=1
    if rt >-1:
        r[rt] +=1
for x in range(N):
    if d[x] !=0 and r[x]!=0:
        ans = ans + d[x]*r[x]
print(ans)

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 30;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

// h(n, r) = c(n+r-1, r)
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
    fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
    ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
    return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main()
{
  int n, k; cin >> n >> k;
  combination C(2*n);
  auto H = [&](int n, int r) {
    return C(n+r-1, r);
  };

  for(int i = 1; i <= k; ++i) {
    if(n-k < i-1) {
      cout << 0 << endl;
      continue;
    }

    cout << (H(i, k-i)*H(i+1, n-k-(i-1))).x << endl;
  }
}

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

int main(){
	int N;
	cin >> N;
	vector<int> H(N);
	int count = 0, hight = 0;
	for (int i = 0;i < N;++i) {
		cin >> H[i];
		if (H[i] >= hight) {
			count++;
			hight = H[i];
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int ap = sc.nextInt();
        int all = 3*a+ap;
         if(all%2 == 0){
             System.out.println(all/2);
         }else{
             System.out.println(all/2);
         }

    }
}

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

int main() {
  int n;
  cin>>n;
  string blue[200];
  for (int i=0;i<n;i++) cin>>blue[i];
  int m;
  cin>>m;
  string red[200];
  for(int i=0;i<m;i++) cin>>red[i];
  int ans=0;
  for(int i=0;i<n;i++){
    int counter=0;
    for(int j=0;j<n;j++){
      if(blue[i]==blue[j])counter++;
    }
    for(int j=0;j<m;j++){
      if(blue[i]==red[j])counter--;
    }
    if (ans<=counter) ans=counter;
  }
  cout<<ans<<endl;
}

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

int main ()
{
	int k, a, b;
	cin >> k >> a >> b;
	for (int i = a; i <= b;i++) {
			if (i%k == 0) {
				cout << "OK\n";
				return 0;
			}
	}
	cout <<"NG\n";
	return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <stack>

using namespace std;

struct Node {
    bool operator<(const struct Node &arg) const {
        return weight < arg.weight;
    };
    int from, to, weight;
};

int parent[10000], height[10000];

int getParent(int id) {
    if (parent[id] == id)
        return id;
    else {
        return parent[id] = getParent(parent[id]);
    }
}

bool isSame(int a, int b) { return getParent(a) == getParent(b); }

void unite(int a, int b) {
    int a_parent = getParent(a);
    int b_parent = getParent(b);

    if (a_parent == b_parent) return;

    if (height[a_parent] > height[b_parent]) {
        parent[b_parent] = a_parent;
    } else {
        if (height[a_parent] == height[b_parent]) height[b_parent]++;
        parent[a_parent] = b_parent;
    }
}

int main() {
    int V, E;

    scanf("%d %d", &V, &E);
    Node nodes[E];

    for (int i = 0; i < V; i++) {
        parent[i] = i;
        height[i] = 0;
    }

    for (int i = 0; i < E; i++) {
        scanf("%d %d %d", &nodes[i].from, &nodes[i].to, &nodes[i].weight);
    }

    sort(nodes, nodes + E);

    int sum = 0;

    for (int i = 0; i < E; i++) {
        if (!isSame(nodes[i].from, nodes[i].to)) {
            sum += nodes[i].weight;
            unite(nodes[i].from, nodes[i].to);
        }
    }

    printf("%d\n", sum);

    return 0;
}



Measured memory_bytes: 3924
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;
     
     
void main() {
    auto A = readln.chomp.map!(x => x == '1').array;
    auto B = readln.chomp.map!(x => x == '1').array;
    auto N = A.length.to!int;
     
    if (A.any && !B.any) {
        writeln(-1);
        return;
    }
     
    auto L = new int[](N);
    auto R = new int[](N);
     
    foreach (i; 0..N) {
        foreach (j; 0..N) {
            if (B[((i-j)%N+N)%N]) {
                L[i] = j;
                break;
            }
        }
        foreach (j; 0..N) {
            if (B[(i+j)%N]) {
                R[i] = j;
                break;
            }
        }
    }

     
    int ans = 1 << 29;
     
    foreach (i; 0..N) { // A[i]を先頭にする
        int flip = 0;
        auto LR = new Tuple!(int, int)[](N);
     
        foreach (j; 0..N) {
            int k = (i + j) % N;
            if (B[j] != A[k]) {
                flip++;
                LR[j] = tuple(L[k], R[k]);
            } else {
                LR[j] = tuple(0, 0);
            }
        }

        // 左 -> 右
        LR.sort!"a[0] < b[0]";
     
        auto r_max = new int[](N + 1);
        r_max[N] = 0;
     
        for (int j = N - 1; j >= 0; j--) {
            r_max[j] = max(LR[j][1], r_max[j+1]);
        }

        foreach (j; 0..N) {
            int left = LR[j][0];
            int right = r_max[j+1] + left;
            int pos = i - left + right;
            pos = (pos % N + N) % N;
            pos = min(pos, N - pos);
            ans = min(ans, left + right + pos + flip);
            debug {writeln([i, j, left, right, pos]);}
        }


        // 右 -> 左
        LR.sort!"a[1] < b[1]";
     
        auto l_max = new int[](N + 1);
        l_max[N] = 0;
     
        for (int j = N - 1; j >= 0; j--) {
            l_max[j] = max(LR[j][0], l_max[j+1]);
        }

        foreach (j; 0..N) {
            int right = LR[j][1];
            int left = l_max[j+1] + right;
            int pos = i - left + right;
            pos = (pos % N + N) % N;
            pos = min(pos, N - pos);
            ans = min(ans, left + right + pos + flip);
            debug {writeln([i, j, left, right, pos]);}
        }        
    }
     
    ans.writeln;
}


Measured memory_bytes: 4348
import sys
import collections
n=int(input())
a=list(map(int,input().split()))
if 1 in a:
  if a.count(1)==1:
    print(1)
    sys.exit()
  else:
    print(0)
    sys.exit()
C=list(collections.Counter(a).items())
t=[] 
for i in range(len(C)):
  if C[i][1]>1:
    t.append(C[i][0])
t=set(t) #カブッタヤツら
b=list(set(a))
m=len(b)
b.sort()
Lst=[]
for i in range(m):
  l=2
  num=b[i]*l
  while num<10**6+1:
    Lst.append(num)
    l+=1
    num=b[i]*l
c=set(Lst)
d=set(b)
e=c&d
print(m-len(e)-len(t)+len(e&t))


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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int q; cin >> q;
  int cntb = 0;
  int cnta = 0;
  int cntab = 0;
  int ans = 0;

  while(q--) {
    string s; cin >> s;
    int n = s.size();
    if (s[0] == 'B') {
      cntb++;
    }
    if (s[n-1] == 'A') {
      cnta++;
    }
    if (s[0] == 'B' && s[n-1] == 'A') {
      cntab++;
    }
    for(int i=0; i<n-1; i++) {
      if (s[i] == 'A' && s[i+1] == 'B') {
        ans++;
      }
    }
  }

  if (cnta > 0 && cnta == cntb && cntb == cntab) {
    ans += cnta - 1;
  } else {
    ans += min(cnta, cntb);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int ans = 0;
		for(int i = 1;i <= N;i++) {
			if(i%2!=0) {
				int num = 0;
				for(int j = 1;j <=i;j++) {
					if(i%j==0)num++;
				}
				if(num==8)ans++;
			}
		}
		System.out.println(ans);
		scn.close();
	}
}


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

int main() {
  int N;
  cin>>N;
  vector<int> vec(100000000);
  for(int x=1;x<=100;x++){
    for(int y=1;y<=100;y++){
      for(int z=1;z<=100;z++){
        vec.at(x*x+y*y+z*z+x*y+y*z+z*x)++;
      }
    }
  }
  for(int i=1;i<=N;i++){
    cout<<vec.at(i)<<endl;
  }
}

Measured memory_bytes: 393832
#include<stdio.h>
int main()
{
    int n,i,j,t,s[100];
    while(scanf("%d",&n)!=EOF)
    {
        int sum=0;
        for(i=0;i<n;i++)
            scanf("%d",&s[i]);
        for(i=0; i<n; i++)
        {
            for(j=n-1; j>i; j--)
            {
                if(s[j]<s[j-1])
                {
                    t=s[j];
                    s[j]=s[j-1];
                    s[j-1]=t;
                    sum++;
                }
            }
        }
        for(i=0;i<n;i++)
        {
            printf("%d",s[i]);
            if(i!=n-1)
                printf(" ");
            else
                printf("\n");
        }
            
        printf("%d\n",sum);
    }
    return 0;
}


Measured memory_bytes: 2044
package main

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

func main() {
	stdin := bufio.NewScanner(os.Stdin)

	stdin.Scan()
	ab := strings.Split(stdin.Text(), " ")

	a, _ := strconv.Atoi(ab[0])
	b, _ := strconv.Atoi(ab[1])

	var aFlag bool
	if a % 2 == 0 {
		aFlag = true
	} else {
		aFlag = false
	}

	var bFlag bool
	if b % 2 == 0 {
		bFlag = true
	} else {
		bFlag = false
	}

	if aFlag || bFlag {
		fmt.Println("Even")
	} else {
		fmt.Println("Odd")
	}
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;

class P
{
    static void Main(string[] _)
    {
        decimal n = decimal.Parse(Console.ReadLine());
        int result = int.MaxValue;
        List<int> l = new List<int>();

        for (decimal i = 2; i <= (decimal)Math.Sqrt((double)n); i++)
        {
            if (n % i == 0)
            {
                result = Math.Min(result, Math.Max(i.ToString().Length, (n / i).ToString().Length));
            }
        }

        if (result != int.MaxValue)
        {
            Console.WriteLine(result);
        }
        else
        {
            Console.WriteLine(n.ToString().Length);
        }
    }
}


Measured memory_bytes: 13140
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    C,S,F=[0]*(N-1),[0]*(N-1),[0]*(N-1)
    for i in range(N-1):
        C[i],S[i],F[i]=map(int,input().split())
    for j in range(N):
        t=0
        for i in range(j,N-1):
            if t<=S[i]:
                t=S[i]
            else:
                t=-(-(t-S[i])//F[i])*F[i]+S[i]
            t+=C[i]
        print(t)

if __name__ == '__main__':
    main()


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

int main()
{
    long long int N;
    long long int P[200001];
    
    cin >> N;
    
    long long int count = 0;
    long long int min;
    for(long long int i=0; i<N; i++){
        cin >> P[i];
        if(i==0){
            min = P[i];
            count++;
        }
        if(P[i] < min){
            min = P[i];
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


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

int main(void)
{
    int h,w,flg;
    string ans1,ans2;

    while (true)
    {
        cin >> h >> w;
        if (h == 0 && w == 0)   break;

        flg = 0;
        ans1 = ans2 = "";
        rep(i, w)
        {
            if (flg == 0)
            {
                ans1 += "#";
                ans2 += ".";
                ++flg;
            }
            else
            {
                ans1 += ".";
                ans2 += "#";
                flg = 0;
            }
        }

        cout << ans1 << endl;
        flg = 0;
        for (int i = 1; i < h; i++)
        {
            if (flg == 0)
            {
                cout << ans2 << endl;
                ++flg;
            }
            else
            {
                cout << ans1 << endl;
                flg=0;
            }
        }

        cout << endl;
    }
}



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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

int main(){
    int N; cin >> N;
    vector<int> L(N); REP(i, N) cin >> L[i];

    sort(all(L));
    ll res = 0;

    for(int i = 0; i < N; ++i) {
        for(int j = i + 1; j < N; ++j) {
            // lower_boundから配列の先頭のイテレータを引くと、ある要素以下の個数を算出できる。
            int k = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();

            res += max(k - (j + 1), 0);
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 256
import io.StdIn.{readInt, readLine}
object Main extends App {
  val n = readInt
  val wrs = readLine

  val w_count = wrs.count(_ == 'W')
  val r_count = wrs.count(_ == 'R')
  
  val case1 = w_count
  val case2 = r_count
  val case3 = w_count - wrs.takeRight(w_count).count(_ == 'W')

  val result = Array(case1, case2, case3).min
  println(result)
}

Measured memory_bytes: 55168
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n = 0;
  cin >> n;
  vector<int> vec(n);
  for(int i = 0; i < n; i++){
    cin >> vec[i];
  }
  vector<int> copy (n);
  for(int i = 0; i < n; i++){
    copy[i] = vec[i];
  }
  sort(copy.begin(),copy.end());
  reverse(copy.begin(),copy.end());
  int max = copy[0];
  int secondmax = 0;
  for(int i = 0; i < n-1; i++){
    if (copy[i] >= copy[i+1]){
      secondmax = copy[i+1];
      break;
    }
  }
  for(int i = 0; i < n; i++){
    if(vec[i] < max){
      cout << max << endl;
    }
    else{
      cout << secondmax << endl;
    }
  }
}

Measured memory_bytes: 3200
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    string s;
    cin>>s;
    int size=s.size();
    int count=0;
    for(int i=0;i<int(size/2);i++)
    {
        if(s[i]!=s[size-1-i])count++;
    }
    cout<<count<<endl;

    return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  unordered_set<int> s;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (s.count(a)) {
      s.erase(a);
    } else {
      s.insert(a);
    }
  }
  cout << s.size() << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 4388
//4/N

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n;cin>>n;
    rep(i,1,3501)rep(j,1,3501){
        double a=4*i*j-n*j-n*i;
        double b=n*i*j;
        if(a==0)continue;
        double u=b/a;
        int t=ceil(u);
        if(t<1||t>3501)continue;
        if(t==u){
            cout<<i<<spa<<j<<spa<<t<<nnn;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
typedef long long LL;

LL n,m,k;
LL a[500005];

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	if(n == m) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

const int MOD = 1000000007;
const int INF = 1000000000;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}


int main(){
int N, K;
cin >> N >> K;
vector<ll> H(N);
REP(i, N) cin >> H[i];
sort(all(H));
reverse(all(H));

ll ans = 0;
REP(i, N){
  if(K > 0) K--;
  else if(K == 0) ans += H[i];
}

print(ans);

}




Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
int comp(const int *a,const int *b){
    return *a-*b;
}
int main(){
    int test,n,i,a[51],sum=0;
    scanf("%d %d",&test,&n);
    for(i=0;i<test;i++){
        scanf("%d",&a[i]);
    }
    qsort(a,test,sizeof(int),comp);
    for(i=0;i<n;i++){
        sum+=a[--test];
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
    string s[105],x;
    int h,w,c,k=0;
    scanf("%d%d",&h,&w);
    for(int i=0; i<h; i++)
    {
        cin>>x;
        if(x[0]=='.')
        {
            c=0;
            for(int j=0; j<w; j++)
            {
                if(x[j]=='.')
                {
                    c++;
                }
                else
                    break;
            }
            if(c==w){
                continue;
            }
        }
        s[k]=x;
        k++;
    }
    for(int i=0; i<k; i++)
    {
      for(int j=0;j<w;j++){
        if(s[i][j]=='.')
        {
            c=0;
            for(int a=0; a<k; a++)
            {
                if(s[a][j]=='.')
                {
                    c++;
                }
                else
                    break;
            }
            if(c==k){
                continue;
            }
        }
        printf("%c",s[i][j]);
    }
    if(i<k-1) puts("");
      }
    return 0;
}


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

#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif

//{{{
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x; while
(getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}

const int N = 3000 + 10;
const int mod = 1e9 + 7;

int n;
char ss[N];
LL dp[N][N];

LL s[N];

LL cal(int st, int ed)
{
    if (st > ed) return 0;
    LL ret = s[ed];
    if (st >= 1) ret -= s[st - 1];
    if (ret < 0) ret = (ret + mod) % mod;
    return ret;
}

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    while (~scanf("%d", &n))
    {
        scanf("%s", ss + 1);

        clr(dp, 0);
        dp[1][1] = 1;

        s[0] = 0;
        s[1] = 1;
        s[2] = 1;

        for (int i = 2; i <= n; i++)
        {
            char op = ss[i - 1];

            for (int j = 1; j <= i; j++)
            {
                if (op == '<')
                {
                    LL v = cal(1, j - 1);
                    dp[i][j] = v;
                    // for (int k = 1; k < j; k++)
                    //{
                    // dp[i][j] += dp[i - 1][k];
                    // dp[i][j] %= mod;
                    //}
                }
                else
                {
                    LL v = cal(j, i);

                    dp[i][j] = v;
                    // for (int k = j; k <= i; k++)
                    //{
                    // dp[i][j] += dp[i - 1][k];
                    // dp[i][j] %= mod;
                    //}
                }
            }

            for (int j = 1; j <= i + 1; j++) s[j] = (s[j - 1] + dp[i][j]) % mod;
        }

        LL ans = 0;
        for (int i = 1; i <= n; i++) ans = (ans + dp[n][i]) % mod;
        printf("%lld\n", ans);
    }

    return 0;
}


Measured memory_bytes: 74524
#include <cstdio>

int shop[100];
long long pro[100][11];

int main()
{
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < 10; ++j)
    {
      int f;
      scanf("%d", &f);
      if (f == 0) continue;
      shop[i] |= (1 << j);
    }
  }
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < 11; ++j)
    {
      scanf("%lld", pro[i] + j);
    }
  }

  long long ans = -1e14;
  for (int i = 1; i < (1 << 10); ++i)
  {
    long long p = 0;
    for (int j = 0; j < n; ++j)
    {
      p += pro[j][__builtin_popcount(i & shop[j])];
    }
    if (p > ans) ans = p;
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

float se(int n, float s[])
{
	float mu_1 = 0.0;
	float mu_2 = 0.0;

	for (int i = 0; i < n; i++) {
		mu_1 += s[i];
		mu_2 += s[i] * s[i];
	}
	mu_1 /= n;
	mu_2 /= n;

	return sqrt(mu_2 - mu_1 * mu_1);
}

int main()
{
	while (1) {
		int n;
		cin >> n;

		if (n == 0) break;

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

		printf("%.8f\n", se(n, s));
	}
}

Measured memory_bytes: 1248
h, w = map(int, input().split())
S = [list(input()) for i in range(h)]
for i in range(h):
    for j in range(w):
        if S[i][j] == '#':
            continue
        cnt = 0
        for dx in [-1, 0, 1]:
            for dy in [-1, 0, 1]:
                if not 0 <= i + dy < h or not 0 <= j + dx < w:
                    continue
                if S[i + dy][j + dx] == '#':
                    cnt += 1
        S[i][j] = str(cnt)
for s in S:
    print("".join(s))


Measured memory_bytes: 3188
import sys
 
n, m = [int(i) for i in input().split(" ")]
p = [0] + [int(i) for i in input().split(" ")]
par = [i for i in range(0, n + 1)]
id_set = [[] for i in range(0, n + 1)]
p_set = [[] for i in range(0, n + 1)]

sys.setrecursionlimit(10**6)
 
def root(x):
    if par[x] == x:
        return x
    else:
        r = root(par[x])
        par[x] = r
        return r

def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        par[x] = y

for i in range(0, m):
    x, y = [int(i) for i in input().split(" ")]
    unite(x, y)

for i in range(1, n + 1):
    r = root(i)
    id_set[r].append(i)
    p_set[r].append(p[i])
    
s = 0
for i in range(1, n + 1):
    if i == root(i):
        id_i = sorted(id_set[i])
        p_i = sorted(p_set[i])
        k = 0
        for j in range(0, len(id_i)):
            while k < len(p_i) and p_i[k] < id_i[j]:
                k += 1
            if k >= len(p_i):
                break
            if p_i[k] == id_i[j]:
                s += 1

print(s)

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

int gcd(int a,int b) {return b?gcd(b,a%b):a;}

const int maxn=1e5+10;

int n,a[maxn];

bool solve()
{
	int i;
	bool flag=0;
	for (i=1;i<=n;i++) flag|=a[i]==1;
	if (flag)
	{
		for (i=1;i<=n;i++) flag^=(a[i]-1)&1;
		return flag^1;
	}
	int odd=0,even=0;
	for (i=1;i<=n;i++) odd+=a[i]&1;
	even=n-odd;
	if (!even) return 0;
	if (even&1) return 1;
	if (odd>1) return 0;
	for (i=1;i<=n;i++) a[i]-=a[i]&1;
	int g=a[1];
	for (i=2;i<=n;i++) g=gcd(g,a[i]);
	for (i=1;i<=n;i++) a[i]/=g;
	return solve()^1;
}

int main()
{
#ifdef h10
	freopen("D.in","r",stdin);
	freopen("D.out","w",stdout);
#endif
	int i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	puts(solve()?"First":"Second");
}


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

typedef vector<int> vi;

const int INF = (int)1e9;
int N, M, R;
vi Q;
vector<vi> cost;

void warshall_floyd(void) {
	for (int k = 0; k < N; ++k) {
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j)
				cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
		}
	}
}

int solve(void) {
	sort(Q.begin(), Q.end());
	int min_cst = INF;
	do {
		int cst = 0;
		for (int i = 0; i < R - 1; ++i)
			cst += cost[Q[i]][Q[i + 1]];
		min_cst = min(cst, min_cst);
	} while (next_permutation(Q.begin(), Q.end()));
	return min_cst;
}

int main(void) {
	cin >> N >> M >> R;
	Q.resize(R);
	for (int i = 0; i < R; ++i) {
		int r;
		cin >> r;
		Q[i] = r - 1;
	}
	vi v(N, INF);
	cost.resize(N, v);
	for (int i = 0; i < N; ++i)
		cost[i][i] = 0;
	for (int i = 0; i < M; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
	}

	warshall_floyd();
	int ans = solve();

	cout << ans << '\n';
	return 0;
}


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

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

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    cout << (s < t ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = lambda : sys.stdin.readline().rstrip()
from collections import defaultdict

n = int(input())
d = defaultdict(list)
for i in range(n):
    s, p = input().split()
    d[s].append([int(p), i + 1])
keys = list(d.keys())
keys.sort()
ans = []
for key in keys:
    values = d[key]
    values = sorted(values, reverse=True)
    for i, j in values:
        ans.append(j)
for i in ans:
    print(i)





Measured memory_bytes: 38384
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = min(a) + min(b)

for i in range(M):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    p = a[x] + b[y] - c
    ans = min(ans, p)

print(ans)

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

#define dump(x) cout << (x) << endl
#define Int int64_t
#define fi first
#define se second
 
Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

int main() {
    Int n;
    cin >> n;
    vector<vector<pair<Int, Int>>> a(n);
    for (Int i = 0; i < n; i++) {
        Int x;
        cin >> x;
        vector<pair<Int, Int>> v(x);
        for (Int j = 0; j < x; j++) {
            cin >> v[j].fi >> v[j].se;
            v[j].fi--;
        }
        a[i] = v;
    }
    Int res = 0;
    for (Int bit = 0; bit < (1<<n); bit++) {
        bool check = true;
        for (Int i = 0; i < n; i++) {
            for (Int j = 0; j < a[i].size(); j++) {
                if ((bit & (1<<i)) and ((bit & (1<<a[i][j].fi)) != (a[i][j].se<<a[i][j].fi))) {
                    if (check) {
                       // cout << i << " " << bit << endl;
                    }
                    check = false;
                }
            }
        }
        if (check) {
            //dump(bit);
            Int cnt = 0;
            for (Int i = 0; i < n; i++) {
                if (bit & (1<<i)) {
                    cnt++;
                }
            }
            res = max(res, cnt);
        }
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 256
#[macro_export]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[doc(hidden)]
#[macro_export]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[doc(hidden)]
#[macro_export]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: i32,
    }
    // a = (n-7*b) / 4;

    let bmax = n / 7;
    let rem = (4 - n % 4) % 4;
    let ans = if rem <= bmax { "Yes" } else { "No" };

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;
const auto MOD = 1000000007;
const int INF = 1e9;
const long long LINF = 1e18;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef vector<int> VI;
typedef vector<long long> VLL;


long long n, m, a, b;
string s;

int main() {
	cin >> n >> m;
	if (m - n >= 2019) { cout << 0 << endl;return 0; }
	n = n % 2019;
	m = m - ((m - n - 1) / 2019) * 2019;
	int ans = 2020;
	for (int i = n; i < m; i++)
	{
		for (int j = i + 1; j <= m; j++)
		{
			ans = min(ans, (i*j) % 2019);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] a = new int [N];
        for (int i = 0;i < N ; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();
        int count = 0;
        for (int i = 1;i <= N; i++) {
            if (i % 2 == 1 && a[i-1] % 2 == 1){
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 35700
N = int(input())
a = list(map(int, input().split()))
#print(a)
b = [0]*(N)

for i in range(N, 0, -1):
    to = 0
    #print(i)

    for j in range(i-1, N ,i):
        to += b[j]

    if to%2 != a[i-1]:
        b[i-1] = 1
    #print(b)
if sum(b)==0:
    print(0)

else:
    print(sum(b))
    ans = str()
    for i in range(N):
        if b[i]:
            ans += str(i+1)+" "
    print(ans)

Measured memory_bytes: 13336
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include <iomanip>
#include<algorithm>
#include<vector>
#define rep(i,N) for(int (i)=0;(i) < (N); (i)++)

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a,b;
  cin >> a >> b;
  int ret = b;

  if(a <= 5){
    ret = 0;
  }else if(a <= 12){
    ret /= 2;
  }

  cout << ret << "\n";

  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

// add(pos, n): data[pos] += n;
// sum(l, r)  : sum [l, r)
template <typename T>
class FenwickTree
{
    const int n;
    vector<T> data;

  public:
    FenwickTree(int count) : n(count), data(count, 0) { ; }

    void add(int pos, const T &value)
    {
        assert(0 <= pos && pos < n);
        for (int i = pos; i < n; i |= i + 1)
        {
            data[i] += value;
            data[i] %= MOD;
        }
    }

    T sum(int pos) const
    {
        assert(0 <= pos && pos <= n);
        T res = 0;
        for (int i = pos - 1; i >= 0; i = (i & (i + 1)) - 1)
        {
            res += data[i];
            res %= MOD;
        }
        return res;
    }

    T sum(int l, int r) const
    {
        assert(0 <= l);
        assert(l <= r);
        assert(r <= n);
        return (sum(r) + MOD + (-sum(l))) % MOD;
    }
    using value_type = T;
    using update_type = T;
};

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

    int N, K;
    cin >> N >> K;
    vector<FenwickTree<ll>> dp(N + 1, FenwickTree<ll>(K + 10));
    dp[0].add(0, 1);
    for (int i = 1; i <= N; i++)
    {
        int a;
        cin >> a;
        for (int j = 0; j <= K; j++)
        {
            int mi = max(0, j - a);
            dp[i].add(j, dp[i - 1].sum(mi, j + 1));
        }
    }
    cout << dp[N].sum(K, K + 1) << endl;
}


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

int main(){
    ll n,m;
    cin >> n >> m;
    if(m<n)cout<<m/2;
    else if(m>2*n) cout<<(m-2*n)/4+n;
    else cout<<m/2;
    return 0;
}

Measured memory_bytes: 256
input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')[0].split(' ');
a = input.shift() * 1;
b = input.shift() * 1;
c = input.shift() * 1;

if (a <= c && c <= b){
  ans = "Yes";
}
else{  
  ans = "No";
}
console.log(ans)

Measured memory_bytes: 22204