akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <bitset>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
const long long INF = (1ull<<63) - 1;

#include <vector>
#define debug(x) print(x, #x)
#define debug_1d(arr, len) print(arr, len, #arr)
#define debug_2d(arr, row, col) print((decltype(&arr[0][0]))arr, row, col, sizeof(*arr)/sizeof(**arr), #arr)
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a1,a2,a3,x,...) x
#define deb(...) CHOOSE((__VA_ARGS__,debug_2d,debug_1d,debug,~))(__VA_ARGS__)
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
	return os << '(' << p.first << ',' << p.second << ')';
}
template<typename T> void print(T x, string tag="") {
	if (tag.empty()) cout << x << endl;
	else cout << tag << ": " << x << endl;
}
template<typename T> void print(T *ar, int len, string tag="") {
	if (!tag.empty()) cout << tag << ": ";
	for (int i = 0; i < len; ++i) cout << ar[i] << ' ';
		cout << endl;
}
template<typename T> void print(T *ar, int row, int col, int C, string tag="") {
	if (!tag.empty()) cout << tag << ": " << endl;
	for (int i = 0; i < row; ++i) {
		for (int j = 0; j < col; ++j) {
			cout << ar[i*C + j] << ' ';
		}
		cout << endl;
	}
}
template<typename T> void print(vector<T> v, string tag="") {
	if (!tag.empty()) cout << tag << ": ";
	for (T e : v) cout << e << ' ';
	cout << endl;
}
template<typename T> void print(vector<vector<T>> v, string tag="") {
	if (!tag.empty()) cout << tag << ": " << endl;
	for (auto ev : v) {
		for (auto e : ev) cout << e << ' ';
		cout << endl;
	}
}

vector<pair<long long, int>> prime_factorization(long long n) {
	vector<pair<long long, int>> v;
	for (long long i = 2; i * i <= n; ++i) {
		int e = 0;
		while (n % i == 0) {
			++e;
			n /= i;
		}
		if (e != 0) v.emplace_back(i, e);
	}
	if (n != 1) v.emplace_back(n, 1);
	return v;
}

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

int main() {
	long long n;
	cin >> n;
	auto v = prime_factorization(2*n);
	vector<long long> r(v.size()), m(v.size());
	for (int i = 0; i < m.size(); i++) {
		m[i] = pow(v[i].first, v[i].second);
	}
	long long ans = INF;
	for (int bits = 0; bits < (1<<r.size()); bits++) {
		bitset<32> t(bits);
		for (int i = 0; i < r.size(); i++) {
			r[i] = t[i] ? 0 : m[i]-1;
		}
		long long now = crt(r, m).first;
		if (now == 0) now = 2*n;
		ans = min(ans, now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

#include <bits/stdc++.h>
using namespace std;

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

const int MOD = 1e9 + 7;
using uint = unsigned;
struct Z {
    uint v;

    Z(uint v = 0) : v(v) {}

    Z& operator += (const Z &z) {
        v += z.v;
        if (v >= MOD) v -= MOD;
        return *this;
    }

    Z& operator -= (const Z &z) {
        if (v < z.v) v += MOD;
        v -= z.v;
        return *this;
    }

    Z& operator *= (const Z &z) {
        v = static_cast<uint64_t>(v) * z.v % MOD;
        return *this;
    }
};

ostream& operator << (ostream &os, const Z &z) {
    return os << z.v;
}

Z operator + (const Z &x, const Z &y) {
    return Z(x.v + y.v >= MOD ? x.v + y.v - MOD : x.v + y.v);
}

Z operator - (const Z &x, const Z &y) {
    return Z(x.v < y.v ? x.v + MOD - y.v : x.v - y.v);
}

Z operator * (const Z &x, const Z &y) {
    return Z(static_cast<uint64_t>(x.v) * y.v % MOD);
}

Z qpow(Z base, uint e) {
    Z ret(1);
    for (; e; e >>= 1) {
        if (e & 1) {
            ret *= base;
        }
        base *= base;
    }
    return ret;
}

const size_t N = 16;
const size_t M = 1 << N;

Z fac[M], inv[M];
int a[N + 1];
Z f[1 << N];

Z comb(int n, int m) {
    return n < 0 || n < m ? 0 : fac[n] * inv[m] * inv[n - m];
}

int main() {
    int n = read(), m = read();
    generate_n(a, m, read);
    sort(a, a + m, greater<int>());

    int tot = (1 << n) - 1;
    fac[0] = 1;
    for (int i = 1; i <= tot; ++i) {
        fac[i] = fac[i - 1] * i;
    }
    inv[tot] = qpow(fac[tot], MOD - 2);
    for (int i = tot; i >= 1; --i) {
        inv[i - 1] = inv[i] * i;
    }

    f[0] = 1;
    for (int i = 0; i < m; ++i) {
        for (int j = tot; j--; ) {
            for (int k = 0; k < n; ++k) {
                if (~j >> k & 1) {
                    f[j | (1 << k)] += f[j] * comb((1 << n) - j - a[i], (1 << k) - 1) * fac[1 << k];
                }
            }
        }
    }

    Z ans = 0;
    for (int i = 0; i <= tot; ++i) {
        Z cur = f[i] * fac[tot - i];
        if (__builtin_popcount(i) & 1) {
            ans -= cur;
        } else {
            ans += cur;
        }
    }
    ans *= (1 << n);
    cout << ans;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<(int)N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=0;i--)
#define p(s) cout<<(s)<<endl
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf=1e9;


map<int,int> m;
int n,ans;
set<int> s;
int main() {
	cin>>n;
	REP(i,0,n){
		int a;
		cin>>a;
		m[a]++;
		s.insert(a);
	}
	for(auto i:s){
		if(m[i]%2) ans++;
	}
	p(ans);
	return 0;
}


Measured memory_bytes: 9600
n = int(input())
d = list(map(int,input().split()))
MOD = 998244353
if d[0] != 0:
    print(0)
    exit()
d.sort()
for i in range(1,n):
    if d[i] - d[i-1] > 1:
        print(0)
        exit()
    if d[i] == 0:
        print(0)
        exit()
count = 1
tmp = 1
ans = 1
for i in range(2,n):
    if d[i] != d[i-1]:
        ans *= pow(tmp,count,MOD)
        #print(tmp,count)
        tmp = count
        count = 1
    else:
        count+=1
ans *= pow(tmp,count,MOD)
ans %= MOD
#print(tmp,count)
print(ans)

Measured memory_bytes: 84440
N = int(input())
S = list(map(int, list(input())))

ans = 0
for i in range(0,10):
        for j in range(0,10):
                for k in range(0,10):
                        flag1 = False
                        flag2 = False
                        for z in S:
                                if flag1 and flag2 and z == k:
                                        ans += 1
                                        break
                                if flag1 and z == j:
                                        flag2 = True
                                        continue
                                if z == i:
                                        flag1 = True
                                        continue


print(ans)

Measured memory_bytes: 45548
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int A,B;
  	int ans = 0;
  	cin >> A >> B;
  	if ( A > B ) {
		ans += A;
      	A--;
    }
    else
    {
      ans += B;
      B--;
    }
  	if ( A > B ) {
		ans += A;
      	A--;
    }
    else
    {
      ans += B;
      B--;
    }
	cout << ans;
}

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

const int mod = 1000000007;
//const int mod = 998244353;
const int INF = 1001001001;
const int di[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dj[] = {0, -1, 0, 1, -1, 1, -1, 1};

struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    if(s[0] == 'R'){
        if(s[1] == 'R'){
            if(s[2] == 'R') ans = 3;
            else ans = 2;
        }
        else{
            if(s[2] == 'R') ans = 1;
            else ans = 1;
        }
    }
    else{
        if(s[1] == 'R'){
            if(s[2] == 'R') ans = 2;
            else ans = 1;
        }
        else{
            if(s[2] == 'R') ans = 1;
            else ans = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

void solve() {
  string s; cin >> s;
  int n = s.size();
  int ans = 0;
  rep(i, n) {
    if (i % 2 == 0) {
      if (s[i] == 'p') ans--;
    } else {
      if (s[i] == 'g') ans++;
    }
  }
  cout << ans << '\n';
}


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

using namespace std;

int main() {
    int a = 0, b = 0, t = 0;
    cin >> a >> b >> t;
    int ans=0;
    for (int i = a; i < t + 0.5; i += a) {
        ans += b;
    }

    cout << ans << endl;

}

Measured memory_bytes: 3564
import sys
input = sys.stdin.readline
import fractions


def main():
    A, B, C, D = map(int, input().split())
    Aone = A - 1
    CDlcm = int(C /  fractions.gcd(C, D) * D)

    Bc = B // C
    Bd = B // D
    Blcm = B // CDlcm
    Bdec = B - Bc - Bd + Blcm

#    print(Bc,Bd,Blcm)

    Ac = Aone // C
    Ad = Aone // D
    Alcm = Aone // CDlcm
    Adec = Aone - Ac - Ad + Alcm

#    print(Ac,Ad,Alcm)

    print(Bdec - Adec)


main()

Measured memory_bytes: 64492
n,m,k=map(int, input().split( ))
mod = 998244353

ans=0
if m==1:##コーナー
  	print(1 if k==n-1 else 0)
  	exit()
tmp=m*pow(m-1,n-1,mod)
m_inv=pow(m-1,mod-2,mod)
invs=[0]+[pow(i+1,mod-2,mod) for i in range(n)]
for i in range(1,k+2):
    ans+=tmp
    #print(ans)
    tmp*=m_inv
    if i<n:##?
        tmp*=n-i
        tmp*=invs[i]
    tmp%=mod
print(ans%mod)



Measured memory_bytes: 82380
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

int main() {
	int n;
	int a[101] = {};
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	int ans = INF;
	for(int i = -100;i <= 100;i++){
		int ret = 0;
		for(int j = 0;j < n;j++){
			ret += (a[j] - i) * (a[j] - i);
		}
		ans = min(ans, ret);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const ll INF = 10000000000;//INFinity
using namespace std;//namespace

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}//transform
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//#define int long long // yabai

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    string s;
    cin>>s;
    vector<int> v;
    REP(i,4)v.pb( stoi(s.substr(i,1)) );
    REP(a,2)REP(b,2)REP(c,2){
        int sum=v[0];
        sum+=(a?v[1]:-v[1]);
        sum+=(b?v[2]:-v[2]);
        sum+=(c?v[3]:-v[3]);
        if(sum==7){cout<<v[0]<<(a?"+":"-")<<v[1]<<(b?"+":"-")<<v[2]<<(c?"+":"-")<<v[3]<<"=7"<<endl; return 0;}
    }

    return 0;
}


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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    if(b%a==0) print(a+b);
    else print(b-a);
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#include <numeric>
#define IINF 1000000000
#define INF 9223372036854775807
#define MOD 998244353
#define mod 1000000007
#define INT_MAX_ 2147483647
#define EPS (1e-10)
#define REP(i, a, n) fo-r (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
#define bit(n,k) ((n>>k)&1)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<ll,ll> a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi>b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_t=clock();
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //-------------------------------
    int n;cin>>n;
    cout<<(n-2)*180<<endl;
    //-------------------------------
    //fclose(stdin);
    //fclose(stdout);
    //ll end_t=clock();cout<<"time="<<end_t-begin_t<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------








































Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

from collections import defaultdict
from sys import exit
import math


def main():
    n, m= getList()
    snu = [0 for _ in range(n)]

    for _ in range(m):
        a = getN()
        nums = getList()
        for num in nums:
            snu[num-1] += 1
    ans = 0
    for sn in snu:
        if sn == 0:
            ans += 1

    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 68064
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    bool f=true;
    int n;cin>>n;
    set<ll> st;
    rep(i,n){
        int t;cin>>t;
        if(st.count(t)){
            cout<<"NO"<<endl;
            return 0;
        }
        st.insert(t);
    }
    cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 9600
a = ["" for i in range(10)]
a[1] = ".,!? "
a[2] = "abc"
a[3] = "def"
a[4] = "ghi"
a[5] = "jkl"
a[6] = "mno"
a[7] = "pqrs"
a[8] = "tuv"
a[9] = "wxyz"
num = int(input())
for count in range(num):
    s = input()
    b = ""
    c = '0'
    d = 0
    for i in s:
        if i=='0' :
            if c=='0': continue
            if c == '1':
                b += a[int(c)][d%5]
            elif c in "79":
                b += a[int(c)][d%4]
            else :
                b += a[int(c)][d%3]
            c = '0'
            d = 0
        if(c!=i):
            c = i
            d = 0
        else :
            d += 1
    print(b)



Measured memory_bytes: 5620
#ifdef ONLINE_JUDGE
  #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#endif

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define ld long double

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))

signed main() {
  #ifndef ONLINE_JUDGE
    ifstream cin("in");
  #endif
  ios_base::sync_with_stdio(0); cin.tie(0); // harris leung ioi gold calling it 18.09

  int n; cin >> n;
  ld v[n + 1];
  for (int i = 1; i <= n; i ++) cin >> v[i];
  ld dp1[n + 1][n + 1]; // dp1[i][j] means j heads in first i coins
  memset(dp1, -1, sizeof(dp1));
  dp1[0][0] = 1;
  for (int i = 1; i <= n; i ++) {
    dp1[i][0] = dp1[i - 1][0] * (1 - v[i]);
    dp1[i][i] = dp1[i - 1][i - 1] * v[i];
  }
  for (int i = 1; i <= n; i ++) {
    for (int j = 1; j < i; j ++) {
      dp1[i][j] = dp1[i - 1][j - 1] * v[i] + dp1[i - 1][j] * (1 - v[i]);
    }
  }
  ld ans = 0;
  for (int i = n; i > n - i; i --) {
    ans += dp1[n][i];
  }
  cout << setprecision(15) << fixed << ans << endl;
}

Measured memory_bytes: 144396
/* Author rumoisen */
/* created 2018/11/08 */

#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <iostream>

using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}
void No(){cout<<"NO"<<endl;exit(0);}
void Yes(){cout<<"YES"<<endl;exit(0);}

using namespace std;

int main(void)
{
    int n,a,b;
    cin>>n>>a>>b;
    if(a*n>=b) cout<<b<<endl;
    else cout<<a*n<<endl;
    return 0;
}

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

using namespace std;



int main()
{
 string s,t;
 cin>>s>>t;
 for(int i=0;i<s.size();i++)
    if(s[i]!=t[i]){cout<<"No";return 0;}


 cout<<"Yes";
 return 0;          
}


Measured memory_bytes: 3624
n = int(input())
a = list(map(int, input().split()))
m = max(a)
y = [0] * (m + 1)
for i in a:
    x = i
    while x <= m:
        y[x] += 1
        x += i
ans = 0
for j in a:
    if y[j] == 1:
        ans += 1

print(ans)

Measured memory_bytes: 131864
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr ll INF = (1LL << 55);
int main(){ 
  int k, n;
  cin >> k >> n;
  vector<int> a(2 * n);
  rep(i,n) {
    cin >> a[i];
    a[i + n] = a[i] + k;
  }
  vector<ll> cum(2*n+1,0);
  for (int i = 0; i < 2 * n; i++) {
    cum[i + 1] = cum[i] + (a[i + 1] - a[i]);
  }
  ll res = INF;
  for (int i = 0; i < n; i++) {
    ll tmp = cum[i + n - 1] - cum[i];
    res = min(res, tmp);
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 4992
k,n=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
m=-1
for i in range(len(a) - 1):
    m = max(m, a[i+1]-a[i])
m = max(m, k-a[len(a)-1]+a[0])
print(k-m)


Measured memory_bytes: 24948
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main(){
    int N, A, B; string S; cin >> N >> A >> B >> S;
    int Final = 0, OverSea = 0;
    for (int i = 0; i < N; i++) {
        string ans = "No";
        if (S[i] == 'a') {
            if (Final < A + B) {
                ans = "Yes";
            Final++;
            }
        } else if (S[i] == 'b') {
            if (Final < A + B && OverSea < B) {
                ans = "Yes";
                Final++;
                OverSea++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    int ans = 1;
    while(n / k > 0){
        n /= k;
        ans ++;
    }
    cout << ans << endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX

typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

int main(){
    
        int n;
        cin >> n;
        while(n--){
                double xa, ya, ra, xb, yb, rb;
                cin >> xa >> ya >> ra >> xb >> yb >> rb;
                double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
                if(d > ra + rb) cout << 0 << endl;
                else if(d < fabs(ra - rb)){
                        if(ra > rb) cout << 2 << endl;
                        else cout << -2 << endl;
                    }
                else cout << 1 << endl;
            }
        return 0;
}



Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
long long f[100001];
long long v[101],w[101];
int main()
{
	long long i,j,n,m;
	scanf("%lld%lld",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%lld%lld",&w[i],&v[i]);
	for(i=1;i<=n;i++)
		for(j=m;j>=w[i];j--)
			f[j]=max(f[j],f[j-w[i]]+v[i]);
	printf("%lld",f[m]);
	return 0;
}

Measured memory_bytes: 1024
A, B, M = map(int, input().split())
*a, = map(int, input().split())
*b, = map(int, input().split())
ab = min(a) + min(b)
for i in range(M):
    x, y, c = map(int, input().split())
    ab = min(ab, a[x - 1] + b[y - 1] - c)
print(ab)

Measured memory_bytes: 76012
import java.util.*;
public class Main {
  public static void main(String... args) {
    Scanner input = new Scanner(System.in);
    
    long MOD = 1_000_000_007;
    
    int n = input.nextInt();
    long sqSum = 0;
    long sum = 0;
    for (int i = 0; i < n; i++) {
      long x = input.nextInt();
      sum += x;
      sum %= MOD;
	  sqSum += ((x * x) % MOD);
      sqSum %= MOD;
    }
    
    sum *= sum;
    sum %= MOD;
    
    System.out.println(((sum - sqSum + MOD) * 500000004) % MOD);
  }
}


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

// cin >> a >> b;
// coud << "" << << endl;

void Main() {
    int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin >> K;
    cout << a[K-1] << endl;
}



int main() {
    Main();
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

int main()
{
	int A1, A2, A3;
	std::cin >> A1 >> A2 >> A3;

	const int sum = A1 + A2 + A3;

	if (21 < sum) {
		std::cout << "bust";
	}
	else {
		std::cout << "win";
	}

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
int n;
unsigned int data[4][3][10] = {{{0}}};

scanf("%d",&n);

for(int i=0; i<n; i++){
unsigned int b,f,r,v;
scanf("%d %d %d %d",&b,&f,&r,&v);
data[b-1][f-1][r-1] += v;
}

printf(" %d %d %d %d %d %d %d %d %d %d\n",data[0][0][0],data[0][0][1],data[0][0][2],data[0][0][3],data[0][0][4],data[0][0][5],data[0][0][6],data[0][0][7],data[0][0][8],data[0][0][9]);
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[0][1][0],data[0][1][1],data[0][1][2],data[0][1][3],data[0][1][4],data[0][1][5],data[0][1][6],data[0][1][7],data[0][1][8],data[0][1][9]);
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[0][2][0],data[0][2][1],data[0][2][2],data[0][2][3],data[0][2][4],data[0][2][5],data[0][2][6],data[0][2][7],data[0][2][8],data[0][2][9]);
printf("####################\n");
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[1][0][0],data[1][0][1],data[1][0][2],data[1][0][3],data[1][0][4],data[1][0][5],data[1][0][6],data[1][0][7],data[1][0][8],data[1][0][9]);
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[1][1][0],data[1][1][1],data[1][1][2],data[1][1][3],data[1][1][4],data[1][1][5],data[1][1][6],data[1][1][7],data[1][1][8],data[1][1][9]);
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[1][2][0],data[1][2][1],data[1][2][2],data[1][2][3],data[1][2][4],data[1][2][5],data[1][2][6],data[1][2][7],data[1][2][8],data[1][2][9]);
printf("####################\n");
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[2][0][0],data[2][0][1],data[2][0][2],data[2][0][3],data[2][0][4],data[2][0][5],data[2][0][6],data[2][0][7],data[2][0][8],data[2][0][9]);
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[2][1][0],data[2][1][1],data[2][1][2],data[2][1][3],data[2][1][4],data[2][1][5],data[2][1][6],data[2][1][7],data[2][1][8],data[2][1][9]);
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[2][2][0],data[2][2][1],data[2][2][2],data[2][2][3],data[2][2][4],data[2][2][5],data[2][2][6],data[2][2][7],data[2][2][8],data[2][2][9]);
printf("####################\n");
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[3][0][0],data[3][0][1],data[3][0][2],data[3][0][3],data[3][0][4],data[3][0][5],data[3][0][6],data[3][0][7],data[3][0][8],data[3][0][9]);
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[3][1][0],data[3][1][1],data[3][1][2],data[3][1][3],data[3][1][4],data[3][1][5],data[3][2][6],data[3][1][7],data[3][1][8],data[3][1][9]);
printf(" %d %d %d %d %d %d %d %d %d %d\n",data[3][2][0],data[3][2][1],data[3][2][2],data[3][2][3],data[3][2][4],data[3][2][5],data[3][2][6],data[3][2][7],data[3][2][8],data[3][2][9]);

return 0;
}



Measured memory_bytes: 2048
#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];
   }
   int sum = 0;
   for(int i = 0; i<n-1; i++){
       for(int j = i+1; j<=n-1; j++){
           sum = sum+(a[i]*a[j]);
       }
   }
   cout<<sum<<endl;
   return 0;
}

Measured memory_bytes: 256
function Main(input) {

	input = input.split("\n");

	var n = parseInt(input[0], 10);

	if (n & 1)
	{
		console.log('%d',n*2);
	}
	else
	{
		console.log('%d',n);
	}

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7496
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int comps(const void *a, const void *b){return strcmp(a, b);}

int main(void){
	int n, i;
	char s[200000][11];
	int a[200000];
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%s", s[i]);
		a[i]=0;
	}
	qsort(s, n, 11, comps);

	int max=0;
	for(i=0; i<n; i++){
		int l=0, r=n-1, m;
		while(l<=r){
			m=(l+r)/2;
			if(comps(s[m], s[i])>=0) r=m-1; else l=m+1;
		}
		a[l]++;
		if(a[l]>max) max=a[l];
	}
	for(i=0; i<n; i++){
		if(a[i]==max) printf("%s\n", s[i]);
	}
}


Measured memory_bytes: 5244
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

lx = [None] * n
ly = [None] * m
sx = set([-10**10, 0, 10**10])
sy = set([-10**10, 0, 10**10])
ix = 0
iy = 0
for i in range(n):
    t = tuple(map(int, input().split()))
    lx[i] = t
    sx.add(t[0])
    sx.add(t[1])
    sy.add(t[2])
        
for i in range(m):
    t = tuple(map(int, input().split()))
    ly[i] = t
    sx.add(t[0])
    sy.add(t[1])
    sy.add(t[2])
        
xs = list(sx)
ys = list(sy)
xs.sort(); ys.sort()

wx = len(xs)*2
wy = len(ys)*2
bs = [[1]*wy for _ in range(wx)]
for i, (x0, x1, y) in enumerate(lx):
    ix0 = xs.index(x0)*2
    ix1 = xs.index(x1)*2
    iy = ys.index(y)*2
    for ii in range(ix0, ix1):
        bs[ii][iy] = -1
for i, (x, y0, y1) in enumerate(ly):
    ix = xs.index(x)*2
    iy0 = ys.index(y0)*2
    iy1 = ys.index(y1)*2
    for ii in range(iy0, iy1):
        bs[ix][ii] = -1

xx = xs.index(0)*2+1
yy = ys.index(0)*2+1
s = [(xx,yy)]
dx = [-1,0,1,0]
dy = [0,-1,0,1]
ans = 0
end = False
while s:
    ix,iy = s.pop()
    for x, y in zip(dx,dy):
        ixx = ix + x
        iyy = iy + y
        if bs[ixx][iyy]!=1:
            continue
        ixx += x
        iyy += y
        if bs[ixx][iyy]!=1:
            continue
        if ixx<0 or ixx>=wx-1 or iyy<0 or iyy>=wy-1:
            print("INF")
            s = []
            end = True
            break
        bs[ixx][iyy] = 2
        ans += (xs[ixx//2+1] - xs[ixx//2]) * (ys[iyy//2+1] - ys[iyy//2])
        s.append((ixx, iyy))
            
if not end:
    print(ans)


Measured memory_bytes: 640072
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

const ll INF = LONG_MAX;
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(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    std::ifstream in("a.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

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

    string s;
    cin >> s;


    s[k-1] += 'a'  -'A';

    cout << s;

    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A, B = (int(i) for i in input().split())
a = collections.Counter(prime_factorize(A))
b = collections.Counter(prime_factorize(B))

c = []
for i in a.keys():
    if i in b.keys():
        c.append(i)
#print(c)

print(len(c)+1)





Measured memory_bytes: 3316
A, B, K = map(int, input().split())

for i in range(K):
    if i % 2 == 0:
        if A % 2 == 1:
            A = A - 1
        B = B + (A/2)
        A = (A/2)

    else:
        if B % 2 == 1:
            B = B - 1
        A = A + (B/2)
        B = (B/2)

print(int(A),int(B))



Measured memory_bytes: 3060
# 繰り返し二乗法
def pow(base,exponent)
  raise ArgumentError if exponent < 0
  # 指数が0の時は結果は1です
  return 1 if exponent==0
  # 結果が出る変数を用意
  result = 1
  # 指数が1なら終了
  while exponent != 1 do
    # 指数が奇数の時、その時の底はここでresultに掛けてしまい、指数を一つ減らす
    if exponent.odd? then
      result *= base
      exponent -= 1
    end
    # 指数を2で割る
    exponent /= 2
    # 底の2乗を新たな底とする
    base *= base
    base = base % MOD
    # 繰り返す
  end
  result *= base
  # 結果を返す
  return result
end
MOD = 998244353

# これはべき場の高速化してない・・
# def inv(x)
#   res = 1 # 逆元をどんどんかけるやつ
#   beki = x # 逆元を計算したい値のMOD化でのべき乗
#   (MOD - 2).to_s(2).reverse.chars do |digest|
#     res = (beki * res) % MOD if digest == '1'
#     beki = (beki * beki) % MOD
#   end
#   res
# end



n,m,k = gets.chomp.split.map(&:to_i)

ncr = 1


# K組までのm*(m-1)を計算 1~n-1を計算しておいて、最後からk+1個を使えば良い
memo = [m%MOD]
1.upto(n-1) do |i|
  memo[i] = memo[i-1] * (m-1) % MOD
end

ans = memo.last

# n-1!まで計算
fac = Array.new(n, 1)
1.upto(n-1) do |i|
  fac[i] = fac[i-1] * i % MOD
end
# p fac

# rfac 逆元を計算したやつ
rfac = Array.new(n)
# 最も大きいのは最後のやつ
# mod pにおけるaの逆元はa^(p-2)つまり mod pの状況で bで割ってから pのあまりというのはb^(p-2)をかけるのに等しい
rfac[-1] = pow(fac[-1], MOD - 2)

# 全部で割ってしまってるので、かけていけば復元できる？
(n-2).downto(0) do |i|
  rfac[i] = rfac[i+1] * (i+1) % MOD
end

# p rfac

1.upto(k) do |i|
  ans += memo[n-i-1] * fac[n-1] * rfac[i] * rfac[n-i-1] % MOD
end



# n-1Ciを高速で計算して足していく
#
#
# ↓はあとでinvを高速化して試す
# 1.upto(k) do |i|
#   exp = memo[n-i-1]
#   if k == 1
#     ncr = (n-1)
#   else
#     ncr = ncr * (n-i) * inv(i)
#   end
#
#   ans += exp * ncr
# end
#
p ans % MOD




Measured memory_bytes: 19220
import java.util.Scanner;

//Grid
public class Main{

	static int[][] d = {{1,1},{1,-1}};
	static int max;
	static char[][] m;
	static int n;
	
	static int dfs(int i,int j, int k){
		if(!(0<=i&&i<n&&0<=j&&j<n)||m[i][j]=='0')return 0;
		int ni = i+d[k][0];
		int nj = j+d[k][1];
		return dfs(ni,nj,k)+1;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			n = sc.nextInt();
			if(n==0)break;
			m = new char[n][n];
			for(int i=0;i<n;i++)m[i]=sc.next().toCharArray();
			max = 0;
			for(int i=0;i<n;i++){
				int c = 0;
				for(int j=0;j<n;j++){
					if(m[i][j]=='0')c = 0;
					else{
						c++;
						max = Math.max(max, c);
					}
				}
			}
			for(int j=0;j<n;j++){
				int c = 0;
				for(int i=0;i<n;i++){
					if(m[i][j]=='0')c=0;
					else{
						c++;
						max = Math.max(max, c);
					}
				}
			}
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					if(m[i][j]=='1'){
						max = Math.max(max, dfs(i,j,0));
						max = Math.max(max, dfs(i,j,1));
					}
				}
			}
			System.out.println(max);
		}
	}
}

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

int main (){
    string s;   cin >> s;
    if(s.at(2) ==  s.at(3)   && s.at(4) ==  s.at(5) ){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

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

typedef long long ll;
typedef pair<int, int> pi;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep_op(i, a, n) for (int i = a; i < n; i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

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;
}

const int MOD = 1000000007;

const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

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

    ll n;
    cin >> n;
    cout << (n * (n - 1)) / 2 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)

int M, N, D, S[32][32], a[768][768];

bool solve(int n) {
    rep(k, n) {
        int ix = -1;
        for(int i=k; i<n; i++) if(a[i][k]) { ix=i; break; }
        if(ix==-1) continue;
        if(k!=ix) rep(i, n+1) swap(a[k][i], a[ix][i]);
        rep(i, n) if(i!=k) if(a[i][k]) {
            for(int j=k; j<=n; j++) a[i][j] ^= a[k][j];
        }
    }
    rep(k, n) if(a[k][n]) {
        bool any = false;
        rep(i, n) if(a[k][i]) any = true;
        if(!any) return false;
    }
    return true;
}

int main() {
    for(;;) {
        scanf("%d%d%d", &M, &N, &D);
        if(M==0 && N==0 && D==0) return 0;
        rep(i, N) rep(j, M) scanf("%d", S[i]+j);
        memset(a, 0, sizeof(a));
        const int n = N*M;
        rep(i, N) rep(j, M) {
            const int ix = i*M+j;
            a[ix][ix] = 1;
            a[ix][n] = S[i][j];
            rep(x, N) rep(y, M) if(abs(i-x)+abs(j-y)==D) a[ix][x*M+y] = 1;
        }
        printf("%d\n", (int)solve(n));
    }
}

Measured memory_bytes: 0
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<iomanip>
#include<complex>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef stack<int> SI;
typedef queue<int> QI;
typedef list<int> LI;
typedef pair<int,int> PII;
typedef long long LL;
#define d(x)  cout<<#x<<" = "<<(x)<<endl;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EP empty()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).rbegin()) i=(c).rbegin(); i!=(c).rend(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c,n) sort(c,c+n)
#define VSORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define DFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define DREP(i,n) DFOR(i,n,0)
#define INF 1000000000
#define PI  acos(-1.0)
int main()
{
	int c[4][4]={0};
	for(int i=1;i<4;i++)
	{
		for(int j=1;j<4;j++)
		{
			cin>>c[i][j];
		}
	}
	int ans=0;
	for(int i=1;i<3;i++)
	{
		for(int j=2;j<4;j++)
		{
			ans+=!(c[i+1][j]-c[i][j]==c[i+1][1]-c[i][1]);
		}
	}
	for(int i=1;i<3;i++)
	{
		for(int j=2;j<4;j++)
		{
			ans+=!(c[j][i+1]-c[j][i]==c[1][i+1]-c[1][i]);
		}
	}
	if(ans==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <deque>
#include <map>

using namespace std;

const int CMax = 100002;
const int CInf = 2000000001;
const long long CMod = 1000000007;

int n, m, t, B[CMax], G[CMax];

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

string baseConverter(int base, int num) {
    string tNum = "";
    while (num > 0) {
        tNum = (char)('0' + num%base) + tNum;
        num /= base;
    }
}

bool isPalindrom(string tS) {
    int sn = (int)tS.length();
    for (int i = 0; i < sn / 2; i++) {
        if (tS[i] != tS[sn - i - 1]) return false;
    }
    return true;
}

int dist(int i, int j) {
    return  (j < i ? n + j : j) - i;
}

long long greatestDivisor(long long a) {
    for (int i = 2; i <= (long long)sqrt(a); i++) {
        if (a % i == 0) return a / i;
    }
    return a;
}

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

    if (n < m) cout << 0 << endl;
    else cout << 10 << endl;
    return 0;
}


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

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second

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

const ll MOD = 1e9+7;

bool isPalindrome(string s){
	int n = s.size();
	for(int i = 0; i < n/2; i++){
		if(s[i] != s[n-i-1]) return false;
	}
	return true;
}

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

	string s; cin >> s;
	if(isPalindrome(s) && isPalindrome(s.substr(0, s.size()/2))
		&& isPalindrome(s.substr(s.size()/2+1)) )
		cout << "Yes\n";
	else
		cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
//cout << fixed << setprecision(0)

int main() { 
  int a[3];cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);
  if(a[0]==5&&a[1]==5&&a[2]==7){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
import itertools

N = int(input())

ans = list()

for i in range(N):
    ans.append([])
    A = int(input())
    for j in range(A):
        x, y = map(int, input().split())
        ans[i].append([x-1, y])

for i in range(N):
    for x in itertools.combinations(range(N), N-i):
        for y in x:
            for c, d in ans[y]:
                if d == 0 and c in x:
                    break
                if d == 1 and not c in x:
                    break
            else:
                continue
            break
        else:
            print(N-i)
            exit()
print(0)

Measured memory_bytes: 3064
// Atcoder11-B.cpp : Defines the entry point for the console application.
//

#include<stdio.h>
#include<algorithm>
#include<stdlib.h>

using namespace std;
int main()
{
	int N;
	int num[100001];
	int result = 1;
	long long int presum =  0;
	scanf("%d", &N);
	for (int i = 0; i < N; i++)
		scanf("%d", &num[i]);

	sort(num, num + N);
	presum = num[0];
	for (int i = 1; i <= N-1; i++)
		presum += num[i];

	for (int i = N - 1; i >= 1; i--)
	{
		if (2 * (presum - num[i]) >= num[i])
		{
			result++;
			presum = presum - num[i];
		}
		else
			break;
	}
	printf("%d\n",result);
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#define ll long long
#include <unordered_map>
using namespace std;
 
int main() {
  ll N, calN, K = 1, M = 26;
  cin >> N;
  calN = N;
  while(1) {
    if(calN > M) {
      calN -= M;
      K++;
      M *= 26;
    }
    else break;
  }
  for(ll i = 0; i < K; i++) N -= (ll)(pow(26, i));
  vector<ll> name(K);
  for(ll i = K; i > 0; i--) {
    name.at(i - 1) = N / (ll)(pow(26, i - 1)) + 97;
    cout << char(name.at(i - 1));
    N %= (ll)(pow(26, i - 1));
  }
}

Measured memory_bytes: 4112
#if 0

#endif
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
int main(){
  vector<xy_t> p;
  p.reserve(20);
  double x, y;
  while(scanf("%lf,%lf", &x, &y) != EOF){
    p.push_back(xy_t(x,y));
  }

  double sum = 0.0;
  for(int i = 0; i+2 < p.size(); i++){
    xy_t a = p[0], b = p[i+1], c = p[i+2];
    sum += cross_product(b-a, c-a) / 2.0;
  }

  printf("%.6f\n", abs(sum));
}

Measured memory_bytes: 3220
import copy
s = list(map(str,input()))
S=copy.copy(s)
cnt1=0
cnt2=0
for i in range(len(s)):
    #print(i,s[i])
    if i%2==0 and s[i]=='1':
        s[i] = '0'
        cnt1+=1
    if i%2==1 and s[i]=='0':
        s[i] = '1'
        cnt1+=1
    if i%2==0 and S[i]=='0':
        S[i] = '1'
        cnt2+=1
    if i%2==1 and S[i]=='1':
        S[i] = '0'
        cnt2+=1
print(min(cnt1,cnt2))

Measured memory_bytes: 5152
N, M = map(int, input().split())
islands = {i + 1: 1 for i in range(N)}
ab_list = [map(int, input().split()) for i in range(M)]

ans = list()
k2k = dict()
start = N*(N - 1) / 2


def recursive_dict(x):
  if not x in k2k: return x
  prev = k2k[x]
  while True:
    if prev in k2k:
      prev = k2k[prev]
    else:
      k2k[x] = prev
      return prev

for a, b in ab_list[::-1]:
  a, b = recursive_dict(a), recursive_dict(b)
  if a == b:
    ans.append(0)
    continue
  ans.append(islands[a] * islands[b])
  islands[a] += islands[b]
  k2k[b] = a

cumsum = 0
for i in ans[::-1]:
  cumsum += i
  print(cumsum)


Measured memory_bytes: 67456