akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define REP2(i, n) for (Int i = 0, max_i = (n); i < max_i; i++)
#define REP3(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++)
#define OVERLOAD2(_1, _2, _3, name, ...) name
#define REP(...) OVERLOAD2(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
template <class T> inline bool chmax(T& a, const T& b) {
    if (a >= b) return false;
    a = b;
    return true;
}
template <class T> inline bool chmin(T& a, const T& b) {
    if (a <= b) return false;
    a = b;
    return true;
}
struct in {
    int n;
    in() {}
    in(int n_) : n(n_){};
    template <class T> operator T() {
        T ret;
        cin >> ret;
        return ret;
    }
    template <class T> operator vector<T>() {
        vector<T> ret(n);
        for (int i = 0; i < n; i++) cin >> ret[i];
        return ret;
    }
};
struct SetupIO {
    SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }
} setup_io;

#ifdef _MY_DEBUG
#include "/Users/knshnb/.competitive_local.hpp"
#else
#define dump(...)
#endif

/**
 *    author:  knshnb
 *    created: Sun Dec 29 16:55:54 JST 2019
 **/

// clang-format off
vector<string> t3 = {
    "aa.",
    "..b",
    "..b",
};
vector<string> t4 = {
    "efaa",
    "efbb",
    "ccgh",
    "ddgh",
};
vector<string> t5 = {
    "aafbb",
    "ccf.g",
    "ddeeg",
    "..hij",
    "..hij",
};
vector<string> t7 = {
    "abb..kk",
    "a.c..ll",
    "ddc.j..",
    "....jmn",
    "..gg.mn",
    "ef.hh..",
    "ef.ii..",
};

// clang-format on
signed main() {
    Int n = in();
    if (n == 2) {
        cout << -1 << endl;
        return 0;
    }
    vector<string> ans(n, string(n, '.'));
    if (n % 3 == 0) {
        REP(x, n / 3) {
            Int offset = x * 3;
            REP(i, 3) REP(j, 3) ans[offset + i][offset + j] = t3[i][j];
        }
    } else if (n == 7 || n == 11) {
        REP(i, 7) REP(j, 7) ans[i][j] = t7[i][j];
        if (n == 11) {
            Int offset = 7;
            REP(i, 4) REP(j, 4) ans[offset + i][offset + j] = t4[i][j];
        }
    } else {
        Int X = -1, Y = -1;
        REP(x, n + 1) {
            Int rem = n - 4 * x;
            if (rem < 0 || rem % 5) continue;
            X = x, Y = rem / 5;
            break;
        }
        assert(X != -1);
        REP(x, X) {
            Int offset = x * 4;
            REP(i, 4) REP(j, 4) ans[offset + i][offset + j] = t4[i][j];
        }
        REP(y, Y) {
            Int offset = X * 4 + y * 5;
            REP(i, 5) REP(j, 5) ans[offset + i][offset + j] = t5[i][j];
        }
    }
    REP(i, n) cout << ans[i] << endl;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//code
	int n;
	cin>>n;
	unordered_set<string> s;
	while(n--)
	{
		string str;
		cin>>str;
		s.insert(str);
	}
	cout<<s.size();
 	return 0;
}



Measured memory_bytes: 17588
bingo = list(map(int, input().split()))
bingo.extend(list(map(int, input().split())))
bingo.extend(list(map(int, input().split())))

N = int(input())

res = "No"

for _ in range(N):
  num = int(input())

  for (index, value) in enumerate(bingo):
    if value == num:
      bingo[index] = 0


## 斜め判定
if bingo[0] == bingo[4] == bingo[8] == 0 or bingo[2] == bingo[4] == bingo[6] == 0:
  res = "Yes"

else:
  ## 縦判定
  for i in range(3):
    if (bingo[i] == bingo[i+3] == bingo[i+6] == 0 or bingo[3 * i] == bingo[3 * i + 1] == bingo[3 * i + 2] == 0):
      res = "Yes"
      break
  
print(res)

Measured memory_bytes: 3064
a,b,c,d = map(int,input().split())
if a<=c:
  if b-c>0:
    print(min(b-c,d-c))
  else:
    print(0)
else:
  if d-a>0:
    print(min(d-a,b-a))
  else:
    print(0)

Measured memory_bytes: 2940
#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int):
    s = N // (A + B)
    add = N - (A + B) * s
    if add < A:
        print(A * s + add)
    elif add >= A:
        print(A * s + A)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define PI       3.1415926535897932384626433832795028841971
#define INF      100000000
#define EPS      1e-10
#define MOD      1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string str;

int main(){
    cin >> str;
    int a = 0, b = 0;
    rep(i,str.size()){
        if(str[i] == 'C') a++;
        if(str[i] == 'F' && a > 0) b++;
    }
    if(a > 0 && b > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

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

using namespace std;
using lint=long long;

int main(){
	int x,y,a,b,c; scanf("%d%d%d%d%d",&x,&y,&a,&b,&c);
	vector<int> p(a),q(b),r(c);
	rep(i,a) scanf("%d",&p[i]);
	rep(i,b) scanf("%d",&q[i]);
	rep(i,c) scanf("%d",&r[i]);

	sort(p.rbegin(),p.rend());
	sort(q.rbegin(),q.rend());

	rep(i,x) r.emplace_back(p[i]);
	rep(i,y) r.emplace_back(q[i]);
	sort(r.rbegin(),r.rend());

	printf("%lld\n",accumulate(r.begin(),r.begin()+x+y,0LL));

	return 0;
}


Measured memory_bytes: 2552
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
typedef pair<int, int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;

int vx[4] = {1, -1, 0, 0};
int vy[4] = {0, 0, 1, -1};
char m[60][60];
int mc[60][60];
int main()
{
	int h, w;
	cin >> h >> w;
	int bcount = 0;
	rep(i, h)
	{
		rep(k, w)
		{
			char c;
			cin >> c;
			if (c == '#')
				bcount++;
			m[i + 1][k + 1] = c;
		}
	}
	queue<pii> q;
	q.push(make_pair(1, 1));
	int g = -1;
	while (!q.empty())
	{
		pii pos = q.front();
		q.pop();
		if (pos.first == w && pos.second == h)
		{
			g = mc[h][w] + 1;
			break;
		}
		rep(i, 4)
		{
			int x = pos.first + vx[i];
			int y = pos.second + vy[i];
			if (m[y][x] == '.')
			{
				m[y][x] = '#';
				mc[y][x] = mc[pos.second][pos.first] + 1;
				q.push(make_pair(x, y));
			}
		}
	}
	cout << (g < 0 ? -1 : (w * h - g - bcount)) << endl;
	return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    long long N, K;
    cin >> N >> K;

    vector<pair<long, long>> ab(N);
    for (int i = 0; i < N; i++) {
        long long a, b;
        cin >> a >> b;
        ab[i] = make_pair(a, b);
    }

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

    long long sum = 0;
    for (int i = 0; i < N; i++) {
        sum += ab[i].second;
        if (sum >= K) {
            cout << ab[i].first << endl;
            return 0;
        }
    }

    return 0;
}











































































Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
//#define int ll

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> a(2, vector<int>(n));
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  vector<int> flip(n), val(n);
  int ans = 1e9;
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int i = 0; i < n; i++) {
      val[i] = a[(mask >> i) & 1][i];
      flip[i] = ((mask >> i) & 1);
    }
    int sum = 0;
    for (int i = 1; i < n; i++) {
      int cpos = i;
      while (cpos > 0 && val[cpos] < val[cpos - 1]) {
        swap(val[cpos], val[cpos - 1]);
        swap(flip[cpos], flip[cpos - 1]);
        flip[cpos] ^= 1;
        flip[cpos - 1] ^= 1;
        cpos--;
        sum++;
      }
    }
    bool ok = true;
    int cval = val[0], cnt = flip[0];
    for (int i = 1; i < n; i++) {
      if (val[i] != cval) {
        cval = val[i];
        ok &= (cnt == 0);
        cnt = flip[i];
      }
      else {
        cnt ^= flip[i];
      }
    }
    ok &= (cnt == 0);
    if (ok) {
      vector<int> poses;
      for (int i = 0; i < n; i++) {
        if (flip[i]) {
          poses.pb(i);
        }
      }
      for (int i = 0; i + 1 < SZ(poses); i += 2) {
        ok &= (poses[i + 1] - poses[i]) % 2 == 1;
        sum += poses[i + 1] - poses[i];
      }
      if (ok) ans = min(ans, sum);  
    }
  }
  cout << (ans == 1e9  ? -1 : ans) << '\n';
} 

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

int main() {
  int H, N;
  cin >> H >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i)
    cin >> A[i];
  int d = 0;
  for (int i = 0; i < N; ++i)
    d += A[i];
  if (d >= H)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <cstdint>
#include <sys/time.h>

typedef std::int_fast32_t  s32;
typedef std::uint_fast32_t u32;
typedef std::int_fast64_t  s64;
typedef std::uint_fast64_t u64;

const unsigned long mod = 1000000007;
const double EPS = 0.00000001;
const int INF = (1 << 29);

typedef std::pair<int, int> pii;

template<typename T>
void print_array(T *A_, s32 size) {
  //printf("%d\n", size);
  if( size != 0 ) {
    for(int i = 0; i < size - 1; ++i) {
      printf("%d ", A_[i]);
    }
    printf("%d\n", A_[size - 1]);
  }
}

int solve(int m, int i, int j, int k, int l) {
  int total = i * 10 + j * 50 + k * 100 + l * 500; 
  if( total < m ) return -1;
  int diff = total - m;
  int res = 0;
  res += (diff / 10 % 10) % 5 + (diff / 10 % 10) / 5;
  res += (diff / 100 % 10) % 5 + (diff / 100) / 5;
  return res;
}
  

auto main() -> int {

  for(;;) {
    int n;
    std::cin >> n;
    if( n == 0 ) break;

    bool know[128][128];
    for(int i = 0; i < 128; ++i) for(int j = 0; j < 128; ++j) know[i][j] = false;

    for(int i = 1; i <= n; ++i) {
      int m;
      std::cin >> m;
      for(int j = 0; j < m; ++j) {
        int p;
        std::cin >> p;
        know[i][p] = true;
      }
    }

    bool check[128];
    for(int i = 0; i < 128; ++i) check[i] = false;
    int k;
    std::cin >> k;
    for(int i = 0; i < k; ++i) {
      int l;
      std::cin >> l;
      check[l] = true;
    }
    
    

    int res = 0;
    for(int i = 1; i <= n; ++i) {
      for(int j = 1; j <= n; ++j) {
        if( not know[i][j] and check[j] ) {
          goto label_1;
        }
      }
      if( res == 0 ) {
        res = i;
      }
      else {
        res = -1;
        goto label_2;
      }
        
    label_1:;
    }
  label_2:;
    if( res == 0 ) res = -1;
    std::cout << res << std::endl;    
  }
  
  return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N_MAX = 2e5+5;

ll N, K;
ll A[N_MAX], F[N_MAX];

int C(ll key) {
	ll sum = 0;
	ll tmp[N] = {0};
	for(int i=0;i<N;i++) {
		tmp[i] = key/F[i];
	}
	sort(tmp, tmp+N);
	for(int i=0;i<N;i++) {
		if(tmp[i] <= A[i]) sum += (A[i]-tmp[i]);
	}
	return K >= sum;
}

int main(){
	cin >> N >> K;
	for(int i=0;i<N;i++) cin >> A[i];
	for(int i=0;i<N;i++) cin >> F[i];
	sort(A,A+N);
	sort(F,F+N, greater<ll>());

	ll left = -1, right = A[N-1]*F[0]+1;
	while(right - left > 1) {
		// cout << left << " " << right << endl;
		ll mid = (left + right)/2;
		if(C(mid)) right = mid;
		else left = mid;
	}
	cout << right << endl;
}

Measured memory_bytes: 4992
h,w=map(int,input().split())
s=[['カス'for i in range(w+2)]]
for i in range(h):
    s.append(['カス']+list(input())+['カス'])
s.append(['カス'for i in range(w+2)])
p=0
pp=0
for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j]=='#':
            p+=1
            if s[i+1][j]=='#' or s[i-1][j]=='#' or s[i][j-1]=='#' or s[i][j+1]=='#':
                pp+=1
print('Yes' if p==pp else 'No')

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MOD (ll)1000000007

int main(void)
{
	ll a, b, c, d;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
	printf("%lld", max(max(a * c, a * d), max(b * c, b * d)));
	return 0;
}

Measured memory_bytes: 1728
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] input = scanner.nextLine().trim().split(" ");
        int n = Integer.parseInt(input[0]);
        int m = Integer.parseInt(input[1]);

        int[][] students = new int[n][2];
        for (int i = 0; i < n; i ++) {
            input = scanner.nextLine().trim().split(" ");
            students[i][0] = Integer.parseInt(input[0]);
            students[i][1] = Integer.parseInt(input[1]);
        }

        int[][] checkpoints = new int[m][2];
        for (int i = 0; i < m; i ++) {
            input = scanner.nextLine().trim().split(" ");
            checkpoints[i][0] = Integer.parseInt(input[0]);
            checkpoints[i][1] = Integer.parseInt(input[1]);
        }

        for (int[] s: students) {
            int iMin = -1;
            int dMin = Integer.MAX_VALUE;
            for (int i = 0; i < m; i ++) {
                int[] c = checkpoints[i];
                int dist = Math.abs(s[0] - c[0]) + Math.abs(s[1] - c[1]);
                if (dist < dMin) {
                    dMin = dist;
                    iMin = i;
                }
            }
            System.out.println(iMin + 1);
        }
    }
}


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

int how_many(int x) {
	int ans = 0;
	while (x % 2 == 0) {
		x /= 2;
		ans++;
	}
	return ans;
}

int main() {
	int n;
	cin >> n;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		int p;
		cin >> p;
		ans += how_many(p);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
NK=input().split()
N=int(NK[0])
K=int(NK[1])
Hlis=list(map(int,input().split()))
ans=0

if K>=N:
    print(0)
else:
    Hlis.sort()
    for i in range(N-K):
        ans+=Hlis[i]
    print(ans)


Measured memory_bytes: 26180
#include<cstring>
#include<cstdio>
#include<cmath>
#include<iostream>
#define N 110000
#define mmod 1000000007
#define LL long long
using namespace std;
int n,f[N],g[N],na[N],nb[N],ca[N],cb[N],ans;
LL s[N],a,b,inf;
int main()
{
	inf=1e9;inf*=inf;
	scanf("%d%lld%lld",&n,&a,&b);
	for(int i=1;i<=n;i++) scanf("%lld",&s[i]);
	s[++n]=inf;
	na[n]=nb[n]=n;
	int j=n;
	for(int i=n-1;i>=1;i--)
	{
		while(s[j-1]-s[i]>=a) j--;
		na[i]=j;
	}
	j=n;
	for(int i=n-1;i>=1;i--)
	{
		while(s[j-1]-s[i]>=b) j--;
		nb[i]=j;
	}
	ca[n]=cb[n]=n;
	for(int i=n-1;i>=1;i--)
	{
		if(s[i+1]-s[i]>=a) ca[i]=ca[i+1];
		else ca[i]=i;
		if(s[i+1]-s[i]>=b) cb[i]=cb[i+1];
		else cb[i]=i;
	}
	s[0]=-inf;f[0]=g[0]=1;f[1]=g[1]=-1;
	for(int i=0;i<n;i++)
	{
		int l=max(i+1,na[i]-1),r=cb[i+1];
		if(l<=r) g[l]=(g[l]+f[i])%mmod,g[r+1]=(g[r+1]-f[i])%mmod;
		
		l=max(i+1,nb[i]-1);r=ca[i+1];
		if(l<=r) f[l]=(f[l]+g[i])%mmod,f[r+1]=(f[r+1]-g[i])%mmod;
		f[i+1]=(f[i+1]+f[i])%mmod;g[i+1]=(g[i+1]+g[i])%mmod;
	}
	ans=(f[n-1]+g[n-1])%mmod;
	ans=(ans+mmod)%mmod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

struct Combi
{
	vector<int> fact;
	vector<int> ifact;
	vector<int> inv;
	vector<int> pow2;
	const int MOD = 998244353;
	int add(int a, int b)
	{
		a+=b;
		while(a>=MOD) a-=MOD;
		return a;
	}
	int mult(int a, int b)
	{
		return (a*1LL*b)%MOD;
	}
	int modpow(int a, int b)
	{
		int r=1;
		while(b)
		{
			if(b&1) r=mult(r,a);
			a=mult(a,a);
			b>>=1;
		}
		return r;
	}
	int choose(int a, int b)
	{
		if(a<b) return 0;
		if(b==0) return 1;
		if(a==b) return 1;
		return mult(fact[a],mult(ifact[b],ifact[a-b]));
	}
	int inverse(int a)
	{
		return modpow(a,MOD-2);
	}
	void init(int _n)
	{
		fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
		fact.resize(_n+1);
		ifact.resize(_n+1);
		inv.resize(_n+1);
		pow2.resize(_n+1);
		pow2[0]=1;
		ifact[0]=1;
		fact[0]=1;
		for(int i=1;i<=_n;i++)
		{
			pow2[i]=add(pow2[i-1],pow2[i-1]);
			fact[i]=mult(fact[i-1],i);
			//ifact[i]=mult(ifact[i-1],inv[i]);
		}
		ifact[_n] = inverse(fact[_n]);
		for(int i=_n-1;i>=1;i--)
		{
		    ifact[i] = mult(ifact[i + 1], i + 1);
		}
		for(int i=1;i<=_n;i++)
		{
		    inv[i] = mult(fact[i-1],ifact[i]);
		}
	}
};

Combi combi;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	combi.init(1011111);
	int n,m; cin>>n>>m;
	int ans=max(m,n);
	int ans2=0;
	for(int i=1;i<=min(n,m);i++)
	{
		ans2=combi.add(ans2,combi.mult(combi.choose(2*i,i), combi.choose(m+n-2*i,n-i)));
	}
	ans2=combi.mult(ans2,combi.inv[2]);
	ans2=combi.mult(ans2,combi.inverse(combi.choose(n+m,n)));
	ans=combi.add(ans,ans2);
	cout<<ans<<'\n';
}


Measured memory_bytes: 16128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector< int > l(n);
    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }
    int ans = 0;
    sort(l.begin(), l.end());
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int Min = abs(l[i] - l[j]);
            int Max = l[i] + l[j];
            int iter1, iter2;
            iter1 = lower_bound(l.begin(), l.end(), Max) - l.begin(); //l[i]+l[j]以上の要素のうち最小のもののイテレータ
            iter2 = upper_bound(l.begin(), l.end(), Min) - l.begin(); //abs(l[i]-l[j])よりも大きい
            ans += iter1 - max(iter2, j + 1);
            //            cout << l[i] << " " << l[j] << " " << iter1 << " " << iter2 << " " << ans << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

struct Node {
    ll sum, val;
};

struct IT {
private:
    vector<Node> t;
    int n;

    void propagate(int id, int l, int r) {
        ll &x = t[id].val;
        if (x != -1) {
            int m = (l+r)/2;
            t[2*id].val = t[2*id+1].val = x;
            t[2*id].sum = (m-l+1)*x;
            t[2*id+1].sum = (r-m)*x;
            x = -1;
        }
    }

    void update(int id, int l, int r, int i, int j, ll x) {
        if (l > j || r < i) return;
        if (i <= l && r <= j) {
            t[id].val = x;
            t[id].sum = (r-l+1)*x;
            return;
        }
        propagate(id, l, r);
        int m = (l+r)/2;
        update(2*id, l, m, i, j, x); update(2*id+1, m+1, r, i, j, x);
        t[id].sum = t[2*id].sum + t[2*id+1].sum;
    }

    long long query(int id, int l, int r, int i, int j) {
        if (l > j || r < i) return 0;
        if (i <= l && r <= j) return t[id].sum;
        propagate(id, l, r);
        int m = (l+r)/2;
        return query(2*id, l, m, i, j) + query(2*id+1, m+1, r, i, j);
    }

public:
    IT(int n): n(n) {t.assign(4*n+1, {0, -1});}

    void update(int i, int j, ll x) {update(1, 1, n, i, j, x);}

    long long query(int i, int j) {return query(1, 1, n, i, j);}
};

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

    IT t(n);

    for(int i = 0; i < q; ++i) {
        int a; ll b;
        scanf("%d%lld", &a, &b);

        int lo = 1, hi = a-1, res = a;
        while (lo <= hi) {
            int mid = (lo + hi)/2;
            ll tMid = t.query(mid, mid);
            ll x = (a-mid+1)*tMid - t.query(mid, a);

            if (x <= b) {
                res = mid;
                hi = mid-1;
            } else
                lo = mid+1;
        }

        ll tRes = t.query(res, res);
        b -= (a-res+1) * tRes - t.query(res, a);

        ll tA = tRes + b/(a-res+1);
        int extra = b%(a-res+1);
        int lastExtra = res + extra - 1;
        t.update(res, lastExtra, tA + 1);
        t.update(lastExtra + 1, a, tA);
    }

    for(int i = 1; i <= n; ++i)
        printf("%lld\n", t.query(i, i));

    return 0;
}


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

int main(void) {
  ll Q;
  cin >> Q;
  vector<ll> L(Q), R(Q);
  REP(i, 0, Q) cin >> L[i] >> R[i], R[i]++;

  vector<bool> isp(200000, true);
  isp[0] = isp[1] = false;
  REP(i, 0, 200000) if(isp[i]) for(ll j = i + i; j < 200000; j += i) isp[j] = false;

  vector<ll> s(200001);
  REP(i, 0, 200000) if(i % 2 == 1 && isp[i] && isp[(i + 1) / 2]) s[i + 1] = 1;
  REP(i, 0, 200000) s[i + 1] += s[i];

  REP(i, 0, Q) cout << s[R[i] + 1] - s[L[i]] << endl;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
int t[110], v[110];
int lm[202020];
int n, T;

int main(){
    LL x, y;
    cin >> x >> y;
    cout << (abs(x-y) <= 1 ? "Brown" : "Alice") << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<iostream>
using namespace std;
int main()
{
	string s,buf;
	cin >> s;
	int sum=0;
	int end=s.size()-1;
	int star=0; 
	int len=s.size();
	int flag=0;
	int uu=s.size();
//	printf("%d- %d",buf.size()-1,len/2);	
	int lenbuf=buf.size();
	while(lenbuf*2<len)
	{
//		printf("%d- %d",lenbuf,len);
		if(s[star]==s[end])
		{
			buf+=s[star];
			star++;
			end--;
		}
		else
		{
			if(s[end]=='x')
			 {
		 		buf+='x';
		 		len++;
			 	end--;
			 }
			 else
			 	if(s[star]=='x')
			 	{
			 		s+='x';
			 		buf+='x';
			 		star++;
			 		len++;
				}
				else
				{
					flag=1;
					break;
				}
		}
		lenbuf++;
//		cout << buf<<endl;
	}
	while(star<s.size())
		buf+=s[star++];
	if(flag==0)
		printf("%d\n",len-uu);
	else
		printf("-1\n");
	return 0;
}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

int main(){

    ll n; cin >> n;

    if(n%1000 == 0){
        cout << 0 << endl;
    }
    else{
        cout << 1000-n%1000 << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

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

    int sum = 0;

    /*for (int i = 0; i < 1000; i++) {
        std::stringstream ss;
        ss << setw(3) << setfill('0') << i;
        string v = ss.str();
        for(int j = 0; j < n; j++) {
            if(v[0] == s[j]) {
                for(int k = j + 1; k < n; k++) {
                    if(v[1] == s[k]){
                        for(int l = k + 1; l < n; l++) {
                            if(v[2] == s[l]) {
                                sum++;
                                goto END;
                            }
                        }
                    }
                }
            }
        }
        END: ;
    }*/

    for(int i = 0; i < 10; i++) {
        for(int l = 0; l < N; l++) {
            if(i == ctoi(s[l])) {
                for (int j = 0; j < 10; j++) {
                    for(int m = l + 1; m < N; m++) {
                        if (j ==  ctoi(s[m])) {
                            for(int k = 0; k < 10; k++) {
                                for(int n = m + 1;  n < N; n++) {
                                    if(k == ctoi(s[n])){
                                        sum++;
                                        break;
                                    }
                                }
                            }
                            break;
                        }
                    }
                }
                break;
            }
        }
    }

    cout << sum << endl;
} 

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

int main() {
  long long A, B;
  cin >> A >> B;
  int x;
  for (int i = A; i > 0; i--) {
    if (A % i == 0){
      if (B % i == 0){
        x = i;
        break;
      }
    }
  }
  cout << A * B / x << endl;
}


Measured memory_bytes: 256
while True:
	try:
		D = list(input())
		isPlayable = True
		for i in range(0, len(D), 2):
			if D[i] == 'L':
				isPlayable = False
				break
		if isPlayable:
			for i in range(1, len(D), 2):
				if D[i] == 'R':
					isPlayable = False
					break
		if isPlayable:
			print("Yes")
		else:
			print("No")
	except:
		break
		

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(min(b, d)-max(a, c), (ll)0) << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ull unsigned long long
#define mp make_pair
#define F first
#define S second
#define mod 1000000007

int n;

ll dp[3005][3005];

int main()
{
    scanf("%d", &n);
    vector<ll> v(n+5);

    for(int i=1; i<=n; i++) 
        scanf("%lld", &v[i]);
    
    dp[1][1] = v[1];

    for(int i=n; i>0; i--)
    {
        for(int j = i; j<n+1; j++)
        {
            dp[i][j] = max(v[i] - dp[i+1][j] ,v[j] - dp[i][j-1]);
        }
    }

    cout << dp[1][n] << endl; 

}


Measured memory_bytes: 70016
#include <bits/stdc++.h>
#define ull unsigned long long 
#define ul unsigned long
#define ll long long
#define pb push_back
#define sodayoda_C  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define f(i,a,b) for(int i = a;i<b;i++)
#define fb(i,a,b) for(int i = a;i>b;i--)
#define endl "\n"
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define mp make_pair
//memset(name,'',size)
//reverse(s,begin(),s.end())

using namespace std;

int main(){	
	sodayoda_C;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int t;
	//cin>>t;
	t = 1;
	while(t--){
		int n;
		cin>>n;
		int arr[n];
		f(i,0,n) cin>>arr[i];
		int maxx = arr[0];
		ll sum = 0;
		f(i,1,n){
			if(arr[i]<maxx){
				sum+=(maxx-arr[i]);
			}
			maxx = max(arr[i],maxx);
		}
		cout<<sum;
	}
	return 0;
}

Measured memory_bytes: 4396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  if (a<=x && x<=a+b) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

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

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define sz size()
#define mp make_pair
#define pii pair<int,int>


ll a[200010],n;

ll cost(int x)
{
	ll ret = 0;

	for(int i = 0;i < n;i++){
		ret += abs(a[i]-(x+i+1));
	}
	return ret;
}

int main()
{
	cin >> n;

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

		cin >> a[i];
	}

	/*for(int i = -13;i <= 10;i++){

		int loc = 0;

		for(int j = 0;j < n;j++){
			loc += abs( a[j] - (i+j+1) );
		}
		cout << i << ' ' << loc << endl;
	}*/

	ll lo = -1e9,hi = 1e9;

	while(hi-lo > 5){

		int m1 = (lo+hi)/2;
		int m2 = m1+1;

		if(cost(m1) < cost(m2)){

			hi = m1;
		}
		else lo = m2;
	}
	ll ans = (1LL << 60);
	for(int i = lo;i <= hi;i++){
		ans = min(ans,cost(i));
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
n=int(input())
a=[int(input()) for i in range(n)]

dict={}
for i in range(n):
    if not a[i] in dict or dict[a[i]]==0:
        dict[a[i]]=1
    else:
        dict[a[i]]=0

ans=0
for i in dict.values():
    ans+=i
print(ans)

Measured memory_bytes: 59736
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    int L;
    cin >> N >> L;
    int sum=0;

    if(L+N-1 <0){
        for (int i=0; i<N-1; i++){
            sum += L+i;
        }
    }
    else if( L>0){
        for (int i=0; i<N-1; i++){
            sum += L+1+i;
        }
    }
    else {
        for (int i=0; i<N; i++){
            sum += L+i;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for( int i=a; i<b; i++)
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<pii>vpi;

void LCS(string &S1,string &S2,int n,int m){
    vvi dp(n+1,vi(m+1));
    for(int i=0;i<=n;i++){
        dp[i][0] = 0;
    }
    for(int i=0;i<=m;i++){
        dp[0][i] = 0;
    }
    int cnt = 0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(S1[i-1]==S2[j-1]){
                dp[i][j] = 1+dp[i-1][j-1];
            }
            else{
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    vector<char> seq(dp[n][m]+1);
    int i=n,j = m;
    while(i>0 && j>0){
        if(S1[i-1]==S2[j-1]){
            seq[cnt++] = S1[i-1];
            i--;j--;
        }
        else{
            if(dp[i-1][j]>dp[i][j-1]){
                i--;
            }
            else{
                j--;
            }
        }
    }
    for(int i=cnt-1;i>=0;i--){
        cout<<seq[i];
    }
    cout<<"\n";
    // return dp[n][m];
}   
void solve(){
    string S1,S2;
    cin>>S1>>S2;
    int n = S1.size();
    int m = S2.size();
    LCS(S1,S2,n,m);
}

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

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

int main() {
  long long a, b, c, t;
  cin >> a >> b >> c;
  t = c - a - b;
  //   cout << t << endl;
  if (t < 0) {
    cout << "No" << endl;
  } else if (4 * a * b < t * t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  itn int
using ll=int64_t;
#define rep(i,n) for (int i = 0; i < (int) (n); i++)
using vi = vector<int>;
using vll = vector<ll>;
int main(){
string a;
  cin>>a;
cout<<a.erase(3);
  
}


Measured memory_bytes: 3624
h,w = map(int,input().split())
meiros = [['' for x in range(w)] for y in range(h)]
for i in range(h):
  tmp = input().rstrip()
  for j in range(w):
    meiros[i][j] = tmp[j]
nowh,noww = 0,0
queue = [(0,0)]
flg = True
while 1:
  L = len(queue)
  if L == 0:
    break
  for z in range(L):
    nowh,noww = map(int,queue[0])
    queue.pop(0)
    if nowh + 1 < h:
      if meiros[nowh+1][noww] == '#':
        queue.append((nowh+1,noww))
    if noww + 1 < w:
      if meiros[nowh][noww+1] == '#':
        queue.append((nowh,noww+1))
    meiros[nowh][noww] = '.'
  if nowh != (h-1) and noww != (w-1) and len(queue) != L:
    flg = False
    break
for mairo in meiros:
  if '#' in mairo:
    flg = False
    break
if flg:
  print('Possible')
else:
  print('Impossible')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

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

    int w,h,n;
    cin>>w>>h>>n;
    int l=0,r=w,u=h,d=0;
    rep(_,n){
        int x,y,a;
        cin>>x>>y>>a;
        if(a==1) l=max(l,x);
        if(a==2) r=min(r,x);
        if(a==3) d=max(d,y);
        if(a==4) u=min(u,y);
    }
    
    cout<<(max(0,r-l)*max(0,u-d))<<endl;
    return 0;
}

Measured memory_bytes: 256
/* ex 6_1
   potter0723sw */

#include <stdio.h>

typedef struct point{
    int x_elem;
    int y_elem;
}point;

point shift_point(point pre, int x_shift, int y_shift){
    point post;
    post.x_elem = pre.x_elem + x_shift;
    post.y_elem = pre.y_elem + y_shift;
    return post;
}

int main(void){
    int dif_x, dif_y;
    point point_a, point_b, point_c, point_d;
    scanf("%d %d %d %d", &point_a.x_elem, &point_a.y_elem, &point_b.x_elem, &point_b.y_elem);
    dif_x = point_a.x_elem - point_b.x_elem;
    dif_y = point_a.y_elem - point_b.y_elem;
    point_c = shift_point(point_b, dif_y, -dif_x);
    point_d = shift_point(point_a, dif_y, -dif_x);
    printf("%d %d %d %d\n", point_c.x_elem, point_c.y_elem, point_d.x_elem, point_d.y_elem);
    return 0;
}

Measured memory_bytes: 1732
#include<stdio.h>

int main(void){

	int sum = 0,high = 0,amount = 0,num = 0,cnt;
	
	scanf("%d",&num);
	for(cnt = 1 ; cnt <= num ; cnt = cnt + 1){
	
		scanf("%d",&amount);
		sum += amount;
		if(amount > high){
			high = amount;
		}
	
	}
	sum -= (high / 2);
	printf("%d",sum);
	
	return 0;
}

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

using namespace std;
#define int long long
signed main() {
    int n;
    cin >> n;
    int i;
    for(i=1;i<=n;i++)
    {
        int x, y, z;
        int up = sqrt(i);
        int cnt= 0;
        for(x=1;x<=up;x++)
            for(y=1;y<=up;y++)
            {
                int lef = i - x*x - y*y - x*y;
                if(lef <= 0)
                    continue;
                int y1 = (x+y)*(x+y) + 4*lef;
                int y2 = sqrt(y1*1.0L);
                if(y2*y2 != y1)
                    continue;
                y2 = y2-(x+y);
                if(y2%2 != 0)
                    continue;
                y2=y2/2;
                if(y2 >= 1)
                    cnt++;
            }
        cout << cnt << '\n';
    }
}

Measured memory_bytes: 3496
# coding: utf-8
# Your code here!

def dist(x,y):
    if x>y:
        return x-y
    else:
        d=y-x
        if d%2==0:
            return d//2
        else:
            return d//2 +2
        
A,B,C = list(map(int,input().split()))

aa = 100000
for N in range(52):
    aa = min(aa,dist(A,N)+dist(B,N)+dist(C,N))
print(aa)






Measured memory_bytes: 3060
N = int(input())
inList = list(map(int, input().split()))
sqList = [item ** 2 for item in inList]

mySum1 = sum(inList)
mySum2 = sum(sqList)

x_p = float(mySum1) / float(N)

if x_p < 1:
  Ans = mySum2
elif x_p > 100:
  Ans = N * (100 ** 2) - 2 * (mySum1 * 100) + mySum2
else:
  x_p_int = int(x_p)
  Ans = min(N * ((x_p_int    ) ** 2) - 2 * (mySum1 * (x_p_int    )) + mySum2, 
            N * ((x_p_int + 1) ** 2) - 2 * (mySum1 * (x_p_int + 1)) + mySum2)

print(Ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
    int n,i,x,max,min;
    long sum=0;
    scanf("%d",&n);
    scanf("%d",&x);
    min=x;
    max=x;
    sum+=x;
    for(i=1;i<n;i++){
        scanf("%d",&x);
        if(x<min) min=x;
        if(x>max) max=x;
        sum+=x;
    }
    
    printf("%d %d %ld\n",min,max,sum);
    
    return 0;
}


Measured memory_bytes: 2100
#include <stdio.h>
int main(void){
	int A,B,C,X;
	int ans = 0;
	int a,b;
	
	scanf("%d %d %d %d",&A,&B,&C,&X);
	for(a = 0;a <= A;a++){
		for(b=0;b <=B;b++){
			int c = (X-500*a-100*b)/50;
			if(0 <= c && c<=C) ans++;
		}
	}
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <utility>
using namespace std;

using PP = pair<int, int>;

int N, C;
vector<PP> V[30];
int A[100002];

int main() {
  cin >> N >> C;
  for(int i = 0; i < N; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    V[c - 1].push_back(PP(a - 1, b - 1));
  }
  
  for(int k = 0; k < C; ++k) {
    sort(V[k].begin(), V[k].end());
  }
  
  for(int k = 0; k < C; ++k) {
    int prev = -10009;
    for(PP p : V[k]) {
      if(prev == p.first) ++A[prev + 1];
      else ++A[p.first];
      --A[p.second + 1];
      prev = p.second;
    } 
  }
  
  partial_sum(A, A + 100002, A);
  int mx = 0;
  for(int i = 0; i < 100002; ++i) {
    mx = max(mx, A[i]);
  }
  cout << mx << endl;
  
  return 0;
}


Measured memory_bytes: 1920
def main():
    x = input()
    x1, x2, x3 = x.split(' ') 
    a = int(x1)
    b = int(x2)
    c = int(x3)
    z = [a, b, c]
    z.sort()
    print(z[0],z[1],z[2])

if __name__ == "__main__":
    main()

Measured memory_bytes: 7784
from math import sqrt, cos, radians

A, B, H, M = map(int, input().split())

posA = 30 * H + 0.5 * M
posB = 6 * M

if posA - posB < 180:
    theta = posA - posB
else:
    theta = 360 - (posA - posB)

res = sqrt(A * A + B * B - 2 * A * B * cos(radians(theta)))

print(res)


Measured memory_bytes: 9432
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
ll bpow(ll,ll,ll);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
const int MOD = 1000000007;

int main()
{
  ll N,A[200001],cnt=0;
  bool vi[200001];
  REP(i,200001)vi[i] = false;
  cin >> N;
  REP(i,N)cin >> A[i];
  map<int,int> mp,b;
  ll x = 1LL << (31LL);
  sort(A,A+N);
  while(x >= 2){
    for(int i=N-1;i>=0;i--){
      if(vi[i])
        continue;
      if(x-A[i] >= 1){
        int d = lower_bound(A,A+N,x-A[i])-A;
        for(int j=mp[x-A[i]];j<upper_bound(A,A+N,x-A[i])-lower_bound(A,A+N,x-A[i]);j++){
          
          if(vi[d+j] == false && d+j != i){
            cnt++;
            vi[d+j] = true;
            vi[i] = true;
            mp[x-A[i]]++;
            break;
          }
      }
      }
    }
    x >>= 1;
  }
  cout << cnt << endl;
  return 0;
}

/*
  ll N,A[200001];
  cin >> N;
  REP(i,N)cin >> A[i];
  map<int,int> mp;
  ll x = 1;
  
  REP(i,N){
    while(x <= 2000000000){
      if(x- A[i] >= 1)
        mp[x - A[i]]++;
      x <<= 1;
    }
  }
  
  */
ll bpow(ll a, ll n,ll mod){
  int i = 0;
  ll res=1;
  while(n){
    if(n & 1)
      res = (res*a) % mod;
    a = (a*a) % mod;
    n >>= 1;
  }
  return res;
}


Measured memory_bytes: 33536
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;
const long long INF = 1LL<<60;

int main() {
  int64_t N,sum=0,end; cin>>N;
  vector<bool> S(N+1,false);
  for(int64_t i=1;i<=N;i++){
    sum+=i;
    S.at(i)=true;
    if(sum>=N){
      S.at(sum-N)=false;
      end=i;
      break;
    }
  }
  rep(i,end+1) if(S.at(i)) cout<<i<<endl;    
}


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

function main()
  N = readline() |> parseInt

  x=floor(log10(N))
  y=if x==0 N
  elseif x==1 9
  elseif x==2 9+N-100+1
  elseif x==3 909
  elseif x==4 909+N-10000+1
  else 90909
  end
  println(y)
end

main()


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

using namespace std;

namespace {
    template<typename T>
    void print_vector(vector<T> &v) {
        for (auto it = v.begin(); it != v.end(); it++) {
            cout << *it;
            if (it + 1 != v.end())
                cout << " ";
        }
        cout << endl;
    }

     double calculate_area(vector<char>& stack) {
         double area = 0;
         int depth = 0;
         while(!stack.empty()) {
             const char c = stack.back();
             stack.pop_back();
             switch(c) {
                 case '\\':
                     if (depth > 0) {
                         area += 0.5 + depth - 1;
                         depth -= 1;

                         if (depth == 0)
                             return area;
                     }
                     break;
                 case '/':
                     area += 0.5 + depth;
                     depth += 1;
                     break;
                 case '_':
                     if (depth > 0)
                         area += depth;

                     break;
                 default:
                     break;
             }
         }
         return -1;
     }

     vector<double> calculate_areas(vector<char>& stack) {
         vector<double> ret;
         while(double area = calculate_area(stack)) {
             if (area == -1)
                 break;

             ret.push_back(area);
         }
         reverse(ret.begin(), ret.end());
         return ret;
     }
}


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

    string line;
    getline(cin, line);

    vector<double> pools;
    int depth = 0;

    vector<char> stack;
    stack.reserve(20000);

    for(const char& c : line) {
        switch(c) {
            case '\\':
                stack.push_back('\\');
                depth += 1;
                break;
            case '/':
                stack.push_back('/');
                if (depth > 0) {
                    depth -= 1;
                    if (depth == 0) {
                        pools.push_back(calculate_area(stack));
                        stack.clear();
                    }
                }
                break;
            case '_':
                stack.push_back('_');
                break;
            default:
                break;
        }
    }

    if (depth > 0) {
        for (const auto& v: calculate_areas(stack)) {
            pools.push_back(v);
        }
    }

    double total = 0;
    for(const auto& p : pools) { total += p; };

    cout << total << endl;
    cout << pools.size();
    if (pools.size() > 0) {
        cout << " ";
        print_vector(pools);
    } else {
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1404
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>

using namespace std;

int main() {
  string s,t;
  cin >> s;

  bool flag = 0;
  for(char ch = 'a'; ch <= 'z'; ch++) {
    for(int i = 0; i < s.size(); i++) {
      if(ch == s[i]) {
        flag = 0;
        break;
      }
      else flag = 1;
    }
    if(flag) {
      cout << ch << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

int main() {
  lli N;
  cin >> N;
  vector<lli> A(N);
  
    std::map<std::string,int> one;
    std::map<std::string,int> two;
    lli ans=0;
  rep(i, N){
    cin >> A[i];
    one[to_string(A[i]+i)]++;
    two[to_string(i-A[i])]++;
  }
  
  rep(i, N){
    ans+=two[to_string(A[i]+i)];
  }
  cout <<ans << endl;
}

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

int n;
int isprime[1009]={0} ,prime[1009];
int  k=0;
void sieve()
{ 
	isprime[1] = isprime[0] =1;
	for(int i=2;i<=sqrt(1009);i++)
	{
		if(!isprime[i])
		{
			for(int j=i*i;j<=1009;j+=i)
			isprime[j]=1 ;
		}
	}
	
	for(int i=2;i<=1009;i++)
	{
		if(!isprime[i])
		{
			prime[k]=i;
			k++ ;
		}
	}
}

int main()
{
	cin>>n;
	long long ans= 1 ;
	sieve() ;
	for(int i=0;prime[i]<=n && i<k;i++)
	{
		int c= 0;
		for(int j=2;j<=n;j++)
		{
			int x = j;
			while(x%prime[i] == 0)
			{
				c++;
				x/=prime[i] ;
			}
		}
	//	cout<<c+1<<"d"<<prime[i]<<endl;
		ans = ans*(c+1)%mod ;
	}
	cout<<ans<<endl; 
	return 0;
}

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

#define int long long int
#define ff first
#define ss second
#define pb push_back


int bexp(int a, int b, int mod)
{
    int res = 1;

    while (b)
    {
        if (b & 1) res = (res * a) % mod;

        a = (a * a) % mod; 
        b >>= 1;
    }
    return res;
}

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

#define N 100010
#define MOD 1000000007

struct comp {
    bool operator() (const pair<int, int> a, const pair<int, int> b) const
    {
        return a.ss > b.ss;
    }
};

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

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

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

    for (int i = 1; i < n; ++i)
    {
        int k1 = INT_MAX;
        for (int j = 1; j <= k; ++j)
            if (i - j >= 0)
                k1 = min(k1, dp[k - j] + abs(h[i] - h[i - j]));

        for (int j = 0; j < k - 1; ++j)
            dp[j] = dp[j + 1];
        dp[k - 1] = k1;
    }

    cout << dp[k - 1];
    return 0;
}

Measured memory_bytes: 4416
import java.util.Scanner;
public class Main {
	public static void main(String[]args) {
		Scanner s = new Scanner(System.in);
		double h = s.nextDouble();
		double n = s.nextDouble();
		double m =0;
		for(int i = 0;i<n;i++) {
			m += s.nextDouble();
		}
		if(m>=h) {
			System.out.print("Yes");
		}else {
			System.out.print("No");
		}
		
	}
}



Measured memory_bytes: 94544