akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

#define MAX_N 101

int N;
vector<int> ans[MAX_N];

int pre4[4][3] = {
  {2, 3, 1},
  {3, 0, 2},
  {1, 0, 3},
  {0, 2, 1}
};

void input()
{
  cin >> N;
}

//[l, r)
void solve(int l, int r)
{
  if(r-l == 4 || (r-l)%2 == 1){
    if(r-l == 4){
      for (int i = l; i < r; i++) {
        for (int j = 0; j < 3; j++) {
          ans[i].push_back(l+pre4[i-l][j]);
        }
      }
      return;
    }
    else{
      for (int i = l; i < r; i++) {
        int next = i+1;
        if(next >= r){
          next = l;
        }
        for (int cnt = 0; cnt < r-l-1; cnt++) {
          ans[i].push_back(next);
          next++; if(next >= r) next = l;
        }
      }
      return;
    }
  }
  else{
    int mid = (r+l)/2;

    for (size_t i = l; i < mid; i++) {
      ans[i].push_back(mid+i-l);
    }
    for (size_t i = mid; i < r; i++) {
      int next = l+i-mid+1; if(next >= mid) next = l;
      ans[i].push_back(next);
    }

    solve(l, mid);
    for (size_t i = 0; i < mid-l-1; i++) {
      int next = l+i+2; if(next >= mid) next = l;
      for (size_t j = mid; j < r; j++) {
        ans[j].push_back(next);
        next++; if(next >= mid) next = l;
      }
    }

    solve(mid, r);
    for (size_t i = 0; i < r-mid-1; i++) {
      int next = mid+i+1; if(next >= r) next = mid;
      for (size_t j = l; j < mid; j++) {
        ans[j].push_back(next);
        next++; if(next >= r) next = mid;
      }
    }

  }
}

bool checker()
{
  for (int i = 0; i < N; i++) {
    if(ans[i].size() != N-1){
      return false;
    }
    for (int j = 0; j < ans[i].size(); j++) {
      if(0 <= ans[i][j] && ans[i][j] < N){
        for (int k = j+1; k < ans[i].size(); k++) {
          if(ans[i][j] == ans[i][k]){
            return false;
          }
        }
      }
      else{
        return false;
      }
    }
  }

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N-1; j++) {
      if(ans[ans[i][j]][j] == i){
        cerr << "Batting! " << i << " " << j << endl;
        return false;
      }
    }
  }

  return true;
}

int main()
{
  input();

  if(N == 2){
    cout << -1 << endl;
    return 0;
  }

  solve(0, N);
/*
  if(!checker()){
    cerr << "Fail..." << endl;
  }
*/
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j]+1;
      if(j < ans[i].size()-1){
        cout << " ";
      }
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll =long long;
int main(){
    ll mod=1000000007;
    int n,m;
    cin>>n>>m;
    vector<int> a(m);
    rep(i,m) cin>>a[i];
    vector<int> dp(n+1);
    vector<int> hole(n+1);
    dp[0]=1;
    dp[1]=1;
    rep(i,m) hole[a[i]]=1;
    if (hole[1]==1 ) dp[1]=0;
    rep(i,n-1){
        if (hole[i+2]==1) dp[i+2]=0;
        else dp[i+2]=dp[i+1]%mod+dp[i]%mod;
    }
    int ans =dp[n]%mod;
    cout <<ans;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define md 1000000007
#define ll long long 
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fastmap mp.reserve(1024);mp.max_load_factor(0.25);
#define fastset st.reserve(1024);st.max_load_factor(0.25);

//freopen("inp.txt","r",stdin);
//freopen("out.txt","w",stdout);

ll int mpw(ll int a,ll int b,ll int m)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans=(ans*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return ans;
}
 
ll int pw(ll int a,ll int b)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans*=a;
		}
		a*=a;
		b>>=1;
	}
	return ans;
}
 
ll int mn(ll int a,ll int b)
{
	if(a<=b)
	{
		return a;
	}
	return b;
}
 
ll int mx(ll int a,ll int b)
{
	if(a>=b)
	{
		return a;
	}
	return b;
}

int main()
{
	fio
	int n,m;
	cin>>n>>m;
	vector<vector<int>>g(n);
	for(int i=0;i<n-1;++i)
	{
		int a,b;
		cin>>a>>b;
		g[a-1].push_back(b-1);
		g[b-1].push_back(a-1);
	}
	vector<ll int>down(n,1);
	vector<ll int>up(n,1);
	unordered_set<int>st;
	fastset
	std::function<ll int(int)>dfs=[&](int node)->ll int{
		ll int ans=1;
		st.insert(node);
		for(int i=0;i<g[node].size();++i)
		{
			if(st.find(g[node][i])==st.end())
			{
				ans=(ans*(dfs(g[node][i])+1))%m;
			}
		}
		down[node]=ans;
		return ans;
	};
	std::function<void(int,ll int)>ufs=[&](int node,ll int val)->void{
		st.insert(node);
		up[node]=(val+1)%m;
		int n1=g[node].size();
			vector<ll int>pr(n1,1);
			vector<ll int>suf(n1,1);
			for(int i=0;i<n1;++i)
			{
				if(st.find(g[node][i])!=st.end())
				{
					if(i>0)
					{
						pr[i]=pr[i-1];
					}
				}
				else{
					if(i>0)
					{
						pr[i]=(pr[i-1]*(down[g[node][i]]+1))%m;
					}
					else{
						pr[i]=(down[g[node][i]]+1)%m;
					}
				}
			}
			for(int i=n1-1;i>=0;--i)
			{
				if(st.find(g[node][i])!=st.end())
				{
					if(i<n1-1)
					{
						suf[i]=suf[i+1];
					}
				}
				else{
					if(i<n1-1)
					{
						suf[i]=(suf[i+1]*(down[g[node][i]]+1))%m;
					}
					else{
						suf[i]=(down[g[node][i]]+1)%m;
					}
				}
			}
			for(int i=0;i<n1;++i)
			{
				if(st.find(g[node][i])==st.end())
				{
					ufs(g[node][i],((val+1)*(((i==0?1:pr[i-1])*(i==n1-1?1:suf[i+1]))%m))%m);
				}
			}
		return;
	};

	dfs(0);
	st.clear();
	ufs(0,0);
	for(int i=0;i<n;++i)
	{
		cout<<(down[i]*up[i])%m<<"\n";
	}
	return 0;
}

Measured memory_bytes: 32576
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_N = int(1e6);

int main(){

    int n, i, j, maxin = 2;
    bool jud;
    vector <int> vec;
    for (i = 2; i <= MAX_N; i++){
        jud = 0;
        for (j = 0; j < vec.size(); j++){
            if (vec[j] * vec[j] > i) break;
            if (!(i % vec[j])){
                jud = 1;
                break;
            }
        }
        if (!jud)
            vec.push_back(i);
    }
    while (cin >> n){
        cout << upper_bound(vec.begin(), vec.end(), n) - vec.begin() << endl;
    }
}

Measured memory_bytes: 1588
import java.io.PrintWriter;
import java.util.Scanner;
class Main{

    public static int N;
    private static int parent(int k){
        return (k+(N-2))/N;
    }

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();
        int Q = scan.nextInt();
        PrintWriter out = new PrintWriter(System.out);
        while(Q-->0){
            int u = Integer.parseInt(scan.next());
            int v = Integer.parseInt(scan.next());
            int cnt = 0;
            if(N!=1){
            while(u != v){
                while(u > v)u = parent(u);
                while(v > u)v = parent(v);
            }
            }else{
                u = Math.min(u,v);
            }
            out.println(u);
        }
        out.flush();
    }
}

Measured memory_bytes: 51588
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		if(x == 3 || x == 5 || x == 7) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

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

using namespace std;
typedef long long llint;

int n;
int main() {
    scanf("%d", &n);
    llint sol = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= n; k++) {
                sol += __gcd(i, __gcd(j, k));
            }
        }
    }
    printf("%lld", sol);
    return 0;
}


Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*/
#define error(args...) {vector <string> _v = split(#args, ','); err(_v.begin(), args); cout << endl;}
vector <string> split(const string &s, char c) {
    vector <string> v;
    stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x);
    return move(v);
}
void err(vector <string> :: iterator it) {}
template <typename T, typename... Args>
void err(vector <string> :: iterator it, T a, Args... args) {
    cout << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", ";
    err(++it, args...);
}
 
int ini(){int x; scanf("%d",&x);return x;}
long long inl(){ long long x;scanf("%lld",&x); return x;}
double ind(){double x; scanf("%lf",&x);return x;}
#define Iin ini();
#define Lin inl();
#define Din ind();

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

int a[N];

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    int t=1,te=0;
   // cin>>t;
    while(t--){
        int n,m;
        cin>>n>>m;

        if(n==m)printf("Yes\n");
        else{
            printf("No\n");
        }



        //printf("Case %d: ",++te);
    }
    return 0;
}




Measured memory_bytes: 256
#include<set>
#include<queue>
#include<cstdio>

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

using namespace std;

typedef	pair<int,int>	pii;

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

int main(){
	for(int w,h;scanf("%d%d",&w,&h),w;){
		int n;	scanf("%d",&n);
		int x1[1000],y1[1000],x2[1000],y2[1000];
		set<int> xorg,yorg;
		xorg.insert(0),xorg.insert(w);
		yorg.insert(0),yorg.insert(h);
		rep(i,n){
			scanf("%d%d%d%d",x1+i,y1+i,x2+i,y2+i);
			xorg.insert(x1[i]);
			yorg.insert(y1[i]);
			xorg.insert(x2[i]);
			yorg.insert(y2[i]);
		}

		int ww=xorg.size(),hh=yorg.size();
		static int f_x[1000001],f_y[1000001];
		{
			int t;
			set<int>::iterator it;
			for(it=xorg.begin(),t=0;it!=xorg.end();it++,t++)	f_x[*it]=t;
			for(it=yorg.begin(),t=0;it!=yorg.end();it++,t++)	f_y[*it]=t;
		}

		static bool mask[2011][2011]={};
		rep(y,hh)rep(x,ww)	mask[y][x]=false;
		rep(y,hh)	mask[y][ww-1]=true;
		rep(x,ww)	mask[hh-1][x]=true;
		rep(i,n){
			int l=f_x[x1[i]],r=f_x[x2[i]],u=f_y[y1[i]],b=f_y[y2[i]];
			for(int y=u;y<b;y++)for(int x=l;x<r;x++)	mask[y][x]=true;
		}

		int cnt=0;
		rep(y,hh)rep(x,ww){
			if(mask[y][x])	continue;

			queue<pii> qu;	qu.push(mp(y,x));
			while(!qu.empty()){
				pii a=qu.front();	qu.pop();
				int px=a.second,py=a.first;
				if(mask[py][px])	continue;
				mask[py][px]=true;
				rep(i,4){
					int xx=px+dx[i],yy=py+dy[i];
					if(0<=xx && xx<ww && 0<=yy && yy<hh && !mask[yy][xx]){
						qu.push(mp(yy,xx));
					}
				}
			}
			cnt++;
		}

		printf("%d\n",cnt);
	}

	return 0;
}

Measured memory_bytes: 0
let () =
  let m, f, r = ref 0, ref 0, ref 0 in
  while Scanf.scanf "%d %d %d\n" (fun x y z -> m := x; f:= y; r := z);
        not (!m = -1 && !f = - 1 && !r = -1) do
    let sum = !m + !f in 
    if (!m = -1 || !f = -1) then print_endline "F"
    else if sum >= 80 then print_endline "A"
    else if 65 <= sum && sum < 80 then print_endline "B"
    else if 50 <= sum && sum < 65 then print_endline "C"
    else if 30 <= sum && sum < 50 then (if !r < 50 then print_endline "D"
                                        else print_endline "C")
    else print_endline "F"
  done ;;


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

int mincost(int *h,int n,int k)
{

    int cost[n];   // k=0 represent 1 step

        cost[0]=0;


    int m;
    for(int i=1;i<n;i++)
    {
        m=INT_MAX;

        for(int j=1;j<=k;j++)
        {
            if(j<=i){
        if(m>(cost[i-j]+abs(h[i]-h[i-j])))
        m=(cost[i-j]+abs(h[i]-h[i-j]));

        }
        }
        cost[i]=m;
    }
    return cost[n-1];
}

int main()
{
int n,k;

cin>>n;
cin>>k;

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



cout<<mincost(h,n,k);



    return 0;
}





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

int main() {
  int a, b, c, t = 0;
  cin >> a >> b >> c;
  if(a == b) {
    if(a != c) {
      t = 1;
    }
  } else if(a == c) {
    t = 1;
  } else if(b == c) {
    t = 1;
  }
  if(t == 1) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}
      

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

int main(){
  ll K,A,B,ans=1;
  cin>>K>>A>>B;
  if(K<=A||(K>A&&A>=B)) cout<<K+1<<endl;
  else{
    ll k=K;
    K-=A-1;
    ans+=A-1;
    K-=2;
    ans+=B-A;
    ans+=K/2*(B-A);
    ans+=K%2;
    cout<<max(ans,1+k)<<endl;
  }
}



Measured memory_bytes: 256
require "pp"

n = gets.to_i
s = {}
n.times do |i|
  x = gets.chomp
  s[x] ||= 0
  s[x] += 1
end

order = %w(AC WA TLE RE)
order.each do |key|
  puts "#{key} x #{s[key] || 0}"
end

Measured memory_bytes: 14600
#include <iostream>
#include <string>
#include <unordered_map>
#include <algorithm>

using std::cin;
using std::cout;
using std::endl;

int main(int argc, char* argv)
{
    int N, M;

    cin >> N;
    std::unordered_map<std::string, int> s;

    for (int index = 0; index < N; ++index)
    {
        char input[10];
        cin >> input;

        if (s.count(input) > 0)
        {
            s[input] += 1;
        }
        else
        {
            s[input] = 1;
        }
    }

    cin >> M;
    std::unordered_map<std::string, int> t;

    for (int index = 0; index < M; ++index)
    {
        char input[10];
        cin >> input;

        if (t.count(input) > 0)
        {
            t[input] += 1;
        }
        else
        {
            t[input] = 1;
        }
    }

    int max = 0;
    for (auto& str: s)
    {
        // cout << "key: " << str.first << ", value: " << str.second << endl;
        int plus = str.second;
        int minus = 0;
        if (t.count(str.first) > 0)
        {
            minus = t[str.first];
        }

        max = std::max(plus - minus, max);
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    ll n, ans = 0, sum = 0;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n)
    {
        if (a[i] != 0)
        {
            sum += a[i];
        }
        else
        {
            ans += sum / 2;
            sum = 0;
        }
    }
    ans += sum / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1152
#include<stdio.h>

int main(void){

int ai,n,i,min,max;

long sum;

scanf("%d",&n);

for(i=0;i<n;i++){

scanf("%d",&ai);

if(i==0){

min=ai;

max=ai;

sum=ai;

}

else{

sum=sum+ai;

if(min>ai){

min=ai;

}

if(max<ai){

max=ai;

}

}

}

printf("%d %d %ld\n",min,max,sum);

return 0;

}

Measured memory_bytes: 600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

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

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

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll i,o,t,j,l,s,z;
    cin >> i >> o >> t >> j >> l >> s >> z;
    ll ans = o;
    ans += i / 2*2 + j / 2*2 + l / 2*2;
    if (i%2 + j%2 + l%2 == 3)ans+=3;
    if (i%2 + j%2 + l%2 == 2) {
        ans += 1;
        if (i * j == 0 || l == 0)ans -= 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
#define fs first
#define se second

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<ld, ld> pdd;

const int mod = 1e9 + 7;
int n;
int cnt[26];
char in[100001];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> in;
    for (int i = 0; i < n; ++i) {
        ++cnt[in[i] - 'a'];
    }
    llong ans = 1;
    for (int i = 0; i < 26; ++i) {
        ans *= cnt[i] + 1;
        ans %= mod;
    }
    printf("%lld\n", (ans + mod - 1) % mod);
    return 0;
}

Measured memory_bytes: 384
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	nextInt := func() int { scn.Scan(); r, _ := strconv.Atoi(scn.Text()); return r }

	n := nextInt()

	parents := make([]int, n)
	for i := range parents {
		parents[i] = -1
	}
	children := make([][]int, n)

	for i := 0; i < n; i++ {
		id, k := nextInt(), nextInt()
		children[id] = make([]int, 0, k)
		for j := 0; j < k; j++ {
			c := nextInt()
			parents[c] = id
			children[id] = append(children[id], c)
		}
	}

	root := -1
	for id, parent := range parents {
		if parent == -1 {
			root = id
		}
	}

	depths := make([]int, n)
	markDepth(depths, 1, children, root)

	for id := 0; id < n; id++ {
		typ := "internal node"
		if len(children[id]) == 0 {
			typ = "leaf"
		}
		if depths[id] == 0 {
			typ = "root"
		}
		fmt.Printf("node %d: parent = %d, depth = %d, %s, %s\n", id, parents[id], depths[id], typ, formatArr(children[id]))
	}
}

func markDepth(depths []int, depth int, children [][]int, root int) {
	for _, c := range children[root] {
		depths[c] = depth
		markDepth(depths, depth+1, children, c)
	}
}

func formatArr(a []int) string {
	w := bytes.NewBuffer(nil)
	w.WriteString("[")
	for i, n := range a {
		if i > 0 {
			fmt.Fprint(w, ", ")
		}
		fmt.Fprint(w, n)
	}
	w.WriteString("]")
	return w.String()
}



Measured memory_bytes: 12816
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    cout << fixed << setprecision(10);

    ll N;
    cin >> N;

    double a = (N+1) / 2;
    cout << a / N << "\n";
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D)
    cout << "Left" << endl;
  else if (A + B < C + D)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){

  int W,H,x,y,r;

  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

  if (x-r >= 0 && x+r <= W){

    if (y-r >= 0 && y+r <= H){

      printf("Yes\n");

      } else {
      
      printf("No\n");

    }

  } else {

  printf("No\n");

  }

  return 0;

}

Measured memory_bytes: 580
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))

int main(){
    int N;
    cin >> N;
    long A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    sort(A, A + N);
    long A_lined_up[N], A_lined_up2[N];
    for(int i = 0; i < N; i++){
        if(i % 2 == 0){
            A_lined_up[i] = A[i / 2];
            A_lined_up2[i] = A[N - i / 2 - 1];
        }else{
            A_lined_up[i] = A[N - i / 2 - 1];
            A_lined_up2[i] = A[i / 2];
        }
    }
    swap(A_lined_up[0], A_lined_up[N - 2 - N % 2]);
    swap(A_lined_up2[0], A_lined_up2[N - 2 - N % 2]);
    long ans = 0, ans2 = 0;
    for(int i = 1; i < N; i++){
        ans += abs(A_lined_up[i - 1] - A_lined_up[i]);
        ans2 += abs(A_lined_up2[i - 1] - A_lined_up2[i]);
    }
    cout << max(ans, ans2) << endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
// const ll RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
// gp_hash_table<int, int> table;
 
#define ll long long int
#define vii vector< ll >
#define pb push_back
#define pii pair<ll,ll>
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define ins insert
#define ld long double
#define lp(l,r) for(i=l;i<=r;++i)
 
#define lpj(l,r) for(j=l;j<=r;++j)
#define lpr(l,r) for(i=r;i>=l;--i)
#define lprj(l,r) for(j=r;j>=l;--j)
 
#define swap(a,b){ auto _t=a;a=b,b=_t;}
#define flush() cout.flush()
#define popcount __builtin_popcount
#define die() return 0;
 
 
// typedef __int128 bign;
 
 
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define MD          1000000007
#define M 			2011
#define LN 			14
#define fftmod      998244353
#define EPS         (double)1e-10
 
ll md=MD;
ll inf=1e18;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
 
 
inline ll exp(ll a,ll b){ll r=1LL;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b/=2;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (ll)r;}
 
using cd=complex<double>;
const double PI=acos(-1);
 
inline ll rand(ll l,ll r){
	return l+rng()%(r-l+1);
}

ll a[M],b[M];
ll dp[M][M];
int main(){
 
 
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
   // ifstream fin("input.txt");ofstream fout("outut.txt");
    ll t,i,j,m,n,s,z,k,p;string s1,s2;ll q;ll x,y;
    cin>>n>>m;
    lp(1,n)cin>>a[i];
    lp(1,m)cin>>b[i];
    for(i=0;i<=n;++i)dp[i][0]=1;
    for(i=1;i<=m;++i)dp[0][i]=1;

    for(i=1;i<=n;++i){
    	for(j=1;j<=m;++j){
    		ll ans=0;
    		ans+=dp[i][j-1]%md;
    		ans+=dp[i-1][j]%md;
    		ans-=dp[i-1][j-1]%md;
    		ans=(ans+md)%md;
    		// trace(ans,i,j,a[i],b[j]);
    		if(a[i]==b[j]){
    			ans+=dp[i-1][j-1]%md;
    		}ans%=md;
    		dp[i][j]=ans%md;
    	}
    }
    p=0;cout<<dp[n][m]<<"\n";





}	

Measured memory_bytes: 31744
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	int N;
	cin >> N;
	vi A(N);
	string ans = "APPROVED";
	for(int i=0; i<N; i++){
		cin >> A[i];
	}
	for(int i=0; i<N; i++){
		if(A[i]%2==0){
			if(A[i]%3!=0 && A[i]%5!=0){
				ans="DENIED";
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int spit[] = new int[N*2];
		for(int i=0;i<N*2;i++){
			spit[i] = sc.nextInt();

		}
		sc.close();
		Arrays.sort(spit);
		int ans=0;
		for(int i=0;i<N;i++){
			ans += spit[i*2];
		}
		System.out.println(ans);
	}
}


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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, t;
  cin >> n >> t;
  int mn = 1145141919, mx = 0;
  int cost = 1;
  rep(i, 0, n) {
    int a;
    cin >> a;
    mn = min(mn, a);
    if(a - mn > mx) {
      mx = a - mn;
      cost = 0;
    }
    if(a - mn == mx) cost++;
  }
  cout << cost << endl;
}


Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]
s.sort()
if n == 1:
    print(s[0])
else:
    maximum = 1
    ans = [s[0]]
    count = 1
    for i in range(1, n):
        if s[i] == s[i-1]:
            count += 1
        else:
            count = 1
        if count == maximum:
            ans.append(s[i])
        elif count > maximum:
            ans = [s[i]]
            maximum = count
    for i in ans:
        print(i)


Measured memory_bytes: 83416
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl

int main() {
    
    int l, r;
    cin >> l >> r;
    int flg = 0;
    if (r - l >= 2019) flg = 1;
    l %= 2019; r %= 2019;
    if (flg) r += 2019;
    
    int ans = 1e9 + 7;
    rep3(i, l, r) {
        rep3(j, i + 1, r + 1) {
            int sa = (ll)i * j % 2019;
            chmin(ans, sa);
        }
    }
    out(ans);
    
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int n;
map<int,int> mp;
int vis[2010];
vector<int> v[2010];
void dfs(int k,int sum){
	vis[k]=sum;
	for(int i=0;i<v[k].size();i++){
		if(sum+1<vis[v[k][i]]){
			dfs(v[k][i],sum+1);
		}
	}
}
int main(){
	int n;
	cin>>n;
	for(int i=1;i<n;i++){
		v[i].push_back(i+1);
		v[i+1].push_back(i);
	}
	int x,y;
	cin>>x>>y;
	v[x].push_back(y);
	v[y].push_back(x);
	for(int j=1;j<=n;j++)vis[j]=1000000000;
	for(int i=1;i<=n;i++){
		dfs(i,0);
		for(int j=1;j<=n;j++){
			mp[vis[j]]++;
			vis[j]=1000000000;
		}
	}
	for(int i=1;i<n;i++){
		cout<<mp[i]/2<<endl;
	}
	return 0;
}

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

int main() {
	int n, x;
	
	while (true) {
		cin >> n >> x;
		if (n == 0 and x == 0) break;
		
		int ans = 0;
		for (int a = 1; a <= n; a++) {
			for (int b = a + 1; b <= n; b++) {
				for (int c = b + 1; c <= n; c++) {
					ans += (a + b + c == x);
				}
			}
		}
		
		cout << ans << '\n';
	}
	
	return 0;
}


Measured memory_bytes: 3088
S = input()
N = list(S)

ret = ""

for i in range(len(N)):
  if i%2 == 0:
    if N[i] == "R":
      ret = "Yes"
    elif N[i] == "U":
      ret = "Yes"
    elif N[i] == "D":
      ret = "Yes"
    else:
      ret = "No"
      break
  else:
    if N[i] == "L":
      ret = "Yes"
    elif N[i] == "U":
      ret = "Yes"
    elif N[i] == "D":
      ret = "Yes"
    else:
      ret = "No"
      break
      
print(ret)

Measured memory_bytes: 3064
import heapq

n, m, s, t = map(int, input().split())
adjYen = [[] for v in range(n)]
adjSnuuk = [[] for v in range(n)]

for i in range(m):
    u, v, a, b = map(int, input().split())
    adjYen[u-1].append((v-1, a))
    adjYen[v-1].append((u-1, a))
    adjSnuuk[u-1].append((v-1, b))
    adjSnuuk[v-1].append((u-1, b))

# 単一始点最短経路を求める（ダイクストラ法）
def Dijkstra(adjList, vSt):
    numV = len(adjList)

    numDone = 0
    pq = []

    cost = [float('inf')] * numV
    cost[vSt] = 0
    heapq.heappush(pq, (0, vSt))

    while pq:
        c, vNow = heapq.heappop(pq)
        if c > cost[vNow]: continue

        numDone += 1
        if numDone == numV: break

        for v2, wt in adjList[vNow]:
            c2 = cost[vNow] + wt
            if c2 < cost[v2]:
                cost[v2] = c2
                heapq.heappush(pq, (c2, v2))

    return cost


costYen = Dijkstra(adjYen, s-1)
costSnuuk = Dijkstra(adjSnuuk, t-1)

cost = [(y + s, v) for v, (y, s) in enumerate(zip(costYen, costSnuuk))]
cost.sort()

iC = 0
for i in range(n):
    while cost[iC][1] < i:
        iC += 1
    print(10 ** 15 - cost[iC][0])


Measured memory_bytes: 96644
import Data.List
import Data.Bits

main = do
    [n, k] <- map read . words <$> getLine
    as <- map read . words <$> getLine
    let bestMask = calcBestMask k as
        in print . sum . map (\a -> a `xor` bestMask) $ as

-- number of elements with kth LSB set to 1
numBitSet :: Int -> [Int] -> Int
numBitSet _ [] = 0
numBitSet i (x:xs)
    | ithBit == 1 = 1 + numBitSet i xs
    | otherwise = numBitSet i xs
    where ithBit = shift x (-i) `mod` 2

topBit :: Int -> Int
topBit 0 = -1
topBit x = 1 + topBit (x `div` 2)

calcBestMask :: Int -> [Int] -> Int
calcBestMask k xs = calcBestMask' (topBit k) True k xs

calcBestMask' :: Int -> Bool -> Int -> [Int] -> Int
calcBestMask' (-1) _ _ _ = 0
calcBestMask' i b k xs
    | b && ithBit == 0 = calcBestMask' (i - 1) True k xs
    | b && ithBit == 1 = if numIthBitNotSet > numIthBitSet
        then shift 1 i + calcBestMask' (i - 1) True k xs
        else calcBestMask' (i - 1) False k xs
    | otherwise = if numIthBitNotSet > numIthBitSet
        then shift 1 i + calcBestMask' (i - 1) False k xs
        else calcBestMask' (i - 1) False k xs
    where
        ithBit = shift k (-i) `mod` 2
        numIthBitSet = numBitSet i xs
        numIthBitNotSet = length xs - numIthBitSet


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


vector<long long> sou(51), patty(51);

long long solve(long long n, long long x){
  if (n==0) return 1;
  else if (x==1) return 0;
  else if (x<=sou[n-1]+1) return solve(n-1, x-1);
  else if (x==sou[n-1]+2) return patty[n-1]+1;
  else if (x==sou[n]) return patty[n];
  else return patty[n-1] + 1 + solve(n-1, x-(sou[n-1]+2));
}

int main(){
  long long N, X;
  cin >> N >> X;
  sou[0] = 1; patty[0] = 1;
  for (int i=1; i<=N; i++){
    sou[i] = 2*sou[i-1]+3;
    patty[i] = 2*patty[i-1]+1;
  }
  cout << solve(N,X) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

struct UnionFind{
	vector<int> par;//par[i]:=(0以上の場合,iの親. 0未満の場合はiを含むグループのサイズ).
	int num;		//num:=(Number of groups).
	
	UnionFind(int n):par(n,-1),num(n){}//Constructor.
	
	void init(int n){par.assign(n,-1), num=n;}
	int root(int x){return (par[x]<0)?x:par[x]=root(par[x]);}//Recrusion.
	int size(int x){return -par[root(x)];}
	bool same(int x,int y){return root(x)==root(y);}
	bool unite(int x,int y){
		x=root(x), y=root(y);
		if(x==y) return false;//Do nothing.
		if(size(x)<size(y)) swap(x,y);//Merge technique.
		par[x]+=par[y];
		par[y]=x;
		num--;
		return true;
	}
};

int main(){
	int n,m;
	cin>>n>>m;
	
	vi a(m),b(m);
	REP(i,m){
		cin>>a[i]>>b[i];
		a[i]--, b[i]--;
	}
	
	int ans=0;
	REP(i,m){
		UnionFind uf(n);
		REP(j,m){
			if(i==j){}
			else uf.unite(a[j],b[j]);
		}
		debug(uf.num);
		if(uf.num>1) ans++;
	}
	
	cout<<ans<<endl;
}

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

typedef long long ll;

int n;
ll a[100005];
ll b[100005];
int main() {
  cin >> n;
  ll asum = 0,bsum = 0;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    asum += a[i];
  }
  for(int i = 0; i < n; i++){
    cin >> b[i];
    bsum += b[i];
  }

  if(asum < bsum) {
    cout << -1 << endl;
    return 0;
  }
  
  ll lack = 0;
  priority_queue<ll> q;
  int ans = 0;
  for(int i = 0; i < n; i++) {
    if(a[i] < b[i]) lack += b[i] - a[i];
    else if(a[i] > b[i]) q.push(a[i] - b[i]);
    else ans++;
  }

  while(!q.empty() && lack > 0) {
    ll t = q.top();
    q.pop();
    lack -= t;
  }

  cout << n - (ans + q.size()) << endl;
}


Measured memory_bytes: 2428
//動的計画法
//https://qiita.com/drken/items/dc53c683d6de8aeacf5a

#include <iostream>
#include <vector>

using namespace std;

//https://atcoder.jp/contests/dp/tasks/dp_b

template<class T> inline bool chmax(T& a, T b)
{
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
namespace frog2
{
	void solve()
	{
		int N, K; cin >> N >> K;
		vector<int> h(N);
		for (int i = 0; i < N;++i) {
			cin >> h[i];
		}

		//足場iにいるときの最小コストをメモする
		vector<int> dp(N, 1000 * 1000 * 1000);
		dp[0] = 0;
		for (int i = 1; i < N; ++i) {
			//K前までの足場からiの足場へ飛ぶパターンを調べる
			for (int k = 1; k <= K;++k) {
				if (i - k < 0) {
					break;
				}
				chmin(dp[i], dp[i - k] + abs(h[i] - h[i - k]));
			}
		}
		cout << dp[N - 1] << endl;
	}
}

int main()
{
	frog2::solve();

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    int h=h2-h1;
    int m=m2-m1;
    int time=h*60+m;
    cout<<time-k<<endl;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main(){
  int  a,b;
  scanf("%d %d",&a,&b);
  if(a<b){
    printf("a < b\n");
  }
  if(a>b){
    printf("a > b\n");
  }
  if(a==b){
    printf("a == b\n");
  }
  return(0);
}

Measured memory_bytes: 1008
#include<cstdio>
#include<bitset>
using namespace std;
bitset<2100*2100>f;

int main() {
	int N,A,sum=0;
	scanf("%d",&N);
	f[0]=1;
	for(int i=0; i<N; i++) {
		scanf("%d",&A);
		f|=f<<A;
		sum+=A;
	}
	//for(;p<cnt;)if(f[p]==1)p++;
	for(int i=(sum+1)/2;; i++)if(f[i]) {
			printf("%d\n",i);
			break;
		}

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int pcnt(int x) {
    return __builtin_popcount(x);
}

int f(int x) {
    if (x == 0) return 0;
    return f(x%pcnt(x))+1;
}
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	int n;
	cin >> n;
    string s;
    cin >> s;
    vector<int> x(n);
    rep(i,n) x[i] = s[i]-'0';
    int pc = 0;
    rep(i,n) pc += x[i];
    vector<int> ans(n);
    rep(b,2) {
        int npc = pc;
        if (b==0) npc++; else npc--;
        if (npc <= 0) continue;
        int r0 = 0;
        rep(i,n) {
            r0 = (r0*2)%npc;
            r0 += x[i];
        }
        int k = 1;
        for (int i = n-1; i >= 0; i--) {
            if (x[i] == b) {
                int r = r0;
                if (b == 0) r = (r+k)%npc;
                else r = (r-k+npc)%npc;
                ans[i] = f(r)+1;
            }
            k = (k*2)%npc;
        }
    }
    
    rep(i,n) cout << ans[i] << "\n";
	return 0;
}


Measured memory_bytes: 5112
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
	return (x>=0 and y>=0 and x<n and y<m);
}
ll isprime[1000];
vector<ll> prime;
void sievetoprime(ll n)
{
	mem(isprime,true);
	for(ll p=2;p*p<=n;p++)
	{
		if(isprime[p]==true)
		{
			for(ll i=p*p;i<=n;i+=p)
				isprime[i]=false;
		}
	}
}
ll lcm(ll a,ll b)
{
	return (a/__gcd(a,b))*b;
}
bool cmp(pair<string,ll> a,pair<string,ll> b)
{
	if(a.first<b.first)
		return 1;
	else if(a.x==b.x)
	{
		return a.y<b.y;
	}
	return 0;
}
void solve()
{
	ll a,b,c;
	cin>>a>>b>>c;
	ll x=c-a-b;
	if( (4*a*b)<(x*x) and x>0 )
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
	
}	

int main()
{
	IOS
	ll t;
	t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int N;
	scanf("%d", &N);

	int i, j, k, flag[100001] = {1};
	for (i = 0; flag[N] == 0; i++) {
		for (j = N; j > 0; j--) {
			if (flag[j] == 1) continue;
			else if (flag[j-1] == 1) flag[j] = 1;
			else {
				for (k = 6; k <= j; k *= 6) flag[j] |= flag[j-k];
				for (k = 9; k <= j; k *= 9) flag[j] |= flag[j-k];
			}
		}
	}
	
	printf("%d\n", i);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 512
H,W  = map(int, input().split()) 
S = [list(input()) for i in range(H)] 
T =[['.']*(W+2)]
for y in range (H):
    T.append(['.']+S[y]+['.'])

T.append(['.']*(W+2))

ans = 'Yes'
for y in range(1,H+1):
    for x in range(1,W+1):
        if ((T[y][x]=='#') and (T[y-1][x]=='.') 
            and (T[y+1][x]=='.') and (T[y][x+1]=='.') and (T[y][x-1]=='.') ):
            ans = 'No'

print(ans)
            
            

Measured memory_bytes: 3064
require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
n, C = gets.chomp.split.map(&:to_i)

a = Array.new(C+1){Hash.new(0)}
n.times do |i|
  s,t,c = gets.chomp.split.map(&:to_i)
  a[c][s] += 1
  a[c][t] -= 1
end

imos = Hash.new(0)
a.each do |ac|
  # p ac
  ac.each do |k, v|
    if v > 0
      imos[k-1] += v
    elsif v < 0
      imos[k] += v
    end
  end
end
ans = 0
current = 0
imos.sort_by{|k,v| k}.each do |k,v|
  current += v
  ans = current if ans < current
end
puts ans


Measured memory_bytes: 27256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

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

	int n;
	cin >> n;
	unordered_map<int, int> m;
	for(int i = 1; i < n; i++){
		int k;
		cin >> k;
		m[k - 1]++;
	}
	for(int i = 0; i < n; ++i) {
		if(m.count(i)) {
			cout << m[i] << "\n";
		} else {
			cout << 0 << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 11344
#include<stdio.h>
int main()
{
    int x=1,i=1;
    while(x>=0)
    {
        scanf("%d",&x);
        if(x==0)
        {
            return 0;
        }
        else{
        printf("Case %d: %d\n",i,x);
        i++;
    }
    }
    return 0;
}



Measured memory_bytes: 2028
#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;
main(){
	int N,i,h,m,d;
	for(;scanf("%d",&N),N;printf("%d\n",m)){
		vector<pair<int,int> >v;
		for(i=0;i<N*2;i++)scanf("%d:%d:%d",&h,&m,&d),v.push_back(make_pair(h*3600+m*60+d,i%2?-1:1));
		sort(v.begin(),v.end());
		for(h=m=i=0;i<N*2;i++)h+=v[i].second,m=max(m,h);
	}
}

Measured memory_bytes: 1284
#include <stdio.h>

int cache[50];

int fib(int n) {
	if(cache[n] != 0) {
		return cache[n];
	}
	
	cache[n] = fib(n - 1) + fib(n - 2);
	return fib(n - 1) + fib(n - 2);
}

int main(void) {
	int n;
	memset((char*)cache, 0x00, sizeof(cache));
	cache[0] = cache[1] = 1;
	
	scanf("%d\n", &n);
	printf("%d\n", fib(n));
	return 0;
}

Measured memory_bytes: 600
fun main(args: Array<String>) {
    abc076b()
}

fun abc076b() {
    val (n, k) = (1..2).map { readLine()!!.toInt() }

    val answer = (1..n).fold(1) { acc: Int, i: Int ->  Math.min(acc * 2, acc + k) }

    println(answer)
}


Measured memory_bytes: 33652
// #include <iostream>
// #include <cstdio>
// #include <map>
// #include <set>
// #include <vector>
// #include <algorithm>
// #include <queue>
// #include <stack>
// using namespace std;
// typedef long long ll;
// const int mo=1e9+7;
// #define rep(i, n) for (int i = 0; i < n; i++)
// int u[55];
// ll dp[55];
// char in[2][55];
// vector<int> v;
// void solve()
// {
//     int n,i,j;
//     scanf("%d%s%s",&n,in[0],in[1]);
//     for(i=0;i<n;)
//     {
//         if(i+1==n||in[0][i]==in[1][i])
//         {
//             v.emplace_back(1);
//             i++;
//         }
//         else
//         {
//             v.emplace_back(2);
//             i+=2;
//         }
//     }
//     dp[0]=6;
//     if(v[0]==1)dp[0]=3;
//     for(i=1;i<v.size();i++)
//     {
//         if(v[i]==1&&v[i-1]==1)dp[i]=dp[i-1]*2%mo;
//         if(v[i]==1&&v[i-1]==2)dp[i]=dp[i-1];
//         if(v[i]==2&&v[i-1]==1)dp[i]=dp[i-1]*2%mo;
//         if(v[i]==2&&v[i-1]==2)dp[i]=dp[i-1]*3%mo;
//     }
//     printf("%lld\n",dp[v.size()-1]);
// }
// main()
// {
//     cin.tie(0);
//     ios::sync_with_stdio(0);
//     solve();
//     return 0;
// }

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
const int mo = 1e9 + 7;
typedef long long ll;
ll a;
ll b[60];
typedef pair<ll,ll> P ;
vector<P> v;
ll mxps=-mo,mnps=mo,mx=-mo,mn=mo;
void solve()
{
    if(mn>0)rep(i,a-1);
    else if(abs(mx)<abs(mn))
    {
        rep(i,a)if(b[i]>0)v.emplace_back(make_pair(mnps,i));
        for(int i=a-1;i>0;i--)v.emplace_back(make_pair(i,i-1));
        return;
    }
    else 
    {
        rep(i,a)if(b[i]<0)v.emplace_back(make_pair(mxps,i));
    }
    rep(i,a-1)v.emplace_back(make_pair(i,i+1));
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>a;
    rep(i,a){
        cin>>b[i];
        if(mx<b[i])
        {
            mxps=i;
            mx=b[i];
        }
        if(mn>b[i])
        {
            mnps=i;
            mn=b[i];
        }
    }
    solve();
    cout<<v.size()<<endl;
    rep(i,v.size())cout<<v[i].first+1<<' '<<v[i].second+1<<endl;
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
using namespace std;
#define ll long long
signed main()
{
    ll N, M;
    cin >> N >> M;

    // a1~aN の最大公約数がd => a1~aNがすべてd*i(i:自然数)の形で表される
    for (ll i = M / N; i >= 2; --i) {
        if ((M - i * N) % i == 0) {
            cout << i << endl;
            return 0;
        }
    }

    cout << 1 << endl;
}


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

int N, M;
vector<int> A;

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

	int sum = accumulate(A.begin(), A.end(), 0);
	int ans = -1;
	if (N >= sum)
		ans = N - sum;

	cout << ans << '\n';
	return 0;
}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int main() {
	int L;
	
	while (cin >> L, L) {
		int sum = 0, ans = -1;
		
		for_(i,0,12) {
			int M, N;
			cin >> M >> N;
			sum += (M - N);
			if (sum >= L && ans == -1) ans = i + 1;
		}
		
		if (ans == -1) puts("NA");
		else cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int n,sum=0;
  cin>>n;
  for(int i=0;i<4;i++){
    if(n%10==2) sum++;
    n/=10;
  }
  cout<<sum<<'\n';
  return 0;
}


Measured memory_bytes: 256