akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n, k;
vector<i64> a;
i64 dp[50][2];
int main() {
  cin >> n >> k;
  read_n(a, n);

  bool fo = false;
  for (int i = 41; i >= 0; --i) {

    i64 co = 0, cz;
    for (int j = 0; j < n; ++j) {
      co += (a[j] >> i) & 1ll;
    }
    cz = n - co;
    i64 o = (1ll << i) * co, z = (1ll << i) * cz;

    if ((k >> i) & 1ll) {
      dp[i][1] = dp[i + 1][1] + z;
      if (fo) {
        dp[i][0] = max({
          dp[i + 1][1] + o,
          dp[i + 1][0] + o,
          dp[i + 1][0] + z
        });
      } else {
        dp[i][0] = dp[i + 1][1] + o;
      }
    } else {
      dp[i][1] = dp[i + 1][1] + o;
      if (fo) {
        dp[i][0] = max({
          dp[i + 1][0] + o,
          dp[i + 1][0] + z
        });
      }
    }
    fo = fo || (k >> i) & 1ll;
  }

  for (int i = 40; i >= 0; --i) {
    cerr << i << '\t' << dp[i][1] << '\t' << dp[i][0] << endl;
  }

  cout << max(dp[0][0], dp[0][1]) << endl;
  return 0;
}

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

int main() {
  int N,ans=0;
  cin >> N;

  rep(i,N){
    int l,r;
    cin >>l>>r;
    ans+=r-l+1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define ll long long
//不要再爆long long了！！！！！！！！不要再爆long long了！！！！！！！ 
char c[200010];
int main()
{
	cin>>c;int l=strlen(c);
	for(int i=0;i<l;i++)if(c[i]=='?')putchar('D');else putchar(c[i]);
	return 0;
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
#define rep(i,N) for(int i=0;i<(int)N;i++)
using namespace std;
const int MOD=1e9+7;

int main()
{
  int A[200000],N,K,l,m=0,r,accum=1,sign=1;long x,y;
  cin>>N>>K;
  rep(i,N)cin>>A[i],m+=A[i]<0?1:0;
  sort(A,A+N);
  if(K&1)accum=A[N-1],sign=(A[N-1]<0?-1:1),N--,K--;
  l=0,r=N-1;
  while(K)
  {
    x=1l*A[l]*A[l+1],y=1l*A[r]*A[r-1];
    if(x*sign>y*sign)x%=MOD,accum=1l*accum*x%MOD,l+=2;
    else y%=MOD,accum=1l*accum*y%MOD,r-=2;
    K-=2;
  }
  return printf("%ld\n",(1l*accum%MOD+MOD)%MOD),0;
}


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

constexpr int mmax(const int x, const int y) { return max(x, y); }
constexpr int e() { return 0; }

int solve(const vector<int> &xs, const int k) {
    const int hi = *max_element(cbegin(xs), cend(xs));
    atcoder::segtree<int, mmax, e> max_lengths_by_val(hi + 1);

    for (const int x : xs) {
        const int h =
            max_lengths_by_val.prod(max(0, x - k), min(hi + 1, x + k + 1));
        max_lengths_by_val.set(x, h + 1);
    }

    return max_lengths_by_val.all_prod();
}

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

    int N, K;
    cin >> N >> K;

    vector<int> xs(N, 0);
    for (auto &x : xs) cin >> x;

    cout << solve(xs, K) << '\n';

    return 0;
}


Measured memory_bytes: 9808
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)1e9+10;
const int MOD=(int)1e9+7;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long ans=0;
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];
    if(k<v[0]+v[1]){
    ans+=v[0]+v[1]-k;
    if(v[0]+v[1]-k<=v[1])
        v[1]-=v[0]+v[1]-k;
    else
        v[1]=0,v[0]=k;
    }
    for(int i=2;i<n;i++)
    {
        if(v[i]+v[i-1]<=k)
            continue;
        else
            ans+=v[i]+v[i-1]-k,
            v[i]-=v[i]+v[i-1]-k;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 640
#coding: utf-8
"""
- Aは奇数か偶数かだけ分かれば良い
- Pが0でも1でも計算内容はそんなに変わらない
奇数がk個のとき、P=1の解はどうなるか
1 1C1
2 2C1
3 3C1+3C3
4 4C1+4C3
5 5C1+5C3+5C5
にそれぞれ2^(偶数の数)
"""
from math import factorial
def comb(n, r):
    return factorial(n) // factorial(r) // factorial(n - r)
n, p = map(int, input().split())
A = list(map(int, input().split()))
even = 0
odd = 0
for a in A:
    if a%2==0:
        even+=1
    else:
        odd+=1
ans = 0
for k in range(1,odd+1,2):
    ans += comb(odd,k)
ans *= 2**even
if p==0:
    print (2**n-ans)
else:
    print (ans)

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int K,X;
    cin>>K>>X;

    vector<int> ans;
    for(int i = 0;i < K;i++) {
        ans.push_back(X-i);
    }
    for(int i = 1;i < K;i++) {
        ans.push_back(X+i);
    }
    sort(ans.begin(),ans.end());
    for(auto u:ans) {
        cout<<u<<" ";
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
xd = [list(map(int, input().split())) for _ in range(n)]

mod = 998244353

xd.sort()

# 最大値を求めるセグメント木

def init_max(init_max_val):
    #set_val
    for i in range(n):
        seg_max[i+num_max-1]=init_max_val[i]
    #built
    for i in range(num_max-2,-1,-1) :
        seg_max[i]=max(seg_max[2*i+1],seg_max[2*i+2])

def update_max(k,x):
    k += num_max-1
    seg_max[k] = x
    while k:
        k = (k-1)//2
        seg_max[k] = max(seg_max[k*2+1],seg_max[k*2+2])

def query_max(p,q):
    if q<=p:
        return ide_ele_max
    p += num_max-1
    q += num_max-2
    res=ide_ele_max
    while q-p>1:
        if p&1 == 0:
            res = max(res,seg_max[p])
        if q&1 == 1:
            res = max(res,seg_max[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = max(res,seg_max[p])
    else:
        res = max(max(res,seg_max[p]),seg_max[q])
    return res

#####単位元######
ide_ele_max = -1

#num_max:n以上の最小の2のべき乗
# num_max =2**(n-1).bit_length()
num_max = 2**(len(str(bin(n-1))) -2)
seg_max=[ide_ele_max]*2*num_max

import bisect
xs = list(map(lambda x: x[0], xd))

ans = [0]*(n+1)
ans[-1] = 1

for i in range(n-1, -1, -1):
    move_r = bisect.bisect_left(xs, sum(xd[i]))
    if(i+1 == move_r):
        update_max(i, i)
    else:
        update_max(i, query_max(i+1, move_r))

    ans[i] = (ans[i+1] + ans[seg_max[i + num_max - 1] + 1]) % mod

print(ans[0])

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

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;


template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}


int solve(){
 	int n,k;cin>>n>>k;
 	vector<int>a(n+1);
 	rep(i,1,n+1){
 		cin>>a[i];
 	}
 	for(int i=k+1;i<=n;i++){
 		if(a[i]>a[i-k]){
 			cout<<"Yes"<<endl;
 		}
 		else{
 			cout<<"No"<<endl;
 		}
 	}
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
 

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

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int main() {
  int N;
  cin >> N;
  int tmp = N;
  int res = 0;
  while (tmp > 0) {
    res += tmp % 10;
    tmp /= 10;
  }
  if (N % res == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def dfs(n, s, mx):
	if len(s) == n:
		print(s)
	else:
		for i in range(97, ord(mx)+1):
			dfs(n, s + chr(i), chr(ord(mx) + 1) if i == ord(mx) else mx)
def main():
	n = INT()
	dfs(n, "", "a")


if __name__=='__main__':
	main()


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

int main(){
    string s; cin >> s;
    int ans = 0, cnt = 0;
    for (int i = 0, n = s.size(); i < n; i++)
    {
        if(s[i]== 'A' || s[i]== 'C' || s[i]== 'G' || s[i]== 'T'){
            cnt++;
        } else {
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    cout << max(ans, cnt) << endl;
}

Measured memory_bytes: 256
mod = 10 ** 9 + 7
fac = [1]
caf = [1]


def pow(n, p):
    res = 1
    while p > 0:
        if p % 2 == 0:
            n = n ** 2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod


for i in range(1, 3):
    fac.append((fac[i - 1] * i) % mod)
    caf.append(pow(fac[i], mod - 2))


def main():
    n = int(input())
    a = list(map(int, input().split()))
    maxa = max(a)
    k = 0
    while 2 ** k <= maxa:
        k += 1
    mod = 10 ** 9 + 7
    mo2 = [1]
    for _ in range(k):
        mo2.append(mo2[-1] * 2)

    p = [[0, 0] for i in range(k)]
    for sa in a:
        for j in range(k):
            if mo2[j] & sa != 0:
                p[j][1] += 1
            else:
                p[j][0] += 1
    res = 0
    for i in range(k):
        res += (p[i][0] * p[i][1] * mo2[i]) % mod
    print(res % mod)


main()


Measured memory_bytes: 123056
#include<stdio.h>
#include<string.h>
int main(void)
{
	int s,f,g,h,j,i,k;
	char a[11],d[21];
	scanf("%s",a);
	scanf("%d",&s);
	g=0;
	h=strlen(a);
	for(k=0;k<s;k++){
		scanf("%s",d);
		for(i=0;i<10;i++){
			d[i+10]=d[i];
		}
		for(i=0;i<20;i++){
			f=1;
			for(j=0;j<h;j++){
				if(i+j>=20 ||d[i+j]!=a[j]){
					f=0;
				}
			}
			if(f==1){
				g=g+1;
				break;
			}
		}
	}
	printf("%d\n",g);
	return 0;
}

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

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int[] a = new int[n];

            for(int i = 0; i<n;i++)
            {
                a[i] = int.Parse(input[i]);
            }

            var aliceSum = a
                .OrderByDescending(x => x)
                .Select((x, i) => new { card = x, index = i })
                .Where(c => c.index % 2 == 0)
                .Sum(c => c.card);

            var bobSum = a
                .OrderByDescending(x => x)
                .Select((x, i) => new { card = x, index = i })
                .Where(c => c.index % 2 == 1)
                .Sum(c => c.card);

            int result = aliceSum - bobSum;

            Console.WriteLine(result);
            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 11476
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ll a, b, x, i, j, k;
    cin>>x;
    k=pow(x, 0.2);
    for(i=0; i<=150; i++){
        for(j=0; j<=150; j++){
            if(pow(i, 5)-pow(j,5)==x){
                cout<<i<<" "<<j;
                return 0;
            }
            else if(pow(i, 5)+pow(j,5)==x){
                cout<<i<<" -"<<j;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4080
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <vector>

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

#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define TRUE (0)
#define FALSE (1)

// This value shold be close to used maximum value.  
#define NUM_MAX 20000000005

// void sort(uint32_t *num, uint32_t size);
int main()
{   
 
    vector<long long> vec(0);
    // vector<long long> res_vec(0);
    // uint64_t res_arr[NUM_MAX];
    // uint32_t sum = 0;
    uint64_t tairyoku;
    uint64_t attack;
    string result;
    uint64_t sum;

    // uint32_t res_i = 0;
    // string str_temp, str_temp2;
    uint64_t temp, temp2;
    uint64_t i, j, k, l, m, n, o, size;
    // uint32_t count = 0;
    // string str;
    // uint8_t k_flag;
 
    cin >> tairyoku >> attack;

    for (i = 0; i < attack; i++) {
        cin >> temp;
        vec.push_back(temp);
    }

    sum = 0;
    for (i = 0; i < attack; i++)
    {
        sum = sum + vec[i];
    }
    
    if (sum >= tairyoku) {
        result = "Yes";
    } else {
        result = "No";
    }


    cout << result << endl;

    return 0;
}

// void sort(uint32_t *num, uint32_t size) {
//     uint32_t i, j, k;
//     uint32_t sorted_num;
//     uint32_t array[NUM_MAX] = {0};

//     for (i = 1; i < size + 1; i++) {
//         array[num[i - 1]]++;
//     }

//     sorted_num = 0;

//     for (i = 0; i < NUM_MAX; i++) {
//         for (j = 0; j < array[i]; j++) {
//             num[j + sorted_num] = i;
//         }
//         sorted_num += j;
//         j = 0;
//     }

//     return;
// }


Measured memory_bytes: 1400
MOD = 10**9 + 7


def main():
    # TDPC E or EDPC S
    S = [s for s in input()]
    N = len(S)
    D = int(input())
    dp = [[[0]*D for _ in range(2)] for _ in range(N+1)]
    dp[0][0][0] = 1
    from itertools import product
    for i, smaller, dsum in product(range(N), [True, False], range(D)):
        lim = 9 if smaller else int(S[i])
        for d in range(lim+1):
            dp[i+1][smaller or d < lim][(dsum+d) % D] += dp[i][smaller][dsum]
            dp[i+1][smaller or d < lim][(dsum+d) % D] %= MOD
    print((dp[N][0][0] + dp[N][1][0] - 1) % MOD)


if __name__ == '__main__':
    main()


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


int main() {
    string s;
    cin >> s;
    int a=0;
    int b=0;
    rep(i,s.length()){
        if(s[i] == '0'){
            a++;
        }
        else{
            b++;
        }
    }
    int ans=min(a,b)*2;
    cout << ans <<endl;
    
    return 0;
}







Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n, cnt = 0;
	cin>>n;
	if(n % 2 != 0){
		cout<<0;
	}
	else{
		n /= 10;
		cnt += n;
		while(n){
			n /= 5;
			cnt += n;
		}
		cout<<cnt;
	}
  return 0;
}


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

n = int(input())

if n == 1:
    print(1/1)
elif n % 2 == 0:
    print(1/2)
elif n % 2 != 0:
    print((n//2 + 1)/n)


Measured memory_bytes: 9156
#include <stdio.h>

int main(){
	int n, a, min, max, i;
    long int sum;
	
	min = 1000000;
	max = -1000000;
	sum = 0;
	scanf("%d", &n);
	
	for(i = 1; i <= n; i++){
		scanf("%d", &a);
		if(a < min){
			min = a;
		}
		if(a > max){
			max = a;
		}
		sum = sum + a;
	}
	
	printf("%d %d %ld\n", min, max, sum);
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

 int main(void){
	int ki[100001]={0};
	int gu[100001]={0};
	int n,i;cin>>n;
	for(i=0;i<n/2;i++){
		int u,v;cin>>u>>v;
		ki[u]++;
		gu[v]++;
	}
	int Ka=0,Kb=0,Ga=0,Gb=0;
	for(i=0;i<=100000;i++){
		if(ki[Kb]<ki[i]){Kb=i;}
		if(ki[Ka]<ki[Kb]){swap(Ka,Kb);}
		if(gu[Gb]<gu[i]){Gb=i;}
		if(gu[Ga]<gu[Gb]){swap(Ga,Gb);}
	}
	//cerr<<Ka<<Ga<<endl;
	if(Ka!=Ga){cout<<n-(ki[Ka]+gu[Ga])<<endl;}
	else{cout<<n-max(ki[Ka]+gu[Gb],ki[Kb]+gu[Ga])<<endl;}
	return 0;
}

Measured memory_bytes: 4360
#include <vector>
    #include <string>
    #include <tuple>
    #include <iostream>
    #include <sstream>
    #include <algorithm>
    #include <set>
    #include <map>
    #include <cmath>
    #include <numeric>
    #include <queue>

    #define ll long long
    #define ld long double

    using namespace std;

    vector<ll> vert;

    ll getComp(ll v) {
        if(vert[v] == v) {
            return v;
        } else {
            return vert[v] = getComp(vert[v]);
        }
    }

    void edg(ll a, ll b) {
        a = getComp(a);
        b = getComp(b);
        vert[a] = b;
    }

    vector<vector<ll>> mat;

    ll dx[]{0, 1, 0, -1};
    ll dy[]{1, 0, -1, 0};

    bool isValid(ll x, ll y, ll n, ll m) {
        return x >= 0 && x < n && y >= 0 && y < m;
    }

    int main() {
        char a, b;
        cin >> a >> b;
        int ad = a - '0';
        int bd = b - '0';
        string as(ad, b);
        string bs(bd, a);
        vector<string> v({as, bs});
        sort(v.begin(), v.end());
        cout << v[0];
    }


Measured memory_bytes: 256
n = int(input())
s = input()
alphabets = 'abcdefghijklmnopqrstuvwxyz'
max_chr = 0

for i in range(len(s)-1):
    cnt = 0
    for letter in alphabets:
        if (letter in s[:i+1]) and (letter in s[i+1:]):
            cnt += 1
    max_chr = max(max_chr, cnt)
print(max_chr)

Measured memory_bytes: 9144
import java.util.Scanner;


class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int X = scan.nextInt();

		int ans = 0;

		for(int i = 0;i<= A;i++){
			for(int j= 0;j <= B;j++){
				for(int m = 0;m <= C;m++){
					ans += count(i,j,m,X);
							
				}
			}
		}



		System.out.println(ans);

	}
	
	static int count(int a,int b,int c,int X){
		if(X == a*500+b*100+c*50){
			return 1;
		}else{
			return 0;
		}
	}
	
	
}
class Pair implements Comparable{
	int from;
	int end;

	public Pair(int a,int b) {
		this.from = a;
		this.end = b;

	}
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



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

using namespace std;
typedef long long ll;
#define all(v) ((v).begin()),((v).end())
#define clr(a, b)memset(a,b,sizeof(a))
#define sz(a) (int)(a).size()
#define el '\n';
#define loop(i, n) for(int i = 0;i < int(n);i++)
#define PI acos(-1)
#define pb push_back
#define F first
#define S second

void LOL() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

bool comp(double a, double b) {
    return abs(a - b) < 1e-9;
}

int LCM(int a, int b) {
    return a * b / (__gcd(a, b));
}

bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b) {
    return (a.second < b.second);
}

const int N = 1e6 + 7, E = 1e5 + 5, OO = 0x3f3f3f3f;
bool vis[E];

int main() {
    LOL();
    ll x, p = 100, ans = 0;
    cin >> x;
    while (p < x) {
        p += p / 100;
        ans++;
    }

    cout << ans << el;

    return 0;
}

// CHECK THE FOLLOWING ONE MORE TIME BEFORE SUBMIT :
// the vector,arr,etc is redefined in multi cases
// the constraint N M OO etc ,,, The size of the array,vector etc
// the data type of variables ,,, int is enough ?
// the complexity of the code ? O(n)? O(n*n)? will fit ?
// Out of bond ? access an element out of size ? i-1>0 ? i+1 <n?
// CHECK ONE MORE TIME, IT'S OK TO GET WA,BUT NOT OK TO GET TLE OR RTE

Measured memory_bytes: 3652
#include<iostream>
#include<string>
using namespace std;
int main(){
  int N;
  string S;
  cin>>N>>S;
  int count =0;
  int now[3];
  int prog=0;
  string zerro="0";
  int zeroc=(int)zerro[0];
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      for(int k=0;k<10;k++){
        now[0]=i;
        now[1]=j;
        now[2]=k;
        prog=0;
        for(int l=0;l<N;l++){
          if(((int)S[l]-zeroc)==now[prog]){
            if(prog==2){
              count++;
              prog=0;
              break;
            }else{
              prog++;
            }
          }
        }
      }
    }
  }
  cout<<count;
  return 0;
}

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

int main() {
    long long x; cin >> x;
    long long n = 100;
    int counter = 0;
    while (true) {
        if (n >= x) {
            break;
        }
        n *= 1.01;
        counter++;
    }
    cout << counter << endl;
    return 0;
}


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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int main(){ _
	int n, k; cin >> n >> k;
	vector<int> v(n);
	for(int& i : v) cin >> i;

	vector<vector<int>> memo(2, vector<int>(k+1));
	
	memo[0][0] = memo[1][0] = 0;

	for(int i=0; i<=k; i++) {
		for(int j=0; j<2; j++) {
			for(auto u : v) if(i-u >= 0) memo[j][i] |= !memo[j^1][i-u];
		}
	}
	
	cout << (memo[0][k] ? "First" : "Second") << endl;
	
	return 0;
}


Measured memory_bytes: 4492
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;

const int MAX =200001;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long power(ll n){
    ll k=1;
    rep(i,n){
        k*=26;
    }
    return k;
}
  
int main(){
    ll n;
    COMinit();
    cin>>n;
    
    map<string,ll> mp;
    ll ans=0;
    
    rep(i,n){
        char c;
        vector<char> cv;
        rep(i,10){
            cin>>c;
            cv.pb(c);
        }
        sort(cv.begin(),cv.end());
        string s="";
        rep(j,10){
            s+=cv[j];
        }
        auto itr = mp.find(s);
        if( itr != mp.end() ) {
            ans+=mp[s];
            mp[s]+=1;
            
        } else {
            mp[s]=1;
            
        }
    }
    /*
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if(itr->second>1){
            ans+=COM(itr->second,2);
        }    
    }
    */
    cout<<ans<<endl;
    
    return 0;
}

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

#define ll long long
#define ull unsigned long long
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a;
    cin >> a;
    set<char>s (all(a));
    (s.size() == a.size()) ? cout << "yes" : cout << "no"; 
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
const double pi=3.14159265358979;
void solve(){
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    double omegam = pi/1800;
    double omegah=pi/21600;
    int t = 3600*h+60*m;
    double angm = omegam*t;
    double angh=omegah*t;
    double angle = abs(angh-angm);
    //cout<<angle;
    double ans = sqrt(a*a+b*b-2*a*b*cos(angle));
    cout<<fixed<<setprecision(12)<<ans;
}
int  main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
    //cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 4248
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var num = int.Parse(Console.ReadLine());
        var input = Console.ReadLine().Split(' ');

        var dict = new Dictionary<int, long>();

        var combination = new long[200000];
        var combinationMinusOne = new long[200000];

        var maxNum = 0;

        foreach (var n in input)
        {
            var number = int.Parse(n);
            if (!dict.ContainsKey(number))
            {
                dict.Add(number, 1);
            }
            else
            {
                dict[number] += 1;
            }
            if(maxNum < number)
            {
                maxNum = number;
            }
        }

        foreach (var c in dict)
        {
            combination[c.Key - 1] = c.Value * (c.Value - 1) / 2;
            combinationMinusOne[c.Key - 1] = (c.Value - 1) * (c.Value - 2) / 2;
        }

        long combinationSum = 0;
        long combinationMinusOneSum = 0;

        for(var i = 0; i < 200000; i++)
        {
            combinationSum += combination[i];
            combinationMinusOneSum += combinationMinusOne[i];

        }

        long ans = 0;


        for (var i = 0; i < input.Length; i++)
        {
            Console.WriteLine(combinationSum - combination[int.Parse(input[i]) - 1] + combinationMinusOne[int.Parse(input[i]) - 1]);
        }

        Console.ReadLine();
        
    }
}


Measured memory_bytes: 40352
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,k,c;
    scanf("%d %d",&a,&b);
    c = a + b;
    if(c % 2 == 0)
    {
        k = c / 2;
        printf("%d",k);
    }
    else
    {
        printf("IMPOSSIBLE");
    }
    return 0;
}

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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
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; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

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

  unsigned int n; cin >> n;
  if (__builtin_popcount(n)==1) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;

  auto pr = [](int a, int b) {
      cout << a << ' ' << b << '\n';
  };

  for(int i=2; i+1<=n; i+=2) {
    pr(i+1, i);
    pr(i, 1);
    pr(1, i+n+1);
    pr(i+n+1, i+n);
  }
  pr(n+1, 3);

  if (n%2==0) {
    int k=30;
    while((n&(1<<k))==0) {
      k--;
    }
    auto s=(1<<k); // even
    auto r=(n^s^1); // odd
    pr(n, s);
    pr(n+n, r+n);
  }
}

Measured memory_bytes: 2304
N=int(input())
a=N//1000
b=N//100 - 10*a
c=N//10 - 100*a -10*b
d=N%10
dic={0:"+",1:"-"}

s=a+b+c+d
for i in range(2):
    for j in range(2):
        for k in range(2):
            l=i*b+j*c+k*d
            if(s-2*l==7):
                ans=str(a)+dic[i]+str(b)+dic[j]+str(c)+dic[k]+str(d)+"=7"
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
using namespace std;


int main(void){

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

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

int dp[4][1000000];
bool used[4][1000000];
bool field[1000000];

struct cell {
  int dir, loc, d1, d2;
  cell (int d, int l, int dd1, int dd2) {
    dir = d; loc = l; d1 = dd1; d2 = dd2;
  }
};

bool cmp(cell& c1, cell& c2) {
  if (c1.d1 == c2.d1) return c1.d2 > c2.d2;
  else return c1.d1 > c2.d1;
}

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  x1--; y1--; x2--; y2--;
  rep(i, h) {
    string s;
    cin >> s;
    rep(j, w) {
      if (s[j] == '.') field[i * w + j] = false;
      else field[i * w + j] = true;
    }
  }
  rep(k, 4) rep(i, h) rep(j, w) {
    used[k][i * w + j] = false;
    dp[k][i * w + j] = -1;
  }

  priority_queue<cell, vector<cell>, decltype(&cmp)> pque(cmp);
  rep(i, 4) {
    pque.push( cell(i, x1 * w + y1, 0, 0) );
  }

  while (!pque.empty()) {
    int dir = pque.top().dir;
    int d1 = pque.top().d1, d2 = pque.top().d2;
    int loc = pque.top().loc; pque.pop();

    if (used[dir][loc]) continue;
    dp[dir][loc] = d1 + (d2 > 0 ? 1 : 0);
    used[dir][loc] = true;

    int xx = loc / w, yy = loc % w;

    rep(i, 4) {
      if (i != dir) {
        if (!used[i][loc]) pque.push( cell(i, loc, d1 + (d2 > 0 ? 1 : 0), 0) );
      }
    }

    if (dir == 0 && xx > 0) { //up
      if (!used[0][xx * w + yy - w] && !field[xx * w + yy - w])
        pque.push( cell(0, xx * w + yy - w, d1 + (d2 == k-1 ? 1 : 0), (d2 + 1) % k) );
    } else if (dir == 1 && yy < w-1) { //right
      if (!used[1][xx * w + yy + 1] && !field[xx * w + yy + 1])
        pque.push( cell(1, xx * w + yy + 1, d1 + (d2 == k-1 ? 1 : 0), (d2 + 1) % k) );
    } else if (dir == 2 && xx < h-1) { //down
      if (!used[2][xx * w + yy + w] && !field[xx * w + yy + w])
        pque.push( cell(2, xx * w + yy + w, d1 + (d2 == k-1 ? 1 : 0), (d2 + 1) % k) );
    } else if (dir == 3 && yy > 0) { //left
      if (!used[3][xx * w + yy - 1] && !field[xx * w + yy - 1])
        pque.push( cell(3, xx * w + yy - 1, d1 + (d2 == k-1 ? 1 : 0), (d2 + 1) % k) );
    }
  }

  int ans = min(dp[0][x2 * w + y2], dp[1][x2 * w + y2]);
  ans = min(ans, dp[2][x2 * w + y2]);
  ans = min(ans, dp[3][x2 * w + y2]);
  cout << ans << endl;

  return 0;
}

/*
6 3
8 1
6 2
9 3
1 1
2 2
1 3
4 3
2 1
1 2

2 2
4208 1234
3056 5678
1 2020
2 2020
*/


Measured memory_bytes: 32096
import java.util.Scanner;

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

		while (true) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			if (x == 0 && y ==0) {
				sc.close();
				break;
			}
			if (x > y) {
				int tmp = x;
				x = y;
				y = tmp;
			}
			System.out.println(x + " " + y);
		}
	}
}

Measured memory_bytes: 36148
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//ワーシャルフロイト法のテンプレ.graphに最短経路が格納される.
//負の重みがある場合inf + const = inf に気を付けること.
//graphは隣接行列.
void WF(vector<vector<int>> &graph){
	int n = graph.size();
	for (int k = 0; k < n; k++){
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
			}
		}
	}
}

//素因数分解をする関数.
map<long long int, int> prime_factorization(long long int a)
{
	map<long long int, int>ans;
	for (long long i = 2; i*i <= a; ++i) {
		while (a%i == 0) {
			ans[i]++;
			a /= i;
		}
	}
	if (a != 1)ans[a]++;
	return ans;
}

int main()
{
	ll n, a, b;
	cin >> n >> a >> b;
	vector<ll> x(n);
	rep(i, n) cin >> x[i];
	sort(all(x));
	ll ans = 0;
	rep(i, n - 1)
	{
		ll dist = x[i + 1] - x[i];
		ans += min(a * dist, b);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
 
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
        String input = "";
         
        while((input = br.readLine()) != null){
            String[] arr = input.split(" ");
     
            int a = Integer.parseInt(arr[0]);
            int b = Integer.parseInt(arr[1]);
     
            int inputAngka = a + b;
     
            System.out.println(count(inputAngka));
        }
 
    }
 
    public static int count(int a) {
        if (a < 10) {
            return 1;
        } else {
            return 1 + count(a / 10);
        }
    }
 
}

Measured memory_bytes: 24360
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int a;
  cin >> a;
  int x = a / 100;
  int y = (a - (x * 100)) / 10;
  int z = (a - (x * 100)) -(y * 10)/ 1;
  
  cout << x + y + z << endl;
  
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
S = list(input())[: -1]
mod = 10 ** 9 + 7
N = len(S)
dp = [[0] * 13 for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
  for j in range(13):
    if S[i] != "?":
      x = int(S[i])
      dp[i + 1][(j * 10 + x) % 13] += dp[i][j]
      dp[i + 1][(j * 10 + x) % 13] %= mod
    else:
      for x in range(10):
        dp[i + 1][(j * 10 + x) % 13] += dp[i][j]
        dp[i + 1][(j * 10 + x) % 13] %= mod
print(dp[-1][5])

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

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORTASC(c) sort((c).begin(), (c).end())
#define SORTDESC(c, t) sort((c).begin(), (c).end(), std::greater<t>());
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

const double PI = acos(-1.0);

using ll = long long;
using namespace std;

int main()
{
    ll n, k;
    ll p[200010];

    cin >> n >> k;

    REP(i, n)
    {
        cin >> p[i];
    }

    ll prev = 0;
    REP(i, k){
        prev += p[i];
    }

    ll mx = prev;
    FOR(i, 1, n - k + 1)
    {
        prev = prev - p[i-1] + p[i+k-1];
        mx = max(mx, prev);
    }

    cout << fixed << setprecision(10) << (double)(mx + k) / 2.0 << endl;

    return 0;
}

Measured memory_bytes: 1792
a=[]
for i in range(3):
  a.append(list(map(int,input().split())))
n=int(input())
b=[[0,0,0],[0,0,0],[0,0,0]]
for j in range(n):
  x=int(input())
  for k in range(3):
    for l in range(3):
      if x==a[k][l]:
        b[k][l]=1
if b[0]==[1,1,1] or b[1]==[1,1,1] or b[2]==[1,1,1] or [b[0][0],b[1][0],b[2][0]]==[1,1,1] or [b[0][1],b[1][1],b[2][1]]==[1,1,1] or [b[0][2],b[1][2],b[2][2]]==[1,1,1] or [b[0][0],b[1][1],b[2][2]]==[1,1,1] or [b[0][2],b[1][1],b[2][0]]==[1,1,1]:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
N = int(input())
s = [input() for n in range(N)]

# 先頭が B ではなく、末尾が A な文字列
TxBA = [s[n] for n in range(N) if s[n][0] != "B" and s[n][-1] == "A"]

# 先頭が B で、末尾が A な文字列
TBBA = [s[n] for n in range(N) if s[n][0] == "B" and s[n][-1] == "A"]

# 先頭が B で、末尾が A ではない文字列
TBBx = [s[n] for n in range(N) if s[n][0] == "B" and s[n][-1] != "A"]

# 上記を除き中に "AB" が存在する文字列
kouho = TxBA + TBBA + TBBx
ss = s.copy()
for k in kouho:
    ss.remove(k)
    
str = ""
while (len(TxBA)):
    str += TxBA.pop()
    while (len(TBBA)):
        str += TBBA.pop()
    if (len(TBBx)):
        str += TBBx.pop()

while (len(TBBA)):
    str += TBBA.pop()
if (len(TBBx)):
    str += TBBx.pop()

while (len(TBBx)):
    str += TBBx.pop()

while (len(ss)):
    str += ss.pop()

print(str.count("AB"))

Measured memory_bytes: 3956
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

static const int INFTY = (1 << 25);

int G[100][100], n;

int makeMST() {
	bool mask[100][100];//MAST????????¨???????????¨???????????¨?????????1
	REP(i, n) {
		REP(j, n) mask[i][j] = 0;
	}

	bool color[100];//MST?????\??£??????1
	REP(i, n) color[i] = 0;

	color[0] = 1;//?????????????????¨??????0?????\??????

	REP(k, n - 1) {
		int minv = INFTY;
		int mNodej = -1;
		int mNodei = -1;
		REP(i, n) {
			if (color[i] == 1) {
				REP(j, n) {
					if (G[i][j] != -1) {
						if (color[j] == 0) {
							if (G[i][j] < minv) {
								minv = G[i][j];
								mNodei = i;
								mNodej = j;
							}
						}
					}
				}
			}
		}
		mask[mNodei][mNodej] = 1;
		mask[mNodej][mNodei] = 1;
		color[mNodej] = 1;
	}

	REP(i, n) {
		REP(j, n) {
			if (mask[i][j] == 0) G[i][j] = -1;
		}
	}

	int ans = 0;
	REP(i, n) {
		REP(j, n) {
			if (G[i][j] != -1) ans += G[i][j];
		}
	}

	return ans / 2;
}

int main() {
	cin >> n;

	REP(i, n) {
		REP(j, n) G[i][j] = INFTY;
	}
	REP(i, n) {
		REP(j, n) cin >> G[i][j];
	}

	cout << makeMST() << endl;


	return 0;
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n, k; cin >> n >> k;
    if (k <= (n + 1) / 2) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
"""メモ
n = 0になるまで2で割った回数
answer = sum(2^0 + 2^1 + 2^2 + 2^3 + ... + 2^(n-1))
"""


def sum_2_expo(cnt):
    ans = 0
    for i in range(cnt):
        ans += 2 ** i
    return ans


H = int(input())
cnt = 0
while H != 0:
    H //= 2
    cnt += 1

print(sum_2_expo(cnt))


Measured memory_bytes: 38384
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
int x = 0, y = 0, z = 0,n = 0;
string s = "";
asas;
cncn;
//BEGIN OF CODE.
int main(void) {
	int a, b, c, x;
	cin >> a >> b >> c >> x;
	rep(i, a+1) {
		rep(j, b+1) {
			rep(k, c+1) {
				if (x == i * 500 + j * 100 + k * 50)ans++;
			}
		}
	}
	cout << ans << rt;
	please AC;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;



int main(){
    double t, x;
    cin >> t >> x;
    out(t/x);
}

Measured memory_bytes: 256
def main():
  N, K = [int(n) for n in input().split(" ")]
  X = [int(x) for x in input().split(" ")]
  X.sort()
  
  minus = []
  plus = []
  for i in range(len(X)):
    if X[i] < 0:
      minus.append(-X[i])
    else:
      plus += X[i:]
      break

  minus.reverse()

  T = []
  
  if len(plus) >= K:
    T.append(plus[K - 1])
  if len(minus) >= K:
    T.append(minus[K - 1])
  for i in range(K):
    if i < len(plus) and 0 <= K - i - 2 < len(minus):
      T.append(2 * plus[i] + minus[K - i - 2])
      T.append(2 * minus[K - i - 2] + plus[i])
    if i < len(minus) and 0 <= K - i - 2 < len(plus):
      T.append(2 * minus[i] + plus[K - i - 2])
      T.append(2 * plus[K - i - 2] + minus[i])
  
  print(min(T))

main()



Measured memory_bytes: 24340
#include <stdio.h>
int main(void){
    int a, b;
    char op;
    
    scanf("%d %c %d", &a, &op, &b);
    while(op!='?'){
    switch(op){
        case '+': printf("%d\n", a+b);break;
        case '-': printf("%d\n", a-b);break;
        case '*': printf("%d\n", a*b);break;
        case '/': printf("%d\n", a/b);break;
    }scanf("%d %c %d", &a, &op, &b);
    }
}



Measured memory_bytes: 2140
import java.util.*

fun main(args:Array<String>){
    solve()
}

fun solve(){
    val (h,w,k) = readints()
    val c = Array(h){CharArray(w)}
    for(i in 0 until h){
        c[i] = read().toCharArray()
    }
    var ans = 0
    for(maskh in 0 until (1 shl h)){
        for(maskw in 0 until (1 shl w)){
            var cntb = 0
            for(i in 0 until h){
                for(j in 0 until w){
                    if(((maskh shr i) and 1 == 1) || ((maskw shr j) and 1 == 1)) continue
                    if(c[i][j] == '#') cntb++
                }
            }
            if(cntb == k) ans++
        }
    }
    println(ans)
}



fun read() = readLine()!!
fun reads() = readLine()!!.split(" ")
fun readint() = readLine()!!.toInt()
fun readints() = readLine()!!.split(" ").map{it.toInt()}
fun readlong() = readLine()!!.toLong()
fun readlongs() = readLine()!!.split(" ").map{it.toLong()}



Measured memory_bytes: 36492
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Ord

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n  <- getInt
    as <- filter (\g -> length g >= 2) . group . sortOn Down <$> getIntList
    let ans | null as = 0
            | length (head as) >= 4 = (head (head as)) ^ 2
            | length as == 1 = 0
            | otherwise = let (a:b:_) = as in head a * head b
    print ans

Measured memory_bytes: 27076
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<cstdio>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	int n;
	cin>>n;
	int a[n];
	rep(i,n)cin>>a[i];
	int ans=0;
	for(int i=0;i<n;i++){for(int j=i+1;j<n;j++)ans+=a[i]*a[j];}
		cout<<ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
int main(void){
  string s; cin >> s;
  int a, b, c, d;
  a = s[0]-'0'; b = s[1]-'0'; c = s[2]-'0'; d=s[3]-'0';
  RPT(i,0,2){RPT(j,0,2){RPT(k,0,2){
    if( a+(i?1:(-1) )*b+(j?1:(-1) )*c+(k?1:(-1) )*d    ==7 ) {cout <<  a  <<  (i?'+':'-' )<< b  << (j?'+':'-' ) << c << (k?'+':'-' ) << d << "=7" << endl; return 0;}
  }
  }
  }
  return 0;
}

Measured memory_bytes: 256