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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
int l[N], r[N];

int main(){
  fastIO;
  int n;
  cin >> n;
  int lmx = 0, rmn = (int)1e9 + 1;
  for(int i = 0 ; i < n; i ++ ){
    cin >> l[i] >> r[i];
    lmx = max(lmx, l[i]);
    rmn = min(rmn, r[i]);
  }
  vector<pii> shits;
  for(int i = 0 ; i < n; i ++ ){
    shits.push_back(mp(rmn - l[i] + 1,r[i] - lmx + 1));
  }
  sort(shits.begin(), shits.end());
  int low = (int)1e9 + 1;
  int ans = 0;
  for(int i = 0 ; i < n; i ++ ){
    ans = max(ans, (r[i] - l[i] + 1) + max(rmn-lmx+1,0));
  }
  for(int i = 0 ; i + 1 < n; i ++ ){
    low = min(low, shits[i].se);
    ans = max(ans, max(0,low) + max(0,shits[i + 1].fi));
  }
  ans = max(ans, max(0,shits[0].fi) + max(0,shits[n-1].fi));
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 2168
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int t = sc.nextInt();
		int a = sc.nextInt();
		double tt = Integer.MAX_VALUE;
		int h, idx = 0;
		for (int i = 0; i < n; i++) {
			h = sc.nextInt();
			if (Math.abs(a-(double)( t - h * 0.006 ))< tt) {
				tt = Math.abs(a-(double)( t - h * 0.006 ));
				idx = i + 1;
			}
		}
		System.out.println(idx);
	}
}


Measured memory_bytes: 22356
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    S = list(Scanner.string())
    K = Scanner.int()
    i = 0
    while i < len(S):
        c = S[i]
        n = ord(c) - ord('a')
        if n > 0 and 26 - n <= K:
            c = 'a'
            K -= 26 - n
            S[i] = c
        i += 1
    if K > 0:
        c = S[-1]
        for _ in range(K % 26):
            c = chr(ord(c) + 1)
            if c == chr(ord('z') + 1):
                c = 'a'
        S[-1] = c
    print(''.join(S))


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


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

using namespace std;
using namespace std::chrono;

#define rep(i,a,b) for(int i = a;i<(b);++i)
#define trav(a,v) for(auto& a : v)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

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

ll big = 1000000007ll;
ll big2 = 1000000009ll;
ll n,m,T,k,q,p;

vector<vector<ll> > C(26, vector<ll>());
vector<ll> A;
string alfa = "abcdefghijklmnopqrstuvwxyz";
ll pek[200001] = {0};

ll nxt(ll i, ll a){
    ll l = 0;
    ll r = sz(C[a]);
    if(C[a][0] > i)return C[a][0];
    while(l < r-1){
        ll mid = (l+r)/2;
        if(C[a][mid] > i){
            r = mid;
        }
        else{
            l = mid;
        }
    }
    return C[a][r];
}

void bfs(){
    queue<ll> Q;
    Q.push(-1);
    bool mark[200002] = {0};
    while(!Q.empty()){
        ll a = Q.front();
        Q.pop();
        for(ll c1 = 0; c1 < 26; c1++){
            ll i = nxt(a,c1);
            if(mark[i] == 0){
                if(i == n){
                    m = a;
                    k = c1;
                    pek[n] = a;

                    return;
                }
                Q.push(i);
                pek[i] = a;
                mark[i] = 1;
            }
        }
    }
}

int main()
{
   // freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);
    ll a,b,c,d,e;

    string s;
    cin >> s;
    n = s.length();
    for(ll c1 = 0; c1 < n; c1++){
        a = ll(s[c1]) - ll('a');
        A.push_back(a);
        C[a].push_back(c1);
    }
    for(ll c1 = 0; c1 < 26; c1++){
        C[c1].push_back(n);
    }
    bfs();
    string ans;
    ans += alfa[k];

    while(m != -1){
        ans += alfa[A[m]];
        m = pek[m];
    }
    reverse(all(ans));
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 5744
N = int(input())
B = list(map(int, input().split()))
A = [B[0], B[0]]
for i in range(1, N-1):
    b = B[i]
    A.append(b)
    a = max([A[i],A[i+1]])
    if a > b:
        A[A.index(a)] = b
print(sum(A))


Measured memory_bytes: 9164
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define cc 6.28318530717958623200
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

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

    int n, m;
    cin >> n >> m;
    int sum = 0;
    for (int i = 0; i < m; i++) {
        int x;
        cin >> x;
        sum += x;
    }
    if (sum > n) {
        cout << -1 << '\n';
    } else {
        cout << n - sum << '\n';
    }
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <cmath>
#include <algorithm>

using namespace std;

const int INF = 1e6;

int n, m;
vector< vector<bool> > mat(10, vector<bool>(10, false));
long long ans=0;


void search(int v, vector<bool> visited){
    bool all_visited = true;
    for (int i=0; i<n; i++){
        all_visited = all_visited && visited[i];
    }
    if (all_visited){
        ans++;
        return;
    }

    for (int i=0; i<n; i++){
        if (i != v && mat[v][i] && !visited[i]){
            vector<bool> _visited = visited;
            _visited[i] = true;
            search(i, _visited);
        }
    }
}

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

    for (int i=0; i<m; i++){
        int a, b;
        cin >> a >> b;
        mat[a-1][b-1] = true;
        mat[b-1][a-1] = true;
    }

    vector<bool> visited(10, false);
    visited[0] = true;
    search(0, visited);

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <array>

using namespace std;

#define fi first	
#define se second
#define long long long
typedef pair<int,int> ii;

const long MOD = 998244353;
long xxx[4003][4003];
long C(long n, long k)
{
	if(n == 0 && k == 0) return 1;
	else if(n < 0) return 0;
	else if(k < 0 || k > n) return 0;
	else if(xxx[n][k]) return xxx[n][k];
	else return xxx[n][k] = (C(n-1,k-1)+C(n-1,k))%MOD;
}
long mem[4003];
long p2(long k)
{
	if(k == 0) return 1;
	else if(mem[k]) return mem[k];
	else return mem[k] = (p2(k-1)*2)%MOD;
}


int main()
{
	// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// freopen("input.in", "r", stdin);

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

	for(int i = 2; i <= 2*k; i++)
	{
		int temp = i;
		long res = 0;
		if(i > k+1)
		{
			i = 2*k-i+2;
		}
		if(i&1)
		{
			long pas = i/2;
			long free = k-2*pas;
			// printf("%lld %lld\n", pas, free);
			for(int j = 0; j <= pas; j++)
			{
				long tn = n-j;
				long con = (C(pas,j)*p2(j))%MOD;
				res += (con*C(tn+(free+j-1),free+j-1))%MOD;
				res %= MOD;
			}
		}
		else
		{
			long pas = (i-1)/2;
			long free = k-1-pas*2;
			for(int j = 0; j <= pas; j++)
			{
				long tn = n-j;
				long con = (C(pas,j)*p2(j))%MOD;
				res += (con*C(tn+(free+j-1),free+j-1))%MOD;
				res += (con*C(tn-1+(free+j-1),free+j-1))%MOD;
				res %= MOD;
			}
		}
		i = temp;
		printf("%lld\n", res); fflush(stdout);
	}
}












Measured memory_bytes: 123648
#include<stdio.h>
int main()
{
    int n,m,i,j,sum=0;
    scanf("%d%d",&n,&m);
    for(j=0;; j=j+500)
    {
        if(j==n)
        {
            sum=1;
            printf("Yes\n");
            break;
        }
        if(j>n)
        {
            j-=500;
            break;
        }
    }
    for(i=1; i<=m; i++)
    {
        if((j+i)==n)
        {
            sum=1;
            printf("Yes\n");
            break;
        }
    }
    if(sum==0)
        printf("No\n");
}


Measured memory_bytes: 128
N_,A_,B_=input().split()
N = (int)(N_)
A = (int)(A_)
B = (int)(B_)

sum = 0
for n in range(1,N+1):
    count = 0
    n_ = (str)(n)
    n_num = len(n_)
    for i in range(n_num):
        count = count + (int)(n_[i])
    if A<=count and B>=count:
        sum = sum + n
print(sum)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define inf (long long)1e16
#define fi first
#define se second
using namespace std;

struct data {
  long long p, c, r;
};

long long n, m, k = 1;
map<pair<long long, long long>, long long> mp;
vector<pair<long long, long long>> v[200005];
deque<data> dq;

long long solve();

int main() {
  cin >> n >> m;
  for(int i = 0; i < m; ++i) {
    long long a, b, c;
    cin >> a >> b >> c;
    v[--a].push_back({c, --b});
    v[b].push_back({c, a});
  }
  for(int i = 0; i < n; ++i) sort(v[i].begin(), v[i].end());
  cout << solve() << endl;
  return 0;
}

long long solve() {
  dq.push_back({0, 0, -1});
  mp[{0, -1}] = 0;
  while(dq.size() > 0) {
    data now = dq.front(), nextd;
    dq.pop_front();
    if(now.r == -1)
      for(auto it : v[now.p]) {
        nextd = now;
        nextd.p = it.se;
        nextd.r = it.fi;
        ++nextd.c;
        if(mp.find({nextd.p, nextd.r}) == mp.end() ||
           mp[{nextd.p, nextd.r}] > nextd.c) {
          mp[{nextd.p, nextd.r}] = nextd.c;
          dq.push_back(nextd);
        }
      }
    else {
      auto it =
          lower_bound(v[now.p].begin(), v[now.p].end(),
                      make_pair(now.r, -1LL));
      nextd = now;
      nextd.r = -1;
      if(mp.find({nextd.p, nextd.r}) == mp.end() ||
         mp[{nextd.p, nextd.r}] > nextd.c) {
        mp[{nextd.p, nextd.r}] = nextd.c;
        dq.push_front(nextd);
      }
      while(it != v[now.p].end() && (*it).fi == now.r) {
        nextd = now;
        nextd.p = (*it).se;
        ++it;
        if(mp.find({nextd.p, nextd.r}) == mp.end() ||
           mp[{nextd.p, nextd.r}] > nextd.c) {
          mp[{nextd.p, nextd.r}] = nextd.c;
          dq.push_front(nextd);
        }
      }
    }
  }
  if(mp.find({n - 1, -1}) == mp.end()) return -1;
  return mp[{n - 1, -1}] * k;
}


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

int main(){
  string S;
  cin >> S;
  string cs = S.substr(0,2);
  string ce = S.substr(2,2);
  int cns = stoi(cs);
  int cne = stoi(ce);
  if(1<=cns && cns<= 12){
    if(1<=cne && cne <=12){
      cout << "AMBIGUOUS";
    }else{
      cout << "MMYY";
    }
  }else{
    if(1<=cne && cne <=12){
      cout << "YYMM";
    }else{
      cout << "NA";
    }
  }
}

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

typedef long long ll;
using namespace std;
int main()
{

  string s;
  cin>>s;
  string ans="\0";
  rep(i,s.length()){
    if(s[i]=='0')ans.append("0");
    if(s[i]=='1')ans.append("1");
    if(s[i]=='B'&&ans.length()>0)ans.erase(ans.length()-1);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")  // disable
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define lll __int128
#define lp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define vec(v, type, sz) vector<type> v(sz)
#define in(v) \
    for (auto &i : v) cin >> i
#define all(v) v.begin(), v.end()
#define prv(v)                         \
    for (auto i : v) cout << i << " "; \
    cout << "\n"
#define MOD 1000000007
#define INF 1000000000
#define INFL 1000000000000000000ll
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define vii(v, n, m, val) vector<vector<int>> v(n, vector<int>(m, val))
#define viii(v, i, j, k, val)        \
    vector<vector<vector<int>>> v(i, \
                                  vector<vector<int>>(j, vector<int>(k, val)))
#define pii pair<int, int>
#define pb push_back
#define file_io                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define testcases \
    int tcc;      \
    cin >> tcc;   \
    for (int tc = 1; tc <= tcc; tc++)
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while (!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
    cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if (idx > 0)
        cerr << ", ";
    else
        cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss;
    ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef DB
#define debug(...) \
    debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
    fast_io;
    string s; cin>>s;
    if(s=="ARC") cout<<"ABC";
    else cout<<"ARC";
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
// clang-format off

using LL = long long;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
 
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
// clang-format on

void solve(long long N, long long A, long long B) {
  // solver code

  LL cnt = 0;

  cnt = N / (A + B);

  LL rem = min(N % (A + B), A);

  LL res = cnt * A + rem;

  cout << res << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(N, A, B);
  return 0;
}


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

using namespace std;

int main(){
    string a,b;
    cin >> a >> b;
    if (a.length() > b.length()){
        cout << "GREATER";
    }else if(a.length() < b.length()){
        cout << "LESS";
    }else if(a > b){
        cout << "GREATER";
    }else if(a < b){
        cout << "LESS";
    }else{
        cout << "EQUAL";
    }

return 0;
}








Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    ll a, b, c; cin >> a >> b >> c;
    ll d = c - a - b;
    if (d > 0 && d * d > 4 * a * b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using intl = long long;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)((n) - 1); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define debug(x) cout << #x << ":" << x << endl
const intl INF = 1e9;
const intl MOD = 1e9+7;
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
int main(){
    intl a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    intl b;
    cin >> b;
    cout << a[b-1] << endl;
    return 0;
}

Measured memory_bytes: 256
bingo = []
for i in range(3):
    bingo.append(list(map(int,input().split())))
n = int(input())
for i in range(n):
    num = int(input())
    for j in range(3):
        for k in range(3):
            if num == bingo[j][k]:
                bingo[j][k] = 0
for i in range(3):
    if bingo[i] == [0, 0, 0]:
        print("Yes")
        exit()
for i in range(3):
    cnt = 0
    for j in range(3):
        cnt += bingo[j][i]
    if cnt == 0:
        print("Yes")
        exit()
if bingo[0][0] == bingo[1][1] == bingo[2][2] == 0:
    print("Yes")
    exit()
if bingo[0][2] == bingo[1][1] == bingo[2][0] == 0:
    print("Yes")
    exit()
print("No")



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

int main() {
    int A,B,C,K;
    cin >> A >> B >> C;
    cin >> K;
    
    int count = 0;
    while ( B <= A ){
        B = B * 2;
        ++ count;
    }
    while ( C <= B ){
        C = C * 2;
        ++ count;
    }
    //cout << count << endl;
    if ( count <= K ){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3620
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define print_time cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x,int y)
{
    if(y==0)
	return x;
    else
	return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
	if(m%2)
	    r=(r*n)%p;
	n=(n*n)%p;
	m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;
 
    // This is checked so that we can skip 
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (int i=5; i*i<=n; i=i+6)
	if (n%i == 0 || n%(i+2) == 0)
	   return false;
 
    return true;
}
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
	if (i <= r)
	    z[i] = min (r - i + 1, z[i - l]);
	while (i + z[i] < n && s[z[i]] == s[i + z[i]])
	    ++z[i];
	if (i + z[i] - 1 > r)
	    l = i, r = i + z[i] - 1;
    }
    return z;
}
int32_t main()
{
   IOS;
  /* #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif
   /********************* Code starts here ***********************/     
   string s,t;
   cin>>s>>t;
   int n=s.size();
   for(int i=0;i<n;i++)
   {
   	if(s==t)
   	{
   		cout<<"Yes"<<endl;
   		return 0;
   	}
   	string a;
   	for(int j=i;j<n;j++)
   		a.pb(s[j]);
   	for(int j=0;j<i;j++)
   		a.pb(s[j]);
   	//cout<<a<<endl;
   	if(a==t)
   	{
   		cout<<"Yes"<<endl;
   		return 0;
   	}
   }
   cout<<"No"<<endl;
}      	


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define M 300010

int main(){
	IOS;
	ll n;cin>>n;
	ll z=n/100;
	n-=(100*z);
	bool f=0;
	vll v;
	rep(i1,0,100){
		rep(i2,0,100){
			rep(i3,0,100){
				rep(i4,0,100){
					ll t=(n-i1-2*i2-3*i3-4*i4),i5;
					if(t%5==0){
						i5=t/5;
						if(i1+i2+i3+i4+i5<=z)f=1;
						break;
					}
				}
			}
		}
	}
	cout<<f;
	
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S));
    }

    private static int solve(String S) {
        int ans = S.length();

        for (int c=0; c<26; c++) {
            char ch = (char)('a'+c);
            if (S.indexOf(String.valueOf(ch)) == -1) continue;

            int longest = 0;
            int idx = -1;
            for (int i=0; i<S.length(); i++) {
                if (S.charAt(i) == ch) {
                    // System.err.println("found at " + i + " val=" + (i-idx-1));
                    longest = Math.max(longest, i - idx - 1);
                    idx = i;
                }
            }
            // System.err.println(ch + " length:" + longest + ", idx=" + idx);
            ans = Math.min(ans, Math.max(longest, S.length()-idx-1));
        }

        return ans;
    }
}

Measured memory_bytes: 21844
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,n = map(int, input().split())
a = [None]*n
b = [None]*n
for i in range(n):
    a[i], b[i] = map(int, input().split())
    
dp = [float("inf")]*(h+1)
dp[0] = 0
for i in range(n):
    for j in range(1,h+1):
        dp[j] = min(dp[j], dp[max(0, j-a[i])] + b[i])
print(dp[h])

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

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
    long long a, b;
    cin >> a >> b;
    long long x = euclidean_gcd(b, a);
    long long ans = 0;
    ans = (a * b) / x;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
#include <map>
#include <numeric>
#include <string>
#include <queue>
using namespace std;
typedef long long int ll;

bool can[101][101];

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

int num[6][2][4]=
{{{2,5,4,3},{5,2,3,4}},
{{1,6,3,4},{6,1,4,3}},
{{2,5,1,6},{5,2,6,1}},
{{2,5,6,1},{5,2,1,6}},
{{1,6,4,3},{6,1,3,4}},
{{2,5,3,4},{5,2,4,3}}
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w; cin >> h >> w;
    char fi[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> fi[i][j];
        }
    }
    can[0][0]=1;
    queue<pair<pair<int,int>,pair<int,int>>> q;
    q.push(make_pair(make_pair(0,0),make_pair(6,0)));
    while(q.size()){
        auto p=q.front(); q.pop();
        int x=p.first.first,y=p.first.second;
        for(int i=0;i<4;i++){
            int nx=dx[i]+x,ny=dy[i]+y;
            if(0<=nx&&nx<h&&0<=ny&&ny<w){
                if(can[nx][ny])continue;
                if(fi[nx][ny]=='#')continue;
                if(fi[nx][ny]-'0'!=num[p.second.first-1][p.second.second][i])continue;
                can[nx][ny]=1;
                int v=fi[x][y]-'0';
                int w=fi[nx][ny]-'0';
                int t=0;
                if(i==0||i==1){
                    if(v>=4&&i==1)t=1;
                    if(v<=3&&i==0)t=1;
                }
                else{
                    if(num[p.second.first-1][p.second.second][0]>=4)t=1;
                }
                q.push(make_pair(make_pair(nx,ny),make_pair(fi[nx][ny]-'0',t)));
            }
        }
    }
    if(can[h-1][w-1]){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}



Measured memory_bytes: 3236
#include <stdio.h>
#include <string.h>
int main(){
	int i, len;
	char s[101];
	char check[27]={0};
	scanf("%s", s);
	len=strlen(s);
	for(i=0; i<len; i++){
		check[s[i]-97]++;
	}
	for(i=0; i<27; i++){
		if(check[i]%2!=0) break;
	}
	if(i==27) printf("Yes\n");
	else printf("No\n");  
	return 0;	
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define for(i,a,b) for(int i=a;i<=b;i++)
#define _inline __inline__ __attribute__((always_inline))
#define ll long long
using namespace std;
_inline void read(int &x){
	int res=0,f=1;
	char c=getchar();
	if(c=='-') f=-1;
	while(c>'9'||c<'0') c=getchar();
	while(c>='0'&&c<='9'){
		res=res*10+c-'0';
		c=getchar();
	}
	x=res*f;
}
inline void print(ll x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) print(x/10);
    putchar(x%10+'0');
}
int n;
ll f[400];
int main(){
    read(n);
    f[0]=2;
    for(i,1,n) f[i]=f[i-1]*2+2;
    print(f[n]),puts("");
    exit(0);
}

Measured memory_bytes: 256
A,B,C,X=[int(input()) for i in range(4)]
cnt = 0
for a in range(0,A+1):
    Y = X - 500*a
    if Y==0:
        cnt += 1
        continue
    elif Y<0:
        continue
    for b in range(0,B+1):
        Z = Y - 100*b
        if Z==0:
            cnt += 1
            continue
        elif Z<0:
            continue
        for c in range(0,C+1):
            W = Z - 50*c
            if W == 0:
                cnt += 1
print(cnt)

Measured memory_bytes: 3064
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int a, b, c; cin >> a >> b >> c;
	if(a+b+c >= 22) println("bust");
	else println("win");
}


Measured memory_bytes: 256
n=str(input())
if int(n[0:4])>2019:
    print("TBD")
elif int(n[0:4])<2019:
    print("Heisei")
elif int(n[0:4])==2019:
    if int(n[5:7])>4:
        print("TBD")
    elif int(n[5:7])<=4:
        print("Heisei")

Measured memory_bytes: 3064
#include <stdio.h>
#include <vector>
#include <functional>
#include <algorithm>
#include <set>
using namespace std;

const int N = 1e5 + 10;

int degree[N], c[N], ans[N];
vector<pair<int, int>> e;
multiset<pair<int, int>> d;
vector<int> g[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--; v--;
    degree[u]++;
    degree[v]++;
    g[u].push_back(v);
    g[v].push_back(u);
    e.push_back(make_pair(u, v));
  }
  for (int i = 0; i < n; i++) {
    d.insert(make_pair(degree[i], i));
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", c + i);
  }
  sort(c, c + n);
  int p = 0;
  while (!d.empty()) {
    int u = (d.begin())->second;
    degree[u]--;
    ans[u] = c[p];
    p++;
    d.erase(d.begin());
    for (int v : g[u]) {
      if (degree[v] > 0) {
        d.erase(d.find(make_pair(degree[v], v)));
        degree[v]--;
        if (degree[v] > 0) {
          d.insert(make_pair(degree[v], v));
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (ans[i] == 0) {
      ans[i] = *max_element(c, c + n);
    }
  }
  long long sum = 0;
  for (int i = 0; i < n - 1; i++) {
    sum += min(ans[e[i].first], ans[e[i].second]);
  }
  printf("%lld\n", sum);
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      printf(" ");
    }
    printf("%d", ans[i]);
  }
  puts("");
  return 0;
}

Measured memory_bytes: 3712
from collections import deque
n,k = map(int,input().split())
sl = list(input())

d = deque([])
ans = 0
before = "1"
tmp = 0
p = 0
for s in sl:
    if before == s:
        p += 1
    else:
        d.append(p)
        tmp += p
        p = 1
        before = s
    if len(d) == 2 * k + 1:
        ans = max(tmp, ans)
        tmp -= d.popleft()
        tmp -= d.popleft()
else:
    d.append(p)
    tmp += p
    ans = max(tmp, ans)

print(ans)

Measured memory_bytes: 49648
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define ld long double
 
const int MOD = 1e9 + 7;
#define INF 2e9
 
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)
 
#define MATCH(_str, _ptn) regex_match(_str, regex(_ptn))
#define REPLACE(_str, _ptn, _replacement) regex_replace(_str, regex(_ptn), _replacement)
 
# define pb push_back
 
# define INIT() cin.tie(0); ios::sync_with_stdio(false); cout << fixed << std::setprecision(20)
 
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; }
 
string s;
int main() {
    INIT();
    cin >> s;
    s = REPLACE(s, "P\\?", "PD");
    s = REPLACE(s, "\\?D", "PD");
    s = REPLACE(s, "\\?", "D");
    cout << s;
    return 0;
}

Measured memory_bytes: 4176
#include<bits/stdc++.h>
int main() {
	int i,n,m;
	scanf("%d%d",&n,&m);
//	printf("%d\n",1.*n/(m*2+1));
	printf("%d\n",(int)floor(1.*n/(m*2+1)+0.999999));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string str;
  cin>>str;
  if(str=="MON")
    cout<<6<<endl;
  else if(str=="TUE")
    cout<<5<<endl;
  else if(str=="WED")
    cout<<4<<endl;
  else if(str=="THU")
    cout<<3<<endl;
  else if(str=="FRI")
    cout<<2<<endl;
  else if(str=="SAT")
    cout<<1<<endl;
  else
    cout<<7<<endl;
  return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;

void main()
{
    auto abk = readln.split.to!(int[]);
    auto A = abk[0];
    auto B = abk[1];
    auto K = abk[2];

    foreach (i; 0..K) {
        if (i%2 == 0) {
            A /= 2;
            B += A;
        } else {
            B /= 2;
            A += B;
        }
    }
    writefln("%d %d", A, B);
}

Measured memory_bytes: 256
import qualified Data.Map as M
import Control.Monad.Trans.State

data Acc = Acc
  { mpxy :: M.Map Char Char
  , mpyx :: M.Map Char Char
  , strx :: String
  , stry :: String
  }

main :: IO ()
main = do
    s <- getLine
    t <- getLine
    putStrLn $ if solve s t then "Yes" else "No"

solve :: String -> String -> Bool
solve s t = evalState nullCheckStep $ Acc M.empty M.empty s t
  where
    nullCheckStep = do
      Acc _ _ strx stry <- get
      if null strx && null stry
        then return True
        else dupCheckStep

    dupCheckStep = do
      Acc mpxy mpyx (x:_) (y:_) <- get
      if duplicated x y mpxy || duplicated y x mpyx
        then return False
        else insertStep

    insertStep = do
      Acc mpxy mpyx (x:xs) (y:ys) <- get
      put $ Acc (M.insert x y mpxy) (M.insert y x mpyx) xs ys
      nullCheckStep

    duplicated k v mp = maybe False (/= v) $ M.lookup k mp

Measured memory_bytes: 18812
tmpn,k=map(int,input().split())
a=[int(input()) for _ in range(tmpn)]
n=3*10**5+1

def init_max(init_max_val):
    #set_val
    for i in range(n):
        seg_max[i+num_max-1]=init_max_val[i]    
    #built
    for i in range(num_max-2,-1,-1) :
        seg_max[i]=max(seg_max[2*i+1],seg_max[2*i+2]) 
    
def update_max(k,x):
    k += num_max-1
    seg_max[k] = x
    while k:
        k = (k-1)//2
        seg_max[k] = max(seg_max[k*2+1],seg_max[k*2+2])
    
def query_max(p,q):
    if q<=p:
        return ide_ele_max
    p += num_max-1
    q += num_max-2
    res=ide_ele_max
    while q-p>1:
        if p&1 == 0:
            res = max(res,seg_max[p])
        if q&1 == 1:
            res = max(res,seg_max[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = max(res,seg_max[p])
    else:
        res = max(max(res,seg_max[p]),seg_max[q])
    return res

#####単位元######
ide_ele_max = 0

#num_max:n以上の最小の2のべき乗
num_max =2**(n-1).bit_length()
seg_max=[ide_ele_max]*2*num_max

init_max([0]*n)

for aa in a:
    maxlen=query_max(max(0,aa-k),min(aa+k,n-1)+1)
    update_max(aa,maxlen+1)

print(query_max(0,n+1))

Measured memory_bytes: 139996
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define eps 1e-9
#define oo 1e7+5

using namespace std;

typedef unsigned long long ull;
typedef vector<pair<int,pair<int,int>>> dirgraph;
typedef vector<vector<int>> graph;

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	
	int n,l;
	cin>>n>>l;
	//n=p1+p2;
	int p1=2*n - l/2;
	if(p1>n || p1< 0 || l%2 || n > l)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 3640
#include <cstdio>

int out(int A, int B, int C){
    if(A==B) return C;
    else if(A==C) return B;
    else return A;
}

int main(){
    int A, B, C;
    scanf("%d%d%d", &A, &B, &C);
    printf("%d\n", out(A,B,C));
    return 0;
}

Measured memory_bytes: 128
#include  <bits/stdc++.h>
using namespace std;
const int M=1e5+10;
int a[M];
int main()
{
    int n,c,k;
    while(scanf("%d%d%d",&n,&c,&k)!=EOF){
        for(int i=0;i<n;++i)scanf("%d",&a[i]);
        sort(a,a+n);
        int cnt=1,t=c-1,p=a[0];
        for(int i=1;i<n;++i)
        {
            if(a[i]<=p+k&&t)
                t--;
            else
            {
                t=c-1;
                p=a[i];
                cnt++;//cout<<p<<' '<<cnt<<endl;
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Card Game for Two
            int n = int.Parse(Console.ReadLine());
            var a = ReadLine().OrderByDescending(x => x).ToList();

            int alice = 0;
            int bob = 0;

            for(int i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                {
                    alice += a[i];
                }
                else
                {
                    bob += a[i];
                }
            }

            Console.WriteLine(alice - bob);            
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<vector>
//#include<algorithm>

const static int MAX = 1001;
std::string X, Y;
int LCS[MAX][MAX];

int main(void){
    int q, x_size, y_size;
    std::cin >> q;
    for(int i = 0; i < q; i++){
	std::cin >> X >> Y;
	LCS[0][0] = 0;
	LCS[0][1] = 0;
	LCS[1][0] = 0;
	x_size = X.size();
	y_size = Y.size();
	for(int j = 0; j < X.size(); j++){
	    for(int k = 0; k < Y.size(); k++){
		if(X[j] == Y[k]){
		    LCS[j+1][k+1] = LCS[j][k] + 1;
		}else if(X[j] != Y[k]){
		    LCS[j+1][k+1] = std::max(LCS[j][k+1], LCS[j+1][k]);
		}
	    }
	}
	std::cout << LCS[x_size][y_size] << std::endl;
    }

    return 0;
}



Measured memory_bytes: 7000
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int tmp=0;
		cin>>tmp;
		if(tmp%2==0&&(tmp%5!=0&&tmp%3!=0)){
			cout<<"DENIED\n";
			return 0;
		}
	}
	cout<<"APPROVED";
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var H int
	var N int
	var buf int
	sm := 0

	fmt.Scan(&H)
	fmt.Scan(&N)
	for i := 0; i < N; i++ {
		fmt.Scan(&buf)
		sm += buf
	}
	if sm >= H {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 6320
class UnionFind():
    n=1
    par=[0]
    rnk=[0]
    def __init__(self,size):
        self.n=size
        self.par=[i for i in range(self.n)]
        self.rnk=[0 for i in range(self.n)]
    def find(self,vertex1):
        if self.par[vertex1]==vertex1:
            return vertex1
        else:
            self.par[vertex1]=self.find(self.par[vertex1])
            return self.par[vertex1]
    def unite(self,vertex1,vertex2):
        vertex1=self.find(vertex1)
        vertex2=self.find(vertex2)
        if vertex1==vertex2:
            return
        if (self.rnk[vertex1]<self.rnk[vertex2]):
            self.par[vertex1]=vertex2
        else:
            self.par[vertex2]=vertex1
            if(self.rnk[vertex1]==self.rnk[vertex2]):
                self.rnk[vertex1]+=1
    def same(self,vetrex1,vertex2):
        return self.find(vetrex1)==self.find(vertex2)

N,M=map(int,input().split())
G=UnionFind(N)
for i in range(M):
    a,b=map(int,input().split())
    G.unite(a-1,b-1)

X=[G.find(i) for i in range(N)]
print(len(set(X))-1)


Measured memory_bytes: 86788
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  string s, t;
  int a, b;
  string u;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;

  if (s == u) a--;
  else b--;
  cout << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
ans = []
cnt = 0
for i in range(1, int(n**0.7)+3):
    if n > cnt:
        ans.append(i)
        cnt += i
    else:
        if cnt - n in ans:
            ans.remove(cnt - n)
        break
for i in ans:
    print(i)

Measured memory_bytes: 9644
n=int(input())
p=list(map(int,input().split()))
ans=0
for x in range(n-2):
  if (p[x]>=p[x+1] and p[x+1]>=p[x+2]) or (p[x]<=p[x+1] and p[x+1]<=p[x+2]):
    ans+=1
print(ans)

Measured memory_bytes: 9196
#include <cmath>
#include <iostream>
#include <vector>

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

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

	cout << ceil((a + b) / 2.0) << endl;

	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> h(100000);
  int dp[100000];
  
  REP(i,n){
    cin >> h[i];
    dp[i] = 0;
  }
  dp[0] = 0;
  dp[1] = abs(h[0]-h[1]);
  dp[2] = abs(h[0]-h[2]);
    for (int i = 3; i < (n); ++i){
      if( (dp[i-1]+abs(h[i-1]-h[i])) >= (dp[i-2]+abs(h[i]-h[i-2])) ){
        dp[i] = (dp[i-2]+abs(h[i]-h[i-2]));
      }
      else{
        dp[i] = (dp[i-1]+abs(h[i-1]-h[i]));
      }
    }
  
  
  cout << dp[n-1] << endl;
}


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

int main(){
	int a,b,c,buf;
	cin >> a >> b >> c;
	if(a>b){
		buf=a;
		a=b;
		b=buf;
	}
	if(b>c){
		buf=b;
		b=c;
		c=buf;
	}
	if(a>b){
		buf=a;
		a=b;
		b=buf;
	}
	cout << a << " "<< b << " " << c << endl;
	
	return 0;
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, k;
  string s;
  cin >> n >> k >> s;
  
  vector<int> x;
  int count = 1;
  for (int i = 1; i < n; i++) {
    if (s.at(i - 1) == s.at(i)) count++;
    else {
      x.emplace_back(count);
      count = 1;
    }
  }
  x.emplace_back(count);
  
  int ans = 0;
  if (s.at(0) == '0') {
    if ((x.size() + 1) / 2 <= k) {
      cout << n << '\n';
      return 0;
    }
    int ans = 0;
    int left = 0, count = 0, sum = 0;
    for (int right = 0; right < x.size(); right++) {
      sum += x.at(right);
      if (right % 2 == 0) count++;
      if (count > k) {
        if (left == 0) {
          sum -= x.at(left);
          left++;
          count--;
        }
        else {
          sum -= x.at(left) + x.at(left + 1);
          left += 2;
          count--;
        }
      }
      ans = max(ans, sum);
    }
    cout << ans << '\n';
  }
  else {
    if (x.size() / 2 <= k) {
      cout << n << '\n';
      return 0;
    }
    int ans = 0;
    int left = 0, count = 0, sum = 0;
    for (int right = 0; right < x.size(); right++) {
      sum += x.at(right);
      if (right % 2 == 1) count++;
      if (count > k) {
        sum -= x.at(left) + x.at(left + 1);
        left += 2;
        count--;
      }
      ans = max(ans, sum);
    }
    cout << ans << '\n';
  }
}

Measured memory_bytes: 1020
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Control.Arrow
import Data.Ord


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine



main :: IO ()
main = do
    [n,a,b] <- r'
    print $ (n `div` (a+b)) * a + min a (n `mod` (a+b))



Measured memory_bytes: 380
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6;
const LL mod = 1000000007ll;
 
LL H,W;
 
LL ans = 0;
 
void solve(){
	if(H==1 || W==1){
		ans = 1;
		return;
	}
	ans = (H*W + (H*W)%2)/2;
}
 
int main(){
	cin >> H >> W;
 
	solve();
 
	cout << ans << endl;
	return 0;
}

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

namespace APC001
{
    class B
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long[] b = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long res = 0;
            for (long i = 0; i < N; i++)
            {
                res += Math.Max(0, (b[i] - a[i]) / 2) - Math.Max(0, a[i] - b[i]);
            }
            if (0 <= res) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 15584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const int INF = 1<<30;

int main(){
    int n, m;
    cin >> n >> m;
    VP s(m);
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        s[i].first = b;
        s[i].second = a;
    }
    sort(all(s));
    int x = -INF, ans = 0;
    rep(i,m){
        if (s[i].second <= x) continue;
        x = s[i].first - 1;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main(){
  int n,l;cin>>n>>l;string s[100];rep(i,n)cin>>s[i];
  sort(s,s+n);
  rep(i,n)cout << s[i];
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
ll exp(int a, int x){
    if (x == 0) return 1;
    ll p = exp(a,x/2);
    p *= p;
    p %= mod;
    if (x & 1){
        p *= a;
        p %= mod;
    }
    return p;
}
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int inv[n+1];
    for (int i = 1; i < n; i++){
        inv[i] = (int)exp(i,mod-2);
    }
    int a[n];
    for (int i = 0; i < n; i++){
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    ll ct = 1;
    for (int i = 1; i < k; i++){
        ct *= (n-i);
        ct %= mod;
        ct *= inv[i];
        ct %= mod;
    }
    ll ans = 0;
    for (int i = n-1; i >= 0; i--){
        ans += ct*a[i];
        ans %= mod;
        ct *= inv[i]; ct %= mod;
        ct *= i-k+1; ct %= mod;
    }
    sort(a,a+n,greater<int>());
    ct = 1;
    for (int i = 1; i < k; i++){
        ct *= (n-i);
        ct %= mod;
        ct *= inv[i];
        ct %= mod;
    }
    for (int i = n-1; i >= 0; i--){
        ans -= ct*a[i];
        ans %= mod;
        ct *= inv[i]; ct %= mod;
        ct *= i-k+1; ct %= mod;
    }
    printf("%lld",(ans+mod)%mod);
}


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

int main(void) {
    int a, b, c, d;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cout << min(a, b) + min(c, d) << "\n";
    return 0;
}

Measured memory_bytes: 256