akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define INF 1000000000007

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

void solve()
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll i, j, k;
    ll res = 0;
    set<pll> s1, s2, s3;
    set<ll > ss1,ss2,ss3;
    ll cr = 0, cg = 0, cb = 0;
    for (i = 0; i < n; i++)
    {
        if (s[i] == 'R')
        {
            cr++;
            ss1.insert(i);
            s1.insert(mp(i,cr));
        }
        if (s[i] == 'G')
        {
            cg++;
            ss2.insert(i);
            s2.insert(mp(i,cg));
        }
        if (s[i] == 'B')
        {
            cb++;
            ss3.insert(i);
            s3.insert(mp(i,cb));
        }
    }
    for (i = 0; i < n; i++)
    {
        for (j = i + 1; j < n; j++)
        {
            if (s[i] == s[j])
                continue;

            string ss ="";
            ss+=s[i];
            ss+=s[j];
            sort(all(ss));
            if (ss == "BG")
            {
                auto it = s1.lower_bound(mp(j,-INF));
                if (it != s1.end())
                {
                    res += (cr-it->second+1);
                    // auto itt=s1.find((i+k)/2);
                    
                }
                if(ss1.find(2*j-i)!=ss1.end())
                {
                    res--;
                }
            }
            else if (ss == "BR")
            {
                auto it = s2.lower_bound(mp(j,-INF));
                if (it != s2.end())
                {
                    res += (cg-it->second+1);
                }
                 if(ss2.find(2*j-i)!=ss2.end())
                {
                    res--;
                }
            }
            else
            {
                // cout<<"here\n";
                auto it = s3.lower_bound(mp(j,-INF));
                if (it != s3.end())
                {
                    res += (cb-it->second+1);
                }
                // cout<<2*j-i<<"\n";
               if(ss3.find(2*j-i)!=ss3.end())
                {
                    res--;
                }
            }
        }
        // cout<<res<<" "<<i<<"\n";
    }
    cout << res << "\n";
}

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

    if (fopen("input.txt", "r"))
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    cout << setprecision(20);

    ll t = 1;

    // cin>>t;

    while (t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

const int MAX = 1000000;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int a = x / 100;
    int b = x % 100;
    if(b <= a * 5) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
s=list(input())
v=0
for st in s:
    if st=="+":
        v+=1
    else:
        v-=1
print(v)


Measured memory_bytes: 8960
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <cctype>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define Decimal fixed << setprecision(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}
constexpr int INF = 1 << 30 - 1;
constexpr long long LLINF = 1LL << 60;
constexpr long long MOD = 1000000007;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, tuple<ll, ll, ll>> Data;


int di[] = {1, 0, 0};
int dj[] = {0, 1, 0};
int dk[] = {0, 0, 1};

int main()
{
  ll X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  vector<ll> A(X), B(Y), C(Z);
  REP(i, X) cin >> A[i];
  REP(i, Y) cin >> B[i];
  REP(i, Z) cin >> C[i];
  sort(ALL(A), greater<ll>());
  sort(ALL(B), greater<ll>());
  sort(ALL(C), greater<ll>());

  set<Data> used;
  priority_queue<Data> pq;
  auto s = make_pair(A[0] + B[0] + C[0], make_tuple(0, 0, 0));
  pq.push(s);
  used.insert(s);
  REP(cnt, K) {
    auto tmp = pq.top(); pq.pop();
    auto ans = tmp.first;
    auto idxs = tmp.second;
    cout << ans << endl;
    REP(d, 3) {
      ll sum, ni, nj, nk;
      ni = get<0>(idxs) + di[d];
      nj = get<1>(idxs) + dj[d];
      nk = get<2>(idxs) + dk[d];
      if (ni >= X || nj >= Y || nk >= Z) continue;
      sum = A[ni] + B[nj] + C[nk];
      auto tmp = make_pair(sum, make_tuple(ni, nj, nk));
      if (used.find(tmp) == used.end()) {
        used.insert(tmp);
        pq.push(tmp);
      }
    }
  }
  return 0;
}


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N, C, K;
	vector<llong> T;

	cin >> N >> C >> K;
	T.resize(N);
	for(int i = 0; i < N; i++)
		cin >> T[i];
	sort(BE(T));

	llong id = 0;
	llong ans = 0;
	for(int i = 0; i < N; i++){
		if(T[id]+ K < T[i]){
			ans++;
			id = i;
		}else if(i-id+1 == C){
			ans++;
			id = i+1;
		}
	}
	if(id < N)
		ans++;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
//#pragma GCC target ("avx2,tune=native")
#include<bits/stdc++.h>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv1(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
template<typename a, typename b>
void minq(a& x, b y) {
	if (x > y)
		x = y;
}
template<typename a, typename b>
void maxq(a& x, b y) {
	if (x < y)
		x = y;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef ll _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
//WHEN DOING MODULAR SUBTRACTION ALWAYS **ALWAYS** ADD MOD
//don't use AVX at AtCoder
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
	doin();
	ll n, c;
	vpi info;
	cin >> n >> c;
	getv(info, n);
	ll cur = 0, ans = 0, p[100100], s[100100];
	for(int i = 0; i < n; i++) {
		p[i] = (i?p[i-1]:0)+info[i].second;
	}
	for(int i = 0; i < n; i++) {
		p[i] = max(p[i]-info[i].first, i?p[i-1]:LLONG_MIN);
	}
	for(int i = n-1; i>=0; i--) {
		s[i] = (i+1<n?s[i+1]:0)+info[i].second;
	}
	for(int i = n-1; i>=0; i--) {
		s[i] = max(s[i]-c+info[i].first, i+1<n?s[i+1]:LLONG_MIN);
	}
	ans = max({0ll, s[0], p[n-1]});
	for(int i = 0; i+1 < n; i++)
		maxq(ans, p[i]+s[i+1]-min(info[i].first, c-info[i+1].first));
	cout << ans;
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0 ;i < N; i++) cin >> A[i];
  set<int> st;
  for (int i = 0; i < N; i++) {
    st.insert(A[i]);
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,count,ans=0;
  cin >> n;
  char c[110];
  for(int i=0; i<n; i++){
    cin >> c[i];
  }
  for(int d=1; d<=n; d++){
  count=0;
  for(int i=0; i<d; i++){
    for(int j=d; j<n; j++){
      if(c[i]==c[j]){
        count++;
        for(int k=i+1; k<d; k++){
          if(c[i]==c[k]) c[k]='A';
        }
        break;
      }
    }
  }
  ans = max(count,ans);
}
  /*for(int i=0; i<n/2; i++) cout << c[i];
  cout << endl;
  for(int i=n/2; i<n; i++) cout << c[i];
 */
  cout << ans << endl;
  return 0;

}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = 0;
        String s = sc.nextLine();
        for (Character c : s.toCharArray()) {
            if (c == '+') a++;
            else a--;
        }
        System.out.println(a);
    }
}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int & x : a)
        cin >> x;
    vector<ll> dp(n);
    dp[0] = 1000;
    for (int i = 0; i < n; ++i) {
        //cerr << i << ' ' << dp[i]<<endl;
        for (int j = i + 1; j < n; ++j) {
            dp[j] = max(dp[j], dp[i]);
            if (a[j] > a[i]) {
                ll q = dp[i] / a[i], r = dp[i] % a[i];
                //cerr << "q, r , w " << q << ' ' << r << ' ' << q * (a[j]) + r << endl;
                dp[j] = max(dp[j], q * a[j] + r);
            }
        }
    }
    cout << dp[n - 1] << endl;
}


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

int main(void){
    int L ,R ,d;
    cin >> L >> R >> d;
    
    int rslt = 0;
    rslt += R/d - L/d;
    if(L%d == 0) rslt++;
    
    if(R == L) rslt = 1;
    
    cout << rslt;
    
}


Measured memory_bytes: 3588
from collections import Counter
N = input()
D = Counter([i for i in input().split()])
M = input()
T = Counter([i for i in input().split()])
for key, value in T.items():
    try:
        if D[key] < value:
            print("NO")
            break
    except:
        print("NO")
        break
else:
    print("YES")

Measured memory_bytes: 67416
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair

#define all(x) (x).begin(),(x).end()
#define FOR(x) for(ll i = 0;i < x;++i)

using namespace std;
typedef long long ll;

int main() {
	int N;
	cin >> N;
	int money;
	cin >> money;
	int ans;
	if (N >= 13) { ans = money; }
	else if (N >= 6) { ans = money / 2; }
	else ans = 0;
	cout << ans;


	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#include "string"
#define endl '\n'
#define ff first
#define pi pair<int,int>
#define ss second
#define int long long 
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr)

int32_t main() { 
    boost;
 
    string s;
    cin>>s;
    if(s[0]=='7' or s[1]=='7' or s[2]=='7')
    	cout<<"Yes"<<endl;
    else
    	cout<<"No"<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	if(n==3||n==5||n==7) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	int i,n;cin>>n;
	vector<tuple<int,int,int>>blo(n);
	for(i=0;i<n;i++){
		int w,s,v;cin>>w>>s>>v;
		blo[i]=mt(w+s,w,v);
	}
	SO(blo);
	static llint dp[20001]={0};
	for(auto it:blo){
		int s,w,v;tie(s,w,v)=it;
		for(i=s;i>=w;i--){maxeq(dp[i],dp[i-w]+v);}
	}
	llint ans=0;
	for(i=0;i<=20000;i++){maxeq(ans,dp[i]);}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        K: i64,
        xy: [(i64,i64);n],
    }
    let mut x = vec![];
    let mut y = vec![];
    
    for i in 0..n{
        x.push(xy[i].0);
        y.push(xy[i].1);
    }
    x.sort();
    y.sort();
    let mut ans:i64 = (x[n-1] - x[0])*(y[n-1] - y[0]);
    for i in 0..n {
        for j in 0..n {
            for k in 0..n {
                for l in 0..n {
                    if i==j || k==l {
                        continue;
                    }
                    let x1:i64 = x[i];
                    let x2:i64 = x[j];
                    let y1:i64 = y[k];
                    let y2:i64 = y[l];
                    let mut dot:i64 = 0;
                    for m in 0..n {
                        if x1 <= xy[m].0 && xy[m].0 <= x2 && y1 <= xy[m].1 && xy[m].1 <=y2 {
                            dot+=1;
                        }
                    }
                    if dot >= K {
                        ans = std::cmp::min(ans, (x2-x1)*(y2-y1));
                    }
                }
            }   
        }
    }
    println!("{}", ans);
}

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

int main(){
    string N;
    cin >> N;
    int l = N.size();
    vector <int> n(l);
    for (int i=0; i<l; ++i){
        n.at(i) = N.at(i) - '0';
    }
    int sum = 0;
    for (int i=0; i<l; ++i){
        sum += n.at(i);
    }
    if (sum % 9 == 0) cout<< "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 4428
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
using namespace std;

int main(void){
    int n,k;
    cin >> n >> k;
    double ans = 0;
    for(int i = 1;i <= n;i++){
        int cnt = 0;
        double tmp = i;
        while(tmp < k){
            tmp *= 2;
            cnt++;
        }
        ans += 1/pow(2,cnt);
    }
    ans /= n;
    cout << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/*
  AtCoder Beginner Contest 078
  D - ABS

  方針
    最後に引いたカードが最終的なスコアになる。
    
    N >= 2 の場合は、Xさんが初手で行うべき操作は以下の2通りのみである。
    (1) すべてのカードを引く
    (2) 1枚だけ残してカードを引く

    なぜならば、Xさんはできるだけスコアを大きくしたいため、中途半端なと
    ころまでカードを引いてしまった場合、Yさんにスコアを小さくするように
    されてしまう可能性があるからです。

  実装
    上述の方針より、Xさんの行うべき2つのパターンのうち、スコアが大きく
    なる方をXさんが選択すればよい。
*/

#include<iostream>
#include<cmath>
#include<vector>
using namespace std;

int N, Z, W;
vector<int> a;

int main() {
  scanf("%d %d %d", &N, &Z, &W);
  a = vector<int>(N+1);
  for (int i = 1; i <= N; ++i) scanf("%d", &a[i]);

  if (N == 1) printf("%d\n", abs(a[1] - W));
  else printf("%d\n", max(abs(a[N] - W), abs(a[N] - a[N-1])));
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;cin >> n;
    vvl s(n,vl(n));
    rep(i,n)rep(j,n){
        char a;cin >> a;s[i][j]=a-'0';
    }
    vvl g(n);
    rep(i,n){
        rep(j,n){
            if(s[i][j]){
                g[i].pb(j);
            }
        }
    }
    ll ans=-1;
    rep(i,n){
        queue<ll> que;
        que.push(i);
        vl dist(n,-1);
        dist[i]=1;
        while(!que.empty()){
            ll v=que.front();
            que.pop();
            for(auto nv:g[v]){
                if(dist[nv]!=-1)continue;
                dist[nv]=dist[v]+1;
                que.push(nv);
            }
        }
        bool check=true;
        rep(j,n){
            rep(k,n){
                if(s[j][k]){
                    if(abs(dist[j]-dist[k])!=1)check=false;
                }
            }
        }
        if(check){
            rep(j,n)chmax(ans,dist[j]);
        }
    }
    cout <<ans <<endl;
}   

Measured memory_bytes: 1024
import bisect
import sys
import math
import itertools
sys.setrecursionlimit(10000)

INF = float('inf')

# input macro
def i():
    return int(raw_input())
def ii():
    return map(int,raw_input().split(" "))
def s():
    return raw_input()
def ss():
    return raw_input().split(" ")
def slist():
    return list(raw_input())
#

def join(s):
    return ''.join(s)

#iterate macro
def piter(n,m):
    return itertools.permutations(n,m)
def citer(n,m):
    return itertools.combinations(n,m)

#modulo macro
def modc(a,b,m):
    c = 1
    for i in xrange(b):
        c = c * (a - i) % m
        c = c * modinv(i + 1,m) % m
    return c
 
def gcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
 
def modinv(a, m):
    (inv, q, gcd_val) = gcd(a, m)
    return inv % m

#bisect macro
def index(a, x):
    #Locate the leftmost value exactly equal to x
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    return -1

#memoize macro
def memoize(f):
    cache = {}
    def helper(*args):
        if args not in cache:
            cache[(args)] = f(*args)
        return cache[args]
    return helper

@memoize
def nck(a,b,m):
    b = min([a-b,b])
    if (b>a or b<0 or a<0):
        return 0
    elif a == 0:
        return 1
    return (nck(a-1,b-1,m)+nck(a-1,b,m)) % m

nh=zip([1,0,-1,0],[0,1,0,-1])

###########

a,b,c=ii()
if (a%2)*(b%2)*(c%2)==0:
    print 0
else:
    m=min(a*b,b*c,c*a)
    print m


Measured memory_bytes: 2816
/* by Natsu Kinmoe */
#include <bits/stdc++.h>
using namespace std;
#define SZ(x)               ((int)(x).size())
#define all(x)              (x).begin(), (x).end()
#define loop(i, n)          for(int i = 0; i < (n); i++)
#define cont(i, n)          for(int i = 1; i <= (n); i++)
#define circ(i, a, b)       for(int i = (a); i <= (b); i++)
#define range(i, a, b, c)   for(int i = (a); ((c) > 0 ? i <= (b) : i >= (b)); i += (c))
#define foreach(it, v)      for(__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define y0          y0O0OO00OO0OO0OO0OOO00OO0OO0O0O000OO0
#define y1          y1II11II11III11I1III11II111IIII1II1I1
#define pub         push_back
#define pob         pop_back
#define mak         make_pair
typedef long long   ll;
typedef long double lf;
const int   Inf = 0x3f3f3f3f;
const ll    INF = 0x3f3f3f3f3f3f3f3fll;
/* Source code starts here */

int n, k;
const int maxn = 1 << 19;

struct Segtree {
	int dt[maxn << 1];
	void inline add(int a, int x) {
		for(a += maxn; a; a >>= 1) dt[a] = max(dt[a], x);
	}
	int inline qmax(int l, int r) {
		int res = 0;
		for(l += maxn, r += maxn + 1; l < r; l >>= 1, r >>= 1) {
			if(l & 1) res = max(res, dt[l++]);
			if(r & 1) res = max(res, dt[--r]);
		}
		return res;
	}
} seg;

int a[maxn];

int main() {
	scanf("%d%d", &n, &k);
	cont(i, n) scanf("%d", a + i);
	cont(i, n) {
		int mx = seg.qmax(max(0, a[i] - k), min(maxn - 1, a[i] + k)) + 1;
		seg.add(a[i], mx);
	}
	printf("%d\n", seg.qmax(0, maxn - 1));
	return 0;
}


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

int main(){
	int a, b;
	cin >> a >> b;
	if ((a+b)%2==0){
		int ans = (a+b)/2;
		cout << ans << endl;
	}
	else{
		string ans = "IMPOSSIBLE";
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
/*
 ID: bradyawn
 PROG: contest
 LANG: C++11
 */

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <deque>
#include <string>
#include <cmath>
#include <map>
#include <utility>
#include <algorithm>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <random>
#include <cstring>

using namespace std;

typedef long long ll;
typedef pair<int,int> i2;
typedef pair<ll,ll> ll2;

int main()
{
    //ifstream inf("");
    //ofstream outf("");
    //cout << setprecision(10);
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);
    
    int n;
    int a, b;
    cin >> n;
    cin >> a >> b;
    
    int x = abs(a-b)-1;
    
    //if (x >= 4) cout << "Draw\n";
    if (x&1) cout << "Alice\n";
    else cout << "Borys\n";
    
    return 0;
    
}




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

#define int long long

using namespace std;

const int N = 2e5 + 5;

int n, k, a[N], used[N], cnt = 0;
long long f[N], bit[N];
vector <pair <long long, int> > comp;

void update (int x, int val) {
    for (int i = x; i < N; i += i & -i) bit[i] += val;
}

long long get (int x) {
    long long ans = 0;
    for (int i = x; i > 0; i -= i & -i) ans += bit[i];
    return ans;
}

signed main(){
    scanf("%lld %lld", &n, &k);
    long long ans = 0;

    f[0] = 0;
    for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] + a[i];
    for (int i = 1; i <= n; i++) comp.push_back(make_pair(f[i] - k * i, i));
    comp.push_back(make_pair(0, 0));

    sort(comp.begin(), comp.end());
    used[comp[0].second] = ++cnt;
    for (int i = 1; i < comp.size(); i++) {
        if (comp[i].first > comp[i - 1].first) used[comp[i].second] = ++cnt;
        else used[comp[i].second] = cnt;
    }

    for (int i = 1; i <= n; i++) {
        update(used[i - 1], 1);
        ans += get(used[i]);
    }

    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 11248
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

a = []
for i in range(5):
    b = int(input())
    a.append(b)
mn = 0xFFFFFFFFFFFFFF
for i in list(itertools.permutations(a)):
    k = 0
    count = 0
    for j in i:
        count += 1
        k += j
        if count == 5:
            mn = min(mn, k)
        l = 10 - (k % 10)
        if l == 10:
            pass
        else:
            k += l
print(mn)

Measured memory_bytes: 5588
#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
using namespace std;
const int mod=998244353;
int n,m,i,j,a[262145],b[262145],sum;
int pw(int x,int y){
	int z=1;
	while(y){
		if(y&1){
			z=1ll*z*x%mod;
		}
		x=1ll*x*x%mod;
		y/=2;
	}
	return z;
}
void fwt(int *a,int op){
	int i,j;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++)if(!((j>>i)&1)){
			int x=a[j],y=a[j|(1<<i)];
			a[j]=(x+y)%mod;
			a[j|(1<<i)]=(x-y+mod)%mod;
			if(op==-1){
				a[j]=1ll*a[j]*(mod+1)/2%mod;
				a[j|(1<<i)]=1ll*a[j|(1<<i)]*(mod+1)/2%mod;
			}
		}
	} 
}
int main(){
	cin>>n;m=(1<<n);
	for(i=0;i<m;i++){
		cin>>a[i];
		sum+=a[i];
	}
	sum=pw(sum,mod-2);
	for(i=0;i<m;i++){
		a[i]=1ll*a[i]*sum%mod;
		b[i]=mod-1;
	}
	b[0]=m-1;
	a[0]=(a[0]-1+mod)%mod;
	fwt(a,1);fwt(b,1);
	for(i=0;i<m;i++){
		a[i]=1ll*b[i]*pw(a[i],mod-2)%mod;
	}
	fwt(a,-1);
	for(i=0;i<m;i++){
		cout<<(a[i]-a[0]+mod)%mod<<endl;
	}
	return 0;
}

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

using namespace std;

int strToNum(char str)
{
    string sall = "abcdefghijklmnopqrstuvwxyz";
    for(int i = 0; i < 26; i++){
        if(str == sall[i]){
            return i;
        }
    }
}

int main(void)
{
    int N;
    cin >> N;
    string str;
    cin >> str;

    int max = 0;
    for(int i = 1; i < N-1; i++){
        int cnt_alph1[26] = {0};
        for(int j = 0; j < i; j++){
            cnt_alph1[strToNum(str[j])]++;
        }
        int cnt_alph2[26] = {0};
        for(int j = i; j < N; j++){
            cnt_alph2[strToNum(str[j])]++;
        }
        int cnt = 0;
        for(int k = 0; k < 26; k++){
            if(cnt_alph1[k] != 0 && cnt_alph2[k] != 0){
                cnt++;
            }
        }
        if(max < cnt){
            max = cnt;
        }
    }

    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int m, f, r;
    while(1){
        scanf("%d %d %d", &m, &f, &r);
        if(m == -1 && f == -1 && r == -1) break;
        if(m == -1 || f == -1){
            printf("F\n");
        }else if(m + f >= 80){
            printf("A\n");
        }else if(m + f >= 65){
            printf("B\n");
        }else if(m + f >= 50){
            printf("C\n");
        }else if(m + f >= 30 && r >= 50){
            printf("C\n");
        }else if(m + f >= 30){
            printf("D\n");
        }else{
            printf("F\n");
        }
    }
    return 0;
}



Measured memory_bytes: 2056
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

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

    vector<int> a;
    a.push_back(s);
    for (int i = 1; ; i++) {
        if (a[i - 1] % 2 == 0) {
            a.push_back(a[i - 1] / 2);
        } else {
            a.push_back(3 * a[i - 1] + 1);
        }
        for (int j = 0; j < a.size() - 1; j++) {
            if (a[j] == a[i]) {
                cout << i + 1 << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
  int n, s = 0, min = 10000;
  scanf("%d", &n);
  for(int i = 0; i < n; i++) {
    int k;
    scanf("%d", &k);
    if(k < min && k % 10 != 0) min = k;
    s += k;
  }
  if(s % 10 == 0 && min == 10000) puts("0");
  else if(s % 10 == 0 && min != 10000) printf("%d\n", s - min);
  else printf("%d\n", s);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main(){
    int n,m;
    int i,j,x;
    char card_b[201],card_a[201]={0,};
    while(1){
        scanf("%s",card_b);
        //printf("%d\n",strlen(card_b));
        if(strcmp(card_b,"-")==0){
            break;
        }
        scanf("%d",&m);
        for(j=0,i=0;i<m;i++){
            scanf("%d",&n);

            for(j=n,x=0;j<strlen(card_b);j++,x++){
                card_a[x]=card_b[j];
            }

            for(j=0;n!=0;n--,j++){
                card_a[strlen(card_b)-n]=card_b[j];
            }
            card_a[strlen(card_b)]=0;
            strcpy(card_b,card_a);
        }
        printf("%s\n",card_b);
    }
    return 0;
}


Measured memory_bytes: 2032
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <stdlib.h>
using namespace std;
#define          neli                   printf("\n")
#define          rep(i,n)               for(int i=0;i<n;i++)
#define          gcd(a,b)               __gcd(a,b)

int main()
{

    string colour[10]={"Sunny","Cloudy","Rainy"};
    string str;cin>>str;
    for(int i=0;i<3;i++)
    {
        if(colour[i]==str)
        {
            if(i==2)
                i=-1;
            cout<<colour[i+1]<<endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
	while(true){
		int x;
		cin>>x;
		if(x==0){
			break;
		}
 
		int ans=0,change=1000-x,money[6]={500,100,50,10,5,1};
		for(int i=0;i<6;i++){
			int n=change/money[i];
			ans+=n;
			change-=money[i]*n;
		}
 
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
using namespace std;
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+100;
const int mod = 1e9+7;
int c[upperlimit];
int main() {
	ll ans=0;
	int n;
	sd(n);
	for(int i = 1; i <= n; i++) sd(c[i]);
	sort(c+1,c+n+1);
	for(int i = 1; i < n; i++){
		ans+=(c[i]*1ll*(n+2-i))%mod;
		ans%=mod;
	}
	ans*=powmod(2,n-2,mod);ans%=mod;
	ans+=(c[n]*1ll*powmod(2,n-1,mod))%mod;
	ans*=powmod(2,n,mod);ans%=mod;
	plld(ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n, c, k; cin >> n >> c >> k;
    vector<int> t(n);
    for(auto& v:t){
        cin >> v;
    }
    sort(t.begin(), t.end());
    int passengers = 1;
    int limit = t[0] + k;
    int cnt = 0;
    for(int i=1; i<n; i++){
        if(passengers >= c){
            cnt++;
            limit = t[i] + k;
            passengers = 0;
        }
        if(t[i] > limit){
            cnt++;
            limit = t[i] + k;
            passengers = 0;
        }
        passengers++;
    }
    if(passengers > 0){
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
// SeeAlso: https://atcoder.jp/contests/abc121/tasks/abc121_c

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

int N, M;
ll A[MAX], B[MAX];

priority_queue<pll, vector<pll>, greater<pll>> pq;

int main() {

    cin >> N >> M;

    REP(i, N) {
        cin >> A[i] >> B[i];
        pq.push(make_pair(A[i], B[i]));
    }    

    ll sum = 0;
    ll ans = 0;
    while(M > sum) {
        pll ab = pq.top();
        pq.pop();
        ll temp;
        if ((sum + ab.second) > M) {
            temp = M - sum;
        } else {
            temp = ab.second;
        }

        ans += temp * ab.first;
        sum += temp;
    }

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



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

int main() {
	
	ll n, m; cin >> n >> m;
	if (n < m) swap(n, m);  // m <= n
	ll ans = 0;
	if (2 < m) {
		ans = (n - 2) * (m - 2);
	}
	else if (m == 1 && n == 1) {
		ans = 1;
	}
	else if (m == 1 && 2 <= n) {
		ans = n - 2;
	}
	else {
		ans = 0;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
typedef long long ll;
using namespace std;
char s[200];
int main(){
 ll k,sum;cin>>s>>k;sum=0;
 int a,i;i=0;a=strlen(s);
  for(int i=0;i<a;i++)
    if(s[i]=='1')sum++;
  else break;
  if(sum>=k)cout<<1<<endl;
 else
{for(i=0;i<a;i++)
  if(s[i]!='1'){cout<<s[i]<<endl;break;}
 if(i==a)cout<<1<<endl;}
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <string>
#include<iomanip>
#include<limits>
using namespace std;
int main(void){
   int N;
   cin>>N;
   int d[N];
   for(int i=0;i<N;i++){
       cin>>d[i];
   }
   int sum=0;
   for(int i=0;i<N;i++){
       for(int j=i+1;j<N;j++){
           sum+=d[i]*d[j];
       }
   }
   cout<<sum<<endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(in.readLine());
		long sum = 0;
		for (int i = 1; i <= n; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				sum  += i;
		}
		
		System.out.println(sum);
	}
}


Measured memory_bytes: 32520
#include <stdio.h>

int x[111];

int main(void)
{
	int n, i, j, ans = 0x7fffffff;

	scanf("%d" ,&n);
	for (i = 1; i <= n; i++)
		scanf("%d" ,&x[i]);

	for (i = 1; i <= 100; i++)
	{
		int sum = 0;

		for (j = 1; j <= n; j++)
			sum += (x[j] - i) * (x[j] - i);

		if (ans > sum)
			ans = sum;
	}

	printf("%d" ,ans);
	return 0;
}

Measured memory_bytes: 128
n = int(input())
s = input()
max_count = 0
for i in range(1,n):
    left_s = set(list(s[:i]))
    right_s = set(list(s[i:]))
    temp = left_s & right_s
    if max_count < len(temp):
        max_count = len(temp)
print(max_count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    if (a>b)
    {
        for (int i=1; i<=a; i++) cout << b;
    }
    else for (int i=1; i<=b; i++) cout << a;
    return 0;
}


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

int main(){
	string s;
  	cin >> s;
  	int win = 0;
    for (int i = 0; i < s.size(); ++i){
    	if (s[i] == 'o'){
        	win += 1;
        }else{
        	continue;
        }
    }
    if (( win + 15 - s.size() ) >= 8){
    	cout << "YES" << endl;
    }else{
    	cout << "NO" << endl;
    }
  	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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 print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll mod=1e9+7;

struct mint {

  ll x; 

  mint(ll x=0):x((x%mod+mod)%mod){} //コンストラクタを呼んで自動的にmodを取っている。

  mint operator-() const { return mint(-x);}

  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    //メンバ関数にはthisポインタがある。メンバ変数の値を返す。
    return *this;
  }

  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }

  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }

  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }

  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }

  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }

  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1); //a=x/2
    a *= a; //繰り返し二乗法
    if (t&1) a *= *this; //tが奇数のときはxを1回かける
    return a;
  }



  // for prime mod

  mint inv() const {
    return pow(mod-2);
  }

  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }

  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
    
};

int main()
{
    ll n,a,b;
    cin >> n >> a >> b;
    mint p;
    p=2;
    p=p.pow(n);
    //cout << p.x << endl;
    ll A=a;
    ll B=b;
    mint s=1;
    mint t=1;
    mint u=1;
    mint v=1;
    while(a!=0){
        s*=a;
        a--;
        u*=n-a;
    }
    while(b!=0){
        t*=b;
        b--;
        v*=n-b;
    }
    mint q;
    mint r;
    q=s;
    r=t;
    u/=s;
    v/=t;
    //cout << u.x << endl;
    //cout << v.x << endl;
    mint ans=p-u-v-1;
    cout << ans.x << endl;
    
    return 0;
} 

Measured memory_bytes: 256
import itertools
n = int(input())
s = [str(input()) for i in range(n)]
march = [0, 0, 0, 0, 0]
for i in range(n):
    if s[i].startswith("M"):
        march[0] += 1
    elif s[i].startswith("A"):
        march[1] += 1
    elif s[i].startswith("R"):
        march[2] += 1
    elif s[i].startswith("C"):
        march[3] += 1
    elif s[i].startswith("H"):
        march[4] += 1
match = list(itertools.combinations(march, 3))
ans = 0
for i in range(len(match)):
    ans += match[i][0] * match[i][1] * match[i][2]
print(ans)


Measured memory_bytes: 9772
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            while (sc.hasNext()) {
                int n = Integer.parseInt(sc.nextLine());
                if (n == 0) {
                    break;
                }
                double[] ss = Stream.of(sc.nextLine().split(" "))
                        .mapToDouble(Double::parseDouble)
                        .toArray();
                if (n != ss.length) {
                    throw new IllegalTestCaseException();
                }
                double summation = summationForSD(ss);
                double alpha = Math.pow(summation / n, 0.5);
                System.out.printf("%.8f\n", alpha);
            }
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static double meanOf(double[] ss) {
        double sum = 0;
        for (double s: ss) {
            sum += s;
        }
        return sum / ss.length;
    }

    private static double summationForSD(double[] ss) {
        double summation = 0;
        double m = meanOf(ss);
        for (double s: ss) {
            summation += Math.pow((s - m), 2);
        }
        return summation;
    }

    private static class IllegalTestCaseException extends RuntimeException {
        IllegalTestCaseException() {
            super("Illegal condition.");
        }
    }
}



Measured memory_bytes: 32932
#include "bits/stdc++.h"
#include <unistd.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    ll res = 0;
    REP(i,(n+r-1)/r+1){
        REP(j,(n+g-1)/g+1){
            ll k = n-i*r-j*g;
            if(0<=k&&k%b==0){
                res++;
            }
        }
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

int main()
{
	int sum=0;
	int M=0;

	int n,m;
	cin>>n>>m;
	
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];}
	float t= (float)(1/((float)4*m))*sum; //divison lession

	for(int i=0;i<n;i++){
		if(t<=a[i]){
			M+=1;
		}
	}

	if(M>=m){
		printf("Yes\n");}
	else {
		printf("No\n");}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 2000;

long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}

ll GetDigit(ll num){
    ll digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

ll power(ll a, ll b){
  ll ans = 1;
  if(b%2==0){
    REP(i, b/2){
      ans *= a;
      if(ans>1000000000){
        return -1;
      }
    }
    return ans * ans;
  }else{
    b = b/2;
    REP(i, b){
      ans *= a;
      if(ans>1000000000){
        return -1;
      }
    }
    return ans * ans* a;
  }
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(void){

  ll a;
  cin>>a ;
  cout<<a+a*a+a*a*a<<endl;


  return 0;
  
}

Measured memory_bytes: 3720
#include<stdio.h>
int main(void)
{
 	int a,s,i,j,k,cnt;
	scanf("%d",&k);
 	scanf("%d",&s);
 	cnt=0;
 	for(i=0;i<=k;i++){
		for(j=0;j<=k;j++){
			if(0<=s-i-j&&s-i-j<=k){
				cnt++;
			}
		}
	}
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 128