akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    // Your code here!
    ll n,k;
    cin>>n>>k;
    vector<ll>v(n);
    rep(0,i,n)cin>>v[i];
    ll ans=0;
    rep(0,i,min(n,k)+1){
        rep(0,j,min(n,k)-i+1){
            vector<ll> t;
            rep(0,l,i)t.push_back(v[l]);
            rep(0,r,j)t.push_back(v[n-1-r]);
            sort(t.begin(),t.end());
            rep(0,l,min(k-i-j,(ll)t.size())){
                if(t[l]<0)t[l]=0;
            }
            ans=max(ans,accumulate(t.begin(),t.end(),0LL));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
	vector<string>ans;
	int j,y;

	void dfs(string tmp,int a,int b){
	
		if(a==j&&b==y){
			//cout<<tmp<<endl;
			ans.push_back(tmp);
			return ;
		}
		if( a>j||b>y || a==5&&b<=3 || a<=3&&b==5)return ;
		//cout<<"tmp="<<tmp<<endl;


		dfs(tmp+"A",a+1,b);
		
		dfs(tmp+"B",a,b+1);
	}
	int main(){
	cin>>j>>y;
	dfs("",0,0);
	sort(ans.begin(),ans.begin()+ans.size());
	for(int i=0;i<ans.size();i++)cout<<ans[i]<<endl;
	
	return 0;
} 

Measured memory_bytes: 1228
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;
using ll = long long int;

// to format a document: ctrl + K -> ctrl + D

int main() {
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    string S;
    cin >> S;

    A--;
    B--;
    C--;
    D--;

    for (int i = A; i < C; i++) {
        if (S[i] == '#' && S[i + 1] == '#') {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = B; i < D; i++) {
        if (S[i] == '#' && S[i + 1] == '#') {
            cout << "No" << endl;
            return 0;
        }
    }

    if (C > D) {
        int cnt = 0;
        for (int i = B - 1; i <= D + 1; i++) {
            if (S[i] == '.')
                cnt++;
            else
                cnt = 0;
            if (cnt == 3) {
                cout << "Yes" << endl;
                return 0;
            }
        }
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;

    return 0;
}


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

int main() {
    int A, B, X;
    cin >> A >> B >> X;
    if (0 <= X-A and X-A <= B) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*  Author:  Hariom_Pandey
    Created: 1/11/2020 5:24:44 PM
*/
 
#include "bits/stdc++.h"
using namespace std;
 
#define All(a)          (a).begin(), (a).end()
#define Sz(a)           int((a).size())
#define u_map           unordered_map
#define Exist(a, b)     (find(All(a), (b)) != (a).end())
#define Sort(x)         sort(All(x))
#define ll              long long int
#define ull             unsigned ll
#define ld              long double
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mem(a,x) memset(a,x,sizeof(a))
const int base = 311;
#define MOD 1000000007

int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
#define Hariom_Pandey  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll abs(ll a, ll b){ if(a>b){ return a-b;} else{  return b-a;}}
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
int32_t main()
{
    Hariom_Pandey
    string str,str2;
    int num,val,ans=0,cnt=0,fi=0; cin>>num;
    vector<string> srr;
    vector<int> nrr;
    for(int tst=1; tst<=num; tst++){
        cin>>str>>val;
        srr.push_back(str);
        nrr.push_back(val);
        ans+=val;
    }
    cin>>str2;
    for(int i=0; i<srr.size(); i++){
        if(srr[i]!=str2) {
            cnt+=nrr[i];   
        }
        else{
            fi=i;
            break;
        }
    }
    cout<<(ans-cnt)-nrr[fi];
            
    
    return 0;
}















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

int main(){
  int a[100][100];
  int r,c,i,j,b,d=0;
  cin >> r >> c;
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      cin >> a[i][j];
      d += a[i][j];
    }    
  }

  for(i=0;i<r;i++){
    b = 0;
    for(j=0;j<c;j++){
      cout << a[i][j] <<" ";
      b += a[i][j];      
    }
    cout << b <<endl;
  }

  for(j=0;j<c;j++){
    b = 0;
    for(i=0;i<r;i++){
      b += a[i][j];
    }
    cout << b << " ";
  }
  cout << d <<endl;
}
      

Measured memory_bytes: 1196
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  int year = (s[0] - '0') * 1000 + (s[1] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
  int month = (s[5] - '0') * 10 + (s[6] - '0');
  if(year < 2019){
    cout << "Heisei" << endl;
  }else if(year > 2019){
    cout << "TBD" << endl;
  }else if(month <= 4){
    cout << "Heisei" << endl;
  }else{
    cout << "TBD" << endl;
  }
}

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

long long md(pair<long long,long long> x,pair<long long,long long> y){
    return max(x.first,y.first)-min(x.first,y.first)+max(x.second,y.second)-min(x.second,y.second);
}

int main(){
   string S;
   cin >> S;
   bool flag=1;
   for(int i=0;i<S.size();i++){
       char a=S[i];
       int cnt=0;
       for(int j=0;j<S.size();j++){
           if(a==S[j]){
               cnt++;
           }
       }
       if(cnt%2==1){
           flag=0;
       }
   }
   if(flag)
   cout << "Yes" << endl;
   else
   cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int h,w,d,q;
pii pos[100000];
int start[100000];
vll pre[100000];
ll solve (int l, int r){
    int group = start[l];
    int n1,n2;
    n1 = (l-group)/d + 1;
    n2 = (r-group)/d + 1;
    ll res = pre[group][n2] - pre[group][n1];
    return res;
}
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>h>>w>>d;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            int a;cin>>a;
            pos[a] = mp(i,j);
        }
    }

    for(int i=1;i<=h*w;i++){
        if(start[i]==0){
            start[i]=i;
            pre[i].pb(0);pre[i].pb(0);

            for(int j=i+d;j<=h*w;j+=d){
                start[j]=i;
                pii pref,now;
                pref = pos[j-d];
                now = pos[j];
                ll sel = abs(pref.fi-now.fi) + abs(pref.se - now.se);
                ll x = pre[i].back();
                x += sel;
                pre[i].pb(x);
            }
        }
    }

    cin>>q;
    for(int cases=1;cases<=q;cases++){
        int l,r;
        cin>>l>>r;
        ll ans = solve(l,r);
        cout<<ans<<newl;
    }

}


Measured memory_bytes: 6656
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Fenwick Tree
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 500000;

/* typedef */

typedef long long ll;

template <typename T, const int MAX_N>
struct BIT {
  int n;
  T bits[MAX_N + 1];
  
  BIT() {}
  BIT(int _n) { init(_n); }

  void init(int _n) {
    n = _n;
    memset(bits, 0, sizeof(bits));
  }

  T sum(int x) {
    T s = 0;
    while (x > 0) {
      s += bits[x];
      x -= (x & -x);
    }
    return s;
  }

  void add(int x, T v) {
    while (x <= n) {
      bits[x] += v;
      x += (x & -x);
    }
  }
};

/* global variables */

BIT<ll,MAX_N> bit;

/* subroutines */

/* main */

int main() {
  int n, q;
  scanf("%d%d", &n, &q);

  bit.init(n);

  for (int i = 0; i < n; i++) {
    int ai;
    scanf("%d", &ai);
    bit.add(i + 1, ai);
  }

  while (q--) {
    int op, p, x;
    scanf("%d%d%d", &op, &p, &x);

    if (op == 0)
      bit.add(p + 1, x);
    else
      printf("%lld\n", bit.sum(x) - bit.sum(p));
  }
  return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll n, m;
    cin >> n >> m;
    m /= 2;
    if(m >= n)
        cout << (n + m) / 2;
    else
        cout << m << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if (A % 2 || B % 2 || C % 2) {
        cout << 0 << endl;
        return 0;
    }
    if (A == B && B == C) {
        cout << -1 << endl;
        return 0;
    }

    int cnt = 0;
    while (1) {
        if (A % 2 || B % 2 || C % 2) break;
        int a = A / 2, b = B / 2, c = C / 2;
        A = b + c;
        B = a + c;
        C = a + b;
        cnt++;
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
	static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	public static long mod = (long) (1e9+7);
	public static long[] fac,inv;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
	    int n = sc.nextInt();
	    int k = sc.nextInt();
	    k = Math.min(n-1, k);
	    long ans = 0;
	    precompute(n);
	    for(int r=0;r<=k;++r) {
	    	ans= (ans + (ncr(n,r) * ncr(n-1,r))%mod)%mod;
	    }
	    out.print(ans);
	    out.close();

	}
	static void precompute(int n){

		fac = new long[n+1];
		inv = new long[n+1];
		fac[0]=fac[1]=1;
		for(int i=2;i<fac.length;i++)
		{
			fac[i]=(fac[i-1]*i)%mod;
		}
		
		inv[n]=pow(fac[n],mod-2)%mod;
		for(int i=n-1;i>=0;i--)
		{
			inv[i]=(inv[i+1]*(i+1))%mod;
		}
	}
	private static long pow(long a, long b) {
		// TODO Auto-generated method stub
		return BigInteger.valueOf(a).modPow(BigInteger.valueOf(b), BigInteger.valueOf(mod)).longValue();
	}
	private static long ncr(int n, int r) {
		
		return (fac[n]*(inv[r]*inv[n-r]%mod)%mod)%mod;
	}

}


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

int main(){
 

    int a,b;
    cin>>a>>b;

    LL ans=0;
    for(int i=a;i<=b;i++){

        string s=toString(i);
        string rev;
        for(int j=SZ(s)-1;j>=0;j--){
            rev+=s[j];
        }
        if(s==rev){
            ans++;
        }
    }
    cout<<ans<<endl;



}


Measured memory_bytes: 256
from collections import *
h,w=map(int,input().split())
a=[input() for _ in range(h)]
b=[[h*w]*w for _ in range(h)]
b[0][0]=1
d=deque([[0,0]])
while d:
    y,x=d.popleft()
    for i,j in([1,0],[-1,0],[0,1],[0,-1]):
        t,u=y+i,x+j
        if 0<=t<h and 0<=u<w:
            if a[t][u]=="." and b[t][u]>b[y][x]+1:
                d.append([t,u])
                b[t][u]=b[y][x]+1
c=sum([i.count(".") for i in a])
print(max(-1,c-b[-1][-1]))


Measured memory_bytes: 3444
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] komaAndX = br.readLine().split(" ");
        int komaNumber = Integer.parseInt(komaAndX[0]);
        int XNumber = Integer.parseInt(komaAndX[1]);
        
        if(komaNumber >= XNumber) {
            System.out.println(0);
            return;
        } // コマの数が座標より多い場合
        
        String[] strXs = br.readLine().split(" ");
        int[] Xs = new int[XNumber];
        for(int i = 0; i < XNumber; i++){
            Xs[i] = Integer.parseInt(strXs[i]);
        }
        Arrays.sort(Xs);
        int[] distances = new int[XNumber - 1];
        for(int i = 0; i < Xs.length - 1; i++){
            distances[i] = Xs[i + 1] - Xs[i];
        }
        Arrays.sort(distances);
        
        int totalMove = 0;
        for(int i = 0; i < distances.length && i < distances.length - komaNumber + 1; i++){
            totalMove += distances[i];
        }
        System.out.println(totalMove);
    }
}


Measured memory_bytes: 36596
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    while(true) {
        int n;
        cin >> n;
        if(!n) break;
        vi a(n), b(n);
        rep(i, n) {
            int g, h, j, l, p, o;
            scanf("%d:%d:%d %d:%d:%d", &g, &h, &j, &l, &p, &o);
            a[i] = g*3600 + h*60 + j;
            b[i] = l*3600 + p*60 + o;
        }

        vi ch(24*3600+1);
        rep(i, n) {
            ch[a[i]]++;
            ch[b[i]]--;
        }

        int ans = 0;
        int now = 0;
        rep(i, 24*3600+1) {
            now += ch[i];
            ans = max(ans, now);
        }

        cout << ans << '\n';
    }
}


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

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
//#define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 2e6 + 5, LG = 19, MOD = 1e9 + 7;
const int SQ =225;
int k;
string s;
int fast(int b, int e){
  if(!e)
    return 1;
  if(e & 1)
    return 1ll * b * fast(b, e - 1) % MOD;
  return fast(1ll * b * b % MOD, e >> 1);
}
int F[N];
int iF[N];
void init(){
  F[0] = iF[0] = 1;
  for(int i = 1; i < N; i++){
    F[i] = F[i-1] * 1ll * i % MOD;
    iF[i] = fast(F[i], MOD - 2);
  }
}
int C(int n, int k){
  return F[n] * 1ll * iF[k] % MOD * 1ll * iF[n-k] %MOD;
}
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
  init();
  cin >> k >> s;
  int n = s.size();
  int ans = 0;
  for(int i = n; i <= n + k; i++){
    ans = (ans + 1ll * C(n+k, i) * fast(25,n+k-i)) % MOD;
  }
  cout << ans << endl;
  return 0  ;
}


Measured memory_bytes: 19860
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define ALL(a) a.begin(),a.end()
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}

signed main(){
	int N;
	cin >> N;
	multiset<int>st;
	REP(i,1ll<<N){
		int t;
		cin >> t;
		st.insert(t);
	}
	vector<int>v;
	v.push_back(*prev(st.end()));
	st.erase(prev(st.end()));
	st.insert(-1e18);
	st.insert(-1e18);
	st.insert(1e18);
	REP(i,N){
		int num = 1ll << i;
		REP(j,num){
			auto itr = st.lower_bound(v[j]);
			--itr;
			if(*itr==-1e18){
				cout<<"No"<<endl;
				return 0;
			}
			v.push_back(*itr);
			st.erase(itr);
		}
		sort(ALL(v));
	}
	cout<<"Yes"<<endl;
}

Measured memory_bytes: 15736
X, N = map(int, input().split())
if N==0: print(X)
else:
    p = list(map(int, input().split()))
    pd = [[] for _ in range(100)]

    for i in range(N):
        pd[abs(p[i]-X)].append(X - p[i])

    for i in range(1,100):
        if len(pd[i])==0:
            ans = X - i
            break
        elif len(pd[i])==1:
            ans = X + pd[i][0]
            break
    print(ans if pd[0]==[0] else X)


Measured memory_bytes: 9160
/*
If you want to shine like a sun, first burn like a sun.
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

        
	int n,k;
	cin>>n>>k;
	pre

	vector<double> v(n+1,0);

	forn(i,1,n+1)
	{
		cin>>v[i];
		v[i] = (v[i]+1)/2.0;
		v[i] += v[i-1];
	}
        
/*    forv(i,v)
    {
    	cout<<i<<" ";
    }    */

    double maxi = 0;
    forn(i,k,n+1)
    {
    	maxi = max(maxi,v[i]-v[i-k]);
    }

    cout<<maxi;










    return 0;
}		

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n)for(ll i=0;i<n;++i)

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  int x,t;
  cin >> x >> t;
  cout << max(x-t,0) << endl;
  
  return 0;
}


Measured memory_bytes: 3656
# coding: utf-8
# Your code here!
a, b, c=map(int,input().split())
d=0
if b<c:
    d=b*2
    c=c-b
    if a<c:
        d=d+a+1
    else:
        d=d+c
else:
    d=c*2
    b=b-c
    d=d+b
    
print(d)

Measured memory_bytes: 2940
a = input()
a = a.split()
b = input()
b = b.split()
c = input()
c = c.split()
d = [a[0],b[0],c[0]]
e = [a[1],b[1],c[1]]
f = [a[2],b[2],c[2]]
g = [a[0],b[1],c[2]]
h = [a[2],b[1],c[0]]
n = int(input())
for i in range(n):
    j = int(input())
    for k in range(3):
        if int(a[k])==j:
            a.pop(k)
            a.insert(k,0)
        if int(b[k])==j:
            b.pop(k)
            b.insert(k,0)
        if int(c[k])==j:
            c.pop(k)
            c.insert(k,0)
        if int(d[k])==j:
            d.pop(k)
            d.insert(k,0)
        if int(e[k])==j:
            e.pop(k)
            e.insert(k,0)
        if int(f[k])==j:
            f.pop(k)
            f.insert(k,0)
        if int(g[k])==j:
            g.pop(k)
            g.insert(k,0)
        if int(h[k])==j:
            h.pop(k)
            h.insert(k,0)
if a == [0,0,0] or b == [0,0,0] or c == [0,0,0] or d == [0,0,0] or e == [0,0,0] or f == [0,0,0] or g == [0,0,0] or h == [0,0,0]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9296
#include <stdio.h>
int main(void)
{
	int in_second;//??\??????????????????S
	int out_hour, out_minute, out_second;//?????????h:m:s
	
	//??\???
	scanf("%d", &in_second);
	
	//?????????????¨????
	out_second = in_second % 60;
	out_minute = (in_second / 60) % 60;
	out_hour = (in_second / 60) / 60;
	
	//??????
	printf("%d:%d:%d\n", out_hour, out_minute, out_second);
	
	return 0;
}

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

int64_t gcd(int64_t a, int64_t b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
 
int64_t lcm(int64_t a, int64_t b){
  return a/gcd(a,b)* b;
}

int main() {
  int N;
  cin >> N;
  
  vector<int64_t> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i);
  }

  int64_t ans= data.at(0);
  for(int i=1; i<N; i++){
    ans= lcm(ans, data.at(i));
  }

  cout << ans << endl;
}

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

int main() {
  vector<vector<int>> data(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) cin >> data[i][j];
  }
  int n; cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) cin >> vec[i];
  
  bool bingo = false;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < n; k++){
        if(data[i][j]==vec[k]) data[i][j] = 0;
      }
    }
  }
 if(data[0][0] == 0 && data[0][1] == 0 && data[0][2] == 0) bingo = true;
 if(data[0][0] == 0 && data[1][0] == 0 && data[2][0] == 0) bingo = true;
 if(data[0][0] == 0 && data[1][1] == 0 && data[2][2] == 0) bingo = true;
 if(data[0][1] == 0 && data[1][1] == 0 && data[2][1] == 0) bingo = true;
 if(data[0][2] == 0 && data[1][2] == 0 && data[2][2] == 0) bingo = true;
 if(data[1][0] == 0 && data[1][1] == 0 && data[1][2] == 0) bingo = true;
 if(data[0][2] == 0 && data[1][1] == 0 && data[2][0] == 0) bingo = true;
 if(data[2][0] == 0 && data[2][1] == 0 && data[2][2] == 0) bingo = true;
  
  if(bingo)cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0:
                if ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Measured memory_bytes: 40812
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    int a,b;
    cin >> a >> b;
    int c,d;
    cin >> c >> d;
    pr((a>b?b:a) + (c>d?d:c));
}

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

int main() {
    int a;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> a;
    cout << a+pow(a, 2)+pow(a, 3) << endl;

    return 0;
}


Measured memory_bytes: 4212
#include <iostream>
#include <vector>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rrep(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)
const ll INF = (1LL << 50);

int main() {

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

	vector<vector<int>> jobs(M);

	int a, b;
	for (int i = 0; i < N; i++) {
		cin >> a >> b;
		if (a > M) continue;
		jobs[M-a].push_back(b);//何日前までにやる必要があるか　M=4 a=2ならばM-a=2日前までやればよい
	}

	priority_queue<int> q;//最大値

	ll ans = 0;

	for (int i = M - 1; i >= 0; --i) {//Mの一日前からみて、その時にできる仕事があれば、できる仕事のうち最大のBをansに加える
		for (int b : jobs[i]) {
			q.push(b);//priority_queueに格納する
		}
		if (!q.empty()) {
			ans += q.top();//最大のBを取り出す
			q.pop();
		}
	}

	cout << ans << endl;

	return 0;

}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n, m;
	cin >> n >> m;
	vector<int> h(n);
	rep(i, n) {
		cin >> h[i];
	}

	vector<set<int>> G(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].insert(b);
		G[b].insert(a);
	}

	ll ans = 0;
	for (int i = 0; i < n; i++) {
		int ma = h[i];
		bool f = false;
		for (auto g : G[i]) {
			if (ma <= h[g]) {
				ma = h[g];
				f = true;
			}
		}
		if (!f) {
			ans++;
		}
	}

	out(ans);

	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

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

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  int n;
  cin >> n;
  int ma=0;
  int ans=0;
  REP(i,n){
    int h;
    cin >> h;
    if(h >= ma){
      ans++; ma=h;
    }
  }
  cout << ans << endl;
}



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

using namespace std;

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

  int l[N], r[N];
  for (int i = 0; i < Q; i++ ) std::cin >> l[i] >> r[i];

  int res[N]; res[0] = 0;
  int counter = 0;
  for (int i = 0; i < N; i++) {
    if (S[i-1] == 'A' && S[i] == 'C') {
      counter++;
    }
    res[i] = counter;

  }
  for (size_t i = 0; i < Q; i++) {
    std::cout << res[r[i]-1] - res[l[i]-1] << '\n';
  }
  return 0;
}


Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int a = scanner.nextInt();
		int b = scanner.nextInt();

		if (a < b) {
			System.out.println("a < b");
		} else if (a > b) {
			System.out.println("a > b");
		}else if(a == b){
			System.out.println("a == b");
		}
	}

}

Measured memory_bytes: 17320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, z;
    cin >> n >> z;
    vector<ll> x(n), v(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> v[i];
    }
    vector<ll> a(n), b(n), c(n), d(n);
    ll cur = 0;
    for (int i = 0; i < n; i++) {
        cur += v[i];
        a[i] = cur - x[i];
        b[i] = cur - x[i] - x[i];
        if (i) {
            a[i] = max(a[i], a[i - 1]);
            b[i] = max(b[i], b[i - 1]);
        } else {
            a[i] = max(a[i], 0LL);
            b[i] = max(b[i], 0LL);
        }
    }
    cur = 0;
    for (int i = n - 1; i >= 0; i--) {
        cur += v[i];
        c[i] = cur - z + x[i];
        d[i] = cur - z - z + x[i] + x[i];
        if (i != n - 1) {
            c[i] = max(c[i], c[i + 1]);
            d[i] = max(d[i], d[i + 1]);
        } else {
            c[i] = max(c[i], 0LL);
            d[i] = max(d[i], 0LL);
        }
    }
    ll ans = max(a[n - 1], c[0]);
    for (int i = 0; i < n - 1; i++) {
        ans = max({ans, a[i] + d[i + 1], b[i] + c[i + 1]});
    }
    cout << ans << '\n';
    return 0;
}

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

ll n, p;
ll ans;

int even, odd;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> n >> p;
    vector<int> a(n);
    for (auto& i : a) {
		cin >> i;
		i % 2 ? odd++ : even++;
	}
    
    if (even == n) {
		if (p) cout << 0;
		else cout << fixed << setprecision(0) << pow(2, n);
	} else {
		cout << fixed << setprecision(0) << pow(2ll, n - 1);
	}
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

// AtCoder Functions
var sc = bufio.NewScanner(os.Stdin)

func nextString() string {
	sc.Scan()
	return sc.Text()
}
func stringToSlice(str string) []string {
	return strings.Split(str, "")
}

func main() {
	sc.Split(bufio.ScanWords)
	S := nextString()
	T := nextString()

	Sary := stringToSlice(S)
	Tary := stringToSlice(T)
	N := len(Sary)

	ret := "No"
	for loop := 0; loop < N; loop++ {
		yes := true
		for i := 0; i < N; i++ {
			if Sary[i] != Tary[i] {
				yes = false
				continue
			}
		}
		if yes {
			ret = "Yes"
			break
		}
		tmp := Sary[N-1]
		for i := N - 1; i > 0; i-- {
			Sary[i] = Sary[i-1]
		}
		Sary[0] = tmp
	}

	fmt.Println(ret)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define pii pair<int, int>
#define fir first
#define sec second
using namespace std;
const int MAXN = 18;
const int INF = 1e9;
int val[MAXN][2];
pii t[MAXN + 1];
vector<pii>vec[2][2]; // 0-A, 1-B ; 0-even, 1-odd 
int p[2][2];
int main()
{
    int n; scanf("%d", &n);
    for (int j = 0; j < 2; j++)
        for (int i = 0; i < n; i++) scanf("%d", &val[i][j]), p[i][j] = 0;
    int ans = INF;
    for (int s = 0; s < (1 << n); s++)
    {
        for (int i = 0; i < 2; i++)
            for (int j = 0; j < 2; j++) vec[i][j].clear(), p[i][j] = 0;
        for (int i = 0, c; i < n; i++) 
        {
            c = (s >> i & 1);
            vec[c][i & 1].emplace_back(val[i][c], i);
        }
        for (int i = 0; i < 2; i++)
            for (int j = 0; j < 2; j++) sort(vec[i][j].begin(), vec[i][j].end());
        int cnt = 0, f = 1;
        for (int i = 0, c; i < n; i++)
        {
            c = (i & 1);
            if (p[0][c] < vec[0][c].size() && p[1][c ^ 1] < vec[1][c ^ 1].size()) 
            {
                if (vec[0][c][p[0][c]] < vec[1][c ^ 1][p[1][c ^ 1]]) t[++cnt] = vec[0][c][p[0][c]++];
                else t[++cnt] = vec[1][c ^ 1][p[1][c ^ 1]++];
            }
            else if (p[1][c ^ 1] < vec[1][c ^ 1].size()) t[++cnt] = vec[1][c ^ 1][p[1][c ^ 1]++];
            else if (p[0][c] < vec[0][c].size()) t[++cnt] = vec[0][c][p[0][c]++];
            else {f = 0; break;}
            if (cnt >= 2 && t[cnt].fir < t[cnt - 1].fir) {f = 0; break;}
        }
        if (!f) continue;
        assert(cnt == n);
        int res = 0;
        for (int i = 1; i <= n; i++)
            for (int j = i + 1; j <= n; j++)
                if (t[j].sec < t[i].sec) res++;
        ans = min(ans, res);
    }
    printf("%d\n", ans == INF ? -1 : ans);
    return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

const int vmax=100010;
vi graph[vmax];
int color[vmax];
ll black=0LL,white=0LL;

bool dfs(int v,int c){
	color[v]=c;
	if(c==1) black++;
	if(c==-1) white++;
	for(auto &v2:graph[v]){
		if(color[v2]==0&&dfs(v2,-c)==false) return false;
		if(color[v2]==color[v]) return false;
	}
	return true;
}

ll base=0LL;
ll num[100010];
ll dp[100010];

ll calc(ll v){
	clr(dp,-1);
	dp[0]=0LL;

	rep(i,v+1){
		if(num[i]==0) continue;
		rep(j,v+1){
			if(dp[j]>=0)
				dp[j]=num[i];
			else if(j<i || dp[j-i]<=0)
				dp[j]=-1;
			else
				dp[j]=dp[j-i]-1;
		}
	}
	ll all=0LL;
	rep(i,v+1){
		if(dp[i]>=0){
			ll white=base+i;
			ll black=v-white;
			all=max(all,white*black);
		}
	}
	return all;
}

int main(void){
	ll v,e;
	cin >> v >> e;
	rep(i,e){
		int a,b;
		cin >> a >> b;
		graph[a-1].pb(b-1);
		graph[b-1].pb(a-1);
	}

	bool ok=true;;
	rep(i,v){
		if(color[i]!=0) continue;
		int c=1;
		if(dfs(i,c)==false) ok=false;
		base+=min(black,white);
		num[max(black,white)-min(black,white)]++;
		black=0,white=0;
	}

	ll all=calc(v);
	if(ok)
		cout << all-e << endl;
	else
		cout << -1 << endl;
	return 0;
}

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

int main(){

    int N;
    int num;
 
    cin >> N;
    vector<int> di(N);
    
    for(int i=0;i<N;i++) cin >> di[i];
    


   /*
    //ソート
    for(int i=0;i<N;i++){
        
        for(int j=0;j<N-1;j++){
            if(di[j] > di[j+1]){
                num=di[j+1];
                di[j+1]=di[j];
                di[j]=num;
            }
        }
        
        
    }
    */
    
    //ソート
    sort(di.begin(),di.end());
    

    cout << -di[(N/2)-1]+di[N/2] ;
    
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

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

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int a, b;
    cin >> a >> b;
    if(a * b % 2 == 1) cout << "Yes";
    else cout << "No";
    cout << endl;

    return 0;
}


Measured memory_bytes: 3612
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    double ans=0;
    for(int i=0; i<n; i++){
        double x; string u; cin>>x>>u;
        if(u=="JPY") ans+=x;
        else ans+=(x*380000.0);
    }
    printf("%.6lf\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
	string s;
	cin>>s;
	
	while(1){
		REP(i,2) s.pop_back();
		
		int n=s.size();
		string s1=s.substr(0,n/2);
		string s2=s.substr(n/2,n/2);
		if(s1==s2) break;
	}
	
	cout<<s.size()<<endl;
	return 0;
}

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

L = [[0] * 2 for i in range(N)]

for i in range(N):
  L[i][1] = i + 1
  L[i][0] = A[i]

L.sort()

t = str(L[0][1])
for i in range(1, N):
  t += " " + str(L[i][1])

print(t)

Measured memory_bytes: 22116
#include <stdio.h>
int main(void){
	int a[5];
	int i,j,temp,ans;
	for(i=0;i<5;i++){
		scanf("%d",&a[i]);
	}
	int min = 9,mini= 0;
	//a[]の中でもっとも10で割ったときのあまりが1に近いものを出す
	for(i=0;i<5;i++){
		temp = a[i]%10;
		if(temp ==0){
			continue;
		}
		if(temp<min){
			min = temp;
			mini= i;
		}
	}
	//答えはa[maxi]以外を10で割って切り上げたモノ+a[maxi];
	ans = 0;
	for(i=0;i<5;i++){
		if(i != mini){
			ans += ((a[i]+9)/10)*10;
		}else{
			ans += a[mini];
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define pi 3.14159265358979323846
#define ll long long
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  ll int a, b, c;
  cin >> a >> b;
  if(a > 0 && b > 0){
    cout << "Positive\n";
    return 0;
  }
  if(a * b < 0){
    cout << "Zero\n";
    return 0;
  }
  c = b - a + 1;
  if(c % 2 == 0){
    cout << "Positive\n";
    return 0;
  }
  cout << "Negative\n";
}
  

Measured memory_bytes: 3600
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;
template<typename T> void print(T t) {cout << t << endl;}

int main() {
	vector<int> list1(26, 0), list2(26, 0);
	int N, ans = 0;
	string S;
	cin >> N >> S;


	for (const char& c : S) list2[c - 'a']++;
	for (int i = 0; i < N-1; i++) {
		int index = S[i] - 'a';
		list1[index]++;
		list2[index]--;

		int count = 0;
		for (int n = 0; n < 26; n++) {
			if (list1[n]> 0 && list2[n] > 0) count++;
		}
		ans = max(ans, count);
	}
	print(ans);
}

Measured memory_bytes: 3600
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = sc.nextInt();
    int[] p = new int[n];
    for(int i = 0;i<n;i++){
      p[i] = Math.abs(sc.nextInt()-x);
    }
    Arrays.sort(p);
    int d=0;
    distance:for(int i = p[0];i>0;i--){
      for(int j = 0;j<n;j++){
        if(p[j]%i!=0)continue distance;
        if(j==n-1){
          d = i;
          break distance;
        }
      }
    }
    System.out.println(d);

  }
}


Measured memory_bytes: 59500
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

a=gets.chomp
if a.upcase==a
    puts "A"
else
    puts "a"
end

Measured memory_bytes: 14284
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main(){
  ull H;
  cin >> H;
  ull ans = 0, cnt = 0, tmp = 1;
  
  while(H) {
    tmp = 1;
    H /= 2;
    ull a = cnt;
    while(a) {
      tmp *= 2;
      a--;
    }
    ans += tmp;
    cnt++;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	long long sum=100,x;
	cin>>x;
	int tot=0;
	for(long long i=1;i<=x;i++)
	{
		sum*=1.01;
		tot++;
		if(sum>=x)
		{
			cout<<tot;
			break;
		}
	}
}

Measured memory_bytes: 3644
def gcd_array(array)
    a = array.shift
    b = array.shift
    ans = gcd(a,b)
    while(!array.empty?)
        a = array.shift
        ans = gcd(ans, a)
    end
    ans
end

def gcd(a, b)
    return a if b == 0
    gcd(b, a % b)
end

N = gets.to_i
monster = gets.split.map(&:to_i)
puts gcd_array(monster)


Measured memory_bytes: 8452
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long 
#define mod 1000000007 
void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}
void setIO(string name) {
  freopen((name+".in").c_str(),"r",stdin);
  freopen((name+".out").c_str(),"w",stdout);
}
vector<int> adj[200005];
int visited[200005]={0};
int ender=-1;
int n;
long long k;
vector<int> c;
void dfs(int node){
  visited[node]=1;
   c.emplace_back(node);
  for(auto next:adj[node]){
    if(!visited[next]){
      dfs(next);
    }else{
      ender=next;
      break;
    }
  }
 
}

int main() {
   fast();
   cin>>n;
   cin>>k;
   for(int i=0;i<n;i++){
    int l;
    cin>>l;
    --l;
    adj[i].emplace_back(l);
   }
   dfs(0);
  
  
     int x;
      for(int i=0;i<c.size();i++){
        if(c[i]==ender){
           x=i;
           break;
        }
      }
     if(k<=x){
       cout<<c[k]+1<<"\n";
       return 0;
     }else{
      long long y=c.size()-x;
      k-=x;
      k%=y;
      cout<<c[k+x]+1<<"\n";
      return 0;
     }
      
   

   

   

   
   



   
}
 


Measured memory_bytes: 24860
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>

#define lli long long int

#define MIN(a,b) ((a)>(b)?(b):(a))
lli sq(lli a)
{
	lli i = 0;
	while (i*i < a)
	{
		i++;
	}
	return(i);
}
int main(void)
{
	lli n;
	scanf("%lld",&n);
	lli big = 1000003;
	big = MIN(big,sq(n));
	while (big > 1)
	{
		if(n%big == 0)
			break;
		big--;
	}
	if (big == 1)
	{
		printf("%lld\n",n-1);
		return(0);
	}
	else
	{
		printf("%lld\n", big+(n/big)-2);
		return(0);
	}
	lli i, j;
	i = 1;
	j = 1;
	while (i <= n)
	{
		j = 1;
		while (j <= i)
		{
			if(i*j == n)
			{
				printf("%lld\n",i-1+j-1);
				return(0);
			}
			j++;
		}
		i++;
	}

	return(0);
}


Measured memory_bytes: 128