akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(2);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    string s;
    cin>>s;
    int ans=0;
    int t=0;
    rep(i,s.length()){
        if(s[i]=='W'){
            ans+=t;
        }
        else {
            t++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = 998244353;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

Int N;
vector<Int> A, B;

_int used[4010][4010], mem[4010][4010];

Int dfs(Int x, Int a, Int b, Int p, Int q){
  while(p < N && A[p] == 0) p++;
  while(q < N && B[q] == 0) q++;

  //pr(x, a, b, p, q);
  
  if(p == N || q == N) return 1;
  if(used[x][a]++) return mem[x][a];

  Int cnt1 = 0, cnt2 = 0;
  if(p <= x){
  A[p]--;
  cnt1 = dfs(x + 1, a + 1, b, p, q);
  A[p]++;
  }

  if(q <= x){
    B[q]--;
    cnt2 = dfs(x + 1, a, b + 1, p, q);
    B[q]++;
  }

  return mem[x][a] = (cnt1 + cnt2)%mod;
}
signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s;
  cin>>s;
  N = s.size();
  A.resize(N);
  B.resize(N);

  for(Int i=0;i<N;i++){
    if(s[i] == '0') A[i] = 2, B[i] = 0;
    if(s[i] == '1') A[i] = 1, B[i] = 1;
    if(s[i] == '2') A[i] = 0, B[i] = 2;
  }


  Int ans = dfs(0, 0, 0, 0, 0);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 124160
from operator import itemgetter
n = int(input())

lists = list()
for i in range(n):
  s, p = input().split()
  lists.append( (i+1, s, int(p)) )

sorted_list = sorted( lists, key=lambda x:( x[1], -x[2] ))

for i in sorted_list:
  print( i[0] )

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

#define pb push_back
#define int long long
#define mkpr make_pair
#define REP(i,a,b) for (i = a; i <= b; i++)
#define RREP(i,a,b) for (int i = a; i >= b; i--)

typedef pair<int, int> pii;
typedef map<int, int> mpii;
typedef unordered_map<int, int> umpii;
typedef vector<int> vi;
typedef vector<pii> vpii;
#define ff first
#define ss second
#define setbits(x)  __builtin_popcountll(x)
#define zrobits(x)  __builtin_ctzll(x)
#define precise(x) cout<<fixed<<setprecision(9)<<x<<endl
#define mod 1000000007
#define MAX 200010
#define INF (long long) 4e18
#define endl "\n"

void in() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}


int32_t main() {
	in();
	int n;
	cin >> n;
	if (n >= 30)
		cout << "Yes\n";
	else
		cout << "No\n";

}

Measured memory_bytes: 3652
N, *X = map(int, open(0).read().split())

MAX = 10 ** 5 + 1
MOD = 10 ** 9 + 7

# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1
for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    
# Inverse factorial
finv = [0] * (MAX + 1)
finv[MAX] = pow(fac[MAX], MOD - 2, MOD)
for i in reversed(range(1, MAX + 1)):
    finv[i - 1] = finv[i] * i % MOD

def comb(n, k):
    if n < k:
        return 0
    return fac[n] * finv[n - k] * finv[k]

# Find indices of duplicated values
indices = [-1] * (N + 1)
for i in range(N + 1):
    if indices[X[i]] < 0:
        indices[X[i]] = i
    else:
        l = indices[X[i]]
        r = i
        break

for k in range(1, N + 2):
    print((comb(N + 1, k) - comb(l + N - r, k - 1)) % MOD)



Measured memory_bytes: 59952
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


lint key(const V<>& v) {
  lint res = 0;
  for (int i = 0; i < 4; ++i) {
    lint curr = 0;
    for (int j = 0; j < 4; ++j) curr += static_cast<lint>(v[i + j & 3]) << 10 * j;
    res = max(res, curr);
  }
  return res;
}

int coeff(lint key) {
  V<> v(4);
  for (int i = 0; i < 4; ++i) {
    v[i] = key & 1023;
    key >>= 10;
  }
  if (v[0] == v[2] and v[1] == v[3]) {
    if (v[0] == v[1]) return 4;
    return 2;
  }
  return 1;
}

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n; cin >> n;
  VV<> c; assign(c, n, 4, 0);
  for (int i = 0; i < n; ++i) for (int j = 0; j < 4; ++j) cin >> c[i][j];
  map<lint, lint> mp;
  for (int i = 0; i < n; ++i) ++mp[key(c[i])];
  lint res = 0;
  for (int d = 0; d < n; ++d) for (int u = d + 1; u < n; ++u) {
    --mp[key(c[d])], --mp[key(c[u])];
    for (int dir = 0; dir < 4; ++dir) {
      V<lint> keys(4);
      for (int i = 0; i < 4; ++i) keys[i] = key({c[u][dir - i & 3], c[u][dir - i - 1 & 3], c[d][i + 1 & 3], c[d][i]});
      sort(begin(keys), end(keys));
      int bit = 0;
      for (int i = 0; i < 3; ++i) if (keys[i] == keys[i + 1]) bit |= 1 << i;
      auto f = [&](const V<>& v) -> lint {
        lint res = 1;
        for (int i = 0; i < 4; ++i) {
          if (mp.count(keys[i])) res *= coeff(keys[i]) * (mp[keys[i]] - v[i]);
          else return 0;
        }
        return res;
      };
      switch (bit) {
        case 0b000: res += f({0, 0, 0, 0}); break;
        case 0b001: res += f({0, 1, 0, 0}); break;
        case 0b010: res += f({0, 0, 1, 0}); break;
        case 0b011: res += f({0, 1, 2, 0}); break;
        case 0b100: res += f({0, 0, 0, 1}); break;
        case 0b101: res += f({0, 1, 0, 1}); break;
        case 0b110: res += f({0, 0, 1, 2}); break;
        case 0b111: res += f({0, 1, 2, 3}); break;
      }
    }
    ++mp[key(c[d])], ++mp[key(c[u])];
  }
  cout << res / 3 << '\n';
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main (){
    int a,b;
    cin>>a>>b;
    if(a==1 and b==2){
        cout<<3<<"\n";
    }
    if(a==2 and b==3){
        cout<<1<<"\n";
    }
    if(a==1 and b==3){
        cout<<2<<"\n";
    }
    if(a==2 and b==1){
        cout<<3<<"\n";
    }
    if(a==3 and b==2){
        cout<<1<<"\n";
    }
    if(a==3 and b==1){
        cout<<2<<"\n";
    }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int n;
    int w[100001]={};
    int s[100000]={};
    
    scanf("%d",&n);
    int k;
    for(int i=0;i<n;i++){
        scanf("%d",&k);
        w[k]++;
    }
    int max=0;
    for(int i=0;i<100000;i++){
        s[i]=w[i-1]+w[i]+w[i+1];
        if(s[i]>s[max]){
            max=i;
        }
    }
    printf("%d\n",s[max]);
    
    
}


Measured memory_bytes: 2476
// 2013/05/12 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int b1, b2, b3;
	cin >> b1 >> b2 >> b3;

	if((b1==1 && b2==1) || b3==1){
		cout << "Open" << endl;
	}
	else{
		cout << "Close" << endl;
	}

	return 0;
}

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

vector<int64_t> divisor(int64_t n) {
    vector<int64_t> ret;
    for(int64_t i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

int main() {
    int64_t n, ans;
    cin >> n;
    auto div = divisor(n);
    int64_t m = div.size();
    if(m % 2 > 0)
        ans = 2 * (div[m / 2] - 1);
    else
        ans = (div[m / 2 - 1] - 1) + (div[m / 2] - 1);
    cout << ans << endl;
}


Measured memory_bytes: 384
import java.util.*;
import static java.lang.System.*;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  int N = sc.nextInt();
	  List<Double> v = new ArrayList<>();
	  for(int i=0; i<N; i++) {
		  double d = sc.nextDouble();
		  v.add(d);
	  }
	  while(v.size()> 1) {
		  Collections.sort(v);
		  double d1 = v.get(0);
		  double d2 = v.get(1);
		  v.remove(0);
		  v.remove(0);
		  double d3 = (d1 + d2) / 2;
		  v.add(d3);
	  }
	  out.println(v.get(0));
  }
}

Measured memory_bytes: 23252
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
ll f[110][110];
ll dx[] = { 1,1,0,-1,-1,-1,0,1 }, dy[] = { 0,1,1,1,0,-1,-1,-1 };
int main() {
	ll a, b;
	cin >> a >> b;
	char c[110][110];
	if (a > b) {
		for (int i = 0; i < 100; i++) {
			for (int j = 0; j<100; j++) {
				c[i][j] = '.';
			}
		}
		ll num = a - b;
		ll x, y;
		for (int i = 0; i < num; i++) {
			x = (i % 50) * 2 + 1;
			y = (i / 50) * 2 + 1;
			f[y][x] = 1;
		}
		if (num > 1) {
			b--;
			x = 1;
			y = y + 4;
			for (int i = 0; i < b; i++) {
				f[y][x] = 1;
				x += 4;
				if (x == 101) {
					x = 1;
					y += 4;
				}
			}
			for (int i = 0; i < 100; i++) {
				for (int j = 0; j<100; j++) {
					if (f[i][j]) {
						for (int k = 0; k < 8; k++) {
							c[i + dy[k]][j + dx[k]] = '#';
						}
					}
				}
			}
		}
		else {
			b--;
			x = 1;
			y = y + 4;
			for (int i = 0; i < b; i++) {
				f[y][x] = 2;
				x += 4;
				if (x == 101) {
					x = 1;
					y += 4;
				}
			}
			for (int i = 0; i < 100; i++) {
				for (int j = 0; j<100; j++) {
					if (f[i][j]) {
						for (int k = 0; k < 8; k++) {
							c[i + dy[k]][j + dx[k]] = '#';
						}
					}
					//if (f[i][j] == 2)c[i][j] = '#';
				}
			}
		}
	}
	else if (a < b) {
		for (int i = 0; i < 100; i++) {
			for (int j = 0; j<100; j++) {
				c[i][j] = '#';
			}
		}
		ll num = b - a;
		ll x, y;
		for (int i = 0; i < num; i++) {
			x = (i % 50) * 2 + 1;
			y = (i / 50) * 2 + 1;
			f[y][x] = 1;
		}
		if (num > 1) {
			a--;
			x = 1;
			y = y + 4;
			for (int i = 0; i < a; i++) {
				f[y][x] = 1;
				x += 4;
				if (x == 101) {
					x = 1;
					y += 4;
				}
			}
			for (int i = 0; i < 100; i++) {
				for (int j = 0; j<100; j++) {
					if (f[i][j]) {
						for (int k = 0; k < 8; k++) {
							c[i + dy[k]][j + dx[k]] = '.';
						}
					}
				}
			}
		}
		else {
			a--;
			x = 1;
			y = y + 4;
			for (int i = 0; i < a; i++) {
				f[y][x] = 2;
				x += 4;
				if (x == 101) {
					x = 1;
					y += 4;
				}
			}
			for (int i = 0; i < 100; i++) {
				for (int j = 0; j<100; j++) {
					if (f[i][j]) {
						for (int k = 0; k < 8; k++) {
							c[i + dy[k]][j + dx[k]] = '.';
						}
					}
					//if (f[i][j] == 2)c[i][j] = '.';
				}
			}
		}
		
	}
	else {
		for (int i = 0; i < 100; i++) {
			for (int j = 0; j<100; j++) {
				c[i][j] = '.';
			}
		}
		ll x, y;
		x = 1;
		y = 1;
		for (int i = 1; i < b; i++) {
			f[y][x] = 1;
			x += 4;
			if (x == 101) {
				x = 1;
				y += 4;
			}
		}
		for (int i = 0; i < 100; i++) {
			for (int j = 0; j<100; j++) {
				if (f[i][j]) {
					for (int k = 0; k < 8; k++) {
						c[i + dy[k]][j + dx[k]] = '#';
					}
				}
			}
		}
		c[99][99] = '#';
	}
	cout << 100 << ' ' << 100 << endl;
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j<100; j++) {
			cout << c[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>

int main()
{
  constexpr int N = 5;

  std::vector<int> p(N);
  for(int i=0; i<N; i++) {
    std::cin >> p[i];
  }
  int k;
  std::cin >> k;

  int n_non_direct = 0;
  for(int i=0; i<N; i++) {
    for(int j=i+1; j<N; j++) {
      if(k < p[j] - p[i]) {
        n_non_direct++;
      }
    }
  }

  std::cout << (n_non_direct == 0 ? "Yay!" : ":(") << std::endl;
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int imos[111111];
int main(){
    int n;
    while(cin >> n){
        memset(imos,0,sizeof(imos));
        for(int i=0;i<n;i++){
            int a,b;
            cin>>a>>b;
            imos[a-1]++;
            imos[b]--;
        }
        for(int i=1;i<111111;i++){
            imos[i]+=imos[i-1];
        }
        int ans=0;
        for(int i=0;i<111111;i++){
            if(imos[i]>=i)ans=max(ans,i);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1600
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

using namespace std;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

using ll = long long;
constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u * v / gcd(u, v);
}

struct City {
    int cityNum;
    int prefNum;
    int year;
    string ID = "";
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

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


    vector<int> s('z' - 'a' + 1), t('z' - 'a' + 1);
    REP(i, S.length()) {
        s[S[i] - 'a']++;
        t[T[i] - 'a']++;
    }

    RSORT(s);
    RSORT(t);

    bool flag = true;
    REP(i, 26) {
        if (s[i] != t[i]) {
            flag = false;
            break;
        }
    }

    YESNO(flag, "Yes", "No");
    return 0;

}

Measured memory_bytes: 916
N = int(input())

# 各桁の和
def digitSum(n):
    s = str(n)
    array = list(map(int, list(s)))
    return sum(array)

min_sum = 1000000
for i in range(N - 1):
    A = i + 1
    B = N - A
    tmp = digitSum(A) + digitSum(B)
    if tmp < min_sum:
        min_sum = tmp

ans = min_sum
print(ans)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int N;
  int a[SIZE];

  scanf("%d", &N);

  for (int i=0; i<N; i++) {
    scanf("%d", a+i);
  }

  int ans = -1;

  for (int i=0; i<N; i++) {
    for (int j=i+1; j<N; j++) {
      int res = a[i] * a[j];
      string s = to_string(res);
      bool ok = true;
      for (int i=0; i+1<s.size(); i++)
        ok &= s[i]+1 == s[i+1];

      if (ok) ans = max(ans, res);
    }
  }

  printf("%d\n", ans);

  return 0;
}



Measured memory_bytes: 3328
#ABC145C_AverageLength.rb
n = gets.to_i
xy = []
(1..n).each do |nn|
  xy << gets.split.map(&:to_i)
end

ar = xy.permutation(n).to_a
ar_size = ar.size

sum = 0
ar.each do |a|
  i = 0
  while i < n-1
    x = a[i][0].to_f - a[i+1][0].to_f
    y = a[i][1].to_f - a[i+1][1].to_f
    d = Math.sqrt(x**2 + y**2)
    i += 1
    sum += d
  end
end
puts sum / ar_size



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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

int n;

int main()
{
	n=ty();
	lint ans=0,now=0;
	for(int i=1;i<=n;i++)
	{
		lint temp=ty();
		if(temp==0)ans+=now/2,now=0;
		else now+=temp;
	}
	ans+=now/2;
	printf("%lld\n",ans);

	return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    ll ans = 0;
    rep(i, N+1) {
        if (i % 3 == 0 || i % 5 == 0) continue;
        ans += i;
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         998244353
#define pqueue      priority_queue<pii>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
 
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}  

void solve(){
    // int h1,m1,h2,m2,k;
    // cin >> h1 >> m1 >> h2 >> m2 >> k;
    // int tot;
    // if(h2 > h1)tot = m2+(h2-h1)*60+m1;
    // else tot = m2-m1;
    // cout << max(0LL,tot-k) << "\n";
    string s;
    cin >> s;
    FOR(i,0,sz(s)){
        if(s[i] == '?')s[i] = 'D';
    }
    cout << s << "\n";
}       

 
signed main()   
{
    showoff;
    int T = 1;
    //cin >> T;
    FOR(t,1,T+1){
        solve();
        cout << "\n";
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, col[N], deg[N], st[N], not_need[N];
char S[N];
vector<int> G[N];
int mx;
int dfs(int u, int lst) {
	int mx1 = 0, mx2 = 0;
	for (int v : G[u]) if (v != lst && !not_need[v]) {
		int cur = dfs(v, u);
		if (mx1 < cur) {
			mx2 = mx1;
			mx1 = cur;
		} else if (mx2 < cur) {
			mx2 = cur;
		}
	}
	mx = max(mx, mx1 + mx2 + st[u]);
	return mx1 + st[u];
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
		deg[u]++, deg[v]++;
	}
	scanf(" %s", S + 1);
	for (int i = 1; i <= n; i++) {
		col[i] = (S[i] == 'B');
	}
	queue<int> que;
	for (int i = 1; i <= n; i++) {
		if (deg[i] <= 1 && col[i]) {
			que.push(i);
			not_need[i] = 1;
		}
	}
	while (!que.empty()) {
		int u = que.front(); que.pop();
		for (int v : G[u]) if (!not_need[v]) {
			deg[v]--;
			if (col[v] && deg[v] <= 1) {
				que.push(v);
				not_need[v] = 1;
			}
		}
	}
	int rt = 0, cn = 0, ans = 0;
	for (int i = 1; i <= n; i++) if (!not_need[i]) rt = i, cn++, ans += (st[i] = (col[i] ^ 1 ^ (deg[i] & 1)));
	ans += (cn - 1) * 2;
	if (cn <= 1) { printf("%d\n", cn); return 0; }
	dfs(rt, 0);
	ans -= 2 * mx;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 14336
def main():
    n = int(input())
    array = [int(x) for x in input().split()]
    count = 0
    count_max = 0
    for i in range(n-1):
        if array[i] >= array[i+1]:
            count += 1
            if count > count_max:
                count_max = count
            continue
        count = 0
    print(count_max)


if __name__ == '__main__':
    main()


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

int main() {
    int N;
    cin >> N;
    int C[N], Sum[200001]={}, DP[N];
    for(int i=0; i<N; i++){
        cin >> C[i];
    }

    DP[0] = 1;
    Sum[C[0]] = 1;
    for(int i=1; i<N; i++){
        if(C[i] == C[i-1]){
            DP[i] = DP[i-1];
        }else{
            DP[i] = Sum[C[i]] + DP[i - 1];
            DP[i] %= mod;
            Sum[C[i]] = DP[i];
        }
    }

    cout << DP[N-1];
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

int main(void)
{
    int N, R;

    scanf("%d %d", &N, &R);

    if (N >= 10)
    {
        printf("%d", R);
    }
    else
    {
        R = R + 100 * (10 - N);
        printf("%d", R);
    }
    return (0);
}

Measured memory_bytes: 128
#include<iostream>
#include <string.h>
#include <algorithm>
#include <string>
#include <math.h>
typedef long long ll;
using namespace std;

double gcd( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
    double p=0;
	// ユークリッドの方法
	while( m > n )
	{
        m = m/2;
        p+=1;
	}
	return p;
}//gcd

int main()
{
    ll n,m,max=100000,min = 0,ans;
    cin >> n >> m ;

    for(int i = 0; i < m; i++)
    {
        int p = 0,q = 0;
        cin >> p >> q;
        if(min <= p)
        {
            min = p;
        }
        if(q <= max)
        {
            max = q;
        }

    }
    ans = max-min+1;
    if(ans <= 0)
    {
        ans = 0;
        cout << ans;
    }else{
        cout << ans;
    }
   


    return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    int k;
    cin >> k;
    int now = 0;
    for (int i = 1; i <= 10000000; i++) {
        now *= 10, now += 7, now %= k;
        if (now == 0) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

using namespace std;


int main() {
    map<int, int> a, b;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int d;
        cin >> d;
        a[d]++;
    }
    int m;
    cin >> m;
    for(int i = 0; i < m; i++) {
        int t;
        cin >> t;
        b[t]++;
    }
    for(auto c : b) {
        int x = c.first, y = c.second;
        if(a[x] < y) {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}

Measured memory_bytes: 22236
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
const int maxn = 1e5 + 5;
int a[maxn];

int main(){
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
		#if __cplusplus >= 201103L
		auto start = steady_clock::now();
		#endif
	#endif
	int n = read();
	rep(i, 1, n) {
		a[i] = read();
	}
	int cnt = 0;
	for (int i = 2; i < n; ++i) {
		if ((a[i] > a[i + 1] && a[i] < a[i - 1]) ||
			(a[i] > a[i - 1] && a[i] < a[i + 1])) {
				++cnt;
			}
	}
	cout << cnt << endl;
	#ifdef LOCAL
		#if __cplusplus >= 201103L
		auto end = steady_clock::now();
		duration<double> time_span = duration_cast<duration<double>>(end - start);;
		printf("Total time: %.6fs\n", time_span.count());
		#endif
	#endif
	return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
import math

n, m = map(int, input().split())
item_price_list = list(map(int, input().split()))

item_price_list = list(map(lambda x: x*(-1), item_price_list))
heapify(item_price_list)
for i in range(m):
    a = heappop(item_price_list)
    heappush(item_price_list, math.ceil(a/2))
    
print((-1)*sum(item_price_list))

Measured memory_bytes: 14532
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1},N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,ans;
int main(){
	cin>>n;
	while(n>0)
	{
		int r=n%10;
		n/=10;
		if(r==2)
			ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
from sys import stdin, stdout
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()

def main():
	last = rll()[0]
	if last == "ABC":
		stdout.write("ARC");stdout.write("\n")
	else:
		stdout.write("ABC");stdout.write("\n")
	stdout.close()

if __name__ == "__main__":
	main()

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

int main(){
    int A,B,C,D,E,F;
    vector<int> water(F+1,-1);
    vector<int> sugar(F+1,-1);
    int W,S;
    S = 0;
    cin >> A >> B >> C >> D >> E >> F;
    for(int i = 0;i*A*100 <= F;i++){
        for(int j = 0;;j++){
            if(i*A*100 + j*B*100 > F)break;
            water[i*A*100+j*B*100] = 0;
            W = i*A*100+j*B*100;
        }
    }
    for(int i = 0;i*C*100 <= F*E;i++){
        for(int j = 0;;j++){
            if(i*C*100 + j*D*100 > F*E)break;
            sugar[i*C + j*D] = 0;
        }
    }
    double ans = 0.0;
    for(int i = 1;i < F+1;i++){
        if(water[i] == -1)continue;
        for(int j = 0;j <= F-i;j++){
            if(sugar[j] == 0){
                double res = 100.0*j/(i+j);
                if(100*j <= E*i && res > ans){
                    W = i+j;
                    S = j;
                    ans = res;
                }
            }
        }
    }
    cout << W  << " " << S << endl;
    //cin >> A;
}

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

int main() {
	int n;
	int a[101];
	int b[101];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	int max = 0;
	for (int i = 0; i < n; i++) {
		int cnt = 0;
		for (int j = 0; j <= i; j++) {
			cnt += a[j];
		}for (int j = i; j < n; j++) {
			cnt += b[j];
		}
		if (cnt > max) { max = cnt; }
	}
	cout << max << endl;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    import numpy as np
    n, m, c = map(int, readline().split())
    ba = list(map(int, read().split()))
    a = np.array(ba[m:]).reshape((n,m))
    b = np.array(ba[:m])

    print(sum(np.dot(a,b)+c>0))

if __name__ == "__main__":
    main()


Measured memory_bytes: 12448
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 1000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long  ll;
typedef pair<int,int> P;
struct edge{int to,cost;};

//�ő����

int ans[211111];
int n,m;
vector<int> G[211111];
int v[211111];
void dfs(int i,int sum){
	ans[i]=sum;
	for(auto x:G[i]){
		dfs(x,sum+v[x]);
	}
}

signed main(){
	cin>>n>>m;
	int a,b;
	rep(i,n-1){
		cin>>a>>b;
		G[a-1].push_back(b-1);
	}
	rep(i,m){
		cin>>a>>b;
		if(v[a-1]!=0)v[a-1]+=b;
		else v[a-1]=b;
	}
	dfs(0,v[0]);
	rep(i,n)cout<<ans[i]<<" ";
}

Measured memory_bytes: 22784
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	cin >> H >> W;
	vector<string>s(H);
	vector<vector<char>>r(H,vector<char>(W,'.'));
	vector<vector<char>>b(H,vector<char>(W,'.'));
	for (int i = 0; i < H; i++) {
		cin >> s[i];
	}

	for (int i = 0; i < W; i++) {
		r[0][i] = '#';
		b[H - 1][i] = '#';
	}
	for (int i = 1; i < H - 1; i++) {
		for (int j = 0; j < W; j++) {
			if (j % 2) {
				r[i][j] = '#';
			}
			else {
				b[i][j] = '#';
			}
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (s[i][j] == '#') {
				r[i][j] = s[i][j];
				b[i][j] = s[i][j];
			}
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << r[i][j];
		}
		cout << endl;
	}
	cout << endl;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << b[i][j];
		}
		cout << endl;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>

#define CP 4
#define DP 7

int main()
{
    int n,cake=0,donut=0;
    scanf("%d", &n);
    while(donut*DP<n){
        donut++;
    }
    while(donut>=0){
        if(donut*DP+cake*CP == n){
            printf("Yes\n");
            return 0;
        }
        donut--;
        while(donut*DP+cake*CP<n){
            cake++;
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
int main(int argc, char const *argv[])
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b) printf("%d\n", c);
	else if (a == c) printf("%d\n", b);
	else printf("%d\n", a);
	return 0;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var (
    a,b,c,d int
  )

  fmt.Scan(&a)
  fmt.Scan(&b)
  fmt.Scan(&c)
  fmt.Scan(&d)

  fmt.Println(task(a,b,c,d))

}

func task(a,b,c,d int) string {
  for {
    c -= b
    if c<=0 {
      return "Yes"
    }
    a -= d
    if a<=0 {
      return "No"
    }
  }
}


Measured memory_bytes: 1752
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);

		int intCount = scanner.nextInt();

		int intTaro = 0;
		int intHanako = 0;
		for (int intI = 0; intI < intCount; intI++) {
			// 文字列入力
			String strTaroCard = scanner.next();
			String strHanakoCard = scanner.next();

			// intCount分forループ処理、文字列比較
			if (strTaroCard.compareTo(strHanakoCard) < 0) {
				intHanako += 3;
			} else if (strTaroCard.compareTo(strHanakoCard) > 0) {
				intTaro += 3;
			} else if (strTaroCard.compareTo(strHanakoCard) == 0) {
				intTaro += 1;
				intHanako += 1;
			}
		}
		System.out.println(intTaro + " " + intHanako);
	}

}



Measured memory_bytes: 29400
from collections import defaultdict

import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline

parent_node = []

def get_parent(ind):
    global parent_node
    if ind != parent_node[ind]:
        parent_node[ind] = get_parent(parent_node[ind])
    return parent_node[ind]



def main():
    num = int(input())

    data = defaultdict(tuple)

    for i in range(num):
        x, y = map(int, input().split())
        data[i] = (x, y)

    data_sort = sorted(data.items(), key=lambda x: x[1][0])
    data_x = [ele for ele, ele2 in data_sort]
    data_sort = sorted(data.items(), key=lambda x: x[1][1])
    data_y = [ele for ele, ele2 in data_sort]

    cost_data = [0 for i in range((num - 1) * 2)]
    for i in range(len(data_x) - 1):
        a, b = data_x[i], data_x[i + 1]
        cost = abs(data[a][0] - data[b][0])
        cost_data[i] = a, b, cost
    for i in range(len(data_y) - 1):
        a, b = data_y[i], data_y[i + 1]
        cost = abs(data[a][1] - data[b][1])
        cost_data[i + len(data_x) - 1] = a, b, cost

    cost_data.sort(key=lambda x: x[2])
    global parent_node
    parent_node = [i for i in range(num)]

    ans = 0
    for i in range(len(cost_data)):
        a, b, cost = cost_data[i]
        a_parent = get_parent(a)
        b_parent = get_parent(b)
        if a_parent != b_parent:
            ans += cost
            parent_node[min(a_parent, b_parent)] = max(a_parent, b_parent)

    print(ans)





if __name__ == '__main__':
    main()


Measured memory_bytes: 178492
#include<cstdio>
#include<iostream>
#include<math.h>
#define N 100000

using namespace std;

int Binarysearch(int A[], int left, int right, int k)
{
	int mid = (left + right) / 2;
	if (A[mid] == k)
		return 1;
	while (left < right)
	{
		int mid = (left + right) / 2;
		if (A[mid] == k)
			return 1;
		else if (A[mid] < k)
		{
			left = mid + 1;
		}
		else
		{
			right = mid;
		}
	}
	return 0;
}

int main()
{
	int n1, n2;
	int A[N], B[N];
	int total = 0;
	cin >> n1;
	for (int i = 0; i < n1; i++)
	{
		cin >> A[i];
	}
	cin >> n2;
	for (int i = 0; i < n2; i++)
	{
		int s;
		cin >> s;
		if (Binarysearch(A, 0, n1, s))
			total++;
	}
	cout << total << endl;
	return 0;
}


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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        int[] arr = Arrays.stream(br.readLine().split("\\s+")).mapToInt(Integer::valueOf).toArray();
        int[] p   = Arrays.stream(br.readLine().split("\\s+")).mapToInt(Integer::valueOf).toArray();

        long[] dp =new long[n+1];
        int base = 1;
        while(base <= n) {
            base *= 2;
        }
        long[] tree = new long[2*base];
        for (int i = 0; i < n; i++) {
            int index = arr[i]+base;
            long max =0;
            while(index>1){
                if(index%2==1)
                    max = Math.max(max,tree[index-1]);
                index /=2;
            }
            dp[arr[i]] = max + p[i];
            int x = arr[i]+base;
            tree[x]=dp[arr[i]];
            while(x>0){
                x /=2;
                tree[x]  = Math.max(tree[2*x],tree[2*x +1]);
            }
        }
        long ans =0;
        for(long m : dp)
            ans = Math.max(m,ans);

        System.out.println(ans);
    }
}


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

int main()
{
	long long a, b, c;
	cin >> a >> b >> c;

	string ans = "No";
	long long d = c - a - b;
	if( d > 0 && 4 * a * b < d * d ) ans = "Yes";

	cout << ans << endl;
}


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

using ll = long long;

void print(){ std::cout << std::endl; }
template< typename H > void print(H head){std::cout << head << std::endl;}
template< typename H, typename... T > void print(H head, T... tail) {std::cout << head << " ", print(tail...); }

int main()
{
  ll H, A;
  std::cin >> H >> A;

  ll ans = (H + A - 1) / A;

  print(ans);
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

Max = 0
for i in range(n+1):
    x = s[:i]
    y = s[i:]
    count = []
    ans = 0
    for i in alpha:
        if i in x and i in y and not i in count:
           ans += 1
           count.append(i)
    Max = max(Max,ans)
print(Max)

Measured memory_bytes: 3064
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=[]
    for i in range(1,int((n**0.5))+1):
        if n%i==0:
            a,b=i,n//i
            if a<=b:
                l.append(a+b-2)
            else:
                break
    print(min(l))
resolve()

Measured memory_bytes: 3060
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	s = parseMap(split(chomp(readline()),""))
	n = length(s)
	dp = zeros(Int,n)
	dp[n]=s[n]
	dx = zeros(Int,n)
	dx[1]=10
	for i in 2:n
		dx[i]=(dx[i-1]*10)%2019
	end
	for i in n-1:-1:1
		dp[i]=(dp[i+1]+(s[i]*dx[n-i])%2019)%2019
	end
	d = Dict{Int,Int}()
	d[0]=1
	for i in 1:n
		if haskey(d,dp[i])
			d[dp[i]]+=1
		else
			d[dp[i]]=1
		end
	end
	ct = 0
	for i in keys(d)
		ct+=(d[i]*(d[i]-1))>>1
	end
	println(ct)
end

main()

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

int main(){
	int a, b, d, r;
	double f;

	cin >> a >> b;
	d = a / b;
	r = a % b;
	f = (double)a / (double)b;
	printf("%d %d %f", d, r, f);

	return 0;
}

Measured memory_bytes: 3180
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    a, b, c = map(int, input().split())
    print('bust' if sum([a,b,c]) >= 22 else 'win')

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 998244353
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,m,k = map(int,input().split())
class InverseTable:
    __slots__ = ['In', 'fac', 'Ifac']

    def __init__(self, mod, maxnum):
        self.In = [0, 1]; self.fac = [1, 1]; self.Ifac = [1, 1]
        for i in range( 2, maxnum + 1 ):
            self.In.append( ( -self.In[mod % i] * (mod//i) ) % mod )
            self.fac.append( ( self.fac[-1] * i ) % mod )
            self.Ifac.append( (self.Ifac[-1] * self.In[-1]) % mod )
        
    def cmb(self, n, r):
        if ( r<0 or r>n ): return 0
        r = min(r, n-r)
        return self.fac[n] * self.Ifac[r] * self.Ifac[n-r] % mod
    
    def per(self, n, r):
        if ( r<0 or r>n ): return 0
        return self.fac[n] * self.Ifac[n-r] % mod

invt = InverseTable(mod, 10**6)
# maxnum=10**6だとテーブル生成に200ms程かかるので（Pythonだと1000msほど）
# 最大生成領域は問題ごとに要検討
A = pow(m,n,mod) 
count = 0
for i in range(n-k-1,0,-1):
  count += invt.cmb(n-1,i-1) * m * pow(m-1,i-1,mod)
  count %= mod
# print(count)
print((A-count) % mod)




# B = pow(m,n,mod) * invt.fac[n-k] % mod
# C = pow(m,n-k,mod)
# print((A-C)%mod)
# print(pow(m,n,mod) * invt.fac[n-k] % mod)

Measured memory_bytes: 168184
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll N, D;
    cin >> N >> D;
    ll ans = 0;
    vector<vector<ll>> p(N, vector<ll>(D));
    rep(i, N) rep(j, D) cin >> p[i][j];
    rep(i, N)
    {
        for (ll j = i + 1; j < N; ++j)
        {
            ll dis = 0;
            rep(k, D) dis += (p[i][k] - p[j][k]) * (p[i][k] - p[j][k]);
            for (ll k = 1; k * k <= dis; ++k)
            {
                if (dis % (k * k) == 0 && dis / (k * k) == 1)
                    ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	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: 580
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ll n;
  int dig_min = (1U << 15) - 1;
  cin >> n;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ll mx = max(i, n / i);
      int dig = (int)to_string(mx).size();
      dig_min = min(dig_min, dig);
    }
  }

  cout << dig_min << endl;
  return 0;
}


Measured memory_bytes: 3764
#include <iostream>
#include <climits>
using namespace std;
typedef long long int ll;
ll dp[110][100010];
ll w[110];
ll v[110];

int main(){
    ll n,k;
    scanf("%lld %lld",&n,&k);

    for(ll i = 1; i <= n; i++){
        scanf("%lld %lld",w+i,v+i);
    }
    for(ll i = 1; i <= n; i++){
        for(ll j = 1; j <= k; j++){
            dp[i][j] = LLONG_MIN;
            dp[i][j] = dp[i-1][j];
            if(j >= w[i]){
                dp[i][j] = max(dp[i][j],dp[i-1][j-w[i]] + v[i]);
            }
        }
    }

    printf("%lld\n",dp[n][k]);


    //printf("%lld\n",dp[n]);
}


Measured memory_bytes: 79488
import java.util.*;

class Main{

    static int n;
    static int [][] t = new int[3][3];
    static int dy[] = {-1,0,1,0};
    static int dx[] = {0,1,0,-1};
    static int sx,sy,gx,gy,kx,ky;

    static int change(String ch){
	if(ch.equals("A"))return 0;
	if(ch.equals("B"))return 1;
	if(ch.equals("C"))return 2;
	if(ch.equals("D"))return 3;
	if(ch.equals("E"))return 4;
	if(ch.equals("F"))return 5;
	if(ch.equals("G"))return 6;
	if(ch.equals("H"))return 7;
	if(ch.equals("I"))return 8;
	else return -1;
    }

    static boolean inField(int y,int x){
	if(y<0||x<0)return false;
	if(y>2||x>2)return false;
	return true;
    }
    
    static double [][][] mem = new double[3][3][16];

    static double solve(int y,int x,int cnt){
	if(mem[y][x][cnt]!=200.0)return mem[y][x][cnt];
	if(cnt==n){
	    if(t[y][x]==1)return 1.0;
	    else return 0.0;
	}
	
	int ny,nx;
	double sum=0.0;
	for(int i=0;i<4;i++){
	    ny=y+dy[i];
	    nx=x+dx[i];
	    if(inField(ny,nx)==false||t[ny][nx]==-1){
		sum+=solve(y,x,cnt+1);
	    }else{
		sum+=solve(ny,nx,cnt+1);
	    }
	}
	sum=sum/4.0;
	mem[y][x][cnt]=sum;
	return sum;
    }

    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	String ch;
	while(true){
	    n=scan.nextInt();

	    if(n==0)break;
	    for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
		    for(int k=0;k<16;k++)mem[i][j][k]=200.0;
		    t[i][j]=0;
		}
	    }

	    ch=scan.next();
	    sy=change(ch)/3;
	    sx=change(ch)%3;

	    ch=scan.next();
	    gy=change(ch)/3;
	    gx=change(ch)%3;

	    ch=scan.next();
	    ky=change(ch)/3;
	    kx=change(ch)%3;

	    /*
	    System.out.println(sy+" "+sx);
	    System.out.println(gy+" "+gx);
	    System.out.println(ky+" "+kx);
	    */
	    t[gy][gx]=1;
	    t[ky][kx]=-1;
	    System.out.println(solve(sy,sx,0));

	}
    }
}

Measured memory_bytes: 21288
#include<iostream>

using namespace std;

int main(){
    long long int n;
    cin >> n;

    int arr[n + 1];

    for (int i = 0; i < n + 1;i++) {
        arr[i] = 1;
    }

    for (int i = 2; i <= n ;i++){
        int j = i;
        while(j <= n){
            arr[j] += 1;
            j += i;
        }
    }

    long long int ans = 0;
    for (long long int i = 1; i <= n;i++){
      ans += i * arr[i];
    }
    cout << ans << endl;
}

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

typedef long long ll;

const int N = 3e5 + 10;
int n, a[N], sa[N];
char s[N];

int main() {
    cin >> n >> s;
    for (int i = 0; i < n; ++i)
        if (s[i] == 'E') a[i + 1] = 1;
    partial_sum(a, a + n + 1, sa);
    int ans = 10000000;
    for (int i = 1; i <= n; ++i) {
        int r1 = i - 1 - sa[i - 1];
        int r2 = sa[n] - sa[i];
        ans = min(ans, r1 + r2);
    }
    cout << ans << endl;
}


Measured memory_bytes: 2944