akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <cstdio>

using namespace std;

const int N = 500;
const int INF = 1000000000;

class S{
public:
  int x, y, cost;
  S(){}
  S(int x, int y, int cost) : x(x), y(y), cost(cost) {}
  bool operator < (const S& s) const {
    return cost > s.cost;
  }
};

int R, w[2], h[2], sx[2], sy[2], input[2][N][N], vis[N][N];
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
vector<int> vec[2];
set<int> used;
vector<int> data;
int cnt;

void bfs(int d){
  int x = sx[d];
  int y = sy[d];
  int cost = 1;
  priority_queue<S> q;
  S u;
  q.push(S(x, y, cost));
  vis[y][x] = cost;
  while(!q.empty()){
    u = q.top(); q.pop();
    if(vis[u.y][u.x] < u.cost) continue;
    for(int i=0;i<4;i++){
      int ny = u.y + dy[i];
      int nx = u.x + dx[i];
      if(ny < 0 || ny >= h[d]) continue;
      if(nx < 0 || nx >= w[d]) continue;
      int tmp = max(u.cost, input[d][ny][nx]);
      if(vis[ny][nx] > tmp){
        vis[ny][nx] = tmp;
        q.push(S(nx, ny, tmp));
      }
    }
  }
}

void init(){
  data.clear();
  for(int k=0;k<2;k++){
    for(int i=0;i<h[k];i++){
      for(int j=0;j<w[k];j++){
        data.push_back(input[k][i][j]);
      }
    }
  }
  sort(data.begin(), data.end());
  for(int k=0;k<2;k++){
    fill(vis[0], vis[N], INF);
    for(int i=0;i<h[k];i++){
      for(int j=0;j<w[k];j++){
        vis[i][j] = INF;
      }
    }
    bfs(k);

    vec[k].clear();
    for(int i=0;i<h[k];i++){
      for(int j=0;j<w[k];j++){
        vec[k].push_back(vis[i][j]);
      }
    }
    sort(vec[k].begin(), vec[k].end());
  }
}

bool check(int a, int b){
  int t1 = distance(vec[0].begin(), upper_bound(vec[0].begin(), vec[0].end(), a));
  int t2 = distance(vec[1].begin(), upper_bound(vec[1].begin(), vec[1].end(), b));
  return t1 + t2 >= R;
}

int solve(){
  int l = 0, r = data[data.size()-1] + 1;
  while(l<r){
    int m = (l + r) / 2;
    bool f = false;
    for(int i=0;i<data.size();i++){
      if(data[i] > m) break;
      if(check(data[i], m-data[i])) f = true;
    }
    if(f) r = m;
    else l = m + 1;
  }
  return l;
}

main(){
  while(scanf("%d", &R) && R){
    for(int k=0;k<2;k++){
      scanf("%d %d %d %d", w+k, h+k, sx+k, sy+k);
      sx[k]--; sy[k]--;
      for(int i=0;i<h[k];i++){
        for(int j=0;j<w[k];j++){
          scanf("%d", &input[k][i][j]);
        }
      }
    }
    init();
    printf("%d\n", solve());
  }
}

Measured memory_bytes: 9240
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define inf 1000000000000000000
#define pii pair<int, pair<int, int>>
const double pi = acos(-1);
const int sz = 200002;
ll n, m, q, k;

int main() {
	io
	int t = 1;
	// cin>>t;
	while(t--) {
		cin>>n;
		vector<int>a(n);
		int ans = 0;
		for(int i = 0; i < n; i++) {
			cin>>a[i];
			int x = i+1;
			if((x&1) && (a[i]&1)) ans++;
		}
		cout<<ans;
	}
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a>b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;


int main() {
  char a;
  cin>>a;
  cout<<(char)(a+1)<<endl;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

int main(){
  ll n; cin>>n;
  vector<char> arr;
  while(--n>=0){
    char c = 'a'+n%26;
    n/=26;
    arr.push_back(c);
  }
  string s(arr.rbegin(),arr.rend());
  cout<<s<<endl;
}

Measured memory_bytes: 3580
a = int(input())
x = list(map(int, input().split()))
dp = [0]+[10**10]*(a-1)
dp[1] = abs(x[1]-x[0])
for i,h in enumerate(x):
    if i>1:
        dp[i] = min(dp[i-1]+abs(h-x[i-1]),dp[i-2]+abs(h-x[i-2]))
print(dp[a-1])

Measured memory_bytes: 13924
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		sc.close();

		long[][] dp = new long[s.length + 1][13];
		dp[0][0] = 1;
		for (int i = 1; i < dp.length; i++) {
			if (s[i - 1] == '?') {
				for (int j = 0; j < 10; j++) {
					for (int j2 = 0; j2 < 13; j2++) {
						dp[i][(j2 * 10 + j) % 13] += dp[i - 1][j2];
					}
				}
			} else {
				int j = s[i - 1] - '0';
				for (int j2 = 0; j2 < 13; j2++) {
					dp[i][(j2 * 10 + j) % 13] += dp[i - 1][j2];
				}
			}
			for (int j2 = 0; j2 < 13; j2++) {
				dp[i][j2] %= 1000000007;
			}
		}
		System.out.println(dp[s.length][5]);
	}
}


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

int main()
{
    string s; cin>>s;
    int x, y; cin>>x>>y;
    vector<int> a;
    for(int i=0; i<s.size(); ) {
        int c=0;
        for(; i<s.size() && s[i]=='F'; ++i) ++c;
        a.push_back(c);
        if (!c) ++i;
    }
    if (a[0]>0) { x-=a[0]; a.erase(a.begin()); }

    vector<int> tx, ty;
    for(int i=0, c=1; i<a.size(); ++i) {
        if (!a[i]) c=!c;
        (c ? tx : ty).push_back(a[i]);
    }

    auto f=[](auto& t, int g) {
        set<int> s={0};
        for(auto& d: t) if (d) {
            set<int> n;
            for(auto& k: s) n.insert({k-d, k+d});
            s=n;
        }
        return s.count(g);
    };

    cout<<(f(tx, x) && f(ty, y) ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
 long int n,i,ans;
  cin >> n;
  ans=0;
  
  for(i=1;i<n;++i)
  {
  if(n%i==0) ans=ans+n/i-1;
  else ans=ans+n/i;
  }
  cout << ans;
return 0;}

Measured memory_bytes: 3632
package main

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

// input に使うやつ
var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

// string から int へ
func atoi(s string) int {
	i, _ := strconv.Atoi(s)
	return i
}

// 一つの文字を int として読み込み
func readInt() int {
	return atoi(readLine())
}

// 複数の文字を int のスライスとして読み込み
func readInts() []int {
	in := readLine()
	ins := strings.Split(in, " ")
	out := make([]int, len(ins))
	for i, v := range ins {
		out[i] = atoi(v)
	}
	return out
}

// sortしたスライスを返す
func sorted(a []int) []int {
	sort.Ints(a)
	b := a
	return b
}

// 逆順のsort
func reverse(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	b := a
	return b
}

func main() {
	s := strings.Split(readLine(), "")
	n := 13
	dp := make([]int, n)
	dp[0] = 1

	mod := 1000000007
	mul := 1
	for i := len(s) - 1; i >= 0; i-- {
		nextDP := make([]int, n)

		if s[i] == "?" {
			for k := 0; k < 10; k++ {
				for j := 0; j < n; j++ {
					nextDP[(k*mul+j)%n] += dp[j]
					nextDP[(k*mul+j)%n] %= mod
				}
			}
		} else {
			k, _ := strconv.Atoi(s[i])
			for j := 0; j < n; j++ {
				nextDP[(k*mul+j)%n] += dp[j]
				nextDP[(k*mul+j)%n] %= mod
			}
		}

		mul *= 10
		mul %= n
		dp = nextDP
	}
	fmt.Println(dp[5])
}


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

#define ALL(a) begin(a), end(a)
#define SZ(a) ((int)a.size())

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const vector<string> A = {"dreamer", "eraser", "dream", "erase"};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  vector<bool> ok(SZ(s) + 1);
  ok[0] = true;
  for (int i = 0; i < SZ(s); i++) {
    if (ok[i]) {
      for (const auto &add : A) {
        if (i + SZ(add) <= SZ(s) && s.substr(i, SZ(add)) == add) {
          ok[i + SZ(add)] = true;
        }
      }
    }
  }
  cout << (ok[SZ(s)] ? "YES" : "NO") << endl;
  return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int p,a=0;cin>>p;
  for(int i=0;i<=p;i+=1){
    if(i*1.08>=p && i*1.08<p+1){cout<<i<<endl;a=0;break;}
    else a++;
  }
  if(a>0)cout<<":("<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  string C;
  cin>>C;
  int A=0,B=0;
  REP(i,N)if(C[i]=='R')A++;
  REP(i,A)if(C[i]=='R')B++;
  cout<<A-B<<endl;
  return 0;
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
int mod= 1e9 +7;
int main()
{
  int n;
  cin>>n;
  set<string> vaibhav;
  for(int i=0; i<n; i++)
  {
  	string s;
  	cin>>s;
  	vaibhav.insert(s);
  }
  cout<<vaibhav.size();
}

Measured memory_bytes: 19228
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int r=0;
    int b=0;
    for(int i=0;s[i]!=0;i++)
    {
        if(s[i]=='R')
            r++;
        else
            b++;
    }
    if(r>b)
        cout<<"Yes"<<'\n';
    else
        cout<<"No"<<'\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
const int N = 1e6 + 10, OO = 0x3f3f3f3f, mod = 1e9 + 7;

#define PI acos(-1)
#define clr(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, n) for (int i = 0; i < int(n); i++)
#define rloop(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define xloop(i, a, b) for (int i = int(a); i <= int(b); i++)
#define ALL(v) ((v).begin()), ((v).end())
#define SZ(v) ((int)((v).size()))
int dx[] = {1, 0, -1, 0}; // {down , right , up , left}
int dy[] = {0, 1, 0, -1}; //4 Direction
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; //8 direction
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2};
//int dy[] = {1, 2, 2, 1, -1, -2, -2, -1}; //Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

//-- "كلٌّ من يسعى لابد يصل .. كلٌّ من يسعى مضمون له الوصول" --//

int k;
vector<ll> cur;
set<ll> nums;

void solve(int len, ll rkm)
{
  nums.insert(rkm);
  if(SZ(nums) > k)
    nums.erase(*nums.rbegin());
  if(len == 10)
    return;
  for (int i = -1; i <= 1; ++i){
    ll value = cur.back() + i;
    if(value >= 0 && value < 10){
      cur.push_back(value);
      solve(len + 1, (rkm * 10 + value));
      cur.pop_back();
    }
  }
}

int main()
{
  //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

  scanf("%d", &k);
  for(int i = 1 ; i < 10 ; ++i){
    cur.push_back(i);
    solve(0, i);
    cur.pop_back();
  }
  printf("%lld\n", *nums.rbegin());

  return 0;
}


Measured memory_bytes: 8408
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function lower_bound(d,a,b,e){for(var c;1<b-a;)d[c=0|(a+b)/2]<e?a=c:b=c;return d[a]<e?b:a};

console.log(main());
function main(){
  var n = o.a();
  var a = o.l();
  var b = o.l();
  var ans = 0;
  b.sort((a,b)=>a-b);
  for(var i = 28; i >= 0; i--){
    var t = 1 << i, t2 = t*2, t3 = t*3, c = t-1, x = a.length*a.length;
    for(var j = 0; j < a.length; j++){
      var x2 = lower_bound(b,0,b.length,t2-a[j]);
      var x1 = lower_bound(b,0,x2,t-a[j]);
      var x3 = lower_bound(b,x2,b.length,t3-a[j]);
      x += -x3+x2-x1;
    }
    if(x % 2)ans += t;
    b = b.map(a=>a&c);
    a = a.map(a=>a&c);
    if(i<18)a = f(a,i), b = f(b,i);
    else b.sort((a,b)=>a-b);
  }
  return ans;

  function f(b,n){
    var a = Array(1<<n).fill(0), r = [];
    for(var i = 0; i < b.length; i++){
      a[b[i]]++;
    }
    for(i = 0; i < a.length; i++)if(a[i]&1)r.push(i);
    return r;
  }
}

Measured memory_bytes: 107028
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<complex>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define N 100010
int n,h,w;
ll x[N],y[N];
ll vx[N],vy[N];
int main(){
    cin>>h>>w>>n;
    lol(i,n){
	cin>>x[i]>>y[i];
	vx[i]=x[i];
	vy[i]=y[i];
    }
    sort(vx,vx+n);
    sort(vy,vy+n);
    
    if(n%2==1){
	ll xsum=0,ysum=0;
	lol(i,n){
	    xsum+=2*abs(x[i]-vx[n/2]);
	    ysum+=2*abs(y[i]-vy[n/2]);
	}
	ll ans=(ll)mod*(ll)mod;
	lol(i,n){
	    ll gre=xsum-abs(x[i]-vx[n/2])+ysum-abs(y[i]-vy[n/2]);
	    ans=min(ans,gre);
	}
	cout<<ans<<endl;
	cout<<vx[n/2]<<" "<<vy[n/2]<<endl;
	return 0;
    }
    
    ll xsuma=0,ysuma=0,xsumb=0,ysumb=0;
    lol(i,n){
	xsuma+=2*abs(x[i]-vx[n/2-1]);
	ysuma+=2*abs(y[i]-vy[n/2-1]);
	xsumb+=2*abs(x[i]-vx[n/2]);
	ysumb+=2*abs(y[i]-vy[n/2]);
    }
    ll ans=(ll)mod*(ll)mod;
    ll tx,ty;
    lol(i,n){
	ll gx,gy,gre=0;
	if(x[i]>=vx[n/2]){
	    gx=vx[n/2-1],gre+=xsuma-abs(x[i]-vx[n/2-1]);
	}
	else{
	    gx=vx[n/2],gre+=xsumb-abs(x[i]-vx[n/2]);
	}
	
	if(y[i]>=vy[n/2]){
	    gy=vy[n/2-1],gre+=ysuma-abs(y[i]-vy[n/2-1]);
	}
	else{
	    gy=vy[n/2],gre+=ysumb-abs(y[i]-vy[n/2]);
	}
	
	if(ans>gre||(ans==gre&&(tx>gx||(tx==gx&&ty>gy)))){
	    ans=gre;
	    tx=gx,ty=gy;
	}
	//cout<<gre<<" "<<tx<<" "<<ty<<endl;
    }
    cout<<ans<<endl;
    cout<<tx<<" "<<ty<<endl;
    return 0;
}



Measured memory_bytes: 6272
#include <bits/stdc++.h> 
using namespace std;
typedef long long int ll;
ll dp[100005][3];
int main()
{
    memset(dp,-1,sizeof(dp));
    ll n;
    cin>>n;
    ll mat[n+1][3];
    for(ll i=1;i<=n;i++)
        cin>>mat[i][0]>>mat[i][1]>>mat[i][2];

    dp[1][0]  = mat[1][0];
    dp[1][1]  = mat[1][1];
    dp[1][2]  = mat[1][2];
    for(int i=2;i<=n;i++)
    {
        dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + mat[i][0];
        dp[i][1] = max(dp[i-1][2],dp[i-1][0]) + mat[i][1];
        dp[i][2] = max(dp[i-1][1],dp[i-1][0]) + mat[i][2];
    }
    
    ll res;
    res = max(dp[n][0],dp[n][1]);
    res = max(dp[n][2],res);
    cout<<res<<endl;
}

Measured memory_bytes: 4992
from math import gcd
from functools import reduce
from sys import exit

# O(NlogA+AloglogA)解
MAX_A = 1000000
lowerst_prime = [10**9] * (MAX_A + 1) # 最小の素因数をいれる(2以上をみていけばいい)
count = [0] * (MAX_A + 1) # 約数として出てくる回数を数える

for i in range(2, MAX_A + 1): # エラトステネスの篩
    if lowerst_prime[i] != 10**9:
        continue
    lowerst_prime[i] = i
    for j in range(i * i, MAX_A + 1, i): # i * iスタートでいいのは、i * bはbの約数でもあるため
        if lowerst_prime[j] == 10**9:
            lowerst_prime[j] = i
# 入力
N = int(input())
A = [*map(int, input().split())]

if reduce(gcd, A) != 1:
    print("not coprime")
    exit(0)

for i in range(N):
    while A[i] > 1:
        divide = lowerst_prime[A[i]]
        count[divide] += 1
        while A[i] % divide == 0: # 割れるだけ割る
            A[i] //= divide

for i in range(MAX_A + 1):
    if count[i] >= 2:
        print("setwise coprime")
        exit(0)
print("pairwise coprime")

Measured memory_bytes: 185868
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
a = []
s = S[0]
for i in range(1,N):
  s += S[i]
  s = ''.join([key*(min(val//2,s.count(key)-S[i].count(key))) for key,val in Counter(s).items() if val > 1])
s = sorted(s)
print(''.join(s))

Measured memory_bytes: 3316
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();     
        int N = r.i();
        int[] A = r.ii();
        double ans = 0;
        for(int a : A)
            ans += 1./a;
        println(1/ans);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

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

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP

void	Main()
{
	ll	x, y;
	cin >> x >> y;
	int	cnt;
	cnt = 0;
	while (x <= y)
	{
		cnt++;
		x *= 2;
	}
	cout << cnt << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
for(var i=0;i<Arr.length;i++){
   var abn=Arr[i].split(" ").map(Number);
   var a=abn[0];
   var b=abn[1];
   var n=abn[2];
   var arr=(a/b+"").split(".");
   var str=(arr.length==2)?arr[1]:"";
   var sum=0;
   for(var j=0;j<str.length;j++){
      if(j==n)break;
      sum+=(str[j]-0);
   }
   console.log(sum);
}

Measured memory_bytes: 7908
N = int(input())
hs = list(map(int, input().split()))
ans = 0
while max(hs) != 0:
    i = 0
    while i < N:
        if hs[i] == 0:
            i += 1
        else:
            ans += 1
            while i < N and hs[i] > 0:
                hs[i] -= 1
                i += 1

print(ans)


Measured memory_bytes: 39152
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <limits>
#include <random>
#include <utility>
#include <vector>

namespace procon {
  class UnionFind {
  private:
    struct nodeinfo {
      int par;
      int rank;
      nodeinfo(int par) : par(par), rank(0) {}
    };
    std::vector<nodeinfo> node;

  public:
    UnionFind(int n) : node() {
      node.reserve(n);
      for (int i = 0; i < n; ++i) {
	node.push_back(nodeinfo(i));
      }
    }
    int root(int x) {
      if (node[x].par == x) {
	return x;
      }
      return node[x].par = root(node[x].par);
    }
    void unite(int x, int y) {
      x = root(x);
      y = root(y);
      if (x == y) {
	return;
      }
      if (node[x].rank < node[y].rank) {
	node[x].par = y;
      } else {
	node[y].par = x;
	if (node[x].rank == node[y].rank) {
	  ++node[x].rank;
	}
      }
    }
    bool is_same_set(int x, int y) { return root(x) == root(y); }
  };
}

int main(void) {
  int log_size;
  int n_query;
  int seed;
  std::cin >> log_size >> n_query >> seed;

  assert(0 <= log_size && log_size <= 30);
  assert(0 <= n_query);

  const int size = 1 << log_size;
  const int mask = size - 1;
  uint64_t res = 123456789;

  std::mt19937 mt(seed);
  procon::UnionFind uf(size);
  while (n_query--) {
    const int com = mt() & 1;
    const int x = mt() & mask;
    const int y = mt() & mask;
    if (com) {
      res = res * 17 + (uf.is_same_set(x, y) ? 1 : 0);
    } else {
      uf.unite(x, y);
    }
  }
  std::cout << res << std::endl;
  return 0;
}



Measured memory_bytes: 35480
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
  int n, k, r, s, p; string t; cin >>n>>k>>r>>s>>p>>t;
  int sm = 0;
  for(int i=0;i<n;i++) {
    switch(t[i]) {
      case 'r': if (i<k || t[i-k]!='r') sm+=p; else t[i]='0'; break;
      case 's': if (i<k || t[i-k]!='s') sm+=r; else t[i]='0'; break;
      case 'p': if (i<k || t[i-k]!='p') sm+=s; else t[i]='0'; break;
    }
  }
  cout << sm << endl;
  //cout << t << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long 
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;
typedef pair<P, P> PP;
 
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
 
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int p[200000];
double hoge[200001];

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

    int K, N;
    cin >> N >> K;
    for(int i = 0; i < N; ++i) {
        cin >> p[i];
        hoge[i + 1] = (double)(1. + p[i]) / 2.;
    }
    for(int i = 2; i <= N; ++i) {
        hoge[i] += hoge[i - 1];
    }
    double ans = 0;
    for(int i = K; i <= N; ++i) {
        chmax(ans, hoge[i] - hoge[i - K]);
    }
    printf("%.10f\n", ans);
    return 0;
}


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

int main(){

    ll i, o, t, j, l, s, z;
    cin >> i >> o >> t >> j >> l >> s >> z;
    z = 0;
    if (i && j && l)z = (i - 1) / 2 * 2 + o + (j - 1) / 2 * 2 + (l - 1) / 2 * 2 + 3;
    cout << max(i / 2 * 2 + o + j / 2 * 2 + l / 2 * 2, z) << endl;

 }

Measured memory_bytes: 256
n=int(input())
a_list=list(map(int,input().split()))

ans=a_list[0]
if 0 in a_list:
    ans=0
else:
    for i in range(1,n):
        ans*=a_list[i]
        if ans>10**18:
            ans=-1
            break
        
print(ans)
        
    
    

Measured memory_bytes: 84708
#include<stdio.h>
int main(){
  int n,m,q,i,j;
  scanf("%d%d%d",&n,&m,&q);
  int l,r,mass[n+1][n+1];
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      mass[i][j]=0;
  for(i=0;i<m;i++){
    scanf("%d%d",&l,&r);
    for(j=r;j<=n;j++)
      mass[l][j]++;
  }
  int count[q+1];
  for(i=0;i<q;i++){
    count[i]=0;
    scanf("%d%d",&l,&r);
    for(j=l;j<=r;j++)
      count[i]+=mass[j][r];
  }
  for(i=0;i<q;i++)
    printf("%d\n",count[i]);
  return 0;
}


Measured memory_bytes: 2176
#include<map>
#include<string>
#include<sstream>
#include<iostream>

using namespace std;

int main(){
	map<string,int>	prefix;
	prefix["yotta"]=24;	prefix["zetta"]=21;	prefix["exa"]=18;	prefix["peta"]=15;
	prefix["tera"]=12;	prefix["giga"]=9;	prefix["mega"]=6;	prefix["kilo"]=3;
	prefix["hecto"]=2;	prefix["deca"]=1;	prefix["deci"]=-1;	prefix["centi"]=-2;
	prefix["milli"]=-3;	prefix["micro"]=-6;	prefix["nano"]=-9;	prefix["pico"]=-12;
	prefix["femto"]=-15;prefix["ato"]=-18;	prefix["zepto"]=-21;prefix["yocto"]=-24;

	int t;	cin>>t;
	string dammy;	getline(cin,dammy);
	while(t--){
		string s;	getline(cin,s);
		string val,pre,uni;
		{
			int spcnt=0;
			for(int i=0;i<s.length();i++)	if(s[i]==' ')	spcnt++;
			stringstream ss(s);
			ss>>val;
			if(spcnt==2)	ss>>pre;
			ss>>uni;
		}

		int len=val.length();
		int ptpos=len,start=len-1;
		for(int i=0;i<len;i++){
			if(val[i]=='.')	ptpos=i;
			if(val[i]!='0' && val[i]!='.')	start=min(start,i);
		}

		int order=prefix[pre];
		if(start<ptpos || ptpos==len)	order+=ptpos-start-1;
		else							order+=ptpos-start;

		string xval;
		if(ptpos<start)	xval=val.substr(start);
		else	xval=val.substr(start,ptpos)+(ptpos<len?val.substr(ptpos+1):"");

		cout<<xval[0];
		if(xval.length()>1)	cout<<'.'<<xval.substr(1);
		cout<<" * 10^"<<order<<' '<<uni<<endl;
	}

	return 0;
}

Measured memory_bytes: 876
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int32_t goal;
  std::cin >> goal;
  int32_t lower, upper;
  std::cin >> lower >> upper;
  bool is_ok = false;
  for (int32_t i = lower; i <= upper; ++i) {
    if ((i % goal) == 0) {
      is_ok = true;
      break;
    }
  }
  if (is_ok) {
    std::cout << "OK" << std::endl;
  } else {
    std::cout << "NG" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3648
#pragma GCC optimize ("O3")
// #pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}


void MAIN() {
    int X;
    scanf("%d", &X);
    int ans = 10 - X / 200;

    printf("%d\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 3820
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
using ll = long long;
int main()
{
  ll X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  //  const [X, Y, A, B, C] = ints(5);
  vector<ll> p(A), q(B), r(C);
  for (auto &item : p)
    cin >> item;
  for (auto &item : q)
    cin >> item;
  for (auto &item : r)
    cin >> item;
  // const [p, q, r] = [ints(A), ints(B), ints(C)];
  sort(p.begin(), p.end());
  sort(q.begin(), q.end());
  sort(r.begin(), r.end());
  // p.sort();
  // q.sort();
  // r.sort();
  vector<ll> candidate;
  for (int i = 0; i < X; i++)
    candidate.push_back(p[p.size() - 1 - i]);
  for (int i = 0; i < Y; i++)
    candidate.push_back(q[q.size() - 1 - i]);
  for (auto item : r)
    candidate.push_back(item);
  // const candidate = [...p.slice(-X), ...q.slice(-Y), ...r];
  sort(candidate.begin(), candidate.end());
  ll ans = 0;
  for (int i = 0;i<X+Y;i++){
    ans += candidate[candidate.size() - 1 - i];
  }
  cout << ans << endl;
  // const ans=candidate.sort().slice(-X-Y);
  // console.log(ans.reduce((a,b)=>a+b,0));
}

Measured memory_bytes: 8816
S = input()
T = input()
len_s = len(S)
len_t = len(T)
candidates = []
for i in range(len_s - len_t + 1):
    insertable = True
    for j in range(len_t):
        if S[i+j] != "?" and T[j] != S[i+j]:
            insertable = False
    if insertable:
        u = ""
        for k in range(len_s):
            if k >=i and k <= i + len_t - 1:
                u+=T[k-i]
            else:
                if S[k] == "?":
                    u+="a"
                else:
                    u+=S[k]
        candidates.append(u)   
if not candidates:
    print("UNRESTORABLE")
else:
    candidates.sort()
    print(candidates[0])

Measured memory_bytes: 3064
N=int(input())
def div(n):
    low,high= [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            low.append(i)
            if i != n // i:
                high.append(n//i)
        i += 1
    return low+high[::-1]
S=div(N)
ans=0
S=S[1:]
for i in S:
   if i==0:
      continue
   if N%(i-1)==N//(i-1):
      ans+=i-1
print(ans)

Measured memory_bytes: 9092
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-06-25 17:21:17 +0900
# LastModified: 2020-06-25 17:28:09 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    n = int(input())
    d = list(map(int, input().split()))
    d.sort()
#    print(d)
    if len(d)%2 == 1:
        print(0)
        return
    l = d[len(d)//2-1]
    r = d[len(d)//2]
    if l == r:
        print(0)
        return
    print(r-l)



if __name__ == "__main__":
    main()


Measured memory_bytes: 20724
#include<stdio.h>
#include<math.h>
int main()
{
    int N,i,temp,result,count,res;
    int arr[7]={0,9,9,909,909,90909,90909};
    while(scanf("%d",&N)!=EOF)
    {
        count=0;
        temp=N;
        while(temp!=0)
        {
            temp=temp/10;
            count++;
        }

        if(count%2==0)
        {
            printf("%d\n",arr[count]);
        }

        else
        {
            printf("%d\n",( arr[count] - ( (int)(pow(10,count)-1) - N ) )    );
        }

    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
bool cnt[30];
string s;
int main (){
	cin>>s;
	int i,j;
	for(i=0;i<s.size();i++)
	cnt[s[i]-'a']=1;
	i=0;
	while(cnt[i])i++;
	if(i==26){
		cout<<"None";
	}
	else{
		cout<<char(i+'a');
	}
	return 0;
} 

Measured memory_bytes: 512
#ABC172-C
from bisect import bisect_left,bisect_right
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

C=[A[0]]
for i in range(1,N):
    C.append(C[-1]+A[i])
D=[B[0]]
for i in range(1,M):
    D.append(D[-1]+B[i])
C=[0]+C
D=[0]+D
ans=0

#print(C)
#print(D)
ans=0

for i in range(N+1):
    if C[i]<=K:
        k=i
        tmp = K-C[i]
        t= bisect_right(D,tmp)
        #print(i,tmp,t)
        if t>0:
            k +=t-1
        ans=max(ans,k)
print(ans)

Measured memory_bytes: 130324
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;


import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final String s = sc.next();
			
			System.out.println(s.substring(0, 3));
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


Measured memory_bytes: 32784
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define all(v) (v).begin(),v.end()
#define fi first
#define se second
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
map<char,int> mp;
int main(){
int n;
cin>>n;
vector<int> a(n+1),b(n+1,0);
for(int i=1;i<n+1;i++)cin>>a[i];
int ans=0;
for(int i=n;i>=1;i--){
    int cnt=0;
    for(int j=1;i*j<=n;j++)if(b[i*j])cnt^=1;
    if(cnt!=a[i]){b[i]^=1;ans++;}
}
cout<<ans<<endl;
for(int i=1;i<=n;i++)if(b[i])cout<<i<<" ";
cout<<endl;
}


Measured memory_bytes: 2560
import scala.io.StdIn.{readInt, readLine}

object Main extends App {

  val n = readInt()
  val arr = readLine().split(" ").map(_.toInt)

  var swapCount = 0
  for (i <- 0 to n - 1; j <- n - 1 to i + 1 by -1) {
    if (arr(j) < arr(j - 1)) {
      swap(arr, j, j - 1)
      swapCount += 1
    }
  }
  println(arr.mkString(" "))
  println(swapCount)

  def swap(arr: Array[Int], i: Int, j: Int) = {
    arr(i) = arr(i) ^ arr(j)
    arr(j) = arr(i) ^ arr(j)
    arr(i) = arr(i) ^ arr(j)
  }

}




Measured memory_bytes: 44044
s=input()
k=int(input())
l=len(s)
s_list=[s[i] for i in range(l)]
ser_list=[]
ser_list.append(int(1))
for i in range(l-1):
    if s_list[i]==s_list[i+1]:
        ser_list[-1]=ser_list[-1]+1
    else:
        ser_list.append(1)
if s_list[0]!=s_list[l-1]:
    divide = [x//2 for x in ser_list]
    print(sum(divide)*k)
elif s_list.count(s_list[0])==len(s_list):
    print(l*k//2)
else:
    b=sum([x//2 for x in ser_list])
    ser_list[0]=ser_list[0]+ser_list[-1]
    ser_list.pop()
    a= sum([x//2 for x in ser_list])
    print(a*(k-1)+b)
    


Measured memory_bytes: 3064
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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

	int N = 0;
	char ct;
	while ((ct = getchar_unlocked()) >= '0') N = N * 10 + ct - '0';

	ll mod = 998244353;
	ll kotae = 1;
	rep1(i, N) kotae = kotae * i % mod;

	int flag = 0;
	int a = 0, b = 0;
	char ca, cb;
	rep(i, 3 * N) {

		char C = getchar_unlocked();

		switch (flag) {
		case 0:
			flag = 1;
			ca = C;
			a++;
			break;
		case 1:
			if (C == ca) a++;
			else {
				cb = C;
				kotae = kotae * a % mod;
				a--;
				b++;
				if (a) flag = 2;
				else flag = 3;
			}
			break;
		case 2:
			if (C == ca) a++;
			else if (C == cb) {
				kotae = kotae * a % mod;
				a--;
				b++;
				if (a == 0) flag = 3;
			}
			else {
				kotae = kotae * b % mod;
				b--;
				if (b == 0) flag = 1;
			}
			break;
		case 3:
			if (C == ca) {
				a++;
				flag = 2;
			}
			else if (C == cb) {
				a++;
				cb = ca;
				ca = C;
				flag = 2;
			}
			else {
				kotae = kotae * b % mod;
				b--;
				if (b == 0) flag = 0;
			}
			break;
		}

	}

	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n,m;
  cin >> n >> m;
  vector<ll> v[2];
  rep(i,n) {
    int x;
    R x;
    if(x<0) v[0].pb(-x);
    else v[1].pb(x);
  }
  rep(i,2) sort(all(v[i]));
  ll ans=MAXL;
  rep(i,v[0].size()) {
    if(m-i-2<v[1].size()) ans=min(ans,v[0][i]*2+v[1][m-i-2]);
    if(i+1==m) ans=min(ans,v[0][i]);
  }
  rep(i,v[1].size()) {
    if(m-i-2<v[0].size()) ans=min(ans,v[1][i]*2+v[0][m-i-2]);
    if(i+1==m) ans=min(ans,v[1][i]);
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 1656
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<cmath>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;

int main(){
    string S;
    cin >> S;
    
    int ans = 1;
    for(int i = 0;i < S.size();i += 2){
        if(S[i] != 'R' && S[i] != 'U' && S[i] != 'D') ans *= 0;
    }
    for(int i = 1;i < S.size();i += 2){
        if(S[i] != 'L' && S[i] != 'U' && S[i] != 'D') ans *= 0;
    }

    if(ans == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

const int N_MAX=100;
const int L_MAX=100;
int N, L;
vector <string> S(N_MAX);


int main() {
    cin >> N >> L;
    for (int i=0; i<N; i++) {
        cin >> S.at(i);
    }
    sort(S.begin(), S.end());
    string ans="";
    for (string s : S) {
        ans += s;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
gets
b = gets.chomp.split("")

a = b.map { |x| x == 'W' ? -1 : 1}
s = Array.new(a.length)
sum = 0
a.length.times do |i|
  sum += a[i]
  s[i] = sum
end
max_i = s.index(s.max)
l = max_i == 0 ? 0 : a[0..max_i-1].count(-1)
r = max_i == a.length ? 0: a[max_i+1..-1].count(1)
 
puts l+r

Measured memory_bytes: 32132
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

class DisjointSet{
    public:
    vector<ll> rank,p,sz;
    DisjointSet(){}
    DisjointSet(ll size){ //作られうる木の頂点数の最大値を入れる。
        rank.resize(size,0);
        p.resize(size,0);
        sz.resize(size,0);
        rep(i,size) makeSet(i);
    }
    void makeSet(ll x){ //xだけが属する木を作る。
        p[x]=x;
        rank[x]=0;
    }
    bool same(ll x,ll y){ //xとyが同じ木に属するかどうか
        return findSet(x)==findSet(y);
    }
    void unite(ll x, ll y){
        link(findSet(x),findSet(y));
    }
    void link(ll x, ll y){ //rankが大きい方の根に小さい方の根をつける。
        if(rank[x]>rank[y]){
            p[y]=x;
        }
        else{
            p[x]=y;
            if(rank[x]==rank[y]){
                rank[y]++; //xとyの木のrankが同じであれば、統合するとrankが1増える。
            }
        }
        sz[x]+=sz[y];
        sz[y]=sz[x];
    }
    ll findSet(ll x){ //xが属する木の根の番号を返す
        if(x!=p[x]){
            p[x]=findSet(p[x]);
        }
        return p[x];
    }
};


int main()
{
    ll n,m;
    cin >> n >> m;
    DisjointSet ds=DisjointSet(n+1);
    vector<ll> x(m),y(m),z(m);
    rep(i,m){
        cin >> x[i] >> y[i] >> z[i];
        x[i]--;
        y[i]--;
        ds.unite(x[i],y[i]);
    }
    set<ll> ans;
    rep(i,n){
        ans.insert(ds.findSet(i));
    }
    cout << ans.size() << endl;
    return 0;
} 

Measured memory_bytes: 9600
import sys
from collections import Counter

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))
Q = int(input())
d = dict(Counter(A))
res = sum(A)

for i in range(Q):
    b, c = map(int, input().split())
    if b in d:
        res = res - b * d[b] + c * d[b]
        if c in d:
            d[c] += d[b]
        else:
            d[c] = d[b]
        d[b] = 0
    print(res)


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

//全点間の距離を求めたあとに、燃料補給なしで渡れる点を結んだ新しいマップを作る。
//全点間の距離をもとめる -> ダイクストラまたはワーシャルフロイド　

//始点固定でstart -> goal の最短距離 :: ダイクストラが便利
//全点間の最短距離 start -> goalの最短距離 :: WFが便利(O(N^3)が間に合うなら)

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

#define MAX 1000100100LL
using ll = long long;
using Graph = vector<vector<ll>>;
class WF {
public:
  Graph g;
  ll num_of_nodes;

  WF(ll n) {
    num_of_nodes = n;
    g = vector<vector<ll>>(n, vector<ll>(n, MAX));
    for (ll i = 0; i < n; i++) { g[i][i] = 0; }
  }

  Graph get_graph() {
    return g;
  }

  void graph_init(ll e) {
    //e: number of edges
    for (ll i = 0; i < e; i++) {
      ll a, b, c;
      cin >> a >> b >> c;
      a--; b--; //入力が1オリジンのとき

      g[a][b] = g[b][a] = c;
    }

  }

  //ワーシャルフロイド法で各頂点i->jの最短距離をモトメル
  void get_shortest() {
    for (ll k = 0; k < num_of_nodes; k++) {
      for (ll i = 0; i < num_of_nodes; i++) {
        if (g[i][k] == MAX) continue;
        for (ll j = 0; j < num_of_nodes; j++) {
          if (g[k][j] == MAX) continue;
          g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
        }
      }
    }
  }
};


int main() {
  int N, M, L;
  cin >> N >> M >> L;
  WF wf = WF(N);
  wf.graph_init(M);
  wf.get_shortest(); //全点間の最小距離が求められた

  vector<vector<ll>> new_graph(N, vector<ll>(N, MAX));
  for (ll i = 0; i < N; i++) new_graph[i][i] = 0;

  for (ll i = 0; i < N; i++) {
    for (ll j = i+1; j < N; j++) {
      if (wf.g[i][j] <= L) {
        new_graph[i][j] = new_graph[j][i] = 1;
      }
    }
  }

  WF wf2 = WF(N);
  wf2.g = new_graph;

  wf2.get_shortest();


  vector<vector<ll>> ans_graph = wf2.get_graph();

  ll Q;
  cin >> Q;
  for (ll i = 0; i < Q; i++) {
    ll s, t;
    cin >> s >> t;
    s--; t--;
    if (ans_graph[s][t] == MAX) cout << -1 << endl;
    else cout << ans_graph[s][t] - 1 << endl;
  }
  return 0;

}


Measured memory_bytes: 3328
#include<iostream>

int main(){
  int n,a[200000],min,max;
  
  std::cin>>n;
  
  for(int i=0;i<n;i++){
    std::cin>>a[i];
  }
  
  min=a[0];
  max=a[1]-a[0];

  for(int i=1;i<n-1;i++){
    if(min>a[i]){
      min=a[i];
    }
    if((a[i+1]-min)>max){
      max=a[i+1]-min;
    }
  }

  std::cout<<max<<'\n';
  
  return 0;
}


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

int main(){
  ll n,a,b,ab,syou,amari;
  cin >> n >> a >> b;
  ab = a+b;
  syou = n/ab;
  amari = n%ab;
  cout << a*syou+min(a,amari) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)

typedef long long ll;
ll MOD = 1000000007;

int main()
{
    int n, m;
    cin >> n >> m;
 
    vector <int> a(n), b(n);
    rep(i, 0, n) cin >> a[i] >> b[i];
 
    vector <vector <int> > c(100001);
    rep(i, 0, n) c[a[i]].push_back(b[i]);
 
    priority_queue <int> que;
    int ans = 0;
    rep(i, 1, m+1) {
        for (int j = 0; j < c[i].size(); j++) que.push(c[i][j]);
        if (!que.empty()) {
            ans += que.top();
            que.pop();
        }
    }
    cout << ans << endl;
    
    return 0;
}


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

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define vllin(x,n) vll (x)(n);FOR(i,0,n-1){cin >>(x)[i];}
#define vllin2(a,b,n) vll (a)(n);vll (b)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vllin3(a,b,c,n) vll (a)(n);vll (b)(n);vll (c)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >>(x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vpl4in(x,n) vpl4 (x)((n),mp(0,0));FOR(i,0,n-1){cin >>x[i].fi>>x[i].se;}
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define says(x) cout<<(x)<<(' ');
#define sas cout<<(' ');
#define sayR(x) cout<<fixed<<setprecision(10)<<(x);
#define salR(x) cout<<fixed<<setprecision(10)<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=998244353;
ll INF=100000000000001;
vector<ll> value; // ノードの値を持つ配列
ll N;             // 葉の数
 
void update(ll i, ll x) {
    // i 番目の葉の値を x に変える
    i += N - 1; // i 番目の葉のノード番号
    value[i] = x;
    while (i > 0) {
        i = (i - 1) / 2; // ノード i の親ノードの番号に変える
        value[i] = min(value[i * 2 + 1],
                       value[i * 2 + 2]); // 左右の子の min を計算しなおす
    }
}
 
ll query(ll a, ll b, ll k, ll l, ll r) {
    // [a, b) の区間に対するクエリについて
    // ノード k （区間 [l, r) 担当）が答える
    if (r <= a || b <= l) return INF; // 区間が被らない場合は INF を返す
    if (a <= l && r <= b)
        return value[k]; // ノード k の担当範囲がクエリ区間 [a, b)
                         // に完全に含まれる
    else {
        ll c1 = query(a, b, 2 * k + 1, l, (l + r) / 2); // 左の子に値を聞く
        ll c2 = query(a, b, 2 * k + 2, (l + r) / 2, r); // 右の子に値を聞く
        return min(c1, c2); // 左右の子の値の min を取る
    }
}
signed main(){
    llin(x);
    sal((x%100<=(x/100)*5)?1:0)
}


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

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   ll a,b;
   cin>>a>>b;
   ll temp=(a*b)/__gcd(a,b);
   cout<<temp<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
using namespace std;

int main(){

    long long  n, x;
    cin >> n >> x;

    vector<long long>v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    sort(v.begin(), v.end());

    long long sum = 0;
    for(int i = 0; i < n; i++){
        sum += v[i];
        if(sum > x){
            cout << i << endl;
            return 0;
        }
    }

    if(sum == x) cout << n << endl;
    else cout << n-1 << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 long long x;
 cin>>x;
 if(x==2){
   cout<<x<<endl;
 }
 else{
 long long m=x;
 int ans=0;
 while(1){
   for(int i=2;i<=m-1;i++){
     if(m%i==0){
       ans=1;
       break;
     }
   }
   if(ans==0){
     break;
   }
   else{
     ans=0;
     m++;
   }
 }
 cout<<m<<endl;
}
  return 0;
}


Measured memory_bytes: 256