akhauriyash/Code-Regression huggingface dataset:
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
use std::collections::BinaryHeap;
fn main() {
    input!{
        n: usize,
        m: usize,
        a: [i64; n],
    }
    let mut bh = BinaryHeap::from(a);
    for _ in 0..m {
        if let Some(v) = bh.pop() {
            bh.push(v / 2);
        }
    }
    println!("{}", bh.iter().fold(0, |sum, x| sum + x));
}


Measured memory_bytes: 6396
import java.util.Scanner;

public class Main
{
    // https://atcoder.jp/contests/abc081/tasks/abc081_a
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        int answer = 0;
        for (char c : input.toCharArray()) {
            answer += c == '1' ? 1 : 0;
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 23252
N, M = map(int, input().split())
fact = [1]*(N+1)
rfact = [1]*(N+1)
for i in range(1, N+1):
    fact[i] = r = (i * fact[i-1]) % M
    rfact[i] = pow(r, M-2, M)


memo = {}
def f(N, K):
    if (N, K) in memo:
        return memo[N, K]
    if K == 0:
        return N == 0
    elif K == 1 or N == K:
        return 1
    r = memo[N, K] = (f(N-1, K-1) + K*f(N-1, K)) % M
    return r

S = [1]

rev2 = pow(2, M-2, M)
base = pow(2, N, M)
ans = 0
S = [1]
for K in range(N+1):
    r = (fact[N] * rfact[K] * rfact[N-K]) % M
    r = (r * pow(2, pow(2, N - K, M-1), M)) % M
    b = 1
    v = 0
    T = [0]*(K+2)
    for L in range(K):
        T[L+1] = s = (S[L] + (L+1)*S[L+1]) % M
        v += s * b
        b = (b * base) % M
    v += b
    T[K+1] = 1
    S = T
    r = (r * v) % M
    if K % 2:
        ans -= r
    else:
        ans += r
    ans %= M

    base = (base * rev2) % M
print(ans)


Measured memory_bytes: 3564
import math


def bits(n, max_bits):
    return [int(x) for x in format(n, '0{}b'.format(max_bits))]


def my(A, B):
    max_bits = len(bin(B)[2:])
    c = [0] * max_bits
    ans = -1

    # for n in range(A, B+1):
    #     a = bits(n, max_bits)
    #     for i in range(max_bits):
    #         if a[i] == 1:
    #             c[i] += 1

    #     if ans == -1:
    #         ans = n
    #     else:
    #         ans ^= n

    # print(ans)
    # print(*c)

    # print(*bits(A, max_bits))
    # print(*bits(B, max_bits))
    # print(int(math.ceil((B - A) / 2)))
    pair = []
    for C in [A-1, B]:
        cur = 1
        bit_list = []
        for i in range(0, max_bits):
            a = C // (cur * 2)
            b = C % (cur * 2)
            # print(a, b, (a * cur), (b - cur) + 1)
            bit_list.append((a * cur) + max((b - cur) + 1, 0))
            # print(C, i, a, b, (a * cur) + max((b - cur) + 1, 0))
            cur *= 2
        # print(bit_list)
        pair.append(bit_list)

    pair[0] = pair[0][::-1]
    pair[1] = pair[1][::-1]
    for i in range(max_bits):
        c[i] = pair[1][i] - pair[0][i]

    ans = ''
    for i in range(max_bits):
        if c[i] % 2 == 0:
            ans += '0'
        else:
            ans += '1'

    print(int(ans, 2))
    # print(*c)


def f(n):
    if n % 2 == 1 and n % 4 == 3:
        return 0
    elif n % 2 == 1 and n % 4 == 1:
        return 1
    elif n % 2 == 0 and n % 4 == 0:
        return 0 ^ n
    else:
        return 1 ^ n


def main():
    A, B = map(int, input().split())

    print(f(B) ^ f(A-1))


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(i, n) a[idx][i] = v[i]; idx++; PER = a;} while(next_permutation(ALL(v)));} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  LL n, k;
  cin >> n >> k;
  LL i = 0;
  while (true)
  {
    if (pow(k, i) <= n && n < pow(k, i+1))
    {
      cout << i+1;
      return 0;
    }
    i++;
  }

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	x := iScan()
	y := 0
	for i := 1; ; i++ {
		y += i
		if y >= x {
			fmt.Println(i)
			break
		}
	}
}


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

#ifdef LOCAL 
string to_string(char a) { return string(1,a); }
string to_string(bool a) { return a ? "1" : "0"; }
string to_string(const char* a) { return (string)a; }
string to_string(string a) { return a; }
string to_string(vector<bool> v) {
	string s = "["; for(unsigned i=0;i<v.size();i++){ s += ((i>0)?" ":"");
    s += char('0'+v[i]); } 	s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p);
template<class T> string to_string(T v) {
	bool b = 1; string s = "["; for (const auto& x: v) {
		if (!b) {s += ", ";} b = 0; s += to_string(x); } s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p) {
	return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
void dbgf() { cerr << endl; }
template<class H, class... T> void dbgf(H h, T... t) {
	cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
	dbgf(t...); }
#define dbg(...) cerr << #__VA_ARGS__ << " = ", dbgf(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
#define boolout(x) cout<<(x?"YES":"NO")<<endl;
typedef long long ll;


void solve()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i] >> c[i];
    }

    vector<vector<int>> dp(2, vector<int>(3, 0));
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for (int i = 1; i < n; ++i) {
       dp[i&1][0] = a[i] + max(dp[!(i&1)][1], dp[!(i&1)][2]);
       dp[i&1][1] = b[i] + max(dp[!(i&1)][2], dp[!(i&1)][0]);
       dp[i&1][2] = c[i] + max(dp[!(i&1)][0], dp[!(i&1)][1]);
    }

    int res = max(dp[0][0], dp[0][1]);
    res = max(res, dp[0][2]);
    res = max(res, dp[1][0]);
    res = max(res, dp[1][1]);
    res = max(res, dp[1][2]);

    cout << res << endl;

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t; // read t. cin knows that t is an int, so it reads it as such.
    for (int i = 1; i <= t; ++i) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#define MAX_U   10
#define MIN_U   0
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((int)(x).size())
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef queue<int> qi;
const int INF=numeric_limits<int>::infinity();
void printa(){cout<<"\n";}
template<class T, class... A>void printa(const T&first,const A&... rest){cout<<first;printa(rest...);}
template<class... A>void printa(const A&... rest){printa(rest...);}
void prints(){cout<<" ";}
template<class T, class... A>void prints(const T&first,const A&... rest){cout<<first;prints(rest...);}
template<class... A>void prints(const A&... rest){prints(rest...);}
int factorial(int x){int f=1;for(int i=1;i<x+1;i++)f=f*i;return f;}
int sigma(int x){int s;for(int i=1;i<x+1;i++)s=s+i;return s;}
int middle(int x){if(x%2==0)return x/2;else return x/2+1;}
double heron(int a,int b,int c){double s;s=(a+b+c)/2;return sqrt(s*(s-a)*(s-b)*(s-c));}
double trapezium(int a,int b,int h){return (a+b)*h/2;}
double triangle(int a,int h){return a*h/2;}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a,b,c;
    cin >>a;
    b=a.substr(6,7);
    c=a.substr(14,5);
    a=a.erase(5);
    printa(a," ",b," ",c);
    return 0;
}

Measured memory_bytes: 256
c = 3.times.map{gets.chomp.split.map(&:to_i)}
b = []
flag = true
0.upto(c[0][0]) do |k|
  flag = true
  a = []
  a.push(k)
  c[0].each {|c| b.push(c - k)}
  a.push(c[1][0]-b[0])
  a.push(c[2][0]-b[0])
  b.each_with_index do |b,j|
    a.each_with_index do |a,i|
      flag = false unless a + b == c[i][j]
    end
  end
  break if flag == true
end
puts flag ? "Yes" : "No"


Measured memory_bytes: 1788
import queue

divide = ["dream", "dreamer", "erase", "eraser"]

S = input()

BFS = queue.Queue()

can = False

BFS.put(0)

while not BFS.empty():
    t = BFS.get()
    if (t == len(S)):
        can = True
        break
    for s in divide:
        if s == S[t: t + len(s)]:
            BFS.put(t + len(s))

if can is True:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 4080
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	n = int(input())
	b = list(map(int,input().split()))
	a = []
	a.append(b[0])
	for i in range(1,n-1):
		a.append(min(b[i],b[i-1]))
	a.append(b[-1])
	print(sum(a))

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()


Measured memory_bytes: 5460
#include <iostream>
#include <set>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;

    set<string> st;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        st.insert(s);
    }

    cout << st.size() << endl;
}


Measured memory_bytes: 19256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)




#ifdef _MSC_VER
#include <intrin.h>

#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>


#include"atcoder/all"
using namespace atcoder;
using namespace std;


#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << endl
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << " \n"[i==(int)v.size()-1]
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;



void solve() {
	int N; cin >> N;
	fenwick_tree<int>fw(N);
	int Q; cin >> Q;
	vector<int>A(N);
	REP(i, N) {
		cin >> A[i];
		fw.add(i, A[i]);
	}
	REP(_, Q) {
		int sign, a, b; cin >> sign >> a >> b;
		if (sign == 0) {
			fw.add(a, b);
		}
		else {
			print(fw.sum(a, b));
		}
	}
}



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

	//int q;
	//cin >> q;
	//while (q--)
	solve();

}


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

const int N = 2e5 + 5;
int a[N], k, n;
int main(){
	ios_base::sync_with_stdio(false);
  	cin.tie(NULL); cin >> n >> k;
  	if (k >= n){cout << 0; return 0;}
  	for (int i = 0; i < n; i++) cin >> a[i];
  	sort(a, a + n, greater <int> ());
  	long long res = 0;
  	for (int i = k; i < n; i++)
      	res += a[i];
  	cout << res; return 0;
}

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

int main()
{
  int nAlow, nAhigh, nBlow, nBhigh;
  cin >> nAlow >> nAhigh >> nBlow >> nBhigh;

  int nHigher = min(nAhigh, nBhigh);
  int nLower  = max(nAlow,  nBlow);

  cout << max(0, nHigher - nLower) << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		
		int k = A%C;
		int s = B%D;
		int large = 0;
		int x = 0;
		
		if(k == 0 && s == 0){
			if(A/C > B/D){
				large = A/C+1;
			}else{
				large = B/D;
			}
			x = L - large;
		}else if(k != 0 && s == 0){
			if(A/C+1 > B/D){
				large = A/C;
			}else{
				large = B/D;
			}
			x = L - large;
		}else if(k == 0 && s != 0){
			if(A/C > B/D+1){
				large = A/C;
			}else{
				large = B/D+1;
			}
			x = L - large;
		}else{
			if(A/C+1 > B/D+1){
				large = A/C+1;
			}else{
				large = B/D+1;
			}
			x = L - large;
		}
		System.out.println(x);
		// TODO Auto-generated method stub

	}

}

Measured memory_bytes: 17164
import itertools
n, m, r = map(int, input().split())
d = [[float('inf')]*n for _ in range(n)]
rs = list(map(int, input().split()))
for _ in range(m):
  a, b, t = map(int, input().split())
  a -= 1
  b -= 1
  d[a][b] = t
  d[b][a] = t
for i in range(n):
  d[i][i] = 0

def warshall_floyd(d):
  #d[i][j]: iからjへの最短距離
  for k in range(n):
    for i in range(n):
      for j in range(n):
        d[i][j] = min(d[i][j],d[i][k] + d[k][j])
  return d 

d = warshall_floyd(d)
ans = float('inf')
for p in itertools.permutations(rs):
  tmp = 0
  for i in range(len(p)-1):
    tmp += d[p[i]-1][p[i+1]-1]
  ans = min(ans, tmp)

print(ans)




Measured memory_bytes: 59480
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/




int main() {
int N,K;
cin>>N>>K;
int p[N];
ld ex[N];
rep(i,N){
  cin>>p[i];
  ex[i]=(ld)(p[i]*(p[i]+1)/2)/p[i];

}

ld ans=0,sum=0;
rep(i,K){
  sum+=ex[i];
  
}
ans=sum;
rep(i,N-K){
sum-=ex[i];
sum+=ex[i+K];
ans=max(ans,sum);
}
cout(10)<<ans<<endl;
return 0;
}

Measured memory_bytes: 7684
import sys

n = int(sys.stdin.readline().strip())
S = map(int, sys.stdin.readline().strip().split(" "))

n = int(sys.stdin.readline().strip())
T = map(int, sys.stdin.readline().strip().split(" "))

res = []

for t in T:
    res.append(int(S.count(t) != 0))
print sum(res)

Measured memory_bytes: 6976
#include <bits/stdc++.h>
#define LL long long
using namespace std;

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

    int n, x;
    cin>>n>>x;

    int g = 0;

    for (int i=0; i<n; i++) {
        int m;
        cin>>m;
        m-=x;
        if (m<0)    m=-m;
        g = __gcd(g, m);
    }
    cout<<g<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  cin>>n;
  VEC<LL>x(n);
  LL left,right;
  REP(i,0,n){
    cin>>x[i];
  }
  VEC<LL>y = x;
  sort(ALL(x));
  REP(i,0,n){
    if(i==n/2-1)left=x[i];
    else if(i==n/2)right=x[i];
  }
  REP(i,0,n){
    if(y[i]<=left)cout<<right<<endl;
    else cout<<left<<endl;
  }

  return 0;
}


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

int main() {
  int r, D, x;
  cin >> r >> D >> x;
  for (int i = 0; i < 10; i++) {
    x = r*x - D;
    cout << x << 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 x = sc.nextInt();
		int y = sc.nextInt();
		while(x != y)
		{
			if(x > y)
			{
				x -= y;
			}
			else
			{
				y -= x;
			}
		}
		System.out.println(x);
		sc.close();
	}
}


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main(){
	int n,a,b;
	cin>>n>>a>>b;

	if(n*a>b)
		cout<<b<<endl;
	else
		cout<<a*n<<endl;

	return 0;
}


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

#define int long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

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

  vector<pii> ans;
  if(n%2 == 0){
    repi(i, 1, n+1){
      repi(j, i+1, n+1){
        if(j != n-i+1){
          ans.pb({i, j});
        }
      }
    }
  }else{
    repi(i, 1, n){
      ans.pb({i, n});
      repi(j, i+1, n){
        if(j != n-i){
          ans.pb({i, j});
        }
      }
    }
  }

  cout << ans.size() << endl;
  rep(i, ans.size()) cout << ans[i].first << " " << ans[i].second << endl;

  return 0;
}


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

namespace _161abc
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] read = Array.ConvertAll(Console.ReadLine().Split(),double.Parse);
            double[] A = Array.ConvertAll(Console.ReadLine().Split(),double.Parse);
            double sum = A.Sum();
            double count = 0;
            for(int i=0;i<read[0];i++){
                if(A[i]>=sum*1/(4*read[1])){
                    count++;
                }
            }
            if(count>=read[1]){
                Console.WriteLine("Yes");
            }else{
                Console.WriteLine("No");
            }

        }
    }
}


Measured memory_bytes: 13268
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        HashMap<Integer,ArrayList<City>> map = new HashMap<Integer,ArrayList<City>>();
        String[] ans = new String[m];
        for(int i = 0; i < m; i++){
            int p = sc.nextInt();
            if(map.containsKey(p)){
                map.get(p).add(new City(sc.nextInt(), i));
            }else{
                ArrayList<City> tmp = new ArrayList<City>();
                tmp.add(new City(sc.nextInt(), i));
                map.put(p,tmp);
            }
        }
        for(Map.Entry<Integer,ArrayList<City>> e : map.entrySet()){
            int p = e.getKey();
            ArrayList<City> v = e.getValue();
            if(v.size() != 1){
                Collections.sort(v);
            }
            int index = 1;
            for(City c : v){
                ans[c.index] = String.format("%06d",p) + String.format("%06d",index);
                index++;
            }
        }
        for(String s : ans){
            System.out.println(s);
        }
    }
}

class City implements Comparable<City>{
    int y,index;
    public City(int y, int i){
        this.y = y;
        this.index = i;
    }
    
    public int compareTo(City c){
        if(this.y < c.y){
            return -1;
        }else if(this.y > c.y){
            return 1;
        }else{
            return 0;
        }
    }
}

Measured memory_bytes: 180980
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int n,a,b,x;
  cin>>n;
  map<int,int> m;
  ll s=0;
  rep(i,0,n) {cin>>x;m[x]++;s+=x;}
  int q;
  cin>>q;
  rep(i,0,q){
    cin>>a>>b;
    if(m.find(a)!=m.end()){
      int y=m[a];
      m.erase(a);
      m[b]+=y;
      s=s+(b-a)*y;
    }
    cout<<s<<endl;
  }
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 6620
from collections import defaultdict
N = int(input())
mm = defaultdict(int)

for i in range(N):
    key = input()
    mm[key] += 1

max_val= max(mm.values())
mm_max = []
for kv in mm.items():
    if kv[1] == max_val:
        mm_max.append(kv)

mm_max.sort()
for v in mm_max:
    print(v[0])


Measured memory_bytes: 44544
n,y=map(int,input().split())
for a in range(y//10000+1):
  for b in range(y//5000+1):
    c=n-a-b
    if 0>min(a,b,c):continue
    if a*10000+b*5000+c*1000!=y:continue
    exit(print(a,b,c))
print(-1,-1,-1)

Measured memory_bytes: 73756
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int n,m,x,b,ans1 = 0,ans2 = 0;
    cin >> n >> m >> x;
    bool a[n + 1];
    rep(i, n + 1)a[i] = false;
    rep(i, m){
        cin >> b;
        a[b] = true;
    }
    rep(i, n + 1){
        if (i == x) {
            break;
        }
        if (a[i]) {
            ++ans1;
        }
    }
    nfor(i, x, n + 1){
        if (a[i]) {
            ++ans2;
        }
    }
    if (ans1 > ans2) {
        cout << ans2 << endl;
    }else{
        cout << ans1 << endl;
    }
    return 0;
}


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

using i64 = int64_t;

constexpr int INF = 1e9;

struct Edge {
    int from, to;
    i64 cost;
};

// s番目の頂点から各頂点への最短距離を求める
bool shortest_path(int v, int e, int s, vector<i64> &mini, const vector<Edge> &edges) {
    for(int i = 0; i < 2*v; i++) {
        bool update = false;
        for (auto e: edges) {
            if (mini[e.from] != INF && mini[e.to] > mini[e.from] + e.cost) {
                mini[e.to] = mini[e.from] + e.cost;
                update = true;
            }
        }
        if (!update)
            break;
        else if(i >= 2*v - 1)
            return false;
    }
    return true;
}

int main(){
    int v, e, r;
    cin >> v >> e >> r;
    vector<Edge> edges;
    for(int i=0;i<e;++i){
        int s, t, d;
        cin >> s >> t >> d;
        edges.push_back({s, t, d});
    }
    vector<i64> mini(v, INF);
    mini[r] = 0;
    bool flag = shortest_path(v, e, r, mini, edges);

    if(!flag){
        cout << "NEGATIVE CYCLE" << endl;
        return 0;
    }

    for(int i=0;i<v;++i){
        if(mini[i] < INF){
            cout << mini[i] << endl;
        }else{
            cout << "INF" << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=20;
int n;ll a[N];
ll sol(int l,int r,int cl,int cr)
{
	if(l+1==r)return 0;
	ll res=sol(l,l+1,cl,cl+cr)+sol(l+1,r,cl+cr,cr)+(cl+cr)*a[l+1];
	for(int i=l+2;i<r;i++)res=min(res,sol(l,i,cl,cl+cr)+sol(i,r,cl+cr,cr)+(cl+cr)*a[i]);
	return res;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	printf("%lld\n",sol(1,n,1,1)+a[1]+a[n]);
	return 0;
}

Measured memory_bytes: 256
n,c,k=map(int,input().split())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()

tmp=t[0]
ans=0
cnt=1

for i in range(1,n):
    if t[i]>tmp+k or cnt>=c:
        tmp=t[i]
        cnt=1
        ans+=1
    else:cnt+=1
ans+=1
print(ans)

Measured memory_bytes: 7388
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=100;
typedef pair<int,bool> P;
int N;
P pnt[MAX_N*2];
int main(){
	cin>>N;
	REP(i,N<<1){
		int a,b;
		cin>>a>>b;
		pnt[a]=P(b,i<N);
	}
	vector<int> vec;
	int ans=0;
	REP(x,N<<1){
		if(pnt[x].second){
			vec.push_back(pnt[x].first);
		}else{
			int v=-1;
			REP(i,(int)vec.size()){
				if (vec[i]<pnt[x].first && (v==-1 || vec[i]>vec[v])){
					v=i;
				}
			}
			if (v!=-1){
				ans++;
				vec.erase(vec.begin()+v);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  double sum = 0.0;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    sum += 1.0 / (double)A;
  }
  printf("%.9lf\n", 1.0 / sum);
  return 0;
}


Measured memory_bytes: 256
#N,A,B=map(int, input().split())
 
#A=list(map(int, input().split()))
 
N=int(input())
 
F=[]
P=[]
 
for i in range(N):
    tmp=list(map(int, input().split()))
    F.append(tmp)
 
for i in range(N):
    tmp=list(map(int, input().split()))
    P.append(tmp)
 
max_sum=-1000000001
 
for i in range(1,1024):
    bin=[0]*10
    now=i
    for j in range(10):
        bin[j]=now%2
        now=now//2
    ans_sum=0
    for j in range(N):
        ans=0
        for h in range(10):
            if F[j][h]*bin[h]==1:
                ans+=1
        ans_sum+=P[j][ans]
    if max_sum<ans_sum:
        max_sum=ans_sum
 
print(max_sum)

Measured memory_bytes: 3064
#include<stdio.h>
 
int main(void){
 
  int i,j;
  int n,k = 0;
  int p[1010];
  int ans=0;
  
  scanf("%d%d",&n,&k);
  for(i=1; i<n+1; i++){
  	scanf("%d",&p[i]);
  	for(j=i;j>1;j--){
  		int tmp;
  		if(p[j]<p[j-1]){
  			tmp = p[j-1];
  			p[j-1] = p[j];
  			p[j] = tmp;
  		}
  		else{
  			break;
  		}
  	}
  }
  
  
  
  for(i=1;i<k+1;i++){
  	//printf("%d\n",p[i]);
  	ans=ans+p[i];
  }
  
  printf("%d\n",ans);
    
}


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

int n, temp, cnt[100005], ans;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i=0; i<n; i++) {
        cin >> temp;
        cnt[temp]++;
    }

    for(int i=0; i<100000; i++) {
        ans = max(ans, cnt[i]+cnt[i-1]+cnt[i+1]);
    }
    cout << ans << '\n';

    return 0;
}


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

using namespace std;

int main(){
    int n;
    int res[20];
    int numres = 0;
    while(1){
        cin >> n;
        if(n==0){
            break;
        }
        
        int max = INT_MIN;
        int min = INT_MAX;
        int total = 0;
        int read;
        for(int i=0; i<n; i++){
            cin >> read;
            total += read;
            if(read < min){
                min = read;
            }
            if(read > max){
                max = read;
            }
        }
        res[numres] = (total - max - min)/(n-2);
        numres++;
    }

    for(int i=0; i< numres; i++){
        cout << res[i] << endl;
    }

    return 0;
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

int n;
string s, t;
void solve() {
    cin >> n;
    cin >> s >> t;

    rep(i, n) cout << s[i] << t[i];
    cout << endn;

}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m,k,tmp,ans;
    cin>>n>>m;
    ans=0;
    vector<vector<int>> v=vector<vector<int>>(m,vector<int>(10,20));  //20なら捨てろ
    for(int i=0  ;i<m  ;i++){
        cin>>k;
        for(int j=0  ;j<k  ;j++){
            cin>>tmp;
            v[i][j]=tmp;
            
        }
    }
    vector<int> p;
    for(int i=0  ;i<m  ;i++){
        cin>>tmp;
        p.push_back(tmp);
    }
    
    for(int i=0  ;i<pow(2,n)  ;i++){
        vector<int> tmplist,tmplist2;
        for(int j=0  ;j<n  ;j++){
            tmplist.push_back(i>>j&1);
        }
        //tmplistは0110101011
        for(int i=0  ;i<m  ;i++){
            tmp=0;
            for(int j=0  ;j<10  ;j++){
                if (v[i][j]!=20) tmp+=tmplist[v[i][j]-1];
            }
            tmp%=2;
            tmplist2.push_back(tmp);
        }
   
        if (tmplist2==p) ans+=1;

    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    iterator.next();
    let s = iterator.next().unwrap();
    let vec: Vec<_> = s.match_indices("ABC").collect();

    return vec.len().to_string();
}

#[test]
fn test() {
    assert_eq!(
        solve(
            r"10
ZABCDBABCQ"
        ),
        "2"
    );
    assert_eq!(
        solve(
            r"19
THREEONEFOURONEFIVE"
        ),
        "0"
    );
    assert_eq!(
        solve(
            r"33
ABCCABCBABCCABACBCBBABCBCBCBCABCB"
        ),
        "5"
    );
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    char c; cin >> c;
    cout << char(c + 1) << "\n";
}

Measured memory_bytes: 256
inputs = gets.chomp.split.map{|x| x.to_i}

mom = 1000000007

(1 .. inputs[1]).each{ |i|
	puts ((1 .. (inputs[0] - inputs[1] + 1)).to_a.combination(i).size * (1 ... inputs[1]).to_a.combination(i-1).size) % mom
}


Measured memory_bytes: 3512
import java.util.Scanner;

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

        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        for(int i=1;i*i<=c;i++){
            int d=c%i;
            if(d==0){
                if(a<=i&&i<=b)count++;
                if(i!=c/i&&a<=c/i&&c/i<=b)count++;
            }
        }
        System.out.println(count);
    }
}



Measured memory_bytes: 26336
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdint>

int main() {
  intmax_t K, A, B;
  scanf("%jd %jd %jd", &K, &A, &B);

  if (K <= A)
    return !printf("1\n");

  if (A <= B)
    return !printf("-1\n");

  printf("%jd\n", 1+(K-B-1)/(A-B)*2);
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
 int n,m;
  cin >> n >>m ;
  vector<ll> h(n);
    rep(i,n) cin >> h.at(i) ;
  VI a(m);
  VI b(m);
  rep(i,m){
    cin >> a.at(i) >> b.at(i);
  }
  set<int> S;
  rep(i,m){
    if(h.at(a.at(i)-1)<h.at(b.at(i)-1)){
      S.insert(a.at(i));
    }
    else if(h.at(a.at(i)-1)>h.at(b.at(i)-1)){
      S.insert(b.at(i));
    }
    else if(h.at(a.at(i)-1)==h.at(b.at(i)-1)){
      S.insert(b.at(i));
      S.insert(a.at(i));
    }
  }
  int num=S.size();
       cout << n-num << endl;
      
       
}

Measured memory_bytes: 7432
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll A, B, C;
  cin >> A >> B >> C;
  ll K;
  cin >> K;
  ll m1 = max(max(A, B), C);
  ll m2 = max(max(A, B), C);
  rep(i, K) {
    m1 *= 2;
  }

  ll ans = A + B + C - m2 + m1;
  COUT(ans);

  return 0;
}

Measured memory_bytes: 3644
case = 0
while True:
    w = int(raw_input())
    if w == 0:
        break
    n = int(raw_input())
    dp = [[0] * 1001 for i in range(1001)]
    r1,r2 = 0,0
    for i in range(1, n + 1):
        a,b = map(int, raw_input().split(','))
        for j in range(w + 1):
            if j - b >= 0:
                dp[i][j] = max(dp[i - 1][j],dp[i - 1][j - b] + a)
            else:
                dp[i][j] = dp[i - 1][j]
            if r1 <= dp[i][j]:
                if r1 == dp[i][j]:
                    r2 = min(r2, j)
                else:
                    r2 = j
                    r1 = dp[i][j]
    case += 1
    print 'Case {}:'.format(case)
    print r1
    print r2

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

using namespace std;

int main()
{
	int N;
  cin >> N;
	string color[N];

  for(int i = 0; i < N; i++){
    cin >> color[i];
  }
  
  for(int i = 0; i < N; i++){
   if(color[i] == "Y"){
     cout << "Four" << endl;
     exit(0);
   }
  }
  cout << "Three" << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n;
	n/=5;
	a=n/100*1000;
	a+=n%100*5;
	cout<<a<<endl;
}

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

#define rep(i, N) for (ll i = 0; i < N; i++)

using ll = long long;
using namespace std;

int main() {
    ll X;
    cin >> X;
    ll aA=0,aB=0;

    bool flag = false;
    for(int i = -120; i < 120; i++){
        for(int j = -120; j < 120; j++){
            int num = i*i*i*i*i - j*j*j*j*j;
            if(num == X){
                aA = i;
                aB = j;
                flag = true;
                break;
            }
        }
        if(flag) break;
    }

    
    cout << aA << " " << aB;
    cout << "\n";
    return 0;
}


Measured memory_bytes: 3636