akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC

int solve(int n, vector <int> a, vector <int> b) {

    auto comp = [&](int i, int j) {
        return b[i] - a[i] < b[j] - a[j];
    };   

    vector <int> per;
    for (int i = 0; i < 3; ++i)
        per.app(i);
    sort(all(per), comp);

    vector <int> a1(3), b1(3);
    for (int i = 0; i < 3; ++i) {
        a1[i] = a[per[i]];
        b1[i] = b[per[i]];
    }
    a = a1; b = b1;

    vector <int> r(3);
    for (int i = 0; i < 3; ++i) {
        if (a[i] >= b[i]) {
            r[i] = 0;
        }   
        else {
            r[i] = n/a[i];
        }   
    }
    
    int ans = n;
    for (int i = 0; i <= r[0]; ++i) {
        for (int j = 0; i * a[0] + j * a[1] <= n && j <= r[1]; ++j) {

            int h = n - i * a[0] - j * a[1];
            int k = h/a[2];
            ans = max(ans, n + i * (b[0] - a[0]) + j * (b[1] - a[1]) + k * (b[2] - a[2]));
            ans = max(ans, n + i * (b[0] - a[0]) + j * (b[1] - a[1]));            

        }   
    }   
    return ans;
}   

signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

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

    n = solve(n, a, b);
    n = solve(n, b, a);
    cout << n << endl;

}

Measured memory_bytes: 256
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import qualified Data.Map.Strict as MPS
import Control.Monad
import Data.Char
import Data.Tuple

buildGraph :: V.Vector (Int, Int) -> Int -> V.Vector [Int]
buildGraph edges n = V.accumulate step (V.replicate n []) (V.map swap edges V.++ edges)
  where
    step xs v = v:xs

toTuple :: B.ByteString -> (Int, Int)
toTuple bs =
    let
      Just (a,bs') = B.readInt bs 
      Just (b,_) = B.readInt $ B.dropWhile isSpace bs'
    in (a,b)

dfs :: V.Vector [Int] -> VUM.IOVector Int -> Int -> Int -> IO ()
dfs graph table v p = 
        VUM.read table v >>= \r -> 
          forM_ ns $ \n -> 
            unless (n==p) $
              VUM.modify table (+r) n >> 
                dfs graph table n v
  where
    ns = graph V.! v

main = do
  [n,q] <- map read . words <$> getLine :: IO [Int]
  table <- VUM.replicate n 0 :: IO (VUM.IOVector Int)
  graph <- flip buildGraph n <$> (V.replicateM (n-1) $ B.getLine >>= return . (\(a,b) -> (a-1,b-1)) . toTuple)
  query <- replicateM_ q $ do
    (v,n) <- B.getLine >>= return . (\(a,b) -> (a-1,b)) . toTuple
    VUM.modify table (+n) v
  dfs graph table 0 (-1)
  table' <- VU.unsafeFreeze table
  VU.forM_ table' $ \x -> putStr $ show x ++ " "
  putStrLn ""

Measured memory_bytes: 81916
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	vi cnt(26, inf);
	rep(i, n){
		string s; cin >> s;
		vi v(26);
		for(char j : s) v[j - 'a']++;
		rep(j, 26) cnt[j] = min(cnt[j], v[j]);
	}
	string s;
	rep(i, 26) rep(j, cnt[i]) s += 'a' + i;
	cout << s << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

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

int main(){
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >>m;
    double pre=pow(0.5,m)*(100*n+1800*m);
    double sum=0;
    for (int i=1;i<=1e6;i++){
        sum+=i*pow((1-pow(0.5,m)),(i-1));
    }
    cout << pre*sum;
    return 0;
}

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

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

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

	int ans = 0;
	for(int i = 1; i < n - 1; i++){
		if(p[i] > p[i - 1] && p[i] < p[i + 1]){
			ans++;
		}
		else if (p[i] < p[i - 1] && p[i] > p[i + 1])
		{
			ans++;
		}
	}

	cout << ans;
	return 0;
}

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

int main(){
  cin >> N;
  vector<long long> A(N);
  vector<P> B(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
    B[i] = P( A[i], (long long)i );
  }
  sort( B.begin(), B.end() );
  for(int i = 0; i < N; i++){
    A[ B[i].second ] = (long long)i;
  }
  int m = 0;
  for(int i = 0; i < N; i++){
    //cout << A[i] << endl;
    m += abs( i - A[i] ) % 2;
  }
  cout << m/2 << endl;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<map>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define fo(a,b) for(int o=a;o<b;++o)
#define fdi(a,b) for(int i=a-1;i>=b;--i)
#define fdj(a,b) for(int j=a-1;j>=b;--j)
#define fdo(a,b) for(int o=a-1;o>=b;--o)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
//////////////////////

int const N = 41;
int const M = 18;
int const MOD = 1e9 + 7;

int n, x, y, z;
int ans;

void add(int &a, int b){
	a += b;
	if(a >= MOD) a -= MOD;
}

int mul(int a, int b){
	return (ll) a * b % MOD;
}

bool bit(int m, int i){
	return (m & (1 << i));
}

void removeleast(int &m){
	fi(1, 11){
		if(bit(m, i)){
			m >>= i;
			return;
		}
	}
}

int nxt[(1<<M)][11];

int getnewmask(int m, int o){
	if(nxt[m][o] != -1) return nxt[m][o];
	int m1 = m;
	fdi(M, 0){
		if(bit(m, i)){
			m |= (1 << (o + i));
			break;
		}
	}	
	while(m >= (1 << M)){
		removeleast(m);
	}
	nxt[m1][o] = m;
	return m;
}

int hm[(1<<M)];

bool have(int m){
	if(hm[m] != -1) return hm[m];
	vector<int> v;
	fi(0, M){
		if(bit(m, i)) v.pb(i);
	}
	fdi(sz(v), 1) v[i] -= v[i-1];
	fi(0, sz(v)){
		int sx = x, sy = y, sz = z;
		fj(i, sz(v)){
			if(sx > 0){
				sx -= v[j];
			}else if(sy > 0){
				sy -= v[j];
			}else if(sz > 0){
				sz -= v[j];
			}
		}
		if(sx == sy && sy == sz && sz == 0) return hm[m] = 1;
	}
	return hm[m] = 0;
}

int d[N][(1 << M)];

void solve(){
	memset(hm, 255, sizeof(hm));
	memset(nxt, 255, sizeof(nxt));
	int ten[4141];
	ten[0] = 1;
	fi(1, 4141) ten[i] = mul(10, ten[i-1]);

	d[0][1] = 1;
	fi(0, n){
		int cur = i;
		int nxt = i + 1;
		fj(0, (1<<M)){ 
			if(d[cur][j]){
				fo(1, 11){
					int nj = getnewmask(j, o);
					if(have(nj)){
						add(ans, mul(ten[n-1-i], d[cur][j]));
					}else{
						add(d[nxt][nj], d[cur][j]);
					}
				}
			}
		}
	}
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d %d %d %d",&n,&x,&y,&z);

	solve();

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 52480
// https://atcoder.jp/contests/abc116/tasks/abc116_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int f(int i)
{
  return i % 2 == 0 ? i / 2 : 3 * i + 1;
}

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int s;
  cin >> s;

  set<int> v;

  int i = 1, l = s;
  while (true)
  {
    v.insert(l);
    i++;
    int n = f(l);
    if (0 < v.count(n))
      break;
    l = n;
  }

  cout << i << '\n';

  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)
a_c =  a.count {|a_i|a_i>=3200}
a.select! { |a_i| a_i < 3200 }
types =  (a.group_by { |a_i| a_i / 400 }).length
puts "#{types == 0 ? 1 : types} #{types + (a_c == 0 ? 0 : a_c)}"

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ll long long
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define M 1000000
using namespace std;

//vector<ll> ;

void answer(){
    ll n,m,ans=999999999999,q;
    cin>>n>>m>>q;
    ll a[n+1],b[m+1];
    ll mi=999999999,ma=999999999;
    for(int i=0;i<n;i++){
        cin>>a[i]; ma = min(ma,a[i]);
    }
    for(int i=0;i<m;i++){ 
        cin>>b[i]; mi = min(mi,b[i]);
    }
    while(q--){
        ll x,y,z;
        cin>>x>>y>>z;
        ans = min({ans,a[x-1]+b[y-1]-z});
        //cout<<a[x-1]<<" "<<b[y-1]<<endl;
    }
    cout<<max(0LL,min(ans,ma+mi));
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int q;
    //cin>>q; while(q--)
        answer();
    return 0;
}

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

namespace AtTest.ABC_147
{
    class B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string s = Read();
            int res = 0;
            for(int i = 0; i < s.Length / 2; i++)
            {
                if (s[i] != s[s.Length - 1 - i]) res++;
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
import sys
input = sys.stdin.readline

N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
A2 = [[0]*N for _ in range(N)]
for i in range(N):
    for j in range(N):
        A2[i][j] = A[i][j]
for k in range(N):
    for i in range(N):
        for j in range(N):
            A2[i][j] = min(A2[i][j], A2[i][k]+A2[k][j])
ok = True
for i in range(N):
    for j in range(N):
        if A[i][j] != A2[i][j]:
            ok = False
if not ok:
    print(-1)
    exit()
ans = 0
for i in range(N):
    for j in range(N):
        connected = True
        for k in range(N):
            if i == k or j == k: continue
            if A[i][j] == A[i][k]+A[k][j]:
                connected = False
                break
        if connected:
            ans += A[i][j]
print(ans//2)


Measured memory_bytes: 70436
import statistics  
N = int(input())
A=list(map(int, input().split()))
B=[]
for number, i in enumerate(A, 1):
    B.append(i-number)
median = round(statistics.median(B))
ans2 = 0
for i in B:
    ans2 += abs(i-median)
print(ans2)

Measured memory_bytes: 27244
n,a=map(int,input().split())
lists=list(map(int,input().split()))
 
for i in range(n):
    lists[i]-=a
answer=0
dp=[[0 for i in range(5001)] for _ in range(51)]
#dp[i][j]で0からi枚目まで好きなように選択してそのそうわがｊ-2500となるような撮り方の総数
#最終的に求めるのはdp[i][0]である
 
for i in range(n+1):
    for j in range(4951):
        if i>=1 and j>=lists[i-1]:
            dp[i][j]=dp[i-1][j-lists[i-1]]+dp[i-1][j]
        if i>=1 and j<lists[i-1]:
            dp[i][j]=dp[i-1][j]
        else:
            if j==2500 and i==0:
                dp[i][j]=1
            elif j!=2500 and i==0:
                dp[i][j]=0
print(dp[n][2500]-1)  

Measured memory_bytes: 5748
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))
#define INF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

typedef long long int lli;

void swap(int* a, int* b)
{
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

void ll_swap(lli* a, lli* b)
{
    lli tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

int gcd(int a, int b)
{
    if (a < b)
        swap(&a, &b);

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

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

long power(long x, int n) {
    long ans = 1;
    while (n > 0) {
        if ((n & 1) == 1) {
            ans = ans * x;
        }
        x = x * x;
        n >>= 1;
    }
    return ans;
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
		printf("res:%lld a:%lld\n", res,a);
	}
	return res;
}


lli comb(lli n, lli r)
{
    if (n == 0)
        return 0;

    if (r == 0 || r == n)
        return (1);
    else if (r == 1)
        return (n);
    return (comb(n - 1, r - 1) + comb(n - 1, r));
}

/*
#define MAX 100000
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;
}
*/


int main()
{
    long long int X;

    scanf("%lld", &X);

    long long int A = 100;
    long long int count = 0;

    while (A < X)
    {
        A *= 1.01;
        count++;
    }
    printf("%lld", count);
}



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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll n; cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n - 1; ++i)
    {
        ans += (n - 1) / i;
    }
    cout << ans;
}


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

int main() {
    int N, X;
    cin >> N >> X;
    while (!(N == 0 && X == 0)) {
    	vector<int>A(N);
    	for (long long i = 0; i < N; i++) {
    		A.at(i) = i + 1;
    	}
    	long long ans = 0;
    	for (long long i = 0; i < N - 2; i++) {
    		for (long long j = i + 1; j < N - 1; j++) {
    			for (long long k = j + 1; k < N; k++) {
    				if (A.at(i) + A.at(j) + A.at(k) == X) ans++;
    			}
    		}
    	}
    	cout << ans << endl;
    	cin >> N >> X;
	}
}


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

int read()
{
	int ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=0;
	if(ch=='-')flag=1,ch=getchar();
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10+ch-'0';
	if(flag)ans=-ans;
	return ans;
}

long long rell()
{
	long long ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=0;
	if(ch=='-')flag=1,ch=getchar();
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10ll+(long long)(ch-'0');
	if(flag)ans=-ans;
	return ans;
}

void writ(int n)
{
	char ch[25];
	int m=0;
	if(n<0)putchar('-'),n=-n;
	if(n==0)
	{
		putchar('0');
		return;
	}
	for(;n;)ch[m++]=n%10ll+'0';
	for(;m;)putchar(ch[--m]);
}

void wrll(long long n)
{
	char ch[25];
	int m=0;
	if(n<0)putchar('-'),n=-n;
	//cout<<n<<endl;
	if(n==0)
	{
		putchar('0');
		return;
	}
	for(;n;n/=10ll)ch[m++]=n%10ll+'0';
	for(;m;)putchar(ch[--m]);
}

int main()
{
	long long m=rell(),k=51,n=50;
	long long rm=m-m/k*n;
	wrll(n);puts("");
	//cout<<rm<<endl;
	for(int i=0;i<50;i++)
	{
		long long o=n-m%k-1ll+rm/(n-(long long)i)*k;
		//cout<<o<<endl;
		wrll(o);putchar(' ');
		rm-=rm/(n-(long long)i);
	}
	puts("");
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int n;
	
	scanf("%d",&n);
	
	while(n!=0)
	{
		if(n%10==7)
		{
			printf("Yes");
			return 0;
		}
		
		n/=10;
	}
	
	printf("No");
	
	return 0;
}

Measured memory_bytes: 3228
import numpy as np
arr = np.zeros((3, 3), dtype=int)
for i in range(3):
    arr[i, 0], arr[i, 1], arr[i, 2] = list(map(int, input().split()))

ans = True
if np.any(arr[0] - arr[0, 0] != arr[1] - arr[1, 0]):
    ans = ans & False
if np.any(arr[0] - arr[0, 0] != arr[2] - arr[2, 0]):
    ans = ans & False
if np.any(arr[:, 0] - arr[0, 0] != arr[:, 1] - arr[0, 1]):
    ans = ans & False
if np.any(arr[:, 0] - arr[0, 0] != arr[:, 2] - arr[0, 2]):
    ans = ans & False

if ans:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 20960
#include <iostream>
#include <string>

using namespace std;

int main()	{
  string a;
  cin >> a;
  string b;
  int n = a.length();
  for (int i = 0; i < n; i++)	{
    if (i % 2 == 0)	{
      b.push_back(a[i]);
    }
  }
  cout << b << endl;
  return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
#ifdef _IS_LOCAL //
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout   \
	if (false) \
	cout
#define debug() if (false)
#define dvout(v) if(false);
#endif //
#define next asdnext
#define prev asdprev
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define vrep(i, v) for (auto &i : v)
#define all(x) (x).begin(), (x).end()
#define vout(v)           \
	for (auto &i : v)     \
	{                     \
		cout << i << " "; \
	}                     \
	cout << "\n"; //配列出力
#define vin(v)        \
	for (auto &i : v) \
		cin >> i; //配列入力
#define vecin(v,n)	\
	vec(v,n);		\
	vin(v);
#define vec(v, n) vector<int> v(n, 0);
#define mod (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;



void Main()
{
	string S1, S2;
	cin>>S1>>S2;
	int cnt = 0;
	rep(i,3){
		if(S1[i] == S2[i]) cnt++;
	}
	cout<<cnt<<endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

double N,X,T;

int main(){
    cin>>N>>X>>T;

    int ans=ceil(N/X)*T;

    cout<<ans<<endl;
}

Measured memory_bytes: 3720
n, a, b, c, d = map(int, input().split())
S = input()

if d > c:
    S1 = S[a - 1:c]
    S2 = S[b - 1:d]
    if "##" in S1 or "##" in S2:
        print("No")
        exit()
    else:
        print("Yes")
        exit()

S1 = S[a - 1:c]
S2 = S[b - 1:d]
if "##" in S1 or "##" in S2:
    print("No")
    exit()

S3 = S[b - 2:d + 1]
if "..." in S3:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3572
#include<stdio.h>
#include<math.h>

int main()
{
    long long n,m;
    while(scanf("%lld%lld",&n,&m) == 2)
    {
        printf("%lld\n",(long long)pow(2,m)*((n-m)*100 + m*1900));
    }
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int A,B,X,max;
 
  scanf("%d %d",&A,&B);
  max = A+A-1;
  if(max < A+B)max=A+B;
  if(max < B + B-1)max=B+B-1;
  printf("%d\n",max);
 
 
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>

using namespace std;

int main()
{
  string input;
  int num[3];
  cin >> input;
  num[0] = input[0] - '0';
  num[1] = input[1] - '0';
  num[2] = input[2] - '0';
  if (num[0] == 1) input[0] = '9';
  if (num[1] == 1) input[1] = '9';
  if (num[2] == 1) input[2] = '9';
  if (num[0] == 9) input[0] = '1';
  if (num[1] == 9) input[1] = '1';
  if (num[2] == 9) input[2] = '1';

  cout << input << endl;

  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main  implements Runnable {
	int[][] ta = new int[16][4096];
	int ptr = 0;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 64 * 1024 * 1024).start();
    }

    public void run() {
    	FastScanner sc = new FastScanner(System.in);
    	//int[] ar = new int[3];
    	//ar[0]=Integer.parseInt(sc.next());
    	//Arrays.parallelSort(ar);
		int n = Integer.parseInt(sc.next());
		//long a = Long.parseLong(sc.next());
		//String s = sc.next();
		//String str = sc.next();
		//char c[] = str.toCharArray();
		//char a[][] = new char[n];
		//ArrayList<Str_4> lists = new ArrayList<Str_4>();
		//lists = new ArrayList;
		PrintWriter out = new PrintWriter(System.out);
		//int[] ra = new int[r];
		//ArrayList<ArrayList<Integer>> lists = new ArrayList<>();
		String[] ss = new String[n];
		for(int i = 0; i < n; i++)
		{
			String str = sc.next();
			char c[] = str.toCharArray();
			Arrays.parallelSort(c);
			ss[i] = new String(c);
		}
		Arrays.parallelSort(ss);
		int preeq = 0;
		long eqlen = 0;
		long ans = 0;
		for(int i = 1; i < n; i++)
		{
			if(ss[i].contentEquals(ss[i-1]))
			{
				if(preeq == 0)
				{
					eqlen = 2;
				}
				else
				{
					eqlen++;
				}
				preeq = 1;
			}
			else
			{
				if(preeq == 1)
				{
					ans += (long)((eqlen*(eqlen-1))/2);
				}
				preeq = 0;
			}
		}
		if(preeq == 1)
		{
			ans += (eqlen*(eqlen-1))/2;
		}
		out.println(ans);
		out.flush();
    }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long nextInt() {
            return Integer.parseInt(next());
        }

    }
}

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

using namespace std;

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

    long long t = 1, a = 1;
    for (int i = 0; i < n; ++i) {
        long long T, A;
        cin >> T >> A;

        auto k = max((t + T - 1) / T, (a + A - 1) / A);
        t = k * T;
        a = k * A;
    }

    cout << t + a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
#include <fstream>
using namespace std;

const int INF = 1<<30;
#define rep(i, n) for(int i = 0; i < (n); i++)
int main(){
  while(true){
    int n;
    cin >> n;
    if(n == 0) return 0;
    vector<int> cnt(26, 0);
    vector<char> vote(n);
    char ans = '#';
    int ANS;
    rep(i, n) cin >> vote[i];
    rep(i, n){
      cnt[vote[i]-'A']++;
      char c;
      int M1 = -1, M2 = -1;
      rep(j, 26){
        if(M1 < cnt[j]){
          M2 = M1;
          M1 = cnt[j];
          c = 'A' + j;
        }else if(M2 < cnt[j]){
          M2 = cnt[j];
        }
      }
      if(M1 > M2 + n-i-1){
        if(ans == '#'){
          ans = c;
          ANS = i + 1;
        }
      }
    }
    if(ans == '#') cout << "TIE" << endl;
    else cout << ans << " " << ANS << endl;
  }
}



Measured memory_bytes: 3080
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int main() {
  size_t N;
  int X;
  scanf("%zu %d", &N, &X);

  std::vector<int> m(N);
  int sum = 0;
  for (auto& mi: m) {
    scanf("%d", &mi);
    sum += mi;
  }

  int min = *std::min_element(m.begin(), m.end());
  int res = N;
  
  X -= sum;
  res += X / min;
  printf("%d\n", res);
}


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

using namespace std;

int a[100005];
int n,k;
int ans=2e9;
int main() {
    cin>>n>>k;
    for(int i=0;i<n;++i)cin>>a[i];
    for(int l=0;l+k-1<n;++l){
        int r=l+k-1;
        ans=min(ans,min(abs(0-a[l])+abs(a[l]-a[r]),abs(0-a[r])+abs(a[l]-a[r])));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <math.h>
#include <bits/stdc++.h>
#include <deque>
#include <string>
#include <vector>
#include <algorithm>
#define ll long long int
#define l long double
#define pi 3.14159265358979323846
#define mod 1000000007
#define vali 1000000000000000000
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll a[n],sum=0,b[100006]={0};
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
        b[a[i]]++;
    }
    ll k,x=0,y=0;
    cin>>k;
    for(int i=0;i<k;i++)
    {
        cin>>x>>y;
        sum=sum-b[x]*x+b[x]*y;
        ll temp=b[x];
        b[x]=b[y];
        b[y]+=temp;
        b[x]=0;
        //cout<<"a "<<b[y]<<endl;
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 5172
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc172/abc172_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, M, K;
  cin >> N >> M >> K;

  vector<ll> a(N), b(M);
  rep(i, N) { cin >> a[i]; }
  rep(i, M) { cin >> b[i]; }

  ll A = 0;
  ll ai = -1;
  rep(i, N) {
    if (A + a[i] <= K) {
      A += a[i];
    } else {
      break;
    }
    ai = i;
  }

  int bj = -1;
  ll B = 0;
  ll k = K - A;
  rep(j, M) {
    if (B + b[j] <= k) {
      B += b[j];
    } else {
      break;
    }
    bj = j;
  }
  int ans = ai + bj + 2;

  for (int i = ai; i >= 0; i--) {
    A -= a[i];
    ll k = K - A;
    repi(j, bj + 1, M) {
      if (B + b[j] <= k) {
        B += b[j];
      } else {
        break;
      }
      bj = j;
    }
    ans = max(i + bj + 1, ans);
  }

  cout << ans << endl;
}

Measured memory_bytes: 6364
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		String S=stdIn.next();
		if(S.equals("AAA")||S.equals("BBB"))
			System.out.println("No");
		else
			System.out.println("Yes");
	}
}


Measured memory_bytes: 22996
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

typedef long long int ll;

int main(void){
    int n;
    double b=0;
    int minn=0;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
        b+=a[i];
    }
    double ave = b / n;
    double min=1000.0;
    for(int i=0;i<n;i++){
        if(min>fabs(ave-a[i])){min=fabs(ave-a[i]);minn=i;}
    }
    cout << minn << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define DEBUG
#ifdef DEBUG
#define debug_printf printf
#else
#define debug_printf 1 ? 0 : printf
#endif

using namespace std;
typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<Vl> VVl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;

#define BASE  (1000000000 + 7)
#define MAX_N (1000000000)
#define MAX_M (100000)

int N, M;
int X[MAX_M + 1];
Vl A{1, 3, 1};
VVl P1{
  {2, 1, 0},
  {3, 1, 2},
  {1, 0, 1}},
P[31],
Q{{1, 1, 0},
  {0, 1, 2},
  {0, 0, 1}},
R(3, Vl(3));

void mat_print(VVl &a) {
#ifdef DEBUG
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < a[0].size(); j++) {
      debug_printf("%lld ", a[i][j]);
    }
    debug_printf("\n");
  }
#endif
}

void mat_prod(VVl &a, VVl b, VVl c) {
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < a[0].size(); j++) {
      a[i][j] = 0;
      for (int k = 0; k < b[0].size(); k++) a[i][j] = (a[i][j] + b[i][k] * c[k][j]) % BASE;
    }
  }
}

void build_mat_pow() {
  for (int i = 0; i < 31; i++) P[i] = VVl(3, Vl(3));

  for (int i = 0; i < P[0].size(); i++) {
    for (int j = 0; j < P[0][0].size(); j++) {
      P[0][i][j] = (i == j)? 1: 0;
      P[1][i][j] = P1[i][j];
    }
  }
  for (int i = 2; i < 31; i++) mat_prod(P[i], P[i - 1], P[i - 1]);
}

void mat_pow_P(VVl &a, ll n) {
  for (int i = 0; i < a.size(); i++)
    for (int j = 0; j < a[0].size(); j++) a[i][j] = (i == j)? 1: 0;
    for (int i = 1; i < 31; i++) {
      if (n == 0) break;
      if ((n & 1) != 0)
        mat_prod(a, a, P[i]);
      n >>= 1;
    }
}

void solve() {
  mat_pow_P(R, X[0] - 1);
  for (int i = 1; i <= M; i++) {
    VVl s(3, Vl(3));
    mat_prod(R, R, Q);
    mat_pow_P(s, X[i] - X[i - 1] - 1);
    mat_prod(R, R, s);
  }

  ll ans = 0;
  for (int i = 0; i < 3; i++) ans = (ans + R[0][i] * A[i]) % BASE;

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

int main() {
  build_mat_pow();

  cin >> N >> M;
  for (int i = 0; i < M; i++) cin >> X[i];
  X[M] = N;

  solve();

  return 0;
}


Measured memory_bytes: 640
def main():
	n = int(input())
	l = []
	i = 1
	while n > 0:
		n -= i
		t = i * (i - 1) // 2
		l += [list(range(t + 1, t + i + 1))]
		i += 1
	if n < 0:
		print("No")
		exit()
	print("Yes")
	i -= 1
	ans = [i + 1] + [i] + [l[j][-1] for j in range(i)]
	for j in range(i):
		ans += [i] + l[j] + [l[k][j] for k in range(j + 1, i)]
	print(" ".join(map(str, ans)))
	
if __name__=="__main__":
	main()


Measured memory_bytes: 22592
#include <iostream>

int main(int argc, char** argv){
    int n;
    std::cin >> n;
    if(n==1){
        std::cout << "Hello World" << std::endl;
    }else{
        int a, b;
        std::cin >> a >> b;
        std::cout << a+b << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
# include <cmath>
# include <iostream>
# include <string>
# include <vector>


using namespace std;


vector<long long> int2divs(long long k, long long len) {
    vector<long long> result(len); fill(result.begin(), result.end(), 0);

    for (long long t=0; t<len; ++t) {
        if (k>>t & 1) result[t] = 1;
    }
    return result;
}


int main() {
    string s; cin >> s;
    long long len = s.size()-1;
    long long ans = 0;

    for (long long k=0; k<pow(2, len); ++k) {
        vector<long long> divs = int2divs(k, len);

        string _s = ""; _s += s.at(0);
        for (long long i=0; i<len; ++i) {
            if (!divs[i]) {
                _s += s.at(i+1);
            }
            else {
                ans += stoll(_s);
                _s = ""; _s = s.at(i+1);
            }
        }
        
        ans += stoll(_s);
    }

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


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner	sc	= new Scanner(System.in);
		long	n	= sc.nextLong();
		sc.close();

		System.out.println(fact(n));
		
	}
	
	static long fact(long x){
		long sum=1;
		if(x==0){
			return 1;
		}else{
			for(long i=x; i>0; i--){
				sum *= i;
			}
			return sum;
		}
	}
}

Measured memory_bytes: 11000
def main():
    n, p = map(int, input().split())
    a = list(map(int, input().split()))

    dp = [[0, 0] for i in range(n + 1)]
    dp[0][0] = 1
    for i in range(n):
        if a[i] % 2 == 0:
            dp[i + 1][0] += dp[i][0]*2
            dp[i+1][1] += dp[i][1]*2
        else:
            dp[i + 1][0] += dp[i][0] + dp[i][1]
            dp[i + 1][1] += dp[i][0] + dp[i][1]

    print(dp[n][p])


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
S = input()
L = len(S)
K = int(input())

dp = [[[0,0] for _ in range(K+1)] for _ in range(L+1)]
dp[0][0][0] = 1
for i,c in enumerate(S):
    c = int(c)
    for k in reversed(range(K+1)):
        for d in range(10):
            nk = k + (d>0)
            if nk > K: continue
            dp[i+1][nk][1] += dp[i][k][1]
            if d > c: continue
            dp[i+1][nk][int(c>d)] += dp[i][k][0]
print(sum(dp[-1][-1]))

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

x, y = inm()
ans = 0
while x <= y:
    ans += 1
    x *= 2
print(ans)

Measured memory_bytes: 9044
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int first_num = sc.nextInt();
        int second_num = sc.nextInt();
        for(int i = 1;i < 2000 ;i++){
            if(Math.floor(i*0.08) == first_num && Math.floor(i*0.1) == second_num){
                System.out.println(i);
                System.exit(0);
            }
        }
        System.out.println(-1);
    }
}

Measured memory_bytes: 23764
n = int(input()) 
s = [input().strip() for _ in range(n)]

ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    if s[i] == "AC":
        ac = ac + 1
    elif s[i] == "WA":
        wa = wa + 1
    elif s[i] == "TLE":
        tle = tle + 1
    elif s[i] == "RE":
        re = re + 1

print("AC","x",ac)
print("WA","x",wa)
print("TLE","x",tle)
print("RE","x",re)

Measured memory_bytes: 16240
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using llint = long long int;
using namespace std;

int main() {
    fastIO;
    int n;
    cin >> n;
    vector<int> pi(n);
    vector<int> sorted(n);
    rep(i, n) {
        int N;
        cin >> N;
        pi.at(i) = N;
        sorted.at(i) = N;
    }
    sort(sorted.begin(), sorted.end());

    int cnt = 0;
    rep(i, n) {
        if (pi.at(i) != sorted.at(i))
            cnt++;
    }
    if (cnt == 0 || cnt == 2)
        cout << "YES";
    else
        cout << "NO";
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main(){
  double d,a,r2=sqrt(2);
  cin>>d;
  if(1<=d&&d<r2)a=2;
  else if(2<=d&&d*r2<3)a=3;
  else a=r2*d;
  printf("%.10f\n",a);
  return 0;
}

Measured memory_bytes: 1240
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		boolean[] prime = new boolean[100001];
		Arrays.fill(prime, true);
		prime[0] = false;
		prime[1] = false;
		for(int i=2;i*i<prime.length;i++){
			if(prime[i]){
				for(int j=i*i;j<prime.length;j+=i){
					prime[j] = false;
				}
			}
		}
		
		int cnt[] = new int[100001];
		
		for(int i=3;i<=100000;i++){
			cnt[i] = cnt[i-1];
			if(prime[i] && prime[(i+1)/2])
				cnt[i]++;
		}
		
		int q = sc.nextInt();
		while(q-->0){
			int l = sc.nextInt(), r = sc.nextInt();
			
			System.out.println(cnt[r] - cnt[l-1]);
		}

	}

}


Measured memory_bytes: 71012
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
   int A , B , K ;
   cin >> A >> B >> K ;

if( (B - A) > 2*K-1 ){
   for(int i = 0; i < K ; i++)
     cout << A +i << endl;

   for(int i = 0; i < K ; i++)
     cout << B - (K -i-1 )<< endl;
}else{
    for(int i=0; i< (B-A)+1 ; i++)
       cout << A+i << endl;
}


    return 0;
}

Measured memory_bytes: 256
#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>;

ll mod = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  map<int, vector<int>> memo;
  rep(i, n) {
    int left = i;
    int right = n - i - 1;
    memo[abs(left - right)].push_back(i);
  }

  vector<int> actuals(n);
  rep(i, n) {
    actuals[a[i]]++;
  }

  // 報告が間違っていたパターンのチェック
  rep(i, n) {
    if(actuals[i] != memo[i].size()) {
      cout << 0 << endl;
      return 0;
    }
  }

  int ans = 1;
  rep(i, n) {
    if(actuals[i] == 0) continue;
    ans *= actuals[i];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 13484
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		int rating;
		if(n>=10) 
			rating = r;
		else 
			rating = r +100*(10-n);
		
		System.out.println(rating);
	}

}


Measured memory_bytes: 23636
N,K = map(int,input().split())
x = [int(i) for i in input().split()]
a=[]
for i in range(N-K+1):
  left =x[i]
  right =x[i+K-1]
  p1 = abs(left) + abs(right-left)
  p2 = abs(right) + abs(right-left)
  p = min(p1,p2)
  a.append(p)
  
  
print(min(a))
  

Measured memory_bytes: 14384
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    string s;
    string p;
    cin >> s >> p;
    
    s += s;
    if(s.find(p,0) == string::npos){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 3180
#include <stdio.h>

int main(void){

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

        if(n%10==2 || n%10==4 || n%10==5 || n%10==7 ||n%10==9){
                printf("hon\n");
        }else if(n%10==3){
                printf("bon\n");
        }else{
                printf("pon\n");
        }   

return 0;
}

Measured memory_bytes: 1664
import sys
def f(P):
 i=0
 for _ in[0]*k:
  s=0
  while s+w[i]<=P:
   s+=w[i];i+=1
   if i==n: return n
 return i
n,k=map(int,input().split())
w=list(map(int,sys.stdin.read().splitlines()))
l=0;r=n*100000
while r-l>1:
 m=(l+r)//2
 if f(m)>=n:r=m
 else:l=m
print(r)


Measured memory_bytes: 16424
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#define int long long
using namespace std;

int n;
int a[100000];
int b[100000];
int c[100000];

signed main()
{
	int i;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> a[i];
	for (i = 0; i < n; i++) cin >> b[i];
	for (i = 0; i < n; i++) cin >> c[i];
	sort(a, a + n);
	sort(b, b + n);
	sort(c, c + n);
	
	static int x[100001] = {0};
	for (i = 0; i < n; i++) {
		int id = upper_bound(c, c + n, b[i]) - c;
		x[i] = n - id;
	}
	for (i = n - 1; i >= 0; i--) x[i] += x[i + 1];
	
	int ans = 0;
	for (i = 0; i < n; i++) {
		int id = upper_bound(b, b + n, a[i]) - b;
		ans += x[id];
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3960
from sys import stdin
import math

n, m = [int(x) for x in stdin.readline().rstrip().split()]

s = [0] * m
c = [0] * m
for i in range(m):
    s[i], c[i] = [int(x) for x in stdin.readline().rstrip().split()]

result = -1
for nn in range(10 ** n):
    ns = str(nn)
    if len(ns) < n:
        continue
    #ns = ns.zfill(n)
    flag = True
    for i in range(m):
        if ns[s[i]-1] == str(c[i]):
            continue
        else:
            flag = False
            break
    if flag:
        result = nn
        if n > 1 and result == 0:
            result = -1
        break

print(result)
        


Measured memory_bytes: 3188
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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 <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

using mint = modint<MOD>;


struct ModCombination {
    vector<mint> Fac;
    vector<mint> Facinv;

    ModCombination(int x) {
        Fac.resize(x+1);
        Facinv.resize(x+1);
        Fac[0] = 1;
        for (long long i = 1; i <= x; i++) Fac[i] = Fac[i-1]*i;
        Facinv[x] = Fac[0]/Fac[x];
        for (long long i = x; i > 0; i--) Facinv[i-1] = Facinv[i]*i;
    }

    mint get(int n, int k) {
        if (k < 0 || k > n) return 0;
        return Fac[n]*Facinv[k]*Facinv[n-k];
    }
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,K; cin >> N >> K;

    ModCombination MC(2*N);
    if (K >= N-1) {
        cout << MC.get(2*N-1,N).a << ln;
        return 0;
    }
    mint ans = 0;
    rep(i,K+1) {
        ans += MC.get(N-1,i)*MC.get(N,i);
    }

    cout << ans.a << ln;
}

Measured memory_bytes: 6528
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

vector<long long int> solve(long long int k)
{
	vector<long long int> result;
	if(k == 0){
		result.push_back(0);
		result.push_back(0);
	} else if(k == 1){
		result.push_back(0);
		result.push_back(2);
	} else if(k <= 50){
		for(int i = 0; i < k; i++){
			result.push_back(i + 1);
		}
	} else {
		long long int tmp1 = k / 50;
		long long int tmp2 = k % 50;
		// cout << tmp1 << endl;
		for(int i = 0; i < 50; i++){
			result.push_back(tmp1 + i);
		}
		for(int i = 0; i < tmp2; i++){
			for(int j = 0; j < 50; j++){
				if(i == j) result[j] += 50;
				else result[j]--;
			}
		}
	}
	return result;
}

int main()
{
	long long int k;
	cin >> k;
	// cout << k << endl;
	vector<long long int> ans = solve(k);
	cout << ans.size() << endl;
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i];
		if(i == ans.size() - 1) cout << endl;
		else cout << " ";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
	int N, X;
	cin >> N >> X;

	vector<int> m(N,0);
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> m.at(i);
		sum += m.at(i);
	}

	X = X - sum;

	int minVar = *min_element(m.begin(), m.end());

	N = N + (X / minVar);

	cout << N << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
   	#endif
    int a,b;
    cin>>a>>b;
    cout<<round((a+b+1)/2);
   	return 0;
}

Measured memory_bytes: 3752