akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			final String input = sc.next();
			final String type = sc.next();
			
			if("X".equals(type)){
				break;
			}
			
			char[][] units;
			
			if(input.indexOf("_") >= 0){
				String[] ret = input.split("_");
				units = new char[ret.length][];
				for(int i = 0; i < ret.length; i++){
					units[i] = ret[i].toCharArray();
				}
			}else{
				char[] array = input.toCharArray();
				
				int count = 0;
				for(int i = 1; i < array.length; i++){
					if('A' <= array[i] && array[i] <= 'Z'){
						count++;
					}
				}
				count++;
				
				units = new char[count][];
				
				int start = 0;
				int cur = 0;
				for(int i = 1; i < array.length; i++){
					if('A' <= array[i] && array[i] <= 'Z'){
						final int size = i - start;
						
						units[cur] = new char[size];
						for(int j = 0; j < size; j++){
							if(j == 0){
								if('A' <= array[start + j] && array[start + j] <= 'Z'){
									units[cur][j] = (char) (array[start + j] - ('A' - 'a'));
								}else{
									units[cur][j] = array[start + j];
								}
							}else{
								units[cur][j] = array[start + j];
							}
						}
						
						start = i;
						cur++;
					}
				}
				
				final int size = input.length() - start;
				units[cur] = new char[size];
				for(int j = 0; j < size; j++){
					if(j == 0){
						if('A' <= array[start + j] && array[start + j] <= 'Z'){
							units[cur][j] = (char) (array[start + j] - ('A' - 'a'));
						}else{
							units[cur][j] = array[start + j];
						}
					}else{
						units[cur][j] = array[start + j];
					}
				}
			}
			/*
			for(char[] ch : units){
				System.out.println(Arrays.toString(ch));
			}
			*/
			if("L".equals(type)){
				for(int i = 0; i < units.length; i++){
					for(int j = 0; j < units[i].length; j++){
						System.out.print((char)(units[i][j] + (j == 0 && i != 0 ? 'A' - 'a' : 0)));
					}
				}
				
				System.out.println();
			}else if("U".equals(type)){
				for(int i = 0; i < units.length; i++){
					for(int j = 0; j < units[i].length; j++){
						System.out.print((char)(units[i][j] + (j == 0 ? 'A' - 'a' : 0)));
					}
				}
				
				System.out.println();
			}else if("D".equals(type)){
				for(int i = 0; i < units.length; i++){
					for(int j = 0; j < units[i].length; j++){
						System.out.print(units[i][j]);
					}
					
					if(i != units.length - 1){
						System.out.print("_");
					}
				}
				
				System.out.println();
			}
		}
		
	}

}

Measured memory_bytes: 17232
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def solve():
    n, k = map(int, input().split())
    hl = [int(input()) for _ in range(n)]
    hl.sort()
    diff = hl[k - 1] - hl[0]
    for i in range(0, n - k + 1):
        td = hl[k - 1 + i] - hl[i]
        diff = min(td, diff)
    print(diff)


if __name__ == "__main__":
    solve()


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

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

    int H[N];
    rep(i, N) cin >> H[i];

    bool good[N];
    rep(i, N) good[i] = true;

    int ai, bi;
    rep(i, M) {
        cin >> ai >> bi;
        ai--, bi--;
        if (H[ai] > H[bi]) good[bi] = false;
        else if (H[ai] < H[bi]) good[ai] = false;
        else good[ai] = good[bi] = false;
    }

    int ans = 0;
    rep(i, N) if (good[i]) ans++;

    cout << ans << endl;    

    return 0;
}



Measured memory_bytes: 4080
abs = [[int(x) for x in input().split()] for _ in range(3)]

ns = {1: 0, 2: 0, 3: 0, 4: 0}
for a, b in abs:
    ns[a] += 1
    ns[b] += 1
ans = max(ns.values()) == 2

print("YES" if ans else "NO")


Measured memory_bytes: 2940
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
typedef long long ll;
int main() {
	string S;
	cin >> S;
	ll N = S.length();
	vector<int> sa = suffix_array(S);
	ll res = N * (N + 1) / 2;
	for (auto x : lcp_array(S, sa)) {
		res -= x;
	}
	cout << res << endl;
}


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

int main() 
{ 
	long long int n,sum=0;
		cin>>n;
	for(int i=1;i<=n; i++){
		if(i%3 !=0 && i%5 !=0 && i%15 !=0)
			sum +=i;
	}
	cout<<sum;
	
	return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    ll ans = 0;
    rep(i, N) {
        ll a;
        cin >> a;
        bool ok = false;
        for (ll j = 2; j * j <= a; j++) {
            if (a % j == 0) {
                ok = true;
            }
        }
        if (!ok) ans++;
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}



Measured memory_bytes: 3072
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <string>
#include <cstdio>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define ls x<<1
#define rs x<<1|1
#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define fun function
#define vi vector<int>
#define lowbit(x) x&(-x)
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);

using namespace std;

const int INF = 0x3f3f3f3f;



int main() {
	IOS;
#ifdef xiaofan
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif

	ll a,b,c;
	cin>>a>>b>>c;
	c=(c-a-b);
	if(c*c>a*b*4&&c>0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;





	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cfloat>
#include <cmath>
#include <random>
#include <algorithm>
#define norm(X) ((X) * (X))
using namespace std;
using ll = long long;
    
struct Point {
    ll x, y;
    ll z;
};

int main() {
    ll n;
    Point e[105];
    double ans = 0;
    ll sx[4] = {};
    ll sy[4] = {};

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> e[i].x >> e[i].y;

        e[i].z = 0;
        if (e[i].y > 0) {
            e[i].z |= 2;
        }
        if (e[i].x > 0) {
            e[i].z |= 1;
        }

        sx[e[i].z] += e[i].x;
        sy[e[i].z] += e[i].y;
    }

    mt19937 rnd(1030832);
    ll x, y;

    for (int z = 0; z < 4; z++) {
        
        for (int k = 0; k < 30000; k++) {
            x = sx[z];
            y = sy[z];

            for (int i = 0; i < n; i++) {
                ll zz = 0;
                if (e[i].y > 0) zz |= 2;
                if (e[i].x > 0) zz |= 1;
                e[i].z = (zz == z ? -1 : 1);
            }

            for (int j = 0; j < 300; j++) {
                ll indx = rnd() % n;

                if (e[indx].z != -1) {
                    if (norm(x) + norm(y) < norm(x + e[indx].x) + norm(y + e[indx].y)) {
                        x += e[indx].x;
                        y += e[indx].y;
                        e[indx].z = -1;
                    }
                }
                else {
                    if (norm(x) + norm(y) < norm(x - e[indx].x) + norm(y - e[indx].y)) {
                        x -= e[indx].x;
                        y -= e[indx].y;
                        e[indx].z = 1;
                    }
                }
            }

            ans = max(ans, hypot(x, y));
        }
    }
    
    printf("%.*lf\n", DBL_DIG, ans);

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  long N;
  vector<long> as;
  scanf("%ld", &N);
  for (int i = 0; i < N; i++) {
    long a;
    scanf("%ld", &a);
    as.push_back(a);
  }

  // solve
  long ans = 0;
  ans += as[N - 1];
  for (long i = N - 2; i >= 0; i--) {
    if (as[i] < as[i + 1] - 1) {
      ans = -1;
      break;
    } else if (as[i] > as[i + 1] - 1) {  // 0 will not be a corner case
      ans += as[i];
    }
  }
  if (as[0] > 0) {
    ans = -1;
  }
  printf("%ld\n", ans);

  return 0;
}


Measured memory_bytes: 2420
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

// reference: http://ir5.hatenablog.com/entry/20171209/1512821837

struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

use std::mem;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let N: usize = sc.read();
    let D: usize = sc.read();

    let mut X = vec![vec![0; D]; N];
    for i in 0..N {
        for j in 0..D {
            let x: i32 = sc.read();
            X[i][j] = x;
        }
    }

    let mut ans = 0;
    for i in 0..N {
        for j in (i + 1)..N {
            let mut d: f32 = 0.0;
            for k in 0..D {
                d += (X[i][k] - X[j][k]).pow(2) as f32;
            }
            if d.sqrt().round().powf(2.0) == d {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 2468
#include<iostream>
using namespace std;
int main()
{
    int n,count=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
    {
        if((i+1)%2!=0 && a[i]%2!=0)
        {
            //cout<<i<<" "<<a[i]<<endl;
            count++;
        }    
    }    
    cout<<count<<endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  char b;
  cin>>b;
  if(b=='A')
  cout<<'T'<<endl;
  else if(b=='T')
  cout<<'A'<<endl;

  if(b=='G')
  cout<<'C'<<endl;
  else if(b=='C')
  cout<<'G'<<endl;
    }

   
  
   


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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(n) begin(n), end(n)

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> check(N, 0);
    int pena = 0;
    int sei = 0;
    string ac = "AC";
    string wa = "WA";
    REP(i, M)
    {
        int p;
        string S;
        cin >> p >> S;
        if (check.at(p - 1) != -1)
        {
            if (S == wa)
            {
                ++check.at(p - 1);
            }
            else if (S == ac)
            {
                ++sei;
                pena += check.at(p - 1);
                check.at(p - 1) = -1;
            }
        }
    }

    std::cout << sei << " " << pena << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
 
#define EPS (1e-7)
#define INF (1e30)
#define PI (acos(-1))
int n;
ll a[300001];
priority_queue<int, vector<int>, greater<int>> que;
priority_queue<int> que2;
int main() {
    cin >> n;
    for (int i=0;i<3*n;i++) cin >> a[i];
    // 前半の和を求める(i個とった時)
    ll sum[2*n] = {};
    for (int i=0;i<n;i++) {
        que.push(a[i]);
        sum[0] += a[i];
    }
    for (int i=n;i<2*n;i++) {
        // cout << "sum " << i-n << " " << sum[i-n] << endl;
        que.push(a[i]);
        sum[i-n+1] = sum[i-n] + a[i] - que.top();
        que.pop();
    }
    // 後半の和を求める(後ろからi個とった時)
    ll sum2[2*n] = {};
    for (int i=2*n;i<3*n;i++) {
        que2.push(a[i]);
        sum2[0] += a[i];
    }
    for (int i=2*n-1;i>=n;i--) {
        // cout << "sum2 " << 2+n-i-1 << " " << sum2[2*n-i-1] << endl;
        que2.push(a[i]);
        sum2[2*n-i] = sum2[2*n-i-1] + a[i] - que2.top();
        que2.pop();
    }
    // 最大値を求める
    ll ans = sum[0]- sum2[n];
    for (int i=0;i<=n;i++) ans = max(ans, sum[i] - sum2[n-i]);
    cout << ans << endl;
}

Measured memory_bytes: 6904
n, k = map(int, input().split())
ans = 0
mod = 10 **9 + 7
for i in range(k, n+2):
    # i個(k<= i <= n+1)を選ぶとき
    # i * 10^100 + (1+2+・・・+(i-1)) 〜 i * 10^100 + (n + (n-1) + ・・・ + (n-(i-1) ) )
    # の間の値をとりうるので
    # i*(n + n-(i-1))//2 - (i-1)*i//2 + 1 = i * (n-i+1) + 1
    ans += i * (n - i + 1) + 1
print(ans % mod)

Measured memory_bytes: 9164
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行あり
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

N行M列の初期化
dp = [[INF] * M for i in range(N)]

'''

N, D, A = map(int, input().split())
XH = []

for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    XH.append([x1, y1])

    
def counting(hp):
    if hp < 0:
        return 0
    return hp//A + int(hp%A!=0)

XH.sort()


bombs = deque([]) # 有効な爆弾の威力と範囲を保存する
power = 0 # 有効な爆弾の威力の合計

ans = 0
for i in range(N):
    
    # 使えない爆弾を捨てる
    while len(bombs)>0 and bombs[0][0] < XH[i][0]:
        power -= bombs.popleft()[1]

    # パワーの不足分の爆弾
    add = counting(XH[i][1]-power) 
    ans += add
    
    # 追加した爆弾をキューに加える
    bombs.append((XH[i][0] + 2*D, add*A))
    power += add*A


print(ans)









"""
ATTENTION: Pythonで間に合うか？？

            <目安>
 文字列結合、再帰関数を含む→Python
 上を含まず時間が不安→PyPy3

"""

Measured memory_bytes: 63696
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,x,y,z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

template <std::int_fast64_t Modulus> class modint {
  using u64 = std::int_fast64_t;
public:
  u64 a;
  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};
typedef modint<MOD> m;
#pragma endregion

int main() {
  cin >> N;
  ll _min = 0;
  ll count = 1;
  cin >> _min;
  rep(i, N-1){
    ll num;
    cin >> num;
    if(num < _min){
      count++;
    }
    _min = min(_min, num);
  }
  cout << count;
}


Measured memory_bytes: 256
def get(i):
    mx = 0
    while i > 0:
        if bit[i] > mx:
            mx = bit[i]
        i -= i & -i
    return mx


def update(i, x):
    while i < n + 1:
        if x > bit[i]:
            bit[i] = x
        i += i & -i


n = int(input())
hs = list(map(int, input().split()))
a_s = list(map(int, input().split()))

bit = [0] * (n + 1)
for h, a in zip(hs, a_s):
    update(h, get(h - 1) + a)
print(max(bit))


Measured memory_bytes: 35256
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

bool chk[100009], bl[100009];
vector<pii> G[100009];
int D[100009], w[200009];

int main() {
	int N, M; scanf("%d%d",&N,&M);
	for(int i=1; i<=N; i++) scanf("%d", &D[i]);
	for(int i=0; i<M; i++) {
		int u, v; scanf("%d%d",&u,&v);
		G[u].push_back({v, i});
		G[v].push_back({u, i});
		w[i] = 1e9;
	}
	vector<int> S;
	for(int i=1; i<=N; i++) S.push_back(i);
	sort(S.begin(), S.end(), [&](int P, int Q) { return D[P] < D[Q]; });
	for(auto& it: S) {
		if(chk[it]) continue;
		chk[it] = 1;
		int nei = -1, id = -1;
		for(auto& jt: G[it]) if(chk[jt.first]) tie(nei, id) = jt;
		if(nei != -1) {
			w[id] = D[it];
			bl[it] = bl[nei] ^ 1;
		}
		else {
			for(auto& jt: G[it]) if(D[jt.first] == D[it]) tie(nei, id) = jt;
			if(nei != -1) {
				chk[nei] = 1;
				w[id] = D[it];
				bl[it] = 1;
			}
			else return !printf("-1");
		}
	}
	for(int i=1; i<=N; i++) {
		if(bl[i]) printf("B");
		else printf("W");
	}
	for(int i=0; i<M; i++) printf("\n%d", w[i]);
	return 0;
}

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

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

    ll x;
    cin >> x;

    for (ll a = -200; a < 200; a++){
        bool r = false;
        for (ll b = -200; b < 200; b++){
            if (a*a*a*a*a - b*b*b*b*b == x){
                cout << a << " " << b << endl;
                r = true;
                break;
            }
            
        }
        if (r){
            break;
        }
    }


}

Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int main() {
	int x; cin >> x;
	int a, b;
	if (x == 1) {
		cout << "Hello World" << endl;
	}
	else if (x == 2) {
		cin >> a >> b;
		cout << a + b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
using namespace std;
#define REP(i,n); for(int i = 0;i < (int)(n);i++)

int main() {
	int n, k;
	long long sum, input;
	vector<long long> h;
	
	cin >> n >> k;
	
	REP(i,n){
		cin >> input;
		h.push_back(input);
		
	}
	sort(h.begin(), h.end());
	if(n <= k){
		cout << 0;
		return 0;
	}
	h.erase(h.end() - k, h.end());

	sum = 0;
	REP(i, h.size()){
		sum += h[i];
	}
	cout << sum;
	
	return(0);
}

Measured memory_bytes: 2420
import numpy

n, m = map(int, input().split())
a = numpy.zeros([n, n], dtype=int)
b = numpy.zeros([m, m], dtype=int)
for i in range(n):
    s = input()
    for j in range(n):
        if s[j] == '#':
            a[i, j] = 1
for i in range(m):
    s = input()
    for j in range(m):
        if s[j] == '#':
            b[i, j] = 1
for i in range(n - m + 1):
    for j in range(n - m + 1):
        if numpy.all(a[i: i + m, j: j + m] == b):
            print("Yes")
            exit()
print("No")

Measured memory_bytes: 12488
N = gets.to_i
a = gets.split(' ').map(&:to_i)
even = false
N.times do |time|
    if a[time].even?
        if a[time] % 3 == 0 || a[time] % 5 == 0
            next
        else
            even = true
            break
        end
    end
end
if even
    puts 'DENIED'
else
    puts 'APPROVED'
end


Measured memory_bytes: 3836
import math
def solve():
    N = int(input())

    ans = 10**12 + 1
    s = int(math.sqrt(N))
    for i in range(1, s+1):
        if N % i == 0:
            val1 = i
            val2 = N // val1
            ans = min(ans, val1+val2-2)
    print(ans)

solve()

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
N = int(input())
a = [int(x) for x in input().split()]

b = [x%4 for x in a]
from collections import Counter
bco = Counter(b)

if bco[0] >= N//2 :
    print("Yes")
else :
    fe = N//2 - bco[0]
    if N%2 == 0 :
        if bco[2] >= 2*fe :
            print("Yes")
        else :
            print("No")
    else :
        if bco[2] >= 2*fe + 1 :
            print("Yes")
        else :
            print("No")


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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, VL, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll X;

signed main() {
    cin >> X;
    REP(i, ll(sqrt(2 * X) + 2)) {
        if(i * (i + 1) >= 2 * X) {
            cout << i << "\n";
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;



int main()
{
  string s, t;
  cin >> s >> t;
  int best = 1e9;
  for(int i = 0; i + sz(t) <= sz(s); i++) {
    int cur = 0;
    for(int j = 0; j < sz(t); j++) {
      cur += t[j] != s[i + j];
    }
    best = min(best, cur);
  }
  cout << best << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define mod 1000000007
#define bitcount __builtin_popcountll
#define ll long long
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define mp make_pair
int dp[2005][2005][2];
int main()
{
	int i,j,k;
	int n;
	sd(n);
	sd(k);
	char c;
	while(n--)
	{
		sd(i);
		sd(j);
		cin>>c;
		int x=i%(2*k)+1;
		int y=j%(2*k)+1;
		if(c=='B')
			dp[x][y][0]++;
		else
			dp[x][y][1]++;
	}
	for(i=1;i<=2*k;i++)
	{
		dp[i][0][0]+=dp[i-1][0][0];
		dp[i][0][1]+=dp[i-1][0][1];
		dp[0][i][0]+=dp[0][i-1][0];
		dp[0][i][1]+=dp[0][i-1][1];
	}
	for(i=1;i<=2*k;i++)
	{
		for(j=1;j<=2*k;j++)
		{
			dp[i][j][0]+=dp[i-1][j][0]+dp[i][j-1][0]-dp[i-1][j-1][0];
			dp[i][j][1]+=dp[i-1][j][1]+dp[i][j-1][1]-dp[i-1][j-1][1];
		}
	}
	int ans=0;
	for(i=1;i<=k;i++)
	{
		for(j=1;j<=k;j++)
		{
			for(int x=0;x<=1;x++)
			{
				int val1=0,val2=0;
				val1+=dp[i-1][j-1][x];
				val2+=dp[i+k-1][j-1][1-x]-dp[i-1][j-1][1-x];
				val1+=dp[2*k][j-1][x]-dp[i+k-1][j-1][x];
				val2+=dp[i-1][j+k-1][1-x]-dp[i-1][j-1][1-x];
				val1+=dp[i-1][2*k][x]-dp[i-1][j+k-1][x];
				val1+=dp[i+k-1][j+k-1][x]-dp[i+k-1][j-1][x]-dp[i-1][j+k-1][x]+dp[i-1][j-1][x];
				val2+=dp[2*k][j+k-1][1-x]-dp[i+k-1][j+k-1][1-x]-dp[2*k][j-1][1-x]+dp[i+k-1][j-1][1-x];
				val2+=dp[i+k-1][2*k][1-x]-dp[i+k-1][j+k-1][1-x]-dp[i-1][2*k][1-x]+dp[i-1][j+k-1][1-x];
				val1+=dp[2*k][2*k][x]-dp[i+k-1][2*k][x]-dp[2*k][j+k-1][x]+dp[i+k-1][j+k-1][x];
				ans=max(ans,val1+val2);
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> card(n);

    for(int i = 0; i < n; i++)
        cin >> card.at(i);
    
    sort(card.begin(), card.end());
    reverse(card.begin(), card.end());

    int hoz = card.at(0);
    for(int i = 1; i < n; i++){
        if(i % 2 == 1){
            hoz -= card.at(i);
        }else{
            hoz += card.at(i);
        }
    }
    
    cout << hoz << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int A,B; cin >> A >> B;
    cout << A*B << endl;
}

Measured memory_bytes: 3548
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n));
    
    let answer = A[0];
    
    for(var i=1; i<A.length; i++){
        answer ^= A[i];
    }
    
    console.log(answer === 0 ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 17728
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = gets.to_i
puts arr[k-1]


Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<unordered_map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
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)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    ll n,m;
    cin>>n>>m;
    ll t;
    cin>>t;
    vector<vector<pair<int,int>>> query(n);
    set<int> st;
    rep(i,m){
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        --b;
        if(c){
            for(auto e : st){
                query[e].emplace_back(b,-a);
                query[b].emplace_back(e,-a);
            }
            st.insert(b);
        }
        else {
            st.erase(b);
            for(auto e : st){
                query[e].emplace_back(b,a);
                query[b].emplace_back(e,a);
            }
        }
    }
    for(auto e : st)for(auto f : st){
        if(f>=e)break;
        query[e].emplace_back(f,t);
        query[f].emplace_back(e,t);
    }
    vector<ll> res(n),ma(n);
    vector<int> flag(n,-1),ans(n);
    ans[0]=1;
    rep(i,n){
        for(auto p : query[i]){
            if(flag[p.first]!=i){
                res[p.first]=0;
                flag[p.first]=i;
            }
            res[p.first]+=p.second;
            if(res[p.first]==ma[i]){
                ans[i]=min(ans[i],p.first);
            }
            else if(res[p.first]>ma[i]){
                ma[i]=res[p.first];
                ans[i]=p.first;
            }
        }
    }
    rep(i,n){
        printf("%d\n",ans[i]+1);
    }
    return 0;
}


Measured memory_bytes: 174644
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<math.h>
#include<unordered_set>
#include<string.h>
#include<unordered_map>
#include<numeric>
#include<string.h>
using namespace std;

typedef unsigned long long ll;
typedef long double ld;

#define FOR(i,N) for(int i=0;i<N;i++)

ll mod=1e9+7;

int main() {
    string A;
    cin>>A;
    map<char,ll>ma;
    for(int i=0;i<A.length();i++){
        ma[A[i]]++;
    }
    ll ans=A.length()*(A.length()-1)/2;
    for(auto a:ma){
        ans-=a.second*(a.second-1)/2;
    }
    cout<<ans+1<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>

using namespace std;

int N, M, N2;
int v[200100];
int ans;

int Solve(int t) {
  int m = 0;
  int T = N-t;
  int* V = v + t*2;
  for (int i = 0; i < t; ++i) {
    int s = v[i] + v[t*2-1-i];
    m = max(m, s%M);
  }
  for (int i = 0; i < T; ++i) {
    int s = V[i] + V[T*2-1-i];
    if (s < M) return -1;
    m = max(m, s%M);
  }
  ans = min(ans, m);
  return 0;
}

int main() {
  while (cin >> N >> M) {
    ans = M;
    N2 = N*2;
    for (int i = 0; i < N2; ++i) {
      cin >> v[i];
    }
    sort(v, v+N2);
    int p = 0, q = N;
    while (p+1 < q) {
      int t = (p+q)/2;
      int r = Solve(t);
      if (r < 0) {
	p = t;
      } else {
	q = t;
      }
    }
    Solve(p);
    Solve(q);
    cout << ans << endl;
  }
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define gc getchar
#define rint register int
#define rep(i,u,z) for(rint i=u;i<=z;++i)
#define reb(i,u,z) for(rint i=u;i>=z;--i)
#define inf 0x7fffffff

using namespace std;
typedef long long ll;

int n,t,A;

inline int readint(){
	int rt=0,sign=1;
	char ch=gc();
	while(ch<'0'||ch>'9'){
		if(ch=='-')sign=-1;
	    ch=gc();
	}
	while(ch>='0'&&ch<='9'){
		rt=(rt<<3)+(rt<<1)+(ch&15);
		ch=gc();
	}
	return rt*sign;
}
int main(){
	double minn=inf;
	n=readint(),t=readint(),A=readint();
	int pos,h;
	rep(i,1,n){
		h=readint();
		if(fabs((double)t-0.006*(double)h-(double)A)<minn){
			pos=i;
			minn=fabs((double)t-0.006*(double)h-(double)A);
		}
	}
	printf("%d",pos);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
	char a,b[1000]={0};
	int i,h=0;
	for(i=0;i<1000;i++){
		scanf("%c",&a);
		if(a=='C')b[i]='Z';
		else if(a=='B')b[i]='Y';
		else if(a=='A')b[i]='X';
		else b[i]=a-3;
		h+=1;
		if(a=='\n')break;
	}
	for(i=0;i<h-1;i++){
		printf("%c",b[i]);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2124
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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 A,B,C, k;
bool fg = false;
void func(int a, int b, int c, int cnt){
    if(cnt==k){
        if(c > b && b > a)fg = true;
        return;
    }
    if(c > b && b > a)fg = true;
    a *= 2; func(a, b, c, cnt+1); a/=2;
    b*=2; func(a, b, c, cnt+1); b/=2;
    c*=2; func(a,b,c,cnt+1); c/=2;
}

int main(){
    cin >> A >> B >> C >> k;
    func(A, B, C, 0);
    if(fg)cout << "Yes" << ln;
    else cout << "No" << ln;
}
    


Measured memory_bytes: 3616
from sys import stdin
# import math
import numpy as np
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = stdin.readline().rstrip().split()[0]

N = int(stdin.readline().rstrip().split()[0])
S = stdin.readline().rstrip().split()[0]
K = int(stdin.readline().rstrip().split()[0])

K = K-1

S_k = S[K]
arr = ""
for s in S:
  if s==S_k:
    arr += s
  else:
    arr += "*"
print(arr)



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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

fn main() {
    input! {
        N: u64
    }
    let mut p:u64 = 1;
    for i in 1..(N+1) {
        p = (p * i) % (1000000000 + 7);
        
    }

    println!("{}",p)
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <int, ii> iii;
#ifdef VC
#define scanf scanf_s
#endif

const int Maxn = 1005;
const int mod = 1000000007;

int n;
vector<int> offs[Maxn];
ll X[Maxn];
ll Y[Maxn];
bool flg;
int dp[5010];

void dfs(int v) {
	if (offs[v].size() == 0) {
		Y[v] = 0;
		return;
	}
	for (int i = 0; i < offs[v].size(); i++) {
		dfs(offs[v][i]);
		if (!flg) return;
	}
	ll tsum = 0LL;
	for (int i = 0; i < X[v] + 1; i++) dp[i] = 0;
	dp[X[offs[v][0]]] = 1; tsum += X[offs[v][0]];
	if (Y[offs[v][0]] <= X[v]) {
		dp[Y[offs[v][0]]] = 1; tsum += Y[offs[v][0]];
	}
	for (int i = 1; i < offs[v].size(); i++) {
		tsum += X[offs[v][i]];
		tsum += Y[offs[v][i]];
		for (int j = X[v]; j >= 0; j--) {
			if (dp[j] == i) {
				if (j + X[offs[v][i]] <= X[v]) {
					dp[j + X[offs[v][i]]] = i + 1;
				}
				if (j + Y[offs[v][i]] <= X[v]) {
					dp[j + Y[offs[v][i]]] = i + 1;
				}
			}
		}
	}
	for (int i = X[v]; i >= 0; i--) {
		if (dp[i] == offs[v].size()) {
			Y[v] = tsum - i;
			return;
		}
	}
	flg = false;
	return;
}

int main(){
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		int p; 
		scanf("%d", &p);
		p--;
		offs[p].push_back(i);
	}
	for (int i = 0; i < n; i++) 
		scanf("%d", &X[i]);
	flg = true;
	dfs(0);
	if (flg) {
		cout << "POSSIBLE" << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}


	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    int count_1=0,count_0=0;
    cin>>s;
    for(int i=0;s[i]!='\0';i++){
        if(s[i]=='1'){
            count_1++;
        }else{
            count_0++;
        }
    }
    if(count_0>count_1){
        cout<<count_1*2<<endl;
    }else{cout<<count_0*2<<endl;}
    return 0;
}

Measured memory_bytes: 512
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var a = o.a();
  var b = o.a();
  var ans = 0;
  for(var i = 1; i < b; i+=a-1){
    ans++;
  }
  return ans;
}

Measured memory_bytes: 22076
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns      #-}
{-# LANGUAGE CPP               #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = B.getLine >>= print . solve

inf :: Int32
inf = 0x3f3f3f3f

solve :: B.ByteString -> Int32
solve bs = res
  where
    cs = U.map(\c->unsafeShiftL 1 $ ord c - ord 'a').U.fromList $ B.unpack bs
    !ps = U.fromList $ 0 : map (shiftL 1) [0..25]
    !cum = U.scanl1 xor cs
    res = runST $ do
        m <- UM.replicate (2^26) inf
        UM.write m (U.head cum) 1
        U.forM_ (U.tail cum) $ \s -> do
            let step acc p = do
                if s == p
                then return $ min acc 1
                else min acc . (+1) <$> UM.unsafeRead m (fromIntegral $ xor s p)
            tmp <- U.foldM' step inf ps
            UM.unsafeModify m (min tmp) (fromIntegral s)
        UM.read m . fromIntegral $ U.last cum



Measured memory_bytes: 269692
n,m = map(int,input().split())

dist = [[10**10 for i in range(n)]for j in range(n)]
for i in range(n):
	dist[i][i] == 0

a = [0]*m
b = [0]*m
c = [0]*m

for i in range(m):
	a[i], b[i], c[i] = map(int,input().split())
	dist[a[i]-1][b[i]-1] = c[i]
	dist[b[i]-1][a[i]-1] = c[i]


#nは頂点、mは辺、a、bは頂点、cはaとbの距離


for k in range(n):
	for i in range(n):
		for j in range(n):
			dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])


res = 0
for i in range(m):
	if c[i] > dist[a[i]-1][b[i]-1]:
		res += 1

print(res)


Measured memory_bytes: 3392
n = int(input())
F = []
P = []
for i in range(n):
    F.append(list(map(int,input().split())))
for i in range(n):
    P.append(list(map(int,input().split())))

ans = -10**10

for i in range(1,2**10):
    l = []
    ans1 = 0
    for j in range(10):
        if (i>>j) & 1:
            l.append(1)
        else:
            l.append(0)
    for k in range(n):
        count = 0
        for m in range(10):
            if l[m] == 1 and F[k][m] == 1:
                count += 1
        ans1 += P[k][count]
    ans = max(ans,ans1)
print(ans)


Measured memory_bytes: 3188
#include <stdio.h>

#define N 100

int min(int, int);

int main()
{
  int i, n, l, j, k, q, p[N+1], m[N+1][N+1];

  scanf("%d",&n);

  for(i = 1; i <= n; i++)
    {
      scanf("%d%d",&p[i-1],&p[i]);
    }

  for(i = 1; i<=n; i++)
    {
      m[i][i] = 0;
    }

  for(l = 2; l <= n; l++)
    {
      for(i = 1; i <= n-l+1; i++)
	{
	  j = i+l-1;
	  m[i][j] = 2147483647;
	    for(k = i; k < j; k++)
	      {
		m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
	      }
	}
    }

  printf("%d\n",m[1][n]);
  
  return 0;
}

int min(int a, int b)
{
  if(a < b)return a;
  else return b;
}



Measured memory_bytes: 2052
#include<stdio.h>
#define MAX 500000
#define SENTINEL 2000000000

typedef long long llong;

int L[MAX/2+2],R[MAX/2+2];

llong merge(int A[], int n, int left, int mid, int right){
  int i,j,k;
  llong cnt = 0;
  int n1 = mid-left;
  int n2 = right - mid;
  for(i = 0; i < n1; i++) L[i] = A[left + i];
  for(i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  j = 0;
  i = 0;
  for(k = left;k<right;k++){
    if(L[i] <= R[j]){
      A[k] = L[i++];
    }else{
      A[k] = R[j++];
      cnt+=n1-i;
    }
  }
  return cnt;
}


llong mergeSort(int A[], int n, int left, int right){
  int mid;
  llong v1,v2,v3;
  if(left+1<right){
    mid = (left+right)/2;
    v1 = mergeSort(A,n,left,mid);
    v2 = mergeSort(A,n,mid,right);
    v3 = merge(A,n,left,mid,right);
    return v1+v2+v3;
  }else return 0;
}


int main(){
  int A[MAX],n,i;

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

  llong ans = mergeSort(A,n,0,n);

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


Measured memory_bytes: 3352
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<stack>
#include<iomanip>
#define rep(i,n) for(int i=0;i<((int)n);i++)
#define Rep(i,n0,n) for(int i=n0;i<((int)n);i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<((int)n);j++)
#define W(x) cout<<x<<endl;
#define Debug(x) cout<<"#DEBUG "<<x<<endl;
#define INF (1<<29)
#define INF2 (long long)8*(long long)INF*(long long)INF
#define mod 1000000007
typedef long long ll;

using namespace std;


int min(int x,int y){if(y<x)return y;else return x;}
int max(int x,int y){if(y>x)return y;else return x;}
int fact(int x){int i=1;rep(j,x){i*=(j+1);} return i;}
long long fact(long long x){long long i=1;rep(j,x){i*=(j+1);} return i;}
int gcd(int x, int y)
{
    if(x%y==0)return y;
    else if(y%x==0)return x;
    else return gcd(x%y,y%x);
}
ll gcd(ll x, ll y)
{
    if(x%y==0)return y;
    else if(y%x==0)return x;
    else return gcd(x%y,y%x);
}

int main()
{
    int n,m;
    cin>>n>>m;
    int b[n];
    vector<int> G[n];
    stack<int> s;
    rep(i,n)
    {
        b[i]=0;
    }
    int k,l;
    rep(i,m)
    {
        cin>>k>>l;
        k--;
        l--;
        G[k].push_back(l);
        b[l]++;
    }
    int num=0,ans=0;
    rep(i,n)
    {
        if(b[i]>0)
        {
            ans++;
            num=0;
            while(!s.empty())
            {
                b[s.top()]--;
                s.pop();
            }
        }
        rep(j,G[i].size())
        {
            num++;
            s.push(G[i][j]);
        }
    }
    W(ans)
    return 0;
}

Measured memory_bytes: 6272
#include <iostream>
#include <tuple>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>
#include <string>
#include <utility>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

struct Node{
    uint id;
    vector<uint> adjacent_node_indexes;
    bool visited;
    explicit Node(uint id);
};

struct Edge{
    bool valid;
    uint from;
    uint to;
    Edge(bool valid, uint from, uint to);
};




Node::Node(uint id): id(id), adjacent_node_indexes({}), visited(false) {
}

Edge::Edge(bool valid, uint from, uint to):valid(valid), from(from), to(to){}


bool is_connected(vector<Edge> edges, uint N);
bool is_connected(vector<Edge> edges, uint N){
    vector<Node> nodes{};
    for (auto &&i: irange(0U, N)){
        nodes.emplace_back(Node(i));
    }
    for (auto &&edge:edges){
        if (edge.valid){
            nodes.at(edge.from).adjacent_node_indexes.push_back(edge.to);
            nodes.at(edge.to).adjacent_node_indexes.push_back(edge.from);
        }
    }
    vector<uint> stack{};
    stack.push_back(0);
    while (!stack.empty()){
        uint node_index = stack.back();
        stack.pop_back();
        for (auto &&i: nodes.at(node_index).adjacent_node_indexes){
            if (!nodes.at(i).visited){
                stack.push_back(i);
                nodes.at(i).visited = true;
            }
        }
    }
    bool ret{true};
    for (auto &&i: irange(0U, N)){
        if (!nodes.at(i).visited){
            ret = false;
            return ret;
        }
    }
    return ret;
}



int main() {
    uint N, M;
    cin >> N >> M;
    vector<Edge> edges;
    for (auto &&i: irange(0U, M)){
        uint a, b;
        cin >> a >> b;
        a--;
        b--;
        edges.emplace_back(Edge(true, a, b));
    }
    uint count{0};
    for (auto &&i: irange(0U, M)){
        vector<Edge> edges_tmp{edges};
        edges_tmp.at(i).valid = false;
        if (!is_connected(edges_tmp, N))count++;
    }
    cout << count;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

int main() {
	int a,b, i, j;
	scanf("%d %d", &a,&b);
	if (a%b == 0) {
			printf("-1\n");
	}
	else{
		for (i = 1; i < 100000000; i++) {
			if ((a*i) %b != 0) {
				printf("%d\n", a*i);
				break;
			};
		};
	};
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	unsigned long long int a, b, c, d;
	unsigned long long int H[100000];
	unsigned long long int K[100000];
	long int i, j;
	long int sum = 0;

	scanf("%lld%lld", &a, &b);

	for (i = 0; a > i; i++) {
		scanf("%lld", &(H[i]));
		K[i] = 0;
	}

	for (i = 0; b > i; i++) {
		scanf("%lld%lld", &c, &d);
		if (H[c - 1] <= H[d - 1]) {
			K[c - 1] = 1;
		}
		if (H[c - 1] >= H[d - 1]) {
			K[d - 1] = 1;
		}
	}

	for (i = 0; a > i; i++) {
		if (K[i] == 0) {
			sum++;
		}
	}

	printf("%ld", sum);

	return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str;
  cin >> str;
  
  reverse(str.begin(), str.end());
  
  bool ans = true;

  while(str.size() != 0) {
    if(str.find("maerd") == 0){
      str = str.erase(0, 5);
    }
    else if(str.find("esare") == 0){
      str = str.erase(0, 5);
    }
    else if(str.find("remaerd") == 0){
      str = str.erase(0, 7);
    }
    else if(str.find("resare") == 0){
      str = str.erase(0, 6);
    }
    else{
      ans = false;
      break;
    }
  }
  
  if(ans){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
 
  
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;

int noOfFactors(int n) {
    map<int, int>mp;
    for (long long d = 2; d * d <= n; d++) {
        while (n % d == 0) {
            mp[d]++;
            n /= d;
        }
    }
    if (n > 1)
        mp[n]++;
    int ans=1;
    for(auto i:mp){
            ans*=(i.second+1);
    }
    return ans;
}


int32_t main() {

    fast
    int n;
    cin >> n;
    int ans=0;
    for(int i=1;i<=n-1;i++){
        ans+=noOfFactors(i);
    }
    cout<<ans;

    return 0;
}



Measured memory_bytes: 3652