akhauriyash/Code-Regression huggingface dataset:
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int N;
	std::cin >> N;
	for (int i = 10; i >= 0; --i) {
		if (N >= (1 << i)) {
			std::cout << (1 << i) << "\n";
			return 0;
		}
	}
}


Measured memory_bytes: 384
n = int(input())
l = [[] for i in range(4)]
for i in range(n):
    x, y = map(int, input().split())
    l[0].append(x+y)
    l[1].append(x-y)
    l[2].append(-x+y)
    l[3].append(-x-y)
for i in range(4):
    l[i].sort()
ans = 0
for i in range(4):
    ans = max(ans, l[i][-1] - l[i][0])
print(ans)


Measured memory_bytes: 41532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


int main(){
    int n, k;
    cin>>n>>k;
    int ans = 1e9;
    for(int i = 0; i <= n; i++){
        int x = 1;
        int a = i;
        while(a--) x *= 2;
        
        int b = n - i;
        while(b--) x += k;

        ans = min(ans, x);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+18;

int main() {
    ios::sync_with_stdio(false);
    Int a, b, c;
    cin >> a >> b >> c;
    dump(min(b / a, c));
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
typedef long long ll;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, n) cin >> a[i];
	
	sort(a.begin(), a.end(),greater<int>());
	
	int ans=0;
	
	rep(i, n){
		if(i%2 == 0) ans += a[i];
		else ans -= a[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector> // vectorを使うためにインクルードする

using namespace std;
int main(void){
    // Your code here!
    vector<int> arr; // <T>でT型のvector
    int count = 0,x,n = 0;
    cin >> n;
    
    while(cin >> x) {
		arr.push_back(x);
	}
    
    // while(cin>>l){
    //     arr[k] = l;
    //     k++;
    // }
    
    int a,b,c;
    
    for(int i = 0; i < n-2; i++){
        a = arr[i];
        b = arr[i+1];
        c = arr[i+2];
        
        if((a<b && b<c) || (c<b && b<a)){
            count ++;
        }
        
    }
    
        cout << count << endl; 
    
}

Measured memory_bytes: 256
h, w = map(int, input().split())
s = [["." for j in range(w+2)] for i in range(h+2)]

for i in range(h):
    tmp = list(input())
    for j in range(1, w+1):
        s[i][j] = tmp.pop()

for i in range(1, h+1):
    for j in range(1, w+1):
        up = s[i-1][j]
        down = s[i+1][j]
        left = s[i][j-1]
        right = s[i][j+1]

        if  s[i][j] == "#" and s[i][j] != up and s[i][j] != down and s[i][j] !=left and s[i][j] != right:
            print("No")
            exit()

print("Yes")

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

int main()
{
  int n;
  int a[n];
  int max = 0;
  int sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++){
    int x;
    cin >> x;
    a[i] = x;
  }
  for (int i = 0; i < n; i++){
   if (max < a[i])
     max = a[i];
  }
  for (int i = 0; i < n; i++){
    sum += a[i];
  }
  if (sum > max * 2)
    cout << "Yes";
  else
    cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
const int inf = 1e18;
typedef pair<int, int> P;
#define MAX 35000000

int price[32], value[32];
int segmax[MAX], segn = 1;
vector<P> a[2];

void dfs(int k, int t, int u, int pri, int val){
	if(k == t){
		a[u].push_back(P(pri, val));
		return ;
	}
	dfs(k+1, t, u, pri+price[k], val+value[k]);
	dfs(k+1, t, u, pri-price[k], val-value[k]);
	dfs(k+1, t, u, pri, val);
}

void init(int n){
	while(segn < n)segn *= 2;
	for(int i = 0;i < segn*2;i++)segmax[i] = -inf;
}

void add(int k, int val){
	k += segn-1;
	segmax[k] = val;
	while(k){
		k = (k-1)/2;
		segmax[k] = max(segmax[k*2+1], segmax[k*2+2]);
	}
}

int getmax(int a, int b, int k, int l, int r){
	if(b <= l || r <= a)return -inf;
	if(a <= l && r <= b)return segmax[k];
	int t1 = getmax(a, b, k*2+1, l, (l+r)/2);
	int t2 = getmax(a, b, k*2+2, (l+r)/2, r);
	return max(t1, t2);
}

signed main(){
	int n, d;
	scanf("%lld%lld", &n, &d);
	for(int i = 0;i < n;i++)
	scanf("%lld%lld", &price[i], &value[i]);
	
	int m = n/2;n = n-m;
	dfs(0, n, 0, 0, 0);
	dfs(n, n+m, 1, 0, 0);
	
	sort(a[0].begin(), a[0].end());
	sort(a[1].begin(), a[1].end(), greater<P>());
	
	init(a[1].size());
	for(int i = 0;i < a[1].size();i++)add(i, a[1][i].se);
	
	int l = 0, r = 0, ans = 0;
	for(int i = 0;i < a[0].size();i++){
		int bn = a[1].size(), v = a[0][i].fi, v2 = a[0][i].se;
		while(r < bn && a[1][r].fi+v >= -d)r++;
		while(l < bn && a[1][l].fi+v > d)l++;
		int mx = getmax(l, r, 0, 0, segn);
		if(mx == -inf)continue;
		ans = max(ans, v2+mx);
	}
	
	printf("%lld\n", ans);
}


Measured memory_bytes: 713384
{-# LANGUAGE CPP #-}
module Main where

import qualified Data.Vector as V 
import qualified Data.Map.Strict as M
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

dump :: (Show a) => a -> IO()
#if __GLASGOW_HASKELL__ >= 850
dump x = print x
#else
dump _ = pure ()
#endif

readint :: IO Int
readint = (fst . fromJust . BS.readInt) <$> BS.getLine

readvec :: IO [Int]
readvec = (fmap (read . BS.unpack) . BS.words) <$> BS.getLine

newtype UF a = UF (M.Map a a) deriving (Show) -- Map node parent

makeuf :: Int -> UF Int
makeuf n = let m = M.fromList $ zip [0..n] [0..n]
                in UF m

union :: (Eq a, Ord a) => a -> a -> UF a -> UF a
union l r uf@(UF m) = let lp = find l uf
                          rp = find r uf
                      in if lp == rp
                         then uf
                         else if size l uf < size r uf
                              then UF $ M.update (const $ Just rp) lp m
                              else UF $ M.update (const $ Just lp) rp m

find :: (Eq a, Ord a) => a -> UF a -> a
find x uf@(UF m) = let px = m M.! x
                in if px == x
                   then px
                   else find px uf

size :: (Eq a, Ord a) => a -> UF a -> Int
size x (UF m) = M.size $ M.filter (\par -> par==x) m

main :: IO()
main = do
  [a,b,k] <- readvec
  let xs = reverse $ [x | x <- [1..(min a b)], a `mod` x == 0, b `mod` x == 0]
  dump xs
  print $ xs !! (k-1)


Measured memory_bytes: 508
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

signed main() {
	int n; cin >> n;
	cout << 800 * n - (n / 15 * 200) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct UnionFind {
  vector<int> d; //xを頂点番号とすると、d[x]にはxが根なら、-(グループ内の頂点数)が格納され、xが根ではないなら、xの所属するグループの根の頂点番号が格納。
  UnionFind(int n): d(n,-1) {} //マイナスが入っていると根。最初は全長点が根。根には-(グループの全頂点数)が格納。
  int root(int x) { //頂点xの属しているグループの根を返す。
    if (d[x] < 0) return x; //xが根なら、return
    return d[x] = root(d[x]); //xが根ではないなら、xの所属するグループの根の頂点番号で再帰する。（つまり、再帰は1回で終わる）
  }
  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y); //小さい方を大きい方につなげる。
    d[x] += d[y]; //大きい方の頂点には小さい方の頂点数分だけ加算される。
    d[y] = x; //小さい方の根の頂点が大きい方の根に書き変わる。
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y);}
  int size(int x) { return -d[root(x)];} //xの連結成分の大きさを返す。
};

void solve(){
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    Graph G(n);
    REP(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        uf.unite(a, b);
        G[a].pb(b);
        G[b].pb(a);
    }
    REP(i, k){
        int c, d;
        cin >> c >> d;
        c--; d--;
        G[c].pb(d);
        G[d].pb(c);
    }

    REP(i, n){
        int cnt = 0;
        REP(j, G[i].size()){
            if(uf.same(i, G[i][j])) cnt += 1;
        }
        cout << uf.size(i) - cnt - 1;
        if(i != n-1) cout << " ";
        else cout << endl;
    }
    
}

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

Measured memory_bytes: 7936
#include <iostream>

using namespace std;

int main(void){
	int a,b;
	while(cin>>a>>b){
		int tl[101][101]={};
		tl[a][b]++;
		tl[b][a]++;
		while(cin>>a>>b,a||b){
			tl[a][b]++;
			tl[b][a]++;
		}
		bool f=true;
		for(int i=1;i<101;++i){
			int cnt=0;
			for(int j=1;j<101;++j){
				cnt+=tl[i][j];
			}
			//cerr<<cnt<<endl;
			if(i<3 && cnt%2==0) f=false;
			if(3<=i && cnt%2==1) f=false;
		}
		cout<<(f?"OK":"NG")<<endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include <iostream>

using namespace std;

int main(void) {
	char str1[12], str2[12];

	cin >> str1;
	cin >> str2;

	//int len = 0;

	if (strlen(str1) != strlen(str2) - 1) {
		cout << "No" << endl;
	}
	else {
		char add = str2[strlen(str2) - 1];
		str2[strlen(str2) - 1] = '\0';
		if (!strcmp(str1, str2) && (add >= 97 && add <= 122)) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3040
// Copyright (C) 2017 Sayutin Dmitry.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.

#include <iostream>
#include <vector>
#include <stdint.h>
#include <algorithm>
#include <set>
#include <map>
#include <array>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <string>
#include <assert.h>
#include <iterator>
#include <cstdint>
#include <cinttypes>
#include <string.h>
#include <random>
#include <numeric>
#include <tuple>


using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::min;
using std::abs;
using std::max;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define pb push_back
#define eb emplace_back


int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    // code here.
    int n = input<int>();
    int ans = 0;

    int prev_r = 0;
    
    for (int i = 0; i != n; ++i) {
        int a = input<int>();

        int lg = 0;
        while ((2 << lg) <= a)
            ++lg;


        if ((1 << lg) == a) {
            ans += lg;
            ans -= min(prev_r, lg);
            prev_r = lg;
        } else {
            ans += lg + 1;

            if (prev_r <= lg)
                ans -= prev_r, prev_r = lg + 1;
            else
                ans -= lg + 1, prev_r = lg;
            
        }
    }

    cout << ans << "\n";
    
    return 0;
}


Measured memory_bytes: 384
a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())
line = [a1, b1, a2, b2, a3, b3]
cnt = [0,0,0,0]
for i in range(6):
    if line[i] == 1:
        cnt[0] += 1
    elif line[i] == 2:
        cnt[1] += 1
    elif line[i] == 3:
        cnt[2] += 1
    else:
        cnt[3] += 1
cnt1 = 0
for j in range(4):
    if 0 < cnt[j] and cnt[j] < 3:
        cnt1 += 1
if cnt1 == 4:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int k;
    cin>>n>>k;
    int h[n];
    for(int i = 0; i<n; i++)
        cin>>h[i];
    int dp[n];
    dp[0] = 0;
    for(int i = 1; i<n; i++)
        dp[i] = INT_MAX;
     
    for(int i = 0; i<n; i++){
        for(int j = i+1; j<=i+k; j++){
            if(j<n){
                dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
                // dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));
            }
        }
    }
    cout<<dp[n-1]<<"\n";
}

Measured memory_bytes: 4420
#include <iostream>
using namespace std;
int main() {
    int N,D;
    cin >> N >> D;
    if (N%(D*2+1)==0) {
        cout << N/(D*2+1) << endl;
    }// Your code here!
    else {
        cout << (N/(D*2+1))+1 << endl;
    }
}


Measured memory_bytes: 3608
#include <iostream>

using namespace std;

int main() {
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  int max = 0;
  int sum = 0;
  for (int i = 0; i <= 2; i++) {
    //cout << a[i] << endl;
    if (a[i] > max) {
      max = a[i];
    }
    sum += a[i];
  }

  int goal = max * 3;
  int diff = goal  - sum;
  //cout << "sum:" << sum << endl;
  //cout << "max:" << max << endl;
  //cout << "goal:" << goal << endl;
  int times = diff / 2;
  if (goal % 2 != sum % 2) {
    times += 2;
  }
  cout << times << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;
 
#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
 
#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)
 
typedef long long ll;
typedef pair<int, int> pii;


int main(void)
{
	int n;
	while (cin >> n, n) {
		vector< pair<string, string> > vs;

		rep(i, n) {
			string a, b;
			cin >> a >> b;
			vs.push_back(make_pair(a, "START"));
			vs.push_back(make_pair(b, "END"));
		}
		sort(ALL(vs));

		int ans = 0, cnt = 0;
		rep(i, vs.size()) {
			if (vs[i].second == "START")
				cnt++;
			else
				cnt--;
			ans = max(ans, cnt);
		}
		cout << ans << endl;
	}
    return 0;
}

Measured memory_bytes: 3196
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(dead_code)]
pub const M: i64 = 1_000_000_007;

fn main() {
    input! {
        n: usize, m: usize,
        x: [i64; n],
        y: [i64; m]
    }

    let mut a = 0i64;
    for i in 0..n {
        let mut tmp = (2*i as i64 - n as i64 + 1) as i64 * x[i] % M;
        if tmp < 0 {tmp += M}
        a += tmp;
        a %= M;
    }
    let mut b = 0i64;
    for i in 0..m {
        let mut tmp = (2*i as i64 - m as i64 + 1) as i64 * y[i] % M;
        if tmp < 0 {tmp += M}
        b += tmp;
        b %= M;
    }
    println!("{}", a * b % M);
}


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

int main () {
  int W , H , N ;
  cin >> W >> H >> N ;
  int line[4] = {} ;
  line[1] = W ; line[3] = H ;
  for(int i = 0 ; i < N ; i++ )  {
    int a , b , c ;
    cin >> a >> b >> c ;
    if(c==1) line[0] = max(line[0],a) ;
    if(c==2) line[1] = min(line[1],a) ;
    if(c==3) line[2] = max(line[2],b) ;
    if(c==4) line[3] = min(line[3],b) ;
  }
  cout << max(0,(line[1]-line[0]))*max(0,(line[3]-line[2])) << endl ;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s1, s2;
    cin >> s1;
    cin >> s2;
    
    int ans = 0;
    for (int i = 0; i < 3; i++){
        if (s1[i] == s2[i])
            ans += 1;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>

#define MAX 1000000

using namespace std;

int fib[MAX];

int solve(int a){
    if(fib[a])return fib[a];
    if(!fib[a-2])fib[a-2] = solve(a-2);
    if(!fib[a-1])fib[a-1] = solve(a-1);
    return fib[a-1]+fib[a-2];
}

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    fill(fib, fib+MAX, 0);
    fib[0] = 1;
    fib[1] = 1;
    int num; cin >> num;
    cout << solve(num) << endl;
    
    return 0;
}



Measured memory_bytes: 7020
#include <iostream>

using namespace std;

int main()
{
  int r,d,x;cin>>r>>d>>x;
  int tempX=0;;
  for(int i=0;i<10;i++)
  {
      tempX=(r*x)-d;
      x=tempX;
      cout<<x<<endl;
  }

    return 0;
}


Measured memory_bytes: 256
x,k,d = map(int,input().split())

kk = k % 2
y = (x + d*kk) % (2*d)

z = abs(x) // d

if z >= k:
    print(abs(x) - (k*d))
else:
    if d >= y:
        print(y)
    else:
        print((2*d)-y)

Measured memory_bytes: 9172
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) {

        try (final Scanner sc = new Scanner(System.in)) {
            final int[] nums = new int[5];
            for (int i = 0; i < nums.length; i++) {
                nums[i] = sc.nextInt();
            }
            int result = 0;
            int maxPad = 0;
            for (int i = 0; i < nums.length; i++) {
                int pad = nums[i] % 10 == 0 ? 0 : 10 - (nums[i] % 10);
                maxPad = Math.max(maxPad, pad);
                result += nums[i] + pad;
            }
            result -= maxPad;
            System.out.println(result);
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
//#define inf 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define MP make_pair
#define PB push_back

typedef std::vector<int> Poly;
typedef std::pair<int,int> Pair;
typedef unsigned long long ull;
typedef long double ld;
typedef long long ll;

const int maxn = 400, maxm = 1e5, MAX = 1e6 + 5, mod = 998244353;
//template{{{
const long double Pi = 3.14159265358979323846l, Eps = 1e-4;
template <class T> inline bool equal(T x, T y) { return fabs(x - y) < Eps; }
inline int add(int x, int y) { x += y; return x >= mod ? x - mod : x; };
inline void inc(int &x, int y) { x += y; x -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y, int Mod = mod) {
	int ans = 1;
	while (y) {
		if (y & 1) ans = (ll) ans * x % Mod;
		x = (ll) x * x % Mod, y >>= 1;
	} return ans;
}

/*char buf[1<<23],obuf[1<<23],*p1=buf,*p2=buf, *O = obuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
void print(int x) {
    if(x > 9) print(x / 10);
    *O++=x%10+'0';
} */

template <class T> inline T	input() {
	T x; char ch; bool flag = false;
	while (!isdigit(ch = getchar())) flag |= ch == '-';
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return flag ? -x : x;
}

template <class T> inline bool chkmin(T &x, T y) { x = x < y ? x : y; return x == y; }
template <class T> inline bool chkmax(T &x, T y) { x = x > y ? x : y; return x == y; }
template <class T> inline T gcd(T x, T y) { return !y ? x : gcd(y, x % y); }
template <class T> inline T sqrm(T x) { return (ll) x * x % mod; }
template <class T> inline T sqr(T x) { return x * x; }

struct {
	inline operator int () { return input<int>(); }
	inline operator long long () { return input<long long>(); }
	template <class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read; //}}}

int T, n;
ll a[maxn + 5], d[100];
char s[maxn + 5];

void insert(ll x) {
	for (int i = 62; ~i; --i)
		if (1ll << i & x) {
			if (!d[i]) { d[i] = x; break; }
			else x ^= d[i];
		}
}

bool query(ll x) {
	for (int i = 62; ~i; --i)
		if (1ll << i & x) {
			if (!d[i]) return false;
			x ^= d[i];
		}
	return true;
}

void solve() {
	memset(d, 0, sizeof d);
	n = read;
	for (int i = 1; i <= n; ++i) read(a[i]);
	scanf("%s", s + 1);

	for (int i = n; i; --i) {
		if (s[i] == '0') insert(a[i]);
		else if (!query(a[i])) return puts("1"), void();
	}
	puts("0");
}

signed main() {
#ifdef local
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	freopen("log", "w", stderr);
#endif

	read(T);
	while (T--) solve();
	return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,k;
  cin >> n >> k;
  vl h(n);
  rep(i,n){
    cin >> h[i];
  }
  sort(rng(h));
  ll ans = 1001001001001;
  rep(i,n){
    if(i+k-1>=n)continue;
    ll diff = h[i+k-1]-h[i];
    mins(ans,diff);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A&lang=jp
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 100000
#define MAX_E 100000

int par[MAX], rank_[MAX];

void init(int N)
{
	for(int i=0;i<N;i++)

	{
		par[i] = i;
		rank_[i] = 0;
	}
}

int find(int x)
{
	if (par[x] == x)
	{
		return x;

	}
	return par[x] = find(par[x]);

}

void unite(int x, int y)
{
	x = find(x);
	y = find(y);
	if (x == y)
	{
		return;
	}

	if (rank_[x] < rank_[y])
	{
		par[x] = y;
	}
	else
	{
		par[y] = x;
	}
	if (rank_[x] == rank_[y])
	{
		rank_[x]++;
	}
}


bool same(int x, int y)
{
	return find(x) == find(y);
}

struct edge
{
	int u, v, cost;
};

bool comp(const edge &e1, const edge &e2)
{
	return e1.cost < e2.cost;
}

int V, E;
edge es[MAX_E];

int kruskal()
{
	sort(es, es + E, comp);
	init(V);
	int res = 0;
	for (int i = 0; i < E; i++)
	{
		if (!same(es[i].u, es[i].v))
		{
			unite(es[i].u, es[i].v);
			res += es[i].cost;
				
		}
	}
	return res;
}

int main()
{
	cin >> V >> E;
	for (int i = 0; i < E; i++)
	{
		cin >> es[i].u >> es[i].v >> es[i].cost;
	}
	cout << kruskal() << endl;
	return 0;
	
}






Measured memory_bytes: 4328
'use strict';
process.stdin.on('data', function(chunk) {
  var lines = chunk.toString().split('\n');
  var params = lines[0].split(' ').map(Number)
  var result = (function(a,b,c) {
   return {true:'Yes',false:'No'}[(a < b && b < c)];

  }(params[0],params[1],params[2]
  ));

  console.log(result);
});

process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 7648
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define souatari rep1(i,n-1)rep(j,i)
#define souatari1 for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
const ll BIG = 10000000000000000;

const int MAX = 1000005;
long long fac[MAX], finv[MAX], inv[MAX];

//必ずCOMinit()をmain関数に書くこと
void COMinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++){
                fac[i] = fac[i - 1] * i % MOD;
                inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
                finv[i] = finv[i - 1] * inv[i] % MOD;
        }
}

long long COM(int n, int k){
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){ 
    COMinit();
    int xtmp,ytmp;
    cin >> xtmp >> ytmp;
    int x,y;
    x = min(xtmp,ytmp);
    y = max(xtmp,ytmp);


    if ((x+y) % 3 != 0){
        cout << 0 << endl;
        return 0;
        }
    elif (y>x*2){
        cout << 0 << endl;
        return 0;
    }

    int sa = y-x;

    int x1 = 0;
    int x2 = 0;
    

    x1+=(x-sa)/3;
    x2+=(x-sa)/3;
    x1+=sa;

    cout << COM(x1+x2,x1) << endl;

    return 0;






    




}

Measured memory_bytes: 23680
import Control.Applicative ((<$>))

main :: IO ()
main = do
  [a, b] <- map read . words <$> getLine :: IO [Int]
  let (x, y) = extgcd a b
  putStrLn $ show x ++ " " ++ show y

extgcd :: Int -> Int -> (Int, Int)
extgcd a 0 = (1, 0)
extgcd a b = (x, y-a`div`b*x)
  where
    (y, x) = extgcd b (a `mod` b)

Measured memory_bytes: 3640
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N;
    cin >> N;
    map<ll, ll> A;
    REP(i, N)
    {
        ll a;
        cin >> a;
        A[a]++;
    }

    A[0] = 0;
    ll first = 0, second = 0;
    for (auto x : A)
    {
        ll key = x.first, value = x.second;
        if (value >= 2)
        {
            if (key >= first)
            {
                second = first;
                first = key;
            }
            else if (key >= second)
            {
                second = key;
            }
        }
    }

    ll l, s;
    if (A.at(first) >= 4)
    {
        l = first;
        s = first;
    }
    else
    {
        l = first;
        s = second;
    }

    cout << l * s << endl;

    return 0;
}


Measured memory_bytes: 9280
#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = a; i <= b; ++i)
#define mp make_pair
#define SIZE 2010
#define ll long long
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
ll n;

int main() {
	io(); cin >> n;
	int ans = 1;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i == 0) {
			ll tmp = n;
			while (tmp % i == 0) tmp /= i;
			if ((tmp - 1) % i == 0) ans++;
			tmp = n;
			if (i * i == n) continue;
			ll x = n / i;
			while (tmp % x == 0) tmp /= x;
			if ((tmp - 1) % x == 0) ans++;
		}
	}
	if (--n > 1) ++ans;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i == 0) {
			ans += 2;
			if (i * i == n) --ans;
		}
	}
	cout << ans;
}

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

const string ACGTstrSet = "ACGT";

int main()
{
    string s;
    cin >> s;

    int maxLength = 0, singleContinuous = 0;
    for (const char &singleChar : s)
    {
        if (count(ACGTstrSet.begin(), ACGTstrSet.end(), singleChar))
        {
            ++singleContinuous;
        }
        else
        {
            maxLength = max(maxLength, singleContinuous);
            singleContinuous = 0;
        }
    }

    maxLength = max(maxLength, singleContinuous);

    cout << maxLength << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main(){
    /*以下コード*/
  long long x,k,d;
    cin>>x>>k>>d;
    x=abs(x);
    if(x/d>=k)cout<<x-k*d<<endl;
    else {
      long long cnt=x/d;
      long long ans=x%d;
      k-=cnt;
      if(k%2)cout<<d-ans<<endl;
      else cout<<ans<<endl;
    }
}


Measured memory_bytes: 3580
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,M = map(int,input().split())
XY = [[int(x) for x in input().split()] for _ in range(M)]

# 各時点でのボールの合計個数、赤の最大個数（0 or 1）を持つ

ball = [None] + [1] * N
red = [None] + [1] + [0] * (N-1)

for x,y in XY:
    if red[x] == 0:
        # 必ず白をうつす
        ball[x] -= 1
        ball[y] += 1
        continue
    if red[x] == 1:
        if ball[x] == 1:
            # 必ず赤をうつす
            red[x] = 0
            ball[x] -= 1
            red[y] = 1
            ball[y] += 1
        else:
            # どちらかをうつす
            ball[x] -= 1
            ball[y] += 1
            red[y] = 1

answer = sum(red[1:])
print(answer)

ball

red



Measured memory_bytes: 24252
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    char s[10];
    cin>>s;
    printf("%d\n",(s[0]-'0')+(s[1]-'0')+(s[2]-'0'));
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979323846264338327950L
int main(void) {
 int a, b, h, m;
scanf("%d%d%d%d", &a, &b, &h, &m);
long double rad = PI * 2 * (
 (long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long
double)m / 60.0);
long double rsq = (long double)(a * a + b * b) - (long double)(2 * a *
b) * cosl(rad);
printf("%20.20Lf\n", sqrtl(rsq));
return 0;
}

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

int main(){
    int num,target,cnt;
    cin>>num>>target;

    vector<int> number(num*2);
    for (int i = 0; i < number.size(); i++) {
    cin >> number.at(i);
    }

    for(int j=0;j<number.size();j+=2){
        int suuti1,suuti2;
        suuti1=number[j];
        suuti2=number[j+1];
        double col=pow(suuti1,2)+pow(suuti2,2);
        double judge=sqrt(col);
        if(target>=judge){
            cnt+=1;
        }
    }
    cout<<cnt<<endl;
}    

Measured memory_bytes: 4872
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let mut s = sc.chars();
    s.sort();
    if s[0] == s[1] && s[2] == s[3] && s[1] != s[2] {
        println!("Yes");
    } else {
        println!("No");
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
public:
    input()
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var) { return std::cin >> var, *this; }
    template <class T>
    inline input& operator,(T& var) { return *this >> var; }

    template <class T>
    inline T read()
    {
        T var;
        std::cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            std::cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            std::cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            std::cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

    template <class T, class... Args>
    void impl(T&& v, Args&&... args)
    {
        cout << std::forward<T>(v) << ' ';
        impl(std::forward<Args>(args)...);
    }
    template <class T>
    void impl(T&& v)
    {
        cout << std::forward<T>(v);
    }

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class... Args>
    void operator()(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
        cout << '\n';
    }
    template <class... Args>
    void noreturn(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
        cout << '\n';
    }
};

template <class Integer>
Integer ceil(Integer x, Integer y)
{
    return (x + y - 1) / y;
}

void prog()
{
    input in;
    output out;
    std::uint64_t h, w;
    in >> h, w;
    if (h == 1 || w == 1) {
        out(1);
    } else {
        out(ceil(h * w, std::uint64_t{2}));
    }
}

int main()
{
    prog();
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// ここにコードを挿入
		Scanner s = new Scanner(System.in);
		long l = s.nextLong();
		for(long i = 0; i < l; i++) {
			if((i + 2) * (i + 1) >= l * 2) {
				System.out.println(i + 1);
				break;
			}
		}

	}

}

Measured memory_bytes: 21844
H,W=map(int, raw_input().split())
#print H,W

c=[-1,0,1,2]

#tate,tate
def calc_t_t(h,w):
	if w%3==0:
		A1=h*int(w/3)
		A2=h*int(w/3)
		A3=h*w-A1-A2
	else:
		A1=h*(w/3)
		A2=h*((w-int(w/3))/2)
		A3=h*w-A1-A2
	a=[A1,A2,A3]
	#print a
	return max(a)-min(a)


#tate,yoko
def calc_t_y(h,w):
	a=[]
	if w==2:
		A1=h*w/2
		A2=1*h/2
		A3=h*w-A1-A2
		a.append([A1,A2,A3])
	else:

		w_tmp=int(h*w/3)/h
		#print w_tmp
		for j in c:
			if w_tmp+j<=w and w>0:
				A1=h*(w_tmp+j)
				A2=h/2*(w-(w_tmp+j))
				A3=h*w-A1-A2
				a.append([A1,A2,A3])
			


	#print a
	min_a=0
	for i in a:
		if min_a==0 or min_a>max(i)-min(i):
			min_a=max(i)-min(i)
	return min_a

b=[]
b.append(calc_t_t(H,W))
b.append(calc_t_t(W,H))
b.append(calc_t_y(H,W))
b.append(calc_t_y(W,H))

print min(b)




Measured memory_bytes: 2696
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
    r := bufio.NewReader(os.Stdin)

    var N,  K int

    if _, e := fmt.Fscan(r, &N, &K); e != nil {
    	return
	}
	hitpointsInterfaces := make([]interface{}, N)
	hitpointsInts := make([]int, N)
	for i, _:= range hitpointsInts {
		hitpointsInts[i] = 0
		hitpointsInterfaces[i] = &hitpointsInts[i]
	}

	result := 0
	if  N >= K {
		fmt.Fscan(r, hitpointsInterfaces...)
		sort.Sort(sort.Reverse(sort.IntSlice(hitpointsInts)))
		result = calcAtackCount(hitpointsInts, K)
	}
	fmt.Println(result)
}

func calcAtackCount(points []int, k int) int {
	return sum(points[k:])
}

func sum(a []int) int {
	result := 0
	for _, v := range a {
		result += v
	}
	return result
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int cnt[100005] = {};
signed main() {
    int N,A,B;
    cin >> N >> A >> B;
    cout << max(0LL,B*(N-1)+A-(A*(N-1)+B)+1) << endl;
}


Measured memory_bytes: 3600
N = int(input())
li = []
for _ in range(N):
    a, b = list(map(int,input().split()))
    li.append([b,a,b])

flag = True
now = 0
li = sorted(li)

for a, b, c in li:
    now += b
    if now > c:
        print("No")
        flag = False
        break
        
if flag:
    print("Yes")

Measured memory_bytes: 38104
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#include <time.h> //for clock
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
using ll = long long;

int main(){
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> v;

    int i, b;
    for(i = 0; i < m; i++){
        cin >> b;
        v.push_back(b);
    }

    int sum = 0;
    int a;
    int j;
    int count = 0;
    for(i = 0; i < n; i++){
        sum = 0;
        for(j = 0; j < m; j++){
            cin >> a;
            sum += v[j] * a;
        }
        if(sum+c > 0){
            count++;
        }
    }

    cout << count << endl;
}

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

int main(){
	int n[25565] = {0};
	int x[25565] = {0};
	int m[25565] = {0};
	int l;
	do{
		cin >> n[l] >> x[l];
		l++;
	}while(n[l-1] != 0 || x[l-1] != 0);
	l = 0;
	do{
		for (int i = 1; i <= n[l]-2; ++i)
		{
			for (int j = i + 1; j <= n[l]-1; ++j)
			{
				for (int k = j + 1; k <= n[l]; ++k)
				{
					if((i + j + k) == x[l]){
						m[l]++;
					}
				}
			}
		}
		l++;
	}while(n[l] != 0 && x[l] != 0);
	l = 0;
	do{
		cout << m[l] << endl;
		l++;
	}while(n[l] != 0 || x[l] != 0);
}

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

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
#define REP(i, n)  for(int i = 0; i < n; ++i)
#define FOR(i, t, n)  for(ll i = t; i <= (ll)n; ++i)
struct edge {
    int from, to;
    ll cost;
};


class Eratosthenes {
public:
    vector<bool> prime;

    Eratosthenes(int size) {
        prime.resize(size + 1, 1);
        prime[0] = 0;
        prime[1] = 0;
        FOR(i, 2, size) {
            if (prime[i]) {
                for (int j = 2 * i; j <= size; j += i) {
                    prime[j] = 0;
                }
            }
        }
    }

};


class Combination {
    vector<ll> fac; //n!(mod M)
    vector<ll> ifac; //k!^{M-2} (mod M)
public:
    Combination(ll size) {
        fac.resize(size);
        ifac.resize(size);
        fac[0] = 1;
        ifac[0] = 1;
        for (ll i = 0; i < size; i++) {
            fac[i + 1] = fac[i] * (i + 1) % MOD;
            ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD;
        }
    }

    ll mpow(ll x, ll n) {
        ll ans = 1;
        while (n != 0) {
            if (n & 1) ans = ans * x % MOD;
            x = x * x % MOD;
            n = n >> 1;
        }
        return ans;
    }

    ll comb(ll a, ll b) {
        if (a == 0 && b == 0)return 1;
        if (a < b || a < 0)return 0;
        ll tmp = ifac[a - b] * ifac[b] % MOD;
        return tmp * fac[a] % MOD;
    }
};


ll GCD(ll a, ll b) {
    if (b == 0)return a;
    return GCD(b, a % b);
}

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

int N, K;

int main() {
    cin >> N;
    vector<ll> A(N);
    int c = 0;
    REP(i, N) {
        cin >> A[i];
        if (A[i] % 2)c++;
    }
    if (c % 2)cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 1152