akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int mod = 1'000'000'007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint dp[100000][2];
vector<int> ne[100000];
int dfs(int pa, int id) {
  rep(i, ne[id].size()) {
    if (ne[id][i] != pa) dfs(id, ne[id][i]);
  }
  dp[id][0] = 1; dp[id][1] = 1;
  rep(i, ne[id].size()) if (ne[id][i] != pa) {
    dp[id][0] *= dp[ne[id][i]][0] + dp[ne[id][i]][1];
    dp[id][1] *= dp[ne[id][i]][0];
  }
  return 0;
}

int main() {
  int n;
  cin >> n;
  rep(i, n-1) {
    int u, v; cin >> u >> v;
    ne[u-1].push_back(v-1); ne[v-1].push_back(u-1);
  }
  dfs(-1, 0);
  mint ans = dp[0][0].x + dp[0][1].x;
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 14208
H, W, K, = list(map(int, input().split()))
C = [0] * H
for i in range(H):
  C[i] = input()
  C[i] = [1 if(C[i][j] == "#") else 0 for j in range(W)]
h = 2 ** H
w = 2 ** W
ans = 0
cnt = 0
for i in range(2 ** H):
  w = 2 ** W
  for j in range(2 ** W):
    cnt = 0
    for k in range(H):
      for l in range(W):
        if(bin(h)[k + 3] == "0" and bin(w)[l + 3] == "0"):
          cnt += C[k][l]
    ans += (cnt == K)
    w += 1
  h += 1
print(ans)


Measured memory_bytes: 74180
N = int(input())
CSF = [list(map(int,input().split())) for _ in range(N-1)]
for i in range(N-1):
    for j in range(i, N-1):
        if j == i:
            ans = CSF[j][1]+CSF[j][0]
        else:
            if ans < CSF[j][1]:
                ans = CSF[j][1] + CSF[j][0]
            else:
                if ans % CSF[j][2] == 0:
                    ans = (ans // CSF[j][2]) * CSF[j][2]
                else:
                    ans = (ans // CSF[j][2] + 1) * CSF[j][2]
                ans += CSF[j][0]
    print(ans)
print(0)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
int main() {
  ll a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  if (a + v * t >= b + w * t && a <= b) {
    cout << "YES" << endl;
  } else if (a - v * t <= b - w * t && b <= a) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 3636
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int M = in.i();

        ArrayList<Integer>[] edges = new ArrayList[N];
        Arrays.setAll(edges, i -> new ArrayList<>());

        for (int i = 0; i < M; i++) {
            int x = in.i() - 1;
            int y = in.i() - 1;
            edges[x].add(y);
        }

        int[] dp = new int[N];
        Arrays.fill(dp, -1);

        for (int i = 0; i < N; i++) {
            f(i, dp, edges);
        }

        int max = 0;
        for (int i = 0; i < N; i++) {
            if (max < dp[i]) {
                max = dp[i];
            }
        }

        out.println(max);
    }

    static void f(int i, int[] dp, ArrayList<Integer>[] edges) {
        if (dp[i] > -1) return;
        dp[i] = 0;
        for (int j : edges[i]) {
            f(j, dp, edges);
            dp[i] = Math.max(dp[i], dp[j] + 1);
        }
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 52828
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <numeric>
#include <limits>

const int INF = 1 << 30;
const int V = 10;
struct edge { int to, cost; };
std::vector<edge>v[100];
typedef std::pair<int, int>p;

int main() {
	int q, l[100000], r[100000];
	std::cin >> q;
	for (int i = 0;i < q;i++) {
		std::cin >> l[i] >> r[i];
	}
	int a[100010] = {};
	a[1] = 0;
	a[3] = 1;
	for (int i = 5;i < 100001;i += 2) {
		int sum = a[i - 2];
		int k = i, flag = 0;
		for (int j = 2;j <= sqrt(i) + 1;j++) {
			while (true) {
				if (i%j == 0) {
					flag = 1;
					break;
				}
				else if(i%j!=0) {
					break;
				}
			}
		}
		if (flag == 0) {
			for (int j = 2;j <= sqrt((i + 1) / 2) + 1;j++) {
				while (true) {
					if ((i+1)/2%j == 0) {
						flag = 1;
						break;
					}
					else if((i+1)/2%j!=0) {
						break;
					}
				}
			}
		}
		if (flag == 0)
			a[i] = sum + 1;
		else
			a[i] = sum;
	}
	for (int i = 0;i < q;i++) {
		if (l[i] != 1)
			std::cout << a[r[i]] - a[l[i] - 2] << std::endl;
		else
			std::cout << a[r[i]] << std::endl;
	}
	return 0;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) 
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(const T x,const T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),b.begin(),b.end());}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD=1e9+7;
const int MAX=1e5+100;

int main() {
  int n,m;cin>>n>>m;
  set<int> as,bs;
  REP(i,n) {
    int a;cin>>a;
    as.insert(a);
  }
  REP(i,m) {
    int b;cin>>b;
    bs.insert(b);
  }
  set<int> cs,ds;
  getand(as,bs,cs);
  getor(as,bs,ds);
  // DUMP(cs);
  // DUMP(ds);
  cout << siz(cs)<<' '<<siz(ds)<<endl;
  for (int c:cs) OUT(c);
  for (int d:ds) OUT(d);
  // DUMP(getor(as,bs,cs));

  return 0;
}



Measured memory_bytes: 25940
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {

    int n,i;

    cin >> n;

    int a[n];

    for(i=0;i<n;i++){
        cin >> a[n];
        if(a[n] % 2 == 0){
            if(a[n] % 3 != 0 && a[n] % 5 != 0){
                printf("DENIED\n");
                return 0;
            }
        }
    }
    printf("APPROVED\n");
}

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

int main()
{
    string s, t, r;

    cin >> s >> t >> r;

    if(s[s.size() - 1] == t[0] && t[t.size() - 1] == r[0]) cout << "YES" << endl;
    else cout << "NO" << endl;

    return (0);
}


Measured memory_bytes: 256
/*input
2 5
*/

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

int main() {
  int a, b;
  cin >> a >> b;
  cout << a*b << endl;
}

Measured memory_bytes: 3580
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
int dyy[]={0,-1,0,1};
int dxx[]={-1,0,1,0};


int solve(ll h,ll w){
     ll ans=w;
    if(h%3==0)return 0;
    rep(i,1,h){
        ll x,y,z;
        x=w*i;
        ll s=h-i;
        ll t=w/2;
        y=s*t;
        if(w%2==0)z=y;
        else z=(h-i)*(w/2+1);
        ll ans1=max({x,y,z})-min({x,y,z});
        ans=min(ans,ans1);
    }
    return ans;
}

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

Measured memory_bytes: 256
n = gets.chomp.to_i
ary = []
3.times do
    ary << gets.chomp
end

count = 0
n.times do |i|
    tmp = []
    3.times do |j|
        tmp << ary[j][i]
    end
    tmp.uniq!
    count += tmp.length - 1
end
puts count

Measured memory_bytes: 3836
import numpy as np

N = int(input())
A = list(map(int, input().split()))
A = np.int32(A)

vals, cnts = np.unique(A, return_counts=True)

if len(vals) == 1:
    print(0 if cnts[0] > 1 else 1)
elif vals[0] == 1:
    print(0 if cnts[0] > 1 else 1)
else:
    sat = np.ones(vals.max() + 1, dtype=bool)
    for x in vals:
        sat[2 * x::x] = False
    ans = (sat[vals] & (cnts == 1)).sum().item()
    print(ans)

# 1
# 1
# 5
# 2 2 2 3 3
# 5
# 2 2 2 4 4
# 5
# 1 1 1 1 2

Measured memory_bytes: 51592
#include<iostream>
#include<cstdio>
using namespace std;
int length(int);
int main()
{
	int x[200][2],i=0;
	while(scanf("%d %d",&x[i][0],&x[i][1])!=EOF)
	{
		if(i<200)
		{
			i++;
	    }
	}
	for(int j=0;j<i;j++)
	{
		cout<<length(x[j][0]+x[j][1])<<endl;
	}
	return 0;
 } 
int length(int x)
{
	int t;
	for( t=0;x>0;t++)
	{
		x=x/10;
	}
	return t;
}


Measured memory_bytes: 3232
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
using namespace std;
typedef long long LL;

LL cnt[20005] = {0},P,now = 0,ans = 0,n;
string s;

LL kpw(LL x,LL y){
	LL ans = 1,tmp = x % P;
	while(y){
		if(y & 1) ans = (ans * tmp) % P;
		tmp = (tmp * tmp) % P;
		y >>= 1;
	}
	return ans;
}

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> P;
	cin >> s; s = ' ' + s;
	
	if(P == 2){
		for(LL i = 1;i <= n;i ++){
			if((s[i] - '0') % 2 == 0) ans += i;
		}
		cout << ans << endl;
		return 0;
	}
	
	if(P == 5){
		for(LL i = 1;i <= n;i ++){
			if((s[i] - '0') % 5 == 0) ans += i;
		}
		cout << ans << endl;
		return 0;
	}
	
	cnt[0] ++;
	for(LL i = n;i >= 1;i --){
		now = (now + ((LL)(s[i] - '0')) * kpw(10,(n - i))) % P;
		ans += cnt[now]; cnt[now] ++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 788
// ALDS1_7_B: Binary Tree

use std::cmp::max;
use std::str::FromStr;

fn scan<T: FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn scan_vec<T: FromStr>() -> Vec<T> {
    let s: String = scan();
    s.split_whitespace().map(|a| T::from_str(a).ok().unwrap()).collect()
}

struct Node { parent: Option<usize>, left: Option<usize>, right: Option<usize> }

impl Node {
    fn new() -> Node {
        Node { parent: None, left: None, right: None }
    }
}

fn set_depth(t: &Vec<Node>, u: usize, d: &mut Vec<usize>, v: usize){
    d[u] = v;
    if let Some(l) = t[u].left {
        set_depth(t, l, d, v + 1);
    }
    if let Some(r) = t[u].right {
        set_depth(t, r, d, v + 1);
    }
}

fn set_height(t: &Vec<Node>, u: usize, h: &mut Vec<usize>) -> usize {
    let mut h1: usize = 0;
    let mut h2: usize = 0;
    if let Some(l) = t[u].left {
        h1 = set_height(t, l, h) + 1;
    }
    if let Some(r) = t[u].right {
        h2 = set_height(t, r, h) + 1;
    }
    let v = max(h1, h2);
    h[u] = v;
    v
}

fn get_sibling(t: &Vec<Node>, u: usize) -> Option<usize> {
    if let Some(p) = t[u].parent {
        if let Some(l) = t[p].left {
            if l != u {
                return Some(l);
            }
        }
        if let Some(r) = t[p].right {
            if r != u {
                return Some(r);
            }
        }
    } 
    None
}

fn print(t: &Vec<Node>, u: usize, d: &Vec<usize>, h: &Vec<usize>) {
    print!("node {}: ", u);
    match t[u].parent {
        Some(p) => print!("parent = {}, ", p),
        None => print!("parent = -1, "),
    }
    match get_sibling(t, u) {
        Some(p) => print!("sibling = {}, ", p),
        None => print!("sibling = -1, "),
    }
    let mut deg: usize = 0;
    if let Some(_) = t[u].left {
        deg += 1;
    }
    if let Some(_) = t[u].right {
        deg += 1;
    }
    print!("degree = {}, ", deg);
    print!("depth = {}, ", d[u]);
    print!("height = {}, ", h[u]);
    if t[u].parent == None {
        println!("root");
    } else if t[u].left == None && t[u].right == None {
        println!("leaf");
    } else {
        println!("internal node");
    }
}

fn main() {
    let n: usize = scan();
    let mut t: Vec<Node> = Vec::new();

    for _ in 0..n {
        t.push(Node::new());
    }

    for _ in 0..n {
        let a: Vec<i64> = scan_vec();
        let v = Some(a[0] as usize);
        let l = if a[1] < 0 { None } else { Some(a[1] as usize) };
        let r = if a[2] < 0 { None } else { Some(a[2] as usize) };
        if let Some(v) = v {
            t[v].left = l;
            t[v].right = r;
        }
        if let Some(l) = l {
            t[l].parent = v
        }
        if let Some(r) = r {
            t[r].parent = v
        }
    }

    let mut root = 0;
    for i in 0..n {
        if t[i].parent == None {
            root = i;
            break;
        }
    }

    let mut d = vec![0; n];
    let mut h = vec![0; n];
    set_depth(&t, root, &mut d, 0);
    set_height(&t, root, &mut h);

    for i in 0..n {
        print(&t, i, &d, &h);
    }
}


Measured memory_bytes: 5028
# 最初の回答が半分くらいWA になってしまったので、解説見てシンプルに書き直した
N, x = map(int, input().split())
A = [int(x) for x in input().split()]

D = [0]*N
answer = 0
for i in range(N-1):
    if A[i] + A[i+1] > x:
        d = A[i] + A[i+1] - x
        e = min(A[i+1], d)
        answer += e
        A[i+1] -= e
        d -= e
        if d > 0:
            A[i] -= d
            answer += d
print(answer) 


Measured memory_bytes: 14548
def gcd(a, b):
    if a>b:
        c = a%b
    else:
        c = b%a
    if c==0:
        return b
    else:
        return gcd(b,c)

[n,m]=[int(i) for i in input().split()]
s=input()
t=input()
g=gcd(n,m)

lcm=int(n*m/g)

s1=int(lcm/n)
s2=int(lcm/m)

#print(s1, s2, int(n/s2))

f=1
for i in range(int(n/s2)):
    #print(s2*i, s[s2*i], s1*i, t[s1*i])
    if s[s2*i] != t[s1*i]:
        f=0

if f:
    print(lcm)
else:
    print("-1")


Measured memory_bytes: 3316
def main():
    # 全探索する解法
    limit, divisor = map(int, input().split(" "))
    reminders = [0] * divisor
    answer = 0
    for i in range(1, limit + 1):
        reminders[i % divisor] += 1
    # 余りにより分類 -> 余り別に総計
    for i in range(0, divisor):
        others_reminder = (divisor - i) % divisor
        if not (2 * others_reminder) % divisor:
            answer += reminders[i % divisor] * (reminders[others_reminder]) ** 2
    print(answer)


if __name__ == '__main__':
    main()

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

int n;
string s;

int main() {
	cin >> s;
	n = s.size();
	if (s[0]=='0' || s[n-1]=='1') return cout << -1 << endl, 0;
	for(int i=1; i<n-1; i++) if (s[i-1]!=s[n-i-1]) return cout << -1 << endl, 0;
	int p = n;
	for (int i=n-1; i>=1; i--) {
		cout << i << ' ' << p << endl;
		if (s[i-1]=='1') p = i;
	}
}

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

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    char tmp = s[s.size() - 1];

    if (tmp == '3') cout << "bon" << endl;
    else if (tmp == '0' or tmp == '1' or tmp == '6' or tmp == '8') cout << "pon" << endl;
    else cout << "hon" << endl;
    return 0;
}



Measured memory_bytes: 3648
module Main where

import Data.List

main :: IO ()
main = do
  _ <- getLine
  as <- sort . map read . words <$> getLine :: IO [Integer]
  case head as of
    0 -> print 0
    _ -> proAndPrint (reverse as) 1

limit :: Integer
limit = 10^18

proAndPrint :: [Integer] -> Integer -> IO ()
proAndPrint [] n = print n
proAndPrint (x:xs) n = if n * x > limit
                       then print (-1)
                       else proAndPrint xs (n * x)


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

using namespace std;

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

    long long tab[8];
    for( long long i=0; i<7; i++ ) {
        cin >> tab[i];
    }long long wy=tab[1];
    if( tab[3] && tab[4] && (tab[3]%2 || tab[4]%2) && tab[0]%2 ) {
        tab[3]--;
        tab[4]--;
        tab[0]--;
        wy+=3;
    }

    long long x = tab[3]/2;
    wy += x*2;
    tab[3] -= x*2;
    x = tab[4]/2;
    wy += x*2;
    tab[4] -= x*2;
    if( tab[3] && tab[4] && tab[0] ) {
        wy += 3;
        tab[0]--;
    }
    x = tab[0]/2;
    wy += x*2;
    cout << wy;

    return 0;
}


Measured memory_bytes: 256
inputA =  list(map(int,input().split()))
inputB =  list(map(int,input().split()))

humancount = inputA[0]
talllimit = inputA[1]
anser = 0

for count in range(0,humancount):
    if inputB[count] >= talllimit:
        anser += 1


print(anser)

Measured memory_bytes: 11912
a,b,k = map(int,input().split())

if b-a <= k:
    L = list(range(a,b+1))
else:
    i = list(range(a,a+k))
    j = list(range(b-k+1,b+1))

    L = list(set(i+j))
    L = sorted(L)
    
for i in L:
    print(i) 


Measured memory_bytes: 38512
import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.math.BigDecimal;

public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);

        //String N=sc.next();

        int N=sc.nextInt();
        int K=sc.nextInt();

        int[] p=new int[N];

        int i=0;

        for(i=0;i<N;i++){
            p[i]=sc.nextInt();
            //System.out.println(p[i]+" ");
        }

        Arrays.sort(p);

        int sum=0;

        for(i=0;i<K;i++){
            sum=sum+p[i];
            //System.out.println(p[i]);
        }

        System.out.print(sum);
        //END
    }
}






Measured memory_bytes: 38812
#include <stdio.h>
     
 int main(void) {
   int a, b, c;
   
    scanf("%d%d%d", &a, &b, &c);
    
     if (a == b+c || b == c+a || c == a+b) { 
      printf("Yes\n");
     }
     else {
      printf("No\n");
     }
    	return 0;
 }

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

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

  int n, m;
  cin >> n >> m;
  vector<vector<int>> graph(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  vector<pair<int, int>> stack;
  stack.push_back(pair<int, int>(0, 0));
  int paths = 0;
  while (!stack.empty()) {
    auto tmp = stack.back(); stack.pop_back();
    int i = tmp.first;
    int visited = tmp.second;
    visited |= 1 << i;
    if (visited == (1 << n) - 1) {
      paths++;
      continue;
    }
    for (int &j : graph[i]) {
      if (visited >> j & 1) continue;
      stack.push_back(pair<int, int>(j, visited));
    }
  }
  cout << paths << '\n';
  return 0;
}

Measured memory_bytes: 256
/* << IN THE NAME OF GOD >> */
#include <bits/stdc++.h>
using namespace std;



#define err(x) cerr << #x  << " = "<<  x << '\n'
#define out(x) cout << x << '\n'
#define forp(i, r, l) for(int i = int(r); i < int(l); i++)
#define forn(i, r, l) for(int i = int(r); i > int(l); i--)
#define FAST ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll ,ll> pll;
const int maxn = 2e5 + 120;

int dip[maxn] ,n ,res;
void pre(){
    int cnt = 1;
     for(int i = 105 ,ii ,tmp; i < 400; i++){
           cnt = 1 ,tmp = 0;
           ii = i;
           forp(j ,2 ,i){
                    while(ii % j == 0)
                   tmp++,ii/=j;
            if(tmp)
                 cnt *= ++tmp ,tmp = 0;
           }
           if(ii >1)
               cnt<<=1;
          dip[i] = cnt;
    }


}
int main(){FAST;   
    pre();
    cin >> n;
    forp(i ,105 ,n + 1)
        if(dip[i] > 7 && (i & 1))
            res++;
    out(res);
    
return 0;
}
 










Measured memory_bytes: 256
import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
	Scanner s=new Scanner(System.in);
	int n=s.nextInt();
	int w=s.nextInt();
	Pair p[]=new Pair[n];
	long dp[][]=new long[n][w+1];
	for(int i=0;i<n;i++)
	p[i]=new Pair(s.nextInt(),s.nextLong());
	Compare obj=new Compare();
	obj.compare(p,n);
	for(int i=0;i<w+1;i++)
	{
	if(i<p[0].x)
	dp[0][i]=0;
	else
	dp[0][i]=p[0].y;
	}
	for(int i=1;i<n;i++)
	{
	for(int j=0;j<w+1;j++)
	{
	if(j<p[i].x)
	dp[i][j]=dp[i-1][j];
	else
	dp[i][j]=Math.max(p[i].y+dp[i-1][j-p[i].x],dp[i-1][j]);
	}	
	}
	/*for(int i=0;i<n;i++)
	System.out.println(p[i].x+" "+p[i].y+" ");
	for(int i=1;i<n;i++)
	{
	for(int j=0;j<w+1;j++)
	System.out.print(dp[i][j]+" ");
	System.out.println();
	}*/
	System.out.println(dp[n-1][w]);
}
}
class Pair
{
	int x;
	long y;
	public Pair(int a,long b)
	{
	x=a;
	y=b;
	}
}
class Compare
{
	static void compare(Pair arr[],int n)
	{
	Arrays.sort(arr,new Comparator<Pair>(){
	public int compare(Pair p1,Pair p2)
	{
	return p1.x-p2.x;
	}
	});
	}
}  

Measured memory_bytes: 126804
import sys
sys.setrecursionlimit(10**9)

N = int(input())
G = [[] for _ in range(N)]

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

Q, K = map(int, input().split())
query = [list(map(int, input().split())) for _ in range(Q)]

def dfs(v, pv=-1, d=0):
  dist[v] = d
  for nv, nd in G[v]:
    if nv == pv:
      continue
    dfs(nv, v, d+nd)

dist = [0]*N
dfs(K-1)

for x, y in query:
  x, y = x-1, y-1
  print(dist[x] + dist[y])

Measured memory_bytes: 180996
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> S[M];
  REP(i, M) {
    int k;
    cin >> k;
    REP(j, k) {
      int s;
      cin >> s;
      s--;
      S[i].PB(s);
    }
  }
  int p[M];
  REP(i, M) cin >> p[i];
  int ans = 0;
  REP(i, (1 << N)) {
    bool ok = true;
    REP(j, M) {
      int count = 0;
      for (auto id : S[j]) {
        if (i & (1 << id)) {
          count++;
        }
      }
      count %= 2;
      if (count != p[j]) {
        ok = false;
        break;
      }
    }
    if (ok) ans++;
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	long long n,m;
	scanf("%lld%lld",&n,&m);
	if(n==1&&m==1)n=1;
	else if(n==1||m==1)n=(n>m?n-2:m-2);
	else n=(n-2)*(m-2);
	printf("%lld",n);
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){
  
  int n,d,res = 0;
  cin >> n >> d;
  d *= 2;
  d++;
  int k = 0;
  for(int i = 1;k < n;i++){
    k = i*d;
    res++;
  }
  cout << res << endl;


  return 0;
}


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

using namespace std;

using ll = int64_t;
#define int ll

signed main()
{
  int A, B, C;
  cin >> A >> B >> C;

  if(A == B){
    cout << C << endl;
  }else if(A == C){
    cout << B << endl;
  }else if(B == C){
    cout << A << endl;
  }
  
  return 0;
}


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

// Morris-Pratt
template<typename T>
struct MP {
  int n;
  T t;
  vector<int> a;
  MP() {}
  MP(const T& t): t(t) {
    n = t.size();
    a = vector<int>(n + 1);
    a[0] = -1;
    int j = -1;
    for (int i = 0; i < n; ++i) {
      while (j != -1 && t[j] != t[i]) j = a[j];
      j++;
      a[i + 1] = j;
    }
  }
  int operator[](int i) { return a[i];}
  vector<int> findAll(const T& s) {
    vector<int> res;
    int j = 0;
    for (int i = 0; i < s.size(); ++i) {
      while(j != -1 && t[j] != s[i]) j = a[j];
      j++;
      if (j == n) {
        res.push_back(i - j + 1);
        j = a[j];
      }
    }
    return res;
  }
};

vector<int> f(vector<int>& a) {
  int n = a.size();
  vector<int> res(n);
  rep(i, n) res[i] = a[i] ^ a[(i + 1) % n];
  return res;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  vector<int> xa = f(a);
  vector<int> xb = f(b);
  MP<vector<int> > mp(xa);
  xb.insert(xb.end(), xb.begin(), xb.end());
  vector<int> res = mp.findAll(xb);
  vector<int> ks;
  for (int p : res) ks.push_back(n - p);
  sort(ks.begin(), ks.end());
  for (int k : ks) {
    if (k >= n) continue;
    int x = a[k]^b[0];
    printf("%d %d\n", k, x);
  }
  return 0;
}


Measured memory_bytes: 11504
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int n;
	cin >> n;
	vi a(n);
	for(int i=0; i <n; i++) cin >> a[i];
	map<int,int> m;
	lli ans = 0ll;
	for(int i=0; i < n; i++){
		int dif = i - a[i];
		if(m.find(dif) != m.end()){
			ans+=m[dif];
		}
		m[i+a[i]]++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 13508
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
// const ll MOD = 1000000007;
// const int INF = 2000000000;
const int MAX_SIZE = 2 * 100000;

int N, C;
unordered_map<int, vector<bool>> mp;
vector<int> num_chans(MAX_SIZE, 0);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> C;
  for (int i = 0; i < N; i++) {
    int s, t, c;
    cin >> s >> t >> c;
    if (mp[c].empty()) {
      mp[c].resize(MAX_SIZE, 0);
    }
    for (int j = 2 * s - 1; j <= 2 * t - 1; j++) {
      mp[c][j] = true;
    }
  }

  for (auto &e : mp) {
    for (int i = 0; i < MAX_SIZE; i++) {
      if (e.second[i]) {
        num_chans[i]++;
      }
    }
  }

  sort(num_chans.begin(), num_chans.end(), greater<int>());
  int ans = num_chans[0];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
x,y,z,k = map(int, input().split())
a= list(map(int, input().split()))
b= list(map(int, input().split()))
c= list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ansListab=[]
for i in range(x):
  for j in range(y):
    ansListab.append(a[i]+b[j])

ansListab.sort(reverse= True)

if len(ansListab)>k:
  ansListab=ansListab[0:k]

ansList=[]

for i in c:
  for j in ansListab:
    ansList.append(i+j)

ansList.sort(reverse= True)

for i in range(k):
  print(ansList[i])


Measured memory_bytes: 161112
#include <cstdio>
#include <queue>
#include <string>
using namespace std;

int main()
{
  long long n, k;
  char s[100001];
  queue<int> q;
  long long count = 0;
  long long ans = 0;
  scanf("%lld %lld", &n, &k);
  scanf("%s", s);
  for (long long i = 0; i < strlen(s); i++) {
    q.push(s[i]);
    if (s[i] == '0' && s[i + 1] == '1') 
      count++;
    if (q.size() > ans)
      ans = q.size();
    if (count == k && s[i] == '1' && s[i + 1] == '0')
      while (1) {
	if (q.front() == '0') {
	  while(1) {
	    q.pop();
	    if (q.front() == '1')
	      break;
	  }
	  count--;
	  break;
	}
	q.pop();
      }
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    string s;

    cin >> s;

    V v;

    for (int i = 1; i < s.size() - 2; i++)
    {
        if (s[i] == '1')
            v.push_back(i + 1);
    }

    if (s[0] == '0' || s[s.size() - 1] == '1' || (s.size() > 2 && s[s.size() - 2] == '0'))
    {
        cout << -1 << endl;
        return 0;
    }

    /*
    if (!v.size())
    {
        for (int i = 1; i < s.size(); i++)
            cout << i << " " << i + 1 << endl;

        return 0;
    }
    */

    v.insert(v.begin(), 0);
    v.push_back(s.size());

    V x;
    for (int i = 1; i < v.size(); i++)
        x.push_back(v[i] - v[i - 1]);

    bool check = true;

    for (int i = 0; i < x.size(); i++)
        if (x[i] != x[x.size() - i - 1])
            check = false;

    if (check)
    {
        int j = x.size() + 1;

        for (int i = 0; i < x.size(); i++)
            for (int k = 0; k < x[i] - 1; k++)
            {
                cout << i + 1 << " " << j << endl;
                j++;
            }

        for (int i = 1; i < x.size(); i++)
            cout << i << " " << i + 1 << endl;
    }
    else
    {
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 2376
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  bool found = false;
  for (int i = 0; i < s.size(); i += 2) {
    if (s[i] == 'L') found = true;
  }
  for (int i = 1; i < s.size(); i += 2) {
    if (s[i] == 'R') found = true;
  }
  cout << (found ? "No" : "Yes") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	string s;
	cin>>s;
	string out="";
	rep(i,s.size())if(s[i]=='0')out+="0";
	else if(s[i]=='1')out+="1";
	else{
		out=out.substr(0,out.size()-1);
	}
	cout<<out<<endl;
}







Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt(), w = sc.nextInt();
        boolean[][] b = new boolean[h + 2][w + 2];

        for (int y = 1; y <= h; y++) {
            String s = sc.next();
            for (int x = 1; x <= w; x++) {
                b[y][x] = s.charAt(x - 1) == '#';
            }
        }
        int x = 1, y = 1;
        boolean ok = true;
        while (true) {
            if (b[y - 1][x] || b[y][x - 1]) {
                System.out.println("Impossible");
                break;
            }

            if (x == w && y == h) {
                System.out.println("Possible");
                break;
            }

            if (b[y][x + 1] == b[y + 1][x]) {
                System.out.println("Impossible");
                break;
            }
            b[y][x] = false;
            int nx = b[y][x + 1] ? x + 1 : x, ny = b[y + 1][x] ? y + 1 : y;
            x = nx;
            y = ny;
        }
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int mod =1e9+7;
const int N = (int)2e5 + 5;

int used[101];
void solve(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	for(int i=a;i<=b;i++){
		used[i]++;
	}
	int cnt=0;
	for(int i=c;i<=d;i++){
		used[i]++;
		if(used[i]==2)cnt++;
	}		
	cout<<max(cnt-1,0);	

}

int main(){
	Red;
	int t=1;
	// cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main() {
	ll n, m, d;
	cin >> n >> m >> d;
	double ans = 0;
	if (d == 0) {
		ans = 1;
		ans /= n;
	}
	else {
		ans = 2;
		ans *= (n - d);
		ans /= (n * n);
	}

	ans *= (m - 1);
	printf("%.12f\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int l;
	int m[12];
	int n[12];
	int kane[12];
	int sum;
	int accmonth;
	int i;
	
	scanf("%d", &l);
	
	while (l != 0) {
		sum = 0;
		accmonth = 0;
		for (i = 0; i < 12; i++){
			m[i] = 0;
			n[i] = 0;
			scanf("%d%d", &m[i], &n[i]);
			kane[i] = m[i] - n[i];
			sum += kane[i];
			
			if (sum >= l){
				if(accmonth == 0){
					accmonth = i + 1;
				}
			}
		}
		
		if (accmonth != 0){
			printf("%d\n", accmonth);
		}
		else {
			printf("NA\n");
		}
		
		scanf("%d", &l);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

#define endl '\n'
#define ll long long

using namespace std;

vector<int> g[100001];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n, m, a, b;
	cin >> n >> m;
	vector<int> h(n + 1);

	for (int i = 1; i <= n; i++)
		cin >> h[i];

	for (int i = 0; i < m; i++)
	{
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	int ans = 0;
	for (int from = 1; from <= n; from++)
	{
		bool isGood = true;
		for (int j = 0; j < g[from].size(); j++)
		{
			int to = g[from][j];
			if( h[from] <= h[to]) isGood = false;
		}
		if (isGood) ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8748
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var abc =Console.ReadLine().Split().Select(int.Parse).ToArray();

            Console.WriteLine(abc[1]/abc[0] > abc[2] ? abc[2] : abc[1]/abc[0]);
        }
    }
}


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

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A, B = get_ints

plus = A + B
minus = A - B
multi = A * B

puts [plus, minus, multi].max


Measured memory_bytes: 14520
N, K = gets.split.map(&:to_i)
As = gets.split.map(&:to_i)

#pre = (As.index(1).to_f / (K-1).to_f).ceil
#suf = ((N - As.index(1) - 1).to_f / (K-1).to_f).ceil
#ans = N <= K ? 1 : pre + suf
ans = N <= K ? 1 : ((N-1).to_f / (K-1).to_f).ceil
puts ans


Measured memory_bytes: 8068
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n,d;
    cin>>n>>d;
    int p[n][d];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>p[i][j];
        }
    }
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            //if(i==j)    continue;
            int sum = 0;
            for(int k=0;k<d;k++){
                sum += ((p[i][k]-p[j][k])*(p[i][k]-p[j][k]));
            }
            bool flag = false;
            for(int k=0;k<=sum;k++){
                if(k*k == sum){
                    flag = true;
                }
            }
            if(flag)    cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
inline int change_pixel(int v, string &str)
{
    int nv = v;
    const int d[7][7] =
        {
            { 8,  9,  3,  4,  5,  0,  1},
            { 9, 10,  4,  5,  6,  1,  2},
            {12, 13,  7,  8,  9,  3,  4},
            {13, 14,  8,  9, 10,  4,  5},
            {14, 15,  9, 10, 11,  5,  6},
            {16, 17, 12, 13, 14,  8,  9},
            {17, 18, 13, 14, 15,  9, 10}
        };
 
    for (int i = 0; i < 7; i++) {
        int bit = 0;
        nv &= ~(1 << d[i][3]);
        for (int j = 0; j < 7; j++) {
            bit |= (v >> d[i][j] & 1) ? (1<<j) : 0;
        }        
        nv |= (1 << d[i][3])*(str[bit] - '0');
    }
    return nv;
}
 
bool is_idempotent(string &str)
{
    for (int i = 0; i < (1<<19); i++) {
        int before = i, after;
        before = change_pixel(before, str);
        after  = change_pixel(before, str);
        if ((before >> 9 & 1) != (after >> 9 & 1)) {
            return false;
        }
    }
    return true;
}
 
int main()
{
    string str;
    while (cin >> str, str != "#") {
        cout << (is_idempotent(str) ? "yes" : "no") << endl;
    }
    return 0;
}

Measured memory_bytes: 2980
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if(i%2==0&&a[i]%2==1){
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3612
n = int(input())
s = []
i = 1
m = (n%2)
s.append(n%2)
while 1:
    if m == n:
        break
    if n%(2**(i+1)) == m or n%(2**(i+1))-2**(i+1) == m:
        s.append(0)
    else:
        s.append(1)
        m += (-2)**i
    i += 1

print(''.join(map(str, s[::-1])))


Measured memory_bytes: 3064
import sys
import math

a,b,k = map(int, input().split())
if (b - a+1 < 2*k):
    for i in range(a, b+1):
        print(i)
    sys.exit()
else:
    for i in range(a, a + k):
        print(i)
    for i in range(b - k+1, b+1):
        print(i)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(void)
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }

    vector<ll> b;
    for (int i = n - 1; i >= 0; i-=2)
    {
        b.push_back(a[i]);
    }

    FOR(i,n % 2,n){
        b.push_back(a[i]);
        i++;
    }

    REP(i,n){
        cout << b[i] << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 5488
import math

class Point:
    def __init__(self,x,y):
        self.x = x
        self.y = y

    def __add__(self,a):
        return self.__class__(self.x+a.x,self.y+a.y)

    def __sub__(self,a):
        return self.__class__(self.x-a.x,self.y-a.y)

    def __mul__(self,d):
        return self.__class__(self.x*d,self.y*d)

    def __truediv__(self,d):
        return self.__class__(self.x/d,self.y/d)

    def __str__(self):
        return '%.10f %.10f'%(self.x,self.y)

    def abs(self):
        return (self.x*self.x+self.y*self.y)**(1.0/2.0)

    def rotate(self,d):
        r = math.pi*d/180.0
        return self.__class__( self.x*math.cos(r)-self.y*math.sin(r),
                               self.x*math.sin(r)+self.y*math.cos(r))

def func(p1,p2,n):

    if n==0:return

    v = (p2-p1)
    a = p1+v/3.0
    c = p1+v*2.0/3.0
    b = a+(c-a).rotate(60.0)

    func(p1,a,n-1)
    print (a)
    func(a,b,n-1)
    print (b)
    func(b,c,n-1)
    print (c)
    func(c,p2,n-1)

def main():
    n = int(input())
    a = Point(0.0,0.0)
    b = Point(100.0,0.0)
    print (a)
    func(a,b,n)
    print (b)

if __name__ == '__main__':
    main()




Measured memory_bytes: 5760
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void){
    int a,b;
    double n;
    
    cin>>a;
    cin>>b;
    
    n=1.0*a/b;
    
    cout<<a/b<<" "<<a%b<<" ";
    printf("%.5lf\n", n);
    
    return 0;
}


Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int max = -1000000, min = 1000000;
		long counter = 0;
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int a[] = new int[n];
			for(int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				if(a[i] >= max) {
					max = a[i];
				}
				if(a[i] <= min) {
					min = a[i];
				}
				counter =  counter + a[i];
			}
			System.out.println(String.format("%d %d %d", min, max, counter));
		}
	}
}



Measured memory_bytes: 41780