akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;

    vector<string> vec(h);

    // 入力
    for (int i = 0; i < h; i++) {
        cin >> vec.at(i);
    }

    // 横の確認
    vector<int> index_h;
    for (int i = 0; i < h; i++) {
        if (vec.at(i).find('#') != string::npos) {
            index_h.push_back(i);
        }
    }

    // 縦の確認
    vector<int> index_w;
    for (int i = 0; i < w; i++) {
        bool flag = false;
        for (int j = 0; j < h; j++) {
            if (vec.at(j).at(i) == '#') flag = true;
        }
        if (flag) index_w.push_back(i);
    }

    for (auto i : index_h) {
        for (auto j : index_w) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
num = input().split(" ")
if "1" in num:
  print(1)
else:
	gu = int(num[1]) // 2
	ki = int(num[1]) - int(gu)
	gu2 = int(num[0]) // 2
	ki2 = int(num[0]) - int(gu2)
	print(gu * gu2 + ki * ki2)

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

int check(int n, int x) {

  int c = 0;
  for(int i = 1; i <= n; i++) {
    for(int j = i+1; j <= n; j++) {
      for(int k = j+1; k <= n; k++) {
	if (i + j + k == x) {
	  //cout << i << ","  << j << ","  << k << endl;
	  c += 1;
	}
      }
    }
  }
  
  cout << c << endl;
  
  return 0;
}



int main() {
  int n, x;

  for(;;) {
    cin >> n >> x;
    if (n == 0 && x == 0) {
      break;
    }

    check(n, x);
  }
  
  return 0;
}


Measured memory_bytes: 3084
#include <stdio.h>
#include <string.h>

int main(void)
{
	int n, i;
	char tmp[4];
	int tests[4] = {0};

	scanf("%d", &n);
	i = 0;
	while (i < n)
	{
		scanf("%s", tmp);
		if (strcmp(tmp, "AC") == 0)
			tests[0]++;
		else if (strcmp(tmp, "WA") == 0)
			tests[1]++;
		else if (strcmp(tmp, "TLE") == 0)
			tests[2]++;
		else if (strcmp(tmp, "RE") == 0)
			tests[3]++;
		i++;
	}

	printf("AC x %d\n", tests[0]);
	printf("WA x %d\n", tests[1]);
	printf("TLE x %d\n", tests[2]);
	printf("RE x %d\n", tests[3]);

	return (0);
}

Measured memory_bytes: 1732
#include <iostream>

#ifdef _XCODE_DEBUG
    #include <fstream>
#endif
using ll = long long;

int main() {
    #ifdef _XCODE_DEBUG
        std::ifstream in("input.txt");
        std::cin.rdbuf(in.rdbuf());
    #endif
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll X, Y;
    std::cin >> X >> Y;
    ll c_num = X;
    int ans = 0;
    while (c_num<=Y) {
        ++ans;
        c_num *=2;
    }
    std::cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define lli long long int
#define pii pair<int,int>
#define vii vector<pii>
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v)  v.begin(),v.end()
#define mod 1000000007
#define vi vector<int>
#define vl vector<lli>
#define vll vector<pair<lli,lli>>
#define pll pair<lli,lli>
#define vvi vector<vector<int>>
#define vvl vector<vector<lli>>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define tk(args...) take(args);
#define posLSB(X) __builtin_ctz(X)
#define num1bit(X) __builtin_popcount(X)
#define numlead0(X) __builtin_clz(X)
#define umreserve(X) X.reserve(32768); X.max_load_factor(0.25);
void err(istream_iterator<string> it) {} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << " = " << a << "\n"; err(++it, args...);}
void take() {} template<typename T, typename... Args> void take( T & a, Args & ... args ) { cin>>a; take(args...); }
template<class T>
void printvec(vector<T> &a){
	for(T &x:a){
		cout<<x<<" ";
	}
	cout<<endl;
}
template<class T>
void printarr(T a[],lli n){
	for(lli i=0;i<n;i++){
		cout<<a[i]<<" ";
	}
	cout<<endl;
}
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};

#define endl "\n"

lli add(lli a, lli b) {
	a += b;
	if (a >= mod) a -= mod;
	return a;
}

lli mul(lli a, lli b) {
	return a * 1ll * b % mod;
}

inline bool setmin(lli &x, lli y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(lli &x, lli y) { return (y > x) ? x = y, 1 : 0; }

lli power_mod(lli a,lli x){if(x==0) return 1;lli y=power_mod(a,x/2);lli ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
lli inv(lli a){return power_mod(a,mod-2);}
lli power(lli a, lli x){ if(x==0) return 1; lli y= power(a,x/2); lli ans=(y*y); if(x%2) ans*=a; return ans;}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lli n;
	cin>>n;
	vector<lli> a(n);
	for(lli i=0;i<n;i++){
		cin>>a[i];
	}
	lli oo=1e18+5;
	vector<vector<lli>> dp(n,vector<lli>(n,oo));

	vector<lli> sum(n);
	sum[0]=a[0];
	for(lli i=1;i<n;i++){
		sum[i]=a[i]+sum[i-1];
	}

	for(lli l=1;l<=n;l++){
		for(lli i=0;i<n-l+1;i++){
			lli j=i+l-1;
			if(i==j){dp[i][j]=0;continue;}
			for(lli k=i;k<j;k++){
				lli x=dp[i][k]+sum[k]-(i-1>=0?sum[i-1]:0);
				lli y=dp[k+1][j]+sum[j]-sum[k];
				dp[i][j]=min(dp[i][j],x+y);
			}
		}
	}
	cout<<dp[0][n-1]<<endl;
}


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

int main(){
	int a;
	int b;
	int ans1;
	int ans2;
	cin >> a >> b;
	ans1 = a*b;
	ans2 = 2*(a+b);
	cout << ans1 << ' ' << ans2 << '\n';
}


Measured memory_bytes: 3076
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func yakusuu(n int) []int {
	ret := []int{1}
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			ret = append(ret, i)
			ret = append(ret, n/i)
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	var n, a int
	n = nextInt()
	set := make(map[int]struct{})
	dame := make(map[int]struct{})
	for i := 0; i < n; i++ {
		a = nextInt()
		if _, ok := set[a]; ok {
			dame[a] = struct{}{}
			continue
		}
		set[a] = struct{}{}
	}
OUTER:
	for x := range set {
		if x == 1 {
			continue
		}
		for _, y := range yakusuu(x) {
			if _, ok := set[y]; ok {
				dame[x] = struct{}{}
				continue OUTER
			}
		}
	}

	fmt.Println(len(set) - len(dame))
}


Measured memory_bytes: 19688
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<map>
using namespace std;
map<long long,long long>s;
map<long long,long long>::iterator it;
int main(){
    int n;
    long long sum=0,a;
    scanf("%d",&n);

    s[0]++;
    for(int i=0;i<n;i++){
        scanf("%lld",&a);
        sum+=a;
        s[sum]++;
    }
    long long ans=0;
    for(it=s.begin();it!=s.end();it++){
        if(it->second>1){
            ans+=(it->second)*(it->second-1)/2;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 12800
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int x = scan.nextInt();
    int y = scan.nextInt();
    int menseki = x * y;
    int syu = (2 * x)+(2 * y);
    System.out.println(menseki + " " + syu);
  }
}

Measured memory_bytes: 26208
def solve():

    N = int(input())
    xlist = []

    for i in range(N):
        x, u = input().split()
        x = float(x)
        if u == "BTC":
            xlist.append(x*380000.0)
        else:
            xlist.append(x)

    print(sum(xlist))


if __name__ == "__main__":
    solve()


Measured memory_bytes: 38256
#include <stdio.h>

int main(void) {
	int H, W, i, j;
	while(1){
		scanf("%d %d", &H, &W);
		if(H == 0 && W == 0) break;
		for(i=0; i<H; i++){
			for(j=0; j<W; j++)
				putchar('#');
			putchar('\n');
		}
	putchar('\n');
	}
	return 0;
}



Measured memory_bytes: 2064
#pragma comment(linker, "/STACK:128777216")

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <sstream>
 
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
 
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <string.h>
 
#include <memory.h>
#include <cassert>
#include <time.h>
 
using namespace std;
 
#define forn(i,n) for (int i = 0; i < (int)(n); i++)
#define fornd(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define forab(i,a,b) for (int i = (int)(a); i <= (int)(b); i++)
#define forabd(i, b, a) for (int i = (int)(b); i >= (int)(a); i--)
#define forit(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
 
#define _(a, val) memset (a, val, sizeof (a))
#define sz(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
 
typedef long long lint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vii;
 
const lint LINF = 1000000000000000000LL;
const int INF = 1000000000;
const long double eps = 1e-9;
const long double PI = 3.1415926535897932384626433832795l;
 
#ifdef MY_DEBUG
#define dbgx( x ) { cerr << #x << " = " << x << endl; }
#define dbg( ... ) { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#else
#define dbgx( x ) {  } 
#define dbg( ... ) {  } 
#endif
 
void prepare(string s)
{
#ifdef MY_DEBUG
    freopen ("input.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
#else
    if (s.length() != 0)
    {
        freopen ((s + ".in").c_str(), "r", stdin);
        freopen ((s + ".out").c_str(), "w", stdout);
    }
#endif
}

int n;

void read() {
    scanf("%d", &n);
}

void solve() {
    int c = n % 10;
    if (c == 3) {
        puts("bon");
    } else if (c == 0 || c == 1 || c == 6 || c == 8) {
        puts("pon");
    } else {
        puts("hon");
    }
}

int main() {
	prepare("");
    read();
    solve();

    return 0;
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


vector<vector<pair<int,int>>> G(100010);
int n;
int ans[100010];

void dfs(int cu,int pa=-1,int col=0){
    set<int> used;
    used.insert(col);
    int c=1;
    for(auto to : G[cu]){
        if(to.first==pa) continue;
        while(used.count(c)) c++;
        ans[to.second]=c;
        dfs(to.first,cu,c);
        c++;
    }
}

int main(){
    cin>>n;
    G.resize(n);

    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back({b,i});
        G[b].push_back({a,i});
    }

    dfs(0);
    int ma=0;
    rep(i,n) ma=max(ma,(int)G[i].size());
    cout<<ma<<endl;
    rep(i,n-1) cout<<ans[i]<<endl;

}

Measured memory_bytes: 18408
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
//fixed<<setprecision(10)<<ans<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin >> N >> K;
    vector<string> D(K);
    REP(i,K) cin >> D[i];
    int ans=0;  
    for(;;N++){ //N*100以下に必ず存在する
        string s = to_string(N);
        bool ok = true;
        for(string d:D){
            char c=d[0];
            if(find(ALL(s),d[0])!=s.end()) {
                ok=false;
                break;
            }
        }
        if(ok) break;
    }


    cout << N << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
signed main(){
    int n;cin>>n;
    int sum[13]={};sum[0]=1;
    vector<int> num;
    rep(i,0,n){
        int d;cin>>d;
        if(d==0){
            cout<<0<<endl;
            return 0;
        }
        num.push_back(d);
        sum[d]++;
    }
    sort(num.begin(),num.end());
    rep(i,1,12){
        if(sum[i]>=3){
            cout<<0<<endl;
            return 0;
        }
    }
    if(sum[12]>=2){
        cout<<0<<endl;
        return 0;
    }
    int place[24]={};place[0]=1;
    int c=1;
    rep(i,0,n){
        if(c==1){
            place[num[i]]=1;
        }else {
            place[24-num[i]]=1;
        }c*=-1;
    }
    int count=0;int ans=114514;
    rep(i,1,24){
        if(place[i]==0)count++;
        else {
            ans=min(ans,count);
            count=0;
        }
    }cout<<ans+1<<endl;
    return 0;
}

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

int main(){
    long long N;
    cin>>N;
    long long a[N];
    long long count[N]={0};
    rep(i, N){
        cin>>a[i];
        count[a[i]-1]++;
    }
    long long all=0;
    long long ans[N]={0};
    rep(i, N){
        ans[i]=count[i]*(count[i]-1)/2;
        all+=ans[i];
    }
    long long answer;
    rep(i, N){
        answer=all-ans[a[i]-1]+(count[a[i]-1]-1)*(count[a[i]-1]-2)/2;
        cout<<answer<<endl;
    }
}

Measured memory_bytes: 7296
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N, C, K;
int T[100010];

int main () {
  cin >> N >> C >> K;
  for (auto i = 0; i < N; ++i) {
    cin >> T[i];
  }
  sort(T, T+N);
  int ans = 0;
  int now_t = T[0];
  int now_p = 0;
  for (auto i = 0; i < N; ++i) {
    if (now_p >= C || T[i] - now_t > K) {
      ++ans;
      now_t = T[i];
      now_p = 1;
    } else {
      ++now_p;
    }
    //cerr << now_t << " " << now_p << endl;
  }
  ++ans;
  cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

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

    long long a, b, n;
    cin >> a >> b >> n;
    cout << a * min(n, b - 1) / b << endl;

    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int a,b,c;
	string s;
	cin>>s;
	if(s[0]=='9'||s[1]=='9')cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
class Dice:
    def __init__(self,pips):
        self.top = pips[0]
        self.south = pips[1]
        self.east = pips[2]
        self.west = pips[3]
        self.north =pips[4]
        self.bottom=pips[5]
    def n(self):
        self.top,self.south,self.bottom,self.north = \
        self.south,self.bottom,self.north,self.top
    def s(self):
        self.top,self.north,self.bottom,self.south = \
        self.north,self.bottom,self.south,self.top
    def e(self):
        self.top,self.west,self.bottom,self.east = \
        self.west,self.bottom,self.east,self.top
    def w(self):
        self.top,self.east,self.bottom,self.west = \
        self.east,self.bottom,self.west,self.top
    def r(self):
        self.north,self.east,self.south,self.west = \
        self.east,self.south,self.west,self.north
    def set(self,t,s):
        for i in range(4):
            if self.top != t:
                if self.east == t or self.west == t:
                    self.e()
                else:
                    self.n()
            else:
                break
        for i in range(4):
            if self.south != s:
                self.r()
            else:
                break

pips = [int(x) for x in input().split()]
a = Dice(pips)

n = int(input())
for i in range(n):
    t,s = map(int,input().split())
    a.set(t,s)
    print(a.east)

Measured memory_bytes: 7768
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a[105],alice=0,bob=0;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0; i<n; i++){
        if(i%2==0){
            alice=alice+a[i];
        }else{
            bob=bob+a[i];
        }
    }
    if(alice>=bob){
        cout<<alice-bob<<'\n';
    }else{
        cout<<bob-alice<<'\n';
    }
    return(0);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;

int main(void) {
  char s[100003];
  cin >> s;
  int ca = 0, cb = 0;
  for (int i = 0; s[i] != '\0'; i++) {
    if (s[i] == '0') {
      ca++;
    } else {
      cb++;
    }
  }
  cout << (ca + cb - (abs(ca - cb))) << endl;
  return 0;
}


Measured memory_bytes: 632
#include <bits/stdc++.h>
#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(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#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 show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//inline int in() { int x; scanf("%d",&x); return x;}
template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n;
  cin >> n;
  map<string,int> mp;
  rep(i,n) {
    //string s = in<string>();
    string s;
    cin >> s;
    mp[s]++;
  }
  int mx = 0;
  for (auto p : mp) mx = max(mx, p.se);
  for (auto p : mp) {
    if (p.se != mx) continue;
    cout << p.fi << '\n';
  }
  return 0;
}

Measured memory_bytes: 25216
A, B, K = map(int, input().split())

for k in range(K):
	if k%2 == 0:
		if A%2 == 1:
			A -= 1
		B += A//2
		A //= 2
	else:
		if B%2 == 1:
			B -= 1
		A += B//2
		B //= 2

print(A, B)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int n,t,ans;
P a[106];

int main(){
  cin>>n>>t;
  for(int i=0;i<t;i++)cin>>a[i].first,a[i].second=i;
  sort(a,a+t,greater<P>());
  int prev=-1;
  while(1){
    sort(a,a+t,greater<P>());
    int f=0;
    for(int i=0;i<t;i++){
      if(a[i].first&&prev!=a[i].second){
	f=1,a[i].first--;
	prev=a[i].second;
	break;
      }
    }
    if(!f){
      for(int i=0;i<t;i++){
	if(a[i].first){
	  ans++;
	  f=1,a[i].first--;
	  prev=a[i].second;
	  break;
	}
      }
    }
    if(!f)break;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

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

A = [a - 1 for a in A]
Acum = [0]
for a in A:
  Acum.append((Acum[-1] + a) % K)

answer = 0
counter = defaultdict(int)
for i, ai in enumerate(Acum):
  answer += counter[ai]
  counter[ai] += 1
  if i - K + 1 >= 0:
    counter[Acum[i - K + 1]] -= 1
    
print(answer)

Measured memory_bytes: 116136
#include <iostream>
#include <string>

using namespace std;

int main() {
	string a, b, c;

	cin >> a >> b >> c;

	if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N; cin >> N;
	string s; cin >> s;
	int red = 0;
	rep(i, 0, N) {
		if (s[i] == 'R')++red;
	}
	cout << (N - 2 * red < 0 ? "Yes" : "No") << "\n";

	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

const int MAX_NUM = 100000;

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

	vector<int> pow;
	pow.emplace_back(1);
	int p6 = 6;
	while (p6 <= n) {
		pow.emplace_back(p6);
		p6 *= 6;
	}
	int p9 = 9;
	while (p9 <= n) {
		pow.emplace_back(p9);
		p9 *= 9;
	}

	sort(pow.begin(), pow.end());

	int p_size = pow.size();
	vector<int> withdraw(n + 1,MAX_NUM);
	withdraw[0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < p_size; j++) {
			int num;

			if (i - pow[j] < 0) {
				break;
			}
			
			num = withdraw[i - pow[j]] + 1;

			if (num < withdraw[i]) {
				withdraw[i] = num;
			}
		}
	}

	cout << withdraw[n] << endl;
}

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

int main(){
    int a,b;
    cin>>a>>b;
    if(a+b>=a-b&&a+b>=a*b){
        cout<<a+b;
        return 0;
    }
    if(a-b>=a+b&&a-b>=a*b){
        cout<<a-b;
        return 0;
    }
    if(a*b>=a+b&&a*b>=a-b){
        cout<<a*b;
        return 0;
    }
    return 0;
}


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

double W, H, x, y;

void solve()
{
	double s = W * H / 2.0; 
	int flag = 0;
	if(x == W/2 && y == H/2) flag = 1;
	printf("%lf %d\n", s, flag);
}

int main()
{	
	scanf("%lf %lf %lf %lf", &W, &H, &x, &y);
	solve();
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int a, b;
	cin>>a>>b;
	ll x = 1;
	while(a--){
		if(x<b) x *= 2;
		else x += b;
	}
	cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  vector<ll> a(N), accum(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (i == 0)
      accum[0] = a[0];
    else
      accum[i] = accum[i - 1] + a[i];
  }
  ll ans = INF;
  for (int i = 0; i < N - 1; i++) {
    ll x = accum[i];
    ll y = accum[N - 1] - accum[i];
    ans = min(ans, abs(x - y));
  }
  cout << ans << endl;
  return 0;
}

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

#define IL __inline__ __attribute__((always_inline))

#define For(i, a, b) for (int i = a, i##end = b; i <= i##end; ++ i)
#define FOR(i, a, b) for (int i = a, i##end = b; i < i##end; ++ i)
#define Rep(i, a, b) for (int i = a, i##end = b; i >= i##end; -- i)
#define REP(i, a, b) for (int i = (a) - 1, i##end = b; i >= i##end; -- i)

typedef long long LL;

template <class T>
IL bool chkmax(T &a, const T &b) {
  return a < b ? ((a = b), 1) : 0;
}

template <class T>
IL bool chkmin(T &a, const T &b) {
  return a > b ? ((a = b), 1) : 0;
}

template <class T>
IL T mymax(const T &a, const T &b) {
  return a > b ? a : b;
}

template <class T>
IL T mymin(const T &a, const T &b) {
  return a < b ? a : b;
}

template <class T>
IL T myabs(const T &a) {
  return a > 0 ? a : -a;
}

const int INF = 0X3F3F3F3F;
const double EPS = 1E-10, PI = acos(-1.0);

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define OK DEBUG("Passing [%s] in LINE %d...\n", __FUNCTION__, __LINE__)
/*------------------------------header------------------------------*/

int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  printf("%d\n", a + b >= c ? b + c : a + (b << 1) + 1);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii  = pair<int,int>;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define MOD 1000000007
#define EPS 10e-8
int gcd(int a,int b){return b?gcd(b,a%b):a;}    //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main(){
    string s;
    cin >> s;
    int count = 0;
    rep(i,(int)s.length()){
        if(s[i]=='1')
            count++;
    }
    cout<<count<<endl;
}


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

int frogjumpcost(int arr[], int n){

    vector<int> vec(n+1, 0);

    vec[2] = abs(arr[1]-arr[2]);

    for (int i=3; i<=n; i++){
        vec[i] = min( vec[i-1] + abs(arr[i]-arr[i-1]),  vec[i-2] + abs(arr[i]-arr[i-2]) );
    }
    
    return vec[n];

}


int main(){

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

    int n;
    cin >> n;

    int arr[n+1];

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

    cout << frogjumpcost(arr, n);

    return 0;

}



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

class Dmondai
{
    static void Main()
    {
        var N = Int32.Parse(Console.ReadLine());
        var k = 0;
        for(int i = 0; i <= N; ++i) if (i * (i + 1) == 2 * N) k = i+1;
        if (k == 0)
        {
            Console.WriteLine("No");
            return;
        }
        Console.WriteLine("Yes");
        Console.WriteLine(k);
        var array = new int[k,k-1];
        for (int i = 0; i < k; ++i) for (int j = 0; j < k - 1; ++j) array[i, j] = -1;
        for (int i = 0; i < k; ++i)
        {
            Console.Write(k - 1);
            var num = 0;
            var index = 1;
            for (int j = 0; j < k - 1; ++j)
            {
                Console.Write(" ");
                if (i == 0) num = j + 1;
                else if (i == 1)
                {
                    if (j == 0) num = j + 1;
                    else num = array[i - 1, k - 2] + j;
                }
                else
                {
                    if (i<=j) {
                        num = array[i - 1, k - 2] + index;
                        index++;
                    }
                    else num = array[j, i-1];
                }
                array[i, j] = num;
                Console.Write(num);
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 16860
a = gets.split.map(&:to_i)
             

    	if a[0] == a[1] && a[0] == a[2]
    		p 1
    	elsif a[0] == a[1] || a[0] == a[2] || a[1] == a[2]
    		p 2
    	else
    		p 3
    	end


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

int findSumOfDights(int n){
int sum = 0;
while(n > 0){
sum += n % 10;
n /= 10;
}
return sum;
}
int main(){
int N,A,B;
cin >> N >> A >> B;
int total = 0;
for(int i = 0;i <= N; ++i){
int sum = findSumOfDights(i);
if (sum >= A && sum <= B){
total += i;
}
}
cout << total << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main(){
	int c=0, i,y=0,x=0;
	string s;
	cin>>s;
	if ((s[0]!='A')){
		cout<<"WA";
		return 0;
	}
	for(int j=2;j<=s.size()-2;j++){
            x++;
        if(s[j]!='C'){
          y++;
        }
	}
	if(x==y){ cout<<"WA";
		 return 0;}
	for (i=1;i<s.size();i++){
		 if (isupper(s[i])){
		  c++;
		} }
        if(c!=1){
		cout<<"WA";
        }
        else{
            cout<<"AC";
        }

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    const int y=2019;
    bool flag = 0;
    int tmp = 2020, i, j;
    long long l, r;
    cin >> l >> r;
    for(i=l;(i<l+y)&&(i<r-1);i++){
        if(i%y == 0) flag = 1;
    }
    if(flag == 1) tmp = 0;
    else{
        for(i=l;i<r;i++) for(j=i+1;j<=r;j++){
            tmp = min(tmp,((i%y) * (j%y))%y);
            if(tmp == 0){
                flag = 1;
                break;
            }
        }
    }
    cout << tmp << endl;
}

Measured memory_bytes: 504
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main(){
	int n = read();
	int sum = 0, k = 0;
	for (int i = 0; i < n; i++) {
		int r = read();
		sum += r;
		chmax(k, r / 2);
	}
	cout << sum - k << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n - 1);
  for (int i = 0; i < n - 1; i++) cin >> b.at(i);
  
  int sum = 0;
  sum += b.at(0);
  for (int i = 1; i < n - 1; i++)
    sum += min(b.at(i - 1), b.at(i));
  sum += b.at(n - 2);
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  string s;
  cin>>s;
  bool past[26];
  for(int i=0;i<26;i++) past[i]=false;
  int ans=1000;
  for(int i=0;i<s.size();i++){
    char a=s[i];
    string cop=s;
    if(past[s[i]-'a']) continue;
    int cnt=0;
    bool all=true;
    for(int j=0;j<s.size();j++){
      if(s[j]!=s[i]) all=false;
    }
    while(!all and cnt!=s.size()-1){
      cnt++;
      all=true;
      for(int j=0;j<s.size()-cnt;j++){
        if(cop[j]==a or cop[j+1]==a) cop[j]=a;
        else all=false;
      }
    }
    ans=min(ans,cnt);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;int n,i;main(){cin>>n;long a[n];for(;i<n;cin>>a[i],i++);for(sort(a,a+n);i-1;(*a*=__gcd(a[n-i+1],n-i+1l))%=998244353,i--);cout<<*a;}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
const int MOD = 1000000007;


int main(){
    ll X,K,D; cin >> X >> K >> D;

    ll count = abs(X)/D;
    ll ans = 0;
    if (count <= K){
        if (count%2 == K%2){
            ans = abs(X)%D;
        }
        else{
            ans = D-(abs(X)%D);
        }
    }
    else{
        ans = abs(X)-(K*D);
    }

    cout << abs(ans) << endl;

}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1000000007;

int main() {
  string s;
  cin>>s;
  int ans=10000;
  rep(i,s.size()-2){
    int temp=s[i]-'0';
    temp*=10;
    temp+=s[i+1]-'0';
    temp*=10;
    temp+=s[i+2]-'0';
    ans=min(ans,abs(temp-753));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

long int lcm(long int C,long int D);

int main(void){
  	long int A,B,C,D,uni,L;
  	scanf("%ld %ld %ld %ld",&A,&B,&C,&D);
    L=lcm(C,D);
 	uni = B/C + B/D - B/L - (A-1)/C - (A-1)/D +(A-1)/L;
    printf("%ld",B-A+1-uni);
    return 0;
}

long int lcm(long int C,long  int D){
    long int a,b,r;
      a = C;
      b = D;
    r = a%b;      
	while(1){
    if(r==0)break;
      a = b;
      b = r;
      r = a%b;
    }
    return C*D/b;
}


Measured memory_bytes: 128
from collections import Counter
 
n, *v = map(int, open(0).read().split())
c1 = Counter(v[::2]).most_common()
c2 = Counter(v[1::2]).most_common()
 
c1.append([0, 0])
c2.append([0, 0])
 

if c1[0][0] != c2[0][0]:
  print(n - c1[0][1] - c2[0][1])
else:
  print(min(n - c1[0][1] - c2[1][1], n - c1[1][1] - c2[0][1]))

Measured memory_bytes: 20524
#include<stdio.h>
#include<string.h>

int main(void)
{
   int a,b;
   char A[11],B[11],C[11];

   scanf("%s%s%s", &A, &B, &C);

   a=strlen(A);
   b=strlen(B);

   if((A[a-1]==B[0]) && (B[b-1]==C[0]))
      printf("YES");
   else
      printf("NO");

   return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int p, q, r; cin >> p >> q >> r;
  int ans = INF;
  chmin(ans, p + q);
  chmin(ans, r + q);
  chmin(ans, p + r);
  chmin(ans, q + r);
  chmin(ans, r + p);
  chmin(ans, q + p);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define ll long long int
/*
ll GCD(ll a,ll b)
{
	if(b==0)
	return a;
	else
	return GCD(b,a%b);
}
 
 
ll x,y,d;       //d is gcd x and y are coefficients
void exten_euclid(ll a,ll b)
{	ll temp;
	if(b==0)
	{
		d=a;
		x=1;
		y=0;	
	}
	else
	{
		exten_euclid(b,a%b);
		temp=x;
		x=y;
		y=temp-(a/b)*y;	
	}
return;
}
 
ll fastModExp(ll a,ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b&1)
		res=(res*a)%m;
	a=(a*a)%m;
	b=b>>1;	
	}
return res;
}
*/
int main()
{
fast
ll h,w;
cin>>h>>w;
ll a=h*w;
ll b=2;
if(h<=1 || w<=1)
cout<<1;
else
cout<<(a / b) + ((a % b) != 0);
 
return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left
from bisect import bisect_right


N = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))

ans = 0
y_low = {}
i = 0
for y in B:
    x = bisect_left(A, y)
    z = bisect_right(C, y)
    ans += x * (N-z)
print(ans)


Measured memory_bytes: 22720
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int mod = 1e9+7;
long long int inf = 1e18;

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  x -= z;
  cout << x / (y+z) << endl;

  return 0;
}

//


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

int main()
{
    int b;
    long long int ans = -1, tmp;

    int N;
    cin >> N;

    vector<int> A(N);
    for( int i = 0; i < N; ++i ){
        cin >> A[i];
        A[i] -= i + 1;
    }

    sort(A.begin(), A.end());
    b = A[N/2];

    for( int i = b-1000; i < b+1000; ++i ){
        tmp = 0;
        for( int j = 0; j < N; ++j ){
            tmp += abs(A[j] - b);
        }
        if( ans == -1 ) ans = tmp;
        else if( tmp < ans ) ans = tmp;
    }

    //cout << b << " : " << ans << endl;
    
    cout << ans << endl;

    return 0;
}


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

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

    vector<int> D(N);
    for (int i = 0; i < N; i++) {
        cin >> D.at(i);
    }

    sort(D.begin(), D.end());

    int count = 1;
    for (int i = 0; i < N - 1; i++) {
        if (D.at(i) != D.at(i + 1)) {
            count++;
        }
    }

    cout << count  << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <set>
#include <cmath>
#include <deque>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 123456;

int main() {
    int n;
    while (~scanf("%d", &n)) {
          map<int, int> mp;
          for (int i = 0; i < n; i++) {
              int tmp;
              scanf("%d", &tmp);
              if (!mp.count(tmp)) mp[tmp] = 1;
              else mp[tmp]++;
          }
          int ans = 0;
          for (auto i : mp) {
              int cur = i.first, cnt = i.second;
              if (cnt >= cur) ans += cnt - cur;
              else ans += cnt;
          }
          printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
#include<string.h>
#include<tuple>
#define all(c) c.begin(),c.end()
#define pb push_back
#define em emplace_back
#define mp make_pair
#define ll long long int

using namespace std;

typedef vector<ll>vi;
typedef vector<vi>vii;
typedef pair<ll,ll>pi;
typedef tuple<ll,ll,ll>ti;



ll FindLCM(ll a, ll b) 
{ 
    return (a * b) / __gcd(a, b); 
} 
  
ll rangeDivisor(ll m, ll n, ll a, ll b) 
{ 
    ll lcm = FindLCM(b, a); 
  
    ll a_divisor = n / a - (m - 1) / a; 
    ll b_divisor = n / b - (m - 1) / b; 
  
    ll common_divisor = n / lcm - (m - 1) / lcm; 

  
    ll ans = a_divisor + b_divisor - common_divisor; 
    ll total=(n+1-m)-ans;   
    return total; 
}

int main(){
    ios_base::sync_with_stdio(false);
    
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<rangeDivisor(a,b,c,d);
     
}

Measured memory_bytes: 256
//ITP 1_3_B
#include <iostream>
using namespace std;

int main(){
  
  for(int i=1;; i++){
    int x;
    cin >> x;
    if(x == 0) break;
    cout << "Case " << i << ": " << x << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
using namespace std;
const int N=1e3+7;
const int M=2e5+7;
template <class I>
inline void read(I &x){
    int f=1;
    char c;
    for(c=getchar();c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
    for(x=0;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c&15),c=getchar());
    x*=f;
}
int a[N][N];
vector <pii > e;
vector <int> p[N];
int n,m;
void dfs1(int x,int fa){
	a[fa][x]=1;
	for(unsigned int i=0;i<p[x].size();i++){
		int y=p[x][i];
		if(!a[fa][y]) dfs1(y,fa);
	}
}
int pd[N][2];
int b[N][N];
void dfs2(int x,int tag,int o){
    pd[x][o]=tag;
    for(int i=0;i<p[x].size();i++)
        if(!pd[p[x][i]][o])
            dfs2(p[x][i],tag,o);
}
int main(){
	read(n),read(m);
	for(int i=1,x,y;i<=m;i++) read(x),read(y),e.pb(mp(x,y)),p[x].pb(y);
	for(int i=1;i<=n;i++)
		dfs1(i,i);
	for(int i=1;i<=n;i++){
		memset(pd,0,sizeof(pd));
		pd[i][0]=pd[i][1]=i;
		for(unsigned int j=0;j<p[i].size();j++)
			if(!pd[p[i][j]][0])
				dfs2(p[i][j],p[i][j],0);
		for(int j=p[i].size()-1;j>=0;j--)
			if(!pd[p[i][j]][1])
				dfs2(p[i][j],p[i][j],1);
		for(unsigned int j=0;j<p[i].size();j++){
			int y=p[i][j];
			b[i][y]=!(pd[y][0]==pd[y][1]);
		}
	}
	for(unsigned int i=0;i<e.size();i++){
		int x=e[i].first,y=e[i].second;
		if(a[y][x]^b[x][y]) puts("diff");
		else puts("same");
	}
	return 0;
}

Measured memory_bytes: 12144
s = input()
odd_desired = set(["R", "U", "D"])
even_desired = set(["L", "U", "D"])
odd_actual = set(s[0::2])
even_actual = set(s[1::2])
if len(odd_actual - odd_desired) > 0 or len(even_actual - even_desired) > 0:
    print("No")
else:
    print("Yes")

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

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

  int a, b;
  cin >> a >> b;

  if (a > 8 || b > 8) cout << ":(\n";
  else cout << "Yay!\n";

  return (0);
}


Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main()
{
    long long h;
    long long p = 1LL, ans = 0LL;
    cin >> h;
    while (h > 0){
        ans += p;
        h /= 2;
        p *= 2;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int t1, t2, a1, a2, b1, b2;
	cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
	int da = t1*a1+t2*a2, db = t1*b1+t2*b2, da1 = t1*a1, db1 = t1*b1;
	if(da == db)
		return !(cout << "infinity");
	if((da < db) == (da1 < db1))
		return !(cout << 0);
	int x = abs(da1-db1), y = abs(da-db);
	cout << ((x+y-1)/y)*2-1+(x % y == 0);
}

Measured memory_bytes: 256