akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var Xt = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(Math.Max(0, Xt[0] - Xt[1]));
        }
    }
}


Measured memory_bytes: 28116
ctr = 0

def mizuyari(left, right, array):
    # left <= x <= right
    N = right - left
    if N == 0:
        global ctr
        ctr += array[left]
    elif N == 1:
        mini = max(array[left], array[right])
        ctr += mini
        if array[left] != 0:
            array[left] -= mini
        else:
            array[right] -= mini
    else:
        mini = 10000
        mini_index = -1
        for i in range(left, right+1):
            if mini > array[i]:
                mini = array[i]
                mini_index = i
        ctr += mini

        for i in range(left, right+1):
            array[i] -= mini
        
        if left != mini_index:
            mizuyari(left, mini_index-1, array)
        if mini_index != right:
            mizuyari(mini_index+1, right, array)


def solve_C():
    n = int(input())
    h = list(map(int, input().split()))

    mizuyari(0, n-1, h)

solve_C()
print(ctr)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long int ll;
using namespace std;
int main()
{
	IOS;
	int t=1;
	//cin >> t;
	while (t--) 
	{
	 ll x,k,d,r,x1,x2;
	 cin>>x>>k>>d;
    if(llabs(x)/d>=k)
    {
    	if(x<0) x=x+k*d;
    	else x=x-k*d;
	}
	else{
		r=llabs(x)/d;
		if(x<0)
		{
			x1=x+r*d;
			x2=x1+d;
			if((k-r)%2==0) x=x1;
			else x=x2;
		}
		else{
			x1=x-r*d;
			x2=x1-d;
			if((k-r)%2==0) x=x1;
			else x=x2; 
		}
	}
	 cout<<llabs(x)<<endl;
	}
}


Measured memory_bytes: 3616
#include <stdio.h>
int divisible(int N);
int main(void){
  int N, judge;
  scanf("%d", &N);
  judge = divisible(N);
  if (judge == 1){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}
int divisible (int N){
  if((N<4)&&(N!=0)){
    return 0;
  }
  else{
    if(N%4==0){
      return 1;
    }
    else{
      return divisible(N-7);
    }
  }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define all(v) (v).begin(),(v).end()
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using int32 = int32_t; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
#define FASTCIN() cin.tie(0);ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
#define DEBUG_IMPORT(file) vs args(argv, argv+argc);str sample = make_sample(args, file);ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#else
#define DEBUG_IMPORT(file)
#endif
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}


int32 main(int32 argc, char* argv[]) {
    FASTCIN();
    DEBUG_IMPORT("sample-1");


    int R; cin>>R;

    double ans = 2*R*M_PI;
    printf("%12.8f\n", ans);


    return 0;
}


Measured memory_bytes: 3780
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;

ll p;

ll pow_ans(ll x, ll nn) {
    ll ress = 1;
    while (nn > 0) {
			if(ress>p) return -1;
        if (nn & 1) { ress *= x; }
        x *= x;
        nn >>= 1;
    }
    return ress;
}

int main(){
	ll n;
	cin>>n>>p;
	ll ans=1;
	if(p==1){
		cout<<ans<<endl;
		return 0;
	}
	if(n==1){
		cout<<p<<endl;
		return 0;
	}
	ll s=pow(p,double(1.0/n));
	s++;
	if(s==1){
		cout<<ans<<endl;
		return 0;
	}
	vector<ll> res;
	vector<bool> is_prime(s + 1, true);
	for (ll pp = 2; pp <= s; pp++) {
      if (!is_prime[pp]) continue;
      // p の倍数を全て消す。
      for (ll k = pp * 2; k <= s; k += pp) is_prime[k] = false;
      res.push_back(pp);
  }
	ll z=0;
	for(ll i=0;z=pow_ans(res[i],n),z>0&&z<=p;){
		if(p%z==0){
			p=p/z;
			ans*=res[i];
		}
		else i++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1528
#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
//#define map map<char,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
const double PI=acos(-1);
using namespace std;

int main() {
    ll N;
    cin>>N;
    vec A(N);
    ll count=0;
    map<ll,ll> B; 
    rep(i,0,N) {
        cin>>A[i];
        count+=A[i];
        B[A[i]]+=1;
        }

    ll M;
    cin>>M;
    rep(i,0,M) {
        ll a,b;
        cin>>a>>b;
        count+=(b-a)*B[a];
        cout<<count<<endl;
        B[b]+=B[a];
        B[a]=0;
        }


        }




Measured memory_bytes: 10048
#include <bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,c;
  string s[256];
  cin>>a>>b;
  for(int i=0;i<a;i++){
    cin>>s[i];
  }
  sort(s,s+a);
  for(int i=0;i<a;i++){
    cout<<s[i];
  }
  cout<<"\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int n;
  while(cin>>n) {
    for(int i=0; i<10; i++) {
      if(n&1) {
    cout << (1<<i);
    if(n>>1) cout << " ";
      }
      n >>= 1;
    }
    cout << endl;
  }
  return 0;
}


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

const int maxn = 210000;

int n,m,d[maxn];
struct edge{int y,nex;}a[maxn<<1]; int len,fir[maxn];
inline void ins(const int x,const int y){a[++len]=(edge){y,fir[x]};fir[x]=len;}

int fa[maxn],dep[maxn];
void dfs(const int x)
{
    for(int k=fir[x],y=a[k].y;k;k=a[k].nex,y=a[k].y) if(y!=fa[x])
        dep[y]=dep[x]+1,fa[y]=x,dfs(y);
}

int col[maxn];
struct node{int d,x;};
inline bool operator <(const node x,const node y){return x.d<y.d;}
priority_queue<node>q;
bool Col()
{
    for(int i=1;i<=n;i++) q.push((node){dep[i],i});
    memset(col,-1,sizeof col);
    while(!q.empty())
    {
        const node now=q.top(); q.pop();
        int x=now.x;
        if(col[x]!=-1) continue;
        if(x==1) {col[x]=0;return true;}
        if(col[fa[x]]!=-1) return true;
        col[fa[x]]=0;
        col[x]=1;
        d[fa[x]]=1;
    }
    return false;
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<n;i++)
    {
        int x,y; scanf("%d%d",&x,&y);
        ins(x,y); ins(y,x);
    }
    dep[1]=1; dfs(1);
    if(Col()) return puts("First"),0;
   // for(int i=1;i<=n;i++) if(!col[i]&&!d[i]) return puts("First"),0;
    puts("Second");

    return 0;
}
/*
3
1 2
2 3
*/

Measured memory_bytes: 7284
<?php

//$_input = explode(
//    "\n",
//    '2
//5 1 1
//100 1 1
//'
//);

function getNext() {
    return trim(
        isset($GLOBALS['_input'])
            ? array_shift($GLOBALS['_input'])
            : fgets(STDIN)
    );
}

$planCount = (int) getNext();
$plans = [];
for ($i = 0; $i < $planCount; ++$i) {
    $temp = explode(' ', getNext());
    $plans[] = [
        't' => (int) $temp[0],
        'x' => (int) $temp[1],
        'y' => (int) $temp[2],
    ];
}

usort($plans, function ($a, $b) {
    if ($a['t'] === $b['t']) {
        return 0;
    }

    return ($a['t'] < $b['t']) ? -1 : 1;
});

$lastTime = 0;
$lastPosX = 0;
$lastPosY = 0;

foreach ($plans as $plan) {
    $diffTime = $plan['t'] - $lastTime;
    $diffX = abs($plan['x'] - $lastPosX);
    $diffY = abs($plan['y'] - $lastPosY);

    if (
        $diffX + $diffY > $diffTime
        ||  ($diffTime - ($diffX + $diffY)) % 2 === 1
    ) {
        echo "No\n";
        exit();
    }

    $lastTime = $plan['t'];
    $lastPosX = $plan['x'];
    $lastPosY = $plan['y'];
}

echo "Yes\n";


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

using namespace std;


using int64 = long long;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {
  int N;
  cin >> N;
  int64 d[22][22] = {{}};
  int64 ret = 0;
  for(int i = 0; i < N; i++) {
    string s;
    cin >> s;
    string x, y;
    if(s.find('.') != string::npos) {
      int pos = s.find('.') + 1;
      for(int k = pos; k < s.size(); k++) {
        y += s[k];
      }
    } else {
      y = "0";
    }
    while(y.size() < 10) y += "0";
    for(int k = 0; k < s.size(); k++) {
      if(s[k] == '.') break;
      x += s[k];
    }

    int64 ue = stoll(x);
    ue *= 10000000000LL;
    int64 sita = stoll(y);

    ue += sita;

    int64 latte = 0, malta = 0;
    while(ue % 2 == 0) {
      ++latte;
      ue /= 2;
    }
    while(ue % 5 == 0) {
      ++malta;
      ue /= 5;
    }
    for(int j = 0; j <= 20; j++) {
      for(int k = 0; k <= 20; k++) {
        if(min(j + latte, k + malta) >= 20) {
          ret += d[j][k];
        }
      }
    }

    d[min(latte, 20LL)][min(malta, 20LL)]++;
  }
  cout << ret << "\n";
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main(){
    ll n,m;
    cin >> n >> m;
    ll cnt = 0;
    ll c = n;

    if(2*n>m){
        cout << m/2 << endl;
        return 0;
    }

    cnt += n;
    m -= 2*n;
    cnt += m/4;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


signed main(){
    int n;
    cin >> n;
    int A[n],mi = llong(1e15),su = 0;
    REP(i,n){
        scanf("%lld",&A[i]);
        mi = min(abs(A[i]),mi);
        su += abs(A[i]);
    }

    REP(i,n-1){
        if(A[i] < 0){
            A[i] *= -1;
            A[i +1] *= -1;
        }
        else if(A[i] ==0){
            cout << su << endl;
            return 0;
        }
    }
    if(A[n-1] >=0) cout << su << endl;
    else cout << su - 2 * mi << endl;



}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
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 (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

map<int, int> prime_factors(ll n) {
	map<int, int> res;
	if(n == 1) { // n=1 の素因数分解は n^1
		res[n] = 1;
		return res;
	}
	for(ll i = 2, _n = n; i*i <= _n; ++i) {
		while(n % i == 0) {
			++res[i]; // 素因数i^{res[i]}
			n /= i;
			}
		}
	if(n != 1) res[n] = 1; // nが素数のとき
	return res;
}

const int MAXN = (int)1e6;

int main() {
    ll n; cin >> n;
    map<int, int> pfs = prime_factors(n);
    int ans = 0;
    for(const auto& p: pfs) {
        int num = p.fi, tot = p.se;
        if (num==1) continue;
        debug(num, tot);
        int cnt = 1;
        while(tot-cnt>=0) {
            if (tot-cnt>=0) {
                tot-=cnt;
            }
            cnt++;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>

int main()
{
  long long s;
  std::cin >> s;
  long long max = 1000000;
  long long store[max];
  long long i = 0;
  store[0] = s;

  while (true) {
    if ( s % 2 == 0 ) {
      s /= 2;
    } else {
      s = 3 * s + 1;
    }
    i++;
    store[i] = s;

    for ( int j = 0; j < i; j++ ) {
      if ( store[j] == store[i] ) {
        std::cout << i+1 << std::endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad (unless)
import Data.List (unfoldr, sort)
import Data.IntMap (IntMap)
import qualified Data.IntMap as IM

main :: IO ()
main = do
  [a, l] <- map read <$> words <$> getLine
  unless (a == 0 && l == 0) $ do
    putStrLn $ solve a l
    main

solve :: Int -> Int -> String
solve a l = f 1 (IM.singleton a 0) a
  where f i mp x = let ys = sort $ toL x l
                       mx = frL ys
                       mn = frL $ reverse ys
                       z = mx - mn
                   in case IM.lookup z mp of
                       Just j -> unwords $ map show $ [j, z, i-j]
                       Nothing -> f (i+1) (IM.insert z i mp) z

toL x l = unfoldr f (x, l)
  where f (x, l) | l == 0 = Nothing
                 | otherwise = let (q, r) = divMod x 10
                               in Just (r, (q, l-1))

frL = foldr f 0
  where f x a = 10 * a + x



Measured memory_bytes: 4096
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	vector<int> conw, conh;
    map<pair<int,int>,int> mp;
    priority_queue<pair<int,int>> Q;
    int H, W, M;
    int ans = 0;
    
    cin>>H>>W>>M;
    
    conw.resize(W+1);
    conh.resize(H+1);
    
    for(int i = 0; i < M; i++){
        int h, w;
        
        cin>>h>>w;
        
        mp[{h, w}]++;
        conh[h]++;
        conw[w]++;
    }
	
    for(int i = 1; i <= H; i++){
        if(conh[i]) {
            Q.push({conh[i], i});
        }
    }
    
    for(int i = 1; i <= W; i++){
        priority_queue<pair<int,int>> Q2;
        pair<int,int> p = {-1, -1};
        pair<int,int> p2 = {-1, -1};
        
        while(Q.size()){
            p = Q.top();
            if(mp.count({p.second, i})) {
                Q2.push(p);
                Q.pop();
                p = {-1,-1};
            } else break;
        }
        
        if(Q2.size())p2 = Q2.top();

        ans = max(ans, conw[i] + p.first);
        
        ans = max(ans, conw[i] + p2.first - 1);
        
        while(Q2.size()){
            Q.push(Q2.top()); Q2.pop();
        }
    }
	
    cout<<ans<<endl;
    
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  int s = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    s ^= a[i];
  }

  for (int i = 0; i < N; i++) {
    cout << (s ^ a[i]) << " ";
  }
  cout << endl;
}


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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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

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; }

void Main(){
    int a,b,c,k; cin >> a >> b >> c >> k;
    int t = 0;
    while(b<=a){
        b *= 2;
        t++;
    }
    while(c<=b){
        c *= 2;
        t++;
    }
    cout << (t<=k ? "Yes" : "No") << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 3632
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

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

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b - a == c - b)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int BFS(vector<vector<int>>& A,int u,int v){
	int H=A.size(),W=A[0].size();
	vector<vector<int>> F(H,vector<int>(W,-1));
	REP(i,H){
		REP(j,W){
			if(A[i][j]) F[i][j]=0;
		}
	}
	queue<int> Q;
	F[v][u]=0;
	if(!A[v][u]) Q.push(u+v*W);
	int ans = 0;
	while(!Q.empty()){
		auto p=Q.front();Q.pop();
		int x=p%W,y=p/W;
		if(x>0 && F[y][x-1]<0){
			F[y][x-1] = F[y][x]+1;
			ans = max(ans,F[y][x]+1);
			Q.push(x-1+y*W);
		}
		if(x<W-1 && F[y][x+1]<0){
			F[y][x+1] = F[y][x]+1;
			ans = max(ans,F[y][x]+1);
			Q.push(x+1+y*W);
		}
		if(y>0 && F[y-1][x]<0){
			F[y-1][x] = F[y][x]+1;
			ans = max(ans,F[y][x]+1);
			Q.push(x+(y-1)*W);
		}
		if(y<H-1 && F[y+1][x]<0){
			F[y+1][x] = F[y][x]+1;
			ans = max(ans,F[y][x]+1);
			Q.push(x+(y+1)*W);
		}
	}
	return ans;
}

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

	ll H=in(),W=in();
	vector<vector<int>> A(H,vector<int>(W,0));
	REP(i,H){
		string S=in<string>();
		REP(j,W){
			if(S[j]=='#') A[i][j]=1;
		}
	}

	int ans = 0;
	REP(i,H){
		REP(j,W){
			ans = max(ans,BFS(A,j,i));
		}
	}
	out(ans);
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

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

        public void Solve(ConsoleInput cin)
        {
            var n = cin.ReadInt;
            int maxi = 0;
            int sum = 0;
            for (int i = 0; i < n; i++)
            {
                var x = cin.ReadInt;
                sum += x;
                maxi = Max(maxi, x);
            }
            sum -= maxi / 2;
            Console.WriteLine(sum);
            return;
        }
    }

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



Measured memory_bytes: 13268
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int n;
	while(cin>>n)
	{
		int i,j,num=0;
		for(i=1;i<=n;i++)
		{
			int cnt=0;
			if(i%2==1)
			{
				for(j=1;j<=i;j++)
				{
					if(i%j==0)
						cnt++;
				}
				if(cnt==8)
					num++;
			}
			
		}
		cout<<num<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int MAXN = 2e3 + 5;
const ll linf = 0x3f3f3f3f3f3f3f3f;

inline void chk_max(ll &a,ll b){ if(a<b) a=b;}
inline int Abs(int x){ return x<0? -x: x;}

struct Node
{
	int val,id;
}a[MAXN];
inline bool cmp(const Node &p,const Node &q){ return p.val==q.val? p.id>q.id: p.val>q.val;}

int fst[MAXN],lst[MAXN];
ll f[MAXN][MAXN],lval[MAXN],rval[MAXN],pre[MAXN],suf[MAXN];

int main(void)
{
	int n;
	scanf("%d",&n);
	for(int i=1; i<=n; ++i)
		scanf("%d",&a[i].val),
		a[i].id=i;
	
	sort(a+1,a+n+1,cmp);
	
	lst[n]=n;
	for(int i=n-1; i>=1; --i)
	{
		if(a[i].val==a[i+1].val) lst[i] = lst[i+1];
		else lst[i]=i;
	}
	fst[1]=1;
	for(int i=2; i<=n; ++i)
	{
		if(a[i].val==a[i-1].val) fst[i] = fst[i-1];
		else fst[i]=i;
	}
	
	for(int i=1,j=1; i<=n; i=j)
	{
		while(j<=n && a[i].val==a[j].val) ++j;
		
		for(int k=0; k<i; ++k)
		{
			int l = k+1;
			int r = n-(i-1-k);
			
			for(int kk=i; kk<j; ++kk)
			{
				int x=kk-i, y=j-kk-1;
				lval[kk-i+1] = (ll)a[kk].val * Abs(a[kk].id - (l+x));
				rval[kk-i+1] = (ll)a[kk].val * Abs(a[kk].id - (r-y));
			}
			
			int len = j-i;
			pre[0]=0;
			for(int kk=1; kk<=len; ++kk) pre[kk] = pre[kk-1] + lval[kk];
			suf[len+1]=0;
			for(int kk=len; kk>=1; --kk) suf[kk] = suf[kk+1] + rval[kk];
			
			for(int kk=0; kk<=len; ++kk)
				chk_max(f[j-1][k+kk], f[i-1][k] + pre[kk] + suf[kk+1]);
		}
	}
	
	ll ans=0;
	for(int i=0; i<=n; ++i) chk_max(ans,f[n][i]);
	printf("%lld",ans);
	return 0;
}

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

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(v1, v2)     cout << v1 << " " << v2 << endl
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << endl
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << endl

//----------------------------------------------------------------

int main(void) {
  int n;
  cin >> n;
  vpair student(n);

  rep(i,n){
    int tmp;
    cin >> tmp;
    student[i] = make_pair(tmp, i+1);
  }

  sortall(student);

  rep(i,n){
    cout << student[i].second;
    if(i!=n-1){cout << " ";}
  }
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

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

    if(N == 1){
        cout << 1 << endl;
        return 0;
   }

    int min_length = INF;
    for(ll i = 1; i < N; ++i){
        if(i*i > N) break;
        if(N % i == 0){
            string s1 = to_string(i);
            string s2 = to_string(N/i);
            int f = max(s1.size(), s2.size());
            min_length = min(f, min_length);
        }
    }
    cout << min_length << endl;
    return 0;
}

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

int main()
{
    int a,b,c;
    cin >> a >> b >>c;

    if(a == b && a != c){
        cout << "Yes" << endl;
        return 0;
    }

    if(a == c && a != b){
        cout << "Yes" << endl;
        return 0;
    }

    if(b == c && b != a){
        cout << "Yes" << endl;
        return 0;
    }
        
    cout << "No" << endl;

}

Measured memory_bytes: 256
from collections import deque
S = input()
Q = int(input())
d = deque()
d.append(S)
reverse = False
for _ in range(Q):
    tmp = input().split()
    q = int(tmp[0])
    if q == 1:
        reverse = not reverse
    elif q == 2:
        f = int(tmp[1])
        if f == 1:
            if reverse:
                d.append(tmp[2])
            else:
                d.appendleft(tmp[2])
        elif f == 2:
            if reverse:
                d.appendleft(tmp[2])
            else:
                d.append(tmp[2])
S = "".join(d)
if reverse:
    print(S[::-1])
else:
    print(S)

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

n, m = map(int, input().split())

l = []
r = []
for _ in range(m):
    templ, tempr = map(int, input().split())
    l.append(templ)
    r.append(tempr)

pass_min = 1
pass_max = n

for li, ri in zip(l, r):
    if li > pass_min:
        pass_min = li
    if ri < pass_max:
        pass_max = ri
        
if pass_max >= pass_min:
    print(pass_max - pass_min + 1)
else:
    print(0)

Measured memory_bytes: 10996
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set> 
#include <bitset>
#include <cmath>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)

int main () {
    
    int a, b;

    cin >> a >> b;

    REP(i,3) {
        if(a * b * (i+1) % 2 == 1) {
            cout << "Yes" << endl;
            return 0;
        } 
    }
    
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k;
  string s;
  cin>>k>>s;
  if(s.size()<=k){
    cout<<s<<endl;
  }
  else{
    for(int i=0;i<k;i++){
      cout<<s.at(i);
    }cout<<"..."<<endl;
  }
}




Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  string s;
  cin >> s;

  int aIndex = 0;
  int zIndex = 0;

  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A') {
      aIndex = i;
      break;
    }
  }

  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == 'Z') {
      zIndex = i;
      break;
    }
  }

  cout << zIndex - aIndex + 1 << endl;

  return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <cmath>
 
using namespace std;
 
// typedef
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<string> vs;
 
// container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for (typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
// repetition
#define FOR(i,m,n) for (ll (i) = ((ll) m); (i) < ((ll) n); ++(i))
#define RFOR(i,m,n) for (ll (i) = ((ll) (m)-1); (i) >= ((ll) n); --(i))
#define REP(i,n) FOR(i,0,n)
 
// i/o
#define TFOUT(b,t,f) cout << ((b)? (t) : (f)) << endl
 
//constant
const double    EPS     = 1e-10;
const double    PI      = acos(-1.0);
const int       INFTY   = (1<<21);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

ll gcd(ll a, ll b) {
    if (a < b) {
        ll temp = a;
        a = b;
        b = temp;
    }

    while(a % b != 0) {
        ll r = a % b;
        a = b;
        b = r;
    }
    return b;
}

bool solve(const vll& a, ll g, ll k) {
    if (g > k || k % g != 0) return false;
    k /= g;
    return *max_element(ALL(a)) >= k;

}

int main() {
    ll n, k; cin >> n >> k;
    vll a;
    REP(i, n) {
        ll e; cin >> e;
        a.push_back(e);
    }
    ll g = a[0];
    FOR(i, 1, n) {
        g = gcd(a[i], g);
    }
    REP(i, n) a[i] /= g;
    cout << (solve(a, g, k)? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

Measured memory_bytes: 1400
let rec upper_bound l r p =
  if r <= 1 + l
  then l
  else let m = (l + r) / 2 in
       if p m
       then upper_bound m r p
       else upper_bound l m p

let () = Scanf.scanf "%d" @@ fun n ->
  let m = upper_bound 0 (n + 1) @@ fun m -> m * m <= n in
  Printf.printf "%d\n" @@ m * m

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
constexpr ll mod[2] = {1000000007,998244353},z = 100;
map<pll,int> mp;
string s;
vector<ll> trans(string t){
	int i,n = t.size();
	vector<ll> v;
	for(i=0;i<n;i++){
		v.push_back(t[i] - 'a' + 1);
	}
	return v;
}
vector<vector<ll>> pre(string t){
	int i,j,n;
	vector<ll> v = trans(t);
	n = v.size();
	vector<vector<ll>> w(2,vector<ll>(n + 1,0));
	for(i=1;i<=n;i++){
		for(j=0;j<2;j++){
			w[j][i] = (w[j][i-1]*z + v[i-1])%mod[j];
		}
	}
	return w;
}
ll ex[5010][2];
vector<vector<ll>> v;
ll rolling_hash(int l, int r){//[l,r]
	ll x = (v[0][r] - ex[r - l + 1][0]*v[0][l - 1]%mod[0] + mod[0])%mod[0];
	ll y = (v[1][r] - ex[r - l + 1][1]*v[1][l - 1]%mod[1] + mod[1])%mod[1];
	return y;
	//return {x,y};
}
int n;
int ch(int i,int j){
	int l = 0,r = min(n - j,j - i - 1);
	if(rolling_hash(i,i + r)==rolling_hash(j,j + r)) return r + 1;
	while(r - l>1){
		int mid = (l + r)/2;
		if(rolling_hash(i,i + mid)==rolling_hash(j,j + mid)) l = mid;
		else r = mid;
	}
	return r;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int i,j,ans = 0;
	cin >> n >> s;
	v = pre(s);
	ex[0][0] = 1; ex[0][1] = 1;
	for(i=0;i<n;i++){
		for(j=0;j<2;j++){
			ex[i + 1][j] = 100*ex[i][j]%mod[j];
		}
	}
	for(i=0;i<n;i++){
		for(j=i + 2;j<n;j++){
			if(s[i]==s[j]) ans = max(ans,ch(i,j));
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define itn int


int main(void){
    int n,q;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++)cin >> a[i];
    cin >> q;
    int b[q],c[q];
    for(int i = 0;i < q;i++)cin >> b[i] >> c[i];
    
    map<long long,long long> mp;
    long long sum = 0;
    for(int i = 0;i < n;i++){
        mp[a[i]]++;
        sum += a[i];
    }
    for(int i = 0;i < q;i++){
        sum -= b[i]*mp[b[i]];
        sum += c[i]*mp[b[i]];
        mp[c[i]] += mp[b[i]];
        mp[b[i]] = 0;
        cout << sum << endl;
    }
    
}

Measured memory_bytes: 10688
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <cstdio>
#include <iomanip>
using namespace std;
typedef long long ll;

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

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

int main(){
    ll b,c,d,e,k,l,m,n,o=0,p,q,r,z,max1=0,a1,b1;
    string s,t,u;
    ll a[7][7];
    double ans=0;
    cin>>n;
    ll x[n],y[n];
    
    for(ll i=0;i<n;i++){
        cin>>x[i]>>y[i];
    }
    for(ll i=0;i<n;i++){
        for(ll j=i+1;j<n;j++){
        ans+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            o++;
    }
    }
    //for(ll i=1;i<n;i++)o+=i;
    cout<<setprecision(10)<<ans-(ans/o)*(o-n+1)<<endl;
}






Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <complex>
#include <iomanip>
using namespace std;
//using ll = long long;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
int c[50][50];
int visited[50][50];
void init(int h,int w){
    for(int i = 0; i < 50; i++){
        for(int j = 0; j < 50; j++){
            visited[i][j] = false;
            c[i][j] = 0;
        }
    }
}
void dfs(int h,int w,int H,int W){
    visited[h][w] = true;
    for(int i = 0; i < 8; i++){
        int ny = h+dy[i];
        int nx = w+dx[i];
        if (0 <= ny && ny < H && 0 <= nx && nx < W && visited[ny][nx] == false && c[ny][nx] == 1){
            dfs(ny,nx,H,W);
        }
    }
    return;
}
int main(){
    vector<int> ans(0);
    for(;;){
        int H,W; cin >> W >> H;
        if(H == 0 && W == 0) break;
        init(H,W);
        for(int h = 0; h < H; h++){
            for(int w = 0; w < W; w++){
                cin >> c[h][w];
            }
        }
        int cnt = 0;
        for(int h = 0; h < H; h++){
            for(int w = 0; w < W; w++){
                if (c[h][w] == 1 && visited[h][w] == false){
                    dfs(h,w,H,W);
                    cnt++;
                }
            }
        }
        /* 
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                cout << visited[i][j] << " ";
            }
            cout << endl;
        }
        */
        ans.push_back(cnt);
    }
    for(int i = 0; i < ans.size(); i++){
        cout << ans[i] << endl;
    }
}
  




Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int x = A + B;
  int y = C + D;
  if (x > y){
    cout << "Left" << endl;
  }
  else if (x == y){
	cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 3564
S = input()
T = input()
ma = 0
for i in range(len(S)-len(T)+1):
    Ssub = S[i:i+len(T)]
    match = 0
    for j in range(len(T)):
        if Ssub[j] == T[j]:
            match += 1
    if ma < match:
        ma = match
print(len(T)-ma)

Measured memory_bytes: 9020
<?php
fscanf(STDIN, "%s", $S);
fscanf(STDIN, "%d", $Q);
$direction = false;
$array = array_pad(array(), 400000, "");
$array[200000] = $S;
$cursor_l = 199999;
$cursor_r = 200001;
for ($i = 0; $i < $Q; $i++) {
    list($c1, $c2, $c3) = explode(' ', trim(fgets(STDIN)));
    $c2 = intval($c2);
    if ($c1 === "1") {
        $direction = ! $direction;
    } else {
        $num = ($direction === false) + $c2;
        if ($num % 2 === 0) {
            $array[$cursor_l] = $c3;
            $cursor_l--;
        } else {
            $array[$cursor_r] = $c3;
            $cursor_r++;
        }
    }
}
$T = implode('', $array);
if ($direction === true) {
    $T = implode("", array_reverse(str_split($T)));
}
echo $T;

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

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

	vector<int> X(n),Y(n),H(n);
	for(int i=0; i<n; i++) cin >> X[i] >> Y[i] >> H[i];

	set<int> s;
	set<pair<int, int>> t;

	for(int x=0; x<=100; x++){
		for(int y=0; y<=100; y++){
			for(int k=0; k<n; k++){
				if(H[k]==0){
					t.insert({X[k], Y[k]});
					continue;
				}
				s.insert(abs(X[k]-x)+abs(Y[k]-y)+H[k]);
			}
			
			if(s.size()==1){
				bool b = true;
				for(auto z:t){
					if((*begin(s)-abs(z.first-x)-abs(z.second-y))>0){
						b = false;
					}
				}

				if(b){
					cout << x << " "  << y << " " << *begin(s) << endl;
					return 0;
				}
			}
		s.clear();
		t.clear();
		}
	}

	return 0;
}

Measured memory_bytes: 3636
n = int(input())
people = input()
mini = n
for i in range(1,n+1):
    if i ==1:
        left_e = people[:(i-1)].count("E")
        left_w = people[:(i-1)].count("W")
        right_e = people[i:].count("E")
        right_w = people[i:].count("W")
    else:
        if people[i-1] =="E" and people[i-2] =="W":
            right_e = right_e-1
            left_w = left_w+1
        elif people[i-1] =="E" and people[i-2] =="E":
            left_e = left_e +1
            right_e = right_e -1
        elif people[i-1] == "W" and people[i-2] == "E":
            left_e = left_e+1
            right_w = right_w -1
        else:
            left_w = left_w+1
            right_w = right_w -1
    if left_w+right_e < mini:
        mini = left_w+right_e
    #print(left_e, left_w, right_e, right_w)
print(mini)

Measured memory_bytes: 3784
n = int(input())
a = [int(input()) for i in range(n)]
a += [a[-1]]
def end():
    print(-1)
    exit()

if a[0] != 0:
    end()

ans = 0
for i in range(1, n+1):
    if a[i-1]+1 < a[i]:
        end()
    elif a[i-1] + 1 == a[i]:
        continue
    else:
        ans += a[i-1]
print(ans)

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

int main(){
    int n;
    cin >> n;
    int arr[n]={};
    for(int i=0;i<n;i++){
    	cin >> arr[i];
    }
    int dp[n]={};
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(int i=2;i<n;i++){
    	dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
    }
    cout << dp[n-1] << endl;
	return 0;
}

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

using namespace std;

/*****************MACRO*****/

#define ll long long
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

/*******CONSTANT***********/
#define INF (1<<30) //infinity value
#define EPS 1e-9
#define MOD 10000007
#define SIZ 1005
#define PI (acos(-1))


int f(int a)
{
    int val = a;
    while(a){
        val = a;
        a= a/10;
    }
    return val;
}


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cout.tie(0);
    int a[10][10];
    memset(a, 0, sizeof a);
    ///cout<<f(8)<<"\n";
    int n;
    cin>>n;

    ///x = current element
    for(int x= 1; x<= n; x++){
        int last= x%10;
        int first= f(x);
        a[first][last]++;
    }
    /****
    for(int i=0; i<=9; i++){
        for(int j=0; j<=9; j++){
            cout<<a[i][j]<<" ";
        }
        cout<<"\n";
    }
    */


    int ans= 0;


    for(int i=0; i<=9; i++){
        for(int j=0; j<=9; j++){
            ans+= (a[i][j]*a[j][i]);
        }
    }
    cout<<ans<<"\n";

    return 0;
}

/**********************************************************************************


100
0 0 0 0 0 0 0 0 0 0
2 2 1 1 1 1 1 1 1 1
1 1 2 1 1 1 1 1 1 1
1 1 1 2 1 1 1 1 1 1
1 1 1 1 2 1 1 1 1 1
1 1 1 1 1 2 1 1 1 1
1 1 1 1 1 1 2 1 1 1
1 1 1 1 1 1 1 2 1 1
1 1 1 1 1 1 1 1 2 1
1 1 1 1 1 1 1 1 1 2
108

Process returned 0 (0x0)   execution time : 1.199 s
Press any key to continue.





*************************************************************************************/


Measured memory_bytes: 256
s = list(input())
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] not in odd:
            print('No')
            exit()
    else:
        if s[i] not in even:
            print('No')
            exit()
print('Yes')

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

int main() {
    int N, K, Q; cin >> N >> K >> Q;
    vector<int> num(N, 0);
    for (int i = 0; i < Q; ++i) {
        int a; cin >> a; --a;
        num[a]++;
    }

    for (int i = 0; i < N; ++i) {
        if (K - (Q - num[i]) <= 0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}


Measured memory_bytes: 1024
#include <iostream>

typedef long long int lli;

lli n;

int main() {
    std::cin >> n;
    lli ans = 1;
    for (lli i = 1; i * i <= n; ++i) {
        if (n % i == 0) ans = std::max(ans, i);
    }
    printf("%lld\n", (n / ans) + ans - 2);
    return 0;
}

Measured memory_bytes: 256
# BFS, queue
from collections import deque

h, w = map(int, input().split())
s = [input() for _ in range(h)]

# print(s)

inf = 1001001001
di = [0, -1, 0, 1]
dj = [-1, 0, 1, 0]


ans = 0

for si in range(h):
    for sj in range(w):
        if s[si][sj] == "#":
            continue
        dist = [[inf] * w for _ in range(h)]
        q = deque()

        def update(i, j, x):
            if dist[i][j] != inf:
                return
            dist[i][j] = x
            q.append([i, j])

        update(si, sj, 0)
        while q:
            i, j = q.popleft()
            for dir in range(4):
                ni = i + di[dir]
                nj = j + dj[dir]
                if ni < 0 or ni >= h or nj < 0 or nj >= w:
                    continue
                if s[ni][nj] == "#":
                    continue
                update(ni, nj, dist[i][j] + 1)
        for i in range(h):
            for j in range(w):
                if dist[i][j] == inf:
                    continue
                ans = max(ans, dist[i][j])
print(ans)



Measured memory_bytes: 3316
#include <vector>
#include <iostream>
using namespace std;
int a, b, c, d, e, x, y, z;
int main() {
	while(cin >> a >> b >> c >> d >> e, a) {
		cin >> x >> y >> z;
		vector<int> v;
		for(int i = 0; i < z; i++) v.push_back(c);
		for(int i = 0; i < y; i++) v.push_back(b);
		for(int i = 0; i < x; i++) v.push_back(a);
		int g = a * x + b * y + c * z, sum = 0, ret = g;
		for(int i = 1; i <= v.size(); i++) {
			sum += v[i - 1];
			if(i >= d) {
				if(sum > i * e) ret = min(ret, g - (sum - i * e));
			}
			else {
				if(sum > d * e) ret = min(ret, g - (sum - d * e));
			}
		}
		cout << ret << endl;
	}
}

Measured memory_bytes: 6068