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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define Min(...) min({__VA_ARGS__})
#define Max(...) max({__VA_ARGS__})
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
static inline ll sgn(ll x) { return (x>0)-(x<0); }
static inline bool vowel(char c) { c = (char)tolower(c); return c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u' or c == 'y'; }
static inline vi rvi(int N) { vi res(N); rep(i,0,N) cin >> res[i]; return res; }
static inline int ri() { int N; cin >> N; return N; }
static inline void pvi(const vi& r) { trav(it,r) cout << it << " "; cout << endl; }
template<class S, class T> static inline void smax(S& s, const T& t) { if (t > s) s = t; }
template<class S, class T> static inline void smin(S& s, const T& t) { if (t < s) s = t; }
template<class S> static inline void in(S& s) { cin >> s; }
template<class S> static inline void ut(const S& s) { cout << s << " "; }
static inline void nl() { cout << endl; }

signed main() {
	cin.sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int N = ri();
	int odd = 0,
		even = 0,
		four = 0;
	rep(i,0,N) {
		int X = ri();
		if (X%4 == 0) ++four;
		else if (X%2 == 0) ++even;
		else odd++;
	}
	while (odd) {
		if (N > 1 && !four) goto die;
		--odd;
		--four;
		N -= 2;
	}
	cout << "Yes" << endl;
	return 0;
die:
	cout << "No" << endl;
}


Measured memory_bytes: 256
s = input()
a = int(s[:2])
b = int(s[2:])
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif a<=99 and 0<b<=12:
    print('YYMM')
elif 0<a<=12 and b<=99:
    print('MMYY')
else:
    print('NA')


Measured memory_bytes: 9064
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <limits>
#include <math.h>
#include <string>
#include <map>

using namespace std;

int main() {
  long long n, a, b;
  cin >> n >> a >> b;
  if (n == 1) {
    if (a == b) puts("1");
    else puts("0");
    return 0;
  }

  if (a > b) {
    puts("0");
  } else {
    long long ans = (n - 2) * (b - a) + 1;
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
    int n; cin >> n;
    string s; cin >> s;
    ll r = 0, g = 0, b = 0;
    REP(i, 0, n){
        if(s[i] == 'R'){
            r++;
        }else if(s[i] == 'G'){
            g++;
        }else{
            b++;
        }
    }
    ll ans = r * g * b;
    REP(i, 1, n){
        for(int l = 0; l + 2 * i < n; l++){
            if(s[l] != s[l+i] && s[l] != s[l+2*i] && s[l+i] != s[l+2*i]){
                ans--;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
//Use valgrind once if the submission doesn't go through. It can detect uninitialized variables and see where they could be an issue.
#include <bits/stdc++.h>
using namespace std;

int main(){

	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);

	long long n,m,k, c{0};
	cin>>n>>m>>k;
	vector<long long> a(n+1,0), b(m+1,0);
	for(int i=1;i<a.size();i++){
		cin>>a[i];
		a[i]+=a[i-1];
	}
	for(int i=1;i<b.size();i++){
		cin>>b[i];
		b[i]+=b[i-1];
	}
	for(int i=1;i<a.size();i++){
		if(a[i]<=k){
			//cout<<k-a[i]<<' '<<*upper_bound(b.begin(),b.end(),k-a[i])<<endl;
			c=max(c,(long long)(upper_bound(b.begin(),b.end(),k-a[i])-b.begin())+i-1);
		}
	}
	for(int i=1;i<b.size();i++){
		if(b[i]<=k){
			//cout<<k-a[i]<<' '<<*upper_bound(b.begin(),b.end(),k-a[i])<<endl;
			c=max(c,(long long)(upper_bound(a.begin(),a.end(),k-b[i])-a.begin())+i-1);
		}
	}
	cout<<c<<endl;
}


Measured memory_bytes: 6328
#include <bits/stdc++.h>
using namespace std;
 
  string str;
  int sum = 0;
int main() {
  cin >> str ;
 for(int i = 0; i < sizeof(str); i++){
   if(str[i] == '1'){
     sum++;
   }
 }
  cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        System.out.println(execute(sc.nextInt(),sc.nextInt(),sc.nextInt()));

    }

    public static String execute(int a1,int a2,int a3) {

        if(a1 + a2 + a3 <=21){
            return "win";
        }
        return "bust";
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <map>

using namespace std;

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

#define SUPmaxp 1000001

bool bs[SUPmaxp];
int maxp,a,b;

int main(){
	while(true){
		cin>>maxp>>a>>b;			if(!maxp) return 0;
		FOR(p,0,maxp+1) bs[p]=false;
		bs[0]=true;
		FOR(p,0,maxp+1) if(bs[p]){
			if(p+a<=maxp) bs[p+a]=true;
			if(p+b<=maxp) bs[p+b]=true;
		}
		int re=0;
		FOR(p,1,maxp+1) if(!bs[p]) re++;
		cout<<re<<endl;
	}
}

Measured memory_bytes: 2136
#include <bits/stdc++.h>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* 定数 {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

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

  string s, a = "CODEFESTIVAL2016";
  cin >> s;
  int cnt = 0;

  REP(i, s.size()){
    if (s[i] == a[i]) continue;
    cnt++;
  }

  cout << cnt << endl;


}



Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<math.h>

using namespace std;

typedef unsigned long long ull;
#define B1 100000007
#define B2 1000000007

bool rolling_hash(string const& S, int t_start, int m){
  int s_start = t_start + m;

  // B^mを用意する
  ull pow_B_m_1 = 1, pow_B_m_2 = 1;
  for(int k = 0; k < m; k++){
    pow_B_m_1 *= B1, pow_B_m_2 *= B2;
  }

  // sとtの先頭m文字のハッシュ値sh,thを計算
  ull sh1 = 0, sh2 = 0, th1 = 0, th2 = 0;
  for(int k = 0; k < m; k++){
    th1 = th1 * B1 + S[t_start + k], th2 = th2 * B2 + S[t_start + k];
    sh1 = sh1 * B1 + S[s_start + k], sh2 = sh2 * B2 + S[s_start + k];
  }

  // sをずらしながらハッシュ値を計算
  for(int k = 0; s_start + k < S.length(); k++){
    if(sh1 == th1 && sh2 == th2) return true;
    if(k + s_start < S.length()){
      sh1 = sh1 * B1 + S[s_start + m + k] - S[s_start + k] * pow_B_m_1;
      sh2 = sh2 * B2 + S[s_start + m + k] - S[s_start + k] * pow_B_m_2;
    }
  }
  return false;
}

int main(){
  int n;
  string S;
  // 入力
  cin >> n >> S;

  // 一致する最大文字数を２分探索
  int ng = n+1, ok = 0, mid = 0;
  while(ng - ok > 1){
    mid = (ng + ok) / 2;
    bool mached = false;
    // Sのi文字目をtの先頭として,t = S[i:i+mid], s = S[i+mid:]
    for(int i = 0; i < n; i++){
      if(i + mid*2 > n) break;
      if(rolling_hash(S, i, mid)){
        mached = true;
        break;
      }
    }
    if(mached) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
const ll INF = 114514810;
const ll MOD = 1000000007;
const double EPS = 1e-8;
const double PI = acos(-1.0);
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
//int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

int V;
int d[4000];
int s;
vector<vector<edge>> es;

void dijkstra(int s)
{
	fill(ALL(d), INF);
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while (!que.empty())
	{
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first) continue;
		REP(i, es[v].size())
		{
			edge e = es[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int place(int x, int y, int w)
{
	return x*w + y;
}

//right 0, down 1, left 2, up 3
int dx[] = { 0, 1, 0, -1 }; int dy[] = { 1, 0, -1, 0 };
int main()
{
	int w, h;
	while (cin >> w >> h, w)
	{
		es.clear();
		es.resize(w*h * 4);
		int fld[31][31];
		REP(i, h)REP(j, w) cin >> fld[i][j];
		int cost[4];
		REP(i, 4) cin >> cost[i];
		REP(i, 4)
		{
			REP(j, h)REP(k, w)
			{
				int tmp = place(j, k, w) + i*(w*h);
				REP(l, 4)
				{
					int nx = j + dx[l], ny = k + dy[l];
					if (!valid(nx, ny, h, w)) continue;
					int next = place(nx, ny, w) + l*(w * h);
					if ((l - i + 4) % 4 == fld[j][k]) es[tmp].push_back(edge{ tmp, next, 0 });
					else es[tmp].push_back(edge{ tmp, next, cost[(l - i + 4) % 4] });
				}
			}
		}
		dijkstra(0);
		int goal = place(h - 1, w - 1, w);
		int ans = INF;
		REP(i, 4) ans = min(ans, d[i*(w * h) + goal]);
		cout << ans << endl;
	}
}

Measured memory_bytes: 1520
import Data.List
import Data.Array.IO
import Data.IORef
import Control.Monad
import Control.Applicative
 
rInt = read :: String -> Int
 
type Ary = IOUArray (Int, Int) Int
type Var = IORef Int
 
infinity = maxBound :: Int
 
putAry ary s t d = do
    writeArray ary (s, t) d
 
putDAry ary [a, b, c] = do
    writeArray ary (a, b) c
    writeArray ary (b, a) c
 
getAry ary s t = do
    readArray ary (s, t)
 
updateAry :: Ary -> Int -> Int -> Int -> IO ()
updateAry ary s t k = do
    v <- readArray ary (s, t)
    k1 <- readArray ary (s, k)
    k2 <- readArray ary (k, t)
    writeArray ary (s, t) (if (k1==infinity || k2 == infinity) then v else min v (k1 + k2))
 
accum :: Ary -> Var -> (Int, Int) -> IO ()
accum ary tmp (s, t) = do
    v <- getAry ary s t
    modifyIORef tmp (+v)
 
calc :: Ary -> Var -> [Int] -> IO ()
calc ary res path = do
    tmp <- newIORef 0
    mapM_ (accum ary tmp) (zip path (tail path))
    tvar <- readIORef tmp
    modifyIORef res (min tvar)
 
main = do
    [n, m, r] <- ((map rInt) . words) <$> getLine
    rs <- ((map rInt) . words) <$> getLine
    l <- map ((map rInt) . words) <$> replicateM m getLine
    array <- newArray ((1, 1), (n, n)) infinity :: IO Ary
    mapM_ (putDAry $ array) l
    mapM_ (\(k, i, j) -> updateAry array i j k) [(k, i, j) | k <- [1..n], i <- [1..n], j <- [1..n]]
    result <- newIORef infinity
    mapM_ (calc array result) $ permutations rs
    readIORef result >>= print

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

using namespace std;

#define USE_IOSTREAM \
{\
	ios::sync_with_stdio(false);\
	cin.tie(0);\
	cout.tie(0);\
}

#define pii pair<int, int>
#define mp make_pair

typedef long long ll;

const int N = 1e5 + 100;

int a[N];
map<int, vector<int> > mm;
int dp[N];
int cnt[N];

int main()
{
	USE_IOSTREAM;
	
	int n, sum, i;
	cin >> n >> sum;
	for (i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	
	int curMin = a[1];
	int diff = 0;
	for (i = 2; i <= n; i++)
	{
		diff = max(diff, a[i] - curMin);
		curMin = min(curMin, a[i]);
	}
	
	curMin = a[1];
	int ans = 0;
	for (i = 2; i <= n; i++)
	{
		if (a[i] - curMin == diff)
		{
			ans++;
		}
		curMin = min(curMin, a[i]);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main() {
  int n;
  scanf("%d", &n);
  double a[n], b = 0.00;
  for (size_t i = 0; i < n; i++) {
    scanf("%lf", a+i);
    b += 1/a[i];
  }
  printf("%lf\n", 1/b);
  return 0;
}


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

public class Program
{
    public static void Main()
    {
        var xs = Console.ReadLine().Split()
            .Select(x => int.Parse(x))
            .ToArray();
        var z = xs[1] - xs[0] == xs[2] - xs[1];
        Console.WriteLine(z ? "YES" : "NO");
    }
}


Measured memory_bytes: 13396
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    put!(match n % 10 {
        3 => "bon",
        0 | 1 | 6 | 8 => "pon",
        _ => "hon",
    });
}

use std::collections::VecDeque;
use std::io::{self, Write};
use std::str::FromStr;

struct Scanner {
    stdin: io::Stdin,
    buffer: VecDeque<String>,
}
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: io::stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  int c=0;
  rep(i,n) {
    c+=a[i]%2;
  }
  if(c%2==0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
pub trait FromLn {
	fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
	let mut buf = String::new();
	let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
	T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
	let mut vs = vec![];
	for _ in 0..n { vs.push(readln()); }
	vs
}
macro_rules! fromln_primitives {
	($($t:ty),*) => { $(
		impl FromLn for $t {
			fn fromln(s: &str) -> $t {
				s.parse().unwrap()
			}
		}
	)* }
}
fromln_primitives!(String, bool, f32, f64, isize, i8, i16, i32, i64, usize, u8, u16, u32, u64);
impl<T> FromLn for Vec<T> where T: FromLn {
	fn fromln(s: &str) -> Vec<T> {
		s.split_whitespace().map(T::fromln).collect()
	}
}
impl FromLn for Vec<char> {
	fn fromln(s: &str) -> Vec<char> {
		s.chars().collect()
	}
}
macro_rules! fromln_tuple {
	($($t:ident),*) => {
		impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
			fn fromln(s: &str) -> ($($t),*) {
				let mut it = s.split_whitespace();
				let t = ($($t::fromln(it.next().unwrap())),*);
				assert_eq!(it.next(), None);
				t
			}
		}
	}
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);

fn main() {
    let (a, b, c): (i32, i32, i32) = readln();
	let answer = if a <= c && c <= b {
        "Yes"
    } else {
        "No"
    };
    println!("{}", answer);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int r, D, x;
  std::cin >> r >> D >> x;
  for(int i=0;i<10;i++){
    x = r*x - D;
    std::cout << x << '\n';
  }
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;




int main() {
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int n;
    cin >> n;
    vector<int> a[n + 1], b[n + 1];
    int ans[n - 1];
    memset(ans, -1, sizeof ans);
    for (int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        a[u].pb(i);
        a[v].pb(i);
        b[u].pb(v);
        b[v].pb(u);
    }

    int k = 0;
    queue<int> q;
    bool vis[n + 1];
    memset(vis, false, sizeof vis);
    vis[1] = true;
    q.push(1);
    while (!q.empty()) {
        int f = q.front();
        q.pop();
        k = max(k, (int) a[f].size());
        int c = 1, taken = -1;
        for (int ed : a[f]) {
            if (ans[ed] != -1) taken = ans[ed];
        }

        for (int ed : a[f]) {
            if (ans[ed] == -1) {
                if (c == taken) ++c;
                ans[ed] = c++;
            }
        }

        for (int e : b[f]) {
            if (!vis[e]) {
                vis[e] = true;
                q.push(e);
            }
        }
    }

    cout << k << '\n';
    for (int e : ans) cout << e << '\n';

}

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

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	ll n;
	cin >> n;

	ll a[n];
	rep(i,n) cin >> a[i];

	map<ll, ll> mp;
	rep(i,n){
		ll x = a[i];
		if(mp.find(x) == mp.end()) mp[x] = 0;
		mp[x]++;
	}

	vector<ll> vs;

	for(map<ll, ll>::iterator itr = mp.begin();itr != mp.end(); ++itr){
		if(itr->second >= 2) vs.push_back(itr->first);
	}

	if(vs.size() == 0 || (vs.size() == 1 && mp[vs[0]] <= 3)) {
		cout << 0 << endl;
		return 0;
	}

	sort(vs.begin(),vs.end(),greater<ll>());

	if(mp[vs[0]] >= 4) {
		cout << (vs[0] * vs[0]) << endl;
		return 0;
	}

	cout << (vs[0] * vs[1]) << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  while(true){
    ll n;
    cin>>n;
    if(n==0)break;
    vl a(n);
    REP(i,n)cin>>a[i];
    sort(ALL(a));
    ll ret = 0;
    vl sum(n);
    sum[0] = a[0];
    REPR(i,n){
      ret += sum[i-1];
      sum[i] = sum[i-1]+a[i];
    }
    cout << ret << endl;
  }
  return 0;
}

Measured memory_bytes: 1360
import java.util.Scanner;
class Main {
	public static void main(String[] args){
		 Scanner scn = new Scanner(System.in);
		    int S = scn.nextInt();
		  
		    int m = S/60;
		    int h = m/60;
		    int s = S%60;
		    m = m%60;    
		  System.out.println(h+":" +m +":" +s);
		
	}

}

Measured memory_bytes: 26364
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

ll N,K;
ll A[100000];

int main(){
    cin>>N>>K;
    rep(i,N) cin>>A[i];

    ll one[40];
    rep(i,40) one[i]=0;
    for(ll i=0;i<40;i++){
        rep(j,N){
            if(A[j]>>i&1) one[i]++;
        }
    }

    ll ans=0;
    for(ll i=39;i>=0;i--){
        if(one[i]<N-one[i] && K-((ll)1<<i)>=0){
            ans+=((ll)1<<i)*(N-one[i]);
            K-=((ll)1<<i);
        }else{
            ans+=((ll)1<<i)*one[i];
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
import math
import heapq
import sys
from collections import Counter
import numpy as np
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
#s = [input() for i in range(3)]

S=input()

a=datetime.datetime(int(S[:4]), int(S[5:7]), int(S[8:10]))        
b=datetime.datetime(2019,4,30)

if a<=b:
    print('Heisei')
else:
    print('TBD')

Measured memory_bytes: 13528
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;

using Graph = vector<vector<int>>;

//深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v){
    seen[v] = true; // v を訪問済みにする

    // vから行ける各頂点 next_v について
    for(auto nv : G[v]){
        if (seen[nv]) continue; // next_v が探索済みだったらスルー
        dfs(G, nv); // 再帰的に探索
    } 
}

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

    int N, M; cin >> N >> M;
  
    Graph G(N);
    for(int i=0;i<M;i++){
        int A, B, C;
        cin >> A >> B >> C;
        --A, --B;
        G[A].push_back(B);
        G[B].push_back(A);
    }

    seen.assign(N, false); // 全頂点を「未訪問」にして初期化
	int ans = 0;
    rep(i,N){
		if(!seen[i]){
			dfs(G, i);
			++ans;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 10368
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

int n, m;
int d[200000], t[200000];
int tmp;
bool ans = 1;

int main(void) {
  scanf("%d",&n);
  for(int i=0;i<n;i++) scanf("%d",&d[i]);
  scanf("%d",&m);
  for(int i=0;i<m;i++) scanf("%d",&t[i]);

  sort(d, d+n);
  sort(t, t+m);

  int i=0, j=0;
  while(i < m){
    if(d[j] > t[i] || j>=n) {
      ans = 0;
      break;
    }
    else if(d[j] < t[i]) j++;
    else{
      j++;
      i++;
    }
  }

  if(ans) printf("YES\n");
  else printf("NO\n");
  return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

template <typename T>
std::tuple<T, T, T> extgcd(T a, T b){
    T s1 = 1, t1 = 0, s2 = 0, t2 = 1;
    while(b != 0){
        std::tie(s1, t1, s2, t2) = std::make_tuple(s2, t2, s1 - (a / b) * s2, t1 - (a / b) * t2);
        std::tie(a, b) = std::make_tuple(b, a % b);
    }
    return std::make_tuple(s1, t1, a);
}

template <typename T>
T mod_inverse(T a, T mod){
    T b;
    std::tie(b, std::ignore, std::ignore) = extgcd(a, mod);
    if(b < 0){b += mod;}
    return b;
}

template <typename T>
struct Combinatorics{
    T modulo;
    std::vector<T> fact, inv_fact;

    Combinatorics(T max, T modulo) : modulo(modulo), fact(max + 1), inv_fact(max + 1) {
        fact[0] = 1;
        for(T i=1;i<=max;++i){
            fact[i] = i * fact[i - 1] % modulo;
        }

        inv_fact[max] = mod_inverse(fact[max], modulo);
        for(T i=max;i>0;--i){
            inv_fact[i - 1] = i * inv_fact[i] % modulo;
        }
    }

    T nPk(T n, T k){
        if(n < k){return 0;}
        return fact[n] * inv_fact[n - k] % modulo;
    }

    T nCk(T n, T k){
        if(n < k){return 0;}
        return fact[n] * inv_fact[k] % modulo * inv_fact[n - k] % modulo;
    }

    T nHk(T n, T k){
        if(n == 0 && k == 0){return 1;}
        return nCk(n + k - 1, k);
    }
};

constexpr ll MOD = 1'000'000'007;
Combinatorics<ll> comb(2000100, MOD);
int r1, c1, r2, c2;

inline ll g(int r, int c){
    if(r > c){
        std::swap(r, c);
    }

    if(r == 0){
        return c + 1;
    }
    return (comb.nCk(r + c + 2, r + 1) + MOD - 1) % MOD;
}

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

  std::cin >> r1 >> c1 >> r2 >> c2;
  
  ll res = g(r2, c2);
  res = (res + MOD - g(r1 - 1, c2)) % MOD;
  res = (res + MOD - g(r2, c1 - 1)) % MOD;
  res = (res + g(r1 - 1, c1 - 1)) % MOD;

  std::cout << res << std::endl;
}


Measured memory_bytes: 31488
# 少ないので実際にやる
# あまりはループするので、0かループした時点で終了
a, b, c = map(int, input().split())
aa = a
lis = []
while True:
    aa = aa + a
    d = aa % b
    if b == 0 or d in lis:
        print("NO")
        exit()
    lis.append(d)
    if d == c:
        print("YES")
        exit()



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

using namespace std;

using ll = long long;

int r[100000], c[100000];
ll dp[100000];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, d;
    cin >> h >> w >> d;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int a;
            cin >> a;
            r[a] = i;
            c[a] = j;
        }
    }

    for (int i = d + 1; i <= h * w; i++) {
        dp[i] = dp[i - d] + abs(r[i] - r[i - d]) + abs(c[i] - c[i - d]);
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int L, R;
        cin >> L >> R;
        cout << dp[R] - dp[L] << endl;
    }
    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			long a = scanner.nextLong(), b = scanner.nextLong(), x = scanner.nextLong();
			System.out.println((0 == a) ? b / x + 1 : b / x - (a - 1) / x);
		}
	}
}


Measured memory_bytes: 35760
# coding: utf-8

import sys
import math
import collections
import itertools
def input(): return sys.stdin.readline().strip()
def gcd(x, y): return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y): return (x * y) // gcd(x, y)
MOD = 10 **9 + 7

R = int(input())
# S = input()
# N, M = map(int, input().split())
# 横
# L = [int(x) for x in input().split()]
# 縦
# A = [int(input()) for _ in range(N)]
# 多次元
# L = [[int(x) for x in input().split()] for _ in range(N)]

print(3 * R * R)


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

using namespace std;

int main()
{
  int N, M;
  int sum_N = 0, sum_M = 0,  c = 0;
  while (scanf("%d,%d ", &N, &M) == 2) {
    sum_N += N * M, sum_M += M;
    c++;
  }
  printf("%d\n%d\n", sum_N, (int)((double)sum_M / c + 0.5));
  return 0;
}

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

int main() {
  int A,B;
  cin>>A>>B;
  rep(i,B) if((A-1)*(i-1)+A>=B) {
    cout<<i<<endl;
    break;
  }
  
}

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

using namespace std;

using ll = long long;

ll dp[3000][51] = {};

int main() {
  int n;
  cin >> n;
  int mi = 1e9, ans = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    if (a % 10) {
      mi = min(mi, a);
    }
    ans += a;
  }
  if (ans % 10) {
    cout << ans << endl;
  } else {
    ans -= mi;
    if (ans >= 0) {
      cout << ans << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

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

int main()
{
    int n, a, p[101];
    for( int i = 0; i < 101; i++ )
        p[i] = 0;

    cin >> n;
    for( int i = 0; i < n; i++ )
    {
        cin >> a;
        p[a]++; 
    }

    for( int i = 99; i >= 1; i-- )
        p[i] += p[i+1];

    int max = 0;
    for( int i = 1; i < 101; i++ )
        if( i <= p[i] )
            max = i;

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;

int main(){jizz
	int a,b;cin >> a >> b;
	string s;cin >> s;
	for(int i = 0 ; i < s.size();  i++){
		if(i == a){
			if(s[i] != '-'){
				return cout << "No",0;
			}
		}
		else if(s[i] > '9' || s[i] < '0'){
			cout << "No";
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
L = []
for Resturant_number in range(1, N+1):
    tmp = [Resturant_number]
    tmp += input().split()
    tmp[2] = int(tmp[2])
    L.append(tmp)
L.sort(key=lambda x:(x[1],-x[2]))
for Restaurant_data in L:
    print(Restaurant_data[0])
    

Measured memory_bytes: 3060
cards = {"a" => gets.chomp.chars.to_a,
  "b" => gets.chomp.chars.to_a,
  "c" => gets.chomp.chars.to_a}
turn = "a"
loop do
  break if cards[turn].empty?
  turn = cards[turn].shift
end
puts turn.to_s.upcase

Measured memory_bytes: 1788
#include <iostream>
#include <list>
#include <algorithm>
#define F first
#define S second
using namespace std;
typedef pair <int,int> pa;
typedef pair <int,pa> P;
int n,m,a;
int main(void){
	while(cin >> n >> m >> a ,n|m|a){
		int S[101];
		for(int i=0;i<101;i++)
			S[i]=i;
		P seq[1000];
		for(int i=0;i<m;i++){
			int a,b,c;
			cin >> a >> b >> c;
			seq[i].F=a;
			seq[i].S.F=b;
			seq[i].S.S=c;
		}
		sort(seq,seq+m);
		for(int i=0;i<m;i++)
			swap(S[seq[i].S.F],S[seq[i].S.S]);
		cout << S[a] << endl;
	}
	return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    string S;
    cin >> S;
    int len = S.length();
    bool ans =true;
    for(int i=0; i<len-1; i++){
        for(int j=i+1; j<len; j++){
            if(S[i]==S[j]){
                ans = false;
            }
        }
    }
    if(ans){
        cout << "yes" << endl;
    }else{
        cout << "no" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
signed main(){
    int n;cin >> n;
    int a[n];
    rep(i,n){
        cin >> a[i];
        a[i]--;
    }
    vector<int> t;
    t.push_back(0);
    rep(i,n){
        int hoge = t.back();
        int to = a[hoge];
        if(to == 1){
            cout << i+1 << endl;
            return 0;
        }
        t.push_back(to);

    }
    cout << -1 << endl;
    return 0;
}

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

typedef struct{
	int parent,left,right;
}Node;

void print(int n);
void sibling(int i);
void degree(int i);
void setDepth(int i,int p);
int setHeight(int H[],int u);
void type(int i);

Node *T;
int *depth,*height;

int main(){
	int n; cin>>n;
	T = new Node[n]; depth = new int[n]; height = new int[n];
	for(int i=0;i<n;i++) T[i].parent = T[i].left = T[i].right = -1;
	for(int i=0;i<n;i++) depth[i] = 0;
	for(int i=0;i<n;i++) height[i] = 0;

	int id;
	for(int i=0;i<n;i++){
		cin>>id;
		cin>>T[id].left>>T[id].right;
		if(T[id].left!=-1) T[T[id].left].parent = id;
		if(T[id].right!=-1) T[T[id].right].parent = id;
	}

	int root;
	for(int i=0;i<n;i++)
		if(T[i].parent==-1) root = i;

	setDepth(root,0);
	setHeight(height,root);

	print(n);

	delete [] T; delete [] depth; delete [] height;
}

void print(int n){
	for(int i=0;i<n;i++){
		cout<<"node "<<i<<": parent = "<<T[i].parent<<", sibling = ";sibling(i);
		cout<<", degree = ";degree(i);cout<<", depth = "<<depth[i]<<", height = "<<height[i]<<", ";type(i);cout<<endl;
	}
}

void sibling(int i){
	if(T[i].parent!=-1){
		if(T[T[i].parent].left!=i){
			cout<<T[T[i].parent].left;
		}else if(T[T[i].parent].right!=i){
			cout<<T[T[i].parent].right;
		}else{
			cout<<-1;
		}
	}else{
		cout<<-1;
	}
}

void degree(int i){
	int deg = 0;
	if(T[i].left!=-1) deg++;
	if(T[i].right!=-1) deg++;
	cout<<deg;
}

void setDepth(int i,int p){
	depth[i] = p;
	if(T[i].right!=-1) setDepth(T[i].right,p+1);
	if(T[i].left!=-1) setDepth(T[i].left,p+1);
}

int setHeight(int H[],int u){
	int h1=0,h2=0;
	if(T[u].right!=-1) h1 = setHeight(H,T[u].right)+1;
	if(T[u].left!=-1) h2 = setHeight(H,T[u].left)+1;

	return  H[u] = max(h1,h2);
}

void type(int i){
	if(T[i].parent==-1){
		cout<<"root";
	}else if(T[i].left==-1&&T[i].right==-1){
		cout<<"leaf";
	}else{
		cout<<"internal node";
	}
}

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

const int MOD = 1000000007;

int n,m;
vector<int> G[100010];
bool used[100010];

void dfs(int v){
	used[v] = true;
	for(int to : G[v]){
		if(!used[to]) dfs(to);
	}
}

void solve(){
	for(int i = 0;i < n;i++){
		G[i].clear();
		used[i] = false;
	}
	for(int i = 0;i < m;i++){
		int a,b;
		cin >> a >> b; a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	int k = 0;
	for(int i = 0;i < n;i++){
		if(!used[i]){
			k++;
			dfs(i);
		}
	}
	int ans = 1;
	for(int i = 0;i < k;i++) ans = ans * 2 % MOD;
	cout << (ans + !!m) % MOD << endl;
}

signed main(){
	while(cin >> n >> m,n) solve();
}


Measured memory_bytes: 11624
#include<bits/stdc++.h>
using namespace std;
int main(void){
pair<int,int>y,z;
y=make_pair(500,1000);
z=make_pair(5,5);
int x,sum=0;cin>>x;
while(true){
    if(x-y.first>=0)
        {x-=y.first;sum+=y.second;}
    else
        break;
}
while(true){
    if(x-z.first>=0)
        {x-=z.first;sum+=z.second;}
    else
        break;
}
cout<<sum<<endl;


return 0;}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
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;
}

//a^n mod を計算する関数
long long modpow(long long a,long long n,long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n % 2 == 1) {
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//a^(-1) mod すなわちaの逆元を返す関数
long long modinv(long long a,long long mod) {
    return modpow(a,mod-2,mod);
}

//最大公約数をを返す関数
long long gcd (long long a,long long b) {
    if(a % b == 0) {
        return b;
    }else {
        return (gcd(b,a%b));
    }
}

const long long INF = 1LL << 60;
const long long P = 1000000007;

//nCkを求める関数
long long conbi (long long n,long long k) {
    long long res = 1;
    long long inv;
    for(long long i = n-k+1; i <= n; i++) {
        res *= i;
        res %= P;
    }
    for(long long i = 1; i <= k; i++) {
        inv = modinv(i,P);
        res *= inv;
        res %= P;
    }
    return res;
}

int main() {
    string s,t;
    cin >> s >> t;
    int count = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == t[i]) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>

using namespace std;


int main(int argc, char* argv[]) {
  int N, X, Y;
  cin >> N >> X >> Y;

  map<pair<int, int>, int> m;
  vector<int> ret(N);
  for (int i = 1; i < N; ++i) {
    for (int j = i + 1; j <= N; ++j) {
      int d = min(min(abs(j - i), abs(X - i) + abs(Y - j) + 1), abs(Y - i) + abs(X - j) + 1);
      ++ret[d];
    }
  }

  for (int i = 1; i < N; ++i)
    cout << ret[i] << endl;

  return 0;
}

Measured memory_bytes: 256
from scipy.sparse import*
(n,m,s,*D),*t=[map(int,t.split())for t in open(0)]
R,C=[],[]
r=range(2501)
for u,v,a,b in t[:m]:
 for i in r:k=(i+a)*51;R+=k+u,k+v;C+=i*51+v,i*51+u;D+=b,b
i=0
for c,d in t[m:]:
 i+=1
 for j in r:R+=j*51+i,;C+=(j+c)*51+i,;D+=d,
d=csgraph.dijkstra(csr_matrix((D,(R,C)),[8**6]*2),1,min(j,s)*51+1)
for i in range(2,n+1):print(int(min(d[i::51])))

Measured memory_bytes: 123816
#include <bits/stdc++.h>
using namespace std;
int main() {
	long a,b,c,k,s=0;
	cin>>a>>b>>c>>k;
	if (a<=k)
	{
		s+=a;
		k-=a;
		if (b<=k)
		{
			k-=b;
			if (c<=k)
				s-=c;
			else
				s-=k;
		}
	}
	else
		s=k;
	cout<<s<<'\n';
	return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
using namespace std;
int a = 0, b = 0, c = 0, d = 0, e[60][60], f[120] = {}, g[10100], h[10100], counto = 0, ans = 0, x[100] = {}, y, z;
int64_t ab[10000] = {}, abc = 0, abcd = 0;
pair<int, int>manji[101] = {};
char rikka, toka[150][150] = {};
vector<int> train,code;
string saya, homu, kyok, mami[108], mado[100];
bool gg;
bool exist[1000];
int main() {
	cin >> a;
	if (a == 22) {
		cout << "Christmas Eve Eve Eve" << endl;
	}
	if (a == 23) {
		cout << "Christmas Eve Eve" << endl;
	}
	if (a == 24) {
		cout << "Christmas Eve" << endl;
	}
	if (a == 25) {
		cout << "Christmas" << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
const int maxn = (int) 1e5 + 1;

int n, k;
int a;
int ans, cur;
int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> a;
    }
    ans = n / k;
    cur = n % k + n / k - 1;
    while(cur >= k){
       ans += cur / k;
       cur = cur % k + cur / k;
    }
    if(cur > 0){
        ans++;
    }
    cout << ans ;
}


Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0:
        break
    A, B = 0, 0
    for _ in range(n):
        x, y = map(int, input().split())
        if x > y:
            A += x + y
        elif x < y:
            B += x + y
        else:
            A += x
            B += y
    print(A, B)


Measured memory_bytes: 5616
#include <iostream>
#include <stdio.h>

using namespace std;

int main(){
	int a[5],i,j,b;
	scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
	for(i=0;i<5;i++){
		for(j=0;j<4;j++){
			if(a[j]<=a[j+1]){
				b=a[j];
				a[j]=a[j+1];
				a[j+1]=b;
			}
		}
	}
	for(i=0;i<5;i++){
		printf("%d",a[i]);
		if(i<4){
			printf(" ");
		}else{
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1192
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix

from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！

def main():
    a,b=map(int,input().split())
    if abs(a-b)>=2:
        print("Alice")
    else:
        print("Brown")
if __name__ == '__main__':
    main()

Measured memory_bytes: 5096
input_str = input()
input = input_str.split(' ')
a = int(input[0])
b = int(input[1])
c = int(input[2])
flag = False
for n in range(100):
    if (n*a)%b == c:
        flag = True

if flag:
    output = 'YES'
else:
    output = 'NO'

print(output)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    int N, M, X;
    cin >> N >> M >> X;

    vector<int> c(N);
    vector<vector<int>> A(N, vector<int>(M));
    for (int i = 0; i < N; i++)
    {
        cin >> c.at(i);

        for (int j = 0; j < M; j++)
        {
            cin >> A.at(i).at(j);
        }
    }

    
    int ans = 1001001001;

    for (int i = 0; i < (1<<N); i++)
    {
        int cost = 0;
        vector<int> rikai(M);
        for (int j = 0; j < N; j++)
        {
            if (i >> j & 1)
            {
                cost += c.at(j);
                for (int k = 0; k < M; k++)
                {
                    rikai.at(k) += A.at(j).at(k);
                }
            }
        }
        bool ok = true;
        for(int j=0; j < M; j++){
            if(rikai.at(j) < X){
                ok = false;
            }
        }
        if(ok){
            ans = min(ans, cost);
        }
    }

    if(ans == 1001001001){
            cout << -1 << endl;
        }else{
            cout << ans << endl;
        }

    return 0;
}


Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String[] sl = s.split("[\\s]+");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);

    int z = b - a;
    
    int v = z * (z - 1) / 2;
    

    System.out.println(v - a);

  }

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

class CumulativeSum {
    vector<ll> numbers;
    vector<ll> sums;

public:
    CumulativeSum(int n) {
        numbers.resize(n);
        sums.resize(n);
    }

    void set(int i, ll value) {
        numbers[i] = value;
    }

    ll getSum(int i) {
        if (i == -1) return 0;
        if (i == sums.size()) return sums.back();
        return sums[i];
    }

    ll getSectionSum(int start, int end) {
        return getSum(end) - getSum(start - 1);
    }

    void build() {
        for (int i = 0; i < numbers.size(); i++) {
            sums[i] = getSum(i - 1) + numbers[i];
        }
    }

};

map<ll, int> factorize(ll n) {
    map<ll, int> res;

    for (ll i = 2; i * i <= n; i++) {
        if (n % i != 0) {
            continue;
        }
        res[i] = 0;
        while (n % i == 0) {
            n /= i;
            res[i]++;
        }
    }

    if (n != 1) res[n] = 1;
    return res;
}


int main() {
    int n;
    cin >> n;
    ll k;
    cin >> k;
    vector<ll> t(n);
    rep(i, n) cin >> t[i];

    auto check = [&](ll a) -> bool {
        vector<ll> u(n);
        rep(i, n) u[i] = t[i] % a;
        if (count(u.begin(), u.end(), 0) == n) return true;
        sort(u.rbegin(), u.rend());
        CumulativeSum cs(n);
        rep(i, n) cs.set(i, u[i]);
        cs.build();

        rep(i, n) {
            ll l = cs.getSum(i);
            ll r = cs.getSectionSum(i + 1, n);
            ll lr = (i + 1) * a - l;
            if (lr == r && lr <= k) return true;
        }
        return false;
    };

    ll sum = accumulate(t.begin(), t.end(), 0ll);
    ll ma = sum / n;

    vector<ll> candidate;

    for (ll a = 1; a * a <= sum; a++) {
        if (sum % a == 0) candidate.push_back(a), candidate.push_back(sum / a);
    }
    sort(candidate.rbegin(), candidate.rend());

    for (ll a : candidate) {
        if (sum % a != 0) continue;
        bool ok = check(a);
        if (ok) {
            cout << a << endl;
            ret();
        }
    }
}


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

namespace AtCoder
{
    class Program
    {
        static long n;

        static void Main(string[] args)
        {
            n = int.Parse(Console.ReadLine());
            Console.WriteLine(n * n * n);
        }
    }
}


Measured memory_bytes: 13140
#include<algorithm>

#define MAX_N 1001

using namespace std;

int BinSearch(int v[], int vsize, int search){
	int l = 0;
	int r = vsize;
	int m = 0;
	if( v[r - 1] < search )
		return r - 1;
	else if(v[1] > search )
		return 0;

	while( r - 1 > l ){
		m = (r + l) / 2;

		if( v[m] > search )
			r = m;
		else if(v[m] == search)
			return m;
		else
			l = m;
	}
	return m;
}

int main(void){
	while( true ){
		int prevQ = -1;
		int index = 0;
		int Max = 0;
		int N, M;
		int *Q;
		int V[MAX_N];

		cin >> N >> M;
		
		if( N == 0 && M == 0 ) break;

		for(int i = 0; i < N; i++)
			cin >> V[i];
		
		V[N] = 0;
		N++;

		Q = new int[N*N];

		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
				Q[i * N + j] = V[i] + V[j];

		sort(Q, Q+N*N);

		for(int i = 0; i < N * N; i++){
			int optim;
			
			if( prevQ == Q[i] )
				continue;
			else
				prevQ = Q[i];

			optim = BinSearch(Q, N*N, M - Q[i]);
			if( optim > 0 && Q[i] + Q[optim] > M)
				optim--;
			Max = max( Max , Q[i] + Q[optim] > M ? 0 : Q[i] + Q[optim]);
		}

		delete[] Q;
		cout << Max << '\n';
	}
	return 0;
}

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

int main()
{
	int n, m, q;
	cin >> n >> m >> q;
	vector<int> l(m), r(m);
	for (int i = 0; i < m; i++)
	{
		cin >> l[i] >> r[i];
	}
	vector<vector<int>> dp(n + 1, vector<int>(n + 1, 0));
	for (int i = 0; i < m; i++)
	{
		dp[l[i]][r[i]]++;
	}
	for (int i = 0; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			dp[i][j] += dp[i][j - 1];
		}
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 0; j <= n; j++)
		{
			dp[i][j] += dp[i - 1][j];
		}
	}
	for (int i = 0; i < q; i++)
	{
		int p, q;
		cin >> p >> q;
		cout << dp[q][q] - dp[p - 1][q] - dp[q][p - 1] + dp[p - 1][p - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 3456