akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define f first
#define s second
#define inf 1000000007

ll K,N;
ll x[55];
ll y[55];

int main() {
    cin >> N >> K;
    rep(i,N) cin >> x[i] >> y[i];
    ll ans = -1;
       rep(i,N-1){
            repi(j,i+1,N){
                rep(k,N-1){
                    repi(l,k+1,N){
                    ll minx = min(x[i],x[j]);
                    ll maxx = max(x[i],x[j]);
                    ll miny = min(y[k],y[l]);
                    ll maxy = max(y[k],y[l]);
                    ll num = 0;
                    rep(m,N){
                        if ((x[m] >= minx && x[m] <= maxx) && (y[m] >= miny && y[m] <= maxy)){
                            num++;
                        }
                    }
                    if (num >= K){
                        ll temp = (maxx-minx)*(maxy-miny);
                        //cout << temp << endl;
                        if (ans < 0) ans = temp;
                        else ans = min(ans,temp);
                    }
                    }
                }
            }
        }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 INP PIC X(1000).
       01 A PIC X(100).
       01 B PIC X(100).
       01 C PIC X(100).
       01 REN PIC 9999999.
       01 RE PIC Z(7).
       01 temp1 PIC 9999.
       01 temp2 PIC 9999.
       01 N PIC 9999.
       PROCEDURE DIVISION.
       MAIN.
       	ACCEPT INP.
      	PERFORM VARYING temp1 FROM 1 BY 1 UNTIL INP(temp1:1)=SPACE
      	END-PERFORM.
      	SUBTRACT 1 FROM temp1.
      	MOVE INP(1:temp1) TO A.
      	ADD 2 TO temp1.
      	PERFORM VARYING temp2 FROM temp1 BY 1 UNTIL INP(temp2:1)=SPACE
      	END-PERFORM.
      	COMPUTE N=temp2 - temp1.
      	MOVE INP(temp1:N) TO B.
      	ADD 1 TO temp2.
      	PERFORM VARYING temp1 FROM temp2 BY 1 UNTIL INP(temp1:1)=SPACE
      	END-PERFORM.
      	COMPUTE N=temp1 - temp2.
      	MOVE INP(temp2:N) TO C.
      	DISPLAY "A" B(1:1) "C"
        STOP RUN.


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		    Scanner sc = new Scanner(System.in);
		    int n = sc.nextInt();
		    int[] a = new int[n+1];
		    int[] b = new int[n];
		    for(int i=0; i<n+1; i++) {
		    	a[i] = sc.nextInt();
		    }
		    for(int i=0; i<n; i++) {
		    	b[i] = sc.nextInt();
		    }

		    long monster =0;
		    for(int i=0; i<n; i++) {
		    	if(b[i]<a[i]) {
		    		monster += b[i];
		    	} else {
		    		monster += a[i];
		    		b[i] -= a[i];
		    		if(b[i]>=a[i+1]) {
		    			monster += a[i+1];
		    			a[i+1] = 0;
		    		} else {
		    			monster += b[i];
		    			a[i+1] -= b[i];
		    		}
		    	}
		    }

		    System.out.println(monster);
	}
}


Measured memory_bytes: 65452
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))



    while(1):
        min_A = min(A)
        is_all_dividable = True
        for i in range(N):
            if A[i]%min_A != 0:
                A[i] = A[i] % min_A
                is_all_dividable = False
        if is_all_dividable == True:
            break
    print min_A


if __name__ == '__main__':
    main()


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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define sz(obj) ((int)(obj).size())

map<string, int> p;
int main()
{
  int a;
  char c;
  string blood;

  while (cin >> a >> c >> blood){
    p[blood]++;
  }
  cout << p["A"] << "\n" << p["B"] << "\n" << p["AB"] << "\n" << p["O"] << endl;
}

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

using namespace std;

#define M_DEBUG if (0)

/******************************************************************************
	typedef
******************************************************************************/
typedef unsigned long long int ullint;

struct coord
{
	coord(int pX, int pY) : x(pX), y(pY){};

	int x;
	int y;
};

/******************************************************************************
	Main
******************************************************************************/
int main()
{
	int n = -1;
	cin >> n;
	assert(n >= 2 && n <= 8);

	vector<coord> coords;
	double dist = 0.0;
	ullint factorial = 1;
	for (int i = 1; i <= n; i++)
	{
		int x = -1001;
		int y = -1001;
		cin >> x >> y;
		assert(x >= -1000 && x <= 1000);
		assert(y >= -1000 && y <= 1000);

		coord p = coord(x, y);
		for (coord q : coords)
		{
			double tmp_dist = sqrt(pow((q.x - x), 2) + pow((q.y - y), 2));
			M_DEBUG cout << "sqrt(pow((" << q.x << " - " << x << "), "
						 << "2) + pow((" << q.y << " - " << y << "), 2));" << sqrt(pow((q.x - x), 2) + pow((q.y - y), 2)) << endl;
			dist += tmp_dist;
		}
		coords.push_back(p);
		factorial *= i;
	}

	ullint multiCnt = (factorial) * (n - 1) / (n * (n - 1) / 2); // 同じ道(i->jとj->i)を何回通るか. (n! * (n-1)) / (nC2 / 2)

	M_DEBUG cout << "dist:" << dist << " multi: " << multiCnt << " f:" << double(factorial) << endl;
	cout << setprecision(10) << setiosflags(ios::fixed) << (dist * multiCnt) / double(factorial) << endl;

	return 0;
}


Measured memory_bytes: 384
package main

import (
	"fmt"
	"sort"
)

func euclidean(a, b int) int {
	x, y := a, b
	if x < y {
		x, y = y, x
	}
	if y == 0 {
		return x
	}
	return euclidean(y, x%y)
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	l, r := make([]int, n+1), make([]int, n+1)
	l[0], r[n] = 0, 0
	for i := 0; i < n; i++ {
		l[i+1] = euclidean(l[i], a[i])
	}
	for i := n; i > 0; i-- {
		r[i-1] = euclidean(r[i], a[i-1])
	}

	gcd := make([]int, n)
	for i := 0; i < n; i++ {
		gcd[i] = euclidean(l[i], r[i+1])
	}

	sort.Ints(gcd)
	fmt.Println(gcd[n-1])
}



Measured memory_bytes: 6272
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int a[3];
	rep(i, 3) cin>>a[i];
	sort(a, a+3);
	if(a[0]==5&&a[1]==5&&a[2]==7) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int k, s;
  cin >> k >> s;
  int res = 0;
  for (int i = 0; i <= k; i++) {
    for (int j = 0; j <= k; j++) {
      int now = i + j;
      int need = s - now;
      if (need <= k && need >= 0) {
        //cerr << i << ' ' << k << ' ' << need << '\n';
        ++res;
      }
    }
  }
  cout << res  << '\n';
  return 0;
}

Measured memory_bytes: 3572
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL MOD=998244353;
LL n,k,l[15],r[15];
struct BinaryIndexedTree{
	LL a[200005];
	void clear(){memset(a,0,sizeof a);}
	LL lowbit(LL x){return x&(-x);}
	void modify(LL x,LL val){for(LL i=x;i<=n;i+=lowbit(i))	a[i]+=val,a[i]%=MOD;}
	LL query(LL x){LL ans=0;for(LL i=x;i;i-=lowbit(i))	ans+=a[i],ans%=MOD;return ans;}
}bit;
int main(){
	memset(bit.a,0,sizeof bit.a);
	scanf("%lld %lld",&n,&k);
	bit.modify(1,1);
	bit.modify(2,-1);
	for(LL i=1;i<=k;++i)	scanf("%lld %lld",&l[i],&r[i]);
	for(LL i=1;i<=n;++i)
	{
		LL val=bit.query(i);
		for(LL j=1;j<=k;++j)
		{
			LL L=i+l[j],R=i+r[j];
			if(L>n)	continue;
			R=min(R,n);
//			for(LL s=1;s<=n;++s)	printf("%lld ",bit.query(s));
//			puts("");
			bit.modify(L,val);
//			for(LL s=1;s<=n;++s)	printf("%lld ",bit.query(s));
//			puts("");
			bit.modify(R+1,-val);
//			for(LL s=1;s<=n;++s)	printf("%lld ",bit.query(s));
//			puts("");
		}
	}
	LL ans=bit.query(n);
	printf("%lld",(ans%MOD+MOD)%MOD);
	return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

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

struct UnionFind {
  vector<int> data;
  UnionFind(int v) : data(v, -1) {}
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int size(int x) {
    return -data[root(x)];
  }
  void merge(int x, int y) {
    x = root(x), y = root(y);
    if (x != y) {
      if (size(y) > size(x))
        swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
  }
};

int main() {

	int n, k, l;
	cin >> n >> k >> l;

	UnionFind u1(n), u2(n);

	rep(i, k){
		int x, y;
		cin >> x >> y;
		x--;y--;
		u1.merge(x, y);
	}

	rep(i, l){
		int x, y;
		cin >> x >> y;
		x--;y--;
		u2.merge(x, y);
	}

 	map<ii, int> mp;
	rep(i, n){
		mp[make_pair(u1.root(i), u2.root(i))]++;
	}
	rep(i, n){
		if(i != 0) cout << " ";
		cout << mp[make_pair(u1.root(i), u2.root(i))];
	}
	cout << endl;

	return 0;

}


Measured memory_bytes: 13696
import sys
sys.setrecursionlimit(3003)
def main():
    s = " "+input()
    N = len(s)-1

    t = " "+input()
    M = len(t)-1
    if N < M:
        N, M = M, N
        s, t = t, s
    # dp[i][j] := sのi文字目, tのj文字目までを使ったLCSの長さ
    dp = [[-1]*(M+1) for i in range(N+1)]
    dp[0] = [0]*(N+1)
    for i in range(N+1):
        dp[i][0] = 0
    for i in range(1, N+1):
        for j in range(1, M+1):
            
            if s[i] == t[j]:
                dp[i][j] = dp[i-1][j-1]+1
            elif s[i] != t[j]:
                if dp[i-1][j] > dp[i][j-1]:
                    dp[i][j] = dp[i-1][j]
                else:
                    dp[i][j] = dp[i][j-1]
    print(get(s, t, N, M, dp))

def get(s, t, i, j, dp):
    if i == 0 or j == 0:
        return ""

    if s[i]==t[j]:
        return get(s, t, i-1, j-1, dp) + s[i]
    elif s[i] != t[j]:
        if dp[i-1][j] > dp[i][j-1]:
            return get(s, t, i-1, j, dp)
        else:
            return get(s, t, i, j-1, dp)


if __name__ == "__main__":
    main()

Measured memory_bytes: 114524
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++) 
#define so(v) sort(v.begin(),v.end())
using ll = long long;
using vi=vector<int>;
using vii=vector<vi>;
const int MAX = 510000;
const int MOD = 1000000007;
ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long com(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
int main() {
    ll n,m;
    cin>>n>>m;
    vector<ll> AC(n,0);
    vector<ll> P(n,0);
    rep(i,m){
        ll j;string k;
        cin>>j>>k;
        if(AC[j-1]==1){
            continue;            
        }
        else if(k=="AC"){
            AC[j-1]++;
        }
        else {
            P[j-1]++;
        }
    }
    ll a=0;
    ll p=0;
    rep(i,n){
        a+=AC[i];
        if(AC[i]==1)p+=P[i];
    }
    cout<<a<<" "<<p<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

signed main() {
  ll N, M;
  cin >> N >> M;
  if (N == M) {
    COUT("Yes");
  } else {
    COUT("No");
  }
  return 0;
}

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

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



int main()
{
    int A;

    cin >> A;

    rep(i, 3)
    {
        if( A / 100 == 7 )
        {
            cout << "Yes" << endl;
            return 0;
        }
        else if ( A % 100 / 10 == 7 )
        {
            cout << "Yes" << endl;
            return 0;
        }
        else if ( A % 10 == 7 )
        {
            cout << "Yes" << endl;
            return 0;
        }
        else
        {
            cout << "No" << endl;
            return 0;
        }
        
    }



    
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

//sからtへの流量fのフローの最小費用流を求める(Dijkstra法)
//計算量 O(F*E*log(V))

template<typename T>
struct Min_Cost_Flow{
    struct edge{
        int to; T cap, cost; int rev;
        edge(int to, T cap, T cost, int rev) : to(to), cap(cap), cost(cost), rev(rev) {}
    };

    vector<vector<edge>> es;
    vector<T> d, h;
    vector<int> pre_v, pre_e;
    const int INF_T;

    Min_Cost_Flow(int n) : INF_T(numeric_limits<T>::max()){
        es.resize(n), d.resize(n), h.resize(n), pre_v.resize(n), pre_e.resize(n);
    }

    void add_edge(int from, int to, T cap, T cost){
        es[from].eb(to, cap, cost, sz(es[to]));
        es[to].eb(from, 0, -cost, sz(es[from])-1);
    }

    void dijkstra(int s){
        fill(all(d), INF_T);
        using P = pair<T, int>;
        priority_queue<P, vector<P>, greater<P> > que;
        que.emplace(d[s] = 0, s);
        while(!que.empty()){
            T p; int i;
            tie(p, i) = que.top(); que.pop();
            if(p > d[i]) continue;
            rep(j, sz(es[i])){
                edge &e = es[i][j];
                if(e.cap > 0 && chmin(d[e.to], d[i]+e.cost+h[i]-h[e.to])){
                    pre_v[e.to] = i, pre_e[e.to] = j;
                    que.emplace(d[e.to], e.to);
                }
            }
        }
    }

    T min_cost_flow(int s, int t, T flow){
        T ret = 0;
        fill(all(h), 0);
        while(flow > 0){
            dijkstra(s);
            if(d[t] == INF_T) return -1;
            rep(i, sz(es)){
                if(h[i] == INF_T || d[i] == INF_T) h[i] = INF_T;
                else h[i] += d[i];
            }
            T f = flow;
            for(int now = t; now != s; now = pre_v[now]){
                chmin(f, es[pre_v[now]][pre_e[now]].cap);
            }
            ret += f*h[t], flow -= f;
            for(int now = t; now != s; now = pre_v[now]){
                edge &e = es[pre_v[now]][pre_e[now]];
                e.cap -= f, es[now][e.rev].cap += f;
            }
        }
        return ret;
    }
};

int main(){
    int V, E, F;
    cin >> V >> E >> F;
    Min_Cost_Flow<int> G(V);
    rep(i, E){
        int u, v, c, d; cin >> u >> v >> c >> d;
        G.add_edge(u, v, c, d);
    }
    cout << G.min_cost_flow(0, V-1, F) << endl;
}


Measured memory_bytes: 3160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <utility>
#include <set>
#include <numeric>
#include <queue>
#include <sstream>
#include <map>
#include <unordered_map>
#include <cmath>
using namespace std;
using LLI = long long int;

#define Rep(i, N) for (int i = 0; i < N; i++)

int n_LCS(string s, string t) {
    int ns = static_cast<int>(s.size());
    int nt = static_cast<int>(t.size());
 
    vector<vector<int>> dp(ns + 1, vector<int>(nt + 1));
 
    // dp[i][j]: s[1:i+1]とt[1:j+1]のLCSの1つ
    // 先頭に他と重複しない文字列を追加
    s = "A" + s;
    t = "B" + t;
 
    dp[0][0] = 0;
    dp[0][1] = 0;
    dp[1][0] = 0;
    for (int i=1; i<ns+1; i++) {
        for (int j=1; j<nt+1; j++) {
            if (s[i] == t[j]) {
                dp[i][j] = dp[i-1][j-1] + 1;
            } else {
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }

    return dp[ns][nt];
}

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

    int m = n_LCS(S.substr(0, 1), S.substr(1));
    for (int i=2; i<N-1; i++) {
        string s1 = S.substr(0, i);
        string s2 = S.substr(i);
        if (s2.find(s1.substr(s1.size() - m - 1)) != string::npos) {
            m++;
        }
    }

    cout << m << endl;
 
    return 0;
}

Measured memory_bytes: 384
def main():
    N,A,B = map(int,input().split())
    S = input()
    now = 0
    others = 0
    ans = []

    for i in S:

        if i == "a":
            if now < A+B:
                ans.append("Yes")
                now +=1
            else:
                ans.append("No")
        elif i=="b":
            others += 1
            if now < A+B and others<=B:
                ans.append("Yes")
                now += 1
            else:
                ans.append("No")
        else:
            ans.append("No")
    for i in ans:
        print(i)        
if __name__ == '__main__':
    main()

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

ll calc(pll s, pll t){
  if(s.fi > t.fi) swap(s,t);
  ll x1 = s.fi,y1 = s.se, x2 = t.fi, y2 = t.se;
  ll res = 0;
  if(x2 > x1 && y1 > y2){
    res = x2 - x1 + abs(y2 - y1);
  }
  else if(x2 == x1 || y2 == y1){
    res = abs(x2 - x1 + y2 - y1);
  }
  else{
    ll dif2 = x2 - y2;
    ll dif  = x1 - y1;
    res += abs(dif2 - dif);
    if(dif2 - dif > 0){
      x1 += res;
      res += abs(x2 - x1);
    }
    else{
      res += abs(x2 - x1);
    }
  }
  return res;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll w,h,n,ans = 0;
  cin >> w >> h >> n;
  vector<pll> v(n);
  rep(i,n){
    cin >> v[i].fi >> v[i].se;
  }
  rep(i,n-1){
    ans += calc(v[i],v[i+1]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3168
/*------U Have To DO It------*/
/* BY-> RicoProg */
/*        ___ 
           __|__|
          |  |___       */
#include <bits/stdc++.h>
using namespace std;
 
 
//---------------------------------------------------MACROS----------------------------------------------------------
#define ll long long
#define ld long double
#define beg(i ,n) for(ll i=0;i<n;i++)
#define beg1(i ,n) for(ll i=1;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back 
#define mp make_pair
#define nl "\n" 
#define sp " "
#define vec(v , n) vector<ll> v(n)
#define all(x) x.begin() , x.end()
#define pii pair<int , int>
#define pll pair<ll , ll>
#define mii map<int , int>
#define mll map<ll , ll>
#define msi map<string , int>
#define mci map<char , int>
#define f1 first
#define f2 second

//---------------------------------------------------GLOBAL----------------------------------------------------------
const ll MOD2 = 998244353 ;
const ll MOD = 1e9 + 7 ;
const ll MAX = 1e5 + 7 ;
const ll inf = 1e18L + 5 ;
const double pi = 3.14159265358979323846 ;
ll fpow(ll n , ll m ){ll res=1 ;while(m>0){if(m&1){res*=n ;}m/=2 ;n*=n ;}return res;}

//---------------------------------------------------FUNCTIONS-------------------------------------------------------

const ll nax = 1e5 + 5 ;

void solve(){
	string s ;
	cin >> s ;
	ll t ;
	cin >> t ;
	ll n = s.length() ; 
	ll st=1 , e=1 , x=1 , y=n-2 ;
	beg1(i , n){
		if(s[i] != s[i-1]){
			break ;
		}
		x = i+1 ;
		++st ;
	}
	for(int i=n-2 ; i>=0 ; --i){
		if(s[i]!=s[i+1]){
			break ;
		}
		y = i-1 ;
		++e ;
	}
	if(st+e >= n){
		cout << (n*t)/2 ;
		return ;
	}
	else{
		ll b = 0 ; 
		for(int i=x ; i<=y ; ++i){
			if(s[i] == s[i-1]) b++ , s[i] = '-' ;
		}
		ll ans ;
		if(s[0] == s[n-1])
			ans = b*t + st/2 + e/2 + ((st+e)/2)*(t-1) ;
		else
			ans = b*t + (st/2)*t + (e/2)*t ;
		cout << ans ;
	}
}

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

Measured memory_bytes: 256
x,y = map(int ,input().split())
dec = {1:300000, 2:200000, 3:100000}
ans = 0
if x in dec.keys():
	ans += dec[x]
if y in dec.keys():
	ans += dec[y]

if x == 1 and y == 1:
	ans += 400000

print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main(){
	long long n;
	cin >> n;
	map<string,long long> mp;
	for(long long i=0;i<n;i++){
		string s;
		cin >> s;
		mp[s]++;
	}
	long long cnt_max=0;
	for(auto p:mp){
		cnt_max=max(cnt_max,p.second);
	}
	for(auto p:mp){
		if(p.second==cnt_max)cout << p.first << endl;
	}
	return 0;
}


Measured memory_bytes: 25216
N, M = list(map(int, input().split()))
XYZ = [list(map(int, input().split())) for _ in range(N)]

from itertools import product

ans = -1e12
for s, t, u in product([-1,+1], repeat=3):
  #print([(s,x,t,y,u,z) for x,y,z in XYZ if s*x + t*y + u*z>0])
  #print(sum(sorted([s*x + t*y + u*z for x,y,z in XYZ if s*x + t*y + u*z>0], reverse=True)[:M]))
  ans = max(ans,
           sum(sorted([s*x + t*y + u*z for x,y,z in XYZ], reverse=True)[:M]))
  
print(ans)
  

Measured memory_bytes: 3384
//2018年  3月 26日 月曜日 02:00:43 JST
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
string str;

void solve() {
	cin >> str;
	N = sz(str);
	if(str[0] == str[N - 1]) {
		if(N % 2 == 0) cout << "First\n";
		else cout << "Second\n";
	}
	else {
		if(N % 2 == 1) cout << "First\n";
		else cout << "Second\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

int main() {
	string c;
	cin >> c;
	
	if (c.size() == 1) cout << c << endl;
	else if (c[0] == 'x' && c[c.size() - 1] == 'x') cout << "x" << endl;
	else if (c[0] == 'o' && c[c.size() - 1] == 'o') cout << "o" << endl;
	else cout << 'o' << endl;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;

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

int n, a[N],mx,mx2;
multiset < int > s;

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    scanf("%d",&n);

    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] >= mx2) {
        mx = mx2;
        mx2 = a[i];
      }
      else if (a[i] > mx && a[i] < mx2)
        mx = a[i];
    }

    for(int i = 0; i < n; i++)
    {
        if(a[i] == mx2)
         cout << mx << "\n";
        else
         cout << mx2 << "\n";
    }

    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	
	int r;
	cin >> r;
	
	cout << 2 * M_PI * r << endl;
	
	
	return 0;
}


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

#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
#define all(v) (v).begin() , (v).end()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using pii = pair<int , int>;
using pll = pair<long long , long long>;

//プロトタイプ宣言
void faster(void);
template <class T>
T gcd(T , T);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);

ll h;

ll f(ll h){
  if(h==1) return 1;
  return f(h/2)*2 + 1;
}

int main(){
  faster();
  cin >> h;
  cout << f(h);
}



























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
template <class T>
T gcd(T a, T b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 



Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int n, d[100010];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", d + i);
	sort(d, d + n);
	printf("%d\n", d[n/2] - d[n/2-1]);
}

Measured memory_bytes: 512
import sys
readline = sys.stdin.readline

N = int(readline())
T,A = map(int,readline().split())
H = list(map(int,readline().split()))

ans_i = -1
min_h = 10 ** 6

for i in range(len(H)):
  h = T - H[i] * 0.006
  if abs(A - h) < min_h:
    min_h = abs(A - h)
    ans_i = i

print(ans_i + 1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

const double EPS = 1e-8;

using namespace std;
struct Point{
    double x, y, z;
    Point () {}
    Point (double x, double y, double z) :
        x(x), y(y), z(z) {}
};
Point operator - (Point a, Point b){
    return Point(a.x - b.x, a.y - b.y, a.z - b.z);
}
Point operator * (double a, Point b){
    return Point(a * b.x, a * b.y, a * b.z);
}

double dot(Point a, Point b){
    return a.x * b.x + a.y * b.y + a.z * b.z;
}

double abs(Point a){
    return sqrt(dot(a, a));
}


bool is_cross(Point p, Point c, double r){
    bool in_target = (abs(c) < r + EPS);
    bool in_self = (abs(c - p) < r + EPS);
    if(in_self && in_target) return false;
    if(!in_self && in_target) return true;
    if(in_self && !in_target) return true;

    double k = dot(c, p) / dot(p, p);
    if(k < 0 || 1 < k) return false;

    return abs(c - k * p) < r + EPS;
}

int main(){
    int N, M, R;
    while(cin >> N >> M >> R && N){
        vector<Point> sp(N);
        vector<double> sr(N);
        vector<Point> tp(M);
        vector<double> tb(M);
        double ex, ey, ez;
        REP(i, N) cin >> sp[i].x >> sp[i].y >> sp[i].z >> sr[i];
        REP(i, M) cin >> tp[i].x >> tp[i].y >> tp[i].z >> tb[i];
        cin >> ex >> ey >> ez;
        REP(i, N){
            sp[i].x -= ex;
            sp[i].y -= ey;
            sp[i].z -= ez;
        }
        REP(i, M){
            tp[i].x -= ex;
            tp[i].y -= ey;
            tp[i].z -= ez;
        }

        vector<double> score(M);
        for(int i = 0; i < M; i++){
            score[i] = tb[i] / dot(tp[i], tp[i]);
        }

        vector<int> cross(N);
        for(int i = 0; i < N; i++){
            for(int j = 0; j < M; j++){
                if(is_cross(tp[j], sp[i], sr[i])){
                    cross[i] |= 1 << j;
                }
            }
        }

        double ans = 0;
        for(int s = 0; s < (1 << M); s++){
            double score_sum = 0;
            for(int i = 0; i < M; i++)
                if(s >> i & 1)
                    score_sum += score[i];

            if(score_sum < ans) continue;

            int cost = 0;
            for(int i = 0; i < N; i++){
                if(cross[i] & s) cost++;
                if(cost > R) break;
            }

            if(cost <= R){
                ans = score_sum;
            }
        }
        
        printf("%.15f\n", ans);
    }
    return 0;
}

Measured memory_bytes: 1312
#include<stdio.h>

int main()
{
	int n,p,a[55],i;
	int num_1=0;
	long long int ans,m;
	scanf("%d%d",&n,&p);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);	
		if(a[i]%2)	num_1++;
	}
	if(num_1==0)
	{
		if(p)
		{
			printf("0");
			return 0;
		}
		else
		{
			if(n%2)
			{
				ans=1<<(n/2);
				m=2<<(n/2);
				printf("%lld",m*ans);
				return 0;
			}
			else
			{
				ans=m=1<<(n/2);
				printf("%lld",ans*m);
				return 0;
			}
		}
	}
	ans=1<<(num_1-1);
	m=1<<(n-num_1);
	printf("%lld",ans*m);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)

int main(){
  ll n, count = 0;
  double m, sum = 0;
  cin >> n >> m;
  ll A[n];
  RAP(i, n){
    cin >> A[i];
    sum += A[i];
  }
  double limit = sum /(4*m);
  RAP(i, n){
    if(A[i] >= limit){
      count++;
    }
  }
  if(count>=m){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int N, K; cin >> N >> K;
    vec A(N); cin >> A;
    FOR(i, K, N){
        chOut(A[i] > A[i - K], "Yes", "No");
    }

    return 0;
}


Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

P f(int x){
  int a = x%10;
  int b = 0;
  while (x){
    b = x;
    x /= 10;
  }
  return P(a, b);
}

int main(){
  int n;
  cin >> n;
  map<P, int> mp;
  for (int i = 1; i <= n; i++){
    P p = f(i);
    mp[p]++;
  }
  ll ans = 0;
  for (int i = 1; i <= n; i++){
    P p = f(i);
    P q = P(p.second, p.first);
    ans += mp[q];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

kouho = [[] for _ in range(N)]

n = 0
for i, j in ab:
    for k, l in cd:
        kouho[n].append(abs(i-k) + abs(j-l))
    n += 1

for i in range(N):
    Nmin = min(kouho[i])
    for j, k in enumerate(kouho[i]):
        if k == Nmin:
            print(j+1)
            break

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderCore {
	public class Program {
		private const int MOD = 1000000007;

		static Dictionary<string, int>[] memo;

		static void Main (string[] args) {
			int n = int.Parse(Console.ReadLine());
			memo = new Dictionary<string, int>[n];
			for (int i = 0; i < n; i++)
			{
				memo[i] = new Dictionary<string, int>();
			}

			//AGC
			//GAC, ACG, AG*C, A*GC
			int ans = DFS(0, "TTT", n);
			Console.WriteLine(ans);
		}

		public static int DFS(int n, string last3, int max)
		{
			if(n == max){
				return 1;
			}

			if(memo[n].ContainsKey(last3)){
				return memo[n][last3];
			}

			int ret = 0;
			foreach(char c in "AGCT"){
				if(IsOK(last3 + c)){
					ret = (ret + DFS(n + 1, last3.Substring(1, 2) + c, max)) % MOD;
				}
			}

			memo[n][last3] = ret;

			return ret;
		}

		public static bool IsOK(string str){
			if(str.Contains("AGC")){
				return false;
			}

			string temp1 = new string(new char[]{str[1], str[0], str[2], str[3]});
			if(temp1.Contains("AGC")){
				return false;
			}

			string temp2 = new string(new char[]{str[0], str[2], str[1], str[3]});
			if(temp2.Contains("AGC")){
				return false;
			}

			string temp3 = new string(new char[]{str[0], str[1], str[3], str[2]});
			if(temp3.Contains("AGC")){
				return false;
			}

			return true;
		}
	}
}

Measured memory_bytes: 17880
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
int main() {
    int k; cin >> k;
    int A, B; cin >> A >> B;
    bool can = false;

    for(int i=A; i<=B; i++){
        if(i%k == 0) can = true;
    }

    if(can) cout << "OK" << endl;
    else cout << "NG" << endl;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

void dfs(int n, complex<double> left, complex<double> right)
{
  if (n == 0)
    return;
  complex<double> tmp(0.5, 0.5 * sqrt(3));
  complex<double> s = (2.0 * left + right) / 3.0;
  complex<double> t = (left + 2.0 * right) / 3.0;
  complex<double> u = s + (t - s) * tmp;
  dfs(n - 1, left, s);
  cout << fixed << setprecision(10) << s.real() << ' ' << s.imag() << endl;
  dfs(n - 1, s, u);
  cout << fixed << setprecision(10) << u.real() << ' ' << u.imag() << endl;
  dfs(n - 1, u, t);
  cout << fixed << setprecision(10) << t.real() << ' ' << t.imag() << endl;
  dfs(n - 1, t, right);
}

int main()
{
  int n;
  cin >> n;
  cout << fixed << setprecision(10) << 0.0 << ' ' << 0.0 << endl;
  complex<double> p1(0.0, 0.0), p2(100.0, 0.0);
  dfs(n, p1, p2);
  cout << fixed << setprecision(10) << 100.0 << ' ' << 0.0 << endl;

  return 0;
}



Measured memory_bytes: 3228
n, k = gets.split.map(&:to_i)
p = gets.split.map { |num|
  (num.to_f - 1.0) / 2 + 1
}
#print p

culsum = [0]
p.each do |num|
  culsum.push(culsum.last + num)
end

#print culsum

sumres = 0
(0..(n-k)).each do |i|
  sum = culsum[i+k] - culsum[i]
  #puts sum
  if sumres < sum
    sumres = sum
  end
end

puts sumres

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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;
using P = pair<int, int>;

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

  if ((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using ld = long double;

const int N = 2003;
vector<int> g[N];
char s[N];
ll a[N], dp[N], cc[N], md[N];

void dfs(int v, int p) {
	cc[v] = a[v];
	dp[v] = 0;
	md[v] = 0;
	for (int u : g[v]) {
		if (u == p)
			continue;
		dfs(u, v);
		dp[v] += dp[u];
		cc[v] += cc[u];
	}
	for (int u : g[v]) {
		if (u == p)
			continue;
		md[v] = max(md[v], md[u] - (dp[v] - dp[u]));
	}
	md[v] = max(md[v], dp[v] % 2);
	if (p != -1) {
		dp[v] += cc[v];
		md[v] += cc[v];
	}
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, u, v;
	cin >> n >> s;
	rep(i, n)
		a[i] = s[i] - '0';
	rep(i, n - 1) {
		cin >> u >> v;
		u--; v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	ll ans = -1;
	rep(i, n) {
		dfs(i, -1);
		ll sm = 0, mx = 0;
		if (md[i] == 0 && (ans == -1 || ans > dp[i] / 2))
			ans = dp[i] / 2;
	}
	cout << ans;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int n,k;
 
int main(){
  cin >> n >> k;
  
  double res = 0;
  
  for(int i = 1; i <= n; ++i){
    //cout << i << " " << res << endl;
    if(i >= k){
      double cou = 1.0 / n;
      res += cou;
    }else{
      double  cou = 1;
      int c = i;
      while(c < k){
        cou /= 2;
        c *= 2;
      }
      res += cou / n;
    }
  }
  
  printf("%.12f\n",res);
}

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

#define fastIO \
ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
#define ll long long
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pii pair<int,int> 

int main(){
	string a,b;
	cin>>a>>b;
	ll int cnt = 0;
	for(int i=0;i<min(a.length(), b.length());++i){
		if(a[i]==b[i])	cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

long long N, M;


int main(){
	
	scanf("%lld%lld", &N, &M);
	
	if(M<=(N<<1))	printf("%lld\n", M>>1);
	else{
		long long Ans=N;
		M-=(N<<1);
		Ans+=M>>2;
		printf("%lld\n", Ans);
	}
	return 0;
}


Measured memory_bytes: 128
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        long x = sc.nextLong();

        long money = 100;
        int count = 0;
        while(true) {
            count++;
            money = (long) Math.floor(money * 1.01);
            if (money >= x) {
                System.out.println(count);
                return;
            }
        }
    }
}


Measured memory_bytes: 35808
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	vector<vector<int>> g(n);
	rep(i,m){
		int x,y;
		cin>>x>>y;
		x--,y--;
		g[x].push_back(y);
	}
	vector<int> dp(n,-1);
	function<int(int)> dfs=[&](int v){
		if(dp[v]!=-1) return dp[v];
		int ret=0;
		for(auto itr:g[v]){
			chmax(ret,dfs(itr)+1);
		}
		return dp[v]=ret;
	};
	rep(i,n) dfs(i);
	cout<<*max_element(begin(dp),end(dp))<<endl;
}

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

int main() {
	// your code goes here
	int n; cin >> n;
	set<string> st;
	int last = 0;
	for (int i = 0; i < n; i++) {
		string t; cin >> t;
		if ((last and t[0] != last) or st.count(t)) {
			cout << "No";
			return 0;
		}
		st.insert(t);
		last = t.back();
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 256