akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/*
1
11
101
1111
10001
110011
1010101
11111111
100000001
1100000011
10100000101
111100001111
1000100010001
11001100110011
101010101010101
1111111111111111
 */
public class Main {
	static PrintWriter out = new PrintWriter(System.out);

	static int N;
	static long twosInFac[];
	public static void main(String[] args) {
		FS in = new FS();
		int maxn = 1000002;
		
		twosInFac = new long[maxn];
		twosInFac[0] = 0;
		for(int i = 1; i < maxn; i++) {
			int val = i;
			twosInFac[i] += twosInFac[i-1];
			while(val%2 == 0) { twosInFac[i]++; val /= 2;}
		}
		
		N = in.nextInt();
		char c[] = in.next().toCharArray();
		int first[] = new int[N];
		for(int i = 0; i < N; i++) first[i] = c[i]-'0';
		
		int vs[] = new int[N-1];
		for(int i = 0; i < N-1; i++) vs[i] = Math.abs(first[i]-first[i+1]);
		N--;
		
		boolean hasOne = false;
		for(int ii : vs) hasOne |= ii == 1;
		
		int res = 0;
		if(hasOne) {
			for(int i = 0; i < N; i++) if(vs[i] == 1) res ^= getCol(i);
		}
		else {
			for(int i = 0; i < N; i++) if(vs[i] == 2) res ^= getCol(i);
			res *= 2;
		}
		out.println(res);
		out.close();
	}
	
	static int getCol(int c) {
		long a = twosInFac[N-1];
		long b = twosInFac[N-1-c] + twosInFac[c];
		return a > b ? 0 : 1;
	}
	
	
	static class FS{
		BufferedReader br;
		StringTokenizer st;
		public FS() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {st = new StringTokenizer(br.readLine());}
				catch(Exception e) { throw null;}
			}
			return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next());}
		double nextDouble() { return Double.parseDouble(next());}
		long nextLong() { return Long.parseLong(next());}
		int[] NIA(int n) {
			int r[] = new int[n];
			for(int i = 0; i < n; i++) r[i] = nextInt();
			return r;
		}
		long[] NLA(int n) {
			long r[] = new long[n];
			for(int i = 0; i < n; i++) r[i] = nextLong();
			return r;
		}
		char[][] grid(int r, int c){
			char res[][] = new char[r][c];
			for(int i = 0; i < r; i++) {
				char l[] = next().toCharArray();
				for(int j = 0; j < c; j++) {
					res[i][j] = l[j];
				}
			}
			return res;
		}
	}
	
}


Measured memory_bytes: 49876
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0

L = sum(A) * (1 / (4 * M))
for i in range(N):
  if A[i] >= L:
    cnt += 1

if cnt >= M:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]
p = [k]*n
for i in a:
    p[i-1] = p[i-1] + 1
for i in p:
    if i - q > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 10492
using System;
class Program
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int N = int.Parse(input[0]);
    int K = int.Parse(input[1]);
    const long mod = 1000000007;
    
    long[,] C = new long[N+1, N+1];
    C[0, 0] = 1;
    
    int Cmax = Math.Max(K-1, N-K+1);
    for (int i = 1; i <= Cmax; i++)
    {
      for (int j = 0; j <= i; j++)
      {
        if (j == 0)
          C[i, j] = C[i-1, j];
        else
          C[i, j] = (C[i-1, j-1] + C[i-1, j]) % mod;
      }
    }
    
    for (int i = 1; i <= K; i++)
    {
      long blue = C[K-1, i-1];
      
      long red;
      
      if (N-K+1 < i)
        red = 0;
      else
        red = C[N-K+1, i];
      
      Console.WriteLine((blue * red) % mod);
    }
    
  }
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
#define pb push_back
#define ll long long
#define ALL(a) a.begin(), a.end()

int main(void)
{
  ll n, k;
  cin >> n >> k;
  vec<ll> m(48, 0);
  rep(i, 48) m[i] = ((k + 1) >> i) % 2;

  vec<ll> a(n);
  rep(i, n) cin >> a[i];

  vec<ll> keta(48, 0);
  rep(i, n) {
    rep(j, 48) keta[j] += (a[i] >> j) % 2;
  }

  ll Max = 0;
  rep(i, 48) Max += ((ll)1 << (ll)i) * keta[i];
  rep(i, 48) {
    if (!m[i]) continue;
    vec<ll> x(48);
    rep(j, i) x[j] = max(keta[j], n - keta[j]);
    x[i] = keta[i];
    for (int j = i + 1; j < 48; j++) x[j] = m[j] ? n - keta[j] : keta[j];
    ll temp = 0;
    rep(j, 48) temp += ((ll)1 << (ll)j) * x[j];
    if (temp > Max) Max = temp;
  }
  cout << Max << endl;
  return 0;
}



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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

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

//--------------------------------------------

int main(){
  int x,a,b;
  scanf("%d %d %d",&x,&a,&b);
  if (a - b >= 0) printf("delicious\n");
  else if ((b - a) <= x) printf("safe\n");
  else printf("dangerous\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <bitset>
#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000'000'007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    if(s.size() == 1 || s.size() % 2 == 1){
        cout << "No" << endl;
        return 0;
    }
    rep(i,s.size()/2){
        if(s[i] != s[s.size()/2+i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll mod = 10e9+7;

#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prtd(n, var)  cout << setprecision(n) << var << endl

//----------------------------------------------------------------

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

  if((c>a&&c<b)||(c>b&&c<a)){
    prt("Yes");
  } else {
    prt("No");
  }

}


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

using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;

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

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

	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms.\n";
}

// g++ o .cpp -O2 -std=c++11 -D cute -Wall -Wno-unused-result



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  
  cin>>n;
  
  map<int,int> ans;
  
  int x;
  
  for(int i=0;i<n-1;i++)
  {
    cin>>x;
    
    ans[x]++;
  }
  for(int i=1;i<=n;i++)
  {
    cout<<ans[i]<<"\n";
  }
  return 0;
}

Measured memory_bytes: 12976
#include <bits/stdc++.h>
using namespace std;
const int N=210000;
int n,k;
int a[N];
int go[N];
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	go[0]=0;
	int ans=0;
	for(int i=1;i<n;i++)
	{
		if(a[i]>a[i-1]) go[i]=go[i-1]+1;
		else go[i]=0;
		if(go[i]>=k-1) ans=1;
	}
	set<int> ss;
	for(int i=0;i<k;i++) ss.insert(a[i]);
	if(go[k-1]!=k-1) ans++;
	for(int i=k;i<n;i++)
	{
		ss.insert(a[i]);
		if(*ss.begin()!=a[i-k] || *ss.rbegin()!=a[i])
		{
			if(go[i]<k-1) ans++;
		}
		ss.erase(a[i-k]);
	}
	cout<<ans<<"\n";
	return 0;
} 

Measured memory_bytes: 11136
// ~/Remember,remember the 6th of March

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double  EPS = 1e-8;
const ll MOD = 998244353;
const int N = 100000 + 7;

int n;
string s;
bool check(int len)
{
    for(int i=0; i+len<n; i++)
    {
        string temp=s.substr(i,len);
        if(s.find(temp,i+len)!=string::npos)
            return 1;
    }
    return 0;
}
int main()
{
    cin>>n>>s;
    int l=1,h=n/2,mid,ans=0;
    while(l<=h)
    {
        mid=(h+l)/2;
        if(check(mid))
        {
            ans=mid;
            l=mid+1;
        }
        else
            h=mid-1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#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(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

int C, N, M, S, D;
vector<pii> g[100];
int d[11][100];

int main() {
	while (cin >> C >> N >> M >> S >> D, C || N || M || S || D) {
		S--; D--;
		REP(i, N) g[i].clear();
		
		REP(i, M) {
			int a, b, f;
			scanf("%d %d %d", &a, &b, &f);
			a--; b--;
			g[a].push_back(pii(b, f));
			g[b].push_back(pii(a, f));
		}
		
		fill(d[0], d[C + 1], INF);
		
		priority_queue<pii, vector<pii>, greater<pii> > pq[11];
		
		pq[0].push(pii(0, S));
		d[0][S] = 0;
		
		REP(i, C + 1) {
			while (!pq[i].empty()) {
				pii now = pq[i].top(); pq[i].pop();
				int u = now.se, cost = now.fi;
				REP(j, g[u].size()) {
					int v = g[u][j].fi, c = g[u][j].se;
					if (i < C && chmin(d[i + 1][v], cost + c / 2)) pq[i + 1].push(pii(cost + c / 2, v));
					if (chmin(d[i][v], cost + c)) pq[i].push(pii(cost + c, v));
				}
			}
		}
		
		int ans = INF;
		REP(i, C + 1) chmin(ans, d[i][D]);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007
//#pragma GCC optimize(2)
//#define int long long
using namespace std;
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	string s,t;
	cin>>s>>t;
	int ans=0;
	for(int i=0;i<3;i++)
		if(s[i]==t[i])
			ans++;
	cout<<ans<<endl;
	return 0;
}


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

string s;

bool input() {
  return cin >> s;
}

string convert(string s) {
  string res;
  for (int i = 0; i < 1000; ++i) {
    for (char c = '0'; c <= '9'; ++c) {
      for (auto& x : s) {
        if (x == c) {
          res += x;
          x = '@';
          break;
        }
      }
    }
    for (char c = 'a'; c <= 'z'; ++c) {
      for (auto& x : s) {
        if (x == c) {
          res += x;
          x = '@';
          break;
        }
      }
    }
  }
  return res;
}

int count(const string& s, int k) {
  int res = 1;
  for (int i = k; i + 1 < (int)s.size(); ++i) {
    if (s[i + 1] - s[i] == 1) {
      res ++;
    } else {
      break;
    }
  }
  return res;
}

int solve() {
  string t = convert(s);
  int res = 0;
  for (int i = 0; i < (int)t.size();) {
    int cnt = count(t, i);
    if (cnt >= 3) {
      res += 3;
    } else {
      res += cnt;
    }
    i += cnt;
  }
  return res;
}

int main() {
  while (input()) cout << solve() << endl;
  return 0;
}

Measured memory_bytes: 1200
#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 MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;

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

  int ans=1<<21;
  for(ll i = 1; i * i <= N; i++){
    if(N%i!=0)continue;
    ll a=i;
    ll b=N/i;

    int s=0;
    while(a>0){
      a /= 10;
      s++;
    }
    int t=0;
    while(b>0){
      b /= 10;
      t++;
    }
    ans = min(max(s,t),ans);
  }
  cout << ans << endl;
}



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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

ll MOD = 998244353;
const int MAXN = 3e5 + 10;
vll fact (MAXN);
vll invfact (MAXN);
vll pow2(MAXN);
vll inv (MAXN);

ll choose(ll n, ll k) {
    return fact[n] * invfact[k] % MOD * invfact[n-k] % MOD;
}

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

	fact[0] = 1;
    FOR(i, 1, MAXN) fact[i] = fact[i-1] * i % MOD;

    inv[1] = 1;
    FOR(i, 2, MAXN) inv[i] = (MOD - (MOD/i) * inv[MOD%i] % MOD) % MOD;

    invfact[0] = 1;
    FOR(i, 1, MAXN) invfact[i] = invfact[i-1] * inv[i] % MOD;

	ll N, A, B, K; cin >> N >> A >> B >> K;
	
	ll ans = 0;
	for (ll s1 = 0; s1 <= N; ++s1) if (s1 * B <= K) {
		ll s2 = K - s1 * B;
		if ((s2 % A != 0) || (s2 / A > N)) continue;
		s2 /= A;
		ans += choose(N, s1) * choose(N, s2);
		ans %= MOD;
	}
	print(ans);
}

Measured memory_bytes: 9600
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <vector>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <ctime>

using namespace std;


int main()
{
    //freopen("../input.txt", "r", stdin);
    string s;
    cin >> s;

    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes";
    } else {
        cout << "No";
    }


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define debug(x) cerr << #x " = " << (x) << endl;
#define P(x) cerr << #x << endl;    
typedef long long ll;
#define int long long
const int mod = 1000000007;



int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(9);
    
    
    int n;
    cin >> n;
    
    cout << n * n * n << endl;
    
    
    return 0;
}






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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  for_each(begin(H), end(H), [](int &e) { cin >> e; });
  int ma = 0, ans = 0;
  for (int i = 0; i < N; i++) {
    if (ma <= H[i]) ans++;
    ma = max(ma, H[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class Program
{
    static void Main(string[] args)
    {
        var x = long.Parse(Console.ReadLine());
        var y = 0;
        var st = 100L;

        while (st < x)
        {
            y++;
            st = (long)Math.Floor(st * 1.01);
        }

        Console.WriteLine(y);
    }
}


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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int m1, d1;
    cin >> m1 >> d1;
    int m2, d2;
    cin >> m2 >> d1;

    if (m1 != m2) cout << 1 << '\n';
    else cout << 0 << '\n';
    return 0;
}

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

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

    string ans = "hon";

    int k = num % 10;
    if (k == 0 || k == 1 || k == 6 || k == 8) {
        ans = "pon";
    } else if (k == 3) {
        ans = "bon";
    }

    cout << ans << endl;

    return 0;
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

int main(){
    int n,m;cin >> n >> m;
    vector<pair<int,int>> sc;
    for(int i=0;i<m;i++){
        int s,c;cin >> s >> c;
        sc.push_back(make_pair(s,c));
    }

    sort(ALL(sc));
    //条件外チェック
    for(int i=1;i<m;i++){
        if((sc[i].first == sc[i-1].first) && (sc[i].second != sc[i-1].second)){
            cout << -1 << endl;
            return 0;
        }else if(sc[0].first == 1 && sc[0].second == 0 && n != 1){
            cout << -1 << endl;
            return 0;
        }
    }

    if(m==1){
        if(sc[0].first == 1 && sc[0].second == 0 && n != 1){
            cout << -1 << endl;
            return 0;
        }
    }

    if(m==0){
        if(n == 1){
            cout << 0 << endl;
        }else if(n == 2){
            cout << 10 << endl;
        }else if(n == 3){
            cout << 100 << endl;
        }
        return 0;
    }

    sc.erase(unique(ALL(sc)),sc.end());
    vi ans(n);
    for(int i=0;i<sc.size();i++){
        ans[sc[i].first-1] = sc[i].second;
    }
    if(ans[0] == 0 && n != 1)ans[0] = 1;
    rep(i,n)cout << ans[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a1,a2,a3,a4,b1,b2,b3,b4;
	scanf("%d %d %d %d",&a1,&a2,&a3,&a4);
	scanf("%d %d %d %d",&b1,&b2,&b3,&b4);
	if(a1+a2+a3+a4<b1+b2+b3+b4){
		printf("%d\n",b1+b2+b3+b4);
	}
	else{
		printf("%d\n",a1+a2+a3+a4);
	}
	return 0;
}


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

using namespace std;

int main() {
	vector<int> furui(300001, 0);
	vector<int> furui2(300001, 0);
	furui[0] = furui[1] = furui2[0] = furui2[1] = 1;
	for (int i = 2; i < 300001; i++) {
		if (i % 7 == 1 || i % 7 == 6) {
		} else {
			furui[i] = furui2[i] = 1;
		}
	}
	for (long long int i = 6; i < 300001; i++) {
		if (furui[i] == 0) {
			for (long long int j = i; j < 300001; j++) {
				if (furui2[j] == 0) {
					if (i*j < 300001) {
						furui[i*j] = 1;
					} else {
						break;
					}
				}
			}
		}
	}
	int n;
	while (cin >> n) {
		if (n == 1) {
			break;
		}
		priority_queue< int, vector<int>, greater<int> > pq;
		cout << n << ":";
		int kari;
		if (furui[n] != 0) {
			vector<int> furui3(300001, 0);
			for (int i = 6; i < n; i++) {
				kari = n;
				if (furui[i] == 0 && furui3[i] == 0) {
					if (i > n) {
						break;
					}
					if (n % i == 0) {
						queue<int> q;
						kari /= i;
						q.push(i);
						for (int j = 6; j < n; j++) {
							if (furui[j] == 0 && kari % j == 0) {
								q.push(j);
								while (kari % j == 0) {
									kari /= j;
								}
							}
							if (kari == 1) {
								furui3[i] = 1;
								while (!q.empty()) {
									pq.push(q.front());
									furui3[q.front()] = 1;
									q.pop();
								}
							}
							if (kari % 7 != 1 && kari % 7 != 6) {
								break;
							}
						}
					}
				}
			}
		} else {
			pq.push(n);
		}
		int a = pq.top();
		pq.pop();
		cout << " " << a;
		while (!pq.empty()) {
			if (pq.top() != a) {
				cout << " " << pq.top();
				a = pq.top();
			}
			pq.pop();
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 4704
s = gets.chomp.to_i
num = s.to_s.split("").map(&:to_i)
sum = 0
 
n = num.length
(1..n).each do |digit| #桁数
    (0..n-1).each do |i| #インデックス
        next if digit > (n-i)
        dig = num[i] * 10**(digit-1)
        left = i
        right = (n-1 - (i+digit) > 0 ? n-1 - (i+digit): 0)
        sum += dig * (2 ** (left + right))
    end
end
puts sum

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int ans=0,i;
    int l=s.length();
    for(i=0;i<l;i++)
    {
        if(s[i]>='a' && s[i]<='z')
            ans++;
    }
    int ans1=0;
    for(i=2;i<l-1;i++)
    {
        if(s[i]=='C')
            ans1++;
    }
    if(s[0]=='A' && ans1==1 && ans==l-2)
        cout<<"AC";
    else
        cout<<"WA";
    return 0;
}


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

int main()
{
	string s;
	int a,b;
	
	cin>>a>>b;
	cin>>s;
	
	if(s.size()!=a+b+1)
	{
		cout<<"No"<<endl;
		return 0;
	}
	
	for(int i=0; i<s.size(); i++)
	{
		if(i!=a)
		  {
		  if(!isdigit(s[i]))
		  {
		  	cout<<"No"<<endl;
		  	return 0;
		  }
	      }
		else
		{
			if(s[i]!='-')
		    {
		    	cout<<"No"<<endl;
		    	return 0;
		    }
		}
	}
	
	cout<<"Yes"<<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 pair<int, int> P;

int main(){
  int n; cin >> n;
  vector<pair<ll, ll>> p(n);
  //multi_set<int> l, r;
  rep(i, n){
    cin >> p[i].second >> p[i].first;
    p[i].first += p[i].second;
    //l.insert(x[i] - a[i]);
    //r.insert(x[i] + a[i]);
  }
  sort(p.begin(), p.end());

  int ans = 0;
  ll right = -1e18;

  for(int i = 0; i < n; i++){
    ll left = p[i].second * 2 - p[i].first;
    if(right <= left){
      ans++;
      right = p[i].first;
    }
  }


  cout << ans << endl;


  return 0;
}


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

int main(void)
{
	//N:サイコロの面数
	//K:目標得点
	//t:K以上になる回数
	//i, j:カウンタ
	//total:sigma(i:1～N)2^t(i)
	int N, K, t, i, j;
	double total = 0.0;
	char inputline[100];

	//入力
	if (fgets(inputline, sizeof inputline, stdin) != NULL) {
		sscanf(inputline, "%d %d", &N, &K);
	}


	for (i = 1; i <= N; i++)
	{
		//tを計算
		t = 0;
		j = i;
		while (j < K)
		{
			j *= 2;
			t++;
		}
		

		//0.5^tを計算してtotalに加算
		total += pow(0.5, (double)t);
	}

	//出力
	printf("%.10f\n", total / (double)N);

	return 0;
}

Measured memory_bytes: 128
n = int(input())
x = list(map(int, input().split()))

x.sort()
cnt = 0
minimum = 0
for i in range(x[0], x[-1] + 1):
    for j in range(n):
        cnt += (x[j] - i) ** 2
    
    if i == x[0]:
        minimum = cnt
        
    minimum = min([minimum, cnt]) 
    cnt = 0

print(minimum)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    long long N, K;
    cin >> N >> K;
    
    vector<vector<vector<int>>> wish(2, vector<vector<int>>(K, vector<int>(2*K, 0)));
    vector<vector<vector<int>>> cumsum(2, vector<vector<int>>(K+1, vector<int>(2*K+1, 0)));
    
    for(int i = 0; i < N; i++){
        long long x, y;
        char c;
        cin >> x >> y >> c;
        
        if((x / K + y / K) % 2 == 0){
            wish[c=='B'?0:1][y%K][x%K]++;
        }
        else{
            wish[c=='B'?0:1][y%K][x%K+K]++;
        }
    }
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < K; j++){
            for(int k = 0; k < 2*K; k++){
                if(j > 0)
                    cumsum[i][j+1][k+1] += cumsum[i][j][k+1];
                if(k > 0)
                    cumsum[i][j+1][k+1] += cumsum[i][j+1][k];
                if(j > 0 && k > 0)
                    cumsum[i][j+1][k+1] -= cumsum[i][j][k];
                cumsum[i][j+1][k+1] += wish[i][j][k];
            }
        }
    }
   
    long long max_wish = 0;
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < K; j++){
            for(int k = 0; k < K; k++){
                long long count_wish = 0;
                count_wish += cumsum[i%2][K-j][K-k] - cumsum[i%2][0][K-k] - cumsum[i%2][K-j][0] + cumsum[i%2][0][0]; // 1
                count_wish += cumsum[(i+1)%2][K][K-k] - cumsum[(i+1)%2][K-j][K-k] - cumsum[(i+1)%2][K][0] + cumsum[(i+1)%2][K-j][0]; // 2
                count_wish += cumsum[(i+1)%2][K-j][2*K-k] - cumsum[(i+1)%2][0][2*K-k] - cumsum[(i+1)%2][K-j][K-k] + cumsum[(i+1)%2][0][K-k]; // 3
                count_wish += cumsum[i%2][K][2*K-k] - cumsum[i%2][K-j][2*K-k] - cumsum[i%2][K][K-k] + cumsum[i%2][K-j][K-k]; // 4
                count_wish += cumsum[i%2][K-j][2*K] - cumsum[i%2][0][2*K] - cumsum[i%2][K-j][2*K-k] + cumsum[i%2][0][2*K-k]; // 5
                count_wish += cumsum[(i+1)%2][K][2*K] - cumsum[(i+1)%2][K-j][2*K] - cumsum[(i+1)%2][K][2*K-k] + cumsum[(i+1)%2][K-j][2*K-k]; // 6
                max_wish = count_wish > max_wish ? count_wish : max_wish;
            }
        }
    }
    
    cout << max_wish << endl;
    
}


Measured memory_bytes: 39552
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <assert.h>
#include <deque>
#include <algorithm>
#include <string>
using namespace std;

typedef long long lli;
typedef pair<int, int> pii;

int main() {
    int n, s = 0;
    scanf("%d", &n);
    while (n--) {
        int t;
        scanf("%d", &t);
        s += (t & 1);
    }
    puts((s & 1) ? "NO" : "YES");
	return 0;
}


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

class Program{

  static int cnt0 = 0;
  static int cnt1 = 0;
  static int ans = 0;

  static int Main() {

    string nyu = Console.ReadLine();
    int lng = nyu.Length;
    int[] s = new int[lng];
    for (int i = 0; i < s.Length; i++) {
      s[i] = (int)char.GetNumericValue(nyu[i]);
    }
    // ここまで入力

    for (int i = 0; i < s.Length; i++) {
      if (s[i]!=0) {
        cnt0++;
      }
      i++;
      if (i < s.Length) {
        if (s[i]!=1) {
          cnt0++;
        }
      }
    }

    for (int i = 0; i < s.Length; i++) {
      if (s[i]!=1) {
        cnt1++;
      }
      i++;
      if (i < s.Length) {
        if (s[i]!=0) {
          cnt1++;
        }
      }
    }

    ans = Math.Min(cnt0, cnt1);

    // Console.WriteLine("cn0={0}, cnt1={1}", cnt0, cnt1);
    Console.WriteLine("{0}", ans);

    return 0;
  }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF = pow(10,11);

int main()
{
	ll A,B,Q;
  cin >> A >> B >> Q;
	vector<ll> s(A+2,INF),t(B+2,INF);
	s[0] = t[0] = -INF;
	s[A+1] = t[B+1] = INF;
	for (ll i(1);i<=A;++i){
		cin >> s[i];
	}
	for (ll i(1);i<=B;++i){
		cin >> t[i];
	}
	ll x;
	for (ll i(0);i<Q;++i){
		cin >> x;
		ll b = upper_bound(s.begin(),s.end(),x) - s.begin();
		ll d = upper_bound(t.begin(),t.end(),x) - t.begin();
		vector<ll> res(8);
		res[0] = abs(s[b-1]-x) + abs(s[b-1]-t[d-1]);
		res[1] = abs(t[d-1]-x) + abs(t[d-1]-s[b-1]);
		res[2] = abs(s[b-1]-x) + abs(s[b-1]-t[d]);
		res[3] = abs(t[d]-x) + abs(t[d]-s[b-1]);
		res[4] = abs(s[b]-x) + abs(s[b]-t[d-1]);
		res[5] = abs(t[d-1]-x) + abs(t[d-1]-s[b]);
		res[6] = abs(s[b]-x) + abs(s[b]-t[d]);
		res[7] = abs(t[d]-x) + abs(t[d]-s[b]);
		sort(res.begin(),res.end());
		cout << res[0] << endl;
	}
	return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <ctime>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=1000+10;
const int maxm=100000+10;
const int mod=(int)1e9+7;
const int INF=0x3f3f3f3f;
const ll LINF=(1LL<<62);
const double eps=1e-8;
const double PI=acos(-1.0);
#define mst(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for (int i=(a);i<b;i++)
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define lowbit(x) x&(-x)
#define X first
#define Y second
int a[maxn];
int main(){
#ifdef local
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif
    //ios::sync_with_stdio(false); cin.tie(0);
    int n; scanf("%d",&n);
    int ans=0;
    for (int i=0;i<n;i++) scanf("%d",&a[i]);
    bool flag=true;
    while (flag){
        for (int i=0;i<n;i++){
            if (a[i]%2==0){
                a[i]/=2;
            } else {
                flag=false;
                break;
            }
        }
        if (flag) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
freq=Array.new(6, 0)
n=gets.to_i

n.times {
  h=gets.to_f
  case
    when h<165
      freq[0]+=1
    when h<170
      freq[1]+=1
    when h<175
      freq[2]+=1
    when h<180
      freq[3]+=1
    when h<185
      freq[4]+=1
    else
      freq[5]+=1
  end
}

freq.each_index { |i|
  puts "#{i+1}:" << '*' * freq[i]
}

Measured memory_bytes: 6120
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>
#include <random>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

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

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

random_device seed_gen;
mt19937 engine(seed_gen());
// 0, 1, 2 のどれかが得られる一様分布
// uniform_int_distribution<> dist(0, 2);
// cout << dist(engine) << endl;
// みたいに、先に確率分布を宣言して、そこにengineを与えて使う。

// =========ここまでテンプレ============

int main()
{
    ll x;
    cin >> x;
    if (x >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  vector<int> b(n);
  vector<int> ans;
  for(int i = n; i >= 1; i--){
    b[i-1]=b[i-1]%2;
    if(b[i-1]!=a[i-1]){
      ans.push_back(i);
      for(int j = 1; j*j <= i; j++){
        if(i%j==0){
          if(i!=1) b[j-1]++;
          if(i/j!=i && i/j!=j) b[i/j-1]++;
        }
      }
    }
  }
  cout<<ans.size()<<endl;
  for(auto x : ans){
    cout<<x<<" ";
  }
  cout<<endl;
}


Measured memory_bytes: 5472
n = gets.chomp.to_i
d = n.times.map{gets.split.map(&:to_i)}

count=0
flag=0
for i in 0..n-1
  if(d[i][0]==d[i][1])
    count+=1
  else
    count=0
  end
  if count>=3
    flag=1
  end
end

if flag==1
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 14352
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);


    map<int,int> cnts;
    cnts[0] += 1;

    int n, m;
    cin >> n >> m;

    long long res = 0;
    long long sum = 0;
    for (int i = 0; i < n; ++i) {
        long long x;
        cin >> x;
        sum += x;
        res += cnts[sum % m];
        cnts[sum % m] += 1;
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int n,num;
  char suit;
  int s[13] = {1,2,3,4,5,6,7,8,9,10,11,12,13};
  int h[13] = {1,2,3,4,5,6,7,8,9,10,11,12,13};
  int c[13] = {1,2,3,4,5,6,7,8,9,10,11,12,13};
  int d[13] = {1,2,3,4,5,6,7,8,9,10,11,12,13};
  cin >> n;
  for(int i = 0; i < n;i++){
    cin >> suit >> num;
    if(suit == 'S'){
      s[num-1] = 0;
    }else if(suit == 'H'){
      h[num-1] = 0;
    }else if(suit == 'C'){
      c[num-1] = 0;
    }else{
      d[num-1] = 0;
    }
  }
  for(int i = 0;i < 13;i++){
    if (s[i] != 0) cout << "S " << s[i] << endl;
  }
  for(int i = 0;i < 13;i++){
    if (h[i] != 0) cout << "H " << h[i] << endl;
  }
  for(int i = 0;i < 13;i++){
    if (c[i] != 0) cout << "C " << c[i] << endl;
  }
  for(int i = 0;i < 13;i++){
    if (d[i] != 0) cout << "D " << d[i] << endl;
  }
  return 0;
}



Measured memory_bytes: 3048
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int sc[MAX_N];
int a[MAX_N];
int n;

int main()
{
	scanf("%d",&n);
	int sm = 0;
	rep(i,n){
		scanf("%d",&a[i]);
		sm += a[i];
	}
	sc[sm]++;
    rep(i,n){
		rep(j,10001){
			if(sc[j] > 0){
				sc[j-a[i]]++;
			}
		}
	}
	for(int i=10001;i>=0;i--){
		if(sc[i] > 0){
			if(i%10 != 0){
				cout << i << "\n";
				return 0;
			}
		}
	}
	printf("0\n");
	return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    bool turn = true;
    vector<int> v(N + 2, 0);
    v[0] = v[N + 1] = v[A] = v[B] = 1;
    REP (i, 0, N * 10) {
        if (turn) {
            if (v[A - 1] && v[A + 1]) {
                cout << "Borys" << endl;
                return 0;
            }
            if (v[A + 1] != 1) {
                v[A] = 0;
                v[A + 1] = 1;
                A++;
            } else {
                v[A] = 0;
                v[A - 1] = 1;
                A--;
            }
        } else {
            if (v[B - 1] && v[B + 1]) {
                cout << "Alice" << endl;
                return 0;
            }
            if (v[B - 1] != 1) {
                v[B] = 0;
                v[B - 1] = 1;
                B--;
            } else {
                v[B] = 0;
                v[B + 1] = 1;
                B++;
            }
        }
        turn = !turn;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>

using namespace std;

int a[100001], n;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	bool prev = false;
	int res = 0;
	for (int i = 1; i <= n; i++) {
		if (prev) {
			swap(a[i - 1], a[i]);
			res++;
			prev = false;
		}
		if (a[i] == i) prev = true;
	}
	res += prev;
	printf("%d\n", res);
	return 0;
}

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

int main()
{
  string s;
  cin >> s;
  
  vector<char> answer;
  for (int i = 0; i < s.size(); i ++)
  {
    if (s.at(i) == '?')
    {
      answer.push_back('D');
    }
    else
      answer.push_back(s.at(i));
  }
  
  for (int i = 0; i < answer.size(); i ++)
    cout << answer.at(i);
  
  return 0;
}


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

int main()
{
    int a,b;
    cin >> a >> b;
    
    if(a < 9 && b < 9){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
#define rep(i, m, n) for (int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for (int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
using Edge = pair<int, long long>;
using Graph = vector<vector<Edge>>;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef vector<vector<vector<ll>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
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;
}
// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// vector<long long> v(n), c(n);
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)
int gcd(int a, int b) {
    while (a != b) {
        if (a > b) {
            if (a % b == 0)
                return b;
            else
                a = a % b;
        }
        if (a < b) {
            if (b % a == 0)
                return a;
            else
                b = b % a;
        }
    }
    return a;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,0,n) cin >> a[i];
    int res = 1e9 + 1;
    rep(i,0,n) {
        if (i == 0) {
            res = a[0];
            continue;
        }
        res = gcd(res,a[i]);
    }
    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 3788
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<stack>
#include<cstring>
#include<cmath>
#include<queue>
using namespace std;
typedef long long ll;
double a[1111111];
double cmp(double a,double b)
{
	return a>b;
}
int main()
{

	//ios::sync_with_stdio(false);
	priority_queue<double> q;
	double n,m,x;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		scanf("%lf",&x);
		q.push(x);
	}
	for(int i=0;i<m;i++)
	{
		double y=q.top()/2.0;
		q.pop();
		q.push(y);
		
	}
	ll sum=0;
	for(int i=0;i<n;i++)
	{
		sum=sum+floor(q.top());
		q.pop();
	}
	cout<<sum<<endl;
	return 0;
}



Measured memory_bytes: 1400
#include <stdio.h>
#include <string.h>
#define rep(i, a) for(int i = 0; i < a; ++i)

int main(void) {
  char s[1500];
  int i, j = 0;
  while(scanf("%s", s) != EOF) {
    if(j) printf(" ");
    else j = 1;
    rep(i, strlen(s)) {
      if(s[i] >= 'a' && s[i] <= 'z') printf("%c", s[i] + 'A' - 'a');
      else if(s[i] >= 'A' && s[i] <= 'Z') printf("%c", s[i] + 'a' - 'A');
      else printf("%c", s[i]);
    }
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 2560
import java.util.*;

public class Main{

	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);

		char[] s=sc.next().toCharArray();
		int total=700;

		for(int i=0;i<3;i++){
			if(s[i]=='o'){
				total+=100;
			}
		}
		System.out.println(total);


	}
}


Measured memory_bytes: 21844
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int x,a,b;
  cin >> x >> a >> b;
  int A=x-a; int B=x-b;
  if(A<0) A=-A;
  if(B<0) B=-B;
  if(A>B) cout<< "B" << endl;
  else cout<< "A" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
const int N=600007;
int n,tot=1,head[N],ver[N],next[N],v1[N],v2[N],val[N];
int read(){int x;scanf("%d",&x);return x;}
void add(int u,int v){ver[++tot]=v,next[tot]=head[u],head[u]=tot,ver[++tot]=u,next[tot]=head[v],head[v]=tot;}
void work(int u,int v){if(u==v+n)val[v]=1;if(v==u+n)val[u]=-1;}
void dfs(int u){for(int&i=head[u],v;i;i=next[i])if(!v1[i])v1[i]=v1[i^1]=1,work(u,v=ver[i]),dfs(v);}
int main()
{
    n=read();
    for(int i=1,x;i<=n;++i) ~(x=read())? v1[x]^=1,v2[x]^=1,add(x,i):add(0,i);
    for(int i=1,x;i<=n;++i) ~(x=read())? v1[x]^=1,add(x+n,i+n):add(0,i+n);
    for(int i=1;i<=n;++i){if(v1[i])return puts("IMPOSSIBLE"),0;if(!v2[i])add(i,i+n);}
    puts("POSSIBLE"),dfs(1);
    for(int i=1;i<=n;++i) printf("%d%c",val[i]," \n"[i==n]);
}


Measured memory_bytes: 20864
#include <stdio.h>
 
int U[45];
 
int main(void) {
  int i, n;
  for (i = 0; i < 45; i++) {
    U[i] = -1;
  }
  scanf("%d", &n);
 
  printf("%d\n", fibonacch(n));
 
  return 0;
}

int fibonacch(int x) {
  if (U[x] != -1) {
    return U[x];
  }
  if (x == 0 || x == 1) {
    U[x] = 1;
    return U[x];
  } else {
    U[x] = fibonacch(x - 1) + fibonacch(x - 2);
    return U[x];
  }
}

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

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

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

  int ansMax = min(a, b);
  int ansMin = max(0, a + b - n);

  cout << ansMax << " " << ansMin << endl;

  return 0;
}

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

typedef long long ll;
using namespace std;

int main() {
  ll N, K;
  cin >> N >> K;

  ll r = N % K;
  ll s = K - r;

  if (r < s) {
    cout << r << endl;
  } else {
    cout << s << endl;
  }
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

bool graph[4][4];

int main(void){
	rep(i,3){
		int a,b;
		cin >> a >> b;
		graph[a-1][b-1] = graph[b-1][a-1] = true;
	}

	vector<int> ary(4);
	iota(begin(ary),end(ary),0);

	bool ok = false;
	do{
		bool cur = true;
		rep(i,3){
			if(graph[ary[i]][ary[i+1]] == false){
				cur = false;
			}
		} 
		ok |= cur;
	}while(next_permutation(begin(ary),end(ary)));

	puts(ok ? "YES":"NO");
	return 0;
}

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

typedef long long LL;

const int N=3000;

int mod;

int add(int a,int b,int p=mod){return a+b>=p?a+b-p:a+b;}
int sub(int a,int b,int p=mod){return a-b<0?a-b+p:a-b;}
int mul(int a,int b,int p=mod){return (LL)a*b%p;}
void sadd(int &a,int b,int p=mod){a=add(a,b,p);}
void ssub(int &a,int b,int p=mod){a=sub(a,b,p);}
void smul(int &a,int b,int p=mod){a=mul(a,b,p);}
int Power(int a,int k,int p=mod){int res=1;for (;k;k>>=1,smul(a,a,p)) if (k&1) smul(res,a,p);return res;}

int n;

void into(){
  scanf("%d%d",&n,&mod);
}

int pw2[N+9];

void Get_pw2(){
  pw2[0]=1;
  for (int i=1;i<=n;++i) pw2[i]=mul(pw2[i-1],2);
}

int inv[N+9],fac[N+9],ifac[N+9];

void Get_inv(){
  inv[1]=1;
  fac[0]=fac[1]=1;
  ifac[0]=ifac[1]=1;
  for (int i=2;i<=n;++i){
	inv[i]=mul(mod-mod/i,inv[mod%i]);
	fac[i]=mul(fac[i-1],i);
	ifac[i]=mul(ifac[i-1],inv[i]);
  }
}

int Get_c(int n,int m){return n<m||m<0?0:mul(fac[n],mul(ifac[m],ifac[n-m]));}

int sl[N+9][N+9];

void Get_sl(){
  sl[0][0]=1;
  for (int i=1;i<=n+1;++i)
	for (int j=1;j<=i;++j) sl[i][j]=add(sl[i-1][j-1],mul(j,sl[i-1][j]));
}

int ans;

void Get_ans(){
  for (int i=0;i<=n;++i){
	int cnt=0,pw=1;
	for (int j=0;j<=i;++j){
	  sadd(cnt,mul(sl[i+1][j+1],pw));
	  smul(pw,pw2[n-i]);
	}
	smul(cnt,mul(Get_c(n,i),Power(2,Power(2,n-i,mod-1))));
	i&1?ssub(ans,cnt):sadd(ans,cnt);
  }
}

void work(){
  Get_pw2();
  Get_inv();
  Get_sl();
  Get_ans();
}

void outo(){
  printf("%d\n",ans);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

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

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

  map<int,int> mp;
  for (int i = 0; i < n; i++)
  {
    int a;
    cin >> a;

    mp[a-1]++;
    mp[a]++;
    mp[a+1]++;
  }

  int ans = 0;
  for(auto p:mp){
    ans = max(ans,p.second);
  }

  cout << ans << endl;
}

Measured memory_bytes: 4736
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.swing.text.Segment;

public class Main {

	public static void main(String[] args) throws IOException {
		try (Scanner sc = new Scanner(System.in)) {
			final long R = sc.nextLong();
			final long G = sc.nextLong();
			
			final long diff = G - R;
			System.out.println(G + diff);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

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

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

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

int main()
{
  int a,b,c,d,e,f;
 cin >>a;
  cin >>b;
  cin >>c;
  cin >>d;
  e=(a+b);
  f=(c+d);
  
  if (e>f)
  {
    cout << "Left"<< endl;
  }
  if (f>e)
  {
    cout << "Right"<< endl;
  }
  if (e==f)
  {
    cout << "Balanced"<< endl;
  }
  return 0;
}

Measured memory_bytes: 3616