akhauriyash/Code-Regression huggingface dataset:
var output;
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//1:数値へ変換 2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字に分割 7:1文字に分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main() {
  var one = myconv(next(),4);
  var H = one[0];
  var N = one[1];
  var list = myconv(next(),4);
  var sum = 0;
  for(var i = 0; i < N; i++){
    sum += list[i];
  }
  if(sum >= H){
     myout("Yes");
     }else{
     myout("No");
     }
}

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

void solve(long long N, vector<long long> D, long long M, vector<long long> T){
	map<int,int> v;
	for(int i = 0 ; i < N ; i++) v[D[i]]++;
	for(int i = 0 ; i < M ; i++)
		if( v[T[i]]-- ){
		
		}else{
			cout << "NO" << endl;
			return;
		}
	cout << "YES" << endl;	
}

int main(){	
	long long M;
	long long N;
	scanf("%lld",&N);
	vector<long long> D(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&D[i]);
	}
	scanf("%lld",&M);
	vector<long long> T(M-1+1);
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&T[i]);
	}
	solve(N, D, M, T);
	return 0;
}


Measured memory_bytes: 15872
N = int(input())
arr = list(map(int, input().split()))
jump_flg = [0]*N

for i in range(N-1):
    if arr[i] >= arr[i+1]:
        jump_flg[i] =1

ans = 0
count = 0
for i in range(N):
    if jump_flg[i] == 1:
        count +=1
        if ans<count:
            ans =count
    else:
        count =0

print(ans)


Measured memory_bytes: 64220
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> a(N+1, 0);
    for(int i = 1; i < N+1; i++) cin >> a[i];
    for(int i = K+1; i <= N; i++){
        if(a[i-K] < a[i]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

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

int main(){
  string s;long long k,one=0;cin>>s>>k;
  REP(i,s.size()){
    if(s.at(i)=='1') one++;
    else break;
  }
  cout<<(k<=one?'1':s.at(one));
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    string S;
    cin >> S;
    
    bool flag = true;

    rep(i,S.size()-1)
    {
        if(S[i] == S[i+1])
        {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int N = in.nextInt();
		int K = in.nextInt();
		int sum = 0;
		for(int i=0; i<N; i++) {
			int x = in.nextInt();
			int d = Math.abs(x-K);
			if(Math.abs(x) < d) {
				sum += 2*x;
			}else {
				sum += 2*d;
			}
		}
		System.out.println(sum);
		
		
		in.close();
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.size(); i++) {
        if (s[i]-'0' != i%2)
            ans += 1;
    }
    cout << min(ans, int(s.size()-ans)) << endl;
    return 0;
}




Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;

int cnt = 0;
string t(10, '#');

bool check753(string s) {
	bool seven = false, five = false, three = false;
	for ( int i = 0; i < s.size(); i++ ) {
		if ( s[i] == '7' ) seven = true;
		if ( s[i] == '5' ) five = true;
		if ( s[i] == '3' ) three = true;
	}
	if ( seven && five && three ) {
		return true;
	}
	else {
		return false;
	}
}

void generate753( int i, int n, string s ) {
	if ( i == n ) {
		string num = t.substr(0, n);
		if ( stoi(num) <= stoi(s) && check753( num ) ) {
			cnt++;
		}
		return;
	}
		
	t[i] = '3';
	generate753(i + 1, n, s);
	t[i] = '5';
	generate753(i + 1, n, s);
	t[i] = '7';
	generate753(i + 1, n, s);
}


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

	for ( int i = 1; i <= s.size(); i++ ) {
		generate753(0, i, s);
	}

	cout << cnt << endl;
}


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

using namespace std;

class Point {
public:
	int id, x, y;
	Point() {
	}
	Point(int id, int x, int y) :
			id(id), x(x), y(y) {
	}
	bool operator <(const Point &p) const {
		return id < p.id;
	}
	void print() {
		printf("%d\n", id);
	}
};
class Node {
public:
	int location, l, r;
};
bool lessX(const Point &p1, const Point &p2) {
	return p1.x < p2.x;
}
bool lessY(const Point &p1, const Point &p2) {
	return p1.y < p2.y;
}
int np = 0;
const int MAX = 500000;
Point P[MAX];
Node T[MAX];
const int NIL = -1;

int makeKdTree(int l, int r, int depth) {
	if (!(l < r))
		return NIL;

	if (depth % 2 == 0) {
		sort(P + l, P + r, lessX);
	} else {
		sort(P + l, P + r, lessY);
	}

	int t = np++;
	int mid = (l + r) / 2;
	T[t].location = mid;
	T[t].l = makeKdTree(l, mid, depth + 1);
	T[t].r = makeKdTree(mid + 1, r, depth + 1);

	return t;
}
void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point> &ans) {
	int x = P[T[v].location].x;
	int y = P[T[v].location].y;
	if (sx <= x && x <= tx && sy <= y && y <= ty) {
		ans.push_back(P[T[v].location]);
	}
	if (depth % 2 == 0) {
		if (T[v].l != NIL) {
			if (sx <= x)
				find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
		}
		if (T[v].r != NIL) {
			if (x <= tx)
				find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
		}
	} else {
		if (T[v].l != NIL) {
			if (sy <= y)
				find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
		}
		if (T[v].r != NIL) {
			if (y <= ty)
				find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
		}
	}
}
int main() {

	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		int x, y;
		scanf("%d %d", &x, &y);
		P[i] = Point(i, x, y);
		T[i].location = T[i].l = T[i].r = NIL;
	}

	int root = makeKdTree(0, n, 0);

	int q;
	scanf("%d", &q);
	int sx, tx, sy, ty;
	vector<Point> ans;
	for (int i = 0; i < q; ++i) {
		scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
		ans.clear();
		find(root, sx, tx, sy, ty, 0, ans);
		sort(ans.begin(), ans.end());
		for (int i = 0; i < ans.size(); ++i) {
			ans[i].print();
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 14640
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll N;
    cin >> N;
    string S[100010];
    rep(i,0,N) cin >> S[i];
    map<string,ll> mp;
    rep(i,0,N) mp[S[i]]++;
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;


    

}

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

Measured memory_bytes: 6796
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define rt return
using dbl = double;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

set<int> G[200001];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N, M;
    cin >> N >> M;
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        G[a].insert(b);
        G[b].insert(a);
    }
    int ok = 0;
    each(v, G[1]) {
        if (G[v].count(N)) {
            ok = 1;
            break;
        }
    }
    cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}


Measured memory_bytes: 28416
fun main() {
    val (n, h) = longList()
    var d = 0L
    var c = 0L
    val katana = mutableListOf<Katana>()
    repeat(n.toInt()) {
        val (a, b) = longList()
        katana.add(Katana(it, a, b))
    }
    katana.sortByDescending { it.b }
    val attack = katana.maxBy { it.a }!!
    katana.forEach {
        if (it.b <= attack.a) {
            c += ((h - d) / attack.a).toInt()
            if ((h - d) % attack.a > 0) {
                c++
            }
            println("$c")
            return
        } else {
            d += it.b
            c++
            if (d >= h) {
                println("$c")
                return
            }
        }
    }
    c += ((h - d) / attack.a).toInt()
    if ((h - d) % attack.a > 0) {
        c++
    }
    println("$c")
}

fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
data class Katana(val i: Int, val a: Long, val b: Long)


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

int K, S;
int main() {
    std::cin >> K >> S;

    long cnt = 0;
    for(int X=0; X<=K; ++X) {
        for(int Y=0; Y<=K; ++Y) {
            int Z = S - X - Y;
            if(Z >= 0 && Z <= K) {
                cnt++;
            }
        }
    }
    std::cout << cnt << std::endl;
}

Measured memory_bytes: 256
package main

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

func main() {
	fmt.Printf("%d\n", resolve(parseProblem(os.Stdin)))
}

func parseProblem(r io.Reader) int {
	var n int
	fmt.Fscanf(r, "%d", &n)
	sc := bufio.NewScanner(r)
	sc.Split(bufio.ScanWords)
	testimonies := []testimony{}
	for i := 0; i < n; i++ {
		testimonies = append(testimonies, parseTestimony(sc))
	}
	max := uint32(0)
	for i := 0; i < 1<<uint32(n); i++ {
		if checkAllHornest(n, uint32(i), testimonies) {
			numH := onesCount(uint32(i))
			if max < numH {
				max = numH
			}
		}
	}
	return int(max)
}

func checkAllHornest(n int, i uint32, testimonies []testimony) bool {
	flag := 1
	idx := 0
	for idx < n {
		if i&uint32(flag) == uint32(flag) {
			if i&testimonies[idx].l != i {
				return false
			}
			if i|testimonies[idx].h != i {
				return false
			}
		}
		flag <<= 1
		idx++
	}
	return true
}

func onesCount(bits uint32) (num uint32) {
	num = (bits >> 1) & 03333333333
	num = bits - num - ((num >> 1) & 03333333333)
	num = ((num + (num >> 3)) & 0707070707) % 077
	return
}

type testimony struct{ h, l uint32 }

func parseTestimony(sc *bufio.Scanner) (t testimony) {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	t.l, t.h = math.MaxUint32, 0
	for i := 0; i < n; i++ {
		sc.Scan()
		idx, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		horneset, _ := strconv.Atoi(sc.Text())
		if horneset == 0 {
			t.l ^= 1 << uint32(idx-1)
		} else {
			t.h |= 1 << uint32(idx-1)
		}
	}
	return
}

func resolve(n int) int {
	return n
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
using lint = long long;

int main()
{
    lint n, h;
    scanf("%lld", &n);
    scanf("%lld", &h);

    std::vector<lint> a(n);
    std::vector<lint> b(n);

    for (int i = 0; i < n; ++i)
    {
        scanf("%lld", &a[i]);
        scanf("%lld", &b[i]);
    }

    std::sort(a.begin(), a.end());
    std::sort(b.begin(), b.end());

    lint damage = 0;
    lint ans = 0;

    while (damage < h)
    {
        if (!b.empty() && b.back() > a.back())
        {
            damage += b.back();
            b.pop_back();
            ans++;
        }
        else
        {
            lint remain = h - damage;
            if (remain % a.back() == 0)
            {
                ans += remain / a.back();
            }
            else
            {
                ans += remain / a.back() + 1;
            }
            break;
        }
    }

    printf("%lld", ans);

    return 0;
}


Measured memory_bytes: 1920
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const int INF = 2000000000;

    ll N,M;
    ll A[101],X[101],C;
    std::string S[4],T;
    bool F=false;
    ll ans=0;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N>>S[0]>>S[1]>>S[2];
    REP(i,N){
        unordered_set<char> Q;
        REP(k,3){
            Q.insert(S[k][i]);
        }
        if(Q.size()==3)ans+=2;
        if(Q.size()==2)ans+=1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            line.pop();
            line
        }
    )
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let iter = line.split_whitespace();
            iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    )
}

fn solve(k: u64) -> u64 {
    use std::collections::VecDeque;
    use std::rc::Rc;

    let mut deque = Rc::new(VecDeque::new());
    let mut memo = vec![std::u64::MAX; k as usize];

    Rc::make_mut(&mut deque).push_front((1, 1));
    memo[1] = 1;

    while !deque.is_empty() {
        let mut nd = Rc::new(VecDeque::new());

        for &(i,j) in deque.iter() {
            {
                let n = (i*10) % k;

                if j < memo[n as usize] {
                    memo[n as usize] = j;
                    Rc::make_mut(&mut nd).push_front((n, j));
                }
            }

            {
                let n = (i+1) % k;
                if j+1 <memo[n as usize] {
                    memo[n as usize] = j+1;
                    Rc::make_mut(&mut nd).push_back((n, j+1));
                }
            }
        }

        deque = nd;
    }

    memo[0]
}

fn main() {
    let k = parse_line!(u64);
    println!("{}", solve(k));
}

#[test]
fn solve_test() {
    assert_eq!(solve(6), 3);
    assert_eq!(solve(41), 5);
    assert_eq!(solve(4), 1);
    assert_eq!(solve(79992), 36);
}


Measured memory_bytes: 10492
function main(input) {
    const [ A, B, C, D ] = input.split(' ').map( n => parseInt(n, 10) );

    if( A + B > C + D ) {
        console.log('Left');
    } else if( A + B < C + D ) {
        console.log('Right');
    } else {
        console.log('Balanced');
    }
}

main( require('fs').readFileSync('/dev/stdin', 'utf8') )

Measured memory_bytes: 29632
from collections import Counter

n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]

c1 = Counter(s)
c2 = Counter(t)

MAX=0
for k1 in c1.keys():
  count = c1[k1]
  for k2 in c2.keys():
    if k1==k2:
      count -= c2[k2]
  MAX = max(MAX,count)

print(MAX)

Measured memory_bytes: 9412
import collections

N = int(input())
A = sorted([int(a) for a in input().split()], reverse=True)

result = 0
max_a = A[0]
hash = {A[0]: 1}
next_max_a = collections.deque()
for i in range(1, len(A)):
    a = A[i]
    hash[max_a] -= 1
    result+=max_a

    if not(a in hash):
        hash[a] = 0
        next_max_a.append(a)
    hash[a] += 2

    if hash[max_a] <= 0:
        hash.pop(max_a)
        max_a = next_max_a.popleft()
print(result)

Measured memory_bytes: 32396
#include <stdio.h>

int fig[7][4][2] = {{{0, 0}, {1, 0}, {0, 1}, {1, 1}}, 
					{{0, 0}, {0, 1}, {0, 2}, {0, 3}}, 
					{{0, 0}, {1, 0}, {2, 0}, {3, 0}}, 
					{{1, 0}, {0, 1}, {1, 1}, {0, 2}}, 
					{{0, 0}, {1, 0}, {1, 1}, {2, 1}}, 
					{{0, 0}, {0, 1}, {1, 1}, {1, 2}}, 
					{{1, 0}, {2, 0}, {0, 1}, {1, 1}}};

int main(void)
{
	int a[8][8];
	int i, j, k, l;
	char str[8][9];
	int flag;

	i = 0;
	while (1){
		flag = 0;
		for (i = 0; i < 8; i++){
			if (scanf("%s", str[i]) == EOF){
				flag = 1;
			}
		}

		if (flag)break;

		flag = 0;
		for (i = 0; i < 8; i++){
			for (j = 0; j < 8; j++){
				for (k = 0; k < 7; k++){
					if (fig[k][0][1] + i < 8 && fig[k][0][0] + j < 8 &&
						str[fig[k][0][1] + i][fig[k][0][0] + j] == '1'){
						for (flag = 1, l = 1; l < 4; l++){
							if ((fig[k][l][1] + i >= 8 || fig[k][l][0] + j >= 8) ||
								str[fig[k][l][1] + i][fig[k][l][0] + j] == '0'){
								flag = 0;
								break;
							}
						}
					}
					if (flag)break;
				}
				if (flag)break;
			}
			if (flag)break;
		}

		printf("%c\n", 'A' + k);
	}

	return (0);
}

Measured memory_bytes: 536
#!/usr/bin/env python3
import sys


def solve(H: int, W: int, h: int, w: int):
    return (H - h) * (W - w)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    h = int(next(tokens))  # type: int
    w = int(next(tokens))  # type: int
    print(solve(H, W, h, w))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#define mod 1000000007
using namespace std;
#define LL long long int 
int main() 
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    LL N;
    cin  >> N;
    vector<LL> arr(N);
    for(auto &it:arr)
    {
        cin>>it;
    }
    vector<LL> prefix(N);
    prefix[N-1]=arr[N-1];
    for(LL i=N-2;i>=0;i--)
    {
        prefix[i]=(prefix[i+1]+arr[i])%mod;
    }
    LL prod=0;
    for(LL i=0;i<N-1;i++)
    {
        prod=(prod +(arr[i]*prefix[i+1] ) %mod )%mod;
    }
    cout<<prod;

}
 
 

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int ans = 1;
  for (int i=0; i<N; i++) {
    if (ans < K) {
      ans *= 2;
    } else {
      ans += K;
    }
  }
  cout << ans << endl;
  
  return 0;
}


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

//オーバーフロー
//コーナーケース

typedef long long ll;

void yes() {
    cout << "Yay!" << endl;
}
void no() {
    cout << ":(" << endl;
}

ll a[1<<18];
int main() {
    int n;
    cin >> n;
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
        if (i != 0) {
            a[i] += a[i - 1];
        }
    }
    ll ans = sum;
    for (int i = 0; i < n; i++) {
        ans = min(ans, abs(a[i] - (sum - a[i])));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
#input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())



def main():
	n=II()
	X=[]
	Y=[]
	for i in range(n):
		x,y=MI()
		X.append((x,i))
		Y.append((y,i))
	X.sort()
	Y.sort()
	#print(X,Y)

	li=[]
	for i in range(n-1):
		li.append((X[i+1][0]-X[i][0],X[i+1][1],X[i][1]))
		li.append((Y[i+1][0]-Y[i][0],Y[i+1][1],Y[i][1]))
	li.sort()
	#rint(li)

	UF=UnionFind(n)
	k=0
	ans=0
	for d,s,t in li:
		if k==n-1:
			break
		if UF.same(s,t):
			continue
		else:
			ans+=d
			UF.union(s,t)
			k+=1
	print(ans)

if __name__ == "__main__":
	main()

Measured memory_bytes: 51704
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define MP make_pair
#define pb push_back
#define SIZE 100005

using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef long long LL;

static const int INF = INT_MAX;
static const int MIN = INT_MIN;
static const LL L_INF = LLONG_MAX;
static const int MOD = 1000000000 + 7;

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

    int n;
    string s;
    cin >> n >> s;
    vector< pair< int, bool > > stone;

    bool color;
    //true: 白, false: 黒
    if( s[0] == '.' ) color = true;
    else color = false;

    int cnt = 0;
    for( int i = 0; i < s.size(); ++i ) {
        if( s[i] == '.' && !color ) {
            stone.pb( MP( cnt, color ) );
            cnt = 0;
            color = true;

        } else if( s[i] == '#' && color ) {
            stone.pb( MP( cnt, color ) );
            cnt = 0;
            color = false;

        }
        ++cnt;

    }
    stone.pb( MP( cnt, color ) );

    int res = INT_MAX;
    int white = 0, black = 0;

    for( int i = 0; i < stone.size(); ++i ) {
        if( stone[i].S ) white += stone[i].F;

    }

    res = white + black;
    for( int i = 0; i < stone.size(); ++i ) {
        if( stone[i].S ) white -= stone[i].F;
        else black += stone[i].F;
        res = min( res, white + black );

    }

    cout << res << endl;


        return 0;
}



Measured memory_bytes: 2700
from collections import deque

n, m = map(int, input().split())
xyz = []
for _ in range(m):
    x, y, z = map(int, input().split())
    xyz.append((x, y, z))


uf = [-1]*(n+1)
def find(i):
    if uf[i] < 0:
        return i
    else:
        uf[i] = find(uf[i])
        return uf[i]

for x, y, z in xyz:
    px, py = find(x), find(y)
    
    if px != py:
        px, py = (px, py) if uf[py] < uf[px] else (px, py)
        uf[px] += uf[py]
        uf[py] = px

# print(uf)
ans = sum([1 for i in range(1, n+1) if uf[i] < 0])
print(ans)


Measured memory_bytes: 19292
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// ABC059 C-Sequence
// 2020.06.03

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N; cin >> N;
  vector<ll> A(N, 0);
  REPLL(i, N){
    cin >> A[i];
  }
  ll ansP = 0, ansM = 0;
  ll sumP = 0, sumM = 0;
  REPLL(i, N){
    ///////////////////////////////////////////////
    if(sumP <= 0){ // マイナス又は初期値のとき（次はプラスになる）
      if(A[i] >= 0){ //　A[i]がプラスのとき
        sumP += A[i];
        if(sumP <= 0){ // まだマイナスなら
          ansP += 1-sumP;
          sumP = 1;
        }
      }else{ // A[i]がマイナスのとき
        ansP += 1-A[i]; // 最低のプラスにしてやる
        sumP += 1;
        if(sumP <= 0){ // まだマイナスなら
          ansP += 1-sumP;
          sumP = 1;
        }
      }
    }else{ // プラスのとき（次はマイナスになる）
      if(A[i] <= 0){ //　A[i]がマイナスのとき
        sumP += A[i];
        if(sumP >= 0){ // まだプラスなら
          ansP += 1+sumP;
          sumP = -1;
        }
      }else{ // A[i]がプラスのとき
        ansP += 1+A[i]; // 最低のマイナスにしてやる
        sumP += -1;
        if(sumP >= 0){ // まだプラスなら
          ansP += 1+sumP;
          sumP = -1;
        }
      }     
    }
    ///////////////////////////////////////////////
    if(sumM < 0){ // マイナスのとき（次はプラスになる）
      if(A[i] >= 0){ //　A[i]がプラスのとき
        sumM += A[i];
        if(sumM <= 0){ // まだマイナスなら
          ansM += 1-sumM;
          sumM = 1;
        }
      }else{ // A[i]がマイナスのとき
        ansM += 1-A[i]; // 最低のプラスにしてやる
        sumM += 1;
        if(sumM <= 0){ // まだマイナスなら
          ansM += 1-sumM;
          sumM = 1;
        }
      }
    }else{ // プラス又は初期値のとき（次はマイナスになる）
      if(A[i] <= 0){ //　A[i]がマイナスのとき
        sumM += A[i];
        if(sumM >= 0){ // まだプラスなら
          ansM += 1+sumM;
          sumM = -1;
        }
      }else{ // A[i]がプラスのとき
        ansM += 1+A[i]; // 最低のマイナスにしてやる
        sumM += -1;
        if(sumM >= 0){ // まだプラスなら
          ansM += 1+sumM;
          sumM = -1;
        }
      }     
    }
  }
  ll ans = min(ansP, ansM);
  cout << ans << endl;
}


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

const int inf = 1e17;

signed main(){

    int n,k;    cin >> n >> k;
    int h[n];
    for(int x=0;x<n;x++)    cin >> h[x];

    sort(h,h+n);

    int l = 0 , r = k-1;
    int ans = inf;


    while(r < n){
        ans = min(ans , h[r++] - h[l++]);
    }

    cout << ans;



    return 0;
}

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


int main()
{
map<string,int>m;
int n;string s;cin>>n;
while(n--){
    cin>>s;m[s]++;
}
printf("AC x %d\n",m["AC"]);
printf("WA x %d\n",m["WA"]);
printf("TLE x %d\n",m["TLE"]);
printf("RE x %d\n",m["RE"]);


}


Measured memory_bytes: 3724
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long K = Long.parseLong(sc.next());
        long[] A = new long[N];
        for (int i=0;i<N;i++) {
            A[i] = Long.parseLong(sc.next());
        }

        String K_str_a = Long.toBinaryString(K);
        StringBuilder sb_k = new StringBuilder(K_str_a);
        sb_k.reverse();
        String K_str = sb_k.toString();
        int n_1 = K_str.length();
        // int[] cnt = new int[n_1];
        int[] cnt = new int[100];
        for (int i=0;i<N;i++) {
            String A_str_a = Long.toBinaryString(A[i]);
            StringBuilder sb = new StringBuilder(A_str_a);
            sb.reverse();
            String A_str = sb.toString();
            // System.out.println(A_str);
            // System.out.println("n_1: " + n_1);
            int n_2 = A_str.length();
            // System.out.println("n_2: " + n_2);
            // for (int j=n_1-n_2;j<n_1;j++) {
            //     if (A_str.charAt(j-(n_1-n_2))=='1') {
            //         cnt[j]++;
            //     }
            // }
            for (int j=0;j<n_2;j++) {
                if (A_str.charAt(j)=='1') {
                    cnt[j]++;
                }
            }
        }

        long ans = 0;
        for (int j=0;j<100;j++) {
            if (j<n_1 && K_str.charAt(j)=='1') {
                ans += (N-cnt[j])*pow(2, j);
            } else {
                ans += cnt[j]*pow(2, j);
            }
        }
        for (int i=0;i<n_1;i++) {
            if (K_str.charAt(i)=='1') {
                // long tmp_ans = cnt[i]*pow(2, n_1-i-1);
                long tmp_ans = cnt[i]*pow(2, i);
                // for (int j=0;j<i;j++) {
                for (int j=i+1;j<100;j++) {
                    if (j<n_1 && K_str.charAt(j)=='1') {
                        // tmp_ans += (N-cnt[j])*pow(2, n_1-j-1);
                        tmp_ans += (N-cnt[j])*pow(2, j);
                    } else {
                        // tmp_ans += cnt[j]*pow(2, n_1-j-1);
                        tmp_ans += cnt[j]*pow(2, j);
                    }
                }
                // for (int j=i+1;j<n_1;j++) {
                for (int j=0;j<i;j++) {
                    // tmp_ans += Math.max(cnt[j], N-cnt[j])*pow(2, n_1-j-1);
                    tmp_ans += Math.max(cnt[j], N-cnt[j])*pow(2, j);
                }
                // System.out.println("tmp_ans: " + tmp_ans);
                ans = Math.max(ans, tmp_ans);
            }
        }
        // System.out.println("cnt: " + Arrays.toString(cnt));
        // System.out.println(K_str);
        // System.out.println(N);
        System.out.println(ans);
    }
    static long pow(long a,int n) {
        long res=1;
        while (n>0) {
            if ((n-n/2*2)==1) {
                res=res*a;
            }
            a=a*a;
            n>>=1;
        }
        return res;
    }
}

Measured memory_bytes: 51236
#include <stdio.h>
#include <iostream>
#include <vector>

int main(int argc, char** argv)
{
    int n;
    std::vector<int> vp;    

    std::cin >> n;
    for(int i=0;i<n;i++)
    {
        int p;
        std::cin >> p;
        vp.push_back(p);
    }
    int counter=0;
    for(int i=1;i<n-1;i++)
    {
        if(vp[i-1]>vp[i] && vp[i+1]<vp[i] || vp[i-1]<vp[i] && vp[i+1]>vp[i])
        {
            counter++;
        }
    }


   std::cout << counter;
    
    return 0;
}

Measured memory_bytes: 256
import sys

def main():
    N = int(input())

    a =[]
    for i in range(N):
        a.append(list(map(int,input().split())))


    count = 0

    for b in a:
        count = count + (b[1]-b[0]+1)

    print(count)


if __name__=='__main__':
    main()


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

int main(){
  int n;
  cin>>n;
  vector<int> h(n);
  rep(i,n) cin>>h[i];
  
  vector<ll> dp(n);
  dp[0]=0; 
  dp[1]=abs(h[0]-h[1]);
  for(int i = 1;i < n;i++){
      dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
  cout << dp[n-1] << endl;
}


Measured memory_bytes: 1536
def dfs(x, y):
  if x >= M or y >= N or x < 0 or y < 0 or field[y][x] == 0:
    return 0
  field[y][x] = 0
  res = max(dfs(x + 1, y), dfs(x - 1, y), dfs(x, y - 1), dfs(x, y + 1))
  field[y][x] = 1
  return res + 1

while True:
  M = input()
  N = input()
  field = []
  if not M and not N:
    break
  for i in range(N):
    field.append(map(int, raw_input().split()))

  ans = 0
  for x in range(M):
    for y in range(N):
      ans = max(dfs(x, y), ans)
  print ans

Measured memory_bytes: 4316
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll n,m;cin>>n>>m;
    priority_queue<pair<ll,ll>, vector<pair<ll,ll>>, greater<pair<ll,ll>> > que;
    rep(i,n){
        ll a,b;cin>>a>>b;
        que.push({a,b});
    }
    ll res=0;
    while(que.size()&&m>0){
        ll a=que.top().first,b=que.top().second;que.pop();
        //cout<<a<<" "<<b<<endl;
        res+=min(m,b)*a;
        m-=b;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 5372
n=int(input())
syugo=set()
S,T=[],[]
ans=0
for i in range(n):
    s=input()
    S.append(s)
    syugo.add(s)
m=int(input())
for i in range(m):
    t=input()
    T.append(t)
    syugo.add(t)
syugo=list(syugo) #リスト型に直す
syugo.append("0")
for i in range(len(syugo)):
    sin=S.count(syugo[i])
    tin=T.count(syugo[i])
    if ans<sin-tin:
        ans=sin-tin
print(ans)

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

int main(){
    int s;
    int taro=0, hanako=0;
    string str1, str2;
    cin>>s;
    for(int i=0;i<s;i++){
        cin>>str1>>str2;
        if ( str1 == str2 ){
            taro += 1;
            hanako += 1;
        }else if( str1 > str2 ){
            taro += 3;
        }else if ( str1 < str2 ){
            hanako += 3;
        }
    }
    cout<<taro<<" "<<hanako<<endl;
}


Measured memory_bytes: 3216
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<a;i++){
		int p,q,r,s;
		scanf("%d%d%d%d",&p,&q,&r,&s);
		if(r>=5&&s>=2)printf("%d\n",4*(p*r+q*s)/5);
		else printf("%d\n",min((max(5,r)*p+max(2,s)*q)*4/5,p*r+q*s));
	}
}

Measured memory_bytes: 1032
#include <iostream>
using namespace std;
int a[200006];
long long int sol(int h, int N) {
    long long int cut=0;
    for (int i=0; i<N; i++) {
        if (a[i]%h==0) {
            cut+=a[i]/h-1;
        }
        else {
            cut+=a[i]/h;
        }
    }
    return cut;
}
int main () {
    int N, K;
    cin >> N >> K;
    for (int i=0; i<N; i++) {
        cin >> a[i];
    }
    int right=1000000000, left=0;
    while (right-left!=1) {
        int mid=(right+left)/2;
        if (sol(mid, N)<=K) {
            right=mid;
        }
        else {
            left=mid;
        }
    }
    cout << right << endl;
}

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

namespace ConsoleApp15
{
    class Class214
    {
        static void Main()
        {
            var weather = new List<string>() { "Sunny", "Cloudy", "Rainy" };
            string S = Console.ReadLine();
            int index = weather.FindIndex(x => x == S);
            Console.WriteLine(weather[(index+1)%3] );
            
        }
    }
}


Measured memory_bytes: 13140
import sys

input = sys.stdin.readline
n = int(input())
s = input()[:-1]
to_w = 0
to_b = 0
to_w_list = []
to_b_list = []
for i in range(n):
    if s[i] == '#':
        to_w += 1
    if s[-i-1] == '.':
        to_b += 1
    to_w_list.append(to_w)
    to_b_list.append(to_b)
to_b_list.reverse()
ans = min(to_w_list[-1], to_b_list[0])
for i in range(n-1):
    ans = min(ans, to_w_list[i]+to_b_list[i+1])
print(ans)


Measured memory_bytes: 12808
#include <iostream>
#include <algorithm>
using namespace std;
const int inf=1<<29;
int dp[2][2][10010];//偶奇、AかBか、Aの持ってる長さ
int n,t[10010];
int main(){
	cin>>n;
	for(int i=0;i<n-1;i++)	cin>>t[i];
	for(int i=0;i<10010;i++){
		dp[0][0][i]=dp[0][1][i]=dp[1][0][i]=dp[1][1][i]=inf;
	}
	dp[0][0][0]=0;
	for(int i=0;i<n;i++){
		int s=i&1;
		for(int j=0;j<=min(i,n/2);j++){
			dp[s^1][0][j+1]=min(dp[s][0][j],dp[s][1][j]+t[i]);
			dp[s^1][1][j]=min(dp[s][1][j],dp[s][0][j]+t[i]);
		}
		dp[s][0][0]=inf;
	}
	cout<<dp[0][0][n/2]<<endl;
	return 0;
}

Measured memory_bytes: 1360
#include <stdio.h>
int main()
{
	int n,temp=0;
	int sum;
	while(scanf("%d",&n)!=EOF){
		sum=0;
		temp=n;
		while(n){
			
			sum=sum*10+n%10;
			
			n/=10;
		}
	    if(temp==sum)
		   printf("Yes\n");
	    else
	       printf("No\n");
	}
 } 

Measured memory_bytes: 128
#include <stdio.h>
int main(void){
  int x,y;
  int temp;
  scanf("%d%d",&x,&y);
  while(1){
    if(x%y==0)break;
    temp=x;
    x = y;
    y = temp%y;
  }
  printf("%d\n",y);
  return 0;
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
#define repeat(i,a,b) for(int i=(a),_=(b);i<_;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,_=(a);i>=_;i--)
#define mst(a,x) memset(a,x,sizeof(a))
#define vector basic_string
#define fi first
#define se second
#ifndef qwq
int cansel_sync=(ios::sync_with_stdio(0),cin.tie(0),0);
#endif
//mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const int N=2010; const double err=1e-11; typedef long long ll; const int inf=~0u>>2; const ll INF=~0ull>>2; ll read(){ll x; if(scanf("%lld",&x)==-1)exit(0); return x;} typedef double lf; typedef long double llf; const lf pi=acos(-1.0); lf readf(){lf x; if(scanf("%lf",&x)==-1)exit(0); return x;} template<typename T> T sqr(const T &x){return x*x;} typedef pair<int,int> pii; template<typename A,typename B> ostream &operator<<(ostream &o,const pair<A,B> &x){return o<<'('<<x.fi<<','<<x.se<<')';}
const int mod=(1?1000000007:998244353); ll mul(ll a,ll b,ll m=mod){return a*b%m;} ll qpow(ll a,ll b,ll m=mod){ll ans=1; for(;b;a=mul(a,a,m),b>>=1)if(b&1)ans=mul(ans,a,m); return ans;} ll getinv(ll v,ll m=mod){return qpow(v,m-2,m);}
//#define int ll
vector<int> a[N];
int dis[N],cnt[N];
queue<int> q;
int n,x,y;
void bfs(int s){
	fill(dis,dis+n,inf); dis[s]=0;
	q.push(s);
	while(!q.empty()){
		int x=q.front(); q.pop();
		cnt[dis[x]]++;
		for(auto p:a[x])
		if(dis[p]==inf){
			dis[p]=dis[x]+1;
			q.push(p);
		}
	}
}
signed main(){
	cin>>n>>x>>y; x--,y--;
	repeat(i,0,n-1)a[i]+=i+1,a[i+1]+=i;
	a[x]+=y,a[y]+=x;
	repeat(i,0,n){
		bfs(i);
		//orzarr(dis,n);
	}
	repeat(i,1,n)cout<<cnt[i]/2<<endl;
	return 0;
}

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

int main() {
  string in = "";
  char str;
  cin >> in;
  int ans = 0,count = 0;
  for (int i = 0; i < in.size(); i++) {
    str = in[i];
    if (str == 'R') {
      count++;
    }
    else if (count != 0) {
      ans = max(count, ans);
      count = 0;
    }
  }
  ans = max(count, ans);
  cout << ans << endl;
}


Measured memory_bytes: 3552
package main

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

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	a := make([]int, 3*n)
	for i := range a {
		sc.Scan()
    v, err := strconv.Atoi(sc.Text())
		if err != nil {
			panic("invalid value")
		}
    a[i] = v
	}
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	var ans int64
	for i := 1; i <= 2*n; i += 2 {
		ans += int64(a[i])
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5248
#include <iostream>
#include <cstring>

using namespace std;
int main(void){
  char a[128],b[128];
  int res;
  cin >> a >> b;
  if (strlen(a)>strlen(b))  res = 1;
  else if (strlen(a)<strlen(b)) res = -1;
  else res = strcmp(a,b);
  cout << (res?res>0?"GREATER":"LESS":"EQUAL") << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

namespace AizuOnlineJudge
{
    class Program
    {
        static void Main(string[] args)
        {
            for(int i = 1; i <= 9; ++i)
            {
                for(int j = 1; j <= 9; ++j)
                {
                    Console.WriteLine($"{i}x{j}={i * j}");
                }
            }
        }
    }
}


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

int main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << (H - h) * (W - w) << endl;
}

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

int main(){
  int A, B;
  string S;
  cin >> A >> B >> S;

  bool even = true;
  for (int i=0; i<A+B+1; i++){
    if (i<A && S.at(i)=='-'){
      even = false;
    }
    if (i==A && S.at(i)!='-'){
      even = false;
    }
    if (i>A && i<A+B && S.at(i)=='-'){
      even = false;
    }
  }
  cout << (even? "Yes":"No") << endl;
}


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



int main (void){

    int n;
    cin >> n;

    int v[n+5],c[n+5];

    rep(i,n){
        cin >> v[i];
    }
    rep(i,n){
        cin >> c[i];
    }


    int a,b=0;

    int MAX = 0;
    for(int i=0;i<(1<<n);i++){
        a=0;
        b=0;

       for(int j=0;j<n;j++){
           if(i&(1<<j)){
             a+=v[j];
             b+=c[j];
           }
       }

       
       
       MAX=max(MAX,a-b);
       

    }

    cout << MAX << endl;
   return 0;
}

Measured memory_bytes: 256
import java.util.Random;
import java.util.Scanner;
 
public class Main 
{   
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
 
        int[][] n = new int[2][6];
        for(int i=0; i<2; i++)
        {
            for(int j=0; j<6; j++)
            {
                n[i][j] = scanner.nextInt();
            }
        }
         
        boolean match = false;
        for(int i=0; i<99999; i++)
        {
            Random random = new Random();
            int d = random.nextInt(4);
                 
            int[] buf = new int[6];
            for(int j=0; j<6; j++)
            {
                buf[j] = n[1][j];
            }
                     
            switch(d)
            {
                case 0:
                    n[1][0] = buf[4];
                    n[1][1] = buf[0];
                    n[1][5] = buf[1];
                    n[1][4] = buf[5];
                    break;
                case 1:
                    n[1][0] = buf[1];
                    n[1][1] = buf[5];
                    n[1][5] = buf[4];
                    n[1][4] = buf[0];
                    break;
                case 2:
                    n[1][0] = buf[2];
                    n[1][2] = buf[5];
                    n[1][5] = buf[3];
                    n[1][3] = buf[0];
                    break;
                case 3:
                    n[1][0] = buf[3];
                    n[1][3] = buf[5];
                    n[1][5] = buf[2];
                    n[1][2] = buf[0];
                    break;
            }
             
            boolean is = true;
            for(int j=0; j<6; j++)
            {
                if(n[0][j] != n[1][j])
                {
                    is = false;
                    break;
                }
            }
            if(is)
            {
                match = true;
                break;
            }
        }
         
        System.out.println(match?"Yes":"No");
    }
}


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

using namespace std;

typedef long long lint;
const lint N = 1e5+100, INF = 9e9+7;
lint n, k, h[N], cost[N];

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif

	scanf("%lld %lld", &n, &k);

	for (int i = 1; i <= n; i++)
		scanf("%lld", &h[i]);

	h[0] = h[1];
	cost[1] = 0;

	for (int i = 2; i <= n; i++){
		//cost[i] = min(cost[i-1] + abs(h[i] - h[i-1]), cost[i-2] + abs(h[i] - h[i-2]));
		lint val = INF;
		for (int j = i-1; j >= i-k && j >= 0; j--){
			val = min(val, cost[j] + abs(h[i] - h[j]));
		}
		cost[i] = val;
	}

	printf("%lld\n", cost[n]);

	return 0; 
}

Measured memory_bytes: 5252
#include <bits/stdc++.h>
using namespace std;
#define desync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define EPS                 0.00000001
#define LL_MAX              1e18
#define LL_MIN              -1e18
#define MAX                 0x3f3f3f3f
#define MIN                 -0x3f3f3f3f
#define MOD                 1000000007
#define DEBUG(x)            cout << '>' << #x << ':' << x << endl;
#define REP(i,n)            for(int i=0;i<(n);i++)
#define FOR(i,a,b)          for(int i=(a);i<=(b);i++)
#define FORD(i,a,b)         for(int i=(a);i>=(b);i--)
#define n1                  '\n'

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<ld> pt;
typedef vector<pt> pol;

int n, m;

ll power(ll b, int e) {
    ll res = 1;
    for ( ; e>0; e/=2) {
        if (e&1) res = res*b % MOD;
        b = b*b % MOD;
    }
    return res;
}

//void dfs(vector<vector<int>> &g, int u, vector<int> &dp, vector<int> &in,
//vector<bool> &visited, int lev) {
//    if (in[u] <= 0) visited[u] = true;
//    dp[u] = max(dp[u], lev);
//    REP(i, g[u].size()) {
//        if (!visited[g[u][i]]) {
//            in[g[u][i]]--;
//            dfs(g, g[u][i], dp, in, visited, lev+1);
//        }
//    }
//}

void dfs(vector<vector<int>> &g, int u, vector<int> &dp, vector<int> &in,
vector<bool> &visited) {
    visited[u] = true;
    REP(i, g[u].size()) {
        dp[g[u][i]] = max(dp[g[u][i]], dp[u]+1);
        in[g[u][i]]--;
        if (in[g[u][i]] == 0) dfs(g, g[u][i], dp, in, visited);
    }
}


int main()
{
    desync
    cin >> n >> m;
    vector<vector<int>> graph(n);
    vector<int> in(n, 0);
    vector<bool> visited(n, false);
    REP(i, m) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        graph[u].push_back(v);
        in[v]++;
    }
    // dp[i] stores the longest path it takes to reach node i
    vector<int> dp(n);
    REP(i, n) {
        if (!visited[i] && in[i] == 0) dfs(graph, i, dp, in, visited);
    }
    
    cout << *max_element(begin(dp), end(dp)) << n1;

    return 0;
}


Measured memory_bytes: 14336
#include<stdio.h>
#include<string.h>
int main(){
char str[100];
  scanf("%s",str);
  int len = strlen(str);
  int counter=0;
  for(int i=0;i<len/2;i++){
	if(str[i]!=str[len-i-1]){
counter++;
    }
  }
  printf("%d\n",counter);
}

Measured memory_bytes: 128
# import math
# a, b, c = map(int, input().split())
# # k = list(map(int, input().split(",")))

# if math.sqrt(a) + math.sqrt(b) < math.sqrt(c):
#     print("Yes")
# else:
#     print("No")

h, w = map(int, input().split())

if h == 1 or w == 1:
    print(1)
    exit()

hw  = h*w

if hw%2 == 0:
    print(hw//2)
else:
    print(hw//2 + 1)


Measured memory_bytes: 2940