akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<ll> sll;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))

// constexpr int INF = 1<<25;
// constexpr ll  INF = 1LL<<50;
// int dp[N_MAX][M_MAX] = {}

// Forward declaration
template <typename T>
void dumpContents(const T& v, const string& msg="");

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

pii makeSame(const vi& v, int banned) {
  vi slots(1e5+1, 0);
  for (auto i : v) {
    if (i == banned) continue;
    slots[i]++;
  }

  int m = -1;
  int index = -1;
  for (int i=1; i<int(slots.size()); i++) {
    if (m < slots[i]) {
      m = slots[i];
      index = i;
    }
  }

  return make_pair(v.size()-m, index);
}

int main(int argc, char** argv) {
  int n;
  cin >> n;
  vi a(n/2); // even indices
  vi b(n/2); // odd indices
  for (int i=0; i<n/2; i++) {
    cin >> a[i] >> b[i];
  }

  // from even
  auto r1a = makeSame(a, -1);
  int ret1 = r1a.first;
  auto r1b = makeSame(b, r1a.second);
  ret1 += r1b.first;


  // from odd
  auto r2b = makeSame(b, -1);
  int ret2 = r2b.first;
  auto r2a = makeSame(a, r2b.second);
  ret2 += r2a.first;

  cout << min({ret1, ret2}) << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////


void solve() {
	int A, B;
	cin >> A >> B;
	if(A == 2 || B == 2) cout << "No\n";
	else cout << "Yes\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;
    static CF_Reader in;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in = new CF_Reader();

        int n = in.intNext();
        int[] lows = new int[n];
        int[] highs = new int[n];
        for (int i = 0; i < n; i++) {
            lows[i] = in.intNext();
            highs[i] = in.intNext();
        }
        Arrays.sort(lows);
        Arrays.sort(highs);
        int mid = n/2;
        int ans;
        if (n % 2 == 1) {
            ans = highs[mid] - lows[mid] + 1;
        } else {
            ans = (highs[mid - 1] + highs[mid]) - (lows[mid - 1] + lows[mid]) + 1;
        }
        out.println(ans);

        out.close();
    }


    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}




Measured memory_bytes: 57876
n, m = map(int, input().split())
a = list()
for i in range(n):
    a.append(list(map(int, input().split())))
b = list()
for i in range(m):
    b.append(int(input()))
for i in range(n):
    ans = 0
    for j in range(m):
        ans += a[i][j] * b[j]
    print(ans)


Measured memory_bytes: 6004
#include<stdio.h>

int List[300000];

void list(void){
	int i, j;
	int next;
	for (i = 6,next = 5; i < 300000; i+=next){
		List[i] = 1;
		next = (next == 5) ? 2 : 5;
	}
	for (i = 6; i < 300000; i++){
		if (List[i]){
			for (j = i + i; j < 300000; j += i) List[j] = 0;
		}
	}
}

int main(void){
	int a;
	int i;
	list();
	while (scanf("%d", &a), a != 1){
		printf("%d:", a);
		for (i = 6; i <= a; i++){
			if (a%i == 0 && List[i]) printf(" %d", i);
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 1772
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep0(i,n) for (int i=0; i<=(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using llGraph = vector<vl>;
using vb = vector<bool>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

template<typename T>
struct is_vector : false_type{};

template<typename T>
struct is_vector<vector<T>> : true_type{};

template<typename T>
ostream &operator << (ostream &ostr, const vector<T> &vec) {
  if (vec.empty()) {
    return ostr;
  }
  ostr << vec.front();
  for (auto itr = ++vec.begin(); itr != vec.end(); ++itr) {
    if (is_vector<T>()) ostr << "\n" << *itr;
    else ostr << ' ' << *itr;
  }
  return ostr;
}

template<typename T>
bool CompareBySecond(pair<T, T> a, pair<T, T> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

template<typename T>
T GCD(T a, T b) {
  T c = a % b;
  while (c != 0) { a = b; b = c; c = a % b; }
  return b;
}

vl pow2, pow3;

ll CutUnder(int LOG, ll n) {
  ll ret = 0;
  int d = 0;
  while (LOG--) {
    if ((n>>LOG) & 1) continue;
    (ret += pow2[d] * pow3[LOG]) %= MOD;
    ++d;
  }
  (ret += pow2[d]) %= MOD;
  return ret;
}

ll CutOver(int LOG, ll n) {
  ll ret = 0;
  int d = 0;
  while (LOG--) {
    if ((n>>LOG) & 1) {
      (ret += pow2[d] * pow3[LOG]) %= MOD;
      ++d;
    }
  }
  (ret += pow2[d]) %= MOD;
  return ret;
}

ll SameRange(int LOG, ll L, ll R) {
  if (L > R) return 0;
  if (L == R) return 1;

  --LOG;

  if (((L>>LOG) & 1) == ((R>>LOG) & 1)) {
    return SameRange(LOG, L, R);
  }

  return (CutUnder(LOG, L) + CutOver(LOG, R) + SameRange(LOG, L+(1LL<<LOG), R)) % MOD;
}

void solve() {
  ll L, R; cin >> L >> R;

  pow2.resize(64);
  pow2[0] = 1;
  rep(i,64) pow2[i+1] = pow2[i] * 2 % MOD;

  pow3.resize(64);
  pow3[0] = 1;
  rep(i,64) pow3[i+1] = pow3[i] * 3 % MOD;

  int l = 64, r = 64;
  while (--l >= 0) if (L>>l) break;
  while (--r >= 0) if (R>>r) break;

  if (l == r) {
    cout << SameRange(l, L, R) << endl;
    return;
  }

  ll ans = (CutUnder(l, L) + CutOver(r, R)) % MOD;
  for (int i=l+1; i<r; ++i) (ans += pow3[i]) %= MOD;
  cout << ans << endl;
}

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


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

auto main() -> int
{
  auto numHumans = 0;
  std::cin >> numHumans;
  std::string march("MARCH");
  std::unordered_map<char, std::vector<std::string>> humans;
  for (auto i = 0; i < numHumans; ++i) {
    std::string name;
    std::cin >> name;
    if (std::find(march.begin(), march.end(), name[0]) != march.end()) {
      humans[name[0]].push_back(name);
    }
  }
  long long int result = 0;
  for (int i = 0; i < march.size() - 2; ++i) {
    for (int j = i + 1; j < march.size() - 1; ++j) {
      for (int k = j + 1; k < march.size(); ++k) {
	result += humans[march[i]].size() * humans[march[j]].size() * humans[march[k]].size();
      }
    }
  }
  std::printf("%lld\n", result);
  return 0;
}


Measured memory_bytes: 5748
import sys

x = int(input())
nums = [i for i in range(1, 100004, 2)]
del nums[0]
if x == 2:
    print(2)
    sys.exit()
while nums:
    primal = nums.pop(0)
    if primal >= x:
        print(primal)
        break
    nums = [num for num in nums if num % primal != 0]


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

int main(int argc, char *argv[])
{
	int a,b;
	std::cin >> a >> b;
	if (a < b) {
		cout << "a < b\n";
	} else if (a > b) {
		cout << "a > b\n";
	} else {
		cout << "a == b\n";
	}
	return 0;	
}

Measured memory_bytes: 3084
import numpy as np
A = np.array([list(map(int, input().split())) for i in range(3)])
N = int(input())
for i in range(N):
    bingo_num = int(input())
    A = np.where(A == bingo_num, 0, A)

if (0 in np.sum(A, axis=1)
    or 0 in np.sum(A, axis=0)
    or np.sum(np.diag(A)) == 0
        or A[0, 2]+A[1, 1]+A[2, 0] == 0):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 12480
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }
    let mut a = a;
    a.sort();
    let mut ans = 0;
    for i in 1..n {
        ans += a[i] - a[i - 1];
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <queue>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs, x) vector<vector<T>> xs(n, vector<T>(m, x))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs, 0); For(i, n) For(j, m) cin >> xs[i][j]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"

using namespace std;
using ll = long long;

int main(void){
    Cin(int, a);
    Cin(int, b);
    
    Vec2(char, 40, 100, c, '#');
    For(i, 20) For(j, 100) c[i][j] = '.';
    
    For(k, a-1){
        int i = (k/50)*2, j = (k%50)*2;
        c[21+i][j] = '.';
    }
    For(k, b-1){
        int i = (k/50)*2, j = (k%50)*2;
        c[i][j] = '#';
    }
    
    Cout("40 100");
    For(i, 40){
        For(j, 100) cout << c[i][j];
        cout << "\n";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	//
  char x;
  cin >> x;

  if (x == 'a'|| x == 'e')
    cout << "vowel" << endl;
  else if (x =='i'|| x == 'u')
    cout << "vowel" << endl;
  else if (x == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ft[2000005];
ll ls(ll x) { 
    return (x & (-x)); 
}
ll query(ll p) {
    ll sum = 0;
    for(; p; p -= ls(p)) sum += ft[p];
    return sum;
}

void update(ll p, ll v) {
	for(; p <= 2000005; p += ls(p)) ft[p] += v;}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,m,i,q,x,y,i1,z,k,sum=0;
    cin>>n>>k;
    ll arr[n],ps[n+1];
    map<ll,ll>mp;
    vector<ll>v;
    ps[0]=0;
    v.push_back(0);
    for (i=0;i<n;i++){
        cin>>arr[i];
        arr[i]-=k;
        ps[i+1]=ps[i]+arr[i];
        v.push_back(ps[i+1]);
    }
    sort(v.begin(),v.end());
    for (i=0;i<v.size();i++){
        mp[v[i]]=i+1;
    }
    update(mp[0],1);
    for (i=1;i<=n;i++){
        //cout<<ps[i]<<' '<<mp[ps[i]]<<' '<<query(mp[ps[i]])<<'\n';
        sum+=query(mp[ps[i]]);
        update(mp[ps[i]],1);
    }
    cout<<sum<<'\n';
}


Measured memory_bytes: 25200
#include <stdio.h>


int main(void) {
    char bar[31][11] = {};
    int n, m, lucky, d, i, r, c;
    int route[31], lroute[31];

    while (scanf("%d", &n) != EOF && n) {
        scanf("%d", &m);
        scanf("%d", &lucky);
        scanf("%d", &d);
        route[0] = m;
        for (i = 1; i <= d; i++) {
            scanf("%s", &(bar[i][1]));
            bar[i][0] = bar[i][n] = '0';

            if (bar[i][route[i-1]-1] == '1') {
                route[i] = route[i-1] - 1;
            }
            else if (bar[i][route[i-1]] == '1') {
                route[i] = route[i-1] + 1;
            }
            else {
                route[i] = route[i-1];
            }
        }
        if (route[d] == lucky) {
            puts("0");
            continue;
        }

        lroute[d] = lucky;
        for (i = d - 1; i >= 1; i--) {
            if (bar[i+1][lroute[i+1]-1] == '1') {
                lroute[i] = lroute[i+1] - 1;
            }
            else if (bar[i+1][lroute[i+1]] == '1') {
                lroute[i] = lroute[i+1] + 1;
            }
            else {
                lroute[i] = lroute[i+1];
            }
        }

        for (i = 1, r = 0, c = 0; i <= d; i++) {
            if (route[i] + 1 == lroute[i] &&
                bar[i][route[i]-1]=='0' && bar[i][route[i]]=='0' && bar[i][route[i]+1]=='0') {
                r = i;
                c = route[i];
                break;
            }
            else if (route[i] - 1 == lroute[i] &&
                     bar[i][route[i]-2]=='0' && bar[i][route[i]-1]=='0' && bar[i][route[i]]=='0') {
                r = i;
                c = route[i] - 1;
                break;
            }
        }
        if (r != 0) {
            printf("%d %d\n", r, c);
        }
        else {
            puts("1");
        }

    }
    return 0;
}

Measured memory_bytes: 612
function main(arg) {
	var tmp = arg.split("\n")[0].split(" ").map(e => Number(e))
	var N = tmp[0]
	var A = tmp[1]
	var B = tmp[2]

	var max = 0
	if (A < B) {
		max = A
	} else {
		max = B
	}

	var min = 0
	if (A + B > N) {
		min = Math.abs(N - (A + B))
	} 
	console.log(max + " " + min)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    X, Y = map(int, input().split())
    for i in range(X + 1):
        for j in range(X + 1):
            if i + j != X:
                continue
            if 2 * i + 4 * j == Y:
                print("Yes")
                return

    print("No")


if __name__ == "__main__":
    main()


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

const int mod = 1000000007;
int dp[2][201][10001];

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> w(N);
    for (int i=0; i<N; ++i) {
        cin >> w[i];
    }
    sort(w.begin(), w.end());
    dp[0][0][0] = 1;
    for (int i=0; i<N; ++i) {
        for (int j=0; j<=i; ++j) {
            for (int k=0; k<=W; ++k) {
                // w[i] を取る場合
                if (k + w[i] <= W) {
                    (dp[(i+1)%2][j][k+w[i]] += dp[i%2][j][k]) %= mod;
                }
                // w[i] を取らない場合
                if (j == 0) {
                    (dp[(i+1)%2][i+1][k] += dp[i%2][j][k]) %= mod;
                } else {
                    (dp[(i+1)%2][j][k] += dp[i%2][j][k]) %= mod;
                }
            }
        }
        for (int j=0; j<=N; ++j) {
            for (int k=0; k<=W; ++k) {
                dp[i%2][j][k] = 0;
            }
        }
    }
    int sum = 0;
    for (int i=0; i<=N; ++i) {
        for (int j=0; j<=W; ++j) {
            if (i == 0 || j + w[i-1] > W) {
                (sum += dp[N%2][i][j]) %= mod;
            }
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 18700
def solve(a,b,n,m)
	ans=false
	for i in 0..n-m
		for j in 0..n-m
			same=true
			for k in 0..m-1
				for l in 0..m-1
					if a[i+k][j+l]!=b[k][l]
						same=false
					end
				end
			end
			if same==true then ans=true end
		end
	end
	puts ans==true ? "Yes" : "No" 
end

if __FILE__==$0
	rl_i=lambda{|str,dl|str.strip.split(dl).map(&:to_i)}
	r_s=lambda{|str|str.strip}
	dl=" "
	n=rl_i[gets,dl]
	a=[]
	b=[]
	n[0].times do |i|
		a.push(r_s[gets])
	end
	n[1].times do |i|
		b.push(r_s[gets])
	end
	solve(a,b,n[0],n[1])
end

Measured memory_bytes: 1788
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

MAX = 10 ** 5
MOD = 10 ** 9 + 7

fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]

def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod


def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod
comInit(MOD)

N, K = map(int, readline().split())

for i in range(1, K + 1):
    print(com(N - K + 1, i, MOD) * com(K - 1, i - 1, MOD) % MOD)

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

using namespace std;

const int MOD = 1e9 + 7;

void solve(void)
{
	int n, m;
	cin >> n >> m;
	vector<int> dp(n+1), ng(n+1);
	for (int i = 0; i < m; i++)
	{
		int x;
		cin >> x;
		ng[x] = 1;
	}
	dp[0] = 1;
	for (int i = 1; i <= n; i++)
	{
		if (ng[i])
		{
			continue;
		}
		if (i > 1)
		{
			dp[i] += dp[i - 2];
			dp[i] %= MOD;
		}
		dp[i] += dp[i - 1];
		dp[i] %= MOD;
	}
	cout << dp[n] << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 1024
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (T, X) = read!(f64, f64);
    println!("{}", T / X)
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){
   
    int n;
	cin >> n;

	for(int nuki = 1;nuki <= 50000;nuki++){
		if((int)(nuki*1.08) == n){
			cout << nuki << endl;
			return 0;
		} 
	}
	cout << ":(" << endl;


	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2020-qual.contest.atcoder.jp/tasks/ddcc2020_qual_b
// rm -r -f test;oj dl https://sumitrust2019.contest.atcoder.jp/tasks/sumitb2019_b

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

class microwave
{
  int tmpA, tmpB;
  int timeC, timeD, timeE;

public:
  microwave(int a, int b, int c, int d, int e) 
    : tmpA(a),tmpB(b),timeC(c),timeD(d),timeE(e) {}
  int calcTime();
};

int microwave::calcTime()
{
  int time = 0;
  if (tmpA < 0)
  {
    time += (-1) * tmpA * timeC;
    time += timeD;
    time += tmpB * timeE;
  }
  else if (0 < tmpA)
  {
    time += (tmpB - tmpA) * timeE;
  }
  return time;
}

int main()
{
  int a, b, c, d, e;

  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);

  microwave mcr(a, b, c, d, e);

  printf("%d\n", mcr.calcTime());
  
  return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char a[101000];
    long long k,m,n;
    cin>>a;
    n=strlen(a);
    for(int i=0;i<n;i++)
    {
        if(a[i]=='e')       //读到e就判断
        {
            if(a[i+1]=='r'&&a[i+2]=='a'&&a[i+3]=='s'&&a[i+4]=='e')       //erase或eraser
            {
                if(a[i+5]=='r')       //eraser
                {
                    i+=5;
                }
                else          //erase
                {
                    i+=4;
                }
            }
        }
        else if(a[i]=='d')         //读到d就判断
        {
            if(a[i+1]=='r'&&a[i+2]=='e'&&a[i+3]=='a'&&a[i+4]=='m')    //dream还是dreamer还是dreamerase还是dreameraser
            {
                if(a[i+5]=='e'&&a[i+6]=='r'&&a[i+7]=='a'&&a[i+8]=='s'&&a[i+9]=='e')        //dreamerase
                {
                    i+=4;
                }
                else
                {
                    if(a[i+5]=='e'&&a[i+6]=='r')      //排除完就只剩dreamer
                    {
                        i+=6;
                    }
                    else
                    {
                        i+=4;
                    }
                }
            }
        }
        else     //如果以上都不是，说明挂了，直接输出NO就好了
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;        //完美结束
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
  static int[] list;
    public static void main(String[] args) throws Exception{
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      for (int i = n; i <= 999; i++) {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      }
    }
}

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

using namespace std;

using int64 = long long;


int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector< int > B(N);
  for(int i = 0; i < N; i++) {
    cin >> B[i];
  }
  sort(begin(B), end(B));

  vector< int > ans(N, -1);
  for(int i = 0; i < N; i++) {
    int win = 0;
    int ok, ng;

    bool iswin = A[i] < B.back();
    if(iswin) {
      ok = (int) (upper_bound(begin(B), end(B), A[i]) - begin(B));
      ng = B.size();
    } else {
      ok = 0;
      ng = B.size();
    }

    multiset< int > C(B.begin(), B.end());
    for(int j = i; j < N; j++) {
      auto it = C.upper_bound(A[j]);
      if(it != end(C)) {
        C.erase(it);
        ++win;
      }
    }

    vector< int > Asort;
    for(int j = i + 1; j < N; j++) {
      Asort.push_back(A[j]);
    }
    sort(begin(Asort), end(Asort));

    auto check = [&](int val) {
      vector< int > nxtB;
      for(auto &p : B) {
        if(p == val) val = -1;
        else nxtB.push_back(p);
      }
      int get3 = 0, add = 0;
      for(int j = 0; j < Asort.size(); j++) {
        while(get3 < nxtB.size() && nxtB[get3] <= Asort[j]) {
          ++get3;
        }
        if(get3 < nxtB.size()) {
          ++add;
          ++get3;
        }
      }
      return add;
    };


    while(ng - ok > 1) {
      int mid = (ok + ng) / 2;
      if(check(B[mid]) + iswin == win) ok = mid;
      else ng = mid;
    }

    ans[i] = B[ok];

    vector< int > Bnxt;
    for(int j = 0; j < B.size(); j++) {
      if(ok == j) ok = -1;
      else Bnxt.push_back(B[j]);
    }
    B.swap(Bnxt);
  }

  for(int i = 0; i < N; i++) {
    if(i) cout << " ";
    cout << ans[i];
  }
  cout << endl;
}


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

using namespace std;

template <class T> inline bool chmax(T &a, T b) { /* {{{ */
  if (a < b) {
    a = b;
    return true;
  }
  return false;
} /* }}} */

int main() {
  int N;
  cin >> N;
  map<string, int> m;
  int max_cnt = 0;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    m[s]++;
    chmax(max_cnt, m[s]);
  }
  for (auto item : m) {
    if (item.second == max_cnt) {
      cout << item.first << endl;
    }
  }

  return 0;
}
/* vim:set fdm=marker: */


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

using i64 = int64_t;

struct Node{
    int i, j, color;
};

char island[52][52]={0};
int owner[52][52]={0};
int di[4] = {0,1,0,-1}, dj[4] = {-1,0,1,0};

void init(int w, int h){
    for(int i=1;i<=h;++i){
        for(int j=1;j<=w;++j){
            island[i][j] = '.';
            owner[i][j] = 0;
        }
    }
    for(int i=0;i<=w+1;++i){
        island[0][i] = '#';
        island[h+1][i] = '#';
    }
    for(int i=0;i<=h+1;++i){
        island[i][0] = '#';
        island[i][w+1] = '#';
    }
}

int main(){
    int w, h;
    while(cin >> w >> h, w != 0){
        init(w, h);
        queue<Node> que;
        for(int i=1;i<=h;++i){
            for(int j=1;j<=w;++j){
                cin >> island[i][j];
                if(island[i][j] == 'B'){
                    que.push((Node){i, j, 1});
                }else if(island[i][j] == 'W'){
                    que.push((Node){i, j, 2});
                }
            }
        }
        while(!que.empty()){
            Node cur = que.front(); que.pop();
            for(int k=0;k<4;++k){
                int ni = cur.i + di[k], nj = cur.j + dj[k];
                if(island[ni][nj] != '.')continue;
                if(owner[ni][nj] & cur.color)continue;
                owner[ni][nj] |= cur.color;
                que.push((Node){ni, nj, cur.color});
            }
        }
        int black = 0, white = 0;
        for(int i=1;i<=h;++i){
            for(int j=1;j<=w;++j){
                if(owner[i][j] == 1)black++;
                else if(owner[i][j] == 2)white++;
            }
        }
        cout << black << " " << white << endl;
    }

    return 0;
}



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

int main()
{
    long long i,j,a,b,c=0,l=0,t,x,y,n;
    string s;
    cin>>s;
  for(i=0;i<s.size();i++)
  {
    c+=int(int(s[i])-48);
  }
if(c%9==0) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
 return 0;
}


Measured memory_bytes: 3716
S = input()
a, b = int(S[:2]), int(S[2:])

if 0 < a <= 12 >= b > 0:
    print('AMBIGUOUS')
elif 0 < a <= 12:
    print('MMYY')
elif 0 < b <= 12:
    print('YYMM')
else:
    print('NA')



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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    int K,X; cin >> K >> X;
    int l = X-K+1, r = X+K-1;
    FOR(i,l,r+1) cout << i << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 3620
#define fn auto
#include <iostream>
#include <stdio.h>
using namespace std;

void newline() {cout << endl;}
template <typename T> void display(T input){cout << input;}
template <typename T> void put(T input){display(input); newline();}
void iput(int input) {put(input);}

fn add_time(int n, int m) -> int {
  return (
      m == 0  ? n
    : n == 23 ? add_time(0, m-1) 
    : add_time(n+1, m-1)
    );
}

fn main() -> int {
  int n, m;
  cin >> n >> m;
  iput(add_time(n, m));
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int a[303030];
void jud(int l,int r)
{
	int now1=0,now2=0;
	for(int i=l;i<=r;i+=2)
	{
		if(i<a[i])
		{
			if(a[i]>now1)
				now1=a[i];
			else
			{
				printf("No");
				exit(0);
			}	
		}
		else
		{
			if(a[i]>now2)
				now2=a[i];
			else
			{
				printf("No");
				exit(0);
			}
		}
		if(a[i]<l||a[i]>r)
		{
			printf("No");
			exit(0);
		}
	}
}
int main()
{
	int n,l=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	a[n+1]=n+1;
	a[n+2]=n+2;
	n+=2;
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=i)
		{
			if(l==0)
				l=i;
			else if((i-l)&1)
			{
				jud(l,i-1);
				l=i;
			}
		}
		else
		{
			if(l&&((i-l)&1)==0)
			{
				jud(l,i-2);
				l=0;
			}
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int a, b;
    cin >> a >> b;
    if(a + b == 15) {
        output("+");
        
    }
    else if(a * b == 15) {
        output("*");
    }
    else {
        output("x");
    }
    
    return 0;
}


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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n, t; cin >> n >> t;
  vector<int> d(n);
  for(int i=0;i<n;++i) {
    cin >> d[i];
  }

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

  vector<ll> dp(n+1);
  dp[0] = 1;

  for(int i=1;i<n;++i) {
    int tmp = distance(d.begin(), lower_bound(d.begin(), d.end(), d[i] - t));
    dp[i] = dp[i-1] * (i-tmp+1);
    dp[i] %= MOD;
  }

  cout << dp[n-1] << endl;

}



Measured memory_bytes: 3928
#include<bits/stdc++.h>
using namespace std;
int n,m,ans;
int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++)
		for (int j=10;j<=m;j++)
			if (j%10>=2&&j/10>=2&&(j%10)*(j/10)==i) ans++;
	cout<<ans<<endl;
	return 0;
}

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

void harshadC(char *p)
{
  int sum=0,i;
  char c;
  for(i=0; *(p+i) != '\0'; i++)
  {
    c = *(p+i);
    sum = atoi(&c) + sum;
  }

  if( (atoi(p) % sum) == 0 && atoi(p) >= sum)
  {
    printf("Yes\n");
  }else
  {
    printf("No\n");
  }
}

int main(void)
{
  int n;
  char line[10];

  fgets(line, 9, stdin);
  harshadC(line);

}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{ 
  int n;
  int fib[44];
  
  scanf("%d", &n);
  
  fib[0] = fib[1] = 1;
  
  for (int i = 2; i <= n; i++)
    fib[i] = fib[i-1] + fib[i-2];
  
  printf("%d\n", fib[n]);
  
  return 0;
}


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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
#define INF (1ll<<60)

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    string t;
    int left = 0, right = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '(') {
            left++;
            t.pb('(');
        } else {
            if (left > 0) {
                left--;
            } else {
                right++;
            }
            t.pb(')');
        }
    }
    while (right > 0) {
        t.insert(t.begin(), '(');
        right--;
    }
    while (left > 0) {
        t.pb(')');
        left--;
    }
    cout << t << endl;

}

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

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int A, B, C, D; cin >> A >> B >> C >> D;
    if (A+B == C+D)
    {
        cout << "Balanced" << endl;
    }
  
    else if ( A+B > C+D)
    {
        cout << "Left" << endl;
    }
    else cout <<"Right" << endl;
    return 0;
}



Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

public class Main {
	static boolean debug = true;

	public static void main(String[] args) throws IOException {

		UserScanner scan = new UserScanner();
		PrintWriter pwriter = new PrintWriter(System.out);

		int h = scan.nextInt();
		int w = scan.nextInt();

		Square sq = new Square(h, w, debug);

		for (int i = 0; i < h; i++)
			for (int j = 0; j < w; j++)
				sq.addTile(i, j, scan.nextInt());

		pwriter.println(sq.getMaxSquare());

		pwriter.flush();
		scan.close();
		System.exit(0);
	}
}

class Square {
	boolean debug;
	int[][] tile;
	int maxEdge;

	public Square(int h, int w, boolean debug) {
		this.debug = debug;
		tile = new int[h][w];
	}

	public int getMaxSquare() {
		// check right-down of square
		// if tile is countable and upper,left and left-upper have n X n square,
		// n+1 X n+1 square is possible

		for (int h = 1; h < tile.length; h++)
			for (int w = 1; w < tile[0].length; w++)
				if (tile[h][w] > 0) {
					tile[h][w] = 1 + Math.min(tile[h - 1][w - 1], Math.min(tile[h - 1][w], tile[h][w - 1]));
					if (maxEdge < tile[h][w])
						maxEdge = tile[h][w];
				}
		
		return maxEdge * maxEdge;
	}

	public void addTile(int h, int w, int c) {
		// set countable tile as 1
		if (c == 0) {
			tile[h][w] = 1;
			maxEdge = 1;
		} else
			tile[h][w] = 0;
	}

}

class UserScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean read() throws IOException {
		ptr = 0;
		buflen = in.read(buffer);
		if (buflen <= 0)
			return false;
		else
			return true;
	}

	private byte getByte() throws IOException {
		if (ptr >= buflen)
			read();
		if (isCtlSpace(buffer[ptr])) {
			return -1;
		} else
			return buffer[ptr++];
	}

	private void skipCtlSpace() throws IOException {
		if (ptr >= buflen)
			read();
		if (isCtlSpace(buffer[ptr])) {
			ptr++;
			skipCtlSpace();
		}
	}

	private boolean isCtlSpace(byte b) {
		if (b <= ' ' || b > '~')
			return true;
		else
			return false;
	}

	public void close() throws IOException {
		in.close();
	}

	public String next() throws IOException {
		skipCtlSpace();
		StringBuilder sb = new StringBuilder();
		byte b;
		while ((b = getByte()) != -1) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() throws IOException {
		skipCtlSpace();
		int n = 0;
		boolean minus = false;
		byte b;
		while ((b = getByte()) != -1) {
			if (b == '-')
				minus = true;
			else {
				n *= 10;
				n += (b - '0');
			}
		}
		if (minus)
			return n * -1;
		else
			return n;
	}
}

Measured memory_bytes: 33952
#pragma GCC optimize("O3")
/*{{{*/
#include <bits/stdc++.h>
#ifdef LOCAL
int c_ = 0;
#define cout (c_?cerr:cout)
#define debug(...) \
{if(!c_++)cerr<<"\033[96;1m"; \
__VA_ARGS__; \
if(!--c_)cerr<<"\033[0m";}
#else
#define debug(...) {}
#endif
#define assrt(...) debug(\
if (not (__VA_ARGS__)) \
    exit((cerr << __LINE__ << ": " << #__VA_ARGS__ << '\n', 0));\
)
#define st first
#define nd second
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
using namespace std; using ll = long long;
template < typename t > using V = vector< t >;
template < typename t, size_t s > using A = array< t, s >;
void print() {cout << '\n';}
template< typename t, typename... v >
void print(const t& a, const v&... b)
{cout << a << (sizeof...(b)?" ":""); print(b...);}
template< typename t > void print_range(t a, const t& b)
{ while (a != b) cout << (*a++) << ' '; cout << '\n';}
#define dump(...) debug(print(#__VA_ARGS__,'=',__VA_ARGS__))
#define dump_range(...) debug(cerr<<#__VA_ARGS__ << ": "; print_range(__VA_ARGS__))
/*}}}*/



int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int tab[5];
    for (int i = 0; i < 5; ++i)
        cin >> tab[i];
    sort(tab, tab + 5);
    int res = 1e9;
    do
    {
        int t = 0;
        for (int i = 0; i < 5; ++i)
        {
            if (t % 10)
                t += (10 - (t % 10));
            t += tab[i];
        }
        res = min(res, t);
    } while (next_permutation(tab, tab + 5));

    cout << res << '\n';
}

Measured memory_bytes: 256
while True:
    m, f, r = map(int, input().split())
    score = m + f
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    elif score >= 80:
        print('A')
    elif score >= 65:
        print('B')
    elif score >= 50 or (score >= 30 and r >= 50):
        print('C')
    elif score >= 30:
        print('D')
    else:
        print('F')


Measured memory_bytes: 5592
main = do
  n <- readLn :: IO Int
  input <- map (map read . words) . lines <$> getContents :: IO [[Int]]
  print $ solve 1 1 input

solve :: Int -> Int -> [[Int]] -> Int
solve t a [] = t + a
solve t a ([x,y]:s)
  | x < t || y < a = let multi = max (div' t x) (div' a y)
                     in solve (x * multi) (y * multi) s
  | otherwise = solve x y s

div' :: Int -> Int -> Int
div' x y = if mod x y == 0 then div x y
                           else (div x y) + 1


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  VI h(n);
  rep(i, n) cin >> h[i];
  sort(all(h));
  int mx = 0;
  int mn = INF;
  int ans = INF;
  rep(i, n - k + 1) {
    ans = min(ans, h[i + k - 1] - h[i]);
  }
  out(ans);
  return 0;
}


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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

template<class T> inline bool chmin(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

int main(){
    string s,ans;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        ans += 'x';
    }
    cout << ans << endl;
}


Measured memory_bytes: 256