akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Dynamic;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int len = S.Length;
            string X = "";
            for(int i = 0; i < len; i++)
            {
                X += "x";
            }
            Console.WriteLine(X);
        }
    }
}


//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 25788
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int x;
    cin >> x;
    cout << 8 - (x - 400) / 200 << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
long long  mod = 1000000007;

int N, a[200010];
int main()
{
	int co[200010] = { 0 };
	int count = 0;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = N; i > 0; i--) {
		if (i > N / 2) {
			if (a[i] == 1) {
				count++;
				co[i]++;
			}
		}
		else {
			for (int j = i ; j <= N; j += i) {
				co[i] += co[j];
				co[i] %= 2;
			}
			if (co[i] % 2 != a[i]) {
				count++;
				co[i] = 1;
			}
			else {
				co[i] = 0;
			}
		}
	}
	printf("%d\n", count);
	for (int i = 1; i <= N; i++) {
		if (co[i] == 1) {
			printf("%d ", i);
		}
	}
	return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf (int)50000000000 //5･10^10
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
int fact(int n) {
  if(n==0) return 1;
  return fact(n-1)*n;
}
signed main() {
  int n,m,r,w=1,ans=inf;
  cin>>n>>m>>r;
  vector<int> R(r);
  int d[n][n];
  int N[fact(r)][r];
  rep(i,r) {
    int a;
    cin>>a;
    R[i]=a;
  }
  rep(i,n) rep(j,n) d[i][j]=inf;
  rep(i,n) d[i][i]=0;
  vsort(R);
  rep(i,m) {
    int a,b,c;
    cin>>a>>b>>c;
    d[a-1][b-1]=c;
    d[b-1][a-1]=c;
  }
  rep(k,n) {
    rep(i,n) {
      rep(j,n) {
        d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }
  rep(i,r) N[0][i]=R[i];
  while(next_permutation(all(R))) {
    rep(i,r) {
      N[w][i]=R[i];
    }
    w++;
  }
  rep(i,fact(r)) {
    int cnt=0;
    rep(j,r-1) {
      cnt+=d[N[i][j]-1][N[i][j+1]-1];
    }
    ans=min(ans,cnt);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3072
use std::fmt::Debug;
use std::str::FromStr;

#[allow(dead_code)]
#[allow(deprecated)]
fn read_line_from_stdin() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    buffer.trim_right().to_owned()
}

#[allow(dead_code)]
#[allow(deprecated)]
fn parse_line_to_single<T>() -> T
where
    T: FromStr,
    T::Err: Debug,
{
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    T::from_str(buffer.trim_right()).unwrap()
}

#[allow(dead_code)]
#[allow(deprecated)]
fn parse_line_to_multiple<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    buffer
        .trim_right()
        .split_whitespace()
        .flat_map(|s| T::from_str(s))
        .collect()
}

#[allow(unused_macros)]
macro_rules! parse_line {
    [$( $x:tt : $t:ty ),+] => {
        //declare variables
        $( let $x: $t; )+
        {
            use std::str::FromStr;
            // read
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            #[allow(deprecated)]
            let mut splits = buf.trim_right().split_whitespace();
            // assign each variable
            $(
                $x = splits.next().and_then(|s| <$t>::from_str(s).ok()).unwrap();
            )+
            // all strs should be used for assignment
            assert!(splits.next().is_none());
        }
    };
}

fn main() {
    parse_line![a: i32, b: i32, c: i32, k: i32];

    let max = if k < a {
        k
    } else if k < a + b {
        a
    } else if k < a + b + c {
        a - (k - (a + b))
    } else {
        a - c
    };

    println!("{}", max);
}


Measured memory_bytes: 2112
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    string s;
    string p;
    cin>>s;
    cin>>p;
    s+=s;
    int loc=s.find(p,0);
    if(loc!=string::npos)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

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

using namespace std;
const int N = 1e5 + 3 , OO = 0x3f3f3f3f ;
int arr[N] , mem[N];
int n  , k;
int solve(int idx){
    if(idx == n-1) return 0;
    int &ret = mem[idx];
    if(~ret) return ret;
    ret = OO;
    for(int i = 1 ; i<=k ;++i){
        if(idx + i <= n-1)
            ret = min(ret , abs(arr[idx] - arr[idx + i]) + solve( idx + i));
    }
    return ret;
}
int main()
{
    cin >> n >> k;
    for(int i = 0 ; i < n ; ++i) cin >> arr[i];
    memset(mem , -1 , sizeof mem);
    cout << solve(0);
    return 0;
}


Measured memory_bytes: 5760
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int> a(N); rep(i, 0, N) {
		cin >> a[i];
	}
	int cnt2 = 0, cnt4 = 0;
	rep(i, 0, N) {
		if (a[i] % 4 == 0)cnt4++;
		else if (a[i] % 2 == 0)cnt2++;
	}
	if (cnt2 != 0)
		N -= cnt2 - 1;
	bool ng = false;
	dump(N, cnt4);
	if (N / 2 <= cnt4) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back
const ll mod = 1000000007;
// const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

int main() {
	string S; cin >> S;
	int N = S.size();

	vi ans(N, 0);
	int r = 0;
	int rid = 0;
	int l = 0;
	int lid = 0;

	bool isR = true;

	for (int i = 0; i < N; i++) {
		if (isR) {
			if (S[i] == 'R') {
				r++;
				rid = i;
			}
			else {
				lid = i;
				l = 1;
				ans[rid] += r / 2;
				ans[lid] += r / 2;
				if (r % 2 == 1) {
					ans[rid] += 1;
				}
				r = 0;
				isR = false;
			}
		}
		else {
			if (S[i] == 'L') {
				l++;
			}
			else {
				r = 1;
				ans[rid] += l / 2;
				ans[lid] += l / 2;
				if (l % 2 == 1) {
					ans[lid] += 1;
				}
				l = 0;
				rid = i;
				isR = true;
			}
		}
	}

	ans[rid] += l / 2;
	ans[lid] += l / 2;
	if (l % 2 == 1) {
		ans[lid] += 1;
	}

	for (auto a : ans) {
		cout << a << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int N;
    int K;
    char *S;

    scanf("%d",&N);
    scanf("%d%d",&K);

    S=(char *)malloc(sizeof(char)*N+1);
    scanf("%s",S);

    S[K-1]+=32;
    printf("%s",S);

    free(S);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MAXN = 100 * 1000 + 7;
bool can[MAXN];
int cnt[MAXN];
int main()
{
   // freopen("input.txt", "r", stdin);
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; i++)
    {
        can[i] = false;
        cnt[i] = 1;
    }
    can[1] = true;
    for (int i = 1; i <= m; i++)
    {
        int x, y;
        scanf("%d %d", &x ,&y);
        if (can[x])
        {
            can[y] = true;
        }
        cnt[y]++;
        cnt[x]--;
        if (cnt[x] == 0)
        {
            can[x] = false;
        }
    }
    int res = 0;
    for (int i = 1; i <= n; i++)
    {
        if (can[i]) res++;
    }
    printf("%d\n", res);
}


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

#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define clr(arr, key) memset(arr, key, sizeof arr)
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define infinity (1 << 28)
#define LL long long
#define PI acos(-1)
#define gcd(a, b) __gcd(a, b)
#define CF ios_base::sync_with_stdio(0);cin.tie(0);
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define all(v) v.begin(), v.end()
#define no_of_ones __builtin_popcount // __builtin_popcountll for LL
#define SZ(v) (int)(v.size())
#define eps 1e-7

//int col[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//int row[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int col[4] = {1, 0, -1, 0};
//int row[4] = {0, 1, 0, -1};
//int months[13] = {0, ,31,28,31,30,31,30,31,31,30,31,30,31};

using namespace std;

struct point{int x, y; point () {} point(int a, int b) {x = a, y = b;}};
template <class T> T sqr(T a){return a * a;}
template <class T> T power(T n, T p) { T res = 1; for(int i = 0; i < p; i++) res *= n; return res;}
template <class T> double getdist(T a, T b){return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));}    // distance between a and b
template <class T> T extract(string s, T ret) {stringstream ss(s); ss >> ret; return ret;}
template <class T> string tostring(T n) {stringstream ss; ss << n; return ss.str();}
//LL bigmod(LL B,LL P,LL M){LL R=1; while(P>0)  {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
struct fast{fast(){ios_base::sync_with_stdio(0);cin.tie(0);}}cincout;

#define MAX 200010
/***********************************THE GRASS IS ALWAYS GREENER ON THE OTHER SIDE***********************************/

vector <int> adj[MAX], elements;
int seenAt[MAX], cycleStart, cycleLength;

void dfs(int u, int d){
    if(seenAt[u]){
        cycleStart = u;
        cycleLength = d-seenAt[u];
        return;
    }
    seenAt[u] = d;
    elements.pb(u);
    for(auto v: adj[u])
        dfs(v, d+1);
}

int main()
{
    // in;
    LL n, k, x;
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
        cin >> x;
        adj[i].pb(x);
    }
    dfs(1, 1);
    if(k < SZ(elements)){
        cout << elements[k] << "\n";
        return 0;
    }
    k -= SZ(elements) - cycleLength;
    k %= cycleLength;
    cout << elements[SZ(elements) - cycleLength+k];
    return 0;
}


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

string s;
int last[26], dp[200005], nxt[200005];
char memo[200005];
int main()
{
    cin>>s;
    for(int i=0; i<26; i++)last[i] = (int)s.size()+1;
    s='#' + s;

    for(int i=(int)s.size()-1; i>=0; i--){
        int ch = s[i]-'a';
        dp[i] = 1e9;

        for(int j=0; j<26; j++){


            if(dp[i] > dp[last[j]]+1){
                dp[i] = dp[last[j]] +1;
                nxt[i] = last[j];
                memo[i] = (char)('a'+j);
            }
        }
        if(i!=0)
        last[ch] = i;
    }

    string ans;
    for(int i=0; ; i=nxt[i]){
        if(dp[i]==0)break;
        ans.push_back(memo[i]);
    }

    cout<<ans;

}


Measured memory_bytes: 2368
import math
N = int(input())

def frac(a):
	Q = math.ceil(a / -2)
	if a % 2 == 0:
		R = 0
	else:
		R = 1
	return Q, R

if N != 0:
	ans = []
	while N != 1:
		N, R = frac(N)
		ans.insert(0, R)
	ans = map(str, [1] + ans)
	print(''.join(ans))
else:
	print(0)


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

int main() {
	int N;
	cin >> N;
	vector<ll> H(N);
	for (int i = 0;i < N;i++)
		cin >> H[i];
	int nit, xit;
	ll ans = 0, cnt;
	for (int i = 1;i < N - 1;i++) {
		nit = cnt = 0;
		xit = N - 1;
		while (nit != xit && nit < N - 1 && xit > i) {
			cnt += H[nit] + H[xit];
			ans = max(ans, cnt);
			nit += i;
			if (nit == xit) break;
			xit -= i;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  int a,b,c,x,y; cin>>a>>b>>c>>x>>y;
  int sum=0;
  if(c*2>a+b){
    sum=a*x+b*y;
  }else{
    if(x>y){
      sum+=y*c*2;
      if((x-y)*a<(x-y)*c*2){
        sum+=(x-y)*a;
      }else{
        sum+=(x-y)*c*2;
      }
    }else{
      sum+=x*c*2;
      if((y-x)*b<(y-x)*c*2){
        sum+=(y-x)*b;
      }else{
        sum+=(y-x)*c*2;
      }
    }
  }
  cout<<sum<<endl;


  return 0;

}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

var MAX int

func main() {
	log.SetFlags(log.Lshortfile)
	sc := newScanner()
	var H, W, ans int
	H = sc.nextInt()
	W = sc.nextInt()
	if H%3 == 0 || W%3 == 0 {
		fmt.Println("0")
		return
	}
	MAX = H * W
	ans = H * W
	for i := 1; i < H; i++ {
		ans = min(ans, sizeW(i, H, W))
	}
	for i := 1; i < W; i++ {
		ans = min(ans, sizeW(i, W, H))
	}
	fmt.Println(ans)
	// log.Println(sizeW(1))
}

// W固定のサイズ
func sizeW(x, H, W int) int {
	var a, b int
	h := H - x
	c1 := W * x
	c2 := W / 2 * h
	c3 := (W/2 + W%2) * h
	if c1 == 0 || c2 == 0 || c3 == 0 {
		a = MAX
	} else {
		maxChoco := max(c1, max(c2, c3))
		minChoco := min(c1, min(c2, c3))
		a = maxChoco - minChoco
	}
	h, W = W, h
	c2 = W / 2 * h
	c3 = (W/2 + W%2) * h
	if c1 == 0 || c2 == 0 || c3 == 0 {
		b = MAX
	} else {
		maxChoco := max(c1, max(c2, c3))
		minChoco := min(c1, min(c2, c3))
		b = maxChoco - minChoco
	}
	return min(a, b)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}

func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int main() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    vector<int> Nums;
    int now = 1; 
    int cnt = 0; 
    for (int i = 0; i < N; i++){
	if (S[i] == (char)('0' + now))
	    cnt++;
	else {
	    Nums.push_back(cnt);
	    now ^= 1; 
	    cnt = 1; 
	}
    }
    if (cnt != 0) Nums.push_back(cnt);

    if (Nums.size() % 2 == 0) Nums.push_back(0);

    int Add = 2 * K + 1;

    vector<int> sum(Nums.size() + 1);
    for (int i = 0; i < Nums.size(); i++){
	sum[i + 1] = sum[i] + Nums[i];
    }


    int ans = 0;
    int left, right, tmp;
    for (int i = 0; i < Nums.size(); i += 2){
	left = i;
	right = min(i + Add, (int)Nums.size());
	tmp = sum[right] - sum[left];
	ans = max(tmp, ans);
    }


    // for (int i = 0; i < Nums.size(); i ++){
    // 	cout << Nums[i] << " ";
    // }
    // cout << endl;    
    // for (int i = 0; i < Nums.size(); i ++){
    // 	cout << sum[i] << " ";
    // }
    // cout << endl;


    cout << ans << endl;
}



Measured memory_bytes: 1272
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a) for(ll i=ll(a-1);i>=0;--i)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e10;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<double,double> point;
typedef complex<double> Point;
const ll MAX = 30000;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    cins(all(a));
    RSORT(a);
    ll ans = a[0];
    rep(i,(n-2)/2){
        ans += a[i+1]*2;
    }
    if ((n-2)%2){
        ans += a[(n-2)/2+1];
    }
    PRINT(ans);
}



Measured memory_bytes: 4772
#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#include<math.h>
using namespace std;

int  main()
{   
    int n; 
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    sort(s.begin(), s.end());
    int ans = 1;
    for (int i = 1; i < n; i++) {
        if (s[i] != s[i - 1]) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9596
#include <bits/stdc++.h>
using namespace std;
#define ll	        long long
#define all(v)      (v).begin() , (v).end()
#define vi          vector <ll>
#define vii         vector <pair<ll,ll>>
#define ii          pair<int,int>
#define lp(i,a,b)	for(int i=a;i<b;i++)
#define pb          push_back
#define F           first
#define S           second
const ll mod=1e9+7,MAX=2e5+7;
void fast();
int main()
{
    fast();
    ll res=0;
    int k;
    cin>>k;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int q=1;q<=k;q++)
                res+=__gcd(i,__gcd(j,q));
        }
    }
    cout<<res;
}

void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*

*/


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define int long long
#define INT_MAX INT64_MAX
#define INT_MIN INT64_MIN
#define PI 3.14159265358979323846
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define MOD 1000000007
/* DEFINE cout */
#define pln cout << "===============================\n"
#define on cout<<"\n"
#define os cout<<" "
#define o2(a,b) cout<<a<<" "<<b
#define o(a) cout << a
#define bitcount __builtin_popcount
/* DEFINE cout */
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);//fastio
using namespace std;
struct hash_pair { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
bool prime[10000001];
int P=MOD-2;
int factorial[10000001]={0};
int powerFunction(int x,int y){
    int res = 1;
    int p = MOD;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}
void factorialFunction(int maxLimit){
    factorial[0]=1;
    for(int i=1 ; i <= maxLimit ; i++)
        factorial[i]=(factorial[i-1]*i)%MOD;
    return;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
signed main(){
    int x, y;
    cin >> x >> y;
    bool fg = false;
    for(int i=0; x>=i; i++){
        if(4*i + (2*(x-i)) == y){
            fg = true;
            break;
        }
    }
    if(fg){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}






Measured memory_bytes: 3624
n = int(input())
a = list(map(int, input().split()))

from fractions import gcd

l = [(hoge.append(gcd(hoge[i - 1], a[i])),hoge)[1] for hoge in [[a[0]]]for i in range(1, n)][0]


# l = [a[0]]
# for i in range(1, n):
#     l.append(gcd(l[i - 1], a[i]))
r = [a[n - 1]]
for i in range(1, n):
    r.append(gcd(r[i - 1], a[n - 1 - i]))
r.reverse()
from functools import reduce

print (reduce(lambda x,y:max(x,y),[gcd(l[i-1]if 0<i else r[i+1],r[i+1] if i<n-1 else l[i-1])for i in range(n)]))

Measured memory_bytes: 14584
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,n,j,k;
    cin>>n;string s;
    cin>>s;int ans=0;
    for(i=0;i<n;i++)
    {
        int cnt=0;
        for(char c='a';c<='z';c++)
        {   bool left=false,right=false;
            for(j=0;j<=i;j++)
            {
                if(s[j]==c){left=true;break;}
            }

            for(j=i+1;j<=n;j++)
            {
                if(s[j]==c){right=true;break;}
            }
            if(right&&left)cnt++;
        }
        if(ans<cnt)ans=cnt;
    }
    cout<<ans;
}


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

int count(vector<vector<char>> c,int H,int W){
  int i,j,cou=0;
  for(i=0;i<H;i++){
    for(j=0;j<W;j++){
      if(c[i][j]=='#')cou++;
    }
  }
  return cou;
}

int main() {
  int H,W,K;
  cin>>H>>W>>K;
  int i,j,ans=0;
  vector<vector<char>> c(H,vector<char>(W));
  for(i=0;i<H;i++)for(j=0;j<W;j++)cin>>c[i][j];
  
  for(i=0;i<(1<<H);i++){
    bitset<6> a(i);
    vector<vector<char>> C(H,vector<char>(W));
    for(int n=0;n<H;n++){
      if(a.test(n))for(j=0;j<W;j++)C[n][j]='o';
      else if(!a.test(n))for(j=0;j<W;j++)C[n][j]=c[n][j];
    }
    for(int I=0;I<(1<<W);I++){
      bitset<6> b(I);
      vector<vector<char>> d(H,vector<char>(W));
      for(int m=0;m<W;m++){
        if(b.test(m))for(j=0;j<H;j++)d[j][m]='o';
        else if(!(b.test(m)))for(int J=0;J<H;J++)d[J][m]=C[J][m];
      }
        if(count(d,H,W)==K)ans++;
    }
  }
  cout<<ans<<endl;
}


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

int main() {
	int n,w;
	cin>>n>>w;
	long* weight = new long[n];
	long* cost = new long[n];
	for(int i=0;i<n;i++){
	    cin>>weight[i]>>cost[i];
	}
	long** dp = new long*[n+1];
	for(int i=0;i<=n;i++){
	    dp[i] = new long[w+1];
	}
	for(int i=0;i<=n;i++){
	    dp[i][0]=0;
	}
	for(int i=0;i<=w;i++){
	    dp[0][i]=0;
	}
	for(int i=1;i<=n;i++){
	    for(int j=1;j<=w;j++){
	        dp[i][j] = dp[i-1][j];
	        if(j-weight[i-1]>=0){
	            dp[i][j] = max(dp[i][j],cost[i-1]+dp[i-1][j-weight[i-1]]);
	        }
	    }
	}
	cout<<dp[n][w]<<'\n';

}


Measured memory_bytes: 79488
#include<stdio.h>
int main(){
  char s[201];
  int i,j,n,t;
  scanf("%s",s);
  for(n=0;s[n];n++);
  for(i=n/2-1;i>0;i--){t=0;for(j=0;j<i;j++)t+=s[j]==s[i+j];if(i==t){printf("%d",i*2);return 0;}}
}


Measured memory_bytes: 128
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 4e6 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif

const int M = 2005 ;
// l = 0 , r = 1 , u = 2 , d = 3 , no = 4;
int dx[] = {0 , 0 , -1 , 1};
int dy[] = {-1, 1 , 0 , 0};
int ad[5][M][M];
int g[M][M] ;

int ok(int i , int j , int n , int m){
	bool ans1 = (i >= 0 && i < n);
	bool ans2 = (j >= 0 && j < m);
	return ans1 && ans2 ;
}

int sqsum(int k , int lx , int ly , int rx , int ry){
	int res = ad[k][rx][ry]; 
	if(lx) res -= ad[k][lx-1][ry];
	if(ly) res -= ad[k][rx][ly - 1];
	if(lx && ly) res += ad[k][lx-1][ly-1];
	return res ;
}
void solve()
{
	int n , m , q ;
	cin >> n >> m >> q;
	string s[n] ;
	rep(i , n){
		cin >> s[i] ;
		rep(j , m)
			g[i][j] = s[i][j] - '0';
	}
	rep(i , n) rep(j , m){
		if(g[i][j]){
			rep(k , 4) ad[k][i][j] = (ok(i + dx[k] , j + dy[k] , n , m) && g[i + dx[k]][j + dy[k]]);
		}
		ad[4][i][j] = g[i][j];
	}
	rep(k , 5){
		rep(i , n) rep(j , m){
			if(i) ad[k][i][j] += ad[k][i-1][j] ;
			if(j) ad[k][i][j] += ad[k][i][j-1] ;
			if(i && j) ad[k][i][j] -= ad[k][i-1][j-1];
		}
	}
	while(q--){
		int lx, ly, rx, ry;
		cin >> lx >> ly >> rx >> ry; 
		lx--, ly--, rx--, ry-- ;
		int edges = 0;
		rep(k , 4) edges += sqsum(k , lx , ly , rx , ry); 
		edges -= sqsum(0 , lx , ly , rx, ly);
		edges -= sqsum(1 , lx, ry, rx, ry);
		edges -= sqsum(2 , lx , ly , lx, ry);
		edges -= sqsum(3 , rx, ly, rx, ry);
		int nodes = sqsum(4, lx, ly, rx, ry);
		// cout << nodes << " " << edges/2 << "\n" ;
		cout << nodes - edges/2 << "\n" ;
	}

}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

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

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        static void SolveA(string[] args)
        {
            int n = ReadAndParseInt();
            int total = 0;
            for(int i=1;i<=n;i+=2)
            {
                if( IsValid(i))
                {
                    total++;
                }
            }

            Console.WriteLine(total);
        }
        private static bool IsValid(int n)
        {
            int total = 0;
            for(int i=1;i<=n;++i)
            {
                if(n%i==0)
                {
                    total++;
                }
            }
            return total == 8;
        }
    }
}


Measured memory_bytes: 11092
fun main(args: Array<String>) {

    val n = readLine()!!.toInt()

    call(n)    
}

fun call(n: Int)
{
    for (i in 1..n) {
        var x = i
        if (x % 3 == 0) {
            print(" ${i}")
            continue
        }
        while (x != 0) {
            if (x % 10 == 3) {
                print(" ${i}")
                break
            }
            x /= 10
        }
    }
    println("")
}



Measured memory_bytes: 31008
#include <iostream>

using namespace std;

int main(){
    int N;
    int K;
    cin >> N >> K;
    int ans = 1;
    for(int i = 0; i < N; i++){
        if(ans <= K){
            ans = ans * 2;
        }else{
            ans = ans + K;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

/* 一つ読み */
func scanText() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat() float64 {
	sc.Scan()
	a, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		fmt.Println(err)
	}
	return a
}

/* 複数読み */
func scanTextSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = scanText()
	}
	return a
}
func scanSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}
func scanFloatSlice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = scanFloat()
	}
	return a
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	a := scanSlice(2)
	if a[0]*a[1]%2 == 0 {
		fmt.Println("Even")
	} else {
		fmt.Println("Odd")
	}

}


Measured memory_bytes: 1772
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N;
    int a[110];  // 最大 100 個ですが余裕をもたせます
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];

    sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート
    int Alice = 0;
    int Bob = 0;
    for (int i = 0; i < N; ++i) {
        if (i % 2 == 0) { // Alice のターン
            Alice += a[i];
        }
        else { // Bob のターン
            Bob += a[i];
        }
    }
    cout << Alice - Bob << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

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

        int a = scan.nextInt();
        int b = scan.nextInt();
        int N = scan.nextInt();
        int n = 0;
        int k = 0;

        for (int i = 0; i < N; i++) {

            int f = scan.nextInt();
            int s = scan.nextInt();

            if (a >= s || b <= f) {

                n++;
            } else {
                k++;
            }
        }    
    if(k > 0){
        System.out.println("1");
    } else{
        System.out.println("0");
    }
}
}


Measured memory_bytes: 26504
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> pippi;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<61;
int iinf=1<<30;
double pi=3.14159265358979323846;
double pi2=pi/2.0;
double eps=1e-8;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
//#define endl "\n"
int dh[4]={1,0,-1,0};
int dw[4]={0,1,0,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<int,int,custom_hash>
ll gcd(ll a,ll b){
    if(a<0)a=-a;
    if(b<0)b=-b;
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    if(k<0)return 0;
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int x;cin>>x;
    x-=400;
    x/=200;
    x=8-x;
    cout<<x<<endl;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] ss = {"Sunny","Cloudy","Rainy"};
        int i =0;
        for(; i<ss.length; i++) {
            if(s.equals(ss[i])) break;
        }
        if(i >= 2) System.out.println(ss[0]);
        else System.out.println(ss[i+1]);
    }
}


Measured memory_bytes: 35344
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int main()
{
    int n, k;
    cin >> n >> k;
    vector<long long> dp(N + 1, INT_MAX);
    dp[0] = 0;
    for (int i = 0; i < n; ++i)
    {
        int w, v;
        cin >> w >> v;
        for (int j = N; j >= v; --j)
            if (dp[j - v] != INT_MAX)
                dp[j] = min(dp[j], dp[j - v] + w);
    }
    for (int j = N; j >= 0; --j)
        if (dp[j] <= k)
        {
            cout << j;
            break;
        }
}

Measured memory_bytes: 4056
#include <stdio.h>
#include <string.h>
int main(){
  int ca=0,cb=0,cc=0,cd=0,ce=0,cf=0,cg=0,ch=0,ci=0,cj=0,ck=0,cl=0,cm=0,cn=0,co=0,cp=0,cq=0,cr=0,cs=0,ct=0,cu=0,cv=0,cw=0,cx=0,cy=0,cz=0;
  char a;
  bool flag=0;
  char moji[101];
  scanf("%s",&moji);
  int b=strlen(moji);
  for(int i=0;i<b;i++){
    a=moji[i];
    if(a=='a') ca++; if(a=='b') cb++; if(a=='c') cc++;
    if(a=='d') cd++; if(a=='e') ce++; if(a=='f') cf++;
    if(a=='g') cg++; if(a=='h') ch++; if(a=='i') ci++;
    if(a=='j') cj++; if(a=='k') ck++; if(a=='l') cl++;
    if(a=='m') cm++; if(a=='n') cn++; if(a=='o') co++;
    if(a=='p') cp++; if(a=='q') cq++; if(a=='r') cr++;
    if(a=='s') cs++; if(a=='t') ct++; if(a=='u') cu++;
    if(a=='v') cv++; if(a=='w') cw++; if(a=='x') cx++;
    if(a=='y') cy++; if(a=='z') cz++;
  }
  if(ca%2!=0||cb%2!=0||cc%2!=0||cd%2!=0||ce%2!=0||cf%2!=0||cg%2!=0) flag=1;
  if(ch%2!=0||ci%2!=0||cj%2!=0||ck%2!=0||cl%2!=0||cm%2!=0||cn%2!=0) flag=1;
  if(co%2!=0||cp%2!=0||cq%2!=0||cr%2!=0||cs%2!=0||ct%2!=0||cu%2!=0) flag=1;
  if(cv%2!=0||cw%2!=0||cx%2!=0||cy%2!=0||cz%2!=0) flag=1;
  
  if(flag==1) printf("No\n");
  else printf("Yes\n");
}

Measured memory_bytes: 128
# 今、日本は 11 月 18 日ですが、11 と 18 は隣り合うリュカ数です。
# 整数 N が与えられるので、N 番目のリュカ数を求めてください。
# ただし、リュカ数は i 番目のリュカ数を Li とすると、
# L0=2
# L1=1
# Li=Li−1+Li−2(i≧2)
# と定義される数とします。

n = gets.to_i

l = [2, 1]

(n - 1).times do |i|
  l << (l[i] + l[i+1])
end

puts l.last


Measured memory_bytes: 1788
import sys; readline = sys.stdin.readline
from collections import deque


N = int(readline())


if N % 2 == 1:
    print(0)
    exit(0)

def count(d, n):
    c = 0
    a = n
    while True:
        a = a // d
        if a == 0:
            break
        c += a
    return c

print(min(count(2,N), count(5, N // 2)))

Measured memory_bytes: 38384
from math import sqrt
itl = lambda: list(map(float, input().strip().split()))


def median(N, C):
    if N % 2:
        return C[N // 2]
    else:
        return C[N // 2 - 1] + C[N // 2]


def solve():
    N = int(input())

    A = []
    B = []
    for _ in range(N):
        a, b = itl()
        A.append(int(a))
        B.append(int(b))
    A.sort()
    B.sort()

    ma = median(N, A)
    mb = median(N, B)
    return mb - ma + 1


if __name__ == '__main__':
    print(solve())

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

int main() {
    priority_queue<int> q;
    int n,m,a;
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        q.push(a);
    }
    for(int i=0;i<m;i++){
       a=q.top();
       q.pop();
       q.push(a/2);
    }
    long long ans=0;
    for(int i=0;i<n;i++){
        ans+=q.top();
        q.pop();
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 892
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int ele, n, k, q;
    cin >>n >>k >>q;
    vector<int> arr(n, k - q);
    while(q--){
        cin >>ele;
        arr[ele-1]++;
    }
    for(auto x : arr)
        if(x > 0)
            cout <<"Yes\n";
        else 
            cout <<"No\n";
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();

		for (int i=0; i<K; i++) {
			//高橋フェイズ
			if (i%2==0) {
				if (A%2 != 0) {
					A--;
				}
				B=B+(A/2);
				A=A/2;
			} else { //青木フェイズ
				if (B%2 != 0) {
					B--;
				}
				A=A+(B/2);
				B=B/2;
			}
		}

		System.out.println(A + " " + B);
	}
}

Measured memory_bytes: 25172
#include<stdio.h>
int main(){
  int N,a1,a2,i;
  double b;
  scanf("%d",&N);
  a1=0;
  for(i=1;i<=N;++i){
    if(i%2==1){
      a2=a1+1;
      a1=a2;
    }
  }
  b=(double)a1/N;
  printf("%f\n",b);
}


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

int main() {
    int K, A, B;
    cin >> K >> A >> B;
    bool exist = false;
    for (int i = A; i <= B; ++i) {
        if (i % K == 0) exist = true;
    }
    if (exist) cout << "OK" << endl;
    else cout << "NG" << endl;
}

Measured memory_bytes: 3580
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    if(a + b == 15)
        cout << '+' << endl;
    else if(a * b == 15)
        cout << '*' << endl;
    else
        cout << 'x' << endl;

    return 0;
}


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

string s;

int rec(string t,char base)
{
    //check
    bool all = true;
    for(int i = 0;i < t.size();i++) if(t[i] != base) all = false;
    if(all) return 0;
    string next = "";
    for(int i = 1;i < t.size();i++)
    {
        if(t[i - 1] == base || t[i] == base) next.push_back(base);
        else next.push_back(t[i - 1]);
    }
    return rec(next,base) + 1;
}

int main()
{
    cin >> s;
    int result = 10000;
    for(char c : s)
    {
        result = min(result , rec(s,c));
    }    

    cout << result << endl;
}

Measured memory_bytes: 256
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define EPS (1e-7)
#define IINF ((int)1e9)


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

	ll n;
	cin >> n;
	ll res = 0;
	for (ll k = 1; k <= n; k++)
	{
		res += ((n / k) * (n / k + 1) * k) / 2;
	}
	cout << res << "\n";
	return 0;
}

int main0()  // original answer
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	ll res = 1;  // for k=1
	for (int k = 2; k <= n; k++)
	{
		res += 2 * (ll)k;  // for two divisors of 1 and k
	}
	for (int k = 2; k * 2 <= n; k++)
	{
		for (int j = k * 2; j <= n; j += k)
		{
			res += j;  // for the divisors other than 1 and k
		}
	}
	cout << res << "\n";
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
long long cnr(long long int n,long long int r)
{
    long long ans = 1;
    r = std::min(r, n - r);

    for(long long int j = 1; j <= r; j++, n--) {
        if (n % j == 0) {
            ans *= n / j;
        } else if (ans % j == 0) {
            ans = (ans / j) * n;
        } else {
            ans = (ans * n) / j;
        }
    }
    return ans;
}
int main()
{
    long long n,a1,b,i,have,sum=0,a[100],val,c=0;
    scanf("%lld %lld %lld",&n,&a1,&b);
    //printf("fs");
    map<long long int,int> h;
    for(i=0;i<n;i++)
    scanf("%lld",&a[i]),h[a[i]]+=1;
    //printf("fs");

    sort(a,a+n);
    if(a[0]==a[n-1])
    {
        printf("%Lf\n",(long double)a[0]);
        long long tot=0;
        for(i=a1;i<=b;i++)
        {
            tot+=cnr(n,i);
        }
        printf("%lld",tot);
        return 0;
    }
    i=n-1;
    long long int c1=0;
    while(i>=0 && a[i]==a[n-1])
    c1++,i--;
    if(c1>=a1)
    {
        printf("%Lf\n",(long double)a[n-1]);
        long long tot=0;
        for(i=a1;i<=min(c1,b);i++)
        {
            tot+=cnr(h[a[n-1]],i);
        }
        printf("%lld",tot);
        return 0;
    }
    for(i=n-1;i>=n-a1;i--)
    sum+=a[i];
    val=a[n-a1];
    printf("%Lf\n",(long double)sum/a1);
    for(i=n-a1;i<n;i++)
    {
        if(a[i]==val)
        c++;
    }

    //printf("%lld %lld\n",c,h[val]);
    printf("%lld",cnr(h[val],c));
}


Measured memory_bytes: 256
#include <bits/stdc++.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};

// Problem Specific Parameter:

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

	ll upper = 1LL * (n-1) * b + a;
	ll lower = 1LL * (n-1) * a + b;
	
	cout << max(0LL,upper - lower + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <limits>
#include <utility>
#include <algorithm>

int main(int argc, char *argv[])
{
    int n;
    std::vector<std::string> s;

    std::cin >> n;
    s.reserve(n);

    for (int i = 0; i < n; i++) {
        std::string st;
        std::cin >> st;
        s.push_back(st);
    }

    sort(s.begin(), s.end());
    const auto it = std::unique(s.begin(), s.end());
    s.erase(it, s.end());

    std::cout << s.size() << std::endl;

    return 0;
}


Measured memory_bytes: 9608
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	int cnt = 0;
	rep(i,n) {
		int a; cin >> a;
		if(i % 2 == 0 and a % 2 == 1) {
			++cnt;
		}
	}
	cout << cnt << '\n';
	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define INF 1e9
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
bool vis[55];
vector<pi > g[55]; 
int dfs(int i,int j){
	vis[i]=true;
	rep(k,g[i].size()){
		if(!vis[g[i][k].fi]&&g[i][k].se!=j){
			dfs(g[i][k].fi,j);
		}
	}
	return 0;
}
int main(){
	int n,m;
	cin>>n>>m;
	rep(i,m){
		int l,r;
		cin>>l>>r;
		l--;
		r--;
		g[l].pb(mp(r,i));
		g[r].pb(mp(l,i));
	}
	int ans=0;
	rep(i,m){
		fill(vis,false);
		dfs(0,i);
		bool f=true;
		rep(j,n){
			if(!vis[j]){
				f=false;
			}
		}
		if(!f){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256