akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

int isprime[1000100];

void Eratos(int n){
  int i;
  ++n;
  //int isprime[n];
  for(i = 0; i < n; i++){
    isprime[i] = 1;
  }

  isprime[0] = isprime[1] = 0;

  for(i = 2; i*i <= n; ++i){
    if(isprime[i]){
      int j = i + i;
      while(j <= n){
        isprime[j] = 0; //iの倍数を除去
        j = j + i;
      }
    }
  }
  // for(i = 0; i <= n; i++){
  //   if(isprime[i]) cout << i << endl;
  // }

}

int main(){
  int n;
  cin >> n;
  const int nmax = 1000010;
  Eratos(nmax);
  vector<int> a(n);
  vector<int> c(nmax);
  sort(ALL(a));
  REP(i,n) {
    cin >> a[i];
    c[a[i]]++;
  }

  bool ok = false;
  REP2(i,2,nmax){
    if(!isprime[i]) continue;
    //cout << i;
    int cnt = 0;
    for(int j = i; j < nmax; j += i){
      cnt += c[j];
    }
    if(cnt > 1){
      ok = true;
      break;
    }
  }

  if(!ok){
    cout << "pairwise coprime" << endl;
    return 0;
  }

  int gcdst = a[0];
  REP2(i,1, n){
    gcdst = __gcd(gcdst,a[i]);
  }
  if(gcdst == 1) cout << "setwise coprime" << endl;
  else cout << "not coprime" << endl;

  return 0;
}

Measured memory_bytes: 14736
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ");cout<<endl;
#define pdd(a,n,m)for(int i=0;i<n;i++){for(int j=0;j<m;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define mp make_pair
#define pb push_back
#define ll long long
//#define __int64 lng long
#define P pair<int,int>
#define PP pair<P,int>

int x,y,m;
int a[111111],b[111111];

int main(){
  cin>>x>>y>>m;
  rep(i,x)cin>>a[i];
  rep(i,y)cin>>b[i];
  int ans=100000000;
  rep(i,m){
    int c,d,e;
    cin>>c>>d>>e;
    c--;
    d--;
    ans=min(ans,a[c]+b[d]-e);
  }

  sort(a,a+x);
  sort(b,b+y);
  ans=min(ans,a[0]+b[0]);
  cout<<ans<<endl;
  return 0;
}

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

int main() {
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    sort(a.begin(), a.end());

    int cnt = 0;
    for (int i = 0; i < n - 1; i++) {
        if (x >= a[i]) {
            x -= a[i];
            cnt++;
        }
    }
    if (x == a[n-1]) {
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

#define ll long long
#define all(x) (x).begin(),(x).end()
#define SZ(x) (x).size()
#define fir first
#define sec second

void scan() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


using namespace std;
const int maxn = 2e5 + 7;
struct node {
    int fi, se;
} a[maxn];

bool cmp(node a, node b) {
    return a.fi == b.fi ? a.se < b.se : a.fi < b.fi;
}

int main() {
    //scan();

    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        int x, val;
        cin >> x >> val;
        a[i].fi = m - x + 1;
        a[i].se = val;
    }
    ll ans = 0;
    sort(a + 1, a + 1 + n, cmp);
    priority_queue<int> que;
    for (int i = m, j = n; i >= 1; i--) {
        for (; j; j--) {
            if (a[j].fi < i) break;
            que.push(a[j].se);
        }
        if (!que.empty()) {
            ans += que.top();
            que.pop();
        }
    }
    cout << ans << endl;
    return 0;
}




















Measured memory_bytes: 1660
import math
from math import modf

n = int(input())
A = input()
B = input()
C = input()
a = [(int(i) + 0.1) for i in A.split()]
b = [int(i) for i in B.split()]
c = [(int(i) - 0.1) for i in C.split()]
al = sorted(a + b + c)
ans = 0
a_count = 0
c_count = n
for i in al:
    decimal, integer = modf(i)
    if decimal > 0.8:
        c_count -= 1
    elif decimal > 0.05:
        a_count += 1
    else:
        ans += a_count * c_count
print(ans)


Measured memory_bytes: 23832
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>

using namespace std;

int sum( vector<int> v ) {
  int sum = 0;
  for ( const int val : v ) {
	sum += val;
  }
  return sum;
}

int diff( int i, vector<int>& v ) {
  int sumA = 0;
  int sumB = 0;
  for ( int index = 0; index < v.size(); index++ ) {
	if ( i % 2 == 0 ) {
	  sumA += v[ index ];
	} else {
	  sumB += v[ index ];
	}
	i /= 2;
  }
  return abs( sumA - sumB );
}

int main() {
  
  while( true ){
	int n;
	cin >> n;
	if ( n == 0 ) break;
	vector<int> v( n );
	for ( int i = 0; i < n; i++ ) {
	  cin >> v[ i ];
	}
	int ans = sum( v );
	for ( int i = 0; i < (1 << n); i++ ) {
	  ans = min( ans, diff( i, v ) );
	}
	cout << ans << endl;
  }  
}

Measured memory_bytes: 1204
N = int(input())
if N == 0:
    print(0)
    exit()

if N > 0:
    N_bin = bin(N)[2:]
else:
    N_bin = bin(-N)[2:]
ans = [s for s in N_bin]
ans.reverse()
ans.append('0')
ans.append('0')

if N >= 0:
    p = 1
else:
    p = 0
for i in range(len(ans)):
    if i % 2 == p:
        if ans[i] == '1':
            k = i
            while True:
                if ans[k+1] == '0':
                    ans[k+1] = '1'
                    break
                else:
                    ans[k+1] = '0'
                    k += 1
while ans[-1] == '0':
    ans.pop()

ans.reverse()
print(''.join(ans))


Measured memory_bytes: 38384
n = STDIN.gets.to_i
a = STDIN.gets.split.map(&:to_i)

flg = true
a.each do |i|
  if i.even?
    if i % 3 != 0 && i % 5 != 0
      flg = false
      break
    end
  end
end

puts flg ? 'APPROVED' : 'DENIED'


Measured memory_bytes: 1788
#!/usr/bin/env ruby

n = gets.to_i
line1 = gets.split.map {|num| num.to_i }
line2 = gets.split.map {|num| num.to_i }

line1scores = line1.clone
line2scores = line2.clone

(0..n-1).reverse_each do |i|
  line2scores[i] += line2scores[i+1].to_i
end

(0..n-1).reverse_each do |i|
  left = line1scores[i+1].to_i
  down = line2scores[i]
  line1scores[i] += (left > down)? left : down
end

# pp line1
# pp line2
# pp line1scores
# pp line2scores

point = line1[0]
current_x = 0

while line1scores[current_x + 1].to_i > line2scores[current_x]
  # puts "%d + %d" % [point, line1[current_x + 1]]
  point += line1[current_x + 1]
  current_x += 1
end

# puts line2scores[current_x]
point += line2scores[current_x]

# puts '---'

puts point


Measured memory_bytes: 1788
/**********************************************************************************************
******************************AUTHOR:**********************************************************
****************************ASHISH RANJAN******************************************************
***********************************************************************************************/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<chrono>
#include<vector>
#include<string>
#include<cstring>
using namespace std;
using namespace std::chrono;
/*
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    cout << "Time taken by function: "
         << duration.count() << " microseconds" << endl;
*/
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
const int M = 1e9 + 7;
#define fr(i,n) for(int i=0;i<n;i++)
#define frs(i,a,b) for(int i = a;i<b;i++)
#define meme(a,b) memset(a,b,sizeof(a)); //works only for 0 and -1
ll mod(long long x){
 return (x%M+M)%M;
}
ll add(long long a,long long  b){
return mod(mod(a)+mod(b));
}
ll mul(long long a,long long b){
return mod(mod(a)*mod(b));
}
ll minu(long long a,long long b){
return mod(mod(a)-mod(b));
}
ll modPow(ll a,ll b){
if(b==0)return 1LL;
if(b==1)return a%M;
ll res= 1;
while(b){
if(b%2==1)
res = mul(res,a);
a = mul(a,a);
b/=2;
}
return res;
}
void solve(){
long long a;
string b;
 cin>>a>>b;
long long c = (b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
long long res = (a*c)/100;
// long long res = (long long)ans;
cout<<res;
}
int main(){
  fast();
//  int t;cin>>t;
//  while(t--){
    solve();
    cout<<endl;
//  }
 return 0;
}


Measured memory_bytes: 3640
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<int, PP> PPP;
struct edge { int to; int to2; int cost; };
int h[25];
signed main() {
	int n; cin >> n;
	rep(i, n)cin >> h[i];
	int cnt = 0;
	rep(i, n) {
		int flg = 0;
		rep(j, i ) {
			if (h[j] <= h[i])flg++;
		}
		if (flg == i)cnt++;
	}cout << cnt << endl;
}	


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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] x = new int[N];
        int[] y = new int[N];
        int[] h = new int[N];

        for (int i = 0; i < N; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
            h[i] = sc.nextInt();
        }

        // c_xとc_yの全探索
        int c_x = -1, c_y = -1, res_H = -1;

        for (int i_cx = 0; i_cx <= 100; i_cx++) {
            for (int i_cy = 0; i_cy <= 100; i_cy++) {
                // 中心が(x_i, y_i)であるときの高さをサンプル一つから求める
                int H = -1;
                for (int i_data = 0; i_data < N; i_data++) {
                    if (h[i_data] == 0) {
                        continue;
                    }
                    H = h[i_data] + (Math.abs(x[i_data] - i_cx) + Math.abs(y[i_data] - i_cy));
                }
                // 全サンプルに対して値の組の正当性を調査
                boolean allHsAreConsistent = true;
                for (int i_data = 0; i_data < N; i_data++) {
                    int expected_Hi = H - ((Math.abs(x[i_data] - i_cx) + Math.abs(y[i_data] - i_cy)));
                    expected_Hi = Math.max(0, expected_Hi);

                    if (expected_Hi != h[i_data]) {
                        allHsAreConsistent = false;
                        break;
                    }
                }
                if (allHsAreConsistent) {
                    c_x = i_cx;
                    c_y = i_cy;
                    res_H = H;
                }
            }
        }

        if (res_H == -1) {
            throw new Exception();
        }

        System.out.println(c_x + " " + c_y + " " + res_H);
    }
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A+B > C+D){
    cout << "Left" << endl;
  }
  else if(A+B == C+D){
    cout << " Balanced" <<endl;
  }
  else{
    cout <<  "Right" <<endl;
  }
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define INF 9223372036854775807 / 2
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair


using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

int a[402], b[402];
int dp[402][402];

int solve(int left, int right) {
	if (left == right) return 0;
	if (dp[left][right] != 0) return dp[left][right];

	int score = LL_HALFMAX;
	for (int mid = left; mid < right; mid++) {
		int tmp = solve(left, mid) + solve(mid + 1, right);
		if (score > tmp) {
			score = tmp;
		}
	}
	int secSum = b[right] - b[left - 1];

	return dp[left][right] = score + secSum;
}

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

	a[0] = b[0] = 0;
	int su = 0;
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
		su += a[i];
		b[i] = su;
	}
	cout << solve(1, N) << "\n";
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int dp[101][10001] = {};

int main() {
  int n, W;
  cin >> n >> W;
  vi v(n), w(n);
  REP(i, n) { cin >> v[i] >> w[i]; }
  FOR(i, 1, n + 1) {
    REP(j, W + 1) {
      dp[i][j] = dp[i - 1][j];
      if (j >= w[i - 1]) {
        dp[i][j] = max(dp[i][j], dp[i][j - w[i - 1]] + v[i - 1]);
      }
    }
  }

  int ans = 0;
  REP(i, W + 1) { ans = max(ans, dp[n][i]); }
  cout << ans << endl;
}



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

int main() {
  string S;
  cin >> S;
  int N = 0;
  for (auto letter : S) {
    N += letter - '0';
  }
  int X = stoi(S);
  if (X % N == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}



Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<functional>
#include<algorithm>
#include<bitset>
#include<utility>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
using namespace std;
long long ans;
int a[100005];
int b[100005];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	for(int i=0;i<n+1;i++)
		cin>>a[i];
	for(int i=0;i<n;i++)
		cin>>b[i];
	for(int i=0;i<n+1;i++)
	{
		if(a[i]>=b[i])
			ans+=b[i],a[i]-=b[i],b[i]=0;
		else
			b[i]-=a[i],ans+=a[i],a[i]=0;
		if(a[i+1]>=b[i])
			ans+=b[i],a[i+1]-=b[i],b[i]=0;
		else
			b[i]-=a[i+1],ans+=a[i+1],a[i+1]=0;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
 
signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);
  
  int n, t, a;
  cin >> n >> t >> a ;

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

  double m = INF;
  int b = 0;
  
  REP(i, n){
    if(abs(a - ( t - h[i] * 0.006)) < m){
      m = abs(a - ( t - h[i] * 0.006));
      b = i;
    }
  }

  cout << b + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
ll maxl(ll a, ll b){ return ((a<b)?b:a);}
ll minl(ll a, ll b){ return ((a>b)?b:a);}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int d,t,s;
    cin >> d >> t >> s;
    if (s*t>=d){
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}


Measured memory_bytes: 3648
//package com.company;
import java.util.*;

public class Main {
    static class Pair {
        int a, b;
        Pair(int a, int b) {
            this.a = a;
            this.b = b;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt(), n = sc.nextInt();
        ArrayList<Pair> a = new ArrayList<>(n);
        for (int i = 0; i < n; i++)
        {
            int r = sc.nextInt(), t = sc.nextInt();
            a.add(new Pair(r, t));
        }
        int[] dp = new int[21000];
        for (int i = 0; i < 21000; i++)
            dp[i] = (int)1E9;
        dp[0] = 0;
        for (int i = 0; i < h; i++)
            for (int j = 0; j < n; j++) {
                int damage = a.get(j).a;
                int cost = a.get(j).b;
                dp[i + damage] = Math.min(dp[i + damage], dp[i] + cost);
            }
        int ans = (int)1E9;
        for (int i = h; i < 21000; i++)
            ans = Math.min(ans, dp[i]);
        System.out.println(ans);
    }
}


Measured memory_bytes: 28100
#include<iostream>

using namespace std;

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

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>

int main() {
	int n; std::cin >> n;
	std::vector<std::vector<int>> nodes(n);
	for (auto i = 1; i < n; ++i) {
		int a, b; std::cin >> a >> b;
		nodes[a - 1].push_back(b - 1);
		nodes[b - 1].push_back(a - 1);
	}
	std::stack<int> stack; stack.push(0);
	std::vector<int> depth(n, -1); depth[0] = 1;
	while (!stack.empty()) {
		const auto top = stack.top(); stack.pop();
		for (const auto next : nodes[top]) if (depth[next] == -1) {
			depth[next] = depth[top] + 1;
			stack.push(next);
		}
	}
	const auto end_a = std::distance(depth.begin(), std::max_element(depth.begin(), depth.end()));
	stack.push(end_a);
	depth.assign(n, -1); depth[end_a] = 1;
	std::vector<int> height(n, -1);
	while (!stack.empty()) {
		const auto top = stack.top(); stack.pop();
		if (top >= 0) {
			stack.push(-1 - top);
			for (const auto next : nodes[top]) if (depth[next] == -1) {
				depth[next] = depth[top] + 1;
				stack.push(next);
			}
		}
		else {
			const auto current = -1 - top;
			height[current] = 1;
			for (const auto next : nodes[current]) {
				height[current] = std::max(height[current], height[next] + 1);
			}
		}
	}
	int max{ 2 };
	for (auto i = 0; i < n; ++i) if (nodes[i].size() >= 3) {
		std::vector<int> length; length.reserve(nodes[i].size() + 1);
		std::transform(nodes[i].begin(), nodes[i].end(), std::back_inserter(length), [&depth, &height, i](const int a) {return depth[i] < depth[a] ? height[a] : depth[a]; });
		std::sort(length.rbegin(), length.rend());
		const auto k = length[0] + length[2];
		if (length[0] == length[2]) {
			max = std::max(max, k);
		}
		else {
			max = std::max(max, k + 1);
		}
	}
	for (auto i = 1; i <= n; ++i) {
		if (3 <= i && i < max) {
			std::cout << '0';
		}
		else {
			std::cout << '1';
		}
	}
	std::cout << std::endl;
}



Measured memory_bytes: 10112
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout << (#x)<<" = "<<x<<endl
#define sz(s)    (int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	//file();
	fast();
	vi v1(5);
	for (auto& it : v1)
		cin >> it;
	for (int i = 0; i < 5; i++) {
		if (!v1[i])
			RT(i + 1);
	}
	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
long long N;
  cin>>N;
  set<long long> d;
  vector<long long> a(N);
  int i;
  for(i=0;i<N;i++){
  cin>>a.at(i);
    d.insert(a.at(i));
  }
  if(N==d.size()){
  cout<<"YES"<<endl;
  }
  else{
  cout<<"NO"<<endl;
  }

}


Measured memory_bytes: 11136
use proconio::input;
use proconio::marker::Chars;
use proconio::marker::Usize1;
use std::collections::VecDeque;

fn main() {
    input! {
        h: usize, w: usize,
        start: (Usize1, Usize1),
        goal: (Usize1, Usize1),
        field: [Chars; h],
    }
    let mut already_queued = vec![vec![false; w]; h];
    let mut same_level_queue: VecDeque<(usize, usize)> = VecDeque::new();
    let mut level_now = 0;
    let mut ans = -1;
    same_level_queue.push_back(start);
    'outer: loop {
        if same_level_queue.is_empty() {
            break 'outer;
        }
        let mut warp_queue: Vec<_> = Vec::new();
        'inner: loop {
            if let Some((x, y)) = same_level_queue.pop_front() {
                if (x, y) == goal {
                    ans = level_now;
                    break 'outer;
                }
                if !already_queued[x][y] {
                    already_queued[x][y] = true;
                    same_level_queue.push_back((x, y));
                    warp_queue.push((x, y));
                }
                if 1 <= x && !already_queued[x - 1][y] && field[x - 1][y] == '.' {
                    already_queued[x - 1][y] = true;
                    same_level_queue.push_back((x - 1, y));
                    warp_queue.push((x - 1, y));
                }
                if 1 <= y && !already_queued[x][y - 1] && field[x][y - 1] == '.' {
                    already_queued[x][y - 1] = true;
                    same_level_queue.push_back((x, y - 1));
                    warp_queue.push((x, y - 1));
                }
                if x + 1 < h && !already_queued[x + 1][y] && field[x + 1][y] == '.' {
                    already_queued[x + 1][y] = true;
                    same_level_queue.push_back((x + 1, y));
                    warp_queue.push((x + 1, y));
                }
                if y + 1 < w && !already_queued[x][y + 1] && field[x][y + 1] == '.' {
                    already_queued[x][y + 1] = true;
                    same_level_queue.push_back((x, y + 1));
                    warp_queue.push((x, y + 1));
                }
            } else {
                break 'inner;
            }
        }
        level_now += 1;
        for &(x, y) in &warp_queue {
            let x = x as isize;
            let y = y as isize;
            for dx in -2..=2 {
                for dy in -2..=2 {
                    if 0 <= x + dx && x + dx < h as isize && 0 <= y + dy && y + dy < w as isize {
                        let x = (x + dx) as usize;
                        let y = (y + dy) as usize;
                        if !already_queued[x][y] && field[x][y] == '.' {
                            same_level_queue.push_back((x, y));
                        }
                    }
                }
            }
        }
    }

    println!("{}", ans);
}


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

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    long long B = 0;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        B ^= A[i];
    }
    for (int i = 0; i < N; ++i) cout << (B^A[i]) << endl;
}

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

struct UF{
  vector<int> par;
  
  UF(int N):par(N){
    for(int i=0;i<N;i++) par[i] = i;
  }
  
  int root(int x){
    if(par[x] == x) return x;
    else{
      return par[x] = root(par[x]);
    }
  }
  
  void unite(int x,int y){
    int rx=root(x);
    int ry=root(y);
    if(rx == ry) return;
    else{
      par[rx]=ry;
      return;
    }
  }
  
  bool same(int x,int y){
    int rx=root(x);
    int ry=root(y);
    return rx == ry;
  }
};
  

int main(){
  int N,M;
  cin>>N>>M;
  int p[N];
  for(int i=0;i<N;i++){
    cin>>p[i];
    p[i]--;
  }
  
  UF U(N);
  for(int i=0;i<M;i++){
    int x,y;
    cin>>x>>y;
    U.unite(x-1,y-1);
  }
  int ans=0;
  for(int i=0;i<N;i++){
    if(U.same(i,p[i])) ans++;
  }
  cout << ans <<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;

	string q = t.substr(0, t.size() - 1);

	if (s == q)
	{
		puts("Yes");
	}
	else
	{
		puts("No");
	}


	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int INF=1<<29;

int main(){
	ios::sync_with_stdio(false);
	ll n,m,ans1=0,ans2=0,mod=1000000007;
	cin>>n>>m;
	vector<ll> x(n),y(m);
	for(int i=0;i<n;i++) cin>>x[i];
	for(int i=0;i<m;i++) cin>>y[i];
	for(int i=1;i<=n;i++){
		ans1+=(i-1)*x[i-1]-(n-i)*x[i-1];
		ans1%=mod;
	}
	for(int i=1;i<=m;i++){
		ans2+=(i-1)*y[i-1]-(m-i)*y[i-1];
		ans2%=mod;
	}
	cout<<(ans1*ans2)%mod<<endl;
	return 0;
}

Measured memory_bytes: 1792
h,w,n = gets.split.map(&:to_i)

sum = Hash.new(0)
n.times do 
    i,j = gets.split.map(&:to_i)
    s = i - 2 >= 1 ? i - 2 : 1
    t = j - 2 >= 1 ? j - 2 : 1
    u = i >= h - 1 ? h - 2 : i
    v = j >= w - 1 ? w - 2 : j

    s.upto(u) do |si|
        t.upto(v) do |tj|
            sum["#{si},#{tj}"] += 1
        end
    end
end
#p sum

ans = Array.new(10,0)
count = 0
sum.each_value do |value|
    ans[value] += 1
    count += 1
end
ans[0] = (h-2) * (w-2) - count

puts ans

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


int solve(string& s){
    int L=s.size();
    int from=-1, to=-1;
    int best = 0;
    rep(i,L){
        switch(s[i]){
            case 'A':case 'C':case 'G':case 'T':
                if (from==-1) from=i;
                to=i;
                best=max(best, to-from+1);
                break;
            default:
                from = to = -1;
                break;
        }
    }
    return best;
}

int main() {
    string s; cin >> s;
    cout << solve(s) << endl;
    return 0;
}


Measured memory_bytes: 256
//#include "SaveFuncs.cpp"

/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divUp(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

int Main()
{
	int N;
	cin >> N;
	vector<ll> B(N - 1);
	rep(i, N - 1)	cin >> B.at(i);

	ll ret = B.at(0);
	for (int i = 1; i < N-1; i++)
	{
		//debug_cout(i);
		//debug_tabCout(1, ret);
		ret += min(B.at(i-1), B.at(i));
	}
	ret += B.at(N - 2);

	cout << ret;

	return 0;
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);

	Main();

	return 0;
}


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

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

Measured memory_bytes: 1160
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#define lli long long int
#define mp make_pair
#define pb push_back
using namespace std;

const lli mod = 998244353;

lli power(lli x, lli y) {
    // x %= mod;
    if (y == 0) return 1;
    // return ((y % 2 == 1 ? x : 1) * power(x * x, y / 2)) % mod;
    return ((y % 2 == 1 ? x : 1) * power(x * x, y / 2));
}

vector <long long int> primeNumbers;

void SieveOfEratosthenes(int n){
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++){ 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for (int p=2; p<=n; p++){
      if (prime[p]){
        primeNumbers.push_back(p);
      }
    }        
}

#define MAXN 100005
// vector < vector < int >  > v(MAXN);
// int visit[MAXN];
// int d[MAXN];
// int deg[MAXN];

// void dfs(int index, int parent){
//   visit[index] = 1;
//   for(int i = 0;i<v[parent].size();i++){
//     int node = v[parent][i];
//     if(visit[node]) continue;
//     else if (!binary_search(v[index].begin(),v[index].end(),node)){
//       visit[node] = 1;
//       dfs(node,index);
//     }
//   }
// }
void pre(){
}

void solve(){
  int n;
  cin>>n;
  long double p[n];
  for(int i = 0;i<n;i++) cin>>p[i];

  long double dp[n+1][n+1];
  memset(dp,0,sizeof(dp));
  dp[0][0] = 1;
  // for(int i =)
  for(int i = 1;i<=n;i++){
    for(int j = 0;j<=i;j++){
      if(j == 0){
        dp[i][j] = dp[i-1][j]*(1-p[i-1]);
      }else{
        dp[i][j] = dp[i-1][j]*(1-p[i-1]) + dp[i-1][j-1]*p[i-1];
      }
    }
  }
  long double ans = 0;
  for(int j = n;j>=0;j--){
    if(j + j < n) break;
    else{
      ans += dp[n][j];
    }
  }
  // cout<<endl;
  cout<<setprecision(9)<<ans;
}
 
 
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
  #endif
 
  int t;
  // cin>>t;
  // scanf("%d",&t);
  t = 1;
  pre();
  while(t--){
    // cout<<
    solve();
 
    if(t>0){
      cout<<endl;
      // printf("\n");
    } 
  }
 
 
  cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
 
  return 0;
}


Measured memory_bytes: 144356
#include<stdio.h>

int main(void)
{
  int a,b,ans;
  char o,dammy;
  scanf("%d%c%c%d",&a,&dammy,&o,&b);
  if(o=='+')
    ans=a+b;
  else
    ans=a-b;
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
N, Q = map(int, input().split())
S = list(input())
TD = [tuple(input().split()) for _ in range(Q)]

def bs_l(f, s, e):
	if s==e:
		return s if f(s) else s+1

	c = (s+e)//2
	if f(c):
		#左
		return bs_l(f, s, c if c == s else c-1)
	else:
		#右
		return bs_l(f, c if c == e else c+1, e)

def bs_r(f, s, e):
	if s==e:
		return s if f(s) else s-1

	c = (s+e)//2
	if not f(c):
		#左
		return bs_r(f, s, c if c == s else c-1)
	else:
		#右
		return bs_r(f, c if c == e else c+1, e)

def isAlive(c):
	for t, d in TD:
		if S[c] == t:
			c += 1 if "R" == d else -1
			if c < 0 or N <= c:
				return False
	return True

S, E = bs_l(isAlive, 0, N-1), bs_r(isAlive, 0, N-1)
print(max(E-S+1, 0))


Measured memory_bytes: 19120
#include <bits/stdc++.h>
using namespace std;
const int N = 3003, M = 1000000007;

int n;
char a[N];

int dp[N], ndp[N];
int p[N], s[N];

int main()
{
    cin >> n >> a;
    dp[1] = 1;
    for (int j = 1; j <= n; ++j)
    {
        p[j] = p[j - 1] + dp[j];
    }
    for (int j = n; j >= 1; --j)
    {
        s[j] = s[j + 1] + dp[j];
    }
    for (int i = 2; i <= n; ++i)
    {
        for (int j = 1; j <= i; ++j)
        {
            if (a[i - 2] == '<')
                ndp[j] = p[j - 1];
            else
                ndp[j] = s[j];
        }
        memcpy(dp, ndp, sizeof ndp);
        for (int j = 1; j <= n; ++j)
        {
            p[j] = (p[j - 1] + dp[j]) % M;
        }
        for (int j = n; j >= 1; --j)
        {
            s[j] = (s[j + 1] + dp[j]) % M;
        }
    }
    cout << p[n] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <string>
using namespace std;
int main(){
    int n;
    cin >> n;
    if(n%2==0){
        cout << n*(n-2)/2 << endl;
        for(int i = 1;i<n+1;i++){
            for(int j = i+1;j<n+1;j++){
                if(i+j != n+1){
                    cout << i << " " << j << endl;
                }
            }
        }
    }
    else{
        cout << (n-1)*(n-1)/2 << endl;
        for(int i = 1;i<n+1;i++){
            for(int j = i+1;j<n+1;j++){
                if(i+j != n){
                    cout << i << " " << j << endl;
                }
            }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int a[7];
    rep(i, 7) cin >> a[i];
    int ans = a[1] + (a[0] / 2 + a[3] / 2 + a[4] / 2) * 2;
    if (a[0] > 0 && a[3] > 0 && a[4] > 0)
    {
        a[0]--, a[3]--, a[4]--;
        int tmp = a[1] + 3 + (a[0] / 2 + a[3] / 2 + a[4] / 2) * 2;
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N; cin >> N;
    string S; cin >> S;

    string S1 = S.substr(0, N);
    string S2 = S.substr(N, 2 * N);
    REVERSE(S2);

    map<string, int> m;

    REP(i, 1 << N){
        string s1 = "", s2 = "";
        REP(j, N){
            if(((i >> j) & 1) == 1){
                s1 += S1[j];
            }else{
                s2 += S1[j];
            }
        }
        m[s1 + " " + s2] += 1;
    }

    int ans = 0;
    REP(i, 1 << N){
        string s1 = "", s2 = "";
        REP(j, N){
            if(((i >> j) & 1) == 0){
                s1 += S2[j];
            }else{
                s2 += S2[j];
            }
        }
        ans += m[s1 + " " + s2];
    }

    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 67200
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  int W,a,b;
  cin >> W >> a >> b;
  if(abs(a-b)<=W)  cout << 0 << endl;
  else  cout << abs(a-b)-W << endl;
  
  return 0;
}


Measured memory_bytes: 256
N=int(input())
S=list(input())
RS=S[::-1]
W=[0]
E=[0]
for i in range(N):
    if S[i]=="W":
        W.append(W[-1]+1)
    else:
        W.append(W[-1])
W.append(0)
for i in range(N):
    if RS[i]=="E":
        E.append(E[-1]+1)
    else:
        E.append(E[-1])
E.append(0)
E=E[::-1]
#print(W)
#print(E)
ans=10**9
for i in range(1,N+1):
    if W[i-1]+E[i+1]<ans:
        ans=W[i-1]+E[i+1]
print(ans)

Measured memory_bytes: 86080
import bisect

n = int(input())
l = list(map(int, input().split()))
list.sort(l)
cnt = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        a = l[i]
        b = l[j]
        a_b = a + b
        insert_index = bisect.bisect_left(l, a_b)
        cnt += insert_index - (j + 1)

print(cnt)

Measured memory_bytes: 43756
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


    using namespace std;
 
    int main(){
      string a,b,c,x,y,z;
      cin >> a >> b >> c;
      rep(i,26){
       if(a[0]=='a'+i){
         x='A'+i;
       }
      }
      rep(i,26){
       if(b[0]=='a'+i){
         y='A'+i;
       }
      }
      rep(i,26){
       if(c[0]=='a'+i){
         z='A'+i;
       }
      }
      cout << x << y << z << endl;
      return 0;}


Measured memory_bytes: 256
# Ordinary Number
n = int(input())
p = list(map(int, input().split()))
ct= 0
C = []
for i in range(1,n-1):
    C.append(p[i])
    C.append(p[i-1])
    C.append(p[i+1])
    C.sort()
    if C[1] == p[i]:
        ct +=1
        C = []
    else:
        C = []
print(ct)


Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
int read()
{
	int x=0,f=1;	char ch=getchar();
	while(ch<'0'||ch>'9')	{if(ch=='-')	f=-1;	ch=getchar();}
	while(ch>='0'&&ch<='9')	{x=(x<<3)+(x<<1)+(ch^48);	ch=getchar();}
	return x*f;
}
int n,m,x,y,z;
int dis[20][20];
int tag[20],s[100050];
int f[100050][20],sum,ans;
int main()
{
	n=read();	m=read();	tag[0]=-1;
	memset(f,-1,sizeof(f));	f[1][0]=0;
	while(m--)
	{
		x=read()-1;	y=read()-1;	z=read();
		dis[x][y]=dis[y][x]=z;	sum+=z;
	}
	for(int i=1;i<(1<<n);++i)
	{
		//x=tag[i]=tag[i>>1]+1;	s[i]=s[i^(1<<x)];
		//for(y=0;y<x;++y)
		//	if(i&(1<<y))	s[i]+=dis[x][y];
		for(int j=0;j<n;++j)
			for(int k=0;k<n;++k)
				if((i&(1<<j))&&(i&(1<<k)))
					s[i]+=dis[j][k];
		s[i]>>=1;
	}
	for(int i=1;i<(1<<n);++i)
		for(int j=0;j<n;++j)
		{
			if(f[i][j]==-1)	continue;
			for(int k=0;k<n;++k)
				if(dis[j][k]&&!(i&(1<<k)))
					f[i|(1<<k)][k]=max(f[i|(1<<k)][k],f[i][j]+dis[j][k]);
			int t=((1<<n)-1)^i^(1<<j);
			for(int k=t;k;k=(k-1)&t)
				f[i|k][j]=max(f[i|k][j],f[i][j]+s[k]);
		}
	for(int i=0;i<(1<<n);++i)
		ans=max(ans,f[i][n-1]);
	printf("%d",sum-ans);
	return 0;
}

Measured memory_bytes: 8448
//
//  main.cpp
//  HelloWorld
//
//  Created by purple on 2020/04/13.
//  Copyright © 2020 Purple. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <cmath>

using namespace std;

int main(int argc, const char * argv[]) {


    int n;
    cin >> n;
    
    int b,f,r,v;
    int cnt[5][4][11];
    
    for(int i=1; i<=4; i++){
        for(int j=1; j<=3; j++){
            for(int k=1; k<=10; k++)
                cnt[i][j][k] = 0;
        }
    }
    
    for(int i=0; i<n; i++){
        cin >> b >> f >> r >> v;
        cnt[b][f][r] += v;
    }
    
    for(int i=1; i<=4; i++){
        for(int j=1; j<=3; j++){
            for(int k=1; k<=10; k++){
                cout << " " << cnt[i][j][k];
            }
            cout << endl;
        }
        
        if(i<4){
            for(int k=0; k<20; k++)
                cout << "#";
            cout << endl;
        }
    }

    
    return 0;
    
}



Measured memory_bytes: 3120
/*
 * ABC095_A.cpp
 *
 *  Created on: May 21, 2018
 *      Author: 13743
 */
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



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

	string str;
	cin >> str;
	int ans = 700;
	REP(i, 3) {
		if(str[i] == 'o') {
			ans += 100;
		}
	}
	cout << ans << endl;
}






Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
using namespace std;


int main(){

  double x[4], y[4];
  while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){

    vector<bool> t(3, false);
    for(int i=0; i<3; i++){
      if( ( x[ i ] - x[ (i+1)%3 ] )*( y[ 3 ]-y[ (i+1)%3 ]) - ( y[ i ] - y[ (i+1)%3 ] )*( x[ 3 ] - x[ (i+1)%3 ] ) < 0 ) t[i] = true;
    }

    if( (t[0] && t[1] && t[2])||(!t[0] && !t[1] && !t[2]) ) cout << "YES" << endl;
    else cout << "NO" << endl;

  }

  return 0;
}














// EOF

Measured memory_bytes: 3120
from collections import deque

R,C = list(map(int,input().split()))
Sx,Sy = 0,0
Gx,Gy = R-1,C-1
Mize = [input() for _ in range(R)]
dd = [[1, 0], [-1, 0], [0, 1], [0, -1]]

def bfs():
    d = [[float('inf')] * C for i in range(R)]
    q = deque([])
    d[Sx][Sy] = 0
    q.append((Sx,Sy))
    while(len(q) != 0):
        x,y = q.popleft()
        if x == Gx and y == Gy:
            break
        for dx,dy in dd:
            
            if -1<x+dx<R and -1<y+dy<C and Mize[x+dx][y+dy]=='.' and d[x+dx][y+dy] == float('inf'):
                q.append([x+dx,y+dy])
                d[x+dx][y+dy] = d[x][y] + 1
    return d[Gx][Gy]

white = sum([m.count('#') for m in Mize])
need = bfs()
if need == float('inf'):
    print(-1)
else:
    print(R*C-white-need-1)


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}

const int N = 2e5 + 10;
vi ga[N],gb[N];

void solve()
{
   int n;
    cin >> n;
    
    int a[n];
    f(i,n) cin >> a[i];
    
    int b[n];
    f(i,n) cin >> b[i];
    
    f(i,n) ga[a[i]].pb(i);
    f(i,n) gb[b[i]].pb(i);
    
    vi res(n,-1);
    
    for(int i=1;i<=n;i++)
    {
        if((int)ga[i].size() + (int)gb[i].size() > n)
        {
            cout <<"No\n";
            return;
        }
    }
    
    vector<pii> go;
    
    for(int i=1;i<=n;i++)
        go.pb({ga[i].size(),i});
        
    sort(go.begin(),go.end());
    reverse(go.begin(),go.end());
    
    set<pii> ind;
    f(i,n) ind.insert({ga[a[i]].size(),i});
    
    for(auto v : go)     
    {
        int i = v.S;
        
        int need = (int)gb[i].size();
        
        vector<pii> rem;
        
        for(auto x : ind)
        {
            if(need == 0) break;
          
            if(a[x.S] == i) continue;
            else 
            {
                res[x.S] = i;
                rem.pb(x);
                need--;
            }
        }
        
        for(auto x : rem) ind.erase(x);
    }
    
    cout <<"Yes\n";
    
    for(auto x : res) cout << x << ' ';
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 45208
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef pair<int, int> pii;

const int N = 102;

int n;
vector<pii> a;

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
	cin >> n;
	for (int i = 1; i < n; i++)
		for (int j = i + 1; j <= n; j++)
			if (i + j != n + !(n % 2))
				a.emplace_back(i, j);
	cout << SZ(a) << "\n";
	for (pii x : a)
		cout << x.first << " " << x.second << "\n";
	return 0;
}


Measured memory_bytes: 384