akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(){
  int ans=0;
  string n;
  cin>>n;
    for(int i=0;i<6;i++){
      if(n[i]=='1'){
        ans+=1;
      }
      else{
        ans+=0;
      }
    }
    cout<<ans<<endl;
}

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

class Main{
	public static void main(String[] args){
		solve();
	}
	public static void solve(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		for(int i=0;i<n;i++){
			p[i] = sc.nextInt();
		}

		int count = 0;
		for(int i=0;i<n;i++){
			if(i==n-1 && p[i] == (i+1)){
				int x = p[i];
				p[i] = p[i-1];
				p[i-1] = x;
				count++;
			}
			else if(p[i] == (i+1)){
				int x = p[i];
				p[i] = p[i+1];
				p[i+1] = x;
				count++; 
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 50424
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n],b[n];
  map<int,int> mp;
  rep(i,n){
    cin>>a[i];
    b[i]=a[i]-i;
    mp[b[i]]++;
  }
  int ans=0;
  rep(i,n){
    mp[b[i]]--;
    int target=a[i]+i;
    target*=(-1);
    ans+=mp[target];
  }
  cout<<ans<<endl;
  

  return 0;
}


Measured memory_bytes: 29448
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(string.Join(" ", s.Select((x, y) => new { x, y }).OrderBy(x => x.x).Select(x => x.y + 1)));
    }

    static int NextInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0;
            int next = Console.In.Read();
            int sign = 1;
            while (45 > next || next > 57) next = Console.In.Read();
            if (next == 45) { next = Console.In.Read(); sign = -1; }
            while (48 <= next && next <= 57)
            {
                res = res * 10 + next - 48;
                next = Console.In.Read();
            }
            return res * sign;
        }
    }
}


Measured memory_bytes: 32476
N = int(input())
H = list(map(int, input().split()))

max_num = 0
count = 0
b = -(10**18)
for i, h in enumerate(H+[10**18]):
    # print(i, h, count)
    if h <= b:
        count += 1
    else:
        max_num = max(max_num, count)
        count = 0
    b = h

print(max_num)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,n) for(int i=s;i<n;i++)
#define rep_bit(n) for (int bit = 0; bit < (1<<n); ++bit)
#define all(x) (x).begin(),(x).end()
#define ll long long
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
using namespace std;
typedef vector<vector<int> > Graph;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
//条件式 ? 真の場合の文 : 偽の場合の文
//abs(x) = (x の絶対値)
//string S  S[i],S += T,S += c,S.size(),S.substr(l),S.substr(l, r)
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定　変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素

int main(){

    int k,s;
    cin >> k >> s;
    int cnt = 0;
    rep(i,k+1){
        rep(j,k+1) {
            if(0 <= s-i-j && s-i-j <= k) cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;

int main(void) {

  int n, m;
  cin >> n >> m;
  vector< pair<int, int> > p(m);
  int cnt = 0;
  for(int i=0; i<m; i++){
    cin >> p[i].first >> p[i].second;
    if( p[i].first >= n ) cnt++;
  }

  if( cnt >= m-1 ) cout << 0 << endl;
  else{
    int ans = 0;
    sort(p.begin(), p.end());
    for(int i=0; i<m; i++){
      if( p[m-1-i].first >= n ) continue;
      ans += max(0, n-p[m-1-i].first);
      cnt++;
      if( cnt >= m - 1 ) break;
    }
    cout << ans << endl;
  }

  return 0;
}


// EOF

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

    int main() {
        int n, d, x;
        cin >> n >> d >> x;
        vector<vector<int>> p(d, vector<int>(n));
        for (int i=0; i<d; ++i) {
            for (int j=0; j<n; ++j) {
                cin >> p[i][j];
            }
        }

        for (int i=0; i<d-1; ++i) {
            vector<int> dp(1e5+1, 0);
            int mx = 0;
            for (int j=0; j<n; ++j) {
                if (p[i+1][j] - p[i][j] <= 0) continue;
                for (int k=0; k+p[i][j]<=x; ++k) {
                    dp[k + p[i][j]] = max(dp[k + p[i][j]], dp[k] + p[i+1][j] - p[i][j]);
                    mx = max(mx, dp[k + p[i][j]]);
                }
            }
            x += mx;
        }
        cout << x << endl;
        return 0;
    }


Measured memory_bytes: 3560
/**
 * Program name:Queue
 * author:Xin Peng
 * date:2020/1/18
 * Pragram problem source: AOJ
*/
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

#define MAX_N 100000

//data structure
typedef struct task
{
    string name;
    int time;
} Task;

class Queue
{
    Task *data; //data pointer
    int pp;     //first position data
    int np;     //next position data
    int size;

public:
    Queue()
    {
        data = NULL;
        pp = np = 0;
        size = 0;
    }
    Queue(int size)
    {
        this->size = size;
        data = new Task[size + 1];
        pp = np = 0;
    }
    ~Queue()
    {
        if (data)
            delete[] data;
    }

    bool enqueue(Task x);

    Task dequeue();

    bool isFull() { return (pp - np) == 1; }

    bool isEmpty() { return (np == pp); }
};

bool Queue::enqueue(Task x)
{
    if (isFull())
    {
        return false;
    }
    else
    {
        data[np++] = x;
        np %= (size + 1);

        return true;
    }
}

Task Queue::dequeue()
{
    if (isEmpty())
    {
        Task null;
        null.time = -1;
        return null;
    }
    else
    {
        Task tmp;

        tmp = data[pp++];
        pp %= (size + 1);

        return tmp;
    }
}

int main()
{
    int time = 0;
    int n, q;
    Queue task(MAX_N);

    cin >> n;
    cin >> q;

    for (int i = 0; i < n; i++)
    {
        string name, number;
        cin >> name;
        cin >> number;
        Task tmp;
        tmp.name = name;
        tmp.time = atoi(number.c_str());

        task.enqueue(tmp);
    }

    while (!task.isEmpty())
    {
        Task tmp;
        tmp = task.dequeue();

        if (tmp.time > q)
        {
            tmp.time -= q;
            time += q;
            task.enqueue(tmp);
        }
        else
        {
            time += tmp.time;
            cout << tmp.name << " " << time << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 6760
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# E - Sum of gcd of Tuples (Hard)

n, k = map(int, input().split())

modulus = 10 ** 9 + 7

def expt(x, k):
    """(x ** k) % modulus"""
    p = 1
    for b in (bin(k))[2:]:
        p = p * p % modulus
        if b == '1':
            p = p * x % modulus
    return p

# iの倍数をn個並べた列の個数
nseq = [expt((k // i), n) if i > 0 else None for i in range(k + 1)]

for i in range(k, 0, -1):
    # iの2倍以上の倍数からなる列の個数を引く
    s = sum(nseq[m] for m in range(2 * i, k + 1, i))
    nseq[i] = (nseq[i] - s % modulus + modulus) % modulus

# nseq[i]はgcd==iになる列の個数
ans = sum(i * nseq[i] % modulus for i in range(1, k + 1))
print(ans % modulus)


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int N;
    cin >> N;
    ll ret = 0;
    vector<int> a;
    rep(i, N) {
        ret += (i+1);
        a.push_back(i+1);
        if (ret >= N) break;
    }
    ll tmp = ret - N;
    rep(i, a.size()) {
        if (a[i] != tmp) {
            cout << a[i] << endl;
        }
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

bool used[114514];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	pll dt[114514];
	cin>>n>>k;
	REP(i, n){
		cin>>dt[i].second>>dt[i].first;
	}
	sort(dt, dt+n, greater<pll>());
	ll sum=0, x=0;
	vl q;
	REP(i, k){
		sum+=dt[i].first;
		if(used[dt[i].second]){
			q.push_back(dt[i].first);
		}
		else{
			used[dt[i].second]=true;
			++x;
		}
	}
	sort(ALL(q));
	ll ans=sum+x*x;
	int idx=0;
	FOR(i, k, n){
		if(x>=k || idx>=q.size()){
			break;
		}
		if(used[dt[i].second]){
			continue;
		}
		used[dt[i].second]=true;
		sum=sum-q[idx++]+dt[i].first;
		++x;
		CHMAX(ans, sum+x*x);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 2812
N, M, X = [int(x) for x in input().split()]
costs = []
A = []
for i in range(N):
    line = [int(x) for x in input().split()]
    costs.append(line[0])
    A.append(line[1:])

best = float('inf')
for mask in range(2 ** N):
    totalCost = 0
    skills = [0] * M
    for i in range(N):
        if (1 << i) & mask:
            totalCost += costs[i]
            for j in range(M):
                skills[j] += A[i][j]
    if all(x >= X for x in skills):
        best = min(best, totalCost)

if best != float('inf'):
    print(best)
else:
    print(-1)





Measured memory_bytes: 69156
#include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp>
using namespace std;
using ll=long long;
const int MOD=1000000007;


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

Measured memory_bytes: 3588
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

// 1 点更新区間取得
// 条件は要素がモノイドであること（あるいは半群？）
// 有名どころは 和, 積, min, max gcd lcm
// プラスアルファで行列 ?



template <typename T>
struct SegmentTree{
    using F = function<T(T, T)>;
    int n;
    F f;
    T ti;
    vector<T> dat;
    SegmentTree(){};
    SegmentTree(F f, T ti, const vector<T> &v):f(f),ti(ti){
        int sz = v.size();
        n = 1;
        while(n < sz) n <<= 1;
        dat.assign(2 * n - 1, ti);
        for(int i = 0; i < sz; i++) dat[n - 1 + i] = v[i];
        for(int i = n - 2; i >= 0; i--) dat[i] = f(dat[2 * i + 1], dat[2 * i + 2]);
    }

    // x 番目(0 - indexed) の要素を val に更新
    void update(int x, T val){
        x += (n - 1);
        dat[x] = val;
        while(x > 0){
            x = (x - 1) / 2;
            dat[x] = f(dat[2 * x + 1], dat[2 * x + 2]);
        }
    }

    // 区間[a, b)を取得する
    T query(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return ti;
        if(a <= l && r <= b) return dat[k];
        T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return f(vl, vr);
    }
    
    T query(int a, int b){
        return query(a, b, 0, 0, n);
    }
};


signed main(){

    int n, q; cin >> n >> q;
    int ti = 0;
    vector<int> v(n, ti);
    auto f = [](int a, int b){return a + b;};
    // 関数, 単位元, 元の配列の順に宣言
    SegmentTree<int> sg(f, ti, v);
    
    for(int i = 0; i < q; i++){
        int c, x, y; cin >> c >> x >> y;
        if(c) cout << sg.query(x - 1, y) << endl;
        else sg.update(x - 1, sg.query(x - 1, x) + y);
    }

    return 0;
}




Measured memory_bytes: 5720
//#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<map>
#include<math.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    string s;
    cin >> s;

    irep(i, 3) {
        if(s[i] == s[i+1])  {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
} /*atcoder*/



Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, X;
//string S, T;

signed main(){
  cin >> N >> M; 
  vvi a(N,vi(2)), c(M,vi(2));
  rep(i,N) cin >> a[i][0] >> a[i][1];
  rep(i,M) cin >> c[i][0] >> c[i][1];
  
  rep(i,N){
    int ans = 1e18;
    int pt;
    rep(j,M){
      int len = abs(a[i][0]-c[j][0]) + abs(a[i][1]-c[j][1]);
      if (ans > len) {
        pt = j;
        ans = len;
      }
    }
    cout << pt+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define int long long
using namespace std;
int N,m[111111][3];
signed main(){
    cin>>N;
    N--;
    for(int i=0;i<N;i++){
        cin>>m[i][1]>>m[i][0]>>m[i][2];
    }
    for(int i=0;i<N;i++){
        int time=0;
        for(int j=i;j<N;j++){
            if(time>m[j][0]){
                if(time%m[j][2]!=0){
                    time+=m[j][2]-time%m[j][2];
                }
            }
            else time=m[j][0];
            time+=m[j][1];
        }
        cout<<time<<'\n';
    }
    cout<<0;
}


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

using namespace std;
using ll = long long int;

int main()
{
	int n, x, y;
	cin >> n >> x >> y;
	x--; y--;

	unordered_map<int, int> m;
	for (int a = 0; a < n; a++)
	{
		for (int b = a + 1; b < n; b++)
		{
			int distance = b - a;
			distance = min(distance, abs(x - a) + 1 + abs(y - b));
			distance = min(distance, abs(y - a) + 1 + abs(x - b));
			m[distance]++;
		}
	}

	for (int k = 1; k <= n - 1; k++)
	{
		cout << m[k] << endl;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int h, w;
    cin >> h >> w;
    vstr a(h);
    rep(i, h) cin >> a[i];

    vvbool c(h, vbool(w, true));
    rep(i, h) {
        int b = 0;
        rep(j, w) if (a[i][j] == '#') b++;
        if (b != 0) continue;
        rep(j, w) c[i][j] = false;
    }

    rep(j, w) {
        int b = 0;
        rep(i, h) if (a[i][j] == '#') b++;
        if (b != 0) continue;
        rep(i, h) c[i][j] = false;
    }

    vstr ans(h, "");
    rep(i, h) rep(j, w) {
        if (c[i][j]) ans[i] += a[i][j];
    }
    rep(i, h) if (ans[i] != "") cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: i64 = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };

    let ans = (((N + 1) / 2) as f64) / (N as f64);

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


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
  int N, a[200001], k[200001];
  cin >> N;
  for(int i=1; i<=N; i++){
    cin >> a[i];
  }

  int m = 0;
  for(int i=N; i>0; i--){
    int j = 0, n = 0;
    while(j <= N){
      n += k[j];
      j += i;
    }
    if(n%2 != a[i]){
      k[i] = 1;
      m += 1;
    }
  }

  cout << m << endl;
  for(int i=0; i<=N; i++){
    if(k[i] == 1) cout << i << " ";
  }
  return 0;
}

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

#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-funroll-loops")
#pragma GCC target("avx,sse4")

#define mms(a,n) memset(a,0,sizeof((a)[0])*(n))
#define mmp(a,b,n) memcpy(a,b,sizeof((b)[0])*(n))
#define lowbit(x) ((x)&-(x))
#define pb push_back
#define fi first
#define se second
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define fo(i,l,r) for(register int i=l,_lim_=r;i<=_lim_;i++)
#define fd(i,r,l) for(register int i=r,_lim_=l;i>=_lim_;i--)
#define fos(i,l,r,d) for(register int i=l,_lim_=r;i<=r;i+=d)
#define fol(i,l,r) for(register ll i=l,_lim_=r;i<=_lim_;i++)
#define fdl(i,r,l) for(register ll i=r,_lim_=l;i>=_lim_;i--)
#define fosl(i,l,r,d) for(register ll i=l,_lim_=r;i<=r;i+=d)
#define Clear(a) memset(a,0,sizeof(a))
#define Copy(a,b) memcpy(a,b,sizeof(b))
#define ALL(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ldb;
typedef double db;
typedef pair<int,int> pi;

const int N=10005;
int n,a[N],b[N];
ll x,y;

int main(){
	scanf("%d",&n);
	fo(i,1,n)scanf("%d",a+i);
	fo(i,1,n)scanf("%d",b+i);
	fo(i,1,n)x+=max(b[i]-a[i]+1,0)>>1,y+=b[i]-a[i];
	if(y<x)puts("No");else puts("Yes");
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>

using namespace std;
//#define int long
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main() 
{
	string S;
	cin >> S;
	if (S == "SUN")cout << "7";
	else if (S == "MON")cout << "6";
	else if (S == "TUE")cout << "5";
	else if (S == "WED")cout << "4";
	else if (S == "THU")cout << "3";
	else if (S == "FRI")cout << "2";
	else cout << "1";
}

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

#define ll long long int

int main() {
	ll A, B, C, K;
	cin >> A >> B >> C >> K;

	int count = 0;
	for (int i = 0; i < A; i++) {
		if (K > 0) {
			K--;
			count++;
		}
		else
			break;
	}

	for (int i = 0; i < B; i++) {
		if (K > 0) {
			K--;
		}
		else
			break;
	}

	for (int i = 0; i < C; i++) {
		if (K > 0) {
			K--;
			count--;
		}
		else
			break;
	}

	cout << count << "\n";
	return 0;

}

Measured memory_bytes: 3600
#include<stdio.h>
#include<math.h>
int isprime(int x);
int main()
{
  int i,j,n,num[10000];
  int prime=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    if( scanf("%d",&num[i])==EOF)break;
  if(isprime(num[i])==1){
    prime++;
    }
  }
    printf("%d\n",prime);
    return 0;
}
int isprime(int x){
  int i;
  if(x==2)return 1;
  if(x<2 || x%2==0)return -1;
  i=3;
  while(i<=sqrt(x)){
    if(x%i==0)return -1;
    i=i+2;
  }
  return 1;
}
      

Measured memory_bytes: 628
from collections import defaultdict
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
bxs = list(map(int, input().split()))
xs = bxs[:]
dd = defaultdict(set)
for i, x in enumerate(xs):
    dd[x].add(i+1)
xs = list(set(xs))
xs.sort()

#for x, i in xs:
G = [set() for _ in range(N+1)]
G2 = [set() for _ in range(N+1)]
es = []
for i in range(M):
    u, v = map(int, input().split())
    if bxs[u-1] == bxs[v-1]:
        G2[v].add(u)
        G2[u].add(v)
    elif bxs[u-1] > bxs[v-1]:
        G[u].add(v)
    else:
        G[v].add(u)
    e = (min(u,v), max(u,v))
    es.append(e)

r = True
d = dict()
cc = [-1 for _ in range(N+1)]
for i in range(N):
    if len(G[i+1]) + len(G2[i+1]) == 0:
        print(-1)
        sys.exit()
for x in xs:
    for u in dd[x]:
        if cc[u] != -1:
            continue
        if not G2[u]:
            continue
        cc[u] = 1
        stack = [u]
        while stack:
            q = stack.pop()
            for c in G2[q]:
                e = (min(q,c), max(q,c))
                if e in d:
                    continue
                d[e] = x
                if cc[c] != -1:
                    continue
                stack.append(c)
                cc[c] = 1 - cc[q]
for x in xs:
    for i in dd[x]:
        for c in G[i]:
            e = (min(i,c), max(i,c))
            d[e] = bxs[i-1]
            if cc[i] == -1:
                cc[i] = 1 - cc[c]
for i in range(1, N+1):
    print("B"if cc[i] else "W", end="")
print()
for i in range(M):
    print(d[es[i]])



Measured memory_bytes: 136308
#!/usr/bin/env python3
import sys
from collections import Counter
import math
MOD = 1000000007  # type: int


def factorial(n):
    prime_count = Counter()

    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n /= i
            prime_count[i] += 1
    if n > 1:
        prime_count[int(n)] += 1

    return prime_count


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % MOD
    elif y % 2 == 0:
        return power(x, y//2)**2 % MOD
    else:
        return power(x, y//2)**2 * x % MOD


def div(a, b):
    return (a * power(b, MOD-2)) % MOD


def solve(N: int, A: "List[int]"):

    lcm = Counter()
    for a in A:
        c = factorial(a)
        for k in c:
            lcm[k] = max(c[k], lcm[k])
    # print(lcm)

    LCM = 1
    for k, v in lcm.items():
        LCM *= power(k, v)
        LCM %= MOD
    # print(LCM)

    tot = 0
    for a in A:
        tot += div(LCM, a)
    print(tot % MOD)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 66396
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200) cout << s << endl;
    else cout << "red" << endl;
    return 0;
}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true) {
			int n = stdIn.nextInt();
			int k = stdIn.nextInt();
			if(n == 0 && k == 0) break;
			boolean[] tmp = new boolean[n+1];
			int sum = 0;
			for(int i = 0; i < k; i++) {
				int s = stdIn.nextInt();
				if(s == 0) {
					sum++;
				}
				tmp[s] = true;
			}
			int max = 0;
			int lp = 1;
			int rp = 1;
			int prelp = 1;
			int tmpsum = sum;
			while(true) {
				if(!tmp[rp]) {
					rp++;
					lp++;
				}
				else {
					break;
				}
			}
			while(true) {
				rp++;
				while(rp < tmp.length && (tmp[rp] ||tmpsum > 0)) {
					if(!tmp[rp] || rp > tmp.length) {
						prelp = rp;
						tmpsum--;
					}
					rp++;
				}
				tmpsum = sum;
				if(rp - lp > max) {
					max = rp - lp;
				}
				
				if(lp > tmp.length || rp > tmp.length) {
					break;
				}
				lp = prelp+1;
				rp = lp+1;
				prelp++;
			}
			if(sum == 0) {
				System.out.println(max-2);
			}
			else 
			System.out.println(max-1);
			
		}
		
	}

}

Measured memory_bytes: 60824
#include <iostream>  
using namespace std;  
int main()  
{  
 int N;
 cin>>N;
 int a;
 a=N%10;
 if(a==2 ||a==4||a==5||a==7||a==9)
 {
 	cout<<"hon"<<endl;
 }
 if(a==1 ||a==0||a==6||a==8)
 {
 	cout<<"pon"<<endl;
 }
 if(a==3)
 {
 	cout<<"bon"<<endl;
 }
}

Measured memory_bytes: 3636
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}
function segTree(n){
  var l = n.length, u = l-1, x = 2, i, v;
  while(u)u >>= 1, x <<= 1;
  v = this.seg = Array(x-1).fill(0);
  this.l = x = (x >> 1) - 1;
  for(i = 0; i < l; i++)v[i+x] = n[i];
  for(i = x-1; i >= 0; i--)v[i] = segSolve(v[i+i+1],v[i+1<<1]);
}
function segSolve(a,b){
  return Math.max(a,b);
}
segTree.prototype={
  get:function(l,r){//[l,r)
    if(l >= r)return 0;
    var v = this.seg;
    return q(l,r,0,this.l+1,0);
    function q(l,r,x,y,i){
      if(l === x && r === y)return v[i];
      var m = x+y >> 1;
      if(m < r)if(l < m)return segSolve(q(l,m,x,m,i+i+1),q(m,r,m,y,i+1<<1));
      else return q(l,r,m,y,i+1<<1);
      return q(l,r,x,m,i+i+1);
    }
  },
  update:function(x,i){
    var v = this.seg;
    i += this.l;
    v[i] = x;
    for(i = i-1>>1; i >= 0; i = i-1>>1){
      v[i] = segSolve(v[i+i+1],v[i+1<<1]);
    }
  },
}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var n = next();
  var a = [];
  for(var i = 0; i < n; i++){
    a.push([next(),i]);
  }
  a.sort((a,b)=>a[0]-b[0]);
  var segl = new segTree(xArray(0,n));
  var segr = new segTree(xArray(0,n));
  var ans = 0;
  for(var i = 0; i < n; i++){
    var b = a[i][1];
    var l = b-segl.get(0,b+1)+1;
    var r = n-b-segr.get(0,n-b);
    ans += l*r*(i+1);
    segl.update(b+1,b);
    segr.update(n-b,n-b-1);
  }
  return ans;
}

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

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

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


Measured memory_bytes: 3628
def main():
    h,w,k=map(int,input().split())
    grid=[input() for _ in [0]*h]
    ans=[[0]*w for _ in [0]*h]
    berry=0
    for i in range(h):
        if "#" in grid[i]:
            cnt=0
            berry+=1
            for j in range(w):
                if grid[i][j]=="#":
                    cnt+=1
                    if cnt>1:
                        berry+=1
                ans[i][j]=berry
    for i in range(1,h):
        if ans[i][0]==0:
            for j in range(w):
                ans[i][j]=ans[i-1][j]
    for i in range(h-2,-1,-1):
        if ans[i][0]==0:
            for j in range(w):
                ans[i][j]=ans[i+1][j]         
    for i in ans:
        print(*i)
main()


Measured memory_bytes: 7568
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

combination comb(2005);
mint f(int n, int k) {
    if (n < k) return 0;
    if (n == k) return 1;
    return comb(n-1,k-1);
}

int main() {
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= k; i++) {
        mint red = f(n-k,i+1) + f(n-k,i)*2 + f(n-k,i-1);
        //mint red = comb(n-k+1, i);
        mint blue = f(k,i);
        mint ans = red * blue;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(double& x, double y) {
	x = min(x, y);
}

void chmax(double& x, double y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll n, a, b;
ll ans;
ll CO[200010];

void solve() {
	cin >> n >> a >> b;
	CO[0] = 1;
	rep(i, 200005) {
		if (i == 0) continue;
		CO[i] = CO[i - 1] * (n + 1 - i);
		CO[i] %= mod;
		CO[i] *= div_mod(i);
		CO[i] %= mod;
	}
	ans = pow_mod(2, n) - 1;
	ans += 2 * mod - CO[a] - CO[b];
	ans %= mod;
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class C
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
		
		string[] args = Console.ReadLine().Split(' ');
		List<long> B = new List<long>(N);
		for(int i = 0; i < N; i++)
			B.Add(Int64.Parse(args[i]) - (i + 1));
		B.Sort();

		long ans = Int64.MaxValue;
		for(int i = (N-1)/2; i <= N/2; i++)
		{
			long tmp = 0;
			long b = B[i];
			for(int j = 0; j < N; j++)
				tmp += Math.Abs(B[j] - b);
			ans = Math.Min(ans,tmp);
		}
		
		Console.WriteLine(ans);
	}	
}





Measured memory_bytes: 30684
#include<bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const int MOD = 998244353;
const int maxn = 1e5 + 10;
int N, S, A[maxn];
LL dp[maxn];
int main()
{
    scanf("%d %d", &N, &S);
    for(int i = 1; i <= N; i++)
        scanf("%d", &A[i]);
    LL ans = 0;
    for(int i = 1; i <= N; i++)
    {
        if(A[i] == S)
            ans = (ans + i * (N - i + 1) % MOD) % MOD;
        if(A[i] >= S)
            continue;
        ans = (ans + dp[S-A[i]] * (N - i + 1) % MOD) % MOD;
        for(int j = S - 1; j >= 0; j--)
        {
            if(A[i] + j < S)
                dp[A[i] + j] = (dp[A[i] + j] + dp[j] % MOD)% MOD;
        }
        dp[A[i]] = (dp[A[i]] + i) % MOD;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
while true
    arr = [0, 0, 0, 0]
    hands = []
    hands << gets.to_i
    break if hands.last == 0
    arr[hands.last] += 1
    4.times{
        hands << gets.to_i
        arr[hands.last] += 1
    }

    arr.shift
    if arr.count(0) == 0 || arr.count(0) == 2
        5.times{puts 3}
    else
        case arr.index(0)
        when 0
            hands.map!{|h| h - 1}
        when 1
            hands.map!{|h| h == 1 ? 2 : 1}
        end
        puts hands
    end
end



Measured memory_bytes: 6868
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(n)-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd
#define mod 1000000007
/****************************/
string ans;
int re=0;
int q;
int t;
string rev(string s)
{
	string t="";
	if(SZ(s)==0) return t;
	rep2(i,SZ(s))
	{
		t+=s[i];
	}
	return t;
}
string fr,en;
int main()
{
	cin>>ans;
	cin>>q;
	re=0;
	fr="";
	en="";
	bool f1=0,f2=0;
	rep(i,q)
	{
		cin>>t;
		if(t==1)
		{
			if(f2)
			{
				f1=1-f1;
			}
			re++;
		}
		else
		{
			f2=1;
			int f;
			char c;
			cin>>f>>c;
			if(f==2&&!f1||f==1&&f1)
			{
				en+=c;
			}
			else
			{
				fr+=c;
			}
		}
	}
	if(re%2!=0)
	{
		ans=rev(ans);
	}
	if(!f1)
	{
		ans=rev(fr)+ans+en;
	}
	else
	{
		ans=rev(en)+ans+fr;
	}
	cout<<ans;
	return 0;
}

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

int main(){
  int a,b,ans;
  
  cin >> a >> b ;
  
  if( a < 6 ) ans = 0;
  else if( a < 13 ) ans = b/2;
  else ans = b;
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline void read(int &f){
    f=0;
    ll x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
int n;
int a[DMAX];
int main()
{   
    read(n);
    for(int i=1;i<=n;i++){
        read(a[i]);
    }
    for(int i=1;i<=n;i++){
        if(a[i]%2==0){
            if(a[i]%3!=0 && a[i]%5!=0){
                cout<<"DENIED"<<endl;
                return 0;
            }   
        }
    }
    cout<<"APPROVED"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
using Int = int64_t;
int main() {
    Int N, A, B;
    cin >> N >> A >> B;
    Int t = B - A;
    if (t & 1) cout << min(A - 1, N - B) + 1 + (t - 1) / 2 << endl;
    else cout << t / 2 << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        
        double a = in.nextDouble(), b = in.nextDouble();

        System.out.printf("%d %d %f\n", (int)(a/b), (int)(a%b), a/b);
    }
}


Measured memory_bytes: 28208
package main

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

func main() {
	scan_init()
	x := scanInt()
	if x >= 30 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

var sc = bufio.NewScanner(os.Stdin)

func scan_init() {
	sc.Split(bufio.ScanWords)
}
func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func scan() string {
	sc.Scan()
	return sc.Text()
}

Measured memory_bytes: 1772
def md(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
Y = md(n)

if len(Y)%2 == 1: print(Y[len(Y)//2]*2-2)
else: print(Y[len(Y)//2]+Y[len(Y)//2-1]-2)


Measured memory_bytes: 3268
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include<math.h>
using namespace std;

int main() {
	string s, t; cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != t[i])ans++;
	}
	cout << ans << endl;
}

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


int main(){
  int N;
  cin >> N;
  vector<int>ans(10050,0);
  for(int x = 1; x<105; x++){
    for(int y = 1; y < 105; y++){
      for(int z = 1; z <105 ; z++){
        int v = x*x + y*y + z*z + x*y + y*z + z*x;
        if (v < 10050){
          ans[v]++;
        }
      }
    }

  }
  for(int i = 1; i <= N ;i++){
    cout << ans[i] << endl;
  }
 
  
}

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

int main(){
  int n;
  cin >> n;
  if(n % 10 == 3) cout << "bon" << endl;
  else if(n % 10 == 0 ||n % 10 == 1||n % 10 == 6||n % 10 == 8) cout << "pon" << endl;
  else cout << "hon" << endl;
  return 0;
}

Measured memory_bytes: 3620
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

S = str(input())
S = list(S)
S.reverse()
S = "".join(S)

def check(T):
    if len(S) == 0:
        return 1
    adds = ["maerd","remaerd","esare","resare"]
    q = copy.deepcopy(adds)
    while len(q) > 0:
        t = q.pop()
        if t == S:
            return 1
        for add in adds:
            if S[len(t):len(t+add)] == add:
                q.append(t+add)
    return 0

if check(""):
    print("YES")
else:
    print("NO")


Measured memory_bytes: 6608
/*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_H&lang=jp
*/

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


int main(){
    int n;
    ll W;
    cin >> n >> W;
    int n1,n2;
    n1 = n/2;
    n2 = n-n1;
    vector<ll> val(n);
    vector<ll> wei(n);
    rep(i,n){
        ll v,w;
        cin >> v >> w;
        val[i]=v;
        wei[i]=w;
    }

    /*
    cout << "value" << endl;
    for(auto v:val) cout << v << " ";
    cout << endl;
    */

    /*
    cout << "weight" << endl;
    for(auto w:wei) cout << w << " ";
    cout << endl;
    */

    //vector<P> sec;
    vector<P> fir(1<<n1);
    //first:weight  second:value

    rep(i,1<<n1){
        ll v=0,w=0;
        for(int j = 0;j<n1;++j){
            if(i>>j & 1){
                w += wei[j];
                v += val[j];
            }
        }
        fir[i].first = w;
        fir[i].second = v;
    }

    sort(fir.begin(),fir.end());

    /*
    cout << "sorted" << endl;
    rep(i,1<<n1){
        cout << "w: " << fir[i].first << "v: " << fir[i].second << endl;
    }
    */

    vector<ll> fir_defined_w;
    vector<ll> fir_defined_v;
    int m = 0;
    fir_defined_v.push_back(fir[0].second);
    fir_defined_w.push_back(fir[0].first);
    for(int i=1;i< 1<<n1; ++i){
        if(fir[m].second < fir[i].second) {
            m=i;
            //fir_defined.push_back(fir[i]);
            fir_defined_v.push_back(fir[i].second);
            fir_defined_w.push_back(fir[i].first);
        }
    }

    /*
    cout << "eliminate" << endl;
    rep(i,fir_defined_w.size()){
        cout << "w: " << fir_defined_w[i]<< "v: " << fir_defined_v[i] << endl;
    }
    */



    //cout << "second" << endl;
    ll res=0;
    rep(i,1<<n2){
        ll v=0,w=0;
        for(int j = 0; j<n2;++j){
            if(i>>j & 1){
                w+=wei[j+n1];
                v+=val[j+n1];
            }
        }

        //cout << "w: " << w << "v: " << v << "res"<< res<< endl;


        
        if(w<=W){
            decltype(fir_defined_w)::iterator temp = lower_bound(fir_defined_w.begin(),fir_defined_w.end(),W-w+1);
            int idx;
            idx = distance(fir_defined_w.begin(),temp);
            if(idx==0) idx++; 
            res = max(res,v+  fir_defined_v[idx-1]);
            //cout << "sec" << fir_defined_v[idx-1] << endl;
            //cout << "temp:idx " <<idx<<" " << res << endl;
        }
        
    }

    cout << res << endl;
}


Measured memory_bytes: 19216
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a == b && b == c)
			System.out.println("1");
		else if(a == b || b == c || c == a)
			System.out.println("2");
		else
			System.out.println("3");
	}
}

Measured memory_bytes: 9808