akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    if(N>0 && N==M && N>=M){
        System.out.println("Yes");
    }else{
        System.out.println("No");
    }
    }    
}


Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
int a[114514],b[114514],c[8];
int ans[114514][8];
signed main(){
	sc(a) sc(b) sc(c) 
	char t='a';
	int aa=0,bb=0,cc=0;
	rep(0,i,810){
		if(t=='a'){
			if(aa==a.size()){
				cout<<'A'<<endl;
				return 0;
			}
			t=a[aa];
			aa++;
		}
		else if(t=='b'){
			if(bb==b.size()){
				cout<<'B'<<endl;
				return 0;
			}
			t=b[bb];
			bb++;
		}
		else{
			if(cc==c.size()){
				cout<<'C'<<endl;
				return 0;
			}
			t=c[cc];
			cc++;
		}
	}
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n, a;

	cin >> n;

	vector<ll> v;
	vector<ll> vv;

	REP(i, n) {
		cin >> a;
		v.push_back(a);
		vv.push_back(a);
	}

	sort(vv.begin(), vv.end(), greater<ll>());

	REP(i, n) {
		if (v[i] == vv[0]) {
			cout << vv[1] << endl;
		}
		else {
			cout << vv[0] << endl;
		}
	}
}

Measured memory_bytes: 4964
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

public class AtCoderE
{
    static void Main()
    {
        int h;
        int n;
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            h = int.Parse(words[0]);
            n = int.Parse(words[1]);
        }

        Tuple<int, int>[] spells = new Tuple<int, int>[n];

        for (int i = 0; i < n; i++)
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            int a = int.Parse(words[0]);
            int b = int.Parse(words[1]);
            spells[i] = Tuple.Create(a, b);
        }

        long[] dp = new long[h + 1];
        for (int i = 0; i <= h; i++)
        {
            dp[i] = long.MaxValue;
        }
        dp[0] = 0;

        for (int i = 1; i <= h; i++)
        {
            foreach (var spell in spells)
            {
                var diff = Math.Max(0, i - spell.Item1);
                dp[i] = Math.Min(dp[i], dp[diff] + spell.Item2);
            }
        }

        Console.WriteLine(dp[h]);
    }
}

Measured memory_bytes: 13172
#include <stdio.h>
#define p 1000000007

long cal(long n){
  if(n <= 0) return 1;
  else return n * cal( n - 1 ) % p;
}

int main(void){
  long n;
  scanf("%ld", &n);
  n = cal(n);
  printf("%ld\n", n);
  return 0;
}


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

int *
read_nums(int n_nums)
{
	int i;
	int *nums = (int *)malloc(n_nums * sizeof(int));

	for (i = 0; i < n_nums; i++)
	{
		scanf("%d", &nums[i]);
	}

	return nums;
}

void 
dump_reversed_nums(int *nums, int n_nums)
{
	int i;

	for (i = 0; i < n_nums; i++)
	{
		if (i != 0)
		{
			printf(" ");
		}
		printf("%d", nums[n_nums-i-1]);
	}
	putchar('\n');
}

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

	int *nums = read_nums(n_nums);
	dump_reversed_nums(nums, n_nums);

	return 0;
}

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

int P[ 100010 ];
int Chk[ 100010 ];
int Num[ 100010 ];
pair<int, int> Y[ 100010 ];

int main()
{
int i;
int N;
int M;

	cin >> N;
	cin >> M;

	for( i = 0; i < M; i++ )
	{
		cin >> P[ i ];
		cin >> Y[ i ].first;

		Y[ i ].second = i;
	}

	sort( Y, Y + M );
	for( i = 0; i < M; i++ )
	{
		Chk[ P[ Y[ i ].second ] ]++;
		Num[ Y[ i ].second ] = Chk[ P[ Y[ i ].second ] ];
	}

	for( i = 0; i < M; i++ )
	{
		printf( "%06d%06d\n", P[ i ], Num[ i ] );
	}

	return 0;
}







Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(const auto& x : c )cout << x << " "; cout << "\n";
#define PI acos(-1LL)


#ifdef LOCAL
string to_string(const string& s){
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename T>
string to_string(T v){
    bool first = true;
    string res = "{";
    for(const auto& x: v){
        if(!first) res+=", ";
        first = false;
        res+=to_string(x);
    }
    res+="}";
    return res;
}
void bug() { cerr << endl; }
template<typename Head, typename... Tail>
void bug(Head H, Tail... T) {
    cerr << " " << to_string(H);
    bug(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__);
#else
#define debug(...) 11;
#endif


const int M = 1000000007;
const int N = 2e5 + 5;
const long long INF = 2e17 + 12;

int arr[N];
int sz[N];
//Dont forget to invoke init in main function.
void init(){
    for(int i=0 ; i< N; i++){
        arr[i] = i;
        sz[i] = 1;
    }
}
//log2(N);
int root(int i){
    while(arr[i]!=i){
        arr[i] = arr[arr[i]];
        i = arr[i];
    }
    return i;
}
//Note: for root i always arr[i] = i;
//also log2(N)
void union1(int a, int b){
    int root_a = root(a);
    int root_b = root(b);
    if(root_a == root_b) // that means already connected
        return;
    else if(sz[root_a] < sz[root_b]){
        arr[root_a] = arr[root_b];
        sz[root_b]+=sz[root_a];
        //set contains 0 elements now onwards.
        sz[root_a] = 0;
    }
    else{
        arr[root_b] = arr[root_a];
        sz[root_a]+=sz[root_b];
        //set contains 0 elements now onwards.
        sz[root_b] = 0;
    }
}
bool find(int a,int b)
{
    if( root(a)==root(b) )
        return true;
    else
        return false;
}

void solve() {
    init();
    int n, m;
    cin >> n >> m;
    for(int i=0; i<m; i++){
        int a, b;
        cin >> a >> b;
        if(root(a)!=root(b)){
            union1(a, b);
        }
    }
    int mx = 0;
    for(int i=0; i<=n; i++){
        mx = max(mx, sz[root(i)]);
    }
    cout << mx << endl;
}
signed main(){
    FAST
#ifdef TIMER
    clock_t start;
    double duration;
    start = clock();
#endif
    int tc = 1;
//    TODO: check for tc
//    cin >> tc;
    for (int t = 1; t <= tc; t++) {
        solve();
    }
#ifdef TIMER
    duration = (clock() - start) / (double) CLOCKS_PER_SEC;
    cerr <<"\n\nTotal time elapsed: "<< duration <<"sec\n";
#endif
}


Measured memory_bytes: 6752
while 1:
    a,op,b = input().split()
    a = int(a)
    b = int(b)

    if op == '?' :
        break
    if op == '+' :
        print(a + b)
    if op == '-' :
        print(a - b)
    if op == '*' :
        print(a * b)
    if op == '/' :
        print(a // b)

Measured memory_bytes: 5596
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    double[] v = new double[N];
    for(int i = 0; i < N; i++) {
      v[i] = sc.nextDouble();
    }
    Arrays.sort(v);
    double max = v[N - 1];
    int k = 1;
    for(int i = N - 2; i >= 0; i--) {
      if(max > v[i]) {
        break;
      } else {
        k++;
      }
    }
    long[][] dp = new long[N + 1][N + 1];
    dp[1][0] = 1;
    dp[1][1] = 1;
    for(int i = 2; i < N + 1; i++) {
      dp[i][0] = 1;
      for(int j = 1; j < N + 1; j++) {
        dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
      }
    }
    double maxAve = 0;
    long num = 0;
    if(A > k) {
      double sum = 0;
      for(int i = N - 1; i >= N - A; i--) {
        sum += v[i];
      }
      maxAve = sum / (double)A;
      int c = 0;
      int d = 0;
      for(int i = 0; i < N; i++) {
        if(v[i] == v[N - A]) c++;
      }
      for(int i = N - 1; i >= N - A; i--) {
        if(v[i] == v[N - A]) d++;
      }
      num = dp[c][d];
    } else {
      maxAve = (double)max;
      for(int i = A; i <= Math.min(B, k); i++) {
        num += dp[k][i];
      }
    }
    System.out.println(maxAve);
    System.out.println(num);
  }
}

Measured memory_bytes: 23508
import math

a, b, h, m = map(int, input().split())
h_angle = (h*60+m)/(12*60) * (2*math.pi)
m_angle = m / 60 * (2 * math.pi)
C = abs(m_angle - h_angle)
print("{:.10g}".format(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(C))))

Measured memory_bytes: 9400
#include<bits/stdc++.h>
using namespace std;
main(){
long long int n,k;
cin>>n>>k;
long long int a[n];
for( int i=0;i<n;i++)cin>>a[i];

bool dp[k+1];
memset(dp,false,sizeof(dp));

//dp[0]=true;
for(int i=1;i<=k;i++){

for(int j=0;j<n;j++){

if(i>=a[j]&&(!(dp[i-a[j]])))dp[i]=true;


//cout<<i<<dp[i]<<endl;

if(i<a[j])break;

}
}

if(dp[k])cout<<"First";
else { cout<<"Second";}








}


Measured memory_bytes: 3684
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    N, W = list(map(int, input().strip().split()))
    items = [[0, 0]]
    for i in range(N):
        items.append(list(map(int, input().strip().split())))
    V = 10**5
    dp = [[0]+[INF]*(V) for _ in range(N+1)]
    for i in range(1, N+1):
        for j in range(1, V+1):
            if j-items[i][1] < 0:
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = min(dp[i-1][j], dp[i-1][j-items[i][1]]+items[i][0])
    for i in reversed(range(V+1)):
        if dp[N][i] <= W:
            print(i)
            return
    # print(dp[N][:30])
if __name__ == '__main__':
    main()


Measured memory_bytes: 231308
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <queue>
#include <iomanip>
#include <algorithm>
using namespace std;

string s;

int main()
{
	cin >> s;
	s[3] = '8';
	cout << s << endl;
	return 0;
}

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

using namespace std;


int main (void) 
{

  /* Variable_Proclamation */
  int N, M;     // input

  int i, j;        // subscript


  /* Input, Array_Proclamation */
  cin >> N;
  cin >> M;

  vector<int> a(M), b(M);
  vector<int> ways(N, 0);

  for(i=0; i<M; i++)
  {
    cin >> a.at(i) >> b.at(i);
  }


  /* Initialize */


  /* Calculation */
  for(i=0; i<N; i++)
  {
    for(j=0; j<M; j++)
    {

      if( i+1 == a.at(j) )
      {
        ways.at(i)++;
      }

      if( i+1 == b.at(j) )
      {
        ways.at(i)++;
      }

    }
  }


  /* Output */
  for(i=0; i<N; i++)
  {
    cout << ways.at(i) << endl;
  }


  return 0;

}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
 

 double s1;
 double s2;


 scanf("%lf",&s1);
 scanf("%lf",&s2);

 

 
 
   	if(s1>s2){
		printf("GREATER");
   	}else if(s1<s2){
		printf("LESS");
   	}else if(s1==s2){
		printf("EQUAL");
   	}

  	
 return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;

int main(){
  int A, B;
  cin >> A >> B;
  if (1 <= A and A <= 9 and 1 <= B and B <= 9) cout << A*B << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 3596
import sys
input = sys.stdin.readline
N, Q = map(int, input().split())
AB = [None] * (N-1)
for i in range(N-1):
    a, b = map(int, input().split())
    AB[i] = (a, b)
PX = [None] * (Q)
for i in range(Q):
    p, x = map(int, input().split())
    PX[i] = (p, x)
    
edges = AB[:]
vals = PX[:]

from collections import defaultdict
vals_dict = defaultdict(lambda: 0)
for v, n in vals:
    vals_dict[v] += n
#print(vals_dict)

graph = defaultdict(lambda: {})
for a, b in edges:
    graph[a][b] = vals_dict[b]
    graph[b][a] = vals_dict[a]
#print(graph)
    

from heapq import heappush, heappop
def dijkstra(graph, start, N):
    A = [None] * (N+1)
    queue = [(0, start)]
    while queue:
        path_len, v = heappop(queue)
        if A[v] is None: # v is unvisited
            A[v] = path_len
            for w, edge_len in graph[v].items():
                if A[w] is None:
                    heappush(queue, (path_len + edge_len, w))

    # to give same result as original, assign zero distance to unreachable vertices             
    return [0 if x is None else x for x in A]

shortest = dijkstra(graph, 1, N)
shortest = [s+vals_dict[1] for s in shortest]
#print(shortest)
ans = ' '.join(map(str, shortest[1:]))
print(ans)

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

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


Measured memory_bytes: 256
# ABC113b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

ans = 0
for i in range(n):
    if(abs(a-(t-h[i]*0.006)) <= abs(a-(t-h[ans]*0.006))):
        #print(abs(a-(t-h[i]*0.006)), score)
        ans = i
print(ans+1)

Measured memory_bytes: 3064
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramB a = new ProgramB();
            a.main();//実行する

        }

    }

    class ProgramA
    {
        public void main()
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);

            //時間に換算して起きてる時間からk時間を除く
            Console.WriteLine(a*b);

        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            long ans = 1;
            long[] a = new long[n];
            long INF = 1000000000000000000;

            for (int i = 0; i < n; i++)
                a[i] = long.Parse(s[i]);

            Array.Sort(a);
            for (int i = 0; i < n; i++)
            {
                if (a[i] == 0)
                    break;

                INF /= a[i];
                if(INF == 0)
                {
                    Console.WriteLine("-1");
                    return;
                }

            }

            //?はD、それ以外は普通に出す
            for (int i = 0;i < n;i++)
            {
                ans *= a[i];
            }

            Console.WriteLine(ans);
            

        }
    }

    class ProgramC
    {
        public void main()
        {
            
            string[] s = Console.ReadLine().Split(' ');
            double a = double.Parse(s[0]);
            double b = double.Parse(s[1]);

            Console.WriteLine((long)(a*b));
        }
    }
}






Measured memory_bytes: 40916
#include <stdio.h>
int	main(void)
{
	int n,a,min=1000000,max=-1000000,i;
	long sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
        if(min>a) min=a;
        if(max<a) max=a;
		sum+=a;
	}
	printf("%d %d %ld\n",min,max,sum);
	return	0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define INF 1<<29
using namespace std;

int main(){
int a,b,c,d,e;
int f[100][100];
while(scanf("%d%d%d%d%d",&a,&b,&c,&d,&e),a||b||c||d||e){
	c--;d--;e--;
	for(int g=0;g<a;g++){
		for(int h=0;h<a;h++){if(g!=h) f[g][h]=INF;else f[g][h]=0;}
	}
	int j,k,l;
	for(int i=0;i<b;i++){
		scanf("%d%d%d",&j,&k,&l);
		j--;k--;
		f[j][k]=l;
	}
	for(int x=0;x<a;x++){
		for(int y=0;y<a;y++){
			for(int z=0;z<a;z++){
				f[y][z]=min(f[y][z],f[y][x]+f[x][z]);
			}
		}
	}
	int s=INF;
	for(int o=0;o<a;o++){
		s=min(s,f[c][o]+f[o][d]+f[o][e]);
	}
	printf("%d\n",s);
}
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF ((ll)1<<31)-1
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int gcd(int a,int b){
	if(!a)return b;
	return gcd(b%a,a);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
signed main(){
	int h,w,x,y;
	cin>>h>>w>>x>>y;
	if(h*w%2&&(x+y)%2)puts("No");
	else puts("Yes");
    return 0;
}




Measured memory_bytes: 3072
#include <iostream>

int main(void) {
    int n;
    std::cin >> n;
    int r[4] = {};
    std::string a[n];
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        if (a[i] == "AC") {
            r[0]++;
        } else if (a[i] == "WA") {
            r[1]++;
        } else if (a[i] == "TLE") {
            r[2]++;
        } else {
            r[3]++;
        }
    }
    std::cout << "AC x " << r[0] << std::endl;
    std::cout << "WA x " << r[1] << std::endl;
    std::cout << "TLE x " << r[2] << std::endl;
    std::cout << "RE x " << r[3] << std::endl;

    return 0;
}

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

int main()
{
    vector<int> vi;
    int n;
    vector<bool> prime(300001, true);
    prime[0] = prime[1] = false;
    for(int i = 2; i <= 300000; i++) {
        if(!prime[i]) 
            continue;
        if(((i % 7) != 1) &&  ((i % 7) != 6)) {
            prime[i] = false;
            continue;
        }

        for(int k = 2 * i; k <= 300000; k += i) 
            prime[k] = false;
                     
    }

    while(cin >> n && (n != 1)) {
        cout << n << ":";
        for(int i = 2; i <= n; i++) {
            if(prime[i] && (n % i) == 0) 
                cout << " " << i;
        }
        cout << endl;
    }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

ull Euclid(ull A, ull B){
    if(A<B) swap(A, B);
    ull C = B;
    while(C != 0){
        C = A%B;
        A = B;
        B = C;
    }
    return A;
}

int main(){
	ll T;
	cin >> T;
	ll A, B, C, D;
	REP(t, T){
		cin >> A >> B >> C >> D;
		bool flag;
		if(A<B){
			flag = false;
		}else{
			if(B>D){
				flag =false;
			}else{
				if(B<=C+1){
					flag = true;
				}else{
					ll E = Euclid(B, D);
					flag = (B+A%E-E<=C);
				}
			}
		}
		cout << (flag?"Yes":"No") << endl;
	}
    return 0;
}

Measured memory_bytes: 256
def remove(s):
    i=1
    count=0
    while i<len(s)-1:
        if s[i-1]!=s[i+1]:
            s.pop(i)
            count+=1
        i+=1
    return count

s=list(input())
count=0
while True:
    tmp=remove(s)
    if tmp==0:
        break
    count+=tmp

if count%2==0:
    print("Second")
else:
    print("First")
    

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

using namespace std;

int main() {
	long long int x, y, a;
	int count = 0;

	cin >> x >> y;

	a = x;
	count = 1;
	
	while (2*a <= y) {
		a *= 2;
		count++;
	}
	
	cout << count;

	return 0;
}

Measured memory_bytes: 256
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

N = int(input())
#print(factorize(N))

check = [0] * 10001
for i in range(1, N+1):
    tmp = factorize(i)
    for j in range(len(tmp)):
        check[tmp[j][0]] += tmp[j][1]

x = []
for i in range(len(check)):
    if check[i] != 0:
        x.append(check[i])
#print(x)

ans = 1
for i in range(len(x)):
    ans *= x[i]+1 
    ans %= 1000000007
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long  a,b,x,count=0;
	cin>>a>>b>>x;
	count+=b/x;
	if(a!=0)count-=(a-1)/x;
	if(a!=0)cout<<count<<endl;
	else cout<<count+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<lint, lint> pi;
const int MAXN = 530000;
const int mod = 200003;

map<pi, int> mp;

int main(){
	int n; scanf("%d",&n);
	lint ans = 0;
	for(int i=0; i<n; i++){
		double x; scanf("%lf",&x);
		lint q = (lint)round(x * 1e9);
		if(q % lint(1e9) == 0) ans--;
		int c0 = -9, c1 = -9;
		while(q % 2 == 0){
			q /= 2;
			c0++;
		}
		while(q % 5 == 0){
			q /= 5;
			c1++;
		}
		mp[pi(c0, c1)]++;
	}
	for(auto &[x1, y1] : mp){
		for(auto &[x2, y2] : mp){
			if(x1.first + x2.first >= 0 && x1.second + x2.second >= 0) ans += 1ll * y1 * y2;
		}
	}
	ans /= 2;
	cout << ans << endl;
}


Measured memory_bytes: 3784
import sys

def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f 

input = sys.stdin.readline
N = int(input())
X = input().strip()

n0 = 0
for x_i in X:
    if x_i == "1":
        n0 += 1
# print("n0", n0)
r_p = 0 # 0 -> 1のケース
r_n = 0 # 1 -> 0のケース
X = X[::-1]
for i in range(N):
    x = int(X[i])
    r_p += x * pow(2, i, n0+1)
    r_p %= (n0+1)
    if 1 < n0:
        r_n += x * pow(2, i, n0-1)
        r_n %= (n0-1)
# print("r_p", r_p, "r_n", r_n)

ans = []
# print(n)
for i in range(N):
    count = 1
    diff = (1 if X[i] == "0"  else -1)
    # print("x_i", X[i], "diff", diff)
    n = n0 + diff
    if n == 0:
        ans.append(0)
        continue
    if diff == 1:
        r = r_p + (diff * pow(2, i, n))
        r %= n
    else:
        r = r_n + (diff * pow(2, i, n))
        r %= n
    # print("n", n, "r", r)
    n = r
    # print("n", n)
    while 0 < n:
        r = popcount(n)
        count += 1
        # print("n", n)
        if r == 0:
            break
        n = n % r
    ans.append(count)

for i in ans[::-1]:
    print(i)

Measured memory_bytes: 12868
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
 
int main()
{
  double x1,y1, x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  double result;
  result = sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
  printf("%.8lf\n", result);
}

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


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

    if(u==s) --a;
    else --b;

    cout<<a<<" "<<b<<endl;
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  string a = s.substr(0,2);
  string b = s.substr(2,2);
  if(a < "13" && a > "00" && b < "13" && b > "00"){
    cout << "AMBIGUOUS" << '\n';
  }
  else if(b < "13" && b > "00") cout << "YYMM" << '\n';
  else if(a < "13" && a > "00") cout << "MMYY" << '\n';
  else cout << "NA" << '\n';
}

Measured memory_bytes: 3576
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
using namespace std;
int main()
{
   int a,b,c;
   scanf("%d%d%d",&a,&b,&c);
   printf("%d",min(b/a,c));
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int H, W; vector<vector<int> > v; vector<vector<bool> > used;
int solve(int x, int y) {
	int ret = 0, d[] = { 1, 0, -1, 0 };
	for (int i = 0; i < 4; i++) {
		int tx = x + d[i], ty = y + d[i ^ 1];
		if (0 <= tx && tx < W && 0 <= ty && ty < H && v[ty][tx] == 1 && !used[ty][tx]) {
			used[ty][tx] = true;
			ret = max(ret, solve(tx, ty) + 1);
			used[ty][tx] = false;
		}
	}
	return ret;
}
int main() {
	while (cin >> W >> H, H) {
		v = vector<vector<int> >(H, vector<int>(W));
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) cin >> v[i][j];
		}
		used = vector<vector<bool> >(H, vector<bool>(W, false));
		int ret = 0;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (v[i][j] == 0) ret = max(ret, solve(j, i));
			}
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 3156
/**
 *      ABC 76 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-04 16:52:16
**/

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

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

    int N, K; cin >> N >> K;
    for (int i = 0; i <= N; ++i){
        int cnt = 1;
        cnt *= pow(2, i);
        cnt += K * (N - i);            
        
        if (cnt < answer){
            answer = cnt;
        }
    }
    cout << answer << endl;

    return 0;

}

Measured memory_bytes: 256
N = int(input())
A, B = list(map(int, input().split()))
P = list(map(int, input().split()))
P = sorted(P)
rega=0
regb=0
regc=0
for i in range(N):
    if P[i]<= A:
        rega+=1
    elif P[i] > B:
        regc+=1
    else:
        regb+=1
print(min(rega, regb, regc))


Measured memory_bytes: 3060
import math

n,d = map(int, input().split())
n_list = []
for i in range(n):
    x,y = map(int, input().split())
    n_list.append([x,y])

cnt = 0
for x_y in n_list:
    dist = math.sqrt(x_y[0]**2+x_y[1]**2)
    if dist <= d:
       cnt += 1

print(cnt)

Measured memory_bytes: 39212
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();
            int iN = int.Parse(sS);
            sS = System.Console.ReadLine().Trim();
            List<char> lstsS = sS.ToList();
            //// Debug入力
            //List<char> lstsS = new List<char>();
            //for (int i = 0; i < 4000/3; i++)
            //{
            //    lstsS.Add('R');
            //    lstsS.Add('G');
            //    lstsS.Add('B');
            //}

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            long iSum = 0L;
            //List<string> lstDeb = new List<string>();
            for (int i = 0; i < lstsS.Count; i++)
            {
                for (int j = i + 1; j < lstsS.Count; j++)
                {
                    int iBuf = j - i;
                    for (int k = j + iBuf; k < lstsS.Count; k += iBuf)
                    //for (int k = j + 1; k < lstsS.Count; k += 1)
                    {
                        if (j - i == k - j)
                        {
                            if (lstsS[i] != lstsS[j] && lstsS[j] != lstsS[k] && lstsS[k] != lstsS[i])
                            {
                                iSum += 1L;
                                //lstDeb.Add(i.ToString("00") + j.ToString("00") + k.ToString("00"));
                            }
                        }

                    }
                }
            }
            int iR = 0, iG = 0, iB = 0;
            for (int i = 0; i < lstsS.Count; i++)
            {
                if (lstsS[i] == 'R') { iR += 1; }
                if (lstsS[i] == 'G') { iG += 1; }
                if (lstsS[i] == 'B') { iB += 1; }
            }
            long iOut = (long)iR * (long)iG * (long)iB - iSum;

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            //DebugDisp(lstDeb);
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

        // DebugDisp
        private static void DebugDisp(List<string> lstDeb)
        {
            System.Console.WriteLine("{0}", "".ToString().Trim());
            for (int i = 0; i < lstDeb.Count; i++)
            {
                System.Console.WriteLine("{0}", lstDeb[i].ToString().Trim());
            }
        }

}


Measured memory_bytes: 28144
#include <iostream>
#include <cmath>
#include <string>
#include <utility>
using namespace std;
typedef long long int ll;

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;
}

const ll INF = 1LL << 60;

int N, h[100010];
ll dp[100010];

ll rec(int i) {
  //cout << "rec(" << i << ")" << endl;
  if (dp[i] < INF) return dp[i];
  //cout << "rec(" << i << ")" << endl;
  if (i == 0) return dp[0] = 0;
  if (i == 1) return dp[1] = abs(h[1] - h[0]);
  ll res = INF;
  chmin(res, rec(i-1) + abs(h[i] - h[i-1]));
  chmin(res, rec(i-2) + abs(h[i] - h[i-2]));
  //cout << "rec(" << i << ") is completed" << endl;
  return dp[i] = res;
}

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> h[i];
  for (int i = 0; i < N; i++) dp[i] = INF;
  cout << rec(N - 1) << endl;
  return 0;
}


Measured memory_bytes: 6144
N, M = map(int, input().split())
H = [int(i) for i in input().split()]
AB = [list(map(int, input().split())) for _ in range(int(M))]


Flags = [1] * N

for j in range(M):
    if(H[AB[j][0] - 1] <= H[AB[j][1] - 1]):
        Flags[AB[j][0] - 1] = 0

    if(H[AB[j][1] - 1] <= H[AB[j][0] - 1]):
        Flags[AB[j][1] - 1] = 0

count = 0
for i in range(N):
    count += Flags[i]



print(count)


Measured memory_bytes: 32024
extern crate proconio;

use proconio::*;

fn main() {
    input! {
        weather: String
    }
    if weather == "SSS" {
        println!("0");
    } else if weather == "RRR" {
        println!("3");
    } else if weather == "RRS" || weather == "SRR" {
        println!("2");
    } else {
        println!("1");
    }
}


Measured memory_bytes: 2080
#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 char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
bool compare_by_a(pair<int, pair<ll, ll>> a, pair<int, pair<ll, ll>> b) {
    if(a.second.first != b.second.first){
        return a.second.first < b.second.first;
    }else{
        return a.second.second < b.second.second;
    }
}
bool compare_by_b(pair<int, pair<ll, ll>> a, pair<int, pair<ll, ll>> b) {
    if(a.second.second != b.second.second){
        return a.second.second < b.second.second;
    }else{
        return a.second.first < b.second.first;
    }
}
template<typename T>
struct edge {
    int from, to; // クラスカル法に限って、fromもedgeに含めるといい
    T cost;
};
// UnionFindを示す構造体
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
template<typename T>
T kruskal(vector<edge<T>> &edges, int V) {
    sort(edges.begin(), edges.end(), [](const edge<T> &a, const edge<T> &b) {
        return a.cost < b.cost;
    });
    UnionFind unionFind(V);
    T res = 0;
    for (edge<T> &e: edges) {
        if (unionFind.merge(e.to, e.from)) {
            res += e.cost;
        }
    }
    return res;
}

int main() {
  int N; cin >> N;
  vector<pair<int, pair<ll, ll>>> p(N);
  REP(i, N) {
    ll a, b; cin >> a >> b;
    auto tmp = make_pair(i, make_pair(a, b));
    p[i] = tmp;
  }
  vector<edge<ll>> tree;
  sort(all(p), compare_by_a);
  for(int i = 0; i < N - 1; ++i) {
    ll tmp = abs(p[i].second.first - p[i + 1].second.first);
    edge<ll> res;
    res.from = p[i].first;
    res.to = p[i + 1].first;
    res.cost = tmp;
    tree.push_back(res);
  }
  sort(all(p), compare_by_b);
  for(int i = 0; i < N - 1; ++i) {
    ll tmp = abs(p[i].second.second - p[i + 1].second.second);
    edge<ll> res;
    res.from = p[i].first;
    res.to = p[i + 1].first;
    res.cost = tmp;
    tree.push_back(res);
  }
  cout << kruskal(tree, N) << endl;
}

Measured memory_bytes: 9820
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807/2;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n,m;
int a[1010];
int b[1010];

int main(){
	cin>>n>>m;
	REP(i,n)cin>>a[i];
	REP(i,m)cin>>b[i];
	sort(a,a+n,greater<int>());
	sort(b,b+m,greater<int>());
	for(int i=0;i<n-1;i++){
		if(a[i]==a[i+1]){
			cout<<0<<endl;
			return 0;
		}
	}
	for(int i=0;i<m-1;i++){
		if(b[i]==b[i+1]){
			cout<<0<<endl;
			return 0;
		}
	}
	
	a[n]=-1;
	b[m]=-1;
	ll ans=1;
	int k=0,l=0;
	for(ll i=n*m;i>0;i--){
		while(a[k]>i)k++;
		while(b[l]>i)l++;
		if(a[k]==i&&b[l]==i){
		}else if(a[k]!=i&&b[l]!=i){
			ll tt=(k)*(l)-(n*m-i);
			if(tt<=0){
				cout<<0<<endl;
				return 0;
			}else{
				ans=(ll)ans*tt;
				ans%=MOD;
			}
		}else if(a[k]==i){
			ans=ans*(l);
			ans%=MOD;
		}else{
			ans=ans*(k);
			ans%=MOD;
		}
		//cout<<i<<" "<<ans<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());

        int maxL = 0;
        int minR = 100001;

        for (int i = 0; i < m; i++) {
            maxL = Math.max(maxL, Integer.parseInt(sc.next()));
            minR = Math.min(minR, Integer.parseInt(sc.next()));
        }

        System.out.println((minR >= maxL) ? minR - maxL + 1 : 0);
    }
}


Measured memory_bytes: 48584
#include<bits/stdc++.h>
using namespace std;
//14719021122270100109
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef unsigned long long ull;

#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define forn(i, n) for(register int i=0; i<n; i++)
#define Forn(i, n) for(register int i=1; i<=n; i++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)
#define mid (l+r>>1)
#define lid id<<1|1
#define rid (id<<1)+2
#define lson lid, l, mid
#define rson rid, mid, r

inline int in()
{
    char c=getchar();
    int neg=1, x=0;
    while(!isdigit(c)) (c=='-')?neg=-1, c=getchar():c=getchar();
    while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48), c=getchar();
    return neg*x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}

const int MAX=2e5+5;

int N, ptr, a[MAX];
pair<int,pair<int,int> > rr[MAX];
class State
{
    public:
    int t1, t2, p1, p2, l, r;
    State(int _t1, int _t2, int _p1, int _p2, int _l, int _r):
        t1(_t1), t2(_t2), p1(_p1), p2(_p2), l(_l), r(_r){}
    friend bool operator<(const State&A, const State&B)
    {
        return A.t1<B.t1;
    }
    friend bool operator>(const State&A, const State&B)
    {
        return A.t1>B.t1;
    }
};
priority_queue<State, vector<State>, greater<State> > q; 


class Seg
{
    private:
    struct Dat
    {
        int v, p;
        Dat(int _v=0, int _p=0):v(_v), p(_p){}
        Dat operator+(const Dat&A)
        {
            Dat ret(v, p);
            if(v>A.v) ret=A;
            return ret;
        }
    }dat[MAX<<2];
    public:
    inline void build(int t, int id, int l, int r)
    {
        if(l+1==r)
        {
            if(l%2==t) dat[id]=Dat(a[l], l);
            else dat[id]=Dat(1e9, l);
            return;
        }
        build(t, lson);
        build(t, rson);
        dat[id]=dat[lid]+dat[rid];
//        cout<<l<<" "<<r<<" "<<dat[id].v<<endl;
    }
    inline Dat mn(int id, int l, int r, int a, int b)
    {
        if(r<=a||b<=l) return Dat(1e9, 1e9);
        if(a<=l&&r<=b) return dat[id];
        Dat ret=mn(lson, a, b)+mn(rson, a, b);
//        cout<<l<<" "<<r<<" "<<ret.v<<endl;
        return ret;
    }
    inline int query(int a, int b)
    {
        Dat tt=mn(0, 0, N, a, b);
        return tt.p;
    }
}s0, s1;

inline void get(int l, int r)
{
    if(l>=r) return;
    int p1, p2;
    if(l%2==0)
    {
        p1=s0.query(l, r);
        p2=s1.query(p1, r);
    }
    else
    {
        p1=s1.query(l, r);
        p2=s0.query(p1, r);
    }
    q.push(State(a[p1], a[p2], p1, p2, l, r));
}

int main()
{
    N=in();
    forn(i, N) a[i]=in();
    s0.build(0, 0, 0, N);
    s1.build(1, 0, 0, N);
    get(0, N);
    while(!q.empty())
    {
        State t=q.top();
        q.pop();
        printf("%d %d ", t.t1, t.t2);
        get(t.l, t.p1);
        get(t.p1+1, t.p2);
        get(t.p2+1, t.r);
    }
    return 0;
}

Measured memory_bytes: 17652
#include <cstdio>
#include <queue>
using namespace std;

int main(){
	queue<int> q;
	int w,h,f[484],i,j,d[]={22,0,-1,0,1,0,-22},a,b,t,x,z;
	char p[15];
	for(;scanf("%d%d ",&h,&w),h;){
		for(j=0;j<w+2;j++)f[j]=f[j-~h*22]=-9;
		for(i=1;i<=h;i++){
			for(j=1;j<=w;j++){
				f[x=i*22+j]=-1;
				switch(getchar()){
					case'#':--f[x];break;
					case'A':a=x;break;
					case'B':b=x;break;
				}
			}
			f[i*22]=f[i*22-~w]=-9;
			getchar();
		}
		
		f[a]=t=0;
		q.push(0);
		for(q.push(a);q.size()>1;){
			a=q.front();
			q.pop();
			if(a){
				for(i=0;i<7;i+=2)
					if(f[x=a+d[i]]==-1){
						f[x]=t;
						q.push(x);
					}
			}else{
				++t;
				q.push(0);
			}
		}
		q.pop();
		scanf("%s",p);
		for(a=t=0;!a;){
			x=b;
			z=0;
			for(i=0;!a&&p[i];i++){
				t++;
				if(f[j=b+d[p[i]-'2']]>-3)b=j;
				if(f[b]>=0&&t>=f[b])a=b;
				if(f[b]>=0)z=1;
			}
			if(!z&&!a&&!p[i]&&b==x&&f[b]<0)a=-1;
		}
		printf(a<0?"impossible\n":"%d %d %d\n",t,a/22-1,a%22-1);
	}
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    LL n, k;cin >> n >> k;
    double ans = 0;
    for(int i=1;i<=n;i++){
        double a = 1.0/n;
        LL now = i;
        while(now < k){
            now *= 2;
            a /= 2.0;
        }
        ans += a;
    }
    printf("%.12lf\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<int> w;
  REP(i, n) {
    int a;
    cin >> a;
    int b = upper_bound(ALL(w), a, [](int l, int r) { return l > r; }) - w.begin();
    if (b == w.size()) {
      w.pb(a);
    } else {
      w[b] = a;
    }
  }
  int ans = w.size();
  cout << ans << endl;
  return 0;
}

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

int main(){
   int N,K,count;
   cin>>N>>K;
   count=0;
  
   for(int i=0;i<N;i++){
      int A;
      cin>>A;
      if(A>=K){
       count++;
      }
   }
  
   cout<<count<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1000000007;

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  int d;
  cin >> d;
  arrll(c,26);
  vecll2(s, d, 26);
  rep(i,d){
    rep(j,26){
      cin >> s[i][j];
    }
  }

  srand(time(NULL));

  vecll human(26);
  vecll last(26);

  vecll ans;

  rep(i,d){
    ans.pb(rand()%26+1);
  }

  rep(i,d){
    prt(ans[i]);
  }
}


Measured memory_bytes: 3728
N = int(input())
array = list(map(int, input().split()))

y = list(map(str, array))
y = " ".join(y)
print(y)

for i in range(1, N):
    v = array[i]
    j = i - 1
    while j >= 0 and array[j] > v:
        array[j + 1] = array[j]
        j -= 1
        array[j + 1] = v
    x = list(map(str, array))
    x = " ".join(x)
    print(x)



Measured memory_bytes: 5592
#include <iostream>
    #include <math.h>
    #include <vector>
    #include <string>
    using namespace std;
    
    int func(int n){
        int out =(n%2==0) ? (n/2) : (3*n + 1);
        return out;
    }

    int main() {
        int s,prev=0;cin>>s;
        vector<int> vec(1000000,0);
        vec[0]=s;
        for(int i=1;i<vec.size();i++){
            vec[i] = func(vec[i-1]);
            for(int j=0; j<i; j++){
                if(vec[j] == vec[i]){
                    cout << i+1 << endl;
                    return 0;
                }
            }
        }
        return 0;
    }

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

const int INF = 100010001;

int main()
{
    int H, N;
    cin >> H >> N;
    vector<int> A(N), B(N);
    rep(i,N) cin >> A[i] >> B[i];
    int maxA = 0;
    rep(i,N) chmax (maxA, A[i]);
    int maxH = H+maxA+1;
    vector<int> dp(maxH, INF);
    dp[0] = 0;
    repSE(i,1,maxH) {
        rep(j,N) chmin(dp[i], dp[max(0,i-A[j])] + B[j]);
    }
    int ans = INF;
    repSE(i,H,maxH) chmin(ans, dp[i]);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256