akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

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

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

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

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

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

int main() {
    double n, k;
    cin >> n >> k;
    double ans=0;
    for (int i = 1; i < n+1; i++) {
        double p = 1;
        int g = i;
        while (g < k) {
            g *= 2;
            p /= 2;
        }
        ans += p;
    }
    ans /= n;
    cout << setprecision(18) << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main
{

    public static void main(String args[])
    {
        Scanner kb = new Scanner(System.in);
        int n = kb.nextInt();

        int d1[] = new int[n];
        int d2[] = new int[n];

        for(int i = 0 ; i < n ; i++)
        {
            d1[i] = kb.nextInt();
            d2[i] = kb.nextInt();
        }

        int flag = 0;

        if(n >= 3)
        {
            int p1 = 0;
            int p2 = 1;
            int p3 = 2;

            while(p3 < n)
            {
                if(d1[p1] == d2[p1] && d1[p2] == d2[p2] && d1[p3] == d2[p3])
                {
                    flag = 1;
                    break;
                }

                p1++;
                p2++;
                p3++;
            }
        }

        if(flag == 1)
            System.out.println("Yes");
        else
            System.out.println("No");

    }
}

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

int dp[100005];
vector<int> X[100005];

int solve(int i)
{
    if(dp[i] != -1)
        return dp[i];
    
    int ans = 1;
    
    for(auto x : X[i])
        ans = max(ans, 1 + solve(x));
    
    return dp[i] = ans;
}

int main() {

    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);
    
    int N, M;
    cin >> N >> M;
    
    while(M--)
    {
        int u, v;
        cin >> u >> v;
        
        X[u].push_back(v);
    }
    
    int ans = 0;
    memset(dp, -1, sizeof(dp));
    
    for(int i=1; i<=N; i++)
        ans = max(ans, solve(i));
    
    cout << ans - 1 << "\n";
    return 0;
}

Measured memory_bytes: 8192
N, M = gets.split.map &:to_i
x = []
N.times do
  x << gets.split.map(&:to_i)
end
mul = [
  [1, 1, 1],
  [1, 1, -1],
  [1, -1, 1],
  [-1, 1, 1],
  [1, -1, -1],
  [-1, -1, 1],
  [-1, 1, -1],
  [-1, -1, -1]
]

max = 0
mul.each do |m|
  temp = []
  x.each do |e|
    sum = 0
    3.times do |i|
      sum += e[i] * m[i]
    end
    temp << sum
  end
  sum = temp.sort.reverse.take(M).sum
  max = sum if max < sum
end
puts max

Measured memory_bytes: 14588
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [None] * m
for i in range(m):
    k, *s[i] = map(lambda x: int(x) - 1, input().split())
p = list(map(int, input().split()))
ans = 0
for b in range(1 << n):
    f = True
    for i in range(m):
        cnt = sum(b >> x & 1 for x in s[i])
        f &= (cnt % 2 == p[i])
    ans += f
print(ans)



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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define F first
#define S second
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
bool chmax(T &a, const T &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

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

  int a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;

  if (abs(a - b) - (v - w) * t <= 0) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(int i=(int)(st),i##end=(int)(ed);i<=i##end;++i)
#define DREP(i,st,ed) for(int i=(int)(st),i##end=(int)(ed);i>=i##end;--i)
template<typename T>bool chkmin(T &x,const T &y){return x>y?x=y,1:0;}
template<typename T>bool chkmax(T &x,const T &y){return x<y?x=y,1:0;}
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
template<typename T>T read(){
	T x=0,f=1;
	char c=getchar();
	while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
	while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
#define read() read<int>()
template<typename T>void write(T x,char c){
	static char t[25];
	static int tlen;
	t[tlen=1]=c;
	if(x<0)putchar('-'),x=-x;
	do t[++tlen]=(x%10)^48;
	while(x/=10);
	while(tlen)putchar(t[tlen--]);
}
#define pb push_back
typedef long long ll;
typedef double lf;
const int maxn=105;
int n,sum[maxn][2];
int main(){
	n=read();
	REP(j,0,1)
		REP(i,1,n)
			sum[i][j]=read();
	REP(i,1,n)sum[i][0]+=sum[i-1][0];
	DREP(i,n,1)sum[i][1]+=sum[i+1][1];
	int ans=0;
	REP(i,1,n)
		chkmax(ans,sum[i][0]+sum[i][1]);
	write(ans,'\n');
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest._900problems
{
    class AGC027_C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] nm = ReadInts();
            int n = nm[0];
            int m = nm[1];
            string s = Read();
            List<int>[] graph = new List<int>[n];
            for (int i = 0; i < n; i++) graph[i] = new List<int>();
            bool[] isLoop = new bool[n];
            for(int i = 0; i < m; i++)
            {
                int[] ab = ReadInts();
                int a = ab[0] - 1;
                int b = ab[1] - 1;
                graph[a].Add(b);
                graph[b].Add(a);
            }
            int cnt = 0;
            bool[] removed = new bool[n];
            for (int i = 0; i < n; i++)
            {
                if (removed[i]) continue;

                Queue<int> que = new Queue<int>();
                que.Enqueue(i);
                while (que.Count > 0)
                {
                    int now = que.Dequeue();
                    if (removed[now]) continue;
                    bool a = false;
                    bool b = false;
                    for(int j = 0; j < graph[now].Count; j++)
                    {
                        if (removed[graph[now][j]]) continue;
                        if (s[graph[now][j]] == 'A') a = true;
                        if (s[graph[now][j]] == 'B') b = true;
                    }
                    if (a && b) continue;

                    removed[now] = true;
                    cnt++;
                    for(int j = 0; j < graph[now].Count; j++)
                    {
                        if (removed[graph[now][j]]) continue;
                        que.Enqueue(graph[now][j]);
                    }
                }
            }
            if (cnt == n) WriteLine("No");
            else WriteLine("Yes");
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 38196
//tokenakatta

#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;

int main() {
    int N, M; cin >> N >> M;
    priority_queue<pair<ll, int>> que;
    
    rep(i, N){
        ll x; cin >> x;
        pair<ll, int> t;
        t = make_pair(x, 1);
        que.push(t);
    }

    rep(i, M){
        ll y, z; cin >> y >> z;
        pair<ll, ll> t;
        t = make_pair(z, y);
        que.push(t);
    }

    ll ans = 0;
    rep(i, N){
        auto p = que.top();
        que.pop();
        ans += p.first;
        if(p.second>1){
            p.second--;
            que.push(p);
        } 
    }

    cout << ans << endl;

}   


Measured memory_bytes: 6000
#include <stdio.h>

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

	int prev = 0;
	bool ans = true;
	for (int i = 0; i < N; i++) {
		int H;
		scanf("%d", &H);
		if (i == 0) {
			prev = H - 1;
		}
		else {
			if (prev > H) {
				ans = false;
				prev = H;
			}
			else if (prev == H) {
				prev = H;
			}
			else {
				prev = H - 1;
			}
		}
	}
	printf("%s\n", ans ? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define prique priority_queue
#define umap unordered_map
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int int_fast64_t

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

struct event
{
  int time, type, pos;
  bool operator<(const event& another) const {
    if(time == another.time) return type < another.type;
    else return time < another.time;
  };
};

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

  int N, Q; cin >> N >> Q;
  int S, T, X, D;
  vector<event> vec;
  REP(i, N){
    cin >> S >> T >> X;
    S -= X; T -= X;
    vec.pb({S, 1, X}); // add event
    vec.pb({T, -1, X}); // erase event
  }
  REP(i, Q){
    cin >> D;
    vec.pb({D, 2, i}); // query event
  }
  sort(ALL(vec));
  multiset<int> st;
  vector<int> ans(Q);
  for(auto itr : vec){
    if(itr.type == 1) st.insert(itr.pos);
    else if(itr.type == -1) st.erase(st.lower_bound(itr.pos));
    else ans[itr.pos] = (st.empty() ? -1 : *(st.begin()));
  }
  for(auto a : ans) cout << a << endl;
}

Measured memory_bytes: 28132
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define srep(i, from, to) for(int i = from; i < (int)(to); i++)
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

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

  int ans = 0;
  rep(i, 1000) {
    int x1 = i / 100;
    int x2 = i % 100 / 10;
    int x3 = i % 10;
    int now = 0;
    rep(j, n) {
      if(now == 0 && x1 == (s[j] - '0'))
        now++;
      else if(now == 1 && x2 == (s[j] - '0'))
        now++;
      else if(now == 2 && x3 == (s[j] - '0'))
        now++;
    }
    if(now == 3) ans++;
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
    int n, d, x, a, sum = 0;
    cin >> n >> d >> x;
    for(int i = 0; i < n; ++i) {
        cin >> a;
        int c = 0;
        for(int j = 1; j <= d; j = a*c+1) {
            sum++;
            c++;
        }
    }

    cout << x+sum << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll h, w;
string s[401];
bool hist[401][401];
bool used[401][401];
ll dx[4]={0, 1, 0, -1};
ll dy[4]={1, 0, -1, 0};
int main(){
    cin>>h>>w;
    REP(i, 0, h) cin>>s[i];

    ll ans=0;
    REP(i, 0, h){
        REP(j, 0, w){
            if(s[i][j]=='#' && !used[i][j]){
                ll black=1;
                ll cnt=0;
                used[i][j]=true;

                queue<pair<pair<ll, ll>, ll>> que;
                que.push(make_pair(make_pair(i, j), true));
                while(!que.empty()){
                    pair<pair<ll, ll>, ll> cur=que.front();
                    que.pop();
                    REP(k, 0, 4){
                        ll ny=cur.first.first+dy[k];
                        ll nx=cur.first.second+dx[k];
                        if(ny<0 || ny>=h || nx<0 || nx>=w) continue;
                        if(used[ny][nx]) continue;

                        if(cur.second){ // is black
                            if(s[ny][nx]=='.'){
                                cnt++;
                                used[ny][nx]=true;
                                que.push(make_pair(make_pair(ny, nx), false));
                            }
                        }
                        else{ // is white
                            if(s[ny][nx]=='#' && !used[ny][nx]){
                                black++;
                                used[ny][nx]=true;
                                que.push(make_pair(make_pair(ny, nx), true));
                            }
                        }
                    }
                }
                ans+=(cnt*black);
            }
        }
    }

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int h, w, k;
    cin >> h >> w >> k;
    string s[h];
    for(int i=0;i<h;i++) cin >> s[i];
    ll maki = (1<<h);
    ll niko = (1<<w);
    ll ans = 0;
    for(int i=0;i<maki;i++){
    	for(int j=0;j<niko;j++){
    		ll num = 0;
    		for(int y=0;y<h;y++){
    			for(int x=0;x<w;x++){
    				if(s[y][x] == '#' && (i>>y&1) && (j>>x&1)) num++;
    			}
    		}
    		if(num == k) ans++;
    	}
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3652
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val k = sc.nextInt()
    var ans = 0L
    if (k == 0) {
        ans = n.toLong() * n
    } else {
        for (b in k + 1..n) {
            ans += (n + 1) / b * (b - k)
            val rem = (n + 1) % b
            ans += Math.max(0, rem - k)
        }
    }
    println(ans)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 31012
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
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;}
template <class T> inline T gcd(T a, T b) {if(a==0) return b; return gcd(b%a,a);}
template <class T> inline T lcm(T a, T b) {return a * b / gcd(a,b);}
template <class T> inline T sum(vector<T> &vec) {T res=0; for (int i = 0; i < vec.size(); i++) res += vec[i]; return res;}
template <class T> inline T mpow(T a, T b) {if(b==0)return 1; T c = mpow(a,b/2);if(b%2==1)return c*c*a; return c*c;}
const int INF = 1 << 30;
const long long INFLL = 1LL << 60;
//typedef pair<int, int> P;

#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define FOR(i,n) for (int (i)=0;(i)<(n);(i)++)
#define REPB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define FORB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define SORT(A) sort((A).begin(),(A).end())

/*
配列をK個保持
相手が出すのをシーケンシャルに

dp[i][j] i回まで終わってK回前にjを出したときの最大

dp[i+1][j] = 
0...r
1...S
2...P
*/
ll N, K;
ll R, S, P; 

ll minidp(string &T) {
    vector<vector<ll> > dp(T.length()+1,vector<ll>(3,0LL));
    for (int i = 0; i < T.length(); i++) {
        if (T[i] == 'r') {
            dp[i+1][2] = max(dp[i][1],dp[i][0]) + P;
            dp[i+1][1] = max(dp[i][0],dp[i][2]);
            dp[i+1][0] = max(dp[i][1],dp[i][2]);
        } else if (T[i] == 'p') {
            dp[i+1][2] = max(dp[i][1],dp[i][0]);
            dp[i+1][1] = max(dp[i][0],dp[i][2]) + S;
            dp[i+1][0] = max(dp[i][1],dp[i][2]); 
        } else if (T[i] == 's') {
            dp[i+1][2] = max(dp[i][1],dp[i][0]);
            dp[i+1][1] = max(dp[i][0],dp[i][2]);
            dp[i+1][0] = max(dp[i][1],dp[i][2]) + R; 
        }
    }
    return max(max(dp[T.length()][0], dp[T.length()][1]),dp[T.length()][2]);
    //cout << max(max(dp[T.length()][0], dp[T.length()][1]),dp[T.length()][2]);
}

int main() {
    cin >> N >> K;
    cin >> R >> S >> P;
    string T; cin >> T;
    ll res = 0;
    for (int i = 0; i < K; i++) {
        string tmp;
        int j = i;
        while (j < N) {
            tmp += T[j];
            j += K;
        }
        //cout << tmp << endl;
        res += minidp(tmp);
        //cout << minidp(tmp) << endl;
    }
    cout << res << endl;

}


Measured memory_bytes: 5888
def insertion_sort(a, n):
    for i in range(1, n):
        v = a[i]
        j = i - 1
        while j >= 0 and a[j] > v:
            a[j+1] = a[j]
            j -= 1
        a[j+1] = v
        print(' '.join([str(i) for i in a]))


n = int(input())
a = [int(i) for i in input().split()]
print(' '.join([str(i) for i in a]))

insertion_sort(a, n)


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

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int[][] b = new int[a][2];
    int d = 0; //道の個数
    double ans = 0;
    int f = 0;
    double g = 0;  
    int h = 1; //組み合わせの数
    
    //町の座標を入力
    for(int i = 0;i < a;i++){
      b[i][0] = sc.nextInt();
      b[i][1] = sc.nextInt(); 
      //System.out.println(b[i][0]);
      //System.out.println(b[i][1]);     
    }
    //2個のパターン数
    for(int j = 1;j < a;j++){ 
      d += j;
    }
    //System.out.println(d); 
    
 	//全パターン数
    for(int w = 1; w <= a;w++){ 
      h *= w;
    }
    //System.out.println(h);
    double[] c = new double[d];
    
    //すべての道の長さを求める
    for(int x = 0;x < a-1;x++){
      for(int y = x + 1;y < a;y++){
       double e = Math.pow(b[x][0] - b[y][0] , 2) + Math.pow(b[x][1] - b[y][1] , 2);
       c[f] = Math.sqrt(e);
        f++;
      }
    }
   //System.out.println(f);
    //System.out.println(Arrays.toString(c));
      
    //道をすべて足す
    for(int z = 0;z < d;z++){
      g += c[z]; 
    }
    //System.out.println(g);
   
    //1組の数
    int k = (h * (a - 1)) / d ;
   //System.out.println(k);
    
    ans = (g * 2)/ a;
   System.out.println(ans);
  }
}

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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
map<ll,ll> m;
rep(i, n){
  cin >> a[i];
  m[a[i]-i]++;
  a[i]-=i;
}
rep(i,n){
  ans+=m[-i*2-a[i]];
}

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

Measured memory_bytes: 27328
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#include<string>
#define ll long long
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vi vector<ll>
#define el printf("\n")
#define N 100001
using namespace std;



int main()
{   IOS;
cout.precision(30);
    ll n;
    cin >> n;
    vector<ll> L1,L;
    for(int i=0;i<n-1;i++)
    {
        ll x;
        cin >> x;
        L.push_back(x);
    }
    ll res=L[0];
    for(int i=0;i<n-2;i++)
        res+=min(L[i],L[i+1]);
    res+=L[L.size()-1];

    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
int main(void){
    int w,a,b,ans;
    scanf("%d %d %d",&w,&a,&b);
    if(a+w<b)ans=b-a-w;
    else if(b+w<a)ans=a-b-w;
    else ans=0;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define pb push_back
#define lp(i,a,b) for(int i = a;i<b;i++)
#define ll long long
#define pii pair<int,int>
#define ff first
#define ss second
#define mk make_pair
#define sz size()
 
const int MAXN = 1010 ; 
 
using namespace std ;

string s[3] = { "Sunny", "Cloudy", "Rainy"} ;

int main()
{
	
	string  x ;
	cin>>x ;
	
	int idx ;
	
	lp(i,0,3)
		if( s[i] == x ) idx = i ;
		
	cout<<s[ (idx+1)%3 ] <<endl ;
	
}









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

int main(){
    int n; cin >> n;
    string s; cin >>  s;
    int k; cin >> k;
    for(int i = 0; i < n; i++){
        if(s[i] != s[k-1]) cout << '*';
        else cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N,i = 0,count = 0;
    long long int A;
    cin >> N;
    while (N != i) {
    std::cin >> A;
        while(A % 2 == 0){
            A = A / 2;
            count++;
        }
        i++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

use rand::prelude::*;

#[allow(unused_macros)]
macro_rules! echo {
    ($($e:expr),+) => ( { $(println!("{}", $e))+ } );
}

#[allow(unused)]
fn calc(i: usize, day: usize, s: &Vec<Vec<isize>>, c: &Vec<isize>, last: &mut Vec<usize>) -> isize {
    last[i] = day;
    let up = s[day - 1][i];
    let mut down = 0;

    for j in 0..26 {
        down += (day - last[j]) as isize * c[j];
    }

    up - down
}

fn update(i: usize, j: usize, day: usize, s: &Vec<Vec<isize>>, c: &Vec<isize>) -> isize {
    let mut ans = s[day - 1][j] - s[day - 1][i];
    let c_diff = c[j] - c[i];
    let i = i as isize;
    let j = j as isize;
    ans += c_diff * (j * j - 25 * j - i * i + 25 * i);
    ans
}

fn main() {
    input! {
        d: usize,
        c: [isize; 26],
        s: [[isize; 26]; d],
    }

    // let mut score = 0;
    // let mut last = vec![0; 26];

    let mut tmp_dec_max = (0, 0);
    for e in c.iter().enumerate() {
        if tmp_dec_max.1 < *e.1 {
            tmp_dec_max = (e.0, *e.1);
        }
    }

    let mut contests = vec![];

    for day in 1..=d {
        let mut tmp_inc_max = (0, 0);
        for i in 0..26 {
            if tmp_inc_max.1 < s[day - 1][i] {
                tmp_inc_max = (i, s[day - 1][i]);
            }
        }

        let target: usize;

        if tmp_inc_max.0 == tmp_dec_max.0 {
            target = tmp_inc_max.0;
        } else if tmp_inc_max.1 > tmp_dec_max.1 {
            target = tmp_inc_max.0;
        } else {
            target = tmp_dec_max.0;
        };
        contests.push(target);
        // score += calc(tmp_inc_max.0, day, &s, &c, &mut last);
    }

    let mut rng = rand::thread_rng();
    let ch_contest: Vec<_> = (0..26).collect();
    let ch_day: Vec<_> = (1..=d).collect();

    for _ in 0..10_000 {
        if let Some(contest) = ch_contest.choose(&mut rng) {
            if let Some(day) = ch_day.choose(&mut rng) {
                let before = contests[*day - 1];
                if update(before, *contest, *day, &s, &c) > 0 {
                    contests[*day - 1] = *contest;
                }
            };
        };
    }

    for e in contests {
        echo!(e + 1);
    }

    // score += 10_isize.pow(6);
    // score = std::cmp::max(0, score);

    // dbg!(score);
}


Measured memory_bytes: 2760
#include<stdio.h>
int main()
{
int n,i,a;
  scanf("%d",&n);
  
int b[n-1];
  for(i=0;i<n-1;++i)
  {
  scanf("%d",&b[i]);
  }
  
  a=b[n-2]+b[0];
  
  for(i=0;i<n-2;++i)
  {
  if(b[i]>b[i+1]) a=a+b[i+1];
  else a=a+b[i];  
  }
 
  printf("%d",a);
  
return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map>
#include<stdio.h>
#include<queue>
#include<tuple>

#define ALL(a)  (a).begin(),(a).end()
const long long MOD = 1e9+7;

//いろんなstlの使い方　https://qiita.com/tukejonny/items/f4013547df761a0b3523
//http://y-mazun.hatenablog.com/entry/20111202/1322840281



using namespace std;


long long gcd(long long a, long long b) {
    if (a > b) {
        return gcd(b, a);
    }
    return a == 0 ? b : gcd(b % a, a);
}

int lcm(int m, int n) {
    // 引数に０がある場合は０を返す
    if ((0 == m) || (0 == n))
        return 0;

    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm


int moji(char in) {
    int ans = (int) in - (int) 'a';
    if ((ans < 0) || (ans > 25)) {
        ans = 26;
    }
    return ans;
}


int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int *) a - *(int *) b;
}



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

//formerは前方のindex(自分自身を含んで良い)
template<class T>
int former(const vector<T> &v, T x) {
    return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}

//latterは後方のindex(自分自身を含んで良い)
template<class T>
int latter(const vector<T> &v, T x) {
    return lower_bound(v.begin(), v.end(), x) - v.begin();
}



//indexを用いてvectorから要素削除
template<typename T>
void remove(std::vector<T> &vector, unsigned int index) {
    vector.erase(vector.begin() + index);
}





int main() {
    int N;
    cin>>N;
    vector<int>ans;
    int sum=0;
    int idx=0;
    for(int i=1;i<N;i++){
        sum+=i;
        idx=i;
        if(sum>=N){
            break;
        }
    }
    int iranai=0;
    for(int i=1;i<=idx;i++){
        if(sum-i==N){
            iranai=i;
            break;

        }
    }
    if(N==1){
        cout<<1<<endl;
    }else if(N==2){
        cout<<2<<endl;
    }else{
    for(int i=1;i<=idx;i++){
        if(i==iranai){
            continue;
        }else{
            cout<<i<<endl;
        }
    }}


}














Measured memory_bytes: 384
N = int(input())
T,A = map(int, input().split())
H = list(map(int, input().split()))

ans = float('inf')
index = -1

for i in range(N):
    ave_T = 0
    ave_T = T - H[i] * 0.006
    if (abs(A - ave_T)) < ans:
        ans = abs(A - ave_T)
        index = i + 1

print(index)

Measured memory_bytes: 3188
N,M = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
B = []

#総投票数を求める
sum_vote = sum(A)
#print(sum_vote)

#投票数が1/4Mを下回る物を削除していく つまり　新しいリストに代入
for i in range(len(A)):
    if A[i] >= sum_vote * 1/(4 * M):
        B.append(A[i])
    else:
        pass

#最終判断
if len(B) >= M:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
/*
 * atcoder/abc114_2nd/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
#include <map>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

/*
 * N!(N<=100)の約数のうち、約数をちょうど75個をもつ約数はいくつあるか.
 *
 * N!を素因数分解して、a_1^b_1 * a_2^b_2 * ... a_M * b_Mの形にすると、
 * 約数の数は(b_1+1) * (b_2+1) * ... * (b_M+1)
 *
 * この中で全探索して約数が75個になるものを見つける.
 */
ll N, M;
map<int, int> M1;
vector<int> K;
int dp[100][80];

ll rec(int n = 0, int mul = 75) {
  int &cc = dp[n][mul];
  if (~cc) return cc;
  if (n==M) return cc = mul == 1;

  int num = 0;
  for (int i=0; i<=M1[K[n]]; i++) {
    if (mul % (i+1) != 0) continue;
    num += rec(n + 1, mul / (i+1));
  }
  return cc = num;
}

void solve() {
  cin >> N;
  loop(n,2,N+1) {
    int m = n;
    for (int i=2; i<=97; i++) {
      while (m % i == 0) {
        M1[i]++;
        m /= i;
      }
    }
  }
  for (auto&& m1: M1) K.push_back(m1.first);
  M = (ll)K.size();

  memset(dp, -1, sizeof(dp));
  cout << rec() << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<pair<int,int>> AB;
    for(int i=0; i<N; i++){
        int a,b;
        cin >> a >> b;
        AB.emplace_back(b, a); //締め切り、所要時間
    }
    sort(AB.begin(),AB.end());
    bool judge=true;
    ll time=0;
    for(int i=0; i<N; i++){
        time += AB[i].second;
        if(AB[i].first < time){
            judge = false;
            break;
        }
    }
    if(judge){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


Measured memory_bytes: 2420
#include "bits/stdc++.h"
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define mp make_pair
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
ll mod=1000000007;


int main(){
    ll n,k,ans=0;
    cin>>k>>n;
    vl a(n);
    rep(i,n){
        cin>>a[i];
        ans+=a[i];
    }
    if(ans>=k)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll;
#define  prec(n)        fixed<<setprecision(n)
#define  optimize       ios::sync_with_stdio(0); cin.tie(0);
#define  PI             acos(-1.0)
#define  RESET(a, b)    memset(a, b, sizeof(a))
#define  pb             push_back
#define  pii            pair<int,int>

int main()
{
     int n,cnt=0;
     cin>>n;
     for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        if(i%2 && x%2) cnt++;
     }
     cout<<cnt<<endl;
}


Measured memory_bytes: 3564
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}



int main(){
  ll n;
  cin>>n;
  vector<ll> v(n);
  vector<ll> ans(n);
  for(int i=0; i<n; i++) {
    cin>>v[i];
  }
  for(int i=n-1; i>=0; i--) {
    ll x;
    bool f=true;
    for(auto j = v.begin(); j!=v.end(); j++) {
      if(j-v.begin()+1 == *j) {
	x = j-v.begin();
	f=false;
      }
    }
    if(f) {
      std::cout << -1 << std::endl;
      return 0;
    }

    ans[i] = x+1;
    v.erase(v.begin()+x);
  }
  for(auto x:ans){
    std::cout << x << std::endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SI(_x) scanf("%d",&_x);
#define SI2(_x1,_x2) scanf("%d %d",&_x1,&_x2);
#define SLL(_x) scanf("%lld",&_x);
#define SDB3(_x1,_x2,_x3) scanf("%lf %lf %lf",&_x1,&_x2,&_x3);
#define SDB(_x1) scanf("%lf",&_x1);
#define FOR(_i,_x,_n) for(int _i=_x;_i<_n;_i++)
#define READ() freopen("in.txt","r",stdin)
#define WRITE() freopen("out.txt","w",stdout)
#define  pb(x)  push_back(x)
#define mem(arr,val) memset(arr,val,sizeof(arr));
typedef long long int ll;
int main()
{
   // READ();
   ll n,m;
   cin>>n>>m;
   if(n==1)
   {
       n=1;
   }
   else if(n-2<0)
   {
       n=0;
   }
    else
    n-=2;

    if(m==1)
   {
       m=1;
   }
   else if(m-2<0)
   m=0;
   else
    m-=2;

   cout<<n*m<<endl;




    return 0;
}



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

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

  int m1 = 0, m2 = 0;
  vector<int> a(n);
  rep(i, n){
    cin >> a[i];
    if(a[i] >= m1){
      m2 = m1;
      m1 = a[i];
    }
    else if(a[i] > m2){
      m2 = a[i];
    }
  }

  rep(i, n){
    if(a[i] == m1) cout << m2 << endl;
    else cout << m1 << endl;
  }

  return 0;

}


Measured memory_bytes: 2432
import time
from datetime import date

#solve function
def solve(str_dates):
    dates = []
    for i in range(len(str_dates)):
        dates.append(int(str_dates[i]))

    date_start = date(dates[0], dates[1], dates[2])
    date_end = date(dates[3], dates[4], dates[5])

    return (date_end - date_start)


#main function
if __name__ == '__main__':
    while True:
        dates = input().split()

        if dates[0] == "-1":
            break

        date_diff = solve(dates)

        print(date_diff.days)

Measured memory_bytes: 7064
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<"\n";}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";}
inline void                                              out(ld p){printf("%.12Lf\n",p);}
template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line
template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line
int K;
string S;
inline void solve(void){
  in(K,S);
  if(S.size()<=K)out(S);
  else out(S.substr(0,K)+"...");
}
int main(void){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var answer = 0;
            foreach(var i in Enumerable.Range(0, N))
            {
                if ((i + 1) % 2 == 1 && a[i] % 2 == 1)
                {
                    answer++;
                }
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 28372
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}

const string YES = "Yes";
const string NO = "No";
#define judge(f) cout<<(f?YES:NO)<<"\n";

void solve(long long a, long long b, long long c){
    // ld sa=sqrt(a);
    // ld sb=sqrt(b);
    // ld sc=sqrt(c);
    // debg(sa);
    // debg(sb);
    // debg(sc);
    // judge((sa+sb)<sc);
    unsigned long long lhs=4*a*b;
    // ld rhs=(c-a-b)*(c-a-b)*1.0/4;
    unsigned long long rhs=(c-a-b)*(c-a-b);
    if(c-a-b<=0){
        judge(false);
        return;
    }
    judge(lhs<rhs);
}

int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    solve(a, b, c);
    return 0;
}


Measured memory_bytes: 256
function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

(() => {
    const [ n ] = readMany(1).map(it => parseInt(it))
    const a = readMany(n).map(it => parseInt(it))
    const xorAll = a.reduce((prev, current) => prev ^ current)
    const ans = []
    for (let i = 0; i < n; i += 1) {
        ans.push(xorAll ^ a[i])
    }
    console.log(ans.join(' '))
})()


Measured memory_bytes: 81716
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int a,b,m; cin >> a >> b >> m;
	vector<int> A(a),B(b);
	int mi=1e9,mi2=1e9;
	for(int i=0;i<a;i++){
		cin >> A[i];
		mi=min(mi,A[i]);
	}
	for(int i=0;i<b;i++){
		cin >> B[i];
		mi2=min(mi2,B[i]);
	}
	int ans=mi+mi2;
	for(int i=0;i<m;i++){
		int x,y,c; cin >> x >> y >> c;
		x--; y--;
		ans=min(ans,A[x]+B[y]-c);
	}
	cout << ans << endl;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int a1[N],a2[N],a3[N];
priority_queue<int,vector<int>,greater<int> >q;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	for(int i=0;i<a;i++)cin>>a1[i];
	for(int i=0;i<b;i++)cin>>a2[i];
	for(int i=0;i<c;i++)cin>>a3[i];
	sort(a1,a1+a);sort(a2,a2+b);sort(a3,a3+c);
	ll sum=0;
	if(a>=x){
		for(int i=a-1;i>=a-x;i--){
			q.push(a1[i]);
		}
		x=0;
	}
	else {
		for(int i=0;i<a;i++){
			q.push(a1[i]);
		}
		x-=a;
	}
	if(b>=y){
		for(int i=b-1;i>=b-y;i--){
			q.push(a2[i]);
		}
		y=0;
	}
	else {
		for(int i=0;i<b;i++){
			q.push(a2[i]);
		}
		y-=b;
	}	
	int idx=c-1;
	int minn=0x3f3f3f3f;
	
	while(x>0){
		q.push(a3[idx--]);	
		x--;
	}
	while(y>0){
		q.push(a3[idx--]);	
		y--;
	}	
	for(;idx>=0;idx--){
		int t=q.top();
		if(t<a3[idx]){
			q.pop();
			q.push(a3[idx]);
		}
		else break;
	}
	while(!q.empty()){
		sum+=q.top();
		q.pop();
	}
	cout<<sum<<endl;
	return 0;
}

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

int main() {
  int n,ans;
  cin >> n;
  ans=min(n,9);
  if(n>99) ans+=min(n-99,900);
  if(n>9999) ans+=min(n-9999,90000);
  cout << ans << endl;
}

Measured memory_bytes: 256
from sys import stdin
input = stdin.readline

x = int(input())


if( 400 <= x <= 599):
    print(8)

if( 600 <= x <= 799):
    print(7)

if( 800 <= x <= 999):
    print(6)

if( 1000 <= x <= 1199):
    print(5)

if( 1200 <= x <= 1399):
    print(4)

if( 1400 <= x <= 1599):
    print(3)
                        
if( 1600 <= x <= 1799):
    print(2)

if( 1800 <= x <= 1999):
    print(1)    

Measured memory_bytes: 9200
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        while(n--!=0){
            double[] a=new double[8];
            for(int i=0;i<8;i++)a[i]=sc.nextDouble();
            double e=(a[2]-a[0])*(a[7]-a[5])-(a[3]-a[1])*(a[6]-a[4]);
            System.out.println(e==0?"YES":"NO");
        }
    }
}
//by Tuvshee 12.05.2012
//Parallelism

Measured memory_bytes: 12000
n, lim_w = map(int, input().split())
w, v = [], []

for _ in range(n):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)

# dp[i][j] := i番目までの品物を見たとき, 価値の総和がj以上となるように選んだときの重さの総和の最小値
dp = [ [float("inf")]*(100005) for _ in range(n+1) ]
dp[0][0] = 0

for i in range(n):
    for j in range(100005):
        # i番目の品物を選ぶ
        if j >= v[i]:
            dp[i+1][j] = min(dp[i+1][j], dp[i][j-v[i]] + w[i])
        # i番目の品物を選ばない
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])

ans = 0
for v in range(100005):
    if dp[n][v] <= lim_w:
        ans = max(ans, v)

print(ans)


Measured memory_bytes: 312684
#!/usr/bin/env python3

N, H = map(int, input().split())

A = []
B = []

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A = sorted(A)[::-1]
B = sorted(B)[::-1]

ret = 0
if B[0] < A[0]:
    if H % A[0] == 0: ret = H // A[0]
    else: ret = H // A[0] + 1
    H = 0
else:
    for b in B:
        if b < A[0]:
            if H%A[0] == 0: ret += H // A[0]
            else: ret += H // A[0] + 1
            H = 0
            break
        else:
            ret += 1
            H -= b

        if H <= 0:
            break

    if H > 0:
        if H%A[0] == 0: ret += H // A[0]
        else: ret += H // A[0] + 1


print(ret)


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

int a, b, c, d;
int res;

int main(){
  cin >> a >> b >> c >> d;
  int start = max(a, c);
  int stop = min(b, d);
  res = max(0, stop - start);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

ll mod = 1e9+7;
typedef pair<int,int> pii;

int main()
{
    fastio
    ll x, y, n;
    cin >> n;
    vector<pii> vals;
    ll res = 0;
    ll mn = 1e15, mx = -1e15;
    ll mn2 = 1e15, mx2 = -1e15;
    for(int i=0;i<n;i++) {
        cin >> x >> y;
        vals.emplace_back(x, y);
        mn = min(x+y,mn);
        mx = max(x+y,mx);
        mn2 = min(x-y,mn2);
        mx2 = max(x-y,mx2);
    }
    cout << max(abs(mx-mn), abs(mx2-mn2));
}


Measured memory_bytes: 5284