akhauriyash/Code-Regression huggingface dataset:
def examC():
    N = I()
    x = LI(); num = [i for i in range(N)]
    X = list(zip(x,num)); X.sort()
    ans = [0]*N
    mid0 = X[(N)//2-1][0]; mid1 = X[(N)//2][0]
    for i in range(N):
        if X[i][0]<mid1:
            ans[X[i][1]] = mid1
        else:
            ans[X[i][1]] = mid0
    for v in ans:
        print(v)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 38516
N = int(input())
A = [[],[]]
A[0] = list(map(int, input().split()))
A[1] = list(map(int, input().split()))
result = 0
for i in range(N+1):
    result = max(sum(A[0][:i]) + sum(A[1][i-1:]), result)
print(result)

Measured memory_bytes: 9132
# 操作1はひとつ選んで1減らす　と同じ。
# 基本的には最大値に操作1を適用、操作2はひとつだけ2足りない時のみ適用。
# 差が2のとき、最大値に操作1 x2回 = 最小値と中間値にそれぞれ操作2

# sort -> A<B<C
# AをBに一致させる cnt+=差を2で割った商+2*余り
# CをBに一致させる cnt+=C-B

X=list(map(int,input().split()))
X.sort()
q=(X[1]-X[0])//2
r=(X[1]-X[0])%2
ans=q+2*r+(X[2]-X[1])
print(ans)


Measured memory_bytes: 2940
import java.util.*;

public class Main {
    static long count = 0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); //節点の個数
        Node[] node = new Node[n];
        for(int i=0; i<n; i++) {
            int id = sc.nextInt();
            node[id] = new Node();
            node[id].id = id;
            node[id].k = sc.nextInt();
            node[id].parent = -1;
            node[id].type = "leaf"; //初期値：葉
            if(node[id].k>0) { //次元がある場合
                node[id].child = new int[node[id].k];
                for(int j=0; j<node[id].k; j++) { //子ノードをchild[]に詰める
                    node[id].child[j] = sc.nextInt();
                }
                //タイプを内部節点に書き換える
                node[id].type = "internal node";
            }
        }
        //子ノードの親=ノードid
        for(int i=0; i<n; i++) {
            for(int j=0; j<node[i].k; j++) {
                node[node[i].child[j]].parent = node[i].id;
            }
        }
        //親がない場合、タイプを根に書き換える
        for(int i=0; i<n; i++) {
            if(node[i].parent==-1) {
                node[i].type = "root";
                for(int j=0; j<node[i].k; j++) {
                    depth(node, node[i].child[j], 1);
                }
            }
        }
        //出力
        for(int i=0; i<n; i++) {
            System.out.print("node "+node[i].id+": parent = "+node[i].parent+", depth = "+node[i].depth+", "+node[i].type+", [");
            for(int j=0; j<node[i].k; j++) {
                if(j==0) System.out.print(node[i].child[j]);
                else System.out.print(", "+node[i].child[j]);
            }
            System.out.println("]");
        }
    }
    static void depth(Node[] node, int i, int d) {
        node[i].depth = d;
        d++;
        for(int j=0; j<node[i].k; j++) {
            depth(node, node[i].child[j], d);
        }
    }
}
/**
 * クラス
 */
class Node {
    int id;
    int k;
    int[] child;
    int parent;
    int depth;
    String type;
}



Measured memory_bytes: 127840
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007



signed main(){
    string s;
    cin >> s;

    int y = 0;

    for(int i = 0;i<=3;i++){
        y = pow(10,3-i)*(s[i]-'0');
    }
    int m = 0;
    for(int i = 5;i<7;i++){
        m += pow(10,1+5-i)*(s[i]-'0');
        //cout << m << endl;
    }
    int d = 0;
    for(int i = 8;i<10;i++){
        d += pow(10,8+1-i)*(s[i]-'0');
    }
    //cout << m << " " << d << endl;

    if((m<4 || (m==4 && d<=30)))cout << "Heisei" << endl;
    else cout << "TBD" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX_N 101
#define INF (1<<28);

int N;
int G[MAX_N][MAX_N];

int main() {
  int i, j, k;
  int id, a, b;
  int x;
  for(i = 0; i < MAX_N; ++i) {
    for(j = 0; j < MAX_N; ++j) {
      G[i][j] = i == j ? 0 : INF;
    }
  }

  scanf("%d", &N);
  for(i = 0; i < N; ++i) {
    scanf("%d %d", &id, &k);
    while(k--) {
      scanf("%d %d", &a, &b);
      G[id][a] = b;
    }
  }

  for(k = 0; k < N; ++k) {
    for(i = 0; i < N; ++i) {
      for(j = 0; j < N; ++j) {
        x = G[i][k] + G[k][j];
        if(x < G[i][j]) G[i][j] = x;
      }
    }
  }

  for(i = 0; i < N; ++i) {
    printf("%d %d\n", i, G[0][i]);
  }

  return 0;
}



Measured memory_bytes: 1992
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

const ll MN = -1e18 - 99999999;

int main() {
    ll N, K;
    cin >> N >> K;

    vec<ll> P(N);
    rep(i, N) cin >> P[i], --P[i];

    vec<ll> C(N);
    rep(i, N) cin >> C[i];

    ll ans = MN;
    rep(i, N) {
        ll now = i;
        vector<int> loop;
        ll nowS = 0;

        while (1) {
            now = P[now];
            nowS += C[now];
            loop.emplace_back(C[now]);
            if (now == i) break;
        }

        ll tmp = 0;
        ll sz  = loop.size();
        rep(j, sz) {
            tmp += loop[j];
            if (j + 1 > K) break;
            if (nowS > 0) {
                ll cnt = (K - (j + 1)) / sz;
                ans = max(ans, nowS * cnt + tmp);
            }
            ans = max(ans, tmp);
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3708
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1},
//           dx[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  int x; cin >> x;
  FOR(i, 1, x) {
    int now = i * 100;
    if (now <= x && x - now <= 5 * i) {
      cout << 1 << '\n';
      return 0;
    }
  }
  cout << 0 << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void)
{
	int n, y; cin >> n >> y;
	int c10000 = -1, c5000 = -1, c1000 = -1;

	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= n-i; j++)
		{
			int k = n - i - j;
			if (i * 10000 + j * 5000 + k * 1000 == y)
			{
				c10000 = i;
				c5000 = j;
				c1000 = k;
			}
		}
	}

	cout << c10000 << " " << c5000 << " " << c1000 << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
S = [input()[:-1] for _ in range(N)]
high = []
low = []
for i in range(N):
    cnt = 0
    m = 0
    for j in range(len(S[i])):
        if S[i][j] == "(":
            cnt += 1
        else:
            cnt -= 1
        m = min(m, cnt)
    if cnt > 0:
        high.append([m, cnt])
    else:
        low.append([m-cnt, -cnt])
high.sort(reverse=True)
low.sort(reverse=True)

h = 0
for m, up in high:
    if h+m < 0:
        print("No")
        sys.exit()
    h += up
p = 0
for m, down in low:
    if p+m < 0:
        print("No")
        sys.exit()
    p += down
if h == p:
    print("Yes")
else:
    print("No")




Measured memory_bytes: 104032
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/*Coding Space*/
int main(){
  string s; cin >> s;
  bool flag = 0;
  rep(i,s.size()){
    if(s[i] >= 'A' && s[i] <= 'Z'){
      if(i == 0 && s[0] == 'A') continue;
      if(i >= 2 && i != (int)s.size()-1 && s[i] == 'C' && !flag) {flag = 1; continue;}
      cout << "WA" << endl;
      return 0;
    }
  }
  if(s[0] == 'A' && flag)
    cout << "AC" << endl;
  else
    cout << "WA" << endl;
}

Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
   
#include <x86intrin.h>
#include <bits/stdc++.h>   
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, dp[N][2];
vector <int> g[N];

inline int add (int a, int b) {
   a += b;
   if (a >= mod) a -= mod;
   return a;
}

inline int mult (int a, int b) {
   return 1ll * a * b % mod;
}

void dfs (int v = 1, int pr = 0) {
   dp[v][0] = dp[v][1] = 1;
   for (auto to : g[v]) {
      if (to == pr) continue;
      dfs (to, v);
      dp[v][0] = mult (dp[v][0], add (dp[to][0], dp[to][1]));
      dp[v][1] = mult (dp[v][1], dp[to][0]);
   }
}

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     
                                      
inline void Solve () {
   cin >> n;
   for (int i = 1; i < n; i ++) {
      int x, y;
      cin >> x >> y;
      g[x].pb (y);
      g[y].pb (x);
   }
   dfs ();
   cout << add (dp[1][0], dp[1][1]);
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#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) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, K;
    cin >> N >> K;
    vec X(N);
    REP(i,0,N) cin >> X[i];

    ll p = N;
    REP(i,0,N) {
        if(X[i] >= 0) {
            if(X[i] == 0) {
                X.erase(X.begin() + i);
                --K;
            }
            p = i;
            break;
        }
    }

    ll left, right; 
    if(p < K) {
        left = 0;
        right = K - 1;
    }
    else {
        left = p - K;
        right = p - 1;
    }

    ll m = INF;
    if(K == 0) m = 0;
    else {
        while(left <= p && right < N) {
            ll t;
            if(X[left] < 0 && X[right] < 0) t = -X[left];
            else if(X[left] < 0) t = MIN(X[right]-2*X[left],X[right]*2-X[left]);
            else t = X[right];
            m = MIN(m,t);
            ++left;
            ++right;
        }
    }
    PR(m);

    return 0;
}

/*



*/

Measured memory_bytes: 4040
#include<bits/stdc++.h>
using namespace std;
int n;
long long int k;
map<int,long long int>num;
int main()
{
    map<int,long long int>::iterator it;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        num[a]+=b;
    }
    for(it=num.begin();it!=num.end();++it){
        if(it->second>=k){
            cout<<it->first<<endl;
            break;
        }
        else
            k-=it->second;
    }
    return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  

  for (int i = 0; i < K+1 ; i++) {
  if (A < B && B < C) {
      cout << "Yes" <<endl;
      break;
  }else if (i == K){
      cout << "No" <<endl;
  }else if (A >= B) {
      B = B * 2;
  }else if (B >= C) {
      C = C * 2;
  }
  }

}

Measured memory_bytes: 3640
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>

using namespace std;

int main(void){
	int ans,h;
	int n,m;
	int l;
	int a;
	while(1){
		ans=0;
		h=0;
		cin >> l;
		if(l==0)break;
		for(a=1;a<=12;a++){
			cin >> n >> m;
			if(n>m)ans+=n-m;
			if(ans>=l && h==0)h=a;
		}
		if(h!=0)cout << h << endl;
		else cout << "NA" << endl;
	}
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < int(n) ;++i)
int n;

int in[100][5];
int ans;

void solve(){
  rep(i, n) rep(j, 5) cin >> in[n - i - 1][j];
  ans = 0;
  while(true){
    bool end = true;
    rep(i, n){
      rep(j, 5){
        if(in[i][j] == 0) continue;
        int k = j;
        while(k < 5){
          if(in[i][j] == in[i][k]) ++k;
          else break;
        }
        if(k - j >= 3){
          end = false;
          ans += (k - j) * in[i][j];
          for(int l = j; l < k; ++l)
            in[i][l] = 0;
        }
      }
    }
    if(end) break;
    while(true){
      bool end = true;
      for(int i = 0; i + 1 < n; ++i){
        rep(j, 5){
          if(in[i][j]) continue;
          if(in[i + 1][j]){
            end = false;
            swap(in[i + 1][j], in[i][j]);
          }
        }
      }
      if(end) break;
    }
  }
  
  cout << ans << endl;
}

int main(int argc, char *argv[])
{

  while(cin >> n && n) solve();
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 2147483647;
int prime = 998244353;
void Debug(auto a);
double PI = 3.14159265358979;
void input(vector<auto>& a,int n);
int n;


int gcd(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
int lcm(int u,int v){
    int r = gcd(u,v);
    r = (u / r)*v;
    return r;
}

signed main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int a,b;
    cin >> n >>a >> b;
    vec(x,n);
    input(x,n);
    int ans = 0;
    FOR(i,1,n){
        int tmp = x[i]- x[i-1];
        if(tmp*a<b){
            ans += tmp*a;
        }
        else{
            ans += b;
        }
    }
    print(ans);
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 4000
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <algorithm>
#include <stdio.h>
#include <functional>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		int x = i;
		if (x % 3 == 0)
		{
			cout << " " << i;
		}
		else
		{
			while (x != 0)
			{
				if (x % 10 == 3)
				{
					cout << " " << i;
					break;
				}
				x /= 10;
			}
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1160
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <deque>
#include <map>
using namespace std;

#define ii pair <int, int>
#define lli long long
#define pb push_back
#define X first
#define Y second

const int Mod = 1E9 + 7;
const int Inf = 1E9 + 7;
const int N = 2E5 + 10;

void Input()
{

}

void Solve()
{
    int res = 0;
    string s; cin >> s;
    int n = s.size(); s = " " + s;
    for (int i = 1; i <= n; i++) {
        if (s[i] != s[n - i + 1]) res++;
        s[i] = s[n - i + 1] = '.';
    }

    cout << res;
}

#define task "test"
int main()
{
    if (fopen(task ".inp", "r")) {
        freopen(task ".inp", "r", stdin);
        freopen(task ".out", "w", stdout);
    }
    int testcase = 1;
    /// cin >> testcase;
    while (testcase--) {
        Input();
        Solve();
    }
}




Measured memory_bytes: 3228
#include<set>
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int read(){
	int f=0,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f?-x:x;
}
#define MAXN 400000
#define INF 0x3f3f3f3f
string S;
int main(){
	cin>>S;
	if(S=="Sunny")
		puts("Cloudy");
	else if(S=="Rainy")
		puts("Sunny");
	else puts("Rainy");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
int a[100][6];
void rotation(int d,char c){
    int aoki;
    if(c=='N'){
        aoki=a[d][0];
        a[d][0]=a[d][1];
        a[d][1]=a[d][5];
        a[d][5]=a[d][4];
        a[d][4]=aoki;
    }
    else if(c=='S'){
        aoki=a[d][0];
        a[d][0]=a[d][4];
        a[d][4]=a[d][5];
        a[d][5]=a[d][1];
        a[d][1]=aoki;
    }
    else if(c=='E'){
        aoki=a[d][0];
        a[d][0]=a[d][3];
        a[d][3]=a[d][5];
        a[d][5]=a[d][2];
        a[d][2]=aoki;
    }
    else if(c=='W'){
        aoki=a[d][0];
        a[d][0]=a[d][2];
        a[d][2]=a[d][5];
        a[d][5]=a[d][3];
        a[d][3]=aoki;
    }
    else if(c=='R'){
        aoki=a[d][1];
        a[d][1]=a[d][2];
        a[d][2]=a[d][4];
        a[d][4]=a[d][3];
        a[d][3]=aoki;
    }
}
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        for(int j=0;j<6;++j){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<n-1;++i){
        for(int j=i+1;j<n;++j){
            for(int k=1;k<=6;++k){
                if(a[i][0]==a[j][0]&&a[i][5]==a[j][5]){
                    for(int l=0;l<4;++l){
                        if(a[i][1]==a[j][1]&&a[i][2]==a[j][2]&&a[i][3]==a[j][3]&&a[i][4]==a[j][4]){
                            cout<<"No"<<endl;
                            return 0;
                        }
                        else rotation(j,'R');
                    }
                }
                if(k==1) rotation(j,'N');
                else if(k==2) rotation(j,'W');
                else if(k==3) rotation(j,'W');
                else if(k==4) rotation(j,'W');
                else if(k==5) rotation(j,'N');
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}



Measured memory_bytes: 3124
<?php
[$N, $M] = ints();
$H = ints();
$map = array_fill(1, $N, []);
for($i = 0; $i < $M; $i++){
    list($a, $b) = ints();
    $map[$a][] = $b;
    $map[$b][] = $a;
}
$count = 0;
for($i = 1; $i <= $N; $i++){
    $flag = true;
    $h = $H[$i-1];
    foreach($map[$i] as $to){
        if($h <= $H[$to-1])$flag = false;
    }
    $count+=$flag;
}
echo $count;


function str(){return trim(fgets(STDIN));}
function ints(){return array_map('intval',explode(' ',trim(fgets(STDIN))));}
function int(){return intval(trim(fgets(STDIN)));}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}
function popcount($x){$c=0;while($x){$x&=$x-1;++$c;}return$c;}
function o(...$val){
    if(count($val)==1)$val=array_shift($val);
    echo debug_backtrace()[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0)echo "empty array";
        elseif(!is_array(current($val)))echo "array: ",implode(" ", addIndex($val)),"\n";
        else{
            echo "array:array\n";
            if(isCleanArray($val))foreach($val as $row)echo implode(" ", addIndex($row)),"\n";
            else foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row)),"\n";
        }
    }else echo $val."\n";
}
function addIndex($val){if(!isCleanArray($val)){$val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);}return $val;}
function isCleanArray($array){$clean=true;$i = 0;foreach($array as $k=>$v){if($k != $i++)$clean = false;}return $clean;}
// 座圧対象の配列 -> [圧縮された配列,復元用のMap,圧縮用のMap]
function atsu($array){$a = array_flip($array);$fuku=array_flip($a);sort($fuku);$atsu = array_flip($fuku);foreach($array as $i=>$val)$array[$i]=$atsu[$val];return [$array, $fuku, $atsu];}
function gcdAll($array){$gcd=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$gcd=gcd($gcd,$array[$i]);}return $gcd;}
function gcd($m, $n){if(!$n)return $m;return gcd($n, $m % $n);}
function lcmAll($array){$lcm=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$lcm=lcm($lcm,$array[$i]);}return $lcm;}
function lcm($a, $b) {return $a / gcd($a, $b) * $b;}

function dfs($current, $from = -1, $d = 0){
  global $G, $distance;
  $distance[$current] = $d;
  foreach($G[$current] as $to){
    if($from != $to){
      dfs($to, $current, $d + 1);
    }
  }
}

function loadTree($N = false){
  if($N === false)$N = $GLOBALS['N'];
  return loadGraph($N, $N-1);
}
function loadGraph($N = false, $M = false, $both = true){
  if($N === false)$N = $GLOBALS['N'];
  if($M === false)$M = $GLOBALS['M'];
  $G = array_fill(1, $N, []);
  for($i = 0; $i < $M; $i++){
    $values = ints();
    if(count($values) == 2){
      list($a, $b) = $values;
      $G[$a][] = $b;
      if($both)$G[$b][] = $a;
    }else{
      list($a, $b, $d) = $values;
      $G[$a][] = [$b, $d];
      if($both)$G[$b][] = [$a, $d];
    }
  }
  return $G;
}


Measured memory_bytes: 57768
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: [i64; n],
    }
    let mut dict = HashMap::new();
    let mut acc = 0i64;
    for a_ in a {
        *dict.entry(a_).or_insert(0i64) += 1i64;
    }
    for (k, v) in dict.iter() {
        if k <= v {
            acc += *v - k;
        } else {
            acc += *v;
        }
    }
    println!("{}", acc);
}


Measured memory_bytes: 12540
s = input()
t = ''
add_list = ['dream', 'dreamer', 'erase', 'eraser']
cur = len(s)
for i in range(len(s)):
    if s[-1 - i:cur] in add_list:
        cur = -1 - i
if -cur == len(s):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
using namespace std;

int large = 100000000;

int main()
{
  double a, b, x;
  cin >> a >> b >> x;
  double deg;
  double c;
  double pi = 3.14159265358979;
  if(x/a < a*b/2){
    deg = atan2(b, (x*2.0)/(a*b));
    deg *=(180.0/pi);
  }else{
    c = (x*2.0)/(a*a)-b;
    deg = atan2(b-c,a);
    deg *=(180.0/pi);
  }
  printf("%12.10lf\n", deg);

}

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

int main() {
    string b;
    cin >> b;
    if (b == "A"){
        cout << "T" << endl;
    }
    else if (b == "C"){
        cout << "G" << endl;
    }
    else if (b == "G"){
        cout << "C" << endl;
    }
    else{
        cout << "A" << endl;
    }
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

//qiita.com/drken/items/cce6fc5c579051e64fab
template <class Abel>
struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<int> size;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n);
        rank.resize(n);
        size.resize(n);
        diff_weight.resize(n);
        for (int i = 0; i < n; ++i)
            par[i] = i, rank[i] = 0, size[i] = 1, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        } else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    int get_size(int x) {
        return size[root(x)];
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x);
        w -= weight(y);
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        size[x] = size[y] = size[x] + size[y];
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind<int> uf(n);
    vii friends(n);
    vii blocks(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        friends[a].push_back(b);
        friends[b].push_back(a);
        uf.merge(a, b, 1);
    }
    // rep(i, n) {
    //     debug(uf.get_size(i));
    // }
    rep(i, k) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        blocks[a].push_back(b);
        blocks[b].push_back(a);
    }
    rep(i, n) {
        int ans = uf.get_size(i);
        ans -= 1 + friends[i].size();
        for (auto e : blocks[i]) {
            if (uf.issame(i, e)) ans--;
        }
        out(max(0, ans));
    }
    return 0;
}


Measured memory_bytes: 13432
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();

            var count = 0L;
            for (int i = 1; i <= N; i++)
            {
                if (i % 2 == 0) continue;
                if (GetDivisors(i).Count() == 8)
                {
                    count++;
                }
            }

            return count;
        }

        public static IEnumerable<long> GetDivisors(long n)
        {
            var sqrt = Math.Sqrt(n);
            for (long d = 1; d < sqrt; d++)
            {
                if (n % d == 0)
                {
                    yield return d;
                    yield return n / d;
                }
            }

            // 平方根が整数の場合は約数となる
            if (sqrt == (long)sqrt)
            {
                yield return (long)sqrt;
            }
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 27912
while True :
    n = int(input())
    s = 0
    if n == 0 :
        break
    else :
        m = 1000 - n
        
        if m >= 500 :
            s += 1
            m -= 500
        
        while m >= 100 :
            s += 1
            m -= 100
        
        while m >= 50 :
            s += 1
            m -= 50
            
        while m >= 10 :
            s += 1
            m -= 10
            
        while m >= 5 :
            s += 1
            m -= 5
            
        s += m    
    
    print(s)


Measured memory_bytes: 5592
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

struct Node { int p, l, r; };

Node *u;

void Preorder(int id) {
	if (id == -1) return;
	cout << " " << id;
	Preorder(u[id].l);
	Preorder(u[id].r);
}

void Inorder(int id) {
	if (id == -1) return;
	Inorder(u[id].l);
	cout << " " << id;
	Inorder(u[id].r);
}

void Postorder(int id) {
	if (id == -1) return;
	Postorder(u[id].l);
	Postorder(u[id].r);
	cout << " " << id;
}

int main() {
	int n;
	cin >> n;
	u = new Node[n];

	for (int i = 0; i < n; i++)
		u[i].p = u[i].l = u[i].r = -1;
	for (int i = 0; i < n; i++) {
		int id, l, r;
		cin >> id >> l >> r;
		u[id].l = l;
		u[id].r = r;
		if (l != -1) u[l].p = id;
		if (r != -1) u[r].p = id;
	}
	int root = 0;
	cout << "Preorder" << endl;
	for (root = 0; root < n; root++)
		if (u[root].p == -1) {
			Preorder(root);
			break;
		}
	cout << endl;
	cout << "Inorder" << endl;
	Inorder(root);
	cout << endl;
	cout << "Postorder" << endl;
	Postorder(root);
	cout << endl;

	delete[] u;
	return 0;
}

Measured memory_bytes: 1200
import numpy as np
import itertools
n = int(input())
ixy = []
for i in range(n):
    a = int(input())
    for j in range(a):
        x,y = map(int, input().split())
        ixy.append([i,x-1,y])

ans = 0
ixy = np.array(ixy)
p = itertools.product([True,False], repeat=n)
for p_i in p:
    f = True
    for i,x,y in ixy:
        if not p_i[i]:
            continue
        else:
            if p_i[x] != y:
                f = False
                break
    if f:
        ans = max(sum(p_i), ans)
print(ans)

Measured memory_bytes: 27092
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstdio>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

signed main() {
    int n;
    int p[10] = {0};
    int max = 0;
    int ans = 0;
    cin >> n;
    rep (i, n) {
        cin >> p[i];
        if (max < p[i]) {
            max = p[i];
        }
        ans += p[i];
    }
    cout << ans - max / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <random>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

ll GCD(ll a, ll b){
	if(b==0) return a;
	
	return GCD(b, a%b);
}

int prime[1000001];


bool solve(int n, vector<int> a){
	bool pairwise=true; 
	prime[1] = 1;
	REP(i,n){
		if(a[i] != 1 && prime[a[i]] == 1){
			pairwise = false;
			break;
		}else{
			prime[a[i]] = 1;
		}
		for(int k=2; k*k<=a[i];k++){
			if(a[i]%k==0){
				if(prime[k]==1 || prime[a[i]/k]==1){
					pairwise = false;
					break;
				}else{
					prime[k] = 1;
					prime[a[i]/k]=1;
				}
			}
		}
	}
	return pairwise;
	
}

bool gutyoku(int n, vector<int> a){
	bool pairwise=true;
	REP(i,n){
		for(int j=i+1; j<n; j++){
			if(GCD(a[i],a[j])!=1){
				pairwise=false;
			}
		}
	}
	return pairwise;
}

int main(){
	
	int n;
	cin >> n;
	vector<int> a(n);
	int wholegcd;
	REP(i,n){
		cin >> a[i];
		if(i==0) wholegcd = a[i];
		else wholegcd = GCD(wholegcd, a[i]);
	}
	bool pairwise = solve(n,a);
	/*random_device rnd;
	int n=rnd()%10 + 2;
	int wholegcd;
	vector<int> a(n);
	REP(i,n){
		a[i] = rnd()%100+1;
		if(i==0) wholegcd = a[i];
		else wholegcd = GCD(wholegcd, a[i]);
	}
	cout << "w " << wholegcd<< endl;
 	cout << "s " << solve(n,a)<<endl;
	cout << "g " << gutyoku(n,a) << endl;
	*/

	
	if(pairwise){
		cout << "pairwise coprime" << endl;
	}else if(wholegcd==1){
		cout << "setwise coprime" << endl;
	}else{
		cout << "not coprime" << endl;
	}
		
	
	return 0;
}

Measured memory_bytes: 14880
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;
const int MAXN = 1000000 + 10;

long long n, p;

long long fac[MAXN], times[MAXN];
int cnt;

int main(){
	scanf("%lld%lld", &n, &p);
	
	for(register int i=2; i<=sqrt(p); i++){
		if(p % i == 0){
			fac[++cnt] = i;
			
			while(p % i == 0){
				times[cnt]++;
				
				p /= i;
			}
		}
	}
	
	if(p > 1){
		times[++cnt] = 1;
		fac[cnt] = p;
	}
	
	long long ans = 1;
	
	for(register int i=1; i<=cnt; i++){
		ans *= (long long)max((long long)1, (long long)pow(fac[i] , (long long)floor((long double)times[i] / n)));
	}
	
	printf("%lld", ans);

	return 0;
}


Measured memory_bytes: 2304
n = gets.chomp.to_i
hs = gets.chomp.split(' ').map(&:to_i)

if (hs.max - hs.min).abs <= 1
    puts 'Yes'
    exit
end
max = 0
(n).times do |i|
    if hs[i] - max < -1
        puts 'No'
        exit
    end
    max = hs[i] if max < hs[i]
end
puts 'Yes'

Measured memory_bytes: 9604
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
ans = 1
temp1 = t - h[0] * 0.006
for i in range(1,n):
    temp2 = t - h[i] * 0.006
    if abs(temp1-a) > abs(temp2-a):
        ans = i + 1
        temp1 = temp2
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
using namespace std;

typedef long long ll;
#define pb push_back

#define rep(i, n) for (int i=0;i<(n);++i)
#define rep2(i, s, n) for (int i=s;i<(n);++i)
#define INF (1e9)

/* Adjacent List */
using Edge = pair<int,int>;
using Edges = vector<Edge>;
#define to   first
#define cost second

/* DFS-based Topological Sort */
void dfs(Edges G[], int u, char visited[], vector<int>& L)
{
    visited[u] = 1;
    for(auto v:G[u]) if(!visited[v.to]) dfs(G, v.to, visited, L);
    L.insert(L.begin(), u);
}

void tsort(Edges G[], int V, vector<int>& L)
{
    char visited[V];
    memset(visited, 0, sizeof(visited));
    rep(i,V) if(!visited[i]) dfs(G,i,visited,L);
}
    
int main()
{
    int V,E; cin>>V>>E;
    Edges G[V];
    vector<int> L;

    rep(i,E) {
        int u,v; cin>>u>>v; 
        G[u].pb(Edge(v,1));
    }
    tsort(G,V,L);

    for(auto e:L) cout << e << endl;
}

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

int main(){
  int n;
  cin>>n;
  map<int,int> mp;
  rep(i,n){
    int a; cin>>a;
    mp[a]++;
  }
  int ans=0;
  int b=0;
  for(auto x : mp){
    ans++;
    if(x.second%2==1) continue;
    b++;
  }
  if(b%2==1) ans--;
  cout<<ans<<endl;
}



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

int main() {
  string s;
  int date = 0;
  cin >> s;
  if (s == "SUN")
    date = 7;
  if (s == "MON")
    date = 6;
  if (s == "TUE")
    date = 5;
  if (s == "WED")
    date = 4;
  if (s == "THU")
    date = 3;
  if (s == "FRI")
    date = 2;
  if (s == "SAT")
    date = 1;
  cout << date << endl;
}


Measured memory_bytes: 256
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.reverse()
B.reverse()
cnt = 0
for i in range(N):
    cnt += -(A[i]+cnt)%B[i]
print(cnt)

Measured memory_bytes: 11052
#include<iostream>
#include<list>
#include<string>
using namespace std;
int main(){
	list<long long>l; long long n; scanf("%lld", &n);
	for (long long i = 0; i < n; i++){
		string s; cin >> s;
		if (s[0] == 'i') { long long k; scanf("%lld", &k); l.push_front(k); }
		else{
			if(s.size() == 6){
				long long k; scanf("%lld", &k);
				for (auto i = l.begin(); i != l.end(); i++){
					if (*i == k) {
						l.erase(i);
						break;
					}
				}
			}
			else if (s[6] == 'F')l.pop_front();
			else l.pop_back();
		}
	}
	bool y = false;
	for (auto i = l.begin(); i != l.end(); i++){
		if (y)cout << ' ';
		cout << *i;
		y = true;
	}
	cout << endl;
}

Measured memory_bytes: 34452
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int a[3];

  std::cin >> a[0] >> a[1] >> a[2];

  std::sort(a, a + 3);

  std::cout << a[0] * a[1] / 2 << std::endl;

  return 0;
}


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

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

#define ll long long
#define ull unsigned ll

void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(ll *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(double *x){scanf("%lf",x);}
int reader(char c[]){int i,s=0;for(;;){mygc(i);if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF) break;}c[s++]=i;for(;;){mygc(i);if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF) break;c[s++]=i;}c[s]='\0';return s;}
template <class T, class S> void reader(T *x, S *y){reader(x);reader(y);}
template <class T, class S, class U> void reader(T *x, S *y, U *z){reader(x);reader(y);reader(z);}
template <class T, class S, class U, class V> void reader(T *x, S *y, U *z, V *w){reader(x);reader(y);reader(z);reader(w);}

void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(ll x, char c){int s=0,m=0;char f[20];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(double x, char c){printf("%.15f",x);mypc(c);}
void writer(const char c[]){int i;for(i=0;c[i]!='\0';i++)mypc(c[i]);}
void writer(const char x[], char c){int i;for(i=0;x[i]!='\0';i++)mypc(x[i]);mypc(c);}
template<class T> void writerLn(T x){writer(x,'\n');}
template<class T, class S> void writerLn(T x, S y){writer(x,' ');writer(y,'\n');}
template<class T, class S, class U> void writerLn(T x, S y, U z){writer(x,' ');writer(y,' ');writer(z,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){mypc('\n');return;}rep(i,n-1)writer(x[i],' ');writer(x[n-1],'\n');}

char memarr[17000000]; void *mem = memarr;
#define MD 1000000007

int N, A[100000];

int main(){
  int i, j, k, mx = 1;
  ll res;

  reader(&N);
  rep(i,N) reader(A+i);
  res = A[0] - 1;
  A[0] = 1;
  REP(i,1,N){
    if(A[i] == mx+1){ mx++; continue; }
    res += (A[i] - 1) / (mx+1);
  }
  writerLn(res);

  return 0;
}


Measured memory_bytes: 640
L = list(map(int,input().split()))
L.sort()
c = 0
if L[0] == 1:
  c += 1
if L[1] == 4:
  c += 1
if L[2] == 7:
  c += 1
if L[3] == 9:
  c += 1
if c == 4:
  print('YES')
else:
  print('NO')

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

int main() {
  int N,M;
  cin >> N >> M;
  int A[N];
  for(int i=0;i<N;++i){
    cin >> A[i];
  }
  
  int count = 0;
  int sum = 0;
  int a;
  for(int i=0;i<N;++i){
    sum = sum + A[i];
  }
  a = sum % (4*M);
  sum = sum / (4*M);
  if(a!=0){
    for(int i=0;i<N;++i){
      if(A[i]>sum) count = count + 1;
    }
  }else{
    for(int i=0;i<N;++i){
      if(A[i]>=sum) count = count + 1;
    }
  }
  if(count>=M) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

}



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

int main() {
  int N,A,B,C,D;
  cin>>N;
  A=N/1000;
  B=(N-A*1000)/100;
  N=N-A*1000-B*100;
  C=N/10;
  D=N-C*10;
  char op1,op2,op3;
  if(A+B+C+D==7){op1='+',op2='+',op3='+';}
  if(A+B+C-D==7){op1='+',op2='+',op3='-';}
  if(A+B-C+D==7){op1='+',op2='-',op3='+';}
  if(A+B-C-D==7){op1='+',op2='-',op3='-';}
  if(A-B+C+D==7){op1='-',op2='+',op3='+';}
  if(A-B+C-D==7){op1='-',op2='+',op3='-';}
  if(A-B-C+D==7){op1='-',op2='-',op3='+';}
  if(A-B-C-D==7){op1='-',op2='-',op3='-';}
  cout<<A<<op1<<B<<op2<<C<<op3<<D<<"=7"<<endl;
}

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

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

    string S, T;
    cin >> S >> T;

    int ans = 2 * N;
    rep(i, N)  {
        if (S.substr(i) == T.substr(0, N-i)) {
            ans = N + i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector <int> d (n);
  for (int i = 0; i < n; i++)
    cin >> d[i];
  sort(d.begin(), d.end());
  cout << d[n / 2] - d[(n / 2) - 1] << endl;
}

Measured memory_bytes: 640
using System;

namespace AOJ.ITP
{
    public class Distance
    {
        public static void Main()
        {
            var input = Console.ReadLine().Split(' ');
            double x1 = double.Parse(input[0]);
            double y1 = double.Parse(input[1]);
            double x2 = double.Parse(input[2]);
            double y2 = double.Parse(input[3]);

            double x = Math.Abs(x1 - x2);
            double y = Math.Abs(y1 - y2);
            Console.WriteLine(Math.Sqrt(x * x + y * y));
        }
    }
}

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

using namespace std;

long long int h,w,a,b;
const int nax=2e5+5;
long long int s[nax];
int mod=1e9+7;

long long int pot(long long int a,long long int b)
{
    if(b==0) return 1;
    long long int res=pot(a,b/2);
    res*=res;
    res%=mod;
    if(b&1) res*=a;
    return res%mod;
}

long long int inv(long long int a)
{
    return pot(a,mod-2);
}

long long int nk(long long int n,long long int k)
{
    long long res=s[n];
    res*=inv(s[k]);
    res%=mod;
    res*=inv(s[n-k]);
    return res%mod;
}

int main()
{
    cin>>h>>w>>a>>b;
    s[0]=1;
    for(int i=1;i<nax;i++)
    {
        s[i]=s[i-1]*i;
        s[i]%=mod;
    }
    long long int res=0;
    for(int i=1;i<=h-a;i++)
    {
        long long int akt=nk(b-1+i-1,b-1);
        akt*=nk(h-1-i+1+w-b-1,w-b-1);
        res+=akt;
        res%=mod;
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 1792