akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// std::ios::sync_with_stdio(false);

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int maxn = 110;
int vis[maxn][maxn];
int H,W;

bool solve(priority_queue<int>& Q, const int size)
{
    FOR(i,0,H) FOR(j,0,W) if (!vis[i][j]) {
        set<PII> S;
        const int I = H-1-i;
        const int J = W-1-j;
        S.insert(PII(i,j)); S.insert(PII(i,J));
        S.insert(PII(I,j)); S.insert(PII(I,J));
        if (S.size() == size) {
            const int c = Q.top(); Q.pop();
            if (c < size)
                return false;
            const int sz = c-size;
            if (sz)
                Q.push(c-size);
            vis[i][j] = vis[i][J] = vis[I][j] = vis[I][J] = true;
        }
    }
    return true;
}

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    while (cin >> H >> W) {
        map<char,int> cnt;
        FOR(i,0,H) {
            string s; cin >> s;
            FOR(j,0,W)
                cnt[s[j]]++;
        }
        priority_queue<int> Q;
        FOR_ALL(c,cnt)
            Q.push(c->second);
        memset(vis,0,sizeof(vis));
        const bool a = solve(Q,4);
        const bool b = solve(Q,2);
        const bool c = solve(Q,1);
        const string ans = (a & b & c) ? "Yes" : "No";
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int x=sc.nextInt();
		int[] m=new int[n];

		int mini=x;

		for(int i=0;i<n;i++) {
			m[i]=sc.nextInt();
			x-=m[i];
			if(mini>m[i])
				mini=m[i];
		}
		sc.close();


		System.out.print(m.length+x/mini);




	}

}


Measured memory_bytes: 23892
N, M = map(int, input().split())

Switches = [None] + [ list([0]) for _ in range(N) ]
Ss = [list(map(lambda x: Switches[int(x)], input().split()[1:])) for _ in range(M)]
for coil, S in zip(map(int, input().split()), Ss):
    S.append([coil])

cnt = 0
for L in range(pow(2, N)):

    for i, onoff in enumerate(((L & (1 << x)) != 0 for x in range(N))):
        Switches[i+1][0] = onoff

    if sum((1 for sji in Ss if sum((1 for si in sji for siv in si if siv)) % 2 != 0 )) <= 0:
        cnt += 1

print(cnt)


Measured memory_bytes: 56028
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
#include<limits.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;

//最大公約数
int gcd(int a,int b){
    return b ? gcd(b,a%b):a;
}

//最小公倍数
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

//素数判定
bool isPrime(int x){
    if(x<2)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

//桁ごとの足し算
int digsum(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}

//約数列挙
vector<int> enum_div(int n){
    vector<int> ret;
    for(int i=1;i*i<=n;++i){
        if(n%i==0){
            ret.push_back(i);
            if(i*i !=n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

//累乗の計算とあまり,0で累乗そのまま出力
long long modpow(long long a,long long n,long long mod){
    if(mod==0)mod=__LONG_LONG_MAX__;
    long long res=1;
    while(n>0){
        if(n & 1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

ll X;
ll K;
ll D;
int main(){
    cin>>X>>K>>D;
    X=abs(X);
    ll num=X/D;
    if(X%D>0)num++;

    if(num>K)X-=D*K;
    else {
        X-=D*num;
        if((K-num)%2==1)X+=D;
    }
    cout<<abs(X)<<endl;
}

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

int main(void){
    long int N, T;
    cin >> N >> T;
    long int t[N];
    for(int i = 0; i < N; i++) cin >> t[i];
    long int ans = 0;
    for (int i = 0; i < N-1; i++)
    {
        if (t[i+1] - t[i] > T)
        {
            ans += T;
        }
        else
        {
            ans += t[i+1] - t[i];
        }
    }
    ans += T;
    cout << ans << endl;
    
    return 0;
}

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

using namespace std;

int n;

void solve(){
    int i,j;
    string str;
    cin >> n;
    vector<long long> a(n),b(n);
    long long sa = 0,sb = 0;
    for(i = 0;i < n;i++){
        cin >> a[i];
        sa += a[i];
    }
    for(i = 0;i < n;i++){
        cin >> b[i];
        sb += b[i];
    }
    if(sa < sb){
        cout << -1 << endl;
        return;
    }
    vector<long long> p;
    long long m = 0;
    int ans = 0;
    for(i = 0;i < n;i++){
        if(a[i] < b[i]){
            m += b[i] - a[i];
            ans++;
        }
        else if(a[i] > b[i]) p.push_back(a[i]-b[i]);
    }
    sort(p.begin(),p.end());
    for(i = p.size()-1;i >= 0;i--){
        if(m <= 0) break;
        ans++;
        m -= p[i];
    }
    cout << ans << endl;
}

int main(){
    solve();
}


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

int main (){
    long long A, B, K = 0;
    cin >> A >> B >> K;

    if(A >= K){
        cout << A - K <<' '<< B << endl;
    }
    else if(K <= A+B){

        cout << 0 << ' '<< B - K + A  << endl;
    }
    else
    {
        cout << 0 <<' '<< 0 << endl;
    }
}


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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer[] a = {1,3,5,7,8,10,12};
		Integer[] b = {4,6,9,11};
		int c = 2;
		int aCount = 0,bCount = 0,cCount = 0;
		int x = scanner.nextInt(),y = scanner.nextInt();
		if(Arrays.asList(a).contains(x)){
			aCount++;
		}else if(Arrays.asList(b).contains(x)){
			bCount++;
		}else if(c == x){
			cCount++;
		}
		if(Arrays.asList(a).contains(y)){
			aCount++;
		}else if(Arrays.asList(b).contains(y)){
			bCount++;
		}else if(c == y){
			cCount++;
		}
		if(aCount == 2 || bCount == 2 || cCount == 2){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 20820
a = ("a".."z").to_a
b = Array.new(26, 0)

while x = gets
  x.downcase.chars { |i|
    for j in 0..25
      b[j] += 1 if i == a[j]
    end
  }
end

a.size.times { |c|
  puts "#{a[c]} : #{b[c]}"
}

Measured memory_bytes: 8712
def main():
    n, w = map(int, input().split())
    dp = [[0]*(w+1) for _ in range(n+1)]
    for i in list(range(n+1))[1:]:
        wi, vi = map(int, input().split())
        dp[i] = [max(dp[i-1][j], dp[i-1][j-wi]+vi) if j >= wi else dp[i-1][j] for j in range(w+1)]
    print(max(dp[-1]))

if __name__ == '__main__':
    main()

Measured memory_bytes: 188400
// C - Bugged
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define MAX 10000 // N*si = 100*100

int main(){
	int N; cin>>N;
	int maxi = 0;
	vi dp(MAX+1);
	dp[0] = true;
	for(int i=1; i<=N; ++i){
		int s; cin>>s;
		for(int j=MAX; j>=s; --j){
			if(dp[j-s]){
				dp[j] = true;
				maxi = max(maxi, (j%10? j: 0));
			}
		}
	}
	cout<< maxi <<endl;
}

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

using namespace std;
typedef long long ll;
// #define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const int INF = (1LL<<30);
#else
const ll INF = (1LL<<60);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

signed main(void)
{
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b) cout << c << endl;
  else if(b == c) cout << a << endl;
  else cout << b << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

color = {1:[],2:[], 3:[],4:[],5:[],6:[],7:[],8:[]}
suki = []
iroiro = 0
for i in range(n):
    if a[i] < 1600:
        if a[i] < 800:
            if a[i] < 400:
                color[1].append(a[i])
            else:
                color[2].append(a[i])
        else:
            if a[i] < 1200:
                color[3].append(a[i])
            else:
                color[4].append(a[i])
    else:
        if a[i] < 2400:
            if a[i] < 2000:
                color[5].append(a[i])
            else:
                color[6].append(a[i])
        else:
            if a[i] < 2800:
                color[7].append(a[i])
            elif 2800 <= a[i] < 3200:
                color[8].append(a[i])
            else:
                suki.append(a[i])

for k in color.keys():
    if len(color[k]) != 0:
        iroiro += 1
    else:
        pass
Co = len(suki)
if iroiro != 0:
    ans = iroiro + Co
    print(iroiro,ans)
else:
    print(1,Co)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s,s1,s2;
//vvl v;
//vl vis,d;

ld dp[301][301][301];

ld sg(ll a, ll b, ll c){
    //cout<<a<<" "<<b<<" "<<c<<endl;
    if(a<0||b<0||c<0)return 0;
    if(dp[a][b][c]!=-1)return dp[a][b][c];
    ld ans=(ld)n/(a+b+c)*(1+sg(a-1,b+1,c)*a/n+sg(a,b-1,c+1)*b/n+sg(a,b,c-1)*c/n);
    return dp[a][b][c]=ans;
}

int main() {
    IOS;
    cin>>n;
    fo(i,301)fo(j,301)fo(k,301)dp[i][j][k]=-1;
    fo(i,n){
        cin>>p;
        if(p==1)x++;
        else if(p==2)y++;
        else z++;
    }
    dp[0][0][0]=0;
    cout<<sg(z,y,x);
    return 0;
}


Measured memory_bytes: 426496
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);

            if ((a*b)%2 == 0)
            {
                Console.WriteLine("Even");
            }
            else Console.WriteLine("Odd");
            Console.Read();
        }
    }
}


Measured memory_bytes: 11092
A,B,C,X,Y=map(int,input().split())
L=[]
L.append(A*X+B*Y)
for i in range(min(X,Y)+1):
    L.append(A*X+B*Y-A*i-B*i+2*C*i)
ans=min(L)
if max(X,Y)*2*C<ans:
    ans=max(X,Y)*2*C
print(ans)


Measured memory_bytes: 7048
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Jul 25 21:27:07 JST 2020
 **/

signed main() {
    Int a, b, c, K;
    std::cin >> a >> b >> c >> K;
    Int cnt = 0;
    while (b <= a) cnt++, b *= 2;
    while (c <= b) cnt++, c *= 2;
    std::cout << (cnt <= K ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N;
    cin >> N;
    N %= 10;
    if(N == 3){
        cout << "bon" << "\n";
    }else if(N == 0||N == 1||N == 6||N == 8){
        cout << "pon" << "\n";
    }else{
        cout << "hon" << "\n";
    }
}

Measured memory_bytes: 3640
import java.util.*;

public class Main {
    static long mod = 1000000007;

    public static long gcd(long a, long b) {
        if (a == 0) {
            return b;
        } else if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n+1];
        int[] r = new int[n+1];

        for (int i = 1; i <= n; ++i) {
            a[i] = sc.nextInt();
        }

        for (int i = n; i >= 1; --i) {
            int total = 0;
            for (int j = i * 2; j <= n; j += i) {
                total += r[j];
            }
            if (total % 2 == a[i]) {
                r[i] = 0;
            } else {
                r[i] = 1;
            }
        }

        int cnt = 0;
        for (int i = 1; i <= n; ++i) {
            // System.err.println(String.format(">> %d %d", i, r[i]));
            if (r[i] > 0) {
                cnt++;
            }
        }

        System.out.println(cnt);
        if (cnt > 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = 1; i <= n; ++i) {
                if (r[i] > 0) {
                    sb.append(i);
                    cnt--;
                    if (cnt > 0) {
                        sb.append(" ");
                    }
                }
            }
            System.out.println(sb.toString());
        }
    }
}


Measured memory_bytes: 80532
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(){
    vector<int> vec(26);
    string s;cin>>s;
    for(char c:s)vec[c-'a']++;
    string ans="None";
    for(int i=0;i<26;i++){
        if(vec[i]==0){ans=char('a'+i);break;}
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3708
from collections import deque

class UnionFind():
    def __init__(self,size):
        self.table = [-1 for _  in range(size)]
        self.member_num = [1 for _ in range(size)]
 
    #representative
    #O(a(N))
    def find(self,x):
        Q = deque()
        while self.table[x] >= 0:
            Q.append(x)
            x = self.table[x]
        while len(Q)>0:
            y = Q.pop()
            self.table[y] = x
        return x

    def union(self,x,y):
        s1 = self.find(x)
        s2 = self.find(y)
        m1=self.member_num[s1]
        m2=self.member_num[s2]
        if s1 != s2:
            if m1 != m2:
                if m1 < m2:
                    self.table[s1] = s2
                    self.member_num[s2]=m1+m2
                    return [m1,m2]
                else:
                    self.table[s2] = s1
                    self.member_num[s1]=m1+m2
                    return [m1,m2]
            else:
                self.table[s1] = -1
                self.table[s2] = s1
                self.member_num[s1] = m1+m2
                return [m1,m2]
        return [0,0]

N,Q = list(map(int,input().split()))

UF = UnionFind(N)

for i in range(Q):
    c,a,b = list(map(int,input().split()))
    #print(UF.table)
    if c==0:
        UF.union(a,b)
    else:
        if UF.find(a)==UF.find(b):
            print(1)
        else:
            print(0)


Measured memory_bytes: 6212
#include <iostream>

const int P = (int)1e9 + 7;

int64_t pow(int64_t x, int64_t y) {
  int64_t ans = 1;
  while (y > 0) {
    if (y & 1) ans = ans * x % P;
    x = x * x % P;
    y >>= 1;
  }
  return ans;
}

int64_t comb(int64_t x, int64_t y) {
  if (y == x || y == 0) return 1;
  int64_t ans = 1;
  for (int i = 1; i <= y; ++i) {
    ans = ans * (x - y + i) % P * pow(i, P - 2) % P;
  }
  return ans;
}

int solve(int n, int a, int b) {
  return ((pow(2, n) - 1 - comb(n, a) - comb(n, b)) % P + P) % P;
}

int main() {
  int n, a, b;
  std::cin >> n >> a >> b;
  std::cout << solve(n, a, b) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
	return b? gcd(b,a%b):a;
}
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	int n,a[100001];
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	int lft[100001],right[100001];
	lft[0]=a[0];
	right[0]=a[n-1];
	for(int i=0;i<n-1;i++){
		lft[i+1]=gcd(lft[i],a[i+1]);
		right[i+1]=gcd(right[i],a[n-i-2]); 
	}
	//for(int i=0;i<n;i++)
	//cout<<lft[i]<<' '<<right[i]<<endl;
	int ans=1;
	for(int i=0;i<n;i++){
		int nowans;
		if(i==0)nowans=right[n-2-i];
		else if(i==n-1)nowans=lft[i-1];
		else nowans=gcd(lft[i-1],right[n-i-2]);
		ans=max(ans,nowans);
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4776
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ll n; cin >> n;
  ll inf = (ll)std::sqrt((double_t)n);

  ll res{-1};
  for (ll i = inf; i >= 0; --i) {
    if (n % i == 0) {
      res = i;
      break;
    }
  }

  auto ans = (res + n / res) - 2;
  cout << ans << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
import sys

def print_data(data):
    last_index = len(data) - 1
    
    for idx, item in enumerate(data):
        print(item, end='')
        if idx != last_index:
            print(' ', end='')

    print('')
        
def main():
    N = int(input())
    data = list(map(int, input().split()))
    counter = 0
    
    for i in range(N):
        mini = i
        for j in range(i, N):
            if data[j] < data[mini]:
                mini = j
        if i == mini:
            pass
        else:
            hoge = data[mini]
            data[mini] = data[i]
            data[i] = hoge
            counter += 1
                  
        
    print_data(data)
    print(counter)
    
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 5632
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main(){

	int t,x;
	double f=0;
	cin>>t>>x;
	f=(double(t))/x;

	cout<<f<<endl;
	return 0;
}


Measured memory_bytes: 256
N, M = list(map(int, input().split()))
PS = [input().split() for _ in range(M)]

ps = [(int(p)-1, s) for p, s in PS]

ac = [0]*N
wa = [0]*N
for p, s in ps:
    if s == "AC":
        ac[p] = 1
    else:
        if ac[p] == 0:
            wa[p] += 1

print(sum(ac), sum([a*w for a, w in zip(ac, wa)]))

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


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    ll N;
    cin>>N;
    ll ans = 0;
    rep(i,1,N){
        ans += (N-1)/i;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3628
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
inf = 1000000007
for i in range(N):
    f, b = 0, 0
    for j in range(N):
        if A[i] > A[j]:
            if i < j:
                b += 1
            else:
                f += 1
    ans += f * (K - 1) * K // 2 + b * (K + 1) * K // 2
    ans %= inf
print(ans)


Measured memory_bytes: 42092
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
#define int long long
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;


signed main(){
	
	int n,ans=0,ans2=0;
	cin>>n;
	int a[111111],sum=0,sum2=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		sum2+=a[i];
		if(i%2==0){//sum+ sum2-
			if(sum<=0){
				ans+=1-sum;
				sum=1;
			}
			
			if(sum2>=0){
				ans2+=1+sum2;
				sum2=-1;
			}
			
			
		}
		else{
			if(sum>=0){
				ans+=1+sum;
				sum=-1;
			}
			
			if(sum2<=0){
				ans2+=1-sum2;
				sum2=1;
			}
			
		}
		DEB(sum)END
		DEB(sum2)END
	}
	cout<<min(ans,ans2)<<endl;
	
}

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

int main(){
  long long N;
  cin >> N;

  long long tmp=1;
  while(1){
    if(tmp*(tmp+1)/2>=N){
      long long no=(tmp*(tmp+1)/2)-N;
      for(long long i=1;i<=tmp;i++){
        if(i==no) continue;
        cout << i << endl;
      }
      return 0;
    }
    tmp++;
  }

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int n = 3;
        set<int> s;
        for (int i = 0; i < n; ++i) {
            Int a;
            cin >> a;
            s.insert(a);
        }
        if (s.size() == 2) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }


    }
};


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

    Solve().solve();


    return 0;
}


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

int main()
{
    int x; cin >> x;
    
    if(x >= 400 && x < 600) cout << 8;
    else if(x >= 600 && x < 800) cout << 7;
    else if(x >= 800 && x < 1000) cout << 6;
    else if(x >= 1000 && x < 1200) cout << 5;
    else if(x >= 1200 && x < 1400) cout << 4;
    else if(x >= 1400 && x < 1600) cout << 3;
    else if(x >= 1600 && x < 1800) cout << 2;
    else cout << 1;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << endl;}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
int v[510][510];
void solve() {
	var(int, h, w);
	rep(i, 1, h + 1) {
		rep(j, 1, w + 1) {
			cin >> v[i][j];
		}
	}
	vector<vi> ans;
	rep(i, 1, h) {
		rep(j, 1, w + 1) {
			if (v[i][j] & 1) {
				ans.eb(vi{i, j, i + 1, j});
				++v[i + 1][j];
			}
		}
	}
	rep(j, 1, w) {
		if (v[h][j] & 1) {
			ans.eb(vi{h, j, h, j + 1});
			++v[h][j + 1];
		}
	}
	print(len(ans));
	each(a, ans) {
		print(a[0], a[1], a[2], a[3]);
	}
}
int main() {
	solve();
	return 0;
}


Measured memory_bytes: 10032
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin>>n;
  string s;
  cin >> s;
  for(int i=n;i!=0;i--){
    if(s[i]==s[i-1]){
      s.erase(s.begin()+i);
    }
  }
  cout<<s.size();
}

Measured memory_bytes: 512
#include <stdio.h>
 
void swap(int A[], int i, int j) {
    int t;
    t = A[i];
    A[i] = A[j];
    A[j] = t;
}
 
int partition(int A[], int p, int r) {
    int x,i,j,t;
    x = A[r];
    i=p;
    for(j=p;j<r;j++) {
        if(A[j] <= x) {
            swap(A, i, j);
            i++;
        }
    }
     
    swap(A, i, r);
    return i;
}
 
int A[100000+2];
 
int main(void) {
    int n,i,t;
    scanf("%d\n", &n);
    for(i=0;i<n;i++) {
        scanf("%d", &A[i]);
    }
     
    t = partition(A, 0, n-1);
    for(i=0;i<n;i++) {
        if(t == i) {
            printf("[%d]", A[i]);
        } else {
            printf("%d", A[i]);
        }
         
        if(i<n-1) {
            printf(" ");
        } else {
            printf("\n");
        }
    }
     
    return 0;
}


Measured memory_bytes: 2244
#include<iostream>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    if(a + b == 15){
        cout << "+" << endl;
    }else if(a * b == 15){
        cout << "*" << endl;
    }else{
        cout << "x" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    H = list(map(int, input().split()))
    ans = 1
    for i in range(1, N):
        k = True
        for j in range(i):
            if H[i] < H[j]:
                k = False
                break
        if k:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import math
s = input().split(" ")
A = int(s[0])
B = int(s[1])

for i in range(1001):
    e = math.floor(i * 0.08)
    t = math.floor(i * 0.1)

    if e == A and t == B:
        print(i)
        break
else:
    print(-1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std; 
int main(){
  int H,W,i;
  char a;
  cin>>W>>H;
  string S,s;
  for(i=0;i<W;i++){    
    cin>>s;
    S+=s;
  }
  for(i=0;i<H*W;i++){
    if(S.at(i)!='#'){
      a='0';
      bool x=(i%H==0||i==0),y=(i%H==H-1||i==W*H-1),z=i>=H,w=i+H<W*H;
      if(!x&&S.at(i-1)=='#')a++;
      if(!y&&S.at(i+1)=='#')a++;
      if(z&&S.at(i-H)=='#')a++;
      if(w&&S.at(i+H)=='#')a++;
      if(!x&&z&&S.at(i-H-1)=='#')a++;
      if(!x&&w&&S.at(i+H-1)=='#')a++;
      if(!y&&z&&S.at(i-H+1)=='#')a++;
      if(!y&&w&&S.at(i+H+1)=='#')a++;
      S.at(i)=a;
    }
    cout<<S.at(i);
    if((i+1)%H==0)cout<<endl;
  }
}

Measured memory_bytes: 256
n = int(input())
A = [[0]*10 for i in range(12)] 

for _ in range(n):
    b, f, r, v = map(int, input().split())
    A[(b-1)*3 + (f-1)][r-1] += v
for i, v in enumerate(A, 1):
    print(' ' + ' '.join([str(p) for p in v]))
    if i == 3 or i == 6 or i == 9:
        print('####################')


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

using namespace std;
typedef long long ll; //10^18
typedef unsigned long ul;

#define MOD 1000000007LL

signed main()
{

	ll n, k;
	cin >> n >> k;
    
    ll ans = 0;
        for(int i=k; i<=n+1; i++) {
            ans = (ans + i*(n-i+1) + 1) % MOD;
        }

	cout << ans << endl;

	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int n, k;
  cin >> n >> k;
  vi h(n);
  re(i, n) cin >> h[i];

  int cnt = 0;
  re(i, n) {
    if(h[i] >= k) cnt++;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cstring>
#include <iostream>
#include <deque>
using namespace std;
#define reg register
#define LL long long
#define INF 0x3f3f3f3f
#define max(a, b) (a > b ? a : b)

template<typename T>
void re (T &x){
    x = 0;
    int f = 1;
    char c = getchar ();
    while (c < '0' || c > '9'){
        if (c == '-') f = -1;
        c = getchar ();
    }
    while (c >= '0' && c <= '9'){
        x = (x << 1) + (x << 3) + c - 48;
        c = getchar ();
    }
    x *= f;
}

template<typename T>
void pr (T x){
    if (x < 0){
        putchar ('-');
        x = ~x + 1;
    }
    if (x / 10) pr (x / 10);
    putchar (x % 10 + 48);
}

const int mod = 1e9 + 7;
#define N 2000
#define niyuan 500000004

int n, k, tmp[N + 5], a[N + 5];
LL ans, sum1, sum2;

/*void mergesort (int l, int r){
    if (l == r) return ;
    int mid = (l + r) >> 1;
    mergesort (l, mid); mergesort (mid + 1, r);
    int x1 = l, x2 = mid + 1, now = l - 1;
    while (x1 <= mid && x2 <= r){
        if (a[x1] <= a[x2]) tmp[++ now] = a[x1 ++];
        else{
            sum += mid * 1ll - x1 * 1ll + 1ll;
            tmp[++ now] = a[x2 ++];
        }
    }
    while (x1 <= mid) tmp[++ now] = a[x1 ++];
    while (x2 <= mid) tmp[++ now] = a[x2 ++];
    for (int i = l; i <= r; i++)
        a[i] = tmp[i];
}*/

int main (){
    re (n); re (k);
    bool flag = 0;
    for (int i = 1; i <= n; i++)
        re (a[i]);
	for (int i = 1; i <= n; i++){
		for (int j = 1; j < i; j++){
			if (a[i] < a[j]) sum2 ++;
			else if (a[j] < a[i]) sum1 ++;
		}
	}
	ans = sum1 * k % mod * (k * 1ll - 1ll) % mod * niyuan % mod;
	ans = (ans + sum2 * k % mod * (k * 1ll + 1ll) % mod * niyuan % mod) % mod;
	pr (ans); putchar (10);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N;
  cin >> N;
  vl A(N),s(N+1);
  rep(i,N) {
    cin >> A[i];
    s[i+1]=s[i]+A[i];
  }
  
  ll ans=1e15;
  rep(i,N) ans=min(ans,abs(s[N]-2*s[i]));
  
  cout << ans << endl;
}

Measured memory_bytes: 3328
// http://algorithms.blog55.fc2.com/blog-entry-66.html

#include <stdio.h>
#include <string.h>

#define M 100

int N,R[M+1],C[M][M],B[M][M];

void compute(){
	int i=0,j,k,cost;
	memset(C,99,sizeof(C));
	for(;i<N;i++)C[i][i]=0;
	for(j=1;j<N;j++)
		for(i=0;i<N - j; i++ )
			for (k = i; k < i + j; k++ ){
				cost = C[i][k] + C[k+1][i+j] + R[i]*R[k+1]*R[i+j+1];
				if(cost<C[i][i+j])C[i][i+j]=cost,B[i][i+j]=k; 
			}
}

void order( int i, int j ){
	if(i==j)printf("M%d",i);
	else{
		printf("(");
		order( i, B[i][j]-1 ); order(B[i][j], j);
		printf(")");
	}
}

void input(){
	scanf("%d",&N);
	int z,i=0;
	for(;i<N;i++)scanf("%d%d",R+i,&z);
	R[i]=z;
}

void output(){
	printf("%d\n",C[0][N-1]);
	//order(0, N);
	//puts("");
}

main(){
	input();
	compute();
	output();
}

Measured memory_bytes: 1108
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}



int main(){
    vector<int>a(5);

    rep(i,5)cin >> a[i];

    int k;
    cin >> k;

    bool can = true;

    if(a[1]-a[0] >k || a[2]-a[0] > k ||a[3]-a[0] > k ||a[4]-a[0] > k )can = false;
    else if(a[2]-a[1] >k || a[3]-a[1] > k ||a[4]-a[1] > k )can = false;
    else if(a[3]-a[2] >k || a[4]-a[2] > k )can = false;
    else if(a[4]-a[3] >k) can = false; 

    if(can) cout << "Yay!" << endl;
    else cout << ":(" << endl;
}


Measured memory_bytes: 3548
#include <stdio.h>

int include3(int x) {
    while(x) {
        if(x%10==3) return 1;
        x/=10;
    }
    return 0;
}

int main()
{
    int i, n;
    scanf("%d", &n);
    for(i=1; i<=n; i++) {
        if(i%3==0 || include3(i)) printf(" %d", i);
    }
    putchar('\n');
    return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cstring>
#include<cmath>
#define maxst 1<<20
using namespace std ;
int n , m , p , u , v ;
int r[maxst] ;
double f[maxst] ;

int main() {
	scanf("%d%d%d",&n,&m,&p) ;
	const int maxs = 1 << n;
	for(int i = 0 ; i < m ; i++) {
		scanf("%d%d",&u,&v) ; 
		u-- ; v-- ;
		for(int j = 0 ; j < maxs ; j++) if((j&(1<<u)) && (j&(1<<v)))
		r[j]++ ;
	}
	for(int i = 1 ; i < maxs ; i++) if(i&1){
		f[i] = 1.0 ;
		for(int j = i&(i-1) ; j ; j = i&(j-1)) if(j&1)
			f[i] -= f[j] * pow(p*0.01 , r[i]-r[j]-r[(~j)&i]) ;
	}
	printf("%.9f\n",f[maxs-1]) ;
	return 0 ;
}

Measured memory_bytes: 3252
# coding: utf-8
import itertools

def main():
    n = int(input())
    if n < 3:
        return 0
    l_array = list(map(int, input().split()))
    ans = 0
    for (a, b, c) in itertools.combinations(l_array, 3):
        if a == b or b == c or c == a:
            continue
        elif a + b <= c or b + c <= a or c + a <= b:
            continue
        else:
            ans += 1
    return ans
        
print(main())


Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
 
int main() 
{
    long N,K,L;
    cin>>N>>K;

    vector<long>A;
    for (int i = 0; i < N; i++)
    {
        long a;
        cin>>a;
        A.push_back(a);
    }
 
    for (int i = K; i < N; i++)
    {
        if(A[i]>A[i-K])
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 5268
#include<bits/stdc++.h>
using namespace std;
int main(){
int i,j,n,m;
cin>>n;
int t[n];
long long int s=0;
for(i=1;i<=n;i++){
    cin>>t[i];
    s+=t[i];
}
cin>>m;
int p[m],x[m];

int f;
for(j=1;j<=m;j++){cin>>p[j]>>x[j];
    f=x[j]-t[p[j]];
    cout<<s+f<<endl;
}

  return 0;
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

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

vector<int> h(N);
REP(i, N) cin >> h[i];

int cnt = 0;
while(true){
	if(*max_element(all(h)) == 0) break;
	int i = 0;
	while(i < N){
		if(h.at(i) == 0) i++;
		else{
			++cnt;
			while(i < N && h.at(i) > 0  ){
				// print(i);
				h.at(i)--;
				++i;
			}
		}
	}
}
print(cnt);

}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main() {
    int in;
    int h,m,s;
    cin>>in;
    s=in%60;
    in-=s;
    m=in%3600;
    in-=m;
    m/=60;
    h=in/3600;
    cout<<h<<':'<<m<<':'<<s<<endl;
}


Measured memory_bytes: 3116
import collections
from sys import stdin

# # not AC
# def counter(num_arr):
#     uniq_dict = {}
#     for val in num_arr:
#         uniq_dict[val] = uniq_dict.get(val, 0) + 1
#     return uniq_dict


# def get_result(data):
#     N = data[0][0]
#     A = data[1]
#     uniq_cnt = counter(A)
#     ans = {}
#     for key in uniq_cnt.keys():
#         tmp = uniq_cnt.copy()
#         tmp[key] -= 1
#         ans[key] = int(sum([val * (val-1) / 2 for val in tmp.values()]))

#     for i in range(N):
#         print(ans[A[i]])

def get_result(data):
    N = data[0][0]
    A = data[1]
    uniq_cnt = collections.Counter(A)
    all_selection = 0
    for val in uniq_cnt.values():
        all_selection += int(val * (val-1) / 2)

    for i in range(N):
        print(all_selection - uniq_cnt[A[i]] + 1)


if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    get_result(data)


Measured memory_bytes: 27064
#include "bits/stdc++.h"
using namespace std;
#define INF 20000
int main() {
	long long N, X, Y;
	cin >> N >> X >> Y;
	vector<vector<long long>>Graph(N, vector<long long>(N, INF));
	for (long long i = 0; i < N - 1; i++) {
		Graph.at(i).at(i + 1) = 1;
		Graph.at(i + 1).at(i) = 1;
	}
	for (int i = 0; i < N; i++) {
		Graph.at(i).at(i) = 0;
	}
	Graph.at(X - 1).at(Y - 1) = 1;
	Graph.at(Y - 1).at(X - 1) = 1;
	vector<long long>ans(30000, 0);
	for (long long i = 0; i < N - 1; i++) {
		for (long long j = i + 1; j < N; j++) {
			Graph.at(i).at(j) = min(j - i, abs(X - i - 1) + 1 + abs(Y - j - 1));
		}
	}
	for (long long i = 0; i < N - 1; i++) {
		for (long long j = i + 1; j < N; j++) {
			ans.at(Graph.at(i).at(j) - 1)++;
		}
	}
	for (long long i = 0; i < N - 1; i++) {
		cout << ans.at(i) << endl;
	}
}


Measured memory_bytes: 31872
N=int(input())
A=list(map(int,input().split()))
A=sorted(A,reverse=True)

N-=1
i=1
koko=A[0]
f=0
while 1:
  for _ in range(2):
    N-=1
    if N==0:
      f=1
      break
    koko+=A[i]
  if f==1:
    break
  i+=1
print(koko)

Measured memory_bytes: 31400
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

int main(){

    while(true){
        int h,w;
        cin >> h >> w;
        if(h == 0 && w == 0)break;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(i % 2 == 0){
                    if(j%2==0){
                        cout <<"#";
                    }else{
                        cout <<".";
                    }
                }else{
                    if(j % 2 == 0){
                        cout <<".";
                    }else{
                        cout <<"#";
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }



}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep1(i,a,b) for(int i=(a);(i)<=(b);(i)++)
#define rep(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
#define mpi map<int,int>
#define N 200005
#define pql priority_queue<ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
using namespace std;
int n,a[N],ans[N];
int main() {
	cin>>n;
	rep(i,0,n-1){
		cin>>a[i];
		ans[a[i]-1]++;
	}
	rep(i,0,n)cout<<ans[i]<<"\n";
	return 0;
}


Measured memory_bytes: 5160
import sys
input = sys.stdin.readline
n = int(input())
s = input()
ans = 0
r = [0] * n
w = [0] * n
for i in range(n):
  if s[i] == 'W':
    w[i] += 1
  else:
    r[i] += 1
for i in range(1, n):
  w[i] += w[i - 1]
  r[i] += r[i - 1]
rn = r[n - 1]
ans = n
if rn == 0:
  ans = 0
for i in range(n):
  c = (i + 1)
  ri = r[i]
  left = rn - ri
  need = c - ri
  ans = min(ans, max(left, need))  

print(ans)


Measured memory_bytes: 24816
/******************************************************************************

                         بسم الله الرحمن الرحيم
                     Author: Mst: Mhamuda Khatun
                               RUCSE27

*******************************************************************************/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 1000000007
#define MAX 1000000000000
#define N 305

int main()
{
    fastio;
    ll a,b;
    cin>>a>>b;

    if(a%2==b%2)
        cout<<(a+b)/2;
    else
        cout<<"IMPOSSIBLE";

    cout<<"\n";
    return 0;   //:D
}




Measured memory_bytes: 256