akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 2e5 + 555;
const int MOD = 1e9 + 7;
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    cout << fixed;
    string s;
    cin >> s;
    if (s.front() <= 'Z' and s.front() >= 'A')
        cout << "A" << endl;
    else
        cout << 'a' << endl;
    return 0;
}

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		String s = sc.next();
		
		int max = 0;
		
		int cnt = 0;
		boolean counting = false;
		
		for(int i = 0; i < s.length(); i++) {
			if(counting) {
				cnt++;
			}
			
			if(s.charAt(i) == 'A' && !counting) {
				counting = true;
				cnt++;
			}
			
			if(s.charAt(i) == 'Z' && counting) {
				max = Math.max(max, cnt);
			}
		}
		
		out.println(max);
	}

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

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static int lcm(int a, int b) {
		return (a * b) / gcd(a, b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 26964
let id x = x
let (n,m) = Scanf.scanf "%d %d\n" (fun n m -> (n,m))
 
let sc s c x =
if (2*s) <= c then ((c-2*s),s) else (0,c/2)
 
let cx = sc n m 0
let c = fst cx
let x = snd cx
 
let ans = x + c/4
 
let () = Printf.printf "%d\n" ans

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

int main() {
	int n; int a[110];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n,greater<int>());
	int alice = 0, bob = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			alice += a[i];
		}
		else {
			bob += a[i];
		}
	}
	cout << alice - bob << endl;
	return 0;
}

Measured memory_bytes: 256
/**
 * Circle.cpp
 * Create:20180419
 * Description:rを読み込んで、外周と面積を出力する
 */
#include <iostream>
#include <cmath>

int main(int argc, char* argv[]){
  double r;

  std::cin >> r;

  double outer = r * 2.0 * M_PI;
  double area = r * r * M_PI;

  printf("%.6f %.6f", area, outer);

  return 0;
}



Measured memory_bytes: 3200
n,m=map(int,input().split())
dic={}
for i in range(m):
  x,y=map(int,input().split())
  if x in dic:
    dic[x]+=1
  else:
    dic[x]=1
  if y in dic:
    dic[y]+=1
  else:
    dic[y]=1
for i in range(1,n+1):
  try:
    print(dic[i])
  except:
    print(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
#define MAX(a,b,c) max(a,max(a,b))       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
      ll n;
      cin>>n;
    vector<int> dp(3,0);
    int c[3];
    vector<int> check(3,0);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        cin>>c[j];
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                if(j!=k)
                check[k]=max(check[k],dp[j]+c[k]);
            }
        }
        dp=check;
    }
    cout<<max(dp[0],max(dp[1],dp[2]));
  }  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  double x, a, b;

  scanf("%lf %lf %lf", &x, &a, &b);

  if(a>=b)
  puts("delicious");
  else if(b-a<=x)
  puts("safe");
  else
  puts("dangerous");

  return 0;
}


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

unordered_map<string, string> map = {{"A", "T"}, {"T", "A"}, {"C", "G"}, {"G", "C"}};

int main() {
  string b;
  cin >> b;
  
  cout << map[b] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define my_max(a, b) ((a) > (b) ? (a) : (b))
#define my_min(a, b) ((a) < (b) ? (a) : (b))
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rep(i, s, t) for(int i = (int)(s); i <= (int)(t); i++)
#define rev(i, t, s) for(int i = (int)(t); i >= (int)(s); i--)
#define lson rt << 1
#define rson rt << 1 | 1
#define sz(x) (int)(x).size()

typedef long long ll;
typedef long double lb;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::vector<int> VI;
typedef std::vector<ll> VL;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> rbtree;
ll gcd(ll x, ll y){ return y % x == 0 ? x : gcd(y % x, x); }
template<class T>T my_abs(T a){ if(a < 0) a = -a; return a; }
inline ll read(){
    ll ret = 0, sign = 1;
    char c = getchar();
    while(c < '0' || c > '9'){ if(c == '-') sign = -1; c = getchar();}
    while(c >= '0' && c <= '9'){ ret = ret * 10 + c - '0'; c = getchar(); }
    return ret * sign;
}
inline void write(ll x){
    if(x < 0){
        putchar('-');
        x = -x;
    }
    if(x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

//void expand_stack_space(){
//    int size = 256 << 20; // 256MB
//    char *p = (char*)malloc(size) + size;
//    __asm__("movl %0, %%esp\n" :: "r"(p));
//}
const int maxn = 1e5 + 7;

int h[maxn], n, m, ok[maxn];
int main(){
#ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif // ONLINE_JUDGE
    scanf("%d%d", &n, &m);
    rep(i, 1, n) scanf("%d", h + i);
    rep(i, 1, m) {
        int u, v;
        scanf("%d%d", &u, &v);
        if(h[u] < h[v]) ok[u] = 1;
        else if(h[u] > h[v]) ok[v] = 1;
        else {
            ok[u] = ok[v] = 1;
        }
    }
    int ans = 0;
    rep(i, 1, n) if(!ok[i]) ++ans;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 4544
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int mod=998244353;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=9e18;
typedef pair<ll,ll> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int cnt;
  string s,t;
  cin >> s >> t;
  for(int i=s.size()-t.size(); i>=0; i--) {
    cnt=0;
    for(int j=0; j<t.size(); j++) {
      if(s[i+j]!='?'&&s[i+j]!=t[j]) {
        break;
      }
      cnt++;
    }
    if(cnt==t.size()) {
      for(int j=0; j<t.size(); j++) {
        s[i+j]=t[j];
      }
      for(int j=0; j<s.size(); j++) {
        if(s[j]=='?') {
          s[j]='a';
        }
      }
      cout << s << endl;
      return 0;
    }
  }
  cout << "UNRESTORABLE" << endl;
}

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

int main(){
	int flag = 0;
	char word[1024],*tok,cut[] = " .,";
	fgets(word,1024,stdin);
	tok = strtok(word,cut);
	while(tok != NULL){
		if(strlen(tok) >= 3 && strlen(tok) <= 6) {
			if(!flag) {
				flag = 1;
				printf("%s",tok);
			}else printf(" %s",tok);
		}
		tok = strtok(NULL,cut);
	}
	puts("");
	return 0;
}

Measured memory_bytes: 524
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

S = str(input())
print("x"*len(S))

Measured memory_bytes: 6796
N,M=map(int,input().split())
H = list(map(int,input().split()))
ans=[1]*N
for m in range(M):
    a,b = map(int,input().split())
    if H[a-1]<H[b-1]:
        ans[a-1]=0
    elif H[a-1]>H[b-1]:
        ans[b-1]=0
    elif H[a-1]==H[b-1]:
        ans[a-1]=0
        ans[b-1]=0
print(ans.count(1))

Measured memory_bytes: 20044
import java.util.Scanner;

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

    for (int i = 1; i <= 5; i++) {
      if (sc.nextInt() == 0) {
        System.out.println(i);
        return;
      }
    }
  }
}


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

#define pb push_back
#define fr first
#define sc second
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> pip; 
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){

 int n, k, p;
  cin>> n;
  for(int i=0;i<n;i++){
    cin>> k>> p;
    if(k%p==0){
      cout<< p<< endl;
    }
    else{
      k%=p;
      cout<< k<< endl;
    }
  }
}

Measured memory_bytes: 1160
/*
 ============================================================================
 Name        : ARC_090_C.c
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

int candynum(int* candy1, int*candy2, int down, int N);

int max(int a, int b){
	return a >= b ? a : b;
}

int main(void) {
	int N;
	int i;
	int ans=0;

	scanf("%d", &N);
	int *candy_1 = (int *) malloc(sizeof(int) * N);
	int *candy_2 = (int *) malloc(sizeof(int) * N);

	for (i = 0; i < N; i++) {
		scanf("%d",&candy_1[i]);
	}
	for (i = 0; i < N; i++) {
		scanf("%d", &candy_2[i]);
	}

	for(i=0; i<N; i++){
		ans = max(ans,candynum(candy_1,candy_2, i,N) );
	}

	printf("%d", ans);

	return EXIT_SUCCESS;
}

int candynum(int* candy1, int* candy2, int down, int N) {
	int j;
	int now;
	now = 0;
	for (j = 0; j <= down; j++) {
		now += candy1[j];
	}
	for (j = down; j < N; j++) {
		now += candy2[j];
	}

	return now;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int w[10];
  int k[10];
  int i, j, tmp;

  for (i = 0; i < 10; i++) {
    scanf("%d", &w[i]);
  }
  for (i = 0; i < 10; i++) {
    scanf("%d", &k[i]);
  }

  for (i = 0; i < 10; i++) {
    for (j = i + 1; j < 10; j++) {
      if (w[i] < w[j]) {
        tmp = w[i];
        w[i] = w[j];
        w[j] = tmp;
      }
    }
  }
  for (i = 0; i < 10; i++) {
    for (j = i + 1; j < 10; j++) {
      if (k[i] < k[j]) {
        tmp = k[i];
        k[i] = k[j];
        k[j] = tmp;
      }
    }
  }
  
  printf("%d %d\n", w[0] + w[1] + w[2], k[0] + k[1] + k[2]);

  return 0;
}



Measured memory_bytes: 2016
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#from math import gcd
num_clock = int(input())
times = [int(input()) for i in range(num_clock)]
spent_time = times[0]
for time in times[1:]:
    spent_time = (spent_time * time) // gcd(spent_time, time)
print(spent_time)

Measured memory_bytes: 3060
#include <atcoder/lazysegtree>
#include <atcoder/modint>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
struct S { mint a, b; };
using F = int;
S op(S l, S r) { return S{l.a * r.b + r.a, l.b * r.b}; }
S e() { return S{0, 1}; }
F id() { return -1; }
S mapping(F f, S x) { return f == id() ? x : S{(x.b - 1) / 9 * f, x.b}; }
F composition(F f, F g) { return f == id() ? g : f; }
main() {
    int n, q;
    cin >> n >> q;
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(vector(n, S{1, 10}));
    while (q--) {
        int l, r, d;
        cin >> l >> r >> d;
        seg.apply(l - 1, r, d);
        cout << seg.all_prod().a.val() << '\n';
    }
}

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

int main(){
    int N;
    cin >> N;
    stack<int> s;
    vector<int> df(100);
    int R = 0;
    int b;
    for (int i = 0;i < N;i++){
        int a;
        cin >> a;
        if(0 < a){
            df[a] += 1;
            for(int k = 0;k < 100;k++){
                if(df[k] >= 2){
                    R = i+1;
                    goto loop;
                  
                }
            }
            s.push(a);
        }else{
            if (s.size() == 0){
              R = i+1;
              break;
            }
            int top = s.top();
            if(top == a * -1){
                df[a*-1] = 0;  
                s.pop();
            }else{
              //cout << 1;
                R = i+1;
                break;
            }
        }
    }
    loop:
    if(R == 0){
        cout << "OK" << endl;
    }else{
        cout << R << endl;
    }
}



Measured memory_bytes: 3136
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#include <cstdint>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long solve(long n, std::vector<long> d){
    std::sort(d.begin(), d.end());
    return d[n/2] - d[n/2-1];
}

int main(){
    long n;
    scanf("%ld", &n);
    std::vector<long> d(n);
    for(int i = 0; i < n; i++){
        std::cin >> d[i];
    }
    printf("%ld\n", solve(n, d));
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<vector<int>> jobs(m);
  
  rep(i,n){
    int a,b;
    cin >> a >> b;
    if(a>m) continue;
    jobs[m-a].push_back(b);
  }
  priority_queue<int> q;
  ll ans = 0;
  for(int i=m-1;i>=0;i--){
    for(int b : jobs[i]){
      q.push(b);
    }
    if(!q.empty()){
      ans += q.top();
      q.pop();
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 5632
#include <iostream>
using namespace std;
int main (){
	int H, W, h, w;
	cin >> H >> W >> h >> w;

	if (H%h == 0 && W%w == 0) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
	int N = 1000000;
	if (W%w != 0) {
		for (int i=0; i<H; i++) {
			for (int j=0; j<W; j++) {
				cout << (j ? " " : "");
				cout << (j%w == 0 ? (w-1)*N-1 : -N);
			}
			cout << endl;
		}
	} else {
		for (int i=0; i<H; i++) {
			for (int j=0; j<W; j++) {
				cout << (j ? " " : "");
				cout << (i%h == 0 ? (h-1)*N-1 : -N);
			}
			cout << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    sort(ALL(s));
    sort(ALL(t), greater<char>());
    cout << (s < t ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
ll const mod=998244353;
const ll MAX=300000;
using vi=vector<int>;
using vc=vector<char>;
using vs=vector<string>;
using vvi =vector<vector<int>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
int main(){
    ll n;
    cin>>n;
    ll tmp=n,add=0,two=2;
    int cnt=0,p=1;
    vi ans;
    if(tmp<0){
        tmp=-tmp;
        p=0;
    }
    while(tmp>0){
        ans.push_back(tmp%2);
        if(tmp%2==1&&cnt%2==p){
            tmp+=2;
        }
        tmp/=2;
        cnt++;
    }
    int a=ans.size();
    rep(i,a)cout<<ans[a-1-i];
    if(a==0)cout<<0;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
object Main{
  def main(args: Array[String]): Unit = {
    var n = readInt
    while(n>0){
      var scores = List.empty[Int]
      for(i<- 0 until n){
        scores = readInt :: scores
      }
      val s = scores.sum - scores.min - scores.max
      println(s/(n-2))
      n = readInt
    }
  }
}

Measured memory_bytes: 43636
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*
int inv[1000001]={0};int invf[1000001]={0};
void findinverse(){
	inv[0]=1;
	inv[1] = 1;
	for(int i = 2; i <=1e6 ; ++i)
		inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
	invf[0]=1;invf[1]=1;
	for(int i=2;i<=1e6;i++){
		invf[i]=invf[i-1]*inv[i]%mod;
	}
}*/
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> orderedMultiset;
int solve()
{
	string s;
	cin>>s;
	int sum=0;
	for(int i=0;i<s.length();i++){
		sum+=s[i]-'0';
	}
	if(sum%9==0)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}



Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;

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

  switch (N % 10)
  {
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    cout << "hon";
    break;
  case 0:
  case 1:
  case 6:
  case 8:
    cout << "pon";
    break;
  case 3:
    cout << "bon";
    break;
  default:
    break;
  }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define LL long long
#define MEM(x,y) memset(x,y,sizeof(x))
#define MOD(x) ((x)%mod)
#define mod 1000000007
#define pb push_back
#define STREAM_FAST ios::sync_with_stdio(false)
using namespace std;

int main()
{
	LL L, R; scanf("%lld%lld", &L, &R);
    if (R - L + 1 >= 2019)  {puts("0"); return 0;}
    LL ans = 1e18;
    for (LL x = L; x < R; x++)
        for (LL y = x + 1; y <= R; y++)
        {
            ans = min(ans, ((x % 2019) * (y % 2019)) % 2019);
        }
    printf("%lld\n", ans);
	return 0;
}


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

int main() {
  int n;
  string s[200010];
  cin >> n;
  
  for(int i=0;i<n;i++){
    cin >> s[i];
  }
  
  map<string , int> mp;
  int ans = 0;
  for(int i=0;i<n;i++){
    mp[s[i]] = 1;
  }
  
  for(map<string, int>::iterator itr = mp.begin(); itr != mp.end(); ++itr)
{
    if(itr->second > 0){
      ans ++;
    }
}
  
  cout << ans << endl;
}
  

Measured memory_bytes: 25376
#include <stdio.h>
 #include <algorithm>
 using namespace std;
 int main(){ int n,max_num = -1000001,min_num = 1000001,tmp;
 long long int sum = 0;
 scanf("%d",&n);
 for(int i = 0; i < n; i++)
{ scanf("%d",&tmp);
 sum += tmp;
 max_num = max(max_num,tmp);
 min_num = min(min_num,tmp);
 }
 printf("%d %d %lld\n",min_num,max_num,sum); } 



 



Measured memory_bytes: 2732
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

/*ここまでテンプレ*/



/*ここからmain関数*/

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

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

	vector<pair<int, int>> AB(N);
	for (int i = 0; i < N; i++)
	{
		AB[i] = make_pair(A[i], B[i]);
	}

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

	long long int mon = 0;
	int num = 0;
	for (int i = 0; i < N ; i++)
	{
		if (num >= M) break;

		int buy = 0;
		buy = min(AB[i].second, M - num);

		mon += (long long int)buy * (long long int)AB[i].first;
		num += buy;
	}

	cout << mon;

	return 0;
}

Measured memory_bytes: 1920
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

public static partial class Program
{
    public static void Main()
    {
        var abck = CRL().ArrayLongs();
        var a = abck[0];
        var b = abck[1];
        var c = abck[2];
        var k = abck[3];

        CWL(k.IsEven() ? a - b : b - a);
    }
}

public static partial class Program
{
    //テンプレここから
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static int GCD(int a, int b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    public static int LCM(int a, int b) => a * b / GCD(a, b);
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static string CRL() => Console.ReadLine();
    public static string RL() => ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static void WL(object obj) => WriteLine(obj);
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static long[] dx = new long[] {0, -1, 0, 1};
    public static long[] dy = new long[] {-1, 0, 1, 0};
    public static long mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);

    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

    //テンプレここまで
}

Measured memory_bytes: 13396
import sys
X=int(input())

#for i in range(-30,30):
#    print(i**5)

#for i in range(200):
#    print(i**5-(i-1)**5)

for A in range(-200,200):
    for B in range(-200,200):
        if A**5-B**5==X:
            print(A,B)
            sys.exit()


Measured memory_bytes: 9132
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

ll x,y;

void run() {
	scanf("%lld%lld",&x,&y);
	int ret=1;
	while(x*2<=y) ++ret,x*=2;
	printf("%d\n",ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

int main(){
    int n,m,a,b;
    cin >> n >> m;
    vector<int> v[100009];
    for(int i=0;i<n;i++){
        cin >> a >> b;
        v[a].push_back(b);
    }
    long long cnt=0;
    priority_queue<long long > Q;
    for(int i=1;i<=m;i++){
        if(!v[i].empty()){
            for(int j=0;j<v[i].size();j++){
                Q.push(v[i][j]);
            }
        }
        if(!Q.empty()){
            cnt+=Q.top();Q.pop();
        }
    }
    cout << cnt << endl;
}

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

int main() {

  int N;
  cin >> N;

  if (N / 100 == 7 || N % 10 == 7 || N % 100 == 70 || N % 100 == 71 || N % 100 == 72 || N % 100 == 73 || N % 100 == 74 || N % 100 == 75 || N % 100 == 76 || N % 100 == 78 || N % 100 == 79) {
    cout << "Yes" << endl;
  }
  else { cout << "No" << endl;
    }
}

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

int main () {
  int N;
  cin >> N;
  long long ans = 0;
  for (int i = 1;i <= N; i++){
    for (int j = 1;j <= N; j++){
      for (int k = 1;k <= N; k++){
        int a = min (i, j);
        int b = min (a, k);
        for (int l = b; l >= 1; l--){
          bool plus = true;
          if (i%l != 0) plus = false;
          if (j%l != 0) plus = false;
          if (k%l != 0) plus = false;
          if (plus){
            ans += l;
            break;
          }
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

H,W=LI()
MP=[input() for _ in range(H)]

mp_wid=[[0]*W for _ in range(H)]
mp_hei=[[0]*W for _ in range(H)]

for i in range(H):
    cnt = 0
    for j in range(W):
        if MP[i][j] == '.':
            cnt += 1
        else:
            for k in range(cnt):
                mp_wid[i][j-k-1] = cnt
            cnt=0
    for k in range(cnt):
        mp_wid[i][-k-1] = cnt

for j in range(W):
    cnt = 0
    for i in range(H):
        if MP[i][j] == '.':
            cnt+=1
        else:
            for k in range(cnt):
                mp_hei[i-k-1][j] = cnt
            cnt=0
    for k in range(cnt):
        mp_hei[-k-1][j] = cnt

# for li in mp_wid:
#     print(li)
# print('')
# for li in mp_hei:
#     print(li)
res = 0
for i in range(H):
    for j in range(W):
        res = max(res, mp_hei[i][j]+mp_wid[i][j]-1)
print(res)


Measured memory_bytes: 123224
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define endl '\n'

void solvetask(){
    int n; cin >> n;
    vector<long long> divs(n+1, 1);
    for (int i=2; i<=n; i++){
        for (int j=i; j<=n; j+=i) divs[j]++;
    }
    //for (long long i = 2; i*i <=n; i++) divs[i*i]--;
    long long ans = 0;
    for (int c = 1; c < n; c++){
        ans += divs[n - c];
    }
    cout << ans << endl;
}
 
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t=1; //cin >> t;
    while(t--) solvetask();
}

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

int main() {
    string s;
    cin >> s;
    if(s == "Sunny") {
        cout << "Cloudy";
    } else if(s == "Cloudy") {
        cout << "Rainy";
    } else if(s == "Rainy") {
        cout << "Sunny";
    }
    return 0;
}


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

const int64_t MOD = 998244353;
void add(int64_t& a, int64_t b){
    a %= MOD;
    b %= MOD;
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a %= MOD;
    b %= MOD;
    a = a*b % MOD;
}

vector<int64_t> fact, seq_inv, fact_inv;

void create_fact_mod(int num){
    fact[0] = fact[1] = 1;
    for(int i=2; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
}

void create_seq_inv_mod(int num){
    seq_inv[0] = seq_inv[1] = 1;
    for(int i=2; i<=num; i++) seq_inv[i] = (MOD - MOD/i) * seq_inv[MOD%i] % MOD;
}

void create_fact_inv_mod(int num){
    fact_inv[0] = fact_inv[1] = 1;
    for(int i=2; i<=num; i++) fact_inv[i] = fact_inv[i-1] * seq_inv[i] % MOD;
}

void create_mod_tables(int num){
    fact.resize(num+1);
    seq_inv.resize(num+1);
    fact_inv.resize(num+1);
    create_fact_mod(num);
    create_seq_inv_mod(num);
    create_fact_inv_mod(num);
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    power %= (MOD-1);
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int main() {
    int64_t M, N, K;
    cin >> M >> N >> K;
    if(M < K){
        cout << 0 << endl;
        return 0;
    }
    create_mod_tables(1000);
    int64_t ans = power_mod(M, N);
    for(int k=1; k<K; k++){
        int64_t res = 0;
        for(int m=1; m<=k; m++) add(res, MOD + ((k-m)%2 ? -1 : 1) * comb_mod(k, m) * power_mod(m, N) % MOD);
        for(int i=0; i<k; i++) mul(res, M-i);
        mul(res, fact_inv[k]);
        add(ans, MOD - res);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
    char sh[27]="abcdefghijklmnopqrstuvwxyz",str[100005];
    int a[27]={0},i;
    scanf("%s",str);
    for(i=0;i<strlen(str);i++)
        a[str[i]-'\0'-97]++;
    for(i=0;i<26;i++)
    if(a[i]==0){printf("%c\n",i+97);break;}
    if(i==26)printf("None\n");
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
typedef long long ll;
const int inf = (1<<29);
const int N = 300;
const int E = 1000;
struct st{
  int tar;
  vector<int> req;
};
vector<st> edge;
int cost[N];

void update(int index){
  vector<int> tmp(edge[index].req.size());
  rep(i,edge[index].req.size()){
    int next=edge[index].req[i];
    if (cost[next] == inf)return;
    tmp[i]=cost[next];
  }
  sort(tmp.begin(),tmp.end(),greater<int>());
  //rep(j,tmp.size())cout << tmp[j]<<" " ;cout << endl;
  int gs=0;
  int keep=0;
  int rem=0;//rem=gs-keep
  rep(i,tmp.size()){
    int req=tmp[i];
    //cout <<"update " <<inf <<" " <<  req <<" " << rem <<" " << gs << endl;
    if (req > rem)gs+=req-rem;
    keep++;
    rem=gs-keep;
  }
  int tar=edge[index].tar;
  //cout <<"update result " <<  tar <<" " << cost[tar] << " " << gs << endl;
  cost[tar]=min(cost[tar],gs);
}

int solve(int n,int tar){
  rep(loop,n){
    rep(i,edge.size()){
      update(i);
    }
    //rep(i,n)cout << cost[i] <<" " ;cout << endl;
  }
  return cost[tar];
}

main(){
  int n,e,t;
  while(cin>>n>>e>>t){
    t--;
    edge.clear();
    rep(i,n){
      int tmp;cin>>tmp;
      cost[i]=tmp==1?1:inf;
    }
    rep(i,e){
      st ins;
      cin>>ins.tar;
      ins.tar--;
      int size;
      cin>>size;
      rep(j,size){int tmp;cin>>tmp;ins.req.push_back(tmp-1);}
      edge.push_back(ins);
    }
    int ans = solve(n,t);
    cout << ((ans == inf)? -1 : ans) << endl;
  }
  return 0;
}

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

int main(int argc,char* argv[]){
  int N;
  cin >> N;
  string W[N];
  bool flag = true;
  cin >> W[0];
  for(int i=1;i<N;i++){
    cin >> W[i];
    if(W[i-1][W[i-1].length()-1]!=W[i][0]){
      flag = false;
    }
  }
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      if(W[i]==W[j]) flag = false;
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int compare(int a,int b,int c,int d,char s[4]) {
  return s[a] == s[b] && s[b] != s[c] && s[c] == s[d];
}
int main(void) {
  char s[4];
  int r;
  scanf("%s",s);
  r = compare(0,1,2,3,s);
  r |= compare(0,2,1,3,s);
  r |= compare(0,3,1,2,s);
  if(r) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll b[4][4];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n, k;
	cin >> n >> k;
	ll s = 0;
	for (int i = 0; i < n; i++)
	{
		ll a;
		cin >> a;
		s += min(a * 2, abs(k - a) * 2);
	}
	cout << s;
	return 0;
}


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

namespace cswork
{
    class Program
    {
        public Program() { }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        void Omame()
        {
            cin = new Scanner();
            long n = cin.nextLong();
            long k = cin.nextLong();

            Dictionary<long, long> dic = new Dictionary<long, long>();
            for (long i = 0; i < n; i++)
            {
                long a = cin.nextLong();
                long b = cin.nextLong();

                if (!dic.ContainsKey(a))
                {
                    dic.Add(a, b);
                }
                else
                {
                    dic[a] += b;
                }
            }

            long count = 0;
            for (long i = 1; i <= 100000; i++)
            {
                if (dic.ContainsKey(i))
                {
                    count += dic[i];
                    if (count >= k)
                    {
                        Console.WriteLine(i);
                        return;
                    }
                }
            }
        }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n), b;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int j = 0;
    for (int i = n - 1; i >= 0; i -= 2)
    {
        b.push_back(a[i]);
        j = i;
    }
    for (int i = 1 - j; i < n; i += 2)
    {
        b.push_back(a[i]);
    }
    for (int i = 0; i < n; i++)
    {
        cout << b[i];
        if (i == n - 1)
        {
            cout << endl;
        }
        else
        {
            cout << ' ';
        }
    }
}

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>


#define REP(i,N) for(auto i = 0; i <N; i++)
const int MAX = INT_MAX;
using namespace std;
typedef long long ll;


int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}



int main() {

    ll X = lin();
    ll Y = lin();
    
    /// x, 2x, 4x, 8x, 16x, ...... 2^n x<= Y;
    
    ll N = Y/X;
    
    ll n = (ll)log2(N);
    
    
    while (X * (1LL<<n) <= Y){
        n++;
    }
    
    cout << n << endl;
    
    return 0;
}




                          




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

const char NL = '\n';
const char SP = ' ';
#define loop(i, a, b) for (int i = a; i < b; i++)

int min3 (int &a, int &b, int &c) {
    return min (min (a, b), c);
}

int main () {
    ios_base::sync_with_stdio(false);
    int a, b, c, k, cnt = 0;
	cin >> a >> b >> c >> k;
	while ((a >= b || b >= c) && cnt < k) {
		if (a >= b) {
			b *= 2;
			cnt++;
		}
		if (b >= c) {
			c *= 2;
			cnt++;
		}
	}
    if (a < b && b < c && cnt <= k) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
    return 0;
}

Measured memory_bytes: 3652
#python2.7
N,M = raw_input().split()
time=0
flag=1
A=[]
for i in range(int(N)):
	A.append(raw_input().split())

while len(A)!=0:
	if(int(A[0][1])>int(M)):
		A[0][1]=str(int(A[0][1])-int(M))
		A.append(A[0])
		del A[0]
		time+=int(M)
	else:
		time+=int(A[0][1])
		print A[0][0]+" "+str(time)
		del A[0]

Measured memory_bytes: 19500
while True:
    try:
        n = int(input())
        if n == 0:
            break
        ans = 0
        add = 0
        arr = []
        for i in range(0,n):
            arr.append(int(input()))
        arr = sorted(arr)

        for i in range(0,n - 1):
            add += arr[i]
            ans += add
        print(ans)          
    except:
    	break


Measured memory_bytes: 5816
while True:
    n=int(input())
    if n==0:
        break
    i=0
    mat=[]
    #リストを一つに
    while i<n:
        tmp_mat=list(map(int, input().split()))
        mat.extend(tmp_mat)
        i+=1
    total=0
    tmp_last=[0 for l in range(n+1)]
    for x in range(len(mat)):
        total+=mat[x]
        tmp_last[x%n]+=mat[x]
        print(str(mat[x]).rjust(5),end="")
        if x%n==n-1:
            tmp_last[n]+=total
            print(str(total).rjust(5))
            total=0
    for y in range(n+1):
        print(str(tmp_last[y]).rjust(5),end="")
    print("")
      


Measured memory_bytes: 5624
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <set>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

    UnionFind tree(N);
    
    REP(i, M){
        int a, b;
        cin >> a >> b;
        tree.unite(a-1, b-1);
    }

    vector<int> count(N, 0);
    REP(i, N){
        int root_n = tree.root(i);
        count[root_n] += 1;
    }

    int ans = *max_element(count.begin(), count.end());
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n,ma=0,mi=INF; cin>>n;
    vector<int>a(n);
    for(int i=0; i<n; i++){
        cin>>a[i];
        ma = max(a[i],ma);
        mi = min(a[i],mi);
    }

    cout<<ma-mi<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
p = [i() for _ in range(N)]
p.sort()
p[-1] = p[-1]//2
print(sum(p))

Measured memory_bytes: 5164
#include <iostream>
using namespace std;
#define MAX 200
#define INFTY (1<<21)

int m[MAX][MAX], n, p[MAX];

void matrix()
{
    for(int i=1; i<=n; i++)
        m[i][i] = 0;
    for(int l=2; l<=n; l++)
    {
        for(int i=1; i<=n-l+1; i++)
        {
            int j=i+l-1;
            m[i][j] = INFTY;
            for(int k=i; k<=j-1; k++)
                m[i][j] = min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
        }
    }
}
int main()
{
    cin >> n;
    for(int i=1; i<=n; i++)
        cin >> p[i-1] >> p[i];
    matrix();
    cout << m[1][n] << endl;
    return 0;
}

Measured memory_bytes: 3176
#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; using namespace atcoder;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
vector<ll> enumdiv(ll n) {
	vector<ll> S;
	for (ll i = 1; i*i <= n; i++) if (n%i == 0) { S.push_back(i); if (i*i != n) S.push_back(n / i); }
	sort(S.begin(), S.end());
	return S;
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














ll N;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;

	ll ans = infl;
	auto ed = enumdiv(2 * N);
	fore(x, ed) {
		ll y = 2 * N / x;

		vector<ll> r(2), m(2);
		r[0] = 0, m[0] = x;
		r[1] = -1, m[1] = y;

		auto p = crt(r, m);
		if (p.first != 0 && p.second != 0) chmin(ans, p.first);
	}

	cout << ans << endl;
}







Measured memory_bytes: 3668