akhauriyash/Code-Regression huggingface dataset:
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + 10;
int h, w;
string a[10];
void yes() {
    cout << "Possible" << endl;
}
void no() {
    cout << "Impossible" << endl;
}
void solve() {
    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> a[i];
    int last = 0;
    for (int i = 0; i < h; i++) {
        int now = 0, s = -1;
        for (int j = 0; j < w; j++) {
            if(a[i][j] == '#') {
                now = j;
                if(s == -1)
                    s = j;
            }
        }
        if(s < last) {
            no(); return;
        }
        last = now;
    }
    yes();
}
int main() {
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    solve();
    return 0;
}


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

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

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

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

	if (abs(a - x) > (abs(b - x))) {
		out("B");
	}
	else {
		out("A");
	}

	return 0;
}

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

int * vec;
int n;
long long ans = 0;

bool check_mon_up(int * start, int * end)
{
	if (end - start <= 1)
		return true;
	
	for (auto i = start; i < end - 1; i++)
		if (*i >= *(i + 1))
			return false;
	return true;
}

bool chec_mon_do(int * start, int * end)
{
	if (end - start <= 1)
		return true;

	for (auto i = start; i < end - 1; i++)
		if (*i <= *(i + 1))
			return false;
	return true;
}

int * m_find_max(int * start, int * end)
{
	int max = -1;
	int * numb = nullptr;
	for (int * i = start; i < end; i++)
		if (max < *i) max = *i, numb = i;
	return numb;
}

void m_find_two_max(int * start, int * end, int *& max, int *& tax)
{
	int mm = -1, mt = -1;
	for (int * i = start; i < end; i++)
	{
		if (*i > mm)
		{
			mt = mm;
			mm = *i;
			tax = max;
			max = i;
		}
		else if (*i > mt)
		{
			mt = *i;
			tax = i;
		}
	}
}

void m_find_tax(int * start, int * end, int * max, int *& tax)
{
	int mm = *max, mt = -1;
	for (int * i = start; i < end; i++)
		if (*i > mt)
			if (i != max)
			{
				tax = i;
				mt = *i;
			}
}

void fu(int * start, int * end, int * max)
{
	if (end - start == 1)
		return;
	int * tax = 0;
	m_find_tax(start, end, max, tax);
	if (tax == max)
		return;
	if (tax > max)
	{
		ans += (long long)(*tax) * (max - start + 1) * (end - tax);
		fu(start, tax, max);
	}
	else
	{
		ans += (long long)(*tax) * (tax - start + 1) * (end - max);
		fu(tax + 1, end, max);
	}
	return;
}

void func(int * start, int * end)
{
	if (end - start <= 1)
		return;
	if (end - start == 2)
	{
		ans += (long long)std::min(*(end - 1), *start);
		return;
	}
	if (check_mon_up(start, end))
	{
		for (int i = 0; i < end - start - 1; i++)
			ans += (long long)(*(start + i)) * (i + 1);
		return;
	}
	if (chec_mon_do(start, end))
	{
		for (int i = 1; i < end - start; i++)
			ans += (long long)(*(start + i)) * (end - start - i);
		return;
	}
	int * max = m_find_max(start, end);
	fu(start, end, max);
	func(start, max);
	func(max + 1, end);
	return;
}

int main()
{
	std::cin >> n;
	vec = new int[n];
	int * const start = vec;
	int * const end = vec + n;
	for (int * i = start; i < end; i++)
		scanf("%lld", i);
	func(start, end);
	std::cout << ans;
	return 0;
}

Measured memory_bytes: 640
///
// File:  c.go
// Author: ymiyamoto
//
// Created on Sat Jun 16 23:19:12 2018
//
package main

import "fmt"

var N int
var arr []int

func pow2(n int) int {
	ret := 0
	for n%2 == 0 {
		n /= 2
		ret++
	}
	return ret
}
func main() {
	fmt.Scan(&N)

	ans := 0
	for i := 0; i < N; i++ {
		var a int
		fmt.Scan(&a)
		ans += pow2(a)

	}
	fmt.Println(ans)
}



Measured memory_bytes: 1280
# AtCoder Beginner Contest 087
# C - Candies

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

p=[]

for i in range (N):
    tempA=A[:1+i]
    tempB=B[0+i:]
    # print(tempA,tempB)
    p.append(sum(tempA)+sum(tempB))

print(max(p))

Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=10010000;
const ll mod=1000000007;

int main(){
  ll n;
  cin>>n;
  string s;
  cin>>s;
  
  ll cr=0;
  ll cw=0;
  ll ans=0;
  
  rep(i,n){
    if(s[i]=='R') cr++;
    else cw++;
  }
  
  rep(i,cr){
    if(s[i]=='W') ans++;
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3756
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


typedef struct tag_vertex_t
{
	int id, is_passed;
	int edge_num, *edge;
}vertex_t;


#define N_MAX 100000
#define M_MAX 100000

int n, m;
vertex_t vertex[N_MAX+1];
int result[N_MAX];
int result_num;


void result_init(void)
{
	result_num=0;
}


void result_push_back(int x)
{
	result[result_num++]=x;
}


void result_push_front(int x)
{
	memmove(result+1, result, sizeof(result[0])*result_num);
	result[0]=x;
	result_num++;
}


int result_pop_back(void)
{
	if(result_num<=0) return -1;
	return result[--result_num];
}


void edge_add(vertex_t *vert, int to)
{
	vert->edge=realloc(vert->edge, sizeof(int)*(vert->edge_num+1));
	vert->edge[vert->edge_num++]=to;
}


void vertex_zero(vertex_t *vert)
{
	free(vert->edge);
	memset(vert, 0, sizeof(*vert));
}


void trace(int s, void (*func)(int))
{
	int i;

	for(;;)
	{
		func(s);
		vertex[s].is_passed=1;
		for(i=0;i<vertex[s].edge_num;i++)
		{
			if(vertex[vertex[s].edge[i]].is_passed) continue;
			break;
		}
		if(i>=vertex[s].edge_num) break;
		s=vertex[s].edge[i];
	}
}


int main(void)
{
	int a, b, i, c=0;

	while(scanf("%d%d", &n, &m)==2)
	{
		result_init();
		for(i=0;i<n;i++)
		{
			vertex_zero(&vertex[i]);
		}

		for(i=0;i<m;i++)
		{
			scanf("%d%d", &a, &b);
			edge_add(&vertex[a], b);
			edge_add(&vertex[b], a);
			c=a;
		}

		trace(c, result_push_front);
		result_pop_back();
		trace(c, result_push_back);

		printf("%d\n%d", result_num, result[0]);
		for(i=1;i<result_num;i++) printf(" %d", result[i]);
		printf("\n");
	}

	return 0;
}


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

std::string enc[] = { "101", "000000", "000011", "10010001", "010001", "000001", "100101", "10011010", "0101", "0001", "110", "01001", "10011011", "010000", "0111", "10011000", "0110", "00100", "10011001", "10011110", "00101", "111", "10011111", "1000", "00110", "00111", "10011100", "10011101", "000010", "10010010", "10010011", "10010000" };
std::string str = " \',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::string symbol = " .,-\'?";

std::string bin( int n )
{
	std::string ret( 5, '0' );
	int cnt = 0;

	while( n > 0 )
	{
		ret[cnt++] = ( n & 1 ) + '0';
		n >>= 1;
	}

	std::reverse( ret.begin(), ret.end() );

	return ret;
}

int main()
{
	std::string s;
	while( std::getline( std::cin, s ) )
	{
		std::string code;
		for( int i = 0; i != s.size(); ++i )
			code += s[i] >= 'A' && s[i] <= 'Z' ? bin( s[i] - 'A' ) : bin( 26 + symbol.find( s[i] ) );
	
		std::string ans;

		int i;
		for( i = 0; i < code.size(); ++i )
		{
			std::string t;

			for( int j = i; j < code.size(); ++j )
			{
				t += code[j];

				std::string* it;
				if( ( it = std::find( enc, enc + 32, t ) ) != enc + 32 )
					ans += str[it - enc], i = j;
			}
		}

		std::cout << ans << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    vector<int> w, s;
    a *= 100; b *= 100;
    for(int i = 0; i <= f; i++){
        for(int j = 0; j <= f; j++){
            if(i * a + b * j <= f) w.push_back(i * a + b * j);
            if(i * c + d * j <= f) s.push_back(i * c + d * j);
        }
    }
    // for(int ii = 0; ii < w.size(); ii++){
    //     if(ii) cout << ' ';
    //     cout << w[ii];
    // }
    // for(int ii = 0; ii < s.size(); ii++){
    //     if(ii) cout << ' ';
    //     cout << s[ii];
    // }
    cout << endl;
    cout << endl;
    double MAX = -1.0;
    int ans_water = 0, ans_salt = 0;    
    rep(i, 0, w.size()){
        rep(j, 0, s.size()){
            if(w[i] == 0 && s[j] == 0) continue;
            if(w[i] / 100 * e < s[j]) continue;
            if(w[i] + s[j] > f) continue;
            double tmp = 100.0 * s[j] / (1.0 * (s[j] + w[i]));
            if(tmp > MAX){
                MAX = tmp; ans_water = w[i]; ans_salt = s[j];
            }
        }
    }
    cout << ans_water + ans_salt << " " << ans_salt << endl;
}

Measured memory_bytes: 2420
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#include <sstream>
#include <bitset>
#include<bits/stdc++.h>
using namespace std;
int num[1000010];
int book[1000010];
int main()
{
    int n; 
    cin>>n;
    for(int i=0;i<n;i++)
	{
        cin>>num[i];
        book[num[i]]++;
    }
    int tmp=0;
    int res=0;
    if(n==1) cout<<1<<endl;
    else
	{
        for(int i=1;i<1000010;i++)
		{
            tmp=book[i]+book[i-1]+book[i+1];
            if(tmp>res) res=tmp;
        }
        cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 4736
h,w=map(int,input().split())
a=[[i for i in input()] for i in range(h)]
i=0
j=0
a[0][0]="."
while not(i==h-1 and j==w-1):
    if(i==h-1):
        if(a[i][j+1]=="#"):
            a[i][j+1]="."
            j+=1
        else:
            print("Impossible")
            break
    elif(j==w-1):
        if(a[i+1][j]=="#"):
            a[i+1][j]="."
            i+=1
        else:
            print("Impossible")
            break
    else:
        if(a[i][j+1]=="#" and not a[i+1][j]=="#"):
            a[i][j+1]="."
            j+=1
        elif(not a[i][j+1]=="#" and a[i+1][j]=="#"):
            a[i+1][j]="."
            i+=1
        else:
            print("Impossible")
            break
else:
    if any("#" in i for i in a):
        print("Impossible")
    else:
        print("Possible")

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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; }



void func(long long S, long long W){

    if(W>=S)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;

    return;

}

int main(){
    // cout << fixed << setprecision(5);

    long long S;
    scanf("%lld",&S);
    long long W;
    scanf("%lld",&W);
    func(S, W);
    return 0;
}


Measured memory_bytes: 3768
#include<iostream>
using namespace std;
int main(){
	int f[3],team[100]={0},max;
	int Q,i,j,k;
	cin>>Q;
	for(i=0;i<Q;i++){
		for(j=0;j<3;j++){
			cin>>f[j];
		}
		while(1){
				if(f[2]>0&&f[1]>0&&f[0]>0){
					f[0]--;
					f[1]--;
					f[2]--;
					team[i]++;
				}
				else if(f[0]>1&&f[1]>0){
					f[0]=f[0]-2;
					f[1]--;
					team[i]++;
				}
				else if(f[0]>2){
					f[0]=f[0]-3;
					team[i]++;
				}
				else{
					break;
				}
			}
		}
	for(i=0;i<Q;i++){
		cout<<team[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3096
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin); i < (end); i++)
#define _irep3(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

vector<vector<int>> nodes(100000, vector<int>());

bool findPath(int target, int node, vector<int> &path, int from) {
  if (node == target) {
    path.push_back(node);
    return true;
  }
  rep(i, nodes[node].size()) {
    if (nodes[node][i] == from) continue;
    if (findPath(target, nodes[node][i], path, node)) {
      path.push_back(node);
      return true;
    }
  }
  return false;
}

int maxDistance(int from, int node) {
  vector<int> dist;
  rep(i, nodes[node].size()) {
    if (nodes[node][i] != from) {
      dist.push_back(maxDistance(node, nodes[node][i]));
    }
  }
  if (dist.size() == 0) {
    return 0;
  }
  int maxDist = 0;
  rep(i, dist.size()) {
    maxDist = max(maxDist, dist[i]);
  }
  return maxDist + 1;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

  int N, u, v;
  cin >> N >> u >> v;
  u--;
  v--;
  vector<int> A(N - 1), B(N - 1);
  rep(i, N - 1) {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
    nodes[A[i]].push_back(B[i]);
    nodes[B[i]].push_back(A[i]);
  }

  vector<int> utov;
  findPath(u, v, utov, -1);

  int dist = utov.size() - 1;
  if (dist % 2 == 0) {
    out(maxDistance(utov[dist / 2], utov[dist / 2 - 1]) + dist / 2);
  } else {
    out(maxDistance(utov[dist / 2 + 1], utov[dist / 2]) + dist / 2);
  }
}


Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
int main()
{
int h,n;
  cin>>h>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  if(accumulate(a,a+n,0)>=h)
    cout<<"Yes";
  else
    cout<<"No";
}

Measured memory_bytes: 640
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 1e5 + 5, mod = (int) 0;
int a[N];
int main() {
	int n, res = 0;
	cin >> n;
	for (int j = 0; j < n; ++j) cin >> a[j];
	for (int mask = 0; mask < (1 << n); ++mask) {
		for (int sub = mask; ; sub = (sub - 1) & mask) {
			int flag = 0;
			for (int j = 0; j < n; ++j) {
				int x = a[j] + (mask >> j & 1) + (sub >> j & 1) - 1;
				if (~x & 1) flag = 1;
			}
			res += flag;
			if (sub == 0) break;
		}
	}
	cout << res << endl;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    vint l(n);
    rep(i,n) cin >> l[i];
    n = l.size();
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                int a = l[i], b = l[j], c = l[k];
                if (a == b || b == c || a == c) continue;
                if (((a+b) > c) && ((b+c) > a) && ((a+c) > b)) ans++;
            }
        }
    }
    cout << ans << endl;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<P, ll> PPI;
typedef pair<ll, P> IPP;

#define INF INT_MAX/3

#define MAX_N 1000

int n;
set<PPI> mem;

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>n;
		if(n==0)break;
		mem.clear();
		mem.insert(PPI(P(0,1e9+10),-1));
		rep(i,n){
			char op;
			cin>>op;
			if(op=='W'){
				ll file,sizes;
				cin>>file>>sizes;
				bool end=false;
				vector<PPI> later,later2;
				each(it,mem){
					if(it.se==-1){
						int idx=it.fi.fi,maxsize=it.fi.se;
						if(maxsize>sizes){
							later.pb(PPI(P(idx,sizes),file));
							later.pb(PPI(P(idx+sizes,maxsize-sizes),-1));
							end=true;
						}else{
							later.pb(PPI(P(idx,maxsize),file));
							sizes-=maxsize;
							if(sizes==0)end=true;
						}
						later2.pb(it);
					}
					if(end)break;
				}
				rep(i,later.size())mem.insert(later[i]);
				rep(i,later2.size())mem.erase(later2[i]);
			}else if(op=='D'){
				ll file;
				vector<PPI> later,later2;
				cin>>file;
				each(it,mem){
					if(it.se==file){
						later.pb(PPI(P(it.fi.fi,it.fi.se),-1));
						later2.pb(it);
					}
				}
				rep(i,later.size())mem.insert(later[i]);
				rep(i,later2.size())mem.erase(later2[i]);
			}else if(op=='R'){
				ll sec;
				cin>>sec;
				each(it,mem){
					if(it.fi.fi<=sec&&sec<it.fi.fi+it.fi.se){
						cout<<it.se<<endl;
						break;
					}
				}
			}
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 3748
import sys
sys.setrecursionlimit(1000000000)
from itertools import count
from functools import lru_cache
from collections import defaultdict
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#


def main():
    print(ii()**2)


main()


Measured memory_bytes: 3700
#include<stdio.h>
//#include<cstdlib>
// 0オリジンなことに注意！！！

#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[MAX][MAX];
int color[MAX], d[MAX], f[MAX], time = 0; // d : discovered time  f : finishing time

void dfs_visit(int u){
    int i;
    
    color[u] = GRAY;
    //printf("%d is discovered\n", u+1);
    d[u] = ++time;
    
    for (i = 0; i < n; i++) {
        if(M[u][i] == 1){ // uの隣にiがあったら
            if (color[i] == WHITE) { // 未探索なら
                dfs_visit(i);
            }
        }
    }
    color[u] = BLACK;
    //printf("%d is finishing\n", u+1);
    f[u] = ++time;
}

void dfs(){
    int u, i;
    // init
    for (u = 0; u < n; u++) {
        color[u] = WHITE;
    }
    
    for (u = 0; u < n; u++) {
        if(color[u] == WHITE){
            dfs_visit(u);
        }
    }
    
    for (i = 0; i < n; i++) {
        printf("%d %d %d\n", i+1, d[i], f[i]);
    }
}


int main(){
    int i, j, m, a;
    
    scanf("%d", &n);
    // init
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            M[i][j] = 0;
        }
    }
    // read
    for(i = 0; i < n; i++){
        scanf("%d %d", &m, &m); // First m is dammy
        for(j = 0; j < m; j++){
            scanf("%d", &a);
            M[i][a-1] = 1;
        }
    }
#ifdef D
    // どういう風にグラフが格納されてるか見る
    for(i = 0; i < n; i++){
        for(j = 0; j < n; j++){
            printf("%d ", M[i][j]);
        }
        printf("\n");
    }
#endif
    
    dfs();
    
    return 0;
}



Measured memory_bytes: 2748
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, -1, 0, 1};
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

int cnt[111];

void no() {
    cout << "Impossible" << endl;
    exit(0);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vi A(N);
    int maxi = -1;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        maxi = max(maxi, A[i]);
        cnt[A[i]]++;
    }
    if (cnt[maxi] < 2) no();
    cnt[maxi] -= 2;
    if (maxi % 2 == 0) {
        int now = maxi-1;
        while (now > maxi/2) {
            if (cnt[now] < 2) no();
            cnt[now--] -= 2;
        }
        if (cnt[now] < 1) no();
        cnt[now] -= 1;
    } else {
        int now = maxi-1;
        while (now > maxi/2) {
            if (cnt[now] < 2) no();
            cnt[now--] -= 2;
        }
    }
    for (int i = 1; i < (maxi+1)/2+1; i++)
        if (cnt[i]) no();
    cout << "Possible" << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#include <bits/stdc++.h>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> cards(N);
	REP(i, N) cin >> cards[i];
	sort(ALL(cards));
	reverse(ALL(cards));

	int alice = 0, bob = 0;
	REP(i, N) {
		if (i%2 == 0) alice += cards[i];
		else bob += cards[i];
	}
	
	cout << alice - bob << endl;
}

Measured memory_bytes: 256
main = getLine >> getLine >>= (\(_, y, _) -> print y) . foldr (ff . read) (0, 0, 0) . words
    where
        ff z (v, n, x)
            | z > x = (v, n, z)
            | v < d = (d, 1, x)
            | v == d = (v, n + 1, x)
            | otherwise = (v, n, x)
            where
                d = x - z


Measured memory_bytes: 58748
#include <iostream>
#include <limits>
#include <vector>
#include <stack>
#include <algorithm>
#include <array>
#include <queue>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cassert>

typedef uint_fast64_t u64;
typedef int_fast64_t i64;
typedef uint_least32_t u32;
typedef int_fast32_t i32;
typedef uint_least16_t u16;
typedef int_fast16_t i16;
typedef uint_least8_t u8;
typedef int_fast8_t i8;



int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  u64 n;
  std::cin >> n;
  std::vector<std::pair<bool, bool>> strs(n);
  std::string s;

  u64 cnt=0, cb=0, ca=0, ct=0, cn=0;
  for (u64 i=0;i<n;++i) {
    std::cin >> s;
  for (u64 i=0; i<s.size()-1;++i) if (s[i]=='A' && s[i+1]=='B') ++cnt;
  strs[i] = std::make_pair(s.back()=='A', s[0]=='B');
  if (s.back()=='A' && s[0]=='B') ct++;
  else if (s.back()=='A') ca++;
  else if (s[0]=='B') cb++;
  else cn++;
  }
  bool sta=false;
  if (ca!=0) {sta=true; --ca;}
  else if (cn !=0) --cn;
  else if (ct !=0 ) {sta=true; --ct;}
  else --cb;

  while (ct!=0) {
    if (sta) ++cnt;
    --ct;
    sta=true;
  }
  if (sta && cb!=0) {--cb;++cnt;}
  while (cb!=0 && ca!=0) {
    --cb;
    --ca;
    ++cnt;
  }

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

Measured memory_bytes: 256
import heapq
def main():
    H, W, M = map(int, input().split())

    bn_h = {}
    bn_v = {}

    for i in range(M):
        h, w = map(int, input().split())
        bn_h.setdefault(h, set())
        bn_h[h].add(w)
        bn_v.setdefault(w, set())
        bn_v[w].add(h)

    b1 = sorted(bn_h.items(), key = lambda x:len(x[1]), reverse=True)
    b2 = sorted(bn_v.items(), key = lambda x:len(x[1]), reverse=True)

    m1 = len(b1[0][1])
    m2 = len(b2[0][1])

    flag = False
    max_result = 0
    for i in b1:
        h, sh = i
        if len(sh) < m1:
            break
        for j in b2:
            v, sv = j
            if len(sv) < m2:
                break
            result = len(sh) + len(sv) - 1
            if h not in sv:
                result += 1
                flag = True
            max_result = max(max_result, result)
            if flag == True:
                break
        if flag == True:
            break
    print(max_result)

if __name__ == '__main__':
    main()

Measured memory_bytes: 226736
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(ll i=(begin),i##_end_=(end);i<i##_end_;i++)
#define RFOR(i, begin, end) for(ll i=(end)-1, i##_begin_=(begin);i>=i##_begin_;i--)
#define rep(i, N) FOR(i, 0, N)
#define rrep(i, N) RFOR(i, 0, N)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
using namespace std;
using ll = long long int;
using V = vector<ll>;
using P = pair<ll, ll>;
using VP = vector<P>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
constexpr int inf = 1e9;
constexpr int mod = 1e9+7;
ll gcd(ll a, ll b) { return b? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}


int main() {
    ll n;
    string s;
    cin >> n >> s;

    ll ret = 0;
    rep(d, n) {
        ll cnt = 0;
        rep(i, n-d) {
            if(s[i] == s[i+d]) cnt++;
            else cnt = 0;
            ret = max(ret, min(cnt, d));
        }
    }
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
void outvi(vi v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
void outvvi(vvi v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll a,b;cin>>a>>b;
    if(a*500>=b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    string ans = "No";
    if(a == b && b != c) ans = "Yes";
    else if(b == c && c != a) ans = "Yes";
    else if(c == a && a != b) ans = "Yes";
    cout << ans << endl;
    return 0;
}


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

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

    // 引数の受け取り
    //
    cin >> N ;


    // 出力
    cout << (N*800-  N/15*200) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	std::string s; cin >> s;

	for(auto& c: s) if(c == '?') c = 'D';

	printf("%s\n", s.c_str());
	return 0;
}


Measured memory_bytes: 3756
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 1010;
const int INF = 1E+9;

int H,W;
char mp[N][N];
struct edge{
	int x,nxt,f;
}e[N*N*2];
int h[N*2],tot,st,ed;
int dis[N*2],que[N*2];
bool pd[N*2];

void addedge(int x,int y,int f){e[++tot].x=y;e[tot].f=f;e[tot].nxt=h[x];h[x]=tot;}

void inse(int x,int y,int f){addedge(x,y,f),addedge(y,x,0);}

bool bfs(){
	int he=0,ta=1;
	fo(i,st,ed)dis[i]=INF,pd[i]=0;
	que[1]=st,pd[st]=1,dis[st]=0;
	for(;he!=ta;){
		int x=que[he=he%(ed+1)+1];
		pd[x]=0;
		for(int p=h[x];p;p=e[p].nxt)
		if (e[p].f&&dis[e[p].x]==INF){
			dis[e[p].x]=dis[x]+1;
			if (!pd[e[p].x]){
				pd[e[p].x]=1;
				que[ta=ta%(ed+1)+1]=e[p].x;
			}
		}
	}
	return dis[ed]<INF;
}

int aug(int x,int f){
	if (x==ed)return f;
	int ans=0;
	for(int p=h[x];p;p=e[p].nxt)
	if (e[p].f&&dis[e[p].x]==dis[x]+1){
		int o=aug(e[p].x,min(f,e[p].f));
		f-=o,ans+=o;
		e[p].f-=o,e[p^1].f+=o;
		if (!f)return ans;
	}
	return ans;
}

int main(){
	H=get();W=get();
	st=0,ed=H+W+1;
	tot=1;
	fo(i,1,H){
		scanf("%s",mp[i]+1);
		fo(j,1,W){
			if (mp[i][j]=='S')inse(st,i,INF),inse(st,j+H,INF);
			if (mp[i][j]=='T')inse(i,ed,INF),inse(j+H,ed,INF);
			if (mp[i][j]=='o')inse(i,H+j,1),inse(j+H,i,1);
		}
	}
	int ans=0;
	while(bfs())ans=ans+aug(st,INF);
	if (ans>=INF)ans=-1;
	printf("%d\n",ans);
	return 0;
}

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

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

  int N, D, X;
  cin >> N;
  cin >> D >> X;
  int ans = X;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    int j = 0;
    while(j * a + 1 <= D){
      ans++;
      j++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define il inline
#define LL long long
#define ULL unsigned LL
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>
#define fi first
#define se second
using namespace std;
il int read() {
	int res = 0,f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
	while (isdigit(ch)) {res = res*10+ch-'0'; ch = getchar();} return res*f;
}
namespace qiqi {
	const int N = 5005,P = 1e9+7; int n,ecnt,head[N],f[N][N],g[N],h[N],siz[N]; struct Edge {int v,nxt;} e[N<<1]; il void add(int u,int v) {e[++ecnt] = (Edge){v,head[u]}; head[u] = ecnt;}
	void dfs(int u,int fa) {
		f[u][siz[u] = 1] = 1; grep(k,u) if (v != fa) {
			dfs(v,u); rep(i,1,siz[u]) {h[i] = f[u][i]; f[u][i] = 0;}
			rep(i,0,siz[u]) rep(j,0,siz[v]) f[u][i+j] = (f[u][i+j]+1LL*h[i]*f[v][j]%P)%P; siz[u] += siz[v];
		}
		rep(i,1,siz[u]>>1) f[u][0] = (f[u][0]-1LL*f[u][i<<1]*g[i]%P)%P;
	}
	void main() {n = read(); g[0] = 1; rep(i,0,n>>1) g[i+1] = 1LL*(i<<1|1)*g[i]%P; rep(i,1,n-1) {int u = read(),v = read(); add(u,v); add(v,u);} dfs(1,0); printf("%d\n",(-f[1][0]+P)%P);}
}
int main() {qiqi::main(); return 0;}

Measured memory_bytes: 58268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()

const string YES = "Yes";
const string NO = "No";

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

    vector<ll> a(n), b(n);
    REP(i, n){
        cin >> a.at(i);
    }
    REP(i, n){
        cin >> b.at(i);
    }

    ll ma = 0, mb = 0;
    REP(i, n){
        if(a.at(i) < b.at(i)){
            ma += (b.at(i) - a.at(i) + 1) / 2;
            mb += (b.at(i) - a.at(i)) % 2;
        }else if(b.at(i) < a.at(i)){
            mb += a.at(i) - b.at(i);
        }
    }

    if(mb > ma){
        cout << NO << endl;
    }else{
        cout << YES << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <queue>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define set0(x) memset(x,0,sizeof(x))
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();int f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
int mod = 1000000007;
const int N = 1000010;
int n,inv[N],invfac[N],fac[N];
inline int sq(int x){return 1ll*x*x%mod;}
inline int sub(int a,int b){return a<b?a-b+mod:a-b;}
inline int add(int a,int b){return a+b>=mod?a+b-mod:a+b;}
inline int mul(int a,int b){return 1ll*a*b%mod;}
inline int pow(int a,int b){if(b == 0)return 1;return b&1?mul(sq(pow(a,b/2)),a):sq(pow(a,b/2));}
inline int C(int n,int m){return mul(fac[n],mul(invfac[m],invfac[n-m]));}
int dp[N][3] = {0};
int main() {
	read(n);
	inv[1] = fac[1] = fac[0] = invfac[1] = invfac[0] = 1;
	for(int i=2;i<N;i++){
		inv[i] = (1ll*(mod-mod/i)*inv[mod%i])%mod;
		invfac[i] = mul(invfac[i-1],inv[i]);
		fac[i] = mul(fac[i-1],i);
	}
	int ans = 0;
	dp[0][0] = 1;
	for(int i=1;i<=n;i++){
		dp[i][0] = add(dp[i-1][1],dp[i-1][2]);
		dp[i][1] = add(dp[i-1][0],dp[i-1][2]);
		dp[i][2] = add(dp[i-1][1],dp[i-1][0]);
		ans = add(ans,mul(mul(dp[i][1],C(n,i)),pow(mul(3,mul(n,i)),mod-2)));
	}
	cout<<mul(ans,pow(pow(3,mod-2),n-1))<<endl;
	return 0;
}


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

using namespace std;
using ll = long long;

#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


int main()
{
    ll H, W;
    cin >> H >> W;
    vector<string> S(H+1);
    REP(h,0,H) cin >> S[h];

    vector<vector<ll>> dp(H+1, vector<ll>(W+1, 0));
    dp[0][0] = 1;
    REP(h,0,H) {
        REP(w,0,W) {
            if (S[h][MIN(w+1,W-1)] == '.') dp[h][w+1] = (dp[h][w+1] + dp[h][w]) % MOD;
            if (S[MIN(h+1,H-1)][w] == '.') dp[h+1][w] = (dp[h+1][w] + dp[h][w]) % MOD;
        }
    }

    _PR(dp[H-1][W-1]);

    return 0;
}

/*



*/

Measured memory_bytes: 9216
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
using namespace std;
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    int ans=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(j!=i && a[j]!=a[i])
            {
                for(int k=j+1;k<n;k++)
                {
                    if(k!=j && a[k]!=a[j] && a[i]!=a[k])
                    {
                        if(a[i]+a[j]>a[k])
                        {
                            if(a[j]+a[k]>a[i])
                            {
                                if(a[k]+a[i]>a[j])
                                {
                                    ans++;
                                }
                            }
                        }
                    }
                }
            }
        }
    }    
    cout<<ans;
    return 0;
}

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

int main(){
  int N;
  cin>>N;
  priority_queue<int,vector<int>,greater<int>> u;
  for(int i=0;i<N;i++){
    int j;
    cin>>j;
    u.push(j);
  }
  double j=(double)u.top();
  u.pop();
  for(int i=0;i<N-1;i++){
    j=(j+u.top())/2;
    u.pop();
  }
  cout<<j<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
    double a,b,c,d,e,f,aa,bb,cc,x,y,bai;
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
        bai=d/a;
        aa=a*bai;
        bb=b*bai;
        cc=c*bai;
        y=(f-cc)/(e-bb);
        x=(c-b*y)/a;
        printf("%.3f %.3f\n",x,y);
    }
        
        
        
        
    
    
    
}


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

int main() {
	int a, b;
	while (cin >> a >> b,a|b) {
		int c[100][100];
		for (int x = 0; x < a; x++) {
			for (int y = 0; y < a; y++) {
				c[x][y]=1<<29;
			}
		}
		for (int e = 0; e < b; e++) {
			int f;
			cin >> f;
			if (f==0) {
				int g, h;
				cin >> g >> h;
				g--; h--;
				if (c[g][h] != 1 << 29)cout << c[g][h] << endl;
				else cout << -1 << endl;
			}
			else {
				int g, h,i;
				cin >> g >> h >> i;
				g--; h--;
				if (c[g][h] > i) {
					c[g][h] = c[h][g] = i;
					for (int j = 0; j < a; j++) {
						for (int k = 0; k < a; k++) {
							for (int l = 0; l < a; l++) {
								if (k == l)c[k][l] = 0;
								else c[k][l] = min(c[k][l], c[k][j] + c[j][l]);
							}
						}
					}
				}
			}
		}
	}
}

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

int n;
int p[200010];
int res = 0;

int main(){
  cin >> n;
  
  int mn = 2147483647; //それまでで一番小さい数
  rep(i, n){
    int num;
    cin >> num;
    if(num < mn){
      mn = num;
      res++;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

int main() {
  string s;
  cin >> s;
  string ans = "Yes";
  if (s == "AAA" || s == "BBB") {
    ans = "No";
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
const ll INF = 1LL<<60;
const ll M = 1000000007;
ll mpow(ll a,ll b){ll res=1;while(b!=0){if(b&1)res=res*a%M;a=a*a%M;b=b>>1;}return res;}
ll mcomb(ll n,ll k){if(k>n/2)return mcomb(n,n-k);ll res=1;for(ll i=0;i<k;i++){res=res*(n-i)%M;res=res*mpow(k-i,M-2)%M;}return res;}
/*template*/

int main()
{
  string s;cin>>s;
  string ans= s=="ABC" ? "ARC":"ABC";
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> d(n);
  for (int i = 0; i < n; i++) cin >> d[i];
  ll ans = 0;
  for (int i = 0; i < n; i++) for (int j = 0; j < i; j++) ans += d[i] * d[j];
  cout << ans << endl;
  return 0;
}


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

int main()
{
    int n,d=0;
    cin>>n;
    string s;
    cin>>s;
    string x=s.substr(0,n/2);
    string z=s.substr(n/2);
    if(x==z) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
//#include "library/debug.cpp"

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

    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    rep(i, 0, n) cin >> a[i].first >> a[i].second;
    sort(a.begin(), a.end());
    int ans = 1;
    int lst = 0;

    rep(i, 1, n) {
        if (a[lst].first + a[lst].second <= a[i].first - a[i].second) {
            lst = i;
            ans++;
        } else {
            if (a[lst].first + a[lst].second > a[i].first + a[i].second) {
                lst = i;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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


int main()
{
  int N , K;
 scanf("%d %d",&N,&K);
 int array[N+1];
 memset(array,0,sizeof(array[0])*(N+1));
 int d[K];
 for (int i = 0;i<K;i++)
 {
 	scanf("%d",&d[i]);
 	int A[d[i]];
    for (int j = 0;j<d[i];j++)
	{
	  scanf("%d",&A[j]);
	  array[A[j]]++;
	}
 }

 int count=0;
 for (int i=1;i<=N;i++)
 {
   if (array[i]==0)
	count++;
 }

 printf("%d",count);




   return 0;
}


Measured memory_bytes: 1728
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(15) << << endl;
#include <cassert>
//#include "atcoder/all"

using namespace std;
//using namespace atcoder;

#define ll long long
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define P pair<int,int>

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
ll mod = 1000000007;

int main(){
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<bool> c(n,false);
    bool ok = false;

    for(int i = 0; i < n; ++i){
        int d1,d2; cin >> d1 >> d2;
        if(d1==d2) {
            c[i] = true;
            if(i > 1 && c[i-1] && c[i-2]) ok = true;
        }
    }

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
  cout << fixed << setprecision(10);
  int a;
  cin>>a;
 
  if(a%2==0){
    cout << fixed << setprecision(10);
  cout<<a/2.0/a<<endl;
  }
  else{
     cout << fixed << setprecision(10);
    cout<<(a+1)/2.0/a<<endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>
#include <algorithm>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    string s,ss;
    cin>>s>>ss;
    rep(i,0,s.size()+1){
        if(s==ss){
            cout<<"Yes"<<endl;
            return 0;
        }
        s.insert(s.begin(),s[s.size()-1]);
        s.erase(s.end()-1);
    }
    cout<<"No"<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

void yes(){
  cout << "YES" << endl;
  exit(0);
}

void no(){
  cout << "NO" << endl;
  exit(0);
}

int main(){
  string s; cin >> s;
  vector<ll> cnt(3,0);
  FOREACH(c,s){
    cnt[c-'a']++;
  }
  ll maxi = 0, mini = 1e18;
  FOREACH(x,cnt){
    maxi = max(maxi,x);
    mini = min(mini,x);
  }
  if(maxi-mini<=1) yes();
  else no();
}


Measured memory_bytes: 512
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		List<List<Integer>> g = new ArrayList<>();
		for (int i = 0; i <= N; i++) {
			g.add(new ArrayList<>());
		}

		for (int i = 0; i < M; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			g.get(a).add(b);
			g.get(b).add(a);
		}

		sc.close();

		List<Integer> e = g.get(1);
		for (int x : e) {
			if (g.get(x).contains(N)) {
				out.println("POSSIBLE");
				return;
			}
		}
		out.println("IMPOSSIBLE");
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 141152
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
signed main() {
  ios::sync_with_stdio(false);
  int N, L; cin >> N >> L;
  vector<int> A(N);
  REP(i,N) cin >> A[i];
  bool impossible = true;
  int k = -1;
  REP(i,N - 1) {
    if(A[i] + A[i + 1] >= L) {
      impossible = false;
      k = i;
    }
  }
  if(impossible) {
    cout << "Impossible" << endl;
  }
  else {
    cout << "Possible" << endl;
    REP(i, k) cout << i + 1 << endl;
    for(int i = N - 2; i >= k; i--) {
      cout << i + 1 << endl;
    }
  }
}


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

int main() {
    int n;
    cin >> n;
    string s;
    while (n--) {
        cin >> s;
        int h = (s[0] - '0') * 10 + (s[1] - '0');
        int m = (s[3] - '0') * 10 + (s[4] - '0');
        int d = abs(60 * h - 11 * m);
        if (360 <= d) {
            d = 720 - d;
        }
        if (d < 60) {
            cout << "alert" << endl;
        } else if (d < 180) {
            cout << "warning" << endl;
        } else {
            cout << "safe" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1192