akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// O(HW)
int H,W;
char maze[30][30];
int d[30][30];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
void bfs(int sx,int sy){
    queue<pair<int,int>> que;
    rep(i,H){
        rep(j,W){
            d[i][j]=INF;
        }
    }
    que.push(make_pair(sx,sy)); // (0,0)スタート
    d[sx][sy]=0;
    while(!que.empty()){
        pair<int,int> p=que.front();
        que.pop();
        for(int i=0;i<4;i++){
            int nx=p.first+dx[i];
            int ny=p.second+dy[i];
            if(0<=nx && nx<H && 0<=ny && ny<W && maze[nx][ny]!='#' && d[nx][ny]==INF){
                que.push(make_pair(nx,ny));
                d[nx][ny]=d[p.first][p.second]+1;
            }
        }
    }
}

int main() {
    cin>>H>>W;
    rep(i,H){
        rep(j,W){
            cin>>maze[i][j];
        }
    }

    int ans=0;
    rep(i,H){
        rep(j,W){
            if(maze[i][j]=='#') continue;
            bfs(i,j);
            int tmp=0;
            rep(k,H){
                rep(l,W){
                    if(maze[k][l]=='#') continue;
                    tmp=max(tmp,d[k][l]);
                }
            }
            ans=max(ans,tmp);
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff { ios_base::sync_with_stdio(false);cin.tie(NULL);}
using namespace std;

typedef long long ll;
 ll  pp=1e9+7; 
double pi=3.141592653589793238;
  
 int main() {
        ff;
        ll x,k,d;
        cin>>x>>k>>d;
        x=abs(x);
         ll z;
        if(d!=0)
         z=x/d;
        if(z>=k){
            cout<<x-k*d<<endl;
        }else{
            ll p=k-z;
            if(p%2==0){
                cout<<x%d<<endl;
            }else{
                cout<<d-x%d<<endl;
            }
        }
        
		
    return 0;
}

            
		
        
           
  

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}


int main() {
  int n, b;
  cin >> n >> b;
  int rr = n - b;
  ll M = mod - 2;
  cout << rr + 1 <<endl;
  for (int i = 2; i <= b; i++) {
    
    //bp = b-1Ci
    ll bp = 1;
    ll bw = 1;
    for (int j = b - 1; j > b - i; j--) {
      bp = bp * j % mod;
      bw = bw * (b - j) % mod;
    }
    bw = r(bw, M);
    bp = bp * bw % mod;
    
    //ap
    ll ap = 1;
    ll aw = 1;
    for (int j = 0; j < i; j++) {
      ap = ap * (rr + 1 - j) % mod;
      aw = aw * (j + 1) % mod;
    }
    aw = r(aw, M);
    ap = ap * aw % mod;
    
    ll K = ap * bp % mod;
    printf("%lld\n", K);
  }
}

Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
using namespace std;
char p[110];
int main(){
    int i;
    scanf("%s",p);
    for(i=0;p[i];i++);
    int n =i;
    for(i=0;i<=n-9;i++)printf("%c",p[i]);
    printf("\n");
}

Measured memory_bytes: 128
N, M = map(int, input().split())
A = map(int, input().split())
from itertools import accumulate
from collections import Counter
acc = [0]
acc.extend(accumulate(A))
cnt = Counter(a % M for a in acc)
ans = sum(v * (v - 1) // 2 for v in cnt.values())
print(ans)

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

using namespace std;

int main(){
 int n,l;
  cin >> n >> l;
  string s[n];
  for(int i=0;i<n;i++) cin >> s[i];
  
  sort(s,s+n);
  
  string res="";
  for(int i=0;i<n;i++) res+=s[i]; 
 
  cout << res << endl;
}

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

using namespace std;

/**/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define wt(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define wt(x...)
#endif
/**/

#define LL long long
const int MAXN = 212345;
const int INF  = 0x3f3f3f3f;



int main () {

	int n, m;
	scanf("%d %d", &n, &m);

	std::vector< pair<int,int> > v;

	for (int i = 0, a, b; i < n; ++i) {
		scanf("%d %d", &a, &b);
		v.push_back({a, b});
	}

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

	int nxt= 0;
	LL ans = 0;

	priority_queue <int> q;

	for (int i = 1;  i <= m; ++i) {
		while (nxt < n && v[nxt].first == i) {
			q.push(v[nxt].second);
			++nxt;
		}

		if (!q.empty()) {
			ans += q.top();
			q.pop();
		}
	}

	printf("%lld\n", ans);

	return 0;
}



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

int gcd(int a,int b){
	int x;
	if(max(a,b)%min(a,b)==0){
		x=min(a,b);
	}else{
		x=gcd(min(a,b),max(a,b)%min(a,b));
	}
	return x;
}


int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	
	sort(a.begin(),a.end());
	int sum=0;
	
	for(int i=1;i<n;i++){
		sum+=abs(a[i]-a[i-1]);
	}
	
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
#include<string>
#include<string.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	int h, w;
	char s[9][9];
	cin >> h >> w;
	rep(i, h) {
		cin >> s[i];
	}
	int cnt = 0;
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '#') {
				cnt++;
			}
		}
	}
	if (cnt == h + w - 1) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<ll, ll>
int main()
{
    int h, w, k, cnt = 0;
    cin >> h >> w >> k;
    string s;
    vector<vector<int>> arr(h, vector<int>(w, 0));
    for (int i = 0; i < h; i++)
    {
        cnt = 0;
        cin >> s;
        for (int j = 0; j < w; j++)
        {
            if (s[j] == '#')
                cnt = k, k--;
            arr[i][j] = cnt;
        }
        for (int j = w - 2; j >= 0; j--)
            if (arr[i][j] == 0)
                arr[i][j] = arr[i][j + 1];
    }
    for (int i = 0; i < w; i++)
    {
        cnt = 0;
        for (int j = 0; j < h; j++)
        {
            if (arr[j][i])
                cnt = arr[j][i];
            arr[j][i] = cnt;
        }
        for (int j = h - 2; j >= 0; j--)
            if (arr[j][i] == 0)
                arr[j][i] = arr[j + 1][i];
    }
    for (int i = 0; i < h; cout << "\n", i++)
        for (int j = 0; j < w; j++)
            cout << arr[i][j] << ' ';
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTG(c) sort((c).begin(),(c).end(),greater<auto>())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define REP(i,n)  for(int i=0; i<(n); i++)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
int main(){
  int n, cnt=0;
  int h, w, h1, w1;
  cin >> h >> w;
  h1=h;
  w1=w;
  vector<vector<char>> s(h,vector<char>(w));
  REP(i, h){
      REP(j,w){
          cin >> s[i][j];
        }
    }
    vector<bool> tt(h, false), yk(w, false);
    REP(i, h){
      REP(j,w){
          if(s[i][j]=='#'){
              tt[i]=true;
              yk[j]=true;
            }
        }
    } 
    REP(i, h){
        if(tt[i]){
            REP(j,w){
                if(yk[j]){
                    cout << s[i][j];
                }
            }
            cout << endl;
        }
    } 
     
}

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

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


// union-find
struct UnionFind{
    vector<ll> d;
    UnionFind(ll n): d(n,-1){}

    ll root (ll x){
        if(d[x] < 0) return x; // 自分が根
        return d[x] = root(d[x]);
    }

    bool unite(ll x, ll y){
        x = root(x); y = root(y);
        if(x == y)return false;
        if(d[x]>d[y])swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }

    bool same(ll x, ll y){ //同じグループか判定
        return root(x) == root(y);
    }

    ll size(ll x){
        return -d[root(x)];
    }
};

int main(){

    ll n,m;
    cin >> n >> m;
    UnionFind uf(n);
    rep(i,m){
        ll x, y, z;
        cin >> x >> y >> z;
        x--;
        y--;
        if(!uf.same(x,y)){
            uf.unite(x,y);
        }
    }

    map<ll,ll> mp;
    rep(i,n){
        mp[uf.root(i)]++;
    }

    ll ans = 0;
    for(auto it:mp){
        ans ++;
    }

    cout << ans << endl;



    return 0;
}

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

int main() {
 unsigned char flag = 0;
 int N;
  cin >> N;
  
  for (int i = 0;i<N;i++){
	  	char s;
	    cin >> s;
	    if(s == 'G'){
	    	flag |= 0x01;
	    }else if(s == 'W'){
			flag |= 0x02;
	    }else if(s == 'P'){
	        flag |= 0x04;
	    }else if(s == 'Y'){
	    	flag |= 0x08;
	    }
  	}
    if(flag == 0x0F){
    	cout << "Four" << endl;
    }
    
    if(flag == 0x7 || flag == 0x0E || flag == 0x0D || flag == 0xB){
    	cout << "Three" << endl;
    }  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,a[100],b[100],c[100],s=0;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i];
    for(i=0;i<n;i++)
        cin>>b[i];
    for(i=0;i<n-1;i++)
        cin>>c[i];
    for(i=1;i<n;i++)
    {
        if(a[i]-a[i-1]==1)
            s+=b[a[i]-1]+c[a[i-1]-1];
        else
            s+=b[a[i]-1];
    }
    cout<<s+b[a[0]-1]<<endl;
}


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


int main() {

    long long h, count = 1;
    scanf("%lld", &h);

    while (h > 1) {
        h /= 2;
        count = count * 2 + 1;
    }

    printf("%lld", count);

    return 0;
}


Measured memory_bytes: 128
n = int(input())
A = list(map(int,input().split()))
if n%2==0:
    a = A[::2]
    b = A[1::2]
    b = b[::-1]
    print(*(b+a))
else:
    a = A[::2]
    a = a[::-1]
    b = A[1::2]
    print(*(a+b))

Measured memory_bytes: 105452
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

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

  int cnt = 0;

  for (int i = 0; i < n; ++i) {
    int mn = i;
    for (int j = i; j < n; ++j) {
      if (a[j] < a[mn]) {
        mn = j;
      }
    }
    cnt += i != mn;
    swap(a[i], a[mn]);
  }
  
  for (int i = 0; i < n; ++i) {
    cout << a[i];
    if (i != n - 1) cout << " ";
    else cout << '\n';
  }
  cout << cnt << '\n';

  return 0;
}


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

#define MAX 100000

int N, M;
int P[MAX];
int Y[MAX];

typedef pair< int, int > P1;
typedef pair< int, P1 > PP;
vector<PP> p;

int main() {
	cin >> N >> M;
	for( int i = 0; i < M; i++ ) {
		cin >> P[i] >> Y[i];
	}

	p.resize(M);
	for( int i = 0; i < M; i++ ) {
		p[i].first= P[i];
		p[i].second.first = Y[i];
		p[i].second.second = i;
	}
	sort( p.begin(), p.end() );
	for( int i = 0; i < M; i++ ) {
		int pp = p[i].first;
		int cnt = 0;
		for( int j = i; p[j].first == pp; j++ ) {
			p[j].second.first = cnt++;
			i = j;
		}
	}
	sort( p.begin(), p.end(), [](const PP& a, const PP& b){ return(a.second.second < b.second.second); } );

	for( int i = 0; i < M; i++ ) {
		cout << setfill('0') << setw(6) << right << p[i].first;
		cout << setfill('0') << setw(6) << right << p[i].second.first + 1 << endl;
	}

	return 0;
}


Measured memory_bytes: 3456
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long int MOD = 1000000007;


int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}


int main()
{
	long long int a;
	string s;

	cin >> a;
	cin >> s;

	if (a >= 3200)
		cout << s << endl;
	else
		cout << "red" << endl;

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int field[20][20];
int num;

void pv(int n) {
	rep(i,n) preview(field[i], field[i] + n);
}

bool check(int n) {
	bool f = false;
	rep(y,n) rep(x,n) if(field[y][x] == 0) f = true;
	return f;
}

P put(int ny, int nx, int n) {
	if(n <= nx) {
		return put(ny, 0, n);
	}
	else if(nx < 0) {
		return put(ny, n - 1, n);
	}
	else if(n <= ny) {
		return put(0, nx, n);
	}
	else if(field[ny][nx] != 0) {
		return put(ny + 1, nx - 1, n);
	}
	else {
		field[ny][nx] = num;
		return mp(ny, nx);
	}
}

int main() {
	for(int n; scanf(" %d", &n), n;) {
		memset(field, 0, sizeof field);
		int py = (n + 1) / 2;
		int px = (n + 1) / 2 - 1;

		field[py][px] = 1;
		num = 2;
		while(check(n)) {
			int nx = px + 1;
			int ny = py + 1;
			P next = put(ny, nx, n);
			py = next.first;
			px = next.second;
#if 0
			pv(n);
			cerr << endl;
#endif

			++num;
		}
		rep(y,n) {
			rep(x,n) {
				printf("%4d", field[y][x]);
			}
			puts("");
		}
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < b; i++){
            for(int j = 0; j < a; j++){
                sb.append("0");
            }
            for(int j = 0; j < (w-a); j++){
                sb.append("1");
            }
            sb.append(System.lineSeparator());
        }
        for(int i = 0; i < (h-b); i++){
            for(int j = 0; j < a; j++){
                sb.append("1");
            }
            for(int j = 0; j < (w-a); j++){
                sb.append("0");
            }
            sb.append(System.lineSeparator());
        }
        
        System.out.println(sb);
    }
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/07/07  Problem: soundhound2018_master_qual A / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

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



	LL ans = 0;

	int a, b;
	cin >> a >> b;
	if (a + b == 15) {
		cout << "+" << endl;
	}
	else if (a*b == 15) {
		cout << "*" << endl;
	}
	else {
		cout << "x" << endl;
	}

	return 0;
}


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

int n, d1, d2;
int co[666][666], cnt[4];

void gao(int d,int w){
    int b=1;
    while (d%4==0) d/=4, b*=2;
    for (int i=0;i<n;++i)
        for (int j=0;j<n;++j)
            if (d%4==1&&(i/b+j/b)%2||d%4==2&&i/b%2)
                co[i][j]|=w;
}

int main(){
    cin>>n>>d1>>d2; n*=2;
    gao(d1,1); gao(d2,2);
    for (int i=0;i<n;++i)
        for (int j=0;j<n;++j)
            ++cnt[co[i][j]];
    for (int aim=0;aim<4;++aim)
        if (cnt[aim]>=n*n/4){
            int las=n*n/4;
            for (int i=0;i<n;++i)
                for (int j=0;j<n;++j)
                    if (las&&co[i][j]==aim)
                        printf("%d %d\n",i,j), las--;
            return 0;
        }
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define mk make_pair
#define ll long long
using namespace std;
const int N = 505;
int main() {
	int n, m, ans = 1;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) ans *= 2;
	ans *= 1900 * m + 100 * (n - m);
	cout << ans;
} 


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
 
int main(){
int n,h,w;
int ans =0;
long A[10000],B[10000];
cin >> n>> h >> w;
for(int i = 0; i < n; i++)
{
cin >> A[i] >> B[i];
}
for(int i = 0; i < n; i++)
{
if (A[i]>=h && B[i]>=w) {
ans++;
}
}
cout << ans <<endl;
}

Measured memory_bytes: 256
import math
a,b,h,m = map(int,input().split())
x = 0
y = 1
mkaku = (6*m)+90
hkaku = ((30*h)+(m/2))+90
posb = [b*math.sin(math.radians(float(mkaku))),b*math.cos(math.radians(float(mkaku)))]
posa = [a*math.sin(math.radians(float(hkaku))),a*math.cos(math.radians(float(hkaku)))]
yy = abs(posa[y]-posb[y])
xx = abs(posa[x]-posb[x])
print(math.sqrt(xx**2 + yy**2))

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

int kaijou(int n){
  int ans=1;
  for (int i=0;i<n;i++){
    ans *= i+1;
  }
  return ans;
}


int main (){
  int N;
  cin >> N;
  int a,b;
  vector<int> P(N),Q(N);
  
  for(int i=0;i<N;i++){
    cin>>P[i];
  }
  for(int i=0;i<N;i++){
    a+=(P[i]-1)*kaijou(N-i-1);
    for(int j=i+1;j<N;j++){
      if(P[i] <  P[j]){
        P[j] --;
      }
    }
  }
  a++;
  
  for(int i=0;i<N;i++){
    cin>>Q[i];
  }
  for(int i=0;i<N;i++){
    b+=(Q[i]-1)*kaijou(N-i-1);
    for(int j=i+1;j<N;j++){
      if(Q[i] <  Q[j]){
        Q[j] --;
      }
    }
  }
  b++;
  
  int c = max(a,b)-min(a,b);
  cout << c << endl;
}

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

int main() {
    const int TOPPING = 3;
    const int NUDLE = 700;
    string s;
    int value = NUDLE;
    
    cin >> s;

    for (int i = 0; i < TOPPING; i++) {
        if (s[i] == 'o') {
            value = value + 100;
        }
    }
    cout << value << endl;

    return 0;
}

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

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

  if (N % 2 == 0)
    cout << (N / 2) * (N / 2) << endl;
  else
    cout << (N / 2) * ((N / 2) + 1) << endl;
}

Measured memory_bytes: 256
n,m=[int(i) for i in input().split()]
ab=[]
cd=[]
for i in range(n):
    a,b=[int(j) for j in input().split()]
    ab.append((a,b))

for i in range(m):
    c,d=[int(j) for j in input().split()]
    cd.append((c,d))

for i in range(n):
    mini=10000000000000000
    for j in range(m):
        dis=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if mini>dis:
            mini=dis
            point=j+1
    print(point)

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

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

	vector<int> a(n + 2, 0);
	long long total = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		total += abs(a[i] - a[i-1]);
	}
	total += abs(a[n]);

	for (int i = 1; i <= n; i++) {
		int x = abs(a[i-1] - a[i]) + abs(a[i] - a[i+1]);
		int y = abs(a[i-1] - a[i+1]);

		cout << total - x + y << endl;
	}

	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  vector<int > a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a[k-1] << endl;

  
  return 0;
    

}


Measured memory_bytes: 256
class RMQ
  attr_reader :n, :dat

  INF = 2 ** 31 - 1

  def initialize(n_)
    @n = 1

    @n *= 2 while @n < n_
    @dat = Array.new(2 * @n, INF)
  end

  def update(idx, val)
    idx += n - 1
    dat[idx] = val

    while idx > 0
      idx = (idx - 1) / 2

      if dat[idx * 2 + 1] < dat[idx * 2 + 2]
        dat[idx] = dat[idx * 2 + 1]
      else
        dat[idx] = dat[idx * 2 + 2]
      end
    end
  end

  # 区間 [l, r] の最小値を返す。探索範囲の初期値は [0, n - 1] で固定 (全範囲)
  def find_min(l, r)
    query(l, r, 0, 0, n - 1)
  end

  private

  # @param [Integer] a 探索範囲の左端
  # @param [Integer] b 探索範囲の右端
  # @param [Integer] idx 現在位置
  # @param [Integer] l 現在の探索範囲の左端
  # @param [Integer] r 現在の探索範囲の右端
  def query(a, b, idx, l, r)
    return INF if r < a || b < l

    if a <= l && r <= b
      dat[idx]
    else
      vl = query(a, b, idx * 2 + 1, l, (l + r) / 2)
      vr = query(a, b, idx * 2 + 2, (l + r) / 2 + 1, r)

      vl < vr ? vl : vr
    end
  end
end

N, Q = gets.split.map(&:to_i)
rmq = RMQ.new(N)

Q.times do
  com, x, y = gets.split.map(&:to_i)

  if com == 0
    rmq.update(x, y)
  else
    puts rmq.find_min(x, y)
  end
end



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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n);
    ll l=1;
    bool jud=false;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]/=2;

        ll prevl=l;
        l=l/__gcd(l,a[i])*a[i];
        if(l/prevl != a[i]/__gcd(prevl,a[i])) jud=true;
    }
    for(int i = 0; i < n; i++) if((l/a[i])%2==0) jud=true;
    ll ans=(m/l+1)/2;
    if(jud) ans=0;
    cout << ans << "\n";

    return 0;
}

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


int main() {
  int n = 0;
  int l = 0;
  cin >> n ;
  cin >> l ;

  multiset<string> str_set ;
  rep( i, n ) {
    string str ;
    cin >> str ;  
    str_set.insert( str ) ;
  }
  
  string ans ;
  for ( const auto& str : str_set ) {
    ans += str ;
  }
  cout << ans << endl ;
  return 0 ;
}



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

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);


    string S;
    cin >> S;
    string T;
    cin >> T;
    ll cnt=0;
    rep(si,S.size()){
        if(S.substr(si,1)!=T.substr(si,1)) cnt++;
    }
    cout << cnt << endl;

}

Measured memory_bytes: 3800
/*****************************************************

*****************************************************/

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define pb push_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define ip pair<int, int>
#define ff first
#define ss second

#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 1e5+7;
const ll inf = 1e17;

int pwr(int x, int y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return r % MOD;
}

int inv(int x)
{
    return pow(x, MOD-2);
}


void solve()
{
    string s; cin>>s;
    map<int, int> m;
    for(auto i: s)
        m[i]++;
    bool f = 0;
    for(auto i: m)
    {
        if(i.second != 2)
            f=1;
    }
    if(!f)
        cout<<"Yes";
    else
        cout<<"No";
}

signed main()
{
    int t=1;
    // cin >>t;
    while(t--){
        solve();
    }
    return 0;
}

/*****************************


****************************/

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

int N;
int A[210];// 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];

    int res = 0;

    // 操作が行える限り操作を繰り返す
    while (true) {
        bool exist_odd = false;  // A[i] がすべて偶数かどうかを判定するフラグ
        for (int i = 0; i < N; ++i) {
            if (A[i] % 2 != 0) exist_odd = true;  // 奇数があったらフラグを立てる
        }

        if (exist_odd) break;  // 奇数があったら break

        // 操作を行えるなら操作を実際に行う
        for (int i = 0; i < N; ++i) {
            A[i] /= 2;
        }
        ++res;  // 操作回数をインクリメント
    }

    cout << res << endl;
}

Measured memory_bytes: 256
// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.
	var xy = input.split(' ');
	for(var i=0;i<xy.length;i++){
		xy[i] = parseInt(xy[i]);
	}
	var dx = xy[0]-xy[2];
	var dy = xy[1]-xy[3];
	xy.push(xy[2]+dy);
	xy.push(xy[3]-dx);
	xy.push(xy[4]+dx);
	xy.push(xy[5]+dy);
	console.log(xy[4],xy[5],xy[6],xy[7])
}
// Don't edit this line!
//Main(require("fs").readFileSync(__dirname+'/in.txt', "utf8"));
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
int vsum(vector<int> v){
  int a=0;
  for(int i=0;i<v.size();i++)a+=v[i];
  return a;
}
int main(){
  int i,j,tmp,D,G,ans=1000;
  cin>>D>>G;
  vector<int> p(D),c(D);
  for(i=0;i<D;i++)cin>>p[i]>>c[i];
  for(tmp=0;tmp<(1<<D);tmp++){
    bitset<10> s(tmp);
    int cnt=0,point=0;
    for(i=0;i<D;i++){
      if(s[i]){
        cnt+=p[i];
        point+=p[i]*(i+1)*100+c[i];
      }
    }
    if(point>=G)ans=min(ans,cnt);
    else {
      for(i=0;i<D;i++){
        if(!s[D-1-i]){
          for(j=0;j<p[D-1-i];j++){
            point+=(D-i)*100;
            cnt++;
            if(point>=G){ans=min(ans,cnt);break;}
          }
          break;
        }
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>

using namespace std;
typedef pair<long long,bool> Pair;

int main(){

  long long N;
  long long abc[100001][3];
  long long DP[100001][3]={0};
  long long lane;

  cin >> N;

 for(long long i=1;i<=N;i++)
 {
      cin>>abc[i][0]>>abc[i][1]>>abc[i][2];
 }
 for(long long i=1;i<=N;i++)
 {
      for(long long k=0;k<3;k++)
      {
           for(long long l=0;l<3;l++)
           {
                if(k!=l)
                DP[i][k]=max(DP[i][k],abc[i][k]+DP[i-1][l]);
           }
      }
 }

 long long ans=max(DP[N][0],DP[N][1]);
 ans=max(ans,DP[N][2]);
 cout << ans << endl;

 return 0;

}

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

class Progaram
{
    static void Main(string[] args)
    {
        var l = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var n = l[0]; var a = l[1]; var b = l[2];
        var s = Console.ReadLine().ToCharArray();
        var count = 0;
        var ac = 0;

        for (var i = 0; n > i; i++)
        {
            if (s[i] == 'a' && a + b > count)
            {
                Console.WriteLine("Yes");
                count++;
            }
            else if (s[i] == 'b' && a + b > count && b > ac)
            {
                Console.WriteLine("Yes");
                count++;
                ac++;
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 16096
import java.util.Scanner;

public class Main{

	/**入力された文字列のアルファベットの個数を数えて出力。
	 *
	 * @param args
	 */
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] args){

		//個数カウント用の配列を設置する
		int[] alpha = new int[27];//0-26
		for(int syoki = 0 ; syoki < 27 ;syoki++){
			alpha[syoki]=0;
		}

		/*文字と数値一覧表
		 * A===10===a
		 * B===11===b
		 * !
		 * !
		 * !
		 * Z===35==z
		 * alpha[0]=a--->Character.getNumericValue('A')-10;
		 * alpha[1]=b--->Character.getNumericValue('B')-10;
		 */

		//個数のカウント
	for(;scan.hasNextLine();){
			int sum=0;
			char[] swap = scan.nextLine().toCharArray();//char型の配列に格納する
			
			

			for(int i = 0;i < swap.length ;i++){
				if(swap[i] != ' '){
					int a = Character.getNumericValue(swap[i]);
				//	System.out.println("aは"+a);
				//	System.out.println("a:" + a);
					if(a >= 10 && a <37){
						alpha[a - 10]++;
					}else{
						//break;
					}
				}
			}
	}
		//A~Zの個数を出力
		char L00 = 'a';
		for(int L01 = 0,i = 0; L01 <= ('z' -'a');L01++,i++){
			System.out.print(L00++);
			System.out.println(" : "+alpha[i]);
		}


	}

}



Measured memory_bytes: 26304
n, y = gets.chomp.split(" ").map(&:to_i)
y /= 1000
judge = false
sum = 0
num1000 = 0
0.upto(n) do |num10000|
  0.upto(n - num10000) do |num5000|
    num1000 = n - num10000 - num5000
    sum = num10000 * 10 + num5000 * 5 + num1000
    if sum == y
      puts "#{num10000} #{num5000} #{num1000}"
      judge = true
      break
    end
  end
  if judge == true
    break
  end
end
if judge == false
  puts "-1 -1 -1"
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,X,Y;
  cin>>N>>X>>Y;
  X--,Y--;
  map<int,int> A;
  for(int i=0;i<N-1;i++)
    for(int j=i+1;j<N;j++){
      int k;
      if(i<=X && Y<=j)
        k=j-i-(Y-X)+1;
      else if(X<=i && j<=Y)
        k=min(j-i,Y-X+1-(j-i));
      else if(j<=X || Y<=i)
        k=j-i;
      else if(i<=X && j<=Y)
        k=X-i+min(j-X,Y-j+1);
      else if(X<=i && Y<=j)
        k=j-Y+min(Y-i,i-X+1);
      A[k]++;
    }
  for(int i=1;i<N;i++)
    cout<<A[i]<<endl;
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define SortAsc(c) std::sort(c.begin(), c.end())
#define SortDesc(c) std::sort(c.rbegin(), c.rend())
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};

int main() {
  int A, B, C, D;

  cin >> A >> B >> C >> D;
  int takahashi = C / B;
  int aoki = A / D;

  if (C % B > 0) takahashi++;
  if (A % D > 0) aoki++;

  if (takahashi <= aoki) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int a,b,c,k;
  cin>>a>>b>>c>>k;

  bool ans = false;
  auto dfs = [&](auto&& dfs,int a,int b,int c,int op)->void{
    if(op<=k){
      if(b>a&&c>b)ans=true;
      if(op==k)return;
    }
    dfs(dfs,a*2,b,c,op+1);
    dfs(dfs,a,b*2,c,op+1);
    dfs(dfs,a,b,c*2,op+1);
  };
  dfs(dfs,a,b,c,0);
  cout<<(ans?"Yes":"No")<<endl;

}

Measured memory_bytes: 3620
#include <cstdio>
#include <algorithm>

using namespace std;

int count(int a, int b) {
    int c = a ^ b;
    int sum = 0;
    while(c) {
        sum += c & 1;
        c >>= 1;
    }
    return sum;
}

int p[320000], q[320000], ans[320000];
int k[30], l[30];

void dnc(int len) {
    if(len == 1) {
        p[0] = 0;
        p[1] = 1;
        return;
    }
    
    dnc(len - 2);
    
    int d[4] = {1 << (len - 2), 0, 0, 1 << (len - 2)};
    
    for(int i = 0; i < (1 << (len - 1)); i++) q[i] = 0;
    for(int i = 1 << (len - 1); i < (1 << len); i++) {
        q[i] += 1 << (len - 1);
        q[i] += p[(i - (1 << (len - 1))) / 2];
        q[i] += d[i % 4];
    }
    
    for(int i = 0; i < len - 1; i++) for(int j = 0; j < (1 << i); j++) q[(1 << (i + 1)) - j - 1] = q[j] + (1 << i);
    for(int i = 0; i < (1 << len); i++) p[i] = q[i];
}

int main() {
    int n, a, b;
    scanf("%d %d %d",&n,&a,&b);
    int lls = count(a, b);
    if(!(lls & 1)) {
        printf("NO\n");
        return 0;
    }
    dnc(lls);
    int c = a ^ b;
    int m = 0;
    int s = 0;
    for(int i = 0; i < (1 << n); i++) q[i] = 0;
    for(int i = 0; i < n; i++) {
        if(c & (1 << i)) {
            if(a & (1 << i)) for(int j = (1 << lls) - 1; j >= 0; j--) p[j] ^= (1 << m);
            k[m++] = 1 << i;
        }
        else {
            l[s++] = 1 << i;
            q[0] += a & (1 << i);
        }
    }
    if(s == 0) {
        printf("YES\n");
        for(int i = 0; i < (1 << n); i++) printf("%d ",p[i]);
        printf("\n");
        return 0;
    }
    for(int i = 0; i < s; i++) {
        for(int j = 0; j < (1 << i); j++) {
            q[(1 << (i + 1)) - j - 1] = q[j] ^ l[i];
        }
    }
    for(int i = 0; i < (1 << m); i++) {
        int tmp = p[i];
        p[i] = 0;
        for(int j = 0; j < m; j++) if(tmp & (1 << j)) p[i] += k[j];
    }
    for(int i = 0; i < (1 << s); i++) q[(1 << (s + 1)) - i - 1] = q[i];
    for(int i = 0; i < (1 << n); i++) ans[i] = q[i % (1 << (s + 1))] + p[i / (1 << s)];
    
    printf("YES\n");
    for(int i = 0; i < (1 << n); i++) printf("%d ", ans[i]);
    printf("\n");
    
    return 0;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int a[100005];
int main()
{
	int n;
	cin>>n;

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

	stack<long double> q;
	for(int i=n-1;i>=0;i--)
	{
		q.push(a[i]);
	}

	while(q.size()!=1)
	{
		long double x=q.top();
		q.pop();
		long double y=q.top();
		q.pop();
		q.push((x+y)/2);
	}
	cout<<setprecision(12)<<q.top();
}

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


class cell{
public:
  int v;
  int op;
  int l,r;
  void set(int x,int y, int z,int w){
    v = x;
    op = y;
    l = z;
    r = w;
  }
};

cell num[7];
bool use[7];
bool f;

int cal(int a,int b,int c){
  if(c == 0)return a+b;
  if(c == 1)return a*b;
  if(c == 2)return a-b;
  else return -1;
}   

void rec(int a){
  if(a==7 && num[6].v == 10){
    f = true;
    return;
  }
  if(f)return;

  for(int i=0;i<a;i++){
    if(!use[i]){
      use[i] = true;
      for(int j=0;j<a;j++){
	if(!use[j]){
	  use[j] = true;

	  use[a] = false;
	  for(int k=0;k<3;k++){
	    int tmp = cal(num[i].v,num[j].v,k);
	    num[a].set(tmp,k,i,j);
	    rec(a+1);
	    if(f)return;
	  }
	  use[a] = true;

	  use[j] = false;
	}
      }
      use[i] = false;
    }
  }
}

void cell_print(int n){
  if(num[n].l<0)cout << num[n].v;
  else{
    cout << "(";
    cell_print(num[n].l);
    if(num[n].op == 0)cout << " + ";
    if(num[n].op == 1)cout << " * ";
    if(num[n].op == 2)cout << " - ";
    cell_print(num[n].r);
    cout << ")";
  }
}

int main(){
  int a,b,c,d;

  while(1){
    cin >> a >> b >> c >> d;
    if(!a && !b && !c && !d)break;

    num[0].set(a,-1,-1,-1);
    num[1].set(b,-1,-1,-1);
    num[2].set(c,-1,-1,-1);
    num[3].set(d,-1,-1,-1);
    for(int i=4;i<7;i++)num[i].set(-1,-1,-1,-1);

    for(int i=0;i<7;i++)use[i] = (i>=4);

    f = false;
    rec(4);

    if(f){
      cell_print(6);
      cout << endl;
    }
    else cout << 0 << endl;
  }
}

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

int main() {
    int n, m;
    cin >> n >> m;
    int cnt = 0;
    if (n%2 == 1) {
        for (int l = 1, r = n-1; l < r; l++, r--) {
            printf("%d %d\n", l, r);
            if (++cnt == m) break;
        }
    } else {
        bool flag = false;
        for (int l = 1, r = n-1; l < r; l++, r--) {
            if (!flag && r-l <= n/2) {
                r--;
                flag = true;
            }
            printf("%d %d\n", l, r);
            if (++cnt == m) break;
        }
    }
    return 0;
}

Measured memory_bytes: 3736
n, m, x, y = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
a << x
b << y
a.sort!
b.sort!
ans = "War"
if a[n] < b[0]
  ans = "No War"
end
puts ans


Measured memory_bytes: 1788
import sys

S = input()
alfa = [chr(i) for i in range(97, 97+26)]
l = [0] * 26

for i in range(len(S)):
    index = alfa.index(S[i])
    l[index] += 1

for i in range(len(l)):
    if l[i] == 0:
        print(alfa[i])
        sys.exit()
print("None")


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

const int maxT = 3600 * 2;
int main()
{
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    //cout << fixed << setprecision(7);

    int T, H, S;
    while (cin >> T >> H >> S)
    {
        if (T == -1 && H == -1 && S == -1)
            break;
        int seconds = 3600 * T + 60 * H + S;
        int sa = maxT - seconds;

        cout << setfill('0') << right << setw(2) << sa / 3600 << ":";
        cout << setfill('0') << right << setw(2) << (sa % 3600) / 60 << ":";
        cout << setfill('0') << right << setw(2) << (sa % 3600) % 60 << endl;

        sa *= 3;
        cout << setfill('0') << right << setw(2) << sa / 3600 << ":";
        cout << setfill('0') << right << setw(2) << (sa % 3600) / 60 << ":";
        cout << setfill('0') << right << setw(2) << (sa % 3600) % 60 << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[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 main()
{
    int a, b, c, d; cin >> a >> b >> c >> d;
    int ans = 0;
    if(d <= a) ans = d;
    else if(d <= a+b) ans = a;
    else ans = a - (d - (a+b));
    pr(ans);
    return 0;}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define trep(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
    string s,t;
    cin >> s;
    cin >> t;
    sort(s.begin(), s.end());
    //cout<<s<<endl;
    sort(t.rbegin(), t.rend());
    //cout<<t<<endl;
    if(s<t){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;
using ll = long long int;
 
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

const ll mod = 998244353;

int N,S;
vector<int> A;

void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N >> S;
    A = fetch_vec<int>(N);
}

// 部分和問題の発展系
int solve(){
    vector<vector<ll>> dp(N+1,vector<ll>(3000,0));
    dp[0][0] = 1;
    for (int i = 0; i < N; i++)
    {
        dp[i+1][0] += 1; 
        for (int j = 0; j <= 3000; j++)
        {
            (dp[i+1][j] += dp[i][j])%=mod;
            if(j-A[i]>=0) (dp[i+1][j] += dp[i][j-A[i]])%=mod;
            
        }
        
    }
    ll ans=0;
    for (int i = 0; i <= N; i++)
    {
        ans += dp[i][S];
        ans %= mod;
    }    
    cout << ans << endl;
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 70784