akhauriyash/Code-Regression huggingface dataset:
//#include "pch.h"
//#include "stdafx.h"
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define INF				2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define MIN(a, b)		((a) < (b) ? a : b)
#define MAX(a, b)		((a) > (b) ? a : b)
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)		/* 奇数 */
#define IsEven(x)		(!IsOdd((x)))					/* 偶数 */
#define ArrayLength(x)	(sizeof(x) / sizeof(x[0]))
#define DWORD_MAX		(0xFFFFFFFF)

typedef short SWORD;
typedef unsigned short WORD;
typedef long SDWORD;
typedef unsigned long DWORD;
typedef long long int QWORD;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
DWORD dp[100 * 1000 + 1][3];
DWORD happy[100 * 1000][3];
int main()
{
	int N;
	cin >> N;
	REP(x, N) REP(y, 3) cin >> happy[x][y];

	int i, j, k;
	DWORD maxHappy;
	dp[0][0] = happy[0][0];
	dp[0][1] = happy[0][1];
	dp[0][2] = happy[0][2];
	for (i = 1; i < N; i++) {
		for (j = 0; j < 3; j++) {
			maxHappy = 0;
			for (k = 0; k < 3; k++) {
				if (k != j) {
					maxHappy = MAX(maxHappy, dp[i - 1][k]);
				}
			}
			dp[i][j] = maxHappy + happy[i][j];
		}
	}

	maxHappy = 0;
	for (k = 0; k < 3; k++) {
		maxHappy = MAX(maxHappy, dp[N - 1][k]);
	}
	cout << maxHappy;
	cout << endl;
	return 0;
}



Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>

using namespace std;

int main()
{
  int H;
  int A;

  cin >> H >> A;

  int attack_num = 0;
  while (true) {
    static double present_hp = H;
    present_hp -= A;
    attack_num++;

    if (present_hp <= 0) {
      break;
    }
  }

  cout << attack_num << flush;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i <= (int) n; i++)
using ll = long long;
template <class T>
using vt = vector<T>;
using vvi = vector<vt<int>>;

int main(){

  int x,y;
  cin >> x >> y;

  bool f = false;
  rep(i,x){
      if(2*i+4*(x-i) == y){
        f =true;
        break;
      }
  }

  cout << (f ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
  cin>>s;
  int N=s.size();
  int ans=0;
  for(int i=0;i<N;i++)
    if(s.at(i)=='g')
      ans++;
  else
    ans--;
  cout<<ans/2<<endl;
    return 0;
}


Measured memory_bytes: 512
suits = ['S','H','C','D']

table = [[False]*14 for i in range(4)]

N = int(input())

for loop in range(N):

    mark,num = input().split()
    num = int(num)

    if mark == 'S':
        table[0][num] = True
    elif mark == 'H':
        table[1][num] = True
    elif mark == 'C':
        table[2][num] = True
    else:
        table[3][num] = True

for i in range(4):
    for k in range(1,14):
        if table[i][k] == False:
            print("%s %d"%(suits[i],k))


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

int main() {
  int A, B;
  cin >> A >> B;
  int cnt = 0;
  for (int i = A; i <= B; i++) {
    string S = to_string(i);
    string T = to_string(i);
    reverse(T.begin(), T.end());
    if (S == T) cnt++;
  }
  cout << cnt << "\n";
}

Measured memory_bytes: 3636
input()
A = [int(x) for x in input().split()]
input()
ms = [int(x) for x in input().split()]

enable_create = [False]*2000
for bit in range(1 << len(A)):
    n = 0
    for i in range(len(A)):
        if 1 & (bit >> i) == 1:
            n += A[i]
    enable_create[n] = True

for m in ms:
    print("yes" if enable_create[m] else "no")

Measured memory_bytes: 7760
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define pb push_back
int main(void){
  ll n,k;
  cin>>n;
  cout<<(ll)pow(n,3);
  return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
 
class A {
    static StreamWriter Out = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static void Main(string[] args) {
        int X, Y, Z;
        Input(out X, out Y, out Z);
        Print(Z, X, Y);
        Out.Flush();
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void Inputs<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
    static void Print<T>(T s) => Out.WriteLine(s);
    static void Print<T>(params T[] s) => Out.WriteLine(string.Join(" ", s));
    static void Print<T>(IEnumerable<T> e) => Out.WriteLine(string.Join(" ", e));
}

Measured memory_bytes: 11220
N=int(input())
li=[input() for i in range(N)]

a=li.count("AC")
b=li.count("WA")
c=li.count("TLE")
d=li.count("RE")

print("AC x "+str(a))
print("WA x "+str(b))
print("TLE x "+str(c))
print("RE x "+str(d))


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

#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n";
#define all(c)  (c).begin(),(c).end()
#define SORT(a) sort((a).begin(),(a).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()

typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

struct edge{
    int to;
};

int n,m;
vector<vector<edge>> e;
vector<int> c;

bool dfs(int a,int color){
    c[a]=color;
    REP(i,e[a].size()){
        if(c[e[a][i].to]==color){
            return false;
        }
        if(c[e[a][i].to]==-1&&!dfs(e[a][i].to,1-color)){
            return false;
        }
    }
    return true;
}

int main(){
    cin >> n >> m;
    vector<int> a(m);
    vector<int> b(m);
    e.resize(n);
    REP(i,m){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        edge ed1;
        ed1.to = b[i];
        e[a[i]].push_back(ed1);
        edge ed2;
        ed2.to = a[i];
        e[b[i]].push_back(ed2);
    }
    c.resize(n);
    fill(all(c),-1);
    if(dfs(a[0],0)){
        int cw=0,cb=0;
        REP(i,n){
            if(c[i]==0){
                cw++;
            }else if(c[i]==1){
                cb++;
            }
        }
        put((ll)cw*cb-m);
    }else{
        put((ll)n*(n-1)/2-m);
    }
    return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

const int MAX_N = (int)1e5 + 5;
const int MAX_M = (int)1e5 + 5;

int a[MAX_N];
// n 要素で初期化
void init(int n){
	for (int i = 0; i < n; ++i){
		a[i] = -1;
	} // end for
}

// 木の根を求める
int find(int x){
	if (a[x] < 0){
		return x;
	}else{
		return (a[x] = find(a[x]));
	} // end if
}

// x と y の属する集合を併合
void unite(int x, int y){
	x = find(x);
	y = find(y);
	if (x != y){
		a[x] += a[y];
		a[y] = x;
	} // end if 
}

// x と y が同じ集合に属するか
bool same(int x, int y){
	return find(x) == find(y);
}

int size(int x){
	return -a[find(x)];
}

struct PERSON{
	int K;
	vector<int> L;
};


PERSON G[MAX_N];
vector<int> lang[MAX_M];

int main()
{
	rep (i, MAX_M) lang[i].clear();
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	int M; cin >> M;

	rep (i, N){
		int K; cin >> K;
		G[i].K = K;
		vector<int> L(K, 0);
		rep (j, K){
			int l; cin >> l;
			--l;
			L[j] = l;
		} // end rep
		G[i].L = L;
	} // end rep

	rep (i, N){
		int K = G[i].K;
		rep (j, K){
			int l = G[i].L[j];
			lang[l].push_back(i);
		} // end rep
	} // end rep

	init(N);
	for (int j = 0; j < M; ++j){
		if (lang[j].empty()) continue;
		int u = lang[j][0];
		for (int i = 1; i < lang[j].size(); ++i){
			unite(u, lang[j][i]);
		} // end for
	} // end for
	
	cout << (size(0) == N ? "YES" : "NO") << endl;

	return 0;
}

Measured memory_bytes: 9768
#include <cstdio>

int main(void)
{
	int sec, sum = 0;
	
	for (int i = 0; i < 4; i++){
		scanf("%d", &sec);
		sum += sec;
	}
	
	printf("%d\n%d\n", sum / 60, sum % 60);
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int h, w;
	cin >> h >> w;
	int sx, sy, gx, gy;
	cin >> sx >> sy >> gx >> gy;
	sx--, sy--, gx--, gy--;
	char c[h][w];
	rep(i, h) cin >> c[i];
	vector<vector<int>> dist(h, vector<int>(w, inf));
	dist[sx][sy] = 0;
	deque<pair<int, int>> deq;
	deq.push_back({sx, sy});
	while (!deq.empty()) {
		int x = deq.front().first, y = deq.front().second;
		deq.pop_front();
		rep(i, 4) {
			int nx = x + dx[i], ny = y + dy[i];
			if (nx < 0 or h <= nx or ny < 0 or w <= ny) continue;
			if (c[nx][ny] == '#') continue;
			if (dist[nx][ny] > dist[x][y]) {
				dist[nx][ny] = dist[x][y];
				deq.push_front({nx, ny});
			}
		}
		repl(i, -2, 3) {
			repl(j, -2, 3) {
				int nx = x + i, ny = y + j;
				if (nx < 0 or h <= nx or ny < 0 or w <= ny) continue;
				if (c[nx][ny] == '#') continue;
				if (dist[nx][ny] > dist[x][y] + 1) {
					dist[nx][ny] = dist[x][y] + 1;
					deq.push_back({nx, ny});
				}
			}
		}
	}
	cout << (dist[gx][gy] == inf ? -1 : dist[gx][gy]) << "\n";
	return 0;
}

Measured memory_bytes: 8548
H,W,K = map(int,input().split())
listc = []
listc = [list(input()) for i in range(H)]
#print(listc)
ans = 0
for j in range(2**H):
    for k in range(2**W):
        count = 0
        for l in range(H):
            for m in range(W):
                if j >> l & 1 == 0 and k >> m & 1 == 0:
                    if listc[l][m] == "#":
                        count += 1
        if count == K:
            ans += 1
print(ans)


Measured memory_bytes: 9144
//Gvs Akhil (Vicennial)
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ld(a) while(a--)
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define tcf(v,i) for(auto i : v)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator
#define INF 		0x3f3f3f3f
#define LLINF       1000111000111000111LL
#define PI 			3.14159265358979323
#define endl '\n'
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
const int N=1000006;
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<ii,vii,greater<ii> > spq;
const ll MOD=1000000007LL;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename T> T power(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
map<string,int> m;
map<string,ii> lt;
map<char,int> cc;
int32_t main(){
	string s; cin>>s;
	tcf(s,i) ++cc[i];
	int n=s.size();
	int ans=0;
	tcf(cc,i){
		ans+=(i.second*(i.second-1))/2;
	}
	ans+=s.size();
	//trace1(ans);
	cout<<(n*(n+1))/2-ans+1<<endl;
}

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

int main()
{
    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> A(N, 0);
    vector<ll> B(M, 0);
    vector<ll> A_acc(N + 1, 0);
    vector<ll> B_acc(M + 1, 0);
    A_acc[0] = 0;
    B_acc[0] = 0;

    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        A_acc[i + 1] = A_acc[i] + A[i];
    }
    for (int i = 0; i < M; i++)
    {
        cin >> B[i];
        B_acc[i + 1] = B_acc[i] + B[i];
    }

    cout << endl;
    // 決め打ち＋累積和＋２分探索
    ll ans = 0;
    for (int i = 0; i < N + 1; i++)
    {
        ll rem = K - A_acc[i];
        if (rem < 0)
            continue;
        ll cnt = upper_bound(B_acc.begin(), B_acc.end(), rem) - B_acc.begin();
        cnt--;
        ans = max(ans, cnt + i);
    }

    cout << ans << endl;
    return 0;
}

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

using namespace std;

int mycalc(int r, int x, int d){
  return r * x - d;
}

int main (void){
  int r, x, d;
  cin >> r >> d >> x;
  cin.ignore();

  for (int i = 0; i < 10; i++){
    x = mycalc(r, x, d);
    cout << x << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vl D(N);
    map<int,int> mp;
    rep(i,N){
        cin >> D[i];
        mp[D[i]]++;
    }
    if(mp[0]>0){
        cout << 0 << endl;
        return 0;
    }
    else if(mp[12]>1){
        cout << 0 << endl;
        return 0;
    }
    FOR(i,1,12){
        if(mp[i]>2){
            cout << 0 << endl;
            return 0;
        }
    }
    ll OK=0,NG=24;
    while(abs(OK-NG)>1){
        ll mid=(OK+NG)/2;
        bool b=true;
        map<int,int> mp1;
        mp1=mp;
        ll nowmx=0;
        mp1[0]++;
        rep(i,25){
            if(mp1[12-abs(12-i)]>=1&&nowmx+mid<=i){
                mp1[12-abs(12-i)]--;
                nowmx=i;
            }
        }
        rep(i,13){
            if(mp1[i]>0){
                b=false;
            }
        }
        if(b){
            OK=mid;
        }
        else{
            NG=mid;
        }
    }
    cout << OK << endl;
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 3672
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,c,k = LI()
    if k <= a+b:
        print(min(k,a))
    else:
        print(a-(k-a-b))
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 65604
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std; 
#define int long long 
#define pb push_back 
#define vii vector < int > 
#define pii pair < int , int >
#define fi first
#define all(a)      (a).begin(),(a).end()
#define si(x)       (int)((x).size())
#define debug(x)    cout<<#x<<" is "<<(x)<<endl;cout.flush();  
#define se second 
#define endl        '\n'
#define f(i,a,b)    for(int i=a;i<b;i++)
#define mem(a,x)          memset(a,x,sizeof(a))
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

// const int  mod=998244353;
const int  mod = 1000000000+7;
const int  N=1000000+6;
#define M_PI           3.14159265358979323846

// int x2[]={+1,-1,+0,+0};
// int y2[]={+0,+0,+1,-1};
// int x2[]={+0,+0,+1,-1,-1,+1,-1,+1};
// int y2[]={-1,+1,+0,+0,+1,+1,-1,-1};
// int x2[]={-2,-2,-1,-1,+1,+1,+2,+2};
// int y2[]={-1,+1,-2,+2,-2,+2,-1,+1};

// === Debug macro starts here ===

int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
    os<<"[";
    for(auto& x:v){os<<x<<", ";}
    return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
    return os<<"{"<<p.first<<", "<<p.second<<"}";
}

// === Debug macro ends here ===
int dp[3005][3005];
 main() 
{
    fastIO;
    string s,t;cin>>s>>t;
    int n=s.length(),m=t.length();
    mem(dp,0);
    if(s[0]==t[0])   
    dp[0][0]=1;
    f(i,1,m)
    {
        if(s[0]==t[i])
        dp[0][i]=1;
        else
        {
            dp[0][i]=dp[0][i-1];
        }
        
    }
    f(i,1,n)
    {
        if(s[i]==t[0])
        dp[i][0]=1;
        else
        dp[i][0]=dp[i-1][0];
    }
    f(i,1,n)
    f(j,1,m)
    {
        if(s[i]==t[j])
        {
            dp[i][j]=1+dp[i-1][j-1];
        }
        else
        dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
    string ans="";
    int i=n-1,j=m-1;
    while(i>=0 and j>=0)
    {
        if(s[i]==t[j])
        {
            ans=s[i]+ans;i--;j--;
        }
        else
        {
            if(i-1>=0 and j>=1)
            {
                if(dp[i-1][j]>dp[i][j-1])
                i--;
                else
                j--;
            }
            else if(i>=1)
            i--;
            else if(j>=1)
            j--;
            else
            {
                break;
            }
            
        }
    }
    cout<<ans;

} 

Measured memory_bytes: 74268
#include <iostream>
#include <math.h>
#include <iomanip>
#include <bits/stdc++.h>
#include <string.h>
#include <string>
#include <algorithm>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define inf 1e18
#define mem(a,b) memset(a,b,sizeof(a))
#define debug(x) cout << (#x) << " = " << x << endl;
#define debug2(i,j) cout << (#i) << "=" << i << " , " << (#j) << "=" << j << endl;

using namespace std;

ll binomialCoeff(ll n,ll k)
{
    ll res = 1;
    if(k >n - k)
        k = n - k;
    for(int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll power(ll x,ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}


// // nCr % mod
// const int Nf = 1e5 + 5;
// ll fact[6*Nf];
// ll inv[6*Nf],invfac[6*Nf];
// //ll mod = 1e9 + 7;

// void factorial()
// {
//     fact[0] = invfac[0] = fact[1] = invfac[1] = 1;
//     inv[1] = 1;
//     for(int i=2;i<=5*Nf + 10;i++)
//     {
//         fact[i] = (fact[i-1]*i)%mod;
//         inv[i] = (inv[mod%i]*(mod - mod/i))%mod;
//         invfac[i] = (invfac[i-1]*inv[i])%mod;
//     }
// }

ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        // q is quotient
        ll q = a / m;
        ll t = m;

        // m is remainder now, process same as
        // Euclid's algo
        m = a % m, a = t;
        t = y;

        // Update y and x
        y = x - q * y;
        x = t;
    }

    // Make x positive
    if (x < 0)
       x += m0;

    return x;
}

vector<ll> primes;
vector<bool> prime;

void Sieve(int n)
{
    prime = vector<bool> (n+1,true);
    //vector<bool> prime(n+1,true);
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primes.push_back(p);
}

//******************************************************    CHECK CONSTRAINTS   ***************************************************************//

const int Nmax = 1e5 + 6;
const int N = 1005;

ll dp[Nmax][105][2];

ll mod = 1e9 + 7;

string str;
int d;
int n;

ll solve(int pos,int rem,int f)
{
    if(pos == n)
    {
        if(rem%d == 0)
        {
            return 1;
        }
        return 0;
    }

    ll &res = dp[pos][rem][f];
    if(~res)
        return res;

    int limit;
    res = 0;

    if(f == 0)
    {
        limit = str[pos] - '0';
    }
    else
        limit = 9;

    for(int i=0;i<=limit;i++)
    {
        int nf = f;
        int div = rem;
        if(f == 0 && i < limit)
            nf= 1;
        div = (rem+i)%d;
        res += solve(pos+1,div,nf);
        res %= mod;
    }
    //cout << pos << " " << rem <<  " " << res << "\n";
    return res;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin >> str;
    cin >> d;
    n = str.length();
    //reverse(str.begin(),str.end());
    mem(dp,-1);
    cout << (solve(0,0,0) - 1 + mod)%mod;
}


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

for i in range(1, 10**9):
  tmp = [A[j]/2 if A[j]%2 == 0 else -1 for j in range(N)]
  A = tmp[:]
  if A.count(-1) != 0:
      break

print(i-1)

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define int long long
#define debug(x) cerr << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  int n,k;
  cin>>n>>k;
  int a[n];
  rep(i,n) cin>>a[i];
  int cnt[100] = {};
  int last = 0;
  for(int i = 0; (ll)pow(2,i) <= k; i++) {
    int t = (ll)pow(2,i);
    int sum = 0;
    for(int j = 0; j < n; j++) {
      sum += t & a[j];
    }
    if(sum <= n * t / 2) {
      cnt[i] = 1;
    }
    last = i;
  }
  for(int i = last; i >= 0; i--) {
    int p = k >> i & 1;
    if(p == 1 && cnt[i] == 0) {
      break;
    } else if(p == 0 && cnt[i] == 1) {
      cnt[i] = 0;
    }
  }
  int tmp = 0;
  for(int i = 0; i <= last; i++) {
    tmp += (ll)pow(2,i) * cnt[i];
  }
  int ans = 0;
  rep(i,n) {
    ans += tmp ^ a[i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

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

print(ans)

Measured memory_bytes: 77452
#include <iostream>
#include <queue>
#include <functional>
#include <vector>

using namespace std;

typedef pair<int, int> P;

int main() {
	int n;
	cin >> n;
	priority_queue< P, vector<P>, greater<P> > pq;
	for (int i = 0; i < n; i++) {
		P p;
		cin >> p.first >> p.second;
		pq.push(p);
	}
	int m;
	cin >> m;
	for (int i = 0; i < m; i++) {
		P p;
		cin >> p.first >> p.second;
		pq.push(p);
	}
	P pp, qq;
	pp = pq.top();
	pq.pop();
	cout << pp.first << ':';
	if (pp.second <= 9) {
		cout << '0';
	}
	cout << pp.second;
	while (!pq.empty()) {
		qq = pq.top();
		pq.pop();
		if (pp.first == qq.first && pp.second == qq.second) {
		} else {
			cout << ' ' << qq.first << ':';
			if (qq.second <= 9) {
				cout << '0';
			}
			cout << qq.second;
			pp.first = qq.first;
			pp.second = qq.second;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1204
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
int a[105]={0};

int main()
{
  int n,k;
  cin>>n>>k;
 int count=n/2+(n%2==1?1:0);
 if(count>=k)
 printf("YES");
 else
 printf("NO");
 
}



Measured memory_bytes: 256
package main

import (
  "fmt"
)

func abs(N int) int {
  if N >= 0 {
    return N
  } else {
    return -N
  }
}

func main() {
  var N int
  fmt.Scan(&N)
  t, x, y := make([]int, N + 1), make([]int, N + 1), make([]int, N + 1)
  for i := 1; i <= N; i++ {
      fmt.Scan(&t[i], &x[i], &y[i])
    }

  for i := 1; i <= N; i++ {
    dt := t[i] - t[i - 1]
    dx := abs(x[i] - x[i - 1])
    dy := abs(y[i] - y[i - 1])
    if (dx + dy <= dt) && ((dx + dy) % 2 == dt % 2) {
      continue
    } else {
      fmt.Println("No")
      return
    }
  }
  fmt.Println("Yes")
}

Measured memory_bytes: 5376
#include<stdio.h>

int main(void){
	int ans[4][13],card[4][13],x[52],n,i,j,k;
	char m[52],dummy;
	
	//reset
	for(i=0;i<52;i++){
		x[i] = 0;
	}
	
	scanf("%d",&n);
	
	//set
	for(i=0;i<n;i++){
		scanf("%c",&dummy);
		scanf("%c %d",&m[i],&x[i]);
	}
	
	//set_arrey[ans]_arrey[card]
	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			ans[i][j]=1;
			card[i][j]=j+1;
		}
	}
	
	i = 0;
	
	//survey
	while(x[i] != 0){
//		for(j=0;j<4;j++){
			for(k=0;k<13;k++){
				if(m[i]=='S' && x[i]==card[0][k]){
					ans[0][k]=0;
					break;
				}else if(m[i]=='H' && x[i]==card[1][k]){
					ans[1][k]=0;
					break;
				}else if(m[i]=='C' && x[i]==card[2][k]){
					ans[2][k]=0;
					break;
				}else if(m[i]=='D' && x[i]==card[3][k]){
					ans[3][k]=0;
					break;
				}
			}
//		}
		i++;
	}
	
	//output
	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			if(ans[i][j]==1){
				if(i==0) printf("S %d\n",card[0][j]);
				else if(i==1) printf("H %d\n",card[1][j]);
				else if(i==2) printf("C %d\n",card[2][j]);
				else if(i==3) printf("D %d\n",card[3][j]);
			}
		}
	}

	return 0;
}



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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

int main(void)
{
  int n;
  cin >> n;
  REP(i, n) {
    int y, m, d;
    cin >> y >> m >> d;
    ll ans = 0;
    ans += (y-1)/3*590 + (y-1)%3*195;
    if(y%3==0) ans += (m-1)*20;
    else ans += (m-1)/2*39 + (m-1)%2*20;
    ans += d;

    cout << 196471-ans << endl;
  }
  return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define REP(i, vec) for(auto i = vec.begin(); i != vec.end(); ++i)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T> inline T LCM(T a, T b) { return (a + (b - 1)) / b; }

int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

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

ll rec(ll n, ll x) {
	if (n == 0) return 1;

	ll len = (1LL << (n + 1)) - 3;
	ll num = (1LL << n) - 1;

	if (x == 1) return 0;
	else if (x <= len + 1) return rec(n - 1, x - 1);
	else if (x == len + 2) return num + 1;
	else if (x <= (len + 1) * 2) return num + 1 + rec(n - 1, x - len - 2);
	else return num * 2 + 1;
}

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

	cout << rec(n, x) << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;
using ld = double;
template<class T>
using Table = vector<vector<T>>;

//bou height rest
ld dp[100][501][101];
int main() {
	for (int i = 0; i < 100; ++i) {
		for (int j = 0; j < 501; ++j) {
			for (int k = 0; k < 101; ++k) {
				dp[i][j][k] = 0;
			}
		}
	}
	int H, N, P, M, K;
	cin >> H >> N >> P >> M >> K;
	P--;
	vector<int>lines(H,-1);
	for (int i = 0; i < M; ++i) {
		int a, b; cin >> a >> b;
		a--; b--;
		lines[a] = b;
	}
	int undecidednum = H - M;
	dp[P][H][K] = 1;
	for (int h = H-1; h >= 0; --h) {
		if (lines[h] != -1) {
			for (int rest = 0; rest <= K; ++rest) {
				for (int i = 0; i < N; ++i) {
					dp[i][h][rest] = dp[i][h + 1][rest];
				}
				swap(dp[lines[h]][h][rest], dp[lines[h]+1][h][rest]);
			}
		}
		else {
			for (int rest = 0; rest <= K; ++rest) {
				if (rest >undecidednum) {

				}
				else {
					ld per = (ld(rest) / undecidednum) / (N - 1);

					{
						vector<ld>pluss(N);
						for (int sw = 0; sw < N - 1; ++sw) {

							for (int i = 0; i < N; ++i) {
								pluss[i] = dp[i][h + 1][rest] * per;
							}
							swap(pluss[sw], pluss[sw + 1]);
							for (int i = 0; i < N; ++i) {
								dp[i][h][rest - 1] += pluss[i];
							}
						}
					}
					{
						vector<ld>pluss(N);

						for (int i = 0; i < N; ++i) {
							pluss[i] = dp[i][h+1][rest] * (1 - per*(N-1));
						}
						for (int i = 0; i < N; ++i) {
							dp[i][h][rest] += pluss[i];
						}
						
					}
				}
			}
			undecidednum--;
		}
	}
	ld ans = 0;
	for (int i = 0; i < N; ++i) {
		ans = max(dp[i][0][0], ans);
	}
	cout <<setprecision(22)<<fixed<< ans << endl;

	return 0;
}

Measured memory_bytes: 42812
#include<stdio.h>
int main()
{
	long long h;
	scanf("%lld",&h);
	long long sum=0,tip=1;
	while(h)
	{
		if(h==1)
		{
			sum+=tip;
			break;
		}
		else 
		{
			sum+=tip;
			h/=2;
		}
		tip*=2; 
	}
	printf("%lld\n",sum);
	return 0;
 } 

Measured memory_bytes: 128
using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{

    public class Program
    {
        const long MOD = 1000000007;
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            long N = cin.ReadLong;
            string S = cin.ReadLine;
            var R = 0L; var G = 0L; var B = 0L;
            for (int i = 0; i < N; i++)
            {
                if (S[i] == 'R') R++;
                if (S[i] == 'G') G++;
                if (S[i] == 'B') B++;
            }
            var ans = R * G * B;
            for (int i = 0; i < N; i++)
            {
                for (int j = i+1 ; j < N; j++)
                {
                    int k = 2 * j - i;
                    if (k >= N)
                    {
                        continue;
                    }
                    if (S[i] != S[j] && S[i] != S[k] && S[j] != S[k])
                    {
                        ans--;
                    }
                }
            }
            WriteLine(ans);
        }


        static long Gcd(long p, long q)
        {
            if (p % q == 0) return q;
            return Gcd(q, p % q);
        }

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

    }
}

Measured memory_bytes: 27912
//
//  main.cpp
//  ABC167B

#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    long long a,b,c,k;
    cin >> a >> b >> c >> k;
    
    long long ans=0;
    if(k>=a){
        ans=a;
        k-=a;
    }else{
        ans+=k;
        k=0;
    }
    if(k>=b){
        k-=b;
    }else{
        k=0;
    }
    ans=ans-k;
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3176
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
using namespace std;

void solve() {
	int N, K;
	string S;
	cin >> N >> K >> S;
	int counter = 0;
	for (int n = 1; n < N; n++) {
		if (S[n] != S[n - 1])counter++;
	}
	counter++;
	while (K > 0 && counter > 1) {
		counter -= 2;
		if (counter == 0)counter = 1;
		K--;
	}
	cout << N - counter << endl;
	return;
}
//////////////////////////////
//////////////////////////////

int main() {
#ifdef DEBUGTIME
	for (int time = 0; time < DEBUGTIME; time++) {
		solve();
		cout << "####################" << endl;
	}
#else
	solve();
#endif
	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(){
	int x,y;
	while(1){
		scanf("%d %d",&x,&y);
		if(x==0 && y==0) break;
		if(x<y){
			printf("%d %d\n",x,y);
		} else {
			printf("%d %d\n",y,x);
		}
	}
return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,x=0;cin>>N;int v[N],c[N];
  for(int i=0;i<N;i++)cin>>v[i];
  for(int i=0;i<N;i++)cin>>c[i];
  for(int i=0;i<N;i++)if(v[i]>c[i])x+=v[i]-c[i];
  cout<<x<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define dscf(n) scanf("%lf",&n)
#define lpri(n) printf("%lld ",n)
#define dpri(n) printf("%lf ",n)
#define dprin(n) printf("%lf\n",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;
 
void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

int main()
{
    ll n,k;
    lscf(n);lscf(k);
    long double a[n+1];
    rep(i,1,n+1){
    cin>>a[i];
    a[i]=log10l(a[i]);
    }

    long double sum[n+1]={0};
    sum[1]=a[1];

    rep(i,2,n+1)
    sum[i]=sum[i-1]+a[i];

    rep(i,k,n)
    {
        if(sum[i+1]-sum[i+1-k]>sum[i]-sum[i-k])
        cout<<"Yes"<<endl;
        else
        {
            cout<<"No"<<endl;
        }
        
    }
return 0;
}

Measured memory_bytes: 10100
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
//cout << fixed << setprecision(8) << a << endl;
#define Fast_Input ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define pb push_back
#define mem(a, b)     memset(a, b, sizeof(a))
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
/*sort(v.begin(), v.end(),
     [](const pair<int, int>& x, const pair<int, int>& y)
{
    if (x.first != y.first)
        return x.first < y.first;
    return x.second < y.second;
});
*/
int const fx[]= {+1,+0,-1,+1};
int const fy[]= {-1,+1,+0,+0};
const int inf = numeric_limits<int>::max();
const ll mx=1e6;
const ll mod=1e9+7;
bool p[mx+5];
vector<int>prime;
void seive()
{
    int i,j;
    p[0]=p[1]=true;
    for(i=4; i<=mx; i+=2)p[i]=true;
    for(i=3; i*i<=mx; i+=2)
    {
        if(!p[i])
        {
            for(j=i*i; j<=mx; j=j+2*i)
            {
                p[j]=true;
            }
        }
    }
    prime.pb(2);
    for(i=3; i<=mx; i++)
    {
        if(!p[i])prime.pb(i);
    }
}
int main()
{
    seive();
    ll n,i,ans=0;
    cin >> n;
    map<ll,int>m;
    while(n>1)
    {
        set<ll>s;
        for(i=1; i*i<=n; i++)
        {
            if(n%i==0)
            {
                s.insert(i);
                s.insert((n/i));
            }
        }
        ll z=-1;
        for(auto x: s)
        {
            if(m[x]!=0)continue;
            ll now=x;
            int coun=0;
            for(i=0; i<prime.size(); i++)
            {
                if(prime[i]>x)break;
                if(x%prime[i]==0)
                {
                    coun++;
                    if(coun>1)break;
                    while(x%prime[i]==0)x/=prime[i];
                }
            }
            if(x>1)coun++;
            if(coun==1)
            {
                z=now;
                break;
            }
        }

        if(z==-1)break;
        m[z]=1;
        n/=z;
        ans++;
    }
    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 4712
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> button(N);
  for(int n = 0; n < N; n++){
    cin >> button.at(n);
  }
  int light = 1;
  int count = 1;
  while(button.at(light-1) != 2){
    count++;
    light = button.at(light-1);
    if(count > N){
      break;
    }
  }
  if(count > N){
    cout << "-1" << endl;
  }else{
    cout << count << endl;
  }
}


Measured memory_bytes: 640
class Dice
	def initialize(labels)
		@labels = labels
		@top    = labels[0]
		@front  = labels[1]
		@right  = labels[2]
		@left   = labels[3]
		@back   = labels[4]
		@bottom = labels[5]
	end
	attr_reader :top

	def roll(op)
		case op
		when "E"
			@t      = @top
			@top    = @left
			@left   = @bottom
			@bottom = @right
			@right  = @t
		when "W"
			@t      = @top
			@top    = @right
			@right  = @bottom
			@bottom = @left
			@left   = @t
		when "N"
			@t      = @top
			@top    = @front
			@front  = @bottom
			@bottom = @back
			@back   = @t
		when "S"
			@t      = @top
			@top    = @back
			@back   = @bottom
			@bottom = @front
			@front  = @t
		end
	end
end

labels = gets.strip.split(" ").map{|i| i.to_i}
dice = Dice.new(labels)
ops = gets.strip.split("")

ops.map{|op| dice.roll(op)}

puts dice.top


Measured memory_bytes: 6876
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    ll a,b;
    cin>>a>>b>>n;
    /*ll ans=  0;
    m = min(a,b);
    m = min(m,n);
    for(i=1;i<=100;i++)
    {
        x = ((a*i)/b) - (a*(i/b));
        cout<<x<<endl;
        ans = max(ans,x);
    }
    cout<<ans<<endl;*/
    if(b-1<=n)
    {
        i = b-1;
        x = ((a*i)/b) - (a*(i/b));
    }
    else
    {
        i = n;
        x = ((a*i)/b) - (a*(i/b));
    }
    cout<<x<<endl;
    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
const ll mod = 1e9+7;
const ll INF = 2e9;
const double PI = 3.1415926535;

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 400000;

int N, M;
int k[20];
int s[20][20];
int p[20];

bool test(int X) {
	int t[20];

	for (int j = 1; j <= N; j++) {
		t[j] = X % 2;
		X /= 2;
	}

	for (int i = 1; i <= M; i++) {
		int ten = 0;
		for (int j = 1; j <= k[i]; j++) {
			if (t[s[i][j]] == 1) { ten++; }
		}

		if (ten % 2 != p[i]) { return false; }
	}

	return true;

}




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


	for (int i = 1; i <= M; i++) {
		cin >> k[i];

		for (int j = 1; j <= k[i]; j++) {
			cin >> s[i][j];
		}
	}


	for (int i = 1; i <= M; i++) {
		cin >> p[i];
	}

	int ans = 0;
	
	for (int X = 0; X < pow(2, N); X++) {
		if (test(X)) { ans++; }
	}

	cout << ans;

	system("PAUSE");

}

Measured memory_bytes: 504
import math

x = input().split()
a = float(x[0])
b = float(x[1])
h = float(x[2])
m = float(x[3])

degM = 6.0 * m
degH = (h * 60 + m) * 0.5
deg = abs(degM - degH)
if(deg > 180):
    deg = 360 - deg

if(deg == 180):
    print(a + b)
else:
    r = math.radians(deg)
    cosA = math.cos(r)
    p = math.sqrt(a * a + b * b - 2 * a * b * math.cos(r))
    print(round(p, 11))


Measured memory_bytes: 9460
from collections import Counter

n = int(input())
a = input().split()
freq = Counter(a)
#print(freq)
total=0
    
for key,val in freq.items():
    total+=(val*(val-1))//2

for k in range(n): 

    kth = (freq[a[k]]*(freq[a[k]]-1))//2
    newkth = ((freq[a[k]]-2)*(freq[a[k]]-1))//2  

    total -= kth
    total += newkth
    
    print(total)
    
    total -=newkth
    total +=kth

Measured memory_bytes: 26660