akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;



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

    int h,w;
    cin >> h >> w;

    int sx,sy,gx,gy;
    cin >> sy >> sx >> gy >> gx;
    sx--;sy--;gx--;gy--;

    pair<int,int> s = make_pair(sx,sy), g = make_pair(gx,gy); 
    string sur[h];

    for(int i = 0; i < h; i++) cin >> sur[i];

    auto inout = [&](int x,int y){
        if(0 <= x && x < w && 0 <= y && y < h) return true;
        else return false;
    };

    queue<pair<int,int>> p,q;

    int dx[4] = {0,0,1,-1}, dy[4] = {1,-1,0,0};

    p.push(s);

    int can = 0;

    while(!p.empty()){
        while(!p.empty()){
            pair<int,int> now = p.front();
            p.pop();
            q.push(now);
            for(int i = 0; i < 4; i++){
                pair<int,int> nxt = make_pair(now.first+dx[i],now.second+dy[i]);
                if(0 <= nxt.first && nxt.first < w && 0 <= nxt.second && nxt.second < h){
                    if(sur[nxt.second][nxt.first] == '.'){
                        if(nxt == g){
                            cout << can << endl;
                            return 0;
                        }
                        p.push(nxt);
                        sur[nxt.second][nxt.first] = '#';
                    }
                }
            }
        }
        can++;
        while(!q.empty()){
            pair<int,int> now = q.front();
            q.pop();
            for(int i = -2; i < 3; i++){
                for(int j = -2; j < 3; j++){
                    pair<int,int> nxt = make_pair(now.first+i,now.second+j);
                    if(0 <= nxt.first && nxt.first < w && 0 <= nxt.second && nxt.second < h){
                        if(sur[nxt.second][nxt.first] == '.'){
                            p.push(nxt);
                            sur[nxt.second][nxt.first] = '#';
                            if(nxt == g){
                                cout << can << endl;
                                return 0;
                            }
                        }
                    }
                }
            }
        }
    }

    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 4716
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Test | diff Test.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Test.cpp && ./a.out

/*
 
 5/2/2020
 
 21:45-
 
 */

const int MAX_N=1e3+1;
int masks[MAX_N],costs[MAX_N];
int N,M;

const int Inf=1e9;
int dp[MAX_N][(1<<12)+1];
void solve() {
  REPE(i,M)REP(j,1<<N) dp[i][j]=Inf;
  dp[0][0]=0;
  REP(i,M)REP(mask,1<<N) if(dp[i][mask]<Inf) {
    SMIN(dp[i+1][mask|masks[i]], dp[i][mask]+costs[i]);
//    dump(i,mask,dp[i][mask],costs[i],dp[i+1][mask|masks[i]]);
    SMIN(dp[i+1][mask],dp[i][mask]);
  }
  int res=dp[M][(1<<N)-1];
  if(res==Inf) res=-1;
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>M;
  REP(i,M) {
    cin>>costs[i];
    int L; cin>>L;
    REP(j,L) {
      int k; cin>>k,--k,masks[i]|=(1<<k);
    }
  }
  solve();
  
  return 0;
}


Measured memory_bytes: 16256
import sys

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces

# 大きい数用


mod = 10**9 + 7
N = 10 ** 6 + 1  # 出力の制限
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)

K = ni()
S = ns()
s_len = len(S)
mod = 10 ** 9 + 7
ans = 0

total = K + s_len

rui = 1

cmb = 1

for i in range(total, s_len - 1, -1):
    # print(total - i + 1)
    ans = (ans + cmb * rui) % mod
    # print(ans)
    rui = (rui * 25) % mod
    cmb = (cmb * i * inverse[total - i + 1]) % mod
print(ans)


Measured memory_bytes: 144264
#include <iostream>
#include<algorithm>
#include<cmath>
#include <string>
#include <vector>

 int main (){

	 long long n;
	 unsigned long long ans = 1;
	 std::cin >> n;

	 for (unsigned long long i = 1; i <= n; ++i) {
		 ans *= i;

		 ans %= (1000000000 + 7);
	 }

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

	 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <cstdlib>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int to[13][5] = {
	{2,-1},
	{2,5,-1},
	{0,1,3,6,-1},
	{2,7,-1},
	{5,-1},
	{1,4,6,9,-1},
	{2,5,7,10,-1},
	{3,6,8,11,-1},
	{7,-1},
	{5,10,-1},
	{6,9,11,12},
	{7,10,-1},
	{10,-1}
};
int X[]={2,1,2,3,0,1,2,3,4,1,2,3,2};
int Y[]={0,1,1,1,2,2,2,2,2,3,3,3,4};

int solve(vector<int> data){
	queue< vector<int> > Q;
	map<vector<int>,int> done;
	Q.push(data);
	done[Q.front()] = 0;
	
	while(Q.size()){
		vector<int> q = Q.front(); Q.pop();
		int dif = 0;
		rep(i,13)if(q[i])dif += abs(X[q[i]]-X[i])+abs(Y[q[i]]-Y[i]);
		if(dif==0)return done[q];;
		if(dif+done[q]>20)continue;
		int curcost = done[q];
		rep(x,13){
			if(q[x] == 0){
				rep(i,5){
					if(!~to[x][i])break;
					swap(q[x],q[to[x][i]]);
					if(done.find(q) == done.end() ){
						done[q] = curcost+1;
						Q.push(q);
					}
					swap(q[x],q[to[x][i]]);
				}
			}
		}
	}
	return 21;
}
int main(){
	vector<int> data(13);
	while(1){
		rep(i,13)if(!(cin >> data[i]))return 0;
		int ans = solve(data);
		if(ans > 20)cout << "NA" << endl;
		else cout << ans << endl;
	}
}

Measured memory_bytes: 2328
n = int(input())
h = list(map(int,input().split()))
ans = [0,abs(h[1]-h[0])]+[0]*(n-2)
for i in range(2,n):
    ans[i] = min(ans[i-1]+abs(h[i]-h[i-1]),ans[i-2]+abs(h[i]-h[i-2]))
print(ans[-1])

Measured memory_bytes: 13928
#include<bits/stdc++.h>	
#define int long long int
using namespace std;
#define INF 1000111000111000111LL
int dp[105][100005];
main()
{	
	int n,wt,ans=0;
	cin>>n>>wt;
	int w[n+1]={0},v[n+1]={0};
	for(int i=1;i<=n;i++)
		cin>>w[i]>>v[i];
	for(int i=0;i<105;i++)
		for(int j=0;j<100005;j++)
			dp[i][j]=INF;
	dp[1][v[1]]=w[1];
	for(int i=2;i<=n;i++){
		for(int j=0;j<100005;j++){
			dp[i][j]=min(dp[i-1][j], dp[i][j]);
			dp[i][v[i]]=min(dp[i][v[i]], w[i]);
			if(j+v[i]<100005){
				dp[i][j+v[i]]=min(min(dp[i-1][j]+w[i], dp[i][j+v[i]]), dp[i-1][j+v[i]]);
				}
			}	
		}
	for(int i=0;i<100002;i++){
		if(dp[n][i]<=wt)
			ans=i;
	}
	cout<<ans;
}

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

int pop(void);
void push(int a);

int top,S[1000];

int main()
{
  int x=0,y=0;
  char s[100];


  while( scanf("%s",&s)!=EOF)
    {
      
      if(s[0]== '+'&& 1<=strlen(s)&& strlen(s)<=99){
	x=pop();
	y=pop();
	push(x+y);      
      }    

  
      else if(s[0]== '-' &&1<=strlen(s)&& strlen(s)<=99){
	x=pop();
	y=pop();
	push(y-x);      


      }

      else if(s[0]== '*'&& 1<=strlen(s)&& strlen(s)<=99){
	x=pop();
	y=pop();
	push(x*y);      
      }
      else push(atoi(s));
    }
  printf("%d\n",pop());
  return 0;

}
int pop(){
  top--;
  return S[top+1];
}

void push(int a){
  top++;
  S[top] = a;
}

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

using namespace std;

int a, b;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cin >> a >> b;
    if(a == b){
        cout << "Draw\n";
    } else {
        if(a == 1){
            cout << "Alice\n";
        } else if(b == 1){
            cout << "Bob\n";
        } else {
            cout << ((a > b) ? "Alice\n" : "Bob\n");
        }
    }
    return 0;
}

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

int gcd(int a, int b) {
  return b != 0 ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
  return a * b / gcd(a, b);
}

int main(){
  int k;
  cin >> k;
  ll ans = 0;
  for(int i = 1; i <= k; i++){
    for(int j = 1; j <= k; j++){
      for(int l = 1; l <= k; l++){
        ans += gcd(gcd(i, j), l);
      }
    }
  }
  cout << ans << endl;
}

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

int main()
{
	int n, even=0, divisible=0, p;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d", &p);
		if(p % 2 == 0){
			even++;
			if(p % 3 == 0 || p % 5 == 0){
				divisible++;
			}
		}
	}
	if(even == divisible)
	printf("APPROVED");
	else
	printf("DENIED");
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
int N,M;
vi match, vis, id;
vii adjlist[MAXN];
int used[MAXN*MAXN];
int ans[MAXN][MAXN];
int dfs(int u){
    if (vis[u]) return 0;
    vis[u] = 1;
    for (auto v : adjlist[u]){
        if (used[v.second] == 0 && (match[v.first] == -1 || dfs(match[v.first]))){
            match[v.first] = u;
            id[u] = v.second;
            match[u] = v.first;
            return 1;
        }
    }
    return 0;
}
int main(){
    scanf("%d%d",&N,&M);
    int L = N;
    for (int i = 0; i < N*M; i++){
        int x;
        scanf("%d",&x);
        //printf("%d %d %d\n",(x-1)/M,N+i/M,x);
        adjlist[(x-1)/M].push_back({N+i/M,x});
    }
    int MCBM = 0;
    for (int k = 0; k < M; k++){
        match.assign(2*N,-1);
        id.assign(2*N,-1);
        for (int i = 0; i < N; i++){
            vii random;
            for (auto x : adjlist[i]){
                if (match[x.first] == -1 && used[x.second] == 0){
                    random.push_back(x);
                }
            }
            if (random.size()){
                MCBM++;
                ii lucky = random[rand()%random.size()];
                //printf("will use edge %d %d %d\n",i,lucky.first,lucky.second);
                match[lucky.first] = i;
                id[i] = lucky.second;
                match[i] = lucky.first;
            }
            random.clear();
        }
        for (int i = 0; i < L; i++){
            if (match[i] == -1){
                vis.assign(2*N,0);
                dfs(i);
            }
        }
        for (int i = 0; i < L; i++){
            ans[match[i]-N][k] = id[i];
            used[id[i]] = 1;
        }
    }
    for (int i = 0; i < N; i++){
        for (int j = 0; j < M; j++){
            printf("%d ",ans[i][j]);
        }
        printf("\n");
    }
    for (int j = 0; j < M; j++){
        vector<int> v;
        for (int i = 0; i < N; i++){
            v.push_back(ans[i][j]);
        }
        sort(v.begin(),v.end());
        for (int i = 0; i < N; i++){
            ans[i][j] = v[i];
        }
    }
    for (int i = 0; i < N; i++){
        for (int j = 0; j < M; j++){
            printf("%d ",ans[i][j]);
        }
        printf("\n");
    }


}


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

int main() {
  int n, l;
  cin >> n >> l;
  
  int i;
  vector<string> s(n);
  for(i = 0; i < n; i++){
    cin >> s.at(i);
  }
  
  sort(s.begin(), s.end());
  
  for(i = 0; i < n; i++){
    cout << s.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define NUM 50

int main(void){
  int N,i,j;
  double tmp,num[NUM];
  double ans=0;
  
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%lf",&num[i]);
  }
  
  for(i=0;i<N-1;i++){
    for(j=N-1;j>i;j--){
      if(num[i]>num[j]){
        tmp=num[i];
        num[i]=num[j];
        num[j]=tmp;
      }
    }
  }
  
  for(i=0;i<N-1;i++){
    num[i+1]=(num[i]+num[i+1])/2;
  }
  
  printf("%f",num[N-1]);
  
  return 0;
  
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

/*
Range Sum Query by FenwickTree(Binary Indexed Tree)

total number: n
queries:
    1. add(i, val): bit[i] += val
    2. sum(n): sum(bit[0] + ... + bit[n-1])
time complexity: O(log n)
space complexity: O(N)

Self-balancing binary search tree or Segment Tree can do the same, it takes longer to program and complexity also increases.

Thanks: http://hos.ac/slides/20140319_bit.pdf

used in ARC031 C, indeednow finalB E, DSL2B(AOJ), ARC033 C, yukicoder No.59
*/

template<typename T> struct RangeSumQuery {
  int N;
  vector<T> dat;

  RangeSumQuery(int N) : N(N) {
    //assert(N > 0);
    dat.resize(N, 0);
  }

  void add(int k, T val) {
    //assert(0 <= k && k < N);
    for (int x = k; x < N; x |= x + 1) {
      dat[x] += val;
    }
  }

  // [0, k)
  T sum(int k) {
    //assert(k >= 0);
    T ret = 0;
    for (int x = k - 1; x >= 0; x = (x & (x + 1)) - 1) {
      ret += dat[x];
    }
    return ret;
  }
  // [l, r)
  T sum(int l, int r) {
    //assert(0 <= l && l <= r && r <= N);
    return sum(r) - sum(l);
  }

  T index(int k) {
    //assert(0 <= k && k < N);
    return sum(k+1) - sum(k);
  }

  int lower_bound(int l, int r, int t) {
    int left = l-1, right = r;
    while (left + 1 < right) {
      int mid = (left + right) >> 1;
      (sum(l, mid+1) >= t ? right : left) = mid;
    }
    return right;
  }
};


int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  while (1) {
    int n, k, m; cin >> n >> k >> m;
    if (n == 0 and k == 0 and m == 0) break;
    m--;
    RangeSumQuery<int> fwt(n);
    REP(i, n) fwt.add(i, 1);
    fwt.add(m, -1);
    int now = m;
    REP(i, n-2) {
      int move = k % (n-1 - i);
      if (not move) move = n-1 - i;
      if (move <= fwt.sum(now, n)) {
        int next = fwt.lower_bound(now, n, move);
        //assert(fwt.sum(now, next+1) == move);
        //assert(fwt.index(next) == 1);
        fwt.add(next, -1);
        now = next;
      } else {
        move -= fwt.sum(now, n);
        int next = fwt.lower_bound(0, n, move);
        //assert(fwt.sum(0, next+1) == move);
        //assert(fwt.index(next) == 1);
        fwt.add(next, -1);
        now = next;
      }
    }
    REP(i, n) {
      if (fwt.index(i)) {
        cout << i+1 << endl;
        break;
      }
    }
  }
  return 0;
}

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

int main(){
  double PI=3.141592;
  int n;
  cin >> n;
  cout << 2*n*PI << endl;
  return 0;
}

Measured memory_bytes: 3784
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

S = input()

if S == 'SSS':
    print(0)
elif S == 'SSR':
    print(1)
elif S == 'SRS':
    print(1)
elif S == 'SRR':
    print(2)
elif S == 'RSS':
    print(1)
elif S == 'RSR':
    print(1)
elif S == 'RRS':
    print(2)
elif S == 'RRR':
    print(3)




Measured memory_bytes: 9072
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll dp[3100][3100];
pair<pair<ll,ll>,char> d[3100][3100];
string s1;
string s2;

int main() {
	clr(dp,0);
  cin>>s1;
  cin>>s2;
  if(s1[0]==s2[0]){
    dp[0][0] = 1;
    d[0][0] = mp(mp(-1,-1),s1[0]);
  }
  else{
    dp[0][0] = 0;
    d[0][0] = mp(mp(-1,-1),0);
  }
  rep(i,0,s2.sz){
    if(s1[0]==s2[i]){
      dp[0][i] = 1;
      d[0][i] = mp(mp(-1,-1),s1[0]);
    }
  }
  rep(i,0,s1.sz){
    if(s1[i]==s2[0]){
      dp[i][0] = 1;
      d[i][0] = mp(mp(-1,-1),s2[0]);
    }
  }
  rep(i,0,s1.sz){
    rep(j,0,s2.sz){
      if(i-1>=0){
        if(dp[i][j]<=dp[i-1][j]){
          d[i][j] = mp(mp(i-1,j),0);
          dp[i][j] = dp[i-1][j];
        }
      }
      if(j-1>=0){
        if(dp[i][j]<=dp[i][j-1]){
          d[i][j] = mp(mp(i,j-1),0);
          dp[i][j] = dp[i][j-1];
        }
      }
      if(s1[i]==s2[j]){
        if(i>0&&j>0){
          if(dp[i][j]<=dp[i-1][j-1]){
            d[i][j] = mp(mp(i-1,j-1),s1[i]);
            dp[i][j] = dp[i-1][j-1]+1;
          }
        }
      }
    }
  }
  string ans;
  ll p1 = s1.sz-1;
  ll p2 = s2.sz-1;
  while(p1!=-1){
    if(d[p1][p2].se!=0){
      ans += ctos(d[p1][p2].se);
    }
    ll p12 = d[p1][p2].fi.fi;
    ll p22 = d[p1][p2].fi.se;
    p1 = p12;
    p2 = p22;
  }
  reverse(all(ans));
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 296448
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int r = Integer.parseInt(sc.next());
		int g = Integer.parseInt(sc.next());
      	int b = Integer.parseInt(sc.next());
		boolean a1 = r == g;
      	boolean a2 = g == b;
      	boolean a3 = b == r;
      	if(a1 && !a2 && !a3){
          out.println(b);
        }else if(!a1 && a2 && !a3){
          out.println(r);
        }else if(!a1 && !a2 && a3){
          out.println(g);
        }
		out.flush();	
	}
}

Measured memory_bytes: 25172
#include <iostream>
#include <string>
#include <map>

using namespace std;

typedef unsigned long long ULL;

int main() {
    string str;
    cin >> str;
    int S = str.size();

    map<char, int> cnt;
    for(int i = 0; i < str.size(); ++i) {
        cnt[str[i]]++;
    }

    ULL ans = 0;
    int odd = 0;
    char oddchar = '\0';
    for(map<char,int>::iterator it = cnt.begin(); it != cnt.end(); ++it) {
        if(it->second % 2 == 1) {
            ++odd;
            oddchar = it->first;
        }
    }

    if((S%2 == 0 && odd > 0) || (S%2 == 1 && odd != 1)) {
        goto end;
    }
    if(odd) {
        cnt[oddchar]--;
    }

    S &= ~1;
    ans = 1;
    for(int i = 1; i <= S/2; ++i) ans *= i;
    for(map<char,int>::iterator it = cnt.begin(); it != cnt.end(); ++it) {
        for(int j = 1; j <= it->second/2; ++j) {
            ans /= j;
        }
    }

end:
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 0
import math

N=int(input())
A=list(map(int,input().split()))
L=[0]*(N+1)
R=[0]*(N+1)
M=[0]*N
for i in range(N):
  L[i+1]=math.gcd(L[i],A[i])
for i in range(N-1,0,-1):
  R[i]=math.gcd(R[i+1],A[i])
for i in range(N):
  M[i]=math.gcd(L[i],R[i+1])
print(max(M))

Measured memory_bytes: 24980
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int n,l;
string a[100];
int main(){
cin>>n>>l;
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
for(int i=0;i<n;i++)
cout<<a[i];
system("pause");
return 0;
}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=1e5+5;

vector<ii> adj[mxn];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n,a,b; cin >> n;
	for(int i=0; i<n-1; i++){
		cin >> a >> b;
		a--; b--;
		adj[a].eb(b,i);
		adj[b].eb(a,i);
	}
	int mx = 0;
	for(int i=0; i<n; i++){
		mx = max(mx,(int)adj[i].size());
	}
	int color[n-1];
	memset(color,-1,sizeof(color));
	for(int u=0; u<n; u++){
		set<int>cur;
		for(ii x:adj[u]){
			int ind = x.se;
			if(color[ind]!=-1)cur.insert(color[ind]);
		}
		int ptr = 0;
		while(cur.count(ptr))ptr++;
		for(ii x:adj[u]){
			int ind = x.se;
			if(color[ind]==-1){
				color[ind]=ptr;
				ptr++;
			}
			while(cur.count(ptr))ptr++;
		}
	}
	cout << mx << '\n';
	for(int i=0; i<n-1; i++){
		cout << color[i]+1 << '\n';
	}
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 10044
# -*- coding: utf-8 -*-
 
def score(x,y,z):
    return pow(x,2)+pow(y,2)+pow(z,2)+(x*y)+(y*z)+(z*x)

N = int(input())

num = [0 for i in range(N)]
# x,y,zは高々10^2
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            value = score(x,y,z)
            if value <= N:
                num[value-1] += 1

for n in num:
    print(n)

Measured memory_bytes: 69456
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aa = IntArray(n) { readLine()!!.toInt() }
    val ao = aa.sortedDescending()
    val p = ao[0] == ao[1]
    aa.forEach {
        println(if (it == ao[0] && !p) ao[1] else ao[0])
    }
}


Measured memory_bytes: 55844
n = int(input())
ns = sorted(list(map(int, input().split())))
cnt = 0
cum = [0]
for i in ns:
    cum.append(i + cum[-1])
for i in range(n):
    if cum[i] * 2 >= ns[i]:
        cnt += 1
    else:
        cnt = 0
print(cnt+1)

Measured memory_bytes: 65256
a,b=list(map(int,input().split()))
l=['1','2','3','4','5','6','7','8','9','0']
s=input()
if len(s)!=a+b+1:
    print("No")
    exit()
for i in range(a+b+1):
    if i==a:
        if s[a]!='-':
            print("No")
            exit()
        else:
            continue
    if s[i] not in l:
        print("No")
        exit()
print("Yes")

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

int main() {

	int n, k;
	cin >> n >> k;

	int s = 1;
	for (int i = 0; i < n; i++) {
		if (s*2 < s+k) {
			s *= 2;
		}
		else {
			s += k;
		}
	}
	cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using VPII = vector<PII>;
template<typename T, typename C>
using PQ = priority_queue<T, vector<T>, C>;
using Complex = complex<double>;


int N, K;
VPII v;
map<int, bool> m;
PQ<int, greater<int>> pq0;
PQ<int, less<int>> pq1;


signed main(){
    cin >> N >> K;
    rep(i, 0, N){
        int t, d;
        cin >> t >> d;
        v.pb({ d, t });
    }

    sort(ALL(v), greater<PII>());

    int ans = 0, n = 0;
    rep(i, 0, N){
        if(i < K){
            ans += v[i].first;
            if(m[v[i].second]) pq0.push(v[i].first);
            else m[v[i].second] = true, n++;
        }
        else if(!m[v[i].second]) pq1.push(v[i].first), m[v[i].second] = true;
    }
    ans += n*n;
    
    int prev = ans;
    repe(i, n+1, K){
        if(pq0.empty() || pq1.empty()) break;
        int v0, v1;
        v0 = pq0.top(), pq0.pop();
        v1 = pq1.top(), pq1.pop();
        prev = prev-v0-(i-1)*(i-1)+v1+i*i;
        chmax(ans, prev);
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
    int n, a, b;
    cin >> n >> a >> b;

    string s;
    cin >> s;

    int a_now = 0;
    int b_now = 0;

    for(int i = 0; i < n; i++){
        if(s[i] == 'a'){
            if(a_now + b_now < a + b){
                a_now++;
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
        }else if(s[i] == 'b'){
            if(a_now + b_now < a + b && b_now < b){
                cout << "Yes" << endl;
                b_now++;
            }else{
                cout << "No" << endl;
            }
        }else{
            cout << "No" << endl;
        }
    } 
}

Measured memory_bytes: 3732
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
#include<vector>
using namespace std;

int main(void) {
	int l, n;
	cin >> n >> l;
	vector<string> S(n);
	string ans;
	for (int i = 0; i < n; i++) cin >> S[i];
	sort(S.begin(), S.end());
	for (int i = 0; i < n; i++)ans += S[i];
	cout << ans << endl;
	return 0;
}

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

int main() {
  int N, H, W;
  cin >> N >> H >> W;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
  int ans = 0;
  for (int i = 0; i < N; i++) if (A[i] >= H && B[i] >= W) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef long double LD;
typedef vector<LD> vld;
typedef vector<pair<LD, LD>> vpld;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
typedef pair<ll, PL> TL;
typedef vector<TL> vtl;
typedef vector<vtl> vvtl;
typedef long double ld;
typedef vector<ld> vld;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T> T gcd(T a, T b) {return (a == 0) ? b : gcd(b%a, a);}
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b;}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec /* copy */){
    sort(ALL(vec)); vec.erase(unique(vec.begin(), vec.end()), vec.end()); return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const tpl& lhs, const tpl& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}

bool bit(ll st, ll b){return ((st>>b)&1) == 1;}


int main(){
#ifdef __DEBUG_LOCAL__
    ifstream file("../../../../../in.txt"); if(file.is_open()) cin.rdbuf(file.rdbuf());
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    
    ll H, N; cin >> H >> N;
    ll sum = 0;
    rep(_, N){
        ll a; cin >> a; sum += a;
    }
    cout << (sum >= H ? "Yes" : "No") << endstr;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

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

    int a,b,c,x;
    cin>> a >> b >> c >> x;
    int cnt=0;
    rep(i,a+1){
        rep(j,b+1){
            rep(k,c+1){
                if(500*(i)+100*(j)+50*(k)==x){
                    cnt+=1;
                }
            }
        }
    }

    cout << cnt << endl;

    return 0;
}

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

int main() {
  string s; cin >> s;
  set<char> a;
  for (auto& e: s) a.insert(e);
  for (char c = 'a'; c <= 'z'; c++) {
    if (!a.count(c)) {
      cout << c << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
const int MOD=1000000007;
const int nmax=101234;

int n,x,y;
ll m,dp[nmax];
vector<vector<int> > v2(nmax);

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

ll exgcd(ll a,ll b,ll& x,ll& y)
{
    if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    ll q=exgcd(b,a%b,y,x);
    y-=a/b*x;
    return q;
}

void dfs(int s,int f)
{
    dp[s]=1;
    for(int i=0; i<v2[s].size(); ++i)
        if(v2[s][i]!=f)
        {
            dfs(v2[s][i],s);
            dp[s]=dp[s]*(dp[v2[s][i]]+1)%m;
        }
}

void dfs2(int s,int f,ll now)
{
    ll pre[v2[s].size()];
    ll nxt[v2[s].size()];
    for(int i=0; i<v2[s].size(); ++i)
    {
        if(v2[s][i]!=f) pre[i]=dp[v2[s][i]]+1;
        else pre[i]=now;
        if(i>0) pre[i]=pre[i]*pre[i-1]%m;
    }
    for(int i=(int)v2[s].size()-1; i>=0; --i)
    {
        if(v2[s][i]!=f) nxt[i]=dp[v2[s][i]]+1;
        else nxt[i]=now;
        if(i+1<v2[s].size()) nxt[i]=nxt[i]*nxt[i+1]%m;
    }
    ll ans=now;
    for(int i=0; i<v2[s].size(); ++i)
    {
        if(v2[s][i]!=f)
        {
            if(v2[s].size()!=1)
                if(i==0) ans=(nxt[i+1]+1)%m;
                else if(i+1==v2[s].size()) ans=(pre[i-1]+1)%m;
                else ans=(pre[i-1]*nxt[i+1]+1)%m;
            dp[v2[s][i]]=dp[v2[s][i]]*ans%m;
            dfs2(v2[s][i],s,ans);
        }
    }
}

int main()
{
    scanf("%d %lld",&n,&m);
    for(int i=1; i<n; ++i)
    {
        scanf("%d %d",&x,&y);
        v2[x].pb(y);
        v2[y].pb(x);
    }
    dfs(1,0);
    dfs2(1,0,2);
    for(int i=1; i<=n; ++i)
        printf("%lld\n",dp[i]);
    return 0;
}


Measured memory_bytes: 19968
while 1:
    N = int(input())
    if N == 0:
        break
    L = []
    for i in range(N):
        t, *rs = input().split()
        w = 0; l = 0
        for e in map(int, rs):
            if e == 0:
                w += 1
            elif e == 1:
                l += 1
        L.append((-w, l, i, t))
    L.sort()
    for _, _, _, t in L:
        print(t)



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

int main() {
  int n, h, ma = 0, i;
  cin >> n >> h;
  vector<int> a(n), b(n);
  for(int i = 0; i < n; i++) {
    cin >> a.at(i) >> b.at(i);
    ma = max(ma, a.at(i));
  }
  sort(b.begin(), b.end(), greater<int>());
  for(i = 0; i < n; i++) {
    if(b.at(i) <= ma)
      break;
    h -= b.at(i);
    if(h <= 0) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << (h + ma - 1) / ma + i << endl;
}

Measured memory_bytes: 1024
N, T = map(int, input().split())
t_list = list(map(int, input().split()))
cnt = T
for i in range(1, N):
    cnt += T
    if t_list[i]-t_list[i-1]<=T:
        cnt -= T-(t_list[i]-t_list[i-1])
print(cnt)

Measured memory_bytes: 26708
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

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

void solve() {
    LL n;
    cin >> n;
    VI p(n);
    REP(i,0,n) cin >> p[i];

    VP ps(n);
    REP(i,0,n) ps[i] = MP(p[i], i);
    sort(all(ps));
    reverse(all(ps));

    multiset<int> s;
    s.insert(-1);
    s.insert(-1);
    s.insert(n);
    s.insert(n);
    LL ans = 0;
    REP(i,0,n) {
        LL sum = 0;
        int w,x,y,z;
        auto it = s.upper_bound(ps[i].second);
        y = *it;
        ++it;
        z = *it;
        --it; --it;
        x = *it;
        --it;
        w = *it;

        sum += 1LL * (x - w) * (y - ps[i].second);
        sum += 1LL * (z - y) * (ps[i].second - x);

        s.insert(ps[i].second);
        ans += sum * ps[i].first;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 6144
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int t = sc.nextInt();
    int total = 0;
    int[] d = new int[t];
    for(int i = 0;i<t;i++){
      d[i] = sc.nextInt();
    }
    for(int i = 0;i<t;i++){
      for(int j = i+1;j<t;j++){
        total = total + d[i]*d[j];
      }
    }
    System.out.println(total);
  }
}


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

#define vi vector<int>
#define N 100010

int* Eratosthenes(){
    int* arr = new int[N];

    for(int i = 0; i < N; i++){
        arr[i] = 1;
    }
    for(int i = 2; i < sqrt(N); i++){
        if(arr[i]){
            for(int j = 0; i * (j + 2) < N; j++){
                arr[i *(j + 2)] = 0;
            }
        }
    }

    for(int i = 2; i < N; i++){
        if(arr[i]){
        }
    }

    return arr;
}



int main() {

    int Q;
    cin >> Q;

    int* v = Eratosthenes();
    v[0] = 0;
    v[1] = 0;

    int* sim = new int[N];
    for (int i = 1; i < N; i+=2) {
        if (v[i] && v[(i+1)/2]) {
            sim[i] = 1;
        }
    }

    for (int i = 3; i < N; i+=2) {
        sim[i] += sim[i-2];
    }

    int l, r;
    for (int i = 0; i < Q; i++) {
        cin >> l >> r;
        cout << sim[r] - sim[l-2] << endl;
    }

    return 0;
}


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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vector<long long>>;
df data(n, vector<long long>(m));
const int MOD = 1e9 + 7;
const long long INF = 1e18;
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
#include <boost/algorithm/string/join.hpp>
using boost::algorithm::join; // string s = join(arr, "");
#include <boost/algorithm/string/replace.hpp>
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
#include <boost/range/algorithm.hpp> // boost::sort(arr)
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

/* sum function
int sum(vector<int> &arr) {
  int res = accumulate(arr.begin(), arr.end(), 0);
  return res;
}
*/

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a + b >= c ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

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

   sort(a.begin(), a.end(), greater<int>());
   int bob = 0, alice = 0;
   for(int i = 0; i < N; i++){
      if(i % 2 == 0){
         alice += a[i];
      }
      else{
         bob += a[i];
      }
   }
   cout << alice - bob << endl;

   return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long i = (int)Math.sqrt(n);
		while(true) {
			if(n%i==0) {
				System.out.println(i + n/i -2);
				break;
			} else {
				i--;
			}
		}
	}

}


Measured memory_bytes: 22604
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int& e : a) {
        cin >> e;
    }
    sort(a.begin(), a.end(), std::greater<int>());
    ll sumA = 0;
    ll sumB = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            sumA += a[i];
        } else {
            sumB += a[i];
        }
    }
    cout << sumA - sumB << "\n";
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	as := map[int]int{}
	var a int
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		as[a]++
	}

	var ans int
	for x := 0; x < 100000; x++ {
		ans = max(ans, as[x]+as[x-1]+as[x+1])
	}

	fmt.Println(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 7936
#include <cstdio>
#define MAX 10000
#define NIL -1

struct Node
{
    int parent, left, right;
};

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d)
{
    if (u == NIL)
        return;
    D[u] = d;
    setDepth(T[u].left, d + 1);
    setDepth(T[u].right, d + 1);
}

int setHeight(int u)
{
    int h1 = 0, h2 = 0;
    if (T[u].left != NIL)
        h1 = setHeight(T[u].left) + 1;
    if (T[u].right != NIL)
        h2 = setHeight(T[u].right) + 1;

    return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u)
{
    if (T[u].parent == NIL)
        return NIL;
    if (T[T[u].parent].left != u && T[T[u].parent].left != NIL)
        return T[T[u].parent].left;
    if (T[T[u].parent].right != u && T[T[u].parent].right != NIL)
        return T[T[u].parent].right;
    return NIL;
}

void print(int u)
{
    printf("node %d: ", u);
    printf("parent = %d, ", T[u].parent);
    printf("sibling = %d, ", getSibling(u));
    int deg = 0;
    if (T[u].left != NIL)
        deg++;
    if (T[u].right != NIL)
        deg++;
    printf("degree = %d, ", deg);
    printf("depth = %d, ", D[u]);
    printf("height = %d, ", H[u]);

    if (T[u].parent == NIL)
    {
        printf("root\n");
    }
    else if (T[u].left == NIL && T[u].right == NIL)
    {
        printf("leaf\n");
    }
    else
    {
        printf("internal node\n");
    }
}

int main()
{
    int v, l, r, root = 0;
    scanf("%d", &n);

    for (int i = 0; i < n; i++)
        T[i].parent = NIL;

    for (int i = 0; i < n; i++)
    {
        scanf("%d %d %d", &v, &l, &r);
        T[v].left = l;
        T[v].right = r;
        if (l != NIL)
            T[l].parent = v;
        if (r != NIL)
            T[r].parent = v;
    }

    for (int i = 0; i < n; i++)
    {
        if (T[i].parent == NIL)
            root = i;
    }

    setDepth(root, 0);
    setHeight(root);

    for (int i = 0; i < n; i++)
        print(i);

    return 0;
}


Measured memory_bytes: 2768
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main() {
	char a[100],b[100];
	cin>>a>>b;
	int n=0,m=0;
	for(int i=1;i<=strlen(a)+strlen(b);i++){
		if(i%2!=0){
			cout<<a[n];
			n++;
		}
		else{
			cout<<b[m];
			m++;
		}
	}
	cout<<endl;
	return 0;
}

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

int main() {
    int64_t N, M;
    cin >> N >> M;
    vector<int64_t> A(M);
    for (int64_t& a : A) {
        cin >> a;
    }

    int64_t sum = accumulate(A.begin(), A.end(), (int64_t)0);
    if (sum > N) {
        cout << -1 << endl;
    } else {
        cout << N - sum << endl;
    }
}

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

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back

const int N = 100005;
vector<int> gr[N];
int disc[N], low[N], tme;
set<int> art_p;
vector<pair<int,int>> art_b;

void dfs(int cur,int par) {
	disc[cur]=low[cur]=tme++;
	int no_child=0;
	for (auto child : gr[cur]) {
		
		if(disc[child]==0){
			dfs(child,cur);
            no_child++;
			low[cur]=min(low[cur],low[child]);
            if(par!=0 && low[child]>=disc[cur]){
            	art_p.insert(cur);
            }

            if(low[child]>disc[cur]){
            	art_b.pb({cur,child});
            }

		}else if(child!=par){
			//back Edge Found
			low[cur]=min(low[cur],disc[child]);
		}
	} 
	if(par==0 && no_child>=2){ // handling root case
		art_p.insert(cur);
	}
	/*
                       1  remove this will increase coponent
                      / \ 
                     /   \
                    2     3
	*/ 
}


int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
		int i, j, k, n, m, ans = 0, sum = 0;
		cin >> n >> m;
		for (i = 0; i < m; i++) {
			int x, y;
			cin >> x >> y;
			x++;y++;
			gr[x].pb(y);
			gr[y].pb(x);
		}
		tme=1;
		dfs(1,0);
		for(auto x:art_p) cout<<(--x)<<"\n";
return 0;
	
}
/*
5 5
1 2
2 3
3 1
3 4
4 5
*/


Measured memory_bytes: 7496
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    h = LI()
    v = [0]*n
    for _ in range(m):
        a,b = LI()
        a -= 1
        b -= 1
        v[a] = max(v[a],h[b])
        v[b] = max(v[b],h[a])
    ans = 0
    for i in range(n):
        if v[i] < h[i]:
            ans += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 82272
#include<iostream>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int a[30]={0};
    for(int i=1;i<=n;i++){
        int x,y;
        cin>>x>>y;
        a[x] = y;
    }
    int m =0 ,M = 1;
    for(int i = 1;i <= n;i++)if(m < a[i])M = i,m = a[i];
    cout<<M<<" "<<m<<endl;
    return 0;
}

Measured memory_bytes: 1168