akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
ll modpow(ll a, ll b, ll m) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll h = modpow(a, b / 2, m);
        return h * h % m;
    } else {
        return a * modpow(a, b - 1, m) % m;
    }
}
ll comb(ll a, ll b, ll m) {
    if (b > a - b) {
        return comb(a, a - b, m);
    }
    ll c = 1, d = 1;
    REP(i, b) {
        c *= (a - i);
        d *= (b - i);
        c %= m;
        d %= m;
    }
    return c * modpow(d, m - 2, m) % m;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<pair<int, int>> A(N);
    REP(i, N) {
        cin >> A[i].second >> A[i].first;
    }
    SORT(A);
    int t = 0;
    REP(i, N) {
        t += A[i].second;
        if (t > A[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1920
import sys
MAX_INT = int(10e9)
MIN_NUM = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
h = IL()

cnt = 0
ans = 0
for i in range(N-1):
  if h[i] >= h[i+1]:
    cnt += 1
  else:
    ans = max(ans, cnt)
    cnt = 0
else:
  ans = max(ans, cnt)

print(ans)

Measured memory_bytes: 63984
<?php
list($a, $b, $k) = explode(' ', trim(fgets(STDIN)));

if ($k === 1) {
    echo 1, PHP_EOL;
    exit;
}

$x = [1];
$i = 2;
while ($i <= 100) {
    if ($a % $i === 0 && $b % $i === 0) {
        $x[] = $i;
    }
    $i++;
}

echo array_reverse($x)[$k - 1], PHP_EOL;

Measured memory_bytes: 4732
import sys
import math

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]
MOD = 10**9+7

N = INT()
A = MAP()

A.sort()
#print(A)

s = 0 if N%2 else 1
e = N if N%2 else N+1

for i in range(s, e):
	t = math.ceil(i/2)*2
	if not N%2: t -= 1
	if t != A[i-s]:
		print(0)
		break
else:
	print(2**(N//2)%MOD)

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

signed main(){
  string s; cin >> s;
  int n = s.size();
  vector<vector<ll> > dp(n + 1, vector<ll> (13, 0));
  dp[0][0] = 1;
  for(int i = 0; i < n; i++){
    if(s[i] != '?'){
      int num = s[i] - '0';
      for(int j = 0; j < 13; j++){
        int next = (num + 10 * j) % 13;
        (dp[i + 1][next] += dp[i][j]) %= MOD;
      }
    }
    else{
      for(int j = 0; j < 13; j++){
        for(int k = 0; k < 10; k++){
          (dp[i + 1][(10 * j + k) % 13] += dp[i][j]) %= MOD;
        }
      }
    }
  } 
  cout << dp[n][5] << endl;
}

Measured memory_bytes: 13696
#include<iostream>
#include <ctype.h>
#include <string.h>
using namespace std;

int main(){
  string s ;
  cin >> s;
  int n;
  cin >> n;
  int i = 0;
  while(s[i]=='1')
	i++;
  if(n<=i) cout << '1' << endl;
  else cout << s[i] << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
#define ll long long
int a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    int n ; cin >> n;
    int ans = 0;
    for (int i = 1 ; i <= n ; i++){
        int v ; cin >> v;
        if (i % 2 == 1 && v % 2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3648
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

signed main() {
    Fast();

    int x, t;
    cin >> x >> t;
    cout << max(0, x - t) << endl;

    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
char S[20],T[20],U[20];
int f1,f2,a,b;
int main() {
	scanf("%s%s",&S,&T);
	scanf("%d%d",&a,&b);
	scanf("%s",&U);
	f1=true; f2=true;
	for (int i=0;i<strlen(S);++i) if (U[i]!=S[i]) f1=false;
	for (int i=0;i<strlen(T);++i) if (U[i]!=T[i]) f2=false;
	if (f1)--a; if (f2) --b;
	printf("%d %d",a,b);
	return 0;
} 

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


int main(){
  int n, k;
  cin >> n >> k;
  vector<char> v(k);
  for(int i = 0; i < k; i++){
    cin >> v[i];
  }
  bool fin = false;
  for(int i = n; i < 1000000; i++){
    bool f = false;
    
    string s = to_string(i);
    for(int j = 0; j < s.size(); j++){
      for(int l = 0; l < k; l++){
        if(s[j] == v[l]){f = true; break;}
      }
      if(f){break;}
      if(j == s.size() - 1){cout << s << endl; fin = true;}
    }
    if(fin){break;}
  }
}  

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

int main()
{
	int n;cin>>n;
	n%=10;
	if(n==3)
	cout<<"bon"<<endl;
	else if(n==0||n==1||n==6||n==8)
	cout<<"pon"<<endl;
	else
	cout<<"hon"<<endl; 
}

Measured memory_bytes: 3584
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void ABC079D();

#if 1
int main()
{
	ABC079D();
	fflush(stdout);
	return 0;
}
#endif

static void ABC079D()
{
	int H, W;
	getint(H, W);

	std::vector<std::vector<int>> power(10, std::vector<int>(10, 0));
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			getint(power[i][j]);
		}
	}

	std::vector<std::vector<int>> wall(H, std::vector<int>(W));
	for (int h = 0; h < H; h++) {
		for (int w = 0; w < W; w++) {
			getint(wall[h][w]);
		}
	}

	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				power[i][j] = std::min(power[i][j], power[i][k] + power[k][j]);
			}
		}
	}

	int ans = 0;
	for (int h = 0; h < H; h++) {
		for (int w = 0; w < W; w++) {
			if (wall[h][w] != -1) {
				ans += power[wall[h][w]][1];
			}
		}
	}
	printf("%d\n", ans);
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

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

  int N;
  cin >> N;

  string S;
  int AC = 0, WA = 0, TLE = 0, RE = 0;
  for(int i = 0; i < N; ++i) {
    cin >> S;
    if(S == "AC") {
      AC++;
    }
    else if(S == "WA") {
      WA++;
    }
    else if(S == "TLE") {
      TLE++;
    }
    else if(S == "RE") {
      RE++;
    }
  }

  cout << "AC  x " << AC << endl;
  cout << "WA  x " << WA << endl;
  cout << "TLE  x " << TLE << endl;
  cout << "RE  x " << RE << endl;

  return 0;
}


Measured memory_bytes: 3656
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;

int main() {
	go;
    cin >> A >> B >> C;
    ll flag = 0;
    if(A == 0) {
    	flag = 1;
    }
    ll lVal = max(A - 1, 0ll) / C;
    ll rVal = B / C;
   	cout << rVal - lVal + flag << "\n";   
	return 0;
}
/*
	Powered by Buggy Plugin
*/




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

int main()
{
    long long k, a, b;
    cin >> k >> a >> b;

    long long answer = 1;
    rep(i, k)
    {
        if (answer < a)
        {
            answer++;
        }
        else if (i != k - 1)
        {
            if (b - a > 2)
            {
                answer += b - a;
                i++;
            }
            else
            {
                answer++;
            }
        }
        else
        {
            answer++;
        }
    }

    cout << answer << endl;
}

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

using namespace std;

signed main() {
    long long n;
    cin >> n;
    int c[n], v[n];
    for (int i = 0; i < n; i++)
        cin >> c[i];
    for (int i = 0; i < n; i++)
        cin >> v[i];
    int mx = 0;
    for (int i = 0; i < (1 << n); i++) {
        int x = 0, y = 0;
        for (int j = 0, ci = i; j < n; j++, ci /= 2)
            if (ci % 2 == 0) {
                x += c[j];
                y += v[j];
            }
        mx = max(mx, x - y);
    }
    cout << mx;
    return 0;
}


Measured memory_bytes: 384
import math
import sys
#####sorting a dictionary by the values#####
def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))
##### naive method for testing prime or not#####
def is_prime(n):
    if n==1:
        return 0
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
#####greatest common divisor of two numbers#####
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
#####least common multiplyer of two numbers#####
def lcm(a,b):
    return (a*b)//gcd(a,b)
#####function that return all the letters#####
def alphbates():
    return "abcdefghijklmnopqrstuvwxyz"
#####binary search#####
def binary_search(ls,n,flag):
    low=0
    hi=n-1
    while(low<=hi):
        mid=(low+hi)//2
        if ls[mid]==flag:
            return mid
        elif ls[mid]>flag:
            hi=mid-1
        else:
            low=mid+1
    return -1
#####taking an array/list as input#####
def inp():
    ls=list(map(int,input().split()))
    return ls
#####taking multiple inputs#####
def mult_inp():
    return map(int,input().split())
#####Main function starts from here#####
n=int(input())
ls=inp()
if n<3:
    print(0)
    exit(0)
ls.sort()
ans=0
for i in range(n):
        for j in range(i+1,n):
                for k in range(j+1,n):
                        if ls[i]+ls[j]>ls[k] and ls[i]+ls[k]>ls[j] and ls[k]+ls[j]>ls[i] and ls[i]!=ls[j] and ls[j]!=ls[k] and ls[k]!=ls[i]:
                            ans+=1
print(ans)

Measured memory_bytes: 9272
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int MAXN=100+10;
int n,m,G[MAXN][MAXN],number,t,sum,line=1,row,dir=1;
inline void read(int &x)
{
	int data=0,w=1;
	char ch=0;
	while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
	if(ch=='-')w=-1,ch=getchar();
	while(ch>='0'&&ch<='9')data=(data<<3)+(data<<1)+(ch^'0'),ch=getchar();
	x=data*w;
}
int main()
{
	read(n);read(m);
	read(t);
	while(t--)
	{
		read(sum);
		number++;
		while(sum--)
		{
			if(dir)row++;
			else row--;
			if(row>m)line++,row--,dir=0;
			if(row<1)line++,row++,dir=1;
			G[line][row]=number;
		}
	}
	for(register int i=1;i<=n;++i)
	{
		for(register int j=1;j<=m;++j)printf("%d ",G[i][j]);
		printf("\n");
	}
	return 0;
}

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

using namespace std;

int main(){
  int n;

  cin >> n;
  cin.ignore();

  int tmp = 1;
  int cnt = 0;

  for(tmp = 1; tmp <= n/10; tmp *= 100){
    cnt += (tmp * 10) - tmp;
  }


  //cout << tmp << endl;

  // 残り何桁？
  int rem_n;
  rem_n = n / tmp;
  if(rem_n == 0){
    cout << cnt << endl;
    return 0;
  }

  cnt += n - tmp + 1;
  cout << cnt << endl;
  return 0;
}


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))
#define each(i, map) for (auto& i : map)

int main()
{
    string S; cin >> S;

    reverse(S.begin(), S.end());
    long long ten = 1, now = 0;
    map<long long, long long> mp; mp[0] = 1;
    for (long long i = 0; i < S.size(); i++) {
        now += (((S.at(i) - '0') % 2019) * ten);
        now %= 2019;
        ten *= 10;
        ten %= 2019;
        ++mp[now];
    }

    long long ans = 0;
    for (auto& m : mp) {
        ans += (m.second * (m.second - 1)) / 2;
    }
    cout << ans << endl;
}

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

const int N = 200050;
typedef long long  ll;

ll H[N];
ll B[N];
ll tree[4*N];
int n;

void update(int nd,int s,int e,int i,ll v)
{
    if(s>i || e<i) return;
    if(s>=i && e<=i)
    {
        tree[nd]=max(tree[nd],v);
        return;
    }
    int mid=(s+e)/2,l=2*nd,r=l+1;
    update(l,s,mid,i,v);
    update(r,mid+1,e,i,v);
    tree[nd]=max(tree[l],tree[r]);
}

ll query(int nd,int s,int e,int i,int j)
{
    if(s>j || e<i) return 0;
    if(s>=i && e<=j) return tree[nd];
    int mid=(s+e)/2,l=2*nd,r=l+1;
    return max(query(l,s,mid,i,j),query(r,mid+1,e,i,j));
}

int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++) scanf("%lld",&H[i]);
    for(int i=1; i<=n; i++) scanf("%lld",&B[i]);
    ll ans=0;
    for(int i=1; i<=n; i++)
    {
        ll ret=query(1,1,n,1,H[i]);
        ans=max(ans,ret+B[i]);
        update(1,1,n,H[i],ret+B[i]);
    }
    printf("%lld\n",ans);




}


Measured memory_bytes: 9600
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC103_A solver = new ABC103_A();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC103_A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int[] a = new int[3];
            a[0] = in.nextInt();
            a[1] = in.nextInt();
            a[2] = in.nextInt();

            Arrays.sort(a);

            out.print(a[2] - a[0]);

        }

    }
}



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

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        int* array = new int [n];
        for (int i = 0; i < n; i++) {
            cin >> array[i];
        }
        int key;
        cin >> key;
        int count = 0, min = 0, max = n - 1, value = -1;
        while (min <= max) {
            value = array[(max + min) / 2];
            count++;
            if (key < value) {
                max = (max + min) / 2 - 1;
            } else if (key > value) {
                min = (max + min) / 2 + 1;
            } else {
                break;
            }
        }
        cout << count << endl;
        delete[] array;
    }
}

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

int main() {
	int n, mn = 100001;
	cin >> n;

	for (int i = 1; i <= n / 2 + 1; i++) {
		int sum = 0;
		int a = i;
		int b = n - i;
		while (a != 0) {
			sum += a % 10;
			a /= 10;
		}
		while (b != 0) {
			sum += b % 10;
			b /= 10;
		}
		if (sum < mn) mn = sum;
	}
	cout << mn << endl;
	return 0;
}

Measured memory_bytes: 256
S = input()
cost = 0
for i in range(len(S)):
    if i%2 == 1 and S[i] == 'R':
        cost += 1
    elif i%2 == 0 and S[i] == 'L':
        cost += 1
if cost == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
a, b = input().split()
a = int(a)
b_i = int(b[:-3])
b_f = int(b[-2:])
if b_f == 0:
  print(a*b_i)
  exit()
b_m = a*b_f
if b_m < 100:
  print(a*b_i)
  exit()
print(a*b_i + int(str(b_m)[:-2]))

Measured memory_bytes: 9192
import java.util.Scanner;

public class Main
{
	public static void main(String arg[])
	{
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext())
		{
			String str = sc.next();
			int jo=0;
			int io=0;
			for(int i=0; i<str.length()-2; i++)
			{
				if(str.charAt(i)=='J')
					if(str.charAt(i+1)=='O')
						if(str.charAt(i+2)=='I')
							jo++;	
				if(str.charAt(i)=='I')
					if(str.charAt(i+1)=='O')
						if(str.charAt(i+2)=='I')
							io++;	
			}
			System.out.println(jo);
			System.out.println(io);
		}
	}

}

Measured memory_bytes: 12000
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define MAXCOST 50000
double dp[51][MAXCOST+1];
int v[4];
struct INFO{
	int type,val;
	INFO(){type=0;val=0;};
};
INFO mass[51]; 

int main(){
	int x,y,z;
	while(cin >> x >> y >> z , x){
		rep(i,51)mass[i] = INFO();
		rep(i,51)rep(j,MAXCOST+1)dp[i][j] = 0;
		rep(i,x)cin >> v[i];
		
		int mxcost = 0;
		
		rep(i,z){
			int N;
			cin >> N;
			cin >> mass[N].type >> mass[N].val;
			if(mass[N].type == 2)mxcost += mass[N].val;
		}
		double baseProb = 1.0/x;
		dp[0][0] = 1;
		for(int pos = 0; pos < y ; pos++){
			for(int cost = 0 ; cost <= mxcost ; cost++){
				rep(i,x){
					int nextPos = pos+v[i];
					if(nextPos > y)nextPos = y;

					if(mass[nextPos].type == 0){
						dp[nextPos][cost] += dp[pos][cost] * baseProb;
					}					
					if(mass[nextPos].type == 1){
						int newPos = nextPos + mass[nextPos].val;
						if(newPos > y)newPos = y;
						dp[newPos][cost] += dp[pos][cost] * baseProb;
					}
					if(mass[nextPos].type == 2){
						int newCost = mass[nextPos].val + cost;
						dp[nextPos][newCost] += dp[pos][cost] * baseProb;
					}
					if(mass[nextPos].type == 3){
						int newCost = cost - mass[nextPos].val;
						if(newCost < 0)newCost = 0;
						dp[nextPos][newCost] += dp[pos][cost] * baseProb;
					}
				}
			}
		}
		double sum = 0;
		for(int i = 0; i <= mxcost ;i++){
			sum += dp[y][i] * i;
		}
		cout << (int)sum << endl;	
	}
}

Measured memory_bytes: 20000
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int n,mi=10000000,ma=-10000000;
    long long sum=0;
  cin >> n;
  int i,b;
  for(i=0;i<n;i++){
    cin >> b;
    mi=min(mi,b);
    ma=max(ma,b);
    sum+=b;
  }
  cout << mi <<  " " << ma << " " << sum << endl;
  return 0;
}



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

int main() {
  int n;
  ll d;
  cin >> n >> d;
  
  int ans = 0;
  
  rep(i, n){
    ll x, y;
    cin >> x >> y;
    if(x*x + y*y <= d*d)
      ans++;
  }
  
  cout << ans << endl;

}

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename A>
void UNIQUE(vector< A > &a,int mode=0){
    if(mode==0){ sort(ALL(a),greater< A >());}else{ sort(ALL(a));}
    a.erase(unique(ALL(a)),a.en());
}

int main(){
    LL n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    Vi l(q),r(q);
    REP(i,q){
        cin>>l[i]>>r[i];
        l[i]--;
        r[i]--;
    }
    
    Vll cnt_AC(s.size()+1);
    REP(i,s.size()){
        string sub = s.substr(i,2);
        cnt_AC[i+1] = cnt_AC[i] + (sub=="AC");
    }

    REP(i,q){
        cout<<cnt_AC[r[i]] - cnt_AC[l[i]]<<endl;
    }

    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAXN = 1e5 + 50;
bool spe[MAXN];

inline char p(int x) { return x ? 'S' : 'W'; }

int main() {
	int N;
	string S;
	cin >> N;
	cin >> S;
	S += S[0];
	S += S[1];
	for(int s1 = 0; s1 <= 1; s1++) {
		spe[1] = s1;
		for(int s2 = 0; s2 <= 1; s2++) {
			spe[2] = s2;
			for(int j = 2; j <= N; j++) {
				int snxt = spe[j - 1];
				if((spe[j] && S[j] == 'x') || (spe[j] == 0 && S[j] == 'o'))
					snxt ^= 1;
				spe[j + 1] = snxt;
			}
			if(spe[N + 1] != spe[1]) continue;
			int sn2 = spe[N];
			if((spe[1] && S[1] == 'x') || (spe[1] == 0 && S[1] == 'o'))
				sn2 ^= 1;
			if(sn2 != spe[2]) continue;
			putchar(p(spe[N]));
			for(int j = 1; j < N; j++)
				putchar(p(spe[j]));
			puts("");
			exit(0);
		}
	}
	puts("-1");
	return 0;
}


Measured memory_bytes: 640
import sys
from bisect import *

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    m = a[-1] / 2
    i = bisect(a, m)
    d0 = m - a[i - 1]
    d1 = a[i] - m
    if d0 < d1 or i == n - 1:
        print(a[-1], a[i - 1])
    else:
        print(a[-1], a[i])

main()


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

Asum=[0]
for i in A:
  Asum.append(Asum[-1]+i)

s=sum(A)
ans=0

for i,v in enumerate(A):
  ans+=v*(Asum[-1]-Asum[i+1])
  ans%=10**9+7

print(ans)

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

int main(){
	int N;
	cin>>N;
	int t[N+1],x[N+1],y[N+1];
	t[0]=0;
	x[0]=0;
	y[0]=0;
	for(int i=1;i<=N;++i){
		cin>>t[i]>>x[i]>>y[i];
	}
	bool ans=true;
	for(int i=0;i<N;++i){
		if(abs(x[i+1]-x[i])+abs(y[i+1]-y[i])>t[i+1]-t[i] || (abs(x[i+1]-x[i])+abs(y[i+1]-y[i]))%2 != (t[i+1]-t[i])%2)ans=false;
	}
	if(ans==true)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 1536
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <stdarg.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <map>

#define ll long long

using namespace std;

ll mod = 1e9 + 7;

void
solve() {
  ll h, w;
  cin>>h>>w;

  vector<vector<ll>> dp(h, vector<ll>(w, 0));
  vector<string> m(h, "");
  dp[0][0] = 1;
  for (ll i=0; i<h; i++) {
    cin>>m[i];

    for (ll j=0; j<w; j++) {
      if (dp[i][j] == '#') continue;
      if (i==0 && j==0) continue;

      ll v = 0;
      if (j > 0 && m[i][j-1] == '.')
        v += dp[i][j-1];
      if (i > 0 && m[i-1][j] == '.')
        v += dp[i-1][j];
      dp[i][j] = v % mod;
    }
  }
  cout<<dp[h-1][w-1]<<endl;
}

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

  ll t = 1;
  //cin>>t;

  while (t > 0) {
    t--;
    solve();
  }

  return 0;
}



Measured memory_bytes: 12488
#include <cstdio>
#include <algorithm>
using namespace std;
int a[101];
int main(void)
{
	int n, x;
	scanf("%d%d", &n, &x);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	sort(a + 1, a + n + 1);
	int ans = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (x < a[i])
		{
			printf("%d", ans);
			return 0;
		}
		++ans;
		x -= a[i];
	}
	if (x) --ans;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;


void solve()
{
	int n;
	cin>>n;
	map<int,int>cnt;
	rep(i,n-1){
		int a;
		cin>>a;
		a--;
		cnt[a]++;
	}
	rep(i,n){
		cout<<cnt[i]<<endl;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 13032
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
    int N;
    cin >> N;
    int a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    sort(a,a+N);
    int sum=0;
    for(int i=0;i<N-1;i++){
        sum = sum + a[i];
    }
    if(a[N-1]>=sum){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
typedef long long i64;
typedef int *pint;
const int MAXN = 100 + 20;

int a[MAXN], b[MAXN];
int p1, p2;
int M = 100;
i64 N;

int main()
{
	p1 = 0, p2 = 0;
	cin >> N, N++;

	while (N > 1)
	{
		if (N & 1)
			a[++p1] = M, M--, N--;
		else
			b[++p2] = M, M--, N >>= 1;
	}

	cout << ((p1 + p2) << 1) << endl;

	for (int i = 1; i <= p1; i++)
		cout << a[i] << " ";
	for (int i = p2; i >= 1; i--)
		cout << b[i] << " ";
	for (int i = 100 - p1 - p2 + 1; i <= 100; i++)
		cout << i << " ";
	cout << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void alert(vector<int> vec){
  for(int i=0; i<vec.size(); i++){
    cout << vec.at(i) << " ";
  }
  cout << vec.at(vec.size()-1) << endl;
}

int main(){
  int64_t N;
  cin >> N;
  vector<int64_t> X(N), L(N);
  for(int i=0; i<N; i++) cin >> X.at(i) >> L.at(i);
  vector<int64_t> S(N), T(N);
  for(int i=0; i<N; i++){
    S.at(i) = X.at(i) - L.at(i);
    T.at(i) = X.at(i) + L.at(i);
  }
  vector<pair<int64_t,int64_t>> p(N);
  for(int i=0; i<N; i++){
    p.at(i).first = T.at(i);
    p.at(i).second = i;
  }
  sort(p.begin(), p.end());
  int64_t t = T.at(p.at(0).second);
  int64_t s;
  int64_t ans = 1;
  for(int i=1; i<N; i++){
    s = S.at(p.at(i).second);
    if(t<=s){
      t = T.at(p.at(i).second);
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4992
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ll x, y;
    cin >> x >> y;
    int ans=0;
    if(x*y<0) {
        ans++;
        x = abs(x);
        y = abs(y);
        ans += abs(x-y);
    } else {
        if(x>y) {
            ans += 1;
            ans -= y-x;
            if(x != 0 and y != 0) {
                ans += 1;
            }
        } else {
            ans += y-x;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lowbit(i) ((i)&(-(i)))
#define lson(i) ((i)<<1)
#define rson(i) ((i)<<1|1)
#define fi first
#define se second
#define m_p(x,y) make_pair((x),(y))
using namespace std;

typedef long long ll;typedef unsigned long long ul;
typedef pair<int,int> pii;typedef pair<ll,ll> pll;
typedef vector<string> vss;
typedef vector<int> vii;typedef vector<pii> vpi;
typedef queue<int> qii;typedef queue<pii> qpi;

const int inf=0x3f3f3f3f;
const int maxn=100007;

int n=700;

int main()
{
// 	freopen("","r",stdin);
// 	freopen("","w",stdout);
	char c;
	for(int i=0;i<3;i++){
		c=getchar();
		n+=(c=='o')*100;
	}
	printf("%d",n);
	return 0;
}



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

int main() {
  int N;
  cin >> N;
  LL A[N+1];
  for (int i = 0; i < N+1; i++) {
    cin >> A[i];
  }
  LL B[N];
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  
  LL ans = 0;
  for (int i = N - 1; i >= 0; i--) {
    LL m = min(B[i], A[i+1]);
    B[i] = B[i] - m;
    A[i+1] = A[i+1] - m;
    ans = ans + m;
    m = min(B[i], A[i]);
    B[i] = B[i] - m;
    A[i] = A[i] - m;
    ans = ans + m;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n, k;
    string s;
    cin >> n >> k >> s;
    cout << s.substr(0, k - 1) << (char)('a' + s[k - 1] -'A') << s.substr(k) << endl;
    return 0;
}

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

int main() {
	char c;
    cin >> c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
    	cout << "vowel" << endl;
    }else{
    	cout << "consonant" << endl;
    }
}


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


stack<int> S;
int N;

int main(){
	while (cin >> N) {
		if (N == 0) {
			cout << S.top() << endl;
			S.pop();
		}
		else {
			S.push(N);
		}
	}

	return 0;
}

Measured memory_bytes: 2968
#include <bits/stdc++.h>
using namespace std;
long long x,k,d;
int main(){
	cin>>x>>k>>d;
	x=abs(x);
	if(x/k>=d){
		cout<<abs(x-k*d)<<endl;
	}
	else{
		long long y=x%d;
		long long i=(x-y)/d;
		if((k-i)%2)y=abs(y-d);
		cout<<y<<endl;
	}
	return 0; 
}

Measured memory_bytes: 3632
//abc138_e.cpp
//Sun Aug 18 20:46:18 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

vector<vector<ll> > calcNext(const string &S) {
    ll n = (ll)S.size();
    vector<vector<ll> > res(n+1, vector<ll>(26, n));
    for (int i = n-1; i >= 0; --i) {
        for (int j = 0; j < 26; ++j) res[i][j] = res[i+1][j];
        res[i][S[i]-'a'] = i;
    }
    return res;
}

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

	vector<vector<ll>> next = calcNext(s);

	ll ans = 0;
	int curpos = 0;
	for (int i=0;i<t.length();i++){
		int letter = (int)t[i]-'a';
		if (next[0][letter]==s.length()){
			cout << -1 << endl;
			return 0;
		}else if (next[curpos][letter]>=curpos && 
				  next[curpos][letter]<s.length()){
//			cout << t[i] << " " << next[curpos][letter] << " 0" << endl;
			ans += next[curpos][letter]-curpos+1;
			curpos = next[curpos][letter]+1;
			if (curpos==s.length()){
				curpos = 0;
			}
		}else {
//			cout << t[i] << " " << next[0][letter] << " 1" <<  endl;
			ans += next[0][letter]+1+s.length()-curpos;
			curpos = next[0][letter]+1;
			if (curpos==s.length()){
				curpos = 0;
			}
		}
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1; 
    for(int T = 0; T < t ; T++){
        ll n, ans = 0, k;
        cin >> n >> k;
        ll a[n];
        for(int i = 0 ; i < n ; i++){
            cin >> a[i];
        }
        ll cost[n + 1];
        cost[0] = 0;
        cost[1] = 0;
        cost[2] = abs(a[0] - a[1]);
        for(int i = 3; i <= n; i++){
            ll mn = 1e9 + 1;
            for(int j = i - 1; j >= max(i - k, (ll)1); j--){
                mn = min(mn,cost[j] + abs(a[j - 1] - a[i - 1]));
            }
            cost[i] = mn;
        }
        cout << cost[n] << endl;
    }
    return 0;
}

Measured memory_bytes: 5148
N = int(input())
Alice_total = 0
Bob_total = 0
card_list = input().split()
card_list = [int(n) for n in card_list]
card_list.sort(reverse =True)

for i in range(0,N,2):
    Alice_total += card_list[i]

for i in range(1,N,2):
    Bob_total += card_list[i]

print(Alice_total - Bob_total)

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

using namespace std;

int a,b,c,d;

int main(){
    scanf("%d %d %d %d",&a,&b,&c,&d);
    int count = 1;
    while(1){
        if(a <= 0){
            printf("No\n");
            break;
        }
        if(c <= 0){
            printf("Yes\n");
            break;
        }
        if(count % 2){
            c -= b;
        }else{
            a -= d;
        }
        count++;
    }
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+1;
int m[N],vis[N];
int main(){
    //freopen("input.txt","r",stdin);
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<N;i++)
        m[i] = vis[i] = 0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
    }

    bool check = 0;
    for(int i=2;i<N;i++)
    {   
        if(!vis[i])
        {   
            int count = m[i];
            for(int j = 2*i;j<N;j+=i)
                {vis[j] = 1; count+=m[j];}
            
            if(count > 1)
                {check = 1; break;}
        }
    }
    if(check == 0)
        {cout<<"pairwise coprime"; return 0;}
    int g = a[0];
    for(int i=1;i<n;i++)
        g = __gcd(g,a[i]);
    if(g == 1)
        cout<<"setwise coprime";
    else
        cout<<"not coprime";
    return 0;
    
}

Measured memory_bytes: 15396
#include <iostream>

using namespace std;

int main()
{
	int r, g, b;
	cin >> r >> g >> b;
	int n = 10 * g + b;
	if (n % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

int main(void)
{
    string a,b;
    cin>>a;
    cin>>b;

    int x=a.size();

    int count=0;
    for(int i=0;i<x;i++){
        if(a.at(i)==b.at(i)){
            count++;
        }
        
    }
    if(count==x&&(x+1==b.size())){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;

    

    return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;

    double p = 0; //確率
    int c = 0; //カウンター
    int t = n; //確率未確定の最大値

    do{
        if(t>=k){
            p += (t-k+1)/(n*pow(2,c));
            t = k-1;
        }
        else{
            p = 0;
        }
        if(k==1) break;
        k = (k+1)/2;
        c++;
    }while(1);

    cout << std::setprecision(12) << p << endl;

    return 0;
}

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

typedef long long int   ll;
#define int             ll
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
#define scan(n)         scanf("%lld",&n)
#define pb              push_back
#define PI              3.1415926535897932384626433832795
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]
#define showar0(ar)     for(int i=0;i<n;i++)cout<<ar[i]<<" "
#define showar1(ar)     for(int i=1;i<=n;i++)cout<<ar[i]<<" "
int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}

signed main(){
    int t=1;
//    scan(t)
    while(t--){
        int n;cin>>n;
        cout<<(n+n*n+(n*n*n));
    }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n,m;
  cin >> n >> m;
  vector<P>vec;
  if(n%2){
    for(int l=1,r=n-1;l<=n/2;l++,r--){
      vec.push_back(P(l,r));
    }
  }
  else{
    int l=1,r=n,cnt=1;
    while(cnt<=n/4){
      vec.push_back(P(l,r));
      l++;
      r--;
      cnt++;
    }
    l++;
    while(abs(l-r)>1){
      vec.push_back(P(l,r));
      l++;
      r--;
    }
  }
  rep(i,m){
    cout << vec[i].first << " " <<vec[i].second << endl;
  }
  return 0;     
}


Measured memory_bytes: 5280
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
    if a[i]+a[i+1]>x and a[i]<=x:
        ans+=a[i]+a[i+1]-x
        a[i+1]-=a[i]+a[i+1]-x
    if a[i]+a[i+1]>x and a[i]>x:
        ans+=a[i]+a[i+1]-x
        a[i+1]=0
        a[i]=x
print(ans)

Measured memory_bytes: 14844
from itertools import*
s = list(input())
l = len(s)
p = list(chain.from_iterable(zip(s, " "*l)))[:-1]
S = 0
for i in product([0,1], repeat=~-l):
    q = p[:]
    for k, j in enumerate(i):
        if j:
            q[k*2 + 1] = "+"
    S += eval("".join(q).replace(" ", ""))
print(S)

Measured memory_bytes: 3060
import bisect
import sys
import math
from collections import deque
from heapq import heappush, heappop

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29

DIV = (10**9) + 7
#DIV = 998244353

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac = fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV

    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s += a
        yield s


sys.setrecursionlimit(200005)


def dijkstra(G,start=0):
    heap = []
    cost = [INF]*len(G)
    heappush(heap,(0,start))
    while len(heap)!=0:
        c,n = heappop(heap)
        if cost[n] !=INF:
            continue
        cost[n]=c
        for e in G[n]:
            ec,v = e
            if cost[v]!=INF:
                continue
            heappush(heap,(ec+c,v))
    return cost


def main():
    n=iRaw()
    Ls = isRaw()
    ans = 0
    for l1idx in range(n):
        for l2idx in range(l1idx,n):
            for l3idx in range(l2idx,n):
                l1 = Ls[l1idx]
                l2 = Ls[l2idx]
                l3 = Ls[l3idx]
                if l1 == l2 or l2==l3 or l3==l1:
                    continue
                if l1<l2+l3 and l2 <l1+l3 and l3<l1+l2:
                    ans+=1
    print(ans)     
main()


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

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

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll MOD = 1000000007;

inline ll modpow(ll a, ll n, ll mod) {
    ll ret = 1;
    while (n > 0) {
        if (n & 1) {
            ret *= a;
            ret %= mod;
        }
        a *= a;
        a %= mod;
        n >>= 1;
    }
    return ret;
}

int main() {
    ll N;
    cin >> N;
    ll ans = modpow(10, N, MOD) - 2 * modpow(9, N, MOD) + modpow(8, N, MOD);
    while (ans < 0) ans += MOD;
    ans %= MOD;
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007

bool is_guu(string S) {
	if (S.size() % 2 == 1)return false;
	else {
		bool score = true;
		int div = S.size() / 2;
		for (int i = 0; i < div; i++) {
			if (S[i] == S[div + i]) {
				continue;
			}
			else {
				return false;
			}

		}
		return true;
	}
}

int main() {
	string S;
	cin >> S;
	int score = 0;
	int maxsize = S.size();
	for (int i = 0; i < maxsize; i++) {
		S.pop_back();
		if (is_guu(S)) {
			print(S.size());
			return 0;
		}
	}




	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int N;string S;int K;
cin >>N;cin >>S;cin >>K;
 
for (int i = 0; i < N; i++) {
  if(S.at(i)!=S.at(K-1)){
  S.at(i)='*';
   }
  }
cout << S<< endl;
}

Measured memory_bytes: 256