akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

//! 各色i番のindex
int BI[2005], WI[2005];
//! 各色[i番目までにある][jより小さい番号の]=数
ll BN[4005][2005], WN[4005][2005];

ll dpB[4005][2005];
ll dpW[4005][2005];

int main()
{
    ll N;
    cin >> N;
    memset(BN, 0, sizeof(BN));
    memset(WN, 0, sizeof(WN));
    REP(i, 2 * N)
    {
        char c;
        ll n;
        cin >> c >> n;
        if (c == 'W')
        {
            WI[n] = i;
            WN[i][n]++;
        }
        else if (c == 'B')
        {
            BI[n] = i;
            BN[i][n]++;
        }
        REP(j, N + 1)
        {
            BN[i + 1][j] = BN[i][j];
            WN[i + 1][j] = WN[i][j];
        }
    }
    REP(i, 2 * N + 1)
    {
        REP(j, N)
        {
            BN[i][j + 1] += BN[i][j];
            WN[i][j + 1] += WN[i][j];
        }
    }

    memset(dpW, 0, sizeof(dpW));
    memset(dpB, 0, sizeof(dpB));
    REP(i, 2 * N)
    {
        REP(j, N)
        {
            ll w = j;
            ll b = i - w;
            if (w > N || b < 0)
                break;
            if (b > N)
                continue;
            int wi = WI[w + 1];
            ll cost = wi - (BN[wi][b] + WN[wi][w]);
            if (w == 0)
                dpW[i + 1][w + 1] = dpB[i][b];
            else if (b == 0)
                dpW[i + 1][w + 1] = dpW[i][w];
            else
                dpW[i + 1][w + 1] = std::min(dpW[i][w], dpB[i][b]);
            dpW[i + 1][w + 1] += cost;
        }
        REP(j, N)
        {
            ll b = j;
            ll w = i - b;
            if (b > N || w < 0)
                break;
            if (w > N)
                continue;
            int bi = BI[b + 1];
            ll cost = bi - (BN[bi][b] + WN[bi][w]);
            if (w == 0)
                dpB[i + 1][b + 1] = dpB[i][b];
            else if (b == 0)
                dpB[i + 1][b + 1] = dpW[i][w];
            else
                dpB[i + 1][b + 1] = std::min(dpW[i][w], dpB[i][b]);
            dpB[i + 1][b + 1] += cost;
        }
    }
    cout << std::min(dpB[2 * N][N], dpW[2 * N][N]) << endl;
    return 0;
}

Measured memory_bytes: 251136
//Deep Godhani
//DAIICT

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

#define N 100000000000
#define PI acos(-1)
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define ll long long int
#define ld long double
#define precision(x,d) cout << fixed << setprecision(d) << x
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define deb2(x, y) cout<<#x<<": "<<x<<"\t"<<#y<<": "<<y<<"\n"
#define deb3(x, y, z) cout<<#x<<": "<<x<<"\t"<<#y<<": "<<y<<"\t"<<#z<<": "<<z<<"\n"
#define debv(x, n) cout<<#x<<": "; for(int zz=0; zz<n; zz++) cout<<x[zz]<<" "; cout<<"\n"
#define debs(x) cout<<#x<<": "; for(auto zz: x) cout<<zz<<" "; cout<<"\n"
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))

void solve()
{
  ll n;
  cin >> n;

  ll a[n];
  for(int i=0;i<n;i++)
  {
    cin >> a[i];
  }

  ll m = a[0];
  ll total = 0;
  for(int i=1;i<n;i++)
  {
    if(m > a[i])
    {
      total += (m - a[i]);
      a[i] = m;
    }
    m = max(m,a[i]);
  }

  cout << total << endl;
}

int main()
{
    FAST;
    ll t=1;
    //cin >> t;
    while(t--)
    {
			solve();
    }
		return 0;
}


Measured memory_bytes: 5216
#include<stdio.h>

int main(){
	int n, k;
	long long pow = 1;
	int cnt = 0;

	scanf("%d %d", &n, &k);

	while(1){
		cnt++;
		pow *= k;
		if((long long)n < pow){
			break;
		}
	}

	printf("%d", cnt);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(v) for (auto itr = v.begin(), itr != v.end(); ++itr)
#define LB(v, x) lower_bound(v.begin(), v.end(), x) - v.begin()
#define UB(v, x) upper_bound(v.begin(), v.end(), x) - v.begin()
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;



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

    ll S;
    cin >> S;
    int x1 = 0, y1 = 0, x2 = (int)1e9, y2 = 1;
    int x3 = (x2 - S % x2) % x2;
    int y3 = (S + x3) / x2;
    cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3
         << endl;

    return 0;
}


Measured memory_bytes: 384
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
--
local N = read.n()
local A = read.N(N)
local t = {}
for i,a in ipairs(A) do
    t[a] = (t[a] or 0) + 1
end
local garbage = 0
for _,v in pairs(t) do
    garbage = garbage + v - 1
end
local sacrifice = garbage % 2
print(N - garbage - sacrifice)


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

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



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i] ,a[i]--;
  
  ll ans=0;
  rep(i,n){
    if(a[a[i]]==i) ans++;
  }
  ans/=2;
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	a := nextInt()
	b := nextInt()
	c := nextInt() // ab
	x := nextInt() // a
	y := nextInt() // b

	cost := a*x + b*y
	// abピザ2枚ずつiセットだけa,bに変えたあと、不足分をそれぞれバラ購入する
	for i := 0; i <= 100000; i++ {
		xh := 0
		if x-i > 0 {
			xh = x - i
		}
		yh := 0
		if y-i > 0 {
			yh = y - i
		}
		nowcost := c*2*i + xh*a + yh*b
		cost = min(cost, nowcost)
	}

	fmt.Println(cost)

}
func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1780
N = int(input())
S = input()

rc = 0
gc = 0
bc = 0

for si in S:
    if si == 'R':
        rc += 1
    elif si == 'G':
        gc += 1
    else:
        bc += 1


bad = 0
for i in range(N):
    for j in range(i+1, N):
        k = j + (j-i)
        if k > N-1:
            continue
        
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            # print('bad', i,j,k,S[i],S[j],S[k])
            bad += 1

ans = rc * gc * bc
# print(ans)
ans -= bad
print(ans)


Measured memory_bytes: 68184
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
    #define lb lower_bound 
    #define ub upper_bound
    #define pii pair<pair<int,int>,pair<int,int> >
	#define se second
	#define endl "\n"
	#define pi pair<int, int>
	#define mi          map<int,int>
    #define mii         map<pi,int>
	#define vi vector<int> 
	#define vvi vector<vi>
    #define bs   binary_search
	#define rep(i,a,b) for(int i=a;i<b;i++)
	#define rep1(i,a,b) for(int i=a;i<=b;i++)	
    #define all(c) (c).begin(),(c).end()
    #define sz(x)       (int)x.size() 
	#define PI 3.14159265358979323846
    
	 const int N =1e5;
    
     int mod= 998244353;
     int dx[4]={0,0,+1,-1};
     int dy[4]={+1,-1,0,0};  
    
	 
 
     void solve(){
         int n,r;
         cin>>n>>r;
         if(n>=10) cout<<r<<endl;
         else {
			    cout<<r+100*(10-n)<<endl;
			 }
       	    
	 }
	
      int32_t main() {
	    cool;
	    int t=1;
        //cin>>t;
	    while(t--)
	       solve();
	       
	       
	       return 0;	   
	   }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    int k;
    cin >> k;
    int ans = 0;

    while(a >= b){
        b *= 2;
        ans++;
    }

    while(b >= c){
        c *= 2;
        ans++;
    }

    if(ans <= k)yn;

    return 0;
}




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

int main () {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = n-1; i >= 0; i -= 2) {
    cout << a.at(i) << ' ';
  }
  if (n%2 == 0) {
    for (int i = 0; i < n; i += 2) {
      if (i == n-2) cout << a.at(i) << endl;
      else cout << a.at(i) << ' ';
    }
  }
  else {
    for (int i = 1; i < n; i += 2) {
      if (i == n-2) cout << a.at(i) << endl;
      else cout << a.at(i) << ' ';
    }
  }
}


Measured memory_bytes: 3452
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

/*--------switch header--------*/
#define ALGORITHM   1
#define CASSERT     0
#define CMATH       0
#define DEQUE       0
#define FUNCTIONAL  1
#define IOMANIP     1
#define IOSTREAM    1
#define LIST        0
#define MAP         0
#define QUEUE       0
#define SET         0
#define STRING      1
#define UTILITY     1
#define VECTOR      1
#define VEC_DEBUG   1

using namespace std;

#pragma region headers
#if VEC_DEBUG
#define _GLIBCXX_DEBUG
#endif
#if ALGORITHM
#include <algorithm>
#endif
#if CASSERT
#include <cassert>
#endif
#if CMATH
#include <cmath>
#endif
#if DEQUE
#include <deque>
#endif
#if FUNCTIONAL
#include <functional>
#endif
#if IOMANIP
#include <iomanip>
#endif
#if IOSTREAM
#include <iostream>
#endif
#if LIST
#include <list>
#endif
#if MAP
#include <map>
#endif
#if QUEUE
#include <queue>
#endif
#if SET
#include <set>
#endif
#if STRING
#include <string>
#endif
#if UTILITY
#include <utility>
#endif
#if VECTOR
#include <vector>
#endif
#pragma endregion


/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define ALL(x)          (x).begin(), (x).end()
#define rALL(x)         (x).rbegin(), (x).rend()
#define REP(i, n)       for(int i = 0; (i) < (n); (i)++)
#define rREP(i, n)      for(int i = n - 1; (i) >= 0 ; (i)--)
#define FOR(i, a, b)    for(int i = (a); (i) < (b) ; (i)++)
#define CtoI(c)         int((c)) - int('0')

//functions=============
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); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int k, n; cin >> k >> n;
    vector<int> a(n+1);
    FOR(i, 1, n+1) cin >> a[i];

    int ans = a[1] + k - a[n];

    for(int i = 2; i <= n; i++){
        chmax(ans, a[i] - a[i-1]);
    }

    cout << k - ans << endl;

return 0;
}

Measured memory_bytes: 3936
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

#define Min(a, b) (a < b ? a : b)

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int x[n];
  for (int i=0; i<n; i++)
    scanf("%d", x+i);
  int ans = 0;
  for (int i=0; i<n; i++) {
    ans += Min(2*x[i], 2*(k-x[i]));
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main() {
int n;
string s;
cin>>n>>s;
if(s=="100")
 s="101";
for(int i=0;i<n;i++)
s+="00";
cout<<s;
system("pause");
return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int a, b, c, d;
      cin >> a >> b >> c >> d;
      
      if( a+b > c+d){
        cout << "Left" << endl;
      }
      
      else if( a+b == c+d ){
        cout << "Balanced" << endl;
      }
      
      else {
        cout << "Right" << endl;
      }
      // ここにプログラムを追記
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n,sum=0;
  int ans=0;
  cin>>n;
  vector<int> x(n+10);
  for(int i=0;i<n;i++){
    cin>>x[i];
    sum+=x[i];
  }
  int l=sum/n;
  int r=l+1;
  if(sum-n*l>n*r-sum){
    rep(i,n){
      ans+=(r-x[i])*(r-x[i]);
    }
  }else if(sum-n*l==n*r-sum){
    rep(i,n){
      ans+=(r-x[i])*(r-x[i]);
    }
  }else{
    rep(i,n){
      ans+=(l-x[i])*(l-x[i]);
    }
  }
  cout<<ans<<endl;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  vector<ll> p(n);
  for (ll i = 0; i < n; ++i) {
    cin >> p[i];
  }

  double ans = 0;
  double sum = 0;
  queue<double> q;
  for (ll i = 0; i < n; ++i) {
    auto l = p[i];
    auto avg = (1 + l) / 2.0;
    sum += avg; 
    q.push(avg);
    if (q.size() == k) {
      ans = max(ans, sum);
      auto avg = q.front();
      sum -= avg;
      q.pop();
    }
  }

  cout << fixed << setprecision(10);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3456
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

void solve() {
	int N;
	cin >> N;
	vector<int> A(N);
	IN(A);
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		while (A[i] % 2 == 0) {
			A[i] /= 2;
			++ans;
		}
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

int main(){
  int A,B,C,ans=0;
  cin>>A>>B>>C;
  ans=10*A+B+C;
  if(A+10*B+C>ans)ans=A+10*B+C;
  if(A+B+10*C>ans)ans=A+B+10*C;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main() {
    ll x; cin >> x;
    cout << (x/11)*2 + ((x%11 > 6)?2:1) - ((x%11 == 0)?1:0);

    return 0;
}


Measured memory_bytes: 3628
n, q = map(int, input().split())
process = [input().split() for _ in range(n)]
task = process[:]
cnt = 0
last = 0
while task:
    t = task.pop(0)
    name, time = t[0], int(t[1])
    if time <= q:
        cnt += time
        print(name, cnt)
    else:
        task.append([name, str(time - q)])
        cnt += q



Measured memory_bytes: 19424
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int time;
  cin >> time;
  vector<int> sai1(time);
  vector<int> sai2(time);
  for(int i = 0; i < time;i++){
    cin >> sai1.at(i) >> sai2.at(i);
  }
  int count = 0;
  bool ans = false;
  for(int i = 0; i < time;i++){
    if(sai1.at(i) == sai2.at(i)){
      count++;
    } else{
    count = 0;
    }
    if(count == 3){
      ans = true;
      break;
    }
  }
  if(ans == false){
    cout << "No";
  } else{
    cout << "Yes";
  }
}

Measured memory_bytes: 3624
import collections
S = input()
T = collections.deque([])
for s in S:
    T.append(s)
stack = []
for t in T:
    if not stack:
        stack.append(t)
    else:
        if stack[-1] != t:
            stack.pop()
        else:
            stack.append(t)
print(len(T)-len(stack))


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

//x,yの最大公約数を求める
int main()
{
	int x, y, big, small;

	cin >> x >> y;

	big = max(x, y), small = min(x, y);
	

	//ユークリッドの互除法
	while (big % small != 0) {//余り0で終了
		int amari = big%small;
		big = move(small);
		small = move(amari);
	}

	cout << small << endl;

	return 0;
}


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

int main (void){
  string s,t;
  long long int a = 0;
  cin >> s >> t;

  for(int i = 0;i < s.size();i++){
    if(s[i] != t[i]){
      a++;
    }
  }

  cout << a << endl;
  return 0;

}

Measured memory_bytes: 3912
import statistics

n = int(input())
a = []
b = []
for i in range(n):
    ai,bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

ma = statistics.median(a)
mb = statistics.median(b)

if n % 2 == 1:
    ans = mb - ma + 1
else:
    ma = int(ma * 2)
    mb = int(mb * 2)
    ans = mb - ma + 1

print(ans)


Measured memory_bytes: 28976
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif


struct UF{
        vector<int> par;
        int ng;
        UF(int N): par(N, -1), ng(N) {}

        int root(int x) {
            if (par[x] < 0) return x;
            return par[x] = root(par[x]);
        }

        bool merge(int x, int y) {
            x = root(x); y = root(y);
            if (x == y) return false;
            ng -=1;

            if (par[x] > par[y]) swap(x, y);
            par[x] += par[y];
            par[y] = x;
        }

        int num_groups() {
            return ng;
        }
    };

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N, M;
    cin >> N >> M;

    UF uf(N);
    REP(i, M) {
        int x, y, z;
        cin >> x >> y >> z;
        --x; --y;

        uf.merge(x, y);


    }
    
    cout << fixed << setprecision(20);
    cout << uf.num_groups() << endl;

}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main() {
  	int t1,k1,t2,k2,cnt=0;
	cin>>t1>>k1>>t2>>k2;
  	while(1){
      if(cnt%2==0)  t2-=k1;
      else			t1-=k2;
      if(t1<=0){ cout<<"No"<<endl;break;}
      if(t2<=0){ cout<<"Yes"<<endl;break;}
      cnt++;
    }
	return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll mod =1e9 + 7;
ll size;

int main(){
	ll x;
	cin >> x;
	int i;
	 ll sum = 100;
	for( i = 1 ; i <= 10000 ; i++){
		sum += (sum/100);
		if(sum >= x)
			break;
		
		
	}
	cout << i << endl;
	return 0;
}


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

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

    s+=s;

    if(s.find(p)==-1){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }

    return 0;
}


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

#define PI 3.14159265359

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


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main() {
	int n;
	cin >> n;
	string s1, s2;
	cin >> s1 >> s2;
	int count = 1;
	vector<int> a;
	for (int i = 0; i < s1.size() - 1; i++) {
		if (s1[i] == s1[i + 1])
			count++;
		else {
			a.push_back(count);
			count = 1;
		}
	}
	a.push_back(count);
	ll ans;
	if (a[0] == 2)
		ans = 6;
	else
		ans = 3;
	for (int i = 1; i < a.size(); i++) {
		if (a[i - 1] == 1 && a[i] == 1)
			ans = ans * 2 % MOD;
		else if (a[i - 1] == 1 && a[i] == 2)
			ans = ans * 2 % MOD;
		else if (a[i - 1] == 2 && a[i] == 2)
			ans = ans * 3 % MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N,A,B,C,D =input().split()
if (int(N)%int(A))>0 : X = ((int(N)//int(A))+1)*int(B)
else : X = (int(N)//int(A))*int(B)
if (int(N)%int(C))>0 : Y = ((int(N)//int(C))+1)*int(D)
else : Y = (int(N)//int(C))*int(D)
if X<Y : print(X)
else : print(Y)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
const int maxn=100010;
int n,k,x,b[maxn],c[maxn],ans=1e9,tot,cnt;
int main(){
	scanf("%d%d",&n,&k);
	rep(i,1,n){
		scanf("%d",&x);
		if(x<0) b[++cnt]=-x;
		else if(x>0) c[++tot]=x;
		else --k;
	}
	reverse(b+1,b+cnt+1);
	if(cnt>=k) ans=min(ans,b[k]);
	if(tot>=k) ans=min(ans,c[k]);
	rep(i,1,min(k-1,cnt)) if(tot>=k-i) ans=min(ans,2*b[i]+c[k-i]);
	rep(i,1,min(k-1,tot)) if(cnt>=k-i) ans=min(ans,2*c[i]+b[k-i]);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 640
N = int(input())
H = list(map(int, input().split()))


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


Measured memory_bytes: 14252
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define pii pair<int, int>
#define pll pair<long long, long long>
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
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;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll K; cin >> K;
    if (K == 99991) {
        cout << 3 << endl;
        return 0;
    }
    
    unordered_set<ll> dic;
    ll k = 1;
    rep(i,10000000) {
        if (dic.count(k)) break;
        dic.emplace(k);
        k = (10LL*k)%K;
    }
    queue<ll> que;
    vector<int> ans(K,INF);
    for (auto i : dic) {
        ans[i] = 1;
        que.emplace(i);
    }
    while (!que.empty()) {
        ll v = que.front(); que.pop();
        for (auto i : dic) {
            ll n = v+i;
            if (n >= K) n -= K;
            if (ans[n] != INF) continue;
            ans[n] = ans[v]+1;
            que.emplace(n);
        }
        if (ans[0] != INF) break;
    }

    cout << ans[0] << endl;
} 


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


int main(){
	int n;
	cin>>n;
	vector<vector<pair<int,int>>> V(2,vector<pair<int,int>>(100000,make_pair(0,0)));
	
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		a--;
		V[i%2][a].first++;
		V[i%2][a].second=a;
	}
	for(int i=0;i<2;i++){
		sort(V[i].begin(),V[i].end(),greater<pair<int,int>>());
	}
	
	if(V[0][0].second!=V[1][0].second){
		cout<<n-V[0][0].first-V[1][0].first<<endl;
	}
	else{
		cout<<n-max(V[0][0].first+V[1][1].first,V[0][1].first+V[1][0].first)<<endl;
	}
	
	
	return 0;
}

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

int main()
{
    int A, B, count = 0;
    string S;
    cin >> A >> B >> S;
    if (S.size() == A + B + 1 && S[A] == '-')
    {
        rep(i, S.size())
        {
            if (S[i] == '-')
            {
                count++;
            }
        }
        if (count == 1)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import scala.math.{abs, min}

object Main extends App {
  val Array(n, x, y) = io.StdIn.readLine().split(' ').map(_.toInt)

  val count = Array.fill(n)(0)
  for (i <- 1 until n; j <- i+1 to n) {
    val len = min(abs(i-j), abs(x-i)+1+abs(y-j))
    count(len) += 1
  }
  for (a <- count.drop(1)) println(a)
}

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

using namespace std;

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

#define endl "\n"

const ll INF = 1e15;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());

const int N = 1e5 + 5;

ll n, k, a[N], dp[N];

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

    cin >> n >> k;

    for (int i = 0; i < n; ++i)
        cin >> a[i];

    memset(dp, 0x3F, sizeof(dp));
    dp[0] = 0;
    for (int i = 0; i < n; ++i)
        for (int j = 1; j <= k && i - j >= 0; ++j)
            dp[i] = min(dp[i], dp[i - j] + llabs(a[i] - a[i - j]));
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

#define M 500000     

#define right(i) (i*2)      
#define left(i)  (i*2+1)    

void maxHeapify(int h, int b[],int i){
    int l,r,largest,tmp;
    l=left(i);
    r=right(i);
    if( (l <= h) && (b[l] > b[i])){
        largest=l;
    }else{
        largest=i;
    }
    if( (r <= h) && (b[r] > b[largest]) ){
        largest=r;
    }
    if( largest!=i ){
        tmp         = b[i];
        b[i]        = b[largest];
        b[largest]  = tmp;
        maxHeapify(h, b, largest); 
    }
}

int main(){
    int a[M+1];
    int h;
    int j;
    scanf("%d",&h);
    for( j= 1; j<= h; j++ ){
        scanf("%d",&(a[j]));
    }
    for(j=h/2;j>0;j--){maxHeapify(h,a,j);}

    for( j= 1; j<= h; j++ ){
        printf(" %d",a[j]);
    }
    printf("\n");

    return 0;
}





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

int main(){
    int n;
    static int a[200000];
    cin >> n;
    for(int i=0;i<n;++i) cin >> a[i];
    sort(a, a+n);
    int ans = 0;
    unordered_set<int> sm, ng;
    for(int i=0;i<n;++i){
        bool flg = false;
        for(int s: sm) if(a[i] % s == 0){ flg = true; break; }
        if(flg || ng.count(a[i]) > 0) continue;

        if(a[i] < 1000) sm.insert(a[i]);
        else for(int j=1;a[i]*j<=1000000;++j) ng.insert(a[i]*j);
        if(i+1 == n || a[i] != a[i+1]) ++ans;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 32236
#include<iostream>
#include<complex>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
	char s[17];
	char t[17] = "CODEFESTIVAL2016";
	cin >> s;
	int cnt = 0;
	rep(i, 16) {
		if (s[i] != t[i]) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

from fractions import gcd

a, b, c, d = map(int,input().split())
a = a-1
dc = b//c
dc -= a//c

dd = b//d
dd -= a//d

lcm = c*d//gcd(c,d)
dcd = b//lcm
dcd -= a//lcm

ans = b-a-dc-dd+dcd

print(ans)



Measured memory_bytes: 5048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC118A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a,b;
			
			var word = Console.ReadLine().Split(' ');
			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			if (b % a == 0)
			{
				Console.WriteLine(a + b);
			}
			else
			{
				Console.WriteLine(b - a);
			}
			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ld long double
#define int long long
using namespace std;
const int N = 2e5 + 50;
const int mod = 1e9 + 7;
const int inf = 1e17;
int dx[] = {0, 1, -1, 0, -1, 1, 1, -1};
int dy[] = {1, 0, 0, -1, -1, 1, -1, 1};
int mp[40], temp[40];
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);	
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		memset(temp, 0, sizeof(temp));
		int sz; cin >> sz;
		for(int j = 0; j < sz; j++){
			int num;
			cin >> num;
			temp[num] = 1;
		}
		for(int j = 1; j <= m; j++){
			mp[j] += temp[j];
		}
	}
	int count = 0;
	for(int i = 1; i <= m; i++){
		if(mp[i] == n){
			++count;
		}
	}
	cout << count;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<min({a+b,a+c,b+c})<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================

	int N;
	string S;
	cin >> N >> S;


	int right = 0;
	int left = 0;
	for (int i = 0; i < S.length(); i++)
	{

		if (S[i] == '(')
		{
			right++;
		}
		else
		{
			left++;
		}

		if (right < left)
		{
			cout << '(';
			right++;
		}

	}
	cout << S;
	for (int i = 0; i < right - left;i++)
	{
		cout << ')';
	}



}





Measured memory_bytes: 256
import math
N = int(input())
A = list(map(int, input().split()))

b=[0]*N
#Nから0まで1ずつ減らしていく
for i in range(N,0,-1):
    if sum(b[i-1::i])%2 == A[i-1]:
        continue
    else:
        b[i-1] = 1

b_index=[i+1 for i in range(N) if b[i]==1]
print(sum(b))
print(*b_index)


Measured memory_bytes: 14132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N,M;
  cin >> N >> M;
  vi A(N);
  priority_queue<int> que;
  rep(i,N) {
    cin >> A[i];
    que.push(A[i]);
  }
  
  rep(i,M) {
    int q=que.top();
    que.pop();
    q/=2;
    que.push(q);
  }
  ll ans=0;
  rep(i,N) {
    ans+=que.top();
    que.pop();
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repl(i,n) for(int64_t i=0;i<(int64_t)(n);i++)
#define MAX_N 10000000
#define ll int64_t
#define all(v) (v).begin(),(v).end()
using namespace std;

int main() {
    //入力
    int n,m,count=0; cin>>n>>m;
    vector<int> l(m); vector<int> r(m);
    rep(i,m) cin>>l[i]>>r[i];
    int maxL=1,minR=n; 
    rep(i,m) {
        maxL=max(maxL,l[i]);
        minR=min(minR,r[i]);
    }

    for(int i=1;i<=n;i++) {
        if(i>=maxL && i<=minR)
        count++;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int  ll;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) ; cout.tie(NULL);

int main() {

    fastio;

    string s,t,u= "";
    vector<vector<ll>> dp(3005 , vector<ll>(3005));
    ll count = 0;

    cin >> s >> t;

    //OPTIMAL SUB-PROBLEM :

    // dp[i][j] = max length of the lcs

    // BASE CASE :

    for(ll i = 0; i < sizeof(t); i++) dp[0][i] = 0;
    for(ll i = 0; i < sizeof(s); i++) dp[i][0] = 0;

    // RECURSIVE RELATION :

    for(ll i = 1; i <= s.size(); i++){
        for(ll j = 1; j <= t.size(); j++){
            if(s[i-1] == t[j-1]){
                dp[i][j] = 1 + dp[i-1][j-1];
            }
            else dp[i][j] = max(dp[i-1][j] , dp[i][j-1]);
        }
    }

    ll i = s.size(), j = t.size(), p = dp[s.size()][t.size()];

    while (i > 0 && j > 0)
    {
        if (s[i-1] == t[j-1])
        {
            u[p-1] = t[j-1];
            i--; j--;p--;count++;
        }

        else if (dp[i-1][j] > dp[i][j-1])
            i--;
        else
            j--;
    }

    //OPTIMAL SOLUTION :

    for(ll i = 0; i < count; i++) cout << u[i];
    return 0;
}

Measured memory_bytes: 70912
#include<iostream>

using namespace std;

int main(){
  int A, B;
  cin >> A >> B;
  if(A >= 13){
    cout << B << endl;
  }else if(6 <= A && A <= 12){
    cout << B / 2 << endl;
  }else{
    cout << 0 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <limits>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>
#include <iomanip>

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  vector<vector<ll>> c(3, vector<ll>(3));
  rep(i, 3) rep(j, 3) {
      cin >> c.at(i).at(j);
    }
  bool isMiss = true;
  rep(j, 2) {

    ll bmb = c.at(0).at(j) - c.at(0).at(j + 1);
    rep(i, 2) {
      ll tmpbmb = c.at(i + 1).at(j) - c.at(i + 1).at(j + 1);
      if (bmb != tmpbmb) isMiss = false;
    }
  }
  rep(i, 2) {

    ll bmb = c.at(i).at(0) - c.at(i + 1).at(0);
    rep(j, 2) {
      ll tmpbmb = c.at(i).at(j + 1) - c.at(i + 1).at(j + 1);
      if (bmb != tmpbmb) isMiss = false;
    }
  }

  if (isMiss) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL N; cin >> N;
		double ans = 0;
		rep(i, N) {
			double val; cin >> val;
			string S; cin >> S;
			if (S == "JPY") {
				ans += val;
			}
			else if (S == "BTC") {
				ans += val * 380000.0;
			}
		}
		cout << ans << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << setprecision(10);
}


Measured memory_bytes: 256
S = [int(x) for x in list(input())]

min_0 = 0
min_1 = 0

for i in range(len(S)):
    if i % 2 ==0:
        if not (S[i] == 0):
            min_0 += 1
        elif not (S[i] == 1):
            min_1 += 1
    if i % 2 ==1:
        if not (S[i] == 1):
            min_0 += 1
        elif not (S[i] == 0):
            min_1 += 1
                
times = min([min_0, min_1])
print(times)


Measured memory_bytes: 4652
#include<stdio.h>
#include<math.h>
#include<string.h>
#define ll long long int


void sort(int a[],ll n){

ll i,j,temp;

for(i=0;i<n;i++){

    for(j=0;j<n;j++){

        if(a[i]<a[j]){
            temp=a[i];
            a[i]=a[j];
            a[j]=temp;
        }
    }

}



}


int main(){

ll n,i,c,ans;

c=1;
int a[200000];
scanf("%lld",&n);

for(i=0;i<n;i++)
    scanf("%d",&a[i]);

    ans=0;
    for(i=0;i<n;i++){

        if(a[i]==c){
            c++;
            ans++;

        }


    }


    if(c==1){
        printf("-1\n");
    }

    else{

printf("%lld",n-ans);
    }




return 0;
}


Measured memory_bytes: 896
import sys
from collections import defaultdict
sys.setrecursionlimit(1000000)

N, M = map(int, input().split())
AB = defaultdict(list)
gain = [0]*N
for i in range(N + M - 1):
    a, b = map(int, input().split())
    AB[a - 1].append(b - 1)
    gain[b - 1] += 1

ans = [None]*N
def rec(u, p):
    ans[u] = p
    for v in AB[u]:
        gain[v] -= 1
    for v in AB[u]:
        if gain[v] == 0 and ans[v] is None:
            rec(v, u)

root = gain.index(0)
rec(root, -1)

for i in range(N):
    print(ans[i] + 1)


Measured memory_bytes: 116748
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std; 

int n,ans=0;

int main(void){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int t=i,s=0;
		while(t>0){
			t/=10;
			s++;
		}
		if(s%2==1)ans++;
	}
	printf("%d",ans);
}

Measured memory_bytes: 128
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    N = int(input())
    s = input()

    counter = Counter(s)
    rs = counter['R']
    gs = counter['G']
    bs = counter['B']
    

    rcnt, gcnt, bcnt = 0, 0, 0
    rl, gl, bl = list(), list(), list()

    for i in range(N):
        if s[i] == 'R':
            rcnt += 1
        elif s[i] == 'G':
            gcnt += 1
        elif s[i] == 'B':
            bcnt += 1
        
        rl.append(rs-rcnt)
        gl.append(gs-gcnt)
        bl.append(bs-bcnt)
    ans = 0
    
    for i in range(N-2):
        if s[i] != 'R':
            continue
        for j in range(i+1, N-1):
            if s[j] != 'G':
                continue
            if j+abs(j-i) <N:
                ok = s[j+abs(j-i)] == 'B'
                ok = int(ok)
                ans += bl[j] - ok
            else:
                ans += bl[j]

    
    #RBG
    for i in range(N-2):
        if s[i] != 'R':
            continue
        for j in range(i+1, N-1):
            if s[j] != 'B':
                continue
            if j+abs(j-i) <N:
                ok = s[j+abs(j-i)] == 'G'
                ok = int(ok)
                ans += gl[j] - ok
            else:
                ans += gl[j]
    
    for i in range(N-2):
        if s[i] != 'B':
            continue
        for j in range(i+1, N-1):
            if s[j] != 'R':
                continue
            if j+abs(j-i) <N:
                ok = s[j+abs(j-i)] == 'G'
                ok = int(ok)
                ans += gl[j] - ok
            else:
                ans += gl[j]
    
    for i in range(N-2):
        if s[i] != 'B':
            continue
        for j in range(i+1, N-1):
            if s[j] != 'G':
                continue
            if j+abs(j-i) <N:
                ok = s[j+abs(j-i)] == 'R'
                ok = int(ok)
                ans += rl[j] - ok
            else:
                ans += rl[j]
    for i in range(N-2):
        if s[i] != 'G':
            continue
        for j in range(i+1, N-1):
            if s[j] != 'R':
                continue
            if j+abs(j-i) <N:
                ok = s[j+abs(j-i)] == 'B'
                ok = int(ok)
                ans += bl[j] - ok
            else:
                ans += bl[j]
    for i in range(N-2):
        if s[i] != 'G':
            continue
        for j in range(i+1, N-1):
            if s[j] != 'B':
                continue
            if j+abs(j-i) <N:
                ok = s[j+abs(j-i)] == 'R'
                ok = int(ok)
                ans += rl[j] - ok
            else:
                ans += rl[j]



    print(ans)
    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 74812
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, n;
	cin >> a >> n;
	cout << a*a-n << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int array[] = new int[5];
		for (int i = 0; i < 5; i++) {
			array[i] = sc.nextInt();
		}
		int k = sc.nextInt();
		
		
		
		
		if (array[4] - array[0] > k) {
			System.out.println(":(");
		} else {
			System.out.println("Yay!");
		}

	}

}


Measured memory_bytes: 23252