akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int N;
    static int[] L;
    static void INPUT()
    {
        N = NextInt();
        L = LineInt();
    }

    static void OUT()
    {
        //var s = L.OrderByDescending(__ => __).ToArray();
        Array.Sort(L);
        var count = 0L;
        for (var a = 0; a < N; a++)
            for (var b = a + 1; b < N; b++)
            {
                count += LowerBound<int>(L, L[a] + L[b]) - 1 - b;
            }

        Console.WriteLine(count);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
    /// <summary>
    /// 指定した値以上の先頭のインデクスを返す
    /// </summary>
    /// <typeparam name="T">比較する値の型</typeparam>
    /// <param name="arr">対象の配列（※ソート済みであること）</param>
    /// <param name="start">開始インデクス [inclusive]</param>
    /// <param name="end">終了インデクス [exclusive]</param>
    /// <param name="value">検索する値</param>
    /// <param name="comparer">比較関数(インターフェイス)</param>
    /// <returns>指定した値以上の先頭のインデクス</returns>
    public static int LowerBound<T>(T[] arr, int start, int end, T value, IComparer<T> comparer)
    {
        int low = start;
        int high = end;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (comparer.Compare(arr[mid], value) < 0)
                low = mid + 1;
            else
                high = mid;
        }
        return low;

    }

    //引数省略のオーバーロード
    public static int LowerBound<T>(T[] arr, T value) where T : IComparable
    {
        return LowerBound(arr, 0, arr.Length, value, Comparer<T>.Default);
    }
}




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

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

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

const i64 MAXN = 300005;

i64 n;
i64 a[MAXN];

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;
    cout << n * n << endl;

    return 0;
}


Measured memory_bytes: 256
import numpy as np
N,M,C=map(int,input().split())
B=np.array([int(i) for i in input().split()])
A=np.array([[int(i) for i in input().split()] for j in range(N)])

ans=np.count_nonzero(np.dot(A,B)>-C)
print(ans)

Measured memory_bytes: 27112
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn =new Scanner(System.in);
		int A=scn.nextInt();
		int B=scn.nextInt();
		System.out.println(Math.max(A+B, Math.max(A-B, A*B)));

	}

}


Measured memory_bytes: 21204
import bisect
import itertools
n, m, k = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

rui_al = list(itertools.accumulate(al))
rui_bl = list(itertools.accumulate(bl))


ans = 0

for i in range(n):
    sum_a = rui_al[i]
    if sum_a >= k:
        continue
    j = bisect.bisect_right(rui_bl, k-sum_a)
    ans = max(ans, i+j+1)

for i in range(m):
    sum_b = rui_bl[i]
    if sum_b >= k:
        continue
    j = bisect.bisect_right(rui_al, k-sum_b)
    ans = max(ans, i+j+1)

j = bisect.bisect_right(rui_al, k)
ans = max(ans, j)
j = bisect.bisect_right(rui_bl, k)
ans = max(ans, j)

print(ans)


Measured memory_bytes: 132148
a, b = map(int, input().split())
while a%b != 0:
  a, b = b, a%b
ans = 1
if b%2==0:
  ans += 1
  while b%2==0:
    b = b//2
for i in range(3, int(b**0.5)+1, 2):
  if b%i==0:
    ans += 1
    while b%i==0:
      b = b//i
if b != 1:
  ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int p[100];
int n;
bool solve()
{
  REP(i,n) REP(j,n)
  {
    vector<int> v(p,p+n);
    swap(v[i],v[j]);
    bool f = 1;
    REP(k,n-1) {
      if (v[k] > v[k+1]) f = 0;
    }
    if (f) return true;
  }
  return false;
}

int main() {
  while(cin>>n) {
    inputs(p,n);
    cout << (solve() ? "YES" : "NO") << endl;
  }
}


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


int main() {
    int T;

    int H, N, maxA = 0, res = 1e9;
    cin >> H >> N;
    vector<int> A(N), B(N);

    for (int i = 0; i < N; ++i) {
        cin >> A[i] >> B[i];
        maxA = max(maxA, A[i]);
    }

    vector<int> dp(H + maxA, 1e9);
    dp[0] = 0;

    for (int i = 0; i < N; ++i) {
        int a = A[i], b = B[i], x;
        for (x = a; x < H + maxA; ++x) {
            dp[x] = min(dp[x], dp[x - a] + b);
        }
    }
    for (int x = H; x < H + maxA; ++x)
        res = min(res, dp[x]);
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define ll long long
#define MOD 1e9+7
using namespace std;

ll getNumberOfPairs(vector<vector<bool>> compatibility,int n) {
	ll res=0;
	vector<ll> dp(1<<n);
	dp[0]=1;
	for(int mask=0;mask<(1<<n)-1;mask++) {
		int men=__builtin_popcount(mask);
		for(int women=0;women<n;women++) {
			if(compatibility[men][women] && !(mask&(1<<women))) {
				int partner=mask^(1<<women);
				dp[partner]+=dp[mask];
				dp[partner]%=(ll)MOD;
			}
		}
	}
	res=dp[(1<<n)-1];
	return res;
}

int main() {
	int n=0;
	cin>>n;
	vector<vector<bool>> compatibility(n,vector<bool>(n,false));
	int tmp=0;
	for(int i=0;i<n;i++) {
		for(int j=0;j<n;j++) {
			cin>>tmp;
			compatibility[i][j]=tmp==0?false:true;
		}
	}
	cout<<getNumberOfPairs(compatibility,n)<<endl;
	return 0;
}

Measured memory_bytes: 19608
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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


static const double EPS = 1e-8;

int tx[] = {-1,0,1,0};
int ty[] = {0,1,0,-1};

char stage[101][101];
int W,H;

string larger(const string& str1,const string& str2){
	if(str1.size() > str2.size()) return str1;
	if(str1.size() < str2.size()) return str2;

	for(int i=0;i<str1.size();i++){
		if(str1[i] > str2[i] ) return str1;
		if(str1[i] < str2[i] ) return str2;
	}

	return str1;
}

void dfs(int x,int y,string buf,string& res){
	buf.push_back(stage[y][x]);

	if(y+1 < H && isdigit(stage[y+1][x])){
		dfs(x,y+1,buf,res);		
	}

	if(x+1 < W && isdigit(stage[y][x+1])){
		dfs(x+1,y,buf,res);
	}

	res = larger(res,buf);
}

int main()
{
	while(~scanf("%d %d",&W,&H)){
		if(W==H && H==0) break;
		for(int y=0;y<H;y++){
			char buf[128];
			scanf("%s",buf);
			for(int x=0;x<W;x++){
				stage[y][x] = buf[x];
			}
		}

		string dp[101][101];
		//for(int x=0;x<W;x++) 
		//	if(isdigit(stage[0][x]) && stage[0][x] != '0'){
		//	dp[1][x+1] = dp[0][x] + stage[0][x];
		//	printf("dp[%d][%d]=%s\n",0,x+1,dp[0][x+1].c_str());
		//}

		//for(int y=0;x<W;y++) 
		//	if(isdigit(stage[0][x]) && stage[0][x] != '0'){
		//	dp[1][x+1] = dp[0][x] + stage[0][x];
		//	printf("dp[%d][%d]=%s\n",0,x+1,dp[0][x+1].c_str());
		//}

		for(int y=0;y<H;y++){
			for(int x=0;x<W;x++){
				string left="";
				if(isdigit(stage[y][x])){
					if(!(dp[y+1][x].size() == 0 && stage[y][x]=='0')){
						left = dp[y+1][x] + stage[y][x];
					}
				}

				string up="";
				if(isdigit(stage[y][x])){
					if(!(dp[y][x+1].size() == 0 && stage[y][x]=='0')){
						up = dp[y][x+1] + stage[y][x];
					}
				}

				dp[y+1][x+1] = larger(left,up);
			}
		}

		string res="0";
		for(int y=0;y<=H;y++){
			for(int x=0;x<=W;x++){	
				res = larger(res,dp[y][x]);
			}
		}
		cout << res << endl;
	}

}

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

int main() {
  int N,K;
  int A[500];
  cin >> N >> K;
  int sum=0;
  for (int i=0;i<N;i++) {
    cin >> A[i];
    sum += A[i];
  }
  vector<int> factor(0);
  for (int p=1;p*p<=sum;p++) {
    if (sum%p==0) {
      factor.push_back(p);
      factor.push_back(sum/p);
    }
  }
  sort(factor.begin(),factor.end());
  for (int i=factor.size()-1;i>=0;i--) {
    int k = factor[i];
    vector<int> rem(0);
    int remsum=0;
    for (int j=0;j<N;j++) {
      rem.push_back(A[j]%k);
      remsum += A[j]%k;
    }
    sort(rem.begin(),rem.end());
    int remsum_pos=0;
    for (int j=0;j<N-remsum/k;j++) remsum_pos += rem[j];
    if (remsum_pos <= K) {
      cout << k << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
    long long N,M;    cin>>N>>M;
    long long ans;
    if(N==1&&M==1){
        cout<<"1"<<endl;
        return 0;
    }
    if(N==1){
        cout<<M-2<<endl;
        return 0;
    }
    if(M==1){
        cout<<N-2<<endl;
        return 0;
    }
    ans=(N-2)*(M-2);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int a,b,c; cin >> a >> b >> c;
    bool ok=0;
    if(a==b&&b!=c)ok=1;
    if(b==c&&a!=c)ok=1;
    if(c==a&&a!=b)ok=1;
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
def solve(bit):
    ret = 0
    for i in range(n):
        cnt = 0
        for j in range(10):
            if L[i][j] == bit[j] == 1:
                cnt += 1
        ret += p[i][cnt]
    return ret

n = int(input())
L = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
ans = -float('inf')
for i in range(1 << 10):
    bit = [0] * 10
    for j in range(10):
        if i >> j & 1:
            bit[j] = 1
    if 1 in bit:
        ans = max(ans, solve(bit))
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<vector<int>> r(201, vector<int>(201));
    vector<vector<int>> b(201, vector<int>(201));
    for(int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        r[x][y] = 1;
    }
    for(int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        b[x][y] = 1;
    }

    int count = 0;
    for(int i = 1; i < 200; i++)
    {
        for(int j = 1; j < 200; j++)
        {
            if(b[i][j] == 0) continue;
            bool flag = false;
            for(int k = j-1; k >= 0; k--)
            {
                for(int m = i-1; m >= 0; m--)
                {
                    if(r[m][k] == 0) continue;
                    r[m][k] = 0;
                    count++;
                    flag = true;
                    break;
                }
                if(flag) break;
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 640
n=int(input())
arr=list(map(int,input().strip().split()))[:n]
limit=10**18
mul=1
if(0 in arr):
	print(0)
else:
	for i in arr:
		mul*=i
		if(mul > limit):
			print(-1)
			break
	if(mul <= limit):
		print(mul)

Measured memory_bytes: 21696
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s;
    cin >> s;
    long long mod=1e9+7;
    int n=s.length();
    long long dp[n+1][4];
    for (int i=0; i<=2; i++){
        dp[n][i]=0;
    }
    dp[n][3]=1;
    string abc="ABCD";
    for(int i=n-1; i>=0; i--){
        for (int j=0; j<4; j++){
            if (s[i]=='?'){
                if (j==3){
                    dp[i][j]=3*dp[i+1][j]%mod;
                }
                else {
                    dp[i][j]=(3*dp[i+1][j]+dp[i+1][j+1])%mod;
                }
            }
            else {
                if (s[i]==abc[j]){
                    if (j!=3){
                        dp[i][j]=(dp[i+1][j]+dp[i+1][j+1])%mod;
                    }
                    else {
                        dp[i][j]=dp[i+1][j];
                    }
                }
                else {
                    dp[i][j]=dp[i+1][j];
                }
            }
        }
    }
    cout <<dp[0][0];
}
    

Measured memory_bytes: 3584
#include <iostream>
using namespace std;
 
struct Card{char suit, value;};
 
void bubble(struct Card A[], int N){
    for(int i=0;i<N;i++){
        for(int j=N-1;j>=i;j--){
            if(A[j].value < A[j-1].value){
                Card t=A[j];A[j]=A[j-1];A[j-1]=t;
            }
        }
    }
}
 
void selection(struct Card A[], int N){
    for(int i=0;i<N;i++){
        int min_j=i;
        for(int j=i;j<N;j++){
            if(A[j].value<A[min_j].value) min_j=j;
        }
        Card t=A[i];A[i]=A[min_j];A[min_j]=t;
    }
}
 
void exp(struct Card A[], int N){
    for(int i=0;i<N;i++){
        if(i > 0)cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}
 
bool isStable(struct Card C1[], struct Card C2[], int N){
    for(int i=0;i<N;i++){
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}
 
int main(){
    Card C1[100], C2[100];
    int N;
    char ch;
 
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> C1[i].suit >> C1[i].value;
    }
    for(int i=0;i<N;i++)C2[i]=C1[i];
    bubble(C1, N);
    selection(C2, N);
    exp(C1, N);
    cout << "Stable" << endl;
    exp(C2, N);
    if(isStable(C1, C2, N)){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }
    return 0;
}

Measured memory_bytes: 3088
first = input().split()
n = int(first[0])
r = int(first[1])
while n != 0 or r != 0:
    i = 0
    card = list(range(1,n+1))[::-1]
    while i < r:
        sh = input().split()
        p, c = list(map(int,sh))
        card = card[p-1:p+c-1] + card[:p-1] + card[p+c-1:]
        i = i + 1
    print(card[0])
    next = input().split()
    n, r = list(map(int,next))

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

int main(){
  int k,a,b;
  cin >>k >>a >>b;
  bool can = false;
  for(int i = a; i<=b; i++){
    if(i%k==0) {
      can = true;
      break;
    }
  }
  if(can) cout << "OK" << endl;
  else cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>

int main(){
  int n,i,j,count,check,turn,seq[16],sub[16];

  while(1){
    scanf("%d",&n);
    if(n == 0)break;
    else
      {
	turn=0;
	for(i=0;i<n;i++)scanf("%d",&seq[i]);
	while(1){
	  count=0;
	  check=0;
	
	for(i=0;i<n;i++){
	  count=0;
	  for(j=0;j<n;j++){
	    if(seq[i]==seq[j])count++;
	  }
	  sub[i]=count;
	}
	for(i=0;i<n;i++){
	  if(seq[i]==sub[i])check++;}
	if(check==n)break;
	else{
	  turn++;
	  for(i=0;i<n;i++){
	    seq[i]=sub[i];
	    sub[i]=0;
	  }
	}
	}
	printf("%d\n",turn);
	for(i=0;i<n;i++){
	  if(i==0)printf("%d",seq[i]);
	  else{
	    printf(" %d",seq[i]);}
	}
	printf("\n");
      }
  }



  return 0;
}

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

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
		cout << fixed << setprecision( 10 );
	}

	void solve() {
		string n;
		cin >> n;
		cout << count( n.begin(), n.end(), '2' ) << endl;
	}
};

int main() {
	Solver().solve();
	return 0;
}


Measured memory_bytes: 256
///created: 29/May/2019 08:59:18

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n;
ll x, p[51], f[51];

ll calc(int n, ll x) {
	if (n == 0) return x >= 1;
	if (x <= 1 + p[n - 1]) return calc(n - 1, x - 1);
	return f[n - 1] + calc(n - 1, x - 2 - p[n - 1]) + 1;
}

int main() {
	cin >> n >> x;
	p[0] = 1;
	for (int i = 1; i <= 50; ++i)
		p[i] = 3LL + 2LL * p[i - 1];
	f[0] = 1;
	for (int i = 1; i <= 50; ++i)
		f[i] = 1LL + 2LL * f[i - 1];
	printf("%lld", calc(n, x));
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
    fast;
    lli n;
    cin>>n;
    lli a[n],i,ans=0;
    fr(i,n)
    {
        cin>>a[i];
    }
    for(i=1;i<n;i++)
    {
        if(a[i]>=a[i-1])
            continue;
        else
        {
            ans+=a[i-1]-a[i];
            a[i]=a[i-1];
        }
    }
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 5216
#include <cstdio>

using namespace std;

template<typename Type>
void Get_Val(Type &Ret)
{
	Ret = 0;
	char ch;
	while (ch = getchar(), ch > '9' || ch < '0')
		;
	do
	{
		(Ret *= 10) += ch - '0';
	}
	while (ch = getchar(), ch >= '0' && ch <= '9');
}

const int Max_N(100050);
const int Max_Q(100050);
typedef long long int LL;

int N, Q;
LL V[Max_Q];

void init()
{
	int _Q;
	Get_Val(N), Get_Val(_Q);
	V[++Q] = N * 1LL;
	while (_Q--)//把V处理成严格递增的情况 
	{
		Get_Val(V[++Q]);
		while (Q - 1 >= 1 && V[Q - 1] >= V[Q])
			V[Q - 1] = V[Q], --Q;
	}
}

/*
设S[i]表示进行前i次操作得到的答案，solve(i, l)表示进行前i次操作，序列前l个数的答案，其中l <= V[i]。显然有S[i] = solve(i, V[i])
solve(i, l) = S[i - 1] * floor(l / V[i - 1]) + solve(i - 1, l mod V[i - 1])
对于solve(i - 1, l mod V[i - 1])，可以直接往前跳找到第一个有意义的操作，这样只会跳log次
Cnt[i]表示S[i]在最终答案中出现了多少次，倒推计算Cnt[i]，每次solve的过程可以把贡献加到Cnt上
*/

LL Cnt[Max_Q], Ans[Max_N];

inline void insert(const int &l, const int &r, const LL &v)
{
	Ans[l] += v, Ans[r + 1] -= v;
}

void solve(const int &x, const LL &l, const LL &cnt)
{
	if (x == 1)
	{
		Cnt[1] += cnt * (l / V[1]);
		insert(1, static_cast<int>(l % V[1]), cnt);
	}
	else
	{
		Cnt[x - 1] += cnt * (l / V[x - 1]);
		if (l % V[x - 1] == 0LL)
			return;
		int up(1), down(x), mid;
		while (up < down)
		{
			mid = up + ((down - up) >> 1);
			if (l % V[x - 1] >= V[mid - 1])
				up = mid + 1;
			else
				down = mid;
		}
		solve(up - 1, l % V[x - 1], cnt);
	}
}

int main()
{
	init();
	Cnt[Q] = 1LL;
	for (int i = Q;i >= 2;--i)
		solve(i, V[i], Cnt[i]);
	insert(1, V[1], Cnt[1]);
	for (int i = 1;i <= N;++i)
		printf("%lld\n", Ans[i] += Ans[i - 1]);
	return 0;
}

Measured memory_bytes: 3968
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;

typedef long long ll;

int R, C, K;
ll val[3000 + 10][3000 + 10];
ll dp[3000 + 10][3000 + 10][4];

int main() {
	//No sub撤退しないぞ
	cin >> R >> C >> K;
	for (int i = 0; i < K; i++) {
		int r, c;
		cin >> r >> c;
		r--, c--;
		cin >> val[r][c];
	}
	
	dp[0][0][0] = 0, dp[0][0][1] = val[0][0];
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) {
			for (int pick = 0; pick <= 3; pick++) {
				if (i + 1 < R) {
					dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][pick]);
					dp[i + 1][j][1] = max(dp[i + 1][j][1], dp[i][j][pick] + val[i + 1][j]);
				}
				if (j + 1 < C) {
					dp[i][j + 1][pick] = max(dp[i][j + 1][pick], dp[i][j][pick]);
					if (pick <= 2) {
						dp[i][j + 1][pick + 1] = max(dp[i][j + 1][pick + 1], dp[i][j][pick] + val[i][j + 1]);
					}
				}
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i <= 3; i++)ans = max(ans, dp[R - 1][C - 1][i]);
	cout << ans << endl;
	return 0;
}

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

int main(){
  int n, c, k;
  cin >> n >> c >> k;
  int t[n];
  for(int i = 0; i < n; ++i) cin >> t[i];
  sort(t, t+n);

  int cnt = 1;
  int last_time = t[0] + k;
  int pas = 1;

  for(int i = 1; i < n; ++i){
    if(pas >= c || t[i] > last_time){
      cnt++;
      last_time = t[i] + k;
      pas = 1;
    }
    else pas++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    int a, b, c, ans = 0;
    cin >> a >> b >> c;
    for(int i = a; i <= b; i++) {
        if (c % i == 0) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3124
const main = arg => {
    let input = arg.trim();

    const a = BigInt(input.split(' ')[0]);
    const b = BigInt(input.split(' ')[1].replace('.', ''));
    let ret = a * b / BigInt(100)
    console.log(String(ret).replace('n', ''));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 29440
// nCrの記憶配列から解く

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

long long mod = 1e9 + 7;

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n+1, vector<long long>(n+1, 0));
  for ( int i = 0; i < v.size(); i++ ) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for ( int j = 1; j < v.size(); j++ ) {
    for ( int k = 1; k < j; k++ ) {
      v[j][k] = (v[j-1][k-1] + v[j-1][k]);
      v[j][k] %= mod;
    }
  }
  return v;
}

int main() {
  int n, k;
  cin >> n >> k;
  
  vector<vector<long long> > c = comb(n);

  for ( int i = 1; i <= k; i++ ) {
    if ( i+1 <= n-k+2 ) {
      cout << ( c[k-1][i-1] * c[n-k+1][i] ) % mod << endl;
    } else {
      cout << 0 << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 31616
#include<bits/stdc++.h>
#define pb push_back 
#define ff first
#define ss second
#define mod 1000000007
#define ll long long int
using namespace std;


int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
 
   int n,m;
   cin>>n>>m;
   
   map<int,vector<string> > mp;
   for(int i=0;i<m;i++)
   {
	   int p;
	   string q;
	   cin>>p>>q;
	   mp[p].pb(q);
   }
   
   int wa=0,ac=0;
   for( map<int,vector<string> >:: iterator it=mp.begin();it!=mp.end();it++)
   {
	   vector<string> v=it->second;
	   int p=0;
	   for(int i=0;i<v.size();i++)
	   {
		   if(v[i]=="WA")
		    p++;
		   else
		   {   ac++;
			   wa+=p;
			   break;
		   }
	   }
   }
   
   cout<<ac<<" "<<wa;
   return 0;
}



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

using namespace std;

const int Nmax = 1e5 + 5;
bool seen[Nmax];
vector<int> G[Nmax];
vector<pair<int,int> > dp;
int N, M, x, y;

void bfs(int node)
{
    queue <int> Q;

    Q.push(node);
    seen[node] = 1;
    dp[node] = {0,0};

    while(!Q.empty())
    {
        node = Q.front();

        for(int i : G[node])
        {
            if(!seen[i])
            {
                dp[i] = {dp[node].first + 1, node};
                seen[i] = 1;
                Q.push(i);
            }
            else if(dp[node].first + 1 < dp[i].first)
            dp[i] = {dp[node].first + 1, node};
        }

        Q.pop();
    }
}

int main()
{
    cin >> N >> M;

    dp.assign(N + 1, {Nmax + 1,0});

    while(M--)
    {
        cin >> x >> y;
        G[x].push_back(y);
        G[y].push_back(x);
    }

    bfs(1);

    bool OK = 0;

    for(int i = 2; i <= N; ++i)
        if(!(dp[i].second))
        {
            OK = 1;
            break;
        }

    if(OK)
        cout << "No";
    else
    {
        cout << "Yes\n";

        for(int i = 2; i <= N; ++i)
            cout << dp[i].second << '\n';
    }
    return 0;
}


Measured memory_bytes: 10732
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;
using ll = long long;

vector<vector<int>> f(vector<vector<int>>& a, int c) {
	int m = a.size();
	int n = a[0].size();
	//cout << m << " " << n << endl;
	vector<vector<int>> na;
	if (c + c <= n) {
		na.resize(m);
		for (int i = 0; i < m; i++) na[i].resize(n - c);
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < c; j++) {
				//cout << na.size() << " " << na[0].size() << " " << i << " " << j << " " << c + c - 1 - j << "\n";
				na[i][j] = a[i][c - 1 - j] + a[i][c + j];
			}
			for (int j = c; j < na[i].size(); j++) {
				na[i][j] = a[i][j + c];
			}
		}
	}
	else {
		na.resize(m);
		for (int i = 0; i < m; i++) na[i].resize(c);
		int cnt = n - c;
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < cnt; j++) {
				na[i][j] = a[i][c + j] + a[i][c - 1 - j];
			}
			for (int j = cnt; j < na[i].size(); j++) {
				na[i][j] = a[i][c - 1 - j];
			}
		}
	}
	return na;
}
void suzuken() {
	ll n, m, t, p; scanf("%lld %lld %lld %lld", &n, &m, &t, &p); if (n == 0 and m == 0 and t == 0 and p == 0) exit(0);
	vector<vector<int>> a(m, vector<int>(n, 1));
	while (t--) {
		int d, c; scanf("%d %d", &d, &c);
		vector<vector<int>> na;
		if (d == 1) {
			na = f(a, c);
		}
		else {
			vector<vector<int>> b(n, vector<int>(m));
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++) {
					b[n - 1 - j][m - 1 - i] = a[i][j];
				}
			}

			auto nb = f(b, c);

			na = vector<vector<int>>(nb[0].size(), vector<int>(nb.size()));
			for (int i = 0; i < nb.size(); i++) {
				for (int j = 0; j < nb[0].size(); j++) {
					na[nb[0].size() - 1 - j][nb.size() - 1 - i] = nb[i][j];
				}
			}

		}
		a = na;
		m = a.size();
		n = a[0].size();
		/*
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				cerr << a[i][j];
			}
			cerr << "\n";
		}
		*/
	
	}

	while (p--) {
		int x, y; scanf("%d %d", &x, &y);
		//cerr << "^^^^^^^^^^^^^^^^^^^^^^^^" << "\n";
		cout << a[m - 1 - y][x] << "\n";
		//cerr << "^\\\\\\\\\\\\\\\\\\\\\\\\\\" << "\n";
	}
	//cout << res << "\n";
}
int main() {
	int kkt = 89;
	while (kkt) {
		suzuken();
	}
}


Measured memory_bytes: 3252
#include <iostream>
using namespace std;
int main(){
  int h, n, t, sum = 0;
  cin >> h >> n;
  for(int i=0; i < n; i++){
    cin >> t;
    sum += t;
  }
  if (sum < h)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}

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

int dp[10001];
int n, W;
int v[100];
int w[100];

int main(){

  cin >> n >> W;

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

  for(int i = 0; i < n; i++){
    for(int j = w[i]; j <= W; j++){
      dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
    }
  }

  cout << dp[W] << endl;

}

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

#define mod 1000000007

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

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
ll a[100100][3], dp[100100][3] = {};

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

int main(void){
	
	int N;
	
	cin >> N;
	
	rep(i, N)
		rep(j, 3)
			cin >> a[i][j];

	rep(i, N){
		rep(j, 3){
			rep(k, 3){
				if(j == k)
					continue;
				chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
			}
		}
	}
	
	ll ans = 0;
	rep(i, 3)
		chmax(ans, dp[N][i]);
		
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;
class Main{
	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		String str=sc.next();
		for(int i=0;i<str.length();i++) {
			if(i%2==0) {
				System.out.print(str.charAt(i));
			}
		}
		System.out.println();
	}
}

Measured memory_bytes: 30344
package main

import (
	"fmt"
)

func sumNum(n int) int {
	var sum int
	for n > 0 {
		sum += n%10
		n /= 10
	}
	return sum
}

func main() {
	var n,a,b,total int
	fmt.Scanf("%d %d %d", &n, &a, &b)

	for i := 1; i < n+1; i++ {
		if v := sumNum(i); a <= v && v <= b {
			total += i
		}
	}
	fmt.Println(total)
}


Measured memory_bytes: 1832
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)

const ll MOD = 1000000007;

using namespace std;

int C[505], S[505], F[505], A[505];

int main()
{
	int N;
	cin >> N;
	REP(i, N - 1)
	{
		cin >> C[i] >> S[i] >> F[i];
	}
	REP(i, N - 1)
	{
		int t = 0;
		FOR(j, N - 1, i)
		{
			t = std::max(t, S[j]);
			if (t%F[j] != 0)t += F[j] - t%F[j];
			t += C[j];
		}
		A[i] = t;
	}
	A[N - 1] = 0;
	REP(i, N)
	{
		cout << A[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] t = new int[10];

        for(int i = 0; i < 10; i++){
            t[i] = sc.nextInt();
        }
        Arrays.sort(t);

        for(int i = 9; i >= 7; i--){
            System.out.println(t[i]);
        }
    }
}

Measured memory_bytes: 12000
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    s1 = S()
    s2 = S()
    i = 0
    f = 0
    if s1[i] == s2[i]:
        ans = 3
        i += 1
        f = 1
    else:
        ans = 6
        i += 2
    while i < n:
        if s1[i] == s2[i]:
            ans *= 2 if f else 1
            ans %= mod
            i += 1
            f = 1
            continue
        i += 2
        ans *= 2 if f else 3
        f = 0
        ans %= mod
    print(ans)
    return


#main
if __name__ == '__main__':
    solve()


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

struct SegTree{
    int NN;
    int dval;
    vector<int> seg;

    void init(int n, int val){
        NN = 1;
        dval = val;
        while (NN < n)
            NN <<= 1;

        seg = vector<int>(NN * 2);
    }

    void gather(int u){
        seg[u] = max(seg[u * 2 + 1], seg[u * 2 + 2]);
        return ;
    }

    void build(int u, int l, int r, vector<int> &a){
        if (r - l == 1){
            if (l >= (int) a.size())
                seg[u] = dval;
            else
                seg[u] = a[l];
            return ;
        }

        int m = (l + r) / 2;
        build(u * 2 + 1, l, m, a);
        build(u * 2 + 2, m, r, a);
        gather(u);

        return ;
    }

    void update(int idx, int u, int l, int r, int x){
        if (r - l == 1 && idx == l){
            seg[u] += x;
            return ;
        }
        if (idx < l || idx >= r){
            return ;
        }

        int m = (l + r) / 2;
        update(idx, u * 2 + 1, l, m, x);
        update(idx, u * 2 + 2, m, r, x);
        gather(u);

        return ;
    }

    int query(int a, int b, int u, int l, int r){
        if (r <= a || b <= l){
            return dval;
        }
        if (a <= l && r <= b){
            return seg[u];
        }

        int m = (l + r) / 2;
        int res1 = query(a, b, u * 2 + 1, l, m);
        int res2 = query(a, b, u * 2 + 2, m, r);

        return max(res1, res2);
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h, w, m;
    cin >> h >> w >> m;

    vector<int> r_cnt(h), c_cnt(w);
    vector<vector<int>> x(h, vector<int>());
    for (int i = 0; i < m; i++){
        int r, c;
        cin >> r >> c;
        r--; c--;
        r_cnt[r] += 1;
        c_cnt[c] += 1;

        x[r].push_back(c);
    }

    SegTree seg;
    seg.init(w, 0);
    seg.build(0, 0, seg.NN, c_cnt);

    int ans = 0;
    for (int r = 0; r < h; r++){
        for (auto c: x[r])
            seg.update(c, 0, 0, seg.NN, -1);
        
        ans = max(ans, r_cnt[r] + seg.query(0, w, 0, 0, seg.NN));

        for (auto c: x[r])
            seg.update(c, 0, 0, seg.NN, 1);
    }

    cout << ans << '\n';


    return 0;
}


Measured memory_bytes: 26176
x = int(input())
if x<=599:
  ans=8
elif x<=799:
  ans=7
elif x<=999:
  ans=6
elif x<=1199:
  ans=5
elif x<=1399:
  ans=4
elif x<=1599:
  ans=3
elif x<=1799:
  ans=2
elif x<=1999:
  ans=1
print(ans)

Measured memory_bytes: 9124
#include <stdio.h>
#include <algorithm>
#include <functional>
typedef long long ll;

int main(void) {
  ll i, j, k, n, ans = 0;
  scanf("%lld%lld", &n, &k);
  ll h[n];
  for(i = 0; i < n; ++i) scanf("%lld", &h[i]);
  std::sort(h, h + n, std::greater<ll>());
  for(i = k; i < n; ++i) ans += h[i];
  printf("%lld", ans);
  return 0;
}

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

int main(){
  ll N;cin>>N;
  vector<ll> C(N),S(N),F(N);rep(i,N-1)cin>>C[i]>>S[i]>>F[i];
  vector<ll> ans(N);
  rep(i,N-1){
    ll t=0;
    for(int j=i;j<N-1;++j){
      if(t<=S[j]) t=S[j]+C[j];
      else{
        t=((t-S[j]+F[j]-1)/F[j])*F[j]+S[j]+C[j];
      }
    }
    cout << t << endl;
  }
  cout << 0 << endl;
}

Measured memory_bytes: 256
//**KEEP IT SHORT AND SIMPLE**
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define REP(i,a,b) for (int i = a; i < b; i++)
#define NL '\n'
#define F first
#define S second
#define dot(a, b) (conj(a) * (b)).real()
#define cross(a, b) (conj(a)* (b)).imag()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef bool bl;
typedef vector < vector<long long> > vvl;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
typedef map <long long, long long> mll;
typedef map <long long, bool> mlb;
typedef priority_queue<long long, vector<long long>, greater<long long> > minPq;
typedef tuple<ll, ll, ll> line;
typedef complex<double> point;
const double pi = 2 * acos(0.0);
const int OO = 0x3f3f3f3f;
ld fp(ld b, ll p)
{
    if(!p)  return 1.0;
    ld ans = fp(b, p / 2);
    ans *= ans;
    if(p & 1)   ans *= b;
    return ans;
}
int main()
{
    IO
    vll v;
    v.push_back(1);
    while(v[v.size() - 1] * 2 < 1000000000000)
        v.push_back(v[v.size() - 1] * 2);
    ll n, k;
    ld out = 0;
    cin >> n >> k;
    REP(i, 1, n + 1)
    {
        ll Start = 0, End = v.size() - 1, Mid, ans = -1;
        while(Start <= End)
        {
            Mid = (Start + End) >> 1;
            if(i * v[Mid] >= k)
            {
                End = Mid - 1;
                ans = Mid;
            }
            else
                Start = Mid + 1;
        }
        out += fp(0.5, ans);
    }
    cout << fixed << setprecision(12) << out * 1 / n;
    return 0;
}


Measured memory_bytes: 256
//author rhythmicankur
                                                                  //god_is_almighty
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#define f 	first
#define s 	second
#define ll 	int
#define int 	long long
#define ld 	long double
#define pb 	push_back
#define eb 	emplace_back
#define mk 	make_pair
#define vi 	vector<int>
#define pii 	pair<int,int>
#define vpi 	vector<pii>
#define fori(a,b,c) for(register int i=a;i<b;i+=c)
#define ford(a,b,c) for(register int i=a;i>=b;i-=c)
#define 	PI acos(-1)
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define M1 	998244353
#define M2 	1000000007
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); } 
#define test4(x,y,z,a) 		cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<"  |  "<<#a<<": "<<a<<endl;
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
ll power(ll a,ll b,ll m=M2){ll answer=1;while(b){if(b&1)answer=(answer*a)%m;b/=2;a=(a*a)%m;}return answer;}
using namespace std;
void ctrl()
{
	cout<<"Control\n";
}
signed main()
{	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int t;
	cin>>t;
	
    cout<<(t*t*t);

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <tuple>
#include <queue>
using namespace std;

typedef long long ll;

#define INF 100000000;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define eps 1.0e-14;

ll fif(ll x){
	return x * x * x * x * x;
}
int dirx[] = {1,1,-1,-1};
int diry[] = {1,-1,1,-1};
int main(){
	ll x; cin >> x;
	int ans[2];
	rep(kai,4){
		rep(i,120){
			rep(j,120){
				int fixedi = i * dirx[kai];
				int fixedj = j * diry[kai];
				if(fif(fixedi) - fif(fixedj) == x){
					ans[0] = fixedi;
					ans[1] = fixedj;
					cout << ans[0] << " " << ans[1] << endl;
					return 0;
				}
			}
		}
	}
	cout << ans[0] << " " << ans[1] << endl;
	return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>


int main(){
  int n; scanf("%d",&n);
  int a[n],x[n][n][2],f[n];
  for(int i=0; i<n; i++){
    scanf("%d",&a[i]); f[i]=0;
    for(int j=0; j<a[i]; j++){
      scanf("%d",&x[i][j][0]);
      scanf("%d",&x[i][j][1]);
    }
    x[i][a[i]][0]=-1;
  }
  int max=0;
  for(int bit=0; bit<(1<<n); ++bit){
    int sum=0,f=1;
    for(int i=0; i<n; i++){
     	if((1<<i) & bit){
          //printf("%d  %d\n",(1<<i),bit);
          for(int j=0; j<a[n-1-i]; j++){
            //printf("---%d  %d\n",x[n-1-i][j][1],x[n-1-i][j][0]);
          	if(!(x[n-1-i][j][1]^(1 & bit>>(n-x[n-1-i][j][0])))){
              //printf("-----OK\n");
              continue;
            }
          	else{
              f=0;
              //printf("-----NO %d\n",x[n-1-i][j][1]^bit>>(n-x[n-1-i][j][0]));
              break;
            }
          }
          
          sum++;
        }
    }
    if(f==1 && max<sum){
      max=sum;
    }
  }
  printf("%d\n",max);
  return 0;
}

    

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import math

A, B = map(int, input().split())

A_min = math.ceil(A / 0.08)
A_max = (A + 1) / 0.08

B_min = math.ceil(B / 0.1)
B_max = (B + 1) / 0.1

ans = max(A_min, B_min)
if ans < A_max and ans < B_max:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
// string s,t;
ll d[100000],dp[100][100];

int main(){
  char s;
  cin >> s;
  switch(s){
    case 'a':
    case 'i':
    case 'u':
    case 'e':
    case 'o':
    print("vowel");
    break;
    default:
    print("consonant");
    break;
  }
  return 0;
}

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


int main(){
  string s;
  cin >> s;
  int n=s.size();
  map<char,int> mp;
  for(int i=0;i<n;++i){
    mp[s[i]];
  }
  if(n==mp.size()) cout << "yes" <<endl;
  else cout << "no" << endl;

  return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
int N,K;
cin >> N >> K;
if(K==1) pr(0);
else pr(N-K);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);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; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

ll a[220000];
ll ppp[1100000],ch[1100000];
int main(){
    ll n;
    cin>>n;
    rep(i,0,n){cin>>a[i];ppp[a[i]]++;ch[a[i]]++;}
    sort(a,a+n);
    rep(i,0,n){
        if(ppp[a[i]]&&ch[a[i]]){
            ch[a[i]]=0;
            for(ll j=2*a[i];j<=1e6;j+=a[i])ppp[j]=0;
        }
    }
    ll ans=0;
    rep(i,0,1e6+1){
        if(ppp[i]==1)ans++;
    }
    cout<<ans;
}



Measured memory_bytes: 20648