akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repf(i, a, b) for(ll i = (a); i < (b) ; i++ )
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
double ans = 0;

int main()
{
ll w,h,x,y;
cin >> w>>h>>x>>y;
ll nu=0;

if(x*2==w&&y*2==h)nu=1;
ans=(double)w*h/2;

cout<<fixed<<setprecision(10)<<ans<<" "<<nu<<endl;
return 0;
}

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

#define lli long long
#define FOR(i,a,b) for (lli i=(a);i<(b);i++)
#define REP(i,n) for (lli i=0;i<(n);i++)
#define rep(i,n) for (lli i=0;i<(n);i++)

#define INF INT_MAX/3
#define PB push_back
#define pb push_back
#define all(a) (a).begin(),(a),end()
#define pll pair<lli,lli>

int main(){
  lli a,b;
  char op;

  while(1){
    cin>>a>>op>>b;
    if(op=='?')
      break;
    else if(op=='+')
      cout<<a+b<<endl;
    else if(op=='-')
      cout<<a-b<<endl;
    else if(op=='*')
      cout<<a*b<<endl;
    else if(op=='/')
      cout<<a/b<<endl;
    else{
      cout<<"error"<<endl;
      break;
    }
  }
  
  return 0;
}

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

const ll MAX = 2222;
ll MOD = 1e9 + 7;
ll nCk[MAX][MAX] = {};

void calc_init() {
  nCk[0][0] = 1;

  for (int i = 1; i < MAX; i++) {
    nCk[i][0] = 1;
    for (ll j = 1; j <= i; j++) {
      nCk[i][j] = (nCk[i - 1][j - 1] + nCk[i - 1][j]) % MOD;
    }
  }
}

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

  calc_init();

  ll S; cin >> S;  

  ll ans = 0;

  for (ll i = 1; i <= S; i++) {
    if (S - 3 * i < 0) break;
    ll temp = nCk[S - 2 * i - 1][i - 1];
    ans = (ans + temp) % MOD;
  }

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

Measured memory_bytes: 30788
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int x[N], y[N], path[N];
    for (int i = 0; i < N; i++)
    {
        cin >> x[i] >> y[i];
        path[i] = i;
    }
    double ans = 0;
    int num_path = 0;
    do
    {
        num_path++;
        double sum = 0;
        for (int i = 0; i < N - 1; i++)
        {
            sum += sqrt(pow(x[path[i]] - x[path[i + 1]], 2) + pow(y[path[i]] - y[path[i + 1]], 2));
        }
        ans += sum;
    } while (next_permutation(path, path + N));
    cout << setprecision(20) << ans / num_path << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
         
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
 
        final int n = sc.nextInt();
         
        for(int x = 1; x <= n; x++){
            if(x % 3 == 0 || (x + "").contains("3")){
                System.out.print(" " + x);
            }
        }

        System.out.println();
    
        }
 
}

Measured memory_bytes: 30104
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long ans = (long)Math.abs(n - 2) * Math.abs(m - 2);
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 22740
#include<iostream>
using namespace std;
int main(void){
  int a,b,c,t;
  cin>>a>>b>>c;
  if(a>b)t=a,a=b,b=t;
  if(b>c)t=b,b=c,c=t;
  if(a>b)t=a,a=b,b=t;
  cout<<a<<" "<<b<<" "<<c<<endl;
  return 0;
}


Measured memory_bytes: 3092
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vint x(n);
    REP(i,n){
        cin >> x[i];
    }
    int ans = INF;
    for(int i=1;i<=100;i++){
        int t=0;
        REP(j,n){
            t+=(x[j]-i)*(x[j]-i);
        }
        ans = min(ans,t);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
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;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}
ll dx[]={0, 0, -1, 1};
ll dy[]={1, -1, 0, 0};// up,down,left right

struct UnionFind {
    
    vector < int > node;
    UnionFind(int n) : node(n, -1) {}
    
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            if (node[y] < node[x]) swap(x, y);
            node[x] += node[y];
            node[y] = x;
        }
        return x != y;
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    int root(int x) {
        return node[x] < 0 ? x : node[x] = root(node[x]);
    }
    
    int size(int x) {
        return -node[root(x)];
    }
    
};
/*
 usage:
 
 初期化:
 UnionFind  UF(N);//ノードの数
 unite(x,y);// xとyノード連結
 same(a,b);// aとbが同じ所属かどうかを判別
 root(a); //aのルートのノードを計算
 */

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

    ll N, M;
    cin >> N >> M ;
    
    UnionFind UF(N);
    
    rep(i, M){
        ll A, B ;
        cin >> A >> B ;
        A --, B--;
        
        UF.unite(A, B);
    }
    
    vector<ll> cnt(N);
    
    ll ans = 0;
    
    rep(i, N){
        ll aim = UF.root(i);
        cnt[aim] ++;
    }
    
    rep(i, cnt.size()){
        ans = max(ans, cnt[i]) ;
    }
    cout << ans << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  string s,t; cin >> s >> t;
  s += s;
  int n = (int)t.size();
  bool ans = false;
  for(int i = 0; i < n; ++i){
    bool f = true;    
    for(int j = 0 ;j < n; ++j) if(s[i+j] != t[j]) f = false;
    ans |= f;
  }
  cout << (ans?"Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 256
import heapq
n,m = map(int,input().split())
A = [int(x) for x in input().split()]
A.sort(reverse=True)
A = list(map(lambda x: x*-1,A))
heapq.heapify(A)
while(m>0):
    m-=1
    num = heapq.heappop(A)
    if(num == 0):
        break
    num //= (-2)
    heapq.heappush(A,num*-1)

ans = list(map(lambda x: x*-1,A))
print(sum(ans))
    

Measured memory_bytes: 14180
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(f) (f).begin(),(f).end()
#define allr(f) (f).rbegin(),(f).rend()
const int mod = 1e9+7, A = 1e2+5;
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	char c;
  cin >> c;
  cout << ++c;
	
	return 0;
}


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

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(N: int, K: int):
    if N >= 2 * (K - 1) + 1:
        ret = YES
    else:
        ret = NO
    print(ret)
    return


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
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
n = gets.to_i
as = gets.split.map(&:to_i)

as_h = {}
as.each do |a|
  as_h[a] = as_h[a].to_i + 1
end

ans = as.sum

q = gets.to_i
q.times do |i|
  b, c = gets.split.map(&:to_i)

  if as_h[b]
    ans = ans - as_h[b] * b + as_h[b] * c
    as_h[c] = as_h[c].to_i + as_h[b]
    as_h.delete(b)
  end
  puts ans
end

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

#define MOD 1000000007
#define INF 1000000000

ll N;
map<ll, ll> A;

int main()
{
    cin >> N;
    REP(i, N) {
        ll a;
        scanf("%lld", &a);
        A[a]++;
    }
    ll ans = 0;
    for(auto a : A) {
        if(a.second % 2 != 0) { ans++; }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 6528
/*|-----------|
  | templatka |
  |  Tomasz   |
  |   Zyla    |
  |-----------|*/

#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define f first
#define s second

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tiii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef set<int> si;
typedef set<ll> sll;
typedef list<int> li;
typedef list<ll> lll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef map<string,int> msi;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
typedef unordered_map<string,int> umsi;
typedef queue<int> qi;
typedef queue<ll> qll;
typedef priority_queue<int> pqi;
typedef priority_queue<ll> pqll;

int tab[3][3];

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	for (int i = 0; i < 3; i ++)
	for(int j = 0; j < 3; j ++) cin >> tab[i][j];
	
	int q; cin>>q;
	
	while(q--) {
		int x; cin >>x;
		for (int i = 0; i < 3; i ++)
			for(int j = 0; j < 3; j ++)
				if(tab[i][j] == x) tab[i][j] = -1;
	}
	bool czy = false;
	if(tab[0][0] == -1 && tab[0][1] == -1 && tab[0][2] == -1) czy = true;
	if(tab[1][0] == -1 && tab[1][1] == -1 && tab[1][2] == -1) czy = true;
	if(tab[2][0] == -1 && tab[2][1] == -1 && tab[2][2] == -1) czy = true;
	if(tab[0][0] == -1 && tab[1][0] == -1 && tab[2][0] == -1) czy = true;
	if(tab[0][1] == -1 && tab[1][1] == -1 && tab[2][1] == -1) czy = true;
	if(tab[0][2] == -1 && tab[1][2] == -1 && tab[2][2] == -1) czy = true;
	if(tab[0][0] == -1 && tab[1][1] == -1 && tab[2][2] == -1) czy = true;
	if(tab[0][2] == -1 && tab[1][1] == -1 && tab[2][0] == -1) czy = true;
	
	if(czy) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}









Measured memory_bytes: 256
import collections


def solve():
    n = int(input())
    s = list(input() for _ in range(n))
    sets = [''.join(sorted(e)) for e in s]
    co = collections.Counter(sets)
    ans = 0
    for v in co.values():
        ans += v * (v - 1) // 2
    return ans


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 26840
#include "bits/stdc++.h"

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T>
using MaxHeap = priority_queue<T, vector<T>, less<T>>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline void input(vector<T> &vec) {
    for (auto &e: vec) {
        cin >> e;
    }
}

template <class T>
inline void input(vector<vector<T>> &mat) {
    for (auto &vec: mat) {
        input(vec);
    }
}

inline void print() { cout << "\n"; }
template <class Head, class... Tail>
inline void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << ' ';
    }
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &strm, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        strm << e << delim[&e == &vec.back()];
    }
    return strm;
}

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

template <class T>
inline bool chmax(T &a, const T &b) noexcept {
    return b > a && (a = b, true);
}

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

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// }}}

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

    var(intmax_t, X, Y);

    size_t res = 0;
    while (X <= Y) {
        res++;
        X *= 2;
    }

    print(res);

    return 0;
}

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

int main(){
	int Q;
	cin>>Q;
	for(int i=0;i<Q;i++){
		int c,a,n;
		cin>>c>>a>>n;
		int can=min(min(c,a),n);
		c-=can;
		a-=can;
		int cca=min(c/2,a);
		c-=cca*2;
		int ccc=c/3;
		cout<<can+cca+ccc<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3056
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc137/tasks/abc137_c>
 問題文============================================================
 =================================================================
 解説=============================================================
 入力文字列をソートすれば、アナグラムで同じ文字列になるものがわかる
 あとはmapとかを使って数え上げ
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int N; cin >> N;
    map<string,ll> mp;
    vector<string> s(N);
    for(int i = 0; i < N;i++){
        cin >> s[i];
        sort(s[i].begin(),s[i].end());
        mp[s[i]]++;
    }
    for(int i = 0; i < N;i++){
        res += mp[s[i]]-1;
    }
    res/=2;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 16640
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;

int main(){

	ll k, a, b;
	cin >> k >> a >> b;
	b*=-1;
	if(k<=a){
		cout << 1 << endl;
		return 0;
	}
	if(a+b<=0){
		cout << -1 << endl;
	} else {
		cout << (k+b-1)/(a+b)*2+1 << endl;
	}
	
	return 0;
}


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

struct flower {
	int h;
	bool w;
} f[110];

int N, h[110];
int cnt = 0;
int el;
int er;

void water(int l, int r, int n) {
	cnt += n;
	for (int i = l; i <= r; i++) {
		for (int j = 1; j <= n; j++) {
			f[i].h += 1;
			if (f[i].h == h[i]) f[i].w = true;
		}
	}
}

void findFree(int l, int r) {
	el = -1;
	er = -1;
	int maxLen = 0;
	for (int i = l; i <= r; i++) {
		for (int j = 0; i+j <= r; j++) {
			if (f[i].w || f[i+j].w) break;
			else {
				if (j >= maxLen) {
					maxLen = j;
					el = i;
					er = i + j;
				}
			}
		}
	}
}

int HMin(int l, int r) {
	int Min = h[l];
	for (int i = l + 1; i <= r; i++) {
		if (h[i] < Min)	 Min = h[i];
	}
	return Min;
}

int FMin(int l, int r) {
	int Min = f[l].h;
	for (int i = l + 1; i <= r; i++) {
		if (f[i].h < Min) Min = f[i].h;
	}
	return Min;
}

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> h[i];
		if (h[i] == 0) f[i].w = true;
		else f[i].w = false;
	}
	while (true) {
		findFree(1, N);
		if (el == -1 && er == -1) {
			cout << cnt << endl;
			return 0;
		}
		else {
			water(el, er, HMin(el, er) - FMin(el, er));
		}
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>

using namespace std;
typedef long long ll;

int N, K;
int x[60];
int y[60];
int c[60];

const double ep = 0.00000001;

bool IsEnoughTime(double t){
	for(int i = 0; i < N; i++){
		for(int j = i; j < N; j++){
			double xd = x[j]-x[i];
			double yd = y[j]-y[i];
			double r1 = t/c[i];
			double r2 = t/c[j];
			
			if(i == j){
				int count1 = 0;
				double X1 = x[i];
				double Y1 = y[i];
				
				for(int k = 0; k < N; k++){
					double rk = t / c[k];

					if((X1-x[k])*(X1-x[k]) + (Y1-y[k])*(Y1-y[k]) < rk*rk + ep){
						count1++;
					}
				}
				if(count1 >= K){
					return true;
				}
			}
			else if(xd*xd+yd*yd <= ((r1+r2)*(r1+r2)) && xd*xd+yd*yd >= (r1-r2)*(r1-r2)){
				//円i, 円j の交点を求める
				double a = (xd*xd + yd*yd + r1*r1-r2*r2)/2;
				double X1 = x[i] + (a*xd + yd * sqrt((xd*xd+yd*yd)*r1*r1-a*a))/(xd*xd+yd*yd);
				double Y1 = y[i] + (a*yd - xd * sqrt((xd*xd+yd*yd)*r1*r1-a*a))/(xd*xd+yd*yd);
				double X2 = x[i] + (a*xd - yd * sqrt((xd*xd+yd*yd)*r1*r1-a*a))/(xd*xd+yd*yd);
				double Y2 = y[i] + (a*yd + xd * sqrt((xd*xd+yd*yd)*r1*r1-a*a))/(xd*xd+yd*yd);
				
				int count1 = 0;
				int count2 = 0;
				for(int k = 0; k < N; k++){
					double rk = t / c[k];
					if((X1-x[k])*(X1-x[k]) + (Y1-y[k])*(Y1-y[k]) < rk*rk + ep){
						count1++;
					}
					if((X2-x[k])*(X2-x[k]) + (Y2-y[k])*(Y2-y[k]) < rk*rk + ep){
						count2++;
					}
				}
				if(count1 >= K || count2 >= K){
					return true;
				}
			}
		}
	}
	
	return false;
}

int main()
{
	scanf("%d %d", &N, &K);
	for(int i = 0; i < N; i++){
		scanf("%d %d %d", &x[i], &y[i], &c[i]);
	}
	
	double min = 0;
	double max = 2000*2000*100*100;
	
	while(max-min > ep){
		// printf("min %f max %f\n", min, max);
		double mid = min + (max-min)/2;
		if(IsEnoughTime(mid)){
			max = mid;
		}
		else{
			min = mid;
		}
	}
	
	printf("%.8f\n", min);
	
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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 main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = 1e9;
    for(int i = -100; i <= 100; ++i){
        int score = 0;
        rep(j,n){
            score += (i - a[j])*(i - a[j]);
        }
        chmin(ans, score);
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <set>
using namespace std;
int main(void){
    int n, m;
    cin >> n >> m;
    string ans = "No";
    if(n == m){
        ans = "Yes";
    }
    cout << ans << endl;
}


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

using namespace std;


int main(void){
    long long int a, b, c;
    cin >> a >> b >> c;
    if(a%2==0 || b%2==0 || c%2==0) {
        cout << 0 << endl;
        return 0;
    }
    if(a > b) {
        if(a > c) {
            cout << b*c << endl;
        }else {
            cout << a*b << endl;
        }
    }else {
        if(b > c) {
            cout << a*c << endl;
        }else {
            cout << a*b << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long 
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1<<(x))
#define inf 1000000000
#define MOD 1000000007 
#define N 200005
#define M 1000003
#define MAX 2000000
#define LOG 20
#define KOK 300
#define EPS 0.0000001
using namespace std;

struct query {

	ll l,r,num;

};

int main() {

	ll n;

	scanf("%lld",&n);

	vector<query> v;

	for(ll i=1;i*i<n;i++) {

		ll l=n/(i+1)+1;
		ll r=n/i;

		v.pb({l,r,n-i});

	}

	reverse(all(v));

	ll ans=0;

	for(ll i=1;i*i<n;i++) {

		ll mod=v[0].num%i;

		ll beg=(mod?i-mod:0);

		for(ll j=beg;j<sz(v);j+=i) {

			if(i*i<	v[j].num) {

				ll ot=v[j].num/i;

				if(i>=v[j].l && i<=v[j].r) ans+=i;
				if(ot>=v[j].l && ot<=v[j].r && ot!=i) ans+=ot;

			}

		}

	}

	printf("%lld",ans);

} 

Measured memory_bytes: 26984
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<vector>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}
/*

 */
int n, h[20];
int main()
{
  cin >> n;
  int ans = 0;
  for (size_t i = 0; i < n; i++)
  {
    cin >> h[i];
    bool f = true;
    for (size_t j = 0; j < i; j++)
    {
      if (h[j]>h[i]) {
        f = false;
      }

    }
    if (f)
    {
      ans++;
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			int n = sc.nextInt();
			if(n == 0)break;
			calc(n);
		}
	}
	
	public void calc(int n){
		int x[] = new int[n];
		int y[] = new int[n];
		x[0] = 0; y[0] = 0;
		int ue = 0;
		int shita = 0;
		int hidari = 0;
		int migi = 0;
		
		for(int i = 1; i < n; i++){
			int ni = sc.nextInt();
			int di = sc.nextInt();
			if(di == 0){
				x[i] = x[ni] - 1;
				y[i] = y[ni];
				if(x[i] < hidari) hidari = x[i];
			}
			else if(di == 1){
				x[i] = x[ni];
				y[i] = y[ni] - 1;
				if(y[i] < shita) shita = y[i];
			}
			else if(di == 2){
				x[i] = x[ni] + 1;
				y[i] = y[ni];
				if(x[i] > migi) migi = x[i];
			}
			else if(di == 3){
				x[i] = x[ni];
				y[i] = y[ni] + 1;
				if(y[i] > ue) ue = y[i];
			}
		}
		
		System.out.print(migi - hidari + 1);
		System.out.print(" ");
		System.out.println(ue - shita + 1);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

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

    vector<char> C(6);

    for(int i = 0; i < 6; i++) cin >> C[i];

    for(int i = 0; i < 3; i++) {
        if(C[i] != C[5 - i]) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <fstream>

#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) {
    if(b==0) return a;
    else return GCD(b, a%b);
}

ll LCM(ll a, ll b) {
    return a/GCD(a,b)*b;
}

class B3 {
public:
	void solve(std::istream& in, std::ostream& out) {
        string sa,sb,sc;in>>sa>>sb>>sc;
        char p = 'a';
        string test = "a";
        while(1){
            if(p=='a'){
                if(sa.size()==0){
                    out<<'A'<<endl;
                    return;
                }
                p=sa.at(0);
                sa=sa.substr(1);
            } else if(p=='b'){
                if(sb.size()==0){
                    out<<'B'<<endl;
                    return;
                }
                p=sb.at(0);
                sb=sb.substr(1);
            } else {
                if(sc.size()==0){
                    out<<'C'<<endl;
                    return;
                }
                p=sc.at(0);
                sc=sc.substr(1);
            }

        }
	}
};


int main() {
	B3 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll m,n;
pair<ll,ll> p[1000005];
vector<pair<ll,ll> > v;

int main()
{
    while(cin>>n>>m)
    {
        v.clear();
        for(ll i=0;i<n;i++)
        {
            cin>>p[i].first>>p[i].second;
            v.push_back(p[i]);
        }
        sort(v.begin(),v.end());
        ll sum=0;
        for(ll i=0;i<n;i++)
        {
            ll num=v[i].second;
            ll price=v[i].first;
            if(num<=m)
            {
                sum+=price*num;
                m=m-num;
            }
            else
            {
                sum+=price*m;
                m=0;
                break;
            }
        }
        cout<<sum<<"\n";

    }
}


Measured memory_bytes: 3444
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

int main()
{
	ll s;
	cin >> s;

	ll x, y;
	x = (inf - (s % inf)) % inf;
	y = (s + x) / inf;

	cout << "0 0 1000000000 1 " << x << " " << y << endl;
}

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

ll solve() {
    ll N;
    cin >> N;
    vector<ll> ws;
    ws.push_back(1);
    ll k = 6;
    while ( k <= N ) {
        ws.push_back(k);
        k *= 6;
    }
    k = 9;
    while ( k <= N ) {
        ws.push_back(k);
        k *= 9;
    }
    vector<ll> dp(N+1, 1000);
    dp[0] = 0;
    for ( int i = 1; i <= N; i++ ) {
        for ( ll w : ws ) {
            ll pp = i - w;
            if ( pp >= 0 ) {
                dp[i] = min(dp[i], dp[pp] + 1);
            }
        }
    }
    return dp[N];
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
import math

def solve(h):
    devide = math.floor(math.log2(h))
    if h == 1:
        return 1

    if devide == 1:
        return 3
    if devide >= 2:
        num_of_ones = 2 ** devide


        return num_of_ones + sum_of_touhi(devide,1,2)

def sum_of_touhi(n,a,r):
    return ((a * ((r ** n) - 1)) // (r - 1))




def main():
    h = int(input())
    print(solve(h))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    char a,b;
    cin >> a >> b;
    if(a == b) {
        puts("=");
        return 0;
    }
    if(int(a) > int(b)) puts(">");
    else puts("<");
    
}

Measured memory_bytes: 256
import bisect
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
b=[a[0]]
for i in range(1,n):
  b.append(b[i-1]+a[i])
if sum(a)==x:
  print(n)
elif sum(a)<x:
  print(n-1)
else:
  print(bisect.bisect(b,x))


Measured memory_bytes: 3060
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)


int main(){ FastIO;

int i,n;cin>>n;
int a[n],b[n];
for(i=0;i<n;i++)
{
	cin>>a[i];b[i]=a[i];
}
sort(b,b+n,greater<int>());
for(i=0;i<n;i++)
{
	if(a[i]!=b[0]) cout<<b[0]<<endl;
	else cout<<b[1]<<endl;
}


return 0;
}


Measured memory_bytes: 3200
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) { cin >> A[i]; }

    ll cnt = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            for (int k = j + 1; k < N; k++) {
                if (A[i] != A[j] && A[j] != A[k] && A[i] != A[k] &&
                    A[i] + A[j] > A[k] && A[i] + A[k] > A[j] &&
                    A[j] + A[k] > A[i])
                    cnt++;
            }
        }
    }

    cout << cnt << endl;
    return 0;
}

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

using namespace std;

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

    double ans = 0;

    if (n >= k)
    {
        ans += double(n + 1 - k) / n;
        for (auto i = 1; i < k; i++)
        {
            int i_copy = i;
            int sum = 0;
            while (i_copy < k)
            {
                i_copy *= 2;
                sum += 1;
            }

            ans += double(1) / n * pow(0.5, sum);
        }
    }
    else
    {

        for (auto i = 1; i < n+1; i++)
        {
            int i_copy = i;
            int sum = 0;
            while (i_copy < k)
            {
                i_copy *= 2;
                sum += 1;
            }

            ans += double(1) / n * pow(0.5, sum);
        }
    }

    cout << setprecision(15)  << ans << endl;
}

Measured memory_bytes: 892
//submitted by Himj
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;

const int mxn=3e3+1;
ll arr[mxn],dp[mxn][mxn];
ll solve(int i,int j)
{
  if(i>j)
    return 0;
  if(dp[i][j]!=1e18)
    return dp[i][j];
  return dp[i][j]=max(arr[i]-solve(i+1,j),arr[j]-solve(i,j-1));
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

  int t=1;
  //cin>>t;
    while(t--){
      int i,j;
      int n;
      cin>>n;
      fr(i,0,n)
      cin>>arr[i];
      fr(i,0,n)
      {
        fr(j,0,n)
        dp[i][j]=1e18;
      }
      ll ans=solve(0,n-1);
      cout<<ans;
      
       
    }
  return 0;
  }



Measured memory_bytes: 70784
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
 
using namespace std;
 
#define int long long
//typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int n,a[100000],res = 0,cnt[2][100000] = {};
	int pos = 0;
	cin >> n;
	cnt[0][n - 1] = 1;
	cnt[1][n - 1] = 1;
	for(int i = 0;i < n;i++) cin >> a[i];
	for(int i = n - 2;i >= 0;i--){
		if(a[i] <= a[i + 1]) cnt[0][i] = cnt[0][i + 1] + 1;
		else cnt[0][i] = 1;
		if(a[i + 1] <= a[i]) cnt[1][i] = cnt[1][i + 1] + 1;
		else cnt[1][i] = 1;
	}
	for(;pos < n;res++){
		if(cnt[0][pos] > cnt[1][pos]) pos += cnt[0][pos];
		else pos += cnt[1][pos];
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
string a;bool flag;
int main()
{
	cin>>a;
	for(int i=0;i<a.size();i++)
	{
		if(a[i]=='C')flag=true;
		if(a[i]=='F')
			if(flag)puts("Yes"),exit(0);
			else continue;
	}
	puts("No");return 0;
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
v = [x for x in input().split()]
if len(set(v)) == 1:
  print(len(v)//2)
  exit()
v_even = Counter(v[::2])
v_odd = Counter(v[1::2])
v_even_mc = v_even.most_common()
v_odd_mc = v_odd.most_common()

if v_even_mc[0] != v_odd_mc[0]:
  ans = (len(v)//2 - v_even_mc[0][1]) + (len(v)//2 - v_odd_mc[0][1])
else:  
  ans_e = (len(v)//2 - v_even_mc[0][1]) + (len(v)//2 - v_odd_mc[1][1])
  ans_o = (len(v)//2 - v_even_mc[1][1]) + (len(v)//2 - v_odd_mc[0][1])
  ans = min(ans_e, ans_o)
print(ans)

Measured memory_bytes: 25564
# ABC098B - Cut and Count
def main():
    n = int(input())
    s = input()
    cnt = 0
    for i in range(1, n):
        l, r = set(s[:i]), set(s[i:])
        cnt = max(cnt, len(l & r))
    print(cnt)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
using namespace std;
using ll=long long;
//using R=double;

const int INF = 10000000;
typedef pair<int, int> p;

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

ll lcm(ll a, ll b){
    ll g = gcd(a,b);
    return (a/g) * b;
}

int main(){
	int N,M;
    cin >> N >> M;
    string S,T;
    cin >> S >> T;

    ll L = lcm(N,M);

    int g = gcd(N,M);

    string new_S, new_T;

    for(int i = 0; i < g; i++){
        if(S[i*N/g] != T[i*M/g]){
            cout << -1 << endl;
            return 0;
        }
    }

    cout << L << endl;
    return 0;
}


Measured memory_bytes: 512
while True:
   n = int(input())
   if n == 0:
      break

   s = list(map(int, input().split()))
   
   m = sum(s) / n
   a = 0
   for i in range(n):
      a += (s[i] - m) ** 2
   
   ans = (a / n) ** 0.5
   print(ans)



Measured memory_bytes: 5664
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
int32_t main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	int h,a;
	cin >> h >> a;
	cout << h/a+(h%a!=0);
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M= sc.nextInt();
        int res;

        if(N==M){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
        
        
        }
    }

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

int main(){
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  if(k<a){
    cout << k;
  }
  else if(a+b>k){
    cout << a;
  }
  else {
    cout << a-(k-a-b);
  }
  return 0;
}
  
    

Measured memory_bytes: 3644
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

const LL inf = 112345678;
LL N, M, ans;
std::vector<std::vector<LL>>dist;

void warshall_floyd(LL V)
{
	for (LL k = 1; k <= V; ++k)
	{
		for (LL i = 1; i <= V; ++i)
		{
			for (LL j = 1; j <= V; ++j)
			{
				dist[i][j] = std::min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
}

int main()
{
	in >> N >> M;
	std::vector<LL>a(M), b(M), c(M);
	dist.resize(N + 1);
	rep(i, dist.size()) dist[i].resize(N + 1);
	rep(i, N) rep(j, N) dist[i + 1][j + 1] = (i == j ? 0 : inf);
	rep(i, M)
	{
		in >> a[i] >> b[i] >> c[i];
		dist[a[i]][b[i]] = dist[b[i]][a[i]] = c[i];
	}
	warshall_floyd(N);
	rep(i, M)
	{
		bool flag = false;
		rep(j, N)
		{
			if (dist[j + 1][a[i]] + c[i] == dist[j + 1][b[i]] || dist[j + 1][b[i]] + c[i] == dist[j + 1][a[i]])
			{
				flag = true;
				break;
			}
		}
		if (!flag) ++ans;
	}
	out << ans << std::endl;
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 998244353LL
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;


class numberTheory{

public:
    numberTheory(){}

    pii extendedEuclid(i64 a, i64 b) { // returns x, y | ax + by = gcd(a,b)

        if(b == 0) return pii( a >= 0 ? 1 : -1 , 0LL);
        else {
            pii d = extendedEuclid(b, a % b);
            return pii(d.yy, d.xx - d.yy * (a / b));
        }

    }

    i64 modularInverse(i64 a, i64 n) {
        pair<i64,i64> ret = extendedEuclid(a, n);
        return ((ret.xx % n) + n) % n;
    }


    i64 bigMod(i64 a, i64 n , i64 m)
    {
        if(n==0) return 1 ;
        i64 ret = bigMod(a,n/2,m) ;
        ret = (ret*ret)%m ;
        if(n%2) ret = (ret*a)%m ;
        return ret ;
    }
};

const i64 N = 100000 ;

i64 fact[N+5] , invFact[N+5] ;

i64 C(i64 n, i64 r)
{
    if( n<0 || r<0 || r>n ) return 0 ;
    i64 ret = (fact[n]*invFact[r])%mod ;
    return (ret*invFact[n-r])%mod ;
}

void preprocess()
{
    numberTheory nt ;

    fact[0] = 1 ;
    for(i64 x=1 ; x<=N ; x++) fact[x] = (fact[x-1]*x)%mod ;

    invFact[N] = nt.modularInverse(fact[N],mod) ;

    for(i64 x=N-1 ; x>=0 ; x--) invFact[x] = (invFact[x+1]*(x+1) )%mod ;
}

i64 used[3005] ;
i64 dp[3005][3005] ;

int main()
{
    preprocess() ;

    int n , x ;
    scanf("%d %d",&n,&x) ;

    for(int i=0 ; i<=n ; i++)
    {
        used[i] = C(n,i) ;
    }

    i64 ans = 1 ; //all zeroes

    for(int var=1 ; var<=n ; var++)
    {
        for(int sum=var ; sum<x ; sum++)
        {
            ans += (C(var , sum-var )*used[var]) ;
            ans%= mod ;
        }
    }

    if( x%2==1 )
    {
        for(int i=x+1 ; i<=2*n ; i+=2) ans = ( ans + used[i/2] )%mod ;
    }

    for(int i=1 ; i<=n ; i++) used[i] = ( used[i] + used[i-1] )%mod ;

    for(int i=1 ; i<=n ; i++)
    {
        int sum = ( (x-1) - ( 2*(i-1) + 1 ) ) ;

        if( sum < 0  ) continue ;

        for(int j=0 ; j<=sum && i+j<=n ; j++ )
        {
            dp[i][j+i] = ( dp[i][j+i] + C( j , sum-j ) )%mod ;
        }
    }

    for(int i=1 ; i<=n ; i++)
    {
        for(int j=1 ; j<=n ; j++)
        {
            if( dp[i][j]==0 ) continue ;
            int lim = min( i-1 , n-j ) ;
            ans = ( ans + dp[i][j]*( used[j+lim] - used[j] ) )%mod ;
        }
    }

    ans = ( ans%mod + mod )%mod ;

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

    return 0 ;
}


Measured memory_bytes: 72320
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

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

  int n; cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];

  sort(all(a));
  int left = a[n-1], right = a[0];
  vpi ans;

  rep2(i, 1, n-2) {
    if (a[i] < 0) {
      ans.eb(left, a[i]);
      left -= a[i];
    } else {
      ans.eb(right, a[i]);
      right -= a[i];
    }
  }

  cout << left - right << endl;
  for (auto p : ans) cout << p.fi << " " << p.se << endl;
  cout << left << " " << right << endl;

  return (0);
}


Measured memory_bytes: 4612
#include <stdio.h>

int temp[100001];

void MergeSort(int x[],int left,int right);


int main(void){
  int N,i,tmp=0;
  long long int sum=0;
  int A[100001];
  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);
  MergeSort(A,0,N-1);
  for(i=0;i<N-1;i++){
    sum+=A[i];
    if(sum*2 < A[i+1]){
      tmp=i+1;
      //printf("%d\n",tmp);
    }
  }
  printf("%d\n",N-tmp);
}

void MergeSort(int x[],int left,int right){
  int mid,i,j,k;
  if(left >= right) return;
  mid = (left+right)/2;
  MergeSort(x,left,mid);
  MergeSort(x,mid+1,right);

  for(i=left;i<=mid;i++) temp[i] = x[i];
  for(i=mid+1,j=right;i<=right;i++,j--) temp[i]=x[j];

  i=left;
  j=right;

  for(k=left;k<=right;k++){
    if(temp[i] <= temp[j]) x[k] = temp[i++];
    else x[k] = temp[j--];
  }
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
int a,b,c;
cin >> a >> b >> c;
if (a+b>=c) cout << "Yes" << endl;
else cout << "No" << endl;
}


Measured memory_bytes: 256