akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace B_ABC176
{
    class MainClass
    {

        // static int[] s;

        public static void Main(string[] args)
        {
            // s = ReadLine();
            var sstr = ReadLine();
            var ans = 0;

            for (int i = 0; i < sstr.Length; i++)
            {
                if (sstr.Length == 1)
                {
                    int u = int.Parse(sstr);
                    ans += u;
                    ans = ans % 9;
                }
                else
                {
                    ans += sstr[i] - '0';
                    ans = ans % 9;
                }
            }
            if (ans == 0 || ans == 9)
            {
                WriteLine("Yes");
            }
            else
            {
                WriteLine("No");
            }
            // WriteLine(ans);


            // if(s[0]%9==0){
            //     WriteLine("Yes");
            // }else{
            //     WriteLine("No");
            // }
        }

        public static int LowerBound<T>(T[] a, T v)
        {
            return LowerBound(a, v, Comparer<T>.Default);
        }

        public static int LowerBound<T>(T[] a, T v, Comparer<T> cmp)
        {
            var l = 0;
            var r = a.Length - 1;
            while (l <= r)
            {
                var mid = l + (r - l) / 2;
                var res = cmp.Compare(a[mid], v);
                if (res == -1) l = mid + 1;
                else r = mid - 1;
            }
            return l;
        }
        public static int UpperBound<T>(T[] a, T v)
        {
            return UpperBound(a, v, Comparer<T>.Default);
        }

        public static int UpperBound<T>(T[] a, T v, Comparer<T> cmp)
        {
            var l = 0;
            var r = a.Length - 1;
            while (l <= r)
            {
                var mid = l + (r - l) / 2;
                var res = cmp.Compare(a[mid], v);
                if (res <= 0) l = mid + 1;
                else r = mid - 1;
            }
            return l;
        }
    }
}


Measured memory_bytes: 27340
#include <stdio.h>
int main(void)
{
	int N, i, j, h[10] = { 0 }, k = 0, ba = 0, kari;
	char c[201] = { 0 };
	while (1)
	{
		scanf("%d", &N);
		if (N == 0)
			break;
		scanf("%s", c);
		for (i = 0; i < 100; i++)
		{
			if( c[i] == 'M')
			{
				h[k] = h[k] + 1;
			}
			else if (c[i] == 'S')
			{
				ba =ba + h[k] + 1;
				h[k] = 0;
			}
			else if (c[i] == 'L')
			{
				h[k] = h[k] + ba + 1;
				ba = 0;
			}
			k = k + 1;
			if (k == N)
			{
				k = 0;
			}
		}
		for (i = 0; i < N; i++)
		{
			for (j = N-1; j > 0; j--)
			{
				if (h[j] < h[j-1])
				{
					kari = h[j];
					h[j] = h[j-1];
					h[j-1] = kari;
				}
			}
		}
		for (i = 0; i < N; i++)
		{
			printf("%d ", h[i]);
		}
		printf("%d\n", ba);
		ba = 0;
		k = 0;
		for (i = 0; i < 10; i++)
		{
			h[i] = 0;
		}
	}
	return 0;
}

Measured memory_bytes: 604
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
#include<functional>
using namespace std;

//v[y][x]

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int W, H, N; cin >> W >> H >> N;
	vector< vector<bool> > v(H+1, vector<bool>(W+1));
	for (int i = 0; i < N;i++) {
		int x, y, a; cin >> x >> y >> a;
		if (a == 1) {
			for (int j = 1; j <= x;j++) {
				for (int k = 1; k <= H;k++) {
					v[k][j] = true;
				}
			}
		}
		if (a == 2) {
			for (int j = x + 1; j <= W;j++) {
				for (int k = 1; k <= H;k++) {
					v[k][j] = true;
				}
			}
		}
		if (a == 3) {
			for (int j = 1; j <= y;j++) {
				for (int k = 1; k <= W;k++) {
					v[j][k] = true;
				}
			}
		}
		if (a == 4) {
			for (int j = y + 1; j <= H;j++) {
				for (int k = 1; k <= W;k++) {
					v[j][k] = true;
				}
			}
		}
	}
	int Ans = 0;
	for (int i = 1; i <= H;i++) {
		for (int j = 1; j <= W;j++) {
			if (v[i][j] == false) {
				Ans++;
			}
		}
	}
	cout << Ans << endl;
	return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    cin >> s.at(0);
    for (int i = 1; i < n; ++i) {
        cin >> s.at(i);
        if (count(s.begin(), s.end(), s.at(i)) - 1 || s.at(i).front() != s.at(i - 1).back()) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std ;

int main(){
  int i ;
  string s,t ;
  
  cin >> s ;
  
  i=0 ;
  for(i=0 ;2*i<s.length() ;i++){
    t += s[2*i] ;
  }
  
  cout << t;
}
    

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

// SegmentTree
template<class T> struct Min {
  using Type = T;
  T nil;
  Min(){}
  Min(T nil):nil(nil){}
  T operator()(T a, T b) { return a < b ? a : b; }
};
template<class T> struct Max {
  using Type = T;
  T nil;
  Max(){}
  Max(T nil):nil(nil){}
  T operator()(T a, T b) { return a > b ? a : b; }
};
template<class T> struct Sum {
  using Type = T;
  T nil;
  Sum(){}
  Sum(T nil):nil(nil){}
  T operator()(T a, T b) { return a + b; }
};

template<class Monoid> struct SegmentTree {
  using T = typename Monoid::Type;
  vector<T> data;
  Monoid func;
  int sz;
  SegmentTree(int n, Monoid f):func(f) {
    sz = 1; while(sz < n) sz <<= 1;
    data.resize(2*sz+1, func.nil);
  }
  void update(int k, T x) {
    k += sz-1;
    data[k] = x;
    while(k > 0) {
      k = (k-1)/2;
      data[k] = func(data[2*k+1], data[2*k+2]);
    }
  }
  T query(int a, int b, int k, int l, int r) {
    if(r <= a || b <= l) return func.nil;
    if(a <= l && r <= b) return data[k];
    return func(query(a, b, 2*k+1, l, (l+r)/2), query(a, b, 2*k+2, (l+r)/2, r));
  }
  T query(int a, int b) {
    return query(a, b, 0, 0, sz);
  }
};

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, q;
  cin >> n >> q;
  SegmentTree<Min<int> > seg(n, Min<int>((1LL<<31)-1));
  rep(i, q) {
    int com, x, y;
    cin >> com >> x >> y;
    if(com == 0) seg.update(x, y);
    else cout << seg.query(x, y+1) << endl;
  }


  return 0;
}

Measured memory_bytes: 4908
#include <iostream>
#include <climits>
#include <algorithm>
#include <functional>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>

using lint = long long int;
using uint = unsigned int;
using namespace std;

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

	int a;
	cin >> a;
 	for (int i = 1; i < N; i++) {
		int t;
		cin >> t;
		a = a ^ t;
 	}
	if (a == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = 998244353;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,29)-1;

const int N_MAX = pow(10,7)/2;

// factorial(階乗)の計算

ll fac[N_MAX+1] ={};

ll c_fac(int n) {
  if (fac[n]!=0) return fac[n];
  if (n==0) return fac[n] = 1;
  return fac[n] = (c_fac(n-1)*n)%MOD;
}

// inverse(逆元)の計算

ll inv(ll a,ll m) {
  ll b = m, x = 1, y = 0;
  while (b!=0) {
    ll d = a/b;
    a -= b*d; swap(a, b);
    x -= y*d; swap(x, y);
  }
  return x>=0 ? x : x+m;
}

// combinataionの計算

ll nck(ll n, ll k) { 
  if (n<k) return 0;
  ll nume = fac[n];
  ll deno = ( inv(fac[n-k],MOD) * inv(fac[k],MOD) ) % MOD;
  return ( nume * deno ) % MOD;
}

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

  ll com[N/2] = {}; ll pow2 = 1;
  c_fac(N/2+1);
  rep(i,N/2) {
    com[(N/2-1)-i] = (pow2 * nck(N/2, N/2-i)) % MOD;
    pow2 = (pow2*2) % MOD;
  }
  ll sum[N/2] = {}; rep(i,N/2) sum[i] = (i==0) ? com[(N/2-1)-i] : (sum[i-1] + com[(N/2-1)-i]) % MOD;
  ll result = 1, tmp = 0; 
  rep(i,N) { result *= 3; result %= MOD; }
  rep(i,N/2) { tmp += com[i] * sum[i] * 2; tmp %= MOD; }
  result = ( result - tmp + MOD ) % MOD;
  cout << result << endl;
  // rep(i, N/2) cout << com[i] << " " << sum[i] << endl;
  return 0;
}

Measured memory_bytes: 156544
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

//#define int long long
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

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>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
template<class T>void print(T a){cout << a << endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    vector<string> s(3);
    vin(s);
    vector<queue<int>> vq(3);
    rep(i, 3) {
        rfor(c, s[i]) {
            vq[i].push(c - 'a');
        }
    }

    int turn = 0;
    while(1) {
        if(vq[turn].empty()) {
            print((char)('A' + turn));
            return 0;
        } else {
            int t = vq[turn].front();
            vq[turn].pop(); 
            turn = t;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int n,i,j,flag=0;
	cin>>n;
	for(i=0;i<=n/4;i++)
	{
		for(j=0;j<=n/7;j++)
		{
			if(i*4+j*7==n)
			{
				flag=1;
				cout<<"Yes"<<endl; 
				break;
			}
		}
		if(flag==1)
			break;
	}
	if(flag==0)
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for (int i = 0; i < n; ++i)
#define REP(i,k,n) for (int i = k; i <= n; ++i)
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define F first
#define S second
#define I insert
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define debug1(a) cout<<" "<<#a<<" : "<<a<<"\n"
#define debug2(a,b) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<"\n"
#define debug3(a,b,c) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<"\n"
#define debug4(a,b,c,d) cout<<" "<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<"\n"
#define INF (int)10000000000000000
#define PI (double)3.14159265358979
// #define M 421412341324321
#define MOD 1000000007


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

	

	int x;
	cin>>x;
	for (int i=x;;++i)
	{
		bool f=1;
		int p = i;
		for (int j=2;j*j<=p;++j)
		{
			if (p%j==0)
			{
				while(p%j==0) p/=j;
				f=0;
				break;
			}
		}
		if (f)
		{
			cout<<i<<"\n";
			break;
		}
	}


	



	return 0;
}


Measured memory_bytes: 256
n,m = map(int,raw_input().strip().split(' '))
graph = [[] for i in range(n)]
for i in range(m):
    s,t = map(int,raw_input().strip().split(' '))
    graph[s].append(t)
    graph[t].append(s)
color = {}
c = 0
for i in range(n):
    if not i in color:
        que = [i]
        color[i] = c
        while len(que) > 0:
            u = que[0]
            for v in graph[u]:
                if not v in color:
                    color[v] = c
                    que.append(v)
            del que[0]
        c += 1
q = int(raw_input())
for i in range(q):
   s,t = map(int,raw_input().strip().split(' '))
   if color[s] == color[t]:
     print 'yes'
   else:
     print 'no'

Measured memory_bytes: 32080
<?php
$n = trim(fgets(STDIN));
$a = explode(" ",trim(fgets(STDIN)));
 
$M = 0;
$r = array(0,0,0,0,0,0,0,0);
foreach($a as $val){
    $i = floor($val / 400);
    if($i > 7){
        ++$M;
    }else{
        ++$r[$i];
    }
}
 
$m = 0;
foreach($r as $key => $val){
    if($val >= 1){
        ++$m;
    }
}

echo max(1,$m) . " " ;
echo $m + $M ;
?>

Measured memory_bytes: 3700
n = int(input())
A = list(map(int,input().split()))
ans1 = max(A)
ans2 = 0
minid = 10**9+1
for a in A:
    if abs(ans1/2-a) <= minid:
        minid = abs(ans1/2-a)
        ans2 = a
print(ans1, ans2)

Measured memory_bytes: 14428
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clz(x) - 1;	}

//Variables Declaration


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

 	int n ;
 	cin >> n ;

 	ll numberOdd = ceil(n*1.0/2);

 	cout << numberOdd*1.0 / n << endl;





	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0:
    b = a[::-2]
    c = a[::2]
    d = b + c
    for i in d:
        print(i, end=' ')
else:
    b = a[::-2]
    c = a[1::2]
    d = b + c
    for i in d:
        print(i, end=' ')

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

int main() {
  string S;
  cin >> S;
  int ans = 0;
  if (S[0] == '1') ans++;
  if (S[1] == '1') ans++;
  if (S[2] == '1') ans++;
  if (S[3] == '1') ans++;
  if (S[4] == '1') ans++;
  if (S[5] == '1') ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,j,a;
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            a=i*j;
            printf("%dx%d=%d\n",i,j,a);
        }
    }
    return 0;
}


Measured memory_bytes: 2028
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def binary_search(li,item):#二分探索
	left,right = 0, len(li)
	while left<=right:
		mid = (left+right)//2
		if li[mid]==item:
			return mid
		elif li[mid]<item:
			left = mid+1
		else:
			right = mid-1
	return -1

N = readInt()
S = readChar()
rgb = {"R":[],"G":[],"B":[]}
for i in range(N):
	rgb[S[i]].append(i)

c=s=0
c=len(rgb["R"])*len(rgb["G"])*len(rgb["B"])
for i in range(N):
	for j in range(i+1,N):
		k = 2*j-i
		if k>=N:
			continue
		if S[i]!=S[j] and S[i]!=S[k] and S[k]!=S[j]:
			s+=1

ans=c-s
print(ans)


Measured memory_bytes: 9836
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <tuple>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    ll n, t, a[3030], b[3030];
    cin >> n >> t;
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

    ll dp[n + 5][t + 3030] = {}, mx[n + 5][t + 3030] = {};
    for (int w = 0; w <= t; w++) dp[0][w] = 0;

    for (int i = 0; i < n; i++) {
        for (int w = 0; w <= t + 3000; w++) {
            if (w >= a[i]) {
                if (dp[i][w - a[i]] + b[i] > dp[i][w]) {
                    mx[i + 1][w] = max(mx[i][w - a[i]], a[i]);
                }
                else {
                    mx[i + 1][w] = mx[i][w];
                }
                dp[i + 1][w] = max(dp[i][w - a[i]] + b[i], dp[i][w]);
            }
            else {
                dp[i + 1][w] = dp[i][w];
                mx[i + 1][w] = mx[i][w];
            }
        }
    }

    //for (int i = 0; i <= n + 20; i++) cout << i << " " << dp[n][i] << " " << mx[n][i] << endl;

    ll ans = 0;
    for (int i = t; i <= t; i++) {
        if (i - mx[n][i] < t) ans = max(ans, dp[n][i]);
    }
    cout << dp[n][t] << endl;

}


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

#define ll long long

int main(){

    int n;
    ll w;
    cin >>n>>w;
    pair<ll,ll> a[n];
    for (int i=0;i<n;i++){
        cin >>a[i].first>>a[i].second;
    }
    ll dp[n+1][w+1];
    for (int i=0;i<=n;i++){
        for (int j=0;j<=w;j++){
            if (i==0 || j==0){
                dp[i][j]=0;
                continue;
            }
            if (a[i-1].first<=j){
                dp[i][j]=max(dp[i-1][j],a[i-1].second+dp[i-1][j-a[i-1].first]);
                continue;
            }
            dp[i][j]=dp[i-1][j];
        }
    }
    cout <<dp[n][w]<<endl;
    return 0;
}


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

int main()
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	int H1 , M1 , H2 , M2 , K ; 
	int time_long = 0 ; 
	cin >> H1 >> M1 >> H2 >> M2 >> K ; 
	if(M1 > M2)
		time_long = (H2 - H1 - 1) * 60 + (M2 + 60 - M1) ; 
	else
		time_long = (H2 - H1) * 60 + (M2 - M1) ; 
	int ans  = time_long - K ;
	cout << ans  ;   
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>

using namespace std;

int main(){

    int N;
    cin >> N;

    vector<int> L(2 * N);
    for(int i = 0; i < 2 * N; i++){
        cin >> L[i];
    }

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

    int ans = 0;
    for(int i = 0; i < 2 * N; i += 2){
        ans += L[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<queue>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int c[10],d[10],n,w,h,x,y,z;
  int sm=0;
  char s;
  bool a[1002][1002],b[1002][1002];
  queue<pair<pair<int,int>,int> > q;
  memset(a,0,sizeof(a));
  cin>>h>>w>>n;
  for(i=1;i<h+1;i++){
    for(j=1;j<w+1;j++){
      cin>>s;
      if(s!='X'){
	a[j][i]=1;
	if(0){
	}else if(s=='.'){
	}else if(s=='S'){
	  c[0]=j;
	  d[0]=i;
	}else{
	  c[s-'0']=j;
	  d[s-'0']=i;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    memset(b,0,sizeof(b));
    while(q.empty()==0)
      q.pop();
    q.push(make_pair(make_pair(c[i],d[i]),0));
    for(;;){
      x=q.front().first.first;
      y=q.front().first.second;
      z=q.front().second;
      q.pop();
      if(a[x][y]&&b[x][y]==0){
	if(x==c[i+1]&&y==d[i+1])
	  break;
	b[x][y]=1;
	q.push(make_pair(make_pair(x-1,y),z+1));
	q.push(make_pair(make_pair(x,y-1),z+1));
	q.push(make_pair(make_pair(x+1,y),z+1));
	q.push(make_pair(make_pair(x,y+1),z+1));
      }
    }
    sm+=z;
  }
  cout<<sm<<endl;
  return 0;
}

Measured memory_bytes: 2832
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
int n, a[100005];
int pref[100005], suf[100005];
signed main(){
	cin >> n;
	for(int i = 1 ; i <= n ; i ++) cin >> a[i];
	pref[1] = a[1];
	for(int i = 2 ; i <= n ; i ++) 
		pref[i] = __gcd(pref[i - 1], a[i]);
	suf[n] = a[n];
	for(int i = n - 1 ; i >= 1 ; i --) 
		suf[i] = __gcd(suf[i + 1], a[i]);
	int ans = max(pref[n - 1], suf[2]);
	for(int i = 2 ; i < n ; i ++)
		ans = max(ans, __gcd(pref[i - 1], suf[i + 1]));
	cout << ans;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
    int n,m;
    while(cin >> n >> m){
        if((n|m) == 0) break;

        vector<int> h,w;
        map<int,int> mh, mw;
        int sum=0,tmp;
        h.push_back(0);
        for(int i=0;i<n;i++){
            cin >> tmp;
            sum += tmp;
            h.push_back(sum);
        }
        sum = 0;
        w.push_back(0);
        for(int i=0;i<m;i++){
            cin >> tmp;
            sum += tmp;
            w.push_back(sum);
        }

        for(int i=0;i<h.size();i++){
            for(int j=i+1;j<h.size();j++){
                mh[h[j] - h[i]]++;
            }
        }

        for(int i=0;i<w.size();i++){
            for(int j=i+1;j<w.size();j++){
                mw[w[j] - w[i]]++;
            }
        }
        
        map<int,int>::iterator hit = mh.begin(), wit = mw.begin();
        
        int ret = 0;
        while(hit != mh.end() && wit != mw.end()){
            if((*hit).first == (*wit).first){
                ret += (*hit).second * (*wit).second;
                ++hit;
                ++wit;
            }else if((*hit).first < (*wit).first){
                ++hit;
            }else{
                ++wit;
            }
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 18000
N, P = map(int, input().split())
A = list(map(int, input().split()))

odd = 0
for a in A:
    if a % 2 != 0:
        odd += 1

if odd == 0:
    if P == 1:
        res = 0
    else:
        res = 2 ** N
else:
    res = 2 ** (N - 1)

print(res)

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

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++)
    cin >> x[i];

  int l         = n - 1;
  int M         = (l + 1) / 2;
  vector<int> z = x;
  sort(z.begin(), z.end());
  map<int, int> m;

  int first  = z[M - 1];
  int second = z[M];
  for (int i = 0; i < M; i++) {
    m[z[i]]++;
  }

  for (int i = 0; i < n; i++) {
    if (m[x[i]] != 0) {
      if (second == x[i]) {
        cout << first << endl;
      } else {
        cout << second << endl;
      }
    } else {
      cout << first << endl;
    }
  }
}

Measured memory_bytes: 12928
MOD = 10 ** 9 + 7

# MODを法とした階乗、組み合わせ
class ModCombination
  attr_reader :fac, :inv, :finv, :mod

  def initialize(n, mod: MOD)
    @mod = mod
    @fac = [1, 1]
    @inv = [1, 1]
    @finv = [1, 1]

    (2..n).each do |i|
      @fac[i] = fac[i - 1] * i % mod
      @inv[i] = mod - inv[mod % i] * (mod / i) % mod
      @finv[i] = finv[i - 1] * inv[i] % mod
    end
  end

  def combination(n, k)
    return 0 if n < k
    return 0 if n < 0 || k < 0

    fac[n] * (finv[k] * finv[n - k] % mod) % mod
  end

  def repeated_combination(n, k)
    combination(n + k - 1, k)
  end
end

x,y = gets.split.map &:to_i
if (x+y)%3!=0
  puts 0
  exit
end

a = (2*x-y)/3
b = (-x+2*y)/3

MC = ModCombination.new(1_000_000)
ans = MC.combination(a+b,a)

puts ans

Measured memory_bytes: 31148
from functools import reduce
def comb(k, r, mod):
  return (reduce(lambda x, y:(x*y)%mod, range(k-r+1, k+1))*pow(reduce(lambda x, y:(x*y)%mod, range(1, r+1)), mod-2, mod))%mod

n, a, b = map(int, input().split())
mod = 10**9+7
print((pow(2, n, mod)-1-comb(n, a, mod)-comb(n, b, mod))%mod)

Measured memory_bytes: 38640
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll a,b,c;
	scan(a>>b>>c);
	if(c-b-a<0) prin("No");
	else if(4*a*b<(c-b-a)*(c-b-a)) prin("Yes");
	else prin("No");
	return 0;
}


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

#define N_MAX 3002

using namespace std;

int n;

double p[N_MAX];

double dp[N_MAX][N_MAX];

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> p[i];
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++)
        for(int j = 0; j <= i; j++)
            dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][j - 1] * p[i];
    double ans = 0;
    for(int i = n / 2 + 1; i <= n; i++)
        ans += dp[n][i];
    cout << fixed << setprecision(13) << ans << "\n";
    return 0;
}


Measured memory_bytes: 68992
S = input()
N = len(S)

def plindrome_checker(strings):
    result = True
    length = len(strings)
    for k in range(length):
        if (strings[k] == strings[length-1-k]):
            pass
        else:
            result = False
    return result

str0 = plindrome_checker(S)
str1 = plindrome_checker(S[0:(N-1)//2])
str2 = plindrome_checker(S[(N-1)//2+1:])

if(str0 and str1 and str2):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

ll solve(ll n,ll m){
    vector<ll> a(n),b(m);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }

    vector<ll> adist,bdist;
    for(int i = 0; i < n; i++){
        ll dist = a[i];
        adist.push_back(dist);
        for(int j = i + 1; j < n; j++){
            dist += a[j];
            adist.push_back(dist);
        }
    }
    for(int i = 0; i < m; i++){
        ll dist = b[i];
        bdist.push_back(dist);
        for(int j = i + 1; j < m; j++){
            dist += b[j];
            bdist.push_back(dist);
        }
    }

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

    ll ans = 0;
    for(int i = 0; i < adist.size(); i++){
        auto itr = lower_bound(bdist.begin(),bdist.end(),adist[i]);
        auto itr2 = upper_bound(bdist.begin(),bdist.end(),adist[i]);
        ans += (ll)(itr2 - itr);
    }
    return ans;
}

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

    vector<ll> ans;
 
    while(true){
        ll n,m;
        cin >> n >> m;

        if(n == 0 && m == 0){
            break;
        }

        ans.push_back(solve(n,m));
    }

    for(auto x:ans){
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 36892
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cmath>

using namespace std;

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

typedef long long ll;

class Cake{
public:
  int w,h,area;

  Cake(){}
  Cake(int _w,int _h){
    w = _w;
    h = _h;
    area = w * h;
  }

  bool operator<(const Cake &c)const{
    return area < c.area;
  }

  void show(){
    printf("(%d, %d) ",w,h);
  }
};

vector<Cake> cutCake(Cake c,int x){
  int h = c.h;
  int w = c.w;
  vector<Cake> res;

  x = x % ((w + h) * 2);

  if(x >= w + w + h){
    x = w + (2 * (w + h) - x);
  }
  else if(x >= w + h){
    x = w - (x - (w + h));
  }

  if(x >= w){
    res.push_back(Cake(w,x-w));
    res.push_back(Cake(w,w+h-x));
  }
  else{
    res.push_back(Cake(x,h));
    res.push_back(Cake(w-x,h));
  }

  sort(res.begin(),res.end());
  return res;
}

int main(){
  int n,w,h;

  while(cin>>n>>w>>h,n||w||h){
    vector<Cake> v;
    v.push_back(Cake(w,h));

    rep(i,n){
      int p,s;
      cin>>p>>s;
      vector<Cake> tmp = cutCake(v[p-1],s);
      v.erase(v.begin() + (p-1));
      v.push_back(tmp[0]);
      v.push_back(tmp[1]);
    }

    sort(v.begin(),v.end());
    rep(i,v.size()){
      if(i != 0) cout<<" ";
      cout<<v[i].area;
      //v[i].show();
    }
    cout<<endl;
  }
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int h,w,n;
	cin>>h>>w>>n;

	int x = max(h,w);
	cout<<(n+x-1)/x<<endl;

	return 0;
}

Measured memory_bytes: 764
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		string[] str = Console.ReadLine().Split();
		int ct = 0;
		for(var i=0;i<N;i++){
			int a1 = int.Parse(str[i]);
			int a2 = i+1;
			if(a1!=a2){
				ct++;
			}
		}
		if(ct<=2){
			Console.WriteLine("YES");
		} else {
			Console.WriteLine("NO");
		}
	}
}

Measured memory_bytes: 11092
def printans(x):
	for h in range(1, H+1):
		for w in range(1, W+1):
			if w > 1:
				print(' ', end='')
			print(x[h][w], end='')
		print()
		
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
a.insert(0, -1)

g = [[-1] * (W+2) for x in range(H+2)]
v = 1
for h in range(1, H+1):
	if h%2 != 0:
		for w in range(1, W+1):
			g[h][w] = v
			a[v] -= 1
			if a[v] == 0:
				v += 1
	else:
		for w in range(W, 0, -1):
			g[h][w] = v
			a[v] -= 1
			if a[v] == 0:
				v += 1
				
printans(g)

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

long c[22];
int main() {
	long L, a, b, M;
	cin >> L >> a >> b >> M;
	for (long i = 0, j = 1; i < 18; i++, j *= 10) {
		long l = -1, r = L;
		while (l + 1 < r) {
			long m = (l + r) / 2;
			if (a + b * m < j) l = m;
			else r = m;
		}
		if (a + b * r < j * 10)
			c[i] = r;
		else if (i) c[i] = c[i - 1];
	}
	c[18] = L;
	long t = 1, S = 0, T = a;
	for (int e = 0; e < 18; e++) {
		(t *= 10) %= M;
		long A[4][3][3] = {};
		for (int i = 0; i < 3; i++)
			A[2][i][i] = 1;
		A[0][0][1] = A[0][1][1] = A[0][2][2] = 1;
		A[0][1][2] = b;
		A[0][0][0] = t;
		int x = 0, y = 2;
		auto f = [&](int &z) {
			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					A[z ^ 1][i][j] = 0;
					for (int k = 0; k < 3; k++)
						(A[z ^ 1][i][j] += A[x][i][k] * A[z][k][j]) %= M;
				}
			}
			z ^= 1;
		};
		for (long k = c[e + 1] - c[e];;) {
			if (k & 1) f(y);
			k >>= 1;
			if (!k) break;
			f(x);
		}
		S = (S*A[y][0][0] + T * A[y][0][1] + A[y][0][2]) % M;
		(T += A[y][1][2]) %= M;
	}
	cout << S << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
using namespace std;
signed main() {
	int n; cin >> n;
	int ans = 0;
	int h[123]; h[0] = 0;
	for1(i, n) {
		cin >> h[i]; if (h[i - 1] < h[i])ans += h[i] - h[i - 1];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  ll h, w;
  cin >> h >> w;
  vector<string> s(h);
  REP(i, h) { cin >> s[i]; }
  vector<vector<ll>> dp(h + 1, vector<ll>(w + 1, 1e18));
  if (s[0][0] == '#') {
    dp[0][0] = 1;
    // s[0][0] = '.';
  } else {
    dp[0][0] = 0;
  }

  REP(i, h) REP(j, w) {
    if (i + 1 < h) {
      chmin(dp[i + 1][j], dp[i][j] + (s[i][j] == '.' && s[i + 1][j] == '#'));
    }
    if (j + 1 < w) {
      chmin(dp[i][j + 1], dp[i][j] + (s[i][j] == '.' && s[i][j + 1] == '#'));
    }
  }
  cout << dp[h - 1][w - 1] << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

ll N, K, W, H, M;

int main() {
	cin >> N >> K;
	int ans = 0;
	while(N){
		N /= K;
		++ans;
	}
	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,y,a,b;
  	cin>>x>>y;
  	
  	a=(4-x)*100000;
  	b=(4-y)*100000;
  
  	 if(x==1&&y==1){
    	cout<<a+b+400000<<endl;
    }
  	
  	else if(a>=100000&&b>=100000){
    	cout<<a+b<<endl;
    }
  	else if(a>=100000||b>=100000){
    	cout<<max(a,b)<<endl;
    }
  	else{
    	cout<<0<<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define FOR(i,a,b) for(int i=(a);i<(b);++i) 
#define REP(i,n) FOR(i,0,n)
#define EACH(x,a) for(auto& (x):(a))
#define ALL(obj) (obj).begin(),(obj).end()
#define Yes(n) cout<<((n)?"Yes":"No")<<endl;
#define CO(x) cout<<(x)<<endl;
#define COSP(x) cout<<(x)<<" ";
#define DICIMAL(x) fixed<<setprecision(x)
using namespace std;
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
const int INF=1e9;
const ll LINF=1e18;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

using Graph=vector<vector<pii>>;
int N;
Graph G;

vector<int> res;

void dfs(int v, int p, int c){
  res[v] = c; // c is color 1 or 0
  EACH(e,G[v]){
    if(e.first == p) continue;
    if(e.second & 1) dfs(e.first, v, 1-c);
    else dfs(e.first, v, c);
  }
}

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

  cin>>N;
  G.assign(N, vector<pii>());
  REP(i,N-1){
    int u,v,w; cin>>u>>v>>w;
    --u; --v;
    G[u].push_back(pii(v,w));
    G[v].push_back(pii(u,w));
  }
  res.assign(N,0);
  dfs(0, -1, 1);
  EACH(v, res) cout<<v<<endl;
  return 0;
}


Measured memory_bytes: 8960
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: usize = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

pub trait SetMinMax {
	fn setmin(&mut self, v: Self) -> bool;
	fn setmax(&mut self, v: Self) -> bool;
}
impl<T> SetMinMax for T where T: PartialOrd {
	fn setmin(&mut self, v: T) -> bool {
		*self > v && { *self = v; true }
	}
	fn setmax(&mut self, v: T) -> bool {
		*self < v && { *self = v; true }
	}
}

fn solve() {
	let (a,b,c) = read!(i64,i64,i64);
	let r = (c-a-b)*(c-a-b);
	let l = 4*a*b;
	if c-a-b<=0 {
		println!("No");
		return;
	}
	if l<r {
		println!("Yes");
	}
	else {
		println!("No");
	}
}


fn run() {
    solve();
}


Measured memory_bytes: 8572
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private final static String NEGATIVE = "NO\n";
	private final static String AFFIRMATIVE = "YES\n";

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 512);
		int number = Integer.parseInt(br.readLine());
		int sides[] = new int[3];
		StringTokenizer tknz;
		StringBuilder builder = new StringBuilder();

		for (; 0 < number; number--) {
			tknz = new StringTokenizer(br.readLine());
			for (int i = 0; i < 3; i++) {
				sides[i] = Integer.parseInt(tknz.nextToken());
			}
			Arrays.sort(sides);
			if (sides[0] * sides[1] * sides[2] % 60 != 0) {
				builder.append(NEGATIVE);
			} else if (Math.pow(sides[0], 2) + Math.pow(sides[1], 2) != Math.pow(sides[2], 2)) {
				builder.append(NEGATIVE);
			} else {
				builder.append(AFFIRMATIVE);
			}
		}
		System.out.print(builder);
	}
}

Measured memory_bytes: 18368
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

class data{
public:
	int x,y,c;
	data(){}
	data(int xx,int yy,int cc){
		x=xx;
		y=yy;
		c=cc;
	}
	bool operator <(const data& d1)const{
		return c>d1.c;
	}
};
#define INF 1e9
int w,h,n;
const char* dir="RDLU";
double dx[4]={1,0,-1,0};
double dy[4]={0,1,0,-1};
int sx,sy,tx,ty;
int stx,sty;
int stdir[1001];
int fie[1003][1003];
int dp[1003][1003];

int dijk(){
	priority_queue<data> que;
	for(int i=0;i<=(h+1)*2;i++){
		for(int j=0;j<=(w+1)*2;j++){
			dp[j][i]=INF;
		}
	}
	dp[sx][sy]=0;
	que.push(data(sx,sy,0));
	while(que.size()){
		data q=que.top();
		que.pop();
		if(dp[q.x][q.y]<q.c)continue;
		if(q.x==tx && q.y==ty)return q.c;
		for(int i=0;i<4;i++){
			int nx=q.x+dx[i],ny=q.y+dy[i];
			if(nx>=0 && nx<=(w+1)*2 && ny>=0 && ny<=(h+1)*2){
				int nc=q.c+fie[nx][ny];
				nx+=dx[i];
				ny+=dy[i];
				if(dp[nx][ny]>nc){
					dp[nx][ny]=nc;
					que.push(data(nx,ny,nc));
				}
			}
		}
	}
}

int main(void){
	scanf("%d %d %d",&w,&h,&n);
	scanf("%d %d %d %d",&sx,&sy,&tx,&ty);
	sx*=2;
	sy*=2;
	tx*=2;
	ty*=2;
	int cnt=0;
	for(int i=0;i<n;i++){
		scanf("%d %d",&stx,&sty);
		int t;
		string str;
		cin >> t >> str;
		stx=stx*2+1,sty=sty*2+1;
		fie[stx][sty]++;
		for(int j=0;j<str.size();j++){
			for(int k=0;k<4;k++){
				if(dir[k]==str[j]){
					stdir[j]=k;
					break;
				}
			}
		}
		for(int j=0;j<t;j++){
			for(int k=0;k<str.size();k++){
				int l=stdir[k];
				if(stx+dx[l]*2>=0 && stx+dx[l]*2<=w*2 && sty+dy[l]*2>=0 && sty+dy[l]*2<=h*2){
					stx+=dx[l],sty+=dy[l];
					fie[stx][sty]++;
					stx+=dx[l],sty+=dy[l];
					fie[stx][sty]++;
				}
			}
		}
	}
	printf("%d\n",dijk());
	return 0;
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int r;

signed main() {
	cin >> r;
	cout << "A";
	
	if (r<1200) cout << "B";
	else if (r<2800) cout << "R";
	else cout << "G";
	
	cout << "C" << ln;
}

Measured memory_bytes: 896
// Ticket Sales
#include <iostream>
using namespace std;

int main(void) {
  int ticket[4];
  ticket[0] = 6000;             // S
  ticket[1] = 4000;             // A
  ticket[2] = 3000;             // B
  ticket[3] = 2000;             // C

  for (int i = 0; i < 4; i++) {
    int t, n;
    cin >> t >> n;
    t--;

    cout << ticket[t] * n << endl;
  }

  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n, k; cin >> n >> k;
  vector<int> h(n);
  int cnt = 0;
  for(int i=0;i<n;++i) {
    cin >> h[i];
    if(h[i] >= k) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 640
# 2019/05/25
# AtCoder Beginner Contest 061 - B

# Input
n, m = map(int, input().split())
rcnt = [0] * (n + 1)
for i in range(m):
    a, b = map(int, input().split())
    rcnt[a] += 1
    rcnt[b] += 1

# Output
for i in range(1, n+1):
    print(rcnt[i])


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    map<int, int> mp;
    ll ans = 0;
    rep(j,n) {
        int sa = j - a[j];
        ans += mp[sa];
        int wa = j + a[j];
        mp[wa]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 21056
#include <iostream>
#include <string>

using namespace std;

int main() {

  int n, ans = 0, AC, WA, TLE, RE;
  cin >> n;
  AC = WA = TLE = RE = 0;
  string inp;
  for(int i = 1;i <= n;i++){
    cin >> inp;
    if(inp == "AC"){
      AC++;
    }else if(inp == "WA"){
      WA++;
    }else if(inp == "TLE"){
      TLE++;
    }else if(inp == "RE"){
      RE++;
    }
  }
  cout << "AC x " << AC << "\nWA x " << WA << "\nTLE x " << TLE << "\nRE x " << RE;
  return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
int prime[1000001];
int main(){
  int i, k, n,cnt = 0;
  for(i = 2; i <= 1000000; i++){
    prime[i] = 1;
  }
  for(i = 2; i*i <= 1000000; i++){
    if(prime[i]){
      for(k = 2 * i; k <= 1000000; k += i){
        prime[k] = 0;
      }
    }
  }
  while(1){ 
    if(scanf("%d", &n) == EOF) break;
    for(i = 2; i <= n; i++){
      if(prime[i] == 1){
        cnt++;
      }
    }
    printf("%d\n",cnt);
    cnt = 0;
  }
  return 0;
}

Measured memory_bytes: 4500