akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
 
int main(){
	int N, M, C;
	cin >> N >> M >> C;
	vector<int> B(M);
	vector<vector<int>> A(N);

	for(int i=0;i<M;i++){
		cin >>B[i];
	}
	for(int i = 0;i<N;i++){
		vector<int> IN(M);
		for(int j=0;j<M;j++){
			cin >> IN[j];
		}
		A[i] = IN;
	}
	int count = 0;
	for(int i=0;i<N;i++){
		int sum = 0;
		for(int j=0;j<M;j++){
			sum += A[i][j] * B[j];
		}
		sum += C;
		if(sum > 0) count++;
	} 
	cout << count << endl;
}

Measured memory_bytes: 256
a, b, c, x, y = list(map(int, input().split()))
if a + b <= 2 * c:
    print(a * x + b * y)
else:
    if x < y:
        print(min(c * 2 * x + b * (y - x), c * 2 * y))
    else:
        print(min(c * 2 * y + a * (x - y), c * 2 * x))


Measured memory_bytes: 3060
#include<iostream>

int main() {
    int row[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

	int i = 0;
	std::cin >> i;
	std::cout << row[i-1];

    return 0;
}


Measured memory_bytes: 256
using System;

namespace ARC098C
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            int[] dpe = new int[n];
            int[] dpw = new int[n];

            int w = 0;
            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'W')
                {
                    w++;
                }

                dpw[i] = w;
            }

            int e = 0;
            for (int i = n - 1; i >= 0; i--)
            {
                if (s[i] == 'E')
                {
                    e++;
                }

                dpe[i] = e;
            }

            int ans = 10000000;
            for (int i = 0; i < n; i++)
            {
//                Console.Write(i);
//                Console.Write(' ');
//                Console.Write(dpe[i]);
//                Console.Write(' ');
//                Console.WriteLine(dpw[i]);
                int score;

                if (i == 0)
                {
                    score = dpe[i];
                }
                else if (i == n - 1)
                {
                    score = dpw[i];
                }
                else
                {
                    score = dpw[i] + dpe[i] - 1;
                }

                if (ans > score)
                {
                    ans = score;
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 14432
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

using namespace std;

int main(){
        int a,b;
        char op;

        while(true){
                cin >> a >> op >> b;
                if(op == '?')break;

                switch(op){
                        case '+':
                                cout << a + b << "\n";
                                break;

                        case '-':
                                cout << a - b << "\n";
                                break;

                
                        case '*':
                                cout << a * b << "\n";
                                break;
                
                
                        default:
                                cout << a / b << "\n";
                }
        }

        return 0;
}

Measured memory_bytes: 1160
import sys
import numpy as np

def main():
    input = sys.stdin.readline
    abx = list(map(np.float64, input().split()))
    a = abx[0]
    b = abx[1]
    x = abx[2]
    taiseki = a * a * b
    if x <= taiseki / 2:
        y = (2 * x) / (a * b)
        tan = y / b
        theta = np.float64(np.float64(90) - np.rad2deg(np.arctan(tan)))
    else:
        y = (2 * x) / (a * a) - b
        if b - y != 0:
            tan = a / (b - y)
            theta = np.float64(np.float64(90) - np.rad2deg(np.arctan(tan)))
        else:
            theta = 0.


    print(theta)

if __name__ == '__main__':
    main()

Measured memory_bytes: 12496
#include<iostream>
#include<cstdio>
#define MAX_INT 1 << 14
using namespace std;


int main(){
    bool dx[MAX_INT][40] = {false}, flag[40] = {false};
    int no, n;
    while(scanf("%d,%d", &no, &n)){
        if(no == 0 && n == 0) break;
        dx[no][n] = true;
        if(!flag[n]) flag[n] = true;
    }
    int num;
    while(cin >>num){
        int ans = 0;
        for(int i = 30; i >= 0; i--){
            if(flag[i]){
                ans++;
                if(dx[num][i]) break;
            }
        }
        cout <<ans <<endl;
    }
    return 0;
}

Measured memory_bytes: 0
N=int(input())
A=list(map(int,input().split()))

s=sum(A)//2
ans=[0]*N

rem=0
for i in range(1,N,2):
    rem+=A[i]

ans[0]=(s-rem)*2

for i in range(1,N):
    ans[i]=(A[i-1]-ans[i-1]//2)*2
ans[-1]=(A[-1]-ans[0]//2)*2



print(' '.join(map(str, ans)))

Measured memory_bytes: 84452
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <cstring>
//#define LOCAL
using namespace std;
typedef long long ll;
const int mx=1e5+10;
ll a[mx];

void display(ll n, ll num[mx]){
    for(ll i=1;i<=n;i++){
        if(1==i)printf("%lld", num[i]);
        else printf(" %lld", num[i]);
    }
    puts("");
}


int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll n;
cin>>n;
for(ll i=1;i<=n;i++) a[i]=i;
display(n, a);
while(next_permutation(a+1, a+1+n)){
    display(n, a);
}


#ifdef LOCAL
fin.close();
#endif // LOCAL
}




Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int x,y;
    cin>>x>>y;
    
    int n1=x,n2=0;
    while(n1>=0){
        if(2*n1+4*n2 == y) {
            cout<<"Yes"<<endl;
            return 0;
        }
        n1--;
        n2++;
    }
    
    
    cout<<"No"<<endl;
    
}


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

//Common
typedef int Weight;
const Weight WEIGHT_INF = std::numeric_limits<Weight>::max()/4;

struct Edge {
    int src, dst;
    Weight weight;
};
bool operator<(const Edge& a, const Edge& b) {
    return (a.weight < b.weight);
};
bool operator>(const Edge& a, const Edge& b) {
    return (a.weight > b.weight);
};
typedef std::vector<Edge> Edges;
typedef std::vector<Edges> Graph;

int N, M;

Graph g;
std::vector<Weight> costs;
std::vector<int> trace;
void dijkstra(int start){
    int n = g.size();
    costs.resize(n, WEIGHT_INF);
    costs[start] = 0;
    trace.resize(n, -2);

    std::priority_queue<Edge, std::vector<Edge>, std::greater<Edge>> q;
    q.push((Edge){-1, start, 0});
    while(!q.empty()) {
        Edge e = q.top();
        q.pop();

        if(trace[e.dst] != -2) continue;
        trace[e.dst] = e.src;
        EACH(it, g[e.dst]) {
            if(costs[it->dst] > e.weight + it->weight){
                costs[it->dst] = e.weight + it->weight;
                q.push((Edge){it->src, it->dst, e.weight + it->weight});
            }
        }
    }
}


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

    g.resize(N);
    REP(i, M) {
        int a, b;
        std::cin >> a >> b;
        a--, b--;
        Edge e1{a, b, 1}, e2{b, a, 1};
        g[a].pb(e1);
        g[b].pb(e2);
    }

    dijkstra(0);

    std::cout << (costs[N-1] == 2 ? "POSSIBLE" : "IMPOSSIBLE") << std::endl;
}

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

#define pb push_back
#define ll long long int
#define mpi map<int, int>
#define vi vector<int>
#define si set<int>
#define pii pair<int, int>
#define vpi vector<pii>
#define vs vector<string>
#define pri priority_queue<int>
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define For(i, n) for (int i = 0; i < n; i++)
#define Ford(i, a, b) for (int i = a; i >= b; i--)
#define Rep(i, x, y) for (int i = x; i <= y; i++)
#define mem(a, b) memset(a, b, sizeof(a))
#define fastio                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

double tick()
{
    static clock_t oldt, newt = clock();
    double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC;
    oldt = newt;
    return diff;
}

int main()
{
    int k, a, b;
    cin >> k >> a >> b;
    if (b / k - a / k == 0 && (k != a && k != b) && k != 1 && b % k != 0 && a % k != 0)
        cout << "NG";
    else
        cout << "OK";
    cerr << "execution time is: " << tick() << "\n";
}


Measured memory_bytes: 3704
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	cin >> n;
	string a;
	cin >> a;
	stack<char> s;
	for(ll i=0;i<a.size();i++)
	{
		if(s.empty())
		{
			s.push(a[i]);
		}
		else
		{
			while(!s.empty() && s.top() == a[i])
			{
				s.pop();
			}
			s.push(a[i]);
		}
		
	}
	cout << s.size();
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
  int n,m;
  char a[3][4];
  int i,j;
  for(i=0;i<3;i++){
      scanf("%s",a[i]);
  }
  
  for(i=0;i<3;i++){
    printf("%c",a[i][i]);
  }
  
  return 0;
}

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

long long MOD = 1e9+7;
int MAX_INT = 1e9;

// 最大公約数
long long gcd(long long a, long long b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
// 最小公倍数
long long lcm(long long a, long long b) {
  return a / gcd(a, b) * b;
}

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  string N;
  cin >> N;

  long long cnt = 0;
  for(int i = 0; i < N.size(); ++i) {
    cnt += N[i] - '0';
  }

  if(cnt % 9 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/lexical_cast.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define mp make_pair
#define endl '\n'
#define PI acos(-1)
#define bitcount(a) __builtin_popcountll(a)
#define P pair<int,int>
typedef tree<int,null_type,less_equal <int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

long mod=1e9+7;
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int a,b;
	cin>>a>>b;
	if(b==1)
	{
		cout<<0;
		return 0;
	}
	int ans=1;
	int temp=0;
	temp=a;
	while(temp<b)
	{
		++ans;
		temp+=a-1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
input_from = input()
info = input_from.split(' ')
a = int(info[0])
b = int(info[1])
k = int(info[2])
a -= k
if a < 0:
    b += a
    a = 0
    if b < 0:
        b = 0
print("{0} {1}".format(a, b))


Measured memory_bytes: 3060
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	int i = 0;
	double min_v = 0, y, t, height;

	while ( cin >> min_v )
	{
		t = min_v / 9.8;
		y = 4.9 * t * t;
		height = ( y + 5 ) / 5;
		height = ceil( height );
		cout << ( int )height << endl;
	}
	return 0;

}

Measured memory_bytes: 3180
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N, K;
int main() {
	cin >> N >> K;
	int sum = 0;
	REP(i, 0, N) {
		int a;
		cin >> a;
		sum += min(a, K - a) * 2;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 21
using namespace std;
typedef pair<int,int> P;
int w,h,G[N][N];
string mp[N];
map<P,int>M;

void bfs(P s){
  int D[N][N];
  memset(D,-1,sizeof(D));
  queue<P> Q;
  Q.push(s);
  int x=s.first,y=s.second;
  D[y][x]=0;
  while(!Q.empty()){
    P t=Q.front();Q.pop();
    x=t.first,y=t.second;
    if(mp[y][x]=='*'||mp[y][x]=='o') G[M[s]][M[t]]=D[y][x];

    int dx[]={0,0,-1,1},dy[]={1,-1,0,0};
    for(int i=0;i<4;i++){
      int nx=x+dx[i],ny=y+dy[i],cost=D[y][x]+1;
      if(nx<0||ny<0||nx>=w||ny>=h||mp[ny][nx]=='x'||D[ny][nx]!=-1)continue;
      Q.push(P(nx,ny));
      D[ny][nx]=cost;
    }
  }
}

int n,num[11];
P start;
int calc(){
  int res=0;
  for(int i=1;i<n;i++)res+=G[num[i-1]][num[i]];
  return res;  
}

int dfs(int idx){
  if(idx==M[start]) return dfs(idx+1);
  if(idx==n) return calc();
  int res=1e9;
  for(int i=0;i<n;i++){
    if(num[i]!=-1)continue;
    num[i]=idx;
    res=min(res,dfs(idx+1));
    num[i]=-1;
  }
  return res;
}


int main(){
  while(1){
    cin>>w>>h;
    if(!w&&!h)break;
    for(int i=0;i<h;i++) cin>>mp[i];
    M.clear();
    memset(G,-1,sizeof(G));
    memset(num,-1,sizeof(num));
    n=0;
    vector<P> p;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
	P t=P(j,i);
	if(mp[i][j]=='*'||mp[i][j]=='o') p.push_back(t),M[t]=n++;
	if(mp[i][j]=='o') start=t;
      }
    for(int i=0;i<n;i++)bfs(p[i]);

    bool flg=1;
    for(int i=0;i<n;i++)if(G[0][i]==-1)flg=0;
    num[0]=M[start];
    cout <<(flg?dfs(0):-1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 3168
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

get_chars(Xs) :-
    get_string(S),
    string_chars(S, Xs).

get_numbers(0, []).
get_numbers(N, [X|Xs]) :- 
    get_number(X), 
    N2 is N - 1, 
    get_numbers(N2, Xs).

put_numbers([]).
put_numbers([X|Xs]) :-
    writeln(X),
    put_numbers(Xs).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==

    between(L,U,X): L <= X <= U
    nth0(I, Xs, Y), nth1(I, Xs, Y): (Xs,Y) -> I, (I, Xs) -> Y 

    sort(Key, Order, List, Sorted): Keyは通常0?, Orderは=なしが重複削除，=は重複保持
*/

f(X, Y) :- 
    between(0, 200, A),
    between(0, 200, B),
    X =:= A + B,
    Y =:= 2 * A + 4 * B.

main :-
    get_number(X, Y),
    f(X,Y) -> writeln("Yes") ; writeln("No").


Measured memory_bytes: 8056
/**
 *   author: malviyanshiv
 *   created: 09 January 2019  23:27:27
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define MAX 100005

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

void fastscan(int &x){
    bool neg=false;
    register int c;
    x =0;
    c=getchar();
    if(c=='-'){
        neg = true;
        c=getchar();
    }
    for(;(c>47 && c<58);c=getchar())
        x = (x<<1) + (x<<3) +c -48;
    if(neg)
        x *=-1;
}

void optimizeIO(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

vector<int> dp(MAX, -1);
vector<int> h(MAX);

int cal(int idx){
    if( idx <= 0 )
        return 0;
    if( idx == 1 )
        return abs(h[idx]-h[idx-1]);
    if( dp[idx] != -1 )
        return dp[idx];
    else
        return dp[idx] = min( cal(idx-2) + abs(h[idx]-h[idx-2]), cal(idx-1) + abs(h[idx]-h[idx-1]));
}

int main(){
	optimizeIO();

    int n;
    cin >> n;
    REP(i, 0, n)
        cin >> h[i];
    cout << cal( n-1 ) << endl;
	
	return 0;
}


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

int main() {
  string a,b;
  cin>>a>>b;
  if(a.size()>b.size()){
    cout<<"GREATER"<<endl;
    return 0;
  }else if(a.size()<b.size()){
    cout<<"LESS"<<endl;
    return 0;
  }else{
    for(int i=0;i<a.size();i++){
      int kazua=a[i]-'0';
      int kazub=b[i]-'0';
      if(kazua==kazub){
        continue;
      }else if(kazua>kazub){
        cout<<"GREATER"<<endl;
        return 0;
      }else{
        cout<<"LESS"<<endl;
        return 0;
      }
    }
  }
  cout<<"EQUAL"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    int freq[n+1];

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

    long long int ans=0;

    for(int i=0;i<n;i++)
    {
        ans+=freq[a[i]];
        freq[a[i]]++;
    }
    for(int i=0;i<n;i++)
    {
       
        cout<<ans+1-freq[a[i]]<<endl;
    }
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
	ll N,h=0; cin>>N;
	vector<ll> A(N+1,0);
	for(ll i=1; i<=N; i++){
		ll a; cin>>a;
		A[a]=A[a-1]+1;
		h=max(h,A[a]);
	}
	cout<<N-h<<endl;
}

Measured memory_bytes: 4796
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
const int maxn = 1e5+10;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int a[maxn];
int main(){
	int k,m,n;
	n=read();
	for(register int i=1;i<=n;i++)a[i]=read();
	for(register int i=1;i<=n;i++){
		if(a[i]>a[i-1])a[i]--;
	}
	for(register int i=1;i<=n;i++){
		if(a[i-1]>a[i]){puts("No");return 0;}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 640
// 自力でAC出来た
// 累積和+メモリ削減
#include<iostream>
#include<vector>
using namespace std;

const int mod = 1000000007;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for(int i = 0; i < n; i++)  cin >> v[i];
    vector<int> dp(k+1, 0);
    dp[0] = 1;
    for(int i = 0; i < n; i++){
        vector<int> ndp(k+1, 0);
        for(int j = 0; j <= k; j++){
            ndp[j] = (ndp[j] + dp[j])%mod;
            if(j+v[i]+1 <= k) ndp[j+v[i]+1] = (ndp[j+v[i]+1]-dp[j]+mod)%mod;
        }
        for(int j = 1; j <= k; j++) ndp[j] = (ndp[j]+ndp[j-1])%mod;
        dp = ndp;
    }
    cout << dp[k] << endl;
    return 0;
}

Measured memory_bytes: 1024
alphabet = "abcdefghijklmnopqrstuvwxyz"
str = input()
dic = {}
for i in range(len(str)):
  if not str[i] in dic:
    dic[str[i]] = True
if len(dic) == 26:
  print("None")
else:
  for i in range(len(alphabet)):
    if alphabet[i] not in dic:
      print(alphabet[i])
      break

Measured memory_bytes: 3188
// * reference
//   * https://qiita.com/tubo28/items/e6076e9040da57368845

use std::io::*;
use std::str;

fn main () {
    let test_data: u8 = read();

    println!( "{}", abc081_a(test_data) );
}

fn abc081_a (test_data: u8) -> u8 {

    let mut iter:        u8 = test_data;
    let mut num_marbles: u8 = 0;

    while iter > 0 {
        num_marbles += iter % 10;
        iter        /= 10;
    }

    /* return value of this function */
    num_marbles

}

// * reference
fn read<T: std::str::FromStr>() -> T {

    let stdin = std::io::stdin();

    let handle = stdin.lock();

    let token: String = handle
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c|  c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")

}

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

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

using namespace std;

int main(){
	int n; scanf("%d",&n);
	vector<int> a(n),b(n);
	rep(i,n) scanf("%d%d",&a[i],&b[i]);

	sort(a.begin(),a.end());
	sort(b.begin(),b.end());

	if(n%2==1) printf("%d\n",b[n/2]-a[n/2]+1);
	else       printf("%d\n",b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1);

	return 0;
}


Measured memory_bytes: 4840
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

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

signed main(){
    int n, m;
    cin >> n >> m;
    vector<int> c(m);
    rep(i, m) cin >> c[i];

    vector<int> dp(n+1, INF);
    dp[0] = 0;
    rep(i, m){
        rep(j, n+1){
            if(j < c[i] || dp[j-c[i]] == INF){
                continue;
            }
            dp[j] = min(dp[j], dp[j-c[i]] + 1);
        }
    }
    cout << dp[n] << endl;

    return 0;
}



Measured memory_bytes: 3092
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Read();
        }

        public void Solve(ConsoleInput cin)
        {
            string[] str = Console.ReadLine().Split(' ');
            int K = int.Parse(str[0]);  
            int S = int.Parse(str[1]);

            int count = 0;

            for (int i = 0; i <= K; i++)
            {
                for (int j = 0; j <= K; j++)
                {
                   // for (int m = 0; m <= K; m++)
                    //{
                    var l = S - i - j;
                    if (l <= K&&l>=0)
                    {
                        count++;
                    }

                }
            }
            Console.WriteLine(count);

        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 11220
#include<iostream>
#include<algorithm>

using namespace std;

int main(void)

{
    int r, g, b, k, i, flag = 1;
    cin>>r>>g>>b>>k;
    for(i = 0; i <= k; i++){
        if(b>g && g>r){
            flag = 0;
            break;
        }
        if(b <= g || b <= r)b*=2;
        else g *=2;
    }
    if(flag == 0)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3124
#include <cstdio>
int a,b,c;
bool pan(){
	if(a==b and a!=c)return true;
	if(a==c and a!=b)return true;
	if(c==b and a!=c)return true;
	return false;
}
int main(){
	scanf("%d%d%d",&a,&b,&c);
	if(pan())printf("Yes\n");
	else printf("No\n");
	return 0;
}


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

int main(){
  long long N;
  cin >> N;
  bool flag=true;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());

  for(int i=0;i<N-1;i++){
    if(A.at(i)==A.at(i+1)){
      flag=false;
      break;
    }
  }
  if(flag){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" <<endl;
  }
}


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

int h, w;
string s[300];

int calc(int x, int y) {
    uint sum[2*h+1][h+1];
    memset(sum, 0, sizeof(sum));
    for (int i = -h; i <= h; i++) {
        for (int j = 0; j < h; j++) {
            if (0 <= i+j && i+j < h) {
                if (s[h-(i+j)-1][x] == s[h-j-1][y]) sum[i+h][j]++;
            }
        }
        for (int j = h-1; j > 0; j--) {
            sum[i+h][j-1] += sum[i+h][j];
        }
    }

    uint dp[h+1][h+1];
    memset(dp, -1, sizeof(dp));
    dp[0][0] = 0;
    for (int i = 0; i <= h; i++) {
        for (int j = 0; j <= h; j++) {
            if (i < h) {
                dp[i+1][j] = min(dp[i+1][j], dp[i][j] + sum[i-j+h][j]);
            }
            if (j < h) {
                dp[i][j+1] = min(dp[i][j+1], dp[i][j] + sum[i-j+h][j]);
            }
        }
    }
    return dp[h][h];
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> s[i];
    int ans = 0;
    for (int i = 0; i < w-1; i++) {
        ans += calc(i, i+1);
    }
    cout << ans << "\n";
    return 0;
}

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

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

int main() {
    int n;
    int k;
    cin >> n >> k;
    vector<int> x(n);
    for(int i = 0; i < n; i++) {
        cin >> x[i];
    }

    int dist=INT32_MAX;
    int tdist;
    int l,r;
    for(int i = 0; i < n-k+1; i++) {
        l=i;
        r=i+k-1;
        if(x[r]<0)      tdist=-x[l];
        else if(x[l]<0) tdist=x[r]-x[l]+min(x[r],-x[l]);
        else            tdist=x[r];
        dist=min(dist,tdist);
    }
    cout << dist << "\n";
    return 0;
}

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

int main(){
    int x;
    cin>>x;
    int dp[101000] = {0};
    int a[6] = {100,101,102,103,104,105};
    dp[0] = 1;
    for(int i=0; i<6; i++) {
        for(int j=0; j<x; j++) {
            if(dp[j] == 1) {
                dp[j+a[i]] = 1;
            }
        }
    }
    cout<<dp[x];
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=55;
int a[N],b[N],c[N],d[N];
int A[N],n,m,q,ans=0;
void dfs(int id,int num){
	if(id==n+1){
		int sum=0;
		for(int i=1;i<=q;i++)
			if(A[b[i]]-A[a[i]]==c[i]) sum+=d[i];
		ans=max(ans,sum);
		return ;
	}
	for(int i=num;i<=m;i++)
	{
		A[id]=i;
		dfs(id+1,i);
	}
}
int main(){	
 		cin>>n>>m>>q;
 		for(int i=1;i<=q;i++)	
 			cin>>a[i]>>b[i]>>c[i]>>d[i];
		dfs(1,1); 
	    printf("%d\n",ans);
	    return 0;
} 

Measured memory_bytes: 3724
N,L = list(map(int, input().split()))
Ni = []
mI = 0
ab = abs(L - 1)
for i in range(N):
    if ab > abs(L + i):
        mI = i
        ab = abs(L + i)

    Ni.append(L + i)

del Ni[mI]
print(sum(Ni))

Measured memory_bytes: 3060
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
s = input()

#print(s)
def solve(a,b): #a: n-1th b:0th 
    res = [a,b]
    for i in s:
        if i == "o":
            c = (res[-1]+res[-2])%2
        else:
            c = (1+res[-1]+res[-2])%2
        res.append(c)
#    print(a,res)
    if res[-2] == a and res[-1] == b:
        ans = ["W" if i else "S" for i in res[1:-1]]
        print("".join(ans))
        exit()
    
    
for a in range(2):
    for b in range(2):
        solve(a,b)
        
print(-1)

Measured memory_bytes: 5628
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define forx(i,j,n) for(int i=j;i<n;i++)
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define vvi vector<vi>
#define vvl vector<vl>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define fastio ios_base::sync_with_stdio(false)
#define testcase int t; cin>>t
#define inputi(xx) scanf("%d",&xx)
#define inputll(xx) scanf("%lld",&xx)
#define printi(xx) printf("%d",xx)
#define printll(xx) printf("%d",xx)


int main() {
    ll n,l;
    cin>>n>>l;
    vl a;ll sum=0;
    forx(i,0,n){ a.pb(l+i);sum+=l+i;}
    if(a[n-1]>=0&&a[0]<=0) cout<<sum;
    else{
        ll ans=a[0];
        if(abs(a[n-1])<abs(a[0])) ans=a[n-1];
        cout<<sum-ans;
    }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
int c[99],z,p,i;main(){std::string s,r,a="AIDUNYAN";std::cin>>s;r=s;for(char k:a)c[k]--;for(i=0;i<s.size();i++){if(i>7){if(!c[p=s[i-8]]--)z--;if(!c[p])z++;}if(!c[p=s[i]]++)z--;if(!c[p])z++;if(z==6)for(p=0;p<8;p++)r[i-7+p]=a[p],r[i-5]='Z';}std::cout<<r<<"\n";}

Measured memory_bytes: 1176
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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 T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int H,W,K; cin >> H >> W >> K;
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--; y1--;
    x2--; y2--;
    vector<string> masu(H);
    VVI dist(H,VI(W,-INF));
    REP(i,H) cin >> masu[i];
    queue<tuple<int,int,int>> q;
    q.push(make_tuple(x1,y1,0));
    dist[x1][y1] = 0;

    while(!q.empty()){
        auto t = q.front();
        q.pop();
        int nx,ny,nd;
        tie(nx,ny,nd) = t;
        REP(i,4){
            int tx = nx, ty = ny;
            REP(j,K){
                int ttx = tx+dx[i];
                int tty = ty+dy[i];
                if(ttx >= 0 and ttx < H and tty >= 0 and tty < W and masu[ttx][tty] != '@'){
                    if(dist[ttx][tty] == -INF){
                        q.push(make_tuple(ttx,tty,nd+1));
                        dist[ttx][tty] = nd+1;
                    }else if(dist[ttx][tty] == nd+1){
                        ;
                    }else{
                        break;
                    }
                    tx = ttx;
                    ty = tty;
                }else{
                    break;
                }

            }
        }

    }
    if(dist[x2][y2] == -INF){
        cout << -1 << endl;
    }else{
        cout << dist[x2][y2]  << endl;
    }

}

Measured memory_bytes: 11116
#include "bits/stdc++.h"
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define bisea binary_search
#define unsort(vec) sort(vec); rever(vec);
#define cend cout<<endl;
#define gcd __gcd
using namespace std;
signed main() {
  int n,y;
  cin>>n>>y;
  for(int i=0;i<=n;i++) {
    for(int j=0;j+i<=n;j++) {
      int k=n-(i+j);
      if(0<=k) {
        if(1000*i+5000*j+10000*k==y) {
          cout<<k<<" "<<j<<" "<<i<<endl;
          return 0;
        }
      }
    }
  }
  cout<<-1<<" "<<-1<<" "<<-1<<endl;
}

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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;
       
        static void SolveA()
        {
            var o = ReadAndParseLongArr();
            long x = o[0];
            long y = o[1];

            long tmp = x;
            long ans = 0;
            while( tmp <= y)
            {
                tmp *= 2;
                ans++;
            }
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if( x == 2) { return true; }
            if( x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while( i * i <= x)
            {
                if( x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }

        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

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

int main()
{
  std::vector<std::string> words;
  std::string word;
  int n;
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> word;
    if (i != 0 && word[0] != words[i-1][words[i-1].length()-1]) {
      std::cout << "No" << std::endl;
      return 0;
    }
    for (int j = 0; j < words.size(); j++) {
      if (word == words[j]) {
        std::cout << "No" << std::endl;
        return 0;
      }
    }
    words.push_back(word);
  }
  std::cout << "Yes" << std::endl;
  return 0;
}

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

main(){
  int total = 0, sum = 0, v, a, n = 0;
  char ch;
  while( cin >> v >> ch >> a ){
    total += v*a;
    sum += a;
    n++;
  }
  cout << total << endl;
  cout << (int)(1.0*sum/n +0.5) << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
const int N = 1610;

#define PI acos(-1)
typedef long long ll;
typedef pair<int, int> pii;
#define INF 0x3f3f3f3f
int mod = 1000000007;
char s[N];
int main()
{
	//freopen("in.txt", "r", stdin);
	int a, b;
	while (~scanf("%d%d", &a, &b))
	{
		scanf("%s", s + 1);
		bool f = true;
		if (s[a+1] != '-')
			f = false;

		int l = a + b + 1;

		for (int i = 1; i <= l; i++)
			if (i != a+1 && !isdigit(s[i]))
			{
				f = false;
			}
		if (strlen(s+1) != a+1+b)
			f = false;
		puts(f?"Yes":"No");


	}
   	return 0;
}

Measured memory_bytes: 256
import Foundation

private func readWords<T>(_ f: (Substring) -> T) -> [T] {
    return readLine()!.split(separator: " ").lazy.map(f)
}

prefix operator *
prefix func *<T>(a: inout IndexingIterator<[T]>) -> T {
    return a.next()!
}

func mainC() {
    var nk = readWords { Int($0)! }.makeIterator()
    let n = *nk
    let k = min(50, *nk)
    
    var A = readWords { Int($0)! }
    
    for _ in 1...k {
        var B = [Int](repeating: 0, count: n+1)
        for (i, a) in A.enumerated() {
            let l = max(0, i - a)
            let r = min(n, a + i + 1)
            B[l] += 1
            B[r] -= 1
        }
        
        var total = 0
        for i in 0..<n {
            A[i] = total + B[i]
            total = A[i]
        }
    }
    
    print(A.lazy.map{ $0.description }.joined(separator: " "))
    
}

mainC()


Measured memory_bytes: 24528
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int main(){
 

    LL a,max;
    cin>>a>>max;
    LL num=1;
    while(a<=max){
        a*=2;
        if(a>max){break;}
        //cerr<<"ok a:"<<a<<endl;
        num++;
    }
    cout<<num<<endl;



}


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

using namespace std;

const long long int MOD=1e9+7;

vector<long long int> vec;

long long int dfs(long long int tmp, int cur) {
    if(cur==vec.size()) {
        return tmp;
    }
    
    return (dfs(tmp*vec[cur]%MOD, cur+1)+dfs(tmp%MOD, cur+1))%MOD;
}

int main() {
    int N;
    cin >> N;
    string str;
    cin >> str;
    
    map<char, long long int> mp;
    for(int n=0; n<N; n++) {
        mp[str[n]]++;
    }
    vec.assign(mp.size(), 0);
    int cnt=0;
    for(auto i=mp.begin(); i!=mp.end(); i++) {
        vec[cnt] = i->second;
        cnt++;
    }
    

    cout << dfs(1, 0)-1 << endl;
    

    return 0;
    
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    ll K,X; cin>>K>>X;
    ll first, last;

    first = max((ll)-1000000, X - K + 1);
    last = min((ll)1000000, X + K - 1);

    cout << first;
    for (int i = first + 1; i <= last; i++)
        cout << " " << i;
    cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		String str = scanner.nextLine();
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < str.length(); i++) {
			if (Character.isLowerCase(str.charAt(i))) {
				System.out.print(Character.toUpperCase(str.charAt(i)));
			} else {
				System.out.print(Character.toLowerCase(str.charAt(i)));
			}
		}
		System.out.println();

	}

}



Measured memory_bytes: 26928
n = int(input())
c = list(input())
sw = [0]*(n+2)
sr = [0]*(n+2)
for i in range(1,n+1):
    sw[i] = sw[i-1] + 1*(c[i-1]=="W")
    sr[n+1-i] = sr[n+2-i] + 1*(c[n-i]=="R")
ans = 10**6
for i in range(n+1):
    ans = min(ans, max(sw[i],sr[i+1]))
print(ans)

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

struct data{
	llong place;
	llong cost;

	data(){};
	data(llong place, llong cost) :
		place(place),
		cost(cost)
	{}

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
};

vector<vector<P> > edges;

llong Dijkstra(int start, int goal){
	priority_queue<data, vector<data>, greater<data> > q;
	vector<vector<llong> > dis(edges.size(), vector<llong>(3, inf));
	dis[start][0] = 0;

	q.push(data(start, 0));
	while(q.size()){
		data now = q.top(); q.pop();
		if(dis[now.place][now.cost%3] < now.cost) continue;

		for(int i = 0; i < edges[now.place].size(); i++){
			P edge = edges[now.place][i];
			data next(edge.first, now.cost + edge.second);
			if(dis[next.place][next.cost%3] <= next.cost) continue;
			dis[next.place][next.cost%3] = next.cost;
			q.push(next);
		}
	}

	return dis[goal][0] == inf ? -1 : dis[goal][0]/3;
}


int main() {
	llong N, M, S, T;
	cin >> N >> M;
	edges.resize(N+1);
	llong u, v;
	for (int i = 0; i < M; ++i) {
		cin >> u >> v;
		edges[u].push_back(P(v, 1));
	}
	cin >> S >> T;

	cout << Dijkstra(S, T) << endl;

	return 0;
}

Measured memory_bytes: 11136
A=[]
n=int(input())
for i in range(n):
    B=list(int(j) for j in input().split())
    A.append(B)
dp=[[0 for i in range(3)]for k in range(n)]
#print(dp)
for i in range(n):
    for j in range(3):
        if i>0 and j==1:
            dp[i][j]=max(dp[i-1][j-1],dp[i-1][j+1])+A[i][j]
        elif i==0:
            dp[i][j]=A[i][j]
        elif j==0:
            dp[i][j]=max(dp[i-1][j+1],dp[i-1][j+2])+A[i][j]
        elif j==2:
            dp[i][j]=max(dp[i-1][j-1],dp[i-1][j-2])+A[i][j]
print(max(dp[-1]))


Measured memory_bytes: 76632
// Takoyaki.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <iostream>;
using namespace std;

int main()
{
	long long int n, x, t;
	cin >> n >>  x >> t;
	if (x==1){
		cout << t*n;
	}
	else{
		cout << ((n+x-1)/x)*t;
	}
	return 0;
}



Measured memory_bytes: 3592