akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
template<typename A,typename B> inline bool chmax(A &a,const B &b){if(a<b){a=b;return 1;}return 0;}

template<int mod, int base=10007>
struct RollingHash {
    vector<ll> hsh, pwr;
    ll umod(ll n) { return (n % mod + mod) % mod; }
    RollingHash() {}
    RollingHash(const string &s) {
        int sz = (int)s.size();
        hsh.assign(sz + 1, 0);
        pwr.assign(sz + 1, 0);  pwr[0] = 1;
        for (int i = 0; i < sz; ++i) {
            if (sz > i) hsh[i + 1] = umod(hsh[i] * base + s[i]);
            pwr[i + 1] = umod(pwr[i] * base);
        }
    }
    // [l, r)
    ll get(int l, int r) {
        return umod(hsh[r] - hsh[l] * pwr[r - l]);
    }
    // h1 <- h2
    ll join(ll h1, ll h2, int h2_sz) {
        return umod(h1 * pwr[h2_sz] + h2);
    }
    // [idx, len_s) + [0, idx)
    ll rotate(ll idx, int len_s) {
        return join(get(idx, len_s), get(0, idx), idx);
    }
};
using RH1 = RollingHash<(int)1e9 + 7>;
using RH2 = RollingHash<(int)1e9 + 9>;
using RH = pair<RH1, RH2>;
using H = pair<ll, ll>;
RH init(const string &s) { return make_pair(RH1(s), RH2(s)); }
H get(RH &rh, int l, int r) { return make_pair(rh.first.get(l, r), rh.second.get(l, r)); }
H rotate(RH &rh, int n, int sz) { return make_pair(rh.first.rotate(n, sz), rh.second.rotate(n, sz)); }

signed main() {

    string S, T;
    cin >> S >> T;

    int S_sz = S.size();
    int S_sz_tmp = S_sz;
    int T_sz = T.size();

    string S_many = S + S;
    while (S_sz_tmp < T_sz * 3) {
        S_sz_tmp += S_sz;
        S_many += S;
    }

    ll res = 0;
    REP(k, 2) {
        if (k == 1) S_many += S_many;
        RH S_rh = init(S_many);
        RH T_rh = init(T);
        int sz = S_many.size();

        ll tmp = 0;
        REP(i, T_sz) {
            bool ok = false;
            ll ret = 0, cnt = 0;
            for (int j = i; j + T_sz <= sz; j += T_sz) {
                if (get(S_rh, j, j + T_sz) == get(T_rh, 0, T_sz)) {
                    if (ok) {
                        ++cnt;
                    } else {
                        ok = true;
                        cnt = 1;
                    }
                } else {
                    ok = false;
                    chmax(ret, cnt);
                    cnt = 0;
                }
            }
            chmax(ret, cnt);
            chmax(tmp, ret);
        }

        if (k == 0) {
            res = tmp;
        } else {
            if (res != tmp) cout << -1 << endl;
            else cout << res << endl;
        }
    }

}


Measured memory_bytes: 181324
from heapq import *

def dijkstra(sta):
    dist = [10**18]*(N*2510)
    dist[sta] = 0
    pq = []
    heappush(pq, (dist[sta], sta))
    
    while pq:
        d, v = heappop(pq)
        
        if dist[v]<d:
            continue
        
        for nv, w in G[v]:
            if dist[nv]>dist[v]+w:
                dist[nv] = dist[v]+w
                heappush(pq, (dist[nv], nv))
    
    return dist

N, M, S = map(int, input().split())
serial = [[0]*2510 for _ in range(N)]
c = 0

for i in range(N):
    for j in range(2510):
        serial[i][j] = c
        c += 1

G = [[] for _ in range(N*2510)]

for _ in range(M):
    U, V, A, B = map(int, input().split())
    U -= 1
    V -= 1
    
    for i in range(A, 2510):
        G[serial[U][i]].append((serial[V][i-A], B))
        G[serial[V][i]].append((serial[U][i-A], B))

for v in range(N):
    C, D = map(int, input().split())
    
    for i in range(2510):
        if i+C>=2510:
            break
        
        G[serial[v][i]].append((serial[v][i+C], D))

dist = dijkstra(serial[0][min(S, 2509)])

for i in range(1, N):
    ans = 10**18
    
    for j in range(2510):
        ans = min(ans, dist[serial[i][j]])
    
    print(ans)

Measured memory_bytes: 114724
n, a, b = map(int, input().split())
s = input()
a_cnt = b_cnt = 0
p = True
for si in s:
    if si == "c":
        print("No")
    elif si == "a":
        if p:
            print("Yes")
            a_cnt += 1
        else:
            print("No")
    else:
        if p and b_cnt < b:
            print("Yes")
            b_cnt += 1
        else:
            print("No")
    if p and a_cnt + b_cnt == a + b:
        p = False

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

int main(void){

    int n;
    cin >> n;
    vector<long long> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    
    vector<long long> sums1(n);
    sums1[0] = a[0];
    for(int i=1; i<n; i++) {
        sums1[i] = a[i] + sums1[i-1];
    }
    
    vector<long long> sums2(n);
    sums2[n-1] = a[n-1];
    for(int i=n-2; i>=0; i--) {
        sums2[i] = a[i] + sums2[i+1];
    }
    
    long long min = 9999999999;
    for(int i=0; i<n-1; i++) {
        long long delta = sums1[i]-sums2[i+1] > 0 ? sums1[i]-sums2[i+1] : -(sums1[i]-sums2[i+1]);
        if(min > delta) min = delta;
    }
    
    cout << min << endl;
    
    return 0;
}


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

int n;
string s[50];
int calc(int a, int b, bool m) {
	int res = m;
	for (int i = b; i < n; i++) {
		if (s[i].size() <= a)break;
		if ('0' <= s[i][a] && s[i][a] <= '9') {
			if (m)res *= s[i][a] - '0';
			else res += s[i][a] - '0';
		}
		if (s[i][a] == '*') {
			if (m)res *= calc(a + 1, i + 1, 1);
			else res += calc(a + 1, i + 1, 1);
		}
		if (s[i][a] == '+') {
			if (m)res *= calc(a + 1, i + 1, 0);
			else res += calc(a + 1, i + 1, 0);
		}
	}
	return res;
}
int main() {
	while (scanf("%d", &n), n) {
		rep(i, n)cin >> s[i];
		printf("%d\n", calc(0, 0, 0));
	}
}

Measured memory_bytes: 3272
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Programminng
{
    class AOJ_Volume0005
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var input = Console.ReadLine();
                if(string.IsNullOrEmpty(input)) break;

                string[] s = input.Split(' ');
                int a = int.Parse(s[0]);
                int b = int.Parse(s[1]);

                int x = gcd(a, b);
                int y = lcm(a, b);


                Console.WriteLine(x + " " + y);
            }
        }

        private static int gcd(int m, int n)
        {
            if ((m == 0) || (n == 0)) return 0;

            while (m != n)
            {
                if (m > n) m = m - n;
                else n = n - m;
            }
            return m;
        }

        private static int lcm(int m, int n)
        {
            if ((m == 0) || (n == 0)) return 0;
            return ((m / gcd(m, n) * n));
        }
    }
}

Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long x;
    cin >> x;
    
    long long a = x / 3600;
    long long b = (x - a * 3600) / 60;
    long long c = x % 60;

    cout << a << ":" << b << ":" << c << endl;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,M,X;
    cin>>N>>M>>X;

    int C[N];
    int A[N][M];
    rep(i,N){
        cin>>C[i];
        rep(j,M){
            cin>>A[i][j];
        }
    }
    int ans=INF;
    for(int bit=0;bit<(1<<N);bit++){
        int b[M]{};
        int sum=0;
        for(int i=0;i<N;i++){
            if(bit & (1<<i)) {
                sum+=C[i];
                rep(j,M){
                    b[j]+=A[i][j];
                }
            }
        }
        bool z=true;
        rep(i,M){
            if(b[i]<X) z=false;
        }
        if(z) ans=min(ans,sum);
    }
    if(ans==INF) cout << -1 << endl;
    else cout << ans << endl;



}


Measured memory_bytes: 3652
//JOI ?¬¬15 ????????±????????????
#include<iostream>
using namespace std;
int main()
{
	int N,M,T,S[100];
	
	cin >> N >> M;
	for(int i=0;i<N;i++)
		cin >> S[i];
	for(int k=1;k<=M;k++){
		for(int i=0;i<N-1;i++){
			if(S[i]%k > S[i+1]%k){
				T = S[i];
				S[i] = S[i+1];
				S[i+1] = T;
			}
		}
	}
	for(int i=0;i<N;i++)
		cout << S[i] << endl;
	return 0;
}

Measured memory_bytes: 3088
a, b, c = map(int, input().split())

bell_1 = a + b
bell_2 = b + c
bell_3 = c + a

if (bell_1 <= bell_2) and (bell_1 <= bell_3):
    print(bell_1)

elif (bell_2 <= bell_1) and (bell_2 <= bell_3):
    print(bell_2)

elif (bell_3 <= bell_1) and (bell_3 <= bell_2):
    print(bell_3)
    


Measured memory_bytes: 9076
#include <stdio.h>
#include <stdlib.h>
#define VMAX 10000

int main(){
  unsigned short *A,*B;
  int i,j,n;
  int C[VMAX+1];
 
  scanf("%d",&n);
  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]); 
  }
  
  for(i=0;i<VMAX;i++){
    C[i] = 0;
  }
  
  for(j=0;j<n;j++){
    C[A[j]]++;
  }

  for(i=1;i<VMAX;i++){
    C[i] = C[i] + C[i-1];
    //printf("C[%d]:%d\n",i,C[i]);
  }
  
  for(j=n-1;j>=0;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  for(i=1;i<n+1;i++){
    if(i == n) printf("%d\n",B[i]);
    else printf("%d ",B[i]);
   }
  return 0;
}



Measured memory_bytes: 9652
let () =
    let main () =
        let n, k, q = Scanf.sscanf (read_line ()) "%d %d %d" (fun a b c -> a, b, c) in
        let p = Array.make n (k - q) in
        for i = 1 to q do
            let a = int_of_string (read_line ()) - 1 in
            p.(a) <- p.(a) + 1
        done;
        Array.iter (fun v -> print_endline (if v > 0 then "Yes" else "No")) p
    in
    main ()

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

#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
#define ll long long int

int main() {
	int n;
	int ac = 0,wa = 0,tle=0,re=0;
	cin >> n;
	string x;
	rep(i,n){
		cin >> x;
		if(x == "AC"){
			ac++;
		}
		else if(x == "WA"){
			wa++;
		}
		else if(x == "TLE"){
			tle++;
		}
		else{
			re++;
		}
	}
	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define int long long
using namespace std;
    main(){
    int n;
    cin >> n;
    set<char> s1;
    char x;
    for(int i = 1 ; i <= n;i++){
        cin >> x;
        s1.insert(x);
    }
    if(s1.size() == 3)return cout <<"Three",0;
    else cout <<"Four";


    }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
ll INF = (1LL << 50) - 1;
int MOD = 1e9+7;
struct Edge{
    int from,to;
    ll cost;
    Edge(){}
    Edge(int a,int b,ll c){
        from = a;
        to = b;
        cost = c;
    }
};
int V,E;
vector<Edge> edge;
vector<ll> dist;
bool bellman_ford(int s,int t){
    //fill(dist,dist+V,INF);
    dist[s] = 0;
    for(int i = 0;i < V*2;i++){
        for(int j = 0;j < E;j++){
            Edge e = edge[j];
            if(dist[e.from] != -INF && dist[e.to] < dist[e.from] + e.cost){
                dist[e.to] = dist[e.from] + e.cost;
                if(i >= V-1 && e.to == t)return true;
            }
        }
    }
    return false;
}
main(){
    cin >> V >> E;
    dist = vector<ll>(V,-INF);
    edge = vector<Edge>(E);
    rep(i,0,E){
        int a,b,c;
        cin >> a >> b >> c;
        a--,b--;
        edge[i] = Edge(a,b,c);
    }
    if(bellman_ford(0,V-1)){
        cout << "inf" << endl;
    }else{
        cout << dist[V-1] << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
int main(){
	int n,m;
	cin>>n>>m;
	vector<pi>arr(m);
	for(int i=0; i<m; i++) cin>>arr[i].first>>arr[i].second;
	if(n==1){
		for(int i=0; i<10; i++){
			int number[2]={0};
			number[1] = i;
			bool possible = true;
			for(int j=0; j<m; j++){
				if(number[arr[j].first]!=arr[j].second) possible = false;
			}
			if(possible){
				cout<<i;
				return 0;
			}
		}
	}
	else if(n==2){
		for(int i=10; i<100; i++){
			int number[3]={0};
			number[1] = i/10;
			number[2] = i%10;
			bool possible = true;
			for(int j=0; j<m; j++){
				if(number[arr[j].first]!=arr[j].second) possible = false;
			}
			if(possible){
				cout<<i;
				return 0;
			}
		}
	}
	else{
		for(int i=100; i<1000; i++){
			int number[4]={0};
			number[1] = i/100;
			number[3] = i%10;
			number[2] = (i/10)%10;
			bool possible = true;
			for(int j=0; j<m; j++){
				if(number[arr[j].first]!=arr[j].second) possible = false;
			}
			if(possible){
				cout<<i;
				return 0;
			}
		}
	}
	cout<<-1;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define LL long long
#define ld long double
using namespace std;
const int inf=1e9,M=60;
int n,c[M][M];double x;LL ans,num;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lf",&x);
		if((int)x==x)ans--;
		LL y=(LL)((ld)x*inf+0.5);
		int c1=0,c2=0;
		while(y%2==0)c1++,y/=2;
		while(y%5==0)c2++,y/=5;
		// cout<<c1<<" "<<c2<<endl;
		c[c1][c2]++;
	}
	for(int i=0;i<M;i++)
		for(int j=0;j<M;j++)
			for(int k=0;k<M;k++)
				for(int l=0;l<M;l++)
					if(min(i+k,j+l)>=18)ans+=1ll*c[i][j]*c[k][l];
	cout<<ans/2;
	return 0;
}

Measured memory_bytes: 3840
module Main where

import Control.Applicative
import Data.List

getInt :: IO Int
getInt = head <$> getInts

getInts :: IO [Int]
getInts = map read . words <$> getLine 

main :: IO ()
main = do
  { xs <- getInts
  ; putStrLn $ unwords $ map show $ sort xs
  }



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

int main(){
  int n; cin>>n;
  string b;
  if(n==1){
    int a; cin>>a;
    cout<<a<<endl;
    return 0;
  }
  vector<string> s(n+1);
  rep(i,n){
    cin>>s[i+1];
  }
  if(n%2==0){
    for(int i=n; i>=2; i-=2){
      cout<<s[i]<<" ";
    }
    for(int i=1; i<=n-1; i+=2){
       cout<<s[i]<<" ";
    }
  }else{
    for(int i=n; i>0; i-=2){
      cout<<s[i]<<" ";
    }
    for(int i=2; i<=n-1; i+=2){
      cout<<s[i]<<" ";
    }
  }
  cout<<endl;
}


Measured memory_bytes: 9512
#include<bits/stdc++.h>
using namespace std;
#define ll                  long long
#define rep(i,n)            for(ll i=0;i<n;i++)
#define hell                1000000007LL
#define vi                  vector<ll>
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pii                 pair<int,int>
#define all(c)              c.begin(),c.end()
#define mini(c)             min_element(all(c))
#define maxi(c)             max_element(all(c))
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
ll Max(ll a, ll b) { return a > b ? a : b; }
ll Min(ll a, ll b) { return a < b ? a : b; }
ll power(ll x, ll y,ll p)
{
    ll res=1;
    x=x%p;
    while(y>0)
    {
        if(y&1)
            res=((res%p)*(x%p))%p;
        y=y>>1;
        x=((x%p)*(x%p))%p;
    }
    return res;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,ans=0,sum=0;
    cin>>n;
    vi arr(n,0);
    rep(i,n)
    {
        cin>>arr[i];
    }
    rep(i,n)
    {
        sum+=arr[i];
        if(arr[i]==0)
        {
            ans+=(sum/2);
            sum=0;
        }
    }
    ans+=(sum/2);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_set>
# include <unordered_map>
using namespace std;




int main(int argc, const char * argv[]) {
#ifdef __APPLE__
    freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt","r",stdin);
    //freopen("/Users/danya.smelskiy/Documents/Danya/Danya/output.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int x, y;
    cin >> y >> x;
    y -= x;
    cout << (x == 1 ? 0 : y) << '\n';
    return 0;
}



Measured memory_bytes: 256
# def solve(n,m,a,b):
#     ans = 0
#     lim = (a*n+b)//m
    
#     for i in range(1,lim+1):
#         l = (i*m-b+a-1)//a
#         r = (i*m+m-b-1)//a

#         ans += (min(r,n-1)-l+1)*i

#     return ans

def floor_sum(n, m, a, b):
    ans = 0

    # (a*i+b)//m
    '''    
        k = a//m
        series 
            k + 2k + 3k + ... (n-1)k 
    '''
    if a>=m:
        ans += n*(n-1)*(a//m)//2
        a %= m


    '''
        k = b//m
        for each i

        series
            k + k + ... + k <n-1 times>
    '''
    if b>=m:
        ans += n*(b//m)
        b %= m

    yn = (a*n+b)//m

    if yn == 0:
        return ans #yn == 0 implies prev terms contibute 0 so return ans

    x_least = (yn * m - b) #the first x for which y(x) == yn ,'x_least' refers to the val a*x.

    l = (x_least+(a-1))//a
    r = n-1 

    return ans + (r-l+1)*yn + floor_sum(yn, a, m, (a-x_least%a)%a)
    '''
    #r+1 as we pass the element that does not belong in the range.

    '''
def main():
    t = int(input())
    while t>0:
        n,m,a,b = map(int, input().split(' '))
        # print(solve(n,m,a,b))
        print(floor_sum(n,m,a,b))
        t-=1

if __name__ == "__main__":
    main()




#left code
    # ans += (r-l+1)*yn  #if ans was not returned then this implies y(n) == y(n-1) == yn. element in window [l...r] have y(x) = yn
    # ans += floor_sum(yn, a, m, (a-x_least%a)%a)

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

using namespace std;
bool solve() {
    string s;
    cin >> s;
    bool flg = false;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'C') flg = true;
        if (flg && s[i] == 'F') return true;
    }
    return false;
}
int main() {
    if(solve()) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//21
#include<iostream>
#include<algorithm>
#include<numeric>

using namespace std;

int m,n;
int w[100];
int memo[21][100];

int mw(int rm,int f){
  if(rm==1){
    return accumulate(w+f,w+n,0);
  }else if(memo[rm][f]!=-1){
    return memo[rm][f];
  }else{
    int mnw=1<<30;
    for(int i=f;i<n;i++){
      mnw=min(mnw,max(accumulate(w+f,w+i,0),mw(rm-1,i)));
    }
    memo[rm][f]=mnw;
    return mnw;
  }
}

int main(){
  while(cin>>m>>n,m|n){
    fill(memo[0],memo[21],-1);
    for(int i=0;i<n;i++){
      cin>>w[i];
    }
    cout<<mw(m,0)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1168
# -*- coding:utf-8 -*-

def main():
    for i in range(int(input())):
        x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())

        if abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<1e-10:
            print("YES")
        else:
            print("NO")
    
        
if __name__ == '__main__':
    main()

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

int main() {
	// 初期設定
	int cnt1,maxcnt1,maxcnt2,answer=0;
  vector<string> word;
  vector<string> delword;

  // Nカード取り込み
  int N;
  cin >> N;
  vector<string> s(N);
  for (int i = 0; i < N; i++) {
    cin >> s.at(i);
  }
  // Mカード取り込み
  int M;
  cin >> M;
  vector<string> t(M);
  for (int j = 0; j < M; j++) {
    cin >> t.at(j);
  }
  // answer探しループ
  for (int o =0; o < N; o++) {
    //　s重複チェック
    maxcnt1 =0;
    for (int k = 0; k < s.size(); k++) {
      cnt1 = 0;
      for (int l = 0; l < s.size(); l++) {
        if (s.at(k) == s.at(l)) {
          cnt1++;
        }
        if (maxcnt1 < cnt1) {
          maxcnt1 = cnt1;
          word = {s.at(k)};
        }
      }
    }
    //　t重複チェック
    maxcnt2 = 0;
    for (int m = 0; m < t.size(); m++) {
      if (word.at(0) == t.at(m)) {
        maxcnt2++;
      }
    }
    // 最終チェック
    delword = word;
    if (answer < (maxcnt1 - maxcnt2)) {
      answer = maxcnt1 - maxcnt2;
    }
    if (s.size() < answer) {
      break;
    }
    if (s.size() == 0) {
      break;
    }
    //　delword削除 
    vector<string> S;
    if (delword.size() > 0) {
      for (int r = 0; r < s.size(); r++) {
        if (s.at(r) != delword.at(0)) {
          S.push_back(s.at(r));
        }
      }
      //s置き換え
      s = S;
    }
    //　delword削除2
    vector<string> T;
    if (delword.size() > 0) {
      for (int n = 0; n < t.size(); n++) {
        if (t.at(n) != delword.at(0)) {
          T.push_back(t.at(n));
        }
      }
      t = T;
    }
  }
    if (answer < 0) {
      answer = 0;
    }
  cout << answer << endl;
}

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

using namespace std;


int main() {
	int n, z, w;
	cin >> n >> z >> w;
	int a[2002] = {};
	int i = 1;
	a[0] = w;
	for (; i <= n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	ans = max(abs(a[n - 1] - a[n]), abs(a[n] - w));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


i64 n;

int main(){
	cin >> n;
	
	i64 ans = LINF;
	for(i64 i = 1; i*i <= n; i++){
		if(n % i == 0){
			ans = min(ans, i+n/i-2);
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

int main() {
    ll A, B;
    cin >> A >> B;
    if (A == B) {
        cout << "Draw" << endl;
    }
    else {
        if (A == 1) {
            cout << "Alice" << endl;
        }
        else if (B == 1) {
            cout << "Bob" << endl;
        }
        else if (A < B) {
            cout << "Bob" << endl;
        }
        else {
            cout << "Alice" << endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream> 
#include <stdlib.h> 
#include <string.h> 
#include <string> 
#include <sstream>
#include <cstring> 
#include<cmath>
using namespace std;
int main()
{
    int x, z = 0;
    int y[101];
    cin >> x;

    for (int i = 0; i < x; i++) {
        cin >> y[i];
        if (i > 0) {
            int c = 0;
            for (int j = i-1; j >=0; j--) {
                
                if (y[i] == y[j] && c == 0) {
                    z++;
                    c = 1;
                }
            }
        }
    }
   
        cout << x - z;
    
    return 0;
}

Measured memory_bytes: 3472
#include<iostream>
#include<cstdio>
#include<cmath>
#include<set>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=1e5+5;
multiset<int>se[N];
typedef pair<int,int> pii;
set<pii>ma;
pii a[N];
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d%d",&a[i].second,&a[i].first);
    ll ans=0;
    ll sum=0;
    sort(a+1,a+n+1,greater<pii>());
    ll x=0;
    for(int i=1;i<=k;i++){
        if(se[a[i].second].size()==0) x++;
        sum+=a[i].first;
        se[a[i].second].insert(a[i].first);
    }
    ans=sum+x*x;
    for(int i=1;i<=n;i++){
        if(se[i].size()>1){
            ma.insert(pii(*se[i].begin(),i));
        }
    }
    for(int i=k+1;i<=n;i++){
        if(se[a[i].second].size()==0&&ma.size()>0){
            auto it=*ma.begin();
            sum-=it.first;
            sum+=a[i].first;
            x++;
            ans=max(ans,sum+x*x);
            se[it.second].erase(se[it.second].begin());
            ma.erase(it);
            se[a[i].second].insert(a[i].first);
            if(se[it.second].size()>1){
                ma.insert(pii(*se[it.second].begin(),it.second));
            }
        }
    }
    cout<<ans;
}


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

int main()
{   

    //データ定義
    int n;
    
    //データ入力
    cin >> n;

    //メイン処理
    for(int i = 1; i <= n; i++){
        int x = i;
        if( x % 3 == 0){
            cout << " " << i;
        }else{
            do{
                if( x % 10 == 3){
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }while(x);
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3104
n = int(input())
p = [0] + list(map(int, input().split())) + [0]
ans = 'YES'
d = {}
for i in range(n):
    if p[i] != i:
        if p[p[i]] == i:
            d[tuple(sorted([i, p[i]]))] = 0
            continue
        else:
            ans = 'NO'
            break
if len(d) > 1:
    ans = 'NO'
print(ans)


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

int n, k;
int h[100000+10];

int main() {
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) scanf("%d", &h[i]);
	sort(h, h + n);
	int ans = 1e9 + 10;
	for (int i = 0; i < n - k + 1; i++) {
//		printf("%d %d %d\n", h[i], h[i + k - 1], h[i + k - 1] - h[i]);
		ans = min(ans, h[i + k - 1] - h[i]);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5+5;

int main(){
	ll x, y;
	scanf("%lld%lld", &x, &y);
	int ans = 0;
	while(x <= y){
		++ans;
		x <<= 1;
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <map>
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
 
int main()
{
  string a;
  cin >> a;
  bool target = false;
  int maximum = 0;
  int length = 0;
  int index, position;
  for (int i = 0; i < a.length(); ++i) {
    char s = a[i];
    if (!target && (s == 'A' || s == 'T' || s == 'G' || s == 'C')) {
      index = i;
    }
    if (s == 'A' || s == 'T' || s == 'G' || s == 'C') {
        target = true;
        length++;
    } else {
        target = false;
        if (length > maximum) {
          position = index;
          maximum = length;
        }
        index = 0;
        length = 0;
    }
    
  }
  if (length > maximum) {
          position = index;
          maximum = length;
   }
 
  cout << maximum << endl;
  return 0;
}

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

using namespace std;

const long long upper = 1e9;

int main() {
  long long s;
  cin >> s;
  long long x = 1e9, a = 1, b = 1, y = 1;
  b = s / x;
  long long r = s - x * b;
  if (r > 0) {
    r -= x;
    ++b;
  }
  y = -r;
  assert(x *b - y * a == s);
  assert(a <= upper && b <= upper && y <= upper);
  printf("0 0 %lld %lld %lld %lld\n", x, y, a, b);
  return 0;
}


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

void sieve(){
    bool prime[1000000+1];
    memset(prime, true, sizeof(prime));

    for(int p=2; p*p<=1000000; p++){
        if(prime[p] == true){
            for(int i=p*p; i<=1000000; i += p)
                prime[i] = false;
        }
    }

    for(int p=2; p<=1000000; p++){
        if(prime[p]){
            v.push_back(p);
        }
    }
}

int main(){
    int x;
    cin>>x;
    sieve();
    vector<int>::iterator upper,lower;
    upper = upper_bound(v.begin(), v.end(), x);
    lower = lower_bound(v.begin(), v.end(), x);

    if(x == v[lower-v.begin()]){
        cout<<x<<endl;
    }
    else{
        cout<<v[upper - v.begin()]<<endl;
    }
}


Measured memory_bytes: 1916
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
 int h,w;
 cin>>h>>w;
 string s[50];
 for(int i=0;i<h;i++){
  cin>>s[i];
 }
 vector<int> dx={-1,-1,-1,0,0,1,1,1};
 vector<int> dy={-1,0,1,-1,1,-1,0,1};

 for(int i=0;i<h;i++){
  for(int j=0;j<w;j++){
   if(s[i][j]=='#')continue;
   int num=0;
   for(int k=0;k<8;k++){
    if(i+dx[k]<0||i+dx[k]>=h)continue;
    if(j+dy[k]<0||j+dy[k]>=w)continue;
    if(s[i+dx[k]][j+dy[k]]=='#')num++;
   }
   s[i][j]=char(num+'0');
  }
 }
 for(int i=0;i<h;i++)cout<<s[i]<<endl;
 return 0;
}


Measured memory_bytes: 256
def main():
    n, c, k = map(int, input().split())
    t = [int(input()) for _ in range(n)]
    t.sort()
    ans = 0
    passengers = 0
    first = t[0]
    for tn in t:
        if tn > first + k or passengers == c:
            ans += 1
            passengers = 0
            first = tn
        passengers += 1

    print(ans + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 13308
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long,long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

const ll MAX = 1LL<<60;

int main() {
    int N,Q; cin >> N >> Q;
    string S; cin >> S;
    vector<int> s(N+1);
    REP(i,N) {
        if(S[i] == 'A' && S[i+1] == 'C') s[i+1] = s[i] + 1;
        else s[i+1] = s[i];
    }
    //REP(i,N+1) cout << s[i] << endl;
    REP(i,Q) {
        int l,r;cin >> l >> r;
        l--;
        r--;
        cout << s[r] - s[l] << endl;
    }
}

Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <string>
#include <limits.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>

using namespace std;

int main(int argc, char* argv[]){
  string a;
  cin >> a;
  if(a[0]==a[a.length()-1]){
  	cout << "Yes"<<endl;
  }else{
  	cout << "No" << endl;
  }

  cout << endl;
  return 0;
}


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

int main() {

	int N;
	cin >> N;
	
	int P,W,G,Y;
	P = 0;
	W = 0;
	G = 0;
	Y = 0;
	
	for(int i = 0;i < N; i++){
		string S;
		cin >> S;
		
		if (S == "P") {
      		P = 1;
    	}else if (S == "W") {
      		W = 1;
      	}else if (S == "G") {
      		G = 1;
      	}else if (S == "Y") {
      		Y = 1;
      	}
    }
    if (3 == P + W + G + Y){
    	cout << "Three";
    }else if (4 == P + W + G + Y){
    	cout << "Four";
    }
}


Measured memory_bytes: 3588
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var d = int.Parse(line[0]);
        var n = int.Parse(line[1]);
        int a;
        if (d == 0) a = 1;
        else if (d == 1) a = 100;
        else a = 10000;
        var ret = n * a;
        if (n == 100) ret = 101 * a;
        Console.WriteLine(ret);
    }
}

Measured memory_bytes: 13140
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)){
			int num = sc.nextInt();
			List<Integer> pieces = new ArrayList<Integer>();
			for (int i=0; i<num; i++) pieces.add(sc.nextInt());
			int times = sc.nextInt();
			for (int i=0; i<times; i++) {
				int call = sc.nextInt()-1;
				int now = pieces.get(call);
				if ((now!=2019) && (!pieces.contains(now + 1))) {
					pieces.set(call, now+1);
				}
			}
			for (int i=0; i<num; i++) {
				System.out.println(pieces.get(i));
			}
		}
	}
}



Measured memory_bytes: 26572
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  int c[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> c[i][j];
    }
  }

  
  int a[3];
  int b[3];
  for (a[0] = 0; a[0] <= 100; a[0]++) {
    for (a[1] = 0; a[1] <= 100; a[1]++) {
      for (a[2] = 0; a[2] <= 100; a[2]++) {
        b[0] = c[0][0] - a[0];
        b[1] = c[0][1] - a[0];
        b[2] = c[0][2] - a[0];

        bool all = true;
        for (int i = 0; i < 3; i++) {
          for (int j = 0; j < 3; j++) {
            all &= c[i][j] == a[i] + b[j];
          }
        }
        if (all) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
int main(void)
{

  int af, bf, count = 0;
  cin >> af;
  vector<int> vec(af + 1, 0);
  map<int, int> m;
  for (int i = 1; i <= af; i++)
  {
    cin >> vec[i];
    m[vec[i]] = i;
  }

  sort(vec.begin() + 1, vec.begin() + af + 1);

  for (int i = 1; i <= af; i++)
  {
    cout << m[vec[i]] << ' ';
  }

  cout << endl;
}


Measured memory_bytes: 5888
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import math

    
def main():
	num = int(input())
	sum = 0
	for i in range(num):
		a = i+1
		for j in range(num):
			b = j+1
			for k in range(num):
				c = k+1
				sum += math.gcd(math.gcd(a,b),c)
	print (sum)

if __name__ == '__main__':
	main()


Measured memory_bytes: 9068
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define cst first
#define dur second
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e5 + 5, M = 2 * N + 5;

ll a[N];
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0 ; i <= n ; ++i)
        scanf("%d", a + i);
    ll ans = 0;
    for(int i = 0 ; i < n ; ++i){
        ll x;
        scanf("%lld", &x);
        ll mn = min(x, a[i]);
        a[i] -= mn;
        x -= mn;
        ans += (1LL * mn);
        mn = min(x, a[i + 1]);
        a[i + 1] -= mn;
        ans += (1LL * mn);
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(void){
  int kazu,hantei=0;
  cin>>kazu;
  for(int i=0;i<kazu;i++){
    string c;
    cin>>c;
    if(c=="Y"){
      cout<<"Four"<<endl;
      hantei++;
      break;
    }
  }
  if(hantei==0){
    cout<<"Three"<<endl;
  }
}
  
    

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    string s;
    cin >> s;

    if(s[0] != 'A'){
        cout << "WA" << endl;
        return 0;
    }
    
    bool flag = false;
    int c;
    for(int i = 2; i < s.size() - 1; i++){
        if(flag && s[i] == 'C'){
            cout << "WA" << endl;
            return 0;
        }
        if(s[i] == 'C'){
            flag = true;
            c = i;
        } 
    }
    if(!flag){
        cout << "WA" << endl;
        return 0;
    }

    FOR(i, 1, s.size()){
        if(i == c) continue;
        if(s[i] < 'a' || s[i] > 'z'){
            cout << "WA" << endl;
            return 0;
        }
    }
    cout << "AC" << endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
M = 1000
buy = 0
for i in range(N-1):
    if A[i]<A[i+1]:
        p = M // A[i]
        buy = p*A[i]
        M = M - buy +p * A[i+1]
print(M)
        


Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int n;cin>>n;
	int x[n];
	int X[n];
	for(int i=0;i<n;++i){
		cin>>x[i];
		X[i]=x[i];
	}
	
	sort(x,x+n);
	int a=n/2;
	for(int i=0;i<n;++i){
		if(X[i]<x[a]){
			cout<<x[a]<<endl;
		}else{
			cout<<x[a-1]<<endl;
		}
	}
}

Measured memory_bytes: 3712
import java.util.*;

public class Main{
	public static void main(String[] args) {
	    Scanner sc=new Scanner(System.in);
	    int r=sc.nextInt();
	    int g=sc.nextInt();
	    int b=sc.nextInt();
	    int k=sc.nextInt();
	    
	    b*=(int)Math.pow(2, k);
	    for(int i=0;i<=k;i++) {
	    	if(r<g && g<b) {
	    		System.out.println("Yes");
	    		System.exit(0);
	    	}else {
	    		b/=2;
	    		g*=2;
	    	}
	    }
	    
	    System.out.println("No");

	    
	}
}


Measured memory_bytes: 35844
#include<stdio.h>
int abc(int x){
  int k=1;
  while(x/10>=1){
    x/=10;
    k++;
  }
  return k;
}
int main(void){
  int n,count=0;
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    if(abc(i)%2!=0)count++;
  }
  printf("%d",count);
  return 0;
}

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

#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(),(a).end()
#define pii pair<ll,ll>
#define rep(x,n) for(ll i=x;i<n;++i)
#define repd(x,n) for(ll i=x-1;i>=n;--i)
#define repn(x,n) for(ll j=x;j<n;++j)
#define repnd(x,n) for(ll j=x-1;j>=n;--j)
#define dbg(x,y) cout<<x<<" "<<y<<endl
#define endl '\n'
#define M 1000000007
const ll INF = 1ll<<60;

using namespace std;
//-----------------------------------------//

void solve(){
	int a;
	cin>>a;
	int p=a+a*a+a*a*a;
	cout<<p<<endl;
}

int main(){
	solve();

}





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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,f,n) for(int i=f;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(4)
#define int long long
using pii = pair<int,int>;
using Graph = vector<vector<pii> >;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
constexpr int dy[] = {0,1,0,-1,1,-1,-1,1};
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class A, class B> inline A updiv(const A a,const B b){ return (a + b - 1) / b; }
template <class A, class B> inline A gcd(const A a,const B b){ return b ? gcd(b,a % b) : a; }
template <class A, class B> inline A lcm(const A a,const B b){ return a / gcd(a,b) * b; }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A,class B> using umap = unordered_map<A,B>;
 
 
signed main(void){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<int> m;

    m.emplace_back(1);
    int x = 6;

    while(x <= n){
        m.emplace_back(x);
        x *= 6;
    }

    x = 9;

    while(x <= n){
        m.emplace_back(x);
        x *= 9;
    }

    sort(all(m));
    m.erase(unique(all(m)), m.end());

    int siz = m.size();
    vector<int> dp(n+1, INF);
    dp[0] = 0;

    rep(i, siz){
        for(int j = 0; j + m[i] <= n; ++j){
            chmin(dp[j+m[i]], dp[j] + 1);
        }
    }

    cout << dp[n] << '\n';

    return 0;
}

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

using namespace std;

typedef long long ll;
const int MAX_N = (1<<18)-1;

vector<ll> x;
vector<ll> dat[MAX_N];

void init(int k, int l, int r)
{
    if (r - l == 1) {
        dat[k].push_back(x[l]);
    } else {
        int lch = k * 2 + 1, rch = k * 2 + 2;
        init(lch, l, (l + r) / 2);
        init(rch, (l + r) / 2, r);
        dat[k].resize(r - l);

        merge(dat[lch].begin(), dat[lch].end(),
              dat[rch].begin(), dat[rch].end(),
              dat[k].begin());
    }
}

int query(int i, int j, ll x, int k, int l, int r)
{
    if (j <= l || r <= i) {
        return 0;
    } else if (i <= l && r <= j) {
        return upper_bound(dat[k].begin(), dat[k].end(), x) - dat[k].begin();
    } else {
        int lc = query(i, j, x, k * 2 + 1, l, (l + r) / 2);
        int rc = query(i, j, x, k * 2 + 2, (l + r) / 2, r);
        return lc + rc;
    }
}

int main()
{
    ll D, Q, l, r, e;
    scanf("%lld", &D);
    x.resize(D);
    for (int i = 0; i < D; i++) {
        scanf("%lld", &x[i]);
    }    
    
    init(0, 0, D);
    
    scanf("%lld", &Q);
    while (Q--) {
        scanf("%lld %lld %lld", &l, &r, &e);
        l--; r--;
        ll a = min(x[l], x[r]) - e, b = max(x[l], x[r]) + e;        
        printf("%lld\n", query(l, r+1, a-1, 0, 0, D) + (r - l + 1)
                       - query(l, r+1, b, 0, 0, D));
    }
    return 0;
}

Measured memory_bytes: 27152
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

int N, K;
int g;

int coin(int i) {
    int cnt = 0;
    while (i < K) {
        i *= 2;
        cnt++;
        g = max(g, cnt);
    }
    return cnt;
}

int main() {

    while (cin >> N >> K) {
        double e = 0;
        int f = 0;
        g = 0;
        for (int i = 1; i <= N; i++) {
            int c = coin(i);
            double d = 1.0 / pow(2, c);
            f += pow(2, g - c);
            e += d;
        }
        cout << fixed << setprecision(12) << ((long double) f / (N * pow(2, g))) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import sys, bisect, collections, math
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
MOD = 1000000007
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N = I()
    AB = [LI() for _ in range(N)]

    # A, Bを標準化 互いに疎でAは正
    def normalize(AB):
        A = AB[0]
        B = AB[1]
        if A==B==0:
            return (0, 0)
        elif A==0:
            return(0, 1)
        elif B==0:
            return(1, 0)
        else:
            gcd = math.gcd(A, B)
            A //= gcd
            B //= gcd
            if A<0:
                A, B = -A, -B
            return (A, B)
    
    def orthogonal(AB):
        A = AB[0]
        B = AB[1]
        if B>0:
            return (B, -A)
        else:
            return(-B, A)

    AB_n = [normalize(i) for i in AB]
    counter = collections.Counter(AB_n)

    # 場合の数を求める
    used = set()
    ans = 1
    # (0, 0)以外について
    for A, B in AB_n:
        if not (A, B) in used:
            if (A, B)!=(0, 0):
                ans *= pow(2, counter[(A, B)], MOD) + pow(2, counter[orthogonal((A, B))], MOD) - 1
                ans %= MOD
                used.add((A, B))
                used.add(orthogonal((A, B)))
    ans -= 1
    # (0, 0)について
    ans += counter[(0, 0)]
    ans %= MOD

    print(ans)

if __name__ == '__main__':
    resolve()


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

using namespace std;

#define mod 1e9+7

int main()

{

    int a,b;

    cin>>a>>b;

    if(b>=a*2&&b<=a*4&&b%2!=1)

    {

        cout<<"Yes";

    }

    else

    {

        cout<<"No";

    }

    return 0;

}

Measured memory_bytes: 3624
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}
use input::*;

fn main() {
    let (n, k): (usize, usize);
    input!(n, k);
    let input = input_vector::<usize>();
    let mut count = 0;
    let mut v = vec![0; n];
    for z in input {
        if v[z - 1] == 0 {
            count += 1;
        }
        v[z - 1] += 1;
    }
    v.sort();
    if count <= k {
        count = 0;
    } else {
        count = count - k;
    }
    let mut ans = 0;
    for z in v {
        if count == 0 {
            break;
        }
        if z > 0 {
            ans += z;
            count -= 1;
        }
    }
    p(ans);
}


Measured memory_bytes: 8444
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

bool alpha[26];
int main(void) {
  memset(alpha, false, sizeof(alpha));
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) alpha[s[i]-'a'] = true;
  for (int i = 0; i < 26; i++) {
    if (!alpha[i]) {
      cout << (char)(i+'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) 
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }

int pr[4] = {6000, 4000, 3000, 2000};
int a, b;

int main() {
	while (cin >> a >> b) {
		cout << b * pr[a-1] << endl;
	}
    return 0;
}


Measured memory_bytes: 1160
#!/usr/bin/env python3
from collections import deque
n, m = map(int, input().split())
x = [[] for i in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    x[a] += [b]
    x[b] += [a]
ans = [0] * (n + 1)
ans[1] = 1
que = deque([1])
while que:
    q = que.popleft()
    for i in x[q]:
        if ans[i] == 0:
            ans[i] = q
            que.append(i)
print("Yes")
print(*ans[2:], sep="\n")

Measured memory_bytes: 35548