akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define eps 1e-8
#define mo 974711
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
 	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
struct node {
    int to,next;int64 val;
}E[MAXN * 2];
int N,sumE,head[MAXN],siz[MAXN],son[MAXN],dep[MAXN],fa[MAXN];
int64 ans;
void add(int u,int v,int64 c) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    E[sumE].val = c;
    head[u] = sumE;
}
void dfs(int u) {
    siz[u] = 1;
    dep[u] = dep[fa[u]] + 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(v != fa[u]) {
	    fa[v] = u;
	    dfs(v);
	    siz[u] += siz[v];
	    son[u] = max(siz[v],son[u]);
	    ans += min(siz[v],N - siz[v]) * 2 * E[i].val;
	}
    }
    son[u] = max(son[u],N - siz[u]);
}
void Solve() {
    read(N);
    int a,b;int64 c;
    for(int i = 1 ; i < N ; ++i) {
	read(a);read(b);read(c);
	add(a,b,c);add(b,a,c);
    }
    dfs(1);
    int t = 1;
    for(int i = 2 ; i <= N ; ++i) {
	if(son[i] < son[t] || (son[i] == son[t] && dep[i] > dep[t])) t = i;
    }
    if(N % 2 == 0 && son[t] == N / 2) {
	for(int i = head[t] ; i ; i = E[i].next) {
	    if(E[i].to == fa[t]) ans -= E[i].val;
	}
    }
    else {
	int64 k = 0x7fffffff;
	for(int i = head[t] ; i ; i = E[i].next) {
	    k = min(k,E[i].val);
	}
	ans -= k;
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 11520
#include <iostream>

using namespace std;

int main() {
    int N, X;
    int m[110];
    int sum = 0;
    int min = 999999;

    cin >> N >> X;
    for(int i = 0; i < N; i++) {
        cin >> m[i];
        sum += m[i];
        if(m[i] < min) min = m[i];
    }

    cout << (int)(X - sum)/min + N << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	long long n,k;
	cin >> n >> k;
	vector<long long> a(n);
	for(int i=0;i<n;i++)
		cin >> a[i];
	vector<long long> f(n);
	for(int i=0;i<n;i++)
		cin >> f[i];
	sort(a.begin(),a.end());
	sort(f.begin(),f.end());
	reverse(f.begin(),f.end());

	long long mn=-1;
	long long mx=0;
	vector<long long> t(n);
	for(int i=0;i<n;i++)
	{
		t[i]=a[i]*f[i];
		if(t[i]>mx)
			mx=t[i];
	}


	mx++;
	while(mx-mn > 1)
	{
		long long mid = (mn + mx) / 2;

		long long req=0;
		for(int i=0;i<n;i++)
		{
			if(t[i]<=mid)continue;
			long long tmp=t[i]-mid;
			req+=(tmp+f[i]-1)/f[i];
		}

		if(req<=k)mx = mid;
		else mn = mid;
	}

	cout << mx << endl;
}


Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;



signed main()
{
	int A, B;
	cin >> A >> B;
	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0)
	{
		cout << "Possible" << endl;
	}
	else
	{
		cout << "Impossible" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
using pii = pair<int, int>;
using vi=vector<int>;
using vvi=vector<vector<int>>;

int h,w,c;
int mx=0;
vvi last_cond;
int dfs(vvi p,int color,int depth){

    int base = p[0][0];
    queue<pii>q;
    p[0][0]=color;
    q.push(pii(0,0));
    vvi visited(h,vi(w));
    visited[0][0]=true;
    int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
    auto inrange=[&](int x,int y){ return 0<=x and x<h and 0<=y and y<w;};
    while(q.size()){
        pii v=q.front();
        q.pop();
        int x=v.first,y=v.second;
        rep(k,0,4){
            int xx=x+dx[k],yy=y+dy[k];
            if(not inrange(xx,yy) or visited[xx][yy])continue;
            if(p[xx][yy]==base){
                p[xx][yy]=color;
                visited[xx][yy]=1;
                q.emplace(xx,yy);
            }
        }
    }

    if(depth==4){
        if(color!=c)return 0;
        q.emplace(0,0);
        visited=vvi(h,vi(w));
        visited[0][0]=1;
        while(q.size()){
           pii v=q.front();
            q.pop();
            int x=v.first,y=v.second;
            rep(k,0,4){
                int xx=x+dx[k],yy=y+dy[k];
                if(not inrange(xx,yy) or visited[xx][yy])continue;
                if(p[xx][yy]==c){
                    visited[xx][yy]=1;
                    q.emplace(xx,yy);
                }
            }
        }
        int ret=0;
        rep(i,0,h){
            rep(j,0,w)ret+=visited[i][j];
        }
        return ret;
    }
    else {
        int ret=0;
        rep(i,1,6+1){
            ret=max(ret,dfs(p,i,depth+1));
        }
        return ret;
    }
}

signed main() {
    while(cin>>h>>w>>c, h or w or c){
        vvi p(h,vi(w));
        rep(i,0,h){
            rep(j,0,w){
                cin>>p[i][j];
            }
        }
        int ans=0;
        rep(i,1,6+1){
            ans=max(ans,dfs(p,i,0));
        }
        cout<<ans<<endl;

        // rep(i,0,h){
        //     rep(j,0,w)cout<<last_cond[i][j]<<(j==w-1?'\n':' ');
        // }
    }
}


Measured memory_bytes: 3140
import java.util.*;
public class Main {
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int [N+1];
    int n = (int)Math.sqrt(N);
    for (int x=1; x<n; x++) {
      for (int y=1; y<n; y++) {
        for (int z=1; z<n; z++) {
          int num = x*x+y*y+z*z+x*y+x*z+y*z;
          if (num <= N)
            array[num] += 1;
        }
      }
    }
    for (int i=1; i<N+1; i++)
      System.out.println(array[i]);
  }
}

Measured memory_bytes: 39232
#include <stdio.h>

/* Macro Definition */
#define MAX 500000

/* Prototype Declaration */
void marge(int, int, int);
void margeSort(int, int);

/* Grobal Variable */
int S[MAX], L[(MAX/2) + 1], R[(MAX/2) + 1], n, count = 0;

int main() {
  int i;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &S[i]);

  margeSort(0, n);

  for ( i = 0; i < n; i++ ) {
    printf("%d", S[i]);
    if(i < n - 1) printf(" ");
  }
  printf("\n%d\n", count);


  return 0;
}

void marge(int left, int mid, int right) {
  int i, j = 0, k, n1, n2;
  n1 = mid - left;
  n2 = right - mid;

  for ( i = 0; i < n1; i++ ) L[i] = S[i+left];
  for ( i = 0; i < n2; i++ ) R[i] = S[i+mid];

  L[n1] = 1000000050;
  R[n2] = 1000000050;

  i = 0;

  for ( k = left; k < right; k++ ) {
    count++;
    if ( L[i] <= R[j] ) {
      S[k] = L[i];
      i++;
    }else {
      S[k] = R[j];
      j++;
    }
  }

}

void margeSort(int left, int right) {
  int mid;
  
  if( left + 1 < right ) {
    mid = (left + right) / 2;
    margeSort(left, mid);
    margeSort(mid, right);
    marge(left, mid, right);
  }

}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> v(4010,0);
  rep(i,1001){
    rep(j,1001){
      v[i+j]++;
    }
  }
  int n;
  while(cin >> n){
    int ans = 0;
    rep(i,(n+1)){
      ans += v[i] * v[n-i];
    }
    cout << ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3124
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String[] nkqArr = sc.nextLine().split(" ");
		int n = Integer.parseInt(nkqArr[0]);
		int k = Integer.parseInt(nkqArr[1]);
		int q = Integer.parseInt(nkqArr[2]);
		int[] answerTime = new int[n];
		for(int i = 0; i < q ; i++) {
			int answerPerson = sc.nextInt() -  1;
			answerTime[answerPerson] = answerTime[answerPerson] + 1;
		}
		
		for(int i = 0 ; i < n; i++) {
			if(k - (q - answerTime[i]) <= 0) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
		}
		
	}
}

Measured memory_bytes: 68496
/*
    crane_and_turtle.c
    2020/06/14
*/

#include <stdio.h>

int main()
{
    int x, y;
    scanf("%d %d", &x, &y);
    
    /* 条件の確認をする */
    if ((y % 2 == 0) && (y <= 4 * x) && (2 * x <= y)) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 1644
#include<iostream>
#include<vector>
#include<unordered_map>
#include<stack>

using namespace std;

int main(){
    unordered_map< string , int > hm= {
                                                {"Sunny",0},
                                                {"Cloudy",1},
                                                {"Rainy",2}
                                            };
    vector< string  > weather = { "Sunny"  , "Cloudy" , "Rainy"  };
    string inp;
    cin >> inp;
    cout << weather[(hm[inp]+1)%3];
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;


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

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std ; 
typedef long long ll;
#define forn(i,e) for(ll i=0; i<e; i++)
#define endl "\n"
#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PB push_back 
#define MP make_pair
#define F first
#define S second


int main()
{

zoom;

string s ; cin >> s ; 
ll c ; c  =0  ;
forn(i , ((s.size()-1)/2) +1)
{
	if(s[i] != s[s.size()-1 - i])
	c++ ; 
}
cout << c ; 
}

Measured memory_bytes: 3584
using System;
using System.Linq;

namespace CodeFestival2017qualAC
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] ints = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            int H = ints[0];
            int W = ints[1];

            string[] matrix = new string[H];
            for (int i = 0; i < H; i++)
            {
                matrix[i] = Console.ReadLine();
            }

            int wildCard = 0;
            int pairs = 0;
            if (H % 2 == 1 & W % 2 == 1)
            {
                wildCard = 1;
                pairs = W / 2 + H / 2;
            } else if (H % 2 == 1)
            {
                pairs = W / 2;
            } else if (W % 2 == 1)
            {
                pairs = H / 2;
            }

            int[] counts = new int[26];
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    counts[matrix[i][j] - 'a']++;
                }
            }

            for (int i = 0; i < 26; i++)
            {
                counts[i] %= 4;
                if (counts[i] == 0)
                {
                    continue;
                }

                if (counts[i] == 2)
                {
                    pairs--;
                }

                if (counts[i] % 2 == 1)
                {
                    wildCard--;
                }
            }

            if (pairs < 0 | wildCard < 0)
            {
                Console.WriteLine("No");
                return;
            }
            Console.WriteLine("Yes");
        }
    }
}

Measured memory_bytes: 13396
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N; cin >> N;
    VI A(N);
    REP(i, N) cin >> A.at(i);

    sort(ALL(A));

    cout << A.at(A.size()-1) - A.at(0) << endl;
  
    return 0;
}



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

using namespace std;


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

    long long a , b, c, d;
    cin >> a >> b >> c >>d;
    long long x = max(a * c, b * d);
    long long y = max(b * c, a * d);
    cout << max(x, y) <<"\n";
}

Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    int x = (n - 1) * (n - 2) / 2;
    if(x < k){
        cout << -1 << endl;
        return 0;
    }

    vector<pair<int, int> > ans;
    for(int i=0; i<n-1; ++i)
        ans.push_back(make_pair(i, n-1));
    for(int i=0; i<n-1; ++i){
        for(int j=i+1; j<n-1; ++j){
            if(x > k){
                ans.push_back(make_pair(i, j));
                -- x;
            }
        }
    }

    cout << ans.size() << endl;
    for(const auto& p : ans)
        cout << (p.first + 1) << ' ' << (p.second + 1) << endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;

const int N = 2e5 + 7;

vector <int> g[N];
int h[N];

void dfs(int u, int p) {
  for (auto v : g[u]) {
    if (v != p) {
      h[v] = h[u] + 1;
      dfs(v, u);
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  for (int i = 0; i + 1 < n; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, -1);
  vector <vector <int>> who(2);
  for (int i = 0; i < n; ++i) {
    who[h[i] % 2].push_back(i);
  }
  vector <int> cnt(3);
  vector <vector <int>> have(3);
  for (int i = 1; i <= n; ++i) {
    ++cnt[i % 3];
    have[i % 3].push_back(i);
  }
  vector <int> ans(n, -1);
  if (who[0].size() >= cnt[1] && who[1].size() >= cnt[2]) {
    for (int x : who[0]) {
      if (cnt[1] > 0) {
        ans[x] = have[1].back();
        have[1].pop_back();
        --cnt[1];
      }
    }
    for (int x : who[1]) {
      if (cnt[2] > 0) {
        ans[x] = have[2].back();
        have[2].pop_back();
        --cnt[2];
      }
    }
  } else if (who[0].size() >= cnt[2] && who[1].size() >= cnt[1]) {
    for (int x : who[0]) {
      if (cnt[2] > 0) {
        ans[x] = have[2].back();
        have[2].pop_back();
        --cnt[2];
      }
    }
    for (int x : who[1]) {
      if (cnt[1] > 0) {
        ans[x] = have[1].back();
        have[1].pop_back();
        --cnt[1];
      }
    }
  } else if (who[0].size() >= cnt[1] + cnt[2]) {
    for (int x : who[0]) {
      if (cnt[1] > 0) {
        ans[x] = have[1].back();
        have[1].pop_back();
        --cnt[1];
      } else if (cnt[2] > 0) {
        ans[x] = have[2].back();
        have[2].pop_back();
        --cnt[2];
      }
    }
  } else if (who[1].size() >= cnt[1] + cnt[2]) {
    for (int x : who[1]) {
      if (cnt[1] > 0) {
        ans[x] = have[1].back();
        have[1].pop_back();
        --cnt[1];
      } else if (cnt[2] > 0) {
        ans[x] = have[2].back();
        have[2].pop_back();
        --cnt[2];
      }
    }

  } else {
    cout << "-1\n";
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    if (ans[i] == -1) {
      ans[i] = have[0].back();
      have[0].pop_back();
    }
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << ' ';
}



Measured memory_bytes: 20596
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
//const long long int pl=1000000;

long long int N;

int main(){
    cout << fixed << setprecision(18);
    cin>>N;
    cout<<N*N*N<<endl;
    
}



Measured memory_bytes: 3640
sheet = [list(map(int, input().split())) for _ in range(3)]
n = int(input())

li = [[False] * 3 for i in range(3)]

for i in range(n):
    m = int(input())
    for j in range(3):
        for k in range(3):
            if sheet[j][k] == m:
                li[j][k] = True


# check
ans = False
for i in range(3):
    tmp = li[0][i] & li[1][i] & li[2][i]
    if tmp:
        ans = True
        break
for i in range(3):
    tmp = li[i][0] & li[i][1] & li[i][2]
    if tmp:
        ans = True
        break

tmp = li[0][0] & li[1][1] & li[2][2]
if tmp:
    ans = True
tmp = li[0][2] & li[1][1] & li[2][0]
if tmp:
    ans = True

if ans:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
int DX[4]={-1,0,1,0};
int DY[4]={0,1,0,-1};

int H, W;
char S[50][50];
int D[50][50];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> H >> W;
  int w=0;
  rep(y, H)rep(x,W)cin>>S[x][y],D[x][y]=INF,w+=S[x][y]=='.';
  queue<P> q;
  q.push(P(0,0));
  D[0][0]=1;
  while (!q.empty()) {
    int x=q.front()._1,y=q.front()._2;q.pop();
    rep(k,4){
      int nx=x+DX[k],ny=y+DY[k];
      if (nx<0||ny<0||nx>=W||ny>=H||S[nx][ny]=='#')continue;
      if(D[nx][ny]>D[x][y]+1){
        D[nx][ny]=D[x][y]+1;
        q.push(P(nx,ny));
      }
    }
  }
  if(D[W-1][H-1]==INF)cout<<-1<<"\n";
  else cout<<w-D[W-1][H-1]<<"\n";
  return 0;
}


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

typedef unsigned long long ull;

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

	int N, A;
	int x[50];
	ull dp[2501][51];
	cin >> N >> A;
	for(int i=0; i<N; i++) cin >> x[i];

	for(int i=0; i<=2500; i++){
		for(int j=0; j<=50; j++) dp[i][j] = 0;
	}
	dp[0][0] = 1;

	for(int i=0; i<N; i++){
		for(int k=50; k>0; k--){
			for(int j=x[i]; j<=2500; j++){
				dp[j][k] += dp[j-x[i]][k-1];
			}
		}
	}

	ull res = 0;
	for(int k=1; k<=50; k++){
		for(int j=1; j<=2500; j++){
			if(j == A * k) res += dp[j][k];
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <iostream>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define tii tuple<int,int,int>
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}
int main(){
    double pie=3.14159265358979323846;
    double a=in(),b=in(),x=in();
    double y=b*2-x*2/(a*a);
    double ans;
    if(y<=b){
        ans=atan(y/a)*180/pie;
    }else{
        y=2*x/a/b;
        ans=atan(b/y)*180/pie;
    }
    cout<<std::setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main(){

  ll n;
  cin >> n;
  ll p[n];

  REP(i, 0, n)
    cin >> p[i];

  int ans = 0;
  REP(i, 1, n-1){
    if ( ((p[i-1] < p[i]) and (p[i] < p[i+1])) or ((p[i+1] < p[i]) and (p[i] < p[i-1])) )
      ans++;
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
  int n, x;
  while (cin >> n >> x && n) {
    int ans = 0;
    int k;
    for (auto i=1; i<=n; i++) {
      for (auto j=1; j<i; j++) {
        k = x - i - j;
        if (1 <= k && k < j) {
          // cerr << "i = " << i << ", j = " << j << ", k = " << k << endl;
          ans++;
        }
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k;
    cin>>a>>b>>c;
    cin>>k;
    while(k&&b<=a)
    {
        b=b*2;
        k--;
    }
    while(k&&c<=b)
    {
        c=c*2;
        k--;
    }
    if(a<b&&b<c)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 998244353;
const ll MAX = 2000001;

ll mod(ll a){
  if(a % MOD < 0) return MOD + (a % MOD);
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  string s; cin >> s;
  cout << s[0] << s.size()-2 << s[s.size()-1] << endl;
}

Measured memory_bytes: 3600
import java.util.*;

public class Main {
    public static Scanner Scan = new Scanner(System.in);

    public static void main(String[] args) {
        int n;
        n = Scan.nextInt();
        int arr[] = new int[n];
        for(int i=0; i<n; i++) arr[i] = Scan.nextInt();

        int ans = 0;

        for(int i=0; i<n; i++) {
            for(int j=i+1; j<n; j++) {
                for(int k=j+1; k<n; k++) {
                    if(arr[i]==arr[j] || arr[i]==arr[k] || arr[j]==arr[k]) continue;
                    int x = arr[i], y = arr[j], z = arr[k];
                    if(x > y) {x ^= y; y ^= x; x ^= y;}
                    if(x > z) {x ^= z; z ^= x; x ^= z;}
                    if(y > z) {y ^= z; z ^= y; y ^= z;}

                    if(x + y > z) ans++;
                }
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 37028
n,m=map(int,input().split())
p=2**n
inf=10**9
dp=[inf]*p
dp[0]=0
for i in range(m):
  a,b=map(int,input().split())
  c=sum([2**(j-1) for j in list(map(int,input().split()))])
  for k in range(p):
    if dp[k|c]>dp[k]+a:
      dp[k|c]=dp[k]+a
print(dp[-1] if dp[-1]!=inf else -1)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;
#define PI acos(-1.0)
#define EPS 1e-10
const ll INT = 1e16;
const ll MOD = 1e9 + 7;
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define rep(i,N) FOR(i, 0, N)
#define ALL(s) (s).begin(), (s).end()
#define EQ(a, b) (abs((a) - (b)) < EPS)
#define EQV(a, b) (EQ((a).reeal(), (b).real) && EQ((a).imag(), (b).imag()))
#define NIL -1

int main(){
    int n;
    cin>>n;
    vector<int> a(n),w(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>w[i];
    int rmin=100000,lmin=100000;
    rep(i,n){
        if(a[i])lmin=min(lmin,w[i]);
        else rmin=min(rmin,w[i]);
    }
    if(rmin==100000 || lmin==100000)cout<< 0 <<endl;
    else cout<< rmin + lmin <<endl;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;


const int N=2e5+5;
ll f[N],invf[N];

int mul(int a, int b) {
    return (ll) a * b % mod;
}
int my_pow(int a, int b) {
    int r = 1;
    while(b) {
        if(b % 2) {
            r = mul(r, a);
        }
        a = mul(a, a);
        b /= 2;
    }
    return r;
}
int inv_fac(int a) {
    return my_pow(a, mod - 2);
}
 
int binomial(int a, int b) {
    if(a < 0 || b < 0 || b > a) {
        return 0;
    }
    return mul(f[a], mul(invf[b], invf[a-b]));
}
 
int fa(int a, int b) {
    int tmp = binomial(a + b, b);
    //~ debug() << imie(a) imie(b) imie(tmp);
    return tmp;
}

ll mpow(ll x, ll y){ 
    ll res = 1;
    x = x % mod;
    while (y > 0) { 
        if (y & 1) res = (res * x) % mod; 
        y = y >> 1;
        x = (x * x) % mod; 
    } 
    return res; 
} 
  
ll modInv(ll n){ 
    return mpow(n,mod-2); 
} 

void fact(){
    f[0]=1;
    invf[0]=1;
    for(ll i=1;i<N;i++){
        f[i]=(f[i-1]*i)%mod; 
        invf[i]=inv_fac(f[i]);
    }
}

ll paths(pair<ll,ll> p1, pair<ll,ll> p2){
    ll a=p1.first, b=p1.second, x=p2.first, y=p2.second;
    return ((f[x-a+y-b]*modInv(f[x-a]))%mod*modInv(f[y-b]))%mod;
}

ll paths1(pair<ll,ll> p1, pair<ll,ll> p2){
    ll a=p2.first - p1.first, b=p2.second - p1.second;
    return (f[a+b]*(modInv(f[a])*modInv(f[b]))%mod)%mod;
}

const int M=1e3+5;
ll n,m,k;

bool comp(pair<ll,ll> a, pair<ll,ll> b){
    return a.first+a.second<b.first+b.second;
}

int sub(int a, int b) {
    return (a - b + mod) % mod;
}


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int T=clock();

    f[0] = invf[0] = 1;
    for(int i = 1; i < N; ++i) {
        f[i] = mul(f[i-1], i);
        invf[i] = inv_fac(f[i]);
    }
    cin>>n>>m>>k;
    ll x,y;
    vector<pair<ll,ll>> a(k);
    for(ll i=0;i<k;i++){
        cin>>a[i].first>>a[i].second;
    }
    sort(a.begin(),a.end(),comp);
    a.pb({n,m});
    //memset(dp,-1,sizeof(dp));
    vector<ll> dp(k+1);
    for(ll i=0;i<=k;i++){
        ll p=fa(a[i].first-1, a[i].second-1);
        for(ll j=0;j<i;j++){
            if(a[j].first<=a[i].first && a[j].second<=a[i].second)
                p=(p-mul(dp[j],fa(a[i].first - a[j].first, a[i].second-a[j].second))+mod)%mod;
        }
        dp[i]=p;
    }
    cout<<dp[k];


    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}


Measured memory_bytes: 6996
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> trp;
typedef vector<ll> vi;
typedef vector<pll> vp;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define pob         pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define sc3(a,b,c)  cin>>a>>b>>c
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"YES"<<endl
#define prN         cout<<"NO"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define	mp3(a,b,c)  make_pair(a,make_pair(b,c))
#define se          second
#define fi          first 
#define sse         second.second
#define sfi         second.first
#define soA         sort(A+1,A+1+n)
#define so(A,n)     sort(A+1,A+1+n)
#define sov(v)      sort(all(v))
#define sovr(v)     sort(all(v),greater<ll>())
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[32]={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};
ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	sc2(n,m);
	if(n==1 or m==1)rpr(1);
	pr((n*m+1)/2);
	
	
	
	
	
	
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	if(fopen("locin.txt", "r"))INPUT;
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	} 		
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

template<class T> pair<T,T> operator+(const pair<T,T>& l, const pair<T,T>& r) {
    return {(l.f+r.f)%MOD,(l.s+r.s)%MOD};
}
 
template<class T> pair<T,T> operator-(const pair<T,T>& l, const pair<T,T>& r) {
    return {(l.f-r.f+MOD)%MOD,(l.s-r.s+MOD)%MOD};
}
 
template<class T> pair<T,T> operator*(const pair<T,T>& l, const T& r) {
    return {l.f*r%MOD,l.s*r%MOD};
}

template<class T> pair<T,T> operator*(const pair<T,T>& l, const pair<T,T>& r) {
    return {l.f*r.f%MOD,l.s*r.s%MOD};
}
    
struct hsh {
    string S; 
    
    vi manacher(string s) {
        string s1 = "@";
        for (char c: s) s1 += c, s1 += "#";
        s1[s1.length()-1] = '&'; 
        
        vi ans(s1.length()-1);
        int lo = 0, hi = 0; 
        FOR(i,1,s1.length()-1) {
            ans[i] = min(hi-i,ans[hi-i+lo]);
            while (s1[i-ans[i]-1] == s1[i+ans[i]+1]) ans[i] ++;
            if (i+ans[i] > hi) lo = i-ans[i], hi = i+ans[i];
        }
        
        ans.erase(ans.begin());
        F0R(i,sz(ans)) if ((i&1) == (ans[i]&1)) ans[i] ++; // adjust lengths
        return ans;
    }

    vi res;
    
    bool isPal(int l, int r) {
        if (sz(res) == 0) res = manacher(S);
        return res[r+l] >= r-l+1;
    }
};

int N, ans;
char g[300][300];
hsh h[300];

void genHsh() {
    F0R(j,N) F0R(i,N) {
        h[(i+j)%N].S += g[i][j];
    }
    F0R(j,N) F0R(i,N) {
        h[(i+j)%N].S += g[i][j];
    }
}

bool ok(int a, int b) {
    F0R(i,N) {
        // a+i, length i+1, start at char b 
        if (!h[(a+i)%N].isPal(b,b+i) || !h[(a+i)%N].isPal(b+i+1,b+N-1)) return 0;
    }
    return 1;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    F0R(i,N) F0R(j,N) {
        cin >> g[i][j];
        // g[i][j] = 'a';
        // g[i][j] = char('a'+(rand()%26));
    }
    genHsh();
    F0R(i,N) F0R(j,N) if (ok(i,j)) {
        ans ++;
    }
    cout << ans;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)

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

const int MOD = 1e9 + 7;
const int INF = 1 << 30;

int main(){
    long long h, w; cin >> h >> w;
    cout << ((h == 1 || w == 1) ? 1 :(h*w + 1)/2) << endl;
    return 0;
}


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

typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define rep(i,n) for(int i = 0;i < n;i++)

int ch[26];
int main(void){
   string s;cin >> s;
   int n = s.size();
   rep(i,n){
      ch[s[i] - 'a']++;
   }
   
   if(max({ch[0],ch[1],ch[2]}) - min({ch[0],ch[1],ch[2]}) > 1){cout << "NO" << endl;}
   else cout << "YES" << endl;
   
   return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>

using namespace std;

typedef long long ll;
#define rep(i, n) for(long long int (i) = 0; (i) < (int) (n); (i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()

const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const ll LINF = 1e18;


int printYes() {
    cout << "Yes" << endl;
    return 0;
}

int printNo() {
    cout << "No" << endl;
    return 0;
}

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    vector<int> vec;
    rep(i, N) {
        int a;
        cin >> a;
        vec.push_back(a);
    }
    int total = 0;
    sort(ALL(vec));
    rep(i, N - 1) {
        total += vec[i];
    }

    if (vec[N - 1] < total) {
        printYes();
    } else     {
        printNo();
    }
    
    
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var s = ReadLine();
            var a = s.ToUpper();

            if (s == a)
            {
                WriteLine("A");
            }
            else
            {
                WriteLine("a");
            }
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 26288
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
using namespace std;
int main()
{
	int n,m,i,j,num,minm,maxm,a[305][305],c[305],k;
    while(scanf("%d%d",&n,&m)!=EOF)
	{
		for(i=1;i<=n;i++)
		{
			for(j=1;j<=m;j++)
			scanf("%d",&a[i][j]);
		}
		num=m;minm=1000;
		while(num)
		{
			memset(c,0,sizeof(c));
			maxm=-1;
			for(i=1;i<=n;i++)
			{
				for(j=1;j<=m;j++)
				{
					if(a[i][j])
					break;
				}
				c[a[i][j]]++;
				if(c[a[i][j]]>maxm)
				{
					maxm=c[a[i][j]];
					k=a[i][j];
				}
			}
			for(i=1;i<=n;i++)
			{
				for(j=1;j<=m;j++)
				{
					if(a[i][j]==k)
					{
					    a[i][j]=0;
						break;
					}
				}
			}
			minm=min(minm,maxm);
			num--;
		}
		printf("%d\n",minm);
	} 
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int h,w,a[510][510],b[510][510];
char s[510];
int main()
{
	scanf("%d%d",&h,&w);
	for (int i=1;i<=h;i++)
	{
		scanf("%s",s+1);
		for (int j=1;j<=w;j++)
		{
			if (s[j]=='#')
			{
				a[i][j]=3;
			}
		}
	}
	for (int i=1;i<=h;i++)
	{
		b[i][1]=1;
		b[i][w]=2;
		for (int j=2;j<w;j++)
		{
			if (i&1)
			{
				b[i][j]=1;
			}
			else
			{
				b[i][j]=2;
			}
		}
	}
	for (int i=1;i<=h;i++)
	{
		for (int j=1;j<=w;j++)
		{
			a[i][j]|=b[i][j];
		}
	}
	for (int i=1;i<=h;i++)
	{
		for (int j=1;j<=w;j++)
		{
			if (a[i][j]&1)
			{
				putchar('#');
			}
			else
			{
				putchar('.');
			}
		}
		puts("");
	}
	puts("");
	for (int i=1;i<=h;i++)
	{
		for (int j=1;j<=w;j++)
		{
			if (a[i][j]&2)
			{
				putchar('#');
			}
			else
			{
				putchar('.');
			}
		}
		puts("");
	}
	return 0;
}


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

int main()
{
  string S;
  cin >> S;
  
  int A_ind = 0;
  int Z_ind = 0;
  
  for (int i = 0;i < S.size(); i++) {
    if(S.at(i) == 'A') {
      A_ind = i;
      break;
    }
  }
  for (int i = 0; i < S.size(); i++){
    if(S.at(S.size() -1 - i)  == 'Z') {
      Z_ind = S.size() - 1 - i;
      break;
    }
  }
  cout << Z_ind - A_ind + 1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

ll d;
vector<ll> c(26);
vector<vector<ll>> vec(d, vector<ll>(26));

int main() {
    std::cout << std::fixed << std::setprecision(15);
    
    cin >> d;
    clock_t start = clock();
    rep(i, 26){
        cin >> c[i];
    }
    vec.resize(d, vector<ll>(26));
    rep(i, d){
        rep(j, 26){
            cin >> vec[i][j];
        }
    }

    ll ans = 0;
    vector<ll> last(26);

    rep(i, d){

        ll max_value = -1;
        ll contest_type = -1;

        //それぞれの日を選んだ場合
        ll max_val = -INF;
        ll tmp_day = -1;
        rep(j, 26){
            ll tmp = 0;

            rep(k, 26){
                if(j == k){
                    tmp += vec[i][j];
                }
                else{
                    tmp -= c[k] * (last[k] + 1);
                }
            }
            //cout << "tmp = " << tmp << endl;
            if(max_val < tmp){
                max_val = tmp;
                tmp_day = j;
            }

        }

        cout << tmp_day + 1<< endl;

        //後処理
        rep(j, 26){
            if(j == tmp_day){
                last[j] = 0;
            }else{
                last[j]++;
            }
        }
        /*
        rep(j, 26){
            if(max_value < vec[i][j]){
                max_value = vec[i][j];
                contest_type = j;
            }

        }

        ans += max_value;

        rep(j, 26){
            if(j == contest_type){
                last[j] = 0;
            }else{
                last[j]++;
            }
        }

        rep(j, 26){
            ans -= c[j]*last[j];
        }

        cout << contest_type+1 << endl;
        */
    }
    
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    //printf("time %lf[ms]\n", time);


}

Measured memory_bytes: 3748