akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
typedef long long ll;
//プロトタイプ宣言
int gcd(int , int);


int main(){
  ll n,ans = 0;
  cin >> n;
  string s;
  map<string,ll> mp;
  while(n>0){
    cin >> s;
    sort(s.begin(),s.end());
    ans += mp[s];
    mp[s]++;
    n--;
  }
  cout << ans << endl;
}








































//以下、ライブラリ
//ユークリッドの互除法

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
}



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

using namespace std;

int main(){

    int A, B;
    cin >> A >> B;

    int sum = 0;
    if(A >= B){
	sum += A;
	A--;
    }else{
	sum += B;
	B--;
    }
    
    if(A >= B){
	sum += A;
	A--;
    }else{
	sum += B;
	B--;
    }
    
    cout << sum << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,K;
string S;
cin>>N>>K;
cin>>S;

if(S[K-1]=='A'){
        S[K-1]='a';
}else if(S[K-1]=='B'){
        S[K-1]='b';
}else{
S[K-1]='c';
}

cout<<S<<endl;
}

Measured memory_bytes: 256
lines = $stdin.read
array = lines.split("\n")
A,B,C,X = array[0..4].map(&:to_i)

def sum_coin(a=0,b=0,c=0)
  #puts "a = #{a}, b = #{b}, c = #{c}"
  a*500 + b*100 + c*50
end

ans = 0

for a in 0..A
  next if sum_coin(a) > X
  for b in 0..B
    next if sum_coin(a,b) > X
    for c in 0..C
      next if sum_coin(a,b,c) > X
      sum = sum_coin(a,b,c)
      next if sum > X
      if sum == X
        #puts "#{a},#{b},#{c}"
        ans += 1
      end
    end
  end
end

puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;

int main(int argc, char const *argv[]) {
  int N,M;
  scanf("%d%d",&N,&M);
  printf("%d\n",(N-1)*(M-1));
  return 0;
}


Measured memory_bytes: 256
//#define _USE_MATH_DEFINES
//#include <math.h>
#include <iostream>
//#include <iomanip>
//#include <bits/stdc++.h>

using namespace std;

int main() {
    
    int n;
    cin >> n;
    int s[13] = {0};
    int h[13] = {0};
    int c[13] = {0};
    int d[13] = {0};
    string suit = "";
    int num = 0;
    for(int i = 0; i < n; i++){
        cin >> suit >> num;
        if(suit == "S") s[num - 1] = 1;
        else if(suit == "H") h[num - 1] = 1;
        else if(suit == "C") c[num - 1] = 1;
        else if(suit == "D") d[num - 1] = 1;
    }
    for(int i = 0; i < 13; i++){
        if(s[i] == 0) cout << "S" << " " << i + 1 << endl;
    }
    for(int i = 0; i < 13; i++){
        if(h[i] == 0) cout << "H" << " " << i + 1 << endl;
    }
    for(int i = 0; i < 13; i++){
        if(c[i] == 0) cout << "C" << " " << i + 1 << endl;
    }
    for(int i = 0; i < 13; i++){
        if(d[i] == 0) cout << "D" << " " << i + 1 << endl;
    }
}



Measured memory_bytes: 3132
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    s = S()[0]
    for i, t in enumerate(ascii_lowercase):
        # print(t, s)
        if t == s:

            print(ascii_lowercase[i+1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
import math
from functools import reduce
k = int(input())



def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans = 0
for i in range(1,k+1):
  for j in range(i,k+1):
    for m in range(j,k+1):
      tem=[]
      tem = [i,j,m]
      
      if  len(set(tem)) == 1 :
        ans += i
      elif len(set(tem)) == 2:
        ans += gcd(i,j,m) * 3
      elif len(set(tem)) == 3:
        ans += gcd(i,j,m) * 6

print(ans)


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

// プロセスを表す構造体
struct P {
    string name;
    int t;
};

// グローバル変数
static const int len = 100005;

void enqueue(P Q[], P x, int& tail) {
    if (tail == len) {
        tail = 0;
    }

    Q[tail++] = x;
}

P dequeue(P Q[], int& head) {
    if (head == len) {
        head = 0;
    }
    return Q[head++];
}

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

    P Q[len];
    // 全プロセスを順にqueueに追加（準備）
    for (int i = 1; i <= n; ++i) {
        cin >> Q[i].name >> Q[i].t;
    }
    int head = 1;
    int tail = n + 1;

    // シミュレーション開始
    int elaps = 0;  // 経過時刻
    while (head != tail) {
        P target_process = dequeue(Q, head);
        if (target_process.t <= q) {
            elaps += target_process.t;
            cout << target_process.name << " " << elaps << endl;
            continue;
        }

        target_process.t -= q;
        elaps += q;
        enqueue(Q, target_process, tail);
    }
    return 0;
}


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

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

	int t = n, s = 0;
	while (t)
	{
		s += t % 10;
		t /= 10;
	}
	if (n % s)
		printf("No\n");
	else
		printf("Yes\n");

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define Maxn 200000
int a[Maxn+5];
ll sum[Maxn+5];
ll f[Maxn+5],g[Maxn+5],d[Maxn+5];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i++){
		sum[i+1]=sum[i]+a[i];
	}
	for(int i=0;i<n;i++){
		f[i+1]=min(sum[i+1],f[i]+(a[i]==0?2:(a[i]&1)));
		g[n-i-1]=min(sum[n]-sum[n-i-1],g[n-i]+(a[n-i-1]==0?2:(a[n-i-1]&1)));
		d[i+1]=d[i]+(a[i]&1)-1;
	}
	g[n]-=d[n];
	for(int i=0;i<n;i++){
		f[i]+=d[i];
		g[n-i-1]-=d[n-i-1];
		g[n-i-1]=min(g[n-i-1],g[n-i]);
	}
	ll ans=f[0]+g[0];
	for(int i=1;i<=n;i++){
		ans=min(ans,f[i]+g[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 7296
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()
#define pb push_back

#define error(x) cout << #x << " = " << x << endl

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;

const int N = 1e5 + 20;
int n, a[N], b[N], c[N], d[N];
vector <int> g[N];

pii p[N];

int cnt;
bool vis[N];

void dfs (int v)
{
	vis[v] = 1;
	cnt++;

	for (int u : g[v])
		if (!vis[u]) dfs(u);
}

void yes ()
{
	cout << "Yes\n";
	exit(0);
}

void no ()
{
	cout << "No\n";
	exit(0);
}

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

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

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

	sort(c, c + n);
	sort(d, d + n);

	for (int i = 0; i < n; i++)
		if (c[i] > d[i]) no();

	for (int i = 1; i < n; i++)
		if (c[i] <= d[i - 1]) yes();

	for (int i = 0; i < n; i++)
		p[i].F = b[i], p[i].S = a[i];

	sort(p, p + n);

	for (int i = 0; i < n; i++)
	{
		int id = lower_bound(c, c + n, p[i].S) - c;

		g[i].pb(id);
	}

	dfs(0);

	if (cnt == n) no();
	else yes();
}


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

using namespace std;

int ans, N, a[100000], b[100000], c[100000], dp[100000][3];

int main(){
	cin >> N;
	for(int i = 0; i < N; ++i) cin >> a[i] >> b[i] >> c[i];
	dp[0][0] = a[0]; dp[0][1] = b[0], dp[0][2] = c[0];
	for(int i = 1; i < N; ++i){
		for(int j = 0; j < 3; ++j){
			if(j == 0) dp[i][j] = max(dp[i-1][1], dp[i-1][2]) + a[i];
			else if(j == 1) dp[i][j] = max(dp[i-1][0], dp[i-1][2]) + b[i];
			else dp[i][j] = max(dp[i-1][0], dp[i-1][1]) + c[i];
		}
	}
	
	ans = max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
	
	cout << ans << endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	string s;
	int w;
	cin >> s >> w;
	string h = "";
	for (int i = 0; i < s.size(); i += w) {
		h += s[i];
	}
	cout << h << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
using namespace std;

int main() {
    char s[200001], t[200001];
    rep(i, 200001) {
        s[i] = t[i] = '\0';
    }
    scanf("%s", s);
    scanf("%s", t);
    int counter = 0;
    rep(i, 200001) {
        if (s[i] != t[i]) {
            counter++;
        }
    }
    printInt(counter);
    return 0;
}


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

allMonsters = sum(A)

defeatMonsters = 0
for i in range(N):

    if A[i] <= B[i]:
        defeatMonsters += A[i]
        B[i] -= A[i]

        if A[i+1] >= B[i]:
            defeatMonsters += B[i]
            A[i+1] -= B[i]
        else:
            defeatMonsters += A[i+1]
            A[i+1] = 0

    else:
        defeatMonsters += B[i]
        B[i] = 0

print(defeatMonsters)
# print(A)


Measured memory_bytes: 97680
<?php
 
$s = trim(fgets(STDIN));
$c = 0;
$t = 0;
for ($i = strlen($s) - 1; $i >= 0; $i--) {
    if (strtolower($s[$i]) === 'w') {
        $c++;
    } else {
        $t += $c;
    }
}
printf("%s", $t);
 

Measured memory_bytes: 4856
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

constexpr int M = 114514;

int main(int argc, char const *argv[]) {
    int n,m,s,t; cin>>n>>m;
    vector<int> x = {0,M,M*2};
    vector<vector<int>> g(M*3);
    rep(i,m) {
        int u,v; cin>>u>>v;
        --u,--v;
        g[u+x[0]].push_back(v+x[1]);
        g[u+x[1]].push_back(v+x[2]);
        g[u+x[2]].push_back(v+x[0]);
    }

    cin>>s>>t; --s,--t;
    s += x[2];
    vector<int> dp(M*3, INF);

    auto bfs = [&] {
        queue<int> q;
        q.push(s);
        dp[s] = 0;
        
        while (q.size()) {
            int v = q.front(); q.pop();
            for (auto &&e: g[v]) {
                if (dp[e] > dp[v]+1) {
                    dp[e] = dp[v]+1;
                    q.push(e);
                }
            }
        }
    };

    bfs();

    if (dp[t+x[2]] == INF || dp[t+x[2]]%3!=0) cout << -1 << '\n';
    else cout << dp[t+x[2]]/3 << '\n';

    return 0;
}

Measured memory_bytes: 19072
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

#define ll long long

#define BUFF ios::sync_with_stdio(false)
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

#define inf std::numeric_limits<int>().max()

int main() {
	int a;
	cin >> a;
	cout << a + a*a + a*a*a << endl;
}


Measured memory_bytes: 3176
a ('R':xs) = b xs
a ('U':xs) = b xs
a ('D':xs) = b xs
a [] = "Yes"
a _ = "No"
b ('L':xs) = a xs
b ('U':xs) = a xs
b ('D':xs) = a xs
b [] = "Yes"
b _ = "No"


main = putStrLn =<< a <$> getLine

Measured memory_bytes: 380
#include <stdio.h>
int main(){
    
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    
    if (r <= x && x <= W-r){
        
        if(r <= y && y <= H-r){
            printf("Yes\n");
        }
        else printf("No\n");
    }
    else printf("No\n");
    
    return 0;
}


Measured memory_bytes: 2080
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint a[114514],b[114514];
int main()
{
	int N;lint n,sum=0,num;
	cin>>N;n=N;
	rep(i,N){
		cin>>a[i];
		sum+=a[i];
	}
	a[N]=a[0];
	if(sum%(n*(n+1)/2)>0){
		cout<<"NO"<<endl;return 0;
	}
	num=sum/(n*(n+1)/2);
	rep(i,N){
		lint di=a[i+1]-a[i],d2=num-di;
		if(d2%n>0){
			cout<<"NO"<<endl;return 0;
		}
		b[(i+1)%n]=d2/n;
	}
	rep(i,N){
		if(b[i]<0 || b[i]>num){
			cout<<"NO"<<endl;return 0;
		}
	}
	//rep(i,N) cout<<b[i]<<endl;
	lint s=0;rep(i,N) s+=(n-i)*b[i];
	for(int i=N-1;i>=0;i--){
		//cout<<i<<' '<<s<<endl;
		if(a[i]!=s){
			cout<<"NO"<<endl;return 0;
		}
		s-=num;s+=n*b[i];
	}
	cout<<"YES"<<endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#define rep(i, N) for (int i = 0; i < (N); ++i) 
using namespace std;

const int INF = 1001001001;

int main() {
    int N, M, L;
    cin >> N >> M >> L;
    vector<vector<int>> dist(N, vector<int>(N, INF));
    rep(i, N) dist[i][i] = 0;
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        dist[a][b] = dist[b][a] = c;
    }
    rep(k, N) rep(i, N) rep(j, N) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
    
    vector<vector<int>> dist2(N, vector<int>(N, INF));
    rep(i, N) rep(j, N){
        if (dist[i][j] <= L) dist2[i][j] = 1;
    }

    rep(k, N) rep(i, N) rep(j, N) dist2[i][j] = min(dist2[i][j],  dist2[i][k] + dist2[k][j]);

    int Q;
    cin >> Q;
    rep(i, Q) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        if (dist2[s][t] == INF) cout << -1 << endl;
        else cout << dist2[s][t] - 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,nn,m,a[1000];
  cin>>n>>m;
  for(int i=0;i<n;i++)cin>>a[i];
  nn=n;
  n/=__gcd(n,m);
  int c=0,ans=0;
  for(int i=0;i<n;i++){
    int mn=1e9,mx=-1;
    for(int j=0;j<m;j++){
      mn=min(mn,a[(c+j)%nn]);
      mx=max(mx,a[(c+j)%nn]);
    }
    c+=m;
    ans+=mx-mn;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

ll gcd(ll a, ll b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  return b ? gcd(b, a % b) : a;
}

ll gcd_arr(vector<ll> a) {
  int n = a.size();
  for (int i = n - 2; i >= 0; i--) {
    a[i] = gcd(a[i], a[i + 1]);
  }
  return a.front();
}

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

int main() {
  int n;
  cin >> n;
  vector<ll> data;

  REP(i, n) {
    ll x;
    cin >> x;
    data.push_back(x);
  }

  map<ll, int> prime_memo;

  bool gcd_all_1 = true;
  REP(i, n) {
    map<ll, int> tmp = prime_factor(data[i]);
    for (auto p : tmp) {
      if (prime_memo[p.first] != 0) {
        gcd_all_1 = false;
        break;
      } else {
        prime_memo[p.first] = 1;
      }
    }
  }

  if (gcd_all_1) {
    cout << "pairwise coprime" << endl;
    return 0;
  }

  ll gcd_all_2 = gcd_arr(data);
  if (gcd_all_2 == 1) {
    cout << "setwise coprime" << endl;
    return 0;
  }
  cout << "not coprime" << endl;
  return 0;
}

Measured memory_bytes: 23580
#include<stdio.h>

int main(void)
{
  int n,i,j,a[32],b,ohajiki;

  while(scanf("%d",&n)!=EOF)
    {

      if(n==0)break;
      ohajiki=32;

      for(i=0;i<n;i++)
	{
	  scanf("%d",&a[i]);
}
      i=0;
      j=0;
      while(ohajiki>1)
	{
	  if(i%2==0)
	    {
	      b=(ohajiki-1)%5;
	      printf("%d\n",ohajiki-b);
	      ohajiki=ohajiki-b;
	    }
	  else
	    {
	      printf("%d\n",ohajiki-a[j]);
	      ohajiki=ohajiki-a[j];
	      j++;
	    }
	  if(j==n)j=0;
	  i++;
	}
      printf("0\n");
    }
  return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main(void)
{
int a,b,c,d,e;
scanf("%d %d %d",&e,&a,&b);
if(a>=b){
c=b;
d=(a+b)-e;
}else{
c=a;
d=(a+b)-e;
}
if(d<=0){
d=0;
}
printf("%d %d\n",c,d);
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
#define debug(V) rep(i, V.size()) cout << V[i] << " ";
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, m, n, t, r, k, w, l, ans, i, j;
string S, T;
vl A, B;
void solve() { cout << a * b << endl; }
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b;
    solve();
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            char a[] = sc.nextLine().toCharArray();
            int b[] = new int[1000];
            int sum = 0;
            if (a[0] == '0') {
                break;
            }
            for (int i = 0; i < a.length; i++) {
                b[i] = a[i] - '0';
                sum += b[i];
            }
            System.out.printf("%d\n", sum);
        }
        sc.close();
    }
}


Measured memory_bytes: 27492
#pragma comment(linker, "/STACK:102400000,102400000")
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F
#define N 200010
#define M 2000100
#define LL long long
#define FF(i,a,b) for(int i=a;i<=b;++i)
#define RR(i,a,b) for(int i=a;i>=b;--i)
#define FJ(i,a,b) for(int i=a;i<b;++i)
#define SC(x) scanf("%d",&x)
#define SCC(x,y) scanf("%d%d",&x,&y)
#define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define SS(x) scanf("%s",x)
#define PR(x) printf("%d\n",x)
#define CL(a,b) memset(a,b,sizeof(a))
#define FD T&q=fd[rt],&ql=fd[rt<<1],&qr=fd[rt<<1|1]
#define MID int mid=((l+r)>>1)
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
#define zero(x) (((x)>0?(x):-(x))<EPS)
#define PB push_back
#define SZ size
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define MP make_pair
#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
using namespace std;
const int MOD=1000000007;
const double PI=acos(-1.0);
const double EPS=1e-8;
inline int II(){int n=0,ch=getchar();bool t=0;if(ch==-1)return 0;
for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')t=1;
for(;ch>='0'&&ch<='9';n=n*10+ch-'0',ch=getchar());if(t)return -n;return n;}
inline void OO(int a){if(a<0){putchar('-');a=-a;}
if(a>=10)OO(a/10);putchar(a%10+'0');}
inline int sgn(double x){return(x>EPS)-(x<-EPS);}
struct edge{int v,nx;}E[M*2+N*2];int head[N],EN;
void init_edge(){EN=0;CL(head,-1);}
void add_edge(int u,int v){
    E[EN]=(edge){v,head[u]};head[u]=EN++;
    E[EN]=(edge){u,head[v]};head[v]=EN++;
}
int n,ma,mb;
int f[555][555];
int main(){
    int a,b,c;
    CL(f,0x3f);
    f[0][0]=0;
    SCCC(n,ma,mb);
    FF(i,1,n){
        SCCC(a,b,c);
        RR(i,400,0)
        RR(j,400,0)
        f[i+a][j+b]=min(f[i+a][j+b],f[i][j]+c);
    }
    int ans=INF;
    FF(i,1,400){
        if(i*ma>400||i*mb>400)break;
        if(f[i*ma][i*mb]<ans)ans=f[i*ma][i*mb];
    }
    if(ans==INF)puts("-1");
    else  PR(ans);
    return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String in = sc.nextLine();
        String[] inst = in.split(" ");
        int x = Integer.parseInt(inst[0]);
        int y = Integer.parseInt(inst[1]);
        System.out.println(x*y + " " + (x+y)*2);
    }
}



Measured memory_bytes: 26140
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <random>

using namespace std;

int main() {
  string str;
  cin >> str;
  str.insert(str.begin() + 4, ' ');
  cout << str << endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vii vector<vi>

int main() {
	int n, d;
	cin >> n >> d;
	int x[15][15];
	rep(i, n)rep(j, d) cin >> x[i][j];
	int ans=0;
	rep(i, n-1)for(int j=i+1; j<n; j++)
	{
		int dd=0;
		rep(k, d) dd+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
		rep(t, 200) if(t*t==dd) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	char c;
	cin >> c;
	
	if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
		printf("vowel\n");
	}else{
		printf("consonant\n");
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ll long long
#define MOD 1000000007
#define ull unsigned long long int
#define db double
#define fi first
#define se second
#define pb push_back
#define vec vector<ll>
#define pr pair<ll,ll>
#define pq priority_queue<ll,vector<ll>, compare_queue >
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define GS(s)   string s; getline(cin,s);
#define lll __int128_t
#define endl "\n"
#define Next cout.flush()

struct compare_queue
{
    bool operator()(const pair<ll,pr>& a, const pair<ll,pr>& b)
    {
        return a.fi < b.fi;
    }
};

ll gcd(ll u,ll v)
{
	if(v==0)
	return u;
	
	else
	return gcd(v,u%v);
}

// ll power(ll x,ll y) 
// { 
//     if (y == 0) 
//         return 1; 
//     ll p = power(x, y/2)%MOD; 
//     p = ((p%MOD) * (p%MOD))%MOD; 

//     return (y%2 == 0)? p%MOD : ((x%MOD) * (p%MOD))%MOD; 
// } 

// ll modInverse(int a) 
// { 
//     if(a==1){return 1;}
//     return power(a,MOD-2); 
// } 
  
// // // #define MAX 1000000
// int primes[1000009],cnt=0;
// int spf[1000009];
// // vector<int> factors[1000009];
// char str[1000009];
// void pre()
// {
//     spf[1]=1;
//     spf[0]=1;
//     // calcualting primes
//     int n=1000000;
//     for(int i=2; i*i<=n; i++){
//         if(str[i]==0){
//                 spf[i]=i;
//                 for(int j=i; j*i<=n; j++){
//                     if(spf[i*j]==-1){spf[i*j]=i;}
//                     str[i*j]=1;
//                 }
                
//         }
//     }  

// }


// // A O(log n) function returning primefactorization 
// // by dividing by smallest prime factor at every step 
// int getF(ll x) 
// { if(x==1){return 1;}
//     int ret=0; 
//     while (x != 1) 
//     { 
//         ret++; 
//         x = x / spf[x]; 
//     } 
//     return ret; 
// } 

// C:\Users\A\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\lambda


void Function(){
ll n,k,i,j,x,y,f,g,po,foo;
ll M=998244353;
cin >> n >> k;
vector<pr> w;
repn(i,k){
    cin >> x >> y;
    w.pb({x,y});
}
sort(all(w));
vec dp(n+2,0),s(n+2,0);
dp[n]=1;
s[n]=1;
ll ans=0;
for(i=n-1;i>=1;i--){
    x=1;
    y=n-i;
    ans=0;
    for(j=0;j<k;j++){
        f=max(x,w[j].fi);
        g=min(y,w[j].se);
        if(g>=f){
            ans=( (ans%M) + ((M + s[i+f]-s[i+g+1])%M))%M;
        }
    }
    dp[i]=ans;
    s[i]=dp[i]+s[i+1];
  //  cout << dp[i] << " " << s[i] << endl;
}


cout << dp[1] << endl;

}


int main(){ 
fast;
ll t=1,i=0,j=0,k,h;
// memset(spf,-1,sizeof(spf));
// pre();
// cin >> t;
for(h=1;h<=t;h++){

Function();

}


return 0;

}

Measured memory_bytes: 6368
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
  string s;
  cin >> s;
  int cnt=0;
  for(int i=0;i<s.size()/2;i++){
    if(s[i]!=s[s.size()-1-i]) cnt++;
  }
  cout << cnt << endl;
}
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lowbit(i) ((i)&(-i))
#define ls (p << 1)
#define rs (p << 1 | 1)
using namespace std;

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

const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MAXN = 2 * 1e5 + 15;
char s[MAXN];
vector <int> a, b;
int main() {
#ifdef CitricAcid
    freopen ("input.txt", "rt", stdin);
#endif

    int n;
    scanf("%d", &n);
    scanf("%s", s + 1);
    for(int i = 1; i <= n; i++) {
        if(s[i] == 'W') a.push_back(i);
        else b.push_back(i);
    }
    if(a.size() == 0 || b.size() == 0) printf("0\n");
    else {
        int l = 0, r = b.size() - 1;
        int cnt = 0;
        while(l < a.size() && r >= 0) {
            if(a[l] > b[r]) break;
            // cout << a[l] << " " << b[r] << endl;
            l++; r--;
            cnt++;
        }
        printf("%d\n", cnt);
    }

#ifdef CitricAcid
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}
/*
# author : CitricAcid
# date : 2020/08/03
*/

Measured memory_bytes: 4828
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

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

int main(){
	int N, X;
	cin >> N >> X;
	int x[N+1];
	for (int i = 1; i <= N; ++i)
		cin >> x[i];

	x[0] = X;

	sort(x, x+N+1);

	int ret = x[1] - x[0];

	for (int i = 1; i < N; ++i){
		ret = gcd(x[i+1]-x[i], ret);
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(int,a,b,c);
  OUT((a==b&&b==c?"Yes":"No"))BR;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp(a,b) std::make_pair(a,b)
#define pb push_back
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::set<int> si;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N;
int A[100010];
int main(){
  cin>>N;
  rep(i,N) cin>>A[i];
  int cnt=0;
  rep(i,N) if(A[i]%2==1) cnt++;
  if(cnt%2==0) prin("YES");
  else prin("NO");
  return 0;
}


Measured memory_bytes: 764
n = input()
  
S = [int(x) for x in raw_input().split()]
  
q = input()
  
T = [int(x) for x in raw_input().split()]
  
C = 0
 

 
for key in T:
  left = 0
  right = n
  while left<right:
    mid = (right + left)/2
    if key==S[mid]:
      C += 1
      break
    elif key<S[mid]:
      right = mid
    elif key>S[mid]:
      left = mid+1
 

print C

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

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

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  
  string S;
  cin >> S;
  map<char,int> m;
  for(char c: S){
    m[c]++;
  }
  
  bool flg = true;
  if(m.count('N') != 0 && m.count('S') == 0)
    flg &= false;
  if(m.count('S') != 0 && m.count('N') == 0)
    flg &= false;
  if(m.count('W') != 0 && m.count('E') == 0)
    flg &= false;
  if(m.count('E') != 0 && m.count('W') == 0)
    flg &= false;
  
  cout << (flg ? "Yes" : "No") << endl;
  
  
}



Measured memory_bytes: 256
def prepare(n, MOD):
    facts = [1]
    t = 1
    for i in range(1, n + 1):
        t = t * i % MOD
        facts.append(t)
    invs = [1] * (n + 1)
    t = pow(t, MOD - 2, MOD)
    invs[n] = t
    for i in range(n, 1, -1):
        t = t * i % MOD
        invs[i - 1] = t
    return facts, invs


n, a, b, c = list(map(int, input().split()))
MOD = 10 ** 9 + 7
facts, invs = prepare(2 * n, MOD)

inv_ab = pow(a + b, MOD - 2, MOD)
a_ab = a * inv_ab % MOD
b_ab = b * inv_ab % MOD

win_a = 0
win_b = 0
exp_a = 1
exp_b = 1
for k in range(n):
    coef = facts[n + k] * invs[k] * invs[n - 1] % MOD
    win_a = (win_a + coef * exp_b) % MOD
    win_b = (win_b + coef * exp_a) % MOD
    exp_a = exp_a * a_ab % MOD
    exp_b = exp_b * b_ab % MOD

win_a = win_a * exp_a % MOD
win_b = win_b * exp_b % MOD

print((win_a + win_b) * 100 * inv_ab % MOD)


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

char a[100][100], b[102][102];
int main(){
  int H, W;
  cin >> H >> W;

  for (int i=0; i<H; i++){
    cin >> a[i];
  }

  for (int i=0; i<H+2; i++){
    for (int j=0; j<W+2; j++){
      b[i][j] = '#';
    }
  }

  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      b[i+1][j+1] = a[i][j];
    }
  }

  for (int i=0; i<H+2; i++){
    for (int j=0; j<W+2; j++){
      cout << b[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main(){
  ll a,b;
  cin>>a>>b;
  ll g=a*b;
  if(g==6)cout<<1;
  else  if(g==3)cout<<2;
  else if(g==2)cout<<3;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int l = scan.nextInt();
		int r = scan.nextInt();
		int d = scan.nextInt();

		int ans = 0;
		int count = 0;

		for(int i = l;i<=r;i++) {
			ans = i%d;
			if(ans == 0) {
				count = count + 1;
			}
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 35636
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>

using namespace std;


int main(){
    int h,w;
    cin >> h >> w;
    int maze[h+10][w+10];//0で壁、1で通路
    //外周
    for (int i=0;i<h+2;i++) {
        maze[i][0]=0;
        maze[i][w+1]=0;
    }
    for (int i=0;i<w+2;i++){
        maze[0][i]=0;
        maze[h+1][i]=0;
    }
    
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            char a;
            cin >> a;
            if(a=='#') maze[i][j]=0;
            else maze[i][j]=1;
        }
    }
    
    int d[h+10][w+10];
   
    
    int ans=0;
    int tate[4]={1,0,-1,0};
    int yoko[4]={0, 1, 0, -1};
    
    //全探索パート(BFS)
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            for(int r=0;r<h+2;r++){
                   for(int l=0;l<w+2;l++) d[r][l]=200000;
               }
            if(maze[i][j]==0) continue;
            else{
                queue<pair<int,int>> p; //行ける点
                p.push(make_pair(i,j));
                d[i][j]=0;
                
                while(p.size()){
                    pair<int,int> ima=p.front();
                    p.pop();
                    for(int k=0;k<4;k++){
                        if(maze[ima.first+tate[k]][ima.second+yoko[k]]==0) continue;
                        else{
                            if(d[ima.first+tate[k]][ima.second+yoko[k]]!=200000) continue;
                            else{
                                d[ima.first+tate[k]][ima.second+yoko[k]]=d[ima.first][ima.second]+1;
                                ans=max(ans,d[ima.first+tate[k]][ima.second+yoko[k]]);
                                p.push(make_pair(ima.first+tate[k],ima.second+yoko[k]));
                            }
                        }
                    }
                    
                }
                
            }
        }
    }
    
    cout << ans << endl;
    
    
}




Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<bitset>
#define int long long
#define lowbit(x) ((x)&(-x))
#define hh putchar('\n')
#define kg putchar(' ')
using namespace std;
const int maxn=200005,mod=20101009;
int n,a[maxn],ans;
map<int,int>tong;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
		if(ch=='-')
			f=-1;
		ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
    }
    return x*f;
}
inline void write(int a)
{
    if(a<0)
    {
		putchar('-');
		putchar('1');
    }
    else
    {
		if(a>=10)
			write(a/10);
		putchar(a%10+'0');
    }
}
signed main()
{
	n=read();
	for(int i=1;i<=n;++i)
		a[i]=read();
	for(int i=1;i<=n;++i)
	{
		if(a[i]<=i)
			ans+=tong[-a[i]+i];
		++tong[a[i]+i];
	}
	write(ans);
	return 0;
}


Measured memory_bytes: 18800
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  priority_queue<double, vector<double>, greater<double>> v;
  for (int i = 0; i < n; i++) {
    double x;
    cin >> x;
    v.push(x);
  }
  while (v.size() != 1) {
    double x = v.top();
    v.pop();
    double y = v.top();
    v.pop();
    v.push((x + y) / 2.0);
  }
  printf("%.10lf\n", v.top());
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int n = in.nextInt();
            int h[] = new int[n];
            for (int i = 0; i < n; i++)
            {
                h[i] = in.nextInt();
            }
            int max = 0;
            int localMax = 0;
            int current = h[0];
            for (int i = 1; i < h.length; i++)
            {
                if (current < h[i])
                {
                    max = Math.max(max, localMax);
                    localMax = 0;
                } else
                {
                    localMax++;
                }
                current = h[i];
            }
            max = Math.max(max, localMax);
            out.print(max);
        }

    }
}



Measured memory_bytes: 52400
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

/*
すぬけ君はこのマス目を圧縮しようとしています。
そのために、白いマスのみからなる行または列が存在する間、次の操作を繰り返し行います。
操作: 白いマスのみからなる行または列をひとつ任意に選び、その行または列を取り除いて空白を詰める。
*/

int main(){
    int H,W;cin>>H>>W;
    vector<vector<char>> a(H,vector<char>(W));
    REP(i,H){
        REP(j,W){
            cin>>a[i][j];
        }
    }

    REP(i,H){//行を操作
        int cnt = 0;
        for(int j=0;j< W;j++){
            if(a[i][j] == '.' or a[i][j] == 'd' ) cnt++;
        }
        if(cnt == W){
            //delete
            for(int j=0;j< W;j++){
            a[i][j] = 'd';
            }
        }
    }

    REP(j,W){//列を操作
        int cnt = 0;
        for(int i=0;i< H;i++){
            if(a[i][j] == '.'  or a[i][j] == 'd') cnt++;
        }
        if(cnt == H){
            //delete
            for(int i=0;i< H;i++){
            a[i][j] = 'd';
            }
        }
    }
    REP(i,H){
        int flag = 0;
        REP(j,W){
            if(a[i][j] != 'd'){
                cout<<a[i][j];
                flag ++;
            }
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <set>
#include <map>
#include <bitset>

using namespace std;

typedef long long LL;

#ifdef __GNUC__
#define popcount __builtin_popcount
#elif _MSC_VER >= 1400
#include <intrin.h>
#define popcount __popcnt
#else
static inline int popcount(unsigned int b) {
	b = (b & 0x55555555) + (b >> 1 & 0x55555555);
	b = (b & 0x33333333) + (b >> 2 & 0x33333333);
	b = (b & 0x0F0F0F0F) + (b >> 4 & 0x0F0F0F0F);
	b += b >> 8;
	return (b + (b >> 16)) & 0x3F;
}
#endif

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int n = -1;
		cin >> n;
		if (n < 0) return 0;
		string x;
		cin >> x;
		int cnt = count(x.begin(), x.end(), '1');
		vector<vector<int>> m(2, vector<int>(n, 1));
		int d[2] = { max(cnt - 1, 1), cnt + 1 };
		int r[2] = {};
		for (int i = 0; i < n; ++i) {
			if (i) {
				for (int j = 0; j < 2; ++j) {
					m[j][i] = (m[j][i - 1] * 2) % d[j];
				}
			}
			if (x[n - 1 - i] != '0') {
				for (int j = 0; j < 2; ++j) {
					r[j] = (r[j] + m[j][i]) % d[j];
				}
			}
		}
		for (int i = 0; i < n; ++i) {
			int ans = 0;
			if (cnt == 0) {
				ans = 1;
			} else if (cnt == 1 && x[i] != '0') {
				;
			} else {
				++ans;
				int a;
				if (x[i] != '0') {
					// 1 -> 0
					a = (r[0] - m[0][n - 1 - i] + d[0]) % d[0];
				} else {
					// 0 -> 1
					a = (r[1] + m[1][n - 1 - i]) % d[1];
				}
				while (a) {
					++ans;
					a = a % popcount(a);
				}
			}
			cout << ans << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 5892
/*
                   _ooOoo_
                  o8888888o
                  88" . "88　AC!AC!
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
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; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
int main(){
    ll a,b;
    cin>>a>>b;
    ll res;
    if((a&1)&&(b&1))res=a^((b-a)/2%2);
    if((a&1)&&!(b&1))res=a^((b-1-a)/2%2)^b;
    if(!(a&1)&&(b&1))res=((b-a+1)/2%2);
    if(!(a&1)&&!(b&1))res=((b-a)/2%2)^b;
    cout<<res<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d  = sc.nextInt();
        if (d != 25)
            if (d != 24)
                if (d != 23)
                    System.out.println("Christmas Eve Eve Eve");
                else
                    System.out.println("Christmas Eve Eve");
            else
                System.out.println("Christmas Eve");
        else
            System.out.println("Christmas");
    }
}









Measured memory_bytes: 21844
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric> // 最大公約数が使える
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

int main()
{
    string S,T;
    cin >> S >> T;



    
    int a = S.size();
    int b = T.size();
    int ans = 1;

    for (int i = 0; i < a; i++)
    {
        if (S[i]!=T[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    
    
    
    /*
    int ans = 1;
    for (int i = 0; i < a-1; i++)
    {
        if (S[i] == T[i])
        {
            ans = 1;
        }else
        {
            ans = 0;
            break;
            cout << "No" << endl;
            return 0;
        }
    }
    if (ans == 1)
    {
        if ((a+1)==b)
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
    }
    cout << "No" << endl;
    */
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int n=700;
    if(s[0]=='o')
    {
        n+=100;
    }
    if(s[1]=='o')
    {
        n+=100;
    }
    if(s[2]=='o')
    {
        n+=100;
    }
    cout<<n<<endl;
    return 0;
}

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

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define MP make_pair
#define PB push_back
#define POB pop_back
#define FI first
#define SE second
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;

const double PI = acos(-1);
const double EPS = 1e-9;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

///////////////////////////////////////////////////////

int a[5];

int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	FOR(i,3) cin >> a[i];
	sort(a,a+3);
	if(a[0] == 5 && a[1] == 5 && a[2] == 7) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"errors"
	"fmt"
	"os"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	if s[:1] != "d" && s[:1] != "e" {
		fmt.Println("NO")
		os.Exit(0)
	}

	for {
		var err error
		s, err = removeMatchedStr(s)
		if err != nil {
			fmt.Println("NO")
			os.Exit(0)
		}
		if len(s) == 0 {
			break
		}
	}
	fmt.Println("YES")
}

func removeMatchedStr(s string) (string, error) {
	if s == "dreamer" || s == "dream" || s == "eraser" || s == "erase" {
		return "", nil
	}

	if strings.HasSuffix(s, "dreamer") {
		return strings.TrimSuffix(s, "dreamer"), nil
	}

	if strings.HasSuffix(s, "dream") {
		return strings.TrimSuffix(s, "dream"), nil
	}

	if strings.HasSuffix(s, "eraser") {
		return strings.TrimSuffix(s, "eraser"), nil
	}

	if strings.HasSuffix(s, "erase") {
		return strings.TrimSuffix(s, "erase"), nil
	}

	return "", errors.New("string is not found")
}


Measured memory_bytes: 1280