akhauriyash/Code-Regression huggingface dataset:
import math

S = input()
K = int(input())
cnt = 0
tmp = 1
if K == 1:
    for i in range(1, len(S)):
        if S[i - 1] == S[i]:
            tmp += 1
        elif tmp >= 2:
            cnt += tmp // 2
            tmp = 1
        else:
            tmp = 1
    if tmp >= 2:
        cnt += tmp // 2
else:
    g1 = 0
    g2 = 0
    jlst = S + S
    for i in range(1, len(S) * 2):
        if jlst[i - 1] == jlst[i]:
            tmp += 1
        elif tmp >= 2:
            cnt += tmp // 2
            tmp = 1
        else:
            tmp = 1

    if tmp >= 2:
        cnt += tmp // 2

    if cnt % 2 == 0:
        cnt = K * (cnt // 2)
    else:
        g1 = cnt // 2
        g2 = cnt - g1
        v = math.ceil(K / 2)
        if tmp >= 3 and tmp % 2 != 0 and S[0] == S[-1]:
            cnt = g1 + (g2 * (K - 1))
        else:
            cnt = (g1 * v) + (g2 * (K - v))

print(cnt)

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

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(b >= c){
        cout << b + c;
    }else{
        if(a+b>=c){
            cout << b + c;
        }else{
            cout << 2 * b + a + 1;
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int ab = 0;
	int bc = 0;
	int ca = 0;

	scanf("%d %d %d", &ab, &bc, &ca);

	int min = ab + bc;

	if(bc + ca < min) min = bc + ca; 
	if(ca + ab < min) min = ca + ab;

	printf("%d\n", min); 

	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

inline int getint()
{
	static char c;
	while ((c = getchar()) < '0' || c > '9');

	int res = c - '0';
	while ((c = getchar()) >= '0' && c <= '9')
		res = res * 10 + c - '0';
	return res;
}

const int MaxN = 2000;
const int MaxM = 2000;

int n, m, q;
int a[MaxN + 2][MaxM + 2];

char s[MaxM + 2];

int sum[3][MaxN + 1][MaxM + 1];

inline int query(int k, int x1, int y1, int x2, int y2)
{
	return sum[k][x2][y2] - sum[k][x2][y1 - 1] - sum[k][x1 - 1][y2] + sum[k][x1 - 1][y1 - 1];
}

int main()
{
	cin >> n >> m >> q;
	for (int i = 1; i <= n; ++i)
	{
		scanf("%s", s + 1);
		for (int j = 1; j <= m; ++j)
			a[i][j] = s[j] - '0';
	}

	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
		{
			sum[0][i][j] = a[i][j];
			sum[1][i][j] = a[i][j] && a[i + 1][j];
			sum[2][i][j] = a[i][j] && a[i][j + 1];

			for (int k = 0; k < 3; ++k)
				sum[k][i][j] += sum[k][i - 1][j] + sum[k][i][j - 1] - sum[k][i - 1][j - 1];
		}

	while (q--)
	{
		int x1 = getint(), y1 = getint();
		int x2 = getint(), y2 = getint();

		int res = query(0, x1, y1, x2, y2);
	//	cout << res << ' ';
		res -= query(1, x1, y1, x2 - 1, y2);
	//	cout << res << ' ';
		res -= query(2, x1, y1, x2, y2 - 1);
	//	cout << res << endl;

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

	return 0;
}

Measured memory_bytes: 64384
using System;
using System.Linq;

namespace abc054_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (x[0] == x[1])
            {
                Console.WriteLine("Draw");
            }
            else
            {
                if (x[0] == 1)
                {
                    x[0] += 99;
                }
                if (x[1] == 1)
                {
                    x[1] += 99;
                }
                Console.WriteLine(x[0] > x[1] ? "Alice" : "Bob");
            }
        }
    }
}

Measured memory_bytes: 13268
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int sum1 = A + B + 10*C;
    int sum2 = C + A + 10*B;
    int sum3 = B + C + 10*A;
    System.out.println(Math.max(Math.max(sum1, sum2), sum3));
  }
}


Measured memory_bytes: 22996
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

typedef pair<int, int> pii;

int dp[150][10][80]; //[i][j][k] i???????????§??§(i???,j??????)????????§?????????k????????£????????§????????¨??????????°????
vector<pii> stone[150]; // x[0-indexed], suberi
int n, m;

int main() {
	while (cin >> n >> m, n || m) {
		fill(dp[0][0], dp[n][0], INF);
		REP(i, n) stone[i].clear();
		
		REP(i, n) {
			int k;
			scanf("%d", &k);
			REP(j, k) {
				int a, b;
				scanf("%d %d", &a, &b);
				stone[i].push_back(pii(a, b));
			}
		}
		
		REP(i, stone[0].size()) dp[0][i][m] = 0;
		if (m != 0) REP(i, stone[1].size()) dp[1][i][m - 1] = 0;
		
		REP(i, n - 1) REP(j, stone[i].size()) REP(k, m + 1) {
			pii &from = stone[i][j];
			
			// 1????£???°???
			if (i < n - 2 && k > 0) {
				REP(l, stone[i + 2].size()) {
					pii &to = stone[i + 2][l];
					int cost = (from.second + to.second) * abs(from.first - to.first);
					dp[i + 2][l][k - 1] = min(dp[i + 2][l][k - 1], dp[i][j][k] + cost);
				}
			}
			
			REP(l, stone[i + 1].size()) {
				pii &to = stone[i + 1][l];
				int cost = (from.second + to.second) * abs(from.first - to.first);
				dp[i + 1][l][k] = min(dp[i + 1][l][k], dp[i][j][k] + cost);
			}
		}
		
		/*
		REP(i, n + 1) {
			REP(j, stone[i].size()) {
				int pri = INF;
				REP(k, m + 1) pri = min(pri, dp[i][j][k]);
				printf("%d%c", pri, j == stone[i].size() - 1 ? '\n' : ' ');
			}
		}
		*/
		
		int ans = INF;
		REP(i, stone[n - 1].size()) REP(j, m + 1) ans = min(ans, dp[n - 1][i][j]);
		if (n > 1) REP(i, stone[n - 2].size()) FOR(j, 1, m + 1) ans = min(ans, dp[n - 2][i][j]);
		if (ans == INF) ans = 0;
		cout << ans << endl;
	}
	return 0;
}

// 1:20

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int num = Integer.parseInt(br.readLine());
		int i = 0;

		while (num != 0) {
			i++;
			System.out.println("Case " + i + ": " + num);
			num = Integer.parseInt(br.readLine());

		}
	}
}

Measured memory_bytes: 31904
#include <iostream>

int main(){
    int H,W = 0;
    while(std::cin >> H >> W){
    if(H==0&&W==0) break;
    for(int h=0; h<H; h++){
        for(int w=0; w<W; w++){
            if((h+w)%2==0){
                std::cout << "#";
            }else{
                std::cout << ".";
            }
        }
        std::cout << "\n";
    }
    std::cout << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3080
#include<iostream>
using namespace std;
int main(){
 long long n , a , b;
  cin >> n >> a >> b;
  
  if((a > b)||(n==1 && a!=b)){
    cout<<0<<endl;
  }
  else{
    cout<<(b-a)*(n-2) + 1 <<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

int Gcd(int smaller, int bigger) {
  if (smaller > bigger) {
    return Gcd(bigger, smaller);
  }
  if (smaller <= 0) {
    return bigger;
  }

  auto r = bigger % smaller;
  return Gcd(r, smaller);
}

int main(void) {
  int x, y;
  std::cin >> x >> y;
  std::cout << Gcd(x, y) << '\n';
}

Measured memory_bytes: 3080
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  double total = 0;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    total += A[i];
  }
  
  long long fl = floor(total/N);
  long long ce = ceil(total/N);

  long long fl_total = 0, ce_total = 0;
  for (int i = 0; i < N; i++) {
    fl_total += (A[i]-fl)*(A[i]-fl);
    ce_total += (A[i]-ce)*(A[i]-ce);
  }
  cout << min(fl_total, ce_total) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IDX 131072
using namespace std;
int ans;
int N;
int m[111111],t[111111];
int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>m[i];
    t[i]=m[i];
  }
  sort(t,t+N);
  int a=0,b=N;
  while(a<b){
    int c=(a+b)/2;
    int d=t[c];
    vector<pair<int,int>>v(N+1);
    vector<int>dp(IDX*2);
    for(int i=1;i<=N;i++){
      if(m[i-1]<d)v[i].first=-1;
      else v[i].first=1;
      v[i].first += v[i-1].first;
      v[i].second=i;
    }
    sort(v.begin(),v.end());
    long long sum = 0LL;
    for(auto& p:v){
      int from = IDX;
      int to = p.second + IDX;
      while(from<=to){
        if(to%2==0||to==1){
          sum += dp[to--];
        } else {
          to/=2;
          from/=2;
        }
      }
      int idx = p.second + IDX;
      while(idx){
        dp[idx]++;
        idx/=2;
      }
    }
    if(sum<1LL*N*(N+1)/2/2){
      b = c;
    } else {
      ans = max(ans, d);
      a = c + 1;
    }
  }
  cout<<ans<<'\n';
  return 0;
}

Measured memory_bytes: 2824
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>

using namespace std;
int main() {
  int a, b, m, aa[100000], bb[100000], x, y,
      ans = 1000000000, amin = 1000000000, bmin = 1000000000, c;
  scanf("%d%d%d", &a, &b, &m);
  for (int i = 0; i < a; i++) {
    scanf("%d", &aa[i]);
    amin = min(amin, aa[i]);
  }
  for (int i = 0; i < b; i++) {
    scanf("%d", &bb[i]);
    bmin = min(bmin, bb[i]);
  }
  ans = amin + bmin;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &x, &y, &c);
    x--;
    y--;
    ans = min(ans, aa[x] + bb[y] - c);
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 896
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (a, b, c) = listOfInt()

    for (i in 1..a*b) {
        if ((a * i) % b == c) {
            println("YES")
            return
        }
    }

    println("NO")
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 36076
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

int dp[100005][3];

int main(){
    int n;
    cin >> n;
    int h[n+1][3];
    rep(i,n)cin >> h[i+1][0] >> h[i+1][1] >> h[i+1][2];
    for(int d=1;d<=n;d++){
        rep(i,3){
            rep(j,3){
                if(i==j)continue;
                chmax(dp[d][i],dp[d-1][j]+h[d][i]);
            }
        }
    }
    int ans=0;
    rep(i,3)chmax(ans,dp[n][i]);
    cout << ans << endl;
}

Measured memory_bytes: 2560
n,m = map(int,input().split())
A = list(map(int,input().split()))
D = [(A[i],1) for i in range(n)]

for i in range(m):
    b,c = map(int,input().split())
    D.append((c,b))

D.sort(reverse = True)

ans, left = 0, n

for (i,j) in D:
    use = min(j, left)
    ans += use * i
    left -= use
print(ans)

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> esum(n, 0);
    vector<int> wsum(n, 0);
    if(s[0] == 'E') esum[0] = 1;
    else wsum[0] = 1;
    for(int i = 1; i < n; i++){
        esum[i] = esum[i-1];
        wsum[i] = wsum[i-1];
        if(s[i] == 'E') esum[i]++;
        else wsum[i]++;
    }

    int ans = 1001001001;
    for(int i = 0; i < n; i++){
        int coans = 0;
        if(i != 0) coans += wsum[i-1];
        if(i != n-1) coans += esum[n-1]-esum[i];
        if(ans > coans) ans = coans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6060
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=1e7+7;
vi prime;
bool vis[maxn];
void db()
{
    for(int i=2;i<maxn;i++)
    {
        if(!vis[i])
            prime.push_back(i);
        for(auto p:prime)
        {
            if(i*p>=maxn) break;
            vis[i*p]=1;
            if(i%p==0) break;
        }
    }
    vis[1]=1;
    vis[2]=1;
}
int x[105];
bool b[maxn];
int pp[205];
bool vv[205];
vi even,odd;
bool dfs(int u)
{
    if(vv[u]) return false;
    vv[u]=1;
    for(int i=0;i<odd.size();i++)
    {
        if(!vis[abs(even[u]-odd[i])])
        {
            if(pp[i]==-1||dfs(pp[i]))
            {
                pp[i]=u;
                return true;
            }
        }
    }
    return false;
}
int main()
{
    db();
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>x[i];
        b[x[i]]^=1;
        b[x[i]+1]^=1;
    }
    for(int i=1;i<maxn;i++)
    {
        if(b[i])
        {
            if(i&1) odd.push_back(i);
            else even.push_back(i);
        }
    }
    memset(pp,-1,sizeof(pp));
    int ans=0;
    for(int i=0;i<even.size();i++)
    {
        memset(vv,0,sizeof(vv));
        if(dfs(i))
            ans++;
    }
    ans=ans+((even.size()-ans)/2+(odd.size()-ans)/2)*2+(even.size()-ans)%2*3;
    print(ans);
}

Measured memory_bytes: 21996
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  /*int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int ans = 0;
  for (int i = n - 1; i > 0; i--) {
    int a = arr[i], b = arr[i - 1];
    if (a + b == 5) {
      cout << "Infinite" << endl;
      return 0;
    } else ans += a + b;
  }
  cout << "Finite" << endl;
  cout << ans << endl;*/
  int arr[5];
  for (int i = 0; i < 5; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + 5);
  int k;
  cin >> k;

  if (arr[4] - arr[0] > k) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys


def calc_third_root(q):
    x = q / 2
    while not (abs(x**3 - q) < 0.00001 * q):
        x = x - (x**3 - q)/(3.0 * x**2)
    return x


def main(args):
    while True:
        q = int(input())
        if q == -1:
            break
        result = calc_third_root(q)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7704
package main

import "fmt"

func main() {
	var H, A int
	fmt.Scanf("%d", &H)
	fmt.Scanf("%d", &A)
	if H%A == 0 {
		fmt.Println(H / A)
	} else {
		var ans int
		ans = H / A
		fmt.Println(ans + 1)
	}
}


Measured memory_bytes: 512
//submitted by HimJ
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;
const int mxn=1e5+1;
int dig(int n)
{
    int ans=0;
    while(n)
    {
        ans+=n%10;
        n/=10;
    }
    return ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  ll t=1;
  //cin>>t;
    while(t--){
            int n,a,b,i,j,mn=INT_MAX;
    cin>>n;
    fr(i,1,n)
    {
        j=n-i;
        if(mn>dig(i)+dig(j))
        {
            mn=dig(i)+dig(j);
        }
    }
          cout<<mn;

    }
  return 0;
  }



Measured memory_bytes: 256
import java.util.*;
import java.io.*;

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

        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        int max = 0;
        int move = 0;
        for (int i = 0; i < N - 1; i++) {
            if (H[i] < H[i + 1]) {
                if (max < move) {
                    max = move;
                }
                move = 0;
                continue;
            }
            move++;
        }
        if (max < move) {
            max = move;
        }

        out.printf("%d\n", max);
        out.flush();
    }
}


Measured memory_bytes: 50788
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    int n , t = 0 , ans ;
    cin>>n;
    int arr [n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        t ^=arr[i];
    }
    for(int i =0;i<n;i++)
    {
        ans = t^arr[i];
        cout<<ans<<" ";
    }
   return 0; 
}

Measured memory_bytes: 4432
#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
#endif

// Loops --------------------------------------------------------------------

#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)

// Extra --------------------------------------------------------------------

#define ull                 unsigned long long int
#define ll                  long long int
#define ld                  long double
#define endl                '\n'
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()

// Template -----------------------------------------------------------------

template <typename T> 
inline bool inrange(T a, T l, T r) {
    if(l>r) swap(l,r);
    return (a>=l and a<=r);
}
template <typename T, typename U> 
inline bool exist(T val, U &any) {
    return (any.find(val) != any.end());
}
// multiple input
template <typename T> 
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U> 
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

using graph = vector<vector<ll>>;
void solve(ll &T)
{
    ll n, m;
    std::cin>>n>>m;
    
    vector<ll> h(n);
    std::cin>>h;

    graph g(n+1);
    loop(i,0,m)
    {
        ll x, y;
        std::cin>>x>>y;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }
    
    ll ans = 0;
    loop(i,1,n+1)
    {
        ll add = 1;
        for(ll adj : g[i])
        {
            if(h[i-1] <= h[adj-1]) {
                add = 0;
                break;
            }
        }
        ans += add;
    }
    std::cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int t = 1;
    loop(i,1,t+1)
    {
        cerr<<"Case #"<<i<<"\n";
        solve(i);
    }
    return 0;
}

Measured memory_bytes: 9860
N = int(input())

S_list = {}
ans = set()

for _ in range(N):
    S = input()
    try:
        S_list[S] += 1
    except KeyError:
        S_list[S] = 0

M = max(S_list.values())
S_list = sorted(S_list.items(), key = lambda x: x[0])

for s, v in S_list:
    if v == M:
        print(s)



Measured memory_bytes: 47000
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        mut a:usize,mut b:usize,mut c:usize,
        k:usize,
    }
    for _ in 0..k {
        if b <= a {
            b <<= 1;
        } else if c <= b {
            c <<= 1;
        }
    }
    if (a + 1..c).contains(&b) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>

using namespace std;
const double INF = 1e10;

struct Edge{
  int cost, to, c;
  Edge(int to, int cost, int c):
    to(to), cost(cost), c(c) {}
};

double dijkstra(int s, int g, vector< vector<Edge> > &G){
  int n = G.size();
  vector< vector< vector<double> > > D(n,(vector< vector<double> >(n, vector<double>(30,INF))));
  priority_queue< tuple<double,int,int,int> > wait;
  wait.emplace(0,0,s,-1);//time, v, cur, from
  while(!wait.empty()){
    double t = -get<0>(wait.top());
    int v = get<1>(wait.top()) + 1,
      cur = get<2>(wait.top()), from = get<3>(wait.top());
    wait.pop();
    if(from != -1 && t >= D[cur][from][v-1]) continue;
    if(from != -1) D[cur][from][v-1] = t;
    for(int i = 0; i < G[cur].size(); ++i){
      int to = G[cur][i].to, d = G[cur][i].cost, c = G[cur][i].c;
      if(to == from) continue;
      if(from != -1 && v+1 <= c && D[to][cur][v] > t + (double)d/(v+1))
        wait.emplace(-t-(double)d/(v+1), v, to, cur);
      if(v <= c && D[to][cur][v-1] > t + (double)d/v)
        wait.emplace(-t-(double)d/v, v-1, to, cur);
      if(v > 1 && v-1 <= c && D[to][cur][v-2] > t + (double)d/(v-1))
        wait.emplace(-t-(double)d/(v-1), v-2, to, cur);
    }
  }
  double ret = INF;
  for(int i = 0; i < n; ++i) ret = min(ret,D[g][i][0]);
  return ret;
}

int main(){
  int n, m;
  while(cin >> n >> m, n){
    int s, g;
    cin >> s >> g;
    --s;
    --g;
    int x, y, d, c;
    vector< vector<Edge> > G(n);
    for(int i = 0; i < m; ++i){
      cin >> x >> y >> d >> c;
      --x;
      --y;
      G[x].emplace_back(y,d,c);
      G[y].emplace_back(x,d,c);
    }
    double ans = dijkstra(s,g,G);
    if(ans >= INF) cout << "unreachable" << endl;
    else printf("%.12f\n",ans);
  }
  return 0;
}



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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = 1e9;
const LL LLINF = 1e18;
const LL mod = 1e9 + 7;

void solve()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP0(i, N)
    {
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    LL ans = 1;

    // validation
    if (N % 2 == 0)
    {
        for (int i = 0; i < N; i += 2)
        {
            if ((i + 1) == A[i] and A[i] == A[i + 1])
                continue;
            cout << 0 << endl;
            return;
        }
    }
    else
    {
        if (!(A[0] == 0))
        {
            cout << 0 << endl;
            return;
        }
        for (int i = 1; i < N; i += 2)
        {
            if ((i + 1) == A[i] and A[i] == A[i + 1])
                continue;
            cout << 0 << endl;
            return;
        }
    }

    // ここまできていればvalid
    // N%2==0 なら ans = 2^(N/2), else ans = 2^((N-1)/2)
    // 整数除算なら結局同じこと
    for (int i = 0; i < (N - N % 2) / 2; i++)
    {
        ans *= 2ll;
        ans %= mod;
    }
    cout << ans << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}

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

int main(){

  int n, k, h[100000]={0};

  cin >> n >> k;
  for(int i=0; i<n; ++i){
    cin >> h[i];
  }
  
  sort(h, h+n);
  
  int ans = INT32_MAX;
  for(int i=0; i<n-k+1; ++i){
    int sub = h[i+k-1] - h[i];
    if(sub < ans) ans = sub;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
n = int(input())
x = list(map(int,input().split()))

st = min(x)
en = max(x)
n = len(x)

min_energy = 10**10

for p in range(st,en+1):
    energy = 0
    for i in range(n):
        energy += (x[i] - p )**2

    min_energy = min(min_energy,energy)

print(min_energy)

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

#define SWAP(a, b) (a += b,b = a - b,a -= b)
#define rng(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define urng(i, a, b) for(int i = int(b) - 1; i >= int(a); i--)
#define urep(i, b) urng(i, 0, b)
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed

main() {
  int n, a, k;
  //string s;
  ll ans = 0;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i, n) cin >> h.at(i);
  sort(all(h));
  for(int i = 0; i < n - k; i++) ans += h.at(i);
  cout << ans << endl;
  //cout <<  << endl;
}

Measured memory_bytes: 1792
n,m,*t=map(int,open(0).read().split())
s=sorted
a=s(t[:n])[::-1]
m=0
for c,b in s(zip(t[n+1::2],t[n::2]))[::-1]:
 while a and c>a[-1]and b:m+=c;b-=1;a.pop()
print(m+sum(a))

Measured memory_bytes: 35420
using System;
using System.Linq;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    int N=int.Parse(Console.ReadLine());
    long[] Lucas=new long[N+1];
      Lucas[0]=2;
      Lucas[1]=1;
      for(int i=2;i<=N;i++){
        Lucas[i]=Lucas[i-1]+Lucas[i-2];
      }
      Console.WriteLine(Lucas[N]);
    }
    
  }

}


Measured memory_bytes: 27392
#include <stdio.h>

int main(void)
{
    int N, i, count;
    char S[100000], T;

    scanf("%d", &N);
    
    scanf("%s", S);

    T = S[0];

    count++;

    for(i=1; i<N; i++){
        if(S[i] != T){
            T = S[i];

            count++;
        }
    }

    printf("%d\n", count);

    return 0;
}

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

int main()
{
	int k, n;
	cin >> k >> n;
	int a[2*110000];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	int ma = 0, sum = 0;
	for (int i = 0; i < n-1; ++i)
	{
		sum += a[i+1] - a[i];
		ma = max(a[i+1] - a[i], ma);
	}
	sum += k + a[0] - a[n - 1];
	ma = max(k + a[0] - a[n - 1], ma);
	cout << sum - ma << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <math.h>
#include <assert.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <array>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define forn(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define ford(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define int long long
#define ii pair<int,int>
#define ar array
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define sz(x) ((int)(x).size())
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
//const int INF = 1e18 ;
//const int MOD = 1e9 + 7 ;
//const int N = 3e5+7 ;

void solve(){
	int n ;
	cin >> n ;
	if(n==0){
		cout << 1 ;
	}
	else{
		cout << 0 ;
	}
}


int32_t main(){
    FAST_IO ;
    int t = 1 ;
//    cin >> t ;
    while(t--){
        solve() ;
    }
}


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

using namespace std;

void solve()
{
    int n;
    cin >> n;
    vector<int> hs(n), dp(n);
    for (int i = 0; i < n; i++)
    {
        cin >> hs[i];
    }
    reverse(hs.begin(), hs.end());
    for (int i = 1; i < n; i++)
    {
        if (hs[i] >= hs[i-1])
        {
            dp[i] = dp[i-1] + 1;
        }
    }
    cout << *max_element(dp.begin(), dp.end()) << endl;
}

int main()
{
    solve();
    cerr << "\"努力不足ですね！\"" << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return (t * t) % mod;
    } else {
        return (modpow(m, n - 1) * m) % mod;
    }
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

struct LCA {
    vector<vector<int>> par;
    vector<int> d;
    int n;
    LCA(vector<vector<int>> graph, int root) {
        n = graph.size();
        par.resize(n, vector<int>(30));
        d.resize(n, 0);
        function<void(int, int, int)> dfs = [&](int c, int p, int depth) {
            d[c] = depth;
            par[c][0] = p;
            for (auto ch : graph[c]) {
                if (ch != p) dfs(ch, c, depth + 1);
            }
        };
        dfs(0, 0, 0);
        for (int j = 1; j < 30; j++) {
            REP(i, n) { par[i][j] = par[par[i][j - 1]][j - 1]; }
        }
    }
    int getdistance(int u, int v) { return (d[u] + d[v]) - 2 * (d[query(u, v)]); }
    int query(int u, int v) {
        if (d[u] > d[v]) {
            swap(u, v);
        }
        for (int i = 29; 0 <= i; i--) {
            if (d[u] <= d[par[v][i]]) {
                v = par[v][i];
            }
        }
        /* LCA */
        for (int i = 29; 0 <= i; i--) {
            if (par[v][i] != par[u][i]) {
                v = par[v][i];
                u = par[u][i];
            }
        }
        if (u == v) {
            return u;
        } else {
            return par[v][0];
        }
    }
};

struct UnionFind {
    vector<int> parent, size;
    UnionFind(int n) {
        parent.resize(n, -1);
        size.resize(n, 1);
    }
    void unite(int x, int y) {
        if (same(x, y)) {
            return;
        }
        x = root(x);
        y = root(y);
        if (size[x] <= size[y]) {
            swap(x, y);
        }
        parent[y] = x;
        size[x] += size[y];
    }
    bool same(int x, int y) { return (root(x) == root(y)); }
    int root(int x) {
        while (parent[x] != -1) {
            x = parent[x];
        }
        return x;
    }
    int getsize(int x) { return size[root(x)]; }
};
int n, m;
vector<vector<int>> graph;

signed main() {
    int n;
    cin >> n;
    vector<int> as(n);
    vector<int> bs(n);
    REP(i, n) {
        cin >> as[i];
        bs[i] = as[i];
    }
    if (prev_permutation(as.begin(), as.end())) {
        REP(i, as.size() - 1) { cout << as[i] << " "; }
        cout << as[as.size() - 1] << endl;
    }
    REP(i, bs.size() - 1) { cout << bs[i] << " "; }
    cout << bs[bs.size() - 1] << endl;
    if (next_permutation(bs.begin(), bs.end())) {
        REP(i, bs.size() - 1) { cout << bs[i] << " "; }
        cout << bs[bs.size() - 1] << endl;
    }
}


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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2e18
#define endl "\n"

ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	string s,t,l;
	int a,b;
	cin>>s>>t>>a>>b>>l;
	if(l==s)--a;
	else if(l==t)--b;
	cout<<a<<" "<<b;
	return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A;
    char B;
    int C;
    cin >> A >> B >> C;
    if (B=='+'){
        cout << A+C << endl;
    }
    else if (B=='-'){
        cout << A-C << endl;
    }
}

Measured memory_bytes: 256
#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
import sys
sys.setrecursionlimit(10**6)
import math
import itertools
from collections import defaultdict
from collections import Counter
import numpy as np

import heapq
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
od=998244353
n,k,x=list(map(int,input().split()))

n_c_i=[1]
pow_k=pow(k-1,n,od)
inv_k=pow(k-1,od-2,od)
each_cal=[]
zenpou=[1]
kouhou=[]
for i in range(1,x+1):
    n_c_i.append((n_c_i[-1]*(n-i)*pow(i,od-2,od))%od)
for i in range(n-1):   
    zenpou.append(zenpou[-1]*(k-1)%od)
for i in range(x+1):
    pow_k=pow_k*inv_k%od
    kouhou.append(pow_k)
    each_cal.append(pow(k-1,n-i-1,od))
zenpou=zenpou[n-x-1:]
zenpou.reverse()
#print(zenpou[0],each_cal[0])
#print(zenpou[-1],each_cal[-1])
#print(len(zenpou))
#print(len(each_cal))
ans=0
for i in range(x+1):
    #each_calのみAC
    #zenpouとkouhouはWA
    #なぜ？
    ans+=(n_c_i[i]*k*zenpou[i])%od
    ans%=od

print(ans)



Measured memory_bytes: 59788
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007
using namespace std;

int main(void){
	int N;
	cin>>N;
	int v[N],c[N],ans=0;
	rep(i,N)cin>>v[i];
	rep(i,N)cin>>c[i];
	rep(i,N){
		if(v[i]>c[i])ans+=v[i]-c[i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
n, m, p = map(int, input().split())
edge = []

for _ in range(m):
    a, b, c = map(int, input().split())
    edge.append([a-1, b-1, -c])

d = [float("inf") for _ in range(n)]
d[0] = 0

# check = [0 for _ in range(n)]

for i in range(n*2):
    for now, next, weight in edge:
        if d[next] > d[now] + weight + p:
            d[next] = d[now] + weight + p
            # n+1回目で更新された場合はループしているのでチェックを入れる
            if i > n-1:
                d[next] = -float("inf")
                # check[next] = 1
        if i == n-1:
            prev = d[-1]
            # if check[now]:
            #     check[next] = 1
        # print(d)

# print(check)
# if check[-1]:
if prev != d[-1]:
    print("-1")
else:
    print(max(-prev, 0))
    # print(prev)

Measured memory_bytes: 53848
import sys
from io import StringIO
import unittest
import math

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]


def resolve():
    q = int(input())
    lr = [list(map(int, input().split())) for _ in range(q)]

    # 素数のlist
    prime_list = set(primes(10 ** 5 + 1)) # setにしないと、ものすごい遅い

    """
    # 10^5 * 10 ^ 5なので✗
    for l, r in lr:
        tmp = 0
        for i in range(l, r + 1):
            if i in prime_list and (i + 1)/2 in prime_list:
                tmp += 1
        print(tmp)
    """

    cum_2017 = [0, 0]
    # 累積和的に、2017に似た数カウントをする
    tmp = 0
    for i in range(2, 10 ** 5 + 1, 1):
        if i in prime_list and (i + 1) // 2 in prime_list: # (i + 1) // 2 でなく、(i + 1) / 2にすると遅い
            tmp += 1
            cum_2017.append(tmp)
        else:
            cum_2017.append(tmp)

    for l, r in lr:
        print(cum_2017[r] - cum_2017[l - 1])



class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """1
3 7"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """4
13 13
7 11
7 11
2017 2017"""
        output = """1
0
0
1"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """6
1 53
13 91
37 55
19 51
73 91
13 49"""
        output = """4
4
1
1
1
2"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Measured memory_bytes: 82004
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 1505
const int mod=998244353;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n;
char mp[N][N];
struct MAP{
	int G[N][N],n;
	struct Union_Set{
		int f[N],d[N];
		void init(int n){
			for(int i=1;i<=n;++i){
				f[i]=i;
				d[i]=0;
			}
		}
		inline int getf(int x){
			return f[x]==x?x:f[x]=getf(f[x]);
		}
		inline int Merge(int x,int y){
			int fx=getf(x),fy=getf(y);
			if(fx==fy)return 0;
			d[fx]+=d[fy];
			f[fy]=fx,d[fy]=0;
			return 1;
		}
	}S;
	void init(int _n){
		n=_n;
		S.init(n);
		for(int i=1;i<=n;++i){
			for(int j=1;j<=n;++j){
				G[i][j]=-1;
			}
		}
	}
	bool Add(int u,int v,int w){
		if(!~w)return true;
		if(~G[u][v]){
			return G[u][v]==w;
		}
		else{
			G[u][v]=G[v][u]=w;
			return true;
		}
	}
	int calc(){
		int tot=0;
		for(int i=1;i<=n;++i){
			for(int j=i+1;j<=n;++j){
				if(~G[i][j]){
					S.d[i]+=G[i][j],S.d[j]+=G[i][j];
				}
				else ++tot;
			}
		}
		if(!(n&1))goto End;
		for(int i=1;i<=n;++i){
			for(int j=i+1;j<=n;++j){
				if(!~G[i][j]){
					tot-=S.Merge(i,j);
				}
			}
		}
		for(int i=1;i<=n;++i){
			if(S.getf(i)==i&&S.d[i]&1)return 0;
		}
		End:
		int ans=1;
		while(tot--)(ans<<=1)%=mod;
		return ans;
	}
}p[2];
int main(){
	n=read();
	for(int i=1;i<n;++i){
		scanf("%s",mp[i]+1);
	}
	p[0].init(n/2+1),p[1].init((n+1)/2);
	for(int i=1;i<n;++i){
		for(int j=1;j<n;++j){
			int x=(mp[i][j]=='o'?1:(mp[i][j]=='x'?0:-1));
			int u=(min(i+j,n-i+n-j)>>1)+1;
			int v=(max(i-j,j-i)>>1)+1;
			if(!p[(i+j)&1].Add(u,v,x)){
				return !printf("0\n");
			}
		}
	}
	printf("%lld\n",1LL*p[0].calc()*p[1].calc()%mod);
	return 0;
}



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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
int dx[4] = { 0,  0, 1, -1 };
int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	string s, t; cin >> s >> t;
	
	rep(i, s.size()) {
		bool ok = true;
		
		rep(j, t.size()) {
			int d = i + j;
			if (d > s.size() - 1) d -= s.size();

			if (s[d] != t[j]) {
				ok = false;
				break;
			}
		}

		if (ok) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<string> a(n); for(auto& e : a) cin >> e;

    map<string, int> hist;
    int mx = 0;
    for(auto& e : a){
        hist[e]++;
        chmax(mx, hist[e]);
    }

    vector<string> res;
    for(auto& e : hist){
        string S = e.first;
        int num = e.second;
        if(num == mx){
            res.emplace_back(S);
        }
    }
    sort(_all(res));

    for(auto& e : res){
        cout << e << endl;
    }

    return 0;
}


Measured memory_bytes: 27120
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<limits>
#include<algorithm>
#include<numeric>
#include<utility>

using ull = unsigned long long int;
using ll = long long int; 

using namespace std;

int main(){
    string S;

    cin >> S;

    for(int i=0;i<S.size();i++){
        if((i+1)%2==0 && S[i]=='R'){
            cout << "No" << endl; return 0;
        }
        if((i+1)%2==1 && S[i]=='L'){
            cout << "No" << endl; return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1234567891
#define MAXS 100007

#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define INP freopen("input.txt", "r", stdin)
#define OUT freopen("out.txt", "w", stdout)

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

int n, m;
int lista[MAXS];
int acu[MAXS];



int main(){
  cin >> n >> m;
  int a, b;
  for(int i = 0; i < m; ++i){
    cin >> a >> b;
    lista[a]++; lista[b+1]--;
  }
  int ans = 0;
  int temp = 0;
  for(int i = 0; i <= n; ++i){
    temp += lista[i];
    if(temp >= m) ans++;
  }
  cout << ans;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

#define ll long long

int main() {
    string s;
    int Q;
    char head[200010];
    char tail[200010];
    int hn = 0;
    int tn = 0;

    bool st = true;
    cin >> s >> Q;
    for (int i = 0; i < Q; ++i) {
        int t;
        cin >> t;
        if (t == 1) {
            st = !st;
        } else {
            int f;
            char c;

            cin >> f >> c;
            if ((f == 1) == st) {
                head[hn] = c;
                hn++;
            } else {
                tail[tn] = c;
                tn++;
            }
        }
    }

    if (!st) {
        swap(head, tail);
        swap(hn, tn);
        reverse(s.begin(), s.end());
    }
    for (int i = 0; i < hn; ++i) {
        cout << head[hn - i - 1];
    }
    cout << s;
    for (int i = 0; i < tn; ++i) {
        cout << tail[i];
    }
    cout << endl;
}


Measured memory_bytes: 1152
#include <stdio.h>

int fib[45];

void fibonatti(int i)
{
  fib[0] = 1;
  fib[1] = 1;
  fib[i] = fib[i-1]+fib[i-2];
}

int main()
{
  int n,i;
  
  scanf("%d",&n);
  
  for(i = 0;i < n+1;i++){
    fibonatti(i);
  }

  printf("%d\n",fib[n]);
  return 0;
}



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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair	
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld;	
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
	 
const ll MAX = 10000000;
const ll inf = 5e18-1;


int main() {
	fastio;
	string n;
	cin>>n;
	ll k = n[sz(n)-1] - '0';
	if(k == 2 || k == 4 || k == 5 || k == 7 || k == 9) cout<<"hon"<<endl;
	else if(k == 0 || k == 1 || k == 6 || k == 8) cout<<"pon"<<endl;
	else cout<<"bon"<<endl;

	return 0;
	}

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <cstddef>
#include <algorithm>

using usize = std::size_t;
using i64 = long long;

double calc (i64 x) {
	i64 value = x;
	double sum = 0;
	while (value > 0) {
		sum += (value % 10);
		value /= 10;
	}
	return 1.0 * double(x) / sum;
}

int main() {
	usize k;
	std::cin >> k;
	
	std::vector<i64> num;
	for (i64 ten = 1, _ = 0; _ < 14; _++, ten *= 10) {
		const i64 base = ten - 1;
		for (i64 i = 0; i < 100000; i++) {
			const i64 value = i * ten + base;
			if (0 < value and value <= 1e15) {
				num.push_back(value);
			}
		}
	}
	
	std::sort(num.begin(), num.end());
	num.erase(std::unique(num.begin(), num.end()), num.end());
	
	const usize n = num.size();
	std::vector<double> snk(n), min(n + 1, (1LL << 60));
	for (usize i = 0; i < n; i++) snk[i] = calc(num[i]);
	min[n - 1] = snk[n - 1];
	for (usize i = n; i > 0; i--) {
		min[i - 1] = std::min(min[i], snk[i - 1]);
	}
	
	std::vector<i64> ans;
	for (usize i = 0; i < n; i++) {
		if (snk[i] <= min[i]) ans.push_back(num[i]);
	}
	
	for (usize i = 0; i < k; i++) {
		std::cout << ans[i] << '\n';
	}
	
	return 0;
}

Measured memory_bytes: 27392
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    double t[n];
    for(int i = 0; i < n; i++){
        cin >> t[i];
    }
    double dp[n+1][n+1];

    for(int i = 0; i <= n; i++){
        dp[0][i]=0;
        dp[i][0]=1;
    }
    dp[0][0] = 1;
    for(int j = 1; j <=n; j++){
        for(int i = 1; i<=n; i++){
            dp[i][j] = dp[i-1][j]*(1-t[i-1])+dp[i-1][j-1]*t[i-1];
        }
    }
   /* for(int i = 0; i<=n;i++){
       for(int j = 0; j<=n;j++){
            cout  << setprecision(9) << fixed << dp[i][j] << " ";
        }
        cout<<endl;
    }*/


    double odp = 0;
    for(int i =(n+1)/2; i<=n; i++){
        odp+=dp[n][i];
    }
    cout  << setprecision(9) << fixed << dp[n][(n+1)/2];
    return 0;
}


Measured memory_bytes: 70656